253d110dba
target/ppc: Use tcg_gen_negsetcond_*
...
Tested-by: Nicholas Piggin <npiggin@gmail.com >
Reviewed-by: Nicholas Piggin <npiggin@gmail.com >
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2023-08-24 11:22:42 -07:00
cfe158875b
target/openrisc: Use tcg_gen_negsetcond_*
...
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Reviewed-by: Peter Maydell <peter.maydell@linaro.org >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2023-08-24 11:22:42 -07:00
27f9af76e1
target/m68k: Use tcg_gen_negsetcond_*
...
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Reviewed-by: Peter Maydell <peter.maydell@linaro.org >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2023-08-24 11:22:42 -07:00
a126425990
target/arm: Use tcg_gen_negsetcond_*
...
Reviewed-by: Peter Maydell <peter.maydell@linaro.org >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2023-08-24 11:22:42 -07:00
d55a3211e2
target/alpha: Use tcg_gen_movcond_i64 in gen_fold_mzero
...
The setcond + neg + and sequence is a complex method of
performing a conditional move.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2023-08-24 11:22:42 -07:00
4a88387056
tcg: Use tcg_gen_negsetcond_*
...
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Reviewed-by: Peter Maydell <peter.maydell@linaro.org >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2023-08-24 11:22:42 -07:00
3635502dd0
tcg: Introduce negsetcond opcodes
...
Introduce a new opcode for negative setcond.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2023-08-24 11:22:42 -07:00
13d885b0ad
tcg: Unify TCG_TARGET_HAS_extr[lh]_i64_i32
...
Replace the separate defines with TCG_TARGET_HAS_extr_i64_i32,
so that the two parts of backend-specific type changing cannot
be out of sync.
Reported-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
Message-id: <20230822175127.1173698-1-richard.henderson@linaro.org >
2023-08-24 11:22:42 -07:00
bb9d7ee83e
docs/devel/tcg-ops: Bury mentions of trunc_shr_i64_i32()
...
Commit 609ad70562
("tcg: Split trunc_shr_i32 opcode into
extr[lh]_i64_i32") remove trunc_shr_i64_i32(). Update the
backend documentation.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Message-Id: <20230822162847.71206-1-philmd@linaro.org >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2023-08-24 11:22:42 -07:00
73f97f0aa3
tcg/i386: Allow immediate as input to deposit_*
...
We can use MOVB and MOVW with an immediate just as easily
as with a register input.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2023-08-24 11:22:42 -07:00
8f7a840d7d
tcg: Fold deposit with zero to and
...
Inserting a zero into a value, or inserting a value
into zero at offset 0 may be implemented with AND.
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Reviewed-by: Peter Maydell <peter.maydell@linaro.org >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2023-08-24 11:22:42 -07:00
36df88c040
tcg/i386: Drop BYTEH deposits for 64-bit
...
It is more useful to allow low-part deposits into all registers
than to restrict allocation for high-byte deposits.
Reviewed-by: Peter Maydell <peter.maydell@linaro.org >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2023-08-24 11:22:42 -07:00
64919f710f
target/m68k: Use tcg_gen_deposit_i32 in gen_partset_reg
...
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2023-08-24 11:22:42 -07:00
e79f81421b
accel/tcg: Update run_on_cpu_data static assert
...
As we are now using vaddr for representing guest addresses, update the
static assert to check that vaddr fits in the run_on_cpu_data union.
Signed-off-by: Anton Johansson <anjo@rev.ng >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Message-Id: <20230807155706.9580-10-anjo@rev.ng >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2023-08-24 11:22:38 -07:00
d712b11638
accel/tcg: Widen address arg in tlb_compare_set()
...
Signed-off-by: Anton Johansson <anjo@rev.ng >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Message-Id: <20230807155706.9580-9-anjo@rev.ng >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2023-08-24 11:22:30 -07:00
c78edb5639
include/exec: Widen tlb_hit/tlb_hit_page()
...
tlb_addr is changed from target_ulong to uint64_t to match the type of
a CPUTLBEntry value, and the addressed is changed to vaddr.
Signed-off-by: Anton Johansson <anjo@rev.ng >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Message-Id: <20230807155706.9580-8-anjo@rev.ng >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2023-08-24 11:22:23 -07:00
fc15bfb6a6
include/exec: typedef abi_ptr to vaddr in softmmu
...
In system mode, abi_ptr is primarily used for representing addresses
when accessing guest memory with cpu_[st|ld]*(). Widening it from
target_ulong to vaddr reduces the target dependence of these functions
and is step towards building accel/ once for system mode.
Signed-off-by: Anton Johansson <anjo@rev.ng >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Message-Id: <20230807155706.9580-7-anjo@rev.ng >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2023-08-24 11:21:51 -07:00
022b9bcede
include/exec: Replace target_ulong with abi_ptr in cpu_[st|ld]*()
...
Changes the address type of the guest memory read/write functions from
target_ulong to abi_ptr. (abi_ptr is currently typedef'd to target_ulong
but that will change in a following commit.) This will reduce the
coupling between accel/ and target/.
Note: Function pointers that point to cpu_[st|ld]*() in target/riscv and
target/rx are also updated in this commit.
Signed-off-by: Anton Johansson <anjo@rev.ng >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Message-Id: <20230807155706.9580-6-anjo@rev.ng >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2023-08-24 11:21:46 -07:00
d447a624d0
sysemu/hvf: Use vaddr for hvf_arch_[insert|remove]_hw_breakpoint
...
Changes the signature of the target-defined functions for
inserting/removing hvf hw breakpoints. The address and length arguments
are now of vaddr type, which both matches the type used internally in
accel/hvf/hvf-all.c and makes the api target-agnostic.
Signed-off-by: Anton Johansson <anjo@rev.ng >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Message-Id: <20230807155706.9580-5-anjo@rev.ng >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2023-08-24 11:21:40 -07:00
b8a6eb1862
sysemu/kvm: Use vaddr for kvm_arch_[insert|remove]_hw_breakpoint
...
Changes the signature of the target-defined functions for
inserting/removing kvm hw breakpoints. The address and length arguments
are now of vaddr type, which both matches the type used internally in
accel/kvm/kvm-all.c and makes the api target-agnostic.
Signed-off-by: Anton Johansson <anjo@rev.ng >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Message-Id: <20230807155706.9580-4-anjo@rev.ng >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2023-08-24 11:21:35 -07:00
fcfe761680
accel/hvf: Widen pc/saved_insn for hvf_sw_breakpoint
...
Widens the pc and saved_insn fields of hvf_sw_breakpoint from
target_ulong to vaddr. Other hvf_* functions accessing hvf_sw_breakpoint
are also widened to match.
Signed-off-by: Anton Johansson <anjo@rev.ng >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Message-Id: <20230807155706.9580-3-anjo@rev.ng >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2023-08-24 11:21:29 -07:00
b67be03e3a
accel/kvm: Widen pc/saved_insn for kvm_sw_breakpoint
...
Widens the pc and saved_insn fields of kvm_sw_breakpoint from
target_ulong to vaddr. The pc argument of kvm_find_sw_breakpoint is also
widened to match.
Signed-off-by: Anton Johansson <anjo@rev.ng >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Message-Id: <20230807155706.9580-2-anjo@rev.ng >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2023-08-24 11:21:22 -07:00
50e7a40af3
Merge tag 'pull-target-arm-20230824' of https://git.linaro.org/people/pmaydell/qemu-arm into staging
...
target-arm queue:
* hw/gpio/nrf51: implement DETECT signal
* accel/kvm: Specify default IPA size for arm64
* ptw: refactor, fix some FEAT_RME bugs
* target/arm: Adjust PAR_EL1.SH for Device and Normal-NC memory types
* target/arm/helper: Implement CNTHCTL_EL2.CNT[VP]MASK
* Fix SME ST1Q
* Fix 64-bit SSRA
# -----BEGIN PGP SIGNATURE-----
#
# iQJNBAABCAA3FiEE4aXFk81BneKOgxXPPCUl7RQ2DN4FAmTnIoUZHHBldGVyLm1h
# eWRlbGxAbGluYXJvLm9yZwAKCRA8JSXtFDYM3vufEACPJcwyFvSBHDv4VQ6tbgOU
# zwjpUMv4RMKhCOjuxBlJ2DICwOcGNuKer0tc6wkH2T5Ebhoego1osYbRZZoawAJf
# ntg+Ndrx1QH9ORuGqYccLXtHnP741KiKggDHM05BJqB7rqtuH+N4fEn7Cdsw/DNg
# XuCYD5QrxMYvkSOD1l8W0aqp81ucYPgkFqLufypgxrXUiRZ1RBAmPF47BFFdnM8f
# NmrmT1LTF5jr70ySRB+ukK6BAGDc0CUfs6R6nYRwUjRPmSG2rrtUDGo+nOQGDqJo
# PHWmt7rdZQG2w7HVyE/yc3h/CQ3NciwWKbCkRlaoujxHx/B6DRynSeO3NXsP8ELu
# Gizoi3ltwHDQVIGQA19P5phZKHZf7x3MXmK4fDBGB9znvoSFTcjJqkdaN/ARXXO3
# e1vnK1MqnPI8Z1nGdeVIAUIrqhtLHnrrM7jf1tI/e4sjpl3prHq2PvQkakXu8clr
# H8bPZ9zZzyrrSbl4NhpaFTsUiYVxeLoJsNKAmG8dHb+9YsFGXTvEBhtR9eUxnbaV
# XyZ3jEdeW7/ngQ4C6XMD2ZDiKVdx2xJ2Pp5npvljldjmtGUvwQabKo+fPDt2fKjM
# BwjhHA50I633k4fYIwm8YOb70I4oxoL9Lr6PkKriWPMTI5r7+dtwgigREVwnCn+Y
# RsiByKMkDO2TcoQjvBZlCA==
# =3MJ8
# -----END PGP SIGNATURE-----
# gpg: Signature made Thu 24 Aug 2023 05:27:33 EDT
# gpg: using RSA key E1A5C593CD419DE28E8315CF3C2525ED14360CDE
# gpg: issuer "peter.maydell@linaro.org "
# gpg: Good signature from "Peter Maydell <peter.maydell@linaro.org >" [full]
# gpg: aka "Peter Maydell <pmaydell@gmail.com >" [full]
# gpg: aka "Peter Maydell <pmaydell@chiark.greenend.org.uk >" [full]
# gpg: aka "Peter Maydell <peter@archaic.org.uk >" [unknown]
# Primary key fingerprint: E1A5 C593 CD41 9DE2 8E83 15CF 3C25 25ED 1436 0CDE
* tag 'pull-target-arm-20230824' of https://git.linaro.org/people/pmaydell/qemu-arm : (35 commits)
target/arm: Fix 64-bit SSRA
target/arm: Fix SME ST1Q
target/arm/helper: Implement CNTHCTL_EL2.CNT[VP]MASK
target/arm/helper: Check SCR_EL3.{NSE, NS} encoding for AT instructions
target/arm: Pass security space rather than flag for AT instructions
target/arm: Skip granule protection checks for AT instructions
target/arm/helper: Fix tlbmask and tlbbits for TLBI VAE2*
target/arm/ptw: Load stage-2 tables from realm physical space
target/arm: Adjust PAR_EL1.SH for Device and Normal-NC memory types
target/arm/ptw: Report stage 2 fault level for stage 2 faults on stage 1 ptw
target/arm/ptw: Check for block descriptors at invalid levels
target/arm/ptw: Set attributes correctly for MMU disabled data accesses
target/arm/ptw: Drop S1Translate::out_secure
target/arm/ptw: Remove S1Translate::in_secure
target/arm/ptw: Remove last uses of ptw->in_secure
target/arm/ptw: Only fold in NSTable bit effects in Secure state
target/arm: Pass an ARMSecuritySpace to arm_is_el2_enabled_secstate()
target/arm/ptw: Pass an ARMSecuritySpace to arm_hcr_el2_eff_secstate()
target/arm/ptw: Pass ARMSecurityState to regime_translation_disabled()
target/arm/ptw: Pass ptw into get_phys_addr_pmsa*() and get_phys_addr_disabled()
...
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com >
2023-08-24 10:08:33 -04:00
6030ef9d41
Merge tag 'pull-loongarch-20230824' of https://gitlab.com/gaosong/qemu into staging
...
pull-loongarch-20230824
# -----BEGIN PGP SIGNATURE-----
#
# iLMEAAEIAB0WIQS4/x2g0v3LLaCcbCxAov/yOSY+3wUCZOcdAwAKCRBAov/yOSY+
# 3w3CA/sH8+Ay+Qnaqa2vEyuhOlFQuxHKeR7mYfsitAdzh8yMK2K8C2iBUzDzL1H3
# kZmZbCcYX7ko9RLhsuXmvfBJ7iwzY55ozSHLIjJ/VS4JVE5B0cUSZ5jjIPDqpzDs
# 7TUt9qpTkwg0e+klzVREWLSWP5xopvkRvFHZM3KZZhGMphOTUQ==
# =/HHZ
# -----END PGP SIGNATURE-----
# gpg: Signature made Thu 24 Aug 2023 05:04:03 EDT
# gpg: using RSA key B8FF1DA0D2FDCB2DA09C6C2C40A2FFF239263EDF
# gpg: Good signature from "Song Gao <m17746591750@163.com >" [unknown]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg: There is no indication that the signature belongs to the owner.
# Primary key fingerprint: B8FF 1DA0 D2FD CB2D A09C 6C2C 40A2 FFF2 3926 3EDF
* tag 'pull-loongarch-20230824' of https://gitlab.com/gaosong/qemu : (31 commits)
hw/loongarch: Fix ACPI processor id off-by-one error
target/loongarch: Split fcc register to fcc0-7 in gdbstub
hw/intc/loongarch_pch: fix edge triggered irq handling
target/loongarch: cpu: Implement get_arch_id callback
target/loongarch: Add avail_IOCSR to check iocsr instructions
target/loongarch: Add avail_LSX to check LSX instructions
target/loongarch: Add avail_LAM to check atomic instructions
target/loongarch: Add avail_LSPW to check LSPW instructions
target/loongarch: Add avail_FP/FP_SP/FP_DP to check fpu instructions
hw/loongarch: Remove restriction of la464 cores in the virt machine
target/loongarch: Add LoongArch32 cpu la132
target/loongarch: Add avail_64 to check la64-only instructions
target/loongarch: Add a check parameter to the TRANS macro
target/loongarch: Sign extend results in VA32 mode
target/loongarch: Truncate high 32 bits of address in VA32 mode
target/loongarch: Extract set_pc() helper
target/loongarch: Extract make_address_pc() helper
target/loongarch: Extract make_address_i() helper
target/loongarch: Extract make_address_x() helper
target/loongarch: Add LA64 & VA32 to DisasContext
...
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com >
2023-08-24 09:17:05 -04:00
3f6bec4a9f
hw/loongarch: Fix ACPI processor id off-by-one error
...
In hw/acpi/aml-build.c:build_pptt() function, the code assumes that the
ACPI processor id equals to the cpu index, for example if we have 8
cpus, then the ACPI processor id should be in range 0-7.
However, in hw/loongarch/acpi-build.c:build_madt() function we broke the
assumption. If we have 8 cpus again, the ACPI processor id in MADT table
would be in range 1-8. It violates the following description taken from
ACPI spec 6.4 table 5.138:
If the processor structure represents an actual processor, this field
must match the value of ACPI processor ID field in the processor’s entry
in the MADT.
It will break the latest Linux 6.5-rc6 with the
following error message:
ACPI PPTT: PPTT table found, but unable to locate core 7 (8)
Invalid BIOS PPTT
Here 7 is the last cpu index, 8 is the ACPI processor id learned from
MADT.
With this patch, Linux can properly detect SMT threads when "-smp
8,sockets=1,cores=4,threads=2" is passed:
Thread(s) per core: 2
Core(s) per socket: 2
Socket(s): 2
The detection of number of sockets is still wrong, but that is out of
scope of the commit.
Signed-off-by: Jiajie Chen <c@jia.je >
Reviewed-by: Bibo Mao <maobibo@loongson.cn >
Message-Id: <20230820105658.99123-2-c@jia.je >
Signed-off-by: Song Gao <gaosong@loongson.cn >
2023-08-24 16:58:16 +08:00
17ffe331a9
target/loongarch: Split fcc register to fcc0-7 in gdbstub
...
Since GDB 13.1(GDB commit ea3352172), GDB LoongArch changed to use
fcc0-7 instead of fcc register. This commit partially reverts commit
2f149c759
(`target/loongarch: Update gdb_set_fpu() and gdb_get_fpu()`)
to match the behavior of GDB.
Note that it is a breaking change for GDB 13.0 or earlier, but it is
also required for GDB 13.1 or later to work.
Signed-off-by: Jiajie Chen <c@jia.je >
Acked-by: Song Gao <gaosong@loongson.cn >
Message-Id: <20230808054315.3391465-1-c@jia.je >
Signed-off-by: Song Gao <gaosong@loongson.cn >
2023-08-24 11:17:59 +08:00
2948c1fb6b
hw/intc/loongarch_pch: fix edge triggered irq handling
...
For edge triggered irq, qemu_irq_pulse is used to inject irq. It will
set irq with high level and low level soon to simluate pulse irq.
For edge triggered irq, irq is injected and set as pending at rising
level, do not clear irq at lowering level. LoongArch pch interrupt will
clear irq for lowering level irq, there will be problem. ACPI ged deivce
is edge-triggered irq, it is used for cpu/memory hotplug.
This patch fixes memory hotplug issue on LoongArch virt machine.
Signed-off-by: Bibo Mao <maobibo@loongson.cn >
Reviewed-by: Song Gao <gaosong@loongson.cn >
Message-Id: <20230707091557.1474790-1-maobibo@loongson.cn >
Signed-off-by: Song Gao <gaosong@loongson.cn >
2023-08-24 11:17:59 +08:00
14f21f673a
target/loongarch: cpu: Implement get_arch_id callback
...
Implement the callback for getting the architecture-dependent CPU
ID, the cpu ID is physical id described in ACPI MADT table, this
will be used for cpu hotplug.
Signed-off-by: Bibo Mao <maobibo@loongson.cn >
Reviewed-by: Song Gao <gaosong@loongson.cn >
Message-Id: <20230824005007.2000525-1-maobibo@loongson.cn >
Signed-off-by: Song Gao <gaosong@loongson.cn >
2023-08-24 11:17:59 +08:00
a380c6f11f
target/loongarch: Add avail_IOCSR to check iocsr instructions
...
Signed-off-by: Song Gao <gaosong@loongson.cn >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Message-ID: <20230822032724.1353391-16-gaosong@loongson.cn >
Message-Id: <20230822072219.35719-1-philmd@linaro.org >
2023-08-24 11:17:58 +08:00
ebf288b410
target/loongarch: Add avail_LSX to check LSX instructions
...
Signed-off-by: Song Gao <gaosong@loongson.cn >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Message-ID: <20230822032724.1353391-15-gaosong@loongson.cn >
Message-Id: <20230822073026.35776-1-philmd@linaro.org >
2023-08-24 11:17:58 +08:00
b139ddf1e9
target/loongarch: Add avail_LAM to check atomic instructions
...
Signed-off-by: Song Gao <gaosong@loongson.cn >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Message-ID: <20230822032724.1353391-14-gaosong@loongson.cn >
Message-Id: <20230822071959.35620-8-philmd@linaro.org >
2023-08-24 11:17:58 +08:00
70c8d5eaaa
target/loongarch: Add avail_LSPW to check LSPW instructions
...
Signed-off-by: Song Gao <gaosong@loongson.cn >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Message-ID: <20230822032724.1353391-13-gaosong@loongson.cn >
Message-Id: <20230822071959.35620-7-philmd@linaro.org >
2023-08-24 11:17:58 +08:00
95e2ca2407
target/loongarch: Add avail_FP/FP_SP/FP_DP to check fpu instructions
...
Signed-off-by: Song Gao <gaosong@loongson.cn >
Acked-by: Richard Henderson <richard.henderson@linaro.org >
Message-ID: <20230822032724.1353391-12-gaosong@loongson.cn >
Message-Id: <20230822071959.35620-6-philmd@linaro.org >
2023-08-24 11:17:58 +08:00
3055122ff6
hw/loongarch: Remove restriction of la464 cores in the virt machine
...
Allow virt machine to be used with la132 instead of la464.
Co-authored-by: Jiajie Chen <c@jia.je >
Signed-off-by: Song Gao <gaosong@loongson.cn >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Message-ID: <20230822032724.1353391-11-gaosong@loongson.cn >
Message-Id: <20230822071959.35620-5-philmd@linaro.org >
2023-08-24 11:17:58 +08:00
bb8710cf0a
target/loongarch: Add LoongArch32 cpu la132
...
Add LoongArch32 cpu la132.
Due to lack of public documentation of la132, it is currently a
synthetic LoongArch32 cpu model. Details need to be added in the future.
Signed-off-by: Jiajie Chen <c@jia.je >
Signed-off-by: Song Gao <gaosong@loongson.cn >
Acked-by: Richard Henderson <richard.henderson@linaro.org >
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Message-ID: <20230822032724.1353391-10-gaosong@loongson.cn >
Message-Id: <20230822071959.35620-4-philmd@linaro.org >
2023-08-24 11:17:58 +08:00
c0c0461e3a
target/loongarch: Add avail_64 to check la64-only instructions
...
The la32 instructions listed in Table 2 at
https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html#overview-of-basic-integer-instructions
Co-authored-by: Jiajie Chen <c@jia.je >
Signed-off-by: Song Gao <gaosong@loongson.cn >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Message-ID: <20230822032724.1353391-9-gaosong@loongson.cn >
Message-Id: <20230822071959.35620-3-philmd@linaro.org >
2023-08-24 11:17:58 +08:00
ec3a951891
target/loongarch: Add a check parameter to the TRANS macro
...
The default check parmeter is ALL.
Suggested-by: Richard Henderson <richard.henderson@linaro.org >
Signed-off-by: Song Gao <gaosong@loongson.cn >
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Message-ID: <20230822032724.1353391-8-gaosong@loongson.cn >
Message-Id: <20230822071959.35620-2-philmd@linaro.org >
2023-08-24 11:17:57 +08:00
6496269d7e
target/loongarch: Sign extend results in VA32 mode
...
In VA32 mode, BL, JIRL and PC* instructions should sign-extend the low
32 bit result to 64 bits.
Signed-off-by: Jiajie Chen <c@jia.je >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Signed-off-by: Song Gao <gaosong@loongson.cn >
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Message-ID: <20230822032724.1353391-7-gaosong@loongson.cn >
Message-Id: <20230822071959.35620-1-philmd@linaro.org >
2023-08-24 11:17:57 +08:00
7033c0e6dd
target/loongarch: Truncate high 32 bits of address in VA32 mode
...
When running in VA32 mode(!LA64 or VA32L[1-3] matching PLV), virtual
address is truncated to 32 bits before address mapping.
Signed-off-by: Jiajie Chen <c@jia.je >
Co-authored-by: Richard Henderson <richard.henderson@linaro.org >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Signed-off-by: Song Gao <gaosong@loongson.cn >
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Message-ID: <20230822032724.1353391-6-gaosong@loongson.cn >
Message-Id: <20230822071405.35386-10-philmd@linaro.org >
2023-08-24 11:17:57 +08:00
2f6478ffad
target/loongarch: Extract set_pc() helper
...
Signed-off-by: Jiajie Chen <c@jia.je >
Co-authored-by: Richard Henderson <richard.henderson@linaro.org >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Signed-off-by: Song Gao <gaosong@loongson.cn >
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Message-ID: <20230822032724.1353391-6-gaosong@loongson.cn >
[PMD: Extract helper from bigger patch]
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Message-Id: <20230822071405.35386-9-philmd@linaro.org >
2023-08-24 11:17:57 +08:00
5a7ce25d0d
target/loongarch: Extract make_address_pc() helper
...
Signed-off-by: Jiajie Chen <c@jia.je >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Signed-off-by: Song Gao <gaosong@loongson.cn >
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Message-ID: <20230822032724.1353391-7-gaosong@loongson.cn >
[PMD: Extract helper from bigger patch]
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Message-Id: <20230822071405.35386-8-philmd@linaro.org >
2023-08-24 11:17:57 +08:00
c5af6628f4
target/loongarch: Extract make_address_i() helper
...
Signed-off-by: Jiajie Chen <c@jia.je >
Co-authored-by: Richard Henderson <richard.henderson@linaro.org >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Signed-off-by: Song Gao <gaosong@loongson.cn >
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Message-ID: <20230822032724.1353391-6-gaosong@loongson.cn >
[PMD: Extract helper from bigger patch]
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Message-Id: <20230822071405.35386-7-philmd@linaro.org >
2023-08-24 11:17:57 +08:00
34423c0194
target/loongarch: Extract make_address_x() helper
...
Signed-off-by: Jiajie Chen <c@jia.je >
Co-authored-by: Richard Henderson <richard.henderson@linaro.org >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Signed-off-by: Song Gao <gaosong@loongson.cn >
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Message-ID: <20230822032724.1353391-6-gaosong@loongson.cn >
[PMD: Extract helper from bigger patch]
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Message-Id: <20230822071405.35386-6-philmd@linaro.org >
2023-08-24 11:17:57 +08:00
3966582099
target/loongarch: Add LA64 & VA32 to DisasContext
...
Add LA64 and VA32(32-bit Virtual Address) to DisasContext to allow the
translator to reject doubleword instructions in LA32 mode for example.
Signed-off-by: Jiajie Chen <c@jia.je >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Signed-off-by: Song Gao <gaosong@loongson.cn >
Message-ID: <20230822032724.1353391-5-gaosong@loongson.cn >
Message-Id: <20230822071405.35386-5-philmd@linaro.org >
2023-08-24 11:17:56 +08:00
50fffcc49b
target/loongarch: Support LoongArch32 VPPN
...
VPPN of TLBEHI/TLBREHI is limited to 19 bits in LA32.
Signed-off-by: Jiajie Chen <c@jia.je >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Signed-off-by: Song Gao <gaosong@loongson.cn >
Message-ID: <20230822032724.1353391-4-gaosong@loongson.cn >
Message-Id: <20230822071405.35386-4-philmd@linaro.org >
2023-08-24 11:17:56 +08:00
eece576409
target/loongarch: Support LoongArch32 DMW
...
LA32 uses a different encoding for CSR.DMW and a new direct mapping
mechanism.
Signed-off-by: Jiajie Chen <c@jia.je >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Signed-off-by: Song Gao <gaosong@loongson.cn >
Message-ID: <20230822032724.1353391-3-gaosong@loongson.cn >
Message-Id: <20230822071405.35386-3-philmd@linaro.org >
2023-08-24 11:17:56 +08:00
e70bb6fb9a
target/loongarch: Support LoongArch32 TLB entry
...
The TLB entry of LA32 lacks NR, NX and RPLV and they are hardwired to
zero in LoongArch32.
Signed-off-by: Jiajie Chen <c@jia.je >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Signed-off-by: Song Gao <gaosong@loongson.cn >
Message-ID: <20230822032724.1353391-2-gaosong@loongson.cn >
Message-Id: <20230822071405.35386-2-philmd@linaro.org >
2023-08-24 11:17:56 +08:00
ebda3036e1
target/loongarch: Add GDB support for loongarch32 mode
...
GPRs and PC are 32-bit wide in loongarch32 mode.
Signed-off-by: Jiajie Chen <c@jia.je >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Signed-off-by: Song Gao <gaosong@loongson.cn >
Message-ID: <20230817093121.1053890-4-gaosong@loongson.cn >
[PMD: Rebased, set gdb_num_core_regs]
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Message-Id: <20230821125959.28666-9-philmd@linaro.org >
2023-08-24 11:17:56 +08:00
6cbba3e9eb
target/loongarch: Add new object class for loongarch32 cpus
...
Add object class stub for future loongarch32 cpus.
Signed-off-by: Jiajie Chen <c@jia.je >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Signed-off-by: Song Gao <gaosong@loongson.cn >
Message-ID: <20230817093121.1053890-3-gaosong@loongson.cn >
[Rebased on TYPE_LOONGARCH64_CPU introduction]
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Message-Id: <20230821125959.28666-8-philmd@linaro.org >
2023-08-24 11:17:56 +08:00
19f82a4a6a
target/loongarch: Add function to check current arch
...
Add is_la64 function to check if the current cpucfg[1].arch equals to
2(LA64).
Signed-off-by: Jiajie Chen <c@jia.je >
Co-authored-by: Richard Henderson <richard.henderson@linaro.org >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Signed-off-by: Song Gao <gaosong@loongson.cn >
Message-ID: <20230817093121.1053890-2-gaosong@loongson.cn >
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org >
Message-Id: <20230821125959.28666-7-philmd@linaro.org >
2023-08-24 11:17:56 +08:00