cd1c49ada0
target/loongarch: Implement vmul/vmuh/vmulw{ev/od}
...
This patch includes:
- VMUL.{B/H/W/D};
- VMUH.{B/H/W/D}[U];
- VMULW{EV/OD}.{H.B/W.H/D.W/Q.D}[U];
- VMULW{EV/OD}.{H.BU.B/W.HU.H/D.WU.W/Q.DU.D}.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Signed-off-by: Song Gao <gaosong@loongson.cn >
Message-Id: <20230504122810.4094787-15-gaosong@loongson.cn >
2023-05-06 11:19:46 +08:00
9ab29520f7
target/loongarch: Implement vmax/vmin
...
This patch includes:
- VMAX[I].{B/H/W/D}[U];
- VMIN[I].{B/H/W/D}[U].
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Signed-off-by: Song Gao <gaosong@loongson.cn >
Message-Id: <20230504122810.4094787-14-gaosong@loongson.cn >
2023-05-06 11:19:46 +08:00
af448cb31a
target/loongarch: Implement vadda
...
This patch includes:
- VADDA.{B/H/W/D}.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Signed-off-by: Song Gao <gaosong@loongson.cn >
Message-Id: <20230504122810.4094787-13-gaosong@loongson.cn >
2023-05-06 11:19:46 +08:00
4972565967
target/loongarch: Implement vabsd
...
This patch includes:
- VABSD.{B/H/W/D}[U].
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Signed-off-by: Song Gao <gaosong@loongson.cn >
Message-Id: <20230504122810.4094787-12-gaosong@loongson.cn >
2023-05-06 11:19:45 +08:00
39e9b0a741
target/loongarch: Implement vavg/vavgr
...
This patch includes:
- VAVG.{B/H/W/D}[U];
- VAVGR.{B/H/W/D}[U].
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Signed-off-by: Song Gao <gaosong@loongson.cn >
Message-Id: <20230504122810.4094787-11-gaosong@loongson.cn >
2023-05-06 11:19:45 +08:00
2d5f950c05
target/loongarch: Implement vaddw/vsubw
...
This patch includes:
- VADDW{EV/OD}.{H.B/W.H/D.W/Q.D}[U];
- VSUBW{EV/OD}.{H.B/W.H/D.W/Q.D}[U];
- VADDW{EV/OD}.{H.BU.B/W.HU.H/D.WU.W/Q.DU.D}.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Signed-off-by: Song Gao <gaosong@loongson.cn >
Message-Id: <20230504122810.4094787-10-gaosong@loongson.cn >
2023-05-06 11:19:45 +08:00
c037fbc97d
target/loongarch: Implement vhaddw/vhsubw
...
This patch includes:
- VHADDW.{H.B/W.H/D.W/Q.D/HU.BU/WU.HU/DU.WU/QU.DU};
- VHSUBW.{H.B/W.H/D.W/Q.D/HU.BU/WU.HU/DU.WU/QU.DU}.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Signed-off-by: Song Gao <gaosong@loongson.cn >
Message-Id: <20230504122810.4094787-9-gaosong@loongson.cn >
2023-05-06 11:19:45 +08:00
a94cb91107
target/loongarch: Implement vsadd/vssub
...
This patch includes:
- VSADD.{B/H/W/D}[U];
- VSSUB.{B/H/W/D}[U].
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Signed-off-by: Song Gao <gaosong@loongson.cn >
Message-Id: <20230504122810.4094787-8-gaosong@loongson.cn >
2023-05-06 11:19:45 +08:00
be9ec55758
target/loongarch: Implement vneg
...
This patch includes;
- VNEG.{B/H/W/D}.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Signed-off-by: Song Gao <gaosong@loongson.cn >
Message-Id: <20230504122810.4094787-7-gaosong@loongson.cn >
2023-05-06 11:19:45 +08:00
d8be64c1c5
target/loongarch: Implement vaddi/vsubi
...
This patch includes:
- VADDI.{B/H/W/D}U;
- VSUBI.{B/H/W/D}U.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Signed-off-by: Song Gao <gaosong@loongson.cn >
Message-Id: <20230504122810.4094787-6-gaosong@loongson.cn >
2023-05-06 11:19:45 +08:00
57b4f1ac18
target/loongarch: Implement vadd/vsub
...
This patch includes:
- VADD.{B/H/W/D/Q};
- VSUB.{B/H/W/D/Q}.
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Signed-off-by: Song Gao <gaosong@loongson.cn >
Message-Id: <20230504122810.4094787-5-gaosong@loongson.cn >
2023-05-06 11:19:45 +08:00
a3f3db5cda
target/loongarch: Add CHECK_SXE maccro for check LSX enable
...
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Signed-off-by: Song Gao <gaosong@loongson.cn >
Message-Id: <20230504122810.4094787-4-gaosong@loongson.cn >
2023-05-06 11:19:45 +08:00
a0c9400a5b
target/loongarch: meson.build support build LSX
...
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Signed-off-by: Song Gao <gaosong@loongson.cn >
Message-Id: <20230504122810.4094787-3-gaosong@loongson.cn >
2023-05-06 11:19:44 +08:00
16f5396cec
target/loongarch: Add LSX data type VReg
...
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Signed-off-by: Song Gao <gaosong@loongson.cn >
Message-Id: <20230504122810.4094787-2-gaosong@loongson.cn >
2023-05-06 11:19:42 +08:00
47d3878422
Merge tag 'pull-tcg-20230505' of https://gitlab.com/rth7680/qemu into staging
...
softfloat: Fix the incorrect computation in float32_exp2
tcg: Remove compatability helpers for qemu ld/st
target/alpha: Remove TARGET_ALIGNED_ONLY
target/hppa: Remove TARGET_ALIGNED_ONLY
target/sparc: Remove TARGET_ALIGNED_ONLY
tcg: Cleanups preparing to unify calls to qemu_ld/st helpers
# -----BEGIN PGP SIGNATURE-----
#
# iQFRBAABCgA7FiEEekgeeIaLTbaoWgXAZN846K9+IV8FAmRVc9UdHHJpY2hhcmQu
# aGVuZGVyc29uQGxpbmFyby5vcmcACgkQZN846K9+IV9OiAgAgwc6wFOzFtSnYrvH
# b9YgcJLPX8urgx9g1Exv553hbVtt2J0lsLAhlgwKpms3Os4p6znKhUWcGosHFixO
# eBQFqcS22Cu/ZM2s6299GOGDpxCpjx0/bX7JJTjW805SdSgDAuEUIbKe0ZqQT5tx
# ++F9is2+plp95/BeQz2+hbkbbpdktUkkk288Adoz3KRHqt/zd8cer0WrqR2uVAuX
# swpEluwtCfaewc0iPcNjlp9rLzO882wCFm0RG1EC2j9NHtq8O8xyamM9PPEaRXLv
# MiMA2nB6hsGMz33Wuec8cZTMaCLB+Oqhbq7eYPbCA4SmJBE3V9Rgc7GL4B7yCsyI
# OXSK+Q==
# =GIXd
# -----END PGP SIGNATURE-----
# gpg: Signature made Fri 05 May 2023 10:23:33 PM BST
# gpg: using RSA key 7A481E78868B4DB6A85A05C064DF38E8AF7E215F
# gpg: issuer "richard.henderson@linaro.org "
# gpg: Good signature from "Richard Henderson <richard.henderson@linaro.org >" [ultimate]
* tag 'pull-tcg-20230505' of https://gitlab.com/rth7680/qemu : (42 commits)
tcg: Widen helper_*_st[bw]_mmu val arguments
tcg: Introduce arg_slot_stk_ofs
tcg: Replace REG_P with arg_loc_reg_p
tcg: Move TCGLabelQemuLdst to tcg.c
tcg/sparc64: Pass TCGType to tcg_out_qemu_{ld,st}
tcg/sparc64: Drop is_64 test from tcg_out_qemu_ld data return
tcg/s390x: Introduce HostAddress
tcg/s390x: Pass TCGType to tcg_out_qemu_{ld,st}
tcg/riscv: Rationalize args to tcg_out_qemu_{ld,st}
tcg/riscv: Require TCG_TARGET_REG_BITS == 64
tcg/ppc: Introduce HostAddress
tcg/ppc: Rationalize args to tcg_out_qemu_{ld,st}
tcg/mips: Rationalize args to tcg_out_qemu_{ld,st}
tcg/loongarch64: Introduce HostAddress
tcg/loongarch64: Rationalize args to tcg_out_qemu_{ld,st}
tcg/arm: Introduce HostAddress
tcg/arm: Rationalize args to tcg_out_qemu_{ld,st}
tcg/aarch64: Introduce HostAddress
tcg/aarch64: Rationalize args to tcg_out_qemu_{ld,st}
tcg/i386: Introduce tcg_out_testi
...
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2023-05-05 22:29:28 +01:00
60abd45224
target/sparc: Use cpu_ld*_code_mmu
...
This passes on the memop as given as argument to
helper_ld_asi to the ultimate load primitive.
Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2023-05-05 17:09:47 +01:00
316b6783f1
target/sparc: Use MO_ALIGN where required
...
Acked-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk >
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2023-05-05 17:09:47 +01:00
2d4afb03e4
target/hppa: Use MO_ALIGN for system UNALIGN()
...
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2023-05-05 17:05:58 +01:00
33948b68a7
target/alpha: Use MO_ALIGN where required
...
Mark all memory operations that are not already marked with UNALIGN.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2023-05-05 17:05:58 +01:00
6ffaac9ca0
target/alpha: Use MO_ALIGN for system UNALIGN()
...
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
2023-05-05 17:05:58 +01:00
f0aca2a912
target/xtensa: Finish conversion to tcg_gen_qemu_{ld, st}_*
...
Convert away from the old interface with the implicit
MemOp argument.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
Reviewed-by: Max Filippov <jcmvbkbc@gmail.com >
Message-Id: <20230502135741.1158035-9-richard.henderson@linaro.org >
2023-05-05 17:05:29 +01:00
0814911883
target/sparc: Finish conversion to tcg_gen_qemu_{ld, st}_*
...
Convert away from the old interface with the implicit
MemOp argument.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
Reviewed-by: Anton Johansson <anjo@rev.ng >
Message-Id: <20230502135741.1158035-8-richard.henderson@linaro.org >
2023-05-05 17:05:28 +01:00
e87027d022
target/s390x: Finish conversion to tcg_gen_qemu_{ld, st}_*
...
Convert away from the old interface with the implicit
MemOp argument.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
Reviewed-by: David Hildenbrand <david@redhat.com >
Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com >
Message-Id: <20230502135741.1158035-7-richard.henderson@linaro.org >
2023-05-05 17:05:28 +01:00
6d0cad1259
target/mips: Finish conversion to tcg_gen_qemu_{ld,st}_*
...
Convert away from the old interface with the implicit
MemOp argument.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
Reviewed-by: Anton Johansson <anjo@rev.ng >
Message-Id: <20230502135741.1158035-6-richard.henderson@linaro.org >
2023-05-05 17:05:28 +01:00
b7a94da955
target/m68k: Finish conversion to tcg_gen_qemu_{ld,st}_*
...
Convert away from the old interface with the implicit
MemOp argument.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
Reviewed-by: Anton Johansson <anjo@rev.ng >
Message-Id: <20230502135741.1158035-5-richard.henderson@linaro.org >
2023-05-05 17:05:28 +01:00
53b26d253c
target/Hexagon: Finish conversion to tcg_gen_qemu_{ld, st}_*
...
Convert away from the old interface with the implicit
MemOp argument. Importantly, this removes some incorrect
casts generated by idef-parser's gen_load().
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
Tested-by: Taylor Simpson <tsimpson@quicinc.com >
Reviewed-by: Taylor Simpson <tsimpson@quicinc.com >
Reviewed-by: Anton Johansson <anjo@rev.ng >
Message-Id: <20230502135741.1158035-4-richard.henderson@linaro.org >
2023-05-05 17:05:28 +01:00
a9a9c3fa6f
target/cris: Finish conversion to tcg_gen_qemu_{ld,st}_*
...
Convert away from the old interface with the implicit
MemOp argument. In this case we can fold the calls
using the size bits of MemOp.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
Reviewed-by: Anton Johansson <anjo@rev.ng >
Message-Id: <20230502135741.1158035-3-richard.henderson@linaro.org >
2023-05-05 17:05:28 +01:00
8b4506e5d2
target/avr: Finish conversion to tcg_gen_qemu_{ld,st}_*
...
Convert away from the old interface with the implicit
MemOp argument.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
Reviewed-by: Anton Johansson <anjo@rev.ng >
Message-Id: <20230502135741.1158035-2-richard.henderson@linaro.org >
2023-05-05 17:05:28 +01:00
6a5d81b172
tcg: ppc64: Fix mask generation for vextractdm
...
In function do_extractm() the mask is calculated as
dup_const(1 << (element_width - 1)). '1' being signed int
works fine for MO_8,16,32. For MO_64, on PPC64 host
this ends up becoming 0 on compilation. The vextractdm
uses MO_64, and it ends up having mask as 0.
Explicitly use 1ULL instead of signed int 1 like its
used everywhere else.
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1536
Signed-off-by: Shivaprasad G Bhat <sbhat@linux.ibm.com >
Reviewed-by: Alex Bennée <alex.bennee@linaro.org >
Reviewed-by: Lucas Mateus Castro <lucas.araujo@eldorado.org.br >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Reviewed-by: Cédric Le Goater <clg@redhat.com >
Message-Id: <168319292809.1159309.5817546227121323288.stgit@ltc-boston1.aus.stglabs.ibm.com >
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com >
2023-05-05 12:34:22 -03:00
2060436aab
ppc: spapr: cleanup cr get/set with helpers.
...
The bits in cr reg are grouped into eight 4-bit fields represented
by env->crf[8] and the related calculations should be abstracted to
keep the calling routines simpler to read. This is a step towards
cleaning up the related/calling code for better readability.
Signed-off-by: Harsh Prateek Bora <harshpb@linux.ibm.com >
Reviewed-by: Fabiano Rosas <farosas@suse.de >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Message-Id: <20230503093619.2530487-2-harshpb@linux.ibm.com >
[danielhb: add 'const' modifier to fix linux-user build]
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com >
2023-05-05 12:34:22 -03:00
e1d084a852
target/riscv: add Ventana's Veyron V1 CPU
...
Add a virtual CPU for Ventana's first CPU named veyron-v1. It runs
exclusively for the rv64 target. It's tested with the 'virt' board.
CPU specs and general information can be found here:
https://www.nextplatform.com/2023/02/02/the-first-risc-v-shot-across-the-datacenter-bow/
Signed-off-by: Rahul Pathak <rpathak@ventanamicro.com >
Signed-off-by: Mayuresh Chitale <mchitale@ventanamicro.com >
Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com >
Acked-by: Alistair Francis <alistair.francis@wdc.com >
Message-Id: <20230418123624.16414-1-dbarboza@ventanamicro.com >
Signed-off-by: Alistair Francis <alistair.francis@wdc.com >
2023-05-05 10:49:50 +10:00
190e9f8ec1
riscv: Make sure an exception is raised if a pte is malformed
...
As per the specification, in 64-bit, if any of the pte reserved bits
60-54 is set an exception should be triggered (see 4.4.1, "Addressing and
Memory Protection"). In addition, we must check the napot/pbmt bits are
not set if those extensions are not active.
Reported-by: Andrea Parri <andrea@rivosinc.com >
Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com >
Reviewed-by: Alistair Francis <alistair.francis@wdc.com >
Message-Id: <20230420150220.60919-1-alexghiti@rivosinc.com >
Signed-off-by: Alistair Francis <alistair.francis@wdc.com >
2023-05-05 10:49:50 +10:00
7bf14a2f37
target/riscv: Fix Guest Physical Address Translation
...
Before changing the flow check for sv39/48/57.
According to specification (for Supervisor mode):
Sv39 implementations support a 39-bit virtual address space, divided into 4 KiB
pages.
Instruction fetch addresses and load and store effective addresses, which are
64 bits,
must have bits 63–39 all equal to bit 38, or else a page-fault exception will
occur.
Likewise for Sv48 and Sv57.
So the high bits are equal to bit 38 for sv39.
According to specification (for Hypervisor mode):
For Sv39x4, address bits of the guest physical address 63:41 must all be zeros,
or else a
guest-page-fault exception occurs.
Likewise for Sv48x4 and Sv57x4.
For Sv48x4 address bits 63:50 must all be zeros, or else a guest-page-fault
exception occurs.
For Sv57x4 address bits 63:59 must all be zeros, or else a guest-page-fault
exception occurs.
For example we are trying to access address 0xffff_ffff_ff01_0000 with only
G-translation enabled.
So expected behavior is to generate exception. But qemu doesn't generate such
exception.
For the old check, we get
va_bits == 41, mask == (1 << 24) - 1, masked_msbs == (0xffff_ffff_ff01_0000 >>
40) & mask == mask.
Accordingly, the condition masked_msbs != 0 && masked_msbs != mask is not
fulfilled
and the check passes.
Signed-off-by: Irina Ryapolova <irina.ryapolova@syntacore.com >
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn >
Reviewed-by: Alistair Francis <alistair.francis@wdc.com >
Message-Id: <20230418075423.26217-1-irina.ryapolova@syntacore.com >
Signed-off-by: Alistair Francis <alistair.francis@wdc.com >
2023-05-05 10:49:50 +10:00
eae04c4c13
target/riscv: Restore the predicate() NULL check behavior
...
When reading a non-existent CSR QEMU should raise illegal instruction
exception, but currently it just exits due to the g_assert() check.
This actually reverts commit 0ee342256a
.
Some comments are also added to indicate that predicate() must be
provided for an implemented CSR.
Reported-by: Fei Wu <fei2.wu@intel.com >
Signed-off-by: Bin Meng <bmeng@tinylab.org >
Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com >
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn >
Reviewed-by: Alistair Francis <alistair.francis@wdc.com >
Reviewed-by: LIU Zhiwei <zhiwei_liu@linux.alibaba.com >
Message-Id: <20230417043054.3125614-1-bmeng@tinylab.org >
Signed-off-by: Alistair Francis <alistair.francis@wdc.com >
2023-05-05 10:49:50 +10:00
9e1a30d342
target/riscv: add TYPE_RISCV_DYNAMIC_CPU
...
This new abstract type will be used to differentiate between static and
non-static CPUs in query-cpu-definitions.
All generic CPUs were changed to be of this type. Named CPUs are kept as
TYPE_RISCV_CPU and will still be considered static.
This is the output of query-cpu-definitions after this change for the
riscv64 target:
$ ./build/qemu-system-riscv64 -S -M virt -display none -qmp stdio
{"QMP": {"version": (...)}
{"execute": "qmp_capabilities", "arguments": {"enable": ["oob"]}}
{"return": {}}
{"execute": "query-cpu-definitions"}
{"return": [
{"name": "rv64", "typename": "rv64-riscv-cpu", "static": false, "deprecated": false},
{"name": "sifive-e51", "typename": "sifive-e51-riscv-cpu", "static": true, "deprecated": false},
{"name": "any", "typename": "any-riscv-cpu", "static": false, "deprecated": false},
{"name": "x-rv128", "typename": "x-rv128-riscv-cpu", "static": false, "deprecated": false},
{"name": "shakti-c", "typename": "shakti-c-riscv-cpu", "static": true, "deprecated": false},
{"name": "thead-c906", "typename": "thead-c906-riscv-cpu", "static": true, "deprecated": false},
{"name": "sifive-u54", "typename": "sifive-u54-riscv-cpu", "static": true, "deprecated": false}
]}
Suggested-by: Richard Henderson <richard.henderson@linaro.org >
Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com >
Acked-by: Alistair Francis <alistair.francis@wdc.com >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Message-Id: <20230411183511.189632-4-dbarboza@ventanamicro.com >
Signed-off-by: Alistair Francis <alistair.francis@wdc.com >
2023-05-05 10:49:50 +10:00
c0177f911f
target/riscv: add query-cpy-definitions support
...
This command is used by tooling like libvirt to retrieve a list of
supported CPUs. Each entry returns a CpuDefinitionInfo object that
contains more information about each CPU.
This initial support includes only the name of the CPU and its typename.
Here's what the command produces for the riscv64 target:
$ ./build/qemu-system-riscv64 -S -M virt -display none -qmp stdio
{"QMP": {"version": (...)}
{"execute": "qmp_capabilities", "arguments": {"enable": ["oob"]}}
{"return": {}}
{"execute": "query-cpu-definitions"}
{"return": [
{"name": "rv64", "typename": "rv64-riscv-cpu", "static": false, "deprecated": false},
{"name": "sifive-e51", "typename": "sifive-e51-riscv-cpu", "static": false, "deprecated": false},
{"name": "any", "typename": "any-riscv-cpu", "static": false, "deprecated": false},
{"name": "x-rv128", "typename": "x-rv128-riscv-cpu", "static": false, "deprecated": false},
{"name": "shakti-c", "typename": "shakti-c-riscv-cpu", "static": false, "deprecated": false},
{"name": "thead-c906", "typename": "thead-c906-riscv-cpu", "static": false, "deprecated": false},
{"name": "sifive-u54", "typename": "sifive-u54-riscv-cpu", "static": false, "deprecated": false}]
}
Next patch will introduce a way to tell whether a given CPU is static or
not.
Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Reviewed-by: Alistair Francis <alistair.francis@wdc.com >
Message-Id: <20230411183511.189632-3-dbarboza@ventanamicro.com >
Signed-off-by: Alistair Francis <alistair.francis@wdc.com >
2023-05-05 10:49:50 +10:00
85840bd2e0
target/riscv: add CPU QOM header
...
QMP CPU commands are usually implemented by a separated file,
<arch>-qmp-cmds.c, to allow them to be build only for softmmu targets.
This file uses a CPU QOM header with basic QOM declarations for the
arch.
We'll introduce query-cpu-definitions for RISC-V CPUs in the next patch,
but first we need a cpu-qom.h header with the definitions of
TYPE_RISCV_CPU and RISCVCPUClass declarations. These were moved from
cpu.h to the new file, and cpu.h now includes "cpu-qom.h".
Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com >
Reviewed-by: Richard Henderson <richard.henderson@linaro.org >
Reviewed-by: Alistair Francis <alistair.francis@wdc.com >
Message-Id: <20230411183511.189632-2-dbarboza@ventanamicro.com >
Signed-off-by: Alistair Francis <alistair.francis@wdc.com >
2023-05-05 10:49:50 +10:00
38303e8a2c
target/riscv: Reorg sum check in get_physical_address
...
Implement this by adjusting prot, which reduces the set of
checks required. This prevents exec to be set for U pages
in MMUIdx_S_SUM. While it had been technically incorrect,
it did not manifest as a bug, because we will never attempt
to execute from MMUIdx_S_SUM.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
Reviewed-by: Alistair Francis <alistair.francis@wdc.com >
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn >
Tested-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com >
Message-Id: <20230325105429.1142530-26-richard.henderson@linaro.org >
Message-Id: <20230412114333.118895-26-richard.henderson@linaro.org >
Signed-off-by: Alistair Francis <alistair.francis@wdc.com >
2023-05-05 10:49:50 +10:00
e1dd15076b
target/riscv: Reorg access check in get_physical_address
...
We were effectively computing the protection bits twice,
once while performing access checks and once while returning
the valid bits to the caller. Reorg so we do this once.
Move the computation of mxr close to its single use.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
Reviewed-by: Alistair Francis <alistair.francis@wdc.com >
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn >
Tested-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com >
Message-Id: <20230325105429.1142530-25-richard.henderson@linaro.org >
Message-Id: <20230412114333.118895-25-richard.henderson@linaro.org >
Signed-off-by: Alistair Francis <alistair.francis@wdc.com >
2023-05-05 10:49:50 +10:00
a9d2e3ed4d
target/riscv: Merge checks for reserved pte flags
...
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
Reviewed-by: Alistair Francis <alistair.francis@wdc.com >
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn >
Tested-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com >
Message-Id: <20230325105429.1142530-24-richard.henderson@linaro.org >
Message-Id: <20230412114333.118895-24-richard.henderson@linaro.org >
Signed-off-by: Alistair Francis <alistair.francis@wdc.com >
2023-05-05 10:49:50 +10:00
356c8331d6
target/riscv: Don't modify SUM with is_debug
...
If we want to give the debugger a greater view of memory than
the cpu, we should simply disable the access check entirely,
not simply for this one corner case.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
Reviewed-by: Alistair Francis <alistair.francis@wdc.com >
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn >
Tested-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com >
Message-Id: <20230325105429.1142530-23-richard.henderson@linaro.org >
Message-Id: <20230412114333.118895-23-richard.henderson@linaro.org >
Signed-off-by: Alistair Francis <alistair.francis@wdc.com >
2023-05-05 10:49:50 +10:00
0a19bf5e37
target/riscv: Suppress pte update with is_debug
...
The debugger should not modify PTE_A or PTE_D.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
Reviewed-by: Alistair Francis <alistair.francis@wdc.com >
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn >
Tested-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com >
Message-Id: <20230325105429.1142530-22-richard.henderson@linaro.org >
Message-Id: <20230412114333.118895-22-richard.henderson@linaro.org >
Signed-off-by: Alistair Francis <alistair.francis@wdc.com >
2023-05-05 10:49:50 +10:00
59688aa023
target/riscv: Move leaf pte processing out of level loop
...
Move the code that never loops outside of the loop.
Unchain the if-return-else statements.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
Reviewed-by: Alistair Francis <alistair.francis@wdc.com >
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn >
Tested-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com >
Message-Id: <20230325105429.1142530-21-richard.henderson@linaro.org >
Message-Id: <20230412114333.118895-21-richard.henderson@linaro.org >
Signed-off-by: Alistair Francis <alistair.francis@wdc.com >
2023-05-05 10:49:50 +10:00
8d6a00cdc0
target/riscv: Hoist pbmte and hade out of the level loop
...
These values are constant for every level of pte lookup.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
Reviewed-by: Alistair Francis <alistair.francis@wdc.com >
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn >
Tested-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com >
Message-Id: <20230325105429.1142530-20-richard.henderson@linaro.org >
Message-Id: <20230412114333.118895-20-richard.henderson@linaro.org >
Signed-off-by: Alistair Francis <alistair.francis@wdc.com >
2023-05-05 10:49:50 +10:00
a427c83633
target/riscv: Hoist second stage mode change to callers
...
Move the check from the top of get_physical_address to
the two callers, where passing mmu_idx makes no sense.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
Reviewed-by: Alistair Francis <alistair.francis@wdc.com >
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn >
Tested-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com >
Message-Id: <20230325105429.1142530-19-richard.henderson@linaro.org >
Message-Id: <20230412114333.118895-19-richard.henderson@linaro.org >
Signed-off-by: Alistair Francis <alistair.francis@wdc.com >
2023-05-05 10:49:50 +10:00
eaecd473ca
target/riscv: Check SUM in the correct register
...
Table 9.5 "Effect of MPRV..." specifies that MPV=1 uses VS-level
vsstatus.SUM instead of HS-level sstatus.SUM.
For HLV/HSV instructions, the HS-level register does not apply, but
the VS-level register presumably does, though this is not mentioned
explicitly in the manual. However, it matches the behavior for MPV.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
Reviewed-by: Alistair Francis <alistair.francis@wdc.com >
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn >
Tested-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com >
Message-Id: <20230325105429.1142530-18-richard.henderson@linaro.org >
Message-Id: <20230412114333.118895-18-richard.henderson@linaro.org >
Signed-off-by: Alistair Francis <alistair.francis@wdc.com >
2023-05-05 10:49:50 +10:00
696bacde95
target/riscv: Set MMU_2STAGE_BIT in riscv_cpu_mmu_index
...
Incorporate the virt_enabled and MPV checks into the cpu_mmu_index
function, so we don't have to keep doing it within tlb_fill and
subroutines. This also elides a flush on changes to MPV.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
Reviewed-by: Alistair Francis <alistair.francis@wdc.com >
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn >
Tested-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com >
Message-Id: <20230325105429.1142530-17-richard.henderson@linaro.org >
Message-Id: <20230412114333.118895-17-richard.henderson@linaro.org >
Signed-off-by: Alistair Francis <alistair.francis@wdc.com >
2023-05-05 10:49:50 +10:00
9de7b7b5c7
target/riscv: Move hstatus.spvp check to check_access_hlsv
...
The current cpu_mmu_index value is really irrelevant to
the HLV/HSV lookup. Provide the correct priv level directly.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
Reviewed-by: Alistair Francis <alistair.francis@wdc.com >
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn >
Tested-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com >
Message-Id: <20230325105429.1142530-16-richard.henderson@linaro.org >
Message-Id: <20230412114333.118895-16-richard.henderson@linaro.org >
Signed-off-by: Alistair Francis <alistair.francis@wdc.com >
2023-05-05 10:49:50 +10:00
02369f7906
target/riscv: Introduce mmuidx_2stage
...
Move and rename riscv_cpu_two_stage_lookup, to match
the other mmuidx_* functions.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
Reviewed-by: Alistair Francis <alistair.francis@wdc.com >
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn >
Tested-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com >
Message-Id: <20230325105429.1142530-15-richard.henderson@linaro.org >
Message-Id: <20230412114333.118895-15-richard.henderson@linaro.org >
Signed-off-by: Alistair Francis <alistair.francis@wdc.com >
2023-05-05 10:49:50 +10:00
340b5805db
target/riscv: Introduce mmuidx_priv
...
Use the priv level encoded into the mmu_idx, rather than
starting from env->priv. We have already checked MPRV+MPP
in riscv_cpu_mmu_index -- no need to repeat that.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org >
Reviewed-by: Alistair Francis <alistair.francis@wdc.com >
Reviewed-by: Weiwei Li <liweiwei@iscas.ac.cn >
Tested-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com >
Message-Id: <20230325105429.1142530-14-richard.henderson@linaro.org >
Message-Id: <20230412114333.118895-14-richard.henderson@linaro.org >
Signed-off-by: Alistair Francis <alistair.francis@wdc.com >
2023-05-05 10:49:50 +10:00