1
target-arm queue: the big stuff here is the final part of
1
Hi; here's another arm pullreq; by volume most of this is
2
rth's patches for Cortex-A76 and Neoverse-N1 support;
2
refactoring from me, but there are also some bugfixes and
3
also present are Gavin's NUMA series and a few other things.
3
other bits and pieces here.
4
4
5
thanks
5
thanks
6
-- PMM
6
-- PMM
7
7
8
The following changes since commit 554623226f800acf48a2ed568900c1c968ec9a8b:
8
The following changes since commit ed734377ab3f3f3cc15d7aa301a87ab6370f2eed:
9
9
10
Merge tag 'qemu-sparc-20220508' of https://github.com/mcayland/qemu into staging (2022-05-08 17:03:26 -0500)
10
Merge tag 'linux-user-fix-gupnp-pull-request' of https://github.com/hdeller/qemu-hppa into staging (2025-01-24 14:43:07 -0500)
11
11
12
are available in the Git repository at:
12
are available in the Git repository at:
13
13
14
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20220509
14
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20250128-1
15
15
16
for you to fetch changes up to ae9141d4a3265553503bf07d3574b40f84615a34:
16
for you to fetch changes up to 664280abddcb3cacc9c6204706bb739fcc1316f7:
17
17
18
hw/acpi/aml-build: Use existing CPU topology to build PPTT table (2022-05-09 11:47:55 +0100)
18
hw/usb/canokey: Fix buffer overflow for OUT packet (2025-01-28 18:40:19 +0000)
19
19
20
----------------------------------------------------------------
20
----------------------------------------------------------------
21
target-arm queue:
21
target-arm queue:
22
* MAINTAINERS/.mailmap: update email for Leif Lindholm
22
* hw/arm: Remove various uses of first_cpu global
23
* hw/arm: add version information to sbsa-ref machine DT
23
* hw/char/imx_serial: Fix reset value of UFCR register
24
* Enable new features for -cpu max:
24
* hw/char/imx_serial: Update all state before restarting ageing timer
25
FEAT_Debugv8p2, FEAT_Debugv8p4, FEAT_RAS (minimal version only),
25
* hw/pci-host/designware: Expose MSI IRQ
26
FEAT_IESB, FEAT_CSV2, FEAT_CSV2_2, FEAT_CSV3, FEAT_DGH
26
* hw/arm/stellaris: refactoring, cleanup
27
* Emulate Cortex-A76
27
* hw/arm/stellaris: map both I2C controllers
28
* Emulate Neoverse-N1
28
* tests/functional: Add a test for the arm microbit machine
29
* Fix the virt board default NUMA topology
29
* target/arm: arm_reset_sve_state() should set FPSR, not FPCR
30
* target/arm: refactorings preparatory to FEAT_AFP implementation
31
* fpu: Rename float_flag_input_denormal to float_flag_input_denormal_flushed
32
* fpu: Rename float_flag_output_denormal to float_flag_output_denormal_flushed
33
* hw/usb/canokey: Fix buffer overflow for OUT packet
30
34
31
----------------------------------------------------------------
35
----------------------------------------------------------------
32
Gavin Shan (6):
36
Bernhard Beschow (3):
33
qapi/machine.json: Add cluster-id
37
hw/char/imx_serial: Fix reset value of UFCR register
34
qtest/numa-test: Specify CPU topology in aarch64_numa_cpu()
38
hw/char/imx_serial: Update all state before restarting ageing timer
35
hw/arm/virt: Consider SMP configuration in CPU topology
39
hw/pci-host/designware: Expose MSI IRQ
36
qtest/numa-test: Correct CPU and NUMA association in aarch64_numa_cpu()
37
hw/arm/virt: Fix CPU's default NUMA node ID
38
hw/acpi/aml-build: Use existing CPU topology to build PPTT table
39
40
40
Leif Lindholm (2):
41
Hongren Zheng (1):
41
MAINTAINERS/.mailmap: update email for Leif Lindholm
42
hw/usb/canokey: Fix buffer overflow for OUT packet
42
hw/arm: add versioning to sbsa-ref machine DT
43
43
44
Richard Henderson (24):
44
Peter Maydell (22):
45
target/arm: Handle cpreg registration for missing EL
45
target/arm: arm_reset_sve_state() should set FPSR, not FPCR
46
target/arm: Drop EL3 no EL2 fallbacks
46
target/arm: Use FPSR_ constants in vfp_exceptbits_from_host()
47
target/arm: Merge zcr reginfo
47
target/arm: Use uint32_t in vfp_exceptbits_from_host()
48
target/arm: Adjust definition of CONTEXTIDR_EL2
48
target/arm: Define new fp_status_a32 and fp_status_a64
49
target/arm: Move cortex impdef sysregs to cpu_tcg.c
49
target/arm: Use vfp.fp_status_a64 in A64-only helper functions
50
target/arm: Update qemu-system-arm -cpu max to cortex-a57
50
target/arm: Use fp_status_a64 or fp_status_a32 in is_ebf()
51
target/arm: Set ID_DFR0.PerfMon for qemu-system-arm -cpu max
51
target/arm: Use fp_status_a32 in vjvct helper
52
target/arm: Split out aa32_max_features
52
target/arm: Use fp_status_a32 in vfp_cmp helpers
53
target/arm: Annotate arm_max_initfn with FEAT identifiers
53
target/arm: Use FPST_A32 in A32 decoder
54
target/arm: Use field names for manipulating EL2 and EL3 modes
54
target/arm: Use FPST_A64 in A64 decoder
55
target/arm: Enable FEAT_Debugv8p2 for -cpu max
55
target/arm: Remove now-unused vfp.fp_status and FPST_FPCR
56
target/arm: Enable FEAT_Debugv8p4 for -cpu max
56
target/arm: Define new fp_status_f16_a32 and fp_status_f16_a64
57
target/arm: Add minimal RAS registers
57
target/arm: Use fp_status_f16_a32 in AArch32-only helpers
58
target/arm: Enable SCR and HCR bits for RAS
58
target/arm: Use fp_status_f16_a64 in AArch64-only helpers
59
target/arm: Implement virtual SError exceptions
59
target/arm: Use FPST_A32_F16 in A32 decoder
60
target/arm: Implement ESB instruction
60
target/arm: Use FPST_A64_F16 in A64 decoder
61
target/arm: Enable FEAT_RAS for -cpu max
61
target/arm: Remove now-unused vfp.fp_status_f16 and FPST_FPCR_F16
62
target/arm: Enable FEAT_IESB for -cpu max
62
fpu: Rename float_flag_input_denormal to float_flag_input_denormal_flushed
63
target/arm: Enable FEAT_CSV2 for -cpu max
63
fpu: Rename float_flag_output_denormal to float_flag_output_denormal_flushed
64
target/arm: Enable FEAT_CSV2_2 for -cpu max
64
fpu: Fix a comment in softfloat-types.h
65
target/arm: Enable FEAT_CSV3 for -cpu max
65
target/arm: Remove redundant advsimd float16 helpers
66
target/arm: Enable FEAT_DGH for -cpu max
66
target/arm: Use FPST_A64_F16 for halfprec-to-other conversions
67
target/arm: Define cortex-a76
68
target/arm: Define neoverse-n1
69
67
70
docs/system/arm/emulation.rst | 10 +
68
Philippe Mathieu-Daudé (9):
71
docs/system/arm/virt.rst | 2 +
69
hw/arm/nrf51: Rename ARMv7MState 'cpu' -> 'armv7m'
72
qapi/machine.json | 6 +-
70
hw/arm/stellaris: Add 'armv7m' local variable
73
target/arm/cpregs.h | 11 +
71
hw/arm/v7m: Remove use of &first_cpu in machine_init()
74
target/arm/cpu.h | 23 ++
72
hw/arm/stellaris: Link each board schematic
75
target/arm/helper.h | 1 +
73
hw/arm/stellaris: Constify read-only arrays
76
target/arm/internals.h | 16 ++
74
hw/arm/stellaris: Remove incorrect unimplemented i2c-0 at 0x40002000
77
target/arm/syndrome.h | 5 +
75
hw/arm/stellaris: Replace magic numbers by definitions
78
target/arm/a32.decode | 16 +-
76
hw/arm/stellaris: Use DEVCAP macro to access DeviceCapability registers
79
target/arm/t32.decode | 18 +-
77
hw/arm/stellaris: Map both I2C controllers
80
hw/acpi/aml-build.c | 111 ++++----
78
81
hw/arm/sbsa-ref.c | 16 ++
79
Thomas Huth (1):
82
hw/arm/virt.c | 21 +-
80
tests/functional: Add a test for the arm microbit machine
83
hw/core/machine-hmp-cmds.c | 4 +
81
84
hw/core/machine.c | 16 ++
82
MAINTAINERS | 1 +
85
target/arm/cpu.c | 66 ++++-
83
hw/usb/canokey.h | 4 --
86
target/arm/cpu64.c | 353 ++++++++++++++-----------
84
include/fpu/softfloat-types.h | 10 +--
87
target/arm/cpu_tcg.c | 227 +++++++++++-----
85
include/hw/arm/fsl-imx6.h | 4 +-
88
target/arm/helper.c | 600 +++++++++++++++++++++++++-----------------
86
include/hw/arm/fsl-imx7.h | 4 +-
89
target/arm/op_helper.c | 43 +++
87
include/hw/arm/nrf51_soc.h | 2 +-
90
target/arm/translate-a64.c | 18 ++
88
include/hw/char/imx_serial.h | 2 +-
91
target/arm/translate.c | 23 ++
89
include/hw/pci-host/designware.h | 1 +
92
tests/qtest/numa-test.c | 19 +-
90
target/arm/cpu.h | 12 ++--
93
.mailmap | 3 +-
91
target/arm/tcg/helper-a64.h | 8 ---
94
MAINTAINERS | 2 +-
92
target/arm/tcg/translate.h | 32 ++++++---
95
25 files changed, 1068 insertions(+), 562 deletions(-)
93
fpu/softfloat.c | 6 +-
94
hw/arm/b-l475e-iot01a.c | 2 +-
95
hw/arm/fsl-imx6.c | 13 +++-
96
hw/arm/fsl-imx7.c | 13 +++-
97
hw/arm/microbit.c | 2 +-
98
hw/arm/mps2-tz.c | 2 +-
99
hw/arm/mps2.c | 2 +-
100
hw/arm/msf2-som.c | 2 +-
101
hw/arm/musca.c | 2 +-
102
hw/arm/netduino2.c | 2 +-
103
hw/arm/netduinoplus2.c | 2 +-
104
hw/arm/nrf51_soc.c | 18 ++---
105
hw/arm/olimex-stm32-h405.c | 2 +-
106
hw/arm/stellaris.c | 118 +++++++++++++++++++-----------
107
hw/arm/stm32vldiscovery.c | 2 +-
108
hw/char/imx_serial.c | 7 +-
109
hw/pci-host/designware.c | 7 +-
110
hw/usb/canokey.c | 6 +-
111
target/arm/cpu.c | 6 +-
112
target/arm/helper.c | 2 +-
113
target/arm/tcg/helper-a64.c | 9 ---
114
target/arm/tcg/sme_helper.c | 6 +-
115
target/arm/tcg/sve_helper.c | 6 +-
116
target/arm/tcg/translate-a64.c | 103 ++++++++++++++-------------
117
target/arm/tcg/translate-sme.c | 4 +-
118
target/arm/tcg/translate-sve.c | 130 +++++++++++++++++-----------------
119
target/arm/tcg/translate-vfp.c | 78 ++++++++++----------
120
target/arm/tcg/vec_helper.c | 22 +++---
121
target/arm/vfp_helper.c | 73 +++++++++++--------
122
target/i386/tcg/fpu_helper.c | 8 +--
123
target/m68k/fpu_helper.c | 2 +-
124
target/mips/tcg/msa_helper.c | 4 +-
125
target/rx/op_helper.c | 4 +-
126
target/tricore/fpu_helper.c | 6 +-
127
fpu/softfloat-parts.c.inc | 4 +-
128
hw/arm/Kconfig | 2 +
129
tests/functional/meson.build | 1 +
130
tests/functional/test_arm_microbit.py | 31 ++++++++
131
49 files changed, 452 insertions(+), 337 deletions(-)
132
create mode 100755 tests/functional/test_arm_microbit.py
133
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 FIELD_DP{32,64} to manipulate id_pfr1 and id_aa64pfr0
3
The ARMv7MState object is not simply a CPU, it also
4
during arm_cpu_realizefn.
4
contains the NVIC, SysTick timer, and various MemoryRegions.
5
5
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6
Rename the field as 'armv7m', like other Cortex-M boards.
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7
8
Message-id: 20220506180242.216785-11-richard.henderson@linaro.org
8
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
9
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
10
Message-id: 20250112225614.33723-2-philmd@linaro.org
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
12
---
11
target/arm/cpu.c | 22 +++++++++++++---------
13
include/hw/arm/nrf51_soc.h | 2 +-
12
1 file changed, 13 insertions(+), 9 deletions(-)
14
hw/arm/nrf51_soc.c | 18 +++++++++---------
15
2 files changed, 10 insertions(+), 10 deletions(-)
13
16
14
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
17
diff --git a/include/hw/arm/nrf51_soc.h b/include/hw/arm/nrf51_soc.h
15
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/cpu.c
19
--- a/include/hw/arm/nrf51_soc.h
17
+++ b/target/arm/cpu.c
20
+++ b/include/hw/arm/nrf51_soc.h
18
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)
21
@@ -XXX,XX +XXX,XX @@ struct NRF51State {
19
*/
22
SysBusDevice parent_obj;
20
unset_feature(env, ARM_FEATURE_EL3);
23
21
24
/*< public >*/
22
- /* Disable the security extension feature bits in the processor feature
25
- ARMv7MState cpu;
23
- * registers as well. These are id_pfr1[7:4] and id_aa64pfr0[15:12].
26
+ ARMv7MState armv7m;
24
+ /*
27
25
+ * Disable the security extension feature bits in the processor
28
NRF51UARTState uart;
26
+ * feature registers as well.
29
NRF51RNGState rng;
27
*/
30
diff --git a/hw/arm/nrf51_soc.c b/hw/arm/nrf51_soc.c
28
- cpu->isar.id_pfr1 &= ~0xf0;
31
index XXXXXXX..XXXXXXX 100644
29
- cpu->isar.id_aa64pfr0 &= ~0xf000;
32
--- a/hw/arm/nrf51_soc.c
30
+ cpu->isar.id_pfr1 = FIELD_DP32(cpu->isar.id_pfr1, ID_PFR1, SECURITY, 0);
33
+++ b/hw/arm/nrf51_soc.c
31
+ cpu->isar.id_aa64pfr0 = FIELD_DP64(cpu->isar.id_aa64pfr0,
34
@@ -XXX,XX +XXX,XX @@ static void nrf51_soc_realize(DeviceState *dev_soc, Error **errp)
32
+ ID_AA64PFR0, EL3, 0);
33
}
35
}
34
36
/* This clock doesn't need migration because it is fixed-frequency */
35
if (!cpu->has_el2) {
37
clock_set_hz(s->sysclk, HCLK_FRQ);
36
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)
38
- qdev_connect_clock_in(DEVICE(&s->cpu), "cpuclk", s->sysclk);
39
+ qdev_connect_clock_in(DEVICE(&s->armv7m), "cpuclk", s->sysclk);
40
/*
41
* This SoC has no systick device, so don't connect refclk.
42
* TODO: model the lack of systick (currently the armv7m object
43
* will always provide one).
44
*/
45
46
- object_property_set_link(OBJECT(&s->cpu), "memory", OBJECT(&s->container),
47
+ object_property_set_link(OBJECT(&s->armv7m), "memory", OBJECT(&s->container),
48
&error_abort);
49
- if (!sysbus_realize(SYS_BUS_DEVICE(&s->cpu), errp)) {
50
+ if (!sysbus_realize(SYS_BUS_DEVICE(&s->armv7m), errp)) {
51
return;
37
}
52
}
38
53
39
if (!arm_feature(env, ARM_FEATURE_EL2)) {
54
@@ -XXX,XX +XXX,XX @@ static void nrf51_soc_realize(DeviceState *dev_soc, Error **errp)
40
- /* Disable the hypervisor feature bits in the processor feature
55
mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->uart), 0);
41
- * registers if we don't have EL2. These are id_pfr1[15:12] and
56
memory_region_add_subregion_overlap(&s->container, NRF51_UART_BASE, mr, 0);
42
- * id_aa64pfr0_el1[11:8].
57
sysbus_connect_irq(SYS_BUS_DEVICE(&s->uart), 0,
43
+ /*
58
- qdev_get_gpio_in(DEVICE(&s->cpu),
44
+ * Disable the hypervisor feature bits in the processor feature
59
+ qdev_get_gpio_in(DEVICE(&s->armv7m),
45
+ * registers if we don't have EL2.
60
BASE_TO_IRQ(NRF51_UART_BASE)));
46
*/
61
47
- cpu->isar.id_aa64pfr0 &= ~0xf00;
62
/* RNG */
48
- cpu->isar.id_pfr1 &= ~0xf000;
63
@@ -XXX,XX +XXX,XX @@ static void nrf51_soc_realize(DeviceState *dev_soc, Error **errp)
49
+ cpu->isar.id_aa64pfr0 = FIELD_DP64(cpu->isar.id_aa64pfr0,
64
mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->rng), 0);
50
+ ID_AA64PFR0, EL2, 0);
65
memory_region_add_subregion_overlap(&s->container, NRF51_RNG_BASE, mr, 0);
51
+ cpu->isar.id_pfr1 = FIELD_DP32(cpu->isar.id_pfr1,
66
sysbus_connect_irq(SYS_BUS_DEVICE(&s->rng), 0,
52
+ ID_PFR1, VIRTUALIZATION, 0);
67
- qdev_get_gpio_in(DEVICE(&s->cpu),
68
+ qdev_get_gpio_in(DEVICE(&s->armv7m),
69
BASE_TO_IRQ(NRF51_RNG_BASE)));
70
71
/* UICR, FICR, NVMC, FLASH */
72
@@ -XXX,XX +XXX,XX @@ static void nrf51_soc_realize(DeviceState *dev_soc, Error **errp)
73
74
sysbus_mmio_map(SYS_BUS_DEVICE(&s->timer[i]), 0, base_addr);
75
sysbus_connect_irq(SYS_BUS_DEVICE(&s->timer[i]), 0,
76
- qdev_get_gpio_in(DEVICE(&s->cpu),
77
+ qdev_get_gpio_in(DEVICE(&s->armv7m),
78
BASE_TO_IRQ(base_addr)));
53
}
79
}
54
80
55
#ifndef CONFIG_USER_ONLY
81
@@ -XXX,XX +XXX,XX @@ static void nrf51_soc_init(Object *obj)
82
83
memory_region_init(&s->container, obj, "nrf51-container", UINT64_MAX);
84
85
- object_initialize_child(OBJECT(s), "armv6m", &s->cpu, TYPE_ARMV7M);
86
- qdev_prop_set_string(DEVICE(&s->cpu), "cpu-type",
87
+ object_initialize_child(OBJECT(s), "armv6m", &s->armv7m, TYPE_ARMV7M);
88
+ qdev_prop_set_string(DEVICE(&s->armv7m), "cpu-type",
89
ARM_CPU_TYPE_NAME("cortex-m0"));
90
- qdev_prop_set_uint32(DEVICE(&s->cpu), "num-irq", 32);
91
+ qdev_prop_set_uint32(DEVICE(&s->armv7m), "num-irq", 32);
92
93
object_initialize_child(obj, "uart", &s->uart, TYPE_NRF51_UART);
94
object_property_add_alias(obj, "serial0", OBJECT(&s->uart), "chardev");
56
--
95
--
57
2.25.1
96
2.34.1
97
98
diff view generated by jsdifflib
1
From: Gavin Shan <gshan@redhat.com>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
In aarch64_numa_cpu(), the CPU and NUMA association is something
3
While the TYPE_ARMV7M object forward its NVIC interrupt lines,
4
like below. Two threads in the same core/cluster/socket are
4
it is somehow misleading to name it 'nvic'. Add the 'armv7m'
5
associated with two individual NUMA nodes, which is unreal as
5
local variable for clarity, but also keep the 'nvic' variable
6
Igor Mammedov mentioned. We don't expect the association to break
6
behaving like before when used for wiring IRQ lines.
7
NUMA-to-socket boundary, which matches with the real world.
8
7
9
NUMA-node socket cluster core thread
8
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
10
------------------------------------------
9
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
11
0 0 0 0 0
10
Message-id: 20250112225614.33723-3-philmd@linaro.org
12
1 0 0 0 1
13
14
This corrects the topology for CPUs and their association with
15
NUMA nodes. After this patch is applied, the CPU and NUMA
16
association becomes something like below, which looks real.
17
Besides, socket/cluster/core/thread IDs are all checked when
18
the NUMA node IDs are verified. It helps to check if the CPU
19
topology is properly populated or not.
20
21
NUMA-node socket cluster core thread
22
------------------------------------------
23
0 1 0 0 0
24
1 0 0 0 0
25
26
Suggested-by: Igor Mammedov <imammedo@redhat.com>
27
Signed-off-by: Gavin Shan <gshan@redhat.com>
28
Acked-by: Igor Mammedov <imammedo@redhat.com>
29
Message-id: 20220503140304.855514-5-gshan@redhat.com
30
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
31
---
12
---
32
tests/qtest/numa-test.c | 18 ++++++++++++------
13
hw/arm/stellaris.c | 21 +++++++++++----------
33
1 file changed, 12 insertions(+), 6 deletions(-)
14
1 file changed, 11 insertions(+), 10 deletions(-)
34
15
35
diff --git a/tests/qtest/numa-test.c b/tests/qtest/numa-test.c
16
diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c
36
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
37
--- a/tests/qtest/numa-test.c
18
--- a/hw/arm/stellaris.c
38
+++ b/tests/qtest/numa-test.c
19
+++ b/hw/arm/stellaris.c
39
@@ -XXX,XX +XXX,XX @@ static void aarch64_numa_cpu(const void *data)
20
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
40
g_autofree char *cli = NULL;
21
*/
41
22
42
cli = make_cli(data, "-machine "
23
Object *soc_container;
43
- "smp.cpus=2,smp.sockets=1,smp.clusters=1,smp.cores=1,smp.threads=2 "
24
- DeviceState *gpio_dev[7], *nvic;
44
+ "smp.cpus=2,smp.sockets=2,smp.clusters=1,smp.cores=1,smp.threads=1 "
25
+ DeviceState *gpio_dev[7], *armv7m, *nvic;
45
"-numa node,nodeid=0,memdev=ram -numa node,nodeid=1 "
26
qemu_irq gpio_in[7][8];
46
- "-numa cpu,node-id=1,thread-id=0 "
27
qemu_irq gpio_out[7][8];
47
- "-numa cpu,node-id=0,thread-id=1");
28
qemu_irq adc;
48
+ "-numa cpu,node-id=0,socket-id=1,cluster-id=0,core-id=0,thread-id=0 "
29
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
49
+ "-numa cpu,node-id=1,socket-id=0,cluster-id=0,core-id=0,thread-id=0");
30
qdev_prop_set_uint32(ssys_dev, "dc4", board->dc4);
50
qts = qtest_init(cli);
31
sysbus_realize_and_unref(SYS_BUS_DEVICE(ssys_dev), &error_fatal);
51
cpus = get_cpus(qts, &resp);
32
52
g_assert(cpus);
33
- nvic = qdev_new(TYPE_ARMV7M);
53
34
- object_property_add_child(soc_container, "v7m", OBJECT(nvic));
54
while ((e = qlist_pop(cpus))) {
35
- qdev_prop_set_uint32(nvic, "num-irq", NUM_IRQ_LINES);
55
QDict *cpu, *props;
36
- qdev_prop_set_uint8(nvic, "num-prio-bits", NUM_PRIO_BITS);
56
- int64_t thread, node;
37
- qdev_prop_set_string(nvic, "cpu-type", ms->cpu_type);
57
+ int64_t socket, cluster, core, thread, node;
38
- qdev_prop_set_bit(nvic, "enable-bitband", true);
58
39
- qdev_connect_clock_in(nvic, "cpuclk",
59
cpu = qobject_to(QDict, e);
40
+ armv7m = qdev_new(TYPE_ARMV7M);
60
g_assert(qdict_haskey(cpu, "props"));
41
+ object_property_add_child(soc_container, "v7m", OBJECT(armv7m));
61
@@ -XXX,XX +XXX,XX @@ static void aarch64_numa_cpu(const void *data)
42
+ qdev_prop_set_uint32(armv7m, "num-irq", NUM_IRQ_LINES);
62
43
+ qdev_prop_set_uint8(armv7m, "num-prio-bits", NUM_PRIO_BITS);
63
g_assert(qdict_haskey(props, "node-id"));
44
+ qdev_prop_set_string(armv7m, "cpu-type", ms->cpu_type);
64
node = qdict_get_int(props, "node-id");
45
+ qdev_prop_set_bit(armv7m, "enable-bitband", true);
65
+ g_assert(qdict_haskey(props, "socket-id"));
46
+ qdev_connect_clock_in(armv7m, "cpuclk",
66
+ socket = qdict_get_int(props, "socket-id");
47
qdev_get_clock_out(ssys_dev, "SYSCLK"));
67
+ g_assert(qdict_haskey(props, "cluster-id"));
48
/* This SoC does not connect the systick reference clock */
68
+ cluster = qdict_get_int(props, "cluster-id");
49
- object_property_set_link(OBJECT(nvic), "memory",
69
+ g_assert(qdict_haskey(props, "core-id"));
50
+ object_property_set_link(OBJECT(armv7m), "memory",
70
+ core = qdict_get_int(props, "core-id");
51
OBJECT(get_system_memory()), &error_abort);
71
g_assert(qdict_haskey(props, "thread-id"));
52
/* This will exit with an error if the user passed us a bad cpu_type */
72
thread = qdict_get_int(props, "thread-id");
53
- sysbus_realize_and_unref(SYS_BUS_DEVICE(nvic), &error_fatal);
73
54
+ sysbus_realize_and_unref(SYS_BUS_DEVICE(armv7m), &error_fatal);
74
- if (thread == 0) {
55
+ nvic = armv7m;
75
+ if (socket == 0 && cluster == 0 && core == 0 && thread == 0) {
56
76
g_assert_cmpint(node, ==, 1);
57
/* Now we can wire up the IRQ and MMIO of the system registers */
77
- } else if (thread == 1) {
58
sysbus_mmio_map(SYS_BUS_DEVICE(ssys_dev), 0, 0x400fe000);
78
+ } else if (socket == 1 && cluster == 0 && core == 0 && thread == 0) {
79
g_assert_cmpint(node, ==, 0);
80
} else {
81
g_assert(false);
82
--
59
--
83
2.25.1
60
2.34.1
61
62
diff view generated by jsdifflib
1
From: Gavin Shan <gshan@redhat.com>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
Currently, the SMP configuration isn't considered when the CPU
3
When instanciating the machine model, the machine_init()
4
topology is populated. In this case, it's impossible to provide
4
implementations usually create the CPUs, so have access
5
the default CPU-to-NUMA mapping or association based on the socket
5
to its first CPU. Use that rather then the &first_cpu
6
ID of the given CPU.
6
global.
7
7
8
This takes account of SMP configuration when the CPU topology
8
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
9
is populated. The die ID for the given CPU isn't assigned since
9
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
10
it's not supported on arm/virt machine. Besides, the used SMP
10
Reviewed-by: Samuel Tardieu <sam@rfc1149.net>
11
configuration in qtest/numa-test/aarch64_numa_cpu() is corrcted
11
Message-id: 20250112225614.33723-4-philmd@linaro.org
12
to avoid testing failure
13
14
Signed-off-by: Gavin Shan <gshan@redhat.com>
15
Reviewed-by: Yanan Wang <wangyanan55@huawei.com>
16
Acked-by: Igor Mammedov <imammedo@redhat.com>
17
Message-id: 20220503140304.855514-4-gshan@redhat.com
18
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
19
---
13
---
20
hw/arm/virt.c | 15 ++++++++++++++-
14
hw/arm/b-l475e-iot01a.c | 2 +-
21
1 file changed, 14 insertions(+), 1 deletion(-)
15
hw/arm/microbit.c | 2 +-
16
hw/arm/mps2-tz.c | 2 +-
17
hw/arm/mps2.c | 2 +-
18
hw/arm/msf2-som.c | 2 +-
19
hw/arm/musca.c | 2 +-
20
hw/arm/netduino2.c | 2 +-
21
hw/arm/netduinoplus2.c | 2 +-
22
hw/arm/olimex-stm32-h405.c | 2 +-
23
hw/arm/stellaris.c | 2 +-
24
hw/arm/stm32vldiscovery.c | 2 +-
25
11 files changed, 11 insertions(+), 11 deletions(-)
22
26
23
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
27
diff --git a/hw/arm/b-l475e-iot01a.c b/hw/arm/b-l475e-iot01a.c
24
index XXXXXXX..XXXXXXX 100644
28
index XXXXXXX..XXXXXXX 100644
25
--- a/hw/arm/virt.c
29
--- a/hw/arm/b-l475e-iot01a.c
26
+++ b/hw/arm/virt.c
30
+++ b/hw/arm/b-l475e-iot01a.c
27
@@ -XXX,XX +XXX,XX @@ static const CPUArchIdList *virt_possible_cpu_arch_ids(MachineState *ms)
31
@@ -XXX,XX +XXX,XX @@ static void bl475e_init(MachineState *machine)
28
int n;
32
sysbus_realize(SYS_BUS_DEVICE(&s->soc), &error_fatal);
29
unsigned int max_cpus = ms->smp.max_cpus;
33
30
VirtMachineState *vms = VIRT_MACHINE(ms);
34
sc = STM32L4X5_SOC_GET_CLASS(&s->soc);
31
+ MachineClass *mc = MACHINE_GET_CLASS(vms);
35
- armv7m_load_kernel(ARM_CPU(first_cpu), machine->kernel_filename, 0,
32
36
+ armv7m_load_kernel(s->soc.armv7m.cpu, machine->kernel_filename, 0,
33
if (ms->possible_cpus) {
37
sc->flash_size);
34
assert(ms->possible_cpus->len == max_cpus);
38
35
@@ -XXX,XX +XXX,XX @@ static const CPUArchIdList *virt_possible_cpu_arch_ids(MachineState *ms)
39
if (object_class_by_name(TYPE_DM163)) {
36
ms->possible_cpus->cpus[n].type = ms->cpu_type;
40
diff --git a/hw/arm/microbit.c b/hw/arm/microbit.c
37
ms->possible_cpus->cpus[n].arch_id =
41
index XXXXXXX..XXXXXXX 100644
38
virt_cpu_mp_affinity(vms, n);
42
--- a/hw/arm/microbit.c
39
+
43
+++ b/hw/arm/microbit.c
40
+ assert(!mc->smp_props.dies_supported);
44
@@ -XXX,XX +XXX,XX @@ static void microbit_init(MachineState *machine)
41
+ ms->possible_cpus->cpus[n].props.has_socket_id = true;
45
memory_region_add_subregion_overlap(&s->nrf51.container, NRF51_TWI_BASE,
42
+ ms->possible_cpus->cpus[n].props.socket_id =
46
mr, -1);
43
+ n / (ms->smp.clusters * ms->smp.cores * ms->smp.threads);
47
44
+ ms->possible_cpus->cpus[n].props.has_cluster_id = true;
48
- armv7m_load_kernel(ARM_CPU(first_cpu), machine->kernel_filename,
45
+ ms->possible_cpus->cpus[n].props.cluster_id =
49
+ armv7m_load_kernel(s->nrf51.armv7m.cpu, machine->kernel_filename,
46
+ (n / (ms->smp.cores * ms->smp.threads)) % ms->smp.clusters;
50
0, s->nrf51.flash_size);
47
+ ms->possible_cpus->cpus[n].props.has_core_id = true;
51
}
48
+ ms->possible_cpus->cpus[n].props.core_id =
52
49
+ (n / ms->smp.threads) % ms->smp.cores;
53
diff --git a/hw/arm/mps2-tz.c b/hw/arm/mps2-tz.c
50
ms->possible_cpus->cpus[n].props.has_thread_id = true;
54
index XXXXXXX..XXXXXXX 100644
51
- ms->possible_cpus->cpus[n].props.thread_id = n;
55
--- a/hw/arm/mps2-tz.c
52
+ ms->possible_cpus->cpus[n].props.thread_id =
56
+++ b/hw/arm/mps2-tz.c
53
+ n % ms->smp.threads;
57
@@ -XXX,XX +XXX,XX @@ static void mps2tz_common_init(MachineState *machine)
58
mms->remap_irq);
54
}
59
}
55
return ms->possible_cpus;
60
61
- armv7m_load_kernel(ARM_CPU(first_cpu), machine->kernel_filename,
62
+ armv7m_load_kernel(mms->iotkit.armv7m[0].cpu, machine->kernel_filename,
63
0, boot_ram_size(mms));
64
}
65
66
diff --git a/hw/arm/mps2.c b/hw/arm/mps2.c
67
index XXXXXXX..XXXXXXX 100644
68
--- a/hw/arm/mps2.c
69
+++ b/hw/arm/mps2.c
70
@@ -XXX,XX +XXX,XX @@ static void mps2_common_init(MachineState *machine)
71
qdev_get_gpio_in(armv7m,
72
mmc->fpga_type == FPGA_AN511 ? 47 : 13));
73
74
- armv7m_load_kernel(ARM_CPU(first_cpu), machine->kernel_filename,
75
+ armv7m_load_kernel(mms->armv7m.cpu, machine->kernel_filename,
76
0, 0x400000);
77
}
78
79
diff --git a/hw/arm/msf2-som.c b/hw/arm/msf2-som.c
80
index XXXXXXX..XXXXXXX 100644
81
--- a/hw/arm/msf2-som.c
82
+++ b/hw/arm/msf2-som.c
83
@@ -XXX,XX +XXX,XX @@ static void emcraft_sf2_s2s010_init(MachineState *machine)
84
cs_line = qdev_get_gpio_in_named(spi_flash, SSI_GPIO_CS, 0);
85
sysbus_connect_irq(SYS_BUS_DEVICE(&soc->spi[0]), 1, cs_line);
86
87
- armv7m_load_kernel(ARM_CPU(first_cpu), machine->kernel_filename,
88
+ armv7m_load_kernel(soc->armv7m.cpu, machine->kernel_filename,
89
0, soc->envm_size);
90
}
91
92
diff --git a/hw/arm/musca.c b/hw/arm/musca.c
93
index XXXXXXX..XXXXXXX 100644
94
--- a/hw/arm/musca.c
95
+++ b/hw/arm/musca.c
96
@@ -XXX,XX +XXX,XX @@ static void musca_init(MachineState *machine)
97
"cfg_sec_resp", 0));
98
}
99
100
- armv7m_load_kernel(ARM_CPU(first_cpu), machine->kernel_filename,
101
+ armv7m_load_kernel(mms->sse.armv7m[0].cpu, machine->kernel_filename,
102
0, 0x2000000);
103
}
104
105
diff --git a/hw/arm/netduino2.c b/hw/arm/netduino2.c
106
index XXXXXXX..XXXXXXX 100644
107
--- a/hw/arm/netduino2.c
108
+++ b/hw/arm/netduino2.c
109
@@ -XXX,XX +XXX,XX @@ static void netduino2_init(MachineState *machine)
110
qdev_connect_clock_in(dev, "sysclk", sysclk);
111
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
112
113
- armv7m_load_kernel(ARM_CPU(first_cpu), machine->kernel_filename,
114
+ armv7m_load_kernel(STM32F205_SOC(dev)->armv7m.cpu, machine->kernel_filename,
115
0, FLASH_SIZE);
116
}
117
118
diff --git a/hw/arm/netduinoplus2.c b/hw/arm/netduinoplus2.c
119
index XXXXXXX..XXXXXXX 100644
120
--- a/hw/arm/netduinoplus2.c
121
+++ b/hw/arm/netduinoplus2.c
122
@@ -XXX,XX +XXX,XX @@ static void netduinoplus2_init(MachineState *machine)
123
qdev_connect_clock_in(dev, "sysclk", sysclk);
124
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
125
126
- armv7m_load_kernel(ARM_CPU(first_cpu),
127
+ armv7m_load_kernel(STM32F405_SOC(dev)->armv7m.cpu,
128
machine->kernel_filename,
129
0, FLASH_SIZE);
130
}
131
diff --git a/hw/arm/olimex-stm32-h405.c b/hw/arm/olimex-stm32-h405.c
132
index XXXXXXX..XXXXXXX 100644
133
--- a/hw/arm/olimex-stm32-h405.c
134
+++ b/hw/arm/olimex-stm32-h405.c
135
@@ -XXX,XX +XXX,XX @@ static void olimex_stm32_h405_init(MachineState *machine)
136
qdev_connect_clock_in(dev, "sysclk", sysclk);
137
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
138
139
- armv7m_load_kernel(ARM_CPU(first_cpu),
140
+ armv7m_load_kernel(STM32F405_SOC(dev)->armv7m.cpu,
141
machine->kernel_filename,
142
0, FLASH_SIZE);
143
}
144
diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c
145
index XXXXXXX..XXXXXXX 100644
146
--- a/hw/arm/stellaris.c
147
+++ b/hw/arm/stellaris.c
148
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
149
create_unimplemented_device("hibernation", 0x400fc000, 0x1000);
150
create_unimplemented_device("flash-control", 0x400fd000, 0x1000);
151
152
- armv7m_load_kernel(ARM_CPU(first_cpu), ms->kernel_filename, 0, flash_size);
153
+ armv7m_load_kernel(ARMV7M(armv7m)->cpu, ms->kernel_filename, 0, flash_size);
154
}
155
156
/* FIXME: Figure out how to generate these from stellaris_boards. */
157
diff --git a/hw/arm/stm32vldiscovery.c b/hw/arm/stm32vldiscovery.c
158
index XXXXXXX..XXXXXXX 100644
159
--- a/hw/arm/stm32vldiscovery.c
160
+++ b/hw/arm/stm32vldiscovery.c
161
@@ -XXX,XX +XXX,XX @@ static void stm32vldiscovery_init(MachineState *machine)
162
qdev_connect_clock_in(dev, "sysclk", sysclk);
163
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
164
165
- armv7m_load_kernel(ARM_CPU(first_cpu),
166
+ armv7m_load_kernel(STM32F100_SOC(dev)->armv7m.cpu,
167
machine->kernel_filename,
168
0, FLASH_SIZE);
56
}
169
}
57
--
170
--
58
2.25.1
171
2.34.1
172
173
diff view generated by jsdifflib
1
From: Gavin Shan <gshan@redhat.com>
1
From: Bernhard Beschow <shentey@gmail.com>
2
2
3
This adds cluster-id in CPU instance properties, which will be used
3
The value of the UCFR register is respected when echoing characters to the
4
by arm/virt machine. Besides, the cluster-id is also verified or
4
terminal, but its reset value is reserved. Fix the reset value to the one
5
dumped in various spots:
5
documented in the datasheet.
6
6
7
* hw/core/machine.c::machine_set_cpu_numa_node() to associate
7
While at it move the related attribute out of the section of unimplemented
8
CPU with its NUMA node.
8
registers since its value is actually respected.
9
9
10
* hw/core/machine.c::machine_numa_finish_cpu_init() to record
10
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
11
CPU slots with no NUMA mapping set.
11
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
12
13
* hw/core/machine-hmp-cmds.c::hmp_hotpluggable_cpus() to dump
14
cluster-id.
15
16
Signed-off-by: Gavin Shan <gshan@redhat.com>
17
Reviewed-by: Yanan Wang <wangyanan55@huawei.com>
18
Acked-by: Igor Mammedov <imammedo@redhat.com>
19
Message-id: 20220503140304.855514-2-gshan@redhat.com
20
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
21
---
13
---
22
qapi/machine.json | 6 ++++--
14
include/hw/char/imx_serial.h | 2 +-
23
hw/core/machine-hmp-cmds.c | 4 ++++
15
hw/char/imx_serial.c | 1 +
24
hw/core/machine.c | 16 ++++++++++++++++
16
2 files changed, 2 insertions(+), 1 deletion(-)
25
3 files changed, 24 insertions(+), 2 deletions(-)
26
17
27
diff --git a/qapi/machine.json b/qapi/machine.json
18
diff --git a/include/hw/char/imx_serial.h b/include/hw/char/imx_serial.h
28
index XXXXXXX..XXXXXXX 100644
19
index XXXXXXX..XXXXXXX 100644
29
--- a/qapi/machine.json
20
--- a/include/hw/char/imx_serial.h
30
+++ b/qapi/machine.json
21
+++ b/include/hw/char/imx_serial.h
31
@@ -XXX,XX +XXX,XX @@
22
@@ -XXX,XX +XXX,XX @@ struct IMXSerialState {
32
# @node-id: NUMA node ID the CPU belongs to
23
uint32_t ucr1;
33
# @socket-id: socket number within node/board the CPU belongs to
24
uint32_t ucr2;
34
# @die-id: die number within socket the CPU belongs to (since 4.1)
25
uint32_t uts1;
35
-# @core-id: core number within die the CPU belongs to
26
+ uint32_t ufcr;
36
+# @cluster-id: cluster number within die the CPU belongs to (since 7.1)
27
37
+# @core-id: core number within cluster the CPU belongs to
28
/*
38
# @thread-id: thread number within core the CPU belongs to
29
* The registers below are implemented just so that the
39
#
30
* guest OS sees what it has written
40
-# Note: currently there are 5 properties that could be present
31
*/
41
+# Note: currently there are 6 properties that could be present
32
uint32_t onems;
42
# but management should be prepared to pass through other
33
- uint32_t ufcr;
43
# properties with device_add command to allow for future
34
uint32_t ubmr;
44
# interface extension. This also requires the filed names to be kept in
35
uint32_t ubrc;
45
@@ -XXX,XX +XXX,XX @@
36
uint32_t ucr3;
46
'data': { '*node-id': 'int',
37
diff --git a/hw/char/imx_serial.c b/hw/char/imx_serial.c
47
'*socket-id': 'int',
48
'*die-id': 'int',
49
+ '*cluster-id': 'int',
50
'*core-id': 'int',
51
'*thread-id': 'int'
52
}
53
diff --git a/hw/core/machine-hmp-cmds.c b/hw/core/machine-hmp-cmds.c
54
index XXXXXXX..XXXXXXX 100644
38
index XXXXXXX..XXXXXXX 100644
55
--- a/hw/core/machine-hmp-cmds.c
39
--- a/hw/char/imx_serial.c
56
+++ b/hw/core/machine-hmp-cmds.c
40
+++ b/hw/char/imx_serial.c
57
@@ -XXX,XX +XXX,XX @@ void hmp_hotpluggable_cpus(Monitor *mon, const QDict *qdict)
41
@@ -XXX,XX +XXX,XX @@ static void imx_serial_reset(IMXSerialState *s)
58
if (c->has_die_id) {
42
s->ucr3 = 0x700;
59
monitor_printf(mon, " die-id: \"%" PRIu64 "\"\n", c->die_id);
43
s->ubmr = 0;
60
}
44
s->ubrc = 4;
61
+ if (c->has_cluster_id) {
45
+ s->ufcr = BIT(11) | BIT(0);
62
+ monitor_printf(mon, " cluster-id: \"%" PRIu64 "\"\n",
46
63
+ c->cluster_id);
47
fifo32_reset(&s->rx_fifo);
64
+ }
48
timer_del(&s->ageing_timer);
65
if (c->has_core_id) {
66
monitor_printf(mon, " core-id: \"%" PRIu64 "\"\n", c->core_id);
67
}
68
diff --git a/hw/core/machine.c b/hw/core/machine.c
69
index XXXXXXX..XXXXXXX 100644
70
--- a/hw/core/machine.c
71
+++ b/hw/core/machine.c
72
@@ -XXX,XX +XXX,XX @@ void machine_set_cpu_numa_node(MachineState *machine,
73
return;
74
}
75
76
+ if (props->has_cluster_id && !slot->props.has_cluster_id) {
77
+ error_setg(errp, "cluster-id is not supported");
78
+ return;
79
+ }
80
+
81
if (props->has_socket_id && !slot->props.has_socket_id) {
82
error_setg(errp, "socket-id is not supported");
83
return;
84
@@ -XXX,XX +XXX,XX @@ void machine_set_cpu_numa_node(MachineState *machine,
85
continue;
86
}
87
88
+ if (props->has_cluster_id &&
89
+ props->cluster_id != slot->props.cluster_id) {
90
+ continue;
91
+ }
92
+
93
if (props->has_die_id && props->die_id != slot->props.die_id) {
94
continue;
95
}
96
@@ -XXX,XX +XXX,XX @@ static char *cpu_slot_to_string(const CPUArchId *cpu)
97
}
98
g_string_append_printf(s, "die-id: %"PRId64, cpu->props.die_id);
99
}
100
+ if (cpu->props.has_cluster_id) {
101
+ if (s->len) {
102
+ g_string_append_printf(s, ", ");
103
+ }
104
+ g_string_append_printf(s, "cluster-id: %"PRId64, cpu->props.cluster_id);
105
+ }
106
if (cpu->props.has_core_id) {
107
if (s->len) {
108
g_string_append_printf(s, ", ");
109
--
49
--
110
2.25.1
50
2.34.1
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Bernhard Beschow <shentey@gmail.com>
2
2
3
Update the legacy feature names to the current names.
3
Fixes characters to be "echoed" after each keystroke rather than after every
4
Provide feature names for id changes that were not marked.
4
other since imx_serial_rx_fifo_ageing_timer_restart() would see ~UTS1_RXEMPTY
5
Sort the field updates into increasing bitfield order.
5
only after every other keystroke.
6
6
7
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20220506180242.216785-10-richard.henderson@linaro.org
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
10
---
12
target/arm/cpu64.c | 100 +++++++++++++++++++++----------------------
11
hw/char/imx_serial.c | 6 +++---
13
target/arm/cpu_tcg.c | 48 ++++++++++-----------
12
1 file changed, 3 insertions(+), 3 deletions(-)
14
2 files changed, 74 insertions(+), 74 deletions(-)
15
13
16
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
14
diff --git a/hw/char/imx_serial.c b/hw/char/imx_serial.c
17
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
18
--- a/target/arm/cpu64.c
16
--- a/hw/char/imx_serial.c
19
+++ b/target/arm/cpu64.c
17
+++ b/hw/char/imx_serial.c
20
@@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj)
18
@@ -XXX,XX +XXX,XX @@ static void imx_put_data(void *opaque, uint32_t value)
21
cpu->midr = t;
19
if (fifo32_num_used(&s->rx_fifo) >= rxtl) {
22
20
s->usr1 |= USR1_RRDY;
23
t = cpu->isar.id_aa64isar0;
21
}
24
- t = FIELD_DP64(t, ID_AA64ISAR0, AES, 2); /* AES + PMULL */
22
-
25
- t = FIELD_DP64(t, ID_AA64ISAR0, SHA1, 1);
23
- imx_serial_rx_fifo_ageing_timer_restart(s);
26
- t = FIELD_DP64(t, ID_AA64ISAR0, SHA2, 2); /* SHA512 */
24
-
27
+ t = FIELD_DP64(t, ID_AA64ISAR0, AES, 2); /* FEAT_PMULL */
25
s->usr2 |= USR2_RDR;
28
+ t = FIELD_DP64(t, ID_AA64ISAR0, SHA1, 1); /* FEAT_SHA1 */
26
s->uts1 &= ~UTS1_RXEMPTY;
29
+ t = FIELD_DP64(t, ID_AA64ISAR0, SHA2, 2); /* FEAT_SHA512 */
27
if (value & URXD_BRK) {
30
t = FIELD_DP64(t, ID_AA64ISAR0, CRC32, 1);
28
s->usr2 |= USR2_BRCD;
31
- t = FIELD_DP64(t, ID_AA64ISAR0, ATOMIC, 2);
29
}
32
- t = FIELD_DP64(t, ID_AA64ISAR0, RDM, 1);
30
+
33
- t = FIELD_DP64(t, ID_AA64ISAR0, SHA3, 1);
31
+ imx_serial_rx_fifo_ageing_timer_restart(s);
34
- t = FIELD_DP64(t, ID_AA64ISAR0, SM3, 1);
32
+
35
- t = FIELD_DP64(t, ID_AA64ISAR0, SM4, 1);
33
imx_update(s);
36
- t = FIELD_DP64(t, ID_AA64ISAR0, DP, 1);
37
- t = FIELD_DP64(t, ID_AA64ISAR0, FHM, 1);
38
- t = FIELD_DP64(t, ID_AA64ISAR0, TS, 2); /* v8.5-CondM */
39
- t = FIELD_DP64(t, ID_AA64ISAR0, TLB, 2); /* FEAT_TLBIRANGE */
40
- t = FIELD_DP64(t, ID_AA64ISAR0, RNDR, 1);
41
+ t = FIELD_DP64(t, ID_AA64ISAR0, ATOMIC, 2); /* FEAT_LSE */
42
+ t = FIELD_DP64(t, ID_AA64ISAR0, RDM, 1); /* FEAT_RDM */
43
+ t = FIELD_DP64(t, ID_AA64ISAR0, SHA3, 1); /* FEAT_SHA3 */
44
+ t = FIELD_DP64(t, ID_AA64ISAR0, SM3, 1); /* FEAT_SM3 */
45
+ t = FIELD_DP64(t, ID_AA64ISAR0, SM4, 1); /* FEAT_SM4 */
46
+ t = FIELD_DP64(t, ID_AA64ISAR0, DP, 1); /* FEAT_DotProd */
47
+ t = FIELD_DP64(t, ID_AA64ISAR0, FHM, 1); /* FEAT_FHM */
48
+ t = FIELD_DP64(t, ID_AA64ISAR0, TS, 2); /* FEAT_FlagM2 */
49
+ t = FIELD_DP64(t, ID_AA64ISAR0, TLB, 2); /* FEAT_TLBIRANGE */
50
+ t = FIELD_DP64(t, ID_AA64ISAR0, RNDR, 1); /* FEAT_RNG */
51
cpu->isar.id_aa64isar0 = t;
52
53
t = cpu->isar.id_aa64isar1;
54
- t = FIELD_DP64(t, ID_AA64ISAR1, DPB, 2);
55
- t = FIELD_DP64(t, ID_AA64ISAR1, JSCVT, 1);
56
- t = FIELD_DP64(t, ID_AA64ISAR1, FCMA, 1);
57
- t = FIELD_DP64(t, ID_AA64ISAR1, SB, 1);
58
- t = FIELD_DP64(t, ID_AA64ISAR1, SPECRES, 1);
59
- t = FIELD_DP64(t, ID_AA64ISAR1, BF16, 1);
60
- t = FIELD_DP64(t, ID_AA64ISAR1, FRINTTS, 1);
61
- t = FIELD_DP64(t, ID_AA64ISAR1, LRCPC, 2); /* ARMv8.4-RCPC */
62
- t = FIELD_DP64(t, ID_AA64ISAR1, I8MM, 1);
63
+ t = FIELD_DP64(t, ID_AA64ISAR1, DPB, 2); /* FEAT_DPB2 */
64
+ t = FIELD_DP64(t, ID_AA64ISAR1, JSCVT, 1); /* FEAT_JSCVT */
65
+ t = FIELD_DP64(t, ID_AA64ISAR1, FCMA, 1); /* FEAT_FCMA */
66
+ t = FIELD_DP64(t, ID_AA64ISAR1, LRCPC, 2); /* FEAT_LRCPC2 */
67
+ t = FIELD_DP64(t, ID_AA64ISAR1, FRINTTS, 1); /* FEAT_FRINTTS */
68
+ t = FIELD_DP64(t, ID_AA64ISAR1, SB, 1); /* FEAT_SB */
69
+ t = FIELD_DP64(t, ID_AA64ISAR1, SPECRES, 1); /* FEAT_SPECRES */
70
+ t = FIELD_DP64(t, ID_AA64ISAR1, BF16, 1); /* FEAT_BF16 */
71
+ t = FIELD_DP64(t, ID_AA64ISAR1, I8MM, 1); /* FEAT_I8MM */
72
cpu->isar.id_aa64isar1 = t;
73
74
t = cpu->isar.id_aa64pfr0;
75
+ t = FIELD_DP64(t, ID_AA64PFR0, FP, 1); /* FEAT_FP16 */
76
+ t = FIELD_DP64(t, ID_AA64PFR0, ADVSIMD, 1); /* FEAT_FP16 */
77
t = FIELD_DP64(t, ID_AA64PFR0, SVE, 1);
78
- t = FIELD_DP64(t, ID_AA64PFR0, FP, 1);
79
- t = FIELD_DP64(t, ID_AA64PFR0, ADVSIMD, 1);
80
- t = FIELD_DP64(t, ID_AA64PFR0, SEL2, 1);
81
- t = FIELD_DP64(t, ID_AA64PFR0, DIT, 1);
82
+ t = FIELD_DP64(t, ID_AA64PFR0, SEL2, 1); /* FEAT_SEL2 */
83
+ t = FIELD_DP64(t, ID_AA64PFR0, DIT, 1); /* FEAT_DIT */
84
cpu->isar.id_aa64pfr0 = t;
85
86
t = cpu->isar.id_aa64pfr1;
87
- t = FIELD_DP64(t, ID_AA64PFR1, BT, 1);
88
- t = FIELD_DP64(t, ID_AA64PFR1, SSBS, 2);
89
+ t = FIELD_DP64(t, ID_AA64PFR1, BT, 1); /* FEAT_BTI */
90
+ t = FIELD_DP64(t, ID_AA64PFR1, SSBS, 2); /* FEAT_SSBS2 */
91
/*
92
* Begin with full support for MTE. This will be downgraded to MTE=0
93
* during realize if the board provides no tag memory, much like
94
* we do for EL2 with the virtualization=on property.
95
*/
96
- t = FIELD_DP64(t, ID_AA64PFR1, MTE, 3);
97
+ t = FIELD_DP64(t, ID_AA64PFR1, MTE, 3); /* FEAT_MTE3 */
98
cpu->isar.id_aa64pfr1 = t;
99
100
t = cpu->isar.id_aa64mmfr0;
101
@@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj)
102
cpu->isar.id_aa64mmfr0 = t;
103
104
t = cpu->isar.id_aa64mmfr1;
105
- t = FIELD_DP64(t, ID_AA64MMFR1, HPDS, 1); /* HPD */
106
- t = FIELD_DP64(t, ID_AA64MMFR1, LO, 1);
107
- t = FIELD_DP64(t, ID_AA64MMFR1, VH, 1);
108
- t = FIELD_DP64(t, ID_AA64MMFR1, PAN, 2); /* ATS1E1 */
109
- t = FIELD_DP64(t, ID_AA64MMFR1, VMIDBITS, 2); /* VMID16 */
110
- t = FIELD_DP64(t, ID_AA64MMFR1, XNX, 1); /* TTS2UXN */
111
+ t = FIELD_DP64(t, ID_AA64MMFR1, VMIDBITS, 2); /* FEAT_VMID16 */
112
+ t = FIELD_DP64(t, ID_AA64MMFR1, VH, 1); /* FEAT_VHE */
113
+ t = FIELD_DP64(t, ID_AA64MMFR1, HPDS, 1); /* FEAT_HPDS */
114
+ t = FIELD_DP64(t, ID_AA64MMFR1, LO, 1); /* FEAT_LOR */
115
+ t = FIELD_DP64(t, ID_AA64MMFR1, PAN, 2); /* FEAT_PAN2 */
116
+ t = FIELD_DP64(t, ID_AA64MMFR1, XNX, 1); /* FEAT_XNX */
117
cpu->isar.id_aa64mmfr1 = t;
118
119
t = cpu->isar.id_aa64mmfr2;
120
- t = FIELD_DP64(t, ID_AA64MMFR2, UAO, 1);
121
- t = FIELD_DP64(t, ID_AA64MMFR2, CNP, 1); /* TTCNP */
122
- t = FIELD_DP64(t, ID_AA64MMFR2, ST, 1); /* TTST */
123
- t = FIELD_DP64(t, ID_AA64MMFR2, VARANGE, 1); /* FEAT_LVA */
124
- t = FIELD_DP64(t, ID_AA64MMFR2, TTL, 1); /* FEAT_TTL */
125
- t = FIELD_DP64(t, ID_AA64MMFR2, BBM, 2); /* FEAT_BBM at level 2 */
126
+ t = FIELD_DP64(t, ID_AA64MMFR2, CNP, 1); /* FEAT_TTCNP */
127
+ t = FIELD_DP64(t, ID_AA64MMFR2, UAO, 1); /* FEAT_UAO */
128
+ t = FIELD_DP64(t, ID_AA64MMFR2, VARANGE, 1); /* FEAT_LVA */
129
+ t = FIELD_DP64(t, ID_AA64MMFR2, ST, 1); /* FEAT_TTST */
130
+ t = FIELD_DP64(t, ID_AA64MMFR2, TTL, 1); /* FEAT_TTL */
131
+ t = FIELD_DP64(t, ID_AA64MMFR2, BBM, 2); /* FEAT_BBM at level 2 */
132
cpu->isar.id_aa64mmfr2 = t;
133
134
t = cpu->isar.id_aa64zfr0;
135
t = FIELD_DP64(t, ID_AA64ZFR0, SVEVER, 1);
136
- t = FIELD_DP64(t, ID_AA64ZFR0, AES, 2); /* PMULL */
137
- t = FIELD_DP64(t, ID_AA64ZFR0, BITPERM, 1);
138
- t = FIELD_DP64(t, ID_AA64ZFR0, BFLOAT16, 1);
139
- t = FIELD_DP64(t, ID_AA64ZFR0, SHA3, 1);
140
- t = FIELD_DP64(t, ID_AA64ZFR0, SM4, 1);
141
- t = FIELD_DP64(t, ID_AA64ZFR0, I8MM, 1);
142
- t = FIELD_DP64(t, ID_AA64ZFR0, F32MM, 1);
143
- t = FIELD_DP64(t, ID_AA64ZFR0, F64MM, 1);
144
+ t = FIELD_DP64(t, ID_AA64ZFR0, AES, 2); /* FEAT_SVE_PMULL128 */
145
+ t = FIELD_DP64(t, ID_AA64ZFR0, BITPERM, 1); /* FEAT_SVE_BitPerm */
146
+ t = FIELD_DP64(t, ID_AA64ZFR0, BFLOAT16, 1); /* FEAT_BF16 */
147
+ t = FIELD_DP64(t, ID_AA64ZFR0, SHA3, 1); /* FEAT_SVE_SHA3 */
148
+ t = FIELD_DP64(t, ID_AA64ZFR0, SM4, 1); /* FEAT_SVE_SM4 */
149
+ t = FIELD_DP64(t, ID_AA64ZFR0, I8MM, 1); /* FEAT_I8MM */
150
+ t = FIELD_DP64(t, ID_AA64ZFR0, F32MM, 1); /* FEAT_F32MM */
151
+ t = FIELD_DP64(t, ID_AA64ZFR0, F64MM, 1); /* FEAT_F64MM */
152
cpu->isar.id_aa64zfr0 = t;
153
154
t = cpu->isar.id_aa64dfr0;
155
- t = FIELD_DP64(t, ID_AA64DFR0, PMUVER, 5); /* v8.4-PMU */
156
+ t = FIELD_DP64(t, ID_AA64DFR0, PMUVER, 5); /* FEAT_PMUv3p4 */
157
cpu->isar.id_aa64dfr0 = t;
158
159
/* Replicate the same data to the 32-bit id registers. */
160
diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c
161
index XXXXXXX..XXXXXXX 100644
162
--- a/target/arm/cpu_tcg.c
163
+++ b/target/arm/cpu_tcg.c
164
@@ -XXX,XX +XXX,XX @@ void aa32_max_features(ARMCPU *cpu)
165
166
/* Add additional features supported by QEMU */
167
t = cpu->isar.id_isar5;
168
- t = FIELD_DP32(t, ID_ISAR5, AES, 2);
169
- t = FIELD_DP32(t, ID_ISAR5, SHA1, 1);
170
- t = FIELD_DP32(t, ID_ISAR5, SHA2, 1);
171
+ t = FIELD_DP32(t, ID_ISAR5, AES, 2); /* FEAT_PMULL */
172
+ t = FIELD_DP32(t, ID_ISAR5, SHA1, 1); /* FEAT_SHA1 */
173
+ t = FIELD_DP32(t, ID_ISAR5, SHA2, 1); /* FEAT_SHA256 */
174
t = FIELD_DP32(t, ID_ISAR5, CRC32, 1);
175
- t = FIELD_DP32(t, ID_ISAR5, RDM, 1);
176
- t = FIELD_DP32(t, ID_ISAR5, VCMA, 1);
177
+ t = FIELD_DP32(t, ID_ISAR5, RDM, 1); /* FEAT_RDM */
178
+ t = FIELD_DP32(t, ID_ISAR5, VCMA, 1); /* FEAT_FCMA */
179
cpu->isar.id_isar5 = t;
180
181
t = cpu->isar.id_isar6;
182
- t = FIELD_DP32(t, ID_ISAR6, JSCVT, 1);
183
- t = FIELD_DP32(t, ID_ISAR6, DP, 1);
184
- t = FIELD_DP32(t, ID_ISAR6, FHM, 1);
185
- t = FIELD_DP32(t, ID_ISAR6, SB, 1);
186
- t = FIELD_DP32(t, ID_ISAR6, SPECRES, 1);
187
- t = FIELD_DP32(t, ID_ISAR6, BF16, 1);
188
- t = FIELD_DP32(t, ID_ISAR6, I8MM, 1);
189
+ t = FIELD_DP32(t, ID_ISAR6, JSCVT, 1); /* FEAT_JSCVT */
190
+ t = FIELD_DP32(t, ID_ISAR6, DP, 1); /* Feat_DotProd */
191
+ t = FIELD_DP32(t, ID_ISAR6, FHM, 1); /* FEAT_FHM */
192
+ t = FIELD_DP32(t, ID_ISAR6, SB, 1); /* FEAT_SB */
193
+ t = FIELD_DP32(t, ID_ISAR6, SPECRES, 1); /* FEAT_SPECRES */
194
+ t = FIELD_DP32(t, ID_ISAR6, BF16, 1); /* FEAT_AA32BF16 */
195
+ t = FIELD_DP32(t, ID_ISAR6, I8MM, 1); /* FEAT_AA32I8MM */
196
cpu->isar.id_isar6 = t;
197
198
t = cpu->isar.mvfr1;
199
- t = FIELD_DP32(t, MVFR1, FPHP, 3); /* v8.2-FP16 */
200
- t = FIELD_DP32(t, MVFR1, SIMDHP, 2); /* v8.2-FP16 */
201
+ t = FIELD_DP32(t, MVFR1, FPHP, 3); /* FEAT_FP16 */
202
+ t = FIELD_DP32(t, MVFR1, SIMDHP, 2); /* FEAT_FP16 */
203
cpu->isar.mvfr1 = t;
204
205
t = cpu->isar.mvfr2;
206
- t = FIELD_DP32(t, MVFR2, SIMDMISC, 3); /* SIMD MaxNum */
207
- t = FIELD_DP32(t, MVFR2, FPMISC, 4); /* FP MaxNum */
208
+ t = FIELD_DP32(t, MVFR2, SIMDMISC, 3); /* SIMD MaxNum */
209
+ t = FIELD_DP32(t, MVFR2, FPMISC, 4); /* FP MaxNum */
210
cpu->isar.mvfr2 = t;
211
212
t = cpu->isar.id_mmfr3;
213
- t = FIELD_DP32(t, ID_MMFR3, PAN, 2); /* ATS1E1 */
214
+ t = FIELD_DP32(t, ID_MMFR3, PAN, 2); /* FEAT_PAN2 */
215
cpu->isar.id_mmfr3 = t;
216
217
t = cpu->isar.id_mmfr4;
218
- t = FIELD_DP32(t, ID_MMFR4, HPDS, 1); /* AA32HPD */
219
- t = FIELD_DP32(t, ID_MMFR4, AC2, 1); /* ACTLR2, HACTLR2 */
220
- t = FIELD_DP32(t, ID_MMFR4, CNP, 1); /* TTCNP */
221
- t = FIELD_DP32(t, ID_MMFR4, XNX, 1); /* TTS2UXN */
222
+ t = FIELD_DP32(t, ID_MMFR4, HPDS, 1); /* FEAT_AA32HPD */
223
+ t = FIELD_DP32(t, ID_MMFR4, AC2, 1); /* ACTLR2, HACTLR2 */
224
+ t = FIELD_DP32(t, ID_MMFR4, CNP, 1); /* FEAT_TTCNP */
225
+ t = FIELD_DP32(t, ID_MMFR4, XNX, 1); /* FEAT_XNX*/
226
cpu->isar.id_mmfr4 = t;
227
228
t = cpu->isar.id_pfr0;
229
- t = FIELD_DP32(t, ID_PFR0, DIT, 1);
230
+ t = FIELD_DP32(t, ID_PFR0, DIT, 1); /* FEAT_DIT */
231
cpu->isar.id_pfr0 = t;
232
233
t = cpu->isar.id_pfr2;
234
- t = FIELD_DP32(t, ID_PFR2, SSBS, 1);
235
+ t = FIELD_DP32(t, ID_PFR2, SSBS, 1); /* FEAT_SSBS */
236
cpu->isar.id_pfr2 = t;
237
238
t = cpu->isar.id_dfr0;
239
- t = FIELD_DP32(t, ID_DFR0, PERFMON, 5); /* v8.4-PMU */
240
+ t = FIELD_DP32(t, ID_DFR0, PERFMON, 5); /* FEAT_PMUv3p4 */
241
cpu->isar.id_dfr0 = t;
242
}
34
}
243
35
244
--
36
--
245
2.25.1
37
2.34.1
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Bernhard Beschow <shentey@gmail.com>
2
2
3
Drop zcr_no_el2_reginfo and merge the 3 registers into one array,
3
Fixes INTD and MSI interrupts poking the same IRQ line without keeping track of
4
now that ZCR_EL2 can be squashed to RES0 and ZCR_EL3 dropped
4
each other's IRQ level. Furthermore, SoCs such as the i.MX 8M Plus don't share
5
while registering.
5
the MSI IRQ with the INTx lines, so expose it as a dedicated pin.
6
6
7
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20220506180242.216785-4-richard.henderson@linaro.org
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
10
---
12
target/arm/helper.c | 55 ++++++++++++++-------------------------------
11
include/hw/arm/fsl-imx6.h | 4 +++-
13
1 file changed, 17 insertions(+), 38 deletions(-)
12
include/hw/arm/fsl-imx7.h | 4 +++-
13
include/hw/pci-host/designware.h | 1 +
14
hw/arm/fsl-imx6.c | 13 ++++++++++++-
15
hw/arm/fsl-imx7.c | 13 ++++++++++++-
16
hw/pci-host/designware.c | 7 +++----
17
hw/arm/Kconfig | 2 ++
18
7 files changed, 36 insertions(+), 8 deletions(-)
14
19
15
diff --git a/target/arm/helper.c b/target/arm/helper.c
20
diff --git a/include/hw/arm/fsl-imx6.h b/include/hw/arm/fsl-imx6.h
16
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX 100644
17
--- a/target/arm/helper.c
22
--- a/include/hw/arm/fsl-imx6.h
18
+++ b/target/arm/helper.c
23
+++ b/include/hw/arm/fsl-imx6.h
19
@@ -XXX,XX +XXX,XX @@ static void zcr_write(CPUARMState *env, const ARMCPRegInfo *ri,
24
@@ -XXX,XX +XXX,XX @@
25
#include "hw/usb/chipidea.h"
26
#include "hw/usb/imx-usb-phy.h"
27
#include "hw/pci-host/designware.h"
28
+#include "hw/or-irq.h"
29
#include "exec/memory.h"
30
#include "cpu.h"
31
#include "qom/object.h"
32
@@ -XXX,XX +XXX,XX @@ struct FslIMX6State {
33
ChipideaState usb[FSL_IMX6_NUM_USBS];
34
IMXFECState eth;
35
DesignwarePCIEHost pcie;
36
+ OrIRQState pcie4_msi_irq;
37
MemoryRegion rom;
38
MemoryRegion caam;
39
MemoryRegion ocram;
40
@@ -XXX,XX +XXX,XX @@ struct FslIMX6State {
41
#define FSL_IMX6_PCIE1_IRQ 120
42
#define FSL_IMX6_PCIE2_IRQ 121
43
#define FSL_IMX6_PCIE3_IRQ 122
44
-#define FSL_IMX6_PCIE4_IRQ 123
45
+#define FSL_IMX6_PCIE4_MSI_IRQ 123
46
#define FSL_IMX6_DCIC1_IRQ 124
47
#define FSL_IMX6_DCIC2_IRQ 125
48
#define FSL_IMX6_MLB150_HIGH_IRQ 126
49
diff --git a/include/hw/arm/fsl-imx7.h b/include/hw/arm/fsl-imx7.h
50
index XXXXXXX..XXXXXXX 100644
51
--- a/include/hw/arm/fsl-imx7.h
52
+++ b/include/hw/arm/fsl-imx7.h
53
@@ -XXX,XX +XXX,XX @@
54
#include "hw/net/imx_fec.h"
55
#include "hw/pci-host/designware.h"
56
#include "hw/usb/chipidea.h"
57
+#include "hw/or-irq.h"
58
#include "cpu.h"
59
#include "qom/object.h"
60
#include "qemu/units.h"
61
@@ -XXX,XX +XXX,XX @@ struct FslIMX7State {
62
IMX7GPRState gpr;
63
ChipideaState usb[FSL_IMX7_NUM_USBS];
64
DesignwarePCIEHost pcie;
65
+ OrIRQState pcie4_msi_irq;
66
MemoryRegion rom;
67
MemoryRegion caam;
68
MemoryRegion ocram;
69
@@ -XXX,XX +XXX,XX @@ enum FslIMX7IRQs {
70
FSL_IMX7_PCI_INTA_IRQ = 125,
71
FSL_IMX7_PCI_INTB_IRQ = 124,
72
FSL_IMX7_PCI_INTC_IRQ = 123,
73
- FSL_IMX7_PCI_INTD_IRQ = 122,
74
+ FSL_IMX7_PCI_INTD_MSI_IRQ = 122,
75
76
FSL_IMX7_UART7_IRQ = 126,
77
78
diff --git a/include/hw/pci-host/designware.h b/include/hw/pci-host/designware.h
79
index XXXXXXX..XXXXXXX 100644
80
--- a/include/hw/pci-host/designware.h
81
+++ b/include/hw/pci-host/designware.h
82
@@ -XXX,XX +XXX,XX @@ struct DesignwarePCIEHost {
83
MemoryRegion io;
84
85
qemu_irq irqs[4];
86
+ qemu_irq msi;
87
} pci;
88
89
MemoryRegion mmio;
90
diff --git a/hw/arm/fsl-imx6.c b/hw/arm/fsl-imx6.c
91
index XXXXXXX..XXXXXXX 100644
92
--- a/hw/arm/fsl-imx6.c
93
+++ b/hw/arm/fsl-imx6.c
94
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6_init(Object *obj)
95
object_initialize_child(obj, "eth", &s->eth, TYPE_IMX_ENET);
96
97
object_initialize_child(obj, "pcie", &s->pcie, TYPE_DESIGNWARE_PCIE_HOST);
98
+ object_initialize_child(obj, "pcie4-msi-irq", &s->pcie4_msi_irq,
99
+ TYPE_OR_IRQ);
100
}
101
102
static void fsl_imx6_realize(DeviceState *dev, Error **errp)
103
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp)
104
sysbus_realize(SYS_BUS_DEVICE(&s->pcie), &error_abort);
105
sysbus_mmio_map(SYS_BUS_DEVICE(&s->pcie), 0, FSL_IMX6_PCIe_REG_ADDR);
106
107
+ object_property_set_int(OBJECT(&s->pcie4_msi_irq), "num-lines", 2,
108
+ &error_abort);
109
+ qdev_realize(DEVICE(&s->pcie4_msi_irq), NULL, &error_abort);
110
+
111
+ irq = qdev_get_gpio_in(DEVICE(&s->a9mpcore), FSL_IMX6_PCIE4_MSI_IRQ);
112
+ qdev_connect_gpio_out(DEVICE(&s->pcie4_msi_irq), 0, irq);
113
+
114
irq = qdev_get_gpio_in(DEVICE(&s->a9mpcore), FSL_IMX6_PCIE1_IRQ);
115
sysbus_connect_irq(SYS_BUS_DEVICE(&s->pcie), 0, irq);
116
irq = qdev_get_gpio_in(DEVICE(&s->a9mpcore), FSL_IMX6_PCIE2_IRQ);
117
sysbus_connect_irq(SYS_BUS_DEVICE(&s->pcie), 1, irq);
118
irq = qdev_get_gpio_in(DEVICE(&s->a9mpcore), FSL_IMX6_PCIE3_IRQ);
119
sysbus_connect_irq(SYS_BUS_DEVICE(&s->pcie), 2, irq);
120
- irq = qdev_get_gpio_in(DEVICE(&s->a9mpcore), FSL_IMX6_PCIE4_IRQ);
121
+ irq = qdev_get_gpio_in(DEVICE(&s->pcie4_msi_irq), 0);
122
sysbus_connect_irq(SYS_BUS_DEVICE(&s->pcie), 3, irq);
123
+ irq = qdev_get_gpio_in(DEVICE(&s->pcie4_msi_irq), 1);
124
+ sysbus_connect_irq(SYS_BUS_DEVICE(&s->pcie), 4, irq);
125
126
/*
127
* PCIe PHY
128
diff --git a/hw/arm/fsl-imx7.c b/hw/arm/fsl-imx7.c
129
index XXXXXXX..XXXXXXX 100644
130
--- a/hw/arm/fsl-imx7.c
131
+++ b/hw/arm/fsl-imx7.c
132
@@ -XXX,XX +XXX,XX @@ static void fsl_imx7_init(Object *obj)
133
* PCIE
134
*/
135
object_initialize_child(obj, "pcie", &s->pcie, TYPE_DESIGNWARE_PCIE_HOST);
136
+ object_initialize_child(obj, "pcie4-msi-irq", &s->pcie4_msi_irq,
137
+ TYPE_OR_IRQ);
138
139
/*
140
* USBs
141
@@ -XXX,XX +XXX,XX @@ static void fsl_imx7_realize(DeviceState *dev, Error **errp)
142
sysbus_realize(SYS_BUS_DEVICE(&s->pcie), &error_abort);
143
sysbus_mmio_map(SYS_BUS_DEVICE(&s->pcie), 0, FSL_IMX7_PCIE_REG_ADDR);
144
145
+ object_property_set_int(OBJECT(&s->pcie4_msi_irq), "num-lines", 2,
146
+ &error_abort);
147
+ qdev_realize(DEVICE(&s->pcie4_msi_irq), NULL, &error_abort);
148
+
149
+ irq = qdev_get_gpio_in(DEVICE(&s->a7mpcore), FSL_IMX7_PCI_INTD_MSI_IRQ);
150
+ qdev_connect_gpio_out(DEVICE(&s->pcie4_msi_irq), 0, irq);
151
+
152
irq = qdev_get_gpio_in(DEVICE(&s->a7mpcore), FSL_IMX7_PCI_INTA_IRQ);
153
sysbus_connect_irq(SYS_BUS_DEVICE(&s->pcie), 0, irq);
154
irq = qdev_get_gpio_in(DEVICE(&s->a7mpcore), FSL_IMX7_PCI_INTB_IRQ);
155
sysbus_connect_irq(SYS_BUS_DEVICE(&s->pcie), 1, irq);
156
irq = qdev_get_gpio_in(DEVICE(&s->a7mpcore), FSL_IMX7_PCI_INTC_IRQ);
157
sysbus_connect_irq(SYS_BUS_DEVICE(&s->pcie), 2, irq);
158
- irq = qdev_get_gpio_in(DEVICE(&s->a7mpcore), FSL_IMX7_PCI_INTD_IRQ);
159
+ irq = qdev_get_gpio_in(DEVICE(&s->pcie4_msi_irq), 0);
160
sysbus_connect_irq(SYS_BUS_DEVICE(&s->pcie), 3, irq);
161
+ irq = qdev_get_gpio_in(DEVICE(&s->pcie4_msi_irq), 1);
162
+ sysbus_connect_irq(SYS_BUS_DEVICE(&s->pcie), 4, irq);
163
164
/*
165
* USBs
166
diff --git a/hw/pci-host/designware.c b/hw/pci-host/designware.c
167
index XXXXXXX..XXXXXXX 100644
168
--- a/hw/pci-host/designware.c
169
+++ b/hw/pci-host/designware.c
170
@@ -XXX,XX +XXX,XX @@
171
#define DESIGNWARE_PCIE_ATU_DEVFN(x) (((x) >> 16) & 0xff)
172
#define DESIGNWARE_PCIE_ATU_UPPER_TARGET 0x91C
173
174
-#define DESIGNWARE_PCIE_IRQ_MSI 3
175
-
176
static DesignwarePCIEHost *
177
designware_pcie_root_to_host(DesignwarePCIERoot *root)
178
{
179
@@ -XXX,XX +XXX,XX @@ static void designware_pcie_root_msi_write(void *opaque, hwaddr addr,
180
root->msi.intr[0].status |= BIT(val) & root->msi.intr[0].enable;
181
182
if (root->msi.intr[0].status & ~root->msi.intr[0].mask) {
183
- qemu_set_irq(host->pci.irqs[DESIGNWARE_PCIE_IRQ_MSI], 1);
184
+ qemu_set_irq(host->pci.msi, 1);
20
}
185
}
21
}
186
}
22
187
23
-static const ARMCPRegInfo zcr_el1_reginfo = {
188
@@ -XXX,XX +XXX,XX @@ static void designware_pcie_root_config_write(PCIDevice *d, uint32_t address,
24
- .name = "ZCR_EL1", .state = ARM_CP_STATE_AA64,
189
case DESIGNWARE_PCIE_MSI_INTR0_STATUS:
25
- .opc0 = 3, .opc1 = 0, .crn = 1, .crm = 2, .opc2 = 0,
190
root->msi.intr[0].status ^= val;
26
- .access = PL1_RW, .type = ARM_CP_SVE,
191
if (!root->msi.intr[0].status) {
27
- .fieldoffset = offsetof(CPUARMState, vfp.zcr_el[1]),
192
- qemu_set_irq(host->pci.irqs[DESIGNWARE_PCIE_IRQ_MSI], 0);
28
- .writefn = zcr_write, .raw_writefn = raw_write
193
+ qemu_set_irq(host->pci.msi, 0);
29
-};
194
}
30
-
195
break;
31
-static const ARMCPRegInfo zcr_el2_reginfo = {
196
32
- .name = "ZCR_EL2", .state = ARM_CP_STATE_AA64,
197
@@ -XXX,XX +XXX,XX @@ static void designware_pcie_host_realize(DeviceState *dev, Error **errp)
33
- .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 2, .opc2 = 0,
198
for (i = 0; i < ARRAY_SIZE(s->pci.irqs); i++) {
34
- .access = PL2_RW, .type = ARM_CP_SVE,
199
sysbus_init_irq(sbd, &s->pci.irqs[i]);
35
- .fieldoffset = offsetof(CPUARMState, vfp.zcr_el[2]),
36
- .writefn = zcr_write, .raw_writefn = raw_write
37
-};
38
-
39
-static const ARMCPRegInfo zcr_no_el2_reginfo = {
40
- .name = "ZCR_EL2", .state = ARM_CP_STATE_AA64,
41
- .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 2, .opc2 = 0,
42
- .access = PL2_RW, .type = ARM_CP_SVE,
43
- .readfn = arm_cp_read_zero, .writefn = arm_cp_write_ignore
44
-};
45
-
46
-static const ARMCPRegInfo zcr_el3_reginfo = {
47
- .name = "ZCR_EL3", .state = ARM_CP_STATE_AA64,
48
- .opc0 = 3, .opc1 = 6, .crn = 1, .crm = 2, .opc2 = 0,
49
- .access = PL3_RW, .type = ARM_CP_SVE,
50
- .fieldoffset = offsetof(CPUARMState, vfp.zcr_el[3]),
51
- .writefn = zcr_write, .raw_writefn = raw_write
52
+static const ARMCPRegInfo zcr_reginfo[] = {
53
+ { .name = "ZCR_EL1", .state = ARM_CP_STATE_AA64,
54
+ .opc0 = 3, .opc1 = 0, .crn = 1, .crm = 2, .opc2 = 0,
55
+ .access = PL1_RW, .type = ARM_CP_SVE,
56
+ .fieldoffset = offsetof(CPUARMState, vfp.zcr_el[1]),
57
+ .writefn = zcr_write, .raw_writefn = raw_write },
58
+ { .name = "ZCR_EL2", .state = ARM_CP_STATE_AA64,
59
+ .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 2, .opc2 = 0,
60
+ .access = PL2_RW, .type = ARM_CP_SVE,
61
+ .fieldoffset = offsetof(CPUARMState, vfp.zcr_el[2]),
62
+ .writefn = zcr_write, .raw_writefn = raw_write },
63
+ { .name = "ZCR_EL3", .state = ARM_CP_STATE_AA64,
64
+ .opc0 = 3, .opc1 = 6, .crn = 1, .crm = 2, .opc2 = 0,
65
+ .access = PL3_RW, .type = ARM_CP_SVE,
66
+ .fieldoffset = offsetof(CPUARMState, vfp.zcr_el[3]),
67
+ .writefn = zcr_write, .raw_writefn = raw_write },
68
};
69
70
void hw_watchpoint_update(ARMCPU *cpu, int n)
71
@@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu)
72
}
200
}
73
201
+ sysbus_init_irq(sbd, &s->pci.msi);
74
if (cpu_isar_feature(aa64_sve, cpu)) {
202
75
- define_one_arm_cp_reg(cpu, &zcr_el1_reginfo);
203
memory_region_init_io(&s->mmio,
76
- if (arm_feature(env, ARM_FEATURE_EL2)) {
204
OBJECT(s),
77
- define_one_arm_cp_reg(cpu, &zcr_el2_reginfo);
205
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
78
- } else {
206
index XXXXXXX..XXXXXXX 100644
79
- define_one_arm_cp_reg(cpu, &zcr_no_el2_reginfo);
207
--- a/hw/arm/Kconfig
80
- }
208
+++ b/hw/arm/Kconfig
81
- if (arm_feature(env, ARM_FEATURE_EL3)) {
209
@@ -XXX,XX +XXX,XX @@ config FSL_IMX6
82
- define_one_arm_cp_reg(cpu, &zcr_el3_reginfo);
210
select PL310 # cache controller
83
- }
211
select PCI_EXPRESS_DESIGNWARE
84
+ define_arm_cp_regs(cpu, zcr_reginfo);
212
select SDHCI
85
}
213
+ select OR_IRQ
86
214
87
#ifdef TARGET_AARCH64
215
config ASPEED_SOC
216
bool
217
@@ -XXX,XX +XXX,XX @@ config FSL_IMX7
218
select WDT_IMX2
219
select PCI_EXPRESS_DESIGNWARE
220
select SDHCI
221
+ select OR_IRQ
222
select UNIMP
223
224
config ARM_SMMUV3
88
--
225
--
89
2.25.1
226
2.34.1
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
Drop el3_no_el2_cp_reginfo, el3_no_el2_v8_cp_reginfo, and the local
3
Board schematic is useful to corroborate GPIOs/IRQs wiring.
4
vpidr_regs definition, and rely on the squashing to ARM_CP_CONST
5
while registering for v8.
6
4
7
This is a behavior change for v7 cpus with Security Extensions and
5
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
8
without Virtualization Extensions, in that the virtualization cpregs
9
are now correctly not present. This would be a migration compatibility
10
break, except that we have an existing bug in which migration of 32-bit
11
cpus with Security Extensions enabled does not work.
12
13
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
14
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7
Message-id: 20250110160204.74997-2-philmd@linaro.org
15
Message-id: 20220506180242.216785-3-richard.henderson@linaro.org
8
[PMM: Use https:// URLs]
16
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
17
---
10
---
18
target/arm/helper.c | 158 ++++----------------------------------------
11
hw/arm/stellaris.c | 8 ++++++++
19
1 file changed, 13 insertions(+), 145 deletions(-)
12
1 file changed, 8 insertions(+)
20
13
21
diff --git a/target/arm/helper.c b/target/arm/helper.c
14
diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c
22
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
23
--- a/target/arm/helper.c
16
--- a/hw/arm/stellaris.c
24
+++ b/target/arm/helper.c
17
+++ b/hw/arm/stellaris.c
25
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = {
18
@@ -XXX,XX +XXX,XX @@ static void lm3s6965evb_init(MachineState *machine)
26
.fieldoffset = offsetoflow32(CPUARMState, cp15.mdcr_el3) },
19
stellaris_init(machine, &stellaris_boards[1]);
20
}
21
22
+/*
23
+ * Stellaris LM3S811 Evaluation Board Schematics:
24
+ * https://www.ti.com/lit/ug/symlink/spmu030.pdf
25
+ */
26
static void lm3s811evb_class_init(ObjectClass *oc, void *data)
27
{
28
MachineClass *mc = MACHINE_CLASS(oc);
29
@@ -XXX,XX +XXX,XX @@ static const TypeInfo lm3s811evb_type = {
30
.class_init = lm3s811evb_class_init,
27
};
31
};
28
32
29
-/* Used to describe the behaviour of EL2 regs when EL2 does not exist. */
33
+/*
30
-static const ARMCPRegInfo el3_no_el2_cp_reginfo[] = {
34
+ * Stellaris: LM3S6965 Evaluation Board Schematics:
31
- { .name = "VBAR_EL2", .state = ARM_CP_STATE_BOTH,
35
+ * https://www.ti.com/lit/ug/symlink/spmu029.pdf
32
- .opc0 = 3, .opc1 = 4, .crn = 12, .crm = 0, .opc2 = 0,
36
+ */
33
- .access = PL2_RW,
37
static void lm3s6965evb_class_init(ObjectClass *oc, void *data)
34
- .readfn = arm_cp_read_zero, .writefn = arm_cp_write_ignore },
35
- { .name = "HCR_EL2", .state = ARM_CP_STATE_BOTH,
36
- .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 1, .opc2 = 0,
37
- .access = PL2_RW,
38
- .type = ARM_CP_CONST, .resetvalue = 0 },
39
- { .name = "HACR_EL2", .state = ARM_CP_STATE_BOTH,
40
- .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 1, .opc2 = 7,
41
- .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
42
- { .name = "ESR_EL2", .state = ARM_CP_STATE_BOTH,
43
- .opc0 = 3, .opc1 = 4, .crn = 5, .crm = 2, .opc2 = 0,
44
- .access = PL2_RW,
45
- .type = ARM_CP_CONST, .resetvalue = 0 },
46
- { .name = "CPTR_EL2", .state = ARM_CP_STATE_BOTH,
47
- .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 1, .opc2 = 2,
48
- .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
49
- { .name = "MAIR_EL2", .state = ARM_CP_STATE_BOTH,
50
- .opc0 = 3, .opc1 = 4, .crn = 10, .crm = 2, .opc2 = 0,
51
- .access = PL2_RW, .type = ARM_CP_CONST,
52
- .resetvalue = 0 },
53
- { .name = "HMAIR1", .state = ARM_CP_STATE_AA32,
54
- .cp = 15, .opc1 = 4, .crn = 10, .crm = 2, .opc2 = 1,
55
- .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
56
- { .name = "AMAIR_EL2", .state = ARM_CP_STATE_BOTH,
57
- .opc0 = 3, .opc1 = 4, .crn = 10, .crm = 3, .opc2 = 0,
58
- .access = PL2_RW, .type = ARM_CP_CONST,
59
- .resetvalue = 0 },
60
- { .name = "HAMAIR1", .state = ARM_CP_STATE_AA32,
61
- .cp = 15, .opc1 = 4, .crn = 10, .crm = 3, .opc2 = 1,
62
- .access = PL2_RW, .type = ARM_CP_CONST,
63
- .resetvalue = 0 },
64
- { .name = "AFSR0_EL2", .state = ARM_CP_STATE_BOTH,
65
- .opc0 = 3, .opc1 = 4, .crn = 5, .crm = 1, .opc2 = 0,
66
- .access = PL2_RW, .type = ARM_CP_CONST,
67
- .resetvalue = 0 },
68
- { .name = "AFSR1_EL2", .state = ARM_CP_STATE_BOTH,
69
- .opc0 = 3, .opc1 = 4, .crn = 5, .crm = 1, .opc2 = 1,
70
- .access = PL2_RW, .type = ARM_CP_CONST,
71
- .resetvalue = 0 },
72
- { .name = "TCR_EL2", .state = ARM_CP_STATE_BOTH,
73
- .opc0 = 3, .opc1 = 4, .crn = 2, .crm = 0, .opc2 = 2,
74
- .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
75
- { .name = "VTCR_EL2", .state = ARM_CP_STATE_BOTH,
76
- .opc0 = 3, .opc1 = 4, .crn = 2, .crm = 1, .opc2 = 2,
77
- .access = PL2_RW, .accessfn = access_el3_aa32ns,
78
- .type = ARM_CP_CONST, .resetvalue = 0 },
79
- { .name = "VTTBR", .state = ARM_CP_STATE_AA32,
80
- .cp = 15, .opc1 = 6, .crm = 2,
81
- .access = PL2_RW, .accessfn = access_el3_aa32ns,
82
- .type = ARM_CP_CONST | ARM_CP_64BIT, .resetvalue = 0 },
83
- { .name = "VTTBR_EL2", .state = ARM_CP_STATE_AA64,
84
- .opc0 = 3, .opc1 = 4, .crn = 2, .crm = 1, .opc2 = 0,
85
- .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
86
- { .name = "SCTLR_EL2", .state = ARM_CP_STATE_BOTH,
87
- .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 0, .opc2 = 0,
88
- .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
89
- { .name = "TPIDR_EL2", .state = ARM_CP_STATE_BOTH,
90
- .opc0 = 3, .opc1 = 4, .crn = 13, .crm = 0, .opc2 = 2,
91
- .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
92
- { .name = "TTBR0_EL2", .state = ARM_CP_STATE_AA64,
93
- .opc0 = 3, .opc1 = 4, .crn = 2, .crm = 0, .opc2 = 0,
94
- .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
95
- { .name = "HTTBR", .cp = 15, .opc1 = 4, .crm = 2,
96
- .access = PL2_RW, .type = ARM_CP_64BIT | ARM_CP_CONST,
97
- .resetvalue = 0 },
98
- { .name = "CNTHCTL_EL2", .state = ARM_CP_STATE_BOTH,
99
- .opc0 = 3, .opc1 = 4, .crn = 14, .crm = 1, .opc2 = 0,
100
- .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
101
- { .name = "CNTVOFF_EL2", .state = ARM_CP_STATE_AA64,
102
- .opc0 = 3, .opc1 = 4, .crn = 14, .crm = 0, .opc2 = 3,
103
- .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
104
- { .name = "CNTVOFF", .cp = 15, .opc1 = 4, .crm = 14,
105
- .access = PL2_RW, .type = ARM_CP_64BIT | ARM_CP_CONST,
106
- .resetvalue = 0 },
107
- { .name = "CNTHP_CVAL_EL2", .state = ARM_CP_STATE_AA64,
108
- .opc0 = 3, .opc1 = 4, .crn = 14, .crm = 2, .opc2 = 2,
109
- .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
110
- { .name = "CNTHP_CVAL", .cp = 15, .opc1 = 6, .crm = 14,
111
- .access = PL2_RW, .type = ARM_CP_64BIT | ARM_CP_CONST,
112
- .resetvalue = 0 },
113
- { .name = "CNTHP_TVAL_EL2", .state = ARM_CP_STATE_BOTH,
114
- .opc0 = 3, .opc1 = 4, .crn = 14, .crm = 2, .opc2 = 0,
115
- .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
116
- { .name = "CNTHP_CTL_EL2", .state = ARM_CP_STATE_BOTH,
117
- .opc0 = 3, .opc1 = 4, .crn = 14, .crm = 2, .opc2 = 1,
118
- .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
119
- { .name = "MDCR_EL2", .state = ARM_CP_STATE_BOTH,
120
- .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 1, .opc2 = 1,
121
- .access = PL2_RW, .accessfn = access_tda,
122
- .type = ARM_CP_CONST, .resetvalue = 0 },
123
- { .name = "HPFAR_EL2", .state = ARM_CP_STATE_BOTH,
124
- .opc0 = 3, .opc1 = 4, .crn = 6, .crm = 0, .opc2 = 4,
125
- .access = PL2_RW, .accessfn = access_el3_aa32ns,
126
- .type = ARM_CP_CONST, .resetvalue = 0 },
127
- { .name = "HSTR_EL2", .state = ARM_CP_STATE_BOTH,
128
- .opc0 = 3, .opc1 = 4, .crn = 1, .crm = 1, .opc2 = 3,
129
- .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
130
- { .name = "FAR_EL2", .state = ARM_CP_STATE_BOTH,
131
- .opc0 = 3, .opc1 = 4, .crn = 6, .crm = 0, .opc2 = 0,
132
- .access = PL2_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
133
- { .name = "HIFAR", .state = ARM_CP_STATE_AA32,
134
- .type = ARM_CP_CONST,
135
- .cp = 15, .opc1 = 4, .crn = 6, .crm = 0, .opc2 = 2,
136
- .access = PL2_RW, .resetvalue = 0 },
137
-};
138
-
139
-/* Ditto, but for registers which exist in ARMv8 but not v7 */
140
-static const ARMCPRegInfo el3_no_el2_v8_cp_reginfo[] = {
141
- { .name = "HCR2", .state = ARM_CP_STATE_AA32,
142
- .cp = 15, .opc1 = 4, .crn = 1, .crm = 1, .opc2 = 4,
143
- .access = PL2_RW,
144
- .type = ARM_CP_CONST, .resetvalue = 0 },
145
-};
146
-
147
static void do_hcr_write(CPUARMState *env, uint64_t value, uint64_t valid_mask)
148
{
38
{
149
ARMCPU *cpu = env_archcpu(env);
39
MachineClass *mc = MACHINE_CLASS(oc);
150
@@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu)
151
define_arm_cp_regs(cpu, v8_idregs);
152
define_arm_cp_regs(cpu, v8_cp_reginfo);
153
}
154
- if (arm_feature(env, ARM_FEATURE_EL2)) {
155
+
156
+ /*
157
+ * Register the base EL2 cpregs.
158
+ * Pre v8, these registers are implemented only as part of the
159
+ * Virtualization Extensions (EL2 present). Beginning with v8,
160
+ * if EL2 is missing but EL3 is enabled, mostly these become
161
+ * RES0 from EL3, with some specific exceptions.
162
+ */
163
+ if (arm_feature(env, ARM_FEATURE_EL2)
164
+ || (arm_feature(env, ARM_FEATURE_EL3)
165
+ && arm_feature(env, ARM_FEATURE_V8))) {
166
uint64_t vmpidr_def = mpidr_read_val(env);
167
ARMCPRegInfo vpidr_regs[] = {
168
{ .name = "VPIDR", .state = ARM_CP_STATE_AA32,
169
@@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu)
170
};
171
define_one_arm_cp_reg(cpu, &rvbar);
172
}
173
- } else {
174
- /* If EL2 is missing but higher ELs are enabled, we need to
175
- * register the no_el2 reginfos.
176
- */
177
- if (arm_feature(env, ARM_FEATURE_EL3)) {
178
- /* When EL3 exists but not EL2, VPIDR and VMPIDR take the value
179
- * of MIDR_EL1 and MPIDR_EL1.
180
- */
181
- ARMCPRegInfo vpidr_regs[] = {
182
- { .name = "VPIDR_EL2", .state = ARM_CP_STATE_BOTH,
183
- .opc0 = 3, .opc1 = 4, .crn = 0, .crm = 0, .opc2 = 0,
184
- .access = PL2_RW, .accessfn = access_el3_aa32ns,
185
- .type = ARM_CP_CONST, .resetvalue = cpu->midr,
186
- .fieldoffset = offsetof(CPUARMState, cp15.vpidr_el2) },
187
- { .name = "VMPIDR_EL2", .state = ARM_CP_STATE_BOTH,
188
- .opc0 = 3, .opc1 = 4, .crn = 0, .crm = 0, .opc2 = 5,
189
- .access = PL2_RW, .accessfn = access_el3_aa32ns,
190
- .type = ARM_CP_NO_RAW,
191
- .writefn = arm_cp_write_ignore, .readfn = mpidr_read },
192
- };
193
- define_arm_cp_regs(cpu, vpidr_regs);
194
- define_arm_cp_regs(cpu, el3_no_el2_cp_reginfo);
195
- if (arm_feature(env, ARM_FEATURE_V8)) {
196
- define_arm_cp_regs(cpu, el3_no_el2_v8_cp_reginfo);
197
- }
198
- }
199
}
200
+
201
+ /* Register the base EL3 cpregs. */
202
if (arm_feature(env, ARM_FEATURE_EL3)) {
203
define_arm_cp_regs(cpu, el3_cp_reginfo);
204
ARMCPRegInfo el3_regs[] = {
205
--
40
--
206
2.25.1
41
2.34.1
42
43
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
Enable the n1 for virt and sbsa board use.
3
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
4
5
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
4
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
5
Message-id: 20250110160204.74997-3-philmd@linaro.org
7
Message-id: 20220506180242.216785-25-richard.henderson@linaro.org
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
---
7
---
10
docs/system/arm/virt.rst | 1 +
8
hw/arm/stellaris.c | 6 +++---
11
hw/arm/sbsa-ref.c | 1 +
9
1 file changed, 3 insertions(+), 3 deletions(-)
12
hw/arm/virt.c | 1 +
13
target/arm/cpu64.c | 66 ++++++++++++++++++++++++++++++++++++++++
14
4 files changed, 69 insertions(+)
15
10
16
diff --git a/docs/system/arm/virt.rst b/docs/system/arm/virt.rst
11
diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c
17
index XXXXXXX..XXXXXXX 100644
12
index XXXXXXX..XXXXXXX 100644
18
--- a/docs/system/arm/virt.rst
13
--- a/hw/arm/stellaris.c
19
+++ b/docs/system/arm/virt.rst
14
+++ b/hw/arm/stellaris.c
20
@@ -XXX,XX +XXX,XX @@ Supported guest CPU types:
15
@@ -XXX,XX +XXX,XX @@ static void ssys_update(ssys_state *s)
21
- ``cortex-a76`` (64-bit)
16
qemu_set_irq(s->irq, (s->int_status & s->int_mask) != 0);
22
- ``a64fx`` (64-bit)
17
}
23
- ``host`` (with KVM only)
18
24
+- ``neoverse-n1`` (64-bit)
19
-static uint32_t pllcfg_sandstorm[16] = {
25
- ``max`` (same as ``host`` for KVM; best possible emulation with TCG)
20
+static const uint32_t pllcfg_sandstorm[16] = {
26
21
0x31c0, /* 1 Mhz */
27
Note that the default is ``cortex-a15``, so for an AArch64 guest you must
22
0x1ae0, /* 1.8432 Mhz */
28
diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c
23
0x18c0, /* 2 Mhz */
29
index XXXXXXX..XXXXXXX 100644
24
@@ -XXX,XX +XXX,XX @@ static uint32_t pllcfg_sandstorm[16] = {
30
--- a/hw/arm/sbsa-ref.c
25
0x585b /* 8.192 Mhz */
31
+++ b/hw/arm/sbsa-ref.c
32
@@ -XXX,XX +XXX,XX @@ static const char * const valid_cpus[] = {
33
ARM_CPU_TYPE_NAME("cortex-a57"),
34
ARM_CPU_TYPE_NAME("cortex-a72"),
35
ARM_CPU_TYPE_NAME("cortex-a76"),
36
+ ARM_CPU_TYPE_NAME("neoverse-n1"),
37
ARM_CPU_TYPE_NAME("max"),
38
};
26
};
39
27
40
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
28
-static uint32_t pllcfg_fury[16] = {
41
index XXXXXXX..XXXXXXX 100644
29
+static const uint32_t pllcfg_fury[16] = {
42
--- a/hw/arm/virt.c
30
0x3200, /* 1 Mhz */
43
+++ b/hw/arm/virt.c
31
0x1b20, /* 1.8432 Mhz */
44
@@ -XXX,XX +XXX,XX @@ static const char *valid_cpus[] = {
32
0x1900, /* 2 Mhz */
45
ARM_CPU_TYPE_NAME("cortex-a72"),
33
@@ -XXX,XX +XXX,XX @@ static void stellaris_adc_init(Object *obj)
46
ARM_CPU_TYPE_NAME("cortex-a76"),
47
ARM_CPU_TYPE_NAME("a64fx"),
48
+ ARM_CPU_TYPE_NAME("neoverse-n1"),
49
ARM_CPU_TYPE_NAME("host"),
50
ARM_CPU_TYPE_NAME("max"),
51
};
52
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
53
index XXXXXXX..XXXXXXX 100644
54
--- a/target/arm/cpu64.c
55
+++ b/target/arm/cpu64.c
56
@@ -XXX,XX +XXX,XX @@ static void aarch64_a76_initfn(Object *obj)
57
cpu->isar.mvfr2 = 0x00000043;
58
}
34
}
59
35
60
+static void aarch64_neoverse_n1_initfn(Object *obj)
36
/* Board init. */
61
+{
37
-static stellaris_board_info stellaris_boards[] = {
62
+ ARMCPU *cpu = ARM_CPU(obj);
38
+static const stellaris_board_info stellaris_boards[] = {
63
+
39
{ "LM3S811EVB",
64
+ cpu->dtb_compatible = "arm,neoverse-n1";
40
0,
65
+ set_feature(&cpu->env, ARM_FEATURE_V8);
41
0x0032000e,
66
+ set_feature(&cpu->env, ARM_FEATURE_NEON);
67
+ set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER);
68
+ set_feature(&cpu->env, ARM_FEATURE_AARCH64);
69
+ set_feature(&cpu->env, ARM_FEATURE_CBAR_RO);
70
+ set_feature(&cpu->env, ARM_FEATURE_EL2);
71
+ set_feature(&cpu->env, ARM_FEATURE_EL3);
72
+ set_feature(&cpu->env, ARM_FEATURE_PMU);
73
+
74
+ /* Ordered by B2.4 AArch64 registers by functional group */
75
+ cpu->clidr = 0x82000023;
76
+ cpu->ctr = 0x8444c004;
77
+ cpu->dcz_blocksize = 4;
78
+ cpu->isar.id_aa64dfr0 = 0x0000000110305408ull;
79
+ cpu->isar.id_aa64isar0 = 0x0000100010211120ull;
80
+ cpu->isar.id_aa64isar1 = 0x0000000000100001ull;
81
+ cpu->isar.id_aa64mmfr0 = 0x0000000000101125ull;
82
+ cpu->isar.id_aa64mmfr1 = 0x0000000010212122ull;
83
+ cpu->isar.id_aa64mmfr2 = 0x0000000000001011ull;
84
+ cpu->isar.id_aa64pfr0 = 0x1100000010111112ull; /* GIC filled in later */
85
+ cpu->isar.id_aa64pfr1 = 0x0000000000000020ull;
86
+ cpu->id_afr0 = 0x00000000;
87
+ cpu->isar.id_dfr0 = 0x04010088;
88
+ cpu->isar.id_isar0 = 0x02101110;
89
+ cpu->isar.id_isar1 = 0x13112111;
90
+ cpu->isar.id_isar2 = 0x21232042;
91
+ cpu->isar.id_isar3 = 0x01112131;
92
+ cpu->isar.id_isar4 = 0x00010142;
93
+ cpu->isar.id_isar5 = 0x01011121;
94
+ cpu->isar.id_isar6 = 0x00000010;
95
+ cpu->isar.id_mmfr0 = 0x10201105;
96
+ cpu->isar.id_mmfr1 = 0x40000000;
97
+ cpu->isar.id_mmfr2 = 0x01260000;
98
+ cpu->isar.id_mmfr3 = 0x02122211;
99
+ cpu->isar.id_mmfr4 = 0x00021110;
100
+ cpu->isar.id_pfr0 = 0x10010131;
101
+ cpu->isar.id_pfr1 = 0x00010000; /* GIC filled in later */
102
+ cpu->isar.id_pfr2 = 0x00000011;
103
+ cpu->midr = 0x414fd0c1; /* r4p1 */
104
+ cpu->revidr = 0;
105
+
106
+ /* From B2.23 CCSIDR_EL1 */
107
+ cpu->ccsidr[0] = 0x701fe01a; /* 64KB L1 dcache */
108
+ cpu->ccsidr[1] = 0x201fe01a; /* 64KB L1 icache */
109
+ cpu->ccsidr[2] = 0x70ffe03a; /* 1MB L2 cache */
110
+
111
+ /* From B2.98 SCTLR_EL3 */
112
+ cpu->reset_sctlr = 0x30c50838;
113
+
114
+ /* From B4.23 ICH_VTR_EL2 */
115
+ cpu->gic_num_lrs = 4;
116
+ cpu->gic_vpribits = 5;
117
+ cpu->gic_vprebits = 5;
118
+
119
+ /* From B5.1 AdvSIMD AArch64 register summary */
120
+ cpu->isar.mvfr0 = 0x10110222;
121
+ cpu->isar.mvfr1 = 0x13211111;
122
+ cpu->isar.mvfr2 = 0x00000043;
123
+}
124
+
125
void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp)
126
{
127
/*
128
@@ -XXX,XX +XXX,XX @@ static const ARMCPUInfo aarch64_cpus[] = {
129
{ .name = "cortex-a72", .initfn = aarch64_a72_initfn },
130
{ .name = "cortex-a76", .initfn = aarch64_a76_initfn },
131
{ .name = "a64fx", .initfn = aarch64_a64fx_initfn },
132
+ { .name = "neoverse-n1", .initfn = aarch64_neoverse_n1_initfn },
133
{ .name = "max", .initfn = aarch64_max_initfn },
134
#if defined(CONFIG_KVM) || defined(CONFIG_HVF)
135
{ .name = "host", .initfn = aarch64_host_initfn },
136
--
42
--
137
2.25.1
43
2.34.1
44
45
diff view generated by jsdifflib
1
From: Gavin Shan <gshan@redhat.com>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
The CPU topology isn't enabled on arm/virt machine yet, but we're
3
There is nothing mapped at 0x40002000.
4
going to do it in next patch. After the CPU topology is enabled by
5
next patch, "thread-id=1" becomes invalid because the CPU core is
6
preferred on arm/virt machine. It means these two CPUs have 0/1
7
as their core IDs, but their thread IDs are all 0. It will trigger
8
test failure as the following message indicates:
9
4
10
[14/21 qemu:qtest+qtest-aarch64 / qtest-aarch64/numa-test ERROR
5
I2C#0 is already mapped at 0x40021000.
11
1.48s killed by signal 6 SIGABRT
12
>>> G_TEST_DBUS_DAEMON=/home/gavin/sandbox/qemu.main/tests/dbus-vmstate-daemon.sh \
13
QTEST_QEMU_STORAGE_DAEMON_BINARY=./storage-daemon/qemu-storage-daemon \
14
QTEST_QEMU_BINARY=./qemu-system-aarch64 \
15
QTEST_QEMU_IMG=./qemu-img MALLOC_PERTURB_=83 \
16
/home/gavin/sandbox/qemu.main/build/tests/qtest/numa-test --tap -k
17
――――――――――――――――――――――――――――――――――――――――――――――
18
stderr:
19
qemu-system-aarch64: -numa cpu,node-id=0,thread-id=1: no match found
20
6
21
This fixes the issue by providing comprehensive SMP configurations
7
Remove the invalid mapping added in commits aecfbbc97a2 & 394c8bbfb7a.
22
in aarch64_numa_cpu(). The SMP configurations aren't used before
23
the CPU topology is enabled in next patch.
24
8
25
Signed-off-by: Gavin Shan <gshan@redhat.com>
9
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
26
Reviewed-by: Yanan Wang <wangyanan55@huawei.com>
10
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
27
Message-id: 20220503140304.855514-3-gshan@redhat.com
11
Message-id: 20250110160204.74997-4-philmd@linaro.org
28
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
29
---
13
---
30
tests/qtest/numa-test.c | 3 ++-
14
hw/arm/stellaris.c | 2 --
31
1 file changed, 2 insertions(+), 1 deletion(-)
15
1 file changed, 2 deletions(-)
32
16
33
diff --git a/tests/qtest/numa-test.c b/tests/qtest/numa-test.c
17
diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c
34
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
35
--- a/tests/qtest/numa-test.c
19
--- a/hw/arm/stellaris.c
36
+++ b/tests/qtest/numa-test.c
20
+++ b/hw/arm/stellaris.c
37
@@ -XXX,XX +XXX,XX @@ static void aarch64_numa_cpu(const void *data)
21
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
38
QTestState *qts;
22
* http://www.ti.com/lit/ds/symlink/lm3s6965.pdf
39
g_autofree char *cli = NULL;
23
*
40
24
* 40000000 wdtimer
41
- cli = make_cli(data, "-machine smp.cpus=2 "
25
- * 40002000 i2c (unimplemented)
42
+ cli = make_cli(data, "-machine "
26
* 40004000 GPIO
43
+ "smp.cpus=2,smp.sockets=1,smp.clusters=1,smp.cores=1,smp.threads=2 "
27
* 40005000 GPIO
44
"-numa node,nodeid=0,memdev=ram -numa node,nodeid=1 "
28
* 40006000 GPIO
45
"-numa cpu,node-id=1,thread-id=0 "
29
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
46
"-numa cpu,node-id=0,thread-id=1");
30
/* Add dummy regions for the devices we don't implement yet,
31
* so guest accesses don't cause unlogged crashes.
32
*/
33
- create_unimplemented_device("i2c-0", 0x40002000, 0x1000);
34
create_unimplemented_device("i2c-2", 0x40021000, 0x1000);
35
create_unimplemented_device("PWM", 0x40028000, 0x1000);
36
create_unimplemented_device("QEI-0", 0x4002c000, 0x1000);
47
--
37
--
48
2.25.1
38
2.34.1
49
39
50
40
diff view generated by jsdifflib
1
From: Gavin Shan <gshan@redhat.com>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
When the PPTT table is built, the CPU topology is re-calculated, but
3
Add definitions for the number of controllers.
4
it's unecessary because the CPU topology has been populated in
5
virt_possible_cpu_arch_ids() on arm/virt machine.
6
4
7
This reworks build_pptt() to avoid by reusing the existing IDs in
5
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
8
ms->possible_cpus. Currently, the only user of build_pptt() is
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
arm/virt machine.
7
Message-id: 20250110160204.74997-5-philmd@linaro.org
10
11
Signed-off-by: Gavin Shan <gshan@redhat.com>
12
Tested-by: Yanan Wang <wangyanan55@huawei.com>
13
Reviewed-by: Yanan Wang <wangyanan55@huawei.com>
14
Acked-by: Igor Mammedov <imammedo@redhat.com>
15
Acked-by: Michael S. Tsirkin <mst@redhat.com>
16
Message-id: 20220503140304.855514-7-gshan@redhat.com
17
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
18
---
9
---
19
hw/acpi/aml-build.c | 111 +++++++++++++++++++-------------------------
10
hw/arm/stellaris.c | 25 +++++++++++++++----------
20
1 file changed, 48 insertions(+), 63 deletions(-)
11
1 file changed, 15 insertions(+), 10 deletions(-)
21
12
22
diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c
13
diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c
23
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
24
--- a/hw/acpi/aml-build.c
15
--- a/hw/arm/stellaris.c
25
+++ b/hw/acpi/aml-build.c
16
+++ b/hw/arm/stellaris.c
26
@@ -XXX,XX +XXX,XX @@ void build_pptt(GArray *table_data, BIOSLinker *linker, MachineState *ms,
17
@@ -XXX,XX +XXX,XX @@
27
const char *oem_id, const char *oem_table_id)
18
#define NUM_IRQ_LINES 64
19
#define NUM_PRIO_BITS 3
20
21
+#define NUM_GPIO 7
22
+#define NUM_UART 4
23
+#define NUM_GPTM 4
24
+#define NUM_I2C 2
25
+
26
typedef const struct {
27
const char *name;
28
uint32_t did0;
29
@@ -XXX,XX +XXX,XX @@ static const stellaris_board_info stellaris_boards[] = {
30
31
static void stellaris_init(MachineState *ms, stellaris_board_info *board)
28
{
32
{
29
MachineClass *mc = MACHINE_GET_CLASS(ms);
33
- static const int uart_irq[] = {5, 6, 33, 34};
30
- GQueue *list = g_queue_new();
34
- static const int timer_irq[] = {19, 21, 23, 35};
31
- guint pptt_start = table_data->len;
35
- static const uint32_t gpio_addr[7] =
32
- guint parent_offset;
36
+ static const int uart_irq[NUM_UART] = {5, 6, 33, 34};
33
- guint length, i;
37
+ static const int timer_irq[NUM_GPTM] = {19, 21, 23, 35};
34
- int uid = 0;
38
+ static const uint32_t gpio_addr[NUM_GPIO] =
35
- int socket;
39
{ 0x40004000, 0x40005000, 0x40006000, 0x40007000,
36
+ CPUArchIdList *cpus = ms->possible_cpus;
40
0x40024000, 0x40025000, 0x40026000};
37
+ int64_t socket_id = -1, cluster_id = -1, core_id = -1;
41
- static const int gpio_irq[7] = {0, 1, 2, 3, 4, 30, 31};
38
+ uint32_t socket_offset = 0, cluster_offset = 0, core_offset = 0;
42
+ static const int gpio_irq[NUM_GPIO] = {0, 1, 2, 3, 4, 30, 31};
39
+ uint32_t pptt_start = table_data->len;
43
40
+ int n;
44
/* Memory map of SoC devices, from
41
AcpiTable table = { .sig = "PPTT", .rev = 2,
45
* Stellaris LM3S6965 Microcontroller Data Sheet (rev I)
42
.oem_id = oem_id, .oem_table_id = oem_table_id };
46
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
43
47
*/
44
acpi_table_begin(&table, table_data);
48
45
49
Object *soc_container;
46
- for (socket = 0; socket < ms->smp.sockets; socket++) {
50
- DeviceState *gpio_dev[7], *armv7m, *nvic;
47
- g_queue_push_tail(list,
51
- qemu_irq gpio_in[7][8];
48
- GUINT_TO_POINTER(table_data->len - pptt_start));
52
- qemu_irq gpio_out[7][8];
49
- build_processor_hierarchy_node(
53
+ DeviceState *gpio_dev[NUM_GPIO], *armv7m, *nvic;
50
- table_data,
54
+ qemu_irq gpio_in[NUM_GPIO][8];
51
- /*
55
+ qemu_irq gpio_out[NUM_GPIO][8];
52
- * Physical package - represents the boundary
56
qemu_irq adc;
53
- * of a physical package
57
int sram_size;
54
- */
58
int flash_size;
55
- (1 << 0),
59
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
56
- 0, socket, NULL, 0);
60
} else {
57
- }
61
adc = NULL;
58
-
62
}
59
- if (mc->smp_props.clusters_supported) {
63
- for (i = 0; i < 4; i++) {
60
- length = g_queue_get_length(list);
64
+ for (i = 0; i < NUM_GPTM; i++) {
61
- for (i = 0; i < length; i++) {
65
if (board->dc2 & (0x10000 << i)) {
62
- int cluster;
66
SysBusDevice *sbd;
63
-
67
64
- parent_offset = GPOINTER_TO_UINT(g_queue_pop_head(list));
68
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
65
- for (cluster = 0; cluster < ms->smp.clusters; cluster++) {
69
}
66
- g_queue_push_tail(list,
70
67
- GUINT_TO_POINTER(table_data->len - pptt_start));
71
68
- build_processor_hierarchy_node(
72
- for (i = 0; i < 7; i++) {
69
- table_data,
73
+ for (i = 0; i < NUM_GPIO; i++) {
70
- (0 << 0), /* not a physical package */
74
if (board->dc4 & (1 << i)) {
71
- parent_offset, cluster, NULL, 0);
75
gpio_dev[i] = sysbus_create_simple("pl061_luminary", gpio_addr[i],
72
- }
76
qdev_get_gpio_in(nvic,
73
+ /*
77
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
74
+ * This works with the assumption that cpus[n].props.*_id has been
75
+ * sorted from top to down levels in mc->possible_cpu_arch_ids().
76
+ * Otherwise, the unexpected and duplicated containers will be
77
+ * created.
78
+ */
79
+ for (n = 0; n < cpus->len; n++) {
80
+ if (cpus->cpus[n].props.socket_id != socket_id) {
81
+ assert(cpus->cpus[n].props.socket_id > socket_id);
82
+ socket_id = cpus->cpus[n].props.socket_id;
83
+ cluster_id = -1;
84
+ core_id = -1;
85
+ socket_offset = table_data->len - pptt_start;
86
+ build_processor_hierarchy_node(table_data,
87
+ (1 << 0), /* Physical package */
88
+ 0, socket_id, NULL, 0);
89
}
90
- }
91
92
- length = g_queue_get_length(list);
93
- for (i = 0; i < length; i++) {
94
- int core;
95
-
96
- parent_offset = GPOINTER_TO_UINT(g_queue_pop_head(list));
97
- for (core = 0; core < ms->smp.cores; core++) {
98
- if (ms->smp.threads > 1) {
99
- g_queue_push_tail(list,
100
- GUINT_TO_POINTER(table_data->len - pptt_start));
101
- build_processor_hierarchy_node(
102
- table_data,
103
- (0 << 0), /* not a physical package */
104
- parent_offset, core, NULL, 0);
105
- } else {
106
- build_processor_hierarchy_node(
107
- table_data,
108
- (1 << 1) | /* ACPI Processor ID valid */
109
- (1 << 3), /* Node is a Leaf */
110
- parent_offset, uid++, NULL, 0);
111
+ if (mc->smp_props.clusters_supported) {
112
+ if (cpus->cpus[n].props.cluster_id != cluster_id) {
113
+ assert(cpus->cpus[n].props.cluster_id > cluster_id);
114
+ cluster_id = cpus->cpus[n].props.cluster_id;
115
+ core_id = -1;
116
+ cluster_offset = table_data->len - pptt_start;
117
+ build_processor_hierarchy_node(table_data,
118
+ (0 << 0), /* Not a physical package */
119
+ socket_offset, cluster_id, NULL, 0);
120
}
121
+ } else {
122
+ cluster_offset = socket_offset;
123
}
124
- }
125
126
- length = g_queue_get_length(list);
127
- for (i = 0; i < length; i++) {
128
- int thread;
129
+ if (ms->smp.threads == 1) {
130
+ build_processor_hierarchy_node(table_data,
131
+ (1 << 1) | /* ACPI Processor ID valid */
132
+ (1 << 3), /* Node is a Leaf */
133
+ cluster_offset, n, NULL, 0);
134
+ } else {
135
+ if (cpus->cpus[n].props.core_id != core_id) {
136
+ assert(cpus->cpus[n].props.core_id > core_id);
137
+ core_id = cpus->cpus[n].props.core_id;
138
+ core_offset = table_data->len - pptt_start;
139
+ build_processor_hierarchy_node(table_data,
140
+ (0 << 0), /* Not a physical package */
141
+ cluster_offset, core_id, NULL, 0);
142
+ }
143
144
- parent_offset = GPOINTER_TO_UINT(g_queue_pop_head(list));
145
- for (thread = 0; thread < ms->smp.threads; thread++) {
146
- build_processor_hierarchy_node(
147
- table_data,
148
+ build_processor_hierarchy_node(table_data,
149
(1 << 1) | /* ACPI Processor ID valid */
150
(1 << 2) | /* Processor is a Thread */
151
(1 << 3), /* Node is a Leaf */
152
- parent_offset, uid++, NULL, 0);
153
+ core_offset, n, NULL, 0);
154
}
78
}
155
}
79
}
156
80
157
- g_queue_free(list);
81
- for (i = 0; i < 4; i++) {
158
acpi_table_end(linker, &table);
82
+ for (i = 0; i < NUM_UART; i++) {
159
}
83
if (board->dc2 & (1 << i)) {
84
SysBusDevice *sbd;
160
85
161
--
86
--
162
2.25.1
87
2.34.1
88
89
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
More gracefully handle cpregs when EL2 and/or EL3 are missing.
3
Add definitions (DCx_periph) for the DeviceCapability bits,
4
If the reg is entirely inaccessible, do not register it at all.
4
replace direct bitmask checks with the DEV_CAP() macro,
5
If the reg is for EL2, and EL3 is present but EL2 is not,
5
which use the extract/deposit API.
6
either discard, squash to res0, const, or keep unchanged.
7
6
8
Per rule RJFFP, mark the 4 aarch32 hypervisor access registers
7
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
9
with ARM_CP_EL3_NO_EL2_KEEP, and mark all of the EL2 address
10
translation and tlb invalidation "regs" ARM_CP_EL3_NO_EL2_UNDEF.
11
Mark the 2 virtualization processor id regs ARM_CP_EL3_NO_EL2_C_NZ.
12
13
This will simplify cpreg registration for conditional arm features.
14
15
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
16
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20250110160204.74997-6-philmd@linaro.org
17
Message-id: 20220506180242.216785-2-richard.henderson@linaro.org
18
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
19
---
11
---
20
target/arm/cpregs.h | 11 +++
12
hw/arm/stellaris.c | 37 +++++++++++++++++++++++++++++--------
21
target/arm/helper.c | 178 ++++++++++++++++++++++++++++++--------------
13
1 file changed, 29 insertions(+), 8 deletions(-)
22
2 files changed, 133 insertions(+), 56 deletions(-)
23
14
24
diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h
15
diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c
25
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
26
--- a/target/arm/cpregs.h
17
--- a/hw/arm/stellaris.c
27
+++ b/target/arm/cpregs.h
18
+++ b/hw/arm/stellaris.c
28
@@ -XXX,XX +XXX,XX @@ enum {
19
@@ -XXX,XX +XXX,XX @@
29
ARM_CP_SVE = 1 << 14,
20
*/
30
/* Flag: Do not expose in gdb sysreg xml. */
21
31
ARM_CP_NO_GDB = 1 << 15,
22
#include "qemu/osdep.h"
32
+ /*
23
+#include "qemu/bitops.h"
33
+ * Flags: If EL3 but not EL2...
24
#include "qapi/error.h"
34
+ * - UNDEF: discard the cpreg,
25
#include "hw/core/split-irq.h"
35
+ * - KEEP: retain the cpreg as is,
26
#include "hw/sysbus.h"
36
+ * - C_NZ: set const on the cpreg, but retain resetvalue,
27
@@ -XXX,XX +XXX,XX @@
37
+ * - else: set const on the cpreg, zero resetvalue, aka RES0.
28
#define NUM_GPTM 4
38
+ * See rule RJFFP in section D1.1.3 of DDI0487H.a.
29
#define NUM_I2C 2
39
+ */
30
40
+ ARM_CP_EL3_NO_EL2_UNDEF = 1 << 16,
31
+/*
41
+ ARM_CP_EL3_NO_EL2_KEEP = 1 << 17,
32
+ * See Stellaris Data Sheet chapter 5.2.5 "System Control",
42
+ ARM_CP_EL3_NO_EL2_C_NZ = 1 << 18,
33
+ * Register 13 .. 17: Device Capabilities 0 .. 4 (DC0 .. DC4).
43
};
34
+ */
44
35
+#define DC1_WDT 3
45
/*
36
+#define DC1_HIB 6
46
diff --git a/target/arm/helper.c b/target/arm/helper.c
37
+#define DC1_MPU 7
47
index XXXXXXX..XXXXXXX 100644
38
+#define DC1_ADC 16
48
--- a/target/arm/helper.c
39
+#define DC1_PWM 20
49
+++ b/target/arm/helper.c
40
+#define DC2_UART(n) (n)
50
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo v8_cp_reginfo[] = {
41
+#define DC2_SSI 4
51
.access = PL1_RW, .readfn = spsel_read, .writefn = spsel_write },
42
+#define DC2_QEI(n) (8 + n)
52
{ .name = "FPEXC32_EL2", .state = ARM_CP_STATE_AA64,
43
+#define DC2_I2C(n) (12 + 2 * n)
53
.opc0 = 3, .opc1 = 4, .crn = 5, .crm = 3, .opc2 = 0,
44
+#define DC2_GPTM(n) (16 + n)
54
- .access = PL2_RW, .type = ARM_CP_ALIAS | ARM_CP_FPU,
45
+#define DC2_COMP(n) (24 + n)
55
+ .access = PL2_RW,
46
+#define DC4_GPIO(n) (n)
56
+ .type = ARM_CP_ALIAS | ARM_CP_FPU | ARM_CP_EL3_NO_EL2_KEEP,
47
+#define DC4_EMAC 28
57
.fieldoffset = offsetof(CPUARMState, vfp.xregs[ARM_VFP_FPEXC]) },
48
+
58
{ .name = "DACR32_EL2", .state = ARM_CP_STATE_AA64,
49
+#define DEV_CAP(_dc, _cap) extract32(board->dc##_dc, DC##_dc##_##_cap, 1)
59
.opc0 = 3, .opc1 = 4, .crn = 3, .crm = 0, .opc2 = 0,
50
+
60
- .access = PL2_RW, .resetvalue = 0,
51
typedef const struct {
61
+ .access = PL2_RW, .resetvalue = 0, .type = ARM_CP_EL3_NO_EL2_KEEP,
52
const char *name;
62
.writefn = dacr_write, .raw_writefn = raw_write,
53
uint32_t did0;
63
.fieldoffset = offsetof(CPUARMState, cp15.dacr32_el2) },
54
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
64
{ .name = "IFSR32_EL2", .state = ARM_CP_STATE_AA64,
55
sysbus_mmio_map(SYS_BUS_DEVICE(ssys_dev), 0, 0x400fe000);
65
.opc0 = 3, .opc1 = 4, .crn = 5, .crm = 0, .opc2 = 1,
56
sysbus_connect_irq(SYS_BUS_DEVICE(ssys_dev), 0, qdev_get_gpio_in(nvic, 28));
66
- .access = PL2_RW, .resetvalue = 0,
57
67
+ .access = PL2_RW, .resetvalue = 0, .type = ARM_CP_EL3_NO_EL2_KEEP,
58
- if (board->dc1 & (1 << 16)) {
68
.fieldoffset = offsetof(CPUARMState, cp15.ifsr32_el2) },
59
+ if (DEV_CAP(1, ADC)) {
69
{ .name = "SPSR_IRQ", .state = ARM_CP_STATE_AA64,
60
dev = sysbus_create_varargs(TYPE_STELLARIS_ADC, 0x40038000,
70
.type = ARM_CP_ALIAS,
61
qdev_get_gpio_in(nvic, 14),
71
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo el2_cp_reginfo[] = {
62
qdev_get_gpio_in(nvic, 15),
72
.writefn = tlbimva_hyp_is_write },
63
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
73
{ .name = "TLBI_ALLE2", .state = ARM_CP_STATE_AA64,
64
adc = NULL;
74
.opc0 = 1, .opc1 = 4, .crn = 8, .crm = 7, .opc2 = 0,
65
}
75
- .type = ARM_CP_NO_RAW, .access = PL2_W,
66
for (i = 0; i < NUM_GPTM; i++) {
76
+ .access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_EL3_NO_EL2_UNDEF,
67
- if (board->dc2 & (0x10000 << i)) {
77
.writefn = tlbi_aa64_alle2_write },
68
+ if (DEV_CAP(2, GPTM(i))) {
78
{ .name = "TLBI_VAE2", .state = ARM_CP_STATE_AA64,
69
SysBusDevice *sbd;
79
.opc0 = 1, .opc1 = 4, .crn = 8, .crm = 7, .opc2 = 1,
70
80
- .type = ARM_CP_NO_RAW, .access = PL2_W,
71
dev = qdev_new(TYPE_STELLARIS_GPTM);
81
+ .access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_EL3_NO_EL2_UNDEF,
72
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
82
.writefn = tlbi_aa64_vae2_write },
83
{ .name = "TLBI_VALE2", .state = ARM_CP_STATE_AA64,
84
.opc0 = 1, .opc1 = 4, .crn = 8, .crm = 7, .opc2 = 5,
85
- .access = PL2_W, .type = ARM_CP_NO_RAW,
86
+ .access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_EL3_NO_EL2_UNDEF,
87
.writefn = tlbi_aa64_vae2_write },
88
{ .name = "TLBI_ALLE2IS", .state = ARM_CP_STATE_AA64,
89
.opc0 = 1, .opc1 = 4, .crn = 8, .crm = 3, .opc2 = 0,
90
- .access = PL2_W, .type = ARM_CP_NO_RAW,
91
+ .access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_EL3_NO_EL2_UNDEF,
92
.writefn = tlbi_aa64_alle2is_write },
93
{ .name = "TLBI_VAE2IS", .state = ARM_CP_STATE_AA64,
94
.opc0 = 1, .opc1 = 4, .crn = 8, .crm = 3, .opc2 = 1,
95
- .type = ARM_CP_NO_RAW, .access = PL2_W,
96
+ .access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_EL3_NO_EL2_UNDEF,
97
.writefn = tlbi_aa64_vae2is_write },
98
{ .name = "TLBI_VALE2IS", .state = ARM_CP_STATE_AA64,
99
.opc0 = 1, .opc1 = 4, .crn = 8, .crm = 3, .opc2 = 5,
100
- .access = PL2_W, .type = ARM_CP_NO_RAW,
101
+ .access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_EL3_NO_EL2_UNDEF,
102
.writefn = tlbi_aa64_vae2is_write },
103
#ifndef CONFIG_USER_ONLY
104
/* Unlike the other EL2-related AT operations, these must
105
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo el2_cp_reginfo[] = {
106
{ .name = "AT_S1E2R", .state = ARM_CP_STATE_AA64,
107
.opc0 = 1, .opc1 = 4, .crn = 7, .crm = 8, .opc2 = 0,
108
.access = PL2_W, .accessfn = at_s1e2_access,
109
- .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC, .writefn = ats_write64 },
110
+ .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC | ARM_CP_EL3_NO_EL2_UNDEF,
111
+ .writefn = ats_write64 },
112
{ .name = "AT_S1E2W", .state = ARM_CP_STATE_AA64,
113
.opc0 = 1, .opc1 = 4, .crn = 7, .crm = 8, .opc2 = 1,
114
.access = PL2_W, .accessfn = at_s1e2_access,
115
- .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC, .writefn = ats_write64 },
116
+ .type = ARM_CP_NO_RAW | ARM_CP_RAISES_EXC | ARM_CP_EL3_NO_EL2_UNDEF,
117
+ .writefn = ats_write64 },
118
/* The AArch32 ATS1H* operations are CONSTRAINED UNPREDICTABLE
119
* if EL2 is not implemented; we choose to UNDEF. Behaviour at EL3
120
* with SCR.NS == 0 outside Monitor mode is UNPREDICTABLE; we choose
121
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo debug_cp_reginfo[] = {
122
{ .name = "DBGVCR32_EL2", .state = ARM_CP_STATE_AA64,
123
.opc0 = 2, .opc1 = 4, .crn = 0, .crm = 7, .opc2 = 0,
124
.access = PL2_RW, .accessfn = access_tda,
125
- .type = ARM_CP_NOP },
126
+ .type = ARM_CP_NOP | ARM_CP_EL3_NO_EL2_KEEP },
127
/* Dummy MDCCINT_EL1, since we don't implement the Debug Communications
128
* Channel but Linux may try to access this register. The 32-bit
129
* alias is DBGDCCINT.
130
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo tlbirange_reginfo[] = {
131
.access = PL2_W, .type = ARM_CP_NOP },
132
{ .name = "TLBI_RVAE2IS", .state = ARM_CP_STATE_AA64,
133
.opc0 = 1, .opc1 = 4, .crn = 8, .crm = 2, .opc2 = 1,
134
- .access = PL2_W, .type = ARM_CP_NO_RAW,
135
+ .access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_EL3_NO_EL2_UNDEF,
136
.writefn = tlbi_aa64_rvae2is_write },
137
{ .name = "TLBI_RVALE2IS", .state = ARM_CP_STATE_AA64,
138
.opc0 = 1, .opc1 = 4, .crn = 8, .crm = 2, .opc2 = 5,
139
- .access = PL2_W, .type = ARM_CP_NO_RAW,
140
+ .access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_EL3_NO_EL2_UNDEF,
141
.writefn = tlbi_aa64_rvae2is_write },
142
{ .name = "TLBI_RIPAS2E1", .state = ARM_CP_STATE_AA64,
143
.opc0 = 1, .opc1 = 4, .crn = 8, .crm = 4, .opc2 = 2,
144
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo tlbirange_reginfo[] = {
145
.access = PL2_W, .type = ARM_CP_NOP },
146
{ .name = "TLBI_RVAE2OS", .state = ARM_CP_STATE_AA64,
147
.opc0 = 1, .opc1 = 4, .crn = 8, .crm = 5, .opc2 = 1,
148
- .access = PL2_W, .type = ARM_CP_NO_RAW,
149
+ .access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_EL3_NO_EL2_UNDEF,
150
.writefn = tlbi_aa64_rvae2is_write },
151
{ .name = "TLBI_RVALE2OS", .state = ARM_CP_STATE_AA64,
152
.opc0 = 1, .opc1 = 4, .crn = 8, .crm = 5, .opc2 = 5,
153
- .access = PL2_W, .type = ARM_CP_NO_RAW,
154
+ .access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_EL3_NO_EL2_UNDEF,
155
.writefn = tlbi_aa64_rvae2is_write },
156
{ .name = "TLBI_RVAE2", .state = ARM_CP_STATE_AA64,
157
.opc0 = 1, .opc1 = 4, .crn = 8, .crm = 6, .opc2 = 1,
158
- .access = PL2_W, .type = ARM_CP_NO_RAW,
159
+ .access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_EL3_NO_EL2_UNDEF,
160
.writefn = tlbi_aa64_rvae2_write },
161
{ .name = "TLBI_RVALE2", .state = ARM_CP_STATE_AA64,
162
.opc0 = 1, .opc1 = 4, .crn = 8, .crm = 6, .opc2 = 5,
163
- .access = PL2_W, .type = ARM_CP_NO_RAW,
164
+ .access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_EL3_NO_EL2_UNDEF,
165
.writefn = tlbi_aa64_rvae2_write },
166
{ .name = "TLBI_RVAE3IS", .state = ARM_CP_STATE_AA64,
167
.opc0 = 1, .opc1 = 6, .crn = 8, .crm = 2, .opc2 = 1,
168
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo tlbios_reginfo[] = {
169
.writefn = tlbi_aa64_vae1is_write },
170
{ .name = "TLBI_ALLE2OS", .state = ARM_CP_STATE_AA64,
171
.opc0 = 1, .opc1 = 4, .crn = 8, .crm = 1, .opc2 = 0,
172
- .access = PL2_W, .type = ARM_CP_NO_RAW,
173
+ .access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_EL3_NO_EL2_UNDEF,
174
.writefn = tlbi_aa64_alle2is_write },
175
{ .name = "TLBI_VAE2OS", .state = ARM_CP_STATE_AA64,
176
.opc0 = 1, .opc1 = 4, .crn = 8, .crm = 1, .opc2 = 1,
177
- .access = PL2_W, .type = ARM_CP_NO_RAW,
178
+ .access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_EL3_NO_EL2_UNDEF,
179
.writefn = tlbi_aa64_vae2is_write },
180
{ .name = "TLBI_ALLE1OS", .state = ARM_CP_STATE_AA64,
181
.opc0 = 1, .opc1 = 4, .crn = 8, .crm = 1, .opc2 = 4,
182
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo tlbios_reginfo[] = {
183
.writefn = tlbi_aa64_alle1is_write },
184
{ .name = "TLBI_VALE2OS", .state = ARM_CP_STATE_AA64,
185
.opc0 = 1, .opc1 = 4, .crn = 8, .crm = 1, .opc2 = 5,
186
- .access = PL2_W, .type = ARM_CP_NO_RAW,
187
+ .access = PL2_W, .type = ARM_CP_NO_RAW | ARM_CP_EL3_NO_EL2_UNDEF,
188
.writefn = tlbi_aa64_vae2is_write },
189
{ .name = "TLBI_VMALLS12E1OS", .state = ARM_CP_STATE_AA64,
190
.opc0 = 1, .opc1 = 4, .crn = 8, .crm = 1, .opc2 = 6,
191
@@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu)
192
{ .name = "VPIDR", .state = ARM_CP_STATE_AA32,
193
.cp = 15, .opc1 = 4, .crn = 0, .crm = 0, .opc2 = 0,
194
.access = PL2_RW, .accessfn = access_el3_aa32ns,
195
- .resetvalue = cpu->midr, .type = ARM_CP_ALIAS,
196
+ .resetvalue = cpu->midr,
197
+ .type = ARM_CP_ALIAS | ARM_CP_EL3_NO_EL2_C_NZ,
198
.fieldoffset = offsetoflow32(CPUARMState, cp15.vpidr_el2) },
199
{ .name = "VPIDR_EL2", .state = ARM_CP_STATE_AA64,
200
.opc0 = 3, .opc1 = 4, .crn = 0, .crm = 0, .opc2 = 0,
201
.access = PL2_RW, .resetvalue = cpu->midr,
202
+ .type = ARM_CP_EL3_NO_EL2_C_NZ,
203
.fieldoffset = offsetof(CPUARMState, cp15.vpidr_el2) },
204
{ .name = "VMPIDR", .state = ARM_CP_STATE_AA32,
205
.cp = 15, .opc1 = 4, .crn = 0, .crm = 0, .opc2 = 5,
206
.access = PL2_RW, .accessfn = access_el3_aa32ns,
207
- .resetvalue = vmpidr_def, .type = ARM_CP_ALIAS,
208
+ .resetvalue = vmpidr_def,
209
+ .type = ARM_CP_ALIAS | ARM_CP_EL3_NO_EL2_C_NZ,
210
.fieldoffset = offsetoflow32(CPUARMState, cp15.vmpidr_el2) },
211
{ .name = "VMPIDR_EL2", .state = ARM_CP_STATE_AA64,
212
.opc0 = 3, .opc1 = 4, .crn = 0, .crm = 0, .opc2 = 5,
213
- .access = PL2_RW,
214
- .resetvalue = vmpidr_def,
215
+ .access = PL2_RW, .resetvalue = vmpidr_def,
216
+ .type = ARM_CP_EL3_NO_EL2_C_NZ,
217
.fieldoffset = offsetof(CPUARMState, cp15.vmpidr_el2) },
218
};
219
define_arm_cp_regs(cpu, vpidr_regs);
220
@@ -XXX,XX +XXX,XX @@ static void add_cpreg_to_hashtable(ARMCPU *cpu, const ARMCPRegInfo *r,
221
int crm, int opc1, int opc2,
222
const char *name)
223
{
224
+ CPUARMState *env = &cpu->env;
225
uint32_t key;
226
ARMCPRegInfo *r2;
227
bool is64 = r->type & ARM_CP_64BIT;
228
bool ns = secstate & ARM_CP_SECSTATE_NS;
229
int cp = r->cp;
230
- bool isbanked;
231
size_t name_len;
232
+ bool make_const;
233
234
switch (state) {
235
case ARM_CP_STATE_AA32:
236
@@ -XXX,XX +XXX,XX @@ static void add_cpreg_to_hashtable(ARMCPU *cpu, const ARMCPRegInfo *r,
237
}
73
}
238
}
74
}
239
75
240
+ /*
76
- if (board->dc1 & (1 << 3)) { /* watchdog present */
241
+ * Eliminate registers that are not present because the EL is missing.
77
+ if (DEV_CAP(1, WDT)) {
242
+ * Doing this here makes it easier to put all registers for a given
78
dev = qdev_new(TYPE_LUMINARY_WATCHDOG);
243
+ * feature into the same ARMCPRegInfo array and define them all at once.
79
object_property_add_child(soc_container, "wdg", OBJECT(dev));
244
+ */
80
qdev_connect_clock_in(dev, "WDOGCLK",
245
+ make_const = false;
81
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
246
+ if (arm_feature(env, ARM_FEATURE_EL3)) {
82
247
+ /*
83
248
+ * An EL2 register without EL2 but with EL3 is (usually) RES0.
84
for (i = 0; i < NUM_GPIO; i++) {
249
+ * See rule RJFFP in section D1.1.3 of DDI0487H.a.
85
- if (board->dc4 & (1 << i)) {
250
+ */
86
+ if (DEV_CAP(4, GPIO(i))) {
251
+ int min_el = ctz32(r->access) / 2;
87
gpio_dev[i] = sysbus_create_simple("pl061_luminary", gpio_addr[i],
252
+ if (min_el == 2 && !arm_feature(env, ARM_FEATURE_EL2)) {
88
qdev_get_gpio_in(nvic,
253
+ if (r->type & ARM_CP_EL3_NO_EL2_UNDEF) {
89
gpio_irq[i]));
254
+ return;
90
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
255
+ }
256
+ make_const = !(r->type & ARM_CP_EL3_NO_EL2_KEEP);
257
+ }
258
+ } else {
259
+ CPAccessRights max_el = (arm_feature(env, ARM_FEATURE_EL2)
260
+ ? PL2_RW : PL1_RW);
261
+ if ((r->access & max_el) == 0) {
262
+ return;
263
+ }
264
+ }
265
+
266
/* Combine cpreg and name into one allocation. */
267
name_len = strlen(name) + 1;
268
r2 = g_malloc(sizeof(*r2) + name_len);
269
@@ -XXX,XX +XXX,XX @@ static void add_cpreg_to_hashtable(ARMCPU *cpu, const ARMCPRegInfo *r,
270
r2->opaque = opaque;
271
}
272
273
- isbanked = r->bank_fieldoffsets[0] && r->bank_fieldoffsets[1];
274
- if (isbanked) {
275
+ if (make_const) {
276
+ /* This should not have been a very special register to begin. */
277
+ int old_special = r2->type & ARM_CP_SPECIAL_MASK;
278
+ assert(old_special == 0 || old_special == ARM_CP_NOP);
279
/*
280
- * Register is banked (using both entries in array).
281
- * Overwriting fieldoffset as the array is only used to define
282
- * banked registers but later only fieldoffset is used.
283
+ * Set the special function to CONST, retaining the other flags.
284
+ * This is important for e.g. ARM_CP_SVE so that we still
285
+ * take the SVE trap if CPTR_EL3.EZ == 0.
286
*/
287
- r2->fieldoffset = r->bank_fieldoffsets[ns];
288
- }
289
+ r2->type = (r2->type & ~ARM_CP_SPECIAL_MASK) | ARM_CP_CONST;
290
+ /*
291
+ * Usually, these registers become RES0, but there are a few
292
+ * special cases like VPIDR_EL2 which have a constant non-zero
293
+ * value with writes ignored.
294
+ */
295
+ if (!(r->type & ARM_CP_EL3_NO_EL2_C_NZ)) {
296
+ r2->resetvalue = 0;
297
+ }
298
+ /*
299
+ * ARM_CP_CONST has precedence, so removing the callbacks and
300
+ * offsets are not strictly necessary, but it is potentially
301
+ * less confusing to debug later.
302
+ */
303
+ r2->readfn = NULL;
304
+ r2->writefn = NULL;
305
+ r2->raw_readfn = NULL;
306
+ r2->raw_writefn = NULL;
307
+ r2->resetfn = NULL;
308
+ r2->fieldoffset = 0;
309
+ r2->bank_fieldoffsets[0] = 0;
310
+ r2->bank_fieldoffsets[1] = 0;
311
+ } else {
312
+ bool isbanked = r->bank_fieldoffsets[0] && r->bank_fieldoffsets[1];
313
314
- if (state == ARM_CP_STATE_AA32) {
315
if (isbanked) {
316
/*
317
- * If the register is banked then we don't need to migrate or
318
- * reset the 32-bit instance in certain cases:
319
- *
320
- * 1) If the register has both 32-bit and 64-bit instances then we
321
- * can count on the 64-bit instance taking care of the
322
- * non-secure bank.
323
- * 2) If ARMv8 is enabled then we can count on a 64-bit version
324
- * taking care of the secure bank. This requires that separate
325
- * 32 and 64-bit definitions are provided.
326
+ * Register is banked (using both entries in array).
327
+ * Overwriting fieldoffset as the array is only used to define
328
+ * banked registers but later only fieldoffset is used.
329
*/
330
- if ((r->state == ARM_CP_STATE_BOTH && ns) ||
331
- (arm_feature(&cpu->env, ARM_FEATURE_V8) && !ns)) {
332
+ r2->fieldoffset = r->bank_fieldoffsets[ns];
333
+ }
334
+ if (state == ARM_CP_STATE_AA32) {
335
+ if (isbanked) {
336
+ /*
337
+ * If the register is banked then we don't need to migrate or
338
+ * reset the 32-bit instance in certain cases:
339
+ *
340
+ * 1) If the register has both 32-bit and 64-bit instances
341
+ * then we can count on the 64-bit instance taking care
342
+ * of the non-secure bank.
343
+ * 2) If ARMv8 is enabled then we can count on a 64-bit
344
+ * version taking care of the secure bank. This requires
345
+ * that separate 32 and 64-bit definitions are provided.
346
+ */
347
+ if ((r->state == ARM_CP_STATE_BOTH && ns) ||
348
+ (arm_feature(env, ARM_FEATURE_V8) && !ns)) {
349
+ r2->type |= ARM_CP_ALIAS;
350
+ }
351
+ } else if ((secstate != r->secure) && !ns) {
352
+ /*
353
+ * The register is not banked so we only want to allow
354
+ * migration of the non-secure instance.
355
+ */
356
r2->type |= ARM_CP_ALIAS;
357
}
358
- } else if ((secstate != r->secure) && !ns) {
359
- /*
360
- * The register is not banked so we only want to allow migration
361
- * of the non-secure instance.
362
- */
363
- r2->type |= ARM_CP_ALIAS;
364
- }
365
366
- if (HOST_BIG_ENDIAN &&
367
- r->state == ARM_CP_STATE_BOTH && r2->fieldoffset) {
368
- r2->fieldoffset += sizeof(uint32_t);
369
+ if (HOST_BIG_ENDIAN &&
370
+ r->state == ARM_CP_STATE_BOTH && r2->fieldoffset) {
371
+ r2->fieldoffset += sizeof(uint32_t);
372
+ }
373
}
91
}
374
}
92
}
375
93
376
@@ -XXX,XX +XXX,XX @@ static void add_cpreg_to_hashtable(ARMCPU *cpu, const ARMCPRegInfo *r,
94
- if (board->dc2 & (1 << 12)) {
377
* multiple times. Special registers (ie NOP/WFI) are
95
+ if (DEV_CAP(2, I2C(0))) {
378
* never migratable and not even raw-accessible.
96
dev = sysbus_create_simple(TYPE_STELLARIS_I2C, 0x40020000,
379
*/
97
qdev_get_gpio_in(nvic, 8));
380
- if (r->type & ARM_CP_SPECIAL_MASK) {
98
i2c = (I2CBus *)qdev_get_child_bus(dev, "i2c");
381
+ if (r2->type & ARM_CP_SPECIAL_MASK) {
99
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
382
r2->type |= ARM_CP_NO_RAW;
383
}
100
}
384
if (((r->crm == CP_ANY) && crm != 0) ||
101
102
for (i = 0; i < NUM_UART; i++) {
103
- if (board->dc2 & (1 << i)) {
104
+ if (DEV_CAP(2, UART(i))) {
105
SysBusDevice *sbd;
106
107
dev = qdev_new("pl011_luminary");
108
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
109
sysbus_connect_irq(sbd, 0, qdev_get_gpio_in(nvic, uart_irq[i]));
110
}
111
}
112
- if (board->dc2 & (1 << 4)) {
113
+ if (DEV_CAP(2, SSI)) {
114
dev = sysbus_create_simple("pl022", 0x40008000,
115
qdev_get_gpio_in(nvic, 7));
116
if (board->peripherals & BP_OLED_SSI) {
117
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
118
qemu_irq_raise(gpio_out[GPIO_D][0]);
119
}
120
}
121
- if (board->dc4 & (1 << 28)) {
122
+ if (DEV_CAP(4, EMAC)) {
123
DeviceState *enet;
124
125
enet = qdev_new("stellaris_enet");
385
--
126
--
386
2.25.1
127
2.34.1
128
129
diff view generated by jsdifflib
1
From: Leif Lindholm <quic_llindhol@quicinc.com>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
The sbsa-ref machine is continuously evolving. Some of the changes we
3
There are 2 I2C controllers, map them both, removing
4
want to make in the near future, to align with real components (e.g.
4
the unimplemented one. Keep the OLED controller on the
5
the GIC-700), will break compatibility for existing firmware.
5
first I2C bus.
6
6
7
Introduce two new properties to the DT generated on machine generation:
7
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
8
- machine-version-major
9
To be incremented when a platform change makes the machine
10
incompatible with existing firmware.
11
- machine-version-minor
12
To be incremented when functionality is added to the machine
13
without causing incompatibility with existing firmware.
14
to be reset to 0 when machine-version-major is incremented.
15
16
This versioning scheme is *neither*:
17
- A QEMU versioned machine type; a given version of QEMU will emulate
18
a given version of the platform.
19
- A reflection of level of SBSA (now SystemReady SR) support provided.
20
21
The version will increment on guest-visible functional changes only,
22
akin to a revision ID register found on a physical platform.
23
24
These properties are both introduced with the value 0.
25
(Hence, a machine where the DT is lacking these nodes is equivalent
26
to version 0.0.)
27
28
Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com>
29
Message-id: 20220505113947.75714-1-quic_llindhol@quicinc.com
30
Cc: Peter Maydell <peter.maydell@linaro.org>
31
Cc: Radoslaw Biernacki <rad@semihalf.com>
32
Cc: Cédric Le Goater <clg@kaod.org>
33
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Message-id: 20250110160204.74997-7-philmd@linaro.org
10
[PMM: tweak to appease maybe-use-uninitialized warning]
34
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
35
---
12
---
36
hw/arm/sbsa-ref.c | 14 ++++++++++++++
13
hw/arm/stellaris.c | 21 +++++++++++++--------
37
1 file changed, 14 insertions(+)
14
1 file changed, 13 insertions(+), 8 deletions(-)
38
15
39
diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c
16
diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c
40
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
41
--- a/hw/arm/sbsa-ref.c
18
--- a/hw/arm/stellaris.c
42
+++ b/hw/arm/sbsa-ref.c
19
+++ b/hw/arm/stellaris.c
43
@@ -XXX,XX +XXX,XX @@ static void create_fdt(SBSAMachineState *sms)
20
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
44
qemu_fdt_setprop_cell(fdt, "/", "#address-cells", 0x2);
21
{ 0x40004000, 0x40005000, 0x40006000, 0x40007000,
45
qemu_fdt_setprop_cell(fdt, "/", "#size-cells", 0x2);
22
0x40024000, 0x40025000, 0x40026000};
46
23
static const int gpio_irq[NUM_GPIO] = {0, 1, 2, 3, 4, 30, 31};
47
+ /*
24
+ static const uint32_t i2c_addr[NUM_I2C] = {0x40020000, 0x40021000};
48
+ * This versioning scheme is for informing platform fw only. It is neither:
25
+ static const int i2c_irq[NUM_I2C] = {8, 37};
49
+ * - A QEMU versioned machine type; a given version of QEMU will emulate
26
50
+ * a given version of the platform.
27
/* Memory map of SoC devices, from
51
+ * - A reflection of level of SBSA (now SystemReady SR) support provided.
28
* Stellaris LM3S6965 Microcontroller Data Sheet (rev I)
52
+ *
29
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
53
+ * machine-version-major: updated when changes breaking fw compatibility
30
qemu_irq adc;
54
+ * are introduced.
31
int sram_size;
55
+ * machine-version-minor: updated when features are added that don't break
32
int flash_size;
56
+ * fw compatibility.
33
- I2CBus *i2c;
57
+ */
34
+ DeviceState *i2c_dev[NUM_I2C] = { };
58
+ qemu_fdt_setprop_cell(fdt, "/", "machine-version-major", 0);
35
DeviceState *dev;
59
+ qemu_fdt_setprop_cell(fdt, "/", "machine-version-minor", 0);
36
DeviceState *ssys_dev;
37
int i;
38
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
39
}
40
}
41
42
- if (DEV_CAP(2, I2C(0))) {
43
- dev = sysbus_create_simple(TYPE_STELLARIS_I2C, 0x40020000,
44
- qdev_get_gpio_in(nvic, 8));
45
- i2c = (I2CBus *)qdev_get_child_bus(dev, "i2c");
46
- if (board->peripherals & BP_OLED_I2C) {
47
- i2c_slave_create_simple(i2c, "ssd0303", 0x3d);
48
+ for (i = 0; i < NUM_I2C; i++) {
49
+ if (DEV_CAP(2, I2C(i))) {
50
+ i2c_dev[i] = sysbus_create_simple(TYPE_STELLARIS_I2C, i2c_addr[i],
51
+ qdev_get_gpio_in(nvic,
52
+ i2c_irq[i]));
53
}
54
}
55
+ if (board->peripherals & BP_OLED_I2C) {
56
+ I2CBus *bus = (I2CBus *)qdev_get_child_bus(i2c_dev[0], "i2c");
60
+
57
+
61
if (ms->numa_state->have_numa_distance) {
58
+ i2c_slave_create_simple(bus, "ssd0303", 0x3d);
62
int size = nb_numa_nodes * nb_numa_nodes * 3 * sizeof(uint32_t);
59
+ }
63
uint32_t *matrix = g_malloc0(size);
60
61
for (i = 0; i < NUM_UART; i++) {
62
if (DEV_CAP(2, UART(i))) {
63
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
64
/* Add dummy regions for the devices we don't implement yet,
65
* so guest accesses don't cause unlogged crashes.
66
*/
67
- create_unimplemented_device("i2c-2", 0x40021000, 0x1000);
68
create_unimplemented_device("PWM", 0x40028000, 0x1000);
69
create_unimplemented_device("QEI-0", 0x4002c000, 0x1000);
70
create_unimplemented_device("QEI-1", 0x4002d000, 0x1000);
64
--
71
--
65
2.25.1
72
2.34.1
66
73
67
74
diff view generated by jsdifflib
1
From: Leif Lindholm <quic_llindhol@quicinc.com>
1
From: Thomas Huth <thuth@redhat.com>
2
2
3
NUVIA was acquired by Qualcomm in March 2021, but kept functioning on
3
We don't have any functional tests for this machine yet, thus let's
4
separate infrastructure for a transitional period. We've now switched
4
add a test with a MicroPython binary that is available online
5
over to contributing as Qualcomm Innovation Center (quicinc), so update
5
(thanks to Joel Stanley for providing it, see:
6
my email address to reflect this.
6
https://www.mail-archive.com/qemu-devel@nongnu.org/msg606064.html ).
7
7
8
Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com>
8
Signed-off-by: Thomas Huth <thuth@redhat.com>
9
Message-id: 20220505113740.75565-1-quic_llindhol@quicinc.com
9
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
10
Cc: Leif Lindholm <leif@nuviainc.com>
10
Message-id: 20250124101709.1591761-1-thuth@redhat.com
11
Cc: Peter Maydell <peter.maydell@linaro.org>
12
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
13
[Fixed commit message typo]
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
---
12
---
16
.mailmap | 3 ++-
13
MAINTAINERS | 1 +
17
MAINTAINERS | 2 +-
14
tests/functional/meson.build | 1 +
18
2 files changed, 3 insertions(+), 2 deletions(-)
15
tests/functional/test_arm_microbit.py | 31 +++++++++++++++++++++++++++
16
3 files changed, 33 insertions(+)
17
create mode 100755 tests/functional/test_arm_microbit.py
19
18
20
diff --git a/.mailmap b/.mailmap
21
index XXXXXXX..XXXXXXX 100644
22
--- a/.mailmap
23
+++ b/.mailmap
24
@@ -XXX,XX +XXX,XX @@ Greg Kurz <groug@kaod.org> <gkurz@linux.vnet.ibm.com>
25
Huacai Chen <chenhuacai@kernel.org> <chenhc@lemote.com>
26
Huacai Chen <chenhuacai@kernel.org> <chenhuacai@loongson.cn>
27
James Hogan <jhogan@kernel.org> <james.hogan@imgtec.com>
28
-Leif Lindholm <leif@nuviainc.com> <leif.lindholm@linaro.org>
29
+Leif Lindholm <quic_llindhol@quicinc.com> <leif.lindholm@linaro.org>
30
+Leif Lindholm <quic_llindhol@quicinc.com> <leif@nuviainc.com>
31
Radoslaw Biernacki <rad@semihalf.com> <radoslaw.biernacki@linaro.org>
32
Paul Burton <paulburton@kernel.org> <paul.burton@mips.com>
33
Paul Burton <paulburton@kernel.org> <paul.burton@imgtec.com>
34
diff --git a/MAINTAINERS b/MAINTAINERS
19
diff --git a/MAINTAINERS b/MAINTAINERS
35
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
36
--- a/MAINTAINERS
21
--- a/MAINTAINERS
37
+++ b/MAINTAINERS
22
+++ b/MAINTAINERS
38
@@ -XXX,XX +XXX,XX @@ F: include/hw/ssi/imx_spi.h
23
@@ -XXX,XX +XXX,XX @@ F: hw/*/microbit*.c
39
SBSA-REF
24
F: include/hw/*/nrf51*.h
40
M: Radoslaw Biernacki <rad@semihalf.com>
25
F: include/hw/*/microbit*.h
41
M: Peter Maydell <peter.maydell@linaro.org>
26
F: tests/qtest/microbit-test.c
42
-R: Leif Lindholm <leif@nuviainc.com>
27
+F: tests/functional/test_arm_microbit.py
43
+R: Leif Lindholm <quic_llindhol@quicinc.com>
28
F: docs/system/arm/nrf.rst
44
L: qemu-arm@nongnu.org
29
45
S: Maintained
30
ARM PL011 Rust device
46
F: hw/arm/sbsa-ref.c
31
diff --git a/tests/functional/meson.build b/tests/functional/meson.build
32
index XXXXXXX..XXXXXXX 100644
33
--- a/tests/functional/meson.build
34
+++ b/tests/functional/meson.build
35
@@ -XXX,XX +XXX,XX @@ tests_arm_system_thorough = [
36
'arm_cubieboard',
37
'arm_emcraft_sf2',
38
'arm_integratorcp',
39
+ 'arm_microbit',
40
'arm_orangepi',
41
'arm_quanta_gsj',
42
'arm_raspi2',
43
diff --git a/tests/functional/test_arm_microbit.py b/tests/functional/test_arm_microbit.py
44
new file mode 100755
45
index XXXXXXX..XXXXXXX
46
--- /dev/null
47
+++ b/tests/functional/test_arm_microbit.py
48
@@ -XXX,XX +XXX,XX @@
49
+#!/usr/bin/env python3
50
+#
51
+# SPDX-License-Identifier: GPL-2.0-or-later
52
+#
53
+# Copyright 2025, The QEMU Project Developers.
54
+#
55
+# A functional test that runs MicroPython on the arm microbit machine.
56
+
57
+from qemu_test import QemuSystemTest, Asset, exec_command_and_wait_for_pattern
58
+from qemu_test import wait_for_console_pattern
59
+
60
+
61
+class MicrobitMachine(QemuSystemTest):
62
+
63
+ ASSET_MICRO = Asset('https://ozlabs.org/~joel/microbit-micropython.hex',
64
+ '021641f93dfb11767d4978dbb3ca7f475d1b13c69e7f4aec3382f212636bffd6')
65
+
66
+ def test_arm_microbit(self):
67
+ self.set_machine('microbit')
68
+
69
+ micropython = self.ASSET_MICRO.fetch()
70
+ self.vm.set_console()
71
+ self.vm.add_args('-device', f'loader,file={micropython}')
72
+ self.vm.launch()
73
+ wait_for_console_pattern(self, 'Type "help()" for more information.')
74
+ exec_command_and_wait_for_pattern(self, 'import machine as mch', '>>>')
75
+ exec_command_and_wait_for_pattern(self, 'mch.reset()', 'MicroPython')
76
+ wait_for_console_pattern(self, '>>>')
77
+
78
+if __name__ == '__main__':
79
+ QemuSystemTest.main()
47
--
80
--
48
2.25.1
81
2.34.1
49
82
50
83
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
The pseudocode ResetSVEState() does:
2
FPSR = ZeroExtend(0x0800009f<31:0>, 64);
3
but QEMU's arm_reset_sve_state() called vfp_set_fpcr() by accident.
2
4
3
This register is present for either VHE or Debugv8p2.
5
Before the advent of FEAT_AFP, this was only setting a collection of
6
RES0 bits, which vfp_set_fpsr() would then ignore, so the only effect
7
was that we didn't actually set the FPSR the way we are supposed to
8
do. Once FEAT_AFP is implemented, setting the bottom bits of FPSR
9
will change the floating point behaviour.
4
10
5
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
11
Call vfp_set_fpsr(), as we ought to.
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
12
7
Message-id: 20220506180242.216785-5-richard.henderson@linaro.org
13
(Note for stable backports: commit 7f2a01e7368f9 moved this function
14
from sme_helper.c to helper.c, but it had the same bug before the
15
move too.)
16
17
Cc: qemu-stable@nongnu.org
18
Fixes: f84734b87461 ("target/arm: Implement SMSTART, SMSTOP")
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
19
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
20
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
21
Message-id: 20250124162836.2332150-4-peter.maydell@linaro.org
9
---
22
---
10
target/arm/helper.c | 15 +++++++++++----
23
target/arm/helper.c | 2 +-
11
1 file changed, 11 insertions(+), 4 deletions(-)
24
1 file changed, 1 insertion(+), 1 deletion(-)
12
25
13
diff --git a/target/arm/helper.c b/target/arm/helper.c
26
diff --git a/target/arm/helper.c b/target/arm/helper.c
14
index XXXXXXX..XXXXXXX 100644
27
index XXXXXXX..XXXXXXX 100644
15
--- a/target/arm/helper.c
28
--- a/target/arm/helper.c
16
+++ b/target/arm/helper.c
29
+++ b/target/arm/helper.c
17
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo jazelle_regs[] = {
30
@@ -XXX,XX +XXX,XX @@ static void arm_reset_sve_state(CPUARMState *env)
18
.access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
31
memset(env->vfp.zregs, 0, sizeof(env->vfp.zregs));
19
};
32
/* Recall that FFR is stored as pregs[16]. */
20
33
memset(env->vfp.pregs, 0, sizeof(env->vfp.pregs));
21
+static const ARMCPRegInfo contextidr_el2 = {
34
- vfp_set_fpcr(env, 0x0800009f);
22
+ .name = "CONTEXTIDR_EL2", .state = ARM_CP_STATE_AA64,
35
+ vfp_set_fpsr(env, 0x0800009f);
23
+ .opc0 = 3, .opc1 = 4, .crn = 13, .crm = 0, .opc2 = 1,
36
}
24
+ .access = PL2_RW,
37
25
+ .fieldoffset = offsetof(CPUARMState, cp15.contextidr_el[2])
38
void aarch64_set_svcr(CPUARMState *env, uint64_t new, uint64_t mask)
26
+};
27
+
28
static const ARMCPRegInfo vhe_reginfo[] = {
29
- { .name = "CONTEXTIDR_EL2", .state = ARM_CP_STATE_AA64,
30
- .opc0 = 3, .opc1 = 4, .crn = 13, .crm = 0, .opc2 = 1,
31
- .access = PL2_RW,
32
- .fieldoffset = offsetof(CPUARMState, cp15.contextidr_el[2]) },
33
{ .name = "TTBR1_EL2", .state = ARM_CP_STATE_AA64,
34
.opc0 = 3, .opc1 = 4, .crn = 2, .crm = 0, .opc2 = 1,
35
.access = PL2_RW, .writefn = vmsa_tcr_ttbr_el2_write,
36
@@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu)
37
define_one_arm_cp_reg(cpu, &ssbs_reginfo);
38
}
39
40
+ if (cpu_isar_feature(aa64_vh, cpu) ||
41
+ cpu_isar_feature(aa64_debugv8p2, cpu)) {
42
+ define_one_arm_cp_reg(cpu, &contextidr_el2);
43
+ }
44
if (arm_feature(env, ARM_FEATURE_EL2) && cpu_isar_feature(aa64_vh, cpu)) {
45
define_arm_cp_regs(cpu, vhe_reginfo);
46
}
47
--
39
--
48
2.25.1
40
2.34.1
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
Use the FPSR_ named constants in vfp_exceptbits_from_host(),
2
rather than hardcoded magic numbers.
2
3
3
This extension concerns changes to the External Debug interface,
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
with Secure and Non-secure access to the debug registers, and all
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
of it is outside the scope of QEMU. Indicating support for this
6
Message-id: 20250124162836.2332150-5-peter.maydell@linaro.org
6
is mandatory with FEAT_SEL2, which we do implement.
7
---
8
target/arm/vfp_helper.c | 12 ++++++------
9
1 file changed, 6 insertions(+), 6 deletions(-)
7
10
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
11
diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c
9
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
10
Message-id: 20220506180242.216785-13-richard.henderson@linaro.org
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
---
13
docs/system/arm/emulation.rst | 1 +
14
target/arm/cpu64.c | 2 +-
15
target/arm/cpu_tcg.c | 4 ++--
16
3 files changed, 4 insertions(+), 3 deletions(-)
17
18
diff --git a/docs/system/arm/emulation.rst b/docs/system/arm/emulation.rst
19
index XXXXXXX..XXXXXXX 100644
12
index XXXXXXX..XXXXXXX 100644
20
--- a/docs/system/arm/emulation.rst
13
--- a/target/arm/vfp_helper.c
21
+++ b/docs/system/arm/emulation.rst
14
+++ b/target/arm/vfp_helper.c
22
@@ -XXX,XX +XXX,XX @@ the following architecture extensions:
15
@@ -XXX,XX +XXX,XX @@ static inline int vfp_exceptbits_from_host(int host_bits)
23
- FEAT_DIT (Data Independent Timing instructions)
16
int target_bits = 0;
24
- FEAT_DPB (DC CVAP instruction)
17
25
- FEAT_Debugv8p2 (Debug changes for v8.2)
18
if (host_bits & float_flag_invalid) {
26
+- FEAT_Debugv8p4 (Debug changes for v8.4)
19
- target_bits |= 1;
27
- FEAT_DotProd (Advanced SIMD dot product instructions)
20
+ target_bits |= FPSR_IOC;
28
- FEAT_FCMA (Floating-point complex number instructions)
21
}
29
- FEAT_FHM (Floating-point half-precision multiplication instructions)
22
if (host_bits & float_flag_divbyzero) {
30
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
23
- target_bits |= 2;
31
index XXXXXXX..XXXXXXX 100644
24
+ target_bits |= FPSR_DZC;
32
--- a/target/arm/cpu64.c
25
}
33
+++ b/target/arm/cpu64.c
26
if (host_bits & float_flag_overflow) {
34
@@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj)
27
- target_bits |= 4;
35
cpu->isar.id_aa64zfr0 = t;
28
+ target_bits |= FPSR_OFC;
36
29
}
37
t = cpu->isar.id_aa64dfr0;
30
if (host_bits & (float_flag_underflow | float_flag_output_denormal)) {
38
- t = FIELD_DP64(t, ID_AA64DFR0, DEBUGVER, 8); /* FEAT_Debugv8p2 */
31
- target_bits |= 8;
39
+ t = FIELD_DP64(t, ID_AA64DFR0, DEBUGVER, 9); /* FEAT_Debugv8p4 */
32
+ target_bits |= FPSR_UFC;
40
t = FIELD_DP64(t, ID_AA64DFR0, PMUVER, 5); /* FEAT_PMUv3p4 */
33
}
41
cpu->isar.id_aa64dfr0 = t;
34
if (host_bits & float_flag_inexact) {
42
35
- target_bits |= 0x10;
43
diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c
36
+ target_bits |= FPSR_IXC;
44
index XXXXXXX..XXXXXXX 100644
37
}
45
--- a/target/arm/cpu_tcg.c
38
if (host_bits & float_flag_input_denormal) {
46
+++ b/target/arm/cpu_tcg.c
39
- target_bits |= 0x80;
47
@@ -XXX,XX +XXX,XX @@ void aa32_max_features(ARMCPU *cpu)
40
+ target_bits |= FPSR_IDC;
48
cpu->isar.id_pfr2 = t;
41
}
49
42
return target_bits;
50
t = cpu->isar.id_dfr0;
51
- t = FIELD_DP32(t, ID_DFR0, COPDBG, 8); /* FEAT_Debugv8p2 */
52
- t = FIELD_DP32(t, ID_DFR0, COPSDBG, 8); /* FEAT_Debugv8p2 */
53
+ t = FIELD_DP32(t, ID_DFR0, COPDBG, 9); /* FEAT_Debugv8p4 */
54
+ t = FIELD_DP32(t, ID_DFR0, COPSDBG, 9); /* FEAT_Debugv8p4 */
55
t = FIELD_DP32(t, ID_DFR0, PERFMON, 5); /* FEAT_PMUv3p4 */
56
cpu->isar.id_dfr0 = t;
57
}
43
}
58
--
44
--
59
2.25.1
45
2.34.1
diff view generated by jsdifflib
New patch
1
In vfp_exceptbits_from_host(), we accumulate the FPSR flags in
2
an "int", and our return type is also "int". However, the only
3
callsite returns the same information as a uint32_t, and
4
more generally we handle FPSR values in the code as uint32_t,
5
not int. Bring this function in to line with that convention.
1
6
7
There is no behaviour change because none of the FPSR bits
8
we set in this function are bit 31. The input argument to
9
the function remains 'int' because that is the return type
10
of the softfloat get_float_exception_flags().
11
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
14
Message-id: 20250124162836.2332150-6-peter.maydell@linaro.org
15
---
16
target/arm/vfp_helper.c | 4 ++--
17
1 file changed, 2 insertions(+), 2 deletions(-)
18
19
diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c
20
index XXXXXXX..XXXXXXX 100644
21
--- a/target/arm/vfp_helper.c
22
+++ b/target/arm/vfp_helper.c
23
@@ -XXX,XX +XXX,XX @@
24
#ifdef CONFIG_TCG
25
26
/* Convert host exception flags to vfp form. */
27
-static inline int vfp_exceptbits_from_host(int host_bits)
28
+static inline uint32_t vfp_exceptbits_from_host(int host_bits)
29
{
30
- int target_bits = 0;
31
+ uint32_t target_bits = 0;
32
33
if (host_bits & float_flag_invalid) {
34
target_bits |= FPSR_IOC;
35
--
36
2.34.1
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
We want to split the existing fp_status in the Arm CPUState into
2
separate float_status fields for AArch32 and AArch64. (This is
3
because new control bits defined by FEAT_AFP only have an effect for
4
AArch64, not AArch32.) To make this split we will:
5
* define new fp_status_a32 and fp_status_a64 which have
6
identical behaviour to the existing fp_status
7
* move existing uses of fp_status to fp_status_a32 or
8
fp_status_a64 as appropriate
9
* delete the old fp_status when it has no uses left
2
10
3
The only portion of FEAT_Debugv8p2 that is relevant to QEMU
11
In this patch we add the new float_status fields.
4
is CONTEXTIDR_EL2, which is also conditionally implemented
5
with FEAT_VHE. The rest of the debug extension concerns the
6
External debug interface, which is outside the scope of QEMU.
7
12
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
13
We will also need to split fp_status_f16, but we will do that
9
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
14
as a separate series of patches.
10
Message-id: 20220506180242.216785-12-richard.henderson@linaro.org
15
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
17
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
18
Message-id: 20250124162836.2332150-7-peter.maydell@linaro.org
12
---
19
---
13
docs/system/arm/emulation.rst | 1 +
20
target/arm/cpu.h | 4 ++++
14
target/arm/cpu.c | 1 +
21
target/arm/tcg/translate.h | 12 ++++++++++++
15
target/arm/cpu64.c | 1 +
22
target/arm/cpu.c | 2 ++
16
target/arm/cpu_tcg.c | 2 ++
23
target/arm/vfp_helper.c | 12 ++++++++++++
17
4 files changed, 5 insertions(+)
24
4 files changed, 30 insertions(+)
18
25
19
diff --git a/docs/system/arm/emulation.rst b/docs/system/arm/emulation.rst
26
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
20
index XXXXXXX..XXXXXXX 100644
27
index XXXXXXX..XXXXXXX 100644
21
--- a/docs/system/arm/emulation.rst
28
--- a/target/arm/cpu.h
22
+++ b/docs/system/arm/emulation.rst
29
+++ b/target/arm/cpu.h
23
@@ -XXX,XX +XXX,XX @@ the following architecture extensions:
30
@@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState {
24
- FEAT_BTI (Branch Target Identification)
31
/* There are a number of distinct float control structures:
25
- FEAT_DIT (Data Independent Timing instructions)
32
*
26
- FEAT_DPB (DC CVAP instruction)
33
* fp_status: is the "normal" fp status.
27
+- FEAT_Debugv8p2 (Debug changes for v8.2)
34
+ * fp_status_a32: is the "normal" fp status for AArch32 insns
28
- FEAT_DotProd (Advanced SIMD dot product instructions)
35
+ * fp_status_a64: is the "normal" fp status for AArch64 insns
29
- FEAT_FCMA (Floating-point complex number instructions)
36
* fp_status_fp16: used for half-precision calculations
30
- FEAT_FHM (Floating-point half-precision multiplication instructions)
37
* standard_fp_status : the ARM "Standard FPSCR Value"
38
* standard_fp_status_fp16 : used for half-precision
39
@@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState {
40
* an explicit FPSCR read.
41
*/
42
float_status fp_status;
43
+ float_status fp_status_a32;
44
+ float_status fp_status_a64;
45
float_status fp_status_f16;
46
float_status standard_fp_status;
47
float_status standard_fp_status_f16;
48
diff --git a/target/arm/tcg/translate.h b/target/arm/tcg/translate.h
49
index XXXXXXX..XXXXXXX 100644
50
--- a/target/arm/tcg/translate.h
51
+++ b/target/arm/tcg/translate.h
52
@@ -XXX,XX +XXX,XX @@ static inline CPUARMTBFlags arm_tbflags_from_tb(const TranslationBlock *tb)
53
*/
54
typedef enum ARMFPStatusFlavour {
55
FPST_FPCR,
56
+ FPST_A32,
57
+ FPST_A64,
58
FPST_FPCR_F16,
59
FPST_STD,
60
FPST_STD_F16,
61
@@ -XXX,XX +XXX,XX @@ typedef enum ARMFPStatusFlavour {
62
*
63
* FPST_FPCR
64
* for non-FP16 operations controlled by the FPCR
65
+ * FPST_A32
66
+ * for AArch32 non-FP16 operations controlled by the FPCR
67
+ * FPST_A64
68
+ * for AArch64 non-FP16 operations controlled by the FPCR
69
* FPST_FPCR_F16
70
* for operations controlled by the FPCR where FPCR.FZ16 is to be used
71
* FPST_STD
72
@@ -XXX,XX +XXX,XX @@ static inline TCGv_ptr fpstatus_ptr(ARMFPStatusFlavour flavour)
73
case FPST_FPCR:
74
offset = offsetof(CPUARMState, vfp.fp_status);
75
break;
76
+ case FPST_A32:
77
+ offset = offsetof(CPUARMState, vfp.fp_status_a32);
78
+ break;
79
+ case FPST_A64:
80
+ offset = offsetof(CPUARMState, vfp.fp_status_a64);
81
+ break;
82
case FPST_FPCR_F16:
83
offset = offsetof(CPUARMState, vfp.fp_status_f16);
84
break;
31
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
85
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
32
index XXXXXXX..XXXXXXX 100644
86
index XXXXXXX..XXXXXXX 100644
33
--- a/target/arm/cpu.c
87
--- a/target/arm/cpu.c
34
+++ b/target/arm/cpu.c
88
+++ b/target/arm/cpu.c
35
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)
89
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_reset_hold(Object *obj, ResetType type)
36
* feature registers as well.
90
set_default_nan_mode(1, &env->vfp.standard_fp_status);
37
*/
91
set_default_nan_mode(1, &env->vfp.standard_fp_status_f16);
38
cpu->isar.id_pfr1 = FIELD_DP32(cpu->isar.id_pfr1, ID_PFR1, SECURITY, 0);
92
arm_set_default_fp_behaviours(&env->vfp.fp_status);
39
+ cpu->isar.id_dfr0 = FIELD_DP32(cpu->isar.id_dfr0, ID_DFR0, COPSDBG, 0);
93
+ arm_set_default_fp_behaviours(&env->vfp.fp_status_a32);
40
cpu->isar.id_aa64pfr0 = FIELD_DP64(cpu->isar.id_aa64pfr0,
94
+ arm_set_default_fp_behaviours(&env->vfp.fp_status_a64);
41
ID_AA64PFR0, EL3, 0);
95
arm_set_default_fp_behaviours(&env->vfp.standard_fp_status);
96
arm_set_default_fp_behaviours(&env->vfp.fp_status_f16);
97
arm_set_default_fp_behaviours(&env->vfp.standard_fp_status_f16);
98
diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c
99
index XXXXXXX..XXXXXXX 100644
100
--- a/target/arm/vfp_helper.c
101
+++ b/target/arm/vfp_helper.c
102
@@ -XXX,XX +XXX,XX @@ static uint32_t vfp_get_fpsr_from_host(CPUARMState *env)
103
uint32_t i;
104
105
i = get_float_exception_flags(&env->vfp.fp_status);
106
+ i |= get_float_exception_flags(&env->vfp.fp_status_a32);
107
+ i |= get_float_exception_flags(&env->vfp.fp_status_a64);
108
i |= get_float_exception_flags(&env->vfp.standard_fp_status);
109
/* FZ16 does not generate an input denormal exception. */
110
i |= (get_float_exception_flags(&env->vfp.fp_status_f16)
111
@@ -XXX,XX +XXX,XX @@ static void vfp_clear_float_status_exc_flags(CPUARMState *env)
112
* be the architecturally up-to-date exception flag information first.
113
*/
114
set_float_exception_flags(0, &env->vfp.fp_status);
115
+ set_float_exception_flags(0, &env->vfp.fp_status_a32);
116
+ set_float_exception_flags(0, &env->vfp.fp_status_a64);
117
set_float_exception_flags(0, &env->vfp.fp_status_f16);
118
set_float_exception_flags(0, &env->vfp.standard_fp_status);
119
set_float_exception_flags(0, &env->vfp.standard_fp_status_f16);
120
@@ -XXX,XX +XXX,XX @@ static void vfp_set_fpcr_to_host(CPUARMState *env, uint32_t val, uint32_t mask)
121
break;
122
}
123
set_float_rounding_mode(i, &env->vfp.fp_status);
124
+ set_float_rounding_mode(i, &env->vfp.fp_status_a32);
125
+ set_float_rounding_mode(i, &env->vfp.fp_status_a64);
126
set_float_rounding_mode(i, &env->vfp.fp_status_f16);
42
}
127
}
43
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
128
if (changed & FPCR_FZ16) {
44
index XXXXXXX..XXXXXXX 100644
129
@@ -XXX,XX +XXX,XX @@ static void vfp_set_fpcr_to_host(CPUARMState *env, uint32_t val, uint32_t mask)
45
--- a/target/arm/cpu64.c
130
bool ftz_enabled = val & FPCR_FZ;
46
+++ b/target/arm/cpu64.c
131
set_flush_to_zero(ftz_enabled, &env->vfp.fp_status);
47
@@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj)
132
set_flush_inputs_to_zero(ftz_enabled, &env->vfp.fp_status);
48
cpu->isar.id_aa64zfr0 = t;
133
+ set_flush_to_zero(ftz_enabled, &env->vfp.fp_status_a32);
49
134
+ set_flush_inputs_to_zero(ftz_enabled, &env->vfp.fp_status_a32);
50
t = cpu->isar.id_aa64dfr0;
135
+ set_flush_to_zero(ftz_enabled, &env->vfp.fp_status_a64);
51
+ t = FIELD_DP64(t, ID_AA64DFR0, DEBUGVER, 8); /* FEAT_Debugv8p2 */
136
+ set_flush_inputs_to_zero(ftz_enabled, &env->vfp.fp_status_a64);
52
t = FIELD_DP64(t, ID_AA64DFR0, PMUVER, 5); /* FEAT_PMUv3p4 */
137
}
53
cpu->isar.id_aa64dfr0 = t;
138
if (changed & FPCR_DN) {
54
139
bool dnan_enabled = val & FPCR_DN;
55
diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c
140
set_default_nan_mode(dnan_enabled, &env->vfp.fp_status);
56
index XXXXXXX..XXXXXXX 100644
141
+ set_default_nan_mode(dnan_enabled, &env->vfp.fp_status_a32);
57
--- a/target/arm/cpu_tcg.c
142
+ set_default_nan_mode(dnan_enabled, &env->vfp.fp_status_a64);
58
+++ b/target/arm/cpu_tcg.c
143
set_default_nan_mode(dnan_enabled, &env->vfp.fp_status_f16);
59
@@ -XXX,XX +XXX,XX @@ void aa32_max_features(ARMCPU *cpu)
144
}
60
cpu->isar.id_pfr2 = t;
61
62
t = cpu->isar.id_dfr0;
63
+ t = FIELD_DP32(t, ID_DFR0, COPDBG, 8); /* FEAT_Debugv8p2 */
64
+ t = FIELD_DP32(t, ID_DFR0, COPSDBG, 8); /* FEAT_Debugv8p2 */
65
t = FIELD_DP32(t, ID_DFR0, PERFMON, 5); /* FEAT_PMUv3p4 */
66
cpu->isar.id_dfr0 = t;
67
}
145
}
68
--
146
--
69
2.25.1
147
2.34.1
diff view generated by jsdifflib
New patch
1
Switch from vfp.fp_status to vfp.fp_status_a64 for helpers which:
2
* directly reference an fp_status field
3
* are called only from the A64 decoder
4
* are not called inside a set_rmode/restore_rmode sequence
1
5
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Message-id: 20250124162836.2332150-8-peter.maydell@linaro.org
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
---
10
target/arm/tcg/sme_helper.c | 2 +-
11
target/arm/tcg/vec_helper.c | 8 ++++----
12
2 files changed, 5 insertions(+), 5 deletions(-)
13
14
diff --git a/target/arm/tcg/sme_helper.c b/target/arm/tcg/sme_helper.c
15
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/tcg/sme_helper.c
17
+++ b/target/arm/tcg/sme_helper.c
18
@@ -XXX,XX +XXX,XX @@ void HELPER(sme_fmopa_h)(void *vza, void *vzn, void *vzm, void *vpn,
19
* round-to-odd -- see above.
20
*/
21
fpst_f16 = env->vfp.fp_status_f16;
22
- fpst_std = env->vfp.fp_status;
23
+ fpst_std = env->vfp.fp_status_a64;
24
set_default_nan_mode(true, &fpst_std);
25
set_default_nan_mode(true, &fpst_f16);
26
fpst_odd = fpst_std;
27
diff --git a/target/arm/tcg/vec_helper.c b/target/arm/tcg/vec_helper.c
28
index XXXXXXX..XXXXXXX 100644
29
--- a/target/arm/tcg/vec_helper.c
30
+++ b/target/arm/tcg/vec_helper.c
31
@@ -XXX,XX +XXX,XX @@ void HELPER(gvec_fmlal_a32)(void *vd, void *vn, void *vm,
32
void HELPER(gvec_fmlal_a64)(void *vd, void *vn, void *vm,
33
CPUARMState *env, uint32_t desc)
34
{
35
- do_fmlal(vd, vn, vm, &env->vfp.fp_status, desc,
36
+ do_fmlal(vd, vn, vm, &env->vfp.fp_status_a64, desc,
37
get_flush_inputs_to_zero(&env->vfp.fp_status_f16));
38
}
39
40
@@ -XXX,XX +XXX,XX @@ void HELPER(sve2_fmlal_zzzw_s)(void *vd, void *vn, void *vm, void *va,
41
intptr_t i, oprsz = simd_oprsz(desc);
42
uint16_t negn = extract32(desc, SIMD_DATA_SHIFT, 1) << 15;
43
intptr_t sel = extract32(desc, SIMD_DATA_SHIFT + 1, 1) * sizeof(float16);
44
- float_status *status = &env->vfp.fp_status;
45
+ float_status *status = &env->vfp.fp_status_a64;
46
bool fz16 = get_flush_inputs_to_zero(&env->vfp.fp_status_f16);
47
48
for (i = 0; i < oprsz; i += sizeof(float32)) {
49
@@ -XXX,XX +XXX,XX @@ void HELPER(gvec_fmlal_idx_a32)(void *vd, void *vn, void *vm,
50
void HELPER(gvec_fmlal_idx_a64)(void *vd, void *vn, void *vm,
51
CPUARMState *env, uint32_t desc)
52
{
53
- do_fmlal_idx(vd, vn, vm, &env->vfp.fp_status, desc,
54
+ do_fmlal_idx(vd, vn, vm, &env->vfp.fp_status_a64, desc,
55
get_flush_inputs_to_zero(&env->vfp.fp_status_f16));
56
}
57
58
@@ -XXX,XX +XXX,XX @@ void HELPER(sve2_fmlal_zzxw_s)(void *vd, void *vn, void *vm, void *va,
59
uint16_t negn = extract32(desc, SIMD_DATA_SHIFT, 1) << 15;
60
intptr_t sel = extract32(desc, SIMD_DATA_SHIFT + 1, 1) * sizeof(float16);
61
intptr_t idx = extract32(desc, SIMD_DATA_SHIFT + 2, 3) * sizeof(float16);
62
- float_status *status = &env->vfp.fp_status;
63
+ float_status *status = &env->vfp.fp_status_a64;
64
bool fz16 = get_flush_inputs_to_zero(&env->vfp.fp_status_f16);
65
66
for (i = 0; i < oprsz; i += 16) {
67
--
68
2.34.1
diff view generated by jsdifflib
New patch
1
In is_ebf(), we might be called for A64 or A32, but we have
2
the CPUARMState* so we can select fp_status_a64 or
3
fp_status_a32 accordingly.
1
4
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
---
8
target/arm/tcg/vec_helper.c | 2 +-
9
1 file changed, 1 insertion(+), 1 deletion(-)
10
11
diff --git a/target/arm/tcg/vec_helper.c b/target/arm/tcg/vec_helper.c
12
index XXXXXXX..XXXXXXX 100644
13
--- a/target/arm/tcg/vec_helper.c
14
+++ b/target/arm/tcg/vec_helper.c
15
@@ -XXX,XX +XXX,XX @@ bool is_ebf(CPUARMState *env, float_status *statusp, float_status *oddstatusp)
16
*/
17
bool ebf = is_a64(env) && env->vfp.fpcr & FPCR_EBF;
18
19
- *statusp = env->vfp.fp_status;
20
+ *statusp = is_a64(env) ? env->vfp.fp_status_a64 : env->vfp.fp_status_a32;
21
set_default_nan_mode(true, statusp);
22
23
if (ebf) {
24
--
25
2.34.1
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
Use fp_status_a32 in the vjcvt helper function; this is called only
2
from the A32/T32 decoder and is not used inside a
3
set_rmode/restore_rmode sequence.
2
4
3
This extension concerns cache speculation, which TCG does
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
not implement. Thus we can trivially enable this feature.
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Message-id: 20250124162836.2332150-9-peter.maydell@linaro.org
8
---
9
target/arm/vfp_helper.c | 2 +-
10
1 file changed, 1 insertion(+), 1 deletion(-)
5
11
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
12
diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20220506180242.216785-22-richard.henderson@linaro.org
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
docs/system/arm/emulation.rst | 1 +
12
target/arm/cpu64.c | 1 +
13
target/arm/cpu_tcg.c | 1 +
14
3 files changed, 3 insertions(+)
15
16
diff --git a/docs/system/arm/emulation.rst b/docs/system/arm/emulation.rst
17
index XXXXXXX..XXXXXXX 100644
13
index XXXXXXX..XXXXXXX 100644
18
--- a/docs/system/arm/emulation.rst
14
--- a/target/arm/vfp_helper.c
19
+++ b/docs/system/arm/emulation.rst
15
+++ b/target/arm/vfp_helper.c
20
@@ -XXX,XX +XXX,XX @@ the following architecture extensions:
16
@@ -XXX,XX +XXX,XX @@ uint64_t HELPER(fjcvtzs)(float64 value, float_status *status)
21
- FEAT_CSV2_1p1 (Cache speculation variant 2, version 1.1)
17
22
- FEAT_CSV2_1p2 (Cache speculation variant 2, version 1.2)
18
uint32_t HELPER(vjcvt)(float64 value, CPUARMState *env)
23
- FEAT_CSV2_2 (Cache speculation variant 2, version 2)
19
{
24
+- FEAT_CSV3 (Cache speculation variant 3)
20
- uint64_t pair = HELPER(fjcvtzs)(value, &env->vfp.fp_status);
25
- FEAT_DIT (Data Independent Timing instructions)
21
+ uint64_t pair = HELPER(fjcvtzs)(value, &env->vfp.fp_status_a32);
26
- FEAT_DPB (DC CVAP instruction)
22
uint32_t result = pair;
27
- FEAT_Debugv8p2 (Debug changes for v8.2)
23
uint32_t z = (pair >> 32) == 0;
28
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
29
index XXXXXXX..XXXXXXX 100644
30
--- a/target/arm/cpu64.c
31
+++ b/target/arm/cpu64.c
32
@@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj)
33
t = FIELD_DP64(t, ID_AA64PFR0, SEL2, 1); /* FEAT_SEL2 */
34
t = FIELD_DP64(t, ID_AA64PFR0, DIT, 1); /* FEAT_DIT */
35
t = FIELD_DP64(t, ID_AA64PFR0, CSV2, 2); /* FEAT_CSV2_2 */
36
+ t = FIELD_DP64(t, ID_AA64PFR0, CSV3, 1); /* FEAT_CSV3 */
37
cpu->isar.id_aa64pfr0 = t;
38
39
t = cpu->isar.id_aa64pfr1;
40
diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c
41
index XXXXXXX..XXXXXXX 100644
42
--- a/target/arm/cpu_tcg.c
43
+++ b/target/arm/cpu_tcg.c
44
@@ -XXX,XX +XXX,XX @@ void aa32_max_features(ARMCPU *cpu)
45
cpu->isar.id_pfr0 = t;
46
47
t = cpu->isar.id_pfr2;
48
+ t = FIELD_DP32(t, ID_PFR2, CSV3, 1); /* FEAT_CSV3 */
49
t = FIELD_DP32(t, ID_PFR2, SSBS, 1); /* FEAT_SSBS */
50
cpu->isar.id_pfr2 = t;
51
24
52
--
25
--
53
2.25.1
26
2.34.1
diff view generated by jsdifflib
New patch
1
The helpers vfp_cmps, vfp_cmpes, vfp_cmpd, vfp_cmped are used only from
2
the A32 decoder; the A64 decoder uses separate vfp_cmps_a64 etc helpers
3
(because for A64 we update the main NZCV flags and for A32 we update
4
the FPSCR NZCV flags). So we can make these helpers use the fp_status_a32
5
field instead of fp_status.
1
6
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20250124162836.2332150-10-peter.maydell@linaro.org
10
---
11
target/arm/vfp_helper.c | 4 ++--
12
1 file changed, 2 insertions(+), 2 deletions(-)
13
14
diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c
15
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/vfp_helper.c
17
+++ b/target/arm/vfp_helper.c
18
@@ -XXX,XX +XXX,XX @@ void VFP_HELPER(cmpe, P)(ARGTYPE a, ARGTYPE b, CPUARMState *env) \
19
FLOATTYPE ## _compare(a, b, &env->vfp.FPST)); \
20
}
21
DO_VFP_cmp(h, float16, dh_ctype_f16, fp_status_f16)
22
-DO_VFP_cmp(s, float32, float32, fp_status)
23
-DO_VFP_cmp(d, float64, float64, fp_status)
24
+DO_VFP_cmp(s, float32, float32, fp_status_a32)
25
+DO_VFP_cmp(d, float64, float64, fp_status_a32)
26
#undef DO_VFP_cmp
27
28
/* Integer to float and float to integer conversions */
29
--
30
2.34.1
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
In the A32 decoder, use FPST_A32 rather than FPST_FPCR. By
2
doing an automated conversion of the whole file we avoid possibly
3
using more than one fpst value in a set_rmode/op/restore_rmode
4
sequence.
2
5
3
This extension concerns not merging memory access, which TCG does
6
Patch created with
4
not implement. Thus we can trivially enable this feature.
7
perl -p -i -e 's/FPST_FPCR(?!_)/FPST_A32/g' target/arm/tcg/translate-vfp.c
5
Add a comment to handle_hint for the DGH instruction, but no code.
6
8
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20220506180242.216785-23-richard.henderson@linaro.org
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
11
Message-id: 20250124162836.2332150-11-peter.maydell@linaro.org
11
---
12
---
12
docs/system/arm/emulation.rst | 1 +
13
target/arm/tcg/translate-vfp.c | 54 +++++++++++++++++-----------------
13
target/arm/cpu64.c | 1 +
14
1 file changed, 27 insertions(+), 27 deletions(-)
14
target/arm/translate-a64.c | 1 +
15
3 files changed, 3 insertions(+)
16
15
17
diff --git a/docs/system/arm/emulation.rst b/docs/system/arm/emulation.rst
16
diff --git a/target/arm/tcg/translate-vfp.c b/target/arm/tcg/translate-vfp.c
18
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
19
--- a/docs/system/arm/emulation.rst
18
--- a/target/arm/tcg/translate-vfp.c
20
+++ b/docs/system/arm/emulation.rst
19
+++ b/target/arm/tcg/translate-vfp.c
21
@@ -XXX,XX +XXX,XX @@ the following architecture extensions:
20
@@ -XXX,XX +XXX,XX @@ static bool trans_VRINT(DisasContext *s, arg_VRINT *a)
22
- FEAT_CSV2_1p2 (Cache speculation variant 2, version 1.2)
21
if (sz == 1) {
23
- FEAT_CSV2_2 (Cache speculation variant 2, version 2)
22
fpst = fpstatus_ptr(FPST_FPCR_F16);
24
- FEAT_CSV3 (Cache speculation variant 3)
23
} else {
25
+- FEAT_DGH (Data gathering hint)
24
- fpst = fpstatus_ptr(FPST_FPCR);
26
- FEAT_DIT (Data Independent Timing instructions)
25
+ fpst = fpstatus_ptr(FPST_A32);
27
- FEAT_DPB (DC CVAP instruction)
26
}
28
- FEAT_Debugv8p2 (Debug changes for v8.2)
27
29
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
28
tcg_rmode = gen_set_rmode(rounding, fpst);
30
index XXXXXXX..XXXXXXX 100644
29
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT(DisasContext *s, arg_VCVT *a)
31
--- a/target/arm/cpu64.c
30
if (sz == 1) {
32
+++ b/target/arm/cpu64.c
31
fpst = fpstatus_ptr(FPST_FPCR_F16);
33
@@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj)
32
} else {
34
t = FIELD_DP64(t, ID_AA64ISAR1, SB, 1); /* FEAT_SB */
33
- fpst = fpstatus_ptr(FPST_FPCR);
35
t = FIELD_DP64(t, ID_AA64ISAR1, SPECRES, 1); /* FEAT_SPECRES */
34
+ fpst = fpstatus_ptr(FPST_A32);
36
t = FIELD_DP64(t, ID_AA64ISAR1, BF16, 1); /* FEAT_BF16 */
35
}
37
+ t = FIELD_DP64(t, ID_AA64ISAR1, DGH, 1); /* FEAT_DGH */
36
38
t = FIELD_DP64(t, ID_AA64ISAR1, I8MM, 1); /* FEAT_I8MM */
37
tcg_shift = tcg_constant_i32(0);
39
cpu->isar.id_aa64isar1 = t;
38
@@ -XXX,XX +XXX,XX @@ static bool do_vfp_3op_sp(DisasContext *s, VFPGen3OpSPFn *fn,
40
39
f0 = tcg_temp_new_i32();
41
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
40
f1 = tcg_temp_new_i32();
42
index XXXXXXX..XXXXXXX 100644
41
fd = tcg_temp_new_i32();
43
--- a/target/arm/translate-a64.c
42
- fpst = fpstatus_ptr(FPST_FPCR);
44
+++ b/target/arm/translate-a64.c
43
+ fpst = fpstatus_ptr(FPST_A32);
45
@@ -XXX,XX +XXX,XX @@ static void handle_hint(DisasContext *s, uint32_t insn,
44
46
break;
45
vfp_load_reg32(f0, vn);
47
case 0b00100: /* SEV */
46
vfp_load_reg32(f1, vm);
48
case 0b00101: /* SEVL */
47
@@ -XXX,XX +XXX,XX @@ static bool do_vfp_3op_dp(DisasContext *s, VFPGen3OpDPFn *fn,
49
+ case 0b00110: /* DGH */
48
f0 = tcg_temp_new_i64();
50
/* we treat all as NOP at least for now */
49
f1 = tcg_temp_new_i64();
51
break;
50
fd = tcg_temp_new_i64();
52
case 0b00111: /* XPACLRI */
51
- fpst = fpstatus_ptr(FPST_FPCR);
52
+ fpst = fpstatus_ptr(FPST_A32);
53
54
vfp_load_reg64(f0, vn);
55
vfp_load_reg64(f1, vm);
56
@@ -XXX,XX +XXX,XX @@ static bool do_vfm_sp(DisasContext *s, arg_VFMA_sp *a, bool neg_n, bool neg_d)
57
/* VFNMA, VFNMS */
58
gen_vfp_negs(vd, vd);
59
}
60
- fpst = fpstatus_ptr(FPST_FPCR);
61
+ fpst = fpstatus_ptr(FPST_A32);
62
gen_helper_vfp_muladds(vd, vn, vm, vd, fpst);
63
vfp_store_reg32(vd, a->vd);
64
return true;
65
@@ -XXX,XX +XXX,XX @@ static bool do_vfm_dp(DisasContext *s, arg_VFMA_dp *a, bool neg_n, bool neg_d)
66
/* VFNMA, VFNMS */
67
gen_vfp_negd(vd, vd);
68
}
69
- fpst = fpstatus_ptr(FPST_FPCR);
70
+ fpst = fpstatus_ptr(FPST_A32);
71
gen_helper_vfp_muladdd(vd, vn, vm, vd, fpst);
72
vfp_store_reg64(vd, a->vd);
73
return true;
74
@@ -XXX,XX +XXX,XX @@ static void gen_VSQRT_hp(TCGv_i32 vd, TCGv_i32 vm)
75
76
static void gen_VSQRT_sp(TCGv_i32 vd, TCGv_i32 vm)
77
{
78
- gen_helper_vfp_sqrts(vd, vm, fpstatus_ptr(FPST_FPCR));
79
+ gen_helper_vfp_sqrts(vd, vm, fpstatus_ptr(FPST_A32));
80
}
81
82
static void gen_VSQRT_dp(TCGv_i64 vd, TCGv_i64 vm)
83
{
84
- gen_helper_vfp_sqrtd(vd, vm, fpstatus_ptr(FPST_FPCR));
85
+ gen_helper_vfp_sqrtd(vd, vm, fpstatus_ptr(FPST_A32));
86
}
87
88
DO_VFP_2OP(VSQRT, hp, gen_VSQRT_hp, aa32_fp16_arith)
89
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_f32_f16(DisasContext *s, arg_VCVT_f32_f16 *a)
90
return true;
91
}
92
93
- fpst = fpstatus_ptr(FPST_FPCR);
94
+ fpst = fpstatus_ptr(FPST_A32);
95
ahp_mode = get_ahp_flag();
96
tmp = tcg_temp_new_i32();
97
/* The T bit tells us if we want the low or high 16 bits of Vm */
98
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_f64_f16(DisasContext *s, arg_VCVT_f64_f16 *a)
99
return true;
100
}
101
102
- fpst = fpstatus_ptr(FPST_FPCR);
103
+ fpst = fpstatus_ptr(FPST_A32);
104
ahp_mode = get_ahp_flag();
105
tmp = tcg_temp_new_i32();
106
/* The T bit tells us if we want the low or high 16 bits of Vm */
107
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_b16_f32(DisasContext *s, arg_VCVT_b16_f32 *a)
108
return true;
109
}
110
111
- fpst = fpstatus_ptr(FPST_FPCR);
112
+ fpst = fpstatus_ptr(FPST_A32);
113
tmp = tcg_temp_new_i32();
114
115
vfp_load_reg32(tmp, a->vm);
116
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_f16_f32(DisasContext *s, arg_VCVT_f16_f32 *a)
117
return true;
118
}
119
120
- fpst = fpstatus_ptr(FPST_FPCR);
121
+ fpst = fpstatus_ptr(FPST_A32);
122
ahp_mode = get_ahp_flag();
123
tmp = tcg_temp_new_i32();
124
125
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_f16_f64(DisasContext *s, arg_VCVT_f16_f64 *a)
126
return true;
127
}
128
129
- fpst = fpstatus_ptr(FPST_FPCR);
130
+ fpst = fpstatus_ptr(FPST_A32);
131
ahp_mode = get_ahp_flag();
132
tmp = tcg_temp_new_i32();
133
vm = tcg_temp_new_i64();
134
@@ -XXX,XX +XXX,XX @@ static bool trans_VRINTR_sp(DisasContext *s, arg_VRINTR_sp *a)
135
136
tmp = tcg_temp_new_i32();
137
vfp_load_reg32(tmp, a->vm);
138
- fpst = fpstatus_ptr(FPST_FPCR);
139
+ fpst = fpstatus_ptr(FPST_A32);
140
gen_helper_rints(tmp, tmp, fpst);
141
vfp_store_reg32(tmp, a->vd);
142
return true;
143
@@ -XXX,XX +XXX,XX @@ static bool trans_VRINTR_dp(DisasContext *s, arg_VRINTR_dp *a)
144
145
tmp = tcg_temp_new_i64();
146
vfp_load_reg64(tmp, a->vm);
147
- fpst = fpstatus_ptr(FPST_FPCR);
148
+ fpst = fpstatus_ptr(FPST_A32);
149
gen_helper_rintd(tmp, tmp, fpst);
150
vfp_store_reg64(tmp, a->vd);
151
return true;
152
@@ -XXX,XX +XXX,XX @@ static bool trans_VRINTZ_sp(DisasContext *s, arg_VRINTZ_sp *a)
153
154
tmp = tcg_temp_new_i32();
155
vfp_load_reg32(tmp, a->vm);
156
- fpst = fpstatus_ptr(FPST_FPCR);
157
+ fpst = fpstatus_ptr(FPST_A32);
158
tcg_rmode = gen_set_rmode(FPROUNDING_ZERO, fpst);
159
gen_helper_rints(tmp, tmp, fpst);
160
gen_restore_rmode(tcg_rmode, fpst);
161
@@ -XXX,XX +XXX,XX @@ static bool trans_VRINTZ_dp(DisasContext *s, arg_VRINTZ_dp *a)
162
163
tmp = tcg_temp_new_i64();
164
vfp_load_reg64(tmp, a->vm);
165
- fpst = fpstatus_ptr(FPST_FPCR);
166
+ fpst = fpstatus_ptr(FPST_A32);
167
tcg_rmode = gen_set_rmode(FPROUNDING_ZERO, fpst);
168
gen_helper_rintd(tmp, tmp, fpst);
169
gen_restore_rmode(tcg_rmode, fpst);
170
@@ -XXX,XX +XXX,XX @@ static bool trans_VRINTX_sp(DisasContext *s, arg_VRINTX_sp *a)
171
172
tmp = tcg_temp_new_i32();
173
vfp_load_reg32(tmp, a->vm);
174
- fpst = fpstatus_ptr(FPST_FPCR);
175
+ fpst = fpstatus_ptr(FPST_A32);
176
gen_helper_rints_exact(tmp, tmp, fpst);
177
vfp_store_reg32(tmp, a->vd);
178
return true;
179
@@ -XXX,XX +XXX,XX @@ static bool trans_VRINTX_dp(DisasContext *s, arg_VRINTX_dp *a)
180
181
tmp = tcg_temp_new_i64();
182
vfp_load_reg64(tmp, a->vm);
183
- fpst = fpstatus_ptr(FPST_FPCR);
184
+ fpst = fpstatus_ptr(FPST_A32);
185
gen_helper_rintd_exact(tmp, tmp, fpst);
186
vfp_store_reg64(tmp, a->vd);
187
return true;
188
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_sp(DisasContext *s, arg_VCVT_sp *a)
189
vm = tcg_temp_new_i32();
190
vd = tcg_temp_new_i64();
191
vfp_load_reg32(vm, a->vm);
192
- gen_helper_vfp_fcvtds(vd, vm, fpstatus_ptr(FPST_FPCR));
193
+ gen_helper_vfp_fcvtds(vd, vm, fpstatus_ptr(FPST_A32));
194
vfp_store_reg64(vd, a->vd);
195
return true;
196
}
197
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_dp(DisasContext *s, arg_VCVT_dp *a)
198
vd = tcg_temp_new_i32();
199
vm = tcg_temp_new_i64();
200
vfp_load_reg64(vm, a->vm);
201
- gen_helper_vfp_fcvtsd(vd, vm, fpstatus_ptr(FPST_FPCR));
202
+ gen_helper_vfp_fcvtsd(vd, vm, fpstatus_ptr(FPST_A32));
203
vfp_store_reg32(vd, a->vd);
204
return true;
205
}
206
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_int_sp(DisasContext *s, arg_VCVT_int_sp *a)
207
208
vm = tcg_temp_new_i32();
209
vfp_load_reg32(vm, a->vm);
210
- fpst = fpstatus_ptr(FPST_FPCR);
211
+ fpst = fpstatus_ptr(FPST_A32);
212
if (a->s) {
213
/* i32 -> f32 */
214
gen_helper_vfp_sitos(vm, vm, fpst);
215
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_int_dp(DisasContext *s, arg_VCVT_int_dp *a)
216
vm = tcg_temp_new_i32();
217
vd = tcg_temp_new_i64();
218
vfp_load_reg32(vm, a->vm);
219
- fpst = fpstatus_ptr(FPST_FPCR);
220
+ fpst = fpstatus_ptr(FPST_A32);
221
if (a->s) {
222
/* i32 -> f64 */
223
gen_helper_vfp_sitod(vd, vm, fpst);
224
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_fix_sp(DisasContext *s, arg_VCVT_fix_sp *a)
225
vd = tcg_temp_new_i32();
226
vfp_load_reg32(vd, a->vd);
227
228
- fpst = fpstatus_ptr(FPST_FPCR);
229
+ fpst = fpstatus_ptr(FPST_A32);
230
shift = tcg_constant_i32(frac_bits);
231
232
/* Switch on op:U:sx bits */
233
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_fix_dp(DisasContext *s, arg_VCVT_fix_dp *a)
234
vd = tcg_temp_new_i64();
235
vfp_load_reg64(vd, a->vd);
236
237
- fpst = fpstatus_ptr(FPST_FPCR);
238
+ fpst = fpstatus_ptr(FPST_A32);
239
shift = tcg_constant_i32(frac_bits);
240
241
/* Switch on op:U:sx bits */
242
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_sp_int(DisasContext *s, arg_VCVT_sp_int *a)
243
return true;
244
}
245
246
- fpst = fpstatus_ptr(FPST_FPCR);
247
+ fpst = fpstatus_ptr(FPST_A32);
248
vm = tcg_temp_new_i32();
249
vfp_load_reg32(vm, a->vm);
250
251
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_dp_int(DisasContext *s, arg_VCVT_dp_int *a)
252
return true;
253
}
254
255
- fpst = fpstatus_ptr(FPST_FPCR);
256
+ fpst = fpstatus_ptr(FPST_A32);
257
vm = tcg_temp_new_i64();
258
vd = tcg_temp_new_i32();
259
vfp_load_reg64(vm, a->vm);
53
--
260
--
54
2.25.1
261
2.34.1
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
In the A64 decoder, use FPST_A64 rather than FPST_FPCR. By
2
doing an automated conversion of the whole file we avoid possibly
3
using more than one fpst value in a set_rmode/op/restore_rmode
4
sequence.
2
5
3
This extension concerns branch speculation, which TCG does
6
Patch created with
4
not implement. Thus we can trivially enable this feature.
5
7
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
perl -p -i -e 's/FPST_FPCR(?!_)/FPST_A64/g' target/arm/tcg/translate-{a64,sve,sme}.c
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
8
Message-id: 20220506180242.216785-20-richard.henderson@linaro.org
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
12
Message-id: 20250124162836.2332150-12-peter.maydell@linaro.org
10
---
13
---
11
docs/system/arm/emulation.rst | 1 +
14
target/arm/tcg/translate-a64.c | 70 +++++++++++-----------
12
target/arm/cpu64.c | 1 +
15
target/arm/tcg/translate-sme.c | 4 +-
13
target/arm/cpu_tcg.c | 1 +
16
target/arm/tcg/translate-sve.c | 106 ++++++++++++++++-----------------
14
3 files changed, 3 insertions(+)
17
3 files changed, 90 insertions(+), 90 deletions(-)
15
18
16
diff --git a/docs/system/arm/emulation.rst b/docs/system/arm/emulation.rst
19
diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c
17
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
18
--- a/docs/system/arm/emulation.rst
21
--- a/target/arm/tcg/translate-a64.c
19
+++ b/docs/system/arm/emulation.rst
22
+++ b/target/arm/tcg/translate-a64.c
20
@@ -XXX,XX +XXX,XX @@ the following architecture extensions:
23
@@ -XXX,XX +XXX,XX @@ static void gen_gvec_op3_fpst(DisasContext *s, bool is_q, int rd, int rn,
21
- FEAT_BBM at level 2 (Translation table break-before-make levels)
24
int rm, bool is_fp16, int data,
22
- FEAT_BF16 (AArch64 BFloat16 instructions)
25
gen_helper_gvec_3_ptr *fn)
23
- FEAT_BTI (Branch Target Identification)
26
{
24
+- FEAT_CSV2 (Cache speculation variant 2)
27
- TCGv_ptr fpst = fpstatus_ptr(is_fp16 ? FPST_FPCR_F16 : FPST_FPCR);
25
- FEAT_DIT (Data Independent Timing instructions)
28
+ TCGv_ptr fpst = fpstatus_ptr(is_fp16 ? FPST_FPCR_F16 : FPST_A64);
26
- FEAT_DPB (DC CVAP instruction)
29
tcg_gen_gvec_3_ptr(vec_full_reg_offset(s, rd),
27
- FEAT_Debugv8p2 (Debug changes for v8.2)
30
vec_full_reg_offset(s, rn),
28
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
31
vec_full_reg_offset(s, rm), fpst,
32
@@ -XXX,XX +XXX,XX @@ static void gen_gvec_op4_fpst(DisasContext *s, bool is_q, int rd, int rn,
33
int rm, int ra, bool is_fp16, int data,
34
gen_helper_gvec_4_ptr *fn)
35
{
36
- TCGv_ptr fpst = fpstatus_ptr(is_fp16 ? FPST_FPCR_F16 : FPST_FPCR);
37
+ TCGv_ptr fpst = fpstatus_ptr(is_fp16 ? FPST_FPCR_F16 : FPST_A64);
38
tcg_gen_gvec_4_ptr(vec_full_reg_offset(s, rd),
39
vec_full_reg_offset(s, rn),
40
vec_full_reg_offset(s, rm),
41
@@ -XXX,XX +XXX,XX @@ static bool do_fp3_scalar(DisasContext *s, arg_rrr_e *a, const FPScalar *f)
42
if (fp_access_check(s)) {
43
TCGv_i64 t0 = read_fp_dreg(s, a->rn);
44
TCGv_i64 t1 = read_fp_dreg(s, a->rm);
45
- f->gen_d(t0, t0, t1, fpstatus_ptr(FPST_FPCR));
46
+ f->gen_d(t0, t0, t1, fpstatus_ptr(FPST_A64));
47
write_fp_dreg(s, a->rd, t0);
48
}
49
break;
50
@@ -XXX,XX +XXX,XX @@ static bool do_fp3_scalar(DisasContext *s, arg_rrr_e *a, const FPScalar *f)
51
if (fp_access_check(s)) {
52
TCGv_i32 t0 = read_fp_sreg(s, a->rn);
53
TCGv_i32 t1 = read_fp_sreg(s, a->rm);
54
- f->gen_s(t0, t0, t1, fpstatus_ptr(FPST_FPCR));
55
+ f->gen_s(t0, t0, t1, fpstatus_ptr(FPST_A64));
56
write_fp_sreg(s, a->rd, t0);
57
}
58
break;
59
@@ -XXX,XX +XXX,XX @@ static bool do_fcmp0_s(DisasContext *s, arg_rr_e *a,
60
TCGv_i64 t0 = read_fp_dreg(s, a->rn);
61
TCGv_i64 t1 = tcg_constant_i64(0);
62
if (swap) {
63
- f->gen_d(t0, t1, t0, fpstatus_ptr(FPST_FPCR));
64
+ f->gen_d(t0, t1, t0, fpstatus_ptr(FPST_A64));
65
} else {
66
- f->gen_d(t0, t0, t1, fpstatus_ptr(FPST_FPCR));
67
+ f->gen_d(t0, t0, t1, fpstatus_ptr(FPST_A64));
68
}
69
write_fp_dreg(s, a->rd, t0);
70
}
71
@@ -XXX,XX +XXX,XX @@ static bool do_fcmp0_s(DisasContext *s, arg_rr_e *a,
72
TCGv_i32 t0 = read_fp_sreg(s, a->rn);
73
TCGv_i32 t1 = tcg_constant_i32(0);
74
if (swap) {
75
- f->gen_s(t0, t1, t0, fpstatus_ptr(FPST_FPCR));
76
+ f->gen_s(t0, t1, t0, fpstatus_ptr(FPST_A64));
77
} else {
78
- f->gen_s(t0, t0, t1, fpstatus_ptr(FPST_FPCR));
79
+ f->gen_s(t0, t0, t1, fpstatus_ptr(FPST_A64));
80
}
81
write_fp_sreg(s, a->rd, t0);
82
}
83
@@ -XXX,XX +XXX,XX @@ static bool do_fp3_scalar_idx(DisasContext *s, arg_rrx_e *a, const FPScalar *f)
84
TCGv_i64 t1 = tcg_temp_new_i64();
85
86
read_vec_element(s, t1, a->rm, a->idx, MO_64);
87
- f->gen_d(t0, t0, t1, fpstatus_ptr(FPST_FPCR));
88
+ f->gen_d(t0, t0, t1, fpstatus_ptr(FPST_A64));
89
write_fp_dreg(s, a->rd, t0);
90
}
91
break;
92
@@ -XXX,XX +XXX,XX @@ static bool do_fp3_scalar_idx(DisasContext *s, arg_rrx_e *a, const FPScalar *f)
93
TCGv_i32 t1 = tcg_temp_new_i32();
94
95
read_vec_element_i32(s, t1, a->rm, a->idx, MO_32);
96
- f->gen_s(t0, t0, t1, fpstatus_ptr(FPST_FPCR));
97
+ f->gen_s(t0, t0, t1, fpstatus_ptr(FPST_A64));
98
write_fp_sreg(s, a->rd, t0);
99
}
100
break;
101
@@ -XXX,XX +XXX,XX @@ static bool do_fmla_scalar_idx(DisasContext *s, arg_rrx_e *a, bool neg)
102
if (neg) {
103
gen_vfp_negd(t1, t1);
104
}
105
- gen_helper_vfp_muladdd(t0, t1, t2, t0, fpstatus_ptr(FPST_FPCR));
106
+ gen_helper_vfp_muladdd(t0, t1, t2, t0, fpstatus_ptr(FPST_A64));
107
write_fp_dreg(s, a->rd, t0);
108
}
109
break;
110
@@ -XXX,XX +XXX,XX @@ static bool do_fmla_scalar_idx(DisasContext *s, arg_rrx_e *a, bool neg)
111
if (neg) {
112
gen_vfp_negs(t1, t1);
113
}
114
- gen_helper_vfp_muladds(t0, t1, t2, t0, fpstatus_ptr(FPST_FPCR));
115
+ gen_helper_vfp_muladds(t0, t1, t2, t0, fpstatus_ptr(FPST_A64));
116
write_fp_sreg(s, a->rd, t0);
117
}
118
break;
119
@@ -XXX,XX +XXX,XX @@ static bool do_fp3_scalar_pair(DisasContext *s, arg_rr_e *a, const FPScalar *f)
120
121
read_vec_element(s, t0, a->rn, 0, MO_64);
122
read_vec_element(s, t1, a->rn, 1, MO_64);
123
- f->gen_d(t0, t0, t1, fpstatus_ptr(FPST_FPCR));
124
+ f->gen_d(t0, t0, t1, fpstatus_ptr(FPST_A64));
125
write_fp_dreg(s, a->rd, t0);
126
}
127
break;
128
@@ -XXX,XX +XXX,XX @@ static bool do_fp3_scalar_pair(DisasContext *s, arg_rr_e *a, const FPScalar *f)
129
130
read_vec_element_i32(s, t0, a->rn, 0, MO_32);
131
read_vec_element_i32(s, t1, a->rn, 1, MO_32);
132
- f->gen_s(t0, t0, t1, fpstatus_ptr(FPST_FPCR));
133
+ f->gen_s(t0, t0, t1, fpstatus_ptr(FPST_A64));
134
write_fp_sreg(s, a->rd, t0);
135
}
136
break;
137
@@ -XXX,XX +XXX,XX @@ static bool do_fmadd(DisasContext *s, arg_rrrr_e *a, bool neg_a, bool neg_n)
138
if (neg_n) {
139
gen_vfp_negd(tn, tn);
140
}
141
- fpst = fpstatus_ptr(FPST_FPCR);
142
+ fpst = fpstatus_ptr(FPST_A64);
143
gen_helper_vfp_muladdd(ta, tn, tm, ta, fpst);
144
write_fp_dreg(s, a->rd, ta);
145
}
146
@@ -XXX,XX +XXX,XX @@ static bool do_fmadd(DisasContext *s, arg_rrrr_e *a, bool neg_a, bool neg_n)
147
if (neg_n) {
148
gen_vfp_negs(tn, tn);
149
}
150
- fpst = fpstatus_ptr(FPST_FPCR);
151
+ fpst = fpstatus_ptr(FPST_A64);
152
gen_helper_vfp_muladds(ta, tn, tm, ta, fpst);
153
write_fp_sreg(s, a->rd, ta);
154
}
155
@@ -XXX,XX +XXX,XX @@ static bool do_fp_reduction(DisasContext *s, arg_qrr_e *a,
156
if (fp_access_check(s)) {
157
MemOp esz = a->esz;
158
int elts = (a->q ? 16 : 8) >> esz;
159
- TCGv_ptr fpst = fpstatus_ptr(esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR);
160
+ TCGv_ptr fpst = fpstatus_ptr(esz == MO_16 ? FPST_FPCR_F16 : FPST_A64);
161
TCGv_i32 res = do_reduction_op(s, a->rn, esz, 0, elts, fpst, fn);
162
write_fp_sreg(s, a->rd, res);
163
}
164
@@ -XXX,XX +XXX,XX @@ static void handle_fp_compare(DisasContext *s, int size,
165
bool cmp_with_zero, bool signal_all_nans)
166
{
167
TCGv_i64 tcg_flags = tcg_temp_new_i64();
168
- TCGv_ptr fpst = fpstatus_ptr(size == MO_16 ? FPST_FPCR_F16 : FPST_FPCR);
169
+ TCGv_ptr fpst = fpstatus_ptr(size == MO_16 ? FPST_FPCR_F16 : FPST_A64);
170
171
if (size == MO_64) {
172
TCGv_i64 tcg_vn, tcg_vm;
173
@@ -XXX,XX +XXX,XX @@ static bool do_fp1_scalar(DisasContext *s, arg_rr_e *a,
174
return check == 0;
175
}
176
177
- fpst = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR);
178
+ fpst = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_A64);
179
if (rmode >= 0) {
180
tcg_rmode = gen_set_rmode(rmode, fpst);
181
}
182
@@ -XXX,XX +XXX,XX @@ static bool trans_FCVT_s_ds(DisasContext *s, arg_rr *a)
183
if (fp_access_check(s)) {
184
TCGv_i32 tcg_rn = read_fp_sreg(s, a->rn);
185
TCGv_i64 tcg_rd = tcg_temp_new_i64();
186
- TCGv_ptr fpst = fpstatus_ptr(FPST_FPCR);
187
+ TCGv_ptr fpst = fpstatus_ptr(FPST_A64);
188
189
gen_helper_vfp_fcvtds(tcg_rd, tcg_rn, fpst);
190
write_fp_dreg(s, a->rd, tcg_rd);
191
@@ -XXX,XX +XXX,XX @@ static bool trans_FCVT_s_hs(DisasContext *s, arg_rr *a)
192
if (fp_access_check(s)) {
193
TCGv_i32 tmp = read_fp_sreg(s, a->rn);
194
TCGv_i32 ahp = get_ahp_flag();
195
- TCGv_ptr fpst = fpstatus_ptr(FPST_FPCR);
196
+ TCGv_ptr fpst = fpstatus_ptr(FPST_A64);
197
198
gen_helper_vfp_fcvt_f32_to_f16(tmp, tmp, fpst, ahp);
199
/* write_fp_sreg is OK here because top half of result is zero */
200
@@ -XXX,XX +XXX,XX @@ static bool trans_FCVT_s_sd(DisasContext *s, arg_rr *a)
201
if (fp_access_check(s)) {
202
TCGv_i64 tcg_rn = read_fp_dreg(s, a->rn);
203
TCGv_i32 tcg_rd = tcg_temp_new_i32();
204
- TCGv_ptr fpst = fpstatus_ptr(FPST_FPCR);
205
+ TCGv_ptr fpst = fpstatus_ptr(FPST_A64);
206
207
gen_helper_vfp_fcvtsd(tcg_rd, tcg_rn, fpst);
208
write_fp_sreg(s, a->rd, tcg_rd);
209
@@ -XXX,XX +XXX,XX @@ static bool trans_FCVT_s_hd(DisasContext *s, arg_rr *a)
210
TCGv_i64 tcg_rn = read_fp_dreg(s, a->rn);
211
TCGv_i32 tcg_rd = tcg_temp_new_i32();
212
TCGv_i32 ahp = get_ahp_flag();
213
- TCGv_ptr fpst = fpstatus_ptr(FPST_FPCR);
214
+ TCGv_ptr fpst = fpstatus_ptr(FPST_A64);
215
216
gen_helper_vfp_fcvt_f64_to_f16(tcg_rd, tcg_rn, fpst, ahp);
217
/* write_fp_sreg is OK here because top half of tcg_rd is zero */
218
@@ -XXX,XX +XXX,XX @@ static bool trans_FCVT_s_sh(DisasContext *s, arg_rr *a)
219
if (fp_access_check(s)) {
220
TCGv_i32 tcg_rn = read_fp_hreg(s, a->rn);
221
TCGv_i32 tcg_rd = tcg_temp_new_i32();
222
- TCGv_ptr tcg_fpst = fpstatus_ptr(FPST_FPCR);
223
+ TCGv_ptr tcg_fpst = fpstatus_ptr(FPST_A64);
224
TCGv_i32 tcg_ahp = get_ahp_flag();
225
226
gen_helper_vfp_fcvt_f16_to_f32(tcg_rd, tcg_rn, tcg_fpst, tcg_ahp);
227
@@ -XXX,XX +XXX,XX @@ static bool trans_FCVT_s_dh(DisasContext *s, arg_rr *a)
228
if (fp_access_check(s)) {
229
TCGv_i32 tcg_rn = read_fp_hreg(s, a->rn);
230
TCGv_i64 tcg_rd = tcg_temp_new_i64();
231
- TCGv_ptr tcg_fpst = fpstatus_ptr(FPST_FPCR);
232
+ TCGv_ptr tcg_fpst = fpstatus_ptr(FPST_A64);
233
TCGv_i32 tcg_ahp = get_ahp_flag();
234
235
gen_helper_vfp_fcvt_f16_to_f64(tcg_rd, tcg_rn, tcg_fpst, tcg_ahp);
236
@@ -XXX,XX +XXX,XX @@ static bool do_cvtf_scalar(DisasContext *s, MemOp esz, int rd, int shift,
237
TCGv_i32 tcg_shift, tcg_single;
238
TCGv_i64 tcg_double;
239
240
- tcg_fpstatus = fpstatus_ptr(esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR);
241
+ tcg_fpstatus = fpstatus_ptr(esz == MO_16 ? FPST_FPCR_F16 : FPST_A64);
242
tcg_shift = tcg_constant_i32(shift);
243
244
switch (esz) {
245
@@ -XXX,XX +XXX,XX @@ static void do_fcvt_scalar(DisasContext *s, MemOp out, MemOp esz,
246
TCGv_ptr tcg_fpstatus;
247
TCGv_i32 tcg_shift, tcg_rmode, tcg_single;
248
249
- tcg_fpstatus = fpstatus_ptr(esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR);
250
+ tcg_fpstatus = fpstatus_ptr(esz == MO_16 ? FPST_FPCR_F16 : FPST_A64);
251
tcg_shift = tcg_constant_i32(shift);
252
tcg_rmode = gen_set_rmode(rmode, tcg_fpstatus);
253
254
@@ -XXX,XX +XXX,XX @@ static bool trans_FJCVTZS(DisasContext *s, arg_FJCVTZS *a)
255
}
256
if (fp_access_check(s)) {
257
TCGv_i64 t = read_fp_dreg(s, a->rn);
258
- TCGv_ptr fpstatus = fpstatus_ptr(FPST_FPCR);
259
+ TCGv_ptr fpstatus = fpstatus_ptr(FPST_A64);
260
261
gen_helper_fjcvtzs(t, t, fpstatus);
262
263
@@ -XXX,XX +XXX,XX @@ static void gen_fcvtxn_sd(TCGv_i64 d, TCGv_i64 n)
264
* with von Neumann rounding (round to odd)
265
*/
266
TCGv_i32 tmp = tcg_temp_new_i32();
267
- gen_helper_fcvtx_f64_to_f32(tmp, n, fpstatus_ptr(FPST_FPCR));
268
+ gen_helper_fcvtx_f64_to_f32(tmp, n, fpstatus_ptr(FPST_A64));
269
tcg_gen_extu_i32_i64(d, tmp);
270
}
271
272
@@ -XXX,XX +XXX,XX @@ static void gen_fcvtn_hs(TCGv_i64 d, TCGv_i64 n)
273
{
274
TCGv_i32 tcg_lo = tcg_temp_new_i32();
275
TCGv_i32 tcg_hi = tcg_temp_new_i32();
276
- TCGv_ptr fpst = fpstatus_ptr(FPST_FPCR);
277
+ TCGv_ptr fpst = fpstatus_ptr(FPST_A64);
278
TCGv_i32 ahp = get_ahp_flag();
279
280
tcg_gen_extr_i64_i32(tcg_lo, tcg_hi, n);
281
@@ -XXX,XX +XXX,XX @@ static void gen_fcvtn_hs(TCGv_i64 d, TCGv_i64 n)
282
static void gen_fcvtn_sd(TCGv_i64 d, TCGv_i64 n)
283
{
284
TCGv_i32 tmp = tcg_temp_new_i32();
285
- TCGv_ptr fpst = fpstatus_ptr(FPST_FPCR);
286
+ TCGv_ptr fpst = fpstatus_ptr(FPST_A64);
287
288
gen_helper_vfp_fcvtsd(tmp, n, fpst);
289
tcg_gen_extu_i32_i64(d, tmp);
290
@@ -XXX,XX +XXX,XX @@ TRANS(FCVTXN_v, do_2misc_narrow_vector, a, f_scalar_fcvtxn)
291
292
static void gen_bfcvtn_hs(TCGv_i64 d, TCGv_i64 n)
293
{
294
- TCGv_ptr fpst = fpstatus_ptr(FPST_FPCR);
295
+ TCGv_ptr fpst = fpstatus_ptr(FPST_A64);
296
TCGv_i32 tmp = tcg_temp_new_i32();
297
gen_helper_bfcvt_pair(tmp, n, fpst);
298
tcg_gen_extu_i32_i64(d, tmp);
299
@@ -XXX,XX +XXX,XX @@ static bool do_fp1_vector(DisasContext *s, arg_qrr_e *a,
300
return check == 0;
301
}
302
303
- fpst = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR);
304
+ fpst = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_A64);
305
if (rmode >= 0) {
306
tcg_rmode = gen_set_rmode(rmode, fpst);
307
}
308
@@ -XXX,XX +XXX,XX @@ static bool do_gvec_op2_fpst(DisasContext *s, MemOp esz, bool is_q,
309
return check == 0;
310
}
311
312
- fpst = fpstatus_ptr(esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR);
313
+ fpst = fpstatus_ptr(esz == MO_16 ? FPST_FPCR_F16 : FPST_A64);
314
tcg_gen_gvec_2_ptr(vec_full_reg_offset(s, rd),
315
vec_full_reg_offset(s, rn), fpst,
316
is_q ? 16 : 8, vec_full_reg_size(s),
317
@@ -XXX,XX +XXX,XX @@ static bool trans_FCVTL_v(DisasContext *s, arg_qrr_e *a)
318
return true;
319
}
320
321
- fpst = fpstatus_ptr(FPST_FPCR);
322
+ fpst = fpstatus_ptr(FPST_A64);
323
if (a->esz == MO_64) {
324
/* 32 -> 64 bit fp conversion */
325
TCGv_i64 tcg_res[2];
326
diff --git a/target/arm/tcg/translate-sme.c b/target/arm/tcg/translate-sme.c
29
index XXXXXXX..XXXXXXX 100644
327
index XXXXXXX..XXXXXXX 100644
30
--- a/target/arm/cpu64.c
328
--- a/target/arm/tcg/translate-sme.c
31
+++ b/target/arm/cpu64.c
329
+++ b/target/arm/tcg/translate-sme.c
32
@@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj)
330
@@ -XXX,XX +XXX,XX @@ static bool do_outprod_env(DisasContext *s, arg_op *a, MemOp esz,
33
t = FIELD_DP64(t, ID_AA64PFR0, SVE, 1);
331
TRANS_FEAT(FMOPA_h, aa64_sme, do_outprod_env, a,
34
t = FIELD_DP64(t, ID_AA64PFR0, SEL2, 1); /* FEAT_SEL2 */
332
MO_32, gen_helper_sme_fmopa_h)
35
t = FIELD_DP64(t, ID_AA64PFR0, DIT, 1); /* FEAT_DIT */
333
TRANS_FEAT(FMOPA_s, aa64_sme, do_outprod_fpst, a,
36
+ t = FIELD_DP64(t, ID_AA64PFR0, CSV2, 1); /* FEAT_CSV2 */
334
- MO_32, FPST_FPCR, gen_helper_sme_fmopa_s)
37
cpu->isar.id_aa64pfr0 = t;
335
+ MO_32, FPST_A64, gen_helper_sme_fmopa_s)
38
336
TRANS_FEAT(FMOPA_d, aa64_sme_f64f64, do_outprod_fpst, a,
39
t = cpu->isar.id_aa64pfr1;
337
- MO_64, FPST_FPCR, gen_helper_sme_fmopa_d)
40
diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c
338
+ MO_64, FPST_A64, gen_helper_sme_fmopa_d)
339
340
TRANS_FEAT(BFMOPA, aa64_sme, do_outprod_env, a, MO_32, gen_helper_sme_bfmopa)
341
342
diff --git a/target/arm/tcg/translate-sve.c b/target/arm/tcg/translate-sve.c
41
index XXXXXXX..XXXXXXX 100644
343
index XXXXXXX..XXXXXXX 100644
42
--- a/target/arm/cpu_tcg.c
344
--- a/target/arm/tcg/translate-sve.c
43
+++ b/target/arm/cpu_tcg.c
345
+++ b/target/arm/tcg/translate-sve.c
44
@@ -XXX,XX +XXX,XX @@ void aa32_max_features(ARMCPU *cpu)
346
@@ -XXX,XX +XXX,XX @@ static bool gen_gvec_fpst_arg_zz(DisasContext *s, gen_helper_gvec_2_ptr *fn,
45
cpu->isar.id_mmfr4 = t;
347
arg_rr_esz *a, int data)
46
348
{
47
t = cpu->isar.id_pfr0;
349
return gen_gvec_fpst_zz(s, fn, a->rd, a->rn, data,
48
+ t = FIELD_DP32(t, ID_PFR0, CSV2, 2); /* FEAT_CVS2 */
350
- a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR);
49
t = FIELD_DP32(t, ID_PFR0, DIT, 1); /* FEAT_DIT */
351
+ a->esz == MO_16 ? FPST_FPCR_F16 : FPST_A64);
50
t = FIELD_DP32(t, ID_PFR0, RAS, 1); /* FEAT_RAS */
352
}
51
cpu->isar.id_pfr0 = t;
353
354
/* Invoke an out-of-line helper on 3 Zregs. */
355
@@ -XXX,XX +XXX,XX @@ static bool gen_gvec_fpst_arg_zzz(DisasContext *s, gen_helper_gvec_3_ptr *fn,
356
arg_rrr_esz *a, int data)
357
{
358
return gen_gvec_fpst_zzz(s, fn, a->rd, a->rn, a->rm, data,
359
- a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR);
360
+ a->esz == MO_16 ? FPST_FPCR_F16 : FPST_A64);
361
}
362
363
/* Invoke an out-of-line helper on 4 Zregs. */
364
@@ -XXX,XX +XXX,XX @@ static bool gen_gvec_fpst_arg_zpzz(DisasContext *s, gen_helper_gvec_4_ptr *fn,
365
arg_rprr_esz *a)
366
{
367
return gen_gvec_fpst_zzzp(s, fn, a->rd, a->rn, a->rm, a->pg, 0,
368
- a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR);
369
+ a->esz == MO_16 ? FPST_FPCR_F16 : FPST_A64);
370
}
371
372
/* Invoke a vector expander on two Zregs and an immediate. */
373
@@ -XXX,XX +XXX,XX @@ static bool do_FMLA_zzxz(DisasContext *s, arg_rrxr_esz *a, bool sub)
374
};
375
return gen_gvec_fpst_zzzz(s, fns[a->esz], a->rd, a->rn, a->rm, a->ra,
376
(a->index << 1) | sub,
377
- a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR);
378
+ a->esz == MO_16 ? FPST_FPCR_F16 : FPST_A64);
379
}
380
381
TRANS_FEAT(FMLA_zzxz, aa64_sve, do_FMLA_zzxz, a, false)
382
@@ -XXX,XX +XXX,XX @@ static gen_helper_gvec_3_ptr * const fmul_idx_fns[4] = {
383
};
384
TRANS_FEAT(FMUL_zzx, aa64_sve, gen_gvec_fpst_zzz,
385
fmul_idx_fns[a->esz], a->rd, a->rn, a->rm, a->index,
386
- a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR)
387
+ a->esz == MO_16 ? FPST_FPCR_F16 : FPST_A64)
388
389
/*
390
*** SVE Floating Point Fast Reduction Group
391
@@ -XXX,XX +XXX,XX @@ static bool do_reduce(DisasContext *s, arg_rpr_esz *a,
392
393
tcg_gen_addi_ptr(t_zn, tcg_env, vec_full_reg_offset(s, a->rn));
394
tcg_gen_addi_ptr(t_pg, tcg_env, pred_full_reg_offset(s, a->pg));
395
- status = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR);
396
+ status = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_A64);
397
398
fn(temp, t_zn, t_pg, status, t_desc);
399
400
@@ -XXX,XX +XXX,XX @@ static bool do_ppz_fp(DisasContext *s, arg_rpr_esz *a,
401
if (sve_access_check(s)) {
402
unsigned vsz = vec_full_reg_size(s);
403
TCGv_ptr status =
404
- fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR);
405
+ fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_A64);
406
407
tcg_gen_gvec_3_ptr(pred_full_reg_offset(s, a->rd),
408
vec_full_reg_offset(s, a->rn),
409
@@ -XXX,XX +XXX,XX @@ static gen_helper_gvec_3_ptr * const ftmad_fns[4] = {
410
};
411
TRANS_FEAT_NONSTREAMING(FTMAD, aa64_sve, gen_gvec_fpst_zzz,
412
ftmad_fns[a->esz], a->rd, a->rn, a->rm, a->imm,
413
- a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR)
414
+ a->esz == MO_16 ? FPST_FPCR_F16 : FPST_A64)
415
416
/*
417
*** SVE Floating Point Accumulating Reduction Group
418
@@ -XXX,XX +XXX,XX @@ static bool trans_FADDA(DisasContext *s, arg_rprr_esz *a)
419
t_pg = tcg_temp_new_ptr();
420
tcg_gen_addi_ptr(t_rm, tcg_env, vec_full_reg_offset(s, a->rm));
421
tcg_gen_addi_ptr(t_pg, tcg_env, pred_full_reg_offset(s, a->pg));
422
- t_fpst = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR);
423
+ t_fpst = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_A64);
424
t_desc = tcg_constant_i32(simd_desc(vsz, vsz, 0));
425
426
fns[a->esz - 1](t_val, t_val, t_rm, t_pg, t_fpst, t_desc);
427
@@ -XXX,XX +XXX,XX @@ static void do_fp_scalar(DisasContext *s, int zd, int zn, int pg, bool is_fp16,
428
tcg_gen_addi_ptr(t_zn, tcg_env, vec_full_reg_offset(s, zn));
429
tcg_gen_addi_ptr(t_pg, tcg_env, pred_full_reg_offset(s, pg));
430
431
- status = fpstatus_ptr(is_fp16 ? FPST_FPCR_F16 : FPST_FPCR);
432
+ status = fpstatus_ptr(is_fp16 ? FPST_FPCR_F16 : FPST_A64);
433
desc = tcg_constant_i32(simd_desc(vsz, vsz, 0));
434
fn(t_zd, t_zn, t_pg, scalar, status, desc);
435
}
436
@@ -XXX,XX +XXX,XX @@ static bool do_fp_cmp(DisasContext *s, arg_rprr_esz *a,
437
}
438
if (sve_access_check(s)) {
439
unsigned vsz = vec_full_reg_size(s);
440
- TCGv_ptr status = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR);
441
+ TCGv_ptr status = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_A64);
442
tcg_gen_gvec_4_ptr(pred_full_reg_offset(s, a->rd),
443
vec_full_reg_offset(s, a->rn),
444
vec_full_reg_offset(s, a->rm),
445
@@ -XXX,XX +XXX,XX @@ static gen_helper_gvec_4_ptr * const fcadd_fns[] = {
446
};
447
TRANS_FEAT(FCADD, aa64_sve, gen_gvec_fpst_zzzp, fcadd_fns[a->esz],
448
a->rd, a->rn, a->rm, a->pg, a->rot,
449
- a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR)
450
+ a->esz == MO_16 ? FPST_FPCR_F16 : FPST_A64)
451
452
#define DO_FMLA(NAME, name) \
453
static gen_helper_gvec_5_ptr * const name##_fns[4] = { \
454
@@ -XXX,XX +XXX,XX @@ TRANS_FEAT(FCADD, aa64_sve, gen_gvec_fpst_zzzp, fcadd_fns[a->esz],
455
}; \
456
TRANS_FEAT(NAME, aa64_sve, gen_gvec_fpst_zzzzp, name##_fns[a->esz], \
457
a->rd, a->rn, a->rm, a->ra, a->pg, 0, \
458
- a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR)
459
+ a->esz == MO_16 ? FPST_FPCR_F16 : FPST_A64)
460
461
DO_FMLA(FMLA_zpzzz, fmla_zpzzz)
462
DO_FMLA(FMLS_zpzzz, fmls_zpzzz)
463
@@ -XXX,XX +XXX,XX @@ static gen_helper_gvec_5_ptr * const fcmla_fns[4] = {
464
};
465
TRANS_FEAT(FCMLA_zpzzz, aa64_sve, gen_gvec_fpst_zzzzp, fcmla_fns[a->esz],
466
a->rd, a->rn, a->rm, a->ra, a->pg, a->rot,
467
- a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR)
468
+ a->esz == MO_16 ? FPST_FPCR_F16 : FPST_A64)
469
470
static gen_helper_gvec_4_ptr * const fcmla_idx_fns[4] = {
471
NULL, gen_helper_gvec_fcmlah_idx, gen_helper_gvec_fcmlas_idx, NULL
472
};
473
TRANS_FEAT(FCMLA_zzxz, aa64_sve, gen_gvec_fpst_zzzz, fcmla_idx_fns[a->esz],
474
a->rd, a->rn, a->rm, a->ra, a->index * 4 + a->rot,
475
- a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR)
476
+ a->esz == MO_16 ? FPST_FPCR_F16 : FPST_A64)
477
478
/*
479
*** SVE Floating Point Unary Operations Predicated Group
480
*/
481
482
TRANS_FEAT(FCVT_sh, aa64_sve, gen_gvec_fpst_arg_zpz,
483
- gen_helper_sve_fcvt_sh, a, 0, FPST_FPCR)
484
+ gen_helper_sve_fcvt_sh, a, 0, FPST_A64)
485
TRANS_FEAT(FCVT_hs, aa64_sve, gen_gvec_fpst_arg_zpz,
486
- gen_helper_sve_fcvt_hs, a, 0, FPST_FPCR)
487
+ gen_helper_sve_fcvt_hs, a, 0, FPST_A64)
488
489
TRANS_FEAT(BFCVT, aa64_sve_bf16, gen_gvec_fpst_arg_zpz,
490
- gen_helper_sve_bfcvt, a, 0, FPST_FPCR)
491
+ gen_helper_sve_bfcvt, a, 0, FPST_A64)
492
493
TRANS_FEAT(FCVT_dh, aa64_sve, gen_gvec_fpst_arg_zpz,
494
- gen_helper_sve_fcvt_dh, a, 0, FPST_FPCR)
495
+ gen_helper_sve_fcvt_dh, a, 0, FPST_A64)
496
TRANS_FEAT(FCVT_hd, aa64_sve, gen_gvec_fpst_arg_zpz,
497
- gen_helper_sve_fcvt_hd, a, 0, FPST_FPCR)
498
+ gen_helper_sve_fcvt_hd, a, 0, FPST_A64)
499
TRANS_FEAT(FCVT_ds, aa64_sve, gen_gvec_fpst_arg_zpz,
500
- gen_helper_sve_fcvt_ds, a, 0, FPST_FPCR)
501
+ gen_helper_sve_fcvt_ds, a, 0, FPST_A64)
502
TRANS_FEAT(FCVT_sd, aa64_sve, gen_gvec_fpst_arg_zpz,
503
- gen_helper_sve_fcvt_sd, a, 0, FPST_FPCR)
504
+ gen_helper_sve_fcvt_sd, a, 0, FPST_A64)
505
506
TRANS_FEAT(FCVTZS_hh, aa64_sve, gen_gvec_fpst_arg_zpz,
507
gen_helper_sve_fcvtzs_hh, a, 0, FPST_FPCR_F16)
508
@@ -XXX,XX +XXX,XX @@ TRANS_FEAT(FCVTZU_hd, aa64_sve, gen_gvec_fpst_arg_zpz,
509
gen_helper_sve_fcvtzu_hd, a, 0, FPST_FPCR_F16)
510
511
TRANS_FEAT(FCVTZS_ss, aa64_sve, gen_gvec_fpst_arg_zpz,
512
- gen_helper_sve_fcvtzs_ss, a, 0, FPST_FPCR)
513
+ gen_helper_sve_fcvtzs_ss, a, 0, FPST_A64)
514
TRANS_FEAT(FCVTZU_ss, aa64_sve, gen_gvec_fpst_arg_zpz,
515
- gen_helper_sve_fcvtzu_ss, a, 0, FPST_FPCR)
516
+ gen_helper_sve_fcvtzu_ss, a, 0, FPST_A64)
517
TRANS_FEAT(FCVTZS_sd, aa64_sve, gen_gvec_fpst_arg_zpz,
518
- gen_helper_sve_fcvtzs_sd, a, 0, FPST_FPCR)
519
+ gen_helper_sve_fcvtzs_sd, a, 0, FPST_A64)
520
TRANS_FEAT(FCVTZU_sd, aa64_sve, gen_gvec_fpst_arg_zpz,
521
- gen_helper_sve_fcvtzu_sd, a, 0, FPST_FPCR)
522
+ gen_helper_sve_fcvtzu_sd, a, 0, FPST_A64)
523
TRANS_FEAT(FCVTZS_ds, aa64_sve, gen_gvec_fpst_arg_zpz,
524
- gen_helper_sve_fcvtzs_ds, a, 0, FPST_FPCR)
525
+ gen_helper_sve_fcvtzs_ds, a, 0, FPST_A64)
526
TRANS_FEAT(FCVTZU_ds, aa64_sve, gen_gvec_fpst_arg_zpz,
527
- gen_helper_sve_fcvtzu_ds, a, 0, FPST_FPCR)
528
+ gen_helper_sve_fcvtzu_ds, a, 0, FPST_A64)
529
530
TRANS_FEAT(FCVTZS_dd, aa64_sve, gen_gvec_fpst_arg_zpz,
531
- gen_helper_sve_fcvtzs_dd, a, 0, FPST_FPCR)
532
+ gen_helper_sve_fcvtzs_dd, a, 0, FPST_A64)
533
TRANS_FEAT(FCVTZU_dd, aa64_sve, gen_gvec_fpst_arg_zpz,
534
- gen_helper_sve_fcvtzu_dd, a, 0, FPST_FPCR)
535
+ gen_helper_sve_fcvtzu_dd, a, 0, FPST_A64)
536
537
static gen_helper_gvec_3_ptr * const frint_fns[] = {
538
NULL,
539
@@ -XXX,XX +XXX,XX @@ static gen_helper_gvec_3_ptr * const frint_fns[] = {
540
gen_helper_sve_frint_d
541
};
542
TRANS_FEAT(FRINTI, aa64_sve, gen_gvec_fpst_arg_zpz, frint_fns[a->esz],
543
- a, 0, a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR)
544
+ a, 0, a->esz == MO_16 ? FPST_FPCR_F16 : FPST_A64)
545
546
static gen_helper_gvec_3_ptr * const frintx_fns[] = {
547
NULL,
548
@@ -XXX,XX +XXX,XX @@ static gen_helper_gvec_3_ptr * const frintx_fns[] = {
549
gen_helper_sve_frintx_d
550
};
551
TRANS_FEAT(FRINTX, aa64_sve, gen_gvec_fpst_arg_zpz, frintx_fns[a->esz],
552
- a, 0, a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR);
553
+ a, 0, a->esz == MO_16 ? FPST_FPCR_F16 : FPST_A64);
554
555
static bool do_frint_mode(DisasContext *s, arg_rpr_esz *a,
556
ARMFPRounding mode, gen_helper_gvec_3_ptr *fn)
557
@@ -XXX,XX +XXX,XX @@ static bool do_frint_mode(DisasContext *s, arg_rpr_esz *a,
558
}
559
560
vsz = vec_full_reg_size(s);
561
- status = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR);
562
+ status = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_A64);
563
tmode = gen_set_rmode(mode, status);
564
565
tcg_gen_gvec_3_ptr(vec_full_reg_offset(s, a->rd),
566
@@ -XXX,XX +XXX,XX @@ static gen_helper_gvec_3_ptr * const frecpx_fns[] = {
567
gen_helper_sve_frecpx_s, gen_helper_sve_frecpx_d,
568
};
569
TRANS_FEAT(FRECPX, aa64_sve, gen_gvec_fpst_arg_zpz, frecpx_fns[a->esz],
570
- a, 0, a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR)
571
+ a, 0, a->esz == MO_16 ? FPST_FPCR_F16 : FPST_A64)
572
573
static gen_helper_gvec_3_ptr * const fsqrt_fns[] = {
574
NULL, gen_helper_sve_fsqrt_h,
575
gen_helper_sve_fsqrt_s, gen_helper_sve_fsqrt_d,
576
};
577
TRANS_FEAT(FSQRT, aa64_sve, gen_gvec_fpst_arg_zpz, fsqrt_fns[a->esz],
578
- a, 0, a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR)
579
+ a, 0, a->esz == MO_16 ? FPST_FPCR_F16 : FPST_A64)
580
581
TRANS_FEAT(SCVTF_hh, aa64_sve, gen_gvec_fpst_arg_zpz,
582
gen_helper_sve_scvt_hh, a, 0, FPST_FPCR_F16)
583
@@ -XXX,XX +XXX,XX @@ TRANS_FEAT(SCVTF_dh, aa64_sve, gen_gvec_fpst_arg_zpz,
584
gen_helper_sve_scvt_dh, a, 0, FPST_FPCR_F16)
585
586
TRANS_FEAT(SCVTF_ss, aa64_sve, gen_gvec_fpst_arg_zpz,
587
- gen_helper_sve_scvt_ss, a, 0, FPST_FPCR)
588
+ gen_helper_sve_scvt_ss, a, 0, FPST_A64)
589
TRANS_FEAT(SCVTF_ds, aa64_sve, gen_gvec_fpst_arg_zpz,
590
- gen_helper_sve_scvt_ds, a, 0, FPST_FPCR)
591
+ gen_helper_sve_scvt_ds, a, 0, FPST_A64)
592
593
TRANS_FEAT(SCVTF_sd, aa64_sve, gen_gvec_fpst_arg_zpz,
594
- gen_helper_sve_scvt_sd, a, 0, FPST_FPCR)
595
+ gen_helper_sve_scvt_sd, a, 0, FPST_A64)
596
TRANS_FEAT(SCVTF_dd, aa64_sve, gen_gvec_fpst_arg_zpz,
597
- gen_helper_sve_scvt_dd, a, 0, FPST_FPCR)
598
+ gen_helper_sve_scvt_dd, a, 0, FPST_A64)
599
600
TRANS_FEAT(UCVTF_hh, aa64_sve, gen_gvec_fpst_arg_zpz,
601
gen_helper_sve_ucvt_hh, a, 0, FPST_FPCR_F16)
602
@@ -XXX,XX +XXX,XX @@ TRANS_FEAT(UCVTF_dh, aa64_sve, gen_gvec_fpst_arg_zpz,
603
gen_helper_sve_ucvt_dh, a, 0, FPST_FPCR_F16)
604
605
TRANS_FEAT(UCVTF_ss, aa64_sve, gen_gvec_fpst_arg_zpz,
606
- gen_helper_sve_ucvt_ss, a, 0, FPST_FPCR)
607
+ gen_helper_sve_ucvt_ss, a, 0, FPST_A64)
608
TRANS_FEAT(UCVTF_ds, aa64_sve, gen_gvec_fpst_arg_zpz,
609
- gen_helper_sve_ucvt_ds, a, 0, FPST_FPCR)
610
+ gen_helper_sve_ucvt_ds, a, 0, FPST_A64)
611
TRANS_FEAT(UCVTF_sd, aa64_sve, gen_gvec_fpst_arg_zpz,
612
- gen_helper_sve_ucvt_sd, a, 0, FPST_FPCR)
613
+ gen_helper_sve_ucvt_sd, a, 0, FPST_A64)
614
615
TRANS_FEAT(UCVTF_dd, aa64_sve, gen_gvec_fpst_arg_zpz,
616
- gen_helper_sve_ucvt_dd, a, 0, FPST_FPCR)
617
+ gen_helper_sve_ucvt_dd, a, 0, FPST_A64)
618
619
/*
620
*** SVE Memory - 32-bit Gather and Unsized Contiguous Group
621
@@ -XXX,XX +XXX,XX @@ DO_ZPZZ_FP(FMINP, aa64_sve2, sve2_fminp_zpzz)
622
623
TRANS_FEAT_NONSTREAMING(FMMLA_s, aa64_sve_f32mm, gen_gvec_fpst_zzzz,
624
gen_helper_fmmla_s, a->rd, a->rn, a->rm, a->ra,
625
- 0, FPST_FPCR)
626
+ 0, FPST_A64)
627
TRANS_FEAT_NONSTREAMING(FMMLA_d, aa64_sve_f64mm, gen_gvec_fpst_zzzz,
628
gen_helper_fmmla_d, a->rd, a->rn, a->rm, a->ra,
629
- 0, FPST_FPCR)
630
+ 0, FPST_A64)
631
632
static gen_helper_gvec_4 * const sqdmlal_zzzw_fns[] = {
633
NULL, gen_helper_sve2_sqdmlal_zzzw_h,
634
@@ -XXX,XX +XXX,XX @@ TRANS_FEAT_NONSTREAMING(RAX1, aa64_sve2_sha3, gen_gvec_fn_arg_zzz,
635
gen_gvec_rax1, a)
636
637
TRANS_FEAT(FCVTNT_sh, aa64_sve2, gen_gvec_fpst_arg_zpz,
638
- gen_helper_sve2_fcvtnt_sh, a, 0, FPST_FPCR)
639
+ gen_helper_sve2_fcvtnt_sh, a, 0, FPST_A64)
640
TRANS_FEAT(FCVTNT_ds, aa64_sve2, gen_gvec_fpst_arg_zpz,
641
- gen_helper_sve2_fcvtnt_ds, a, 0, FPST_FPCR)
642
+ gen_helper_sve2_fcvtnt_ds, a, 0, FPST_A64)
643
644
TRANS_FEAT(BFCVTNT, aa64_sve_bf16, gen_gvec_fpst_arg_zpz,
645
- gen_helper_sve_bfcvtnt, a, 0, FPST_FPCR)
646
+ gen_helper_sve_bfcvtnt, a, 0, FPST_A64)
647
648
TRANS_FEAT(FCVTLT_hs, aa64_sve2, gen_gvec_fpst_arg_zpz,
649
- gen_helper_sve2_fcvtlt_hs, a, 0, FPST_FPCR)
650
+ gen_helper_sve2_fcvtlt_hs, a, 0, FPST_A64)
651
TRANS_FEAT(FCVTLT_sd, aa64_sve2, gen_gvec_fpst_arg_zpz,
652
- gen_helper_sve2_fcvtlt_sd, a, 0, FPST_FPCR)
653
+ gen_helper_sve2_fcvtlt_sd, a, 0, FPST_A64)
654
655
TRANS_FEAT(FCVTX_ds, aa64_sve2, do_frint_mode, a,
656
FPROUNDING_ODD, gen_helper_sve_fcvt_ds)
657
@@ -XXX,XX +XXX,XX @@ static gen_helper_gvec_3_ptr * const flogb_fns[] = {
658
gen_helper_flogb_s, gen_helper_flogb_d
659
};
660
TRANS_FEAT(FLOGB, aa64_sve2, gen_gvec_fpst_arg_zpz, flogb_fns[a->esz],
661
- a, 0, a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR)
662
+ a, 0, a->esz == MO_16 ? FPST_FPCR_F16 : FPST_A64)
663
664
static bool do_FMLAL_zzzw(DisasContext *s, arg_rrrr_esz *a, bool sub, bool sel)
665
{
666
@@ -XXX,XX +XXX,XX @@ TRANS_FEAT_NONSTREAMING(BFMMLA, aa64_sve_bf16, gen_gvec_env_arg_zzzz,
667
static bool do_BFMLAL_zzzw(DisasContext *s, arg_rrrr_esz *a, bool sel)
668
{
669
return gen_gvec_fpst_zzzz(s, gen_helper_gvec_bfmlal,
670
- a->rd, a->rn, a->rm, a->ra, sel, FPST_FPCR);
671
+ a->rd, a->rn, a->rm, a->ra, sel, FPST_A64);
672
}
673
674
TRANS_FEAT(BFMLALB_zzzw, aa64_sve_bf16, do_BFMLAL_zzzw, a, false)
675
@@ -XXX,XX +XXX,XX @@ static bool do_BFMLAL_zzxw(DisasContext *s, arg_rrxr_esz *a, bool sel)
676
{
677
return gen_gvec_fpst_zzzz(s, gen_helper_gvec_bfmlal_idx,
678
a->rd, a->rn, a->rm, a->ra,
679
- (a->index << 1) | sel, FPST_FPCR);
680
+ (a->index << 1) | sel, FPST_A64);
681
}
682
683
TRANS_FEAT(BFMLALB_zzxw, aa64_sve_bf16, do_BFMLAL_zzxw, a, false)
52
--
684
--
53
2.25.1
685
2.34.1
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
Now we have moved all the uses of vfp.fp_status and FPST_FPCR
2
to either the A32 or A64 fields, we can remove these.
2
3
3
Add only the system registers required to implement zero error
4
records. This means that all values for ERRSELR are out of range,
5
which means that it and all of the indexed error record registers
6
need not be implemented.
7
8
Add the EL2 registers required for injecting virtual SError.
9
10
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
12
Message-id: 20220506180242.216785-14-richard.henderson@linaro.org
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Message-id: 20250124162836.2332150-13-peter.maydell@linaro.org
14
---
7
---
15
target/arm/cpu.h | 5 +++
8
target/arm/cpu.h | 2 --
16
target/arm/helper.c | 84 +++++++++++++++++++++++++++++++++++++++++++++
9
target/arm/tcg/translate.h | 6 ------
17
2 files changed, 89 insertions(+)
10
target/arm/cpu.c | 1 -
11
target/arm/vfp_helper.c | 8 +-------
12
4 files changed, 1 insertion(+), 16 deletions(-)
18
13
19
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
14
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
20
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
21
--- a/target/arm/cpu.h
16
--- a/target/arm/cpu.h
22
+++ b/target/arm/cpu.h
17
+++ b/target/arm/cpu.h
23
@@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState {
18
@@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState {
24
uint64_t tfsr_el[4]; /* tfsre0_el1 is index 0. */
19
25
uint64_t gcr_el1;
20
/* There are a number of distinct float control structures:
26
uint64_t rgsr_el1;
21
*
27
+
22
- * fp_status: is the "normal" fp status.
28
+ /* Minimal RAS registers */
23
* fp_status_a32: is the "normal" fp status for AArch32 insns
29
+ uint64_t disr_el1;
24
* fp_status_a64: is the "normal" fp status for AArch64 insns
30
+ uint64_t vdisr_el2;
25
* fp_status_fp16: used for half-precision calculations
31
+ uint64_t vsesr_el2;
26
@@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState {
32
} cp15;
27
* only thing which needs to read the exception flags being
33
28
* an explicit FPSCR read.
34
struct {
29
*/
35
diff --git a/target/arm/helper.c b/target/arm/helper.c
30
- float_status fp_status;
31
float_status fp_status_a32;
32
float_status fp_status_a64;
33
float_status fp_status_f16;
34
diff --git a/target/arm/tcg/translate.h b/target/arm/tcg/translate.h
36
index XXXXXXX..XXXXXXX 100644
35
index XXXXXXX..XXXXXXX 100644
37
--- a/target/arm/helper.c
36
--- a/target/arm/tcg/translate.h
38
+++ b/target/arm/helper.c
37
+++ b/target/arm/tcg/translate.h
39
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo debug_lpae_cp_reginfo[] = {
38
@@ -XXX,XX +XXX,XX @@ static inline CPUARMTBFlags arm_tbflags_from_tb(const TranslationBlock *tb)
40
.access = PL0_R, .type = ARM_CP_CONST|ARM_CP_64BIT, .resetvalue = 0 },
39
* Enum for argument to fpstatus_ptr().
41
};
40
*/
42
41
typedef enum ARMFPStatusFlavour {
43
+/*
42
- FPST_FPCR,
44
+ * Check for traps to RAS registers, which are controlled
43
FPST_A32,
45
+ * by HCR_EL2.TERR and SCR_EL3.TERR.
44
FPST_A64,
46
+ */
45
FPST_FPCR_F16,
47
+static CPAccessResult access_terr(CPUARMState *env, const ARMCPRegInfo *ri,
46
@@ -XXX,XX +XXX,XX @@ typedef enum ARMFPStatusFlavour {
48
+ bool isread)
47
* been set up to point to the requested field in the CPU state struct.
49
+{
48
* The options are:
50
+ int el = arm_current_el(env);
49
*
51
+
50
- * FPST_FPCR
52
+ if (el < 2 && (arm_hcr_el2_eff(env) & HCR_TERR)) {
51
- * for non-FP16 operations controlled by the FPCR
53
+ return CP_ACCESS_TRAP_EL2;
52
* FPST_A32
54
+ }
53
* for AArch32 non-FP16 operations controlled by the FPCR
55
+ if (el < 3 && (env->cp15.scr_el3 & SCR_TERR)) {
54
* FPST_A64
56
+ return CP_ACCESS_TRAP_EL3;
55
@@ -XXX,XX +XXX,XX @@ static inline TCGv_ptr fpstatus_ptr(ARMFPStatusFlavour flavour)
57
+ }
56
int offset;
58
+ return CP_ACCESS_OK;
57
59
+}
58
switch (flavour) {
60
+
59
- case FPST_FPCR:
61
+static uint64_t disr_read(CPUARMState *env, const ARMCPRegInfo *ri)
60
- offset = offsetof(CPUARMState, vfp.fp_status);
62
+{
61
- break;
63
+ int el = arm_current_el(env);
62
case FPST_A32:
64
+
63
offset = offsetof(CPUARMState, vfp.fp_status_a32);
65
+ if (el < 2 && (arm_hcr_el2_eff(env) & HCR_AMO)) {
64
break;
66
+ return env->cp15.vdisr_el2;
65
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
67
+ }
66
index XXXXXXX..XXXXXXX 100644
68
+ if (el < 3 && (env->cp15.scr_el3 & SCR_EA)) {
67
--- a/target/arm/cpu.c
69
+ return 0; /* RAZ/WI */
68
+++ b/target/arm/cpu.c
70
+ }
69
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_reset_hold(Object *obj, ResetType type)
71
+ return env->cp15.disr_el1;
70
set_flush_inputs_to_zero(1, &env->vfp.standard_fp_status);
72
+}
71
set_default_nan_mode(1, &env->vfp.standard_fp_status);
73
+
72
set_default_nan_mode(1, &env->vfp.standard_fp_status_f16);
74
+static void disr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t val)
73
- arm_set_default_fp_behaviours(&env->vfp.fp_status);
75
+{
74
arm_set_default_fp_behaviours(&env->vfp.fp_status_a32);
76
+ int el = arm_current_el(env);
75
arm_set_default_fp_behaviours(&env->vfp.fp_status_a64);
77
+
76
arm_set_default_fp_behaviours(&env->vfp.standard_fp_status);
78
+ if (el < 2 && (arm_hcr_el2_eff(env) & HCR_AMO)) {
77
diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c
79
+ env->cp15.vdisr_el2 = val;
78
index XXXXXXX..XXXXXXX 100644
80
+ return;
79
--- a/target/arm/vfp_helper.c
81
+ }
80
+++ b/target/arm/vfp_helper.c
82
+ if (el < 3 && (env->cp15.scr_el3 & SCR_EA)) {
81
@@ -XXX,XX +XXX,XX @@ static inline uint32_t vfp_exceptbits_from_host(int host_bits)
83
+ return; /* RAZ/WI */
82
84
+ }
83
static uint32_t vfp_get_fpsr_from_host(CPUARMState *env)
85
+ env->cp15.disr_el1 = val;
84
{
86
+}
85
- uint32_t i;
87
+
86
+ uint32_t i = 0;
88
+/*
87
89
+ * Minimal RAS implementation with no Error Records.
88
- i = get_float_exception_flags(&env->vfp.fp_status);
90
+ * Which means that all of the Error Record registers:
89
i |= get_float_exception_flags(&env->vfp.fp_status_a32);
91
+ * ERXADDR_EL1
90
i |= get_float_exception_flags(&env->vfp.fp_status_a64);
92
+ * ERXCTLR_EL1
91
i |= get_float_exception_flags(&env->vfp.standard_fp_status);
93
+ * ERXFR_EL1
92
@@ -XXX,XX +XXX,XX @@ static void vfp_clear_float_status_exc_flags(CPUARMState *env)
94
+ * ERXMISC0_EL1
93
* values. The caller should have arranged for env->vfp.fpsr to
95
+ * ERXMISC1_EL1
94
* be the architecturally up-to-date exception flag information first.
96
+ * ERXMISC2_EL1
95
*/
97
+ * ERXMISC3_EL1
96
- set_float_exception_flags(0, &env->vfp.fp_status);
98
+ * ERXPFGCDN_EL1 (RASv1p1)
97
set_float_exception_flags(0, &env->vfp.fp_status_a32);
99
+ * ERXPFGCTL_EL1 (RASv1p1)
98
set_float_exception_flags(0, &env->vfp.fp_status_a64);
100
+ * ERXPFGF_EL1 (RASv1p1)
99
set_float_exception_flags(0, &env->vfp.fp_status_f16);
101
+ * ERXSTATUS_EL1
100
@@ -XXX,XX +XXX,XX @@ static void vfp_set_fpcr_to_host(CPUARMState *env, uint32_t val, uint32_t mask)
102
+ * and
101
i = float_round_to_zero;
103
+ * ERRSELR_EL1
102
break;
104
+ * may generate UNDEFINED, which is the effect we get by not
103
}
105
+ * listing them at all.
104
- set_float_rounding_mode(i, &env->vfp.fp_status);
106
+ */
105
set_float_rounding_mode(i, &env->vfp.fp_status_a32);
107
+static const ARMCPRegInfo minimal_ras_reginfo[] = {
106
set_float_rounding_mode(i, &env->vfp.fp_status_a64);
108
+ { .name = "DISR_EL1", .state = ARM_CP_STATE_BOTH,
107
set_float_rounding_mode(i, &env->vfp.fp_status_f16);
109
+ .opc0 = 3, .opc1 = 0, .crn = 12, .crm = 1, .opc2 = 1,
108
@@ -XXX,XX +XXX,XX @@ static void vfp_set_fpcr_to_host(CPUARMState *env, uint32_t val, uint32_t mask)
110
+ .access = PL1_RW, .fieldoffset = offsetof(CPUARMState, cp15.disr_el1),
111
+ .readfn = disr_read, .writefn = disr_write, .raw_writefn = raw_write },
112
+ { .name = "ERRIDR_EL1", .state = ARM_CP_STATE_BOTH,
113
+ .opc0 = 3, .opc1 = 0, .crn = 5, .crm = 3, .opc2 = 0,
114
+ .access = PL1_R, .accessfn = access_terr,
115
+ .type = ARM_CP_CONST, .resetvalue = 0 },
116
+ { .name = "VDISR_EL2", .state = ARM_CP_STATE_BOTH,
117
+ .opc0 = 3, .opc1 = 4, .crn = 12, .crm = 1, .opc2 = 1,
118
+ .access = PL2_RW, .fieldoffset = offsetof(CPUARMState, cp15.vdisr_el2) },
119
+ { .name = "VSESR_EL2", .state = ARM_CP_STATE_BOTH,
120
+ .opc0 = 3, .opc1 = 4, .crn = 5, .crm = 2, .opc2 = 3,
121
+ .access = PL2_RW, .fieldoffset = offsetof(CPUARMState, cp15.vsesr_el2) },
122
+};
123
+
124
/* Return the exception level to which exceptions should be taken
125
* via SVEAccessTrap. If an exception should be routed through
126
* AArch64.AdvSIMDFPAccessTrap, return 0; fp_exception_el should
127
@@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu)
128
if (cpu_isar_feature(aa64_ssbs, cpu)) {
129
define_one_arm_cp_reg(cpu, &ssbs_reginfo);
130
}
109
}
131
+ if (cpu_isar_feature(any_ras, cpu)) {
110
if (changed & FPCR_FZ) {
132
+ define_arm_cp_regs(cpu, minimal_ras_reginfo);
111
bool ftz_enabled = val & FPCR_FZ;
133
+ }
112
- set_flush_to_zero(ftz_enabled, &env->vfp.fp_status);
134
113
- set_flush_inputs_to_zero(ftz_enabled, &env->vfp.fp_status);
135
if (cpu_isar_feature(aa64_vh, cpu) ||
114
set_flush_to_zero(ftz_enabled, &env->vfp.fp_status_a32);
136
cpu_isar_feature(aa64_debugv8p2, cpu)) {
115
set_flush_inputs_to_zero(ftz_enabled, &env->vfp.fp_status_a32);
116
set_flush_to_zero(ftz_enabled, &env->vfp.fp_status_a64);
117
@@ -XXX,XX +XXX,XX @@ static void vfp_set_fpcr_to_host(CPUARMState *env, uint32_t val, uint32_t mask)
118
}
119
if (changed & FPCR_DN) {
120
bool dnan_enabled = val & FPCR_DN;
121
- set_default_nan_mode(dnan_enabled, &env->vfp.fp_status);
122
set_default_nan_mode(dnan_enabled, &env->vfp.fp_status_a32);
123
set_default_nan_mode(dnan_enabled, &env->vfp.fp_status_a64);
124
set_default_nan_mode(dnan_enabled, &env->vfp.fp_status_f16);
137
--
125
--
138
2.25.1
126
2.34.1
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
As the first part of splitting the existing fp_status_f16
2
into separate float_status fields for AArch32 and AArch64
3
(so that we can make FEAT_AFP control bits apply only
4
for AArch64), define the two new fp_status_f16_a32 and
5
fp_status_f16_a64 fields, but don't use them yet.
2
6
3
Virtual SError exceptions are raised by setting HCR_EL2.VSE,
4
and are routed to EL1 just like other virtual exceptions.
5
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20220506180242.216785-16-richard.henderson@linaro.org
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20250124162836.2332150-14-peter.maydell@linaro.org
10
---
10
---
11
target/arm/cpu.h | 2 ++
11
target/arm/cpu.h | 4 ++++
12
target/arm/internals.h | 8 ++++++++
12
target/arm/tcg/translate.h | 12 ++++++++++++
13
target/arm/syndrome.h | 5 +++++
13
target/arm/cpu.c | 2 ++
14
target/arm/cpu.c | 38 +++++++++++++++++++++++++++++++++++++-
14
target/arm/vfp_helper.c | 14 ++++++++++++++
15
target/arm/helper.c | 40 +++++++++++++++++++++++++++++++++++++++-
15
4 files changed, 32 insertions(+)
16
5 files changed, 91 insertions(+), 2 deletions(-)
17
16
18
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
17
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
19
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
20
--- a/target/arm/cpu.h
19
--- a/target/arm/cpu.h
21
+++ b/target/arm/cpu.h
20
+++ b/target/arm/cpu.h
22
@@ -XXX,XX +XXX,XX @@
21
@@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState {
23
#define EXCP_LSERR 21 /* v8M LSERR SecureFault */
22
* fp_status_a32: is the "normal" fp status for AArch32 insns
24
#define EXCP_UNALIGNED 22 /* v7M UNALIGNED UsageFault */
23
* fp_status_a64: is the "normal" fp status for AArch64 insns
25
#define EXCP_DIVBYZERO 23 /* v7M DIVBYZERO UsageFault */
24
* fp_status_fp16: used for half-precision calculations
26
+#define EXCP_VSERR 24
25
+ * fp_status_fp16_a32: used for AArch32 half-precision calculations
27
/* NB: add new EXCP_ defines to the array in arm_log_exception() too */
26
+ * fp_status_fp16_a64: used for AArch64 half-precision calculations
28
27
* standard_fp_status : the ARM "Standard FPSCR Value"
29
#define ARMV7M_EXCP_RESET 1
28
* standard_fp_status_fp16 : used for half-precision
30
@@ -XXX,XX +XXX,XX @@ enum {
29
* calculations with the ARM "Standard FPSCR Value"
31
#define CPU_INTERRUPT_FIQ CPU_INTERRUPT_TGT_EXT_1
30
@@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState {
32
#define CPU_INTERRUPT_VIRQ CPU_INTERRUPT_TGT_EXT_2
31
float_status fp_status_a32;
33
#define CPU_INTERRUPT_VFIQ CPU_INTERRUPT_TGT_EXT_3
32
float_status fp_status_a64;
34
+#define CPU_INTERRUPT_VSERR CPU_INTERRUPT_TGT_INT_0
33
float_status fp_status_f16;
35
34
+ float_status fp_status_f16_a32;
36
/* The usual mapping for an AArch64 system register to its AArch32
35
+ float_status fp_status_f16_a64;
37
* counterpart is for the 32 bit world to have access to the lower
36
float_status standard_fp_status;
38
diff --git a/target/arm/internals.h b/target/arm/internals.h
37
float_status standard_fp_status_f16;
38
39
diff --git a/target/arm/tcg/translate.h b/target/arm/tcg/translate.h
39
index XXXXXXX..XXXXXXX 100644
40
index XXXXXXX..XXXXXXX 100644
40
--- a/target/arm/internals.h
41
--- a/target/arm/tcg/translate.h
41
+++ b/target/arm/internals.h
42
+++ b/target/arm/tcg/translate.h
42
@@ -XXX,XX +XXX,XX @@ void arm_cpu_update_virq(ARMCPU *cpu);
43
@@ -XXX,XX +XXX,XX @@ typedef enum ARMFPStatusFlavour {
43
*/
44
FPST_A32,
44
void arm_cpu_update_vfiq(ARMCPU *cpu);
45
FPST_A64,
45
46
FPST_FPCR_F16,
46
+/**
47
+ FPST_A32_F16,
47
+ * arm_cpu_update_vserr: Update CPU_INTERRUPT_VSERR bit
48
+ FPST_A64_F16,
48
+ *
49
FPST_STD,
49
+ * Update the CPU_INTERRUPT_VSERR bit in cs->interrupt_request,
50
FPST_STD_F16,
50
+ * following a change to the HCR_EL2.VSE bit.
51
} ARMFPStatusFlavour;
51
+ */
52
@@ -XXX,XX +XXX,XX @@ typedef enum ARMFPStatusFlavour {
52
+void arm_cpu_update_vserr(ARMCPU *cpu);
53
* for AArch64 non-FP16 operations controlled by the FPCR
53
+
54
* FPST_FPCR_F16
54
/**
55
* for operations controlled by the FPCR where FPCR.FZ16 is to be used
55
* arm_mmu_idx_el:
56
+ * FPST_A32_F16
56
* @env: The cpu environment
57
+ * for AArch32 operations controlled by the FPCR where FPCR.FZ16 is to be used
57
diff --git a/target/arm/syndrome.h b/target/arm/syndrome.h
58
+ * FPST_A64_F16
58
index XXXXXXX..XXXXXXX 100644
59
+ * for AArch64 operations controlled by the FPCR where FPCR.FZ16 is to be used
59
--- a/target/arm/syndrome.h
60
* FPST_STD
60
+++ b/target/arm/syndrome.h
61
* for A32/T32 Neon operations using the "standard FPSCR value"
61
@@ -XXX,XX +XXX,XX @@ static inline uint32_t syn_pcalignment(void)
62
* FPST_STD_F16
62
return (EC_PCALIGNMENT << ARM_EL_EC_SHIFT) | ARM_EL_IL;
63
@@ -XXX,XX +XXX,XX @@ static inline TCGv_ptr fpstatus_ptr(ARMFPStatusFlavour flavour)
63
}
64
case FPST_FPCR_F16:
64
65
offset = offsetof(CPUARMState, vfp.fp_status_f16);
65
+static inline uint32_t syn_serror(uint32_t extra)
66
break;
66
+{
67
+ case FPST_A32_F16:
67
+ return (EC_SERROR << ARM_EL_EC_SHIFT) | ARM_EL_IL | extra;
68
+ offset = offsetof(CPUARMState, vfp.fp_status_f16_a32);
68
+}
69
+ break;
69
+
70
+ case FPST_A64_F16:
70
#endif /* TARGET_ARM_SYNDROME_H */
71
+ offset = offsetof(CPUARMState, vfp.fp_status_f16_a64);
72
+ break;
73
case FPST_STD:
74
offset = offsetof(CPUARMState, vfp.standard_fp_status);
75
break;
71
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
76
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
72
index XXXXXXX..XXXXXXX 100644
77
index XXXXXXX..XXXXXXX 100644
73
--- a/target/arm/cpu.c
78
--- a/target/arm/cpu.c
74
+++ b/target/arm/cpu.c
79
+++ b/target/arm/cpu.c
75
@@ -XXX,XX +XXX,XX @@ static bool arm_cpu_has_work(CPUState *cs)
80
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_reset_hold(Object *obj, ResetType type)
76
return (cpu->power_state != PSCI_OFF)
81
arm_set_default_fp_behaviours(&env->vfp.fp_status_a64);
77
&& cs->interrupt_request &
82
arm_set_default_fp_behaviours(&env->vfp.standard_fp_status);
78
(CPU_INTERRUPT_FIQ | CPU_INTERRUPT_HARD
83
arm_set_default_fp_behaviours(&env->vfp.fp_status_f16);
79
- | CPU_INTERRUPT_VFIQ | CPU_INTERRUPT_VIRQ
84
+ arm_set_default_fp_behaviours(&env->vfp.fp_status_f16_a32);
80
+ | CPU_INTERRUPT_VFIQ | CPU_INTERRUPT_VIRQ | CPU_INTERRUPT_VSERR
85
+ arm_set_default_fp_behaviours(&env->vfp.fp_status_f16_a64);
81
| CPU_INTERRUPT_EXITTB);
86
arm_set_default_fp_behaviours(&env->vfp.standard_fp_status_f16);
87
88
#ifndef CONFIG_USER_ONLY
89
diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c
90
index XXXXXXX..XXXXXXX 100644
91
--- a/target/arm/vfp_helper.c
92
+++ b/target/arm/vfp_helper.c
93
@@ -XXX,XX +XXX,XX @@ static uint32_t vfp_get_fpsr_from_host(CPUARMState *env)
94
/* FZ16 does not generate an input denormal exception. */
95
i |= (get_float_exception_flags(&env->vfp.fp_status_f16)
96
& ~float_flag_input_denormal);
97
+ i |= (get_float_exception_flags(&env->vfp.fp_status_f16_a32)
98
+ & ~float_flag_input_denormal);
99
+ i |= (get_float_exception_flags(&env->vfp.fp_status_f16_a64)
100
+ & ~float_flag_input_denormal);
101
i |= (get_float_exception_flags(&env->vfp.standard_fp_status_f16)
102
& ~float_flag_input_denormal);
103
return vfp_exceptbits_from_host(i);
104
@@ -XXX,XX +XXX,XX @@ static void vfp_clear_float_status_exc_flags(CPUARMState *env)
105
set_float_exception_flags(0, &env->vfp.fp_status_a32);
106
set_float_exception_flags(0, &env->vfp.fp_status_a64);
107
set_float_exception_flags(0, &env->vfp.fp_status_f16);
108
+ set_float_exception_flags(0, &env->vfp.fp_status_f16_a32);
109
+ set_float_exception_flags(0, &env->vfp.fp_status_f16_a64);
110
set_float_exception_flags(0, &env->vfp.standard_fp_status);
111
set_float_exception_flags(0, &env->vfp.standard_fp_status_f16);
82
}
112
}
83
113
@@ -XXX,XX +XXX,XX @@ static void vfp_set_fpcr_to_host(CPUARMState *env, uint32_t val, uint32_t mask)
84
@@ -XXX,XX +XXX,XX @@ static inline bool arm_excp_unmasked(CPUState *cs, unsigned int excp_idx,
114
set_float_rounding_mode(i, &env->vfp.fp_status_a32);
85
return false;
115
set_float_rounding_mode(i, &env->vfp.fp_status_a64);
86
}
116
set_float_rounding_mode(i, &env->vfp.fp_status_f16);
87
return !(env->daif & PSTATE_I);
117
+ set_float_rounding_mode(i, &env->vfp.fp_status_f16_a32);
88
+ case EXCP_VSERR:
118
+ set_float_rounding_mode(i, &env->vfp.fp_status_f16_a64);
89
+ if (!(hcr_el2 & HCR_AMO) || (hcr_el2 & HCR_TGE)) {
90
+ /* VIRQs are only taken when hypervized. */
91
+ return false;
92
+ }
93
+ return !(env->daif & PSTATE_A);
94
default:
95
g_assert_not_reached();
96
}
119
}
97
@@ -XXX,XX +XXX,XX @@ static bool arm_cpu_exec_interrupt(CPUState *cs, int interrupt_request)
120
if (changed & FPCR_FZ16) {
98
goto found;
121
bool ftz_enabled = val & FPCR_FZ16;
99
}
122
set_flush_to_zero(ftz_enabled, &env->vfp.fp_status_f16);
123
+ set_flush_to_zero(ftz_enabled, &env->vfp.fp_status_f16_a32);
124
+ set_flush_to_zero(ftz_enabled, &env->vfp.fp_status_f16_a64);
125
set_flush_to_zero(ftz_enabled, &env->vfp.standard_fp_status_f16);
126
set_flush_inputs_to_zero(ftz_enabled, &env->vfp.fp_status_f16);
127
+ set_flush_inputs_to_zero(ftz_enabled, &env->vfp.fp_status_f16_a32);
128
+ set_flush_inputs_to_zero(ftz_enabled, &env->vfp.fp_status_f16_a64);
129
set_flush_inputs_to_zero(ftz_enabled, &env->vfp.standard_fp_status_f16);
100
}
130
}
101
+ if (interrupt_request & CPU_INTERRUPT_VSERR) {
131
if (changed & FPCR_FZ) {
102
+ excp_idx = EXCP_VSERR;
132
@@ -XXX,XX +XXX,XX @@ static void vfp_set_fpcr_to_host(CPUARMState *env, uint32_t val, uint32_t mask)
103
+ target_el = 1;
133
set_default_nan_mode(dnan_enabled, &env->vfp.fp_status_a32);
104
+ if (arm_excp_unmasked(cs, excp_idx, target_el,
134
set_default_nan_mode(dnan_enabled, &env->vfp.fp_status_a64);
105
+ cur_el, secure, hcr_el2)) {
135
set_default_nan_mode(dnan_enabled, &env->vfp.fp_status_f16);
106
+ /* Taking a virtual abort clears HCR_EL2.VSE */
136
+ set_default_nan_mode(dnan_enabled, &env->vfp.fp_status_f16_a32);
107
+ env->cp15.hcr_el2 &= ~HCR_VSE;
137
+ set_default_nan_mode(dnan_enabled, &env->vfp.fp_status_f16_a64);
108
+ cpu_reset_interrupt(cs, CPU_INTERRUPT_VSERR);
109
+ goto found;
110
+ }
111
+ }
112
return false;
113
114
found:
115
@@ -XXX,XX +XXX,XX @@ void arm_cpu_update_vfiq(ARMCPU *cpu)
116
}
138
}
117
}
139
}
118
140
119
+void arm_cpu_update_vserr(ARMCPU *cpu)
120
+{
121
+ /*
122
+ * Update the interrupt level for VSERR, which is the HCR_EL2.VSE bit.
123
+ */
124
+ CPUARMState *env = &cpu->env;
125
+ CPUState *cs = CPU(cpu);
126
+
127
+ bool new_state = env->cp15.hcr_el2 & HCR_VSE;
128
+
129
+ if (new_state != ((cs->interrupt_request & CPU_INTERRUPT_VSERR) != 0)) {
130
+ if (new_state) {
131
+ cpu_interrupt(cs, CPU_INTERRUPT_VSERR);
132
+ } else {
133
+ cpu_reset_interrupt(cs, CPU_INTERRUPT_VSERR);
134
+ }
135
+ }
136
+}
137
+
138
#ifndef CONFIG_USER_ONLY
139
static void arm_cpu_set_irq(void *opaque, int irq, int level)
140
{
141
diff --git a/target/arm/helper.c b/target/arm/helper.c
142
index XXXXXXX..XXXXXXX 100644
143
--- a/target/arm/helper.c
144
+++ b/target/arm/helper.c
145
@@ -XXX,XX +XXX,XX @@ static uint64_t isr_read(CPUARMState *env, const ARMCPRegInfo *ri)
146
}
147
}
148
149
- /* External aborts are not possible in QEMU so A bit is always clear */
150
+ if (hcr_el2 & HCR_AMO) {
151
+ if (cs->interrupt_request & CPU_INTERRUPT_VSERR) {
152
+ ret |= CPSR_A;
153
+ }
154
+ }
155
+
156
return ret;
157
}
158
159
@@ -XXX,XX +XXX,XX @@ static void do_hcr_write(CPUARMState *env, uint64_t value, uint64_t valid_mask)
160
g_assert(qemu_mutex_iothread_locked());
161
arm_cpu_update_virq(cpu);
162
arm_cpu_update_vfiq(cpu);
163
+ arm_cpu_update_vserr(cpu);
164
}
165
166
static void hcr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value)
167
@@ -XXX,XX +XXX,XX @@ void arm_log_exception(CPUState *cs)
168
[EXCP_LSERR] = "v8M LSERR UsageFault",
169
[EXCP_UNALIGNED] = "v7M UNALIGNED UsageFault",
170
[EXCP_DIVBYZERO] = "v7M DIVBYZERO UsageFault",
171
+ [EXCP_VSERR] = "Virtual SERR",
172
};
173
174
if (idx >= 0 && idx < ARRAY_SIZE(excnames)) {
175
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_do_interrupt_aarch32(CPUState *cs)
176
mask = CPSR_A | CPSR_I | CPSR_F;
177
offset = 4;
178
break;
179
+ case EXCP_VSERR:
180
+ {
181
+ /*
182
+ * Note that this is reported as a data abort, but the DFAR
183
+ * has an UNKNOWN value. Construct the SError syndrome from
184
+ * AET and ExT fields.
185
+ */
186
+ ARMMMUFaultInfo fi = { .type = ARMFault_AsyncExternal, };
187
+
188
+ if (extended_addresses_enabled(env)) {
189
+ env->exception.fsr = arm_fi_to_lfsc(&fi);
190
+ } else {
191
+ env->exception.fsr = arm_fi_to_sfsc(&fi);
192
+ }
193
+ env->exception.fsr |= env->cp15.vsesr_el2 & 0xd000;
194
+ A32_BANKED_CURRENT_REG_SET(env, dfsr, env->exception.fsr);
195
+ qemu_log_mask(CPU_LOG_INT, "...with IFSR 0x%x\n",
196
+ env->exception.fsr);
197
+
198
+ new_mode = ARM_CPU_MODE_ABT;
199
+ addr = 0x10;
200
+ mask = CPSR_A | CPSR_I;
201
+ offset = 8;
202
+ }
203
+ break;
204
case EXCP_SMC:
205
new_mode = ARM_CPU_MODE_MON;
206
addr = 0x08;
207
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_do_interrupt_aarch64(CPUState *cs)
208
case EXCP_VFIQ:
209
addr += 0x100;
210
break;
211
+ case EXCP_VSERR:
212
+ addr += 0x180;
213
+ /* Construct the SError syndrome from IDS and ISS fields. */
214
+ env->exception.syndrome = syn_serror(env->cp15.vsesr_el2 & 0x1ffffff);
215
+ env->cp15.esr_el[new_el] = env->exception.syndrome;
216
+ break;
217
default:
218
cpu_abort(cs, "Unhandled exception 0x%x\n", cs->exception_index);
219
}
220
--
141
--
221
2.25.1
142
2.34.1
diff view generated by jsdifflib
1
From: Gavin Shan <gshan@redhat.com>
1
We directly use fp_status_f16 in a handful of helpers that
2
are AArch32-specific; switch to fp_status_f16_a32 for these.
2
3
3
When CPU-to-NUMA association isn't explicitly provided by users,
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
the default one is given by mc->get_default_cpu_node_id(). However,
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
the CPU topology isn't fully considered in the default association
6
Message-id: 20250124162836.2332150-15-peter.maydell@linaro.org
6
and this causes CPU topology broken warnings on booting Linux guest.
7
---
8
target/arm/tcg/vec_helper.c | 4 ++--
9
target/arm/vfp_helper.c | 2 +-
10
2 files changed, 3 insertions(+), 3 deletions(-)
7
11
8
For example, the following warning messages are observed when the
12
diff --git a/target/arm/tcg/vec_helper.c b/target/arm/tcg/vec_helper.c
9
Linux guest is booted with the following command lines.
10
11
/home/gavin/sandbox/qemu.main/build/qemu-system-aarch64 \
12
-accel kvm -machine virt,gic-version=host \
13
-cpu host \
14
-smp 6,sockets=2,cores=3,threads=1 \
15
-m 1024M,slots=16,maxmem=64G \
16
-object memory-backend-ram,id=mem0,size=128M \
17
-object memory-backend-ram,id=mem1,size=128M \
18
-object memory-backend-ram,id=mem2,size=128M \
19
-object memory-backend-ram,id=mem3,size=128M \
20
-object memory-backend-ram,id=mem4,size=128M \
21
-object memory-backend-ram,id=mem4,size=384M \
22
-numa node,nodeid=0,memdev=mem0 \
23
-numa node,nodeid=1,memdev=mem1 \
24
-numa node,nodeid=2,memdev=mem2 \
25
-numa node,nodeid=3,memdev=mem3 \
26
-numa node,nodeid=4,memdev=mem4 \
27
-numa node,nodeid=5,memdev=mem5
28
:
29
alternatives: patching kernel code
30
BUG: arch topology borken
31
the CLS domain not a subset of the MC domain
32
<the above error log repeats>
33
BUG: arch topology borken
34
the DIE domain not a subset of the NODE domain
35
36
With current implementation of mc->get_default_cpu_node_id(),
37
CPU#0 to CPU#5 are associated with NODE#0 to NODE#5 separately.
38
That's incorrect because CPU#0/1/2 should be associated with same
39
NUMA node because they're seated in same socket.
40
41
This fixes the issue by considering the socket ID when the default
42
CPU-to-NUMA association is provided in virt_possible_cpu_arch_ids().
43
With this applied, no more CPU topology broken warnings are seen
44
from the Linux guest. The 6 CPUs are associated with NODE#0/1, but
45
there are no CPUs associated with NODE#2/3/4/5.
46
47
Signed-off-by: Gavin Shan <gshan@redhat.com>
48
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
49
Reviewed-by: Yanan Wang <wangyanan55@huawei.com>
50
Message-id: 20220503140304.855514-6-gshan@redhat.com
51
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
52
---
53
hw/arm/virt.c | 4 +++-
54
1 file changed, 3 insertions(+), 1 deletion(-)
55
56
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
57
index XXXXXXX..XXXXXXX 100644
13
index XXXXXXX..XXXXXXX 100644
58
--- a/hw/arm/virt.c
14
--- a/target/arm/tcg/vec_helper.c
59
+++ b/hw/arm/virt.c
15
+++ b/target/arm/tcg/vec_helper.c
60
@@ -XXX,XX +XXX,XX @@ virt_cpu_index_to_props(MachineState *ms, unsigned cpu_index)
16
@@ -XXX,XX +XXX,XX @@ void HELPER(gvec_fmlal_a32)(void *vd, void *vn, void *vm,
61
17
CPUARMState *env, uint32_t desc)
62
static int64_t virt_get_default_cpu_node_id(const MachineState *ms, int idx)
63
{
18
{
64
- return idx % ms->numa_state->num_nodes;
19
do_fmlal(vd, vn, vm, &env->vfp.standard_fp_status, desc,
65
+ int64_t socket_id = ms->possible_cpus->cpus[idx].props.socket_id;
20
- get_flush_inputs_to_zero(&env->vfp.fp_status_f16));
66
+
21
+ get_flush_inputs_to_zero(&env->vfp.fp_status_f16_a32));
67
+ return socket_id % ms->numa_state->num_nodes;
68
}
22
}
69
23
70
static const CPUArchIdList *virt_possible_cpu_arch_ids(MachineState *ms)
24
void HELPER(gvec_fmlal_a64)(void *vd, void *vn, void *vm,
25
@@ -XXX,XX +XXX,XX @@ void HELPER(gvec_fmlal_idx_a32)(void *vd, void *vn, void *vm,
26
CPUARMState *env, uint32_t desc)
27
{
28
do_fmlal_idx(vd, vn, vm, &env->vfp.standard_fp_status, desc,
29
- get_flush_inputs_to_zero(&env->vfp.fp_status_f16));
30
+ get_flush_inputs_to_zero(&env->vfp.fp_status_f16_a32));
31
}
32
33
void HELPER(gvec_fmlal_idx_a64)(void *vd, void *vn, void *vm,
34
diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c
35
index XXXXXXX..XXXXXXX 100644
36
--- a/target/arm/vfp_helper.c
37
+++ b/target/arm/vfp_helper.c
38
@@ -XXX,XX +XXX,XX @@ void VFP_HELPER(cmpe, P)(ARGTYPE a, ARGTYPE b, CPUARMState *env) \
39
softfloat_to_vfp_compare(env, \
40
FLOATTYPE ## _compare(a, b, &env->vfp.FPST)); \
41
}
42
-DO_VFP_cmp(h, float16, dh_ctype_f16, fp_status_f16)
43
+DO_VFP_cmp(h, float16, dh_ctype_f16, fp_status_f16_a32)
44
DO_VFP_cmp(s, float32, float32, fp_status_a32)
45
DO_VFP_cmp(d, float64, float64, fp_status_a32)
46
#undef DO_VFP_cmp
71
--
47
--
72
2.25.1
48
2.34.1
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
We directly use fp_status_f16 in a handful of helpers that are
2
AArch64-specific; switch to fp_status_f16_a64 for these.
2
3
3
This feature is AArch64 only, and applies to physical SErrors,
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
which QEMU does not implement, thus the feature is a nop.
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Message-id: 20250124162836.2332150-16-peter.maydell@linaro.org
7
---
8
target/arm/tcg/sme_helper.c | 4 ++--
9
target/arm/tcg/vec_helper.c | 8 ++++----
10
2 files changed, 6 insertions(+), 6 deletions(-)
5
11
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
12
diff --git a/target/arm/tcg/sme_helper.c b/target/arm/tcg/sme_helper.c
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20220506180242.216785-19-richard.henderson@linaro.org
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
docs/system/arm/emulation.rst | 1 +
12
target/arm/cpu64.c | 1 +
13
2 files changed, 2 insertions(+)
14
15
diff --git a/docs/system/arm/emulation.rst b/docs/system/arm/emulation.rst
16
index XXXXXXX..XXXXXXX 100644
13
index XXXXXXX..XXXXXXX 100644
17
--- a/docs/system/arm/emulation.rst
14
--- a/target/arm/tcg/sme_helper.c
18
+++ b/docs/system/arm/emulation.rst
15
+++ b/target/arm/tcg/sme_helper.c
19
@@ -XXX,XX +XXX,XX @@ the following architecture extensions:
16
@@ -XXX,XX +XXX,XX @@ void HELPER(sme_fmopa_h)(void *vza, void *vzn, void *vzm, void *vpn,
20
- FEAT_FlagM2 (Enhancements to flag manipulation instructions)
17
float_status fpst_odd, fpst_std, fpst_f16;
21
- FEAT_HPDS (Hierarchical permission disables)
18
22
- FEAT_I8MM (AArch64 Int8 matrix multiplication instructions)
19
/*
23
+- FEAT_IESB (Implicit error synchronization event)
20
- * Make copies of fp_status and fp_status_f16, because this operation
24
- FEAT_JSCVT (JavaScript conversion instructions)
21
+ * Make copies of the fp status fields we use, because this operation
25
- FEAT_LOR (Limited ordering regions)
22
* does not update the cumulative fp exception status. It also
26
- FEAT_LPA (Large Physical Address space)
23
* produces default NaNs. We also need a second copy of fp_status with
27
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
24
* round-to-odd -- see above.
25
*/
26
- fpst_f16 = env->vfp.fp_status_f16;
27
+ fpst_f16 = env->vfp.fp_status_f16_a64;
28
fpst_std = env->vfp.fp_status_a64;
29
set_default_nan_mode(true, &fpst_std);
30
set_default_nan_mode(true, &fpst_f16);
31
diff --git a/target/arm/tcg/vec_helper.c b/target/arm/tcg/vec_helper.c
28
index XXXXXXX..XXXXXXX 100644
32
index XXXXXXX..XXXXXXX 100644
29
--- a/target/arm/cpu64.c
33
--- a/target/arm/tcg/vec_helper.c
30
+++ b/target/arm/cpu64.c
34
+++ b/target/arm/tcg/vec_helper.c
31
@@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj)
35
@@ -XXX,XX +XXX,XX @@ void HELPER(gvec_fmlal_a64)(void *vd, void *vn, void *vm,
32
t = cpu->isar.id_aa64mmfr2;
36
CPUARMState *env, uint32_t desc)
33
t = FIELD_DP64(t, ID_AA64MMFR2, CNP, 1); /* FEAT_TTCNP */
37
{
34
t = FIELD_DP64(t, ID_AA64MMFR2, UAO, 1); /* FEAT_UAO */
38
do_fmlal(vd, vn, vm, &env->vfp.fp_status_a64, desc,
35
+ t = FIELD_DP64(t, ID_AA64MMFR2, IESB, 1); /* FEAT_IESB */
39
- get_flush_inputs_to_zero(&env->vfp.fp_status_f16));
36
t = FIELD_DP64(t, ID_AA64MMFR2, VARANGE, 1); /* FEAT_LVA */
40
+ get_flush_inputs_to_zero(&env->vfp.fp_status_f16_a64));
37
t = FIELD_DP64(t, ID_AA64MMFR2, ST, 1); /* FEAT_TTST */
41
}
38
t = FIELD_DP64(t, ID_AA64MMFR2, TTL, 1); /* FEAT_TTL */
42
43
void HELPER(sve2_fmlal_zzzw_s)(void *vd, void *vn, void *vm, void *va,
44
@@ -XXX,XX +XXX,XX @@ void HELPER(sve2_fmlal_zzzw_s)(void *vd, void *vn, void *vm, void *va,
45
uint16_t negn = extract32(desc, SIMD_DATA_SHIFT, 1) << 15;
46
intptr_t sel = extract32(desc, SIMD_DATA_SHIFT + 1, 1) * sizeof(float16);
47
float_status *status = &env->vfp.fp_status_a64;
48
- bool fz16 = get_flush_inputs_to_zero(&env->vfp.fp_status_f16);
49
+ bool fz16 = get_flush_inputs_to_zero(&env->vfp.fp_status_f16_a64);
50
51
for (i = 0; i < oprsz; i += sizeof(float32)) {
52
float16 nn_16 = *(float16 *)(vn + H1_2(i + sel)) ^ negn;
53
@@ -XXX,XX +XXX,XX @@ void HELPER(gvec_fmlal_idx_a64)(void *vd, void *vn, void *vm,
54
CPUARMState *env, uint32_t desc)
55
{
56
do_fmlal_idx(vd, vn, vm, &env->vfp.fp_status_a64, desc,
57
- get_flush_inputs_to_zero(&env->vfp.fp_status_f16));
58
+ get_flush_inputs_to_zero(&env->vfp.fp_status_f16_a64));
59
}
60
61
void HELPER(sve2_fmlal_zzxw_s)(void *vd, void *vn, void *vm, void *va,
62
@@ -XXX,XX +XXX,XX @@ void HELPER(sve2_fmlal_zzxw_s)(void *vd, void *vn, void *vm, void *va,
63
intptr_t sel = extract32(desc, SIMD_DATA_SHIFT + 1, 1) * sizeof(float16);
64
intptr_t idx = extract32(desc, SIMD_DATA_SHIFT + 2, 3) * sizeof(float16);
65
float_status *status = &env->vfp.fp_status_a64;
66
- bool fz16 = get_flush_inputs_to_zero(&env->vfp.fp_status_f16);
67
+ bool fz16 = get_flush_inputs_to_zero(&env->vfp.fp_status_f16_a64);
68
69
for (i = 0; i < oprsz; i += 16) {
70
float16 mm_16 = *(float16 *)(vm + i + idx);
39
--
71
--
40
2.25.1
72
2.34.1
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
In the A32 decoder, use FPST_A32_F16 rather than FPST_FPCR_F16.
2
By doing an automated conversion of the whole file we avoid possibly
3
using more than one fpst value in a set_rmode/op/restore_rmode
4
sequence.
2
5
3
Instead of starting with cortex-a15 and adding v8 features to
6
Patch created with
4
a v7 cpu, begin with a v8 cpu stripped of its aarch64 features.
7
perl -p -i -e 's/FPST_FPCR_F16(?!_)/FPST_A32_F16/g' target/arm/tcg/translate-vfp.c
5
This fixes the long-standing to-do where we only enabled v8
6
features for user-only.
7
8
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
10
Message-id: 20220506180242.216785-7-richard.henderson@linaro.org
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
11
Message-id: 20250124162836.2332150-17-peter.maydell@linaro.org
12
---
12
---
13
target/arm/cpu_tcg.c | 151 ++++++++++++++++++++++++++-----------------
13
target/arm/tcg/translate-vfp.c | 24 ++++++++++++------------
14
1 file changed, 92 insertions(+), 59 deletions(-)
14
1 file changed, 12 insertions(+), 12 deletions(-)
15
15
16
diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c
16
diff --git a/target/arm/tcg/translate-vfp.c b/target/arm/tcg/translate-vfp.c
17
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
18
--- a/target/arm/cpu_tcg.c
18
--- a/target/arm/tcg/translate-vfp.c
19
+++ b/target/arm/cpu_tcg.c
19
+++ b/target/arm/tcg/translate-vfp.c
20
@@ -XXX,XX +XXX,XX @@ static void arm_v7m_class_init(ObjectClass *oc, void *data)
20
@@ -XXX,XX +XXX,XX @@ static bool trans_VRINT(DisasContext *s, arg_VRINT *a)
21
static void arm_max_initfn(Object *obj)
21
}
22
23
if (sz == 1) {
24
- fpst = fpstatus_ptr(FPST_FPCR_F16);
25
+ fpst = fpstatus_ptr(FPST_A32_F16);
26
} else {
27
fpst = fpstatus_ptr(FPST_A32);
28
}
29
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT(DisasContext *s, arg_VCVT *a)
30
}
31
32
if (sz == 1) {
33
- fpst = fpstatus_ptr(FPST_FPCR_F16);
34
+ fpst = fpstatus_ptr(FPST_A32_F16);
35
} else {
36
fpst = fpstatus_ptr(FPST_A32);
37
}
38
@@ -XXX,XX +XXX,XX @@ static bool do_vfp_3op_hp(DisasContext *s, VFPGen3OpSPFn *fn,
39
/*
40
* Do a half-precision operation. Functionally this is
41
* the same as do_vfp_3op_sp(), except:
42
- * - it uses the FPST_FPCR_F16
43
+ * - it uses the FPST_A32_F16
44
* - it doesn't need the VFP vector handling (fp16 is a
45
* v8 feature, and in v8 VFP vectors don't exist)
46
* - it does the aa32_fp16_arith feature test
47
@@ -XXX,XX +XXX,XX @@ static bool do_vfp_3op_hp(DisasContext *s, VFPGen3OpSPFn *fn,
48
f0 = tcg_temp_new_i32();
49
f1 = tcg_temp_new_i32();
50
fd = tcg_temp_new_i32();
51
- fpst = fpstatus_ptr(FPST_FPCR_F16);
52
+ fpst = fpstatus_ptr(FPST_A32_F16);
53
54
vfp_load_reg16(f0, vn);
55
vfp_load_reg16(f1, vm);
56
@@ -XXX,XX +XXX,XX @@ static bool do_vfm_hp(DisasContext *s, arg_VFMA_sp *a, bool neg_n, bool neg_d)
57
/* VFNMA, VFNMS */
58
gen_vfp_negh(vd, vd);
59
}
60
- fpst = fpstatus_ptr(FPST_FPCR_F16);
61
+ fpst = fpstatus_ptr(FPST_A32_F16);
62
gen_helper_vfp_muladdh(vd, vn, vm, vd, fpst);
63
vfp_store_reg32(vd, a->vd);
64
return true;
65
@@ -XXX,XX +XXX,XX @@ DO_VFP_2OP(VNEG, dp, gen_vfp_negd, aa32_fpdp_v2)
66
67
static void gen_VSQRT_hp(TCGv_i32 vd, TCGv_i32 vm)
22
{
68
{
23
ARMCPU *cpu = ARM_CPU(obj);
69
- gen_helper_vfp_sqrth(vd, vm, fpstatus_ptr(FPST_FPCR_F16));
24
+ uint32_t t;
70
+ gen_helper_vfp_sqrth(vd, vm, fpstatus_ptr(FPST_A32_F16));
25
26
- cortex_a15_initfn(obj);
27
+ /* aarch64_a57_initfn, advertising none of the aarch64 features */
28
+ cpu->dtb_compatible = "arm,cortex-a57";
29
+ set_feature(&cpu->env, ARM_FEATURE_V8);
30
+ set_feature(&cpu->env, ARM_FEATURE_NEON);
31
+ set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER);
32
+ set_feature(&cpu->env, ARM_FEATURE_CBAR_RO);
33
+ set_feature(&cpu->env, ARM_FEATURE_EL2);
34
+ set_feature(&cpu->env, ARM_FEATURE_EL3);
35
+ set_feature(&cpu->env, ARM_FEATURE_PMU);
36
+ cpu->midr = 0x411fd070;
37
+ cpu->revidr = 0x00000000;
38
+ cpu->reset_fpsid = 0x41034070;
39
+ cpu->isar.mvfr0 = 0x10110222;
40
+ cpu->isar.mvfr1 = 0x12111111;
41
+ cpu->isar.mvfr2 = 0x00000043;
42
+ cpu->ctr = 0x8444c004;
43
+ cpu->reset_sctlr = 0x00c50838;
44
+ cpu->isar.id_pfr0 = 0x00000131;
45
+ cpu->isar.id_pfr1 = 0x00011011;
46
+ cpu->isar.id_dfr0 = 0x03010066;
47
+ cpu->id_afr0 = 0x00000000;
48
+ cpu->isar.id_mmfr0 = 0x10101105;
49
+ cpu->isar.id_mmfr1 = 0x40000000;
50
+ cpu->isar.id_mmfr2 = 0x01260000;
51
+ cpu->isar.id_mmfr3 = 0x02102211;
52
+ cpu->isar.id_isar0 = 0x02101110;
53
+ cpu->isar.id_isar1 = 0x13112111;
54
+ cpu->isar.id_isar2 = 0x21232042;
55
+ cpu->isar.id_isar3 = 0x01112131;
56
+ cpu->isar.id_isar4 = 0x00011142;
57
+ cpu->isar.id_isar5 = 0x00011121;
58
+ cpu->isar.id_isar6 = 0;
59
+ cpu->isar.dbgdidr = 0x3516d000;
60
+ cpu->clidr = 0x0a200023;
61
+ cpu->ccsidr[0] = 0x701fe00a; /* 32KB L1 dcache */
62
+ cpu->ccsidr[1] = 0x201fe012; /* 48KB L1 icache */
63
+ cpu->ccsidr[2] = 0x70ffe07a; /* 2048KB L2 cache */
64
+ define_cortex_a72_a57_a53_cp_reginfo(cpu);
65
66
- /* old-style VFP short-vector support */
67
- cpu->isar.mvfr0 = FIELD_DP32(cpu->isar.mvfr0, MVFR0, FPSHVEC, 1);
68
+ /* Add additional features supported by QEMU */
69
+ t = cpu->isar.id_isar5;
70
+ t = FIELD_DP32(t, ID_ISAR5, AES, 2);
71
+ t = FIELD_DP32(t, ID_ISAR5, SHA1, 1);
72
+ t = FIELD_DP32(t, ID_ISAR5, SHA2, 1);
73
+ t = FIELD_DP32(t, ID_ISAR5, CRC32, 1);
74
+ t = FIELD_DP32(t, ID_ISAR5, RDM, 1);
75
+ t = FIELD_DP32(t, ID_ISAR5, VCMA, 1);
76
+ cpu->isar.id_isar5 = t;
77
+
78
+ t = cpu->isar.id_isar6;
79
+ t = FIELD_DP32(t, ID_ISAR6, JSCVT, 1);
80
+ t = FIELD_DP32(t, ID_ISAR6, DP, 1);
81
+ t = FIELD_DP32(t, ID_ISAR6, FHM, 1);
82
+ t = FIELD_DP32(t, ID_ISAR6, SB, 1);
83
+ t = FIELD_DP32(t, ID_ISAR6, SPECRES, 1);
84
+ t = FIELD_DP32(t, ID_ISAR6, BF16, 1);
85
+ t = FIELD_DP32(t, ID_ISAR6, I8MM, 1);
86
+ cpu->isar.id_isar6 = t;
87
+
88
+ t = cpu->isar.mvfr1;
89
+ t = FIELD_DP32(t, MVFR1, FPHP, 3); /* v8.2-FP16 */
90
+ t = FIELD_DP32(t, MVFR1, SIMDHP, 2); /* v8.2-FP16 */
91
+ cpu->isar.mvfr1 = t;
92
+
93
+ t = cpu->isar.mvfr2;
94
+ t = FIELD_DP32(t, MVFR2, SIMDMISC, 3); /* SIMD MaxNum */
95
+ t = FIELD_DP32(t, MVFR2, FPMISC, 4); /* FP MaxNum */
96
+ cpu->isar.mvfr2 = t;
97
+
98
+ t = cpu->isar.id_mmfr3;
99
+ t = FIELD_DP32(t, ID_MMFR3, PAN, 2); /* ATS1E1 */
100
+ cpu->isar.id_mmfr3 = t;
101
+
102
+ t = cpu->isar.id_mmfr4;
103
+ t = FIELD_DP32(t, ID_MMFR4, HPDS, 1); /* AA32HPD */
104
+ t = FIELD_DP32(t, ID_MMFR4, AC2, 1); /* ACTLR2, HACTLR2 */
105
+ t = FIELD_DP32(t, ID_MMFR4, CNP, 1); /* TTCNP */
106
+ t = FIELD_DP32(t, ID_MMFR4, XNX, 1); /* TTS2UXN */
107
+ cpu->isar.id_mmfr4 = t;
108
+
109
+ t = cpu->isar.id_pfr0;
110
+ t = FIELD_DP32(t, ID_PFR0, DIT, 1);
111
+ cpu->isar.id_pfr0 = t;
112
+
113
+ t = cpu->isar.id_pfr2;
114
+ t = FIELD_DP32(t, ID_PFR2, SSBS, 1);
115
+ cpu->isar.id_pfr2 = t;
116
117
#ifdef CONFIG_USER_ONLY
118
/*
119
- * We don't set these in system emulation mode for the moment,
120
- * since we don't correctly set (all of) the ID registers to
121
- * advertise them.
122
+ * Break with true ARMv8 and add back old-style VFP short-vector support.
123
+ * Only do this for user-mode, where -cpu max is the default, so that
124
+ * older v6 and v7 programs are more likely to work without adjustment.
125
*/
126
- set_feature(&cpu->env, ARM_FEATURE_V8);
127
- {
128
- uint32_t t;
129
-
130
- t = cpu->isar.id_isar5;
131
- t = FIELD_DP32(t, ID_ISAR5, AES, 2);
132
- t = FIELD_DP32(t, ID_ISAR5, SHA1, 1);
133
- t = FIELD_DP32(t, ID_ISAR5, SHA2, 1);
134
- t = FIELD_DP32(t, ID_ISAR5, CRC32, 1);
135
- t = FIELD_DP32(t, ID_ISAR5, RDM, 1);
136
- t = FIELD_DP32(t, ID_ISAR5, VCMA, 1);
137
- cpu->isar.id_isar5 = t;
138
-
139
- t = cpu->isar.id_isar6;
140
- t = FIELD_DP32(t, ID_ISAR6, JSCVT, 1);
141
- t = FIELD_DP32(t, ID_ISAR6, DP, 1);
142
- t = FIELD_DP32(t, ID_ISAR6, FHM, 1);
143
- t = FIELD_DP32(t, ID_ISAR6, SB, 1);
144
- t = FIELD_DP32(t, ID_ISAR6, SPECRES, 1);
145
- t = FIELD_DP32(t, ID_ISAR6, BF16, 1);
146
- t = FIELD_DP32(t, ID_ISAR6, I8MM, 1);
147
- cpu->isar.id_isar6 = t;
148
-
149
- t = cpu->isar.mvfr1;
150
- t = FIELD_DP32(t, MVFR1, FPHP, 3); /* v8.2-FP16 */
151
- t = FIELD_DP32(t, MVFR1, SIMDHP, 2); /* v8.2-FP16 */
152
- cpu->isar.mvfr1 = t;
153
-
154
- t = cpu->isar.mvfr2;
155
- t = FIELD_DP32(t, MVFR2, SIMDMISC, 3); /* SIMD MaxNum */
156
- t = FIELD_DP32(t, MVFR2, FPMISC, 4); /* FP MaxNum */
157
- cpu->isar.mvfr2 = t;
158
-
159
- t = cpu->isar.id_mmfr3;
160
- t = FIELD_DP32(t, ID_MMFR3, PAN, 2); /* ATS1E1 */
161
- cpu->isar.id_mmfr3 = t;
162
-
163
- t = cpu->isar.id_mmfr4;
164
- t = FIELD_DP32(t, ID_MMFR4, HPDS, 1); /* AA32HPD */
165
- t = FIELD_DP32(t, ID_MMFR4, AC2, 1); /* ACTLR2, HACTLR2 */
166
- t = FIELD_DP32(t, ID_MMFR4, CNP, 1); /* TTCNP */
167
- t = FIELD_DP32(t, ID_MMFR4, XNX, 1); /* TTS2UXN */
168
- cpu->isar.id_mmfr4 = t;
169
-
170
- t = cpu->isar.id_pfr0;
171
- t = FIELD_DP32(t, ID_PFR0, DIT, 1);
172
- cpu->isar.id_pfr0 = t;
173
-
174
- t = cpu->isar.id_pfr2;
175
- t = FIELD_DP32(t, ID_PFR2, SSBS, 1);
176
- cpu->isar.id_pfr2 = t;
177
- }
178
-#endif /* CONFIG_USER_ONLY */
179
+ cpu->isar.mvfr0 = FIELD_DP32(cpu->isar.mvfr0, MVFR0, FPSHVEC, 1);
180
+#endif
181
}
71
}
182
#endif /* !TARGET_AARCH64 */
72
73
static void gen_VSQRT_sp(TCGv_i32 vd, TCGv_i32 vm)
74
@@ -XXX,XX +XXX,XX @@ static bool trans_VRINTR_hp(DisasContext *s, arg_VRINTR_sp *a)
75
76
tmp = tcg_temp_new_i32();
77
vfp_load_reg16(tmp, a->vm);
78
- fpst = fpstatus_ptr(FPST_FPCR_F16);
79
+ fpst = fpstatus_ptr(FPST_A32_F16);
80
gen_helper_rinth(tmp, tmp, fpst);
81
vfp_store_reg32(tmp, a->vd);
82
return true;
83
@@ -XXX,XX +XXX,XX @@ static bool trans_VRINTZ_hp(DisasContext *s, arg_VRINTZ_sp *a)
84
85
tmp = tcg_temp_new_i32();
86
vfp_load_reg16(tmp, a->vm);
87
- fpst = fpstatus_ptr(FPST_FPCR_F16);
88
+ fpst = fpstatus_ptr(FPST_A32_F16);
89
tcg_rmode = gen_set_rmode(FPROUNDING_ZERO, fpst);
90
gen_helper_rinth(tmp, tmp, fpst);
91
gen_restore_rmode(tcg_rmode, fpst);
92
@@ -XXX,XX +XXX,XX @@ static bool trans_VRINTX_hp(DisasContext *s, arg_VRINTX_sp *a)
93
94
tmp = tcg_temp_new_i32();
95
vfp_load_reg16(tmp, a->vm);
96
- fpst = fpstatus_ptr(FPST_FPCR_F16);
97
+ fpst = fpstatus_ptr(FPST_A32_F16);
98
gen_helper_rinth_exact(tmp, tmp, fpst);
99
vfp_store_reg32(tmp, a->vd);
100
return true;
101
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_int_hp(DisasContext *s, arg_VCVT_int_sp *a)
102
103
vm = tcg_temp_new_i32();
104
vfp_load_reg32(vm, a->vm);
105
- fpst = fpstatus_ptr(FPST_FPCR_F16);
106
+ fpst = fpstatus_ptr(FPST_A32_F16);
107
if (a->s) {
108
/* i32 -> f16 */
109
gen_helper_vfp_sitoh(vm, vm, fpst);
110
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_fix_hp(DisasContext *s, arg_VCVT_fix_sp *a)
111
vd = tcg_temp_new_i32();
112
vfp_load_reg32(vd, a->vd);
113
114
- fpst = fpstatus_ptr(FPST_FPCR_F16);
115
+ fpst = fpstatus_ptr(FPST_A32_F16);
116
shift = tcg_constant_i32(frac_bits);
117
118
/* Switch on op:U:sx bits */
119
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT_hp_int(DisasContext *s, arg_VCVT_sp_int *a)
120
return true;
121
}
122
123
- fpst = fpstatus_ptr(FPST_FPCR_F16);
124
+ fpst = fpstatus_ptr(FPST_A32_F16);
125
vm = tcg_temp_new_i32();
126
vfp_load_reg16(vm, a->vm);
183
127
184
--
128
--
185
2.25.1
129
2.34.1
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
In the A32 decoder, use FPST_A64_F16 rather than FPST_FPCR_F16.
2
By doing an automated conversion of the whole file we avoid possibly
3
using more than one fpst value in a set_rmode/op/restore_rmode
4
sequence.
2
5
3
Previously we were defining some of these in user-only mode,
6
Patch created with
4
but none of them are accessible from user-only, therefore
7
perl -p -i -e 's/FPST_FPCR_F16(?!_)/FPST_A64_F16/g' target/arm/tcg/translate-{a64,sve,sme}.c
5
define them only in system mode.
6
8
7
This will shortly be used from cpu_tcg.c also.
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
11
Message-id: 20250124162836.2332150-18-peter.maydell@linaro.org
12
---
13
target/arm/tcg/translate-a64.c | 32 ++++++++---------
14
target/arm/tcg/translate-sve.c | 66 +++++++++++++++++-----------------
15
2 files changed, 49 insertions(+), 49 deletions(-)
8
16
9
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
17
diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c
10
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
11
Message-id: 20220506180242.216785-6-richard.henderson@linaro.org
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
14
target/arm/internals.h | 6 ++++
15
target/arm/cpu64.c | 64 +++---------------------------------------
16
target/arm/cpu_tcg.c | 59 ++++++++++++++++++++++++++++++++++++++
17
3 files changed, 69 insertions(+), 60 deletions(-)
18
19
diff --git a/target/arm/internals.h b/target/arm/internals.h
20
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
21
--- a/target/arm/internals.h
19
--- a/target/arm/tcg/translate-a64.c
22
+++ b/target/arm/internals.h
20
+++ b/target/arm/tcg/translate-a64.c
23
@@ -XXX,XX +XXX,XX @@ int aarch64_fpu_gdb_get_reg(CPUARMState *env, GByteArray *buf, int reg);
21
@@ -XXX,XX +XXX,XX @@ static void gen_gvec_op3_fpst(DisasContext *s, bool is_q, int rd, int rn,
24
int aarch64_fpu_gdb_set_reg(CPUARMState *env, uint8_t *buf, int reg);
22
int rm, bool is_fp16, int data,
25
#endif
23
gen_helper_gvec_3_ptr *fn)
26
24
{
27
+#ifdef CONFIG_USER_ONLY
25
- TCGv_ptr fpst = fpstatus_ptr(is_fp16 ? FPST_FPCR_F16 : FPST_A64);
28
+static inline void define_cortex_a72_a57_a53_cp_reginfo(ARMCPU *cpu) { }
26
+ TCGv_ptr fpst = fpstatus_ptr(is_fp16 ? FPST_A64_F16 : FPST_A64);
29
+#else
27
tcg_gen_gvec_3_ptr(vec_full_reg_offset(s, rd),
30
+void define_cortex_a72_a57_a53_cp_reginfo(ARMCPU *cpu);
28
vec_full_reg_offset(s, rn),
31
+#endif
29
vec_full_reg_offset(s, rm), fpst,
32
+
30
@@ -XXX,XX +XXX,XX @@ static void gen_gvec_op4_fpst(DisasContext *s, bool is_q, int rd, int rn,
33
#endif
31
int rm, int ra, bool is_fp16, int data,
34
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
32
gen_helper_gvec_4_ptr *fn)
33
{
34
- TCGv_ptr fpst = fpstatus_ptr(is_fp16 ? FPST_FPCR_F16 : FPST_A64);
35
+ TCGv_ptr fpst = fpstatus_ptr(is_fp16 ? FPST_A64_F16 : FPST_A64);
36
tcg_gen_gvec_4_ptr(vec_full_reg_offset(s, rd),
37
vec_full_reg_offset(s, rn),
38
vec_full_reg_offset(s, rm),
39
@@ -XXX,XX +XXX,XX @@ static bool do_fp3_scalar(DisasContext *s, arg_rrr_e *a, const FPScalar *f)
40
if (fp_access_check(s)) {
41
TCGv_i32 t0 = read_fp_hreg(s, a->rn);
42
TCGv_i32 t1 = read_fp_hreg(s, a->rm);
43
- f->gen_h(t0, t0, t1, fpstatus_ptr(FPST_FPCR_F16));
44
+ f->gen_h(t0, t0, t1, fpstatus_ptr(FPST_A64_F16));
45
write_fp_sreg(s, a->rd, t0);
46
}
47
break;
48
@@ -XXX,XX +XXX,XX @@ static bool do_fcmp0_s(DisasContext *s, arg_rr_e *a,
49
TCGv_i32 t0 = read_fp_hreg(s, a->rn);
50
TCGv_i32 t1 = tcg_constant_i32(0);
51
if (swap) {
52
- f->gen_h(t0, t1, t0, fpstatus_ptr(FPST_FPCR_F16));
53
+ f->gen_h(t0, t1, t0, fpstatus_ptr(FPST_A64_F16));
54
} else {
55
- f->gen_h(t0, t0, t1, fpstatus_ptr(FPST_FPCR_F16));
56
+ f->gen_h(t0, t0, t1, fpstatus_ptr(FPST_A64_F16));
57
}
58
write_fp_sreg(s, a->rd, t0);
59
}
60
@@ -XXX,XX +XXX,XX @@ static bool do_fp3_scalar_idx(DisasContext *s, arg_rrx_e *a, const FPScalar *f)
61
TCGv_i32 t1 = tcg_temp_new_i32();
62
63
read_vec_element_i32(s, t1, a->rm, a->idx, MO_16);
64
- f->gen_h(t0, t0, t1, fpstatus_ptr(FPST_FPCR_F16));
65
+ f->gen_h(t0, t0, t1, fpstatus_ptr(FPST_A64_F16));
66
write_fp_sreg(s, a->rd, t0);
67
}
68
break;
69
@@ -XXX,XX +XXX,XX @@ static bool do_fmla_scalar_idx(DisasContext *s, arg_rrx_e *a, bool neg)
70
gen_vfp_negh(t1, t1);
71
}
72
gen_helper_advsimd_muladdh(t0, t1, t2, t0,
73
- fpstatus_ptr(FPST_FPCR_F16));
74
+ fpstatus_ptr(FPST_A64_F16));
75
write_fp_sreg(s, a->rd, t0);
76
}
77
break;
78
@@ -XXX,XX +XXX,XX @@ static bool do_fp3_scalar_pair(DisasContext *s, arg_rr_e *a, const FPScalar *f)
79
80
read_vec_element_i32(s, t0, a->rn, 0, MO_16);
81
read_vec_element_i32(s, t1, a->rn, 1, MO_16);
82
- f->gen_h(t0, t0, t1, fpstatus_ptr(FPST_FPCR_F16));
83
+ f->gen_h(t0, t0, t1, fpstatus_ptr(FPST_A64_F16));
84
write_fp_sreg(s, a->rd, t0);
85
}
86
break;
87
@@ -XXX,XX +XXX,XX @@ static bool do_fmadd(DisasContext *s, arg_rrrr_e *a, bool neg_a, bool neg_n)
88
if (neg_n) {
89
gen_vfp_negh(tn, tn);
90
}
91
- fpst = fpstatus_ptr(FPST_FPCR_F16);
92
+ fpst = fpstatus_ptr(FPST_A64_F16);
93
gen_helper_advsimd_muladdh(ta, tn, tm, ta, fpst);
94
write_fp_sreg(s, a->rd, ta);
95
}
96
@@ -XXX,XX +XXX,XX @@ static bool do_fp_reduction(DisasContext *s, arg_qrr_e *a,
97
if (fp_access_check(s)) {
98
MemOp esz = a->esz;
99
int elts = (a->q ? 16 : 8) >> esz;
100
- TCGv_ptr fpst = fpstatus_ptr(esz == MO_16 ? FPST_FPCR_F16 : FPST_A64);
101
+ TCGv_ptr fpst = fpstatus_ptr(esz == MO_16 ? FPST_A64_F16 : FPST_A64);
102
TCGv_i32 res = do_reduction_op(s, a->rn, esz, 0, elts, fpst, fn);
103
write_fp_sreg(s, a->rd, res);
104
}
105
@@ -XXX,XX +XXX,XX @@ static void handle_fp_compare(DisasContext *s, int size,
106
bool cmp_with_zero, bool signal_all_nans)
107
{
108
TCGv_i64 tcg_flags = tcg_temp_new_i64();
109
- TCGv_ptr fpst = fpstatus_ptr(size == MO_16 ? FPST_FPCR_F16 : FPST_A64);
110
+ TCGv_ptr fpst = fpstatus_ptr(size == MO_16 ? FPST_A64_F16 : FPST_A64);
111
112
if (size == MO_64) {
113
TCGv_i64 tcg_vn, tcg_vm;
114
@@ -XXX,XX +XXX,XX @@ static bool do_fp1_scalar(DisasContext *s, arg_rr_e *a,
115
return check == 0;
116
}
117
118
- fpst = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_A64);
119
+ fpst = fpstatus_ptr(a->esz == MO_16 ? FPST_A64_F16 : FPST_A64);
120
if (rmode >= 0) {
121
tcg_rmode = gen_set_rmode(rmode, fpst);
122
}
123
@@ -XXX,XX +XXX,XX @@ static bool do_cvtf_scalar(DisasContext *s, MemOp esz, int rd, int shift,
124
TCGv_i32 tcg_shift, tcg_single;
125
TCGv_i64 tcg_double;
126
127
- tcg_fpstatus = fpstatus_ptr(esz == MO_16 ? FPST_FPCR_F16 : FPST_A64);
128
+ tcg_fpstatus = fpstatus_ptr(esz == MO_16 ? FPST_A64_F16 : FPST_A64);
129
tcg_shift = tcg_constant_i32(shift);
130
131
switch (esz) {
132
@@ -XXX,XX +XXX,XX @@ static void do_fcvt_scalar(DisasContext *s, MemOp out, MemOp esz,
133
TCGv_ptr tcg_fpstatus;
134
TCGv_i32 tcg_shift, tcg_rmode, tcg_single;
135
136
- tcg_fpstatus = fpstatus_ptr(esz == MO_16 ? FPST_FPCR_F16 : FPST_A64);
137
+ tcg_fpstatus = fpstatus_ptr(esz == MO_16 ? FPST_A64_F16 : FPST_A64);
138
tcg_shift = tcg_constant_i32(shift);
139
tcg_rmode = gen_set_rmode(rmode, tcg_fpstatus);
140
141
@@ -XXX,XX +XXX,XX @@ static bool do_fp1_vector(DisasContext *s, arg_qrr_e *a,
142
return check == 0;
143
}
144
145
- fpst = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_A64);
146
+ fpst = fpstatus_ptr(a->esz == MO_16 ? FPST_A64_F16 : FPST_A64);
147
if (rmode >= 0) {
148
tcg_rmode = gen_set_rmode(rmode, fpst);
149
}
150
@@ -XXX,XX +XXX,XX @@ static bool do_gvec_op2_fpst(DisasContext *s, MemOp esz, bool is_q,
151
return check == 0;
152
}
153
154
- fpst = fpstatus_ptr(esz == MO_16 ? FPST_FPCR_F16 : FPST_A64);
155
+ fpst = fpstatus_ptr(esz == MO_16 ? FPST_A64_F16 : FPST_A64);
156
tcg_gen_gvec_2_ptr(vec_full_reg_offset(s, rd),
157
vec_full_reg_offset(s, rn), fpst,
158
is_q ? 16 : 8, vec_full_reg_size(s),
159
diff --git a/target/arm/tcg/translate-sve.c b/target/arm/tcg/translate-sve.c
35
index XXXXXXX..XXXXXXX 100644
160
index XXXXXXX..XXXXXXX 100644
36
--- a/target/arm/cpu64.c
161
--- a/target/arm/tcg/translate-sve.c
37
+++ b/target/arm/cpu64.c
162
+++ b/target/arm/tcg/translate-sve.c
38
@@ -XXX,XX +XXX,XX @@
163
@@ -XXX,XX +XXX,XX @@ static bool gen_gvec_fpst_arg_zz(DisasContext *s, gen_helper_gvec_2_ptr *fn,
39
#include "hvf_arm.h"
164
arg_rr_esz *a, int data)
40
#include "qapi/visitor.h"
165
{
41
#include "hw/qdev-properties.h"
166
return gen_gvec_fpst_zz(s, fn, a->rd, a->rn, data,
42
-#include "cpregs.h"
167
- a->esz == MO_16 ? FPST_FPCR_F16 : FPST_A64);
43
+#include "internals.h"
168
+ a->esz == MO_16 ? FPST_A64_F16 : FPST_A64);
44
45
46
-#ifndef CONFIG_USER_ONLY
47
-static uint64_t a57_a53_l2ctlr_read(CPUARMState *env, const ARMCPRegInfo *ri)
48
-{
49
- ARMCPU *cpu = env_archcpu(env);
50
-
51
- /* Number of cores is in [25:24]; otherwise we RAZ */
52
- return (cpu->core_count - 1) << 24;
53
-}
54
-#endif
55
-
56
-static const ARMCPRegInfo cortex_a72_a57_a53_cp_reginfo[] = {
57
-#ifndef CONFIG_USER_ONLY
58
- { .name = "L2CTLR_EL1", .state = ARM_CP_STATE_AA64,
59
- .opc0 = 3, .opc1 = 1, .crn = 11, .crm = 0, .opc2 = 2,
60
- .access = PL1_RW, .readfn = a57_a53_l2ctlr_read,
61
- .writefn = arm_cp_write_ignore },
62
- { .name = "L2CTLR",
63
- .cp = 15, .opc1 = 1, .crn = 9, .crm = 0, .opc2 = 2,
64
- .access = PL1_RW, .readfn = a57_a53_l2ctlr_read,
65
- .writefn = arm_cp_write_ignore },
66
-#endif
67
- { .name = "L2ECTLR_EL1", .state = ARM_CP_STATE_AA64,
68
- .opc0 = 3, .opc1 = 1, .crn = 11, .crm = 0, .opc2 = 3,
69
- .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
70
- { .name = "L2ECTLR",
71
- .cp = 15, .opc1 = 1, .crn = 9, .crm = 0, .opc2 = 3,
72
- .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
73
- { .name = "L2ACTLR", .state = ARM_CP_STATE_BOTH,
74
- .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 0, .opc2 = 0,
75
- .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
76
- { .name = "CPUACTLR_EL1", .state = ARM_CP_STATE_AA64,
77
- .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 2, .opc2 = 0,
78
- .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
79
- { .name = "CPUACTLR",
80
- .cp = 15, .opc1 = 0, .crm = 15,
81
- .access = PL1_RW, .type = ARM_CP_CONST | ARM_CP_64BIT, .resetvalue = 0 },
82
- { .name = "CPUECTLR_EL1", .state = ARM_CP_STATE_AA64,
83
- .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 2, .opc2 = 1,
84
- .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
85
- { .name = "CPUECTLR",
86
- .cp = 15, .opc1 = 1, .crm = 15,
87
- .access = PL1_RW, .type = ARM_CP_CONST | ARM_CP_64BIT, .resetvalue = 0 },
88
- { .name = "CPUMERRSR_EL1", .state = ARM_CP_STATE_AA64,
89
- .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 2, .opc2 = 2,
90
- .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
91
- { .name = "CPUMERRSR",
92
- .cp = 15, .opc1 = 2, .crm = 15,
93
- .access = PL1_RW, .type = ARM_CP_CONST | ARM_CP_64BIT, .resetvalue = 0 },
94
- { .name = "L2MERRSR_EL1", .state = ARM_CP_STATE_AA64,
95
- .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 2, .opc2 = 3,
96
- .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
97
- { .name = "L2MERRSR",
98
- .cp = 15, .opc1 = 3, .crm = 15,
99
- .access = PL1_RW, .type = ARM_CP_CONST | ARM_CP_64BIT, .resetvalue = 0 },
100
-};
101
-
102
static void aarch64_a57_initfn(Object *obj)
103
{
104
ARMCPU *cpu = ARM_CPU(obj);
105
@@ -XXX,XX +XXX,XX @@ static void aarch64_a57_initfn(Object *obj)
106
cpu->gic_num_lrs = 4;
107
cpu->gic_vpribits = 5;
108
cpu->gic_vprebits = 5;
109
- define_arm_cp_regs(cpu, cortex_a72_a57_a53_cp_reginfo);
110
+ define_cortex_a72_a57_a53_cp_reginfo(cpu);
111
}
169
}
112
170
113
static void aarch64_a53_initfn(Object *obj)
171
/* Invoke an out-of-line helper on 3 Zregs. */
114
@@ -XXX,XX +XXX,XX @@ static void aarch64_a53_initfn(Object *obj)
172
@@ -XXX,XX +XXX,XX @@ static bool gen_gvec_fpst_arg_zzz(DisasContext *s, gen_helper_gvec_3_ptr *fn,
115
cpu->gic_num_lrs = 4;
173
arg_rrr_esz *a, int data)
116
cpu->gic_vpribits = 5;
174
{
117
cpu->gic_vprebits = 5;
175
return gen_gvec_fpst_zzz(s, fn, a->rd, a->rn, a->rm, data,
118
- define_arm_cp_regs(cpu, cortex_a72_a57_a53_cp_reginfo);
176
- a->esz == MO_16 ? FPST_FPCR_F16 : FPST_A64);
119
+ define_cortex_a72_a57_a53_cp_reginfo(cpu);
177
+ a->esz == MO_16 ? FPST_A64_F16 : FPST_A64);
120
}
178
}
121
179
122
static void aarch64_a72_initfn(Object *obj)
180
/* Invoke an out-of-line helper on 4 Zregs. */
123
@@ -XXX,XX +XXX,XX @@ static void aarch64_a72_initfn(Object *obj)
181
@@ -XXX,XX +XXX,XX @@ static bool gen_gvec_fpst_arg_zpzz(DisasContext *s, gen_helper_gvec_4_ptr *fn,
124
cpu->gic_num_lrs = 4;
182
arg_rprr_esz *a)
125
cpu->gic_vpribits = 5;
183
{
126
cpu->gic_vprebits = 5;
184
return gen_gvec_fpst_zzzp(s, fn, a->rd, a->rn, a->rm, a->pg, 0,
127
- define_arm_cp_regs(cpu, cortex_a72_a57_a53_cp_reginfo);
185
- a->esz == MO_16 ? FPST_FPCR_F16 : FPST_A64);
128
+ define_cortex_a72_a57_a53_cp_reginfo(cpu);
186
+ a->esz == MO_16 ? FPST_A64_F16 : FPST_A64);
129
}
187
}
130
188
131
void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp)
189
/* Invoke a vector expander on two Zregs and an immediate. */
132
diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c
190
@@ -XXX,XX +XXX,XX @@ static bool do_FMLA_zzxz(DisasContext *s, arg_rrxr_esz *a, bool sub)
133
index XXXXXXX..XXXXXXX 100644
191
};
134
--- a/target/arm/cpu_tcg.c
192
return gen_gvec_fpst_zzzz(s, fns[a->esz], a->rd, a->rn, a->rm, a->ra,
135
+++ b/target/arm/cpu_tcg.c
193
(a->index << 1) | sub,
136
@@ -XXX,XX +XXX,XX @@
194
- a->esz == MO_16 ? FPST_FPCR_F16 : FPST_A64);
137
#endif
195
+ a->esz == MO_16 ? FPST_A64_F16 : FPST_A64);
138
#include "cpregs.h"
196
}
139
197
140
+#ifndef CONFIG_USER_ONLY
198
TRANS_FEAT(FMLA_zzxz, aa64_sve, do_FMLA_zzxz, a, false)
141
+static uint64_t l2ctlr_read(CPUARMState *env, const ARMCPRegInfo *ri)
199
@@ -XXX,XX +XXX,XX @@ static gen_helper_gvec_3_ptr * const fmul_idx_fns[4] = {
142
+{
200
};
143
+ ARMCPU *cpu = env_archcpu(env);
201
TRANS_FEAT(FMUL_zzx, aa64_sve, gen_gvec_fpst_zzz,
144
+
202
fmul_idx_fns[a->esz], a->rd, a->rn, a->rm, a->index,
145
+ /* Number of cores is in [25:24]; otherwise we RAZ */
203
- a->esz == MO_16 ? FPST_FPCR_F16 : FPST_A64)
146
+ return (cpu->core_count - 1) << 24;
204
+ a->esz == MO_16 ? FPST_A64_F16 : FPST_A64)
147
+}
205
148
+
206
/*
149
+static const ARMCPRegInfo cortex_a72_a57_a53_cp_reginfo[] = {
207
*** SVE Floating Point Fast Reduction Group
150
+ { .name = "L2CTLR_EL1", .state = ARM_CP_STATE_AA64,
208
@@ -XXX,XX +XXX,XX @@ static bool do_reduce(DisasContext *s, arg_rpr_esz *a,
151
+ .opc0 = 3, .opc1 = 1, .crn = 11, .crm = 0, .opc2 = 2,
209
152
+ .access = PL1_RW, .readfn = l2ctlr_read,
210
tcg_gen_addi_ptr(t_zn, tcg_env, vec_full_reg_offset(s, a->rn));
153
+ .writefn = arm_cp_write_ignore },
211
tcg_gen_addi_ptr(t_pg, tcg_env, pred_full_reg_offset(s, a->pg));
154
+ { .name = "L2CTLR",
212
- status = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_A64);
155
+ .cp = 15, .opc1 = 1, .crn = 9, .crm = 0, .opc2 = 2,
213
+ status = fpstatus_ptr(a->esz == MO_16 ? FPST_A64_F16 : FPST_A64);
156
+ .access = PL1_RW, .readfn = l2ctlr_read,
214
157
+ .writefn = arm_cp_write_ignore },
215
fn(temp, t_zn, t_pg, status, t_desc);
158
+ { .name = "L2ECTLR_EL1", .state = ARM_CP_STATE_AA64,
216
159
+ .opc0 = 3, .opc1 = 1, .crn = 11, .crm = 0, .opc2 = 3,
217
@@ -XXX,XX +XXX,XX @@ static bool do_ppz_fp(DisasContext *s, arg_rpr_esz *a,
160
+ .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
218
if (sve_access_check(s)) {
161
+ { .name = "L2ECTLR",
219
unsigned vsz = vec_full_reg_size(s);
162
+ .cp = 15, .opc1 = 1, .crn = 9, .crm = 0, .opc2 = 3,
220
TCGv_ptr status =
163
+ .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
221
- fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_A64);
164
+ { .name = "L2ACTLR", .state = ARM_CP_STATE_BOTH,
222
+ fpstatus_ptr(a->esz == MO_16 ? FPST_A64_F16 : FPST_A64);
165
+ .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 0, .opc2 = 0,
223
166
+ .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
224
tcg_gen_gvec_3_ptr(pred_full_reg_offset(s, a->rd),
167
+ { .name = "CPUACTLR_EL1", .state = ARM_CP_STATE_AA64,
225
vec_full_reg_offset(s, a->rn),
168
+ .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 2, .opc2 = 0,
226
@@ -XXX,XX +XXX,XX @@ static gen_helper_gvec_3_ptr * const ftmad_fns[4] = {
169
+ .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
227
};
170
+ { .name = "CPUACTLR",
228
TRANS_FEAT_NONSTREAMING(FTMAD, aa64_sve, gen_gvec_fpst_zzz,
171
+ .cp = 15, .opc1 = 0, .crm = 15,
229
ftmad_fns[a->esz], a->rd, a->rn, a->rm, a->imm,
172
+ .access = PL1_RW, .type = ARM_CP_CONST | ARM_CP_64BIT, .resetvalue = 0 },
230
- a->esz == MO_16 ? FPST_FPCR_F16 : FPST_A64)
173
+ { .name = "CPUECTLR_EL1", .state = ARM_CP_STATE_AA64,
231
+ a->esz == MO_16 ? FPST_A64_F16 : FPST_A64)
174
+ .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 2, .opc2 = 1,
232
175
+ .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
233
/*
176
+ { .name = "CPUECTLR",
234
*** SVE Floating Point Accumulating Reduction Group
177
+ .cp = 15, .opc1 = 1, .crm = 15,
235
@@ -XXX,XX +XXX,XX @@ static bool trans_FADDA(DisasContext *s, arg_rprr_esz *a)
178
+ .access = PL1_RW, .type = ARM_CP_CONST | ARM_CP_64BIT, .resetvalue = 0 },
236
t_pg = tcg_temp_new_ptr();
179
+ { .name = "CPUMERRSR_EL1", .state = ARM_CP_STATE_AA64,
237
tcg_gen_addi_ptr(t_rm, tcg_env, vec_full_reg_offset(s, a->rm));
180
+ .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 2, .opc2 = 2,
238
tcg_gen_addi_ptr(t_pg, tcg_env, pred_full_reg_offset(s, a->pg));
181
+ .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
239
- t_fpst = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_A64);
182
+ { .name = "CPUMERRSR",
240
+ t_fpst = fpstatus_ptr(a->esz == MO_16 ? FPST_A64_F16 : FPST_A64);
183
+ .cp = 15, .opc1 = 2, .crm = 15,
241
t_desc = tcg_constant_i32(simd_desc(vsz, vsz, 0));
184
+ .access = PL1_RW, .type = ARM_CP_CONST | ARM_CP_64BIT, .resetvalue = 0 },
242
185
+ { .name = "L2MERRSR_EL1", .state = ARM_CP_STATE_AA64,
243
fns[a->esz - 1](t_val, t_val, t_rm, t_pg, t_fpst, t_desc);
186
+ .opc0 = 3, .opc1 = 1, .crn = 15, .crm = 2, .opc2 = 3,
244
@@ -XXX,XX +XXX,XX @@ static void do_fp_scalar(DisasContext *s, int zd, int zn, int pg, bool is_fp16,
187
+ .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 },
245
tcg_gen_addi_ptr(t_zn, tcg_env, vec_full_reg_offset(s, zn));
188
+ { .name = "L2MERRSR",
246
tcg_gen_addi_ptr(t_pg, tcg_env, pred_full_reg_offset(s, pg));
189
+ .cp = 15, .opc1 = 3, .crm = 15,
247
190
+ .access = PL1_RW, .type = ARM_CP_CONST | ARM_CP_64BIT, .resetvalue = 0 },
248
- status = fpstatus_ptr(is_fp16 ? FPST_FPCR_F16 : FPST_A64);
191
+};
249
+ status = fpstatus_ptr(is_fp16 ? FPST_A64_F16 : FPST_A64);
192
+
250
desc = tcg_constant_i32(simd_desc(vsz, vsz, 0));
193
+void define_cortex_a72_a57_a53_cp_reginfo(ARMCPU *cpu)
251
fn(t_zd, t_zn, t_pg, scalar, status, desc);
194
+{
252
}
195
+ define_arm_cp_regs(cpu, cortex_a72_a57_a53_cp_reginfo);
253
@@ -XXX,XX +XXX,XX @@ static bool do_fp_cmp(DisasContext *s, arg_rprr_esz *a,
196
+}
254
}
197
+#endif /* !CONFIG_USER_ONLY */
255
if (sve_access_check(s)) {
198
+
256
unsigned vsz = vec_full_reg_size(s);
199
/* CPU models. These are not needed for the AArch64 linux-user build. */
257
- TCGv_ptr status = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_A64);
200
#if !defined(CONFIG_USER_ONLY) || !defined(TARGET_AARCH64)
258
+ TCGv_ptr status = fpstatus_ptr(a->esz == MO_16 ? FPST_A64_F16 : FPST_A64);
201
259
tcg_gen_gvec_4_ptr(pred_full_reg_offset(s, a->rd),
260
vec_full_reg_offset(s, a->rn),
261
vec_full_reg_offset(s, a->rm),
262
@@ -XXX,XX +XXX,XX @@ static gen_helper_gvec_4_ptr * const fcadd_fns[] = {
263
};
264
TRANS_FEAT(FCADD, aa64_sve, gen_gvec_fpst_zzzp, fcadd_fns[a->esz],
265
a->rd, a->rn, a->rm, a->pg, a->rot,
266
- a->esz == MO_16 ? FPST_FPCR_F16 : FPST_A64)
267
+ a->esz == MO_16 ? FPST_A64_F16 : FPST_A64)
268
269
#define DO_FMLA(NAME, name) \
270
static gen_helper_gvec_5_ptr * const name##_fns[4] = { \
271
@@ -XXX,XX +XXX,XX @@ TRANS_FEAT(FCADD, aa64_sve, gen_gvec_fpst_zzzp, fcadd_fns[a->esz],
272
}; \
273
TRANS_FEAT(NAME, aa64_sve, gen_gvec_fpst_zzzzp, name##_fns[a->esz], \
274
a->rd, a->rn, a->rm, a->ra, a->pg, 0, \
275
- a->esz == MO_16 ? FPST_FPCR_F16 : FPST_A64)
276
+ a->esz == MO_16 ? FPST_A64_F16 : FPST_A64)
277
278
DO_FMLA(FMLA_zpzzz, fmla_zpzzz)
279
DO_FMLA(FMLS_zpzzz, fmls_zpzzz)
280
@@ -XXX,XX +XXX,XX @@ static gen_helper_gvec_5_ptr * const fcmla_fns[4] = {
281
};
282
TRANS_FEAT(FCMLA_zpzzz, aa64_sve, gen_gvec_fpst_zzzzp, fcmla_fns[a->esz],
283
a->rd, a->rn, a->rm, a->ra, a->pg, a->rot,
284
- a->esz == MO_16 ? FPST_FPCR_F16 : FPST_A64)
285
+ a->esz == MO_16 ? FPST_A64_F16 : FPST_A64)
286
287
static gen_helper_gvec_4_ptr * const fcmla_idx_fns[4] = {
288
NULL, gen_helper_gvec_fcmlah_idx, gen_helper_gvec_fcmlas_idx, NULL
289
};
290
TRANS_FEAT(FCMLA_zzxz, aa64_sve, gen_gvec_fpst_zzzz, fcmla_idx_fns[a->esz],
291
a->rd, a->rn, a->rm, a->ra, a->index * 4 + a->rot,
292
- a->esz == MO_16 ? FPST_FPCR_F16 : FPST_A64)
293
+ a->esz == MO_16 ? FPST_A64_F16 : FPST_A64)
294
295
/*
296
*** SVE Floating Point Unary Operations Predicated Group
297
@@ -XXX,XX +XXX,XX @@ TRANS_FEAT(FCVT_sd, aa64_sve, gen_gvec_fpst_arg_zpz,
298
gen_helper_sve_fcvt_sd, a, 0, FPST_A64)
299
300
TRANS_FEAT(FCVTZS_hh, aa64_sve, gen_gvec_fpst_arg_zpz,
301
- gen_helper_sve_fcvtzs_hh, a, 0, FPST_FPCR_F16)
302
+ gen_helper_sve_fcvtzs_hh, a, 0, FPST_A64_F16)
303
TRANS_FEAT(FCVTZU_hh, aa64_sve, gen_gvec_fpst_arg_zpz,
304
- gen_helper_sve_fcvtzu_hh, a, 0, FPST_FPCR_F16)
305
+ gen_helper_sve_fcvtzu_hh, a, 0, FPST_A64_F16)
306
TRANS_FEAT(FCVTZS_hs, aa64_sve, gen_gvec_fpst_arg_zpz,
307
- gen_helper_sve_fcvtzs_hs, a, 0, FPST_FPCR_F16)
308
+ gen_helper_sve_fcvtzs_hs, a, 0, FPST_A64_F16)
309
TRANS_FEAT(FCVTZU_hs, aa64_sve, gen_gvec_fpst_arg_zpz,
310
- gen_helper_sve_fcvtzu_hs, a, 0, FPST_FPCR_F16)
311
+ gen_helper_sve_fcvtzu_hs, a, 0, FPST_A64_F16)
312
TRANS_FEAT(FCVTZS_hd, aa64_sve, gen_gvec_fpst_arg_zpz,
313
- gen_helper_sve_fcvtzs_hd, a, 0, FPST_FPCR_F16)
314
+ gen_helper_sve_fcvtzs_hd, a, 0, FPST_A64_F16)
315
TRANS_FEAT(FCVTZU_hd, aa64_sve, gen_gvec_fpst_arg_zpz,
316
- gen_helper_sve_fcvtzu_hd, a, 0, FPST_FPCR_F16)
317
+ gen_helper_sve_fcvtzu_hd, a, 0, FPST_A64_F16)
318
319
TRANS_FEAT(FCVTZS_ss, aa64_sve, gen_gvec_fpst_arg_zpz,
320
gen_helper_sve_fcvtzs_ss, a, 0, FPST_A64)
321
@@ -XXX,XX +XXX,XX @@ static gen_helper_gvec_3_ptr * const frint_fns[] = {
322
gen_helper_sve_frint_d
323
};
324
TRANS_FEAT(FRINTI, aa64_sve, gen_gvec_fpst_arg_zpz, frint_fns[a->esz],
325
- a, 0, a->esz == MO_16 ? FPST_FPCR_F16 : FPST_A64)
326
+ a, 0, a->esz == MO_16 ? FPST_A64_F16 : FPST_A64)
327
328
static gen_helper_gvec_3_ptr * const frintx_fns[] = {
329
NULL,
330
@@ -XXX,XX +XXX,XX @@ static gen_helper_gvec_3_ptr * const frintx_fns[] = {
331
gen_helper_sve_frintx_d
332
};
333
TRANS_FEAT(FRINTX, aa64_sve, gen_gvec_fpst_arg_zpz, frintx_fns[a->esz],
334
- a, 0, a->esz == MO_16 ? FPST_FPCR_F16 : FPST_A64);
335
+ a, 0, a->esz == MO_16 ? FPST_A64_F16 : FPST_A64);
336
337
static bool do_frint_mode(DisasContext *s, arg_rpr_esz *a,
338
ARMFPRounding mode, gen_helper_gvec_3_ptr *fn)
339
@@ -XXX,XX +XXX,XX @@ static bool do_frint_mode(DisasContext *s, arg_rpr_esz *a,
340
}
341
342
vsz = vec_full_reg_size(s);
343
- status = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_A64);
344
+ status = fpstatus_ptr(a->esz == MO_16 ? FPST_A64_F16 : FPST_A64);
345
tmode = gen_set_rmode(mode, status);
346
347
tcg_gen_gvec_3_ptr(vec_full_reg_offset(s, a->rd),
348
@@ -XXX,XX +XXX,XX @@ static gen_helper_gvec_3_ptr * const frecpx_fns[] = {
349
gen_helper_sve_frecpx_s, gen_helper_sve_frecpx_d,
350
};
351
TRANS_FEAT(FRECPX, aa64_sve, gen_gvec_fpst_arg_zpz, frecpx_fns[a->esz],
352
- a, 0, a->esz == MO_16 ? FPST_FPCR_F16 : FPST_A64)
353
+ a, 0, a->esz == MO_16 ? FPST_A64_F16 : FPST_A64)
354
355
static gen_helper_gvec_3_ptr * const fsqrt_fns[] = {
356
NULL, gen_helper_sve_fsqrt_h,
357
gen_helper_sve_fsqrt_s, gen_helper_sve_fsqrt_d,
358
};
359
TRANS_FEAT(FSQRT, aa64_sve, gen_gvec_fpst_arg_zpz, fsqrt_fns[a->esz],
360
- a, 0, a->esz == MO_16 ? FPST_FPCR_F16 : FPST_A64)
361
+ a, 0, a->esz == MO_16 ? FPST_A64_F16 : FPST_A64)
362
363
TRANS_FEAT(SCVTF_hh, aa64_sve, gen_gvec_fpst_arg_zpz,
364
- gen_helper_sve_scvt_hh, a, 0, FPST_FPCR_F16)
365
+ gen_helper_sve_scvt_hh, a, 0, FPST_A64_F16)
366
TRANS_FEAT(SCVTF_sh, aa64_sve, gen_gvec_fpst_arg_zpz,
367
- gen_helper_sve_scvt_sh, a, 0, FPST_FPCR_F16)
368
+ gen_helper_sve_scvt_sh, a, 0, FPST_A64_F16)
369
TRANS_FEAT(SCVTF_dh, aa64_sve, gen_gvec_fpst_arg_zpz,
370
- gen_helper_sve_scvt_dh, a, 0, FPST_FPCR_F16)
371
+ gen_helper_sve_scvt_dh, a, 0, FPST_A64_F16)
372
373
TRANS_FEAT(SCVTF_ss, aa64_sve, gen_gvec_fpst_arg_zpz,
374
gen_helper_sve_scvt_ss, a, 0, FPST_A64)
375
@@ -XXX,XX +XXX,XX @@ TRANS_FEAT(SCVTF_dd, aa64_sve, gen_gvec_fpst_arg_zpz,
376
gen_helper_sve_scvt_dd, a, 0, FPST_A64)
377
378
TRANS_FEAT(UCVTF_hh, aa64_sve, gen_gvec_fpst_arg_zpz,
379
- gen_helper_sve_ucvt_hh, a, 0, FPST_FPCR_F16)
380
+ gen_helper_sve_ucvt_hh, a, 0, FPST_A64_F16)
381
TRANS_FEAT(UCVTF_sh, aa64_sve, gen_gvec_fpst_arg_zpz,
382
- gen_helper_sve_ucvt_sh, a, 0, FPST_FPCR_F16)
383
+ gen_helper_sve_ucvt_sh, a, 0, FPST_A64_F16)
384
TRANS_FEAT(UCVTF_dh, aa64_sve, gen_gvec_fpst_arg_zpz,
385
- gen_helper_sve_ucvt_dh, a, 0, FPST_FPCR_F16)
386
+ gen_helper_sve_ucvt_dh, a, 0, FPST_A64_F16)
387
388
TRANS_FEAT(UCVTF_ss, aa64_sve, gen_gvec_fpst_arg_zpz,
389
gen_helper_sve_ucvt_ss, a, 0, FPST_A64)
390
@@ -XXX,XX +XXX,XX @@ static gen_helper_gvec_3_ptr * const flogb_fns[] = {
391
gen_helper_flogb_s, gen_helper_flogb_d
392
};
393
TRANS_FEAT(FLOGB, aa64_sve2, gen_gvec_fpst_arg_zpz, flogb_fns[a->esz],
394
- a, 0, a->esz == MO_16 ? FPST_FPCR_F16 : FPST_A64)
395
+ a, 0, a->esz == MO_16 ? FPST_A64_F16 : FPST_A64)
396
397
static bool do_FMLAL_zzzw(DisasContext *s, arg_rrrr_esz *a, bool sub, bool sel)
398
{
202
--
399
--
203
2.25.1
400
2.34.1
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
Now we have moved all the uses of vfp.fp_status_f16 and FPST_FPCR_F16
2
to the new A32 or A64 fields, we can remove these.
2
3
3
There is no branch prediction in TCG, therefore there is no
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
need to actually include the context number into the predictor.
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
Therefore all we need to do is add the state for SCXTNUM_ELx.
6
Message-id: 20250124162836.2332150-19-peter.maydell@linaro.org
7
---
8
target/arm/cpu.h | 2 --
9
target/arm/tcg/translate.h | 6 ------
10
target/arm/cpu.c | 1 -
11
target/arm/vfp_helper.c | 7 -------
12
4 files changed, 16 deletions(-)
6
13
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20220506180242.216785-21-richard.henderson@linaro.org
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
12
docs/system/arm/emulation.rst | 3 ++
13
target/arm/cpu.h | 16 +++++++++
14
target/arm/cpu.c | 5 +++
15
target/arm/cpu64.c | 3 +-
16
target/arm/helper.c | 61 ++++++++++++++++++++++++++++++++++-
17
5 files changed, 86 insertions(+), 2 deletions(-)
18
19
diff --git a/docs/system/arm/emulation.rst b/docs/system/arm/emulation.rst
20
index XXXXXXX..XXXXXXX 100644
21
--- a/docs/system/arm/emulation.rst
22
+++ b/docs/system/arm/emulation.rst
23
@@ -XXX,XX +XXX,XX @@ the following architecture extensions:
24
- FEAT_BF16 (AArch64 BFloat16 instructions)
25
- FEAT_BTI (Branch Target Identification)
26
- FEAT_CSV2 (Cache speculation variant 2)
27
+- FEAT_CSV2_1p1 (Cache speculation variant 2, version 1.1)
28
+- FEAT_CSV2_1p2 (Cache speculation variant 2, version 1.2)
29
+- FEAT_CSV2_2 (Cache speculation variant 2, version 2)
30
- FEAT_DIT (Data Independent Timing instructions)
31
- FEAT_DPB (DC CVAP instruction)
32
- FEAT_Debugv8p2 (Debug changes for v8.2)
33
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
14
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
34
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
35
--- a/target/arm/cpu.h
16
--- a/target/arm/cpu.h
36
+++ b/target/arm/cpu.h
17
+++ b/target/arm/cpu.h
37
@@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState {
18
@@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState {
38
ARMPACKey apdb;
19
*
39
ARMPACKey apga;
20
* fp_status_a32: is the "normal" fp status for AArch32 insns
40
} keys;
21
* fp_status_a64: is the "normal" fp status for AArch64 insns
41
+
22
- * fp_status_fp16: used for half-precision calculations
42
+ uint64_t scxtnum_el[4];
23
* fp_status_fp16_a32: used for AArch32 half-precision calculations
43
#endif
24
* fp_status_fp16_a64: used for AArch64 half-precision calculations
44
25
* standard_fp_status : the ARM "Standard FPSCR Value"
45
#if defined(CONFIG_USER_ONLY)
26
@@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState {
46
@@ -XXX,XX +XXX,XX @@ void pmu_init(ARMCPU *cpu);
27
*/
47
#define SCTLR_WXN (1U << 19)
28
float_status fp_status_a32;
48
#define SCTLR_ST (1U << 20) /* up to ??, RAZ in v6 */
29
float_status fp_status_a64;
49
#define SCTLR_UWXN (1U << 20) /* v7 onward, AArch32 only */
30
- float_status fp_status_f16;
50
+#define SCTLR_TSCXT (1U << 20) /* FEAT_CSV2_1p2, AArch64 only */
31
float_status fp_status_f16_a32;
51
#define SCTLR_FI (1U << 21) /* up to v7, v8 RES0 */
32
float_status fp_status_f16_a64;
52
#define SCTLR_IESB (1U << 21) /* v8.2-IESB, AArch64 only */
33
float_status standard_fp_status;
53
#define SCTLR_U (1U << 22) /* up to v6, RAO in v7 */
34
diff --git a/target/arm/tcg/translate.h b/target/arm/tcg/translate.h
54
@@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_dit(const ARMISARegisters *id)
35
index XXXXXXX..XXXXXXX 100644
55
return FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, DIT) != 0;
36
--- a/target/arm/tcg/translate.h
56
}
37
+++ b/target/arm/tcg/translate.h
57
38
@@ -XXX,XX +XXX,XX @@ static inline CPUARMTBFlags arm_tbflags_from_tb(const TranslationBlock *tb)
58
+static inline bool isar_feature_aa64_scxtnum(const ARMISARegisters *id)
39
typedef enum ARMFPStatusFlavour {
59
+{
40
FPST_A32,
60
+ int key = FIELD_EX64(id->id_aa64pfr0, ID_AA64PFR0, CSV2);
41
FPST_A64,
61
+ if (key >= 2) {
42
- FPST_FPCR_F16,
62
+ return true; /* FEAT_CSV2_2 */
43
FPST_A32_F16,
63
+ }
44
FPST_A64_F16,
64
+ if (key == 1) {
45
FPST_STD,
65
+ key = FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, CSV2_FRAC);
46
@@ -XXX,XX +XXX,XX @@ typedef enum ARMFPStatusFlavour {
66
+ return key >= 2; /* FEAT_CSV2_1p2 */
47
* for AArch32 non-FP16 operations controlled by the FPCR
67
+ }
48
* FPST_A64
68
+ return false;
49
* for AArch64 non-FP16 operations controlled by the FPCR
69
+}
50
- * FPST_FPCR_F16
70
+
51
- * for operations controlled by the FPCR where FPCR.FZ16 is to be used
71
static inline bool isar_feature_aa64_ssbs(const ARMISARegisters *id)
52
* FPST_A32_F16
72
{
53
* for AArch32 operations controlled by the FPCR where FPCR.FZ16 is to be used
73
return FIELD_EX64(id->id_aa64pfr1, ID_AA64PFR1, SSBS) != 0;
54
* FPST_A64_F16
55
@@ -XXX,XX +XXX,XX @@ static inline TCGv_ptr fpstatus_ptr(ARMFPStatusFlavour flavour)
56
case FPST_A64:
57
offset = offsetof(CPUARMState, vfp.fp_status_a64);
58
break;
59
- case FPST_FPCR_F16:
60
- offset = offsetof(CPUARMState, vfp.fp_status_f16);
61
- break;
62
case FPST_A32_F16:
63
offset = offsetof(CPUARMState, vfp.fp_status_f16_a32);
64
break;
74
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
65
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
75
index XXXXXXX..XXXXXXX 100644
66
index XXXXXXX..XXXXXXX 100644
76
--- a/target/arm/cpu.c
67
--- a/target/arm/cpu.c
77
+++ b/target/arm/cpu.c
68
+++ b/target/arm/cpu.c
78
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_reset(DeviceState *dev)
69
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_reset_hold(Object *obj, ResetType type)
79
*/
70
arm_set_default_fp_behaviours(&env->vfp.fp_status_a32);
80
env->cp15.gcr_el1 = 0x1ffff;
71
arm_set_default_fp_behaviours(&env->vfp.fp_status_a64);
72
arm_set_default_fp_behaviours(&env->vfp.standard_fp_status);
73
- arm_set_default_fp_behaviours(&env->vfp.fp_status_f16);
74
arm_set_default_fp_behaviours(&env->vfp.fp_status_f16_a32);
75
arm_set_default_fp_behaviours(&env->vfp.fp_status_f16_a64);
76
arm_set_default_fp_behaviours(&env->vfp.standard_fp_status_f16);
77
diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c
78
index XXXXXXX..XXXXXXX 100644
79
--- a/target/arm/vfp_helper.c
80
+++ b/target/arm/vfp_helper.c
81
@@ -XXX,XX +XXX,XX @@ static uint32_t vfp_get_fpsr_from_host(CPUARMState *env)
82
i |= get_float_exception_flags(&env->vfp.fp_status_a64);
83
i |= get_float_exception_flags(&env->vfp.standard_fp_status);
84
/* FZ16 does not generate an input denormal exception. */
85
- i |= (get_float_exception_flags(&env->vfp.fp_status_f16)
86
- & ~float_flag_input_denormal);
87
i |= (get_float_exception_flags(&env->vfp.fp_status_f16_a32)
88
& ~float_flag_input_denormal);
89
i |= (get_float_exception_flags(&env->vfp.fp_status_f16_a64)
90
@@ -XXX,XX +XXX,XX @@ static void vfp_clear_float_status_exc_flags(CPUARMState *env)
91
*/
92
set_float_exception_flags(0, &env->vfp.fp_status_a32);
93
set_float_exception_flags(0, &env->vfp.fp_status_a64);
94
- set_float_exception_flags(0, &env->vfp.fp_status_f16);
95
set_float_exception_flags(0, &env->vfp.fp_status_f16_a32);
96
set_float_exception_flags(0, &env->vfp.fp_status_f16_a64);
97
set_float_exception_flags(0, &env->vfp.standard_fp_status);
98
@@ -XXX,XX +XXX,XX @@ static void vfp_set_fpcr_to_host(CPUARMState *env, uint32_t val, uint32_t mask)
81
}
99
}
82
+ /*
100
set_float_rounding_mode(i, &env->vfp.fp_status_a32);
83
+ * Disable access to SCXTNUM_EL0 from CSV2_1p2.
101
set_float_rounding_mode(i, &env->vfp.fp_status_a64);
84
+ * This is not yet exposed from the Linux kernel in any way.
102
- set_float_rounding_mode(i, &env->vfp.fp_status_f16);
85
+ */
103
set_float_rounding_mode(i, &env->vfp.fp_status_f16_a32);
86
+ env->cp15.sctlr_el[1] |= SCTLR_TSCXT;
104
set_float_rounding_mode(i, &env->vfp.fp_status_f16_a64);
87
#else
88
/* Reset into the highest available EL */
89
if (arm_feature(env, ARM_FEATURE_EL3)) {
90
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
91
index XXXXXXX..XXXXXXX 100644
92
--- a/target/arm/cpu64.c
93
+++ b/target/arm/cpu64.c
94
@@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj)
95
t = FIELD_DP64(t, ID_AA64PFR0, SVE, 1);
96
t = FIELD_DP64(t, ID_AA64PFR0, SEL2, 1); /* FEAT_SEL2 */
97
t = FIELD_DP64(t, ID_AA64PFR0, DIT, 1); /* FEAT_DIT */
98
- t = FIELD_DP64(t, ID_AA64PFR0, CSV2, 1); /* FEAT_CSV2 */
99
+ t = FIELD_DP64(t, ID_AA64PFR0, CSV2, 2); /* FEAT_CSV2_2 */
100
cpu->isar.id_aa64pfr0 = t;
101
102
t = cpu->isar.id_aa64pfr1;
103
@@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj)
104
* we do for EL2 with the virtualization=on property.
105
*/
106
t = FIELD_DP64(t, ID_AA64PFR1, MTE, 3); /* FEAT_MTE3 */
107
+ t = FIELD_DP64(t, ID_AA64PFR1, CSV2_FRAC, 0); /* FEAT_CSV2_2 */
108
cpu->isar.id_aa64pfr1 = t;
109
110
t = cpu->isar.id_aa64mmfr0;
111
diff --git a/target/arm/helper.c b/target/arm/helper.c
112
index XXXXXXX..XXXXXXX 100644
113
--- a/target/arm/helper.c
114
+++ b/target/arm/helper.c
115
@@ -XXX,XX +XXX,XX @@ static void scr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value)
116
if (cpu_isar_feature(aa64_mte, cpu)) {
117
valid_mask |= SCR_ATA;
118
}
119
+ if (cpu_isar_feature(aa64_scxtnum, cpu)) {
120
+ valid_mask |= SCR_ENSCXT;
121
+ }
122
} else {
123
valid_mask &= ~(SCR_RW | SCR_ST);
124
if (cpu_isar_feature(aa32_ras, cpu)) {
125
@@ -XXX,XX +XXX,XX @@ static void do_hcr_write(CPUARMState *env, uint64_t value, uint64_t valid_mask)
126
if (cpu_isar_feature(aa64_mte, cpu)) {
127
valid_mask |= HCR_ATA | HCR_DCT | HCR_TID5;
128
}
129
+ if (cpu_isar_feature(aa64_scxtnum, cpu)) {
130
+ valid_mask |= HCR_ENSCXT;
131
+ }
132
}
105
}
133
106
if (changed & FPCR_FZ16) {
134
/* Clear RES0 bits. */
107
bool ftz_enabled = val & FPCR_FZ16;
135
@@ -XXX,XX +XXX,XX @@ static void define_arm_vh_e2h_redirects_aliases(ARMCPU *cpu)
108
- set_flush_to_zero(ftz_enabled, &env->vfp.fp_status_f16);
136
{ K(3, 0, 5, 6, 0), K(3, 4, 5, 6, 0), K(3, 5, 5, 6, 0),
109
set_flush_to_zero(ftz_enabled, &env->vfp.fp_status_f16_a32);
137
"TFSR_EL1", "TFSR_EL2", "TFSR_EL12", isar_feature_aa64_mte },
110
set_flush_to_zero(ftz_enabled, &env->vfp.fp_status_f16_a64);
138
111
set_flush_to_zero(ftz_enabled, &env->vfp.standard_fp_status_f16);
139
+ { K(3, 0, 13, 0, 7), K(3, 4, 13, 0, 7), K(3, 5, 13, 0, 7),
112
- set_flush_inputs_to_zero(ftz_enabled, &env->vfp.fp_status_f16);
140
+ "SCXTNUM_EL1", "SCXTNUM_EL2", "SCXTNUM_EL12",
113
set_flush_inputs_to_zero(ftz_enabled, &env->vfp.fp_status_f16_a32);
141
+ isar_feature_aa64_scxtnum },
114
set_flush_inputs_to_zero(ftz_enabled, &env->vfp.fp_status_f16_a64);
142
+
115
set_flush_inputs_to_zero(ftz_enabled, &env->vfp.standard_fp_status_f16);
143
/* TODO: ARMv8.2-SPE -- PMSCR_EL2 */
116
@@ -XXX,XX +XXX,XX @@ static void vfp_set_fpcr_to_host(CPUARMState *env, uint32_t val, uint32_t mask)
144
/* TODO: ARMv8.4-Trace -- TRFCR_EL2 */
117
bool dnan_enabled = val & FPCR_DN;
145
};
118
set_default_nan_mode(dnan_enabled, &env->vfp.fp_status_a32);
146
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo mte_el0_cacheop_reginfo[] = {
119
set_default_nan_mode(dnan_enabled, &env->vfp.fp_status_a64);
147
},
120
- set_default_nan_mode(dnan_enabled, &env->vfp.fp_status_f16);
148
};
121
set_default_nan_mode(dnan_enabled, &env->vfp.fp_status_f16_a32);
149
122
set_default_nan_mode(dnan_enabled, &env->vfp.fp_status_f16_a64);
150
-#endif
151
+static CPAccessResult access_scxtnum(CPUARMState *env, const ARMCPRegInfo *ri,
152
+ bool isread)
153
+{
154
+ uint64_t hcr = arm_hcr_el2_eff(env);
155
+ int el = arm_current_el(env);
156
+
157
+ if (el == 0 && !((hcr & HCR_E2H) && (hcr & HCR_TGE))) {
158
+ if (env->cp15.sctlr_el[1] & SCTLR_TSCXT) {
159
+ if (hcr & HCR_TGE) {
160
+ return CP_ACCESS_TRAP_EL2;
161
+ }
162
+ return CP_ACCESS_TRAP;
163
+ }
164
+ } else if (el < 2 && (env->cp15.sctlr_el[2] & SCTLR_TSCXT)) {
165
+ return CP_ACCESS_TRAP_EL2;
166
+ }
167
+ if (el < 2 && arm_is_el2_enabled(env) && !(hcr & HCR_ENSCXT)) {
168
+ return CP_ACCESS_TRAP_EL2;
169
+ }
170
+ if (el < 3
171
+ && arm_feature(env, ARM_FEATURE_EL3)
172
+ && !(env->cp15.scr_el3 & SCR_ENSCXT)) {
173
+ return CP_ACCESS_TRAP_EL3;
174
+ }
175
+ return CP_ACCESS_OK;
176
+}
177
+
178
+static const ARMCPRegInfo scxtnum_reginfo[] = {
179
+ { .name = "SCXTNUM_EL0", .state = ARM_CP_STATE_AA64,
180
+ .opc0 = 3, .opc1 = 3, .crn = 13, .crm = 0, .opc2 = 7,
181
+ .access = PL0_RW, .accessfn = access_scxtnum,
182
+ .fieldoffset = offsetof(CPUARMState, scxtnum_el[0]) },
183
+ { .name = "SCXTNUM_EL1", .state = ARM_CP_STATE_AA64,
184
+ .opc0 = 3, .opc1 = 0, .crn = 13, .crm = 0, .opc2 = 7,
185
+ .access = PL1_RW, .accessfn = access_scxtnum,
186
+ .fieldoffset = offsetof(CPUARMState, scxtnum_el[1]) },
187
+ { .name = "SCXTNUM_EL2", .state = ARM_CP_STATE_AA64,
188
+ .opc0 = 3, .opc1 = 4, .crn = 13, .crm = 0, .opc2 = 7,
189
+ .access = PL2_RW, .accessfn = access_scxtnum,
190
+ .fieldoffset = offsetof(CPUARMState, scxtnum_el[2]) },
191
+ { .name = "SCXTNUM_EL3", .state = ARM_CP_STATE_AA64,
192
+ .opc0 = 3, .opc1 = 6, .crn = 13, .crm = 0, .opc2 = 7,
193
+ .access = PL3_RW,
194
+ .fieldoffset = offsetof(CPUARMState, scxtnum_el[3]) },
195
+};
196
+#endif /* TARGET_AARCH64 */
197
198
static CPAccessResult access_predinv(CPUARMState *env, const ARMCPRegInfo *ri,
199
bool isread)
200
@@ -XXX,XX +XXX,XX @@ void register_cp_regs_for_features(ARMCPU *cpu)
201
define_arm_cp_regs(cpu, mte_tco_ro_reginfo);
202
define_arm_cp_regs(cpu, mte_el0_cacheop_reginfo);
203
}
123
}
204
+
205
+ if (cpu_isar_feature(aa64_scxtnum, cpu)) {
206
+ define_arm_cp_regs(cpu, scxtnum_reginfo);
207
+ }
208
#endif
209
210
if (cpu_isar_feature(any_predinv, cpu)) {
211
--
124
--
212
2.25.1
125
2.34.1
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
Our float_flag_input_denormal exception flag is set when the fpu code
2
2
flushes an input denormal to zero. This is what many guest
3
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
3
architectures (eg classic Arm behaviour) require, but it is not the
4
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
4
only donarmal-related reason we might want to set an exception flag.
5
Message-id: 20220506180242.216785-18-richard.henderson@linaro.org
5
The x86 behaviour (which we do not currently model correctly) wants
6
to see an exception flag when a denormal input is *not* flushed to
7
zero and is actually used in an arithmetic operation. Arm's FEAT_AFP
8
also wants these semantics.
9
10
Rename float_flag_input_denormal to float_flag_input_denormal_flushed
11
to make it clearer when it is set and to allow us to add a new
12
float_flag_input_denormal_used next to it for the x86/FEAT_AFP
13
semantics.
14
15
Commit created with
16
for f in `git grep -l float_flag_input_denormal`; do sed -i -e 's/float_flag_input_denormal/float_flag_input_denormal_flushed/' $f; done
17
18
and manual editing of softfloat-types.h and softfloat.c to clean
19
up the indentation afterwards and to fix a comment which wasn't
20
using the full name of the flag.
21
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
22
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
23
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
24
Message-id: 20250124162836.2332150-20-peter.maydell@linaro.org
7
---
25
---
8
docs/system/arm/emulation.rst | 1 +
26
include/fpu/softfloat-types.h | 5 +++--
9
target/arm/cpu64.c | 1 +
27
fpu/softfloat.c | 4 ++--
10
target/arm/cpu_tcg.c | 1 +
28
target/arm/tcg/sve_helper.c | 6 +++---
11
3 files changed, 3 insertions(+)
29
target/arm/vfp_helper.c | 10 +++++-----
12
30
target/i386/tcg/fpu_helper.c | 6 +++---
13
diff --git a/docs/system/arm/emulation.rst b/docs/system/arm/emulation.rst
31
target/mips/tcg/msa_helper.c | 2 +-
14
index XXXXXXX..XXXXXXX 100644
32
target/rx/op_helper.c | 2 +-
15
--- a/docs/system/arm/emulation.rst
33
fpu/softfloat-parts.c.inc | 2 +-
16
+++ b/docs/system/arm/emulation.rst
34
8 files changed, 19 insertions(+), 18 deletions(-)
17
@@ -XXX,XX +XXX,XX @@ the following architecture extensions:
35
18
- FEAT_PMULL (PMULL, PMULL2 instructions)
36
diff --git a/include/fpu/softfloat-types.h b/include/fpu/softfloat-types.h
19
- FEAT_PMUv3p1 (PMU Extensions v3.1)
37
index XXXXXXX..XXXXXXX 100644
20
- FEAT_PMUv3p4 (PMU Extensions v3.4)
38
--- a/include/fpu/softfloat-types.h
21
+- FEAT_RAS (Reliability, availability, and serviceability)
39
+++ b/include/fpu/softfloat-types.h
22
- FEAT_RDM (Advanced SIMD rounding double multiply accumulate instructions)
40
@@ -XXX,XX +XXX,XX @@ enum {
23
- FEAT_RNG (Random number generator)
41
float_flag_overflow = 0x0004,
24
- FEAT_SB (Speculation Barrier)
42
float_flag_underflow = 0x0008,
25
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
43
float_flag_inexact = 0x0010,
26
index XXXXXXX..XXXXXXX 100644
44
- float_flag_input_denormal = 0x0020,
27
--- a/target/arm/cpu64.c
45
+ /* We flushed an input denormal to 0 (because of flush_inputs_to_zero) */
28
+++ b/target/arm/cpu64.c
46
+ float_flag_input_denormal_flushed = 0x0020,
29
@@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj)
47
float_flag_output_denormal = 0x0040,
30
t = cpu->isar.id_aa64pfr0;
48
float_flag_invalid_isi = 0x0080, /* inf - inf */
31
t = FIELD_DP64(t, ID_AA64PFR0, FP, 1); /* FEAT_FP16 */
49
float_flag_invalid_imz = 0x0100, /* inf * 0 */
32
t = FIELD_DP64(t, ID_AA64PFR0, ADVSIMD, 1); /* FEAT_FP16 */
50
@@ -XXX,XX +XXX,XX @@ typedef struct float_status {
33
+ t = FIELD_DP64(t, ID_AA64PFR0, RAS, 1); /* FEAT_RAS */
51
bool tininess_before_rounding;
34
t = FIELD_DP64(t, ID_AA64PFR0, SVE, 1);
52
/* should denormalised results go to zero and set the inexact flag? */
35
t = FIELD_DP64(t, ID_AA64PFR0, SEL2, 1); /* FEAT_SEL2 */
53
bool flush_to_zero;
36
t = FIELD_DP64(t, ID_AA64PFR0, DIT, 1); /* FEAT_DIT */
54
- /* should denormalised inputs go to zero and set the input_denormal flag? */
37
diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c
55
+ /* should denormalised inputs go to zero and set input_denormal_flushed? */
38
index XXXXXXX..XXXXXXX 100644
56
bool flush_inputs_to_zero;
39
--- a/target/arm/cpu_tcg.c
57
bool default_nan_mode;
40
+++ b/target/arm/cpu_tcg.c
58
/*
41
@@ -XXX,XX +XXX,XX @@ void aa32_max_features(ARMCPU *cpu)
59
diff --git a/fpu/softfloat.c b/fpu/softfloat.c
42
60
index XXXXXXX..XXXXXXX 100644
43
t = cpu->isar.id_pfr0;
61
--- a/fpu/softfloat.c
44
t = FIELD_DP32(t, ID_PFR0, DIT, 1); /* FEAT_DIT */
62
+++ b/fpu/softfloat.c
45
+ t = FIELD_DP32(t, ID_PFR0, RAS, 1); /* FEAT_RAS */
63
@@ -XXX,XX +XXX,XX @@ this code that are retained.
46
cpu->isar.id_pfr0 = t;
64
if (unlikely(soft_t ## _is_denormal(*a))) { \
47
65
*a = soft_t ## _set_sign(soft_t ## _zero, \
48
t = cpu->isar.id_pfr2;
66
soft_t ## _is_neg(*a)); \
67
- float_raise(float_flag_input_denormal, s); \
68
+ float_raise(float_flag_input_denormal_flushed, s); \
69
} \
70
}
71
72
@@ -XXX,XX +XXX,XX @@ float128 float128_silence_nan(float128 a, float_status *status)
73
static bool parts_squash_denormal(FloatParts64 p, float_status *status)
74
{
75
if (p.exp == 0 && p.frac != 0) {
76
- float_raise(float_flag_input_denormal, status);
77
+ float_raise(float_flag_input_denormal_flushed, status);
78
return true;
79
}
80
81
diff --git a/target/arm/tcg/sve_helper.c b/target/arm/tcg/sve_helper.c
82
index XXXXXXX..XXXXXXX 100644
83
--- a/target/arm/tcg/sve_helper.c
84
+++ b/target/arm/tcg/sve_helper.c
85
@@ -XXX,XX +XXX,XX @@ static int16_t do_float16_logb_as_int(float16 a, float_status *s)
86
return -15 - clz32(frac);
87
}
88
/* flush to zero */
89
- float_raise(float_flag_input_denormal, s);
90
+ float_raise(float_flag_input_denormal_flushed, s);
91
}
92
} else if (unlikely(exp == 0x1f)) {
93
if (frac == 0) {
94
@@ -XXX,XX +XXX,XX @@ static int32_t do_float32_logb_as_int(float32 a, float_status *s)
95
return -127 - clz32(frac);
96
}
97
/* flush to zero */
98
- float_raise(float_flag_input_denormal, s);
99
+ float_raise(float_flag_input_denormal_flushed, s);
100
}
101
} else if (unlikely(exp == 0xff)) {
102
if (frac == 0) {
103
@@ -XXX,XX +XXX,XX @@ static int64_t do_float64_logb_as_int(float64 a, float_status *s)
104
return -1023 - clz64(frac);
105
}
106
/* flush to zero */
107
- float_raise(float_flag_input_denormal, s);
108
+ float_raise(float_flag_input_denormal_flushed, s);
109
}
110
} else if (unlikely(exp == 0x7ff)) {
111
if (frac == 0) {
112
diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c
113
index XXXXXXX..XXXXXXX 100644
114
--- a/target/arm/vfp_helper.c
115
+++ b/target/arm/vfp_helper.c
116
@@ -XXX,XX +XXX,XX @@ static inline uint32_t vfp_exceptbits_from_host(int host_bits)
117
if (host_bits & float_flag_inexact) {
118
target_bits |= FPSR_IXC;
119
}
120
- if (host_bits & float_flag_input_denormal) {
121
+ if (host_bits & float_flag_input_denormal_flushed) {
122
target_bits |= FPSR_IDC;
123
}
124
return target_bits;
125
@@ -XXX,XX +XXX,XX @@ static uint32_t vfp_get_fpsr_from_host(CPUARMState *env)
126
i |= get_float_exception_flags(&env->vfp.standard_fp_status);
127
/* FZ16 does not generate an input denormal exception. */
128
i |= (get_float_exception_flags(&env->vfp.fp_status_f16_a32)
129
- & ~float_flag_input_denormal);
130
+ & ~float_flag_input_denormal_flushed);
131
i |= (get_float_exception_flags(&env->vfp.fp_status_f16_a64)
132
- & ~float_flag_input_denormal);
133
+ & ~float_flag_input_denormal_flushed);
134
i |= (get_float_exception_flags(&env->vfp.standard_fp_status_f16)
135
- & ~float_flag_input_denormal);
136
+ & ~float_flag_input_denormal_flushed);
137
return vfp_exceptbits_from_host(i);
138
}
139
140
@@ -XXX,XX +XXX,XX @@ uint64_t HELPER(fjcvtzs)(float64 value, float_status *status)
141
142
/* Normal inexact, denormal with flush-to-zero, or overflow or NaN */
143
inexact = e_new & (float_flag_inexact |
144
- float_flag_input_denormal |
145
+ float_flag_input_denormal_flushed |
146
float_flag_invalid);
147
148
/* While not inexact for IEEE FP, -0.0 is inexact for JavaScript. */
149
diff --git a/target/i386/tcg/fpu_helper.c b/target/i386/tcg/fpu_helper.c
150
index XXXXXXX..XXXXXXX 100644
151
--- a/target/i386/tcg/fpu_helper.c
152
+++ b/target/i386/tcg/fpu_helper.c
153
@@ -XXX,XX +XXX,XX @@ static void merge_exception_flags(CPUX86State *env, uint8_t old_flags)
154
(new_flags & float_flag_overflow ? FPUS_OE : 0) |
155
(new_flags & float_flag_underflow ? FPUS_UE : 0) |
156
(new_flags & float_flag_inexact ? FPUS_PE : 0) |
157
- (new_flags & float_flag_input_denormal ? FPUS_DE : 0)));
158
+ (new_flags & float_flag_input_denormal_flushed ? FPUS_DE : 0)));
159
}
160
161
static inline floatx80 helper_fdiv(CPUX86State *env, floatx80 a, floatx80 b)
162
@@ -XXX,XX +XXX,XX @@ void helper_fxtract(CPUX86State *env)
163
int shift = clz64(temp.l.lower);
164
temp.l.lower <<= shift;
165
expdif = 1 - EXPBIAS - shift;
166
- float_raise(float_flag_input_denormal, &env->fp_status);
167
+ float_raise(float_flag_input_denormal_flushed, &env->fp_status);
168
} else {
169
expdif = EXPD(temp) - EXPBIAS;
170
}
171
@@ -XXX,XX +XXX,XX @@ void update_mxcsr_from_sse_status(CPUX86State *env)
172
uint8_t flags = get_float_exception_flags(&env->sse_status);
173
/*
174
* The MXCSR denormal flag has opposite semantics to
175
- * float_flag_input_denormal (the softfloat code sets that flag
176
+ * float_flag_input_denormal_flushed (the softfloat code sets that flag
177
* only when flushing input denormals to zero, but SSE sets it
178
* only when not flushing them to zero), so is not converted
179
* here.
180
diff --git a/target/mips/tcg/msa_helper.c b/target/mips/tcg/msa_helper.c
181
index XXXXXXX..XXXXXXX 100644
182
--- a/target/mips/tcg/msa_helper.c
183
+++ b/target/mips/tcg/msa_helper.c
184
@@ -XXX,XX +XXX,XX @@ static inline int update_msacsr(CPUMIPSState *env, int action, int denormal)
185
enable = GET_FP_ENABLE(env->active_tc.msacsr) | FP_UNIMPLEMENTED;
186
187
/* Set Inexact (I) when flushing inputs to zero */
188
- if ((ieee_exception_flags & float_flag_input_denormal) &&
189
+ if ((ieee_exception_flags & float_flag_input_denormal_flushed) &&
190
(env->active_tc.msacsr & MSACSR_FS_MASK) != 0) {
191
if (action & CLEAR_IS_INEXACT) {
192
mips_exception_flags &= ~FP_INEXACT;
193
diff --git a/target/rx/op_helper.c b/target/rx/op_helper.c
194
index XXXXXXX..XXXXXXX 100644
195
--- a/target/rx/op_helper.c
196
+++ b/target/rx/op_helper.c
197
@@ -XXX,XX +XXX,XX @@ static void update_fpsw(CPURXState *env, float32 ret, uintptr_t retaddr)
198
if (xcpt & float_flag_inexact) {
199
SET_FPSW(X);
200
}
201
- if ((xcpt & (float_flag_input_denormal
202
+ if ((xcpt & (float_flag_input_denormal_flushed
203
| float_flag_output_denormal))
204
&& !FIELD_EX32(env->fpsw, FPSW, DN)) {
205
env->fpsw = FIELD_DP32(env->fpsw, FPSW, CE, 1);
206
diff --git a/fpu/softfloat-parts.c.inc b/fpu/softfloat-parts.c.inc
207
index XXXXXXX..XXXXXXX 100644
208
--- a/fpu/softfloat-parts.c.inc
209
+++ b/fpu/softfloat-parts.c.inc
210
@@ -XXX,XX +XXX,XX @@ static void partsN(canonicalize)(FloatPartsN *p, float_status *status,
211
if (likely(frac_eqz(p))) {
212
p->cls = float_class_zero;
213
} else if (status->flush_inputs_to_zero) {
214
- float_raise(float_flag_input_denormal, status);
215
+ float_raise(float_flag_input_denormal_flushed, status);
216
p->cls = float_class_zero;
217
frac_clear(p);
218
} else {
49
--
219
--
50
2.25.1
220
2.34.1
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
Our float_flag_output_denormal exception flag is set when
2
the fpu code flushes an output denormal to zero. Rename
3
it to float_flag_output_denormal_flushed:
4
* this keeps it parallel with the flag for flushing
5
input denormals, which we just renamed
6
* it makes it clearer that it doesn't mean "set when
7
the output is a denormal"
2
8
3
Enable the a76 for virt and sbsa board use.
9
Commit created with
10
for f in `git grep -l float_flag_output_denormal`; do sed -i -e 's/float_flag_output_denormal/float_flag_output_denormal_flushed/' $f; done
4
11
5
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7
Message-id: 20220506180242.216785-24-richard.henderson@linaro.org
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
14
Message-id: 20250124162836.2332150-21-peter.maydell@linaro.org
9
---
15
---
10
docs/system/arm/virt.rst | 1 +
16
include/fpu/softfloat-types.h | 3 ++-
11
hw/arm/sbsa-ref.c | 1 +
17
fpu/softfloat.c | 2 +-
12
hw/arm/virt.c | 1 +
18
target/arm/vfp_helper.c | 2 +-
13
target/arm/cpu64.c | 66 ++++++++++++++++++++++++++++++++++++++++
19
target/i386/tcg/fpu_helper.c | 2 +-
14
4 files changed, 69 insertions(+)
20
target/m68k/fpu_helper.c | 2 +-
21
target/mips/tcg/msa_helper.c | 2 +-
22
target/rx/op_helper.c | 2 +-
23
target/tricore/fpu_helper.c | 6 +++---
24
fpu/softfloat-parts.c.inc | 2 +-
25
9 files changed, 12 insertions(+), 11 deletions(-)
15
26
16
diff --git a/docs/system/arm/virt.rst b/docs/system/arm/virt.rst
27
diff --git a/include/fpu/softfloat-types.h b/include/fpu/softfloat-types.h
17
index XXXXXXX..XXXXXXX 100644
28
index XXXXXXX..XXXXXXX 100644
18
--- a/docs/system/arm/virt.rst
29
--- a/include/fpu/softfloat-types.h
19
+++ b/docs/system/arm/virt.rst
30
+++ b/include/fpu/softfloat-types.h
20
@@ -XXX,XX +XXX,XX @@ Supported guest CPU types:
31
@@ -XXX,XX +XXX,XX @@ enum {
21
- ``cortex-a53`` (64-bit)
32
float_flag_inexact = 0x0010,
22
- ``cortex-a57`` (64-bit)
33
/* We flushed an input denormal to 0 (because of flush_inputs_to_zero) */
23
- ``cortex-a72`` (64-bit)
34
float_flag_input_denormal_flushed = 0x0020,
24
+- ``cortex-a76`` (64-bit)
35
- float_flag_output_denormal = 0x0040,
25
- ``a64fx`` (64-bit)
36
+ /* We flushed an output denormal to 0 (because of flush_to_zero) */
26
- ``host`` (with KVM only)
37
+ float_flag_output_denormal_flushed = 0x0040,
27
- ``max`` (same as ``host`` for KVM; best possible emulation with TCG)
38
float_flag_invalid_isi = 0x0080, /* inf - inf */
28
diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c
39
float_flag_invalid_imz = 0x0100, /* inf * 0 */
40
float_flag_invalid_idi = 0x0200, /* inf / inf */
41
diff --git a/fpu/softfloat.c b/fpu/softfloat.c
29
index XXXXXXX..XXXXXXX 100644
42
index XXXXXXX..XXXXXXX 100644
30
--- a/hw/arm/sbsa-ref.c
43
--- a/fpu/softfloat.c
31
+++ b/hw/arm/sbsa-ref.c
44
+++ b/fpu/softfloat.c
32
@@ -XXX,XX +XXX,XX @@ static const int sbsa_ref_irqmap[] = {
45
@@ -XXX,XX +XXX,XX @@ floatx80 roundAndPackFloatx80(FloatX80RoundPrec roundingPrecision, bool zSign,
33
static const char * const valid_cpus[] = {
46
}
34
ARM_CPU_TYPE_NAME("cortex-a57"),
47
if ( zExp <= 0 ) {
35
ARM_CPU_TYPE_NAME("cortex-a72"),
48
if (status->flush_to_zero) {
36
+ ARM_CPU_TYPE_NAME("cortex-a76"),
49
- float_raise(float_flag_output_denormal, status);
37
ARM_CPU_TYPE_NAME("max"),
50
+ float_raise(float_flag_output_denormal_flushed, status);
38
};
51
return packFloatx80(zSign, 0, 0);
39
52
}
40
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
53
isTiny = status->tininess_before_rounding
54
diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c
41
index XXXXXXX..XXXXXXX 100644
55
index XXXXXXX..XXXXXXX 100644
42
--- a/hw/arm/virt.c
56
--- a/target/arm/vfp_helper.c
43
+++ b/hw/arm/virt.c
57
+++ b/target/arm/vfp_helper.c
44
@@ -XXX,XX +XXX,XX @@ static const char *valid_cpus[] = {
58
@@ -XXX,XX +XXX,XX @@ static inline uint32_t vfp_exceptbits_from_host(int host_bits)
45
ARM_CPU_TYPE_NAME("cortex-a53"),
59
if (host_bits & float_flag_overflow) {
46
ARM_CPU_TYPE_NAME("cortex-a57"),
60
target_bits |= FPSR_OFC;
47
ARM_CPU_TYPE_NAME("cortex-a72"),
61
}
48
+ ARM_CPU_TYPE_NAME("cortex-a76"),
62
- if (host_bits & (float_flag_underflow | float_flag_output_denormal)) {
49
ARM_CPU_TYPE_NAME("a64fx"),
63
+ if (host_bits & (float_flag_underflow | float_flag_output_denormal_flushed)) {
50
ARM_CPU_TYPE_NAME("host"),
64
target_bits |= FPSR_UFC;
51
ARM_CPU_TYPE_NAME("max"),
65
}
52
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
66
if (host_bits & float_flag_inexact) {
67
diff --git a/target/i386/tcg/fpu_helper.c b/target/i386/tcg/fpu_helper.c
53
index XXXXXXX..XXXXXXX 100644
68
index XXXXXXX..XXXXXXX 100644
54
--- a/target/arm/cpu64.c
69
--- a/target/i386/tcg/fpu_helper.c
55
+++ b/target/arm/cpu64.c
70
+++ b/target/i386/tcg/fpu_helper.c
56
@@ -XXX,XX +XXX,XX @@ static void aarch64_a72_initfn(Object *obj)
71
@@ -XXX,XX +XXX,XX @@ void update_mxcsr_from_sse_status(CPUX86State *env)
57
define_cortex_a72_a57_a53_cp_reginfo(cpu);
72
(flags & float_flag_overflow ? FPUS_OE : 0) |
73
(flags & float_flag_underflow ? FPUS_UE : 0) |
74
(flags & float_flag_inexact ? FPUS_PE : 0) |
75
- (flags & float_flag_output_denormal ? FPUS_UE | FPUS_PE :
76
+ (flags & float_flag_output_denormal_flushed ? FPUS_UE | FPUS_PE :
77
0));
58
}
78
}
59
79
60
+static void aarch64_a76_initfn(Object *obj)
80
diff --git a/target/m68k/fpu_helper.c b/target/m68k/fpu_helper.c
61
+{
81
index XXXXXXX..XXXXXXX 100644
62
+ ARMCPU *cpu = ARM_CPU(obj);
82
--- a/target/m68k/fpu_helper.c
63
+
83
+++ b/target/m68k/fpu_helper.c
64
+ cpu->dtb_compatible = "arm,cortex-a76";
84
@@ -XXX,XX +XXX,XX @@ static int cpu_m68k_exceptbits_from_host(int host_bits)
65
+ set_feature(&cpu->env, ARM_FEATURE_V8);
85
if (host_bits & float_flag_overflow) {
66
+ set_feature(&cpu->env, ARM_FEATURE_NEON);
86
target_bits |= 0x40;
67
+ set_feature(&cpu->env, ARM_FEATURE_GENERIC_TIMER);
87
}
68
+ set_feature(&cpu->env, ARM_FEATURE_AARCH64);
88
- if (host_bits & (float_flag_underflow | float_flag_output_denormal)) {
69
+ set_feature(&cpu->env, ARM_FEATURE_CBAR_RO);
89
+ if (host_bits & (float_flag_underflow | float_flag_output_denormal_flushed)) {
70
+ set_feature(&cpu->env, ARM_FEATURE_EL2);
90
target_bits |= 0x20;
71
+ set_feature(&cpu->env, ARM_FEATURE_EL3);
91
}
72
+ set_feature(&cpu->env, ARM_FEATURE_PMU);
92
if (host_bits & float_flag_divbyzero) {
73
+
93
diff --git a/target/mips/tcg/msa_helper.c b/target/mips/tcg/msa_helper.c
74
+ /* Ordered by B2.4 AArch64 registers by functional group */
94
index XXXXXXX..XXXXXXX 100644
75
+ cpu->clidr = 0x82000023;
95
--- a/target/mips/tcg/msa_helper.c
76
+ cpu->ctr = 0x8444C004;
96
+++ b/target/mips/tcg/msa_helper.c
77
+ cpu->dcz_blocksize = 4;
97
@@ -XXX,XX +XXX,XX @@ static inline int update_msacsr(CPUMIPSState *env, int action, int denormal)
78
+ cpu->isar.id_aa64dfr0 = 0x0000000010305408ull;
98
}
79
+ cpu->isar.id_aa64isar0 = 0x0000100010211120ull;
99
80
+ cpu->isar.id_aa64isar1 = 0x0000000000100001ull;
100
/* Set Inexact (I) and Underflow (U) when flushing outputs to zero */
81
+ cpu->isar.id_aa64mmfr0 = 0x0000000000101122ull;
101
- if ((ieee_exception_flags & float_flag_output_denormal) &&
82
+ cpu->isar.id_aa64mmfr1 = 0x0000000010212122ull;
102
+ if ((ieee_exception_flags & float_flag_output_denormal_flushed) &&
83
+ cpu->isar.id_aa64mmfr2 = 0x0000000000001011ull;
103
(env->active_tc.msacsr & MSACSR_FS_MASK) != 0) {
84
+ cpu->isar.id_aa64pfr0 = 0x1100000010111112ull; /* GIC filled in later */
104
mips_exception_flags |= FP_INEXACT;
85
+ cpu->isar.id_aa64pfr1 = 0x0000000000000010ull;
105
if (action & CLEAR_FS_UNDERFLOW) {
86
+ cpu->id_afr0 = 0x00000000;
106
diff --git a/target/rx/op_helper.c b/target/rx/op_helper.c
87
+ cpu->isar.id_dfr0 = 0x04010088;
107
index XXXXXXX..XXXXXXX 100644
88
+ cpu->isar.id_isar0 = 0x02101110;
108
--- a/target/rx/op_helper.c
89
+ cpu->isar.id_isar1 = 0x13112111;
109
+++ b/target/rx/op_helper.c
90
+ cpu->isar.id_isar2 = 0x21232042;
110
@@ -XXX,XX +XXX,XX @@ static void update_fpsw(CPURXState *env, float32 ret, uintptr_t retaddr)
91
+ cpu->isar.id_isar3 = 0x01112131;
111
SET_FPSW(X);
92
+ cpu->isar.id_isar4 = 0x00010142;
112
}
93
+ cpu->isar.id_isar5 = 0x01011121;
113
if ((xcpt & (float_flag_input_denormal_flushed
94
+ cpu->isar.id_isar6 = 0x00000010;
114
- | float_flag_output_denormal))
95
+ cpu->isar.id_mmfr0 = 0x10201105;
115
+ | float_flag_output_denormal_flushed))
96
+ cpu->isar.id_mmfr1 = 0x40000000;
116
&& !FIELD_EX32(env->fpsw, FPSW, DN)) {
97
+ cpu->isar.id_mmfr2 = 0x01260000;
117
env->fpsw = FIELD_DP32(env->fpsw, FPSW, CE, 1);
98
+ cpu->isar.id_mmfr3 = 0x02122211;
118
}
99
+ cpu->isar.id_mmfr4 = 0x00021110;
119
diff --git a/target/tricore/fpu_helper.c b/target/tricore/fpu_helper.c
100
+ cpu->isar.id_pfr0 = 0x10010131;
120
index XXXXXXX..XXXXXXX 100644
101
+ cpu->isar.id_pfr1 = 0x00010000; /* GIC filled in later */
121
--- a/target/tricore/fpu_helper.c
102
+ cpu->isar.id_pfr2 = 0x00000011;
122
+++ b/target/tricore/fpu_helper.c
103
+ cpu->midr = 0x414fd0b1; /* r4p1 */
123
@@ -XXX,XX +XXX,XX @@ static inline uint8_t f_get_excp_flags(CPUTriCoreState *env)
104
+ cpu->revidr = 0;
124
& (float_flag_invalid
105
+
125
| float_flag_overflow
106
+ /* From B2.18 CCSIDR_EL1 */
126
| float_flag_underflow
107
+ cpu->ccsidr[0] = 0x701fe01a; /* 64KB L1 dcache */
127
- | float_flag_output_denormal
108
+ cpu->ccsidr[1] = 0x201fe01a; /* 64KB L1 icache */
128
+ | float_flag_output_denormal_flushed
109
+ cpu->ccsidr[2] = 0x707fe03a; /* 512KB L2 cache */
129
| float_flag_divbyzero
110
+
130
| float_flag_inexact);
111
+ /* From B2.93 SCTLR_EL3 */
131
}
112
+ cpu->reset_sctlr = 0x30c50838;
132
@@ -XXX,XX +XXX,XX @@ static void f_update_psw_flags(CPUTriCoreState *env, uint8_t flags)
113
+
133
some_excp = 1;
114
+ /* From B4.23 ICH_VTR_EL2 */
134
}
115
+ cpu->gic_num_lrs = 4;
135
116
+ cpu->gic_vpribits = 5;
136
- if (flags & float_flag_underflow || flags & float_flag_output_denormal) {
117
+ cpu->gic_vprebits = 5;
137
+ if (flags & float_flag_underflow || flags & float_flag_output_denormal_flushed) {
118
+
138
env->FPU_FU = 1 << 31;
119
+ /* From B5.1 AdvSIMD AArch64 register summary */
139
some_excp = 1;
120
+ cpu->isar.mvfr0 = 0x10110222;
140
}
121
+ cpu->isar.mvfr1 = 0x13211111;
141
@@ -XXX,XX +XXX,XX @@ static void f_update_psw_flags(CPUTriCoreState *env, uint8_t flags)
122
+ cpu->isar.mvfr2 = 0x00000043;
142
some_excp = 1;
123
+}
143
}
124
+
144
125
void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp)
145
- if (flags & float_flag_inexact || flags & float_flag_output_denormal) {
126
{
146
+ if (flags & float_flag_inexact || flags & float_flag_output_denormal_flushed) {
127
/*
147
env->PSW |= 1 << 26;
128
@@ -XXX,XX +XXX,XX @@ static const ARMCPUInfo aarch64_cpus[] = {
148
some_excp = 1;
129
{ .name = "cortex-a57", .initfn = aarch64_a57_initfn },
149
}
130
{ .name = "cortex-a53", .initfn = aarch64_a53_initfn },
150
diff --git a/fpu/softfloat-parts.c.inc b/fpu/softfloat-parts.c.inc
131
{ .name = "cortex-a72", .initfn = aarch64_a72_initfn },
151
index XXXXXXX..XXXXXXX 100644
132
+ { .name = "cortex-a76", .initfn = aarch64_a76_initfn },
152
--- a/fpu/softfloat-parts.c.inc
133
{ .name = "a64fx", .initfn = aarch64_a64fx_initfn },
153
+++ b/fpu/softfloat-parts.c.inc
134
{ .name = "max", .initfn = aarch64_max_initfn },
154
@@ -XXX,XX +XXX,XX @@ static void partsN(uncanon_normal)(FloatPartsN *p, float_status *s,
135
#if defined(CONFIG_KVM) || defined(CONFIG_HVF)
155
}
156
frac_shr(p, frac_shift);
157
} else if (s->flush_to_zero) {
158
- flags |= float_flag_output_denormal;
159
+ flags |= float_flag_output_denormal_flushed;
160
p->cls = float_class_zero;
161
exp = 0;
162
frac_clear(p);
136
--
163
--
137
2.25.1
164
2.34.1
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
In softfloat-types.h a comment documents that if the float_status
2
field flush_to_zero is set then we flush denormalised results to 0
3
and set the inexact flag. This isn't correct: the status flag that
4
we set when flush_to_zero causes us to flush an output to zero is
5
float_flag_output_denormal_flushed.
2
6
3
Share the code to set AArch32 max features so that we no
7
Correct the comment.
4
longer have code drift between qemu{-system,}-{arm,aarch64}.
5
8
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20220506180242.216785-9-richard.henderson@linaro.org
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
11
Message-id: 20250124162836.2332150-22-peter.maydell@linaro.org
10
---
12
---
11
target/arm/internals.h | 2 +
13
include/fpu/softfloat-types.h | 2 +-
12
target/arm/cpu64.c | 50 +-----------------
14
1 file changed, 1 insertion(+), 1 deletion(-)
13
target/arm/cpu_tcg.c | 114 ++++++++++++++++++++++-------------------
14
3 files changed, 65 insertions(+), 101 deletions(-)
15
15
16
diff --git a/target/arm/internals.h b/target/arm/internals.h
16
diff --git a/include/fpu/softfloat-types.h b/include/fpu/softfloat-types.h
17
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
18
--- a/target/arm/internals.h
18
--- a/include/fpu/softfloat-types.h
19
+++ b/target/arm/internals.h
19
+++ b/include/fpu/softfloat-types.h
20
@@ -XXX,XX +XXX,XX @@ static inline void define_cortex_a72_a57_a53_cp_reginfo(ARMCPU *cpu) { }
20
@@ -XXX,XX +XXX,XX @@ typedef struct float_status {
21
void define_cortex_a72_a57_a53_cp_reginfo(ARMCPU *cpu);
21
Float3NaNPropRule float_3nan_prop_rule;
22
#endif
22
FloatInfZeroNaNRule float_infzeronan_rule;
23
23
bool tininess_before_rounding;
24
+void aa32_max_features(ARMCPU *cpu);
24
- /* should denormalised results go to zero and set the inexact flag? */
25
+
25
+ /* should denormalised results go to zero and set output_denormal_flushed? */
26
#endif
26
bool flush_to_zero;
27
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
27
/* should denormalised inputs go to zero and set input_denormal_flushed? */
28
index XXXXXXX..XXXXXXX 100644
28
bool flush_inputs_to_zero;
29
--- a/target/arm/cpu64.c
30
+++ b/target/arm/cpu64.c
31
@@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj)
32
{
33
ARMCPU *cpu = ARM_CPU(obj);
34
uint64_t t;
35
- uint32_t u;
36
37
if (kvm_enabled() || hvf_enabled()) {
38
/* With KVM or HVF, '-cpu max' is identical to '-cpu host' */
39
@@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj)
40
t = FIELD_DP64(t, ID_AA64ZFR0, F64MM, 1);
41
cpu->isar.id_aa64zfr0 = t;
42
43
- /* Replicate the same data to the 32-bit id registers. */
44
- u = cpu->isar.id_isar5;
45
- u = FIELD_DP32(u, ID_ISAR5, AES, 2); /* AES + PMULL */
46
- u = FIELD_DP32(u, ID_ISAR5, SHA1, 1);
47
- u = FIELD_DP32(u, ID_ISAR5, SHA2, 1);
48
- u = FIELD_DP32(u, ID_ISAR5, CRC32, 1);
49
- u = FIELD_DP32(u, ID_ISAR5, RDM, 1);
50
- u = FIELD_DP32(u, ID_ISAR5, VCMA, 1);
51
- cpu->isar.id_isar5 = u;
52
-
53
- u = cpu->isar.id_isar6;
54
- u = FIELD_DP32(u, ID_ISAR6, JSCVT, 1);
55
- u = FIELD_DP32(u, ID_ISAR6, DP, 1);
56
- u = FIELD_DP32(u, ID_ISAR6, FHM, 1);
57
- u = FIELD_DP32(u, ID_ISAR6, SB, 1);
58
- u = FIELD_DP32(u, ID_ISAR6, SPECRES, 1);
59
- u = FIELD_DP32(u, ID_ISAR6, BF16, 1);
60
- u = FIELD_DP32(u, ID_ISAR6, I8MM, 1);
61
- cpu->isar.id_isar6 = u;
62
-
63
- u = cpu->isar.id_pfr0;
64
- u = FIELD_DP32(u, ID_PFR0, DIT, 1);
65
- cpu->isar.id_pfr0 = u;
66
-
67
- u = cpu->isar.id_pfr2;
68
- u = FIELD_DP32(u, ID_PFR2, SSBS, 1);
69
- cpu->isar.id_pfr2 = u;
70
-
71
- u = cpu->isar.id_mmfr3;
72
- u = FIELD_DP32(u, ID_MMFR3, PAN, 2); /* ATS1E1 */
73
- cpu->isar.id_mmfr3 = u;
74
-
75
- u = cpu->isar.id_mmfr4;
76
- u = FIELD_DP32(u, ID_MMFR4, HPDS, 1); /* AA32HPD */
77
- u = FIELD_DP32(u, ID_MMFR4, AC2, 1); /* ACTLR2, HACTLR2 */
78
- u = FIELD_DP32(u, ID_MMFR4, CNP, 1); /* TTCNP */
79
- u = FIELD_DP32(u, ID_MMFR4, XNX, 1); /* TTS2UXN */
80
- cpu->isar.id_mmfr4 = u;
81
-
82
t = cpu->isar.id_aa64dfr0;
83
t = FIELD_DP64(t, ID_AA64DFR0, PMUVER, 5); /* v8.4-PMU */
84
cpu->isar.id_aa64dfr0 = t;
85
86
- u = cpu->isar.id_dfr0;
87
- u = FIELD_DP32(u, ID_DFR0, PERFMON, 5); /* v8.4-PMU */
88
- cpu->isar.id_dfr0 = u;
89
-
90
- u = cpu->isar.mvfr1;
91
- u = FIELD_DP32(u, MVFR1, FPHP, 3); /* v8.2-FP16 */
92
- u = FIELD_DP32(u, MVFR1, SIMDHP, 2); /* v8.2-FP16 */
93
- cpu->isar.mvfr1 = u;
94
+ /* Replicate the same data to the 32-bit id registers. */
95
+ aa32_max_features(cpu);
96
97
#ifdef CONFIG_USER_ONLY
98
/*
99
diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c
100
index XXXXXXX..XXXXXXX 100644
101
--- a/target/arm/cpu_tcg.c
102
+++ b/target/arm/cpu_tcg.c
103
@@ -XXX,XX +XXX,XX @@
104
#endif
105
#include "cpregs.h"
106
107
+
108
+/* Share AArch32 -cpu max features with AArch64. */
109
+void aa32_max_features(ARMCPU *cpu)
110
+{
111
+ uint32_t t;
112
+
113
+ /* Add additional features supported by QEMU */
114
+ t = cpu->isar.id_isar5;
115
+ t = FIELD_DP32(t, ID_ISAR5, AES, 2);
116
+ t = FIELD_DP32(t, ID_ISAR5, SHA1, 1);
117
+ t = FIELD_DP32(t, ID_ISAR5, SHA2, 1);
118
+ t = FIELD_DP32(t, ID_ISAR5, CRC32, 1);
119
+ t = FIELD_DP32(t, ID_ISAR5, RDM, 1);
120
+ t = FIELD_DP32(t, ID_ISAR5, VCMA, 1);
121
+ cpu->isar.id_isar5 = t;
122
+
123
+ t = cpu->isar.id_isar6;
124
+ t = FIELD_DP32(t, ID_ISAR6, JSCVT, 1);
125
+ t = FIELD_DP32(t, ID_ISAR6, DP, 1);
126
+ t = FIELD_DP32(t, ID_ISAR6, FHM, 1);
127
+ t = FIELD_DP32(t, ID_ISAR6, SB, 1);
128
+ t = FIELD_DP32(t, ID_ISAR6, SPECRES, 1);
129
+ t = FIELD_DP32(t, ID_ISAR6, BF16, 1);
130
+ t = FIELD_DP32(t, ID_ISAR6, I8MM, 1);
131
+ cpu->isar.id_isar6 = t;
132
+
133
+ t = cpu->isar.mvfr1;
134
+ t = FIELD_DP32(t, MVFR1, FPHP, 3); /* v8.2-FP16 */
135
+ t = FIELD_DP32(t, MVFR1, SIMDHP, 2); /* v8.2-FP16 */
136
+ cpu->isar.mvfr1 = t;
137
+
138
+ t = cpu->isar.mvfr2;
139
+ t = FIELD_DP32(t, MVFR2, SIMDMISC, 3); /* SIMD MaxNum */
140
+ t = FIELD_DP32(t, MVFR2, FPMISC, 4); /* FP MaxNum */
141
+ cpu->isar.mvfr2 = t;
142
+
143
+ t = cpu->isar.id_mmfr3;
144
+ t = FIELD_DP32(t, ID_MMFR3, PAN, 2); /* ATS1E1 */
145
+ cpu->isar.id_mmfr3 = t;
146
+
147
+ t = cpu->isar.id_mmfr4;
148
+ t = FIELD_DP32(t, ID_MMFR4, HPDS, 1); /* AA32HPD */
149
+ t = FIELD_DP32(t, ID_MMFR4, AC2, 1); /* ACTLR2, HACTLR2 */
150
+ t = FIELD_DP32(t, ID_MMFR4, CNP, 1); /* TTCNP */
151
+ t = FIELD_DP32(t, ID_MMFR4, XNX, 1); /* TTS2UXN */
152
+ cpu->isar.id_mmfr4 = t;
153
+
154
+ t = cpu->isar.id_pfr0;
155
+ t = FIELD_DP32(t, ID_PFR0, DIT, 1);
156
+ cpu->isar.id_pfr0 = t;
157
+
158
+ t = cpu->isar.id_pfr2;
159
+ t = FIELD_DP32(t, ID_PFR2, SSBS, 1);
160
+ cpu->isar.id_pfr2 = t;
161
+
162
+ t = cpu->isar.id_dfr0;
163
+ t = FIELD_DP32(t, ID_DFR0, PERFMON, 5); /* v8.4-PMU */
164
+ cpu->isar.id_dfr0 = t;
165
+}
166
+
167
#ifndef CONFIG_USER_ONLY
168
static uint64_t l2ctlr_read(CPUARMState *env, const ARMCPRegInfo *ri)
169
{
170
@@ -XXX,XX +XXX,XX @@ static void arm_v7m_class_init(ObjectClass *oc, void *data)
171
static void arm_max_initfn(Object *obj)
172
{
173
ARMCPU *cpu = ARM_CPU(obj);
174
- uint32_t t;
175
176
/* aarch64_a57_initfn, advertising none of the aarch64 features */
177
cpu->dtb_compatible = "arm,cortex-a57";
178
@@ -XXX,XX +XXX,XX @@ static void arm_max_initfn(Object *obj)
179
cpu->ccsidr[2] = 0x70ffe07a; /* 2048KB L2 cache */
180
define_cortex_a72_a57_a53_cp_reginfo(cpu);
181
182
- /* Add additional features supported by QEMU */
183
- t = cpu->isar.id_isar5;
184
- t = FIELD_DP32(t, ID_ISAR5, AES, 2);
185
- t = FIELD_DP32(t, ID_ISAR5, SHA1, 1);
186
- t = FIELD_DP32(t, ID_ISAR5, SHA2, 1);
187
- t = FIELD_DP32(t, ID_ISAR5, CRC32, 1);
188
- t = FIELD_DP32(t, ID_ISAR5, RDM, 1);
189
- t = FIELD_DP32(t, ID_ISAR5, VCMA, 1);
190
- cpu->isar.id_isar5 = t;
191
-
192
- t = cpu->isar.id_isar6;
193
- t = FIELD_DP32(t, ID_ISAR6, JSCVT, 1);
194
- t = FIELD_DP32(t, ID_ISAR6, DP, 1);
195
- t = FIELD_DP32(t, ID_ISAR6, FHM, 1);
196
- t = FIELD_DP32(t, ID_ISAR6, SB, 1);
197
- t = FIELD_DP32(t, ID_ISAR6, SPECRES, 1);
198
- t = FIELD_DP32(t, ID_ISAR6, BF16, 1);
199
- t = FIELD_DP32(t, ID_ISAR6, I8MM, 1);
200
- cpu->isar.id_isar6 = t;
201
-
202
- t = cpu->isar.mvfr1;
203
- t = FIELD_DP32(t, MVFR1, FPHP, 3); /* v8.2-FP16 */
204
- t = FIELD_DP32(t, MVFR1, SIMDHP, 2); /* v8.2-FP16 */
205
- cpu->isar.mvfr1 = t;
206
-
207
- t = cpu->isar.mvfr2;
208
- t = FIELD_DP32(t, MVFR2, SIMDMISC, 3); /* SIMD MaxNum */
209
- t = FIELD_DP32(t, MVFR2, FPMISC, 4); /* FP MaxNum */
210
- cpu->isar.mvfr2 = t;
211
-
212
- t = cpu->isar.id_mmfr3;
213
- t = FIELD_DP32(t, ID_MMFR3, PAN, 2); /* ATS1E1 */
214
- cpu->isar.id_mmfr3 = t;
215
-
216
- t = cpu->isar.id_mmfr4;
217
- t = FIELD_DP32(t, ID_MMFR4, HPDS, 1); /* AA32HPD */
218
- t = FIELD_DP32(t, ID_MMFR4, AC2, 1); /* ACTLR2, HACTLR2 */
219
- t = FIELD_DP32(t, ID_MMFR4, CNP, 1); /* TTCNP */
220
- t = FIELD_DP32(t, ID_MMFR4, XNX, 1); /* TTS2UXN */
221
- cpu->isar.id_mmfr4 = t;
222
-
223
- t = cpu->isar.id_pfr0;
224
- t = FIELD_DP32(t, ID_PFR0, DIT, 1);
225
- cpu->isar.id_pfr0 = t;
226
-
227
- t = cpu->isar.id_pfr2;
228
- t = FIELD_DP32(t, ID_PFR2, SSBS, 1);
229
- cpu->isar.id_pfr2 = t;
230
-
231
- t = cpu->isar.id_dfr0;
232
- t = FIELD_DP32(t, ID_DFR0, PERFMON, 5); /* v8.4-PMU */
233
- cpu->isar.id_dfr0 = t;
234
+ aa32_max_features(cpu);
235
236
#ifdef CONFIG_USER_ONLY
237
/*
238
--
29
--
239
2.25.1
30
2.34.1
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
The advsimd_addh etc helpers defined in helper-a64.c are identical to
2
the vfp_addh etc helpers defined in helper-vfp.c: both take two
3
float16 inputs (in a uint32_t type) plus a float_status* and are
4
simple wrappers around the softfloat float16_* functions.
2
5
3
Check for and defer any pending virtual SError.
6
(The duplication seems to be a historical accident: we added the
7
advsimd helpers in 2018 as part of the A64 implementation, and at
8
that time there was no f16 emulation in A32. Then later we added the
9
A32 f16 handling by extending the existing VFP helper macros to
10
generate f16 versions as well as f32 and f64, and didn't realise we
11
could clean things up.)
4
12
5
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
13
Remove the now-unnecessary advsimd helpers and make the places that
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
14
generated calls to them use the vfp helpers instead. Many of the
7
Message-id: 20220506180242.216785-17-richard.henderson@linaro.org
15
helper functions were already unused.
16
17
(The remaining advsimd_ helpers are those which don't have vfp
18
versions.)
19
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
20
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
21
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
22
Message-id: 20250124162836.2332150-26-peter.maydell@linaro.org
9
---
23
---
10
target/arm/helper.h | 1 +
24
target/arm/tcg/helper-a64.h | 8 --------
11
target/arm/a32.decode | 16 ++++++++------
25
target/arm/tcg/helper-a64.c | 9 ---------
12
target/arm/t32.decode | 18 ++++++++--------
26
target/arm/tcg/translate-a64.c | 16 ++++++++--------
13
target/arm/op_helper.c | 43 ++++++++++++++++++++++++++++++++++++++
27
3 files changed, 8 insertions(+), 25 deletions(-)
14
target/arm/translate-a64.c | 17 +++++++++++++++
15
target/arm/translate.c | 23 ++++++++++++++++++++
16
6 files changed, 103 insertions(+), 15 deletions(-)
17
28
18
diff --git a/target/arm/helper.h b/target/arm/helper.h
29
diff --git a/target/arm/tcg/helper-a64.h b/target/arm/tcg/helper-a64.h
19
index XXXXXXX..XXXXXXX 100644
30
index XXXXXXX..XXXXXXX 100644
20
--- a/target/arm/helper.h
31
--- a/target/arm/tcg/helper-a64.h
21
+++ b/target/arm/helper.h
32
+++ b/target/arm/tcg/helper-a64.h
22
@@ -XXX,XX +XXX,XX @@ DEF_HELPER_1(wfe, void, env)
33
@@ -XXX,XX +XXX,XX @@ DEF_HELPER_FLAGS_2(frecpx_f16, TCG_CALL_NO_RWG, f16, f16, fpst)
23
DEF_HELPER_1(yield, void, env)
34
DEF_HELPER_FLAGS_2(fcvtx_f64_to_f32, TCG_CALL_NO_RWG, f32, f64, fpst)
24
DEF_HELPER_1(pre_hvc, void, env)
35
DEF_HELPER_FLAGS_3(crc32_64, TCG_CALL_NO_RWG_SE, i64, i64, i64, i32)
25
DEF_HELPER_2(pre_smc, void, env, i32)
36
DEF_HELPER_FLAGS_3(crc32c_64, TCG_CALL_NO_RWG_SE, i64, i64, i64, i32)
26
+DEF_HELPER_1(vesb, void, env)
37
-DEF_HELPER_FLAGS_3(advsimd_maxh, TCG_CALL_NO_RWG, f16, f16, f16, fpst)
27
38
-DEF_HELPER_FLAGS_3(advsimd_minh, TCG_CALL_NO_RWG, f16, f16, f16, fpst)
28
DEF_HELPER_3(cpsr_write, void, env, i32, i32)
39
-DEF_HELPER_FLAGS_3(advsimd_maxnumh, TCG_CALL_NO_RWG, f16, f16, f16, fpst)
29
DEF_HELPER_2(cpsr_write_eret, void, env, i32)
40
-DEF_HELPER_FLAGS_3(advsimd_minnumh, TCG_CALL_NO_RWG, f16, f16, f16, fpst)
30
diff --git a/target/arm/a32.decode b/target/arm/a32.decode
41
-DEF_HELPER_3(advsimd_addh, f16, f16, f16, fpst)
42
-DEF_HELPER_3(advsimd_subh, f16, f16, f16, fpst)
43
-DEF_HELPER_3(advsimd_mulh, f16, f16, f16, fpst)
44
-DEF_HELPER_3(advsimd_divh, f16, f16, f16, fpst)
45
DEF_HELPER_3(advsimd_ceq_f16, i32, f16, f16, fpst)
46
DEF_HELPER_3(advsimd_cge_f16, i32, f16, f16, fpst)
47
DEF_HELPER_3(advsimd_cgt_f16, i32, f16, f16, fpst)
48
diff --git a/target/arm/tcg/helper-a64.c b/target/arm/tcg/helper-a64.c
31
index XXXXXXX..XXXXXXX 100644
49
index XXXXXXX..XXXXXXX 100644
32
--- a/target/arm/a32.decode
50
--- a/target/arm/tcg/helper-a64.c
33
+++ b/target/arm/a32.decode
51
+++ b/target/arm/tcg/helper-a64.c
34
@@ -XXX,XX +XXX,XX @@ SMULTT .... 0001 0110 .... 0000 .... 1110 .... @rd0mn
52
@@ -XXX,XX +XXX,XX @@ uint32_t ADVSIMD_HELPER(name, h)(uint32_t a, uint32_t b, float_status *fpst) \
35
53
return float16_ ## name(a, b, fpst); \
36
{
54
}
37
{
55
38
- YIELD ---- 0011 0010 0000 1111 ---- 0000 0001
56
-ADVSIMD_HALFOP(add)
39
- WFE ---- 0011 0010 0000 1111 ---- 0000 0010
57
-ADVSIMD_HALFOP(sub)
40
- WFI ---- 0011 0010 0000 1111 ---- 0000 0011
58
-ADVSIMD_HALFOP(mul)
41
+ [
59
-ADVSIMD_HALFOP(div)
42
+ YIELD ---- 0011 0010 0000 1111 ---- 0000 0001
60
-ADVSIMD_HALFOP(min)
43
+ WFE ---- 0011 0010 0000 1111 ---- 0000 0010
61
-ADVSIMD_HALFOP(max)
44
+ WFI ---- 0011 0010 0000 1111 ---- 0000 0011
62
-ADVSIMD_HALFOP(minnum)
45
63
-ADVSIMD_HALFOP(maxnum)
46
- # TODO: Implement SEV, SEVL; may help SMP performance.
64
-
47
- # SEV ---- 0011 0010 0000 1111 ---- 0000 0100
65
#define ADVSIMD_TWOHALFOP(name) \
48
- # SEVL ---- 0011 0010 0000 1111 ---- 0000 0101
66
uint32_t ADVSIMD_HELPER(name, 2h)(uint32_t two_a, uint32_t two_b, \
49
+ # TODO: Implement SEV, SEVL; may help SMP performance.
67
float_status *fpst) \
50
+ # SEV ---- 0011 0010 0000 1111 ---- 0000 0100
68
diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c
51
+ # SEVL ---- 0011 0010 0000 1111 ---- 0000 0101
52
+
53
+ ESB ---- 0011 0010 0000 1111 ---- 0001 0000
54
+ ]
55
56
# The canonical nop ends in 00000000, but the whole of the
57
# rest of the space executes as nop if otherwise unsupported.
58
diff --git a/target/arm/t32.decode b/target/arm/t32.decode
59
index XXXXXXX..XXXXXXX 100644
69
index XXXXXXX..XXXXXXX 100644
60
--- a/target/arm/t32.decode
70
--- a/target/arm/tcg/translate-a64.c
61
+++ b/target/arm/t32.decode
71
+++ b/target/arm/tcg/translate-a64.c
62
@@ -XXX,XX +XXX,XX @@ CLZ 1111 1010 1011 ---- 1111 .... 1000 .... @rdm
72
@@ -XXX,XX +XXX,XX @@ static const FPScalar f_scalar_fmul = {
63
[
73
TRANS(FMUL_s, do_fp3_scalar, a, &f_scalar_fmul)
64
# Hints, and CPS
74
65
{
75
static const FPScalar f_scalar_fmax = {
66
- YIELD 1111 0011 1010 1111 1000 0000 0000 0001
76
- gen_helper_advsimd_maxh,
67
- WFE 1111 0011 1010 1111 1000 0000 0000 0010
77
+ gen_helper_vfp_maxh,
68
- WFI 1111 0011 1010 1111 1000 0000 0000 0011
78
gen_helper_vfp_maxs,
69
+ [
79
gen_helper_vfp_maxd,
70
+ YIELD 1111 0011 1010 1111 1000 0000 0000 0001
80
};
71
+ WFE 1111 0011 1010 1111 1000 0000 0000 0010
81
TRANS(FMAX_s, do_fp3_scalar, a, &f_scalar_fmax)
72
+ WFI 1111 0011 1010 1111 1000 0000 0000 0011
82
73
83
static const FPScalar f_scalar_fmin = {
74
- # TODO: Implement SEV, SEVL; may help SMP performance.
84
- gen_helper_advsimd_minh,
75
- # SEV 1111 0011 1010 1111 1000 0000 0000 0100
85
+ gen_helper_vfp_minh,
76
- # SEVL 1111 0011 1010 1111 1000 0000 0000 0101
86
gen_helper_vfp_mins,
77
+ # TODO: Implement SEV, SEVL; may help SMP performance.
87
gen_helper_vfp_mind,
78
+ # SEV 1111 0011 1010 1111 1000 0000 0000 0100
88
};
79
+ # SEVL 1111 0011 1010 1111 1000 0000 0000 0101
89
TRANS(FMIN_s, do_fp3_scalar, a, &f_scalar_fmin)
80
90
81
- # For M-profile minimal-RAS ESB can be a NOP, which is the
91
static const FPScalar f_scalar_fmaxnm = {
82
- # default behaviour since it is in the hint space.
92
- gen_helper_advsimd_maxnumh,
83
- # ESB 1111 0011 1010 1111 1000 0000 0001 0000
93
+ gen_helper_vfp_maxnumh,
84
+ ESB 1111 0011 1010 1111 1000 0000 0001 0000
94
gen_helper_vfp_maxnums,
85
+ ]
95
gen_helper_vfp_maxnumd,
86
96
};
87
# The canonical nop ends in 0000 0000, but the whole rest
97
TRANS(FMAXNM_s, do_fp3_scalar, a, &f_scalar_fmaxnm)
88
# of the space is "reserved hint, behaves as nop".
98
89
diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c
99
static const FPScalar f_scalar_fminnm = {
90
index XXXXXXX..XXXXXXX 100644
100
- gen_helper_advsimd_minnumh,
91
--- a/target/arm/op_helper.c
101
+ gen_helper_vfp_minnumh,
92
+++ b/target/arm/op_helper.c
102
gen_helper_vfp_minnums,
93
@@ -XXX,XX +XXX,XX @@ void HELPER(probe_access)(CPUARMState *env, target_ulong ptr,
103
gen_helper_vfp_minnumd,
94
access_type, mmu_idx, ra);
104
};
95
}
105
@@ -XXX,XX +XXX,XX @@ static bool do_fp_reduction(DisasContext *s, arg_qrr_e *a,
96
}
97
+
98
+/*
99
+ * This function corresponds to AArch64.vESBOperation().
100
+ * Note that the AArch32 version is not functionally different.
101
+ */
102
+void HELPER(vesb)(CPUARMState *env)
103
+{
104
+ /*
105
+ * The EL2Enabled() check is done inside arm_hcr_el2_eff,
106
+ * and will return HCR_EL2.VSE == 0, so nothing happens.
107
+ */
108
+ uint64_t hcr = arm_hcr_el2_eff(env);
109
+ bool enabled = !(hcr & HCR_TGE) && (hcr & HCR_AMO);
110
+ bool pending = enabled && (hcr & HCR_VSE);
111
+ bool masked = (env->daif & PSTATE_A);
112
+
113
+ /* If VSE pending and masked, defer the exception. */
114
+ if (pending && masked) {
115
+ uint32_t syndrome;
116
+
117
+ if (arm_el_is_aa64(env, 1)) {
118
+ /* Copy across IDS and ISS from VSESR. */
119
+ syndrome = env->cp15.vsesr_el2 & 0x1ffffff;
120
+ } else {
121
+ ARMMMUFaultInfo fi = { .type = ARMFault_AsyncExternal };
122
+
123
+ if (extended_addresses_enabled(env)) {
124
+ syndrome = arm_fi_to_lfsc(&fi);
125
+ } else {
126
+ syndrome = arm_fi_to_sfsc(&fi);
127
+ }
128
+ /* Copy across AET and ExT from VSESR. */
129
+ syndrome |= env->cp15.vsesr_el2 & 0xd000;
130
+ }
131
+
132
+ /* Set VDISR_EL2.A along with the syndrome. */
133
+ env->cp15.vdisr_el2 = syndrome | (1u << 31);
134
+
135
+ /* Clear pending virtual SError */
136
+ env->cp15.hcr_el2 &= ~HCR_VSE;
137
+ cpu_reset_interrupt(env_cpu(env), CPU_INTERRUPT_VSERR);
138
+ }
139
+}
140
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
141
index XXXXXXX..XXXXXXX 100644
142
--- a/target/arm/translate-a64.c
143
+++ b/target/arm/translate-a64.c
144
@@ -XXX,XX +XXX,XX @@ static void handle_hint(DisasContext *s, uint32_t insn,
145
gen_helper_autib(cpu_X[17], cpu_env, cpu_X[17], cpu_X[16]);
146
}
147
break;
148
+ case 0b10000: /* ESB */
149
+ /* Without RAS, we must implement this as NOP. */
150
+ if (dc_isar_feature(aa64_ras, s)) {
151
+ /*
152
+ * QEMU does not have a source of physical SErrors,
153
+ * so we are only concerned with virtual SErrors.
154
+ * The pseudocode in the ARM for this case is
155
+ * if PSTATE.EL IN {EL0, EL1} && EL2Enabled() then
156
+ * AArch64.vESBOperation();
157
+ * Most of the condition can be evaluated at translation time.
158
+ * Test for EL2 present, and defer test for SEL2 to runtime.
159
+ */
160
+ if (s->current_el <= 1 && arm_dc_feature(s, ARM_FEATURE_EL2)) {
161
+ gen_helper_vesb(cpu_env);
162
+ }
163
+ }
164
+ break;
165
case 0b11000: /* PACIAZ */
166
if (s->pauth_active) {
167
gen_helper_pacia(cpu_X[30], cpu_env, cpu_X[30],
168
diff --git a/target/arm/translate.c b/target/arm/translate.c
169
index XXXXXXX..XXXXXXX 100644
170
--- a/target/arm/translate.c
171
+++ b/target/arm/translate.c
172
@@ -XXX,XX +XXX,XX @@ static bool trans_WFI(DisasContext *s, arg_WFI *a)
173
return true;
106
return true;
174
}
107
}
175
108
176
+static bool trans_ESB(DisasContext *s, arg_ESB *a)
109
-TRANS_FEAT(FMAXNMV_h, aa64_fp16, do_fp_reduction, a, gen_helper_advsimd_maxnumh)
177
+{
110
-TRANS_FEAT(FMINNMV_h, aa64_fp16, do_fp_reduction, a, gen_helper_advsimd_minnumh)
178
+ /*
111
-TRANS_FEAT(FMAXV_h, aa64_fp16, do_fp_reduction, a, gen_helper_advsimd_maxh)
179
+ * For M-profile, minimal-RAS ESB can be a NOP.
112
-TRANS_FEAT(FMINV_h, aa64_fp16, do_fp_reduction, a, gen_helper_advsimd_minh)
180
+ * Without RAS, we must implement this as NOP.
113
+TRANS_FEAT(FMAXNMV_h, aa64_fp16, do_fp_reduction, a, gen_helper_vfp_maxnumh)
181
+ */
114
+TRANS_FEAT(FMINNMV_h, aa64_fp16, do_fp_reduction, a, gen_helper_vfp_minnumh)
182
+ if (!arm_dc_feature(s, ARM_FEATURE_M) && dc_isar_feature(aa32_ras, s)) {
115
+TRANS_FEAT(FMAXV_h, aa64_fp16, do_fp_reduction, a, gen_helper_vfp_maxh)
183
+ /*
116
+TRANS_FEAT(FMINV_h, aa64_fp16, do_fp_reduction, a, gen_helper_vfp_minh)
184
+ * QEMU does not have a source of physical SErrors,
117
185
+ * so we are only concerned with virtual SErrors.
118
TRANS(FMAXNMV_s, do_fp_reduction, a, gen_helper_vfp_maxnums)
186
+ * The pseudocode in the ARM for this case is
119
TRANS(FMINNMV_s, do_fp_reduction, a, gen_helper_vfp_minnums)
187
+ * if PSTATE.EL IN {EL0, EL1} && EL2Enabled() then
188
+ * AArch32.vESBOperation();
189
+ * Most of the condition can be evaluated at translation time.
190
+ * Test for EL2 present, and defer test for SEL2 to runtime.
191
+ */
192
+ if (s->current_el <= 1 && arm_dc_feature(s, ARM_FEATURE_EL2)) {
193
+ gen_helper_vesb(cpu_env);
194
+ }
195
+ }
196
+ return true;
197
+}
198
+
199
static bool trans_NOP(DisasContext *s, arg_NOP *a)
200
{
201
return true;
202
--
120
--
203
2.25.1
121
2.34.1
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
We should be using the F16-specific float_status for conversions from
2
half-precision, because halfprec inputs never set Input Denormal.
2
3
3
Enable writes to the TERR and TEA bits when RAS is enabled.
4
Without FEAT_AHP, using the wrong fpst here had no effect, because
4
These bits are otherwise RES0.
5
the only difference between the A64_F16 and A64 fpst is its handling
6
of flush-to-zero on input and output, and the helper functions
7
vfp_fcvt_f16_to_* and vfp_fcvt_*_to_f16 all explicitly squash the
8
relevant flushing flags, and flush_inputs_to_zero was the only way
9
that IDC could be set.
5
10
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
11
With FEAT_AHP, the FPCR.AH=1 behaviour sets IDC for
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
12
input_denormal_used, which we will only ignore in
8
Message-id: 20220506180242.216785-15-richard.henderson@linaro.org
13
vfp_get_fpsr_from_host() for the A64_F16 fpst; so it matters that we
14
use that one for f16 inputs (and the normal one for single/double to
15
f16 conversions).
16
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
17
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
18
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
19
Message-id: 20250124162836.2332150-27-peter.maydell@linaro.org
10
---
20
---
11
target/arm/helper.c | 9 +++++++++
21
target/arm/tcg/translate-a64.c | 9 ++++++---
12
1 file changed, 9 insertions(+)
22
target/arm/tcg/translate-sve.c | 4 ++--
23
2 files changed, 8 insertions(+), 5 deletions(-)
13
24
14
diff --git a/target/arm/helper.c b/target/arm/helper.c
25
diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c
15
index XXXXXXX..XXXXXXX 100644
26
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/helper.c
27
--- a/target/arm/tcg/translate-a64.c
17
+++ b/target/arm/helper.c
28
+++ b/target/arm/tcg/translate-a64.c
18
@@ -XXX,XX +XXX,XX @@ static void scr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value)
29
@@ -XXX,XX +XXX,XX @@ static bool trans_FCVT_s_sh(DisasContext *s, arg_rr *a)
19
}
30
if (fp_access_check(s)) {
20
valid_mask &= ~SCR_NET;
31
TCGv_i32 tcg_rn = read_fp_hreg(s, a->rn);
21
32
TCGv_i32 tcg_rd = tcg_temp_new_i32();
22
+ if (cpu_isar_feature(aa64_ras, cpu)) {
33
- TCGv_ptr tcg_fpst = fpstatus_ptr(FPST_A64);
23
+ valid_mask |= SCR_TERR;
34
+ TCGv_ptr tcg_fpst = fpstatus_ptr(FPST_A64_F16);
24
+ }
35
TCGv_i32 tcg_ahp = get_ahp_flag();
25
if (cpu_isar_feature(aa64_lor, cpu)) {
36
26
valid_mask |= SCR_TLOR;
37
gen_helper_vfp_fcvt_f16_to_f32(tcg_rd, tcg_rn, tcg_fpst, tcg_ahp);
27
}
38
@@ -XXX,XX +XXX,XX @@ static bool trans_FCVT_s_dh(DisasContext *s, arg_rr *a)
28
@@ -XXX,XX +XXX,XX @@ static void scr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value)
39
if (fp_access_check(s)) {
29
}
40
TCGv_i32 tcg_rn = read_fp_hreg(s, a->rn);
30
} else {
41
TCGv_i64 tcg_rd = tcg_temp_new_i64();
31
valid_mask &= ~(SCR_RW | SCR_ST);
42
- TCGv_ptr tcg_fpst = fpstatus_ptr(FPST_A64);
32
+ if (cpu_isar_feature(aa32_ras, cpu)) {
43
+ TCGv_ptr tcg_fpst = fpstatus_ptr(FPST_A64_F16);
33
+ valid_mask |= SCR_TERR;
44
TCGv_i32 tcg_ahp = get_ahp_flag();
34
+ }
45
46
gen_helper_vfp_fcvt_f16_to_f64(tcg_rd, tcg_rn, tcg_fpst, tcg_ahp);
47
@@ -XXX,XX +XXX,XX @@ static bool trans_FCVTL_v(DisasContext *s, arg_qrr_e *a)
48
return true;
35
}
49
}
36
50
37
if (!arm_feature(env, ARM_FEATURE_EL2)) {
51
- fpst = fpstatus_ptr(FPST_A64);
38
@@ -XXX,XX +XXX,XX @@ static void do_hcr_write(CPUARMState *env, uint64_t value, uint64_t valid_mask)
52
if (a->esz == MO_64) {
39
if (cpu_isar_feature(aa64_vh, cpu)) {
53
/* 32 -> 64 bit fp conversion */
40
valid_mask |= HCR_E2H;
54
TCGv_i64 tcg_res[2];
41
}
55
TCGv_i32 tcg_op = tcg_temp_new_i32();
42
+ if (cpu_isar_feature(aa64_ras, cpu)) {
56
int srcelt = a->q ? 2 : 0;
43
+ valid_mask |= HCR_TERR | HCR_TEA;
57
44
+ }
58
+ fpst = fpstatus_ptr(FPST_A64);
45
if (cpu_isar_feature(aa64_lor, cpu)) {
59
+
46
valid_mask |= HCR_TLOR;
60
for (pass = 0; pass < 2; pass++) {
47
}
61
tcg_res[pass] = tcg_temp_new_i64();
62
read_vec_element_i32(s, tcg_op, a->rn, srcelt + pass, MO_32);
63
@@ -XXX,XX +XXX,XX @@ static bool trans_FCVTL_v(DisasContext *s, arg_qrr_e *a)
64
TCGv_i32 tcg_res[4];
65
TCGv_i32 ahp = get_ahp_flag();
66
67
+ fpst = fpstatus_ptr(FPST_A64_F16);
68
+
69
for (pass = 0; pass < 4; pass++) {
70
tcg_res[pass] = tcg_temp_new_i32();
71
read_vec_element_i32(s, tcg_res[pass], a->rn, srcelt + pass, MO_16);
72
diff --git a/target/arm/tcg/translate-sve.c b/target/arm/tcg/translate-sve.c
73
index XXXXXXX..XXXXXXX 100644
74
--- a/target/arm/tcg/translate-sve.c
75
+++ b/target/arm/tcg/translate-sve.c
76
@@ -XXX,XX +XXX,XX @@ TRANS_FEAT(FCMLA_zzxz, aa64_sve, gen_gvec_fpst_zzzz, fcmla_idx_fns[a->esz],
77
TRANS_FEAT(FCVT_sh, aa64_sve, gen_gvec_fpst_arg_zpz,
78
gen_helper_sve_fcvt_sh, a, 0, FPST_A64)
79
TRANS_FEAT(FCVT_hs, aa64_sve, gen_gvec_fpst_arg_zpz,
80
- gen_helper_sve_fcvt_hs, a, 0, FPST_A64)
81
+ gen_helper_sve_fcvt_hs, a, 0, FPST_A64_F16)
82
83
TRANS_FEAT(BFCVT, aa64_sve_bf16, gen_gvec_fpst_arg_zpz,
84
gen_helper_sve_bfcvt, a, 0, FPST_A64)
85
@@ -XXX,XX +XXX,XX @@ TRANS_FEAT(BFCVT, aa64_sve_bf16, gen_gvec_fpst_arg_zpz,
86
TRANS_FEAT(FCVT_dh, aa64_sve, gen_gvec_fpst_arg_zpz,
87
gen_helper_sve_fcvt_dh, a, 0, FPST_A64)
88
TRANS_FEAT(FCVT_hd, aa64_sve, gen_gvec_fpst_arg_zpz,
89
- gen_helper_sve_fcvt_hd, a, 0, FPST_A64)
90
+ gen_helper_sve_fcvt_hd, a, 0, FPST_A64_F16)
91
TRANS_FEAT(FCVT_ds, aa64_sve, gen_gvec_fpst_arg_zpz,
92
gen_helper_sve_fcvt_ds, a, 0, FPST_A64)
93
TRANS_FEAT(FCVT_sd, aa64_sve, gen_gvec_fpst_arg_zpz,
48
--
94
--
49
2.25.1
95
2.34.1
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Hongren Zheng <i@zenithal.me>
2
2
3
We set this for qemu-system-aarch64, but failed to do so
3
When USBPacket in OUT direction has larger payload
4
for the strictly 32-bit emulation.
4
than the ep_out_buffer (of size 512), a buffer overflow
5
would occur.
5
6
6
Fixes: 3bec78447a9 ("target/arm: Provide ARMv8.4-PMU in '-cpu max'")
7
It could be fixed by limiting the size of usb_packet_copy
8
to be at most buffer size. Further optimization gets rid
9
of the ep_out_buffer and directly uses ep_out as the target
10
buffer.
11
12
This is reported by a security researcher who artificially
13
constructed an OUT packet of size 2047. The report has gone
14
through the QEMU security process, and as this device is for
15
testing purpose and no deployment of it in virtualization
16
environment is observed, it is triaged not to be a security bug.
17
18
Cc: qemu-stable@nongnu.org
19
Fixes: d7d34918551dc48 ("hw/usb: Add CanoKey Implementation")
20
Reported-by: Juan Jose Lopez Jaimez <thatjiaozi@gmail.com>
21
Signed-off-by: Hongren Zheng <i@zenithal.me>
22
Message-id: Z4TfMOrZz6IQYl_h@Sun
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
23
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20220506180242.216785-8-richard.henderson@linaro.org
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
24
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
25
---
12
target/arm/cpu_tcg.c | 4 ++++
26
hw/usb/canokey.h | 4 ----
13
1 file changed, 4 insertions(+)
27
hw/usb/canokey.c | 6 +++---
28
2 files changed, 3 insertions(+), 7 deletions(-)
14
29
15
diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c
30
diff --git a/hw/usb/canokey.h b/hw/usb/canokey.h
16
index XXXXXXX..XXXXXXX 100644
31
index XXXXXXX..XXXXXXX 100644
17
--- a/target/arm/cpu_tcg.c
32
--- a/hw/usb/canokey.h
18
+++ b/target/arm/cpu_tcg.c
33
+++ b/hw/usb/canokey.h
19
@@ -XXX,XX +XXX,XX @@ static void arm_max_initfn(Object *obj)
34
@@ -XXX,XX +XXX,XX @@
20
t = FIELD_DP32(t, ID_PFR2, SSBS, 1);
35
#define CANOKEY_EP_NUM 3
21
cpu->isar.id_pfr2 = t;
36
/* BULK/INTR IN can be up to 1352 bytes, e.g. get key info */
22
37
#define CANOKEY_EP_IN_BUFFER_SIZE 2048
23
+ t = cpu->isar.id_dfr0;
38
-/* BULK OUT can be up to 270 bytes, e.g. PIV import cert */
24
+ t = FIELD_DP32(t, ID_DFR0, PERFMON, 5); /* v8.4-PMU */
39
-#define CANOKEY_EP_OUT_BUFFER_SIZE 512
25
+ cpu->isar.id_dfr0 = t;
40
26
+
41
typedef enum {
27
#ifdef CONFIG_USER_ONLY
42
CANOKEY_EP_IN_WAIT,
28
/*
43
@@ -XXX,XX +XXX,XX @@ typedef struct CanoKeyState {
29
* Break with true ARMv8 and add back old-style VFP short-vector support.
44
/* OUT pointer to canokey recv buffer */
45
uint8_t *ep_out[CANOKEY_EP_NUM];
46
uint32_t ep_out_size[CANOKEY_EP_NUM];
47
- /* For large BULK OUT, multiple write to ep_out is needed */
48
- uint8_t ep_out_buffer[CANOKEY_EP_NUM][CANOKEY_EP_OUT_BUFFER_SIZE];
49
50
/* Properties */
51
char *file; /* canokey-file */
52
diff --git a/hw/usb/canokey.c b/hw/usb/canokey.c
53
index XXXXXXX..XXXXXXX 100644
54
--- a/hw/usb/canokey.c
55
+++ b/hw/usb/canokey.c
56
@@ -XXX,XX +XXX,XX @@ static void canokey_handle_data(USBDevice *dev, USBPacket *p)
57
switch (p->pid) {
58
case USB_TOKEN_OUT:
59
trace_canokey_handle_data_out(ep_out, p->iov.size);
60
- usb_packet_copy(p, key->ep_out_buffer[ep_out], p->iov.size);
61
out_pos = 0;
62
+ /* segment packet into (possibly multiple) ep_out */
63
while (out_pos != p->iov.size) {
64
/*
65
* key->ep_out[ep_out] set by prepare_receive
66
@@ -XXX,XX +XXX,XX @@ static void canokey_handle_data(USBDevice *dev, USBPacket *p)
67
* to be the buffer length
68
*/
69
out_len = MIN(p->iov.size - out_pos, key->ep_out_size[ep_out]);
70
- memcpy(key->ep_out[ep_out],
71
- key->ep_out_buffer[ep_out] + out_pos, out_len);
72
+ /* usb_packet_copy would update the pos offset internally */
73
+ usb_packet_copy(p, key->ep_out[ep_out], out_len);
74
out_pos += out_len;
75
/* update ep_out_size to actual len */
76
key->ep_out_size[ep_out] = out_len;
30
--
77
--
31
2.25.1
78
2.34.1
diff view generated by jsdifflib