1
Another arm pullreq; nothing particularly exciting here.
1
The following changes since commit 5767815218efd3cbfd409505ed824d5f356044ae:
2
2
3
-- PMM
3
Merge tag 'for_upstream' of https://git.kernel.org/pub/scm/virt/kvm/mst/qemu into staging (2024-02-14 15:45:52 +0000)
4
5
6
The following changes since commit e27d5b488ef08408691bfed61f34ee2858136287:
7
8
Merge remote-tracking branch 'remotes/juanquintela/tags/pull-migration-pull-request' into staging (2020-02-28 14:02:31 +0000)
9
4
10
are available in the Git repository at:
5
are available in the Git repository at:
11
6
12
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20200228
7
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20240215
13
8
14
for you to fetch changes up to 1904f9b5f1d94fe12fe021db6b504c87d684f6db:
9
for you to fetch changes up to f780e63fe731b058fe52d43653600d8729a1b5f2:
15
10
16
hw/intc/arm_gic_kvm: Don't assume kernel can provide a GICv2 (2020-02-28 16:14:57 +0000)
11
docs: Add documentation for the mps3-an536 board (2024-02-15 14:32:39 +0000)
17
12
18
----------------------------------------------------------------
13
----------------------------------------------------------------
19
target-arm queue:
14
target-arm queue:
20
* hw/arm: Use TYPE_PL011 to create serial port
15
* hw/arm/xilinx_zynq: Wire FIQ between CPU <> GIC
21
* target/arm: Set ID_MMFR4.HPDS for aarch64_max_initfn
16
* linux-user/aarch64: Choose SYNC as the preferred MTE mode
22
* hw/arm/integratorcp: Map the audio codec controller
17
* Fix some errors in SVE/SME handling of MTE tags
23
* GICv2: Correctly implement the limited number of priority bits
18
* hw/pci-host/raven.c: Mark raven_io_ops as implementing unaligned accesses
24
* target/arm: refactoring of VFP related feature checks and decode
19
* hw/block/tc58128: Don't emit deprecation warning under qtest
25
* xilinx_zynq: Fix USB port instantiation
20
* tests/qtest: Fix handling of npcm7xx and GMAC tests
26
* acceptance tests for n800, n810, integratorcp
21
* hw/arm/virt: Wire up non-secure EL2 virtual timer IRQ
27
* Implement v8.3-RCPC, v8.4-RCPC, v8.3-CCIDX
22
* tests/qtest/npcm7xx_emc-test: Connect all NICs to a backend
28
* arm_gic_kvm: Don't assume kernel can provide a GICv2
23
* Don't assert on vmload/vmsave of M-profile CPUs
29
(provide better error message for user error)
24
* hw/arm/smmuv3: add support for stage 1 access fault
25
* hw/arm/stellaris: QOM cleanups
26
* Use new CBAR encoding for all v8 CPUs, not all aarch64 CPUs
27
* Improve Cortex_R52 IMPDEF sysreg modelling
28
* Allow access to SPSR_hyp from hyp mode
29
* New board model mps3-an536 (Cortex-R52)
30
30
31
----------------------------------------------------------------
31
----------------------------------------------------------------
32
Gavin Shan (1):
32
Luc Michel (1):
33
hw/arm: Use TYPE_PL011 to create serial port
33
hw/arm/smmuv3: add support for stage 1 access fault
34
34
35
Guenter Roeck (2):
35
Nabih Estefan (1):
36
hw/arm/xilinx_zynq: Fix USB port instantiation
36
tests/qtest: Fix GMAC test to run on a machine in upstream QEMU
37
hw/usb/hcd-ehci-sysbus: Remove obsolete xlnx, ps7-usb class
38
37
39
Peter Maydell (5):
38
Peter Maydell (22):
40
target/arm: Fix wrong use of FIELD_EX32 on ID_AA64DFR0
39
hw/pci-host/raven.c: Mark raven_io_ops as implementing unaligned accesses
41
target/arm: Implement v8.3-RCPC
40
hw/block/tc58128: Don't emit deprecation warning under qtest
42
target/arm: Implement v8.4-RCPC
41
tests/qtest/meson.build: Don't include qtests_npcm7xx in qtests_aarch64
43
target/arm: Implement ARMv8.3-CCIDX
42
tests/qtest/bios-tables-test: Allow changes to virt GTDT
44
hw/intc/arm_gic_kvm: Don't assume kernel can provide a GICv2
43
hw/arm/virt: Wire up non-secure EL2 virtual timer IRQ
44
tests/qtest/bios-tables-tests: Update virt golden reference
45
hw/arm/npcm7xx: Call qemu_configure_nic_device() for GMAC modules
46
tests/qtest/npcm7xx_emc-test: Connect all NICs to a backend
47
target/arm: Don't get MDCR_EL2 in pmu_counter_enabled() before checking ARM_FEATURE_PMU
48
target/arm: Use new CBAR encoding for all v8 CPUs, not all aarch64 CPUs
49
target/arm: The Cortex-R52 has a read-only CBAR
50
target/arm: Add Cortex-R52 IMPDEF sysregs
51
target/arm: Allow access to SPSR_hyp from hyp mode
52
hw/misc/mps2-scc: Fix condition for CFG3 register
53
hw/misc/mps2-scc: Factor out which-board conditionals
54
hw/misc/mps2-scc: Make changes needed for AN536 FPGA image
55
hw/arm/mps3r: Initial skeleton for mps3-an536 board
56
hw/arm/mps3r: Add CPUs, GIC, and per-CPU RAM
57
hw/arm/mps3r: Add UARTs
58
hw/arm/mps3r: Add GPIO, watchdog, dual-timer, I2C devices
59
hw/arm/mps3r: Add remaining devices
60
docs: Add documentation for the mps3-an536 board
45
61
46
Philippe Mathieu-Daudé (3):
62
Philippe Mathieu-Daudé (5):
47
hw/arm/integratorcp: Map the audio codec controller
63
hw/arm/xilinx_zynq: Wire FIQ between CPU <> GIC
48
tests/acceptance: Extract boot_integratorcp() from test_integratorcp()
64
hw/arm/stellaris: Convert ADC controller to Resettable interface
49
tests/acceptance/integratorcp: Verify Tux is displayed on framebuffer
65
hw/arm/stellaris: Convert I2C controller to Resettable interface
66
hw/arm/stellaris: Add missing QOM 'machine' parent
67
hw/arm/stellaris: Add missing QOM 'SoC' parent
50
68
51
Richard Henderson (17):
69
Richard Henderson (6):
52
target/arm: Set ID_MMFR4.HPDS for aarch64_max_initfn
70
linux-user/aarch64: Choose SYNC as the preferred MTE mode
53
target/arm: Add isar_feature_aa32_vfp_simd
71
target/arm: Fix nregs computation in do_{ld,st}_zpa
54
target/arm: Rename isar_feature_aa32_fpdp_v2
72
target/arm: Adjust and validate mtedesc sizem1
55
target/arm: Add isar_feature_aa32_{fpsp_v2, fpsp_v3, fpdp_v3}
73
target/arm: Split out make_svemte_desc
56
target/arm: Add isar_feature_aa64_fp_simd, isar_feature_aa32_vfp
74
target/arm: Handle mte in do_ldrq, do_ldro
57
target/arm: Perform fpdp_v2 check first
75
target/arm: Fix SVE/SME gross MTE suppression checks
58
target/arm: Replace ARM_FEATURE_VFP3 checks with fp{sp, dp}_v3
59
target/arm: Add missing checks for fpsp_v2
60
target/arm: Replace ARM_FEATURE_VFP4 with isar_feature_aa32_simdfmac
61
target/arm: Remove ARM_FEATURE_VFP check from disas_vfp_insn
62
target/arm: Move VLLDM and VLSTM to vfp.decode
63
target/arm: Move the vfp decodetree calls next to the base isa
64
linux-user/arm: Replace ARM_FEATURE_VFP* tests for HWCAP
65
target/arm: Remove ARM_FEATURE_VFP*
66
target/arm: Add formats for some vfp 2 and 3-register insns
67
target/arm: Split VFM decode
68
target/arm: Split VMINMAXNM decode
69
76
70
Sai Pavan Boddu (3):
77
MAINTAINERS | 3 +-
71
arm_gic: Mask the un-supported priority bits
78
docs/system/arm/mps2.rst | 37 +-
72
cpu/a9mpcore: Set number of GIC priority bits to 5
79
configs/devices/arm-softmmu/default.mak | 1 +
73
cpu/arm11mpcore: Set number of GIC priority bits to 4
80
hw/arm/smmuv3-internal.h | 1 +
81
include/hw/arm/smmu-common.h | 1 +
82
include/hw/arm/virt.h | 2 +
83
include/hw/misc/mps2-scc.h | 1 +
84
linux-user/aarch64/target_prctl.h | 29 +-
85
target/arm/internals.h | 2 +-
86
target/arm/tcg/translate-a64.h | 2 +
87
hw/arm/mps3r.c | 640 ++++++++++++++++++++++++++++++++
88
hw/arm/npcm7xx.c | 1 +
89
hw/arm/smmu-common.c | 11 +
90
hw/arm/smmuv3.c | 1 +
91
hw/arm/stellaris.c | 47 ++-
92
hw/arm/virt-acpi-build.c | 20 +-
93
hw/arm/virt.c | 60 ++-
94
hw/arm/xilinx_zynq.c | 2 +
95
hw/block/tc58128.c | 4 +-
96
hw/misc/mps2-scc.c | 138 ++++++-
97
hw/pci-host/raven.c | 1 +
98
target/arm/helper.c | 14 +-
99
target/arm/tcg/cpu32.c | 109 ++++++
100
target/arm/tcg/op_helper.c | 43 ++-
101
target/arm/tcg/sme_helper.c | 8 +-
102
target/arm/tcg/sve_helper.c | 12 +-
103
target/arm/tcg/translate-sme.c | 15 +-
104
target/arm/tcg/translate-sve.c | 83 +++--
105
target/arm/tcg/translate.c | 19 +-
106
tests/qtest/npcm7xx_emc-test.c | 5 +-
107
tests/qtest/npcm_gmac-test.c | 84 +----
108
hw/arm/Kconfig | 5 +
109
hw/arm/meson.build | 1 +
110
tests/data/acpi/virt/FACP | Bin 276 -> 276 bytes
111
tests/data/acpi/virt/GTDT | Bin 96 -> 104 bytes
112
tests/qtest/meson.build | 4 +-
113
36 files changed, 1184 insertions(+), 222 deletions(-)
114
create mode 100644 hw/arm/mps3r.c
74
115
75
Thomas Huth (2):
76
tests/acceptance: Add a test for the N800 and N810 arm machines
77
tests/acceptance: Add a test for the integratorcp arm machine
78
79
include/hw/intc/arm_gic.h | 2 +
80
include/hw/intc/arm_gic_common.h | 1 +
81
target/arm/cpu.h | 88 +++++-
82
hw/arm/integratorcp.c | 1 +
83
hw/arm/sbsa-ref.c | 3 +-
84
hw/arm/virt.c | 3 +-
85
hw/arm/xilinx_zynq.c | 5 +-
86
hw/arm/xlnx-versal.c | 3 +-
87
hw/cpu/a9mpcore.c | 4 +
88
hw/cpu/arm11mpcore.c | 5 +
89
hw/intc/arm_gic.c | 33 +-
90
hw/intc/arm_gic_common.c | 1 +
91
hw/intc/arm_gic_kvm.c | 9 +
92
hw/intc/armv7m_nvic.c | 20 +-
93
hw/usb/hcd-ehci-sysbus.c | 17 -
94
linux-user/arm/signal.c | 4 +-
95
linux-user/elfload.c | 25 +-
96
target/arm/arch_dump.c | 11 +-
97
target/arm/cpu.c | 44 +--
98
target/arm/cpu64.c | 5 +-
99
target/arm/helper.c | 23 +-
100
target/arm/kvm32.c | 5 -
101
target/arm/kvm64.c | 1 -
102
target/arm/m_helper.c | 11 +-
103
target/arm/machine.c | 5 +-
104
target/arm/translate-a64.c | 114 +++++++
105
target/arm/translate-vfp.inc.c | 448 +++++++++++++++++----------
106
target/arm/translate.c | 122 ++------
107
MAINTAINERS | 2 +
108
hw/arm/Kconfig | 1 +
109
target/arm/vfp-uncond.decode | 12 +-
110
target/arm/vfp.decode | 153 ++++-----
111
tests/acceptance/machine_arm_integratorcp.py | 99 ++++++
112
tests/acceptance/machine_arm_n8x0.py | 49 +++
113
34 files changed, 865 insertions(+), 464 deletions(-)
114
create mode 100644 tests/acceptance/machine_arm_integratorcp.py
115
create mode 100644 tests/acceptance/machine_arm_n8x0.py
116
diff view generated by jsdifflib
1
From: Guenter Roeck <linux@roeck-us.net>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
USB ports on Xilinx Zync must be instantiated as TYPE_CHIPIDEA to work.
3
Similarly to commits dadbb58f59..5ae79fe825 for other ARM boards,
4
Linux expects and checks various chipidea registers, which do not exist
4
connect FIQ output of the GIC CPU interfaces to the CPU.
5
with the basic ehci emulation. This patch series fixes the problem.
6
5
7
Without this patch, USB ports fail to instantiate under Linux.
6
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
8
7
Message-id: 20240130152548.17855-1-philmd@linaro.org
9
ci_hdrc ci_hdrc.0: doesn't support host
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
10
ci_hdrc ci_hdrc.0: no supported roles
11
12
With this patch, USB ports are instantiated, and it is possible
13
to boot from USB drive.
14
15
ci_hdrc ci_hdrc.0: EHCI Host Controller
16
ci_hdrc ci_hdrc.0: new USB bus registered, assigned bus number 1
17
ci_hdrc ci_hdrc.0: USB 2.0 started, EHCI 1.00
18
usb 1-1: new full-speed USB device number 2 using ci_hdrc
19
usb 1-1: not running at top speed; connect to a high speed hub
20
usb 1-1: config 1 interface 0 altsetting 0 endpoint 0x81 has invalid maxpacket 512, setting to 64
21
usb 1-1: config 1 interface 0 altsetting 0 endpoint 0x2 has invalid maxpacket 512, setting to 64
22
usb-storage 1-1:1.0: USB Mass Storage device detected
23
scsi host0: usb-storage 1-1:1.0
24
25
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
26
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
27
Message-id: 20200215122354.13706-2-linux@roeck-us.net
28
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
29
---
10
---
30
hw/arm/xilinx_zynq.c | 5 +++--
11
hw/arm/xilinx_zynq.c | 2 ++
31
1 file changed, 3 insertions(+), 2 deletions(-)
12
1 file changed, 2 insertions(+)
32
13
33
diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c
14
diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c
34
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
35
--- a/hw/arm/xilinx_zynq.c
16
--- a/hw/arm/xilinx_zynq.c
36
+++ b/hw/arm/xilinx_zynq.c
17
+++ b/hw/arm/xilinx_zynq.c
37
@@ -XXX,XX +XXX,XX @@
38
#include "hw/loader.h"
39
#include "hw/misc/zynq-xadc.h"
40
#include "hw/ssi/ssi.h"
41
+#include "hw/usb/chipidea.h"
42
#include "qemu/error-report.h"
43
#include "hw/sd/sdhci.h"
44
#include "hw/char/cadence_uart.h"
45
@@ -XXX,XX +XXX,XX @@ static void zynq_init(MachineState *machine)
18
@@ -XXX,XX +XXX,XX @@ static void zynq_init(MachineState *machine)
46
zynq_init_spi_flashes(0xE0007000, pic[81-IRQ_OFFSET], false);
19
sysbus_mmio_map(busdev, 0, MPCORE_PERIPHBASE);
47
zynq_init_spi_flashes(0xE000D000, pic[51-IRQ_OFFSET], true);
20
sysbus_connect_irq(busdev, 0,
48
21
qdev_get_gpio_in(DEVICE(cpu), ARM_CPU_IRQ));
49
- sysbus_create_simple("xlnx,ps7-usb", 0xE0002000, pic[53-IRQ_OFFSET]);
22
+ sysbus_connect_irq(busdev, 1,
50
- sysbus_create_simple("xlnx,ps7-usb", 0xE0003000, pic[76-IRQ_OFFSET]);
23
+ qdev_get_gpio_in(DEVICE(cpu), ARM_CPU_FIQ));
51
+ sysbus_create_simple(TYPE_CHIPIDEA, 0xE0002000, pic[53 - IRQ_OFFSET]);
24
52
+ sysbus_create_simple(TYPE_CHIPIDEA, 0xE0003000, pic[76 - IRQ_OFFSET]);
25
for (n = 0; n < 64; n++) {
53
26
pic[n] = qdev_get_gpio_in(dev, n);
54
cadence_uart_create(0xE0000000, pic[59 - IRQ_OFFSET], serial_hd(0));
55
cadence_uart_create(0xE0001000, pic[82 - IRQ_OFFSET], serial_hd(1));
56
--
27
--
57
2.20.1
28
2.34.1
58
29
59
30
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
Those vfp instructions without extra opcode fields can
3
The API does not generate an error for setting ASYNC | SYNC; that merely
4
share a common @format for brevity.
4
constrains the selection vs the per-cpu default. For qemu linux-user,
5
choose SYNC as the default.
5
6
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Cc: qemu-stable@nongnu.org
8
Reported-by: Gustavo Romero <gustavo.romero@linaro.org>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20200224222232.13807-16-richard.henderson@linaro.org
10
Tested-by: Gustavo Romero <gustavo.romero@linaro.org>
11
Message-id: 20240207025210.8837-2-richard.henderson@linaro.org
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
13
---
11
target/arm/vfp.decode | 134 ++++++++++++++++--------------------------
14
linux-user/aarch64/target_prctl.h | 29 +++++++++++++++++------------
12
1 file changed, 52 insertions(+), 82 deletions(-)
15
1 file changed, 17 insertions(+), 12 deletions(-)
13
16
14
diff --git a/target/arm/vfp.decode b/target/arm/vfp.decode
17
diff --git a/linux-user/aarch64/target_prctl.h b/linux-user/aarch64/target_prctl.h
15
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/vfp.decode
19
--- a/linux-user/aarch64/target_prctl.h
17
+++ b/target/arm/vfp.decode
20
+++ b/linux-user/aarch64/target_prctl.h
18
@@ -XXX,XX +XXX,XX @@
21
@@ -XXX,XX +XXX,XX @@ static abi_long do_prctl_set_tagged_addr_ctrl(CPUArchState *env, abi_long arg2)
19
22
env->tagged_addr_enable = arg2 & PR_TAGGED_ADDR_ENABLE;
20
%vmov_imm 16:4 0:4
23
21
24
if (cpu_isar_feature(aa64_mte, cpu)) {
22
+@vfp_dnm_s ................................ vm=%vm_sp vn=%vn_sp vd=%vd_sp
25
- switch (arg2 & PR_MTE_TCF_MASK) {
23
+@vfp_dnm_d ................................ vm=%vm_dp vn=%vn_dp vd=%vd_dp
26
- case PR_MTE_TCF_NONE:
24
+
27
- case PR_MTE_TCF_SYNC:
25
+@vfp_dm_ss ................................ vm=%vm_sp vd=%vd_sp
28
- case PR_MTE_TCF_ASYNC:
26
+@vfp_dm_dd ................................ vm=%vm_dp vd=%vd_dp
29
- break;
27
+@vfp_dm_ds ................................ vm=%vm_sp vd=%vd_dp
30
- default:
28
+@vfp_dm_sd ................................ vm=%vm_dp vd=%vd_sp
31
- return -EINVAL;
29
+
32
- }
30
# VMOV scalar to general-purpose register; note that this does
33
-
31
# include some Neon cases.
34
/*
32
VMOV_to_gp ---- 1110 u:1 1. 1 .... rt:4 1011 ... 1 0000 \
35
* Write PR_MTE_TCF to SCTLR_EL1[TCF0].
33
@@ -XXX,XX +XXX,XX @@ VDUP ---- 1110 1 b:1 q:1 0 .... rt:4 1011 . 0 e:1 1 0000 \
36
- * Note that the syscall values are consistent with hw.
34
vn=%vn_dp
37
+ *
35
38
+ * The kernel has a per-cpu configuration for the sysadmin,
36
VMSR_VMRS ---- 1110 111 l:1 reg:4 rt:4 1010 0001 0000
39
+ * /sys/devices/system/cpu/cpu<N>/mte_tcf_preferred,
37
-VMOV_single ---- 1110 000 l:1 .... rt:4 1010 . 001 0000 \
40
+ * which qemu does not implement.
38
- vn=%vn_sp
41
+ *
39
+VMOV_single ---- 1110 000 l:1 .... rt:4 1010 . 001 0000 vn=%vn_sp
42
+ * Because there is no performance difference between the modes, and
40
43
+ * because SYNC is most useful for debugging MTE errors, choose SYNC
41
-VMOV_64_sp ---- 1100 010 op:1 rt2:4 rt:4 1010 00.1 .... \
44
+ * as the preferred mode. With this preference, and the way the API
42
- vm=%vm_sp
45
+ * uses only two bits, there is no way for the program to select
43
-VMOV_64_dp ---- 1100 010 op:1 rt2:4 rt:4 1011 00.1 .... \
46
+ * ASYMM mode.
44
- vm=%vm_dp
47
*/
45
+VMOV_64_sp ---- 1100 010 op:1 rt2:4 rt:4 1010 00.1 .... vm=%vm_sp
48
- env->cp15.sctlr_el[1] =
46
+VMOV_64_dp ---- 1100 010 op:1 rt2:4 rt:4 1011 00.1 .... vm=%vm_dp
49
- deposit64(env->cp15.sctlr_el[1], 38, 2, arg2 >> PR_MTE_TCF_SHIFT);
47
50
+ unsigned tcf = 0;
48
# Note that the half-precision variants of VLDR and VSTR are
51
+ if (arg2 & PR_MTE_TCF_SYNC) {
49
# not part of this decodetree at all because they have bits [9:8] == 0b01
52
+ tcf = 1;
50
-VLDR_VSTR_sp ---- 1101 u:1 .0 l:1 rn:4 .... 1010 imm:8 \
53
+ } else if (arg2 & PR_MTE_TCF_ASYNC) {
51
- vd=%vd_sp
54
+ tcf = 2;
52
-VLDR_VSTR_dp ---- 1101 u:1 .0 l:1 rn:4 .... 1011 imm:8 \
55
+ }
53
- vd=%vd_dp
56
+ env->cp15.sctlr_el[1] = deposit64(env->cp15.sctlr_el[1], 38, 2, tcf);
54
+VLDR_VSTR_sp ---- 1101 u:1 .0 l:1 rn:4 .... 1010 imm:8 vd=%vd_sp
57
55
+VLDR_VSTR_dp ---- 1101 u:1 .0 l:1 rn:4 .... 1011 imm:8 vd=%vd_dp
58
/*
56
59
* Write PR_MTE_TAG to GCR_EL1[Exclude].
57
# We split the load/store multiple up into two patterns to avoid
58
# overlap with other insns in the "Advanced SIMD load/store and 64-bit move"
59
@@ -XXX,XX +XXX,XX @@ VLDM_VSTM_dp ---- 1101 0.1 l:1 rn:4 .... 1011 imm:8 \
60
vd=%vd_dp p=1 u=0 w=1
61
62
# 3-register VFP data-processing; bits [23,21:20,6] identify the operation.
63
-VMLA_sp ---- 1110 0.00 .... .... 1010 .0.0 .... \
64
- vm=%vm_sp vn=%vn_sp vd=%vd_sp
65
-VMLA_dp ---- 1110 0.00 .... .... 1011 .0.0 .... \
66
- vm=%vm_dp vn=%vn_dp vd=%vd_dp
67
+VMLA_sp ---- 1110 0.00 .... .... 1010 .0.0 .... @vfp_dnm_s
68
+VMLA_dp ---- 1110 0.00 .... .... 1011 .0.0 .... @vfp_dnm_d
69
70
-VMLS_sp ---- 1110 0.00 .... .... 1010 .1.0 .... \
71
- vm=%vm_sp vn=%vn_sp vd=%vd_sp
72
-VMLS_dp ---- 1110 0.00 .... .... 1011 .1.0 .... \
73
- vm=%vm_dp vn=%vn_dp vd=%vd_dp
74
+VMLS_sp ---- 1110 0.00 .... .... 1010 .1.0 .... @vfp_dnm_s
75
+VMLS_dp ---- 1110 0.00 .... .... 1011 .1.0 .... @vfp_dnm_d
76
77
-VNMLS_sp ---- 1110 0.01 .... .... 1010 .0.0 .... \
78
- vm=%vm_sp vn=%vn_sp vd=%vd_sp
79
-VNMLS_dp ---- 1110 0.01 .... .... 1011 .0.0 .... \
80
- vm=%vm_dp vn=%vn_dp vd=%vd_dp
81
+VNMLS_sp ---- 1110 0.01 .... .... 1010 .0.0 .... @vfp_dnm_s
82
+VNMLS_dp ---- 1110 0.01 .... .... 1011 .0.0 .... @vfp_dnm_d
83
84
-VNMLA_sp ---- 1110 0.01 .... .... 1010 .1.0 .... \
85
- vm=%vm_sp vn=%vn_sp vd=%vd_sp
86
-VNMLA_dp ---- 1110 0.01 .... .... 1011 .1.0 .... \
87
- vm=%vm_dp vn=%vn_dp vd=%vd_dp
88
+VNMLA_sp ---- 1110 0.01 .... .... 1010 .1.0 .... @vfp_dnm_s
89
+VNMLA_dp ---- 1110 0.01 .... .... 1011 .1.0 .... @vfp_dnm_d
90
91
-VMUL_sp ---- 1110 0.10 .... .... 1010 .0.0 .... \
92
- vm=%vm_sp vn=%vn_sp vd=%vd_sp
93
-VMUL_dp ---- 1110 0.10 .... .... 1011 .0.0 .... \
94
- vm=%vm_dp vn=%vn_dp vd=%vd_dp
95
+VMUL_sp ---- 1110 0.10 .... .... 1010 .0.0 .... @vfp_dnm_s
96
+VMUL_dp ---- 1110 0.10 .... .... 1011 .0.0 .... @vfp_dnm_d
97
98
-VNMUL_sp ---- 1110 0.10 .... .... 1010 .1.0 .... \
99
- vm=%vm_sp vn=%vn_sp vd=%vd_sp
100
-VNMUL_dp ---- 1110 0.10 .... .... 1011 .1.0 .... \
101
- vm=%vm_dp vn=%vn_dp vd=%vd_dp
102
+VNMUL_sp ---- 1110 0.10 .... .... 1010 .1.0 .... @vfp_dnm_s
103
+VNMUL_dp ---- 1110 0.10 .... .... 1011 .1.0 .... @vfp_dnm_d
104
105
-VADD_sp ---- 1110 0.11 .... .... 1010 .0.0 .... \
106
- vm=%vm_sp vn=%vn_sp vd=%vd_sp
107
-VADD_dp ---- 1110 0.11 .... .... 1011 .0.0 .... \
108
- vm=%vm_dp vn=%vn_dp vd=%vd_dp
109
+VADD_sp ---- 1110 0.11 .... .... 1010 .0.0 .... @vfp_dnm_s
110
+VADD_dp ---- 1110 0.11 .... .... 1011 .0.0 .... @vfp_dnm_d
111
112
-VSUB_sp ---- 1110 0.11 .... .... 1010 .1.0 .... \
113
- vm=%vm_sp vn=%vn_sp vd=%vd_sp
114
-VSUB_dp ---- 1110 0.11 .... .... 1011 .1.0 .... \
115
- vm=%vm_dp vn=%vn_dp vd=%vd_dp
116
+VSUB_sp ---- 1110 0.11 .... .... 1010 .1.0 .... @vfp_dnm_s
117
+VSUB_dp ---- 1110 0.11 .... .... 1011 .1.0 .... @vfp_dnm_d
118
119
-VDIV_sp ---- 1110 1.00 .... .... 1010 .0.0 .... \
120
- vm=%vm_sp vn=%vn_sp vd=%vd_sp
121
-VDIV_dp ---- 1110 1.00 .... .... 1011 .0.0 .... \
122
- vm=%vm_dp vn=%vn_dp vd=%vd_dp
123
+VDIV_sp ---- 1110 1.00 .... .... 1010 .0.0 .... @vfp_dnm_s
124
+VDIV_dp ---- 1110 1.00 .... .... 1011 .0.0 .... @vfp_dnm_d
125
126
VFM_sp ---- 1110 1.01 .... .... 1010 . o2:1 . 0 .... \
127
vm=%vm_sp vn=%vn_sp vd=%vd_sp o1=1
128
@@ -XXX,XX +XXX,XX @@ VMOV_imm_sp ---- 1110 1.11 .... .... 1010 0000 .... \
129
VMOV_imm_dp ---- 1110 1.11 .... .... 1011 0000 .... \
130
vd=%vd_dp imm=%vmov_imm
131
132
-VMOV_reg_sp ---- 1110 1.11 0000 .... 1010 01.0 .... \
133
- vd=%vd_sp vm=%vm_sp
134
-VMOV_reg_dp ---- 1110 1.11 0000 .... 1011 01.0 .... \
135
- vd=%vd_dp vm=%vm_dp
136
+VMOV_reg_sp ---- 1110 1.11 0000 .... 1010 01.0 .... @vfp_dm_ss
137
+VMOV_reg_dp ---- 1110 1.11 0000 .... 1011 01.0 .... @vfp_dm_dd
138
139
-VABS_sp ---- 1110 1.11 0000 .... 1010 11.0 .... \
140
- vd=%vd_sp vm=%vm_sp
141
-VABS_dp ---- 1110 1.11 0000 .... 1011 11.0 .... \
142
- vd=%vd_dp vm=%vm_dp
143
+VABS_sp ---- 1110 1.11 0000 .... 1010 11.0 .... @vfp_dm_ss
144
+VABS_dp ---- 1110 1.11 0000 .... 1011 11.0 .... @vfp_dm_dd
145
146
-VNEG_sp ---- 1110 1.11 0001 .... 1010 01.0 .... \
147
- vd=%vd_sp vm=%vm_sp
148
-VNEG_dp ---- 1110 1.11 0001 .... 1011 01.0 .... \
149
- vd=%vd_dp vm=%vm_dp
150
+VNEG_sp ---- 1110 1.11 0001 .... 1010 01.0 .... @vfp_dm_ss
151
+VNEG_dp ---- 1110 1.11 0001 .... 1011 01.0 .... @vfp_dm_dd
152
153
-VSQRT_sp ---- 1110 1.11 0001 .... 1010 11.0 .... \
154
- vd=%vd_sp vm=%vm_sp
155
-VSQRT_dp ---- 1110 1.11 0001 .... 1011 11.0 .... \
156
- vd=%vd_dp vm=%vm_dp
157
+VSQRT_sp ---- 1110 1.11 0001 .... 1010 11.0 .... @vfp_dm_ss
158
+VSQRT_dp ---- 1110 1.11 0001 .... 1011 11.0 .... @vfp_dm_dd
159
160
VCMP_sp ---- 1110 1.11 010 z:1 .... 1010 e:1 1.0 .... \
161
vd=%vd_sp vm=%vm_sp
162
@@ -XXX,XX +XXX,XX @@ VCVT_f32_f16 ---- 1110 1.11 0010 .... 1010 t:1 1.0 .... \
163
VCVT_f64_f16 ---- 1110 1.11 0010 .... 1011 t:1 1.0 .... \
164
vd=%vd_dp vm=%vm_sp
165
166
-# VCVTB and VCVTT to f16: Vd format is always vd_sp; Vm format depends on size bit
167
+# VCVTB and VCVTT to f16: Vd format is always vd_sp;
168
+# Vm format depends on size bit
169
VCVT_f16_f32 ---- 1110 1.11 0011 .... 1010 t:1 1.0 .... \
170
vd=%vd_sp vm=%vm_sp
171
VCVT_f16_f64 ---- 1110 1.11 0011 .... 1011 t:1 1.0 .... \
172
vd=%vd_sp vm=%vm_dp
173
174
-VRINTR_sp ---- 1110 1.11 0110 .... 1010 01.0 .... \
175
- vd=%vd_sp vm=%vm_sp
176
-VRINTR_dp ---- 1110 1.11 0110 .... 1011 01.0 .... \
177
- vd=%vd_dp vm=%vm_dp
178
+VRINTR_sp ---- 1110 1.11 0110 .... 1010 01.0 .... @vfp_dm_ss
179
+VRINTR_dp ---- 1110 1.11 0110 .... 1011 01.0 .... @vfp_dm_dd
180
181
-VRINTZ_sp ---- 1110 1.11 0110 .... 1010 11.0 .... \
182
- vd=%vd_sp vm=%vm_sp
183
-VRINTZ_dp ---- 1110 1.11 0110 .... 1011 11.0 .... \
184
- vd=%vd_dp vm=%vm_dp
185
+VRINTZ_sp ---- 1110 1.11 0110 .... 1010 11.0 .... @vfp_dm_ss
186
+VRINTZ_dp ---- 1110 1.11 0110 .... 1011 11.0 .... @vfp_dm_dd
187
188
-VRINTX_sp ---- 1110 1.11 0111 .... 1010 01.0 .... \
189
- vd=%vd_sp vm=%vm_sp
190
-VRINTX_dp ---- 1110 1.11 0111 .... 1011 01.0 .... \
191
- vd=%vd_dp vm=%vm_dp
192
+VRINTX_sp ---- 1110 1.11 0111 .... 1010 01.0 .... @vfp_dm_ss
193
+VRINTX_dp ---- 1110 1.11 0111 .... 1011 01.0 .... @vfp_dm_dd
194
195
-# VCVT between single and double: Vm precision depends on size; Vd is its reverse
196
-VCVT_sp ---- 1110 1.11 0111 .... 1010 11.0 .... \
197
- vd=%vd_dp vm=%vm_sp
198
-VCVT_dp ---- 1110 1.11 0111 .... 1011 11.0 .... \
199
- vd=%vd_sp vm=%vm_dp
200
+# VCVT between single and double:
201
+# Vm precision depends on size; Vd is its reverse
202
+VCVT_sp ---- 1110 1.11 0111 .... 1010 11.0 .... @vfp_dm_ds
203
+VCVT_dp ---- 1110 1.11 0111 .... 1011 11.0 .... @vfp_dm_sd
204
205
# VCVT from integer to floating point: Vm always single; Vd depends on size
206
VCVT_int_sp ---- 1110 1.11 1000 .... 1010 s:1 1.0 .... \
207
@@ -XXX,XX +XXX,XX @@ VCVT_int_dp ---- 1110 1.11 1000 .... 1011 s:1 1.0 .... \
208
vd=%vd_dp vm=%vm_sp
209
210
# VJCVT is always dp to sp
211
-VJCVT ---- 1110 1.11 1001 .... 1011 11.0 .... \
212
- vd=%vd_sp vm=%vm_dp
213
+VJCVT ---- 1110 1.11 1001 .... 1011 11.0 .... @vfp_dm_sd
214
215
# VCVT between floating-point and fixed-point. The immediate value
216
# is in the same format as a Vm single-precision register number.
217
--
60
--
218
2.20.1
61
2.34.1
219
220
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
The old name, isar_feature_aa32_fpdp, does not reflect
3
The field is encoded as [0-3], which is convenient for
4
that the test includes VFPv2. We will introduce another
4
indexing our array of function pointers, but the true
5
feature tests for VFPv3.
5
value is [1-4]. Adjust before calling do_mem_zpa.
6
6
7
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
7
Add an assert, and move the comment re passing ZT to
8
the helper back next to the relevant code.
9
10
Cc: qemu-stable@nongnu.org
11
Fixes: 206adacfb8d ("target/arm: Add mte helpers for sve scalar + int loads")
8
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
12
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20200224222232.13807-3-richard.henderson@linaro.org
13
Tested-by: Gustavo Romero <gustavo.romero@linaro.org>
14
Message-id: 20240207025210.8837-3-richard.henderson@linaro.org
15
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
17
---
12
target/arm/cpu.h | 4 ++--
18
target/arm/tcg/translate-sve.c | 16 ++++++++--------
13
target/arm/translate-vfp.inc.c | 40 +++++++++++++++++-----------------
19
1 file changed, 8 insertions(+), 8 deletions(-)
14
2 files changed, 22 insertions(+), 22 deletions(-)
15
20
16
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
21
diff --git a/target/arm/tcg/translate-sve.c b/target/arm/tcg/translate-sve.c
17
index XXXXXXX..XXXXXXX 100644
22
index XXXXXXX..XXXXXXX 100644
18
--- a/target/arm/cpu.h
23
--- a/target/arm/tcg/translate-sve.c
19
+++ b/target/arm/cpu.h
24
+++ b/target/arm/tcg/translate-sve.c
20
@@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa32_fpshvec(const ARMISARegisters *id)
25
@@ -XXX,XX +XXX,XX @@ static void do_mem_zpa(DisasContext *s, int zt, int pg, TCGv_i64 addr,
21
return FIELD_EX32(id->mvfr0, MVFR0, FPSHVEC) > 0;
26
TCGv_ptr t_pg;
27
int desc = 0;
28
29
- /*
30
- * For e.g. LD4, there are not enough arguments to pass all 4
31
- * registers as pointers, so encode the regno into the data field.
32
- * For consistency, do this even for LD1.
33
- */
34
+ assert(mte_n >= 1 && mte_n <= 4);
35
if (s->mte_active[0]) {
36
int msz = dtype_msz(dtype);
37
38
@@ -XXX,XX +XXX,XX @@ static void do_mem_zpa(DisasContext *s, int zt, int pg, TCGv_i64 addr,
39
addr = clean_data_tbi(s, addr);
40
}
41
42
+ /*
43
+ * For e.g. LD4, there are not enough arguments to pass all 4
44
+ * registers as pointers, so encode the regno into the data field.
45
+ * For consistency, do this even for LD1.
46
+ */
47
desc = simd_desc(vsz, vsz, zt | desc);
48
t_pg = tcg_temp_new_ptr();
49
50
@@ -XXX,XX +XXX,XX @@ static void do_ld_zpa(DisasContext *s, int zt, int pg,
51
* accessible via the instruction encoding.
52
*/
53
assert(fn != NULL);
54
- do_mem_zpa(s, zt, pg, addr, dtype, nreg, false, fn);
55
+ do_mem_zpa(s, zt, pg, addr, dtype, nreg + 1, false, fn);
22
}
56
}
23
57
24
-static inline bool isar_feature_aa32_fpdp(const ARMISARegisters *id)
58
static bool trans_LD_zprr(DisasContext *s, arg_rprr_load *a)
25
+static inline bool isar_feature_aa32_fpdp_v2(const ARMISARegisters *id)
59
@@ -XXX,XX +XXX,XX @@ static void do_st_zpa(DisasContext *s, int zt, int pg, TCGv_i64 addr,
26
{
60
if (nreg == 0) {
27
- /* Return true if CPU supports double precision floating point */
61
/* ST1 */
28
+ /* Return true if CPU supports double precision floating point, VFPv2 */
62
fn = fn_single[s->mte_active[0]][be][msz][esz];
29
return FIELD_EX32(id->mvfr0, MVFR0, FPDP) > 0;
63
- nreg = 1;
64
} else {
65
/* ST2, ST3, ST4 -- msz == esz, enforced by encoding */
66
assert(msz == esz);
67
fn = fn_multiple[s->mte_active[0]][be][nreg - 1][msz];
68
}
69
assert(fn != NULL);
70
- do_mem_zpa(s, zt, pg, addr, msz_dtype(s, msz), nreg, true, fn);
71
+ do_mem_zpa(s, zt, pg, addr, msz_dtype(s, msz), nreg + 1, true, fn);
30
}
72
}
31
73
32
diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c
74
static bool trans_ST_zprr(DisasContext *s, arg_rprr_store *a)
33
index XXXXXXX..XXXXXXX 100644
34
--- a/target/arm/translate-vfp.inc.c
35
+++ b/target/arm/translate-vfp.inc.c
36
@@ -XXX,XX +XXX,XX @@ static bool trans_VSEL(DisasContext *s, arg_VSEL *a)
37
return false;
38
}
39
40
- if (dp && !dc_isar_feature(aa32_fpdp, s)) {
41
+ if (dp && !dc_isar_feature(aa32_fpdp_v2, s)) {
42
return false;
43
}
44
45
@@ -XXX,XX +XXX,XX @@ static bool trans_VMINMAXNM(DisasContext *s, arg_VMINMAXNM *a)
46
return false;
47
}
48
49
- if (dp && !dc_isar_feature(aa32_fpdp, s)) {
50
+ if (dp && !dc_isar_feature(aa32_fpdp_v2, s)) {
51
return false;
52
}
53
54
@@ -XXX,XX +XXX,XX @@ static bool trans_VRINT(DisasContext *s, arg_VRINT *a)
55
return false;
56
}
57
58
- if (dp && !dc_isar_feature(aa32_fpdp, s)) {
59
+ if (dp && !dc_isar_feature(aa32_fpdp_v2, s)) {
60
return false;
61
}
62
63
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT(DisasContext *s, arg_VCVT *a)
64
return false;
65
}
66
67
- if (dp && !dc_isar_feature(aa32_fpdp, s)) {
68
+ if (dp && !dc_isar_feature(aa32_fpdp_v2, s)) {
69
return false;
70
}
71
72
@@ -XXX,XX +XXX,XX @@ static bool do_vfp_3op_dp(DisasContext *s, VFPGen3OpDPFn *fn,
73
return false;
74
}
75
76
- if (!dc_isar_feature(aa32_fpdp, s)) {
77
+ if (!dc_isar_feature(aa32_fpdp_v2, s)) {
78
return false;
79
}
80
81
@@ -XXX,XX +XXX,XX @@ static bool do_vfp_2op_dp(DisasContext *s, VFPGen2OpDPFn *fn, int vd, int vm)
82
return false;
83
}
84
85
- if (!dc_isar_feature(aa32_fpdp, s)) {
86
+ if (!dc_isar_feature(aa32_fpdp_v2, s)) {
87
return false;
88
}
89
90
@@ -XXX,XX +XXX,XX @@ static bool trans_VFM_dp(DisasContext *s, arg_VFM_dp *a)
91
return false;
92
}
93
94
- if (!dc_isar_feature(aa32_fpdp, s)) {
95
+ if (!dc_isar_feature(aa32_fpdp_v2, s)) {
96
return false;
97
}
98
99
@@ -XXX,XX +XXX,XX @@ static bool trans_VMOV_imm_dp(DisasContext *s, arg_VMOV_imm_dp *a)
100
return false;
101
}
102
103
- if (!dc_isar_feature(aa32_fpdp, s)) {
104
+ if (!dc_isar_feature(aa32_fpdp_v2, s)) {
105
return false;
106
}
107
108
@@ -XXX,XX +XXX,XX @@ static bool trans_VCMP_dp(DisasContext *s, arg_VCMP_dp *a)
109
return false;
110
}
111
112
- if (!dc_isar_feature(aa32_fpdp, s)) {
113
+ if (!dc_isar_feature(aa32_fpdp_v2, s)) {
114
return false;
115
}
116
117
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_f64_f16(DisasContext *s, arg_VCVT_f64_f16 *a)
118
return false;
119
}
120
121
- if (!dc_isar_feature(aa32_fpdp, s)) {
122
+ if (!dc_isar_feature(aa32_fpdp_v2, s)) {
123
return false;
124
}
125
126
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_f16_f64(DisasContext *s, arg_VCVT_f16_f64 *a)
127
return false;
128
}
129
130
- if (!dc_isar_feature(aa32_fpdp, s)) {
131
+ if (!dc_isar_feature(aa32_fpdp_v2, s)) {
132
return false;
133
}
134
135
@@ -XXX,XX +XXX,XX @@ static bool trans_VRINTR_dp(DisasContext *s, arg_VRINTR_dp *a)
136
return false;
137
}
138
139
- if (!dc_isar_feature(aa32_fpdp, s)) {
140
+ if (!dc_isar_feature(aa32_fpdp_v2, s)) {
141
return false;
142
}
143
144
@@ -XXX,XX +XXX,XX @@ static bool trans_VRINTZ_dp(DisasContext *s, arg_VRINTZ_dp *a)
145
return false;
146
}
147
148
- if (!dc_isar_feature(aa32_fpdp, s)) {
149
+ if (!dc_isar_feature(aa32_fpdp_v2, s)) {
150
return false;
151
}
152
153
@@ -XXX,XX +XXX,XX @@ static bool trans_VRINTX_dp(DisasContext *s, arg_VRINTX_dp *a)
154
return false;
155
}
156
157
- if (!dc_isar_feature(aa32_fpdp, s)) {
158
+ if (!dc_isar_feature(aa32_fpdp_v2, s)) {
159
return false;
160
}
161
162
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_sp(DisasContext *s, arg_VCVT_sp *a)
163
return false;
164
}
165
166
- if (!dc_isar_feature(aa32_fpdp, s)) {
167
+ if (!dc_isar_feature(aa32_fpdp_v2, s)) {
168
return false;
169
}
170
171
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_dp(DisasContext *s, arg_VCVT_dp *a)
172
return false;
173
}
174
175
- if (!dc_isar_feature(aa32_fpdp, s)) {
176
+ if (!dc_isar_feature(aa32_fpdp_v2, s)) {
177
return false;
178
}
179
180
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_int_dp(DisasContext *s, arg_VCVT_int_dp *a)
181
return false;
182
}
183
184
- if (!dc_isar_feature(aa32_fpdp, s)) {
185
+ if (!dc_isar_feature(aa32_fpdp_v2, s)) {
186
return false;
187
}
188
189
@@ -XXX,XX +XXX,XX @@ static bool trans_VJCVT(DisasContext *s, arg_VJCVT *a)
190
return false;
191
}
192
193
- if (!dc_isar_feature(aa32_fpdp, s)) {
194
+ if (!dc_isar_feature(aa32_fpdp_v2, s)) {
195
return false;
196
}
197
198
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_fix_dp(DisasContext *s, arg_VCVT_fix_dp *a)
199
return false;
200
}
201
202
- if (!dc_isar_feature(aa32_fpdp, s)) {
203
+ if (!dc_isar_feature(aa32_fpdp_v2, s)) {
204
return false;
205
}
206
207
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_dp_int(DisasContext *s, arg_VCVT_dp_int *a)
208
return false;
209
}
210
211
- if (!dc_isar_feature(aa32_fpdp, s)) {
212
+ if (!dc_isar_feature(aa32_fpdp_v2, s)) {
213
return false;
214
}
215
216
--
75
--
217
2.20.1
76
2.34.1
218
219
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
We now have proper ISA checks within each trans_* function.
3
When we added SVE_MTEDESC_SHIFT, we effectively limited the
4
maximum size of MTEDESC. Adjust SIZEM1 to consume the remaining
5
bits (32 - 10 - 5 - 12 == 5). Assert that the data to be stored
6
fits within the field (expecting 8 * 4 - 1 == 31, exact fit).
4
7
8
Cc: qemu-stable@nongnu.org
5
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
10
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7
Message-id: 20200224222232.13807-11-richard.henderson@linaro.org
11
Tested-by: Gustavo Romero <gustavo.romero@linaro.org>
12
Message-id: 20240207025210.8837-4-richard.henderson@linaro.org
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
---
14
---
10
target/arm/translate.c | 4 ----
15
target/arm/internals.h | 2 +-
11
1 file changed, 4 deletions(-)
16
target/arm/tcg/translate-sve.c | 7 ++++---
17
2 files changed, 5 insertions(+), 4 deletions(-)
12
18
13
diff --git a/target/arm/translate.c b/target/arm/translate.c
19
diff --git a/target/arm/internals.h b/target/arm/internals.h
14
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
15
--- a/target/arm/translate.c
21
--- a/target/arm/internals.h
16
+++ b/target/arm/translate.c
22
+++ b/target/arm/internals.h
17
@@ -XXX,XX +XXX,XX @@ static void gen_neon_dup_high16(TCGv_i32 var)
23
@@ -XXX,XX +XXX,XX @@ FIELD(MTEDESC, TBI, 4, 2)
18
*/
24
FIELD(MTEDESC, TCMA, 6, 2)
19
static int disas_vfp_insn(DisasContext *s, uint32_t insn)
25
FIELD(MTEDESC, WRITE, 8, 1)
26
FIELD(MTEDESC, ALIGN, 9, 3)
27
-FIELD(MTEDESC, SIZEM1, 12, SIMD_DATA_BITS - 12) /* size - 1 */
28
+FIELD(MTEDESC, SIZEM1, 12, SIMD_DATA_BITS - SVE_MTEDESC_SHIFT - 12) /* size - 1 */
29
30
bool mte_probe(CPUARMState *env, uint32_t desc, uint64_t ptr);
31
uint64_t mte_check(CPUARMState *env, uint32_t desc, uint64_t ptr, uintptr_t ra);
32
diff --git a/target/arm/tcg/translate-sve.c b/target/arm/tcg/translate-sve.c
33
index XXXXXXX..XXXXXXX 100644
34
--- a/target/arm/tcg/translate-sve.c
35
+++ b/target/arm/tcg/translate-sve.c
36
@@ -XXX,XX +XXX,XX @@ static void do_mem_zpa(DisasContext *s, int zt, int pg, TCGv_i64 addr,
20
{
37
{
21
- if (!arm_dc_feature(s, ARM_FEATURE_VFP)) {
38
unsigned vsz = vec_full_reg_size(s);
22
- return 1;
39
TCGv_ptr t_pg;
23
- }
40
+ uint32_t sizem1;
41
int desc = 0;
42
43
assert(mte_n >= 1 && mte_n <= 4);
44
+ sizem1 = (mte_n << dtype_msz(dtype)) - 1;
45
+ assert(sizem1 <= R_MTEDESC_SIZEM1_MASK >> R_MTEDESC_SIZEM1_SHIFT);
46
if (s->mte_active[0]) {
47
- int msz = dtype_msz(dtype);
24
-
48
-
25
/*
49
desc = FIELD_DP32(desc, MTEDESC, MIDX, get_mem_index(s));
26
* If the decodetree decoder handles this insn it will always
50
desc = FIELD_DP32(desc, MTEDESC, TBI, s->tbid);
27
* emit code to either execute the insn or generate an appropriate
51
desc = FIELD_DP32(desc, MTEDESC, TCMA, s->tcma);
52
desc = FIELD_DP32(desc, MTEDESC, WRITE, is_write);
53
- desc = FIELD_DP32(desc, MTEDESC, SIZEM1, (mte_n << msz) - 1);
54
+ desc = FIELD_DP32(desc, MTEDESC, SIZEM1, sizem1);
55
desc <<= SVE_MTEDESC_SHIFT;
56
} else {
57
addr = clean_data_tbi(s, addr);
28
--
58
--
29
2.20.1
59
2.34.1
30
31
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
We will shortly use these to test for VFPv2 and VFPv3
3
Share code that creates mtedesc and embeds within simd_desc.
4
in different situations.
5
4
5
Cc: qemu-stable@nongnu.org
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20200224222232.13807-4-richard.henderson@linaro.org
8
Tested-by: Gustavo Romero <gustavo.romero@linaro.org>
9
Message-id: 20240207025210.8837-5-richard.henderson@linaro.org
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
---
11
target/arm/cpu.h | 18 ++++++++++++++++++
12
target/arm/tcg/translate-a64.h | 2 ++
12
1 file changed, 18 insertions(+)
13
target/arm/tcg/translate-sme.c | 15 +++--------
14
target/arm/tcg/translate-sve.c | 47 ++++++++++++++++++----------------
15
3 files changed, 31 insertions(+), 33 deletions(-)
13
16
14
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
17
diff --git a/target/arm/tcg/translate-a64.h b/target/arm/tcg/translate-a64.h
15
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/cpu.h
19
--- a/target/arm/tcg/translate-a64.h
17
+++ b/target/arm/cpu.h
20
+++ b/target/arm/tcg/translate-a64.h
18
@@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa32_fpshvec(const ARMISARegisters *id)
21
@@ -XXX,XX +XXX,XX @@ bool logic_imm_decode_wmask(uint64_t *result, unsigned int immn,
19
return FIELD_EX32(id->mvfr0, MVFR0, FPSHVEC) > 0;
22
bool sve_access_check(DisasContext *s);
20
}
23
bool sme_enabled_check(DisasContext *s);
21
24
bool sme_enabled_check_with_svcr(DisasContext *s, unsigned);
22
+static inline bool isar_feature_aa32_fpsp_v2(const ARMISARegisters *id)
25
+uint32_t make_svemte_desc(DisasContext *s, unsigned vsz, uint32_t nregs,
23
+{
26
+ uint32_t msz, bool is_write, uint32_t data);
24
+ /* Return true if CPU supports single precision floating point, VFPv2 */
27
25
+ return FIELD_EX32(id->mvfr0, MVFR0, FPSP) > 0;
28
/* This function corresponds to CheckStreamingSVEEnabled. */
29
static inline bool sme_sm_enabled_check(DisasContext *s)
30
diff --git a/target/arm/tcg/translate-sme.c b/target/arm/tcg/translate-sme.c
31
index XXXXXXX..XXXXXXX 100644
32
--- a/target/arm/tcg/translate-sme.c
33
+++ b/target/arm/tcg/translate-sme.c
34
@@ -XXX,XX +XXX,XX @@ static bool trans_LDST1(DisasContext *s, arg_LDST1 *a)
35
36
TCGv_ptr t_za, t_pg;
37
TCGv_i64 addr;
38
- int svl, desc = 0;
39
+ uint32_t desc;
40
bool be = s->be_data == MO_BE;
41
bool mte = s->mte_active[0];
42
43
@@ -XXX,XX +XXX,XX @@ static bool trans_LDST1(DisasContext *s, arg_LDST1 *a)
44
tcg_gen_shli_i64(addr, cpu_reg(s, a->rm), a->esz);
45
tcg_gen_add_i64(addr, addr, cpu_reg_sp(s, a->rn));
46
47
- if (mte) {
48
- desc = FIELD_DP32(desc, MTEDESC, MIDX, get_mem_index(s));
49
- desc = FIELD_DP32(desc, MTEDESC, TBI, s->tbid);
50
- desc = FIELD_DP32(desc, MTEDESC, TCMA, s->tcma);
51
- desc = FIELD_DP32(desc, MTEDESC, WRITE, a->st);
52
- desc = FIELD_DP32(desc, MTEDESC, SIZEM1, (1 << a->esz) - 1);
53
- desc <<= SVE_MTEDESC_SHIFT;
54
- } else {
55
+ if (!mte) {
56
addr = clean_data_tbi(s, addr);
57
}
58
- svl = streaming_vec_reg_size(s);
59
- desc = simd_desc(svl, svl, desc);
60
+
61
+ desc = make_svemte_desc(s, streaming_vec_reg_size(s), 1, a->esz, a->st, 0);
62
63
fns[a->esz][be][a->v][mte][a->st](tcg_env, t_za, t_pg, addr,
64
tcg_constant_i32(desc));
65
diff --git a/target/arm/tcg/translate-sve.c b/target/arm/tcg/translate-sve.c
66
index XXXXXXX..XXXXXXX 100644
67
--- a/target/arm/tcg/translate-sve.c
68
+++ b/target/arm/tcg/translate-sve.c
69
@@ -XXX,XX +XXX,XX @@ static const uint8_t dtype_esz[16] = {
70
3, 2, 1, 3
71
};
72
73
-static void do_mem_zpa(DisasContext *s, int zt, int pg, TCGv_i64 addr,
74
- int dtype, uint32_t mte_n, bool is_write,
75
- gen_helper_gvec_mem *fn)
76
+uint32_t make_svemte_desc(DisasContext *s, unsigned vsz, uint32_t nregs,
77
+ uint32_t msz, bool is_write, uint32_t data)
78
{
79
- unsigned vsz = vec_full_reg_size(s);
80
- TCGv_ptr t_pg;
81
uint32_t sizem1;
82
- int desc = 0;
83
+ uint32_t desc = 0;
84
85
- assert(mte_n >= 1 && mte_n <= 4);
86
- sizem1 = (mte_n << dtype_msz(dtype)) - 1;
87
+ /* Assert all of the data fits, with or without MTE enabled. */
88
+ assert(nregs >= 1 && nregs <= 4);
89
+ sizem1 = (nregs << msz) - 1;
90
assert(sizem1 <= R_MTEDESC_SIZEM1_MASK >> R_MTEDESC_SIZEM1_SHIFT);
91
+ assert(data < 1u << SVE_MTEDESC_SHIFT);
92
+
93
if (s->mte_active[0]) {
94
desc = FIELD_DP32(desc, MTEDESC, MIDX, get_mem_index(s));
95
desc = FIELD_DP32(desc, MTEDESC, TBI, s->tbid);
96
@@ -XXX,XX +XXX,XX @@ static void do_mem_zpa(DisasContext *s, int zt, int pg, TCGv_i64 addr,
97
desc = FIELD_DP32(desc, MTEDESC, WRITE, is_write);
98
desc = FIELD_DP32(desc, MTEDESC, SIZEM1, sizem1);
99
desc <<= SVE_MTEDESC_SHIFT;
100
- } else {
101
+ }
102
+ return simd_desc(vsz, vsz, desc | data);
26
+}
103
+}
27
+
104
+
28
+static inline bool isar_feature_aa32_fpsp_v3(const ARMISARegisters *id)
105
+static void do_mem_zpa(DisasContext *s, int zt, int pg, TCGv_i64 addr,
106
+ int dtype, uint32_t nregs, bool is_write,
107
+ gen_helper_gvec_mem *fn)
29
+{
108
+{
30
+ /* Return true if CPU supports single precision floating point, VFPv3 */
109
+ TCGv_ptr t_pg;
31
+ return FIELD_EX32(id->mvfr0, MVFR0, FPSP) >= 2;
110
+ uint32_t desc;
32
+}
33
+
111
+
34
static inline bool isar_feature_aa32_fpdp_v2(const ARMISARegisters *id)
112
+ if (!s->mte_active[0]) {
113
addr = clean_data_tbi(s, addr);
114
}
115
116
@@ -XXX,XX +XXX,XX @@ static void do_mem_zpa(DisasContext *s, int zt, int pg, TCGv_i64 addr,
117
* registers as pointers, so encode the regno into the data field.
118
* For consistency, do this even for LD1.
119
*/
120
- desc = simd_desc(vsz, vsz, zt | desc);
121
+ desc = make_svemte_desc(s, vec_full_reg_size(s), nregs,
122
+ dtype_msz(dtype), is_write, zt);
123
t_pg = tcg_temp_new_ptr();
124
125
tcg_gen_addi_ptr(t_pg, tcg_env, pred_full_reg_offset(s, pg));
126
@@ -XXX,XX +XXX,XX @@ static void do_mem_zpz(DisasContext *s, int zt, int pg, int zm,
127
int scale, TCGv_i64 scalar, int msz, bool is_write,
128
gen_helper_gvec_mem_scatter *fn)
35
{
129
{
36
/* Return true if CPU supports double precision floating point, VFPv2 */
130
- unsigned vsz = vec_full_reg_size(s);
37
return FIELD_EX32(id->mvfr0, MVFR0, FPDP) > 0;
131
TCGv_ptr t_zm = tcg_temp_new_ptr();
132
TCGv_ptr t_pg = tcg_temp_new_ptr();
133
TCGv_ptr t_zt = tcg_temp_new_ptr();
134
- int desc = 0;
135
-
136
- if (s->mte_active[0]) {
137
- desc = FIELD_DP32(desc, MTEDESC, MIDX, get_mem_index(s));
138
- desc = FIELD_DP32(desc, MTEDESC, TBI, s->tbid);
139
- desc = FIELD_DP32(desc, MTEDESC, TCMA, s->tcma);
140
- desc = FIELD_DP32(desc, MTEDESC, WRITE, is_write);
141
- desc = FIELD_DP32(desc, MTEDESC, SIZEM1, (1 << msz) - 1);
142
- desc <<= SVE_MTEDESC_SHIFT;
143
- }
144
- desc = simd_desc(vsz, vsz, desc | scale);
145
+ uint32_t desc;
146
147
tcg_gen_addi_ptr(t_pg, tcg_env, pred_full_reg_offset(s, pg));
148
tcg_gen_addi_ptr(t_zm, tcg_env, vec_full_reg_offset(s, zm));
149
tcg_gen_addi_ptr(t_zt, tcg_env, vec_full_reg_offset(s, zt));
150
+
151
+ desc = make_svemte_desc(s, vec_full_reg_size(s), 1, msz, is_write, scale);
152
fn(tcg_env, t_zt, t_pg, t_zm, scalar, tcg_constant_i32(desc));
38
}
153
}
39
154
40
+static inline bool isar_feature_aa32_fpdp_v3(const ARMISARegisters *id)
41
+{
42
+ /* Return true if CPU supports double precision floating point, VFPv3 */
43
+ return FIELD_EX32(id->mvfr0, MVFR0, FPDP) >= 2;
44
+}
45
+
46
/*
47
* We always set the FP and SIMD FP16 fields to indicate identical
48
* levels of support (assuming SIMD is implemented at all), so
49
--
155
--
50
2.20.1
156
2.34.1
51
52
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
We will eventually remove the early ARM_FEATURE_VFP test,
3
These functions "use the standard load helpers", but
4
so add a proper test for each trans_* that does not already
4
fail to clean_data_tbi or populate mtedesc.
5
have another ISA test.
6
5
6
Cc: qemu-stable@nongnu.org
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20200224222232.13807-9-richard.henderson@linaro.org
9
Tested-by: Gustavo Romero <gustavo.romero@linaro.org>
10
Message-id: 20240207025210.8837-6-richard.henderson@linaro.org
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
12
---
12
target/arm/translate-vfp.inc.c | 78 ++++++++++++++++++++++++++++++----
13
target/arm/tcg/translate-sve.c | 15 +++++++++++++--
13
1 file changed, 69 insertions(+), 9 deletions(-)
14
1 file changed, 13 insertions(+), 2 deletions(-)
14
15
15
diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c
16
diff --git a/target/arm/tcg/translate-sve.c b/target/arm/tcg/translate-sve.c
16
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
17
--- a/target/arm/translate-vfp.inc.c
18
--- a/target/arm/tcg/translate-sve.c
18
+++ b/target/arm/translate-vfp.inc.c
19
+++ b/target/arm/tcg/translate-sve.c
19
@@ -XXX,XX +XXX,XX @@ static bool trans_VMOV_to_gp(DisasContext *s, arg_VMOV_to_gp *a)
20
@@ -XXX,XX +XXX,XX @@ static void do_ldrq(DisasContext *s, int zt, int pg, TCGv_i64 addr, int dtype)
20
int pass;
21
unsigned vsz = vec_full_reg_size(s);
21
uint32_t offset;
22
TCGv_ptr t_pg;
22
23
int poff;
23
+ /* SIZE == 2 is a VFP instruction; otherwise NEON. */
24
+ uint32_t desc;
24
+ if (a->size == 2
25
25
+ ? !dc_isar_feature(aa32_fpsp_v2, s)
26
/* Load the first quadword using the normal predicated load helpers. */
26
+ : !arm_dc_feature(s, ARM_FEATURE_NEON)) {
27
+ if (!s->mte_active[0]) {
27
+ return false;
28
+ addr = clean_data_tbi(s, addr);
28
+ }
29
+ }
29
+
30
+
30
/* UNDEF accesses to D16-D31 if they don't exist */
31
poff = pred_full_reg_offset(s, pg);
31
if (!dc_isar_feature(aa32_simd_r32, s) && (a->vn & 0x10)) {
32
if (vsz > 16) {
32
return false;
33
/*
33
@@ -XXX,XX +XXX,XX @@ static bool trans_VMOV_to_gp(DisasContext *s, arg_VMOV_to_gp *a)
34
@@ -XXX,XX +XXX,XX @@ static void do_ldrq(DisasContext *s, int zt, int pg, TCGv_i64 addr, int dtype)
34
pass = extract32(offset, 2, 1);
35
35
offset = extract32(offset, 0, 2) * 8;
36
gen_helper_gvec_mem *fn
36
37
= ldr_fns[s->mte_active[0]][s->be_data == MO_BE][dtype][0];
37
- if (a->size != 2 && !arm_dc_feature(s, ARM_FEATURE_NEON)) {
38
- fn(tcg_env, t_pg, addr, tcg_constant_i32(simd_desc(16, 16, zt)));
38
- return false;
39
+ desc = make_svemte_desc(s, 16, 1, dtype_msz(dtype), false, zt);
39
- }
40
+ fn(tcg_env, t_pg, addr, tcg_constant_i32(desc));
40
-
41
41
if (!vfp_access_check(s)) {
42
/* Replicate that first quadword. */
42
return true;
43
if (vsz > 16) {
44
@@ -XXX,XX +XXX,XX @@ static void do_ldro(DisasContext *s, int zt, int pg, TCGv_i64 addr, int dtype)
45
unsigned vsz_r32;
46
TCGv_ptr t_pg;
47
int poff, doff;
48
+ uint32_t desc;
49
50
if (vsz < 32) {
51
/*
52
@@ -XXX,XX +XXX,XX @@ static void do_ldro(DisasContext *s, int zt, int pg, TCGv_i64 addr, int dtype)
43
}
53
}
44
@@ -XXX,XX +XXX,XX @@ static bool trans_VMOV_from_gp(DisasContext *s, arg_VMOV_from_gp *a)
54
45
int pass;
55
/* Load the first octaword using the normal predicated load helpers. */
46
uint32_t offset;
56
+ if (!s->mte_active[0]) {
47
57
+ addr = clean_data_tbi(s, addr);
48
+ /* SIZE == 2 is a VFP instruction; otherwise NEON. */
49
+ if (a->size == 2
50
+ ? !dc_isar_feature(aa32_fpsp_v2, s)
51
+ : !arm_dc_feature(s, ARM_FEATURE_NEON)) {
52
+ return false;
53
+ }
58
+ }
54
+
59
55
/* UNDEF accesses to D16-D31 if they don't exist */
60
poff = pred_full_reg_offset(s, pg);
56
if (!dc_isar_feature(aa32_simd_r32, s) && (a->vn & 0x10)) {
61
if (vsz > 32) {
57
return false;
62
@@ -XXX,XX +XXX,XX @@ static void do_ldro(DisasContext *s, int zt, int pg, TCGv_i64 addr, int dtype)
58
@@ -XXX,XX +XXX,XX @@ static bool trans_VMOV_from_gp(DisasContext *s, arg_VMOV_from_gp *a)
63
59
pass = extract32(offset, 2, 1);
64
gen_helper_gvec_mem *fn
60
offset = extract32(offset, 0, 2) * 8;
65
= ldr_fns[s->mte_active[0]][s->be_data == MO_BE][dtype][0];
61
66
- fn(tcg_env, t_pg, addr, tcg_constant_i32(simd_desc(32, 32, zt)));
62
- if (a->size != 2 && !arm_dc_feature(s, ARM_FEATURE_NEON)) {
67
+ desc = make_svemte_desc(s, 32, 1, dtype_msz(dtype), false, zt);
63
- return false;
68
+ fn(tcg_env, t_pg, addr, tcg_constant_i32(desc));
64
- }
69
65
-
66
if (!vfp_access_check(s)) {
67
return true;
68
}
69
@@ -XXX,XX +XXX,XX @@ static bool trans_VMSR_VMRS(DisasContext *s, arg_VMSR_VMRS *a)
70
TCGv_i32 tmp;
71
bool ignore_vfp_enabled = false;
72
73
+ if (!dc_isar_feature(aa32_fpsp_v2, s)) {
74
+ return false;
75
+ }
76
+
77
if (arm_dc_feature(s, ARM_FEATURE_M)) {
78
/*
79
* The only M-profile VFP vmrs/vmsr sysreg is FPSCR.
80
@@ -XXX,XX +XXX,XX @@ static bool trans_VMOV_single(DisasContext *s, arg_VMOV_single *a)
81
{
82
TCGv_i32 tmp;
83
84
+ if (!dc_isar_feature(aa32_fpsp_v2, s)) {
85
+ return false;
86
+ }
87
+
88
if (!vfp_access_check(s)) {
89
return true;
90
}
91
@@ -XXX,XX +XXX,XX @@ static bool trans_VMOV_64_sp(DisasContext *s, arg_VMOV_64_sp *a)
92
{
93
TCGv_i32 tmp;
94
95
+ if (!dc_isar_feature(aa32_fpsp_v2, s)) {
96
+ return false;
97
+ }
98
+
99
/*
70
/*
100
* VMOV between two general-purpose registers and two single precision
71
* Replicate that first octaword.
101
* floating point registers
102
@@ -XXX,XX +XXX,XX @@ static bool trans_VMOV_64_dp(DisasContext *s, arg_VMOV_64_dp *a)
103
104
/*
105
* VMOV between two general-purpose registers and one double precision
106
- * floating point register
107
+ * floating point register. Note that this does not require support
108
+ * for double precision arithmetic.
109
*/
110
+ if (!dc_isar_feature(aa32_fpsp_v2, s)) {
111
+ return false;
112
+ }
113
114
/* UNDEF accesses to D16-D31 if they don't exist */
115
if (!dc_isar_feature(aa32_simd_r32, s) && (a->vm & 0x10)) {
116
@@ -XXX,XX +XXX,XX @@ static bool trans_VLDR_VSTR_sp(DisasContext *s, arg_VLDR_VSTR_sp *a)
117
uint32_t offset;
118
TCGv_i32 addr, tmp;
119
120
+ if (!dc_isar_feature(aa32_fpsp_v2, s)) {
121
+ return false;
122
+ }
123
+
124
if (!vfp_access_check(s)) {
125
return true;
126
}
127
@@ -XXX,XX +XXX,XX @@ static bool trans_VLDR_VSTR_dp(DisasContext *s, arg_VLDR_VSTR_dp *a)
128
TCGv_i32 addr;
129
TCGv_i64 tmp;
130
131
+ /* Note that this does not require support for double arithmetic. */
132
+ if (!dc_isar_feature(aa32_fpsp_v2, s)) {
133
+ return false;
134
+ }
135
+
136
/* UNDEF accesses to D16-D31 if they don't exist */
137
if (!dc_isar_feature(aa32_simd_r32, s) && (a->vd & 0x10)) {
138
return false;
139
@@ -XXX,XX +XXX,XX @@ static bool trans_VLDM_VSTM_sp(DisasContext *s, arg_VLDM_VSTM_sp *a)
140
TCGv_i32 addr, tmp;
141
int i, n;
142
143
+ if (!dc_isar_feature(aa32_fpsp_v2, s)) {
144
+ return false;
145
+ }
146
+
147
n = a->imm;
148
149
if (n == 0 || (a->vd + n) > 32) {
150
@@ -XXX,XX +XXX,XX @@ static bool trans_VLDM_VSTM_dp(DisasContext *s, arg_VLDM_VSTM_dp *a)
151
TCGv_i64 tmp;
152
int i, n;
153
154
+ /* Note that this does not require support for double arithmetic. */
155
+ if (!dc_isar_feature(aa32_fpsp_v2, s)) {
156
+ return false;
157
+ }
158
+
159
n = a->imm >> 1;
160
161
if (n == 0 || (a->vd + n) > 32 || n > 16) {
162
@@ -XXX,XX +XXX,XX @@ static bool do_vfp_3op_sp(DisasContext *s, VFPGen3OpSPFn *fn,
163
TCGv_i32 f0, f1, fd;
164
TCGv_ptr fpst;
165
166
+ if (!dc_isar_feature(aa32_fpsp_v2, s)) {
167
+ return false;
168
+ }
169
+
170
if (!dc_isar_feature(aa32_fpshvec, s) &&
171
(veclen != 0 || s->vec_stride != 0)) {
172
return false;
173
@@ -XXX,XX +XXX,XX @@ static bool do_vfp_2op_sp(DisasContext *s, VFPGen2OpSPFn *fn, int vd, int vm)
174
int veclen = s->vec_len;
175
TCGv_i32 f0, fd;
176
177
+ if (!dc_isar_feature(aa32_fpsp_v2, s)) {
178
+ return false;
179
+ }
180
+
181
if (!dc_isar_feature(aa32_fpshvec, s) &&
182
(veclen != 0 || s->vec_stride != 0)) {
183
return false;
184
@@ -XXX,XX +XXX,XX @@ static bool trans_VCMP_sp(DisasContext *s, arg_VCMP_sp *a)
185
{
186
TCGv_i32 vd, vm;
187
188
+ if (!dc_isar_feature(aa32_fpsp_v2, s)) {
189
+ return false;
190
+ }
191
+
192
/* Vm/M bits must be zero for the Z variant */
193
if (a->z && a->vm != 0) {
194
return false;
195
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_int_sp(DisasContext *s, arg_VCVT_int_sp *a)
196
TCGv_i32 vm;
197
TCGv_ptr fpst;
198
199
+ if (!dc_isar_feature(aa32_fpsp_v2, s)) {
200
+ return false;
201
+ }
202
+
203
if (!vfp_access_check(s)) {
204
return true;
205
}
206
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_sp_int(DisasContext *s, arg_VCVT_sp_int *a)
207
TCGv_i32 vm;
208
TCGv_ptr fpst;
209
210
+ if (!dc_isar_feature(aa32_fpsp_v2, s)) {
211
+ return false;
212
+ }
213
+
214
if (!vfp_access_check(s)) {
215
return true;
216
}
217
--
72
--
218
2.20.1
73
2.34.1
219
220
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
Sort this check to the start of a trans_* function.
3
The TBI and TCMA bits are located within mtedesc, not desc.
4
Merge this with any existing test for fpdp_v2.
5
4
5
Cc: qemu-stable@nongnu.org
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20200224222232.13807-8-richard.henderson@linaro.org
8
Tested-by: Gustavo Romero <gustavo.romero@linaro.org>
9
Message-id: 20240207025210.8837-7-richard.henderson@linaro.org
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
---
11
target/arm/translate-vfp.inc.c | 24 ++++++++----------------
12
target/arm/tcg/sme_helper.c | 8 ++++----
12
1 file changed, 8 insertions(+), 16 deletions(-)
13
target/arm/tcg/sve_helper.c | 12 ++++++------
14
2 files changed, 10 insertions(+), 10 deletions(-)
13
15
14
diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c
16
diff --git a/target/arm/tcg/sme_helper.c b/target/arm/tcg/sme_helper.c
15
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/translate-vfp.inc.c
18
--- a/target/arm/tcg/sme_helper.c
17
+++ b/target/arm/translate-vfp.inc.c
19
+++ b/target/arm/tcg/sme_helper.c
18
@@ -XXX,XX +XXX,XX @@ static bool trans_VMSR_VMRS(DisasContext *s, arg_VMSR_VMRS *a)
20
@@ -XXX,XX +XXX,XX @@ void sme_ld1_mte(CPUARMState *env, void *za, uint64_t *vg,
19
* VFPv2 allows access to FPSID from userspace; VFPv3 restricts
21
desc = extract32(desc, 0, SIMD_DATA_SHIFT + SVE_MTEDESC_SHIFT);
20
* all ID registers to privileged access only.
22
21
*/
23
/* Perform gross MTE suppression early. */
22
- if (IS_USER(s) && arm_dc_feature(s, ARM_FEATURE_VFP3)) {
24
- if (!tbi_check(desc, bit55) ||
23
+ if (IS_USER(s) && dc_isar_feature(aa32_fpsp_v3, s)) {
25
- tcma_check(desc, bit55, allocation_tag_from_addr(addr))) {
24
return false;
26
+ if (!tbi_check(mtedesc, bit55) ||
25
}
27
+ tcma_check(mtedesc, bit55, allocation_tag_from_addr(addr))) {
26
ignore_vfp_enabled = true;
28
mtedesc = 0;
27
@@ -XXX,XX +XXX,XX @@ static bool trans_VMSR_VMRS(DisasContext *s, arg_VMSR_VMRS *a)
28
case ARM_VFP_FPINST:
29
case ARM_VFP_FPINST2:
30
/* Not present in VFPv3 */
31
- if (IS_USER(s) || arm_dc_feature(s, ARM_FEATURE_VFP3)) {
32
+ if (IS_USER(s) || dc_isar_feature(aa32_fpsp_v3, s)) {
33
return false;
34
}
35
break;
36
@@ -XXX,XX +XXX,XX @@ static bool trans_VMOV_imm_sp(DisasContext *s, arg_VMOV_imm_sp *a)
37
38
vd = a->vd;
39
40
- if (!dc_isar_feature(aa32_fpshvec, s) &&
41
- (veclen != 0 || s->vec_stride != 0)) {
42
+ if (!dc_isar_feature(aa32_fpsp_v3, s)) {
43
return false;
44
}
29
}
45
30
46
- if (!arm_dc_feature(s, ARM_FEATURE_VFP3)) {
31
@@ -XXX,XX +XXX,XX @@ void sme_st1_mte(CPUARMState *env, void *za, uint64_t *vg, target_ulong addr,
47
+ if (!dc_isar_feature(aa32_fpshvec, s) &&
32
desc = extract32(desc, 0, SIMD_DATA_SHIFT + SVE_MTEDESC_SHIFT);
48
+ (veclen != 0 || s->vec_stride != 0)) {
33
49
return false;
34
/* Perform gross MTE suppression early. */
35
- if (!tbi_check(desc, bit55) ||
36
- tcma_check(desc, bit55, allocation_tag_from_addr(addr))) {
37
+ if (!tbi_check(mtedesc, bit55) ||
38
+ tcma_check(mtedesc, bit55, allocation_tag_from_addr(addr))) {
39
mtedesc = 0;
50
}
40
}
51
41
52
@@ -XXX,XX +XXX,XX @@ static bool trans_VMOV_imm_dp(DisasContext *s, arg_VMOV_imm_dp *a)
42
diff --git a/target/arm/tcg/sve_helper.c b/target/arm/tcg/sve_helper.c
53
43
index XXXXXXX..XXXXXXX 100644
54
vd = a->vd;
44
--- a/target/arm/tcg/sve_helper.c
55
45
+++ b/target/arm/tcg/sve_helper.c
56
- if (!dc_isar_feature(aa32_fpdp_v2, s)) {
46
@@ -XXX,XX +XXX,XX @@ void sve_ldN_r_mte(CPUARMState *env, uint64_t *vg, target_ulong addr,
57
+ if (!dc_isar_feature(aa32_fpdp_v3, s)) {
47
desc = extract32(desc, 0, SIMD_DATA_SHIFT + SVE_MTEDESC_SHIFT);
58
return false;
48
49
/* Perform gross MTE suppression early. */
50
- if (!tbi_check(desc, bit55) ||
51
- tcma_check(desc, bit55, allocation_tag_from_addr(addr))) {
52
+ if (!tbi_check(mtedesc, bit55) ||
53
+ tcma_check(mtedesc, bit55, allocation_tag_from_addr(addr))) {
54
mtedesc = 0;
59
}
55
}
60
56
61
@@ -XXX,XX +XXX,XX @@ static bool trans_VMOV_imm_dp(DisasContext *s, arg_VMOV_imm_dp *a)
57
@@ -XXX,XX +XXX,XX @@ void sve_ldnfff1_r_mte(CPUARMState *env, void *vg, target_ulong addr,
62
return false;
58
desc = extract32(desc, 0, SIMD_DATA_SHIFT + SVE_MTEDESC_SHIFT);
59
60
/* Perform gross MTE suppression early. */
61
- if (!tbi_check(desc, bit55) ||
62
- tcma_check(desc, bit55, allocation_tag_from_addr(addr))) {
63
+ if (!tbi_check(mtedesc, bit55) ||
64
+ tcma_check(mtedesc, bit55, allocation_tag_from_addr(addr))) {
65
mtedesc = 0;
63
}
66
}
64
67
65
- if (!arm_dc_feature(s, ARM_FEATURE_VFP3)) {
68
@@ -XXX,XX +XXX,XX @@ void sve_stN_r_mte(CPUARMState *env, uint64_t *vg, target_ulong addr,
66
- return false;
69
desc = extract32(desc, 0, SIMD_DATA_SHIFT + SVE_MTEDESC_SHIFT);
67
- }
70
68
-
71
/* Perform gross MTE suppression early. */
69
if (!vfp_access_check(s)) {
72
- if (!tbi_check(desc, bit55) ||
70
return true;
73
- tcma_check(desc, bit55, allocation_tag_from_addr(addr))) {
74
+ if (!tbi_check(mtedesc, bit55) ||
75
+ tcma_check(mtedesc, bit55, allocation_tag_from_addr(addr))) {
76
mtedesc = 0;
71
}
77
}
72
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_fix_sp(DisasContext *s, arg_VCVT_fix_sp *a)
73
TCGv_ptr fpst;
74
int frac_bits;
75
76
- if (!arm_dc_feature(s, ARM_FEATURE_VFP3)) {
77
+ if (!dc_isar_feature(aa32_fpsp_v3, s)) {
78
return false;
79
}
80
81
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_fix_dp(DisasContext *s, arg_VCVT_fix_dp *a)
82
TCGv_ptr fpst;
83
int frac_bits;
84
85
- if (!dc_isar_feature(aa32_fpdp_v2, s)) {
86
- return false;
87
- }
88
-
89
- if (!arm_dc_feature(s, ARM_FEATURE_VFP3)) {
90
+ if (!dc_isar_feature(aa32_fpdp_v3, s)) {
91
return false;
92
}
93
78
94
--
79
--
95
2.20.1
80
2.34.1
96
97
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
The raven_io_ops MemoryRegionOps is the only one in the source tree
2
which sets .valid.unaligned to indicate that it should support
3
unaligned accesses and which does not also set .impl.unaligned to
4
indicate that its read and write functions can do the unaligned
5
handling themselves. This is a problem, because at the moment the
6
core memory system does not implement the support for handling
7
unaligned accesses by doing a series of aligned accesses and
8
combining them (system/memory.c:access_with_adjusted_size() has a
9
TODO comment noting this).
2
10
3
We had set this for aarch32-only in arm_max_initfn, but
11
Fortunately raven_io_read() and raven_io_write() will correctly deal
4
failed to set the same bit for aarch64.
12
with the case of being passed an unaligned address, so we can fix the
13
missing unaligned access support by setting .impl.unaligned in the
14
MemoryRegionOps struct.
5
15
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
16
Fixes: 9a1839164c9c8f06 ("raven: Implement non-contiguous I/O region")
7
Message-id: 20200218190958.745-2-richard.henderson@linaro.org
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
17
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
18
Tested-by: Cédric Le Goater <clg@redhat.com>
19
Reviewed-by: Cédric Le Goater <clg@redhat.com>
20
Message-id: 20240112134640.1775041-1-peter.maydell@linaro.org
10
---
21
---
11
target/arm/cpu64.c | 1 +
22
hw/pci-host/raven.c | 1 +
12
1 file changed, 1 insertion(+)
23
1 file changed, 1 insertion(+)
13
24
14
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
25
diff --git a/hw/pci-host/raven.c b/hw/pci-host/raven.c
15
index XXXXXXX..XXXXXXX 100644
26
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/cpu64.c
27
--- a/hw/pci-host/raven.c
17
+++ b/target/arm/cpu64.c
28
+++ b/hw/pci-host/raven.c
18
@@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj)
29
@@ -XXX,XX +XXX,XX @@ static const MemoryRegionOps raven_io_ops = {
19
cpu->isar.id_mmfr3 = u;
30
.write = raven_io_write,
20
31
.endianness = DEVICE_LITTLE_ENDIAN,
21
u = cpu->isar.id_mmfr4;
32
.impl.max_access_size = 4,
22
+ u = FIELD_DP32(u, ID_MMFR4, HPDS, 1); /* AA32HPD */
33
+ .impl.unaligned = true,
23
u = FIELD_DP32(u, ID_MMFR4, AC2, 1); /* ACTLR2, HACTLR2 */
34
.valid.unaligned = true,
24
cpu->isar.id_mmfr4 = u;
35
};
25
36
26
--
37
--
27
2.20.1
38
2.34.1
28
39
29
40
diff view generated by jsdifflib
1
In our KVM GICv2 realize function, we try to cope with old kernels
1
Suppress the deprecation warning when we're running under qtest,
2
that don't provide the device control API (KVM_CAP_DEVICE_CTRL): we
2
to avoid "make check" including warning messages in its output.
3
try to use the device control, and if that fails we fall back to
4
assuming that the kernel has the old style KVM_CREATE_IRQCHIP and
5
that it will provide a GICv2.
6
7
This doesn't cater for the possibility of a kernel and hardware which
8
only provide a GICv3, which is very common now. On that setup we
9
will abort() later on in kvm_arm_pmu_set_irq() when we try to wire up
10
an interrupt to the GIC we failed to create:
11
12
qemu-system-aarch64: PMU: KVM_SET_DEVICE_ATTR: Invalid argument
13
qemu-system-aarch64: failed to set irq for PMU
14
Aborted
15
16
If the kernel advertises KVM_CAP_DEVICE_CTRL we should trust it if it
17
says it can't create a GICv2, rather than assuming it has one. We
18
can then produce a more helpful error message including a hint about
19
the most probable reason for the failure.
20
21
If the kernel doesn't advertise KVM_CAP_DEVICE_CTRL then it is truly
22
ancient by this point but we might as well still fall back to a
23
KVM_CREATE_IRQCHIP GICv2.
24
25
With this patch then the user misconfiguration which previously
26
caused an abort now prints:
27
qemu-system-aarch64: Initialization of device kvm-arm-gic failed: error creating in-kernel VGIC: No such device
28
Perhaps the host CPU does not support GICv2?
29
3
30
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
31
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
5
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
32
Reviewed-by: Andrew Jones <drjones@redhat.com>
6
Message-id: 20240206154151.155620-1-peter.maydell@linaro.org
33
Tested-by: Andrew Jones <drjones@redhat.com>
34
Message-id: 20200225182435.1131-1-peter.maydell@linaro.org
35
---
7
---
36
hw/intc/arm_gic_kvm.c | 9 +++++++++
8
hw/block/tc58128.c | 4 +++-
37
1 file changed, 9 insertions(+)
9
1 file changed, 3 insertions(+), 1 deletion(-)
38
10
39
diff --git a/hw/intc/arm_gic_kvm.c b/hw/intc/arm_gic_kvm.c
11
diff --git a/hw/block/tc58128.c b/hw/block/tc58128.c
40
index XXXXXXX..XXXXXXX 100644
12
index XXXXXXX..XXXXXXX 100644
41
--- a/hw/intc/arm_gic_kvm.c
13
--- a/hw/block/tc58128.c
42
+++ b/hw/intc/arm_gic_kvm.c
14
+++ b/hw/block/tc58128.c
43
@@ -XXX,XX +XXX,XX @@ static void kvm_arm_gic_realize(DeviceState *dev, Error **errp)
15
@@ -XXX,XX +XXX,XX @@ static sh7750_io_device tc58128 = {
44
KVM_DEV_ARM_VGIC_CTRL_INIT, NULL, true,
16
45
&error_abort);
17
int tc58128_init(struct SH7750State *s, const char *zone1, const char *zone2)
46
}
18
{
47
+ } else if (kvm_check_extension(kvm_state, KVM_CAP_DEVICE_CTRL)) {
19
- warn_report_once("The TC58128 flash device is deprecated");
48
+ error_setg_errno(errp, -ret, "error creating in-kernel VGIC");
20
+ if (!qtest_enabled()) {
49
+ error_append_hint(errp,
21
+ warn_report_once("The TC58128 flash device is deprecated");
50
+ "Perhaps the host CPU does not support GICv2?\n");
22
+ }
51
} else if (ret != -ENODEV && ret != -ENOTSUP) {
23
init_dev(&tc58128_devs[0], zone1);
52
+ /*
24
init_dev(&tc58128_devs[1], zone2);
53
+ * Very ancient kernel without KVM_CAP_DEVICE_CTRL: assume that
25
return sh7750_register_io_device(s, &tc58128);
54
+ * ENODEV or ENOTSUP mean "can't create GICv2 with KVM_CREATE_DEVICE",
55
+ * and that we will get a GICv2 via KVM_CREATE_IRQCHIP.
56
+ */
57
error_setg_errno(errp, -ret, "error creating in-kernel VGIC");
58
return;
59
}
60
--
26
--
61
2.20.1
27
2.34.1
62
28
63
29
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
We deliberately don't include qtests_npcm7xx in qtests_aarch64,
2
because we already get the coverage of those tests via qtests_arm,
3
and we don't want to use extra CI minutes testing them twice.
2
4
3
Add a test that verifies the Tux logo is displayed on the framebuffer.
5
In commit 327b680877b79c4b we added it to qtests_aarch64; revert
6
that change.
4
7
5
We simply follow the OpenCV "Template Matching with Multiple Objects"
8
Fixes: 327b680877b79c4b ("tests/qtest: Creating qtest for GMAC Module")
6
tutorial, replacing Lionel Messi by Tux:
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
https://docs.opencv.org/4.2.0/d4/dc6/tutorial_py_template_matching.html
10
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
11
Message-id: 20240206163043.315535-1-peter.maydell@linaro.org
12
---
13
tests/qtest/meson.build | 1 -
14
1 file changed, 1 deletion(-)
8
15
9
When OpenCV and NumPy are installed, this test can be run using:
16
diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
10
11
$ AVOCADO_ALLOW_UNTRUSTED_CODE=hmmm \
12
avocado --show=app,framebuffer run -t device:framebuffer \
13
tests/acceptance/machine_arm_integratorcp.py
14
JOB ID : 8c46b0f8269242e87d738247883ea2a470df949e
15
JOB LOG : avocado/job-results/job-2020-01-31T21.38-8c46b0f/job.log
16
(1/1) tests/acceptance/machine_arm_integratorcp.py:IntegratorMachine.test_framebuffer_tux_logo:
17
framebuffer: found Tux at position [x, y] = (0, 0)
18
PASS (3.96 s)
19
RESULTS : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0
20
JOB TIME : 4.23 s
21
22
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
23
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
24
Message-id: 20200225172501.29609-5-philmd@redhat.com
25
Message-Id: <20200131211102.29612-3-f4bug@amsat.org>
26
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
27
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
28
---
29
tests/acceptance/machine_arm_integratorcp.py | 52 ++++++++++++++++++++
30
1 file changed, 52 insertions(+)
31
32
diff --git a/tests/acceptance/machine_arm_integratorcp.py b/tests/acceptance/machine_arm_integratorcp.py
33
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
34
--- a/tests/acceptance/machine_arm_integratorcp.py
18
--- a/tests/qtest/meson.build
35
+++ b/tests/acceptance/machine_arm_integratorcp.py
19
+++ b/tests/qtest/meson.build
36
@@ -XXX,XX +XXX,XX @@
20
@@ -XXX,XX +XXX,XX @@ qtests_aarch64 = \
37
# later. See the COPYING file in the top-level directory.
21
(config_all_devices.has_key('CONFIG_RASPI') ? ['bcm2835-dma-test'] : []) + \
38
22
(config_all_accel.has_key('CONFIG_TCG') and \
39
import os
23
config_all_devices.has_key('CONFIG_TPM_TIS_I2C') ? ['tpm-tis-i2c-test'] : []) + \
40
+import logging
24
- (config_all_devices.has_key('CONFIG_NPCM7XX') ? qtests_npcm7xx : []) + \
41
25
['arm-cpu-features',
42
from avocado import skipUnless
26
'numa-test',
43
from avocado_qemu import Test
27
'boot-serial-test',
44
from avocado_qemu import wait_for_console_pattern
45
46
+
47
+NUMPY_AVAILABLE = True
48
+try:
49
+ import numpy as np
50
+except ImportError:
51
+ NUMPY_AVAILABLE = False
52
+
53
+CV2_AVAILABLE = True
54
+try:
55
+ import cv2
56
+except ImportError:
57
+ CV2_AVAILABLE = False
58
+
59
+
60
class IntegratorMachine(Test):
61
62
timeout = 90
63
@@ -XXX,XX +XXX,XX @@ class IntegratorMachine(Test):
64
"""
65
self.boot_integratorcp()
66
wait_for_console_pattern(self, 'Log in as root')
67
+
68
+ @skipUnless(NUMPY_AVAILABLE, 'Python NumPy not installed')
69
+ @skipUnless(CV2_AVAILABLE, 'Python OpenCV not installed')
70
+ @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
71
+ def test_framebuffer_tux_logo(self):
72
+ """
73
+ Boot Linux and verify the Tux logo is displayed on the framebuffer.
74
+ :avocado: tags=arch:arm
75
+ :avocado: tags=machine:integratorcp
76
+ :avocado: tags=device:pl110
77
+ :avocado: tags=device:framebuffer
78
+ """
79
+ screendump_path = os.path.join(self.workdir, "screendump.pbm")
80
+ tuxlogo_url = ('https://github.com/torvalds/linux/raw/v2.6.12/'
81
+ 'drivers/video/logo/logo_linux_vga16.ppm')
82
+ tuxlogo_hash = '3991c2ddbd1ddaecda7601f8aafbcf5b02dc86af'
83
+ tuxlogo_path = self.fetch_asset(tuxlogo_url, asset_hash=tuxlogo_hash)
84
+
85
+ self.boot_integratorcp()
86
+ framebuffer_ready = 'Console: switching to colour frame buffer device'
87
+ wait_for_console_pattern(self, framebuffer_ready)
88
+ self.vm.command('human-monitor-command', command_line='stop')
89
+ self.vm.command('human-monitor-command',
90
+ command_line='screendump %s' % screendump_path)
91
+ logger = logging.getLogger('framebuffer')
92
+
93
+ cpu_count = 1
94
+ match_threshold = 0.92
95
+ screendump_bgr = cv2.imread(screendump_path)
96
+ screendump_gray = cv2.cvtColor(screendump_bgr, cv2.COLOR_BGR2GRAY)
97
+ result = cv2.matchTemplate(screendump_gray, cv2.imread(tuxlogo_path, 0),
98
+ cv2.TM_CCOEFF_NORMED)
99
+ loc = np.where(result >= match_threshold)
100
+ tux_count = 0
101
+ for tux_count, pt in enumerate(zip(*loc[::-1]), start=1):
102
+ logger.debug('found Tux at position [x, y] = %s', pt)
103
+ self.assertGreaterEqual(tux_count, cpu_count)
104
--
28
--
105
2.20.1
29
2.34.1
106
30
107
31
diff view generated by jsdifflib
New patch
1
Allow changes to the virt GTDT -- we are going to add the IRQ
2
entry for a new timer to it.
1
3
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
6
Message-id: 20240122143537.233498-2-peter.maydell@linaro.org
7
---
8
tests/qtest/bios-tables-test-allowed-diff.h | 2 ++
9
1 file changed, 2 insertions(+)
10
11
diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
12
index XXXXXXX..XXXXXXX 100644
13
--- a/tests/qtest/bios-tables-test-allowed-diff.h
14
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
15
@@ -1 +1,3 @@
16
/* List of comma-separated changed AML files to ignore */
17
+"tests/data/acpi/virt/FACP",
18
+"tests/data/acpi/virt/GTDT",
19
--
20
2.34.1
diff view generated by jsdifflib
1
From: Gavin Shan <gshan@redhat.com>
1
Armv8.1+ CPUs have the Virtual Host Extension (VHE) which adds a
2
2
non-secure EL2 virtual timer. We implemented the timer itself in the
3
This uses TYPE_PL011 when creating the serial port so that the code
3
CPU model, but never wired up its IRQ line to the GIC.
4
looks cleaner.
4
5
5
Wire up the IRQ line (this is always safe whether the CPU has the
6
Signed-off-by: Gavin Shan <gshan@redhat.com>
6
interrupt or not, since it always creates the outbound IRQ line).
7
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
7
Report it to the guest via dtb and ACPI if the CPU has the feature.
8
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
8
9
Message-id: 20200224222223.4128-1-gshan@redhat.com
9
The DTB binding is documented in the kernel's
10
Documentation/devicetree/bindings/timer/arm\,arch_timer.yaml
11
and the ACPI table entries are documented in the ACPI specification
12
version 6.3 or later.
13
14
Because the IRQ line ACPI binding is new in 6.3, we need to bump the
15
FADT table rev to show that we might be using 6.3 features.
16
17
Note that exposing this IRQ in the DTB will trigger a bug in EDK2
18
versions prior to edk2-stable202311, for users who use the virt board
19
with 'virtualization=on' to enable EL2 emulation and are booting an
20
EDK2 guest BIOS, if that EDK2 has assertions enabled. The effect is
21
that EDK2 will assert on bootup:
22
23
ASSERT [ArmTimerDxe] /home/kraxel/projects/qemu/roms/edk2/ArmVirtPkg/Library/ArmVirtTimerFdtClientLib/ArmVirtTimerFdtClientLib.c(72): PropSize == 36 || PropSize == 48
24
25
If you see that assertion you should do one of:
26
* update your EDK2 binaries to edk2-stable202311 or newer
27
* use the 'virt-8.2' versioned machine type
28
* not use 'virtualization=on'
29
30
(The versions shipped with QEMU itself have the fix.)
31
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
32
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
33
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
34
Message-id: 20240122143537.233498-3-peter.maydell@linaro.org
11
---
35
---
12
hw/arm/sbsa-ref.c | 3 ++-
36
include/hw/arm/virt.h | 2 ++
13
hw/arm/virt.c | 3 ++-
37
hw/arm/virt-acpi-build.c | 20 ++++++++++----
14
hw/arm/xlnx-versal.c | 3 ++-
38
hw/arm/virt.c | 60 ++++++++++++++++++++++++++++++++++------
15
3 files changed, 6 insertions(+), 3 deletions(-)
39
3 files changed, 67 insertions(+), 15 deletions(-)
16
40
17
diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c
41
diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h
18
index XXXXXXX..XXXXXXX 100644
42
index XXXXXXX..XXXXXXX 100644
19
--- a/hw/arm/sbsa-ref.c
43
--- a/include/hw/arm/virt.h
20
+++ b/hw/arm/sbsa-ref.c
44
+++ b/include/hw/arm/virt.h
21
@@ -XXX,XX +XXX,XX @@
45
@@ -XXX,XX +XXX,XX @@ struct VirtMachineClass {
22
#include "hw/pci-host/gpex.h"
46
/* Machines < 6.2 have no support for describing cpu topology to guest */
23
#include "hw/qdev-properties.h"
47
bool no_cpu_topology;
24
#include "hw/usb.h"
48
bool no_tcg_lpa2;
25
+#include "hw/char/pl011.h"
49
+ bool no_ns_el2_virt_timer_irq;
26
#include "net/net.h"
50
};
27
51
28
#define RAMLIMIT_GB 8192
52
struct VirtMachineState {
29
@@ -XXX,XX +XXX,XX @@ static void create_uart(const SBSAMachineState *sms, int uart,
53
@@ -XXX,XX +XXX,XX @@ struct VirtMachineState {
54
PCIBus *bus;
55
char *oem_id;
56
char *oem_table_id;
57
+ bool ns_el2_virt_timer_irq;
58
};
59
60
#define VIRT_ECAM_ID(high) (high ? VIRT_HIGH_PCIE_ECAM : VIRT_PCIE_ECAM)
61
diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
62
index XXXXXXX..XXXXXXX 100644
63
--- a/hw/arm/virt-acpi-build.c
64
+++ b/hw/arm/virt-acpi-build.c
65
@@ -XXX,XX +XXX,XX @@ build_srat(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
66
}
67
68
/*
69
- * ACPI spec, Revision 5.1
70
- * 5.2.24 Generic Timer Description Table (GTDT)
71
+ * ACPI spec, Revision 6.5
72
+ * 5.2.25 Generic Timer Description Table (GTDT)
73
*/
74
static void
75
build_gtdt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
76
@@ -XXX,XX +XXX,XX @@ build_gtdt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
77
uint32_t irqflags = vmc->claim_edge_triggered_timers ?
78
1 : /* Interrupt is Edge triggered */
79
0; /* Interrupt is Level triggered */
80
- AcpiTable table = { .sig = "GTDT", .rev = 2, .oem_id = vms->oem_id,
81
+ AcpiTable table = { .sig = "GTDT", .rev = 3, .oem_id = vms->oem_id,
82
.oem_table_id = vms->oem_table_id };
83
84
acpi_table_begin(&table, table_data);
85
@@ -XXX,XX +XXX,XX @@ build_gtdt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
86
build_append_int_noprefix(table_data, 0, 4);
87
/* Platform Timer Offset */
88
build_append_int_noprefix(table_data, 0, 4);
89
-
90
+ if (vms->ns_el2_virt_timer_irq) {
91
+ /* Virtual EL2 Timer GSIV */
92
+ build_append_int_noprefix(table_data, ARCH_TIMER_NS_EL2_VIRT_IRQ, 4);
93
+ /* Virtual EL2 Timer Flags */
94
+ build_append_int_noprefix(table_data, irqflags, 4);
95
+ } else {
96
+ build_append_int_noprefix(table_data, 0, 4);
97
+ build_append_int_noprefix(table_data, 0, 4);
98
+ }
99
acpi_table_end(linker, &table);
100
}
101
102
@@ -XXX,XX +XXX,XX @@ build_madt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
103
static void build_fadt_rev6(GArray *table_data, BIOSLinker *linker,
104
VirtMachineState *vms, unsigned dsdt_tbl_offset)
30
{
105
{
31
hwaddr base = sbsa_ref_memmap[uart].base;
106
- /* ACPI v6.0 */
32
int irq = sbsa_ref_irqmap[uart];
107
+ /* ACPI v6.3 */
33
- DeviceState *dev = qdev_create(NULL, "pl011");
108
AcpiFadtData fadt = {
34
+ DeviceState *dev = qdev_create(NULL, TYPE_PL011);
109
.rev = 6,
35
SysBusDevice *s = SYS_BUS_DEVICE(dev);
110
- .minor_ver = 0,
36
111
+ .minor_ver = 3,
37
qdev_prop_set_chr(dev, "chardev", chr);
112
.flags = 1 << ACPI_FADT_F_HW_REDUCED_ACPI,
113
.xdsdt_tbl_offset = &dsdt_tbl_offset,
114
};
38
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
115
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
39
index XXXXXXX..XXXXXXX 100644
116
index XXXXXXX..XXXXXXX 100644
40
--- a/hw/arm/virt.c
117
--- a/hw/arm/virt.c
41
+++ b/hw/arm/virt.c
118
+++ b/hw/arm/virt.c
42
@@ -XXX,XX +XXX,XX @@
119
@@ -XXX,XX +XXX,XX @@ static void create_randomness(MachineState *ms, const char *node)
43
#include "hw/mem/nvdimm.h"
120
qemu_fdt_setprop(ms->fdt, node, "rng-seed", seed.rng, sizeof(seed.rng));
44
#include "hw/acpi/generic_event_device.h"
121
}
45
#include "hw/virtio/virtio-iommu.h"
122
46
+#include "hw/char/pl011.h"
123
+/*
47
124
+ * The CPU object always exposes the NS EL2 virt timer IRQ line,
48
#define DEFINE_VIRT_MACHINE_LATEST(major, minor, latest) \
125
+ * but we don't want to advertise it to the guest in the dtb or ACPI
49
static void virt_##major##_##minor##_class_init(ObjectClass *oc, \
126
+ * table unless it's really going to do something.
50
@@ -XXX,XX +XXX,XX @@ static void create_uart(const VirtMachineState *vms, int uart,
127
+ */
51
int irq = vms->irqmap[uart];
128
+static bool ns_el2_virt_timer_present(void)
52
const char compat[] = "arm,pl011\0arm,primecell";
129
+{
53
const char clocknames[] = "uartclk\0apb_pclk";
130
+ ARMCPU *cpu = ARM_CPU(qemu_get_cpu(0));
54
- DeviceState *dev = qdev_create(NULL, "pl011");
131
+ CPUARMState *env = &cpu->env;
55
+ DeviceState *dev = qdev_create(NULL, TYPE_PL011);
132
+
56
SysBusDevice *s = SYS_BUS_DEVICE(dev);
133
+ return arm_feature(env, ARM_FEATURE_AARCH64) &&
57
134
+ arm_feature(env, ARM_FEATURE_EL2) && cpu_isar_feature(aa64_vh, cpu);
58
qdev_prop_set_chr(dev, "chardev", chr);
135
+}
59
diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
136
+
60
index XXXXXXX..XXXXXXX 100644
137
static void create_fdt(VirtMachineState *vms)
61
--- a/hw/arm/xlnx-versal.c
138
{
62
+++ b/hw/arm/xlnx-versal.c
139
MachineState *ms = MACHINE(vms);
63
@@ -XXX,XX +XXX,XX @@
140
@@ -XXX,XX +XXX,XX @@ static void fdt_add_timer_nodes(const VirtMachineState *vms)
64
#include "hw/misc/unimp.h"
141
"arm,armv7-timer");
65
#include "hw/intc/arm_gicv3_common.h"
142
}
66
#include "hw/arm/xlnx-versal.h"
143
qemu_fdt_setprop(ms->fdt, "/timer", "always-on", NULL, 0);
67
+#include "hw/char/pl011.h"
144
- qemu_fdt_setprop_cells(ms->fdt, "/timer", "interrupts",
68
145
- GIC_FDT_IRQ_TYPE_PPI,
69
#define XLNX_VERSAL_ACPU_TYPE ARM_CPU_TYPE_NAME("cortex-a72")
146
- INTID_TO_PPI(ARCH_TIMER_S_EL1_IRQ), irqflags,
70
#define GEM_REVISION 0x40070106
147
- GIC_FDT_IRQ_TYPE_PPI,
71
@@ -XXX,XX +XXX,XX @@ static void versal_create_uarts(Versal *s, qemu_irq *pic)
148
- INTID_TO_PPI(ARCH_TIMER_NS_EL1_IRQ), irqflags,
72
DeviceState *dev;
149
- GIC_FDT_IRQ_TYPE_PPI,
73
MemoryRegion *mr;
150
- INTID_TO_PPI(ARCH_TIMER_VIRT_IRQ), irqflags,
74
151
- GIC_FDT_IRQ_TYPE_PPI,
75
- dev = qdev_create(NULL, "pl011");
152
- INTID_TO_PPI(ARCH_TIMER_NS_EL2_IRQ), irqflags);
76
+ dev = qdev_create(NULL, TYPE_PL011);
153
+ if (vms->ns_el2_virt_timer_irq) {
77
s->lpd.iou.uart[i] = SYS_BUS_DEVICE(dev);
154
+ qemu_fdt_setprop_cells(ms->fdt, "/timer", "interrupts",
78
qdev_prop_set_chr(dev, "chardev", serial_hd(i));
155
+ GIC_FDT_IRQ_TYPE_PPI,
79
object_property_add_child(OBJECT(s), name, OBJECT(dev), &error_fatal);
156
+ INTID_TO_PPI(ARCH_TIMER_S_EL1_IRQ), irqflags,
157
+ GIC_FDT_IRQ_TYPE_PPI,
158
+ INTID_TO_PPI(ARCH_TIMER_NS_EL1_IRQ), irqflags,
159
+ GIC_FDT_IRQ_TYPE_PPI,
160
+ INTID_TO_PPI(ARCH_TIMER_VIRT_IRQ), irqflags,
161
+ GIC_FDT_IRQ_TYPE_PPI,
162
+ INTID_TO_PPI(ARCH_TIMER_NS_EL2_IRQ), irqflags,
163
+ GIC_FDT_IRQ_TYPE_PPI,
164
+ INTID_TO_PPI(ARCH_TIMER_NS_EL2_VIRT_IRQ), irqflags);
165
+ } else {
166
+ qemu_fdt_setprop_cells(ms->fdt, "/timer", "interrupts",
167
+ GIC_FDT_IRQ_TYPE_PPI,
168
+ INTID_TO_PPI(ARCH_TIMER_S_EL1_IRQ), irqflags,
169
+ GIC_FDT_IRQ_TYPE_PPI,
170
+ INTID_TO_PPI(ARCH_TIMER_NS_EL1_IRQ), irqflags,
171
+ GIC_FDT_IRQ_TYPE_PPI,
172
+ INTID_TO_PPI(ARCH_TIMER_VIRT_IRQ), irqflags,
173
+ GIC_FDT_IRQ_TYPE_PPI,
174
+ INTID_TO_PPI(ARCH_TIMER_NS_EL2_IRQ), irqflags);
175
+ }
176
}
177
178
static void fdt_add_cpu_nodes(const VirtMachineState *vms)
179
@@ -XXX,XX +XXX,XX @@ static void create_gic(VirtMachineState *vms, MemoryRegion *mem)
180
[GTIMER_VIRT] = ARCH_TIMER_VIRT_IRQ,
181
[GTIMER_HYP] = ARCH_TIMER_NS_EL2_IRQ,
182
[GTIMER_SEC] = ARCH_TIMER_S_EL1_IRQ,
183
+ [GTIMER_HYPVIRT] = ARCH_TIMER_NS_EL2_VIRT_IRQ,
184
};
185
186
for (unsigned irq = 0; irq < ARRAY_SIZE(timer_irq); irq++) {
187
@@ -XXX,XX +XXX,XX @@ static void machvirt_init(MachineState *machine)
188
qdev_realize(DEVICE(cpuobj), NULL, &error_fatal);
189
object_unref(cpuobj);
190
}
191
+
192
+ /* Now we've created the CPUs we can see if they have the hypvirt timer */
193
+ vms->ns_el2_virt_timer_irq = ns_el2_virt_timer_present() &&
194
+ !vmc->no_ns_el2_virt_timer_irq;
195
+
196
fdt_add_timer_nodes(vms);
197
fdt_add_cpu_nodes(vms);
198
199
@@ -XXX,XX +XXX,XX @@ DEFINE_VIRT_MACHINE_AS_LATEST(9, 0)
200
201
static void virt_machine_8_2_options(MachineClass *mc)
202
{
203
+ VirtMachineClass *vmc = VIRT_MACHINE_CLASS(OBJECT_CLASS(mc));
204
+
205
virt_machine_9_0_options(mc);
206
compat_props_add(mc->compat_props, hw_compat_8_2, hw_compat_8_2_len);
207
+ /*
208
+ * Don't expose NS_EL2_VIRT timer IRQ in DTB on ACPI on 8.2 and
209
+ * earlier machines. (Exposing it tickles a bug in older EDK2
210
+ * guest BIOS binaries.)
211
+ */
212
+ vmc->no_ns_el2_virt_timer_irq = true;
213
}
214
DEFINE_VIRT_MACHINE(8, 2)
215
80
--
216
--
81
2.20.1
217
2.34.1
82
83
diff view generated by jsdifflib
New patch
1
1
Update the virt golden reference files to say that the FACP is ACPI
2
v6.3, and the GTDT table is a revision 3 table with space for the
3
virtual EL2 timer.
4
5
Diffs from iasl:
6
7
@@ -XXX,XX +XXX,XX @@
8
/*
9
* Intel ACPI Component Architecture
10
* AML/ASL+ Disassembler version 20200925 (64-bit version)
11
* Copyright (c) 2000 - 2020 Intel Corporation
12
*
13
- * Disassembly of tests/data/acpi/virt/FACP, Mon Jan 22 13:48:40 2024
14
+ * Disassembly of /tmp/aml-W8RZH2, Mon Jan 22 13:48:40 2024
15
*
16
* ACPI Data Table [FACP]
17
*
18
* Format: [HexOffset DecimalOffset ByteLength] FieldName : FieldValue
19
*/
20
21
[000h 0000 4] Signature : "FACP" [Fixed ACPI Description Table (FADT)]
22
[004h 0004 4] Table Length : 00000114
23
[008h 0008 1] Revision : 06
24
-[009h 0009 1] Checksum : 15
25
+[009h 0009 1] Checksum : 12
26
[00Ah 0010 6] Oem ID : "BOCHS "
27
[010h 0016 8] Oem Table ID : "BXPC "
28
[018h 0024 4] Oem Revision : 00000001
29
[01Ch 0028 4] Asl Compiler ID : "BXPC"
30
[020h 0032 4] Asl Compiler Revision : 00000001
31
32
[024h 0036 4] FACS Address : 00000000
33
[028h 0040 4] DSDT Address : 00000000
34
[02Ch 0044 1] Model : 00
35
[02Dh 0045 1] PM Profile : 00 [Unspecified]
36
[02Eh 0046 2] SCI Interrupt : 0000
37
[030h 0048 4] SMI Command Port : 00000000
38
[034h 0052 1] ACPI Enable Value : 00
39
[035h 0053 1] ACPI Disable Value : 00
40
[036h 0054 1] S4BIOS Command : 00
41
[037h 0055 1] P-State Control : 00
42
@@ -XXX,XX +XXX,XX @@
43
Use APIC Physical Destination Mode (V4) : 0
44
Hardware Reduced (V5) : 1
45
Low Power S0 Idle (V5) : 0
46
47
[074h 0116 12] Reset Register : [Generic Address Structure]
48
[074h 0116 1] Space ID : 00 [SystemMemory]
49
[075h 0117 1] Bit Width : 00
50
[076h 0118 1] Bit Offset : 00
51
[077h 0119 1] Encoded Access Width : 00 [Undefined/Legacy]
52
[078h 0120 8] Address : 0000000000000000
53
54
[080h 0128 1] Value to cause reset : 00
55
[081h 0129 2] ARM Flags (decoded below) : 0003
56
PSCI Compliant : 1
57
Must use HVC for PSCI : 1
58
59
-[083h 0131 1] FADT Minor Revision : 00
60
+[083h 0131 1] FADT Minor Revision : 03
61
[084h 0132 8] FACS Address : 0000000000000000
62
[08Ch 0140 8] DSDT Address : 0000000000000000
63
[094h 0148 12] PM1A Event Block : [Generic Address Structure]
64
[094h 0148 1] Space ID : 00 [SystemMemory]
65
[095h 0149 1] Bit Width : 00
66
[096h 0150 1] Bit Offset : 00
67
[097h 0151 1] Encoded Access Width : 00 [Undefined/Legacy]
68
[098h 0152 8] Address : 0000000000000000
69
70
[0A0h 0160 12] PM1B Event Block : [Generic Address Structure]
71
[0A0h 0160 1] Space ID : 00 [SystemMemory]
72
[0A1h 0161 1] Bit Width : 00
73
[0A2h 0162 1] Bit Offset : 00
74
[0A3h 0163 1] Encoded Access Width : 00 [Undefined/Legacy]
75
[0A4h 0164 8] Address : 0000000000000000
76
77
@@ -XXX,XX +XXX,XX @@
78
[0F5h 0245 1] Bit Width : 00
79
[0F6h 0246 1] Bit Offset : 00
80
[0F7h 0247 1] Encoded Access Width : 00 [Undefined/Legacy]
81
[0F8h 0248 8] Address : 0000000000000000
82
83
[100h 0256 12] Sleep Status Register : [Generic Address Structure]
84
[100h 0256 1] Space ID : 00 [SystemMemory]
85
[101h 0257 1] Bit Width : 00
86
[102h 0258 1] Bit Offset : 00
87
[103h 0259 1] Encoded Access Width : 00 [Undefined/Legacy]
88
[104h 0260 8] Address : 0000000000000000
89
90
[10Ch 0268 8] Hypervisor ID : 00000000554D4551
91
92
Raw Table Data: Length 276 (0x114)
93
94
- 0000: 46 41 43 50 14 01 00 00 06 15 42 4F 43 48 53 20 // FACP......BOCHS
95
+ 0000: 46 41 43 50 14 01 00 00 06 12 42 4F 43 48 53 20 // FACP......BOCHS
96
0010: 42 58 50 43 20 20 20 20 01 00 00 00 42 58 50 43 // BXPC ....BXPC
97
0020: 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // ................
98
0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // ................
99
0040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // ................
100
0050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // ................
101
0060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // ................
102
0070: 00 00 10 00 00 00 00 00 00 00 00 00 00 00 00 00 // ................
103
- 0080: 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // ................
104
+ 0080: 00 03 00 03 00 00 00 00 00 00 00 00 00 00 00 00 // ................
105
0090: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // ................
106
00A0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // ................
107
00B0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // ................
108
00C0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // ................
109
00D0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // ................
110
00E0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // ................
111
00F0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 // ................
112
0100: 00 00 00 00 00 00 00 00 00 00 00 00 51 45 4D 55 // ............QEMU
113
0110: 00 00 00 00 // ....
114
115
@@ -XXX,XX +XXX,XX @@
116
/*
117
* Intel ACPI Component Architecture
118
* AML/ASL+ Disassembler version 20200925 (64-bit version)
119
* Copyright (c) 2000 - 2020 Intel Corporation
120
*
121
- * Disassembly of tests/data/acpi/virt/GTDT, Mon Jan 22 13:48:40 2024
122
+ * Disassembly of /tmp/aml-XDSZH2, Mon Jan 22 13:48:40 2024
123
*
124
* ACPI Data Table [GTDT]
125
*
126
* Format: [HexOffset DecimalOffset ByteLength] FieldName : FieldValue
127
*/
128
129
[000h 0000 4] Signature : "GTDT" [Generic Timer Description Table]
130
-[004h 0004 4] Table Length : 00000060
131
-[008h 0008 1] Revision : 02
132
-[009h 0009 1] Checksum : 9C
133
+[004h 0004 4] Table Length : 00000068
134
+[008h 0008 1] Revision : 03
135
+[009h 0009 1] Checksum : 93
136
[00Ah 0010 6] Oem ID : "BOCHS "
137
[010h 0016 8] Oem Table ID : "BXPC "
138
[018h 0024 4] Oem Revision : 00000001
139
[01Ch 0028 4] Asl Compiler ID : "BXPC"
140
[020h 0032 4] Asl Compiler Revision : 00000001
141
142
[024h 0036 8] Counter Block Address : FFFFFFFFFFFFFFFF
143
[02Ch 0044 4] Reserved : 00000000
144
145
[030h 0048 4] Secure EL1 Interrupt : 0000001D
146
[034h 0052 4] EL1 Flags (decoded below) : 00000000
147
Trigger Mode : 0
148
Polarity : 0
149
Always On : 0
150
151
[038h 0056 4] Non-Secure EL1 Interrupt : 0000001E
152
@@ -XXX,XX +XXX,XX @@
153
154
[040h 0064 4] Virtual Timer Interrupt : 0000001B
155
[044h 0068 4] VT Flags (decoded below) : 00000000
156
Trigger Mode : 0
157
Polarity : 0
158
Always On : 0
159
160
[048h 0072 4] Non-Secure EL2 Interrupt : 0000001A
161
[04Ch 0076 4] NEL2 Flags (decoded below) : 00000000
162
Trigger Mode : 0
163
Polarity : 0
164
Always On : 0
165
[050h 0080 8] Counter Read Block Address : FFFFFFFFFFFFFFFF
166
167
[058h 0088 4] Platform Timer Count : 00000000
168
[05Ch 0092 4] Platform Timer Offset : 00000000
169
+[060h 0096 4] Virtual EL2 Timer GSIV : 00000000
170
+[064h 0100 4] Virtual EL2 Timer Flags : 00000000
171
172
-Raw Table Data: Length 96 (0x60)
173
+Raw Table Data: Length 104 (0x68)
174
175
- 0000: 47 54 44 54 60 00 00 00 02 9C 42 4F 43 48 53 20 // GTDT`.....BOCHS
176
+ 0000: 47 54 44 54 68 00 00 00 03 93 42 4F 43 48 53 20 // GTDTh.....BOCHS
177
0010: 42 58 50 43 20 20 20 20 01 00 00 00 42 58 50 43 // BXPC ....BXPC
178
0020: 01 00 00 00 FF FF FF FF FF FF FF FF 00 00 00 00 // ................
179
0030: 1D 00 00 00 00 00 00 00 1E 00 00 00 04 00 00 00 // ................
180
0040: 1B 00 00 00 00 00 00 00 1A 00 00 00 00 00 00 00 // ................
181
0050: FF FF FF FF FF FF FF FF 00 00 00 00 00 00 00 00 // ................
182
+ 0060: 00 00 00 00 00 00 00 00 // ........
183
184
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
185
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
186
Message-id: 20240122143537.233498-4-peter.maydell@linaro.org
187
---
188
tests/qtest/bios-tables-test-allowed-diff.h | 2 --
189
tests/data/acpi/virt/FACP | Bin 276 -> 276 bytes
190
tests/data/acpi/virt/GTDT | Bin 96 -> 104 bytes
191
3 files changed, 2 deletions(-)
192
193
diff --git a/tests/qtest/bios-tables-test-allowed-diff.h b/tests/qtest/bios-tables-test-allowed-diff.h
194
index XXXXXXX..XXXXXXX 100644
195
--- a/tests/qtest/bios-tables-test-allowed-diff.h
196
+++ b/tests/qtest/bios-tables-test-allowed-diff.h
197
@@ -1,3 +1 @@
198
/* List of comma-separated changed AML files to ignore */
199
-"tests/data/acpi/virt/FACP",
200
-"tests/data/acpi/virt/GTDT",
201
diff --git a/tests/data/acpi/virt/FACP b/tests/data/acpi/virt/FACP
202
index XXXXXXX..XXXXXXX 100644
203
GIT binary patch
204
delta 25
205
gcmbQjG=+)F&CxkPgpq-PO=u!l<;2F$$vli407<0<)c^nh
206
207
delta 28
208
kcmbQjG=+)F&CxkPgpq-PO>`nx<-|!<6Akz$^DuG%0AAS!ssI20
209
210
diff --git a/tests/data/acpi/virt/GTDT b/tests/data/acpi/virt/GTDT
211
index XXXXXXX..XXXXXXX 100644
212
GIT binary patch
213
delta 25
214
bcmYeu;BpUf3CUn!U|^m+kt>V?$N&QXMtB4L
215
216
delta 16
217
Xcmc~u;BpUf2}xjJU|^avkt+-UB60)u
218
219
--
220
2.34.1
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
The patchset adding the GMAC ethernet to this SoC crossed in the
2
mail with the patchset cleaning up the NIC handling. When we
3
create the GMAC modules we must call qemu_configure_nic_device()
4
so that the user has the opportunity to use the -nic commandline
5
option to create a network backend and connect it to the GMACs.
2
6
3
As we want to re-use this code, extract it as a new function.
7
Add the missing call.
4
Since we are using the PL011 serial console, add a Avocado tag
5
to ease filtering of tests.
6
8
7
Reviewed-by: Thomas Huth <thuth@redhat.com>
9
Fixes: 21e5326a7c ("hw/arm: Add GMAC devices to NPCM7XX SoC")
8
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
9
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
10
Message-id: 20200225172501.29609-4-philmd@redhat.com
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Reviewed-by: David Woodhouse <dwmw@amazon.co.uk>
12
Message-id: 20240206171231.396392-2-peter.maydell@linaro.org
12
---
13
---
13
tests/acceptance/machine_arm_integratorcp.py | 18 +++++++++++-------
14
hw/arm/npcm7xx.c | 1 +
14
1 file changed, 11 insertions(+), 7 deletions(-)
15
1 file changed, 1 insertion(+)
15
16
16
diff --git a/tests/acceptance/machine_arm_integratorcp.py b/tests/acceptance/machine_arm_integratorcp.py
17
diff --git a/hw/arm/npcm7xx.c b/hw/arm/npcm7xx.c
17
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
18
--- a/tests/acceptance/machine_arm_integratorcp.py
19
--- a/hw/arm/npcm7xx.c
19
+++ b/tests/acceptance/machine_arm_integratorcp.py
20
+++ b/hw/arm/npcm7xx.c
20
@@ -XXX,XX +XXX,XX @@ class IntegratorMachine(Test):
21
@@ -XXX,XX +XXX,XX @@ static void npcm7xx_realize(DeviceState *dev, Error **errp)
21
22
for (i = 0; i < ARRAY_SIZE(s->gmac); i++) {
22
timeout = 90
23
SysBusDevice *sbd = SYS_BUS_DEVICE(&s->gmac[i]);
23
24
24
- @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
25
+ qemu_configure_nic_device(DEVICE(sbd), false, NULL);
25
- def test_integratorcp_console(self):
26
/*
26
- """
27
* The device exists regardless of whether it's connected to a QEMU
27
- Boots the Linux kernel and checks that the console is operational
28
* netdev backend. So always instantiate it even if there is no
28
- :avocado: tags=arch:arm
29
- :avocado: tags=machine:integratorcp
30
- """
31
+ def boot_integratorcp(self):
32
kernel_url = ('https://github.com/zayac/qemu-arm/raw/master/'
33
'arm-test/kernel/zImage.integrator')
34
kernel_hash = '0d7adba893c503267c946a3cbdc63b4b54f25468'
35
@@ -XXX,XX +XXX,XX @@ class IntegratorMachine(Test):
36
'-initrd', initrd_path,
37
'-append', 'printk.time=0 console=ttyAMA0')
38
self.vm.launch()
39
+
40
+ @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
41
+ def test_integratorcp_console(self):
42
+ """
43
+ Boots the Linux kernel and checks that the console is operational
44
+ :avocado: tags=arch:arm
45
+ :avocado: tags=machine:integratorcp
46
+ :avocado: tags=device:pl011
47
+ """
48
+ self.boot_integratorcp()
49
wait_for_console_pattern(self, 'Log in as root')
50
--
29
--
51
2.20.1
30
2.34.1
52
53
diff view generated by jsdifflib
1
We missed an instance of using FIELD_EX32 on a 64-bit ID
1
Currently QEMU will warn if there is a NIC on the board that
2
register, in isar_feature_aa64_pmu_8_4(). Fix it.
2
is not connected to a backend. By default the '-nic user' will
3
get used for all NICs, but if you manually connect a specific
4
NIC to a specific backend, then the other NICs on the board
5
have no backend and will be warned about:
6
7
qemu-system-arm: warning: nic npcm7xx-emc.1 has no peer
8
qemu-system-arm: warning: nic npcm-gmac.0 has no peer
9
qemu-system-arm: warning: nic npcm-gmac.1 has no peer
10
11
So suppress those warnings by manually connecting every NIC
12
on the board to some backend.
3
13
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
15
Reviewed-by: David Woodhouse <dwmw@amazon.co.uk>
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
16
Reviewed-by: Thomas Huth <thuth@redhat.com>
7
Message-id: 20200224172846.13053-2-peter.maydell@linaro.org
17
Message-id: 20240206171231.396392-3-peter.maydell@linaro.org
8
---
18
---
9
target/arm/cpu.h | 4 ++--
19
tests/qtest/npcm7xx_emc-test.c | 5 ++++-
10
1 file changed, 2 insertions(+), 2 deletions(-)
20
1 file changed, 4 insertions(+), 1 deletion(-)
11
21
12
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
22
diff --git a/tests/qtest/npcm7xx_emc-test.c b/tests/qtest/npcm7xx_emc-test.c
13
index XXXXXXX..XXXXXXX 100644
23
index XXXXXXX..XXXXXXX 100644
14
--- a/target/arm/cpu.h
24
--- a/tests/qtest/npcm7xx_emc-test.c
15
+++ b/target/arm/cpu.h
25
+++ b/tests/qtest/npcm7xx_emc-test.c
16
@@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_pmu_8_1(const ARMISARegisters *id)
26
@@ -XXX,XX +XXX,XX @@ static int *packet_test_init(int module_num, GString *cmd_line)
17
27
* KISS and use -nic. The driver accepts 'emc0' and 'emc1' as aliases
18
static inline bool isar_feature_aa64_pmu_8_4(const ARMISARegisters *id)
28
* in the 'model' field to specify the device to match.
19
{
29
*/
20
- return FIELD_EX32(id->id_aa64dfr0, ID_AA64DFR0, PMUVER) >= 5 &&
30
- g_string_append_printf(cmd_line, " -nic socket,fd=%d,model=emc%d ",
21
- FIELD_EX32(id->id_aa64dfr0, ID_AA64DFR0, PMUVER) != 0xf;
31
+ g_string_append_printf(cmd_line, " -nic socket,fd=%d,model=emc%d "
22
+ return FIELD_EX64(id->id_aa64dfr0, ID_AA64DFR0, PMUVER) >= 5 &&
32
+ "-nic user,model=npcm7xx-emc "
23
+ FIELD_EX64(id->id_aa64dfr0, ID_AA64DFR0, PMUVER) != 0xf;
33
+ "-nic user,model=npcm-gmac "
24
}
34
+ "-nic user,model=npcm-gmac",
25
35
test_sockets[1], module_num);
26
/*
36
37
g_test_queue_destroy(packet_test_clear, test_sockets);
27
--
38
--
28
2.20.1
39
2.34.1
29
30
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
It doesn't make sense to read the value of MDCR_EL2 on a non-A-profile
2
CPU, and in fact if you try to do it we will assert:
2
3
3
Use this in the places that were checking ARM_FEATURE_VFP, and
4
#6 0x00007ffff4b95e96 in __GI___assert_fail
4
are obviously testing for the existance of the register set
5
(assertion=0x5555565a8c70 "!arm_feature(env, ARM_FEATURE_M)", file=0x5555565a6e5c "../../target/arm/helper.c", line=12600, function=0x5555565a9560 <__PRETTY_FUNCTION__.0> "arm_security_space_below_el3") at ./assert/assert.c:101
5
as opposed to testing for some particular instruction extension.
6
#7 0x0000555555ebf412 in arm_security_space_below_el3 (env=0x555557bc8190) at ../../target/arm/helper.c:12600
7
#8 0x0000555555ea6f89 in arm_is_el2_enabled (env=0x555557bc8190) at ../../target/arm/cpu.h:2595
8
#9 0x0000555555ea942f in arm_mdcr_el2_eff (env=0x555557bc8190) at ../../target/arm/internals.h:1512
6
9
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
10
We might call pmu_counter_enabled() on an M-profile CPU (for example
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
11
from the migration pre/post hooks in machine.c); this should always
9
Message-id: 20200224222232.13807-2-richard.henderson@linaro.org
12
return false because these CPUs don't set ARM_FEATURE_PMU.
13
14
Avoid the assertion by not calling arm_mdcr_el2_eff() before we
15
have done the early return for "PMU not present".
16
17
This fixes an assertion failure if you try to do a loadvm or
18
savevm for an M-profile board.
19
20
Cc: qemu-stable@nongnu.org
21
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2155
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
22
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
23
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
24
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
25
Message-id: 20240208153346.970021-1-peter.maydell@linaro.org
11
---
26
---
12
target/arm/cpu.h | 9 +++++++++
27
target/arm/helper.c | 12 ++++++++++--
13
hw/intc/armv7m_nvic.c | 20 ++++++++++----------
28
1 file changed, 10 insertions(+), 2 deletions(-)
14
linux-user/arm/signal.c | 4 ++--
15
target/arm/arch_dump.c | 11 ++++++-----
16
target/arm/cpu.c | 4 ++--
17
target/arm/helper.c | 4 ++--
18
target/arm/m_helper.c | 11 ++++++-----
19
7 files changed, 37 insertions(+), 26 deletions(-)
20
29
21
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
22
index XXXXXXX..XXXXXXX 100644
23
--- a/target/arm/cpu.h
24
+++ b/target/arm/cpu.h
25
@@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa32_fp16_arith(const ARMISARegisters *id)
26
return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, FP) == 1;
27
}
28
29
+static inline bool isar_feature_aa32_vfp_simd(const ARMISARegisters *id)
30
+{
31
+ /*
32
+ * Return true if either VFP or SIMD is implemented.
33
+ * In this case, a minimum of VFP w/ D0-D15.
34
+ */
35
+ return FIELD_EX32(id->mvfr0, MVFR0, SIMDREG) > 0;
36
+}
37
+
38
static inline bool isar_feature_aa32_simd_r32(const ARMISARegisters *id)
39
{
40
/* Return true if D16-D31 are implemented */
41
diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c
42
index XXXXXXX..XXXXXXX 100644
43
--- a/hw/intc/armv7m_nvic.c
44
+++ b/hw/intc/armv7m_nvic.c
45
@@ -XXX,XX +XXX,XX @@ static uint32_t nvic_readl(NVICState *s, uint32_t offset, MemTxAttrs attrs)
46
case 0xd84: /* CSSELR */
47
return cpu->env.v7m.csselr[attrs.secure];
48
case 0xd88: /* CPACR */
49
- if (!arm_feature(&cpu->env, ARM_FEATURE_VFP)) {
50
+ if (!cpu_isar_feature(aa32_vfp_simd, cpu)) {
51
return 0;
52
}
53
return cpu->env.v7m.cpacr[attrs.secure];
54
case 0xd8c: /* NSACR */
55
- if (!attrs.secure || !arm_feature(&cpu->env, ARM_FEATURE_VFP)) {
56
+ if (!attrs.secure || !cpu_isar_feature(aa32_vfp_simd, cpu)) {
57
return 0;
58
}
59
return cpu->env.v7m.nsacr;
60
@@ -XXX,XX +XXX,XX @@ static uint32_t nvic_readl(NVICState *s, uint32_t offset, MemTxAttrs attrs)
61
}
62
return cpu->env.v7m.sfar;
63
case 0xf34: /* FPCCR */
64
- if (!arm_feature(&cpu->env, ARM_FEATURE_VFP)) {
65
+ if (!cpu_isar_feature(aa32_vfp_simd, cpu)) {
66
return 0;
67
}
68
if (attrs.secure) {
69
@@ -XXX,XX +XXX,XX @@ static uint32_t nvic_readl(NVICState *s, uint32_t offset, MemTxAttrs attrs)
70
return value;
71
}
72
case 0xf38: /* FPCAR */
73
- if (!arm_feature(&cpu->env, ARM_FEATURE_VFP)) {
74
+ if (!cpu_isar_feature(aa32_vfp_simd, cpu)) {
75
return 0;
76
}
77
return cpu->env.v7m.fpcar[attrs.secure];
78
case 0xf3c: /* FPDSCR */
79
- if (!arm_feature(&cpu->env, ARM_FEATURE_VFP)) {
80
+ if (!cpu_isar_feature(aa32_vfp_simd, cpu)) {
81
return 0;
82
}
83
return cpu->env.v7m.fpdscr[attrs.secure];
84
@@ -XXX,XX +XXX,XX @@ static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value,
85
}
86
break;
87
case 0xd88: /* CPACR */
88
- if (arm_feature(&cpu->env, ARM_FEATURE_VFP)) {
89
+ if (cpu_isar_feature(aa32_vfp_simd, cpu)) {
90
/* We implement only the Floating Point extension's CP10/CP11 */
91
cpu->env.v7m.cpacr[attrs.secure] = value & (0xf << 20);
92
}
93
break;
94
case 0xd8c: /* NSACR */
95
- if (attrs.secure && arm_feature(&cpu->env, ARM_FEATURE_VFP)) {
96
+ if (attrs.secure && cpu_isar_feature(aa32_vfp_simd, cpu)) {
97
/* We implement only the Floating Point extension's CP10/CP11 */
98
cpu->env.v7m.nsacr = value & (3 << 10);
99
}
100
@@ -XXX,XX +XXX,XX @@ static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value,
101
break;
102
}
103
case 0xf34: /* FPCCR */
104
- if (arm_feature(&cpu->env, ARM_FEATURE_VFP)) {
105
+ if (cpu_isar_feature(aa32_vfp_simd, cpu)) {
106
/* Not all bits here are banked. */
107
uint32_t fpccr_s;
108
109
@@ -XXX,XX +XXX,XX @@ static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value,
110
}
111
break;
112
case 0xf38: /* FPCAR */
113
- if (arm_feature(&cpu->env, ARM_FEATURE_VFP)) {
114
+ if (cpu_isar_feature(aa32_vfp_simd, cpu)) {
115
value &= ~7;
116
cpu->env.v7m.fpcar[attrs.secure] = value;
117
}
118
break;
119
case 0xf3c: /* FPDSCR */
120
- if (arm_feature(&cpu->env, ARM_FEATURE_VFP)) {
121
+ if (cpu_isar_feature(aa32_vfp_simd, cpu)) {
122
value &= 0x07c00000;
123
cpu->env.v7m.fpdscr[attrs.secure] = value;
124
}
125
diff --git a/linux-user/arm/signal.c b/linux-user/arm/signal.c
126
index XXXXXXX..XXXXXXX 100644
127
--- a/linux-user/arm/signal.c
128
+++ b/linux-user/arm/signal.c
129
@@ -XXX,XX +XXX,XX @@ static void setup_sigframe_v2(struct target_ucontext_v2 *uc,
130
setup_sigcontext(&uc->tuc_mcontext, env, set->sig[0]);
131
/* Save coprocessor signal frame. */
132
regspace = uc->tuc_regspace;
133
- if (arm_feature(env, ARM_FEATURE_VFP)) {
134
+ if (cpu_isar_feature(aa32_vfp_simd, env_archcpu(env))) {
135
regspace = setup_sigframe_v2_vfp(regspace, env);
136
}
137
if (arm_feature(env, ARM_FEATURE_IWMMXT)) {
138
@@ -XXX,XX +XXX,XX @@ static int do_sigframe_return_v2(CPUARMState *env,
139
140
/* Restore coprocessor signal frame */
141
regspace = uc->tuc_regspace;
142
- if (arm_feature(env, ARM_FEATURE_VFP)) {
143
+ if (cpu_isar_feature(aa32_vfp_simd, env_archcpu(env))) {
144
regspace = restore_sigframe_v2_vfp(env, regspace);
145
if (!regspace) {
146
return 1;
147
diff --git a/target/arm/arch_dump.c b/target/arm/arch_dump.c
148
index XXXXXXX..XXXXXXX 100644
149
--- a/target/arm/arch_dump.c
150
+++ b/target/arm/arch_dump.c
151
@@ -XXX,XX +XXX,XX @@ int arm_cpu_write_elf32_note(WriteCoreDumpFunction f, CPUState *cs,
152
int cpuid, void *opaque)
153
{
154
struct arm_note note;
155
- CPUARMState *env = &ARM_CPU(cs)->env;
156
+ ARMCPU *cpu = ARM_CPU(cs);
157
+ CPUARMState *env = &cpu->env;
158
DumpState *s = opaque;
159
- int ret, i, fpvalid = !!arm_feature(env, ARM_FEATURE_VFP);
160
+ int ret, i;
161
+ bool fpvalid = cpu_isar_feature(aa32_vfp_simd, cpu);
162
163
arm_note_init(&note, s, "CORE", 5, NT_PRSTATUS, sizeof(note.prstatus));
164
165
@@ -XXX,XX +XXX,XX @@ int cpu_get_dump_info(ArchDumpInfo *info,
166
ssize_t cpu_get_note_size(int class, int machine, int nr_cpus)
167
{
168
ARMCPU *cpu = ARM_CPU(first_cpu);
169
- CPUARMState *env = &cpu->env;
170
size_t note_size;
171
172
if (class == ELFCLASS64) {
173
@@ -XXX,XX +XXX,XX @@ ssize_t cpu_get_note_size(int class, int machine, int nr_cpus)
174
note_size += AARCH64_PRFPREG_NOTE_SIZE;
175
#ifdef TARGET_AARCH64
176
if (cpu_isar_feature(aa64_sve, cpu)) {
177
- note_size += AARCH64_SVE_NOTE_SIZE(env);
178
+ note_size += AARCH64_SVE_NOTE_SIZE(&cpu->env);
179
}
180
#endif
181
} else {
182
note_size = ARM_PRSTATUS_NOTE_SIZE;
183
- if (arm_feature(env, ARM_FEATURE_VFP)) {
184
+ if (cpu_isar_feature(aa32_vfp_simd, cpu)) {
185
note_size += ARM_VFP_NOTE_SIZE;
186
}
187
}
188
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
189
index XXXXXXX..XXXXXXX 100644
190
--- a/target/arm/cpu.c
191
+++ b/target/arm/cpu.c
192
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_reset(CPUState *s)
193
env->v7m.ccr[M_REG_S] |= R_V7M_CCR_UNALIGN_TRP_MASK;
194
}
195
196
- if (arm_feature(env, ARM_FEATURE_VFP)) {
197
+ if (cpu_isar_feature(aa32_vfp_simd, cpu)) {
198
env->v7m.fpccr[M_REG_NS] = R_V7M_FPCCR_ASPEN_MASK;
199
env->v7m.fpccr[M_REG_S] = R_V7M_FPCCR_ASPEN_MASK |
200
R_V7M_FPCCR_LSPEN_MASK | R_V7M_FPCCR_S_MASK;
201
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_dump_state(CPUState *cs, FILE *f, int flags)
202
int numvfpregs = 0;
203
if (cpu_isar_feature(aa32_simd_r32, cpu)) {
204
numvfpregs = 32;
205
- } else if (arm_feature(env, ARM_FEATURE_VFP)) {
206
+ } else if (cpu_isar_feature(aa32_vfp_simd, cpu)) {
207
numvfpregs = 16;
208
}
209
for (i = 0; i < numvfpregs; i++) {
210
diff --git a/target/arm/helper.c b/target/arm/helper.c
30
diff --git a/target/arm/helper.c b/target/arm/helper.c
211
index XXXXXXX..XXXXXXX 100644
31
index XXXXXXX..XXXXXXX 100644
212
--- a/target/arm/helper.c
32
--- a/target/arm/helper.c
213
+++ b/target/arm/helper.c
33
+++ b/target/arm/helper.c
214
@@ -XXX,XX +XXX,XX @@ static void cpacr_write(CPUARMState *env, const ARMCPRegInfo *ri,
34
@@ -XXX,XX +XXX,XX @@ static bool pmu_counter_enabled(CPUARMState *env, uint8_t counter)
215
* ASEDIS [31] and D32DIS [30] are both UNK/SBZP without VFP.
35
bool enabled, prohibited = false, filtered;
216
* TRCDIS [28] is RAZ/WI since we do not implement a trace macrocell.
36
bool secure = arm_is_secure(env);
217
*/
37
int el = arm_current_el(env);
218
- if (arm_feature(env, ARM_FEATURE_VFP)) {
38
- uint64_t mdcr_el2 = arm_mdcr_el2_eff(env);
219
+ if (cpu_isar_feature(aa32_vfp_simd, env_archcpu(env))) {
39
- uint8_t hpmn = mdcr_el2 & MDCR_HPMN;
220
/* VFP coprocessor: cp10 & cp11 [23:20] */
40
+ uint64_t mdcr_el2;
221
mask |= (1 << 31) | (1 << 30) | (0xf << 20);
41
+ uint8_t hpmn;
222
42
223
@@ -XXX,XX +XXX,XX @@ void arm_cpu_register_gdb_regs_for_features(ARMCPU *cpu)
43
+ /*
224
} else if (cpu_isar_feature(aa32_simd_r32, cpu)) {
44
+ * We might be called for M-profile cores where MDCR_EL2 doesn't
225
gdb_register_coprocessor(cs, vfp_gdb_get_reg, vfp_gdb_set_reg,
45
+ * exist and arm_mdcr_el2_eff() will assert, so this early-exit check
226
35, "arm-vfp3.xml", 0);
46
+ * must be before we read that value.
227
- } else if (arm_feature(env, ARM_FEATURE_VFP)) {
47
+ */
228
+ } else if (cpu_isar_feature(aa32_vfp_simd, cpu)) {
48
if (!arm_feature(env, ARM_FEATURE_PMU)) {
229
gdb_register_coprocessor(cs, vfp_gdb_get_reg, vfp_gdb_set_reg,
49
return false;
230
19, "arm-vfp.xml", 0);
231
}
50
}
232
diff --git a/target/arm/m_helper.c b/target/arm/m_helper.c
51
233
index XXXXXXX..XXXXXXX 100644
52
+ mdcr_el2 = arm_mdcr_el2_eff(env);
234
--- a/target/arm/m_helper.c
53
+ hpmn = mdcr_el2 & MDCR_HPMN;
235
+++ b/target/arm/m_helper.c
54
+
236
@@ -XXX,XX +XXX,XX @@ static uint32_t v7m_integrity_sig(CPUARMState *env, uint32_t lr)
55
if (!arm_feature(env, ARM_FEATURE_EL2) ||
237
*/
56
(counter < hpmn || counter == 31)) {
238
uint32_t sig = 0xfefa125a;
57
e = env->cp15.c9_pmcr & PMCRE;
239
240
- if (!arm_feature(env, ARM_FEATURE_VFP) || (lr & R_V7M_EXCRET_FTYPE_MASK)) {
241
+ if (!cpu_isar_feature(aa32_vfp_simd, env_archcpu(env))
242
+ || (lr & R_V7M_EXCRET_FTYPE_MASK)) {
243
sig |= 1;
244
}
245
return sig;
246
@@ -XXX,XX +XXX,XX @@ static void v7m_exception_taken(ARMCPU *cpu, uint32_t lr, bool dotailchain,
247
248
if (dotailchain) {
249
/* Sanitize LR FType and PREFIX bits */
250
- if (!arm_feature(env, ARM_FEATURE_VFP)) {
251
+ if (!cpu_isar_feature(aa32_vfp_simd, cpu)) {
252
lr |= R_V7M_EXCRET_FTYPE_MASK;
253
}
254
lr = deposit32(lr, 24, 8, 0xff);
255
@@ -XXX,XX +XXX,XX @@ static void do_v7m_exception_exit(ARMCPU *cpu)
256
257
ftype = excret & R_V7M_EXCRET_FTYPE_MASK;
258
259
- if (!arm_feature(env, ARM_FEATURE_VFP) && !ftype) {
260
+ if (!ftype && !cpu_isar_feature(aa32_vfp_simd, cpu)) {
261
qemu_log_mask(LOG_GUEST_ERROR, "M profile: zero FTYPE in exception "
262
"exit PC value 0x%" PRIx32 " is UNPREDICTABLE "
263
"if FPU not present\n",
264
@@ -XXX,XX +XXX,XX @@ void HELPER(v7m_msr)(CPUARMState *env, uint32_t maskreg, uint32_t val)
265
* SFPA is RAZ/WI from NS. FPCA is RO if NSACR.CP10 == 0,
266
* RES0 if the FPU is not present, and is stored in the S bank
267
*/
268
- if (arm_feature(env, ARM_FEATURE_VFP) &&
269
+ if (cpu_isar_feature(aa32_vfp_simd, env_archcpu(env)) &&
270
extract32(env->v7m.nsacr, 10, 1)) {
271
env->v7m.control[M_REG_S] &= ~R_V7M_CONTROL_FPCA_MASK;
272
env->v7m.control[M_REG_S] |= val & R_V7M_CONTROL_FPCA_MASK;
273
@@ -XXX,XX +XXX,XX @@ void HELPER(v7m_msr)(CPUARMState *env, uint32_t maskreg, uint32_t val)
274
env->v7m.control[env->v7m.secure] &= ~R_V7M_CONTROL_NPRIV_MASK;
275
env->v7m.control[env->v7m.secure] |= val & R_V7M_CONTROL_NPRIV_MASK;
276
}
277
- if (arm_feature(env, ARM_FEATURE_VFP)) {
278
+ if (cpu_isar_feature(aa32_vfp_simd, env_archcpu(env))) {
279
/*
280
* SFPA is RAZ/WI from NS or if no FPU.
281
* FPCA is RO if NSACR.CP10 == 0, RES0 if the FPU is not present.
282
--
58
--
283
2.20.1
59
2.34.1
284
60
285
61
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Nabih Estefan <nabihestefan@google.com>
2
2
3
Have the calls adjacent as an intermediate step toward
3
Fix the nocm_gmac-test.c file to run on a nuvoton 7xx machine instead
4
actually merging the decodes.
4
of 8xx. Also fix comments referencing this and values expecting 8xx.
5
5
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
Change-Id: Iabd0fba14910c3f1e883c4a9521350f3db9ffab8
7
Signed-Off-By: Nabih Estefan <nabihestefan@google.com>
8
Reviewed-by: Tyrone Ting <kfting@nuvoton.com>
9
Message-id: 20240208194759.2858582-2-nabihestefan@google.com
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
10
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Message-id: 20200224222232.13807-13-richard.henderson@linaro.org
11
[PMM: commit message tweaks]
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
13
---
11
target/arm/translate.c | 83 +++++++++++++++---------------------------
14
tests/qtest/npcm_gmac-test.c | 84 +-----------------------------------
12
1 file changed, 29 insertions(+), 54 deletions(-)
15
tests/qtest/meson.build | 3 +-
16
2 files changed, 4 insertions(+), 83 deletions(-)
13
17
14
diff --git a/target/arm/translate.c b/target/arm/translate.c
18
diff --git a/tests/qtest/npcm_gmac-test.c b/tests/qtest/npcm_gmac-test.c
15
index XXXXXXX..XXXXXXX 100644
19
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/translate.c
20
--- a/tests/qtest/npcm_gmac-test.c
17
+++ b/target/arm/translate.c
21
+++ b/tests/qtest/npcm_gmac-test.c
18
@@ -XXX,XX +XXX,XX @@ static void gen_neon_dup_high16(TCGv_i32 var)
22
@@ -XXX,XX +XXX,XX @@ typedef struct TestData {
19
tcg_temp_free_i32(tmp);
23
const GMACModule *module;
24
} TestData;
25
26
-/* Values extracted from hw/arm/npcm8xx.c */
27
+/* Values extracted from hw/arm/npcm7xx.c */
28
static const GMACModule gmac_module_list[] = {
29
{
30
.irq = 14,
31
@@ -XXX,XX +XXX,XX @@ static const GMACModule gmac_module_list[] = {
32
.irq = 15,
33
.base_addr = 0xf0804000
34
},
35
- {
36
- .irq = 16,
37
- .base_addr = 0xf0806000
38
- },
39
- {
40
- .irq = 17,
41
- .base_addr = 0xf0808000
42
- }
43
};
44
45
/* Returns the index of the GMAC module. */
46
@@ -XXX,XX +XXX,XX @@ static uint32_t gmac_read(QTestState *qts, const GMACModule *mod,
47
return qtest_readl(qts, mod->base_addr + regno);
20
}
48
}
21
49
22
-/*
50
-static uint16_t pcs_read(QTestState *qts, const GMACModule *mod,
23
- * Disassemble a VFP instruction. Returns nonzero if an error occurred
51
- NPCMRegister regno)
24
- * (ie. an undefined instruction).
25
- */
26
-static int disas_vfp_insn(DisasContext *s, uint32_t insn)
27
-{
52
-{
28
- /*
53
- uint32_t write_value = (regno & 0x3ffe00) >> 9;
29
- * If the decodetree decoder handles this insn it will always
54
- qtest_writel(qts, PCS_BASE_ADDRESS + NPCM_PCS_IND_AC_BA, write_value);
30
- * emit code to either execute the insn or generate an appropriate
55
- uint32_t read_offset = regno & 0x1ff;
31
- * exception; so we don't need to ever return non-zero to tell
56
- return qtest_readl(qts, PCS_BASE_ADDRESS + read_offset);
32
- * the calling code to emit an UNDEF exception.
33
- */
34
- if (extract32(insn, 28, 4) == 0xf) {
35
- if (disas_vfp_uncond(s, insn)) {
36
- return 0;
37
- }
38
- } else {
39
- if (disas_vfp(s, insn)) {
40
- return 0;
41
- }
42
- }
43
- /* If the decodetree decoder didn't handle this insn, it must be UNDEF */
44
- return 1;
45
-}
57
-}
46
-
58
-
47
static inline bool use_goto_tb(DisasContext *s, target_ulong dest)
59
/* Check that GMAC registers are reset to default value */
60
static void test_init(gconstpointer test_data)
48
{
61
{
49
#ifndef CONFIG_USER_ONLY
62
const TestData *td = test_data;
50
@@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn)
63
const GMACModule *mod = td->module;
51
ARCH(5);
64
- QTestState *qts = qtest_init("-machine npcm845-evb");
52
65
+ QTestState *qts = qtest_init("-machine npcm750-evb");
53
/* Unconditional instructions. */
66
54
- if (disas_a32_uncond(s, insn)) {
67
#define CHECK_REG32(regno, value) \
55
+ /* TODO: Perhaps merge these into one decodetree output file. */
68
do { \
56
+ if (disas_a32_uncond(s, insn) ||
69
g_assert_cmphex(gmac_read(qts, mod, (regno)), ==, (value)); \
57
+ disas_vfp_uncond(s, insn)) {
70
} while (0)
58
return;
71
59
}
72
-#define CHECK_REG_PCS(regno, value) \
60
/* fall back to legacy decoder */
73
- do { \
61
@@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn)
74
- g_assert_cmphex(pcs_read(qts, mod, (regno)), ==, (value)); \
62
}
75
- } while (0)
63
return;
76
-
64
}
77
CHECK_REG32(NPCM_DMA_BUS_MODE, 0x00020100);
65
- if ((insn & 0x0f000e10) == 0x0e000a00) {
78
CHECK_REG32(NPCM_DMA_XMT_POLL_DEMAND, 0);
66
- /* VFP. */
79
CHECK_REG32(NPCM_DMA_RCV_POLL_DEMAND, 0);
67
- if (disas_vfp_insn(s, insn)) {
80
@@ -XXX,XX +XXX,XX @@ static void test_init(gconstpointer test_data)
68
- goto illegal_op;
81
CHECK_REG32(NPCM_GMAC_PTP_TAR, 0);
69
- }
82
CHECK_REG32(NPCM_GMAC_PTP_TTSR, 0);
70
- return;
83
71
- }
84
- /* TODO Add registers PCS */
72
if ((insn & 0x0e000f00) == 0x0c000100) {
85
- if (mod->base_addr == 0xf0802000) {
73
if (arm_dc_feature(s, ARM_FEATURE_IWMMXT)) {
86
- CHECK_REG_PCS(NPCM_PCS_SR_CTL_ID1, 0x699e);
74
/* iWMMXt register transfer. */
87
- CHECK_REG_PCS(NPCM_PCS_SR_CTL_ID2, 0);
75
@@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn)
88
- CHECK_REG_PCS(NPCM_PCS_SR_CTL_STS, 0x8000);
76
arm_skip_unless(s, cond);
89
-
77
}
90
- CHECK_REG_PCS(NPCM_PCS_SR_MII_CTRL, 0x1140);
78
91
- CHECK_REG_PCS(NPCM_PCS_SR_MII_STS, 0x0109);
79
- if (disas_a32(s, insn)) {
92
- CHECK_REG_PCS(NPCM_PCS_SR_MII_DEV_ID1, 0x699e);
80
+ /* TODO: Perhaps merge these into one decodetree output file. */
93
- CHECK_REG_PCS(NPCM_PCS_SR_MII_DEV_ID2, 0x0ced0);
81
+ if (disas_a32(s, insn) ||
94
- CHECK_REG_PCS(NPCM_PCS_SR_MII_AN_ADV, 0x0020);
82
+ disas_vfp(s, insn)) {
95
- CHECK_REG_PCS(NPCM_PCS_SR_MII_LP_BABL, 0);
83
return;
96
- CHECK_REG_PCS(NPCM_PCS_SR_MII_AN_EXPN, 0);
84
}
97
- CHECK_REG_PCS(NPCM_PCS_SR_MII_EXT_STS, 0xc000);
85
/* fall back to legacy decoder */
98
-
86
@@ -XXX,XX +XXX,XX @@ static void disas_arm_insn(DisasContext *s, unsigned int insn)
99
- CHECK_REG_PCS(NPCM_PCS_SR_TIM_SYNC_ABL, 0x0003);
87
case 0xd:
100
- CHECK_REG_PCS(NPCM_PCS_SR_TIM_SYNC_TX_MAX_DLY_LWR, 0x0038);
88
case 0xe:
101
- CHECK_REG_PCS(NPCM_PCS_SR_TIM_SYNC_TX_MAX_DLY_UPR, 0);
89
if (((insn >> 8) & 0xe) == 10) {
102
- CHECK_REG_PCS(NPCM_PCS_SR_TIM_SYNC_TX_MIN_DLY_LWR, 0x0038);
90
- /* VFP. */
103
- CHECK_REG_PCS(NPCM_PCS_SR_TIM_SYNC_TX_MIN_DLY_UPR, 0);
91
- if (disas_vfp_insn(s, insn)) {
104
- CHECK_REG_PCS(NPCM_PCS_SR_TIM_SYNC_RX_MAX_DLY_LWR, 0x0058);
92
- goto illegal_op;
105
- CHECK_REG_PCS(NPCM_PCS_SR_TIM_SYNC_RX_MAX_DLY_UPR, 0);
93
- }
106
- CHECK_REG_PCS(NPCM_PCS_SR_TIM_SYNC_RX_MIN_DLY_LWR, 0x0048);
94
- } else if (disas_coproc_insn(s, insn)) {
107
- CHECK_REG_PCS(NPCM_PCS_SR_TIM_SYNC_RX_MIN_DLY_UPR, 0);
95
+ /* VFP, but failed disas_vfp. */
108
-
96
+ goto illegal_op;
109
- CHECK_REG_PCS(NPCM_PCS_VR_MII_MMD_DIG_CTRL1, 0x2400);
97
+ }
110
- CHECK_REG_PCS(NPCM_PCS_VR_MII_AN_CTRL, 0);
98
+ if (disas_coproc_insn(s, insn)) {
111
- CHECK_REG_PCS(NPCM_PCS_VR_MII_AN_INTR_STS, 0x000a);
99
/* Coprocessor. */
112
- CHECK_REG_PCS(NPCM_PCS_VR_MII_TC, 0);
100
goto illegal_op;
113
- CHECK_REG_PCS(NPCM_PCS_VR_MII_DBG_CTRL, 0);
101
}
114
- CHECK_REG_PCS(NPCM_PCS_VR_MII_EEE_MCTRL0, 0x899c);
102
@@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn)
115
- CHECK_REG_PCS(NPCM_PCS_VR_MII_EEE_TXTIMER, 0);
103
ARCH(6T2);
116
- CHECK_REG_PCS(NPCM_PCS_VR_MII_EEE_RXTIMER, 0);
104
}
117
- CHECK_REG_PCS(NPCM_PCS_VR_MII_LINK_TIMER_CTRL, 0);
105
118
- CHECK_REG_PCS(NPCM_PCS_VR_MII_EEE_MCTRL1, 0);
106
- if (disas_t32(s, insn)) {
119
- CHECK_REG_PCS(NPCM_PCS_VR_MII_DIG_STS, 0x0010);
107
+ /*
120
- CHECK_REG_PCS(NPCM_PCS_VR_MII_ICG_ERRCNT1, 0);
108
+ * TODO: Perhaps merge these into one decodetree output file.
121
- CHECK_REG_PCS(NPCM_PCS_VR_MII_MISC_STS, 0);
109
+ * Note disas_vfp is written for a32 with cond field in the
122
- CHECK_REG_PCS(NPCM_PCS_VR_MII_RX_LSTS, 0);
110
+ * top nibble. The t32 encoding requires 0xe in the top nibble.
123
- CHECK_REG_PCS(NPCM_PCS_VR_MII_MP_TX_BSTCTRL0, 0x00a);
111
+ */
124
- CHECK_REG_PCS(NPCM_PCS_VR_MII_MP_TX_LVLCTRL0, 0x007f);
112
+ if (disas_t32(s, insn) ||
125
- CHECK_REG_PCS(NPCM_PCS_VR_MII_MP_TX_GENCTRL0, 0x0001);
113
+ disas_vfp_uncond(s, insn) ||
126
- CHECK_REG_PCS(NPCM_PCS_VR_MII_MP_TX_GENCTRL1, 0);
114
+ ((insn >> 28) == 0xe && disas_vfp(s, insn))) {
127
- CHECK_REG_PCS(NPCM_PCS_VR_MII_MP_TX_STS, 0);
115
return;
128
- CHECK_REG_PCS(NPCM_PCS_VR_MII_MP_RX_GENCTRL0, 0x0100);
116
}
129
- CHECK_REG_PCS(NPCM_PCS_VR_MII_MP_RX_GENCTRL1, 0x1100);
117
/* fall back to legacy decoder */
130
- CHECK_REG_PCS(NPCM_PCS_VR_MII_MP_RX_LOS_CTRL0, 0x000e);
118
@@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn)
131
- CHECK_REG_PCS(NPCM_PCS_VR_MII_MP_MPLL_CTRL0, 0x0100);
119
goto illegal_op; /* op0 = 0b11 : unallocated */
132
- CHECK_REG_PCS(NPCM_PCS_VR_MII_MP_MPLL_CTRL1, 0x0032);
120
}
133
- CHECK_REG_PCS(NPCM_PCS_VR_MII_MP_MPLL_STS, 0x0001);
121
134
- CHECK_REG_PCS(NPCM_PCS_VR_MII_MP_MISC_CTRL2, 0);
122
- if (disas_vfp_insn(s, insn)) {
135
- CHECK_REG_PCS(NPCM_PCS_VR_MII_MP_LVL_CTRL, 0x0019);
123
- if (((insn >> 8) & 0xe) == 10 &&
136
- CHECK_REG_PCS(NPCM_PCS_VR_MII_MP_MISC_CTRL0, 0);
124
- dc_isar_feature(aa32_fpsp_v2, s)) {
137
- CHECK_REG_PCS(NPCM_PCS_VR_MII_MP_MISC_CTRL1, 0);
125
- /* FP, and the CPU supports it */
138
- CHECK_REG_PCS(NPCM_PCS_VR_MII_DIG_CTRL2, 0);
126
- goto illegal_op;
139
- CHECK_REG_PCS(NPCM_PCS_VR_MII_DIG_ERRCNT_SEL, 0);
127
- } else {
140
- }
128
- /* All other insns: NOCP */
141
-
129
- gen_exception_insn(s, s->pc_curr, EXCP_NOCP,
142
qtest_quit(qts);
130
- syn_uncategorized(),
143
}
131
- default_exception_el(s));
144
132
- }
145
diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
133
+ if (((insn >> 8) & 0xe) == 10 &&
146
index XXXXXXX..XXXXXXX 100644
134
+ dc_isar_feature(aa32_fpsp_v2, s)) {
147
--- a/tests/qtest/meson.build
135
+ /* FP, and the CPU supports it */
148
+++ b/tests/qtest/meson.build
136
+ goto illegal_op;
149
@@ -XXX,XX +XXX,XX @@ qtests_npcm7xx = \
137
+ } else {
150
'npcm7xx_sdhci-test',
138
+ /* All other insns: NOCP */
151
'npcm7xx_smbus-test',
139
+ gen_exception_insn(s, s->pc_curr, EXCP_NOCP,
152
'npcm7xx_timer-test',
140
+ syn_uncategorized(),
153
- 'npcm7xx_watchdog_timer-test'] + \
141
+ default_exception_el(s));
154
+ 'npcm7xx_watchdog_timer-test',
142
}
155
+ 'npcm_gmac-test'] + \
143
break;
156
(slirp.found() ? ['npcm7xx_emc-test'] : [])
144
}
157
qtests_aspeed = \
145
@@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn)
158
['aspeed_hace-test',
146
goto illegal_op;
147
}
148
} else if (((insn >> 8) & 0xe) == 10) {
149
- if (disas_vfp_insn(s, insn)) {
150
- goto illegal_op;
151
- }
152
+ /* VFP, but failed disas_vfp. */
153
+ goto illegal_op;
154
} else {
155
if (insn & (1 << 28))
156
goto illegal_op;
157
--
159
--
158
2.20.1
160
2.34.1
159
160
diff view generated by jsdifflib
1
From: Thomas Huth <thuth@redhat.com>
1
From: Luc Michel <luc.michel@amd.com>
2
2
3
There is a kernel and initrd available on github which we can use
3
An access fault is raised when the Access Flag is not set in the
4
for testing this machine.
4
looked-up PTE and the AFFD field is not set in the corresponding context
5
descriptor. This was already implemented for stage 2. Implement it for
6
stage 1 as well.
5
7
6
Signed-off-by: Thomas Huth <thuth@redhat.com>
8
Signed-off-by: Luc Michel <luc.michel@amd.com>
7
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
9
Reviewed-by: Mostafa Saleh <smostafa@google.com>
8
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
10
Reviewed-by: Eric Auger <eric.auger@redhat.com>
9
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
11
Tested-by: Mostafa Saleh <smostafa@google.com>
10
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
12
Message-id: 20240213082211.3330400-1-luc.michel@amd.com
11
Message-id: 20200225172501.29609-3-philmd@redhat.com
13
[PMM: tweaked comment text]
12
Message-Id: <20200131170233.14584-1-thuth@redhat.com>
13
[PMD: Renamed test method, moved description from class to method]
14
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
---
15
---
17
MAINTAINERS | 1 +
16
hw/arm/smmuv3-internal.h | 1 +
18
tests/acceptance/machine_arm_integratorcp.py | 43 ++++++++++++++++++++
17
include/hw/arm/smmu-common.h | 1 +
19
2 files changed, 44 insertions(+)
18
hw/arm/smmu-common.c | 11 +++++++++++
20
create mode 100644 tests/acceptance/machine_arm_integratorcp.py
19
hw/arm/smmuv3.c | 1 +
20
4 files changed, 14 insertions(+)
21
21
22
diff --git a/MAINTAINERS b/MAINTAINERS
22
diff --git a/hw/arm/smmuv3-internal.h b/hw/arm/smmuv3-internal.h
23
index XXXXXXX..XXXXXXX 100644
23
index XXXXXXX..XXXXXXX 100644
24
--- a/MAINTAINERS
24
--- a/hw/arm/smmuv3-internal.h
25
+++ b/MAINTAINERS
25
+++ b/hw/arm/smmuv3-internal.h
26
@@ -XXX,XX +XXX,XX @@ S: Maintained
26
@@ -XXX,XX +XXX,XX @@ static inline int pa_range(STE *ste)
27
F: hw/arm/integratorcp.c
27
#define CD_EPD(x, sel) extract32((x)->word[0], (16 * (sel)) + 14, 1)
28
F: hw/misc/arm_integrator_debug.c
28
#define CD_ENDI(x) extract32((x)->word[0], 15, 1)
29
F: include/hw/misc/arm_integrator_debug.h
29
#define CD_IPS(x) extract32((x)->word[1], 0 , 3)
30
+F: tests/acceptance/machine_arm_integratorcp.py
30
+#define CD_AFFD(x) extract32((x)->word[1], 3 , 1)
31
31
#define CD_TBI(x) extract32((x)->word[1], 6 , 2)
32
MCIMX6UL EVK / i.MX6ul
32
#define CD_HD(x) extract32((x)->word[1], 10 , 1)
33
M: Peter Maydell <peter.maydell@linaro.org>
33
#define CD_HA(x) extract32((x)->word[1], 11 , 1)
34
diff --git a/tests/acceptance/machine_arm_integratorcp.py b/tests/acceptance/machine_arm_integratorcp.py
34
diff --git a/include/hw/arm/smmu-common.h b/include/hw/arm/smmu-common.h
35
new file mode 100644
35
index XXXXXXX..XXXXXXX 100644
36
index XXXXXXX..XXXXXXX
36
--- a/include/hw/arm/smmu-common.h
37
--- /dev/null
37
+++ b/include/hw/arm/smmu-common.h
38
+++ b/tests/acceptance/machine_arm_integratorcp.py
38
@@ -XXX,XX +XXX,XX @@ typedef struct SMMUTransCfg {
39
@@ -XXX,XX +XXX,XX @@
39
bool disabled; /* smmu is disabled */
40
+# Functional test that boots a Linux kernel and checks the console
40
bool bypassed; /* translation is bypassed */
41
+#
41
bool aborted; /* translation is aborted */
42
+# Copyright (c) 2020 Red Hat, Inc.
42
+ bool affd; /* AF fault disable */
43
+#
43
uint32_t iotlb_hits; /* counts IOTLB hits */
44
+# Author:
44
uint32_t iotlb_misses; /* counts IOTLB misses*/
45
+# Thomas Huth <thuth@redhat.com>
45
/* Used by stage-1 only. */
46
+#
46
diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c
47
+# This work is licensed under the terms of the GNU GPL, version 2 or
47
index XXXXXXX..XXXXXXX 100644
48
+# later. See the COPYING file in the top-level directory.
48
--- a/hw/arm/smmu-common.c
49
+++ b/hw/arm/smmu-common.c
50
@@ -XXX,XX +XXX,XX @@ static int smmu_ptw_64_s1(SMMUTransCfg *cfg,
51
pte_addr, pte, iova, gpa,
52
block_size >> 20);
53
}
49
+
54
+
50
+import os
55
+ /*
56
+ * QEMU does not currently implement HTTU, so if AFFD and PTE.AF
57
+ * are 0 we take an Access flag fault. (5.4. Context Descriptor)
58
+ * An Access flag fault takes priority over a Permission fault.
59
+ */
60
+ if (!PTE_AF(pte) && !cfg->affd) {
61
+ info->type = SMMU_PTW_ERR_ACCESS;
62
+ goto error;
63
+ }
51
+
64
+
52
+from avocado import skipUnless
65
ap = PTE_AP(pte);
53
+from avocado_qemu import Test
66
if (is_permission_fault(ap, perm)) {
54
+from avocado_qemu import wait_for_console_pattern
67
info->type = SMMU_PTW_ERR_PERMISSION;
55
+
68
diff --git a/hw/arm/smmuv3.c b/hw/arm/smmuv3.c
56
+class IntegratorMachine(Test):
69
index XXXXXXX..XXXXXXX 100644
57
+
70
--- a/hw/arm/smmuv3.c
58
+ timeout = 90
71
+++ b/hw/arm/smmuv3.c
59
+
72
@@ -XXX,XX +XXX,XX @@ static int decode_cd(SMMUTransCfg *cfg, CD *cd, SMMUEventInfo *event)
60
+ @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
73
cfg->oas = MIN(oas2bits(SMMU_IDR5_OAS), cfg->oas);
61
+ def test_integratorcp_console(self):
74
cfg->tbi = CD_TBI(cd);
62
+ """
75
cfg->asid = CD_ASID(cd);
63
+ Boots the Linux kernel and checks that the console is operational
76
+ cfg->affd = CD_AFFD(cd);
64
+ :avocado: tags=arch:arm
77
65
+ :avocado: tags=machine:integratorcp
78
trace_smmuv3_decode_cd(cfg->oas);
66
+ """
79
67
+ kernel_url = ('https://github.com/zayac/qemu-arm/raw/master/'
68
+ 'arm-test/kernel/zImage.integrator')
69
+ kernel_hash = '0d7adba893c503267c946a3cbdc63b4b54f25468'
70
+ kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
71
+
72
+ initrd_url = ('https://github.com/zayac/qemu-arm/raw/master/'
73
+ 'arm-test/kernel/arm_root.img')
74
+ initrd_hash = 'b51e4154285bf784e017a37586428332d8c7bd8b'
75
+ initrd_path = self.fetch_asset(initrd_url, asset_hash=initrd_hash)
76
+
77
+ self.vm.set_console()
78
+ self.vm.add_args('-kernel', kernel_path,
79
+ '-initrd', initrd_path,
80
+ '-append', 'printk.time=0 console=ttyAMA0')
81
+ self.vm.launch()
82
+ wait_for_console_pattern(self, 'Log in as root')
83
--
80
--
84
2.20.1
81
2.34.1
85
86
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
We cannot easily create "any" functions for these, because the
3
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
4
ID_AA64PFR0 fields for FP and SIMD signal "enabled" with zero.
5
Which means that an aarch32-only cpu will return incorrect results
6
when testing the aarch64 registers.
7
8
To use these, we must either have context or additionally test
9
vs ARM_FEATURE_AARCH64.
10
11
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
12
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
4
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
13
Message-id: 20200224222232.13807-5-richard.henderson@linaro.org
5
Message-id: 20240213155214.13619-2-philmd@linaro.org
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
---
7
---
16
target/arm/cpu.h | 11 +++++++++++
8
hw/arm/stellaris.c | 6 ++++--
17
target/arm/cpu.c | 9 ++++++---
9
1 file changed, 4 insertions(+), 2 deletions(-)
18
target/arm/machine.c | 5 +++--
19
3 files changed, 20 insertions(+), 5 deletions(-)
20
10
21
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
11
diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c
22
index XXXXXXX..XXXXXXX 100644
12
index XXXXXXX..XXXXXXX 100644
23
--- a/target/arm/cpu.h
13
--- a/hw/arm/stellaris.c
24
+++ b/target/arm/cpu.h
14
+++ b/hw/arm/stellaris.c
25
@@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa32_fpdp_v3(const ARMISARegisters *id)
15
@@ -XXX,XX +XXX,XX @@ static void stellaris_adc_trigger(void *opaque, int irq, int level)
26
return FIELD_EX32(id->mvfr0, MVFR0, FPDP) >= 2;
16
}
27
}
17
}
28
18
29
+static inline bool isar_feature_aa32_vfp(const ARMISARegisters *id)
19
-static void stellaris_adc_reset(StellarisADCState *s)
30
+{
20
+static void stellaris_adc_reset_hold(Object *obj)
31
+ return isar_feature_aa32_fpsp_v2(id) || isar_feature_aa32_fpdp_v2(id);
21
{
32
+}
22
+ StellarisADCState *s = STELLARIS_ADC(obj);
33
+
23
int n;
34
/*
24
35
* We always set the FP and SIMD FP16 fields to indicate identical
25
for (n = 0; n < 4; n++) {
36
* levels of support (assuming SIMD is implemented at all), so
26
@@ -XXX,XX +XXX,XX @@ static void stellaris_adc_init(Object *obj)
37
@@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_dcpodp(const ARMISARegisters *id)
27
memory_region_init_io(&s->iomem, obj, &stellaris_adc_ops, s,
38
return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, DPB) >= 2;
28
"adc", 0x1000);
29
sysbus_init_mmio(sbd, &s->iomem);
30
- stellaris_adc_reset(s);
31
qdev_init_gpio_in(dev, stellaris_adc_trigger, 1);
39
}
32
}
40
33
41
+static inline bool isar_feature_aa64_fp_simd(const ARMISARegisters *id)
34
@@ -XXX,XX +XXX,XX @@ static const TypeInfo stellaris_i2c_info = {
42
+{
35
static void stellaris_adc_class_init(ObjectClass *klass, void *data)
43
+ /* We always set the AdvSIMD and FP fields identically. */
44
+ return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, FP) != 0xf;
45
+}
46
+
47
static inline bool isar_feature_aa64_fp16(const ARMISARegisters *id)
48
{
36
{
49
/* We always set the AdvSIMD and FP fields identically wrt FP16. */
37
DeviceClass *dc = DEVICE_CLASS(klass);
50
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
38
+ ResettableClass *rc = RESETTABLE_CLASS(klass);
51
index XXXXXXX..XXXXXXX 100644
39
52
--- a/target/arm/cpu.c
40
+ rc->phases.hold = stellaris_adc_reset_hold;
53
+++ b/target/arm/cpu.c
41
dc->vmsd = &vmstate_stellaris_adc;
54
@@ -XXX,XX +XXX,XX @@ void arm_cpu_post_init(Object *obj)
55
* KVM does not currently allow us to lie to the guest about its
56
* ID/feature registers, so the guest always sees what the host has.
57
*/
58
- if (arm_feature(&cpu->env, ARM_FEATURE_VFP)) {
59
+ if (arm_feature(&cpu->env, ARM_FEATURE_AARCH64)
60
+ ? cpu_isar_feature(aa64_fp_simd, cpu)
61
+ : cpu_isar_feature(aa32_vfp, cpu)) {
62
cpu->has_vfp = true;
63
if (!kvm_enabled()) {
64
qdev_property_add_static(DEVICE(obj), &arm_cpu_has_vfp_property);
65
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)
66
* We rely on no XScale CPU having VFP so we can use the same bits in the
67
* TB flags field for VECSTRIDE and XSCALE_CPAR.
68
*/
69
- assert(!(arm_feature(env, ARM_FEATURE_VFP) &&
70
- arm_feature(env, ARM_FEATURE_XSCALE)));
71
+ assert(arm_feature(&cpu->env, ARM_FEATURE_AARCH64) ||
72
+ !cpu_isar_feature(aa32_vfp_simd, cpu) ||
73
+ !arm_feature(env, ARM_FEATURE_XSCALE));
74
75
if (arm_feature(env, ARM_FEATURE_V7) &&
76
!arm_feature(env, ARM_FEATURE_M) &&
77
diff --git a/target/arm/machine.c b/target/arm/machine.c
78
index XXXXXXX..XXXXXXX 100644
79
--- a/target/arm/machine.c
80
+++ b/target/arm/machine.c
81
@@ -XXX,XX +XXX,XX @@
82
static bool vfp_needed(void *opaque)
83
{
84
ARMCPU *cpu = opaque;
85
- CPUARMState *env = &cpu->env;
86
87
- return arm_feature(env, ARM_FEATURE_VFP);
88
+ return (arm_feature(&cpu->env, ARM_FEATURE_AARCH64)
89
+ ? cpu_isar_feature(aa64_fp_simd, cpu)
90
+ : cpu_isar_feature(aa32_vfp_simd, cpu));
91
}
42
}
92
43
93
static int get_fpscr(QEMUFile *f, void *opaque, size_t size,
94
--
44
--
95
2.20.1
45
2.34.1
96
46
97
47
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
Passing the raw op field from the manual is less instructive
3
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
4
than it might be. Do the full decode and use the existing
4
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
5
helpers to perform the expansion.
5
Message-id: 20240213155214.13619-3-philmd@linaro.org
6
7
Since these are v8 insns, VECLEN+VECSTRIDE are already RES0.
8
9
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
11
Message-id: 20200224222232.13807-18-richard.henderson@linaro.org
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
8
---
14
target/arm/translate-vfp.inc.c | 109 +++++++++++----------------------
9
hw/arm/stellaris.c | 26 ++++++++++++++++++++++----
15
target/arm/vfp-uncond.decode | 12 ++--
10
1 file changed, 22 insertions(+), 4 deletions(-)
16
2 files changed, 44 insertions(+), 77 deletions(-)
17
11
18
diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c
12
diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c
19
index XXXXXXX..XXXXXXX 100644
13
index XXXXXXX..XXXXXXX 100644
20
--- a/target/arm/translate-vfp.inc.c
14
--- a/hw/arm/stellaris.c
21
+++ b/target/arm/translate-vfp.inc.c
15
+++ b/hw/arm/stellaris.c
22
@@ -XXX,XX +XXX,XX @@ static bool trans_VSEL(DisasContext *s, arg_VSEL *a)
16
@@ -XXX,XX +XXX,XX @@ static void stellaris_sys_instance_init(Object *obj)
23
return true;
17
s->sysclk = qdev_init_clock_out(DEVICE(s), "SYSCLK");
24
}
18
}
25
19
26
-static bool trans_VMINMAXNM(DisasContext *s, arg_VMINMAXNM *a)
20
-/* I2C controller. */
27
-{
21
+/*
28
- uint32_t rd, rn, rm;
22
+ * I2C controller.
29
- bool dp = a->dp;
23
+ * ??? For now we only implement the master interface.
30
- bool vmin = a->op;
24
+ */
31
- TCGv_ptr fpst;
25
32
-
26
#define TYPE_STELLARIS_I2C "stellaris-i2c"
33
- if (!dc_isar_feature(aa32_vminmaxnm, s)) {
27
OBJECT_DECLARE_SIMPLE_TYPE(stellaris_i2c_state, STELLARIS_I2C)
34
- return false;
28
@@ -XXX,XX +XXX,XX @@ static void stellaris_i2c_write(void *opaque, hwaddr offset,
35
- }
29
stellaris_i2c_update(s);
36
-
37
- if (dp && !dc_isar_feature(aa32_fpdp_v2, s)) {
38
- return false;
39
- }
40
-
41
- /* UNDEF accesses to D16-D31 if they don't exist */
42
- if (dp && !dc_isar_feature(aa32_simd_r32, s) &&
43
- ((a->vm | a->vn | a->vd) & 0x10)) {
44
- return false;
45
- }
46
-
47
- rd = a->vd;
48
- rn = a->vn;
49
- rm = a->vm;
50
-
51
- if (!vfp_access_check(s)) {
52
- return true;
53
- }
54
-
55
- fpst = get_fpstatus_ptr(0);
56
-
57
- if (dp) {
58
- TCGv_i64 frn, frm, dest;
59
-
60
- frn = tcg_temp_new_i64();
61
- frm = tcg_temp_new_i64();
62
- dest = tcg_temp_new_i64();
63
-
64
- neon_load_reg64(frn, rn);
65
- neon_load_reg64(frm, rm);
66
- if (vmin) {
67
- gen_helper_vfp_minnumd(dest, frn, frm, fpst);
68
- } else {
69
- gen_helper_vfp_maxnumd(dest, frn, frm, fpst);
70
- }
71
- neon_store_reg64(dest, rd);
72
- tcg_temp_free_i64(frn);
73
- tcg_temp_free_i64(frm);
74
- tcg_temp_free_i64(dest);
75
- } else {
76
- TCGv_i32 frn, frm, dest;
77
-
78
- frn = tcg_temp_new_i32();
79
- frm = tcg_temp_new_i32();
80
- dest = tcg_temp_new_i32();
81
-
82
- neon_load_reg32(frn, rn);
83
- neon_load_reg32(frm, rm);
84
- if (vmin) {
85
- gen_helper_vfp_minnums(dest, frn, frm, fpst);
86
- } else {
87
- gen_helper_vfp_maxnums(dest, frn, frm, fpst);
88
- }
89
- neon_store_reg32(dest, rd);
90
- tcg_temp_free_i32(frn);
91
- tcg_temp_free_i32(frm);
92
- tcg_temp_free_i32(dest);
93
- }
94
-
95
- tcg_temp_free_ptr(fpst);
96
- return true;
97
-}
98
-
99
/*
100
* Table for converting the most common AArch32 encoding of
101
* rounding mode to arm_fprounding order (which matches the
102
@@ -XXX,XX +XXX,XX @@ static bool trans_VDIV_dp(DisasContext *s, arg_VDIV_dp *a)
103
return do_vfp_3op_dp(s, gen_helper_vfp_divd, a->vd, a->vn, a->vm, false);
104
}
30
}
105
31
106
+static bool trans_VMINNM_sp(DisasContext *s, arg_VMINNM_sp *a)
32
-static void stellaris_i2c_reset(stellaris_i2c_state *s)
107
+{
33
+static void stellaris_i2c_reset_enter(Object *obj, ResetType type)
108
+ if (!dc_isar_feature(aa32_vminmaxnm, s)) {
34
{
109
+ return false;
35
+ stellaris_i2c_state *s = STELLARIS_I2C(obj);
110
+ }
36
+
111
+ return do_vfp_3op_sp(s, gen_helper_vfp_minnums,
37
if (s->mcs & STELLARIS_I2C_MCS_BUSBSY)
112
+ a->vd, a->vn, a->vm, false);
38
i2c_end_transfer(s->bus);
113
+}
39
+}
114
+
40
+
115
+static bool trans_VMAXNM_sp(DisasContext *s, arg_VMAXNM_sp *a)
41
+static void stellaris_i2c_reset_hold(Object *obj)
116
+{
42
+{
117
+ if (!dc_isar_feature(aa32_vminmaxnm, s)) {
43
+ stellaris_i2c_state *s = STELLARIS_I2C(obj);
118
+ return false;
44
119
+ }
45
s->msa = 0;
120
+ return do_vfp_3op_sp(s, gen_helper_vfp_maxnums,
46
s->mcs = 0;
121
+ a->vd, a->vn, a->vm, false);
47
@@ -XXX,XX +XXX,XX @@ static void stellaris_i2c_reset(stellaris_i2c_state *s)
48
s->mimr = 0;
49
s->mris = 0;
50
s->mcr = 0;
122
+}
51
+}
123
+
52
+
124
+static bool trans_VMINNM_dp(DisasContext *s, arg_VMINNM_dp *a)
53
+static void stellaris_i2c_reset_exit(Object *obj)
125
+{
54
+{
126
+ if (!dc_isar_feature(aa32_vminmaxnm, s)) {
55
+ stellaris_i2c_state *s = STELLARIS_I2C(obj);
127
+ return false;
128
+ }
129
+ return do_vfp_3op_dp(s, gen_helper_vfp_minnumd,
130
+ a->vd, a->vn, a->vm, false);
131
+}
132
+
56
+
133
+static bool trans_VMAXNM_dp(DisasContext *s, arg_VMAXNM_dp *a)
57
stellaris_i2c_update(s);
134
+{
58
}
135
+ if (!dc_isar_feature(aa32_vminmaxnm, s)) {
59
136
+ return false;
60
@@ -XXX,XX +XXX,XX @@ static void stellaris_i2c_init(Object *obj)
137
+ }
61
memory_region_init_io(&s->iomem, obj, &stellaris_i2c_ops, s,
138
+ return do_vfp_3op_dp(s, gen_helper_vfp_maxnumd,
62
"i2c", 0x1000);
139
+ a->vd, a->vn, a->vm, false);
63
sysbus_init_mmio(sbd, &s->iomem);
140
+}
64
- /* ??? For now we only implement the master interface. */
141
+
65
- stellaris_i2c_reset(s);
142
static bool do_vfm_sp(DisasContext *s, arg_VFMA_sp *a, bool neg_n, bool neg_d)
66
}
67
68
/* Analogue to Digital Converter. This is only partially implemented,
69
@@ -XXX,XX +XXX,XX @@ type_init(stellaris_machine_init)
70
static void stellaris_i2c_class_init(ObjectClass *klass, void *data)
143
{
71
{
144
/*
72
DeviceClass *dc = DEVICE_CLASS(klass);
145
diff --git a/target/arm/vfp-uncond.decode b/target/arm/vfp-uncond.decode
73
+ ResettableClass *rc = RESETTABLE_CLASS(klass);
146
index XXXXXXX..XXXXXXX 100644
74
147
--- a/target/arm/vfp-uncond.decode
75
+ rc->phases.enter = stellaris_i2c_reset_enter;
148
+++ b/target/arm/vfp-uncond.decode
76
+ rc->phases.hold = stellaris_i2c_reset_hold;
149
@@ -XXX,XX +XXX,XX @@
77
+ rc->phases.exit = stellaris_i2c_reset_exit;
150
%vd_dp 22:1 12:4
78
dc->vmsd = &vmstate_stellaris_i2c;
151
%vd_sp 12:4 22:1
79
}
152
80
153
+@vfp_dnm_s ................................ vm=%vm_sp vn=%vn_sp vd=%vd_sp
154
+@vfp_dnm_d ................................ vm=%vm_dp vn=%vn_dp vd=%vd_dp
155
+
156
VSEL 1111 1110 0. cc:2 .... .... 1010 .0.0 .... \
157
vm=%vm_sp vn=%vn_sp vd=%vd_sp dp=0
158
VSEL 1111 1110 0. cc:2 .... .... 1011 .0.0 .... \
159
vm=%vm_dp vn=%vn_dp vd=%vd_dp dp=1
160
161
-VMINMAXNM 1111 1110 1.00 .... .... 1010 . op:1 .0 .... \
162
- vm=%vm_sp vn=%vn_sp vd=%vd_sp dp=0
163
-VMINMAXNM 1111 1110 1.00 .... .... 1011 . op:1 .0 .... \
164
- vm=%vm_dp vn=%vn_dp vd=%vd_dp dp=1
165
+VMAXNM_sp 1111 1110 1.00 .... .... 1010 .0.0 .... @vfp_dnm_s
166
+VMINNM_sp 1111 1110 1.00 .... .... 1010 .1.0 .... @vfp_dnm_s
167
+
168
+VMAXNM_dp 1111 1110 1.00 .... .... 1011 .0.0 .... @vfp_dnm_d
169
+VMINNM_dp 1111 1110 1.00 .... .... 1011 .1.0 .... @vfp_dnm_d
170
171
VRINT 1111 1110 1.11 10 rm:2 .... 1010 01.0 .... \
172
vm=%vm_sp vd=%vd_sp dp=0
173
--
81
--
174
2.20.1
82
2.34.1
175
83
176
84
diff view generated by jsdifflib
1
From: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
All A9 CPUs have a GIC with 5 bits of priority.
3
QDev objects created with qdev_new() need to manually add
4
their parent relationship with object_property_add_child().
4
5
5
Signed-off-by: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com>
6
This commit plug the devices which aren't part of the SoC;
7
they will be plugged into a SoC container in the next one.
8
9
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
10
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Message-id: 1582537164-764-3-git-send-email-sai.pavan.boddu@xilinx.com
11
Message-id: 20240213155214.13619-4-philmd@linaro.org
8
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
9
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
13
---
12
hw/cpu/a9mpcore.c | 4 ++++
14
hw/arm/stellaris.c | 4 ++++
13
1 file changed, 4 insertions(+)
15
1 file changed, 4 insertions(+)
14
16
15
diff --git a/hw/cpu/a9mpcore.c b/hw/cpu/a9mpcore.c
17
diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c
16
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
17
--- a/hw/cpu/a9mpcore.c
19
--- a/hw/arm/stellaris.c
18
+++ b/hw/cpu/a9mpcore.c
20
+++ b/hw/arm/stellaris.c
19
@@ -XXX,XX +XXX,XX @@
21
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
20
#include "hw/qdev-properties.h"
22
&error_fatal);
21
#include "hw/core/cpu.h"
23
22
24
ssddev = qdev_new("ssd0323");
23
+#define A9_GIC_NUM_PRIORITY_BITS 5
25
+ object_property_add_child(OBJECT(ms), "oled", OBJECT(ssddev));
24
+
26
qdev_prop_set_uint8(ssddev, "cs", 1);
25
static void a9mp_priv_set_irq(void *opaque, int irq, int level)
27
qdev_realize_and_unref(ssddev, bus, &error_fatal);
26
{
28
27
A9MPPrivState *s = (A9MPPrivState *)opaque;
29
gpio_d_splitter = qdev_new(TYPE_SPLIT_IRQ);
28
@@ -XXX,XX +XXX,XX @@ static void a9mp_priv_realize(DeviceState *dev, Error **errp)
30
+ object_property_add_child(OBJECT(ms), "splitter",
29
gicdev = DEVICE(&s->gic);
31
+ OBJECT(gpio_d_splitter));
30
qdev_prop_set_uint32(gicdev, "num-cpu", s->num_cpu);
32
qdev_prop_set_uint32(gpio_d_splitter, "num-lines", 2);
31
qdev_prop_set_uint32(gicdev, "num-irq", s->num_irq);
33
qdev_realize_and_unref(gpio_d_splitter, NULL, &error_fatal);
32
+ qdev_prop_set_uint32(gicdev, "num-priority-bits",
34
qdev_connect_gpio_out(
33
+ A9_GIC_NUM_PRIORITY_BITS);
35
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
34
36
DeviceState *gpad;
35
/* Make the GIC's TZ support match the CPUs. We assume that
37
36
* either all the CPUs have TZ, or none do.
38
gpad = qdev_new(TYPE_STELLARIS_GAMEPAD);
39
+ object_property_add_child(OBJECT(ms), "gamepad", OBJECT(gpad));
40
for (i = 0; i < ARRAY_SIZE(gpad_keycode); i++) {
41
qlist_append_int(gpad_keycode_list, gpad_keycode[i]);
42
}
37
--
43
--
38
2.20.1
44
2.34.1
39
45
40
46
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
Use isar feature tests instead of feature bit tests.
3
QDev objects created with qdev_new() need to manually add
4
their parent relationship with object_property_add_child().
4
5
5
Although none of QEMUs current cpus have VFPv3 without D32,
6
Since we don't model the SoC, just use a QOM container.
6
replace the large comment explaining why with one line that
7
sets ARM_HWCAP_ARM_VFPv3D16 under the correct conditions.
8
Mirror the test sequence used in the linux kernel.
9
7
10
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
11
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
12
Message-id: 20200224222232.13807-14-richard.henderson@linaro.org
10
Message-id: 20240213155214.13619-5-philmd@linaro.org
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
---
12
---
15
linux-user/elfload.c | 23 +++++++++++++----------
13
hw/arm/stellaris.c | 11 ++++++++++-
16
1 file changed, 13 insertions(+), 10 deletions(-)
14
1 file changed, 10 insertions(+), 1 deletion(-)
17
15
18
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
16
diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c
19
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
20
--- a/linux-user/elfload.c
18
--- a/hw/arm/stellaris.c
21
+++ b/linux-user/elfload.c
19
+++ b/hw/arm/stellaris.c
22
@@ -XXX,XX +XXX,XX @@ static uint32_t get_elf_hwcap(void)
20
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
23
21
* 400fe000 system control
24
/* EDSP is in v5TE and above, but all our v5 CPUs are v5TE */
22
*/
25
GET_FEATURE(ARM_FEATURE_V5, ARM_HWCAP_ARM_EDSP);
23
26
- GET_FEATURE(ARM_FEATURE_VFP, ARM_HWCAP_ARM_VFP);
24
+ Object *soc_container;
27
GET_FEATURE(ARM_FEATURE_IWMMXT, ARM_HWCAP_ARM_IWMMXT);
25
DeviceState *gpio_dev[7], *nvic;
28
GET_FEATURE(ARM_FEATURE_THUMB2EE, ARM_HWCAP_ARM_THUMBEE);
26
qemu_irq gpio_in[7][8];
29
GET_FEATURE(ARM_FEATURE_NEON, ARM_HWCAP_ARM_NEON);
27
qemu_irq gpio_out[7][8];
30
- GET_FEATURE(ARM_FEATURE_VFP3, ARM_HWCAP_ARM_VFPv3);
28
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
31
GET_FEATURE(ARM_FEATURE_V6K, ARM_HWCAP_ARM_TLS);
29
flash_size = (((board->dc0 & 0xffff) + 1) << 1) * 1024;
32
- GET_FEATURE(ARM_FEATURE_VFP4, ARM_HWCAP_ARM_VFPv4);
30
sram_size = ((board->dc0 >> 18) + 1) * 1024;
33
+ GET_FEATURE(ARM_FEATURE_LPAE, ARM_HWCAP_ARM_LPAE);
31
34
GET_FEATURE_ID(aa32_arm_div, ARM_HWCAP_ARM_IDIVA);
32
+ soc_container = object_new("container");
35
GET_FEATURE_ID(aa32_thumb_div, ARM_HWCAP_ARM_IDIVT);
33
+ object_property_add_child(OBJECT(ms), "soc", soc_container);
36
- /* All QEMU's VFPv3 CPUs have 32 registers, see VFP_DREG in translate.c.
37
- * Note that the ARM_HWCAP_ARM_VFPv3D16 bit is always the inverse of
38
- * ARM_HWCAP_ARM_VFPD32 (and so always clear for QEMU); it is unrelated
39
- * to our VFP_FP16 feature bit.
40
- */
41
- GET_FEATURE(ARM_FEATURE_VFP3, ARM_HWCAP_ARM_VFPD32);
42
- GET_FEATURE(ARM_FEATURE_LPAE, ARM_HWCAP_ARM_LPAE);
43
+ GET_FEATURE_ID(aa32_vfp, ARM_HWCAP_ARM_VFP);
44
+
34
+
45
+ if (cpu_isar_feature(aa32_fpsp_v3, cpu) ||
35
/* Flash programming is done via the SCU, so pretend it is ROM. */
46
+ cpu_isar_feature(aa32_fpdp_v3, cpu)) {
36
memory_region_init_rom(flash, NULL, "stellaris.flash", flash_size,
47
+ hwcaps |= ARM_HWCAP_ARM_VFPv3;
37
&error_fatal);
48
+ if (cpu_isar_feature(aa32_simd_r32, cpu)) {
38
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
49
+ hwcaps |= ARM_HWCAP_ARM_VFPD32;
39
* need its sysclk output.
50
+ } else {
40
*/
51
+ hwcaps |= ARM_HWCAP_ARM_VFPv3D16;
41
ssys_dev = qdev_new(TYPE_STELLARIS_SYS);
52
+ }
42
+ object_property_add_child(soc_container, "sys", OBJECT(ssys_dev));
53
+ }
43
54
+ GET_FEATURE_ID(aa32_simdfmac, ARM_HWCAP_ARM_VFPv4);
44
/*
55
45
* Most devices come preprogrammed with a MAC address in the user data.
56
return hwcaps;
46
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
57
}
47
sysbus_realize_and_unref(SYS_BUS_DEVICE(ssys_dev), &error_fatal);
48
49
nvic = qdev_new(TYPE_ARMV7M);
50
+ object_property_add_child(soc_container, "v7m", OBJECT(nvic));
51
qdev_prop_set_uint32(nvic, "num-irq", NUM_IRQ_LINES);
52
qdev_prop_set_uint8(nvic, "num-prio-bits", NUM_PRIO_BITS);
53
qdev_prop_set_string(nvic, "cpu-type", ms->cpu_type);
54
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
55
56
dev = qdev_new(TYPE_STELLARIS_GPTM);
57
sbd = SYS_BUS_DEVICE(dev);
58
+ object_property_add_child(soc_container, "gptm[*]", OBJECT(dev));
59
qdev_connect_clock_in(dev, "clk",
60
qdev_get_clock_out(ssys_dev, "SYSCLK"));
61
sysbus_realize_and_unref(sbd, &error_fatal);
62
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
63
64
if (board->dc1 & (1 << 3)) { /* watchdog present */
65
dev = qdev_new(TYPE_LUMINARY_WATCHDOG);
66
-
67
+ object_property_add_child(soc_container, "wdg", OBJECT(dev));
68
qdev_connect_clock_in(dev, "WDOGCLK",
69
qdev_get_clock_out(ssys_dev, "SYSCLK"));
70
71
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
72
SysBusDevice *sbd;
73
74
dev = qdev_new("pl011_luminary");
75
+ object_property_add_child(soc_container, "uart[*]", OBJECT(dev));
76
sbd = SYS_BUS_DEVICE(dev);
77
qdev_prop_set_chr(dev, "chardev", serial_hd(i));
78
sysbus_realize_and_unref(sbd, &error_fatal);
79
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
80
DeviceState *enet;
81
82
enet = qdev_new("stellaris_enet");
83
+ object_property_add_child(soc_container, "enet", OBJECT(enet));
84
if (nd) {
85
qdev_set_nic_properties(enet, nd);
86
} else {
58
--
87
--
59
2.20.1
88
2.34.1
60
89
61
90
diff view generated by jsdifflib
1
The ARMv8.3-CCIDX extension makes the CCSIDR_EL1 system ID registers
1
We support two different encodings for the AArch32 IMPDEF
2
have a format that uses the full 64 bit width of the register, and
2
CBAR register -- older cores like the Cortex A9, A7, A15
3
adds a new CCSIDR2 register so AArch32 can get at the high 32 bits.
3
have this at 4, c15, c0, 0; newer cores like the
4
Cortex A35, A53, A57 and A72 have it at 1 c15 c0 0.
4
5
5
QEMU doesn't implement caches, so we just treat these ID registers as
6
When we implemented this we picked which encoding to
6
opaque values that are set to the correct constant values for each
7
use based on whether the CPU set ARM_FEATURE_AARCH64.
7
CPU. The only thing we need to do is allow 64-bit values in our
8
However this isn't right for three cases:
8
cssidr[] array and provide the CCSIDR2 accessors.
9
* the qemu-system-arm 'max' CPU, which is supposed to be
10
a variant on a Cortex-A57; it ought to use the same
11
encoding the A57 does and which the AArch64 'max'
12
exposes to AArch32 guest code
13
* the Cortex-R52, which is AArch32-only but has the CBAR
14
at the newer encoding (and where we incorrectly are
15
not yet setting ARM_FEATURE_CBAR_RO anyway)
16
* any possible future support for other v8 AArch32
17
only CPUs, or for supporting "boot the CPU into
18
AArch32 mode" on our existing cores like the A57 etc
9
19
10
We don't set the CCIDX field in our 'max' CPU because the CCSIDR
20
Make the decision of the encoding be based on whether
11
constant values we use are the same as the ones used by the
21
the CPU implements the ARM_FEATURE_V8 flag instead.
12
Cortex-A57 and they are in the old 32-bit format. This means
22
13
that the extra regdef added here is unused currently, but it
23
This changes the behaviour only for the qemu-system-arm
14
means that whenever in the future we add a CPU that does need
24
'-cpu max'. We don't expect anybody to be relying on the
15
the new 64-bit format it will just work when we set the cssidr
25
old behaviour because:
16
values and the ID registers for it.
26
* it's not what the real hardware Cortex-A57 does
27
(and that's what our ID register claims we are)
28
* we don't implement the memory-mapped GICv3 support
29
which is the only thing that exists at the peripheral
30
base address pointed to by the register
17
31
18
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
32
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
19
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
33
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
20
Message-id: 20200224182626.29252-1-peter.maydell@linaro.org
34
Message-id: 20240206132931.38376-2-peter.maydell@linaro.org
21
---
35
---
22
target/arm/cpu.h | 17 ++++++++++++++++-
36
target/arm/helper.c | 2 +-
23
target/arm/helper.c | 19 +++++++++++++++++++
37
1 file changed, 1 insertion(+), 1 deletion(-)
24
2 files changed, 35 insertions(+), 1 deletion(-)
25
38
26
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
27
index XXXXXXX..XXXXXXX 100644
28
--- a/target/arm/cpu.h
29
+++ b/target/arm/cpu.h
30
@@ -XXX,XX +XXX,XX @@ struct ARMCPU {
31
/* The elements of this array are the CCSIDR values for each cache,
32
* in the order L1DCache, L1ICache, L2DCache, L2ICache, etc.
33
*/
34
- uint32_t ccsidr[16];
35
+ uint64_t ccsidr[16];
36
uint64_t reset_cbar;
37
uint32_t reset_auxcr;
38
bool reset_hivecs;
39
@@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa32_ac2(const ARMISARegisters *id)
40
return FIELD_EX32(id->id_mmfr4, ID_MMFR4, AC2) != 0;
41
}
42
43
+static inline bool isar_feature_aa32_ccidx(const ARMISARegisters *id)
44
+{
45
+ return FIELD_EX32(id->id_mmfr4, ID_MMFR4, CCIDX) != 0;
46
+}
47
+
48
/*
49
* 64-bit feature tests via id registers.
50
*/
51
@@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_rcpc_8_4(const ARMISARegisters *id)
52
return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, LRCPC) >= 2;
53
}
54
55
+static inline bool isar_feature_aa64_ccidx(const ARMISARegisters *id)
56
+{
57
+ return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR2, CCIDX) != 0;
58
+}
59
+
60
/*
61
* Feature tests for "does this exist in either 32-bit or 64-bit?"
62
*/
63
@@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_any_pmu_8_4(const ARMISARegisters *id)
64
return isar_feature_aa64_pmu_8_4(id) || isar_feature_aa32_pmu_8_4(id);
65
}
66
67
+static inline bool isar_feature_any_ccidx(const ARMISARegisters *id)
68
+{
69
+ return isar_feature_aa64_ccidx(id) || isar_feature_aa32_ccidx(id);
70
+}
71
+
72
/*
73
* Forward to the above feature tests given an ARMCPU pointer.
74
*/
75
diff --git a/target/arm/helper.c b/target/arm/helper.c
39
diff --git a/target/arm/helper.c b/target/arm/helper.c
76
index XXXXXXX..XXXXXXX 100644
40
index XXXXXXX..XXXXXXX 100644
77
--- a/target/arm/helper.c
41
--- a/target/arm/helper.c
78
+++ b/target/arm/helper.c
42
+++ b/target/arm/helper.c
79
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo predinv_reginfo[] = {
80
REGINFO_SENTINEL
81
};
82
83
+static uint64_t ccsidr2_read(CPUARMState *env, const ARMCPRegInfo *ri)
84
+{
85
+ /* Read the high 32 bits of the current CCSIDR */
86
+ return extract64(ccsidr_read(env, ri), 32, 32);
87
+}
88
+
89
+static const ARMCPRegInfo ccsidr2_reginfo[] = {
90
+ { .name = "CCSIDR2", .state = ARM_CP_STATE_BOTH,
91
+ .opc0 = 3, .opc1 = 1, .crn = 0, .crm = 0, .opc2 = 2,
92
+ .access = PL1_R,
93
+ .accessfn = access_aa64_tid2,
94
+ .readfn = ccsidr2_read, .type = ARM_CP_NO_RAW },
95
+ REGINFO_SENTINEL
96
+};
97
+
98
static CPAccessResult access_aa64_tid3(CPUARMState *env, const ARMCPRegInfo *ri,
99
bool isread)
100
{
101
@@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu)
43
@@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu)
102
define_arm_cp_regs(cpu, predinv_reginfo);
44
* AArch64 cores we might need to add a specific feature flag
103
}
45
* to indicate cores with "flavour 2" CBAR.
104
46
*/
105
+ if (cpu_isar_feature(any_ccidx, cpu)) {
47
- if (arm_feature(env, ARM_FEATURE_AARCH64)) {
106
+ define_arm_cp_regs(cpu, ccsidr2_reginfo);
48
+ if (arm_feature(env, ARM_FEATURE_V8)) {
107
+ }
49
/* 32 bit view is [31:18] 0...0 [43:32]. */
108
+
50
uint32_t cbar32 = (extract64(cpu->reset_cbar, 18, 14) << 18)
109
#ifndef CONFIG_USER_ONLY
51
| extract64(cpu->reset_cbar, 32, 12);
110
/*
111
* Register redirections and aliases must be done last,
112
--
52
--
113
2.20.1
53
2.34.1
114
115
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
The Cortex-R52 implements the Configuration Base Address Register
2
(CBAR), as a read-only register. Add ARM_FEATURE_CBAR_RO to this CPU
3
type, so that our implementation provides the register and the
4
associated qdev property.
2
5
3
We have converted all tests against these features
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
to ISAR tests.
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20240206132931.38376-3-peter.maydell@linaro.org
9
---
10
target/arm/tcg/cpu32.c | 1 +
11
1 file changed, 1 insertion(+)
5
12
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
13
diff --git a/target/arm/tcg/cpu32.c b/target/arm/tcg/cpu32.c
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20200224222232.13807-15-richard.henderson@linaro.org
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
target/arm/cpu.h | 3 ---
12
target/arm/cpu.c | 25 -------------------------
13
target/arm/cpu64.c | 3 ---
14
target/arm/kvm32.c | 5 -----
15
target/arm/kvm64.c | 1 -
16
5 files changed, 37 deletions(-)
17
18
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
19
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
20
--- a/target/arm/cpu.h
15
--- a/target/arm/tcg/cpu32.c
21
+++ b/target/arm/cpu.h
16
+++ b/target/arm/tcg/cpu32.c
22
@@ -XXX,XX +XXX,XX @@ QEMU_BUILD_BUG_ON(ARRAY_SIZE(((ARMCPU *)0)->ccsidr) <= R_V7M_CSSELR_INDEX_MASK);
17
@@ -XXX,XX +XXX,XX @@ static void cortex_r52_initfn(Object *obj)
23
* mapping in linux-user/elfload.c:get_elf_hwcap().
18
set_feature(&cpu->env, ARM_FEATURE_PMSA);
24
*/
25
enum arm_features {
26
- ARM_FEATURE_VFP,
27
ARM_FEATURE_AUXCR, /* ARM1026 Auxiliary control register. */
28
ARM_FEATURE_XSCALE, /* Intel XScale extensions. */
29
ARM_FEATURE_IWMMXT, /* Intel iwMMXt extension. */
30
@@ -XXX,XX +XXX,XX @@ enum arm_features {
31
ARM_FEATURE_V7,
32
ARM_FEATURE_THUMB2,
33
ARM_FEATURE_PMSA, /* no MMU; may have Memory Protection Unit */
34
- ARM_FEATURE_VFP3,
35
ARM_FEATURE_NEON,
36
ARM_FEATURE_M, /* Microcontroller profile. */
37
ARM_FEATURE_OMAPCP, /* OMAP specific CP15 ops handling. */
38
@@ -XXX,XX +XXX,XX @@ enum arm_features {
39
ARM_FEATURE_V5,
40
ARM_FEATURE_STRONGARM,
41
ARM_FEATURE_VAPA, /* cp15 VA to PA lookups */
42
- ARM_FEATURE_VFP4, /* VFPv4 (implies that NEON is v2) */
43
ARM_FEATURE_GENERIC_TIMER,
44
ARM_FEATURE_MVFR, /* Media and VFP Feature Registers 0 and 1 */
45
ARM_FEATURE_DUMMY_C15_REGS, /* RAZ/WI all of cp15 crn=15 */
46
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
47
index XXXXXXX..XXXXXXX 100644
48
--- a/target/arm/cpu.c
49
+++ b/target/arm/cpu.c
50
@@ -XXX,XX +XXX,XX @@ void arm_cpu_post_init(Object *obj)
51
if (arm_feature(&cpu->env, ARM_FEATURE_M)) {
52
set_feature(&cpu->env, ARM_FEATURE_PMSA);
53
}
54
- /* Similarly for the VFP feature bits */
55
- if (arm_feature(&cpu->env, ARM_FEATURE_VFP4)) {
56
- set_feature(&cpu->env, ARM_FEATURE_VFP3);
57
- }
58
- if (arm_feature(&cpu->env, ARM_FEATURE_VFP3)) {
59
- set_feature(&cpu->env, ARM_FEATURE_VFP);
60
- }
61
62
if (arm_feature(&cpu->env, ARM_FEATURE_CBAR) ||
63
arm_feature(&cpu->env, ARM_FEATURE_CBAR_RO)) {
64
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)
65
uint64_t t;
66
uint32_t u;
67
68
- unset_feature(env, ARM_FEATURE_VFP);
69
- unset_feature(env, ARM_FEATURE_VFP3);
70
- unset_feature(env, ARM_FEATURE_VFP4);
71
-
72
t = cpu->isar.id_aa64isar1;
73
t = FIELD_DP64(t, ID_AA64ISAR1, JSCVT, 0);
74
cpu->isar.id_aa64isar1 = t;
75
@@ -XXX,XX +XXX,XX @@ static void arm926_initfn(Object *obj)
76
77
cpu->dtb_compatible = "arm,arm926";
78
set_feature(&cpu->env, ARM_FEATURE_V5);
79
- set_feature(&cpu->env, ARM_FEATURE_VFP);
80
set_feature(&cpu->env, ARM_FEATURE_DUMMY_C15_REGS);
81
set_feature(&cpu->env, ARM_FEATURE_CACHE_TEST_CLEAN);
82
cpu->midr = 0x41069265;
83
@@ -XXX,XX +XXX,XX @@ static void arm1026_initfn(Object *obj)
84
85
cpu->dtb_compatible = "arm,arm1026";
86
set_feature(&cpu->env, ARM_FEATURE_V5);
87
- set_feature(&cpu->env, ARM_FEATURE_VFP);
88
set_feature(&cpu->env, ARM_FEATURE_AUXCR);
89
set_feature(&cpu->env, ARM_FEATURE_DUMMY_C15_REGS);
90
set_feature(&cpu->env, ARM_FEATURE_CACHE_TEST_CLEAN);
91
@@ -XXX,XX +XXX,XX @@ static void arm1136_r2_initfn(Object *obj)
92
93
cpu->dtb_compatible = "arm,arm1136";
94
set_feature(&cpu->env, ARM_FEATURE_V6);
95
- set_feature(&cpu->env, ARM_FEATURE_VFP);
96
set_feature(&cpu->env, ARM_FEATURE_DUMMY_C15_REGS);
97
set_feature(&cpu->env, ARM_FEATURE_CACHE_DIRTY_REG);
98
set_feature(&cpu->env, ARM_FEATURE_CACHE_BLOCK_OPS);
99
@@ -XXX,XX +XXX,XX @@ static void arm1136_initfn(Object *obj)
100
cpu->dtb_compatible = "arm,arm1136";
101
set_feature(&cpu->env, ARM_FEATURE_V6K);
102
set_feature(&cpu->env, ARM_FEATURE_V6);
103
- set_feature(&cpu->env, ARM_FEATURE_VFP);
104
set_feature(&cpu->env, ARM_FEATURE_DUMMY_C15_REGS);
105
set_feature(&cpu->env, ARM_FEATURE_CACHE_DIRTY_REG);
106
set_feature(&cpu->env, ARM_FEATURE_CACHE_BLOCK_OPS);
107
@@ -XXX,XX +XXX,XX @@ static void arm1176_initfn(Object *obj)
108
109
cpu->dtb_compatible = "arm,arm1176";
110
set_feature(&cpu->env, ARM_FEATURE_V6K);
111
- set_feature(&cpu->env, ARM_FEATURE_VFP);
112
set_feature(&cpu->env, ARM_FEATURE_VAPA);
113
set_feature(&cpu->env, ARM_FEATURE_DUMMY_C15_REGS);
114
set_feature(&cpu->env, ARM_FEATURE_CACHE_DIRTY_REG);
115
@@ -XXX,XX +XXX,XX @@ static void arm11mpcore_initfn(Object *obj)
116
117
cpu->dtb_compatible = "arm,arm11mpcore";
118
set_feature(&cpu->env, ARM_FEATURE_V6K);
119
- set_feature(&cpu->env, ARM_FEATURE_VFP);
120
set_feature(&cpu->env, ARM_FEATURE_VAPA);
121
set_feature(&cpu->env, ARM_FEATURE_MPIDR);
122
set_feature(&cpu->env, ARM_FEATURE_DUMMY_C15_REGS);
123
@@ -XXX,XX +XXX,XX @@ static void cortex_m4_initfn(Object *obj)
124
set_feature(&cpu->env, ARM_FEATURE_M);
125
set_feature(&cpu->env, ARM_FEATURE_M_MAIN);
126
set_feature(&cpu->env, ARM_FEATURE_THUMB_DSP);
127
- set_feature(&cpu->env, ARM_FEATURE_VFP4);
128
cpu->midr = 0x410fc240; /* r0p0 */
129
cpu->pmsav7_dregion = 8;
130
cpu->isar.mvfr0 = 0x10110021;
131
@@ -XXX,XX +XXX,XX @@ static void cortex_m7_initfn(Object *obj)
132
set_feature(&cpu->env, ARM_FEATURE_M);
133
set_feature(&cpu->env, ARM_FEATURE_M_MAIN);
134
set_feature(&cpu->env, ARM_FEATURE_THUMB_DSP);
135
- set_feature(&cpu->env, ARM_FEATURE_VFP4);
136
cpu->midr = 0x411fc272; /* r1p2 */
137
cpu->pmsav7_dregion = 8;
138
cpu->isar.mvfr0 = 0x10110221;
139
@@ -XXX,XX +XXX,XX @@ static void cortex_m33_initfn(Object *obj)
140
set_feature(&cpu->env, ARM_FEATURE_M_MAIN);
141
set_feature(&cpu->env, ARM_FEATURE_M_SECURITY);
142
set_feature(&cpu->env, ARM_FEATURE_THUMB_DSP);
143
- set_feature(&cpu->env, ARM_FEATURE_VFP4);
144
cpu->midr = 0x410fd213; /* r0p3 */
145
cpu->pmsav7_dregion = 16;
146
cpu->sau_sregion = 8;
147
@@ -XXX,XX +XXX,XX @@ static void cortex_r5f_initfn(Object *obj)
148
ARMCPU *cpu = ARM_CPU(obj);
149
150
cortex_r5_initfn(obj);
151
- set_feature(&cpu->env, ARM_FEATURE_VFP3);
152
cpu->isar.mvfr0 = 0x10110221;
153
cpu->isar.mvfr1 = 0x00000011;
154
}
155
@@ -XXX,XX +XXX,XX @@ static void cortex_a8_initfn(Object *obj)
156
157
cpu->dtb_compatible = "arm,cortex-a8";
158
set_feature(&cpu->env, ARM_FEATURE_V7);
159
- set_feature(&cpu->env, ARM_FEATURE_VFP3);
160
set_feature(&cpu->env, ARM_FEATURE_NEON);
161
set_feature(&cpu->env, ARM_FEATURE_THUMB2EE);
162
set_feature(&cpu->env, ARM_FEATURE_DUMMY_C15_REGS);
163
@@ -XXX,XX +XXX,XX @@ static void cortex_a9_initfn(Object *obj)
164
165
cpu->dtb_compatible = "arm,cortex-a9";
166
set_feature(&cpu->env, ARM_FEATURE_V7);
167
- set_feature(&cpu->env, ARM_FEATURE_VFP3);
168
set_feature(&cpu->env, ARM_FEATURE_NEON);
169
set_feature(&cpu->env, ARM_FEATURE_THUMB2EE);
170
set_feature(&cpu->env, ARM_FEATURE_EL3);
171
@@ -XXX,XX +XXX,XX @@ static void cortex_a7_initfn(Object *obj)
172
173
cpu->dtb_compatible = "arm,cortex-a7";
174
set_feature(&cpu->env, ARM_FEATURE_V7VE);
175
- set_feature(&cpu->env, ARM_FEATURE_VFP4);
176
set_feature(&cpu->env, ARM_FEATURE_NEON);
177
set_feature(&cpu->env, ARM_FEATURE_THUMB2EE);
178
set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER);
179
@@ -XXX,XX +XXX,XX @@ static void cortex_a15_initfn(Object *obj)
180
181
cpu->dtb_compatible = "arm,cortex-a15";
182
set_feature(&cpu->env, ARM_FEATURE_V7VE);
183
- set_feature(&cpu->env, ARM_FEATURE_VFP4);
184
set_feature(&cpu->env, ARM_FEATURE_NEON);
185
set_feature(&cpu->env, ARM_FEATURE_THUMB2EE);
186
set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER);
187
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
188
index XXXXXXX..XXXXXXX 100644
189
--- a/target/arm/cpu64.c
190
+++ b/target/arm/cpu64.c
191
@@ -XXX,XX +XXX,XX @@ static void aarch64_a57_initfn(Object *obj)
192
193
cpu->dtb_compatible = "arm,cortex-a57";
194
set_feature(&cpu->env, ARM_FEATURE_V8);
195
- set_feature(&cpu->env, ARM_FEATURE_VFP4);
196
set_feature(&cpu->env, ARM_FEATURE_NEON);
19
set_feature(&cpu->env, ARM_FEATURE_NEON);
197
set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER);
20
set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER);
198
set_feature(&cpu->env, ARM_FEATURE_AARCH64);
21
+ set_feature(&cpu->env, ARM_FEATURE_CBAR_RO);
199
@@ -XXX,XX +XXX,XX @@ static void aarch64_a53_initfn(Object *obj)
22
cpu->midr = 0x411fd133; /* r1p3 */
200
23
cpu->revidr = 0x00000000;
201
cpu->dtb_compatible = "arm,cortex-a53";
24
cpu->reset_fpsid = 0x41034023;
202
set_feature(&cpu->env, ARM_FEATURE_V8);
203
- set_feature(&cpu->env, ARM_FEATURE_VFP4);
204
set_feature(&cpu->env, ARM_FEATURE_NEON);
205
set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER);
206
set_feature(&cpu->env, ARM_FEATURE_AARCH64);
207
@@ -XXX,XX +XXX,XX @@ static void aarch64_a72_initfn(Object *obj)
208
209
cpu->dtb_compatible = "arm,cortex-a72";
210
set_feature(&cpu->env, ARM_FEATURE_V8);
211
- set_feature(&cpu->env, ARM_FEATURE_VFP4);
212
set_feature(&cpu->env, ARM_FEATURE_NEON);
213
set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER);
214
set_feature(&cpu->env, ARM_FEATURE_AARCH64);
215
diff --git a/target/arm/kvm32.c b/target/arm/kvm32.c
216
index XXXXXXX..XXXXXXX 100644
217
--- a/target/arm/kvm32.c
218
+++ b/target/arm/kvm32.c
219
@@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)
220
* bits, but a few must be tested.
221
*/
222
set_feature(&features, ARM_FEATURE_V7VE);
223
- set_feature(&features, ARM_FEATURE_VFP3);
224
set_feature(&features, ARM_FEATURE_GENERIC_TIMER);
225
226
if (extract32(id_pfr0, 12, 4) == 1) {
227
@@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)
228
if (extract32(ahcf->isar.mvfr1, 12, 4) == 1) {
229
set_feature(&features, ARM_FEATURE_NEON);
230
}
231
- if (extract32(ahcf->isar.mvfr1, 28, 4) == 1) {
232
- /* FMAC support implies VFPv4 */
233
- set_feature(&features, ARM_FEATURE_VFP4);
234
- }
235
236
ahcf->features = features;
237
238
diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c
239
index XXXXXXX..XXXXXXX 100644
240
--- a/target/arm/kvm64.c
241
+++ b/target/arm/kvm64.c
242
@@ -XXX,XX +XXX,XX @@ bool kvm_arm_get_host_cpu_features(ARMHostCPUFeatures *ahcf)
243
* feature bits.
244
*/
245
set_feature(&features, ARM_FEATURE_V8);
246
- set_feature(&features, ARM_FEATURE_VFP4);
247
set_feature(&features, ARM_FEATURE_NEON);
248
set_feature(&features, ARM_FEATURE_AARCH64);
249
set_feature(&features, ARM_FEATURE_PMU);
250
--
25
--
251
2.20.1
26
2.34.1
252
253
diff view generated by jsdifflib
1
The v8.3-RCPC extension implements three new load instructions
1
Add the Cortex-R52 IMPDEF sysregs, by defining them here and
2
which provide slightly weaker consistency guarantees than the
2
also by enabling the AUXCR feature which defines the ACTLR
3
existing load-acquire operations. For QEMU we choose to simply
3
and HACTLR registers. As is our usual practice, we make these
4
implement them with a full LDAQ barrier.
4
simple reads-as-zero stubs for now.
5
5
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20200224172846.13053-3-peter.maydell@linaro.org
8
Message-id: 20240206132931.38376-4-peter.maydell@linaro.org
9
---
9
---
10
target/arm/cpu.h | 5 +++++
10
target/arm/tcg/cpu32.c | 108 +++++++++++++++++++++++++++++++++++++++++
11
linux-user/elfload.c | 1 +
11
1 file changed, 108 insertions(+)
12
target/arm/cpu64.c | 1 +
13
target/arm/translate-a64.c | 24 ++++++++++++++++++++++++
14
4 files changed, 31 insertions(+)
15
12
16
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
13
diff --git a/target/arm/tcg/cpu32.c b/target/arm/tcg/cpu32.c
17
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
18
--- a/target/arm/cpu.h
15
--- a/target/arm/tcg/cpu32.c
19
+++ b/target/arm/cpu.h
16
+++ b/target/arm/tcg/cpu32.c
20
@@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_pmu_8_4(const ARMISARegisters *id)
17
@@ -XXX,XX +XXX,XX @@ static void cortex_r5_initfn(Object *obj)
21
FIELD_EX64(id->id_aa64dfr0, ID_AA64DFR0, PMUVER) != 0xf;
18
define_arm_cp_regs(cpu, cortexr5_cp_reginfo);
22
}
19
}
23
20
24
+static inline bool isar_feature_aa64_rcpc_8_3(const ARMISARegisters *id)
21
+static const ARMCPRegInfo cortex_r52_cp_reginfo[] = {
25
+{
22
+ { .name = "CPUACTLR", .cp = 15, .opc1 = 0, .crm = 15,
26
+ return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, LRCPC) != 0;
23
+ .access = PL1_RW, .type = ARM_CP_CONST | ARM_CP_64BIT, .resetvalue = 0 },
27
+}
24
+ { .name = "IMP_ATCMREGIONR",
25
+ .cp = 15, .opc1 = 0, .crn = 9, .crm = 1, .opc2 = 0,
26
+ .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
27
+ { .name = "IMP_BTCMREGIONR",
28
+ .cp = 15, .opc1 = 0, .crn = 9, .crm = 1, .opc2 = 1,
29
+ .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
30
+ { .name = "IMP_CTCMREGIONR",
31
+ .cp = 15, .opc1 = 0, .crn = 9, .crm = 1, .opc2 = 2,
32
+ .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
33
+ { .name = "IMP_CSCTLR",
34
+ .cp = 15, .opc1 = 1, .crn = 9, .crm = 1, .opc2 = 0,
35
+ .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
36
+ { .name = "IMP_BPCTLR",
37
+ .cp = 15, .opc1 = 1, .crn = 9, .crm = 1, .opc2 = 1,
38
+ .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
39
+ { .name = "IMP_MEMPROTCLR",
40
+ .cp = 15, .opc1 = 1, .crn = 9, .crm = 1, .opc2 = 2,
41
+ .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
42
+ { .name = "IMP_SLAVEPCTLR",
43
+ .cp = 15, .opc1 = 0, .crn = 11, .crm = 0, .opc2 = 0,
44
+ .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
45
+ { .name = "IMP_PERIPHREGIONR",
46
+ .cp = 15, .opc1 = 0, .crn = 15, .crm = 0, .opc2 = 0,
47
+ .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
48
+ { .name = "IMP_FLASHIFREGIONR",
49
+ .cp = 15, .opc1 = 0, .crn = 15, .crm = 0, .opc2 = 1,
50
+ .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
51
+ { .name = "IMP_BUILDOPTR",
52
+ .cp = 15, .opc1 = 0, .crn = 15, .crm = 2, .opc2 = 0,
53
+ .access = PL1_R, .type = ARM_CP_CONST, .resetvalue = 0 },
54
+ { .name = "IMP_PINOPTR",
55
+ .cp = 15, .opc1 = 0, .crn = 15, .crm = 2, .opc2 = 7,
56
+ .access = PL1_R, .type = ARM_CP_CONST, .resetvalue = 0 },
57
+ { .name = "IMP_QOSR",
58
+ .cp = 15, .opc1 = 1, .crn = 15, .crm = 3, .opc2 = 1,
59
+ .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
60
+ { .name = "IMP_BUSTIMEOUTR",
61
+ .cp = 15, .opc1 = 1, .crn = 15, .crm = 3, .opc2 = 2,
62
+ .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
63
+ { .name = "IMP_INTMONR",
64
+ .cp = 15, .opc1 = 1, .crn = 15, .crm = 3, .opc2 = 4,
65
+ .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
66
+ { .name = "IMP_ICERR0",
67
+ .cp = 15, .opc1 = 2, .crn = 15, .crm = 0, .opc2 = 0,
68
+ .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
69
+ { .name = "IMP_ICERR1",
70
+ .cp = 15, .opc1 = 2, .crn = 15, .crm = 0, .opc2 = 1,
71
+ .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
72
+ { .name = "IMP_DCERR0",
73
+ .cp = 15, .opc1 = 2, .crn = 15, .crm = 1, .opc2 = 0,
74
+ .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
75
+ { .name = "IMP_DCERR1",
76
+ .cp = 15, .opc1 = 2, .crn = 15, .crm = 1, .opc2 = 1,
77
+ .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
78
+ { .name = "IMP_TCMERR0",
79
+ .cp = 15, .opc1 = 2, .crn = 15, .crm = 2, .opc2 = 0,
80
+ .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
81
+ { .name = "IMP_TCMERR1",
82
+ .cp = 15, .opc1 = 2, .crn = 15, .crm = 2, .opc2 = 1,
83
+ .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
84
+ { .name = "IMP_TCMSYNDR0",
85
+ .cp = 15, .opc1 = 2, .crn = 15, .crm = 2, .opc2 = 2,
86
+ .access = PL1_R, .type = ARM_CP_CONST, .resetvalue = 0 },
87
+ { .name = "IMP_TCMSYNDR1",
88
+ .cp = 15, .opc1 = 2, .crn = 15, .crm = 2, .opc2 = 3,
89
+ .access = PL1_R, .type = ARM_CP_CONST, .resetvalue = 0 },
90
+ { .name = "IMP_FLASHERR0",
91
+ .cp = 15, .opc1 = 2, .crn = 15, .crm = 3, .opc2 = 0,
92
+ .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
93
+ { .name = "IMP_FLASHERR1",
94
+ .cp = 15, .opc1 = 2, .crn = 15, .crm = 3, .opc2 = 1,
95
+ .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
96
+ { .name = "IMP_CDBGDR0",
97
+ .cp = 15, .opc1 = 3, .crn = 15, .crm = 0, .opc2 = 0,
98
+ .access = PL1_R, .type = ARM_CP_CONST, .resetvalue = 0 },
99
+ { .name = "IMP_CBDGBR1",
100
+ .cp = 15, .opc1 = 3, .crn = 15, .crm = 0, .opc2 = 1,
101
+ .access = PL1_R, .type = ARM_CP_CONST, .resetvalue = 0 },
102
+ { .name = "IMP_TESTR0",
103
+ .cp = 15, .opc1 = 4, .crn = 15, .crm = 0, .opc2 = 0,
104
+ .access = PL1_R, .type = ARM_CP_CONST, .resetvalue = 0 },
105
+ { .name = "IMP_TESTR1",
106
+ .cp = 15, .opc1 = 4, .crn = 15, .crm = 0, .opc2 = 1,
107
+ .access = PL1_W, .type = ARM_CP_NOP, .resetvalue = 0 },
108
+ { .name = "IMP_CDBGDCI",
109
+ .cp = 15, .opc1 = 0, .crn = 15, .crm = 15, .opc2 = 0,
110
+ .access = PL1_W, .type = ARM_CP_NOP, .resetvalue = 0 },
111
+ { .name = "IMP_CDBGDCT",
112
+ .cp = 15, .opc1 = 3, .crn = 15, .crm = 2, .opc2 = 0,
113
+ .access = PL1_W, .type = ARM_CP_NOP, .resetvalue = 0 },
114
+ { .name = "IMP_CDBGICT",
115
+ .cp = 15, .opc1 = 3, .crn = 15, .crm = 2, .opc2 = 1,
116
+ .access = PL1_W, .type = ARM_CP_NOP, .resetvalue = 0 },
117
+ { .name = "IMP_CDBGDCD",
118
+ .cp = 15, .opc1 = 3, .crn = 15, .crm = 4, .opc2 = 0,
119
+ .access = PL1_W, .type = ARM_CP_NOP, .resetvalue = 0 },
120
+ { .name = "IMP_CDBGICD",
121
+ .cp = 15, .opc1 = 3, .crn = 15, .crm = 4, .opc2 = 1,
122
+ .access = PL1_W, .type = ARM_CP_NOP, .resetvalue = 0 },
123
+};
28
+
124
+
29
/*
125
+
30
* Feature tests for "does this exist in either 32-bit or 64-bit?"
126
static void cortex_r52_initfn(Object *obj)
31
*/
127
{
32
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
128
ARMCPU *cpu = ARM_CPU(obj);
33
index XXXXXXX..XXXXXXX 100644
129
@@ -XXX,XX +XXX,XX @@ static void cortex_r52_initfn(Object *obj)
34
--- a/linux-user/elfload.c
130
set_feature(&cpu->env, ARM_FEATURE_NEON);
35
+++ b/linux-user/elfload.c
131
set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER);
36
@@ -XXX,XX +XXX,XX @@ static uint32_t get_elf_hwcap(void)
132
set_feature(&cpu->env, ARM_FEATURE_CBAR_RO);
37
GET_FEATURE_ID(aa64_sb, ARM_HWCAP_A64_SB);
133
+ set_feature(&cpu->env, ARM_FEATURE_AUXCR);
38
GET_FEATURE_ID(aa64_condm_4, ARM_HWCAP_A64_FLAGM);
134
cpu->midr = 0x411fd133; /* r1p3 */
39
GET_FEATURE_ID(aa64_dcpop, ARM_HWCAP_A64_DCPOP);
135
cpu->revidr = 0x00000000;
40
+ GET_FEATURE_ID(aa64_rcpc_8_3, ARM_HWCAP_A64_LRCPC);
136
cpu->reset_fpsid = 0x41034023;
41
137
@@ -XXX,XX +XXX,XX @@ static void cortex_r52_initfn(Object *obj)
42
return hwcaps;
138
139
cpu->pmsav7_dregion = 16;
140
cpu->pmsav8r_hdregion = 16;
141
+
142
+ define_arm_cp_regs(cpu, cortex_r52_cp_reginfo);
43
}
143
}
44
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
144
45
index XXXXXXX..XXXXXXX 100644
145
static void cortex_r5f_initfn(Object *obj)
46
--- a/target/arm/cpu64.c
47
+++ b/target/arm/cpu64.c
48
@@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj)
49
t = FIELD_DP64(t, ID_AA64ISAR1, SB, 1);
50
t = FIELD_DP64(t, ID_AA64ISAR1, SPECRES, 1);
51
t = FIELD_DP64(t, ID_AA64ISAR1, FRINTTS, 1);
52
+ t = FIELD_DP64(t, ID_AA64ISAR1, LRCPC, 1); /* ARMv8.3-RCPC */
53
cpu->isar.id_aa64isar1 = t;
54
55
t = cpu->isar.id_aa64pfr0;
56
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
57
index XXXXXXX..XXXXXXX 100644
58
--- a/target/arm/translate-a64.c
59
+++ b/target/arm/translate-a64.c
60
@@ -XXX,XX +XXX,XX @@ static void disas_ldst_atomic(DisasContext *s, uint32_t insn,
61
int rs = extract32(insn, 16, 5);
62
int rn = extract32(insn, 5, 5);
63
int o3_opc = extract32(insn, 12, 4);
64
+ bool r = extract32(insn, 22, 1);
65
+ bool a = extract32(insn, 23, 1);
66
TCGv_i64 tcg_rs, clean_addr;
67
AtomicThreeOpFn *fn;
68
69
@@ -XXX,XX +XXX,XX @@ static void disas_ldst_atomic(DisasContext *s, uint32_t insn,
70
case 010: /* SWP */
71
fn = tcg_gen_atomic_xchg_i64;
72
break;
73
+ case 014: /* LDAPR, LDAPRH, LDAPRB */
74
+ if (!dc_isar_feature(aa64_rcpc_8_3, s) ||
75
+ rs != 31 || a != 1 || r != 0) {
76
+ unallocated_encoding(s);
77
+ return;
78
+ }
79
+ break;
80
default:
81
unallocated_encoding(s);
82
return;
83
@@ -XXX,XX +XXX,XX @@ static void disas_ldst_atomic(DisasContext *s, uint32_t insn,
84
gen_check_sp_alignment(s);
85
}
86
clean_addr = clean_data_tbi(s, cpu_reg_sp(s, rn));
87
+
88
+ if (o3_opc == 014) {
89
+ /*
90
+ * LDAPR* are a special case because they are a simple load, not a
91
+ * fetch-and-do-something op.
92
+ * The architectural consistency requirements here are weaker than
93
+ * full load-acquire (we only need "load-acquire processor consistent"),
94
+ * but we choose to implement them as full LDAQ.
95
+ */
96
+ do_gpr_ld(s, cpu_reg(s, rt), clean_addr, size, false, false,
97
+ true, rt, disas_ldst_compute_iss_sf(size, false, 0), true);
98
+ tcg_gen_mb(TCG_MO_ALL | TCG_BAR_LDAQ);
99
+ return;
100
+ }
101
+
102
tcg_rs = read_cpu_reg(s, rs, true);
103
104
if (o3_opc == 1) { /* LDCLR */
105
--
146
--
106
2.20.1
147
2.34.1
107
108
diff view generated by jsdifflib
1
The v8.4-RCPC extension implements some new instructions:
1
Architecturally, the AArch32 MSR/MRS to/from banked register
2
* LDAPUR, LDAPURB, LDAPURH, LDAPRSB, LDAPRSH, LDAPRSW
2
instructions are UNPREDICTABLE for attempts to access a banked
3
* STLUR, STLURB, STLURH
3
register that the guest could access in a more direct way (e.g.
4
using this insn to access r8_fiq when already in FIQ mode). QEMU has
5
chosen to UNDEF on all of these.
4
6
5
These are all in a new subgroup of encodings that sits below the
7
However, for the case of accessing SPSR_hyp from hyp mode, it turns
6
top-level "Loads and Stores" group in the Arm ARM.
8
out that real hardware permits this, with the same effect as if the
9
guest had directly written to SPSR. Further, there is some
10
guest code out there that assumes it can do this, because it
11
happens to work on hardware: an example Cortex-R52 startup code
12
fragment uses this, and it got copied into various other places,
13
including Zephyr. Zephyr was fixed to not use this:
14
https://github.com/zephyrproject-rtos/zephyr/issues/47330
15
but other examples are still out there, like the selftest
16
binary for the MPS3-AN536.
7
17
8
The STLUR* instructions have standard store-release semantics; the
18
For convenience of being able to run guest code, permit
9
LDAPUR* have Load-AcquirePC semantics, but (as with LDAPR*) we choose
19
this UNPREDICTABLE access instead of UNDEFing it.
10
to implement them as the slightly stronger Load-Acquire.
11
20
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
21
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
22
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
14
Message-id: 20200224172846.13053-4-peter.maydell@linaro.org
23
Message-id: 20240206132931.38376-5-peter.maydell@linaro.org
15
---
24
---
16
target/arm/cpu.h | 5 +++
25
target/arm/tcg/op_helper.c | 43 ++++++++++++++++++++++++++------------
17
linux-user/elfload.c | 1 +
26
target/arm/tcg/translate.c | 19 +++++++++++------
18
target/arm/cpu64.c | 2 +-
27
2 files changed, 43 insertions(+), 19 deletions(-)
19
target/arm/translate-a64.c | 90 ++++++++++++++++++++++++++++++++++++++
20
4 files changed, 97 insertions(+), 1 deletion(-)
21
28
22
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
29
diff --git a/target/arm/tcg/op_helper.c b/target/arm/tcg/op_helper.c
23
index XXXXXXX..XXXXXXX 100644
30
index XXXXXXX..XXXXXXX 100644
24
--- a/target/arm/cpu.h
31
--- a/target/arm/tcg/op_helper.c
25
+++ b/target/arm/cpu.h
32
+++ b/target/arm/tcg/op_helper.c
26
@@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_rcpc_8_3(const ARMISARegisters *id)
33
@@ -XXX,XX +XXX,XX @@ static void msr_mrs_banked_exc_checks(CPUARMState *env, uint32_t tgtmode,
27
return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, LRCPC) != 0;
34
*/
28
}
35
int curmode = env->uncached_cpsr & CPSR_M;
29
36
30
+static inline bool isar_feature_aa64_rcpc_8_4(const ARMISARegisters *id)
37
- if (regno == 17) {
31
+{
38
- /* ELR_Hyp: a special case because access from tgtmode is OK */
32
+ return FIELD_EX64(id->id_aa64isar1, ID_AA64ISAR1, LRCPC) >= 2;
39
- if (curmode != ARM_CPU_MODE_HYP && curmode != ARM_CPU_MODE_MON) {
33
+}
40
- goto undef;
34
+
41
+ if (tgtmode == ARM_CPU_MODE_HYP) {
35
/*
42
+ /*
36
* Feature tests for "does this exist in either 32-bit or 64-bit?"
43
+ * Handle Hyp target regs first because some are special cases
37
*/
44
+ * which don't want the usual "not accessible from tgtmode" check.
38
diff --git a/linux-user/elfload.c b/linux-user/elfload.c
45
+ */
46
+ switch (regno) {
47
+ case 16 ... 17: /* ELR_Hyp, SPSR_Hyp */
48
+ if (curmode != ARM_CPU_MODE_HYP && curmode != ARM_CPU_MODE_MON) {
49
+ goto undef;
50
+ }
51
+ break;
52
+ case 13:
53
+ if (curmode != ARM_CPU_MODE_MON) {
54
+ goto undef;
55
+ }
56
+ break;
57
+ default:
58
+ g_assert_not_reached();
59
}
60
return;
61
}
62
@@ -XXX,XX +XXX,XX @@ static void msr_mrs_banked_exc_checks(CPUARMState *env, uint32_t tgtmode,
63
}
64
}
65
66
- if (tgtmode == ARM_CPU_MODE_HYP) {
67
- /* SPSR_Hyp, r13_hyp: accessible from Monitor mode only */
68
- if (curmode != ARM_CPU_MODE_MON) {
69
- goto undef;
70
- }
71
- }
72
-
73
return;
74
75
undef:
76
@@ -XXX,XX +XXX,XX @@ void HELPER(msr_banked)(CPUARMState *env, uint32_t value, uint32_t tgtmode,
77
78
switch (regno) {
79
case 16: /* SPSRs */
80
- env->banked_spsr[bank_number(tgtmode)] = value;
81
+ if (tgtmode == (env->uncached_cpsr & CPSR_M)) {
82
+ /* Only happens for SPSR_Hyp access in Hyp mode */
83
+ env->spsr = value;
84
+ } else {
85
+ env->banked_spsr[bank_number(tgtmode)] = value;
86
+ }
87
break;
88
case 17: /* ELR_Hyp */
89
env->elr_el[2] = value;
90
@@ -XXX,XX +XXX,XX @@ uint32_t HELPER(mrs_banked)(CPUARMState *env, uint32_t tgtmode, uint32_t regno)
91
92
switch (regno) {
93
case 16: /* SPSRs */
94
- return env->banked_spsr[bank_number(tgtmode)];
95
+ if (tgtmode == (env->uncached_cpsr & CPSR_M)) {
96
+ /* Only happens for SPSR_Hyp access in Hyp mode */
97
+ return env->spsr;
98
+ } else {
99
+ return env->banked_spsr[bank_number(tgtmode)];
100
+ }
101
case 17: /* ELR_Hyp */
102
return env->elr_el[2];
103
case 13:
104
diff --git a/target/arm/tcg/translate.c b/target/arm/tcg/translate.c
39
index XXXXXXX..XXXXXXX 100644
105
index XXXXXXX..XXXXXXX 100644
40
--- a/linux-user/elfload.c
106
--- a/target/arm/tcg/translate.c
41
+++ b/linux-user/elfload.c
107
+++ b/target/arm/tcg/translate.c
42
@@ -XXX,XX +XXX,XX @@ static uint32_t get_elf_hwcap(void)
108
@@ -XXX,XX +XXX,XX @@ static bool msr_banked_access_decode(DisasContext *s, int r, int sysm, int rn,
43
GET_FEATURE_ID(aa64_condm_4, ARM_HWCAP_A64_FLAGM);
44
GET_FEATURE_ID(aa64_dcpop, ARM_HWCAP_A64_DCPOP);
45
GET_FEATURE_ID(aa64_rcpc_8_3, ARM_HWCAP_A64_LRCPC);
46
+ GET_FEATURE_ID(aa64_rcpc_8_4, ARM_HWCAP_A64_ILRCPC);
47
48
return hwcaps;
49
}
50
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
51
index XXXXXXX..XXXXXXX 100644
52
--- a/target/arm/cpu64.c
53
+++ b/target/arm/cpu64.c
54
@@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj)
55
t = FIELD_DP64(t, ID_AA64ISAR1, SB, 1);
56
t = FIELD_DP64(t, ID_AA64ISAR1, SPECRES, 1);
57
t = FIELD_DP64(t, ID_AA64ISAR1, FRINTTS, 1);
58
- t = FIELD_DP64(t, ID_AA64ISAR1, LRCPC, 1); /* ARMv8.3-RCPC */
59
+ t = FIELD_DP64(t, ID_AA64ISAR1, LRCPC, 2); /* ARMv8.4-RCPC */
60
cpu->isar.id_aa64isar1 = t;
61
62
t = cpu->isar.id_aa64pfr0;
63
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
64
index XXXXXXX..XXXXXXX 100644
65
--- a/target/arm/translate-a64.c
66
+++ b/target/arm/translate-a64.c
67
@@ -XXX,XX +XXX,XX @@ static void disas_ldst_pac(DisasContext *s, uint32_t insn,
68
}
69
}
70
71
+/*
72
+ * LDAPR/STLR (unscaled immediate)
73
+ *
74
+ * 31 30 24 22 21 12 10 5 0
75
+ * +------+-------------+-----+---+--------+-----+----+-----+
76
+ * | size | 0 1 1 0 0 1 | opc | 0 | imm9 | 0 0 | Rn | Rt |
77
+ * +------+-------------+-----+---+--------+-----+----+-----+
78
+ *
79
+ * Rt: source or destination register
80
+ * Rn: base register
81
+ * imm9: unscaled immediate offset
82
+ * opc: 00: STLUR*, 01/10/11: various LDAPUR*
83
+ * size: size of load/store
84
+ */
85
+static void disas_ldst_ldapr_stlr(DisasContext *s, uint32_t insn)
86
+{
87
+ int rt = extract32(insn, 0, 5);
88
+ int rn = extract32(insn, 5, 5);
89
+ int offset = sextract32(insn, 12, 9);
90
+ int opc = extract32(insn, 22, 2);
91
+ int size = extract32(insn, 30, 2);
92
+ TCGv_i64 clean_addr, dirty_addr;
93
+ bool is_store = false;
94
+ bool is_signed = false;
95
+ bool extend = false;
96
+ bool iss_sf;
97
+
98
+ if (!dc_isar_feature(aa64_rcpc_8_4, s)) {
99
+ unallocated_encoding(s);
100
+ return;
101
+ }
102
+
103
+ switch (opc) {
104
+ case 0: /* STLURB */
105
+ is_store = true;
106
+ break;
107
+ case 1: /* LDAPUR* */
108
+ break;
109
+ case 2: /* LDAPURS* 64-bit variant */
110
+ if (size == 3) {
111
+ unallocated_encoding(s);
112
+ return;
113
+ }
114
+ is_signed = true;
115
+ break;
116
+ case 3: /* LDAPURS* 32-bit variant */
117
+ if (size > 1) {
118
+ unallocated_encoding(s);
119
+ return;
120
+ }
121
+ is_signed = true;
122
+ extend = true; /* zero-extend 32->64 after signed load */
123
+ break;
124
+ default:
125
+ g_assert_not_reached();
126
+ }
127
+
128
+ iss_sf = disas_ldst_compute_iss_sf(size, is_signed, opc);
129
+
130
+ if (rn == 31) {
131
+ gen_check_sp_alignment(s);
132
+ }
133
+
134
+ dirty_addr = read_cpu_reg_sp(s, rn, 1);
135
+ tcg_gen_addi_i64(dirty_addr, dirty_addr, offset);
136
+ clean_addr = clean_data_tbi(s, dirty_addr);
137
+
138
+ if (is_store) {
139
+ /* Store-Release semantics */
140
+ tcg_gen_mb(TCG_MO_ALL | TCG_BAR_STRL);
141
+ do_gpr_st(s, cpu_reg(s, rt), clean_addr, size, true, rt, iss_sf, true);
142
+ } else {
143
+ /*
144
+ * Load-AcquirePC semantics; we implement as the slightly more
145
+ * restrictive Load-Acquire.
146
+ */
147
+ do_gpr_ld(s, cpu_reg(s, rt), clean_addr, size, is_signed, extend,
148
+ true, rt, iss_sf, true);
149
+ tcg_gen_mb(TCG_MO_ALL | TCG_BAR_LDAQ);
150
+ }
151
+}
152
+
153
/* Load/store register (all forms) */
154
static void disas_ldst_reg(DisasContext *s, uint32_t insn)
155
{
156
@@ -XXX,XX +XXX,XX @@ static void disas_ldst(DisasContext *s, uint32_t insn)
157
case 0x0d: /* AdvSIMD load/store single structure */
158
disas_ldst_single_struct(s, insn);
159
break;
109
break;
160
+ case 0x19: /* LDAPR/STLR (unscaled immediate) */
110
case ARM_CPU_MODE_HYP:
161
+ if (extract32(insn, 10, 2) != 0 ||
111
/*
162
+ extract32(insn, 21, 1) != 0) {
112
- * SPSR_hyp and r13_hyp can only be accessed from Monitor mode
163
+ unallocated_encoding(s);
113
- * (and so we can forbid accesses from EL2 or below). elr_hyp
164
+ break;
114
- * can be accessed also from Hyp mode, so forbid accesses from
165
+ }
115
- * EL0 or EL1.
166
+ disas_ldst_ldapr_stlr(s, insn);
116
+ * r13_hyp can only be accessed from Monitor mode, and so we
167
+ break;
117
+ * can forbid accesses from EL2 or below.
168
default:
118
+ * elr_hyp can be accessed also from Hyp mode, so forbid
169
unallocated_encoding(s);
119
+ * accesses from EL0 or EL1.
120
+ * SPSR_hyp is supposed to be in the same category as r13_hyp
121
+ * and UNPREDICTABLE if accessed from anything except Monitor
122
+ * mode. However there is some real-world code that will do
123
+ * it because at least some hardware happens to permit the
124
+ * access. (Notably a standard Cortex-R52 startup code fragment
125
+ * does this.) So we permit SPSR_hyp from Hyp mode also, to allow
126
+ * this (incorrect) guest code to run.
127
*/
128
- if (!arm_dc_feature(s, ARM_FEATURE_EL2) || s->current_el < 2 ||
129
- (s->current_el < 3 && *regno != 17)) {
130
+ if (!arm_dc_feature(s, ARM_FEATURE_EL2) || s->current_el < 2
131
+ || (s->current_el < 3 && *regno != 16 && *regno != 17)) {
132
goto undef;
133
}
170
break;
134
break;
171
--
135
--
172
2.20.1
136
2.34.1
173
174
diff view generated by jsdifflib
1
From: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com>
1
We currently guard the CFG3 register read with
2
(scc_partno(s) == 0x524 && scc_partno(s) == 0x547)
3
which is clearly wrong as it is never true.
2
4
3
The GIC built into the ARM11MPCore is always implemented with 4
5
This register is present on all board types except AN524
4
priority bits; set the GIC property accordingly.
6
and AN527; correct the condition.
5
7
6
Signed-off-by: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com>
8
Fixes: 6ac80818941829c0 ("hw/misc/mps2-scc: Implement changes for AN547")
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Message-id: 1582537164-764-4-git-send-email-sai.pavan.boddu@xilinx.com
9
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
10
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
11
[PMM: tweaked commit message]
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
11
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
12
Message-id: 20240206132931.38376-6-peter.maydell@linaro.org
13
---
13
---
14
hw/cpu/arm11mpcore.c | 5 +++++
14
hw/misc/mps2-scc.c | 2 +-
15
1 file changed, 5 insertions(+)
15
1 file changed, 1 insertion(+), 1 deletion(-)
16
16
17
diff --git a/hw/cpu/arm11mpcore.c b/hw/cpu/arm11mpcore.c
17
diff --git a/hw/misc/mps2-scc.c b/hw/misc/mps2-scc.c
18
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
19
--- a/hw/cpu/arm11mpcore.c
19
--- a/hw/misc/mps2-scc.c
20
+++ b/hw/cpu/arm11mpcore.c
20
+++ b/hw/misc/mps2-scc.c
21
@@ -XXX,XX +XXX,XX @@
21
@@ -XXX,XX +XXX,XX @@ static uint64_t mps2_scc_read(void *opaque, hwaddr offset, unsigned size)
22
#include "hw/irq.h"
22
r = s->cfg2;
23
#include "hw/qdev-properties.h"
23
break;
24
24
case A_CFG3:
25
+#define ARM11MPCORE_NUM_GIC_PRIORITY_BITS 4
25
- if (scc_partno(s) == 0x524 && scc_partno(s) == 0x547) {
26
26
+ if (scc_partno(s) == 0x524 || scc_partno(s) == 0x547) {
27
static void mpcore_priv_set_irq(void *opaque, int irq, int level)
27
/* CFG3 reserved on AN524 */
28
{
28
goto bad_offset;
29
@@ -XXX,XX +XXX,XX @@ static void mpcore_priv_realize(DeviceState *dev, Error **errp)
29
}
30
31
qdev_prop_set_uint32(gicdev, "num-cpu", s->num_cpu);
32
qdev_prop_set_uint32(gicdev, "num-irq", s->num_irq);
33
+ qdev_prop_set_uint32(gicdev, "num-priority-bits",
34
+ ARM11MPCORE_NUM_GIC_PRIORITY_BITS);
35
+
36
+
37
object_property_set_bool(OBJECT(&s->gic), true, "realized", &err);
38
if (err != NULL) {
39
error_propagate(errp, err);
40
--
30
--
41
2.20.1
31
2.34.1
42
32
43
33
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
The MPS SCC device has a lot of different flavours for the various
2
different MPS FPGA images, which look mostly similar but have
3
differences in how particular registers are handled. Currently we
4
deal with this with a lot of open-coded checks on scc_partno(), but
5
as we add more board types this is getting a bit hard to read.
2
6
3
Passing the raw o1 and o2 fields from the manual is less
7
Factor out the conditions into some functions which we can
4
instructive than it might be. Do the full decode and let
8
give more descriptive names to.
5
the trans_* functions pass in booleans to a helper.
6
9
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20200224222232.13807-17-richard.henderson@linaro.org
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
12
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
13
Message-id: 20240206132931.38376-7-peter.maydell@linaro.org
11
---
14
---
12
target/arm/translate-vfp.inc.c | 52 ++++++++++++++++++++++++++++++----
15
hw/misc/mps2-scc.c | 45 +++++++++++++++++++++++++++++++--------------
13
target/arm/vfp.decode | 17 +++++------
16
1 file changed, 31 insertions(+), 14 deletions(-)
14
2 files changed, 55 insertions(+), 14 deletions(-)
15
17
16
diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c
18
diff --git a/hw/misc/mps2-scc.c b/hw/misc/mps2-scc.c
17
index XXXXXXX..XXXXXXX 100644
19
index XXXXXXX..XXXXXXX 100644
18
--- a/target/arm/translate-vfp.inc.c
20
--- a/hw/misc/mps2-scc.c
19
+++ b/target/arm/translate-vfp.inc.c
21
+++ b/hw/misc/mps2-scc.c
20
@@ -XXX,XX +XXX,XX @@ static bool trans_VDIV_dp(DisasContext *s, arg_VDIV_dp *a)
22
@@ -XXX,XX +XXX,XX @@ static int scc_partno(MPS2SCC *s)
21
return do_vfp_3op_dp(s, gen_helper_vfp_divd, a->vd, a->vn, a->vm, false);
23
return extract32(s->id, 4, 8);
22
}
24
}
23
25
24
-static bool trans_VFM_sp(DisasContext *s, arg_VFM_sp *a)
26
+/* Is CFG_REG2 present? */
25
+static bool do_vfm_sp(DisasContext *s, arg_VFMA_sp *a, bool neg_n, bool neg_d)
27
+static bool have_cfg2(MPS2SCC *s)
26
{
27
/*
28
* VFNMA : fd = muladd(-fd, fn, fm)
29
@@ -XXX,XX +XXX,XX @@ static bool trans_VFM_sp(DisasContext *s, arg_VFM_sp *a)
30
31
neon_load_reg32(vn, a->vn);
32
neon_load_reg32(vm, a->vm);
33
- if (a->o2) {
34
+ if (neg_n) {
35
/* VFNMS, VFMS */
36
gen_helper_vfp_negs(vn, vn);
37
}
38
neon_load_reg32(vd, a->vd);
39
- if (a->o1 & 1) {
40
+ if (neg_d) {
41
/* VFNMA, VFNMS */
42
gen_helper_vfp_negs(vd, vd);
43
}
44
@@ -XXX,XX +XXX,XX @@ static bool trans_VFM_sp(DisasContext *s, arg_VFM_sp *a)
45
return true;
46
}
47
48
-static bool trans_VFM_dp(DisasContext *s, arg_VFM_dp *a)
49
+static bool trans_VFMA_sp(DisasContext *s, arg_VFMA_sp *a)
50
+{
28
+{
51
+ return do_vfm_sp(s, a, false, false);
29
+ return scc_partno(s) == 0x524 || scc_partno(s) == 0x547;
52
+}
30
+}
53
+
31
+
54
+static bool trans_VFMS_sp(DisasContext *s, arg_VFMS_sp *a)
32
+/* Is CFG_REG3 present? */
33
+static bool have_cfg3(MPS2SCC *s)
55
+{
34
+{
56
+ return do_vfm_sp(s, a, true, false);
35
+ return scc_partno(s) != 0x524 && scc_partno(s) != 0x547;
57
+}
36
+}
58
+
37
+
59
+static bool trans_VFNMA_sp(DisasContext *s, arg_VFNMA_sp *a)
38
+/* Is CFG_REG5 present? */
39
+static bool have_cfg5(MPS2SCC *s)
60
+{
40
+{
61
+ return do_vfm_sp(s, a, false, true);
41
+ return scc_partno(s) == 0x524 || scc_partno(s) == 0x547;
62
+}
42
+}
63
+
43
+
64
+static bool trans_VFNMS_sp(DisasContext *s, arg_VFNMS_sp *a)
44
+/* Is CFG_REG6 present? */
45
+static bool have_cfg6(MPS2SCC *s)
65
+{
46
+{
66
+ return do_vfm_sp(s, a, true, true);
47
+ return scc_partno(s) == 0x524;
67
+}
48
+}
68
+
49
+
69
+static bool do_vfm_dp(DisasContext *s, arg_VFMA_dp *a, bool neg_n, bool neg_d)
50
/* Handle a write via the SYS_CFG channel to the specified function/device.
70
{
51
* Return false on error (reported to guest via SYS_CFGCTRL ERROR bit).
71
/*
52
*/
72
* VFNMA : fd = muladd(-fd, fn, fm)
53
@@ -XXX,XX +XXX,XX @@ static uint64_t mps2_scc_read(void *opaque, hwaddr offset, unsigned size)
73
@@ -XXX,XX +XXX,XX @@ static bool trans_VFM_dp(DisasContext *s, arg_VFM_dp *a)
54
r = s->cfg1;
74
55
break;
75
neon_load_reg64(vn, a->vn);
56
case A_CFG2:
76
neon_load_reg64(vm, a->vm);
57
- if (scc_partno(s) != 0x524 && scc_partno(s) != 0x547) {
77
- if (a->o2) {
58
- /* CFG2 reserved on other boards */
78
+ if (neg_n) {
59
+ if (!have_cfg2(s)) {
79
/* VFNMS, VFMS */
60
goto bad_offset;
80
gen_helper_vfp_negd(vn, vn);
61
}
81
}
62
r = s->cfg2;
82
neon_load_reg64(vd, a->vd);
63
break;
83
- if (a->o1 & 1) {
64
case A_CFG3:
84
+ if (neg_d) {
65
- if (scc_partno(s) == 0x524 || scc_partno(s) == 0x547) {
85
/* VFNMA, VFNMS */
66
- /* CFG3 reserved on AN524 */
86
gen_helper_vfp_negd(vd, vd);
67
+ if (!have_cfg3(s)) {
87
}
68
goto bad_offset;
88
@@ -XXX,XX +XXX,XX @@ static bool trans_VFM_dp(DisasContext *s, arg_VFM_dp *a)
69
}
89
return true;
70
/* These are user-settable DIP switches on the board. We don't
90
}
71
@@ -XXX,XX +XXX,XX @@ static uint64_t mps2_scc_read(void *opaque, hwaddr offset, unsigned size)
91
72
r = s->cfg4;
92
+static bool trans_VFMA_dp(DisasContext *s, arg_VFMA_dp *a)
73
break;
93
+{
74
case A_CFG5:
94
+ return do_vfm_dp(s, a, false, false);
75
- if (scc_partno(s) != 0x524 && scc_partno(s) != 0x547) {
95
+}
76
- /* CFG5 reserved on other boards */
96
+
77
+ if (!have_cfg5(s)) {
97
+static bool trans_VFMS_dp(DisasContext *s, arg_VFMS_dp *a)
78
goto bad_offset;
98
+{
79
}
99
+ return do_vfm_dp(s, a, true, false);
80
r = s->cfg5;
100
+}
81
break;
101
+
82
case A_CFG6:
102
+static bool trans_VFNMA_dp(DisasContext *s, arg_VFNMA_dp *a)
83
- if (scc_partno(s) != 0x524) {
103
+{
84
- /* CFG6 reserved on other boards */
104
+ return do_vfm_dp(s, a, false, true);
85
+ if (!have_cfg6(s)) {
105
+}
86
goto bad_offset;
106
+
87
}
107
+static bool trans_VFNMS_dp(DisasContext *s, arg_VFNMS_dp *a)
88
r = s->cfg6;
108
+{
89
@@ -XXX,XX +XXX,XX @@ static void mps2_scc_write(void *opaque, hwaddr offset, uint64_t value,
109
+ return do_vfm_dp(s, a, true, true);
90
}
110
+}
91
break;
111
+
92
case A_CFG2:
112
static bool trans_VMOV_imm_sp(DisasContext *s, arg_VMOV_imm_sp *a)
93
- if (scc_partno(s) != 0x524 && scc_partno(s) != 0x547) {
113
{
94
- /* CFG2 reserved on other boards */
114
uint32_t delta_d = 0;
95
+ if (!have_cfg2(s)) {
115
diff --git a/target/arm/vfp.decode b/target/arm/vfp.decode
96
goto bad_offset;
116
index XXXXXXX..XXXXXXX 100644
97
}
117
--- a/target/arm/vfp.decode
98
/* AN524: QSPI Select signal */
118
+++ b/target/arm/vfp.decode
99
s->cfg2 = value;
119
@@ -XXX,XX +XXX,XX @@ VSUB_dp ---- 1110 0.11 .... .... 1011 .1.0 .... @vfp_dnm_d
100
break;
120
VDIV_sp ---- 1110 1.00 .... .... 1010 .0.0 .... @vfp_dnm_s
101
case A_CFG5:
121
VDIV_dp ---- 1110 1.00 .... .... 1011 .0.0 .... @vfp_dnm_d
102
- if (scc_partno(s) != 0x524 && scc_partno(s) != 0x547) {
122
103
- /* CFG5 reserved on other boards */
123
-VFM_sp ---- 1110 1.01 .... .... 1010 . o2:1 . 0 .... \
104
+ if (!have_cfg5(s)) {
124
- vm=%vm_sp vn=%vn_sp vd=%vd_sp o1=1
105
goto bad_offset;
125
-VFM_dp ---- 1110 1.01 .... .... 1011 . o2:1 . 0 .... \
106
}
126
- vm=%vm_dp vn=%vn_dp vd=%vd_dp o1=1
107
/* AN524: ACLK frequency in Hz */
127
-VFM_sp ---- 1110 1.10 .... .... 1010 . o2:1 . 0 .... \
108
s->cfg5 = value;
128
- vm=%vm_sp vn=%vn_sp vd=%vd_sp o1=2
109
break;
129
-VFM_dp ---- 1110 1.10 .... .... 1011 . o2:1 . 0 .... \
110
case A_CFG6:
130
- vm=%vm_dp vn=%vn_dp vd=%vd_dp o1=2
111
- if (scc_partno(s) != 0x524) {
131
+VFMA_sp ---- 1110 1.10 .... .... 1010 .0. 0 .... @vfp_dnm_s
112
- /* CFG6 reserved on other boards */
132
+VFMS_sp ---- 1110 1.10 .... .... 1010 .1. 0 .... @vfp_dnm_s
113
+ if (!have_cfg6(s)) {
133
+VFNMA_sp ---- 1110 1.01 .... .... 1010 .0. 0 .... @vfp_dnm_s
114
goto bad_offset;
134
+VFNMS_sp ---- 1110 1.01 .... .... 1010 .1. 0 .... @vfp_dnm_s
115
}
135
+
116
/* AN524: Clock divider for BRAM */
136
+VFMA_dp ---- 1110 1.10 .... .... 1011 .0.0 .... @vfp_dnm_d
137
+VFMS_dp ---- 1110 1.10 .... .... 1011 .1.0 .... @vfp_dnm_d
138
+VFNMA_dp ---- 1110 1.01 .... .... 1011 .0.0 .... @vfp_dnm_d
139
+VFNMS_dp ---- 1110 1.01 .... .... 1011 .1.0 .... @vfp_dnm_d
140
141
VMOV_imm_sp ---- 1110 1.11 .... .... 1010 0000 .... \
142
vd=%vd_sp imm=%vmov_imm
143
--
117
--
144
2.20.1
118
2.34.1
145
119
146
120
diff view generated by jsdifflib
1
From: Guenter Roeck <linux@roeck-us.net>
1
The MPS2 SCC device is broadly the same for all FPGA images, but has
2
2
minor differences in the behaviour of the CFG registers depending on
3
Xilinx USB devices are now instantiated through TYPE_CHIPIDEA,
3
the image. In many cases we don't really care about the functionality
4
and xlnx support in the EHCI code is no longer needed.
4
controlled by these registers and a reads-as-written or similar
5
5
behaviour is sufficient for the moment.
6
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
6
7
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
7
For the AN536 the required behaviour is:
8
Message-id: 20200215122354.13706-3-linux@roeck-us.net
8
9
* A_CFG0 has CPU reset and halt bits
10
- implement as reads-as-written for the moment
11
* A_CFG1 has flash or ATCM address 0 remap handling
12
- QEMU doesn't model this; implement as reads-as-written
13
* A_CFG2 has QSPI select (like AN524)
14
- implemented (no behaviour, as with AN524)
15
* A_CFG3 is MCC_MSB_ADDR "additional MCC addressing bits"
16
- QEMU doesn't care about these, so use the existing
17
RAZ behaviour for convenience
18
* A_CFG4 is board rev (like all other images)
19
- no change needed
20
* A_CFG5 is ACLK frq in hz (like AN524)
21
- implemented as reads-as-written, as for other boards
22
* A_CFG6 is core 0 vector table base address
23
- implemented as reads-as-written for the moment
24
* A_CFG7 is core 1 vector table base address
25
- implemented as reads-as-written for the moment
26
27
Make the changes necessary for this; leave TODO comments where
28
appropriate to indicate where we might want to come back and
29
implement things like CPU reset.
30
31
The other aspects of the device specific to this FPGA image (like the
32
values of the board ID and similar registers) will be set via the
33
device's qdev properties.
34
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
35
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
36
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
37
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
38
Message-id: 20240206132931.38376-8-peter.maydell@linaro.org
10
---
39
---
11
hw/usb/hcd-ehci-sysbus.c | 17 -----------------
40
include/hw/misc/mps2-scc.h | 1 +
12
1 file changed, 17 deletions(-)
41
hw/misc/mps2-scc.c | 101 +++++++++++++++++++++++++++++++++----
13
42
2 files changed, 92 insertions(+), 10 deletions(-)
14
diff --git a/hw/usb/hcd-ehci-sysbus.c b/hw/usb/hcd-ehci-sysbus.c
43
44
diff --git a/include/hw/misc/mps2-scc.h b/include/hw/misc/mps2-scc.h
15
index XXXXXXX..XXXXXXX 100644
45
index XXXXXXX..XXXXXXX 100644
16
--- a/hw/usb/hcd-ehci-sysbus.c
46
--- a/include/hw/misc/mps2-scc.h
17
+++ b/hw/usb/hcd-ehci-sysbus.c
47
+++ b/include/hw/misc/mps2-scc.h
18
@@ -XXX,XX +XXX,XX @@ static const TypeInfo ehci_platform_type_info = {
48
@@ -XXX,XX +XXX,XX @@ struct MPS2SCC {
19
.class_init = ehci_platform_class_init,
49
uint32_t cfg4;
50
uint32_t cfg5;
51
uint32_t cfg6;
52
+ uint32_t cfg7;
53
uint32_t cfgdata_rtn;
54
uint32_t cfgdata_out;
55
uint32_t cfgctrl;
56
diff --git a/hw/misc/mps2-scc.c b/hw/misc/mps2-scc.c
57
index XXXXXXX..XXXXXXX 100644
58
--- a/hw/misc/mps2-scc.c
59
+++ b/hw/misc/mps2-scc.c
60
@@ -XXX,XX +XXX,XX @@ REG32(CFG3, 0xc)
61
REG32(CFG4, 0x10)
62
REG32(CFG5, 0x14)
63
REG32(CFG6, 0x18)
64
+REG32(CFG7, 0x1c)
65
REG32(CFGDATA_RTN, 0xa0)
66
REG32(CFGDATA_OUT, 0xa4)
67
REG32(CFGCTRL, 0xa8)
68
@@ -XXX,XX +XXX,XX @@ static int scc_partno(MPS2SCC *s)
69
/* Is CFG_REG2 present? */
70
static bool have_cfg2(MPS2SCC *s)
71
{
72
- return scc_partno(s) == 0x524 || scc_partno(s) == 0x547;
73
+ return scc_partno(s) == 0x524 || scc_partno(s) == 0x547 ||
74
+ scc_partno(s) == 0x536;
75
}
76
77
/* Is CFG_REG3 present? */
78
static bool have_cfg3(MPS2SCC *s)
79
{
80
- return scc_partno(s) != 0x524 && scc_partno(s) != 0x547;
81
+ return scc_partno(s) != 0x524 && scc_partno(s) != 0x547 &&
82
+ scc_partno(s) != 0x536;
83
}
84
85
/* Is CFG_REG5 present? */
86
static bool have_cfg5(MPS2SCC *s)
87
{
88
- return scc_partno(s) == 0x524 || scc_partno(s) == 0x547;
89
+ return scc_partno(s) == 0x524 || scc_partno(s) == 0x547 ||
90
+ scc_partno(s) == 0x536;
91
}
92
93
/* Is CFG_REG6 present? */
94
static bool have_cfg6(MPS2SCC *s)
95
{
96
- return scc_partno(s) == 0x524;
97
+ return scc_partno(s) == 0x524 || scc_partno(s) == 0x536;
98
+}
99
+
100
+/* Is CFG_REG7 present? */
101
+static bool have_cfg7(MPS2SCC *s)
102
+{
103
+ return scc_partno(s) == 0x536;
104
+}
105
+
106
+/* Does CFG_REG0 drive the 'remap' GPIO output? */
107
+static bool cfg0_is_remap(MPS2SCC *s)
108
+{
109
+ return scc_partno(s) != 0x536;
110
+}
111
+
112
+/* Is CFG_REG1 driving a set of LEDs? */
113
+static bool cfg1_is_leds(MPS2SCC *s)
114
+{
115
+ return scc_partno(s) != 0x536;
116
}
117
118
/* Handle a write via the SYS_CFG channel to the specified function/device.
119
@@ -XXX,XX +XXX,XX @@ static uint64_t mps2_scc_read(void *opaque, hwaddr offset, unsigned size)
120
if (!have_cfg3(s)) {
121
goto bad_offset;
122
}
123
- /* These are user-settable DIP switches on the board. We don't
124
+ /*
125
+ * These are user-settable DIP switches on the board. We don't
126
* model that, so just return zeroes.
127
+ *
128
+ * TODO: for AN536 this is MCC_MSB_ADDR "additional MCC addressing
129
+ * bits". These change which part of the DDR4 the motherboard
130
+ * configuration controller can see in its memory map (see the
131
+ * appnote section 2.4). QEMU doesn't model the MCC at all, so these
132
+ * bits are not interesting to us; read-as-zero is as good as anything
133
+ * else.
134
*/
135
r = 0;
136
break;
137
@@ -XXX,XX +XXX,XX @@ static uint64_t mps2_scc_read(void *opaque, hwaddr offset, unsigned size)
138
}
139
r = s->cfg6;
140
break;
141
+ case A_CFG7:
142
+ if (!have_cfg7(s)) {
143
+ goto bad_offset;
144
+ }
145
+ r = s->cfg7;
146
+ break;
147
case A_CFGDATA_RTN:
148
r = s->cfgdata_rtn;
149
break;
150
@@ -XXX,XX +XXX,XX @@ static void mps2_scc_write(void *opaque, hwaddr offset, uint64_t value,
151
* we always reflect bit 0 in the 'remap' GPIO output line,
152
* and let the board wire it up or not as it chooses.
153
* TODO on some boards bit 1 is CPU_WAIT.
154
+ *
155
+ * TODO: on the AN536 this register controls reset and halt
156
+ * for both CPUs. For the moment we don't implement this, so the
157
+ * register just reads as written.
158
*/
159
s->cfg0 = value;
160
- qemu_set_irq(s->remap, s->cfg0 & 1);
161
+ if (cfg0_is_remap(s)) {
162
+ qemu_set_irq(s->remap, s->cfg0 & 1);
163
+ }
164
break;
165
case A_CFG1:
166
s->cfg1 = value;
167
- for (size_t i = 0; i < ARRAY_SIZE(s->led); i++) {
168
- led_set_state(s->led[i], extract32(value, i, 1));
169
+ /*
170
+ * On most boards this register drives LEDs.
171
+ *
172
+ * TODO: for AN536 this controls whether flash and ATCM are
173
+ * enabled or disabled on reset. QEMU doesn't model this, and
174
+ * always wires up RAM in the ATCM area and ROM in the flash area.
175
+ */
176
+ if (cfg1_is_leds(s)) {
177
+ for (size_t i = 0; i < ARRAY_SIZE(s->led); i++) {
178
+ led_set_state(s->led[i], extract32(value, i, 1));
179
+ }
180
}
181
break;
182
case A_CFG2:
183
if (!have_cfg2(s)) {
184
goto bad_offset;
185
}
186
- /* AN524: QSPI Select signal */
187
+ /* AN524, AN536: QSPI Select signal */
188
s->cfg2 = value;
189
break;
190
case A_CFG5:
191
if (!have_cfg5(s)) {
192
goto bad_offset;
193
}
194
- /* AN524: ACLK frequency in Hz */
195
+ /* AN524, AN536: ACLK frequency in Hz */
196
s->cfg5 = value;
197
break;
198
case A_CFG6:
199
@@ -XXX,XX +XXX,XX @@ static void mps2_scc_write(void *opaque, hwaddr offset, uint64_t value,
200
goto bad_offset;
201
}
202
/* AN524: Clock divider for BRAM */
203
+ /* AN536: Core 0 vector table base address */
204
+ s->cfg6 = value;
205
+ break;
206
+ case A_CFG7:
207
+ if (!have_cfg7(s)) {
208
+ goto bad_offset;
209
+ }
210
+ /* AN536: Core 1 vector table base address */
211
s->cfg6 = value;
212
break;
213
case A_CFGDATA_OUT:
214
@@ -XXX,XX +XXX,XX @@ static void mps2_scc_finalize(Object *obj)
215
g_free(s->oscclk_reset);
216
}
217
218
+static bool cfg7_needed(void *opaque)
219
+{
220
+ MPS2SCC *s = opaque;
221
+
222
+ return have_cfg7(s);
223
+}
224
+
225
+static const VMStateDescription vmstate_cfg7 = {
226
+ .name = "mps2-scc/cfg7",
227
+ .version_id = 1,
228
+ .minimum_version_id = 1,
229
+ .needed = cfg7_needed,
230
+ .fields = (const VMStateField[]) {
231
+ VMSTATE_UINT32(cfg7, MPS2SCC),
232
+ VMSTATE_END_OF_LIST()
233
+ }
234
+};
235
+
236
static const VMStateDescription mps2_scc_vmstate = {
237
.name = "mps2-scc",
238
.version_id = 3,
239
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription mps2_scc_vmstate = {
240
VMSTATE_VARRAY_UINT32(oscclk, MPS2SCC, num_oscclk,
241
0, vmstate_info_uint32, uint32_t),
242
VMSTATE_END_OF_LIST()
243
+ },
244
+ .subsections = (const VMStateDescription * const []) {
245
+ &vmstate_cfg7,
246
+ NULL
247
}
20
};
248
};
21
249
22
-static void ehci_xlnx_class_init(ObjectClass *oc, void *data)
23
-{
24
- SysBusEHCIClass *sec = SYS_BUS_EHCI_CLASS(oc);
25
- DeviceClass *dc = DEVICE_CLASS(oc);
26
-
27
- set_bit(DEVICE_CATEGORY_USB, dc->categories);
28
- sec->capsbase = 0x100;
29
- sec->opregbase = 0x140;
30
-}
31
-
32
-static const TypeInfo ehci_xlnx_type_info = {
33
- .name = "xlnx,ps7-usb",
34
- .parent = TYPE_SYS_BUS_EHCI,
35
- .class_init = ehci_xlnx_class_init,
36
-};
37
-
38
static void ehci_exynos4210_class_init(ObjectClass *oc, void *data)
39
{
40
SysBusEHCIClass *sec = SYS_BUS_EHCI_CLASS(oc);
41
@@ -XXX,XX +XXX,XX @@ static void ehci_sysbus_register_types(void)
42
{
43
type_register_static(&ehci_type_info);
44
type_register_static(&ehci_platform_type_info);
45
- type_register_static(&ehci_xlnx_type_info);
46
type_register_static(&ehci_exynos4210_type_info);
47
type_register_static(&ehci_tegra2_type_info);
48
type_register_static(&ehci_ppc4xx_type_info);
49
--
250
--
50
2.20.1
251
2.34.1
51
252
52
253
diff view generated by jsdifflib
1
From: Thomas Huth <thuth@redhat.com>
1
The AN536 is another FPGA image for the MPS3 development board. Unlike
2
2
the existing FPGA images we already model, this board uses a Cortex-R
3
Old kernels from the Meego project can be used to check that Linux
3
family CPU, and it does not use any equivalent to the M-profile
4
is at least starting on these machines.
4
"Subsystem for Embedded" SoC-equivalent that we model in hw/arm/armsse.c.
5
5
It's therefore more convenient for us to model it as a completely
6
Signed-off-by: Thomas Huth <thuth@redhat.com>
6
separate C file.
7
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
7
8
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
8
This commit adds the basic skeleton of the board model, and the
9
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
9
code to create all the RAM and ROM. We assume that we're probably
10
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
10
going to want to add more images in future, so use the same
11
Message-id: 20200225172501.29609-2-philmd@redhat.com
11
base class/subclass setup that mps2-tz.c uses, even though at
12
Message-Id: <20200129131920.22302-1-thuth@redhat.com>
12
the moment there's only a single subclass.
13
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
13
14
Following commits will add the CPUs and the peripherals.
15
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
17
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
18
Message-id: 20240206132931.38376-9-peter.maydell@linaro.org
15
---
19
---
16
MAINTAINERS | 1 +
20
MAINTAINERS | 3 +-
17
tests/acceptance/machine_arm_n8x0.py | 49 ++++++++++++++++++++++++++++
21
configs/devices/arm-softmmu/default.mak | 1 +
18
2 files changed, 50 insertions(+)
22
hw/arm/mps3r.c | 239 ++++++++++++++++++++++++
19
create mode 100644 tests/acceptance/machine_arm_n8x0.py
23
hw/arm/Kconfig | 5 +
24
hw/arm/meson.build | 1 +
25
5 files changed, 248 insertions(+), 1 deletion(-)
26
create mode 100644 hw/arm/mps3r.c
20
27
21
diff --git a/MAINTAINERS b/MAINTAINERS
28
diff --git a/MAINTAINERS b/MAINTAINERS
22
index XXXXXXX..XXXXXXX 100644
29
index XXXXXXX..XXXXXXX 100644
23
--- a/MAINTAINERS
30
--- a/MAINTAINERS
24
+++ b/MAINTAINERS
31
+++ b/MAINTAINERS
25
@@ -XXX,XX +XXX,XX @@ F: hw/rtc/twl92230.c
32
@@ -XXX,XX +XXX,XX @@ F: include/hw/misc/imx7_*.h
26
F: include/hw/display/blizzard.h
33
F: hw/pci-host/designware.c
27
F: include/hw/input/tsc2xxx.h
34
F: include/hw/pci-host/designware.h
28
F: include/hw/misc/cbus.h
35
29
+F: tests/acceptance/machine_arm_n8x0.py
36
-MPS2
30
37
+MPS2 / MPS3
31
Palm
38
M: Peter Maydell <peter.maydell@linaro.org>
32
M: Andrzej Zaborowski <balrogg@gmail.com>
39
L: qemu-arm@nongnu.org
33
diff --git a/tests/acceptance/machine_arm_n8x0.py b/tests/acceptance/machine_arm_n8x0.py
40
S: Maintained
41
F: hw/arm/mps2.c
42
F: hw/arm/mps2-tz.c
43
+F: hw/arm/mps3r.c
44
F: hw/misc/mps2-*.c
45
F: include/hw/misc/mps2-*.h
46
F: hw/arm/armsse.c
47
diff --git a/configs/devices/arm-softmmu/default.mak b/configs/devices/arm-softmmu/default.mak
48
index XXXXXXX..XXXXXXX 100644
49
--- a/configs/devices/arm-softmmu/default.mak
50
+++ b/configs/devices/arm-softmmu/default.mak
51
@@ -XXX,XX +XXX,XX @@ CONFIG_ARM_VIRT=y
52
# CONFIG_INTEGRATOR=n
53
# CONFIG_FSL_IMX31=n
54
# CONFIG_MUSICPAL=n
55
+# CONFIG_MPS3R=n
56
# CONFIG_MUSCA=n
57
# CONFIG_CHEETAH=n
58
# CONFIG_SX1=n
59
diff --git a/hw/arm/mps3r.c b/hw/arm/mps3r.c
34
new file mode 100644
60
new file mode 100644
35
index XXXXXXX..XXXXXXX
61
index XXXXXXX..XXXXXXX
36
--- /dev/null
62
--- /dev/null
37
+++ b/tests/acceptance/machine_arm_n8x0.py
63
+++ b/hw/arm/mps3r.c
38
@@ -XXX,XX +XXX,XX @@
64
@@ -XXX,XX +XXX,XX @@
39
+# Functional test that boots a Linux kernel and checks the console
65
+/*
40
+#
66
+ * Arm MPS3 board emulation for Cortex-R-based FPGA images.
41
+# Copyright (c) 2020 Red Hat, Inc.
67
+ * (For M-profile images see mps2.c and mps2tz.c.)
42
+#
68
+ *
43
+# Author:
69
+ * Copyright (c) 2017 Linaro Limited
44
+# Thomas Huth <thuth@redhat.com>
70
+ * Written by Peter Maydell
45
+#
71
+ *
46
+# This work is licensed under the terms of the GNU GPL, version 2 or
72
+ * This program is free software; you can redistribute it and/or modify
47
+# later. See the COPYING file in the top-level directory.
73
+ * it under the terms of the GNU General Public License version 2 or
48
+
74
+ * (at your option) any later version.
49
+import os
75
+ */
50
+
76
+
51
+from avocado import skipUnless
77
+/*
52
+from avocado_qemu import Test
78
+ * The MPS3 is an FPGA based dev board. This file handles FPGA images
53
+from avocado_qemu import wait_for_console_pattern
79
+ * which use the Cortex-R CPUs. We model these separately from the
54
+
80
+ * M-profile images, because on M-profile the FPGA image is based on
55
+class N8x0Machine(Test):
81
+ * a "Subsystem for Embedded" which is similar to an SoC, whereas
56
+ """Boots the Linux kernel and checks that the console is operational"""
82
+ * the R-profile FPGA images don't have that abstraction layer.
57
+
83
+ *
58
+ timeout = 90
84
+ * We model the following FPGA images here:
59
+
85
+ * "mps3-an536" -- dual Cortex-R52 as documented in Arm Application Note AN536
60
+ def __do_test_n8x0(self):
86
+ *
61
+ kernel_url = ('http://stskeeps.subnetmask.net/meego-n8x0/'
87
+ * Application Note AN536:
62
+ 'meego-arm-n8x0-1.0.80.20100712.1431-'
88
+ * https://developer.arm.com/documentation/dai0536/latest/
63
+ 'vmlinuz-2.6.35~rc4-129.1-n8x0')
89
+ */
64
+ kernel_hash = 'e9d5ab8d7548923a0061b6fbf601465e479ed269'
90
+
65
+ kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
91
+#include "qemu/osdep.h"
66
+
92
+#include "qemu/units.h"
67
+ self.vm.set_console(console_index=1)
93
+#include "qapi/error.h"
68
+ self.vm.add_args('-kernel', kernel_path,
94
+#include "exec/address-spaces.h"
69
+ '-append', 'printk.time=0 console=ttyS1')
95
+#include "cpu.h"
70
+ self.vm.launch()
96
+#include "hw/boards.h"
71
+ wait_for_console_pattern(self, 'TSC2005 driver initializing')
97
+#include "hw/arm/boot.h"
72
+
98
+
73
+ @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
99
+/* Define the layout of RAM and ROM in a board */
74
+ def test_n800(self):
100
+typedef struct RAMInfo {
75
+ """
101
+ const char *name;
76
+ :avocado: tags=arch:arm
102
+ hwaddr base;
77
+ :avocado: tags=machine:n800
103
+ hwaddr size;
78
+ """
104
+ int mrindex; /* index into rams[]; -1 for the system RAM block */
79
+ self.__do_test_n8x0()
105
+ int flags;
80
+
106
+} RAMInfo;
81
+ @skipUnless(os.getenv('AVOCADO_ALLOW_UNTRUSTED_CODE'), 'untrusted code')
107
+
82
+ def test_n810(self):
108
+/*
83
+ """
109
+ * The MPS3 DDR is 3GiB, but on a 32-bit host QEMU doesn't permit
84
+ :avocado: tags=arch:arm
110
+ * emulation of that much guest RAM, so artificially make it smaller.
85
+ :avocado: tags=machine:n810
111
+ */
86
+ """
112
+#if HOST_LONG_BITS == 32
87
+ self.__do_test_n8x0()
113
+#define MPS3_DDR_SIZE (1 * GiB)
114
+#else
115
+#define MPS3_DDR_SIZE (3 * GiB)
116
+#endif
117
+
118
+/*
119
+ * Flag values:
120
+ * IS_MAIN: this is the main machine RAM
121
+ * IS_ROM: this area is read-only
122
+ */
123
+#define IS_MAIN 1
124
+#define IS_ROM 2
125
+
126
+#define MPS3R_RAM_MAX 9
127
+
128
+typedef enum MPS3RFPGAType {
129
+ FPGA_AN536,
130
+} MPS3RFPGAType;
131
+
132
+struct MPS3RMachineClass {
133
+ MachineClass parent;
134
+ MPS3RFPGAType fpga_type;
135
+ const RAMInfo *raminfo;
136
+};
137
+
138
+struct MPS3RMachineState {
139
+ MachineState parent;
140
+ MemoryRegion ram[MPS3R_RAM_MAX];
141
+};
142
+
143
+#define TYPE_MPS3R_MACHINE "mps3r"
144
+#define TYPE_MPS3R_AN536_MACHINE MACHINE_TYPE_NAME("mps3-an536")
145
+
146
+OBJECT_DECLARE_TYPE(MPS3RMachineState, MPS3RMachineClass, MPS3R_MACHINE)
147
+
148
+static const RAMInfo an536_raminfo[] = {
149
+ {
150
+ .name = "ATCM",
151
+ .base = 0x00000000,
152
+ .size = 0x00008000,
153
+ .mrindex = 0,
154
+ }, {
155
+ /* We model the QSPI flash as simple ROM for now */
156
+ .name = "QSPI",
157
+ .base = 0x08000000,
158
+ .size = 0x00800000,
159
+ .flags = IS_ROM,
160
+ .mrindex = 1,
161
+ }, {
162
+ .name = "BRAM",
163
+ .base = 0x10000000,
164
+ .size = 0x00080000,
165
+ .mrindex = 2,
166
+ }, {
167
+ .name = "DDR",
168
+ .base = 0x20000000,
169
+ .size = MPS3_DDR_SIZE,
170
+ .mrindex = -1,
171
+ }, {
172
+ .name = "ATCM0",
173
+ .base = 0xee000000,
174
+ .size = 0x00008000,
175
+ .mrindex = 3,
176
+ }, {
177
+ .name = "BTCM0",
178
+ .base = 0xee100000,
179
+ .size = 0x00008000,
180
+ .mrindex = 4,
181
+ }, {
182
+ .name = "CTCM0",
183
+ .base = 0xee200000,
184
+ .size = 0x00008000,
185
+ .mrindex = 5,
186
+ }, {
187
+ .name = "ATCM1",
188
+ .base = 0xee400000,
189
+ .size = 0x00008000,
190
+ .mrindex = 6,
191
+ }, {
192
+ .name = "BTCM1",
193
+ .base = 0xee500000,
194
+ .size = 0x00008000,
195
+ .mrindex = 7,
196
+ }, {
197
+ .name = "CTCM1",
198
+ .base = 0xee600000,
199
+ .size = 0x00008000,
200
+ .mrindex = 8,
201
+ }, {
202
+ .name = NULL,
203
+ }
204
+};
205
+
206
+static MemoryRegion *mr_for_raminfo(MPS3RMachineState *mms,
207
+ const RAMInfo *raminfo)
208
+{
209
+ /* Return an initialized MemoryRegion for the RAMInfo. */
210
+ MemoryRegion *ram;
211
+
212
+ if (raminfo->mrindex < 0) {
213
+ /* Means this RAMInfo is for QEMU's "system memory" */
214
+ MachineState *machine = MACHINE(mms);
215
+ assert(!(raminfo->flags & IS_ROM));
216
+ return machine->ram;
217
+ }
218
+
219
+ assert(raminfo->mrindex < MPS3R_RAM_MAX);
220
+ ram = &mms->ram[raminfo->mrindex];
221
+
222
+ memory_region_init_ram(ram, NULL, raminfo->name,
223
+ raminfo->size, &error_fatal);
224
+ if (raminfo->flags & IS_ROM) {
225
+ memory_region_set_readonly(ram, true);
226
+ }
227
+ return ram;
228
+}
229
+
230
+static void mps3r_common_init(MachineState *machine)
231
+{
232
+ MPS3RMachineState *mms = MPS3R_MACHINE(machine);
233
+ MPS3RMachineClass *mmc = MPS3R_MACHINE_GET_CLASS(mms);
234
+ MemoryRegion *sysmem = get_system_memory();
235
+
236
+ for (const RAMInfo *ri = mmc->raminfo; ri->name; ri++) {
237
+ MemoryRegion *mr = mr_for_raminfo(mms, ri);
238
+ memory_region_add_subregion(sysmem, ri->base, mr);
239
+ }
240
+}
241
+
242
+static void mps3r_set_default_ram_info(MPS3RMachineClass *mmc)
243
+{
244
+ /*
245
+ * Set mc->default_ram_size and default_ram_id from the
246
+ * information in mmc->raminfo.
247
+ */
248
+ MachineClass *mc = MACHINE_CLASS(mmc);
249
+ const RAMInfo *p;
250
+
251
+ for (p = mmc->raminfo; p->name; p++) {
252
+ if (p->mrindex < 0) {
253
+ /* Found the entry for "system memory" */
254
+ mc->default_ram_size = p->size;
255
+ mc->default_ram_id = p->name;
256
+ return;
257
+ }
258
+ }
259
+ g_assert_not_reached();
260
+}
261
+
262
+static void mps3r_class_init(ObjectClass *oc, void *data)
263
+{
264
+ MachineClass *mc = MACHINE_CLASS(oc);
265
+
266
+ mc->init = mps3r_common_init;
267
+}
268
+
269
+static void mps3r_an536_class_init(ObjectClass *oc, void *data)
270
+{
271
+ MachineClass *mc = MACHINE_CLASS(oc);
272
+ MPS3RMachineClass *mmc = MPS3R_MACHINE_CLASS(oc);
273
+ static const char * const valid_cpu_types[] = {
274
+ ARM_CPU_TYPE_NAME("cortex-r52"),
275
+ NULL
276
+ };
277
+
278
+ mc->desc = "ARM MPS3 with AN536 FPGA image for Cortex-R52";
279
+ mc->default_cpus = 2;
280
+ mc->min_cpus = mc->default_cpus;
281
+ mc->max_cpus = mc->default_cpus;
282
+ mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-r52");
283
+ mc->valid_cpu_types = valid_cpu_types;
284
+ mmc->raminfo = an536_raminfo;
285
+ mps3r_set_default_ram_info(mmc);
286
+}
287
+
288
+static const TypeInfo mps3r_machine_types[] = {
289
+ {
290
+ .name = TYPE_MPS3R_MACHINE,
291
+ .parent = TYPE_MACHINE,
292
+ .abstract = true,
293
+ .instance_size = sizeof(MPS3RMachineState),
294
+ .class_size = sizeof(MPS3RMachineClass),
295
+ .class_init = mps3r_class_init,
296
+ }, {
297
+ .name = TYPE_MPS3R_AN536_MACHINE,
298
+ .parent = TYPE_MPS3R_MACHINE,
299
+ .class_init = mps3r_an536_class_init,
300
+ },
301
+};
302
+
303
+DEFINE_TYPES(mps3r_machine_types);
304
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
305
index XXXXXXX..XXXXXXX 100644
306
--- a/hw/arm/Kconfig
307
+++ b/hw/arm/Kconfig
308
@@ -XXX,XX +XXX,XX @@ config MAINSTONE
309
select PFLASH_CFI01
310
select SMC91C111
311
312
+config MPS3R
313
+ bool
314
+ default y
315
+ depends on TCG && ARM
316
+
317
config MUSCA
318
bool
319
default y
320
diff --git a/hw/arm/meson.build b/hw/arm/meson.build
321
index XXXXXXX..XXXXXXX 100644
322
--- a/hw/arm/meson.build
323
+++ b/hw/arm/meson.build
324
@@ -XXX,XX +XXX,XX @@ arm_ss.add(when: 'CONFIG_HIGHBANK', if_true: files('highbank.c'))
325
arm_ss.add(when: 'CONFIG_INTEGRATOR', if_true: files('integratorcp.c'))
326
arm_ss.add(when: 'CONFIG_MAINSTONE', if_true: files('mainstone.c'))
327
arm_ss.add(when: 'CONFIG_MICROBIT', if_true: files('microbit.c'))
328
+arm_ss.add(when: 'CONFIG_MPS3R', if_true: files('mps3r.c'))
329
arm_ss.add(when: 'CONFIG_MUSICPAL', if_true: files('musicpal.c'))
330
arm_ss.add(when: 'CONFIG_NETDUINOPLUS2', if_true: files('netduinoplus2.c'))
331
arm_ss.add(when: 'CONFIG_OLIMEX_STM32_H405', if_true: files('olimex-stm32-h405.c'))
88
--
332
--
89
2.20.1
333
2.34.1
90
334
91
335
diff view generated by jsdifflib
1
From: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com>
1
Create the CPUs, the GIC, and the per-CPU RAM block for
2
the mps3-an536 board.
2
3
3
The GICv2 allows the implementation to implement a variable number
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
of priority bits; unimplemented bits in the priority registers
5
Message-id: 20240206132931.38376-10-peter.maydell@linaro.org
5
are read as zeros, writes ignored. We were previously always
6
---
6
implementing a full 8 bits of priority, which is allowed but not
7
hw/arm/mps3r.c | 180 ++++++++++++++++++++++++++++++++++++++++++++++++-
7
what the real hardware typically does (which is usually to have
8
1 file changed, 177 insertions(+), 3 deletions(-)
8
4 or 5 bits of priority).
9
9
10
Add a new device property to allow the number of implemented
10
diff --git a/hw/arm/mps3r.c b/hw/arm/mps3r.c
11
property bits to be specified.
12
13
Signed-off-by: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com>
14
Message-id: 1582537164-764-2-git-send-email-sai.pavan.boddu@xilinx.com
15
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
16
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
17
[PMM: improved commit message]
18
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
19
---
20
include/hw/intc/arm_gic.h | 2 ++
21
include/hw/intc/arm_gic_common.h | 1 +
22
hw/intc/arm_gic.c | 33 ++++++++++++++++++++++++++++++--
23
hw/intc/arm_gic_common.c | 1 +
24
4 files changed, 35 insertions(+), 2 deletions(-)
25
26
diff --git a/include/hw/intc/arm_gic.h b/include/hw/intc/arm_gic.h
27
index XXXXXXX..XXXXXXX 100644
11
index XXXXXXX..XXXXXXX 100644
28
--- a/include/hw/intc/arm_gic.h
12
--- a/hw/arm/mps3r.c
29
+++ b/include/hw/intc/arm_gic.h
13
+++ b/hw/arm/mps3r.c
30
@@ -XXX,XX +XXX,XX @@
14
@@ -XXX,XX +XXX,XX @@
31
15
#include "qemu/osdep.h"
32
/* Number of SGI target-list bits */
16
#include "qemu/units.h"
33
#define GIC_TARGETLIST_BITS 8
17
#include "qapi/error.h"
34
+#define GIC_MAX_PRIORITY_BITS 8
18
+#include "qapi/qmp/qlist.h"
35
+#define GIC_MIN_PRIORITY_BITS 4
19
#include "exec/address-spaces.h"
36
20
#include "cpu.h"
37
#define TYPE_ARM_GIC "arm_gic"
21
#include "hw/boards.h"
38
#define ARM_GIC(obj) \
22
+#include "hw/qdev-properties.h"
39
diff --git a/include/hw/intc/arm_gic_common.h b/include/hw/intc/arm_gic_common.h
23
#include "hw/arm/boot.h"
40
index XXXXXXX..XXXXXXX 100644
24
+#include "hw/arm/bsa.h"
41
--- a/include/hw/intc/arm_gic_common.h
25
+#include "hw/intc/arm_gicv3.h"
42
+++ b/include/hw/intc/arm_gic_common.h
26
43
@@ -XXX,XX +XXX,XX @@ typedef struct GICState {
27
/* Define the layout of RAM and ROM in a board */
44
uint16_t priority_mask[GIC_NCPU_VCPU];
28
typedef struct RAMInfo {
45
uint16_t running_priority[GIC_NCPU_VCPU];
29
@@ -XXX,XX +XXX,XX @@ typedef struct RAMInfo {
46
uint16_t current_pending[GIC_NCPU_VCPU];
30
#define IS_ROM 2
47
+ uint32_t n_prio_bits;
31
48
32
#define MPS3R_RAM_MAX 9
49
/* If we present the GICv2 without security extensions to a guest,
33
+#define MPS3R_CPU_MAX 2
50
* the guest can configure the GICC_CTLR to configure group 1 binary point
34
+
51
diff --git a/hw/intc/arm_gic.c b/hw/intc/arm_gic.c
35
+#define PERIPHBASE 0xf0000000
52
index XXXXXXX..XXXXXXX 100644
36
+#define NUM_SPIS 96
53
--- a/hw/intc/arm_gic.c
37
54
+++ b/hw/intc/arm_gic.c
38
typedef enum MPS3RFPGAType {
55
@@ -XXX,XX +XXX,XX @@ uint32_t gic_acknowledge_irq(GICState *s, int cpu, MemTxAttrs attrs)
39
FPGA_AN536,
56
return ret;
40
@@ -XXX,XX +XXX,XX @@ struct MPS3RMachineClass {
41
MachineClass parent;
42
MPS3RFPGAType fpga_type;
43
const RAMInfo *raminfo;
44
+ hwaddr loader_start;
45
};
46
47
struct MPS3RMachineState {
48
MachineState parent;
49
+ struct arm_boot_info bootinfo;
50
MemoryRegion ram[MPS3R_RAM_MAX];
51
+ Object *cpu[MPS3R_CPU_MAX];
52
+ MemoryRegion cpu_sysmem[MPS3R_CPU_MAX];
53
+ MemoryRegion sysmem_alias[MPS3R_CPU_MAX];
54
+ MemoryRegion cpu_ram[MPS3R_CPU_MAX];
55
+ GICv3State gic;
56
};
57
58
#define TYPE_MPS3R_MACHINE "mps3r"
59
@@ -XXX,XX +XXX,XX @@ static MemoryRegion *mr_for_raminfo(MPS3RMachineState *mms,
60
return ram;
57
}
61
}
58
62
59
+static uint32_t gic_fullprio_mask(GICState *s, int cpu)
63
+/*
64
+ * There is no defined secondary boot protocol for Linux for the AN536,
65
+ * because real hardware has a restriction that atomic operations between
66
+ * the two CPUs do not function correctly, and so true SMP is not
67
+ * possible. Therefore for cases where the user is directly booting
68
+ * a kernel, we treat the system as essentially uniprocessor, and
69
+ * put the secondary CPU into power-off state (as if the user on the
70
+ * real hardware had configured the secondary to be halted via the
71
+ * SCC config registers).
72
+ *
73
+ * Note that the default secondary boot code would not work here anyway
74
+ * as it assumes a GICv2, and we have a GICv3.
75
+ */
76
+static void mps3r_write_secondary_boot(ARMCPU *cpu,
77
+ const struct arm_boot_info *info)
60
+{
78
+{
61
+ /*
79
+ /*
62
+ * Return a mask word which clears the unimplemented priority
80
+ * Power the secondary CPU off. This means we don't need to write any
63
+ * bits from a priority value for an interrupt. (Not to be
81
+ * boot code into guest memory. Note that the 'cpu' argument to this
64
+ * confused with the group priority, whose mask depends on BPR.)
82
+ * function is the primary CPU we passed to arm_load_kernel(), not
83
+ * the secondary. Loop around all the other CPUs, as the boot.c
84
+ * code does for the "disable secondaries if PSCI is enabled" case.
65
+ */
85
+ */
66
+ int priBits;
86
+ for (CPUState *cs = first_cpu; cs; cs = CPU_NEXT(cs)) {
67
+
87
+ if (cs != first_cpu) {
68
+ if (gic_is_vcpu(cpu)) {
88
+ object_property_set_bool(OBJECT(cs), "start-powered-off", true,
69
+ priBits = GIC_VIRT_MAX_GROUP_PRIO_BITS;
89
+ &error_abort);
70
+ } else {
90
+ }
71
+ priBits = s->n_prio_bits;
72
+ }
91
+ }
73
+ return ~0U << (8 - priBits);
74
+}
92
+}
75
+
93
+
76
void gic_dist_set_priority(GICState *s, int cpu, int irq, uint8_t val,
94
+static void mps3r_secondary_cpu_reset(ARMCPU *cpu,
77
MemTxAttrs attrs)
95
+ const struct arm_boot_info *info)
96
+{
97
+ /* We don't need to do anything here because the CPU will be off */
98
+}
99
+
100
+static void create_gic(MPS3RMachineState *mms, MemoryRegion *sysmem)
101
+{
102
+ MachineState *machine = MACHINE(mms);
103
+ DeviceState *gicdev;
104
+ QList *redist_region_count;
105
+
106
+ object_initialize_child(OBJECT(mms), "gic", &mms->gic, TYPE_ARM_GICV3);
107
+ gicdev = DEVICE(&mms->gic);
108
+ qdev_prop_set_uint32(gicdev, "num-cpu", machine->smp.cpus);
109
+ qdev_prop_set_uint32(gicdev, "num-irq", NUM_SPIS + GIC_INTERNAL);
110
+ redist_region_count = qlist_new();
111
+ qlist_append_int(redist_region_count, machine->smp.cpus);
112
+ qdev_prop_set_array(gicdev, "redist-region-count", redist_region_count);
113
+ object_property_set_link(OBJECT(&mms->gic), "sysmem",
114
+ OBJECT(sysmem), &error_fatal);
115
+ sysbus_realize(SYS_BUS_DEVICE(&mms->gic), &error_fatal);
116
+ sysbus_mmio_map(SYS_BUS_DEVICE(&mms->gic), 0, PERIPHBASE);
117
+ sysbus_mmio_map(SYS_BUS_DEVICE(&mms->gic), 1, PERIPHBASE + 0x100000);
118
+ /*
119
+ * Wire the outputs from each CPU's generic timer and the GICv3
120
+ * maintenance interrupt signal to the appropriate GIC PPI inputs,
121
+ * and the GIC's IRQ/FIQ/VIRQ/VFIQ interrupt outputs to the CPU's inputs.
122
+ */
123
+ for (int i = 0; i < machine->smp.cpus; i++) {
124
+ DeviceState *cpudev = DEVICE(mms->cpu[i]);
125
+ SysBusDevice *gicsbd = SYS_BUS_DEVICE(&mms->gic);
126
+ int intidbase = NUM_SPIS + i * GIC_INTERNAL;
127
+ int irq;
128
+ /*
129
+ * Mapping from the output timer irq lines from the CPU to the
130
+ * GIC PPI inputs used for this board. This isn't a BSA board,
131
+ * but it uses the standard convention for the PPI numbers.
132
+ */
133
+ const int timer_irq[] = {
134
+ [GTIMER_PHYS] = ARCH_TIMER_NS_EL1_IRQ,
135
+ [GTIMER_VIRT] = ARCH_TIMER_VIRT_IRQ,
136
+ [GTIMER_HYP] = ARCH_TIMER_NS_EL2_IRQ,
137
+ };
138
+
139
+ for (irq = 0; irq < ARRAY_SIZE(timer_irq); irq++) {
140
+ qdev_connect_gpio_out(cpudev, irq,
141
+ qdev_get_gpio_in(gicdev,
142
+ intidbase + timer_irq[irq]));
143
+ }
144
+
145
+ qdev_connect_gpio_out_named(cpudev, "gicv3-maintenance-interrupt", 0,
146
+ qdev_get_gpio_in(gicdev,
147
+ intidbase + ARCH_GIC_MAINT_IRQ));
148
+
149
+ qdev_connect_gpio_out_named(cpudev, "pmu-interrupt", 0,
150
+ qdev_get_gpio_in(gicdev,
151
+ intidbase + VIRTUAL_PMU_IRQ));
152
+
153
+ sysbus_connect_irq(gicsbd, i,
154
+ qdev_get_gpio_in(cpudev, ARM_CPU_IRQ));
155
+ sysbus_connect_irq(gicsbd, i + machine->smp.cpus,
156
+ qdev_get_gpio_in(cpudev, ARM_CPU_FIQ));
157
+ sysbus_connect_irq(gicsbd, i + 2 * machine->smp.cpus,
158
+ qdev_get_gpio_in(cpudev, ARM_CPU_VIRQ));
159
+ sysbus_connect_irq(gicsbd, i + 3 * machine->smp.cpus,
160
+ qdev_get_gpio_in(cpudev, ARM_CPU_VFIQ));
161
+ }
162
+}
163
+
164
static void mps3r_common_init(MachineState *machine)
78
{
165
{
79
@@ -XXX,XX +XXX,XX @@ void gic_dist_set_priority(GICState *s, int cpu, int irq, uint8_t val,
166
MPS3RMachineState *mms = MPS3R_MACHINE(machine);
80
val = 0x80 | (val >> 1); /* Non-secure view */
167
@@ -XXX,XX +XXX,XX @@ static void mps3r_common_init(MachineState *machine)
168
MemoryRegion *mr = mr_for_raminfo(mms, ri);
169
memory_region_add_subregion(sysmem, ri->base, mr);
81
}
170
}
82
171
+
83
+ val &= gic_fullprio_mask(s, cpu);
172
+ assert(machine->smp.cpus <= MPS3R_CPU_MAX);
84
+
173
+ for (int i = 0; i < machine->smp.cpus; i++) {
85
if (irq < GIC_INTERNAL) {
174
+ g_autofree char *sysmem_name = g_strdup_printf("cpu-%d-memory", i);
86
s->priority1[irq][cpu] = val;
175
+ g_autofree char *ramname = g_strdup_printf("cpu-%d-memory", i);
87
} else {
176
+ g_autofree char *alias_name = g_strdup_printf("sysmem-alias-%d", i);
88
@@ -XXX,XX +XXX,XX @@ static uint32_t gic_dist_get_priority(GICState *s, int cpu, int irq,
177
+
89
}
178
+ /*
90
prio = (prio << 1) & 0xff; /* Non-secure view */
179
+ * Each CPU has some private RAM/peripherals, so create the container
91
}
180
+ * which will house those, with the whole-machine system memory being
92
- return prio;
181
+ * used where there's no CPU-specific device. Note that we need the
93
+ return prio & gic_fullprio_mask(s, cpu);
182
+ * sysmem_alias aliases because we can't put one MR (the original
183
+ * 'sysmem') into more than one other MR.
184
+ */
185
+ memory_region_init(&mms->cpu_sysmem[i], OBJECT(machine),
186
+ sysmem_name, UINT64_MAX);
187
+ memory_region_init_alias(&mms->sysmem_alias[i], OBJECT(machine),
188
+ alias_name, sysmem, 0, UINT64_MAX);
189
+ memory_region_add_subregion_overlap(&mms->cpu_sysmem[i], 0,
190
+ &mms->sysmem_alias[i], -1);
191
+
192
+ mms->cpu[i] = object_new(machine->cpu_type);
193
+ object_property_set_link(mms->cpu[i], "memory",
194
+ OBJECT(&mms->cpu_sysmem[i]), &error_abort);
195
+ object_property_set_int(mms->cpu[i], "reset-cbar",
196
+ PERIPHBASE, &error_abort);
197
+ qdev_realize(DEVICE(mms->cpu[i]), NULL, &error_fatal);
198
+ object_unref(mms->cpu[i]);
199
+
200
+ /* Per-CPU RAM */
201
+ memory_region_init_ram(&mms->cpu_ram[i], NULL, ramname,
202
+ 0x1000, &error_fatal);
203
+ memory_region_add_subregion(&mms->cpu_sysmem[i], 0xe7c01000,
204
+ &mms->cpu_ram[i]);
205
+ }
206
+
207
+ create_gic(mms, sysmem);
208
+
209
+ mms->bootinfo.ram_size = machine->ram_size;
210
+ mms->bootinfo.board_id = -1;
211
+ mms->bootinfo.loader_start = mmc->loader_start;
212
+ mms->bootinfo.write_secondary_boot = mps3r_write_secondary_boot;
213
+ mms->bootinfo.secondary_cpu_reset_hook = mps3r_secondary_cpu_reset;
214
+ arm_load_kernel(ARM_CPU(mms->cpu[0]), machine, &mms->bootinfo);
94
}
215
}
95
216
96
static void gic_set_priority_mask(GICState *s, int cpu, uint8_t pmask,
217
static void mps3r_set_default_ram_info(MPS3RMachineClass *mmc)
97
@@ -XXX,XX +XXX,XX @@ static void gic_set_priority_mask(GICState *s, int cpu, uint8_t pmask,
218
@@ -XXX,XX +XXX,XX @@ static void mps3r_set_default_ram_info(MPS3RMachineClass *mmc)
219
/* Found the entry for "system memory" */
220
mc->default_ram_size = p->size;
221
mc->default_ram_id = p->name;
222
+ mmc->loader_start = p->base;
98
return;
223
return;
99
}
224
}
100
}
225
}
101
- s->priority_mask[cpu] = pmask;
226
@@ -XXX,XX +XXX,XX @@ static void mps3r_an536_class_init(ObjectClass *oc, void *data)
102
+ s->priority_mask[cpu] = pmask & gic_fullprio_mask(s, cpu);
227
};
103
}
228
104
229
mc->desc = "ARM MPS3 with AN536 FPGA image for Cortex-R52";
105
static uint32_t gic_get_priority_mask(GICState *s, int cpu, MemTxAttrs attrs)
230
- mc->default_cpus = 2;
106
@@ -XXX,XX +XXX,XX @@ static void arm_gic_realize(DeviceState *dev, Error **errp)
231
- mc->min_cpus = mc->default_cpus;
107
return;
232
- mc->max_cpus = mc->default_cpus;
108
}
233
+ /*
109
234
+ * In the real FPGA image there are always two cores, but the standard
110
+ if (s->n_prio_bits > GIC_MAX_PRIORITY_BITS ||
235
+ * initial setting for the SCC SYSCON 0x000 register is 0x21, meaning
111
+ (s->virt_extn ? s->n_prio_bits < GIC_VIRT_MAX_GROUP_PRIO_BITS :
236
+ * that the second core is held in reset and halted. Many images built for
112
+ s->n_prio_bits < GIC_MIN_PRIORITY_BITS)) {
237
+ * the board do not expect the second core to run at startup (especially
113
+ error_setg(errp, "num-priority-bits cannot be greater than %d"
238
+ * since on the real FPGA image it is not possible to use LDREX/STREX
114
+ " or less than %d", GIC_MAX_PRIORITY_BITS,
239
+ * in RAM between the two cores, so a true SMP setup isn't supported).
115
+ s->virt_extn ? GIC_VIRT_MAX_GROUP_PRIO_BITS :
240
+ *
116
+ GIC_MIN_PRIORITY_BITS);
241
+ * As QEMU's equivalent of this, we support both -smp 1 and -smp 2,
117
+ return;
242
+ * with the default being -smp 1. This seems a more intuitive UI for
118
+ }
243
+ * QEMU users than, for instance, having a machine property to allow
119
+
244
+ * the user to set the initial value of the SYSCON 0x000 register.
120
/* This creates distributor, main CPU interface (s->cpuiomem[0]) and if
245
+ */
121
* enabled, virtualization extensions related interfaces (main virtual
246
+ mc->default_cpus = 1;
122
* interface (s->vifaceiomem[0]) and virtual CPU interface).
247
+ mc->min_cpus = 1;
123
diff --git a/hw/intc/arm_gic_common.c b/hw/intc/arm_gic_common.c
248
+ mc->max_cpus = 2;
124
index XXXXXXX..XXXXXXX 100644
249
mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-r52");
125
--- a/hw/intc/arm_gic_common.c
250
mc->valid_cpu_types = valid_cpu_types;
126
+++ b/hw/intc/arm_gic_common.c
251
mmc->raminfo = an536_raminfo;
127
@@ -XXX,XX +XXX,XX @@ static Property arm_gic_common_properties[] = {
128
DEFINE_PROP_BOOL("has-security-extensions", GICState, security_extn, 0),
129
/* True if the GIC should implement the virtualization extensions */
130
DEFINE_PROP_BOOL("has-virtualization-extensions", GICState, virt_extn, 0),
131
+ DEFINE_PROP_UINT32("num-priority-bits", GICState, n_prio_bits, 8),
132
DEFINE_PROP_END_OF_LIST(),
133
};
134
135
--
252
--
136
2.20.1
253
2.34.1
137
138
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
This board has a lot of UARTs: there is one UART per CPU in the
2
per-CPU peripheral part of the address map, whose interrupts are
3
connected as per-CPU interrupt lines. Then there are 4 UARTs in the
4
normal part of the peripheral space, whose interrupts are shared
5
peripheral interrupts.
2
6
3
All remaining tests for VFP4 are for fused multiply-add insns.
7
Connect and wire them all up; this involves some OR gates where
8
multiple overflow interrupts are wired into one GIC input.
4
9
5
Since the MVFR1 field is used for both VFP and NEON, move its adjustment
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
from the !has_neon block to the (!has_vfp && !has_neon) block.
11
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
12
Message-id: 20240206132931.38376-11-peter.maydell@linaro.org
13
---
14
hw/arm/mps3r.c | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++
15
1 file changed, 94 insertions(+)
7
16
8
Test for vfp of the appropraite width alongside the test for simdfmac
17
diff --git a/hw/arm/mps3r.c b/hw/arm/mps3r.c
9
within translate-vfp.inc.c. Within disas_neon_data_insn, we have
10
already tested for ARM_FEATURE_NEON.
11
12
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
13
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
14
Message-id: 20200224222232.13807-10-richard.henderson@linaro.org
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
---
17
target/arm/cpu.h | 12 ++++++++++++
18
target/arm/cpu.c | 6 +++++-
19
target/arm/translate-vfp.inc.c | 22 ++++++++++++++++++----
20
target/arm/translate.c | 2 +-
21
4 files changed, 36 insertions(+), 6 deletions(-)
22
23
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
24
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
25
--- a/target/arm/cpu.h
19
--- a/hw/arm/mps3r.c
26
+++ b/target/arm/cpu.h
20
+++ b/hw/arm/mps3r.c
27
@@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa32_fp16_dpconv(const ARMISARegisters *id)
21
@@ -XXX,XX +XXX,XX @@
28
return FIELD_EX32(id->mvfr1, MVFR1, FPHP) > 1;
22
#include "qapi/qmp/qlist.h"
23
#include "exec/address-spaces.h"
24
#include "cpu.h"
25
+#include "sysemu/sysemu.h"
26
#include "hw/boards.h"
27
+#include "hw/or-irq.h"
28
#include "hw/qdev-properties.h"
29
#include "hw/arm/boot.h"
30
#include "hw/arm/bsa.h"
31
+#include "hw/char/cmsdk-apb-uart.h"
32
#include "hw/intc/arm_gicv3.h"
33
34
/* Define the layout of RAM and ROM in a board */
35
@@ -XXX,XX +XXX,XX @@ typedef struct RAMInfo {
36
37
#define MPS3R_RAM_MAX 9
38
#define MPS3R_CPU_MAX 2
39
+#define MPS3R_UART_MAX 4 /* shared UART count */
40
41
#define PERIPHBASE 0xf0000000
42
#define NUM_SPIS 96
43
@@ -XXX,XX +XXX,XX @@ struct MPS3RMachineState {
44
MemoryRegion sysmem_alias[MPS3R_CPU_MAX];
45
MemoryRegion cpu_ram[MPS3R_CPU_MAX];
46
GICv3State gic;
47
+ /* per-CPU UARTs followed by the shared UARTs */
48
+ CMSDKAPBUART uart[MPS3R_CPU_MAX + MPS3R_UART_MAX];
49
+ OrIRQState cpu_uart_oflow[MPS3R_CPU_MAX];
50
+ OrIRQState uart_oflow;
51
};
52
53
#define TYPE_MPS3R_MACHINE "mps3r"
54
@@ -XXX,XX +XXX,XX @@ struct MPS3RMachineState {
55
56
OBJECT_DECLARE_TYPE(MPS3RMachineState, MPS3RMachineClass, MPS3R_MACHINE)
57
58
+/*
59
+ * Main clock frequency CLK in Hz (50MHz). In the image there are also
60
+ * ACLK, MCLK, GPUCLK and PERIPHCLK at the same frequency; for our
61
+ * model we just roll them all into one.
62
+ */
63
+#define CLK_FRQ 50000000
64
+
65
static const RAMInfo an536_raminfo[] = {
66
{
67
.name = "ATCM",
68
@@ -XXX,XX +XXX,XX @@ static void create_gic(MPS3RMachineState *mms, MemoryRegion *sysmem)
69
}
29
}
70
}
30
71
31
+/*
72
+/*
32
+ * Note that this ID register field covers both VFP and Neon FMAC,
73
+ * Create UART uartno, and map it into the MemoryRegion mem at address baseaddr.
33
+ * so should usually be tested in combination with some other
74
+ * The qemu_irq arguments are where we connect the various IRQs from the UART.
34
+ * check that confirms the presence of whichever of VFP or Neon is
35
+ * relevant, to avoid accidentally enabling a Neon feature on
36
+ * a VFP-no-Neon core or vice-versa.
37
+ */
75
+ */
38
+static inline bool isar_feature_aa32_simdfmac(const ARMISARegisters *id)
76
+static void create_uart(MPS3RMachineState *mms, int uartno, MemoryRegion *mem,
77
+ hwaddr baseaddr, qemu_irq txirq, qemu_irq rxirq,
78
+ qemu_irq txoverirq, qemu_irq rxoverirq,
79
+ qemu_irq combirq)
39
+{
80
+{
40
+ return FIELD_EX32(id->mvfr1, MVFR1, SIMDFMAC) != 0;
81
+ g_autofree char *s = g_strdup_printf("uart%d", uartno);
82
+ SysBusDevice *sbd;
83
+
84
+ assert(uartno < ARRAY_SIZE(mms->uart));
85
+ object_initialize_child(OBJECT(mms), s, &mms->uart[uartno],
86
+ TYPE_CMSDK_APB_UART);
87
+ qdev_prop_set_uint32(DEVICE(&mms->uart[uartno]), "pclk-frq", CLK_FRQ);
88
+ qdev_prop_set_chr(DEVICE(&mms->uart[uartno]), "chardev", serial_hd(uartno));
89
+ sbd = SYS_BUS_DEVICE(&mms->uart[uartno]);
90
+ sysbus_realize(sbd, &error_fatal);
91
+ memory_region_add_subregion(mem, baseaddr,
92
+ sysbus_mmio_get_region(sbd, 0));
93
+ sysbus_connect_irq(sbd, 0, txirq);
94
+ sysbus_connect_irq(sbd, 1, rxirq);
95
+ sysbus_connect_irq(sbd, 2, txoverirq);
96
+ sysbus_connect_irq(sbd, 3, rxoverirq);
97
+ sysbus_connect_irq(sbd, 4, combirq);
41
+}
98
+}
42
+
99
+
43
static inline bool isar_feature_aa32_vsel(const ARMISARegisters *id)
100
static void mps3r_common_init(MachineState *machine)
44
{
101
{
45
return FIELD_EX32(id->mvfr2, MVFR2, FPMISC) >= 1;
102
MPS3RMachineState *mms = MPS3R_MACHINE(machine);
46
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
103
MPS3RMachineClass *mmc = MPS3R_MACHINE_GET_CLASS(mms);
47
index XXXXXXX..XXXXXXX 100644
104
MemoryRegion *sysmem = get_system_memory();
48
--- a/target/arm/cpu.c
105
+ DeviceState *gicdev;
49
+++ b/target/arm/cpu.c
106
50
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)
107
for (const RAMInfo *ri = mmc->raminfo; ri->name; ri++) {
51
u = FIELD_DP32(u, MVFR1, SIMDINT, 0);
108
MemoryRegion *mr = mr_for_raminfo(mms, ri);
52
u = FIELD_DP32(u, MVFR1, SIMDSP, 0);
109
@@ -XXX,XX +XXX,XX @@ static void mps3r_common_init(MachineState *machine)
53
u = FIELD_DP32(u, MVFR1, SIMDHP, 0);
110
}
54
- u = FIELD_DP32(u, MVFR1, SIMDFMAC, 0);
111
55
cpu->isar.mvfr1 = u;
112
create_gic(mms, sysmem);
56
113
+ gicdev = DEVICE(&mms->gic);
57
u = cpu->isar.mvfr2;
58
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)
59
u = cpu->isar.mvfr0;
60
u = FIELD_DP32(u, MVFR0, SIMDREG, 0);
61
cpu->isar.mvfr0 = u;
62
+
114
+
63
+ /* Despite the name, this field covers both VFP and Neon */
115
+ /*
64
+ u = cpu->isar.mvfr1;
116
+ * UARTs 0 and 1 are per-CPU; their interrupts are wired to
65
+ u = FIELD_DP32(u, MVFR1, SIMDFMAC, 0);
117
+ * the relevant CPU's PPI 0..3, aka INTID 16..19
66
+ cpu->isar.mvfr1 = u;
67
}
68
69
if (arm_feature(env, ARM_FEATURE_M) && !cpu->has_dsp) {
70
diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c
71
index XXXXXXX..XXXXXXX 100644
72
--- a/target/arm/translate-vfp.inc.c
73
+++ b/target/arm/translate-vfp.inc.c
74
@@ -XXX,XX +XXX,XX @@ static bool trans_VFM_sp(DisasContext *s, arg_VFM_sp *a)
75
76
/*
77
* Present in VFPv4 only.
78
+ * Note that we can't rely on the SIMDFMAC check alone, because
79
+ * in a Neon-no-VFP core that ID register field will be non-zero.
80
+ */
118
+ */
81
+ if (!dc_isar_feature(aa32_simdfmac, s) ||
119
+ for (int i = 0; i < machine->smp.cpus; i++) {
82
+ !dc_isar_feature(aa32_fpsp_v2, s)) {
120
+ int intidbase = NUM_SPIS + i * GIC_INTERNAL;
83
+ return false;
121
+ g_autofree char *s = g_strdup_printf("cpu-uart-oflow-orgate%d", i);
122
+ DeviceState *orgate;
123
+
124
+ /* The two overflow IRQs from the UART are ORed together into PPI 3 */
125
+ object_initialize_child(OBJECT(mms), s, &mms->cpu_uart_oflow[i],
126
+ TYPE_OR_IRQ);
127
+ orgate = DEVICE(&mms->cpu_uart_oflow[i]);
128
+ qdev_prop_set_uint32(orgate, "num-lines", 2);
129
+ qdev_realize(orgate, NULL, &error_fatal);
130
+ qdev_connect_gpio_out(orgate, 0,
131
+ qdev_get_gpio_in(gicdev, intidbase + 19));
132
+
133
+ create_uart(mms, i, &mms->cpu_sysmem[i], 0xe7c00000,
134
+ qdev_get_gpio_in(gicdev, intidbase + 17), /* tx */
135
+ qdev_get_gpio_in(gicdev, intidbase + 16), /* rx */
136
+ qdev_get_gpio_in(orgate, 0), /* txover */
137
+ qdev_get_gpio_in(orgate, 1), /* rxover */
138
+ qdev_get_gpio_in(gicdev, intidbase + 18) /* combined */);
84
+ }
139
+ }
85
+ /*
140
+ /*
86
* In v7A, UNPREDICTABLE with non-zero vector length/stride; from
141
+ * UARTs 2 to 5 are whole-system; all overflow IRQs are ORed
87
* v8A, must UNDEF. We choose to UNDEF for both v7A and v8A.
142
+ * together into IRQ 17
88
*/
89
- if (!arm_dc_feature(s, ARM_FEATURE_VFP4) ||
90
- (s->vec_len != 0 || s->vec_stride != 0)) {
91
+ if (s->vec_len != 0 || s->vec_stride != 0) {
92
return false;
93
}
94
95
@@ -XXX,XX +XXX,XX @@ static bool trans_VFM_dp(DisasContext *s, arg_VFM_dp *a)
96
97
/*
98
* Present in VFPv4 only.
99
+ * Note that we can't rely on the SIMDFMAC check alone, because
100
+ * in a Neon-no-VFP core that ID register field will be non-zero.
101
+ */
143
+ */
102
+ if (!dc_isar_feature(aa32_simdfmac, s) ||
144
+ object_initialize_child(OBJECT(mms), "uart-oflow-orgate",
103
+ !dc_isar_feature(aa32_fpdp_v2, s)) {
145
+ &mms->uart_oflow, TYPE_OR_IRQ);
104
+ return false;
146
+ qdev_prop_set_uint32(DEVICE(&mms->uart_oflow), "num-lines",
147
+ MPS3R_UART_MAX * 2);
148
+ qdev_realize(DEVICE(&mms->uart_oflow), NULL, &error_fatal);
149
+ qdev_connect_gpio_out(DEVICE(&mms->uart_oflow), 0,
150
+ qdev_get_gpio_in(gicdev, 17));
151
+
152
+ for (int i = 0; i < MPS3R_UART_MAX; i++) {
153
+ hwaddr baseaddr = 0xe0205000 + i * 0x1000;
154
+ int rxirq = 5 + i * 2, txirq = 6 + i * 2, combirq = 13 + i;
155
+
156
+ create_uart(mms, i + MPS3R_CPU_MAX, sysmem, baseaddr,
157
+ qdev_get_gpio_in(gicdev, txirq),
158
+ qdev_get_gpio_in(gicdev, rxirq),
159
+ qdev_get_gpio_in(DEVICE(&mms->uart_oflow), i * 2),
160
+ qdev_get_gpio_in(DEVICE(&mms->uart_oflow), i * 2 + 1),
161
+ qdev_get_gpio_in(gicdev, combirq));
105
+ }
162
+ }
106
+ /*
163
107
* In v7A, UNPREDICTABLE with non-zero vector length/stride; from
164
mms->bootinfo.ram_size = machine->ram_size;
108
* v8A, must UNDEF. We choose to UNDEF for both v7A and v8A.
165
mms->bootinfo.board_id = -1;
109
*/
110
- if (!arm_dc_feature(s, ARM_FEATURE_VFP4) ||
111
- (s->vec_len != 0 || s->vec_stride != 0)) {
112
+ if (s->vec_len != 0 || s->vec_stride != 0) {
113
return false;
114
}
115
116
diff --git a/target/arm/translate.c b/target/arm/translate.c
117
index XXXXXXX..XXXXXXX 100644
118
--- a/target/arm/translate.c
119
+++ b/target/arm/translate.c
120
@@ -XXX,XX +XXX,XX @@ static int disas_neon_data_insn(DisasContext *s, uint32_t insn)
121
}
122
break;
123
case NEON_3R_VFM_VQRDMLSH:
124
- if (!arm_dc_feature(s, ARM_FEATURE_VFP4)) {
125
+ if (!dc_isar_feature(aa32_simdfmac, s)) {
126
return 1;
127
}
128
break;
129
--
166
--
130
2.20.1
167
2.34.1
131
168
132
169
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
Add the GPIO, watchdog, dual-timer and I2C devices to the mps3-an536
2
board. These are all simple devices that just need to be created and
3
wired up.
2
4
3
Shuffle the order of the checks so that we test the ISA
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
before we test anything else, such as the register arguments.
6
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
7
Message-id: 20240206132931.38376-12-peter.maydell@linaro.org
8
---
9
hw/arm/mps3r.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++
10
1 file changed, 59 insertions(+)
5
11
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
12
diff --git a/hw/arm/mps3r.c b/hw/arm/mps3r.c
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20200224222232.13807-7-richard.henderson@linaro.org
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
target/arm/translate-vfp.inc.c | 140 +++++++++++++++++----------------
12
1 file changed, 71 insertions(+), 69 deletions(-)
13
14
diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c
15
index XXXXXXX..XXXXXXX 100644
13
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/translate-vfp.inc.c
14
--- a/hw/arm/mps3r.c
17
+++ b/target/arm/translate-vfp.inc.c
15
+++ b/hw/arm/mps3r.c
18
@@ -XXX,XX +XXX,XX @@ static bool trans_VSEL(DisasContext *s, arg_VSEL *a)
16
@@ -XXX,XX +XXX,XX @@
19
return false;
17
#include "sysemu/sysemu.h"
18
#include "hw/boards.h"
19
#include "hw/or-irq.h"
20
+#include "hw/qdev-clock.h"
21
#include "hw/qdev-properties.h"
22
#include "hw/arm/boot.h"
23
#include "hw/arm/bsa.h"
24
#include "hw/char/cmsdk-apb-uart.h"
25
+#include "hw/i2c/arm_sbcon_i2c.h"
26
#include "hw/intc/arm_gicv3.h"
27
+#include "hw/misc/unimp.h"
28
+#include "hw/timer/cmsdk-apb-dualtimer.h"
29
+#include "hw/watchdog/cmsdk-apb-watchdog.h"
30
31
/* Define the layout of RAM and ROM in a board */
32
typedef struct RAMInfo {
33
@@ -XXX,XX +XXX,XX @@ struct MPS3RMachineState {
34
CMSDKAPBUART uart[MPS3R_CPU_MAX + MPS3R_UART_MAX];
35
OrIRQState cpu_uart_oflow[MPS3R_CPU_MAX];
36
OrIRQState uart_oflow;
37
+ CMSDKAPBWatchdog watchdog;
38
+ CMSDKAPBDualTimer dualtimer;
39
+ ArmSbconI2CState i2c[5];
40
+ Clock *clk;
41
};
42
43
#define TYPE_MPS3R_MACHINE "mps3r"
44
@@ -XXX,XX +XXX,XX @@ static void mps3r_common_init(MachineState *machine)
45
MemoryRegion *sysmem = get_system_memory();
46
DeviceState *gicdev;
47
48
+ mms->clk = clock_new(OBJECT(machine), "CLK");
49
+ clock_set_hz(mms->clk, CLK_FRQ);
50
+
51
for (const RAMInfo *ri = mmc->raminfo; ri->name; ri++) {
52
MemoryRegion *mr = mr_for_raminfo(mms, ri);
53
memory_region_add_subregion(sysmem, ri->base, mr);
54
@@ -XXX,XX +XXX,XX @@ static void mps3r_common_init(MachineState *machine)
55
qdev_get_gpio_in(gicdev, combirq));
20
}
56
}
21
57
22
- /* UNDEF accesses to D16-D31 if they don't exist */
58
+ for (int i = 0; i < 4; i++) {
23
- if (dp && !dc_isar_feature(aa32_simd_r32, s) &&
59
+ /* CMSDK GPIO controllers */
24
- ((a->vm | a->vn | a->vd) & 0x10)) {
60
+ g_autofree char *s = g_strdup_printf("gpio%d", i);
25
+ if (dp && !dc_isar_feature(aa32_fpdp_v2, s)) {
61
+ create_unimplemented_device(s, 0xe0000000 + i * 0x1000, 0x1000);
26
return false;
27
}
28
29
- if (dp && !dc_isar_feature(aa32_fpdp_v2, s)) {
30
+ /* UNDEF accesses to D16-D31 if they don't exist */
31
+ if (dp && !dc_isar_feature(aa32_simd_r32, s) &&
32
+ ((a->vm | a->vn | a->vd) & 0x10)) {
33
return false;
34
}
35
36
@@ -XXX,XX +XXX,XX @@ static bool trans_VMINMAXNM(DisasContext *s, arg_VMINMAXNM *a)
37
return false;
38
}
39
40
- /* UNDEF accesses to D16-D31 if they don't exist */
41
- if (dp && !dc_isar_feature(aa32_simd_r32, s) &&
42
- ((a->vm | a->vn | a->vd) & 0x10)) {
43
+ if (dp && !dc_isar_feature(aa32_fpdp_v2, s)) {
44
return false;
45
}
46
47
- if (dp && !dc_isar_feature(aa32_fpdp_v2, s)) {
48
+ /* UNDEF accesses to D16-D31 if they don't exist */
49
+ if (dp && !dc_isar_feature(aa32_simd_r32, s) &&
50
+ ((a->vm | a->vn | a->vd) & 0x10)) {
51
return false;
52
}
53
54
@@ -XXX,XX +XXX,XX @@ static bool trans_VRINT(DisasContext *s, arg_VRINT *a)
55
return false;
56
}
57
58
- /* UNDEF accesses to D16-D31 if they don't exist */
59
- if (dp && !dc_isar_feature(aa32_simd_r32, s) &&
60
- ((a->vm | a->vd) & 0x10)) {
61
+ if (dp && !dc_isar_feature(aa32_fpdp_v2, s)) {
62
return false;
63
}
64
65
- if (dp && !dc_isar_feature(aa32_fpdp_v2, s)) {
66
+ /* UNDEF accesses to D16-D31 if they don't exist */
67
+ if (dp && !dc_isar_feature(aa32_simd_r32, s) &&
68
+ ((a->vm | a->vd) & 0x10)) {
69
return false;
70
}
71
72
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT(DisasContext *s, arg_VCVT *a)
73
return false;
74
}
75
76
- /* UNDEF accesses to D16-D31 if they don't exist */
77
- if (dp && !dc_isar_feature(aa32_simd_r32, s) && (a->vm & 0x10)) {
78
+ if (dp && !dc_isar_feature(aa32_fpdp_v2, s)) {
79
return false;
80
}
81
82
- if (dp && !dc_isar_feature(aa32_fpdp_v2, s)) {
83
+ /* UNDEF accesses to D16-D31 if they don't exist */
84
+ if (dp && !dc_isar_feature(aa32_simd_r32, s) && (a->vm & 0x10)) {
85
return false;
86
}
87
88
@@ -XXX,XX +XXX,XX @@ static bool do_vfp_3op_dp(DisasContext *s, VFPGen3OpDPFn *fn,
89
TCGv_i64 f0, f1, fd;
90
TCGv_ptr fpst;
91
92
- /* UNDEF accesses to D16-D31 if they don't exist */
93
- if (!dc_isar_feature(aa32_simd_r32, s) && ((vd | vn | vm) & 0x10)) {
94
+ if (!dc_isar_feature(aa32_fpdp_v2, s)) {
95
return false;
96
}
97
98
- if (!dc_isar_feature(aa32_fpdp_v2, s)) {
99
+ /* UNDEF accesses to D16-D31 if they don't exist */
100
+ if (!dc_isar_feature(aa32_simd_r32, s) && ((vd | vn | vm) & 0x10)) {
101
return false;
102
}
103
104
@@ -XXX,XX +XXX,XX @@ static bool do_vfp_2op_dp(DisasContext *s, VFPGen2OpDPFn *fn, int vd, int vm)
105
int veclen = s->vec_len;
106
TCGv_i64 f0, fd;
107
108
- /* UNDEF accesses to D16-D31 if they don't exist */
109
- if (!dc_isar_feature(aa32_simd_r32, s) && ((vd | vm) & 0x10)) {
110
+ if (!dc_isar_feature(aa32_fpdp_v2, s)) {
111
return false;
112
}
113
114
- if (!dc_isar_feature(aa32_fpdp_v2, s)) {
115
+ /* UNDEF accesses to D16-D31 if they don't exist */
116
+ if (!dc_isar_feature(aa32_simd_r32, s) && ((vd | vm) & 0x10)) {
117
return false;
118
}
119
120
@@ -XXX,XX +XXX,XX @@ static bool trans_VFM_dp(DisasContext *s, arg_VFM_dp *a)
121
return false;
122
}
123
124
- if (!dc_isar_feature(aa32_fpdp_v2, s)) {
125
+ /* UNDEF accesses to D16-D31 if they don't exist. */
126
+ if (!dc_isar_feature(aa32_simd_r32, s) &&
127
+ ((a->vd | a->vn | a->vm) & 0x10)) {
128
return false;
129
}
130
131
@@ -XXX,XX +XXX,XX @@ static bool trans_VMOV_imm_dp(DisasContext *s, arg_VMOV_imm_dp *a)
132
133
vd = a->vd;
134
135
- /* UNDEF accesses to D16-D31 if they don't exist. */
136
- if (!dc_isar_feature(aa32_simd_r32, s) && (vd & 0x10)) {
137
+ if (!dc_isar_feature(aa32_fpdp_v2, s)) {
138
return false;
139
}
140
141
- if (!dc_isar_feature(aa32_fpdp_v2, s)) {
142
+ /* UNDEF accesses to D16-D31 if they don't exist. */
143
+ if (!dc_isar_feature(aa32_simd_r32, s) && (vd & 0x10)) {
144
return false;
145
}
146
147
@@ -XXX,XX +XXX,XX @@ static bool trans_VCMP_dp(DisasContext *s, arg_VCMP_dp *a)
148
{
149
TCGv_i64 vd, vm;
150
151
+ if (!dc_isar_feature(aa32_fpdp_v2, s)) {
152
+ return false;
153
+ }
62
+ }
154
+
63
+
155
/* Vm/M bits must be zero for the Z variant */
64
+ object_initialize_child(OBJECT(mms), "watchdog", &mms->watchdog,
156
if (a->z && a->vm != 0) {
65
+ TYPE_CMSDK_APB_WATCHDOG);
157
return false;
66
+ qdev_connect_clock_in(DEVICE(&mms->watchdog), "WDOGCLK", mms->clk);
158
@@ -XXX,XX +XXX,XX @@ static bool trans_VCMP_dp(DisasContext *s, arg_VCMP_dp *a)
67
+ sysbus_realize(SYS_BUS_DEVICE(&mms->watchdog), &error_fatal);
159
return false;
68
+ sysbus_connect_irq(SYS_BUS_DEVICE(&mms->watchdog), 0,
160
}
69
+ qdev_get_gpio_in(gicdev, 0));
161
70
+ sysbus_mmio_map(SYS_BUS_DEVICE(&mms->watchdog), 0, 0xe0100000);
162
- if (!dc_isar_feature(aa32_fpdp_v2, s)) {
71
+
163
- return false;
72
+ object_initialize_child(OBJECT(mms), "dualtimer", &mms->dualtimer,
164
- }
73
+ TYPE_CMSDK_APB_DUALTIMER);
165
-
74
+ qdev_connect_clock_in(DEVICE(&mms->dualtimer), "TIMCLK", mms->clk);
166
if (!vfp_access_check(s)) {
75
+ sysbus_realize(SYS_BUS_DEVICE(&mms->dualtimer), &error_fatal);
167
return true;
76
+ sysbus_connect_irq(SYS_BUS_DEVICE(&mms->dualtimer), 0,
168
}
77
+ qdev_get_gpio_in(gicdev, 3));
169
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_f64_f16(DisasContext *s, arg_VCVT_f64_f16 *a)
78
+ sysbus_connect_irq(SYS_BUS_DEVICE(&mms->dualtimer), 1,
170
TCGv_i32 tmp;
79
+ qdev_get_gpio_in(gicdev, 1));
171
TCGv_i64 vd;
80
+ sysbus_connect_irq(SYS_BUS_DEVICE(&mms->dualtimer), 2,
172
81
+ qdev_get_gpio_in(gicdev, 2));
173
+ if (!dc_isar_feature(aa32_fpdp_v2, s)) {
82
+ sysbus_mmio_map(SYS_BUS_DEVICE(&mms->dualtimer), 0, 0xe0101000);
174
+ return false;
83
+
84
+ for (int i = 0; i < ARRAY_SIZE(mms->i2c); i++) {
85
+ static const hwaddr i2cbase[] = {0xe0102000, /* Touch */
86
+ 0xe0103000, /* Audio */
87
+ 0xe0107000, /* Shield0 */
88
+ 0xe0108000, /* Shield1 */
89
+ 0xe0109000}; /* DDR4 EEPROM */
90
+ g_autofree char *s = g_strdup_printf("i2c%d", i);
91
+
92
+ object_initialize_child(OBJECT(mms), s, &mms->i2c[i],
93
+ TYPE_ARM_SBCON_I2C);
94
+ sysbus_realize(SYS_BUS_DEVICE(&mms->i2c[i]), &error_fatal);
95
+ sysbus_mmio_map(SYS_BUS_DEVICE(&mms->i2c[i]), 0, i2cbase[i]);
96
+ if (i != 2 && i != 3) {
97
+ /*
98
+ * internal-only bus: mark it full to avoid user-created
99
+ * i2c devices being plugged into it.
100
+ */
101
+ qbus_mark_full(qdev_get_child_bus(DEVICE(&mms->i2c[i]), "i2c"));
102
+ }
175
+ }
103
+ }
176
+
104
+
177
if (!dc_isar_feature(aa32_fp16_dpconv, s)) {
105
mms->bootinfo.ram_size = machine->ram_size;
178
return false;
106
mms->bootinfo.board_id = -1;
179
}
107
mms->bootinfo.loader_start = mmc->loader_start;
180
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_f64_f16(DisasContext *s, arg_VCVT_f64_f16 *a)
181
return false;
182
}
183
184
- if (!dc_isar_feature(aa32_fpdp_v2, s)) {
185
- return false;
186
- }
187
-
188
if (!vfp_access_check(s)) {
189
return true;
190
}
191
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_f16_f64(DisasContext *s, arg_VCVT_f16_f64 *a)
192
TCGv_i32 tmp;
193
TCGv_i64 vm;
194
195
+ if (!dc_isar_feature(aa32_fpdp_v2, s)) {
196
+ return false;
197
+ }
198
+
199
if (!dc_isar_feature(aa32_fp16_dpconv, s)) {
200
return false;
201
}
202
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_f16_f64(DisasContext *s, arg_VCVT_f16_f64 *a)
203
return false;
204
}
205
206
- if (!dc_isar_feature(aa32_fpdp_v2, s)) {
207
- return false;
208
- }
209
-
210
if (!vfp_access_check(s)) {
211
return true;
212
}
213
@@ -XXX,XX +XXX,XX @@ static bool trans_VRINTR_dp(DisasContext *s, arg_VRINTR_dp *a)
214
TCGv_ptr fpst;
215
TCGv_i64 tmp;
216
217
+ if (!dc_isar_feature(aa32_fpdp_v2, s)) {
218
+ return false;
219
+ }
220
+
221
if (!dc_isar_feature(aa32_vrint, s)) {
222
return false;
223
}
224
@@ -XXX,XX +XXX,XX @@ static bool trans_VRINTR_dp(DisasContext *s, arg_VRINTR_dp *a)
225
return false;
226
}
227
228
- if (!dc_isar_feature(aa32_fpdp_v2, s)) {
229
- return false;
230
- }
231
-
232
if (!vfp_access_check(s)) {
233
return true;
234
}
235
@@ -XXX,XX +XXX,XX @@ static bool trans_VRINTZ_dp(DisasContext *s, arg_VRINTZ_dp *a)
236
TCGv_i64 tmp;
237
TCGv_i32 tcg_rmode;
238
239
+ if (!dc_isar_feature(aa32_fpdp_v2, s)) {
240
+ return false;
241
+ }
242
+
243
if (!dc_isar_feature(aa32_vrint, s)) {
244
return false;
245
}
246
@@ -XXX,XX +XXX,XX @@ static bool trans_VRINTZ_dp(DisasContext *s, arg_VRINTZ_dp *a)
247
return false;
248
}
249
250
- if (!dc_isar_feature(aa32_fpdp_v2, s)) {
251
- return false;
252
- }
253
-
254
if (!vfp_access_check(s)) {
255
return true;
256
}
257
@@ -XXX,XX +XXX,XX @@ static bool trans_VRINTX_dp(DisasContext *s, arg_VRINTX_dp *a)
258
TCGv_ptr fpst;
259
TCGv_i64 tmp;
260
261
+ if (!dc_isar_feature(aa32_fpdp_v2, s)) {
262
+ return false;
263
+ }
264
+
265
if (!dc_isar_feature(aa32_vrint, s)) {
266
return false;
267
}
268
@@ -XXX,XX +XXX,XX @@ static bool trans_VRINTX_dp(DisasContext *s, arg_VRINTX_dp *a)
269
return false;
270
}
271
272
- if (!dc_isar_feature(aa32_fpdp_v2, s)) {
273
- return false;
274
- }
275
-
276
if (!vfp_access_check(s)) {
277
return true;
278
}
279
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_sp(DisasContext *s, arg_VCVT_sp *a)
280
TCGv_i64 vd;
281
TCGv_i32 vm;
282
283
- /* UNDEF accesses to D16-D31 if they don't exist. */
284
- if (!dc_isar_feature(aa32_simd_r32, s) && (a->vd & 0x10)) {
285
+ if (!dc_isar_feature(aa32_fpdp_v2, s)) {
286
return false;
287
}
288
289
- if (!dc_isar_feature(aa32_fpdp_v2, s)) {
290
+ /* UNDEF accesses to D16-D31 if they don't exist. */
291
+ if (!dc_isar_feature(aa32_simd_r32, s) && (a->vd & 0x10)) {
292
return false;
293
}
294
295
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_dp(DisasContext *s, arg_VCVT_dp *a)
296
TCGv_i64 vm;
297
TCGv_i32 vd;
298
299
- /* UNDEF accesses to D16-D31 if they don't exist. */
300
- if (!dc_isar_feature(aa32_simd_r32, s) && (a->vm & 0x10)) {
301
+ if (!dc_isar_feature(aa32_fpdp_v2, s)) {
302
return false;
303
}
304
305
- if (!dc_isar_feature(aa32_fpdp_v2, s)) {
306
+ /* UNDEF accesses to D16-D31 if they don't exist. */
307
+ if (!dc_isar_feature(aa32_simd_r32, s) && (a->vm & 0x10)) {
308
return false;
309
}
310
311
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_int_dp(DisasContext *s, arg_VCVT_int_dp *a)
312
TCGv_i64 vd;
313
TCGv_ptr fpst;
314
315
- /* UNDEF accesses to D16-D31 if they don't exist. */
316
- if (!dc_isar_feature(aa32_simd_r32, s) && (a->vd & 0x10)) {
317
+ if (!dc_isar_feature(aa32_fpdp_v2, s)) {
318
return false;
319
}
320
321
- if (!dc_isar_feature(aa32_fpdp_v2, s)) {
322
+ /* UNDEF accesses to D16-D31 if they don't exist. */
323
+ if (!dc_isar_feature(aa32_simd_r32, s) && (a->vd & 0x10)) {
324
return false;
325
}
326
327
@@ -XXX,XX +XXX,XX @@ static bool trans_VJCVT(DisasContext *s, arg_VJCVT *a)
328
TCGv_i32 vd;
329
TCGv_i64 vm;
330
331
+ if (!dc_isar_feature(aa32_fpdp_v2, s)) {
332
+ return false;
333
+ }
334
+
335
if (!dc_isar_feature(aa32_jscvt, s)) {
336
return false;
337
}
338
@@ -XXX,XX +XXX,XX @@ static bool trans_VJCVT(DisasContext *s, arg_VJCVT *a)
339
return false;
340
}
341
342
- if (!dc_isar_feature(aa32_fpdp_v2, s)) {
343
- return false;
344
- }
345
-
346
if (!vfp_access_check(s)) {
347
return true;
348
}
349
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_fix_dp(DisasContext *s, arg_VCVT_fix_dp *a)
350
TCGv_ptr fpst;
351
int frac_bits;
352
353
+ if (!dc_isar_feature(aa32_fpdp_v2, s)) {
354
+ return false;
355
+ }
356
+
357
if (!arm_dc_feature(s, ARM_FEATURE_VFP3)) {
358
return false;
359
}
360
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_fix_dp(DisasContext *s, arg_VCVT_fix_dp *a)
361
return false;
362
}
363
364
- if (!dc_isar_feature(aa32_fpdp_v2, s)) {
365
- return false;
366
- }
367
-
368
if (!vfp_access_check(s)) {
369
return true;
370
}
371
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_dp_int(DisasContext *s, arg_VCVT_dp_int *a)
372
TCGv_i64 vm;
373
TCGv_ptr fpst;
374
375
- /* UNDEF accesses to D16-D31 if they don't exist. */
376
- if (!dc_isar_feature(aa32_simd_r32, s) && (a->vm & 0x10)) {
377
+ if (!dc_isar_feature(aa32_fpdp_v2, s)) {
378
return false;
379
}
380
381
- if (!dc_isar_feature(aa32_fpdp_v2, s)) {
382
+ /* UNDEF accesses to D16-D31 if they don't exist. */
383
+ if (!dc_isar_feature(aa32_simd_r32, s) && (a->vm & 0x10)) {
384
return false;
385
}
386
387
--
108
--
388
2.20.1
109
2.34.1
389
110
390
111
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
Add the remaining devices (or unimplemented-device stubs) for
2
this board: SPI controllers, SCC, FPGAIO, I2S, RTC, the
3
QSPI write-config block, and ethernet.
2
4
3
Now that we no longer have an early check for ARM_FEATURE_VFP,
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
we can use the proper ISA check in trans_VLLDM_VLSTM.
6
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
7
Message-id: 20240206132931.38376-13-peter.maydell@linaro.org
8
---
9
hw/arm/mps3r.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++
10
1 file changed, 74 insertions(+)
5
11
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
12
diff --git a/hw/arm/mps3r.c b/hw/arm/mps3r.c
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Message-id: 20200224222232.13807-12-richard.henderson@linaro.org
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
target/arm/translate-vfp.inc.c | 39 +++++++++++++++++++++++++
12
target/arm/translate.c | 53 ++++++----------------------------
13
target/arm/vfp.decode | 2 ++
14
3 files changed, 50 insertions(+), 44 deletions(-)
15
16
diff --git a/target/arm/translate-vfp.inc.c b/target/arm/translate-vfp.inc.c
17
index XXXXXXX..XXXXXXX 100644
13
index XXXXXXX..XXXXXXX 100644
18
--- a/target/arm/translate-vfp.inc.c
14
--- a/hw/arm/mps3r.c
19
+++ b/target/arm/translate-vfp.inc.c
15
+++ b/hw/arm/mps3r.c
20
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_dp_int(DisasContext *s, arg_VCVT_dp_int *a)
16
@@ -XXX,XX +XXX,XX @@
21
tcg_temp_free_ptr(fpst);
17
#include "hw/char/cmsdk-apb-uart.h"
22
return true;
18
#include "hw/i2c/arm_sbcon_i2c.h"
23
}
19
#include "hw/intc/arm_gicv3.h"
20
+#include "hw/misc/mps2-scc.h"
21
+#include "hw/misc/mps2-fpgaio.h"
22
#include "hw/misc/unimp.h"
23
+#include "hw/net/lan9118.h"
24
+#include "hw/rtc/pl031.h"
25
+#include "hw/ssi/pl022.h"
26
#include "hw/timer/cmsdk-apb-dualtimer.h"
27
#include "hw/watchdog/cmsdk-apb-watchdog.h"
28
29
@@ -XXX,XX +XXX,XX @@ struct MPS3RMachineState {
30
CMSDKAPBWatchdog watchdog;
31
CMSDKAPBDualTimer dualtimer;
32
ArmSbconI2CState i2c[5];
33
+ PL022State spi[3];
34
+ MPS2SCC scc;
35
+ MPS2FPGAIO fpgaio;
36
+ UnimplementedDeviceState i2s_audio;
37
+ PL031State rtc;
38
Clock *clk;
39
};
40
41
@@ -XXX,XX +XXX,XX @@ static const RAMInfo an536_raminfo[] = {
42
}
43
};
44
45
+static const int an536_oscclk[] = {
46
+ 24000000, /* 24MHz reference for RTC and timers */
47
+ 50000000, /* 50MHz ACLK */
48
+ 50000000, /* 50MHz MCLK */
49
+ 50000000, /* 50MHz GPUCLK */
50
+ 24576000, /* 24.576MHz AUDCLK */
51
+ 23750000, /* 23.75MHz HDLCDCLK */
52
+ 100000000, /* 100MHz DDR4_REF_CLK */
53
+};
24
+
54
+
25
+/*
55
static MemoryRegion *mr_for_raminfo(MPS3RMachineState *mms,
26
+ * Decode VLLDM and VLSTM are nonstandard because:
56
const RAMInfo *raminfo)
27
+ * * if there is no FPU then these insns must NOP in
57
{
28
+ * Secure state and UNDEF in Nonsecure state
58
@@ -XXX,XX +XXX,XX @@ static void mps3r_common_init(MachineState *machine)
29
+ * * if there is an FPU then these insns do not have
59
MPS3RMachineClass *mmc = MPS3R_MACHINE_GET_CLASS(mms);
30
+ * the usual behaviour that vfp_access_check() provides of
60
MemoryRegion *sysmem = get_system_memory();
31
+ * being controlled by CPACR/NSACR enable bits or the
61
DeviceState *gicdev;
32
+ * lazy-stacking logic.
62
+ QList *oscclk;
33
+ */
63
34
+static bool trans_VLLDM_VLSTM(DisasContext *s, arg_VLLDM_VLSTM *a)
64
mms->clk = clock_new(OBJECT(machine), "CLK");
35
+{
65
clock_set_hz(mms->clk, CLK_FRQ);
36
+ TCGv_i32 fptr;
66
@@ -XXX,XX +XXX,XX @@ static void mps3r_common_init(MachineState *machine)
67
}
68
}
69
70
+ for (int i = 0; i < ARRAY_SIZE(mms->spi); i++) {
71
+ g_autofree char *s = g_strdup_printf("spi%d", i);
72
+ hwaddr baseaddr = 0xe0104000 + i * 0x1000;
37
+
73
+
38
+ if (!arm_dc_feature(s, ARM_FEATURE_M) ||
74
+ object_initialize_child(OBJECT(mms), s, &mms->spi[i], TYPE_PL022);
39
+ !arm_dc_feature(s, ARM_FEATURE_V8)) {
75
+ sysbus_realize(SYS_BUS_DEVICE(&mms->spi[i]), &error_fatal);
40
+ return false;
76
+ sysbus_mmio_map(SYS_BUS_DEVICE(&mms->spi[i]), 0, baseaddr);
41
+ }
77
+ sysbus_connect_irq(SYS_BUS_DEVICE(&mms->spi[i]), 0,
42
+ /* If not secure, UNDEF. */
78
+ qdev_get_gpio_in(gicdev, 22 + i));
43
+ if (!s->v8m_secure) {
44
+ return false;
45
+ }
46
+ /* If no fpu, NOP. */
47
+ if (!dc_isar_feature(aa32_vfp, s)) {
48
+ return true;
49
+ }
79
+ }
50
+
80
+
51
+ fptr = load_reg(s, a->rn);
81
+ object_initialize_child(OBJECT(mms), "scc", &mms->scc, TYPE_MPS2_SCC);
52
+ if (a->l) {
82
+ qdev_prop_set_uint32(DEVICE(&mms->scc), "scc-cfg0", 0);
53
+ gen_helper_v7m_vlldm(cpu_env, fptr);
83
+ qdev_prop_set_uint32(DEVICE(&mms->scc), "scc-cfg4", 0x2);
54
+ } else {
84
+ qdev_prop_set_uint32(DEVICE(&mms->scc), "scc-aid", 0x00200008);
55
+ gen_helper_v7m_vlstm(cpu_env, fptr);
85
+ qdev_prop_set_uint32(DEVICE(&mms->scc), "scc-id", 0x41055360);
86
+ oscclk = qlist_new();
87
+ for (int i = 0; i < ARRAY_SIZE(an536_oscclk); i++) {
88
+ qlist_append_int(oscclk, an536_oscclk[i]);
56
+ }
89
+ }
57
+ tcg_temp_free_i32(fptr);
90
+ qdev_prop_set_array(DEVICE(&mms->scc), "oscclk", oscclk);
91
+ sysbus_realize(SYS_BUS_DEVICE(&mms->scc), &error_fatal);
92
+ sysbus_mmio_map(SYS_BUS_DEVICE(&mms->scc), 0, 0xe0200000);
58
+
93
+
59
+ /* End the TB, because we have updated FP control bits */
94
+ create_unimplemented_device("i2s-audio", 0xe0201000, 0x1000);
60
+ s->base.is_jmp = DISAS_UPDATE;
61
+ return true;
62
+}
63
diff --git a/target/arm/translate.c b/target/arm/translate.c
64
index XXXXXXX..XXXXXXX 100644
65
--- a/target/arm/translate.c
66
+++ b/target/arm/translate.c
67
@@ -XXX,XX +XXX,XX @@ static void disas_thumb2_insn(DisasContext *s, uint32_t insn)
68
goto illegal_op; /* op0 = 0b11 : unallocated */
69
}
70
71
- /*
72
- * Decode VLLDM and VLSTM first: these are nonstandard because:
73
- * * if there is no FPU then these insns must NOP in
74
- * Secure state and UNDEF in Nonsecure state
75
- * * if there is an FPU then these insns do not have
76
- * the usual behaviour that disas_vfp_insn() provides of
77
- * being controlled by CPACR/NSACR enable bits or the
78
- * lazy-stacking logic.
79
- */
80
- if (arm_dc_feature(s, ARM_FEATURE_V8) &&
81
- (insn & 0xffa00f00) == 0xec200a00) {
82
- /* 0b1110_1100_0x1x_xxxx_xxxx_1010_xxxx_xxxx
83
- * - VLLDM, VLSTM
84
- * We choose to UNDEF if the RAZ bits are non-zero.
85
- */
86
- if (!s->v8m_secure || (insn & 0x0040f0ff)) {
87
+ if (disas_vfp_insn(s, insn)) {
88
+ if (((insn >> 8) & 0xe) == 10 &&
89
+ dc_isar_feature(aa32_fpsp_v2, s)) {
90
+ /* FP, and the CPU supports it */
91
goto illegal_op;
92
+ } else {
93
+ /* All other insns: NOCP */
94
+ gen_exception_insn(s, s->pc_curr, EXCP_NOCP,
95
+ syn_uncategorized(),
96
+ default_exception_el(s));
97
}
98
-
99
- if (arm_dc_feature(s, ARM_FEATURE_VFP)) {
100
- uint32_t rn = (insn >> 16) & 0xf;
101
- TCGv_i32 fptr = load_reg(s, rn);
102
-
103
- if (extract32(insn, 20, 1)) {
104
- gen_helper_v7m_vlldm(cpu_env, fptr);
105
- } else {
106
- gen_helper_v7m_vlstm(cpu_env, fptr);
107
- }
108
- tcg_temp_free_i32(fptr);
109
-
110
- /* End the TB, because we have updated FP control bits */
111
- s->base.is_jmp = DISAS_UPDATE;
112
- }
113
- break;
114
}
115
- if (arm_dc_feature(s, ARM_FEATURE_VFP) &&
116
- ((insn >> 8) & 0xe) == 10) {
117
- /* FP, and the CPU supports it */
118
- if (disas_vfp_insn(s, insn)) {
119
- goto illegal_op;
120
- }
121
- break;
122
- }
123
-
124
- /* All other insns: NOCP */
125
- gen_exception_insn(s, s->pc_curr, EXCP_NOCP, syn_uncategorized(),
126
- default_exception_el(s));
127
break;
128
}
129
if ((insn & 0xfe000a00) == 0xfc000800
130
diff --git a/target/arm/vfp.decode b/target/arm/vfp.decode
131
index XXXXXXX..XXXXXXX 100644
132
--- a/target/arm/vfp.decode
133
+++ b/target/arm/vfp.decode
134
@@ -XXX,XX +XXX,XX @@ VCVT_sp_int ---- 1110 1.11 110 s:1 .... 1010 rz:1 1.0 .... \
135
vd=%vd_sp vm=%vm_sp
136
VCVT_dp_int ---- 1110 1.11 110 s:1 .... 1011 rz:1 1.0 .... \
137
vd=%vd_sp vm=%vm_dp
138
+
95
+
139
+VLLDM_VLSTM 1110 1100 001 l:1 rn:4 0000 1010 0000 0000
96
+ object_initialize_child(OBJECT(mms), "fpgaio", &mms->fpgaio,
97
+ TYPE_MPS2_FPGAIO);
98
+ qdev_prop_set_uint32(DEVICE(&mms->fpgaio), "prescale-clk", an536_oscclk[1]);
99
+ qdev_prop_set_uint32(DEVICE(&mms->fpgaio), "num-leds", 10);
100
+ qdev_prop_set_bit(DEVICE(&mms->fpgaio), "has-switches", true);
101
+ qdev_prop_set_bit(DEVICE(&mms->fpgaio), "has-dbgctrl", false);
102
+ sysbus_realize(SYS_BUS_DEVICE(&mms->fpgaio), &error_fatal);
103
+ sysbus_mmio_map(SYS_BUS_DEVICE(&mms->fpgaio), 0, 0xe0202000);
104
+
105
+ create_unimplemented_device("clcd", 0xe0209000, 0x1000);
106
+
107
+ object_initialize_child(OBJECT(mms), "rtc", &mms->rtc, TYPE_PL031);
108
+ sysbus_realize(SYS_BUS_DEVICE(&mms->rtc), &error_fatal);
109
+ sysbus_mmio_map(SYS_BUS_DEVICE(&mms->rtc), 0, 0xe020a000);
110
+ sysbus_connect_irq(SYS_BUS_DEVICE(&mms->rtc), 0,
111
+ qdev_get_gpio_in(gicdev, 4));
112
+
113
+ /*
114
+ * In hardware this is a LAN9220; the LAN9118 is software compatible
115
+ * except that it doesn't support the checksum-offload feature.
116
+ */
117
+ lan9118_init(0xe0300000,
118
+ qdev_get_gpio_in(gicdev, 18));
119
+
120
+ create_unimplemented_device("usb", 0xe0301000, 0x1000);
121
+ create_unimplemented_device("qspi-write-config", 0xe0600000, 0x1000);
122
+
123
mms->bootinfo.ram_size = machine->ram_size;
124
mms->bootinfo.board_id = -1;
125
mms->bootinfo.loader_start = mmc->loader_start;
140
--
126
--
141
2.20.1
127
2.34.1
142
128
143
129
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
Add documentation for the mps3-an536 board type.
2
2
3
The Linux kernel displays errors why trying to detect the PL041
3
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
audio interface:
4
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
5
Message-id: 20240206132931.38376-14-peter.maydell@linaro.org
6
---
7
docs/system/arm/mps2.rst | 37 ++++++++++++++++++++++++++++++++++---
8
1 file changed, 34 insertions(+), 3 deletions(-)
5
9
6
Linux version 4.16.0 (linus@genomnajs) (gcc version 7.2.1 20171011 (Linaro GCC 7.2-2017.11)) #142 PREEMPT Wed May 9 13:24:55 CEST 2018
10
diff --git a/docs/system/arm/mps2.rst b/docs/system/arm/mps2.rst
7
CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00093177
8
CPU: VIVT data cache, VIVT instruction cache
9
OF: fdt: Machine model: ARM Integrator/CP
10
...
11
OF: amba_device_add() failed (-19) for /fpga/aaci@1d000000
12
13
Since we have it already modelled, simply plug it.
14
15
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
16
Message-id: 20200223233033.15371-2-f4bug@amsat.org
17
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
18
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
19
---
20
hw/arm/integratorcp.c | 1 +
21
hw/arm/Kconfig | 1 +
22
2 files changed, 2 insertions(+)
23
24
diff --git a/hw/arm/integratorcp.c b/hw/arm/integratorcp.c
25
index XXXXXXX..XXXXXXX 100644
11
index XXXXXXX..XXXXXXX 100644
26
--- a/hw/arm/integratorcp.c
12
--- a/docs/system/arm/mps2.rst
27
+++ b/hw/arm/integratorcp.c
13
+++ b/docs/system/arm/mps2.rst
28
@@ -XXX,XX +XXX,XX @@ static void integratorcp_init(MachineState *machine)
14
@@ -XXX,XX +XXX,XX @@
29
qdev_get_gpio_in_named(icp, ICP_GPIO_MMC_WPROT, 0));
15
-Arm MPS2 and MPS3 boards (``mps2-an385``, ``mps2-an386``, ``mps2-an500``, ``mps2-an505``, ``mps2-an511``, ``mps2-an521``, ``mps3-an524``, ``mps3-an547``)
30
qdev_connect_gpio_out(dev, 1,
16
-=========================================================================================================================================================
31
qdev_get_gpio_in_named(icp, ICP_GPIO_MMC_CARDIN, 0));
17
+Arm MPS2 and MPS3 boards (``mps2-an385``, ``mps2-an386``, ``mps2-an500``, ``mps2-an505``, ``mps2-an511``, ``mps2-an521``, ``mps3-an524``, ``mps3-an536``, ``mps3-an547``)
32
+ sysbus_create_varargs("pl041", 0x1d000000, pic[25], NULL);
18
+=========================================================================================================================================================================
33
19
34
if (nd_table[0].used)
20
-These board models all use Arm M-profile CPUs.
35
smc91c111_init(&nd_table[0], 0xc8000000, pic[27]);
21
+These board models use Arm M-profile or R-profile CPUs.
36
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
22
37
index XXXXXXX..XXXXXXX 100644
23
The Arm MPS2, MPS2+ and MPS3 dev boards are FPGA based (the 2+ has a
38
--- a/hw/arm/Kconfig
24
bigger FPGA but is otherwise the same as the 2; the 3 has a bigger
39
+++ b/hw/arm/Kconfig
25
@@ -XXX,XX +XXX,XX @@ FPGA image.
40
@@ -XXX,XX +XXX,XX @@ config INTEGRATOR
26
41
select INTEGRATOR_DEBUG
27
QEMU models the following FPGA images:
42
select PL011 # UART
28
43
select PL031 # RTC
29
+FPGA images using M-profile CPUs:
44
+ select PL041 # audio
30
+
45
select PL050 # keyboard/mouse
31
``mps2-an385``
46
select PL110 # pl111 LCD controller
32
Cortex-M3 as documented in Arm Application Note AN385
47
select PL181 # display
33
``mps2-an386``
34
@@ -XXX,XX +XXX,XX @@ QEMU models the following FPGA images:
35
``mps3-an547``
36
Cortex-M55 on an MPS3, as documented in Arm Application Note AN547
37
38
+FPGA images using R-profile CPUs:
39
+
40
+``mps3-an536``
41
+ Dual Cortex-R52 on an MPS3, as documented in Arm Application Note AN536
42
+
43
Differences between QEMU and real hardware:
44
45
- AN385/AN386 remapping of low 16K of memory to either ZBT SSRAM1 or to
46
@@ -XXX,XX +XXX,XX @@ Differences between QEMU and real hardware:
47
flash, but only as simple ROM, so attempting to rewrite the flash
48
from the guest will fail
49
- QEMU does not model the USB controller in MPS3 boards
50
+- AN536 does not support runtime control of CPU reset and halt via
51
+ the SCC CFG_REG0 register.
52
+- AN536 does not support enabling or disabling the flash and ATCM
53
+ interfaces via the SCC CFG_REG1 register.
54
+- AN536 does not support setting of the initial vector table
55
+ base address via the SCC CFG_REG6 and CFG_REG7 register config,
56
+ and does not provide a mechanism for specifying these values at
57
+ startup, so all guest images must be built to start from TCM
58
+ (i.e. to expect the interrupt vector base at 0 from reset).
59
+- AN536 defaults to only creating a single CPU; this is the equivalent
60
+ of the way the real FPGA image usually runs with the second Cortex-R52
61
+ held in halt via the initial SCC CFG_REG0 register setting. You can
62
+ create the second CPU with ``-smp 2``; both CPUs will then start
63
+ execution immediately on startup.
64
+
65
+Note that for the AN536 the first UART is accessible only by
66
+CPU0, and the second UART is accessible only by CPU1. The
67
+first UART accessible shared between both CPUs is the third
68
+UART. Guest software might therefore be built to use either
69
+the first UART or the third UART; if you don't see any output
70
+from the UART you are looking at, try one of the others.
71
+(Even if the AN536 machine is started with a single CPU and so
72
+no "CPU1-only UART", the UART numbering remains the same,
73
+with the third UART being the first of the shared ones.)
74
75
Machine-specific options
76
""""""""""""""""""""""""
48
--
77
--
49
2.20.1
78
2.34.1
50
79
51
80
diff view generated by jsdifflib