1
Arm queue; bugfixes only.
1
Hi; here's another arm pullreq; by volume most of this is
2
refactoring from me, but there are also some bugfixes and
3
other bits and pieces here.
2
4
3
thanks
5
thanks
4
-- PMM
6
-- PMM
5
7
6
The following changes since commit 48aa8f0ac536db3550a35c295ff7de94e4c33739:
8
The following changes since commit ed734377ab3f3f3cc15d7aa301a87ab6370f2eed:
7
9
8
Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2020-11-16' into staging (2020-11-17 11:07:00 +0000)
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)
9
11
10
are available in the Git repository at:
12
are available in the Git repository at:
11
13
12
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20201117
14
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20250128-1
13
15
14
for you to fetch changes up to ab135622cf478585bdfcb68b85e4a817d74a0c42:
16
for you to fetch changes up to 664280abddcb3cacc9c6204706bb739fcc1316f7:
15
17
16
tmp105: Correct handling of temperature limit checks (2020-11-17 12:56:33 +0000)
18
hw/usb/canokey: Fix buffer overflow for OUT packet (2025-01-28 18:40:19 +0000)
17
19
18
----------------------------------------------------------------
20
----------------------------------------------------------------
19
target-arm queue:
21
target-arm queue:
20
* hw/arm/virt: ARM_VIRT must select ARM_GIC
22
* hw/arm: Remove various uses of first_cpu global
21
* exynos: Fix bad printf format specifiers
23
* hw/char/imx_serial: Fix reset value of UFCR register
22
* hw/input/ps2.c: Remove remnants of printf debug
24
* hw/char/imx_serial: Update all state before restarting ageing timer
23
* target/openrisc: Remove dead code attempting to check "is timer disabled"
25
* hw/pci-host/designware: Expose MSI IRQ
24
* register: Remove unnecessary NULL check
26
* hw/arm/stellaris: refactoring, cleanup
25
* util/cutils: Fix Coverity array overrun in freq_to_str()
27
* hw/arm/stellaris: map both I2C controllers
26
* configure: Make "does libgio work" test pull in some actual functions
28
* tests/functional: Add a test for the arm microbit machine
27
* tmp105: reset the T_low and T_High registers
29
* target/arm: arm_reset_sve_state() should set FPSR, not FPCR
28
* tmp105: Correct handling of temperature limit checks
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
29
34
30
----------------------------------------------------------------
35
----------------------------------------------------------------
31
Alex Chen (1):
36
Bernhard Beschow (3):
32
exynos: Fix bad printf format specifiers
37
hw/char/imx_serial: Fix reset value of UFCR register
38
hw/char/imx_serial: Update all state before restarting ageing timer
39
hw/pci-host/designware: Expose MSI IRQ
33
40
34
Alistair Francis (1):
41
Hongren Zheng (1):
35
register: Remove unnecessary NULL check
42
hw/usb/canokey: Fix buffer overflow for OUT packet
36
43
37
Andrew Jones (1):
44
Peter Maydell (22):
38
hw/arm/virt: ARM_VIRT must select ARM_GIC
45
target/arm: arm_reset_sve_state() should set FPSR, not FPCR
46
target/arm: Use FPSR_ constants in vfp_exceptbits_from_host()
47
target/arm: Use uint32_t in vfp_exceptbits_from_host()
48
target/arm: Define new fp_status_a32 and fp_status_a64
49
target/arm: Use vfp.fp_status_a64 in A64-only helper functions
50
target/arm: Use fp_status_a64 or fp_status_a32 in is_ebf()
51
target/arm: Use fp_status_a32 in vjvct helper
52
target/arm: Use fp_status_a32 in vfp_cmp helpers
53
target/arm: Use FPST_A32 in A32 decoder
54
target/arm: Use FPST_A64 in A64 decoder
55
target/arm: Remove now-unused vfp.fp_status and FPST_FPCR
56
target/arm: Define new fp_status_f16_a32 and fp_status_f16_a64
57
target/arm: Use fp_status_f16_a32 in AArch32-only helpers
58
target/arm: Use fp_status_f16_a64 in AArch64-only helpers
59
target/arm: Use FPST_A32_F16 in A32 decoder
60
target/arm: Use FPST_A64_F16 in A64 decoder
61
target/arm: Remove now-unused vfp.fp_status_f16 and FPST_FPCR_F16
62
fpu: Rename float_flag_input_denormal to float_flag_input_denormal_flushed
63
fpu: Rename float_flag_output_denormal to float_flag_output_denormal_flushed
64
fpu: Fix a comment in softfloat-types.h
65
target/arm: Remove redundant advsimd float16 helpers
66
target/arm: Use FPST_A64_F16 for halfprec-to-other conversions
39
67
40
Peter Maydell (5):
68
Philippe Mathieu-Daudé (9):
41
hw/input/ps2.c: Remove remnants of printf debug
69
hw/arm/nrf51: Rename ARMv7MState 'cpu' -> 'armv7m'
42
target/openrisc: Remove dead code attempting to check "is timer disabled"
70
hw/arm/stellaris: Add 'armv7m' local variable
43
configure: Make "does libgio work" test pull in some actual functions
71
hw/arm/v7m: Remove use of &first_cpu in machine_init()
44
hw/misc/tmp105: reset the T_low and T_High registers
72
hw/arm/stellaris: Link each board schematic
45
tmp105: Correct handling of temperature limit checks
73
hw/arm/stellaris: Constify read-only arrays
74
hw/arm/stellaris: Remove incorrect unimplemented i2c-0 at 0x40002000
75
hw/arm/stellaris: Replace magic numbers by definitions
76
hw/arm/stellaris: Use DEVCAP macro to access DeviceCapability registers
77
hw/arm/stellaris: Map both I2C controllers
46
78
47
Philippe Mathieu-Daudé (1):
79
Thomas Huth (1):
48
util/cutils: Fix Coverity array overrun in freq_to_str()
80
tests/functional: Add a test for the arm microbit machine
49
81
50
configure | 11 +++++--
82
MAINTAINERS | 1 +
51
hw/misc/tmp105.h | 7 +++++
83
hw/usb/canokey.h | 4 --
52
hw/core/register.c | 4 ---
84
include/fpu/softfloat-types.h | 10 +--
53
hw/input/ps2.c | 9 ------
85
include/hw/arm/fsl-imx6.h | 4 +-
54
hw/misc/tmp105.c | 73 ++++++++++++++++++++++++++++++++++++++------
86
include/hw/arm/fsl-imx7.h | 4 +-
55
hw/timer/exynos4210_mct.c | 4 +--
87
include/hw/arm/nrf51_soc.h | 2 +-
56
hw/timer/exynos4210_pwm.c | 8 ++---
88
include/hw/char/imx_serial.h | 2 +-
57
target/openrisc/sys_helper.c | 3 --
89
include/hw/pci-host/designware.h | 1 +
58
util/cutils.c | 3 +-
90
target/arm/cpu.h | 12 ++--
59
hw/arm/Kconfig | 1 +
91
target/arm/tcg/helper-a64.h | 8 ---
60
10 files changed, 89 insertions(+), 34 deletions(-)
92
target/arm/tcg/translate.h | 32 ++++++---
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
61
133
diff view generated by jsdifflib
New patch
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
1
2
3
The ARMv7MState object is not simply a CPU, it also
4
contains the NVIC, SysTick timer, and various MemoryRegions.
5
6
Rename the field as 'armv7m', like other Cortex-M boards.
7
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
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
---
13
include/hw/arm/nrf51_soc.h | 2 +-
14
hw/arm/nrf51_soc.c | 18 +++++++++---------
15
2 files changed, 10 insertions(+), 10 deletions(-)
16
17
diff --git a/include/hw/arm/nrf51_soc.h b/include/hw/arm/nrf51_soc.h
18
index XXXXXXX..XXXXXXX 100644
19
--- a/include/hw/arm/nrf51_soc.h
20
+++ b/include/hw/arm/nrf51_soc.h
21
@@ -XXX,XX +XXX,XX @@ struct NRF51State {
22
SysBusDevice parent_obj;
23
24
/*< public >*/
25
- ARMv7MState cpu;
26
+ ARMv7MState armv7m;
27
28
NRF51UARTState uart;
29
NRF51RNGState rng;
30
diff --git a/hw/arm/nrf51_soc.c b/hw/arm/nrf51_soc.c
31
index XXXXXXX..XXXXXXX 100644
32
--- a/hw/arm/nrf51_soc.c
33
+++ b/hw/arm/nrf51_soc.c
34
@@ -XXX,XX +XXX,XX @@ static void nrf51_soc_realize(DeviceState *dev_soc, Error **errp)
35
}
36
/* This clock doesn't need migration because it is fixed-frequency */
37
clock_set_hz(s->sysclk, HCLK_FRQ);
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;
52
}
53
54
@@ -XXX,XX +XXX,XX @@ static void nrf51_soc_realize(DeviceState *dev_soc, Error **errp)
55
mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->uart), 0);
56
memory_region_add_subregion_overlap(&s->container, NRF51_UART_BASE, mr, 0);
57
sysbus_connect_irq(SYS_BUS_DEVICE(&s->uart), 0,
58
- qdev_get_gpio_in(DEVICE(&s->cpu),
59
+ qdev_get_gpio_in(DEVICE(&s->armv7m),
60
BASE_TO_IRQ(NRF51_UART_BASE)));
61
62
/* RNG */
63
@@ -XXX,XX +XXX,XX @@ static void nrf51_soc_realize(DeviceState *dev_soc, Error **errp)
64
mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->rng), 0);
65
memory_region_add_subregion_overlap(&s->container, NRF51_RNG_BASE, mr, 0);
66
sysbus_connect_irq(SYS_BUS_DEVICE(&s->rng), 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)));
79
}
80
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");
95
--
96
2.34.1
97
98
diff view generated by jsdifflib
New patch
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
1
2
3
While the TYPE_ARMV7M object forward its NVIC interrupt lines,
4
it is somehow misleading to name it 'nvic'. Add the 'armv7m'
5
local variable for clarity, but also keep the 'nvic' variable
6
behaving like before when used for wiring IRQ lines.
7
8
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
9
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
10
Message-id: 20250112225614.33723-3-philmd@linaro.org
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
---
13
hw/arm/stellaris.c | 21 +++++++++++----------
14
1 file changed, 11 insertions(+), 10 deletions(-)
15
16
diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c
17
index XXXXXXX..XXXXXXX 100644
18
--- a/hw/arm/stellaris.c
19
+++ b/hw/arm/stellaris.c
20
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
21
*/
22
23
Object *soc_container;
24
- DeviceState *gpio_dev[7], *nvic;
25
+ DeviceState *gpio_dev[7], *armv7m, *nvic;
26
qemu_irq gpio_in[7][8];
27
qemu_irq gpio_out[7][8];
28
qemu_irq adc;
29
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
30
qdev_prop_set_uint32(ssys_dev, "dc4", board->dc4);
31
sysbus_realize_and_unref(SYS_BUS_DEVICE(ssys_dev), &error_fatal);
32
33
- nvic = qdev_new(TYPE_ARMV7M);
34
- object_property_add_child(soc_container, "v7m", OBJECT(nvic));
35
- qdev_prop_set_uint32(nvic, "num-irq", NUM_IRQ_LINES);
36
- qdev_prop_set_uint8(nvic, "num-prio-bits", NUM_PRIO_BITS);
37
- qdev_prop_set_string(nvic, "cpu-type", ms->cpu_type);
38
- qdev_prop_set_bit(nvic, "enable-bitband", true);
39
- qdev_connect_clock_in(nvic, "cpuclk",
40
+ armv7m = qdev_new(TYPE_ARMV7M);
41
+ object_property_add_child(soc_container, "v7m", OBJECT(armv7m));
42
+ qdev_prop_set_uint32(armv7m, "num-irq", NUM_IRQ_LINES);
43
+ qdev_prop_set_uint8(armv7m, "num-prio-bits", NUM_PRIO_BITS);
44
+ qdev_prop_set_string(armv7m, "cpu-type", ms->cpu_type);
45
+ qdev_prop_set_bit(armv7m, "enable-bitband", true);
46
+ qdev_connect_clock_in(armv7m, "cpuclk",
47
qdev_get_clock_out(ssys_dev, "SYSCLK"));
48
/* This SoC does not connect the systick reference clock */
49
- object_property_set_link(OBJECT(nvic), "memory",
50
+ object_property_set_link(OBJECT(armv7m), "memory",
51
OBJECT(get_system_memory()), &error_abort);
52
/* This will exit with an error if the user passed us a bad cpu_type */
53
- sysbus_realize_and_unref(SYS_BUS_DEVICE(nvic), &error_fatal);
54
+ sysbus_realize_and_unref(SYS_BUS_DEVICE(armv7m), &error_fatal);
55
+ nvic = armv7m;
56
57
/* Now we can wire up the IRQ and MMIO of the system registers */
58
sysbus_mmio_map(SYS_BUS_DEVICE(ssys_dev), 0, 0x400fe000);
59
--
60
2.34.1
61
62
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
Fix Coverity CID 1435957: Memory - illegal accesses (OVERRUN):
3
When instanciating the machine model, the machine_init()
4
implementations usually create the CPUs, so have access
5
to its first CPU. Use that rather then the &first_cpu
6
global.
4
7
5
>>> Overrunning array "suffixes" of 7 8-byte elements at element
8
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
6
index 7 (byte offset 63) using index "idx" (which evaluates to 7).
9
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
7
10
Reviewed-by: Samuel Tardieu <sam@rfc1149.net>
8
Note, the biggest input value freq_to_str() can accept is UINT64_MAX,
11
Message-id: 20250112225614.33723-4-philmd@linaro.org
9
which is ~18.446 EHz, less than 1000 EHz.
10
11
Reported-by: Eduardo Habkost <ehabkost@redhat.com>
12
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
13
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
14
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
15
Reviewed-by: Luc Michel <luc@lmichel.fr>
16
Message-id: 20201101215755.2021421-1-f4bug@amsat.org
17
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
18
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
19
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
20
---
13
---
21
util/cutils.c | 3 ++-
14
hw/arm/b-l475e-iot01a.c | 2 +-
22
1 file changed, 2 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(-)
23
26
24
diff --git a/util/cutils.c b/util/cutils.c
27
diff --git a/hw/arm/b-l475e-iot01a.c b/hw/arm/b-l475e-iot01a.c
25
index XXXXXXX..XXXXXXX 100644
28
index XXXXXXX..XXXXXXX 100644
26
--- a/util/cutils.c
29
--- a/hw/arm/b-l475e-iot01a.c
27
+++ b/util/cutils.c
30
+++ b/hw/arm/b-l475e-iot01a.c
28
@@ -XXX,XX +XXX,XX @@ char *freq_to_str(uint64_t freq_hz)
31
@@ -XXX,XX +XXX,XX @@ static void bl475e_init(MachineState *machine)
29
double freq = freq_hz;
32
sysbus_realize(SYS_BUS_DEVICE(&s->soc), &error_fatal);
30
size_t idx = 0;
33
31
34
sc = STM32L4X5_SOC_GET_CLASS(&s->soc);
32
- while (freq >= 1000.0 && idx < ARRAY_SIZE(suffixes)) {
35
- armv7m_load_kernel(ARM_CPU(first_cpu), machine->kernel_filename, 0,
33
+ while (freq >= 1000.0) {
36
+ armv7m_load_kernel(s->soc.armv7m.cpu, machine->kernel_filename, 0,
34
freq /= 1000.0;
37
sc->flash_size);
35
idx++;
38
39
if (object_class_by_name(TYPE_DM163)) {
40
diff --git a/hw/arm/microbit.c b/hw/arm/microbit.c
41
index XXXXXXX..XXXXXXX 100644
42
--- a/hw/arm/microbit.c
43
+++ b/hw/arm/microbit.c
44
@@ -XXX,XX +XXX,XX @@ static void microbit_init(MachineState *machine)
45
memory_region_add_subregion_overlap(&s->nrf51.container, NRF51_TWI_BASE,
46
mr, -1);
47
48
- armv7m_load_kernel(ARM_CPU(first_cpu), machine->kernel_filename,
49
+ armv7m_load_kernel(s->nrf51.armv7m.cpu, machine->kernel_filename,
50
0, s->nrf51.flash_size);
51
}
52
53
diff --git a/hw/arm/mps2-tz.c b/hw/arm/mps2-tz.c
54
index XXXXXXX..XXXXXXX 100644
55
--- a/hw/arm/mps2-tz.c
56
+++ b/hw/arm/mps2-tz.c
57
@@ -XXX,XX +XXX,XX @@ static void mps2tz_common_init(MachineState *machine)
58
mms->remap_irq);
36
}
59
}
37
+ assert(idx < ARRAY_SIZE(suffixes));
60
38
61
- armv7m_load_kernel(ARM_CPU(first_cpu), machine->kernel_filename,
39
return g_strdup_printf("%0.3g %sHz", freq, suffixes[idx]);
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);
40
}
169
}
41
--
170
--
42
2.20.1
171
2.34.1
43
172
44
173
diff view generated by jsdifflib
New patch
1
From: Bernhard Beschow <shentey@gmail.com>
1
2
3
The value of the UCFR register is respected when echoing characters to the
4
terminal, but its reset value is reserved. Fix the reset value to the one
5
documented in the datasheet.
6
7
While at it move the related attribute out of the section of unimplemented
8
registers since its value is actually respected.
9
10
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
11
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
14
include/hw/char/imx_serial.h | 2 +-
15
hw/char/imx_serial.c | 1 +
16
2 files changed, 2 insertions(+), 1 deletion(-)
17
18
diff --git a/include/hw/char/imx_serial.h b/include/hw/char/imx_serial.h
19
index XXXXXXX..XXXXXXX 100644
20
--- a/include/hw/char/imx_serial.h
21
+++ b/include/hw/char/imx_serial.h
22
@@ -XXX,XX +XXX,XX @@ struct IMXSerialState {
23
uint32_t ucr1;
24
uint32_t ucr2;
25
uint32_t uts1;
26
+ uint32_t ufcr;
27
28
/*
29
* The registers below are implemented just so that the
30
* guest OS sees what it has written
31
*/
32
uint32_t onems;
33
- uint32_t ufcr;
34
uint32_t ubmr;
35
uint32_t ubrc;
36
uint32_t ucr3;
37
diff --git a/hw/char/imx_serial.c b/hw/char/imx_serial.c
38
index XXXXXXX..XXXXXXX 100644
39
--- a/hw/char/imx_serial.c
40
+++ b/hw/char/imx_serial.c
41
@@ -XXX,XX +XXX,XX @@ static void imx_serial_reset(IMXSerialState *s)
42
s->ucr3 = 0x700;
43
s->ubmr = 0;
44
s->ubrc = 4;
45
+ s->ufcr = BIT(11) | BIT(0);
46
47
fifo32_reset(&s->rx_fifo);
48
timer_del(&s->ageing_timer);
49
--
50
2.34.1
diff view generated by jsdifflib
New patch
1
From: Bernhard Beschow <shentey@gmail.com>
1
2
3
Fixes characters to be "echoed" after each keystroke rather than after every
4
other since imx_serial_rx_fifo_ageing_timer_restart() would see ~UTS1_RXEMPTY
5
only after every other keystroke.
6
7
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
hw/char/imx_serial.c | 6 +++---
12
1 file changed, 3 insertions(+), 3 deletions(-)
13
14
diff --git a/hw/char/imx_serial.c b/hw/char/imx_serial.c
15
index XXXXXXX..XXXXXXX 100644
16
--- a/hw/char/imx_serial.c
17
+++ b/hw/char/imx_serial.c
18
@@ -XXX,XX +XXX,XX @@ static void imx_put_data(void *opaque, uint32_t value)
19
if (fifo32_num_used(&s->rx_fifo) >= rxtl) {
20
s->usr1 |= USR1_RRDY;
21
}
22
-
23
- imx_serial_rx_fifo_ageing_timer_restart(s);
24
-
25
s->usr2 |= USR2_RDR;
26
s->uts1 &= ~UTS1_RXEMPTY;
27
if (value & URXD_BRK) {
28
s->usr2 |= USR2_BRCD;
29
}
30
+
31
+ imx_serial_rx_fifo_ageing_timer_restart(s);
32
+
33
imx_update(s);
34
}
35
36
--
37
2.34.1
diff view generated by jsdifflib
1
From: Andrew Jones <drjones@redhat.com>
1
From: Bernhard Beschow <shentey@gmail.com>
2
2
3
The removal of the selection of A15MPCORE from ARM_VIRT also
3
Fixes INTD and MSI interrupts poking the same IRQ line without keeping track of
4
removed what A15MPCORE selects, ARM_GIC. We still need ARM_GIC.
4
each other's IRQ level. Furthermore, SoCs such as the i.MX 8M Plus don't share
5
the MSI IRQ with the INTx lines, so expose it as a dedicated pin.
5
6
6
Fixes: bec3c97e0cf9 ("hw/arm/virt: Remove dependency on Cortex-A15 MPCore peripherals")
7
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
7
Reported-by: Miroslav Rezanina <mrezanin@redhat.com>
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Andrew Jones <drjones@redhat.com>
9
Reviewed-by: Miroslav Rezanina <mrezanin@redhat.com>
10
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
11
Message-id: 20201111143440.112763-1-drjones@redhat.com
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
10
---
14
hw/arm/Kconfig | 1 +
11
include/hw/arm/fsl-imx6.h | 4 +++-
15
1 file changed, 1 insertion(+)
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(-)
16
19
20
diff --git a/include/hw/arm/fsl-imx6.h b/include/hw/arm/fsl-imx6.h
21
index XXXXXXX..XXXXXXX 100644
22
--- a/include/hw/arm/fsl-imx6.h
23
+++ b/include/hw/arm/fsl-imx6.h
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);
185
}
186
}
187
188
@@ -XXX,XX +XXX,XX @@ static void designware_pcie_root_config_write(PCIDevice *d, uint32_t address,
189
case DESIGNWARE_PCIE_MSI_INTR0_STATUS:
190
root->msi.intr[0].status ^= val;
191
if (!root->msi.intr[0].status) {
192
- qemu_set_irq(host->pci.irqs[DESIGNWARE_PCIE_IRQ_MSI], 0);
193
+ qemu_set_irq(host->pci.msi, 0);
194
}
195
break;
196
197
@@ -XXX,XX +XXX,XX @@ static void designware_pcie_host_realize(DeviceState *dev, Error **errp)
198
for (i = 0; i < ARRAY_SIZE(s->pci.irqs); i++) {
199
sysbus_init_irq(sbd, &s->pci.irqs[i]);
200
}
201
+ sysbus_init_irq(sbd, &s->pci.msi);
202
203
memory_region_init_io(&s->mmio,
204
OBJECT(s),
17
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
205
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
18
index XXXXXXX..XXXXXXX 100644
206
index XXXXXXX..XXXXXXX 100644
19
--- a/hw/arm/Kconfig
207
--- a/hw/arm/Kconfig
20
+++ b/hw/arm/Kconfig
208
+++ b/hw/arm/Kconfig
21
@@ -XXX,XX +XXX,XX @@ config ARM_VIRT
209
@@ -XXX,XX +XXX,XX @@ config FSL_IMX6
22
imply VFIO_PLATFORM
210
select PL310 # cache controller
23
imply VFIO_XGMAC
211
select PCI_EXPRESS_DESIGNWARE
24
imply TPM_TIS_SYSBUS
212
select SDHCI
25
+ select ARM_GIC
213
+ select OR_IRQ
26
select ACPI
214
27
select ARM_SMMUV3
215
config ASPEED_SOC
28
select GPIO_KEY
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
29
--
225
--
30
2.20.1
226
2.34.1
31
32
diff view generated by jsdifflib
1
The TMP105 datasheet (https://www.ti.com/lit/gpn/tmp105) says that the
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
power-up reset values for the T_low and T_high registers are 80 degrees C
3
and 75 degrees C, which are 0x500 and 0x4B0 hex according to table 5. These
4
values are then shifted right by four bits to give the register reset
5
values, since both registers store the 12 bits of temperature data in bits
6
[15..4] of a 16 bit register.
7
2
8
We were resetting these registers to zero, which is problematic for Linux
3
Board schematic is useful to corroborate GPIOs/IRQs wiring.
9
guests which enable the alert interrupt and then immediately take an
10
unexpected overtemperature alert because the current temperature is above
11
freezing...
12
4
5
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Message-id: 20250110160204.74997-2-philmd@linaro.org
8
[PMM: Use https:// URLs]
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
Reviewed-by: Cédric Le Goater <clg@kaod.org>
15
Message-id: 20201110150023.25533-2-peter.maydell@linaro.org
16
---
10
---
17
hw/misc/tmp105.c | 3 +++
11
hw/arm/stellaris.c | 8 ++++++++
18
1 file changed, 3 insertions(+)
12
1 file changed, 8 insertions(+)
19
13
20
diff --git a/hw/misc/tmp105.c b/hw/misc/tmp105.c
14
diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c
21
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
22
--- a/hw/misc/tmp105.c
16
--- a/hw/arm/stellaris.c
23
+++ b/hw/misc/tmp105.c
17
+++ b/hw/arm/stellaris.c
24
@@ -XXX,XX +XXX,XX @@ static void tmp105_reset(I2CSlave *i2c)
18
@@ -XXX,XX +XXX,XX @@ static void lm3s6965evb_init(MachineState *machine)
25
s->faults = tmp105_faultq[(s->config >> 3) & 3];
19
stellaris_init(machine, &stellaris_boards[1]);
26
s->alarm = 0;
27
28
+ s->limit[0] = 0x4b00; /* T_LOW, 75 degrees C */
29
+ s->limit[1] = 0x5000; /* T_HIGH, 80 degrees C */
30
+
31
tmp105_interrupt_update(s);
32
}
20
}
33
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,
31
};
32
33
+/*
34
+ * Stellaris: LM3S6965 Evaluation Board Schematics:
35
+ * https://www.ti.com/lit/ug/symlink/spmu029.pdf
36
+ */
37
static void lm3s6965evb_class_init(ObjectClass *oc, void *data)
38
{
39
MachineClass *mc = MACHINE_CLASS(oc);
34
--
40
--
35
2.20.1
41
2.34.1
36
42
37
43
diff view generated by jsdifflib
1
The TMP105 datasheet says that in Interrupt Mode (when TM==1) the device
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
signals an alert when the temperature equals or exceeds the T_high value and
3
then remains high until a device register is read or the device responds to
4
the SMBUS Alert Response address, or the device is put into Shutdown Mode.
5
Thereafter the Alert pin will only be re-signalled when temperature falls
6
below T_low; alert can then be cleared in the same set of ways, and the
7
device returns to its initial "alert when temperature goes above T_high"
8
mode. (If this textual description is confusing, see figure 3 in the
9
TI datasheet at https://www.ti.com/lit/gpn/tmp105 .)
10
2
11
We were misimplementing this as a simple "always alert if temperature is
3
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
12
above T_high or below T_low" condition, which gives a spurious alert on
4
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
13
startup if using the "T_high = 80 degrees C, T_low = 75 degrees C" reset
5
Message-id: 20250110160204.74997-3-philmd@linaro.org
14
limit values.
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
---
8
hw/arm/stellaris.c | 6 +++---
9
1 file changed, 3 insertions(+), 3 deletions(-)
15
10
16
Implement the correct (hysteresis) behaviour by tracking whether we
11
diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c
17
are currently looking for the temperature to rise over T_high or
18
for it to fall below T_low. Our implementation of the comparator
19
mode (TM==0) wasn't wrong, but rephrase it to match the way that
20
interrupt mode is now handled for clarity.
21
22
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
23
Reviewed-by: Cédric Le Goater <clg@kaod.org>
24
Message-id: 20201110150023.25533-3-peter.maydell@linaro.org
25
---
26
hw/misc/tmp105.h | 7 +++++
27
hw/misc/tmp105.c | 70 +++++++++++++++++++++++++++++++++++++++++-------
28
2 files changed, 68 insertions(+), 9 deletions(-)
29
30
diff --git a/hw/misc/tmp105.h b/hw/misc/tmp105.h
31
index XXXXXXX..XXXXXXX 100644
12
index XXXXXXX..XXXXXXX 100644
32
--- a/hw/misc/tmp105.h
13
--- a/hw/arm/stellaris.c
33
+++ b/hw/misc/tmp105.h
14
+++ b/hw/arm/stellaris.c
34
@@ -XXX,XX +XXX,XX @@ struct TMP105State {
15
@@ -XXX,XX +XXX,XX @@ static void ssys_update(ssys_state *s)
35
int16_t limit[2];
16
qemu_set_irq(s->irq, (s->int_status & s->int_mask) != 0);
36
int faults;
17
}
37
uint8_t alarm;
18
38
+ /*
19
-static uint32_t pllcfg_sandstorm[16] = {
39
+ * The TMP105 initially looks for a temperature rising above T_high;
20
+static const uint32_t pllcfg_sandstorm[16] = {
40
+ * once this is detected, the condition it looks for next is the
21
0x31c0, /* 1 Mhz */
41
+ * temperature falling below T_low. This flag is false when initially
22
0x1ae0, /* 1.8432 Mhz */
42
+ * looking for T_high, true when looking for T_low.
23
0x18c0, /* 2 Mhz */
43
+ */
24
@@ -XXX,XX +XXX,XX @@ static uint32_t pllcfg_sandstorm[16] = {
44
+ bool detect_falling;
25
0x585b /* 8.192 Mhz */
45
};
26
};
46
27
47
#endif
28
-static uint32_t pllcfg_fury[16] = {
48
diff --git a/hw/misc/tmp105.c b/hw/misc/tmp105.c
29
+static const uint32_t pllcfg_fury[16] = {
49
index XXXXXXX..XXXXXXX 100644
30
0x3200, /* 1 Mhz */
50
--- a/hw/misc/tmp105.c
31
0x1b20, /* 1.8432 Mhz */
51
+++ b/hw/misc/tmp105.c
32
0x1900, /* 2 Mhz */
52
@@ -XXX,XX +XXX,XX @@ static void tmp105_alarm_update(TMP105State *s)
33
@@ -XXX,XX +XXX,XX @@ static void stellaris_adc_init(Object *obj)
53
return;
54
}
55
56
- if ((s->config >> 1) & 1) {                    /* TM */
57
- if (s->temperature >= s->limit[1])
58
- s->alarm = 1;
59
- else if (s->temperature < s->limit[0])
60
- s->alarm = 1;
61
+ if (s->config >> 1 & 1) {
62
+ /*
63
+ * TM == 1 : Interrupt mode. We signal Alert when the
64
+ * temperature rises above T_high, and expect the guest to clear
65
+ * it (eg by reading a device register).
66
+ */
67
+ if (s->detect_falling) {
68
+ if (s->temperature < s->limit[0]) {
69
+ s->alarm = 1;
70
+ s->detect_falling = false;
71
+ }
72
+ } else {
73
+ if (s->temperature >= s->limit[1]) {
74
+ s->alarm = 1;
75
+ s->detect_falling = true;
76
+ }
77
+ }
78
} else {
79
- if (s->temperature >= s->limit[1])
80
- s->alarm = 1;
81
- else if (s->temperature < s->limit[0])
82
- s->alarm = 0;
83
+ /*
84
+ * TM == 0 : Comparator mode. We signal Alert when the temperature
85
+ * rises above T_high, and stop signalling it when the temperature
86
+ * falls below T_low.
87
+ */
88
+ if (s->detect_falling) {
89
+ if (s->temperature < s->limit[0]) {
90
+ s->alarm = 0;
91
+ s->detect_falling = false;
92
+ }
93
+ } else {
94
+ if (s->temperature >= s->limit[1]) {
95
+ s->alarm = 1;
96
+ s->detect_falling = true;
97
+ }
98
+ }
99
}
100
101
tmp105_interrupt_update(s);
102
@@ -XXX,XX +XXX,XX @@ static int tmp105_post_load(void *opaque, int version_id)
103
return 0;
104
}
34
}
105
35
106
+static bool detect_falling_needed(void *opaque)
36
/* Board init. */
107
+{
37
-static stellaris_board_info stellaris_boards[] = {
108
+ TMP105State *s = opaque;
38
+static const stellaris_board_info stellaris_boards[] = {
109
+
39
{ "LM3S811EVB",
110
+ /*
40
0,
111
+ * We only need to migrate the detect_falling bool if it's set;
41
0x0032000e,
112
+ * for migration from older machines we assume that it is false
113
+ * (ie temperature is not out of range).
114
+ */
115
+ return s->detect_falling;
116
+}
117
+
118
+static const VMStateDescription vmstate_tmp105_detect_falling = {
119
+ .name = "TMP105/detect-falling",
120
+ .version_id = 1,
121
+ .minimum_version_id = 1,
122
+ .needed = detect_falling_needed,
123
+ .fields = (VMStateField[]) {
124
+ VMSTATE_BOOL(detect_falling, TMP105State),
125
+ VMSTATE_END_OF_LIST()
126
+ }
127
+};
128
+
129
static const VMStateDescription vmstate_tmp105 = {
130
.name = "TMP105",
131
.version_id = 0,
132
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_tmp105 = {
133
VMSTATE_UINT8(alarm, TMP105State),
134
VMSTATE_I2C_SLAVE(i2c, TMP105State),
135
VMSTATE_END_OF_LIST()
136
+ },
137
+ .subsections = (const VMStateDescription*[]) {
138
+ &vmstate_tmp105_detect_falling,
139
+ NULL
140
}
141
};
142
143
@@ -XXX,XX +XXX,XX @@ static void tmp105_reset(I2CSlave *i2c)
144
s->config = 0;
145
s->faults = tmp105_faultq[(s->config >> 3) & 3];
146
s->alarm = 0;
147
+ s->detect_falling = false;
148
149
s->limit[0] = 0x4b00; /* T_LOW, 75 degrees C */
150
s->limit[1] = 0x5000; /* T_HIGH, 80 degrees C */
151
--
42
--
152
2.20.1
43
2.34.1
153
44
154
45
diff view generated by jsdifflib
1
In commit 76346b6264a9b01979 we tried to add a configure check that
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
the libgio pkg-config data was correct, which builds an executable
3
linked against it. Unfortunately this doesn't catch the problem
4
(missing static library dependency info), because a "do nothing" test
5
source file doesn't have any symbol references that cause the linker
6
to pull in .o files from libgio.a, and so we don't see the "missing
7
symbols from libmount" error that a full QEMU link triggers.
8
2
9
(The ineffective test went unnoticed because of a typo that
3
There is nothing mapped at 0x40002000.
10
effectively disabled libgio unconditionally, but after commit
11
3569a5dfc11f2 fixed that, a static link of the system emulator on
12
Ubuntu stopped working again.)
13
4
14
Improve the gio test by having the test source fragment reference a
5
I2C#0 is already mapped at 0x40021000.
15
g_dbus function (which is what is indirectly causing us to end up
16
wanting functions from libmount).
17
6
7
Remove the invalid mapping added in commits aecfbbc97a2 & 394c8bbfb7a.
8
9
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
10
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
11
Message-id: 20250110160204.74997-4-philmd@linaro.org
18
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
19
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
20
Message-id: 20201116104617.18333-1-peter.maydell@linaro.org
21
---
13
---
22
configure | 11 +++++++++--
14
hw/arm/stellaris.c | 2 --
23
1 file changed, 9 insertions(+), 2 deletions(-)
15
1 file changed, 2 deletions(-)
24
16
25
diff --git a/configure b/configure
17
diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c
26
index XXXXXXX..XXXXXXX 100755
18
index XXXXXXX..XXXXXXX 100644
27
--- a/configure
19
--- a/hw/arm/stellaris.c
28
+++ b/configure
20
+++ b/hw/arm/stellaris.c
29
@@ -XXX,XX +XXX,XX @@ if $pkg_config --atleast-version=$glib_req_ver gio-2.0; then
21
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
30
# Check that the libraries actually work -- Ubuntu 18.04 ships
22
* http://www.ti.com/lit/ds/symlink/lm3s6965.pdf
31
# with pkg-config --static --libs data for gio-2.0 that is missing
23
*
32
# -lblkid and will give a link error.
24
* 40000000 wdtimer
33
- write_c_skeleton
25
- * 40002000 i2c (unimplemented)
34
- if compile_prog "" "$gio_libs" ; then
26
* 40004000 GPIO
35
+ cat > $TMPC <<EOF
27
* 40005000 GPIO
36
+#include <gio/gio.h>
28
* 40006000 GPIO
37
+int main(void)
29
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
38
+{
30
/* Add dummy regions for the devices we don't implement yet,
39
+ g_dbus_proxy_new_sync(0, 0, 0, 0, 0, 0, 0, 0);
31
* so guest accesses don't cause unlogged crashes.
40
+ return 0;
32
*/
41
+}
33
- create_unimplemented_device("i2c-0", 0x40002000, 0x1000);
42
+EOF
34
create_unimplemented_device("i2c-2", 0x40021000, 0x1000);
43
+ if compile_prog "$gio_cflags" "$gio_libs" ; then
35
create_unimplemented_device("PWM", 0x40028000, 0x1000);
44
gio=yes
36
create_unimplemented_device("QEI-0", 0x4002c000, 0x1000);
45
else
46
gio=no
47
--
37
--
48
2.20.1
38
2.34.1
49
39
50
40
diff view generated by jsdifflib
1
From: Alistair Francis <alistair.francis@wdc.com>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
This patch fixes CID 1432800 by removing an unnecessary check.
3
Add definitions for the number of controllers.
4
4
5
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
5
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
7
Message-id: 20250110160204.74997-5-philmd@linaro.org
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
---
9
---
9
hw/core/register.c | 4 ----
10
hw/arm/stellaris.c | 25 +++++++++++++++----------
10
1 file changed, 4 deletions(-)
11
1 file changed, 15 insertions(+), 10 deletions(-)
11
12
12
diff --git a/hw/core/register.c b/hw/core/register.c
13
diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c
13
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
14
--- a/hw/core/register.c
15
--- a/hw/arm/stellaris.c
15
+++ b/hw/core/register.c
16
+++ b/hw/arm/stellaris.c
16
@@ -XXX,XX +XXX,XX @@ static RegisterInfoArray *register_init_block(DeviceState *owner,
17
@@ -XXX,XX +XXX,XX @@
17
int index = rae[i].addr / data_size;
18
#define NUM_IRQ_LINES 64
18
RegisterInfo *r = &ri[index];
19
#define NUM_PRIO_BITS 3
19
20
20
- if (data + data_size * index == 0 || !&rae[i]) {
21
+#define NUM_GPIO 7
21
- continue;
22
+#define NUM_UART 4
22
- }
23
+#define NUM_GPTM 4
23
-
24
+#define NUM_I2C 2
24
/* Init the register, this will zero it. */
25
+
25
object_initialize((void *)r, sizeof(*r), TYPE_REGISTER);
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)
32
{
33
- static const int uart_irq[] = {5, 6, 33, 34};
34
- static const int timer_irq[] = {19, 21, 23, 35};
35
- static const uint32_t gpio_addr[7] =
36
+ static const int uart_irq[NUM_UART] = {5, 6, 33, 34};
37
+ static const int timer_irq[NUM_GPTM] = {19, 21, 23, 35};
38
+ static const uint32_t gpio_addr[NUM_GPIO] =
39
{ 0x40004000, 0x40005000, 0x40006000, 0x40007000,
40
0x40024000, 0x40025000, 0x40026000};
41
- static const int gpio_irq[7] = {0, 1, 2, 3, 4, 30, 31};
42
+ static const int gpio_irq[NUM_GPIO] = {0, 1, 2, 3, 4, 30, 31};
43
44
/* Memory map of SoC devices, from
45
* Stellaris LM3S6965 Microcontroller Data Sheet (rev I)
46
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
47
*/
48
49
Object *soc_container;
50
- DeviceState *gpio_dev[7], *armv7m, *nvic;
51
- qemu_irq gpio_in[7][8];
52
- qemu_irq gpio_out[7][8];
53
+ DeviceState *gpio_dev[NUM_GPIO], *armv7m, *nvic;
54
+ qemu_irq gpio_in[NUM_GPIO][8];
55
+ qemu_irq gpio_out[NUM_GPIO][8];
56
qemu_irq adc;
57
int sram_size;
58
int flash_size;
59
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
60
} else {
61
adc = NULL;
62
}
63
- for (i = 0; i < 4; i++) {
64
+ for (i = 0; i < NUM_GPTM; i++) {
65
if (board->dc2 & (0x10000 << i)) {
66
SysBusDevice *sbd;
67
68
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
69
}
70
71
72
- for (i = 0; i < 7; i++) {
73
+ for (i = 0; i < NUM_GPIO; i++) {
74
if (board->dc4 & (1 << i)) {
75
gpio_dev[i] = sysbus_create_simple("pl061_luminary", gpio_addr[i],
76
qdev_get_gpio_in(nvic,
77
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
78
}
79
}
80
81
- for (i = 0; i < 4; i++) {
82
+ for (i = 0; i < NUM_UART; i++) {
83
if (board->dc2 & (1 << i)) {
84
SysBusDevice *sbd;
26
85
27
--
86
--
28
2.20.1
87
2.34.1
29
88
30
89
diff view generated by jsdifflib
1
From: Alex Chen <alex.chen@huawei.com>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
We should use printf format specifier "%u" instead of "%d" for
3
Add definitions (DCx_periph) for the DeviceCapability bits,
4
argument of type "unsigned int".
4
replace direct bitmask checks with the DEV_CAP() macro,
5
which use the extract/deposit API.
5
6
6
Reported-by: Euler Robot <euler.robot@huawei.com>
7
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
7
Signed-off-by: Alex Chen <alex.chen@huawei.com>
8
Message-id: 20201111073651.72804-1-alex.chen@huawei.com
9
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Message-id: 20250110160204.74997-6-philmd@linaro.org
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
11
---
12
hw/timer/exynos4210_mct.c | 4 ++--
12
hw/arm/stellaris.c | 37 +++++++++++++++++++++++++++++--------
13
hw/timer/exynos4210_pwm.c | 8 ++++----
13
1 file changed, 29 insertions(+), 8 deletions(-)
14
2 files changed, 6 insertions(+), 6 deletions(-)
15
14
16
diff --git a/hw/timer/exynos4210_mct.c b/hw/timer/exynos4210_mct.c
15
diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c
17
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
18
--- a/hw/timer/exynos4210_mct.c
17
--- a/hw/arm/stellaris.c
19
+++ b/hw/timer/exynos4210_mct.c
18
+++ b/hw/arm/stellaris.c
20
@@ -XXX,XX +XXX,XX @@ static void exynos4210_gcomp_raise_irq(void *opaque, uint32_t id)
19
@@ -XXX,XX +XXX,XX @@
21
/* If CSTAT is pending and IRQ is enabled */
20
*/
22
if ((s->reg.int_cstat & G_INT_CSTAT_COMP(id)) &&
21
23
(s->reg.int_enb & G_INT_ENABLE(id))) {
22
#include "qemu/osdep.h"
24
- DPRINTF("gcmp timer[%d] IRQ\n", id);
23
+#include "qemu/bitops.h"
25
+ DPRINTF("gcmp timer[%u] IRQ\n", id);
24
#include "qapi/error.h"
26
qemu_irq_raise(s->irq[id]);
25
#include "hw/core/split-irq.h"
26
#include "hw/sysbus.h"
27
@@ -XXX,XX +XXX,XX @@
28
#define NUM_GPTM 4
29
#define NUM_I2C 2
30
31
+/*
32
+ * See Stellaris Data Sheet chapter 5.2.5 "System Control",
33
+ * Register 13 .. 17: Device Capabilities 0 .. 4 (DC0 .. DC4).
34
+ */
35
+#define DC1_WDT 3
36
+#define DC1_HIB 6
37
+#define DC1_MPU 7
38
+#define DC1_ADC 16
39
+#define DC1_PWM 20
40
+#define DC2_UART(n) (n)
41
+#define DC2_SSI 4
42
+#define DC2_QEI(n) (8 + n)
43
+#define DC2_I2C(n) (12 + 2 * n)
44
+#define DC2_GPTM(n) (16 + n)
45
+#define DC2_COMP(n) (24 + n)
46
+#define DC4_GPIO(n) (n)
47
+#define DC4_EMAC 28
48
+
49
+#define DEV_CAP(_dc, _cap) extract32(board->dc##_dc, DC##_dc##_##_cap, 1)
50
+
51
typedef const struct {
52
const char *name;
53
uint32_t did0;
54
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
55
sysbus_mmio_map(SYS_BUS_DEVICE(ssys_dev), 0, 0x400fe000);
56
sysbus_connect_irq(SYS_BUS_DEVICE(ssys_dev), 0, qdev_get_gpio_in(nvic, 28));
57
58
- if (board->dc1 & (1 << 16)) {
59
+ if (DEV_CAP(1, ADC)) {
60
dev = sysbus_create_varargs(TYPE_STELLARIS_ADC, 0x40038000,
61
qdev_get_gpio_in(nvic, 14),
62
qdev_get_gpio_in(nvic, 15),
63
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
64
adc = NULL;
27
}
65
}
28
}
66
for (i = 0; i < NUM_GPTM; i++) {
29
@@ -XXX,XX +XXX,XX @@ static void exynos4210_mct_update_freq(Exynos4210MCTState *s)
67
- if (board->dc2 & (0x10000 << i)) {
30
MCT_CFG_GET_DIVIDER(s->reg_mct_cfg));
68
+ if (DEV_CAP(2, GPTM(i))) {
31
69
SysBusDevice *sbd;
32
if (freq != s->freq) {
70
33
- DPRINTF("freq=%dHz\n", s->freq);
71
dev = qdev_new(TYPE_STELLARIS_GPTM);
34
+ DPRINTF("freq=%uHz\n", s->freq);
72
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
35
73
}
36
/* global timer */
37
tx_ptimer_set_freq(s->g_timer.ptimer_frc, s->freq);
38
diff --git a/hw/timer/exynos4210_pwm.c b/hw/timer/exynos4210_pwm.c
39
index XXXXXXX..XXXXXXX 100644
40
--- a/hw/timer/exynos4210_pwm.c
41
+++ b/hw/timer/exynos4210_pwm.c
42
@@ -XXX,XX +XXX,XX @@ static void exynos4210_pwm_update_freq(Exynos4210PWMState *s, uint32_t id)
43
44
if (freq != s->timer[id].freq) {
45
ptimer_set_freq(s->timer[id].ptimer, s->timer[id].freq);
46
- DPRINTF("freq=%dHz\n", s->timer[id].freq);
47
+ DPRINTF("freq=%uHz\n", s->timer[id].freq);
48
}
74
}
49
}
75
50
76
- if (board->dc1 & (1 << 3)) { /* watchdog present */
51
@@ -XXX,XX +XXX,XX @@ static void exynos4210_pwm_tick(void *opaque)
77
+ if (DEV_CAP(1, WDT)) {
52
uint32_t id = s->id;
78
dev = qdev_new(TYPE_LUMINARY_WATCHDOG);
53
bool cmp;
79
object_property_add_child(soc_container, "wdg", OBJECT(dev));
54
80
qdev_connect_clock_in(dev, "WDOGCLK",
55
- DPRINTF("timer %d tick\n", id);
81
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
56
+ DPRINTF("timer %u tick\n", id);
82
57
83
58
/* set irq status */
84
for (i = 0; i < NUM_GPIO; i++) {
59
p->reg_tint_cstat |= TINT_CSTAT_STATUS(id);
85
- if (board->dc4 & (1 << i)) {
60
86
+ if (DEV_CAP(4, GPIO(i))) {
61
/* raise IRQ */
87
gpio_dev[i] = sysbus_create_simple("pl061_luminary", gpio_addr[i],
62
if (p->reg_tint_cstat & TINT_CSTAT_ENABLE(id)) {
88
qdev_get_gpio_in(nvic,
63
- DPRINTF("timer %d IRQ\n", id);
89
gpio_irq[i]));
64
+ DPRINTF("timer %u IRQ\n", id);
90
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
65
qemu_irq_raise(p->timer[id].irq);
91
}
66
}
92
}
67
93
68
@@ -XXX,XX +XXX,XX @@ static void exynos4210_pwm_tick(void *opaque)
94
- if (board->dc2 & (1 << 12)) {
95
+ if (DEV_CAP(2, I2C(0))) {
96
dev = sysbus_create_simple(TYPE_STELLARIS_I2C, 0x40020000,
97
qdev_get_gpio_in(nvic, 8));
98
i2c = (I2CBus *)qdev_get_child_bus(dev, "i2c");
99
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
69
}
100
}
70
101
71
if (cmp) {
102
for (i = 0; i < NUM_UART; i++) {
72
- DPRINTF("auto reload timer %d count to %x\n", id,
103
- if (board->dc2 & (1 << i)) {
73
+ DPRINTF("auto reload timer %u count to %x\n", id,
104
+ if (DEV_CAP(2, UART(i))) {
74
p->timer[id].reg_tcntb);
105
SysBusDevice *sbd;
75
ptimer_set_count(p->timer[id].ptimer, p->timer[id].reg_tcntb);
106
76
ptimer_run(p->timer[id].ptimer, 1);
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");
77
--
126
--
78
2.20.1
127
2.34.1
79
128
80
129
diff view generated by jsdifflib
1
In the mtspr helper we attempt to check for "is the timer disabled"
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
with "if (env->ttmr & TIMER_NONE)". This is wrong because TIMER_NONE
3
is zero and the condition is always false (Coverity complains about
4
the dead code.)
5
2
6
The correct check would be to test whether the TTMR_M field in the
3
There are 2 I2C controllers, map them both, removing
7
register is equal to TIMER_NONE instead. However, the
4
the unimplemented one. Keep the OLED controller on the
8
cpu_openrisc_timer_update() function checks whether the timer is
5
first I2C bus.
9
enabled (it looks at cpu->env.is_counting, which is set to 0 via
10
cpu_openrisc_count_stop() when the TTMR_M field is set to
11
TIMER_NONE), so there's no need to check for "timer disabled" in the
12
target/openrisc code. Instead, simply remove the dead code.
13
6
14
Fixes: Coverity CID 1005812
7
Signed-off-by: Philippe Mathieu-Daudé <philmd@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]
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
Acked-by: Stafford Horne <shorne@gmail.com>
17
Message-id: 20201103114654.18540-1-peter.maydell@linaro.org
18
---
12
---
19
target/openrisc/sys_helper.c | 3 ---
13
hw/arm/stellaris.c | 21 +++++++++++++--------
20
1 file changed, 3 deletions(-)
14
1 file changed, 13 insertions(+), 8 deletions(-)
21
15
22
diff --git a/target/openrisc/sys_helper.c b/target/openrisc/sys_helper.c
16
diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c
23
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
24
--- a/target/openrisc/sys_helper.c
18
--- a/hw/arm/stellaris.c
25
+++ b/target/openrisc/sys_helper.c
19
+++ b/hw/arm/stellaris.c
26
@@ -XXX,XX +XXX,XX @@ void HELPER(mtspr)(CPUOpenRISCState *env, target_ulong spr, target_ulong rb)
20
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
27
21
{ 0x40004000, 0x40005000, 0x40006000, 0x40007000,
28
case TO_SPR(10, 1): /* TTCR */
22
0x40024000, 0x40025000, 0x40026000};
29
cpu_openrisc_count_set(cpu, rb);
23
static const int gpio_irq[NUM_GPIO] = {0, 1, 2, 3, 4, 30, 31};
30
- if (env->ttmr & TIMER_NONE) {
24
+ static const uint32_t i2c_addr[NUM_I2C] = {0x40020000, 0x40021000};
31
- return;
25
+ static const int i2c_irq[NUM_I2C] = {8, 37};
32
- }
26
33
cpu_openrisc_timer_update(cpu);
27
/* Memory map of SoC devices, from
34
break;
28
* Stellaris LM3S6965 Microcontroller Data Sheet (rev I)
35
#endif
29
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
30
qemu_irq adc;
31
int sram_size;
32
int flash_size;
33
- I2CBus *i2c;
34
+ DeviceState *i2c_dev[NUM_I2C] = { };
35
DeviceState *dev;
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");
57
+
58
+ i2c_slave_create_simple(bus, "ssd0303", 0x3d);
59
+ }
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);
36
--
71
--
37
2.20.1
72
2.34.1
38
73
39
74
diff view generated by jsdifflib
1
In commit 5edab03d4040 we added tracepoints to the ps2 keyboard
1
From: Thomas Huth <thuth@redhat.com>
2
and mouse emulation. However we didn't remove all the debug-by-printf
3
support. In fact there is only one printf() remaining, and it is
4
redundant with the trace_ps2_write_mouse() event next to it.
5
Remove the printf() and the now-unused DEBUG* macros.
6
2
3
We don't have any functional tests for this machine yet, thus let's
4
add a test with a MicroPython binary that is available online
5
(thanks to Joel Stanley for providing it, see:
6
https://www.mail-archive.com/qemu-devel@nongnu.org/msg606064.html ).
7
8
Signed-off-by: Thomas Huth <thuth@redhat.com>
9
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
10
Message-id: 20250124101709.1591761-1-thuth@redhat.com
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
9
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
10
Message-id: 20201101133258.4240-1-peter.maydell@linaro.org
11
---
12
---
12
hw/input/ps2.c | 9 ---------
13
MAINTAINERS | 1 +
13
1 file changed, 9 deletions(-)
14
tests/functional/meson.build | 1 +
15
tests/functional/test_arm_microbit.py | 31 +++++++++++++++++++++++++++
16
3 files changed, 33 insertions(+)
17
create mode 100755 tests/functional/test_arm_microbit.py
14
18
15
diff --git a/hw/input/ps2.c b/hw/input/ps2.c
19
diff --git a/MAINTAINERS b/MAINTAINERS
16
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
17
--- a/hw/input/ps2.c
21
--- a/MAINTAINERS
18
+++ b/hw/input/ps2.c
22
+++ b/MAINTAINERS
23
@@ -XXX,XX +XXX,XX @@ F: hw/*/microbit*.c
24
F: include/hw/*/nrf51*.h
25
F: include/hw/*/microbit*.h
26
F: tests/qtest/microbit-test.c
27
+F: tests/functional/test_arm_microbit.py
28
F: docs/system/arm/nrf.rst
29
30
ARM PL011 Rust device
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
19
@@ -XXX,XX +XXX,XX @@
48
@@ -XXX,XX +XXX,XX @@
20
49
+#!/usr/bin/env python3
21
#include "trace.h"
50
+#
22
51
+# SPDX-License-Identifier: GPL-2.0-or-later
23
-/* debug PC keyboard */
52
+#
24
-//#define DEBUG_KBD
53
+# Copyright 2025, The QEMU Project Developers.
25
-
54
+#
26
-/* debug PC keyboard : only mouse */
55
+# A functional test that runs MicroPython on the arm microbit machine.
27
-//#define DEBUG_MOUSE
56
+
28
-
57
+from qemu_test import QemuSystemTest, Asset, exec_command_and_wait_for_pattern
29
/* Keyboard Commands */
58
+from qemu_test import wait_for_console_pattern
30
#define KBD_CMD_SET_LEDS    0xED    /* Set keyboard leds */
59
+
31
#define KBD_CMD_ECHO     0xEE
60
+
32
@@ -XXX,XX +XXX,XX @@ void ps2_write_mouse(void *opaque, int val)
61
+class MicrobitMachine(QemuSystemTest):
33
PS2MouseState *s = (PS2MouseState *)opaque;
62
+
34
63
+ ASSET_MICRO = Asset('https://ozlabs.org/~joel/microbit-micropython.hex',
35
trace_ps2_write_mouse(opaque, val);
64
+ '021641f93dfb11767d4978dbb3ca7f475d1b13c69e7f4aec3382f212636bffd6')
36
-#ifdef DEBUG_MOUSE
65
+
37
- printf("kbd: write mouse 0x%02x\n", val);
66
+ def test_arm_microbit(self):
38
-#endif
67
+ self.set_machine('microbit')
39
switch(s->common.write_cmd) {
68
+
40
default:
69
+ micropython = self.ASSET_MICRO.fetch()
41
case -1:
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()
42
--
80
--
43
2.20.1
81
2.34.1
44
82
45
83
diff view generated by jsdifflib
New patch
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.
1
4
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.
10
11
Call vfp_set_fpsr(), as we ought to.
12
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")
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
22
---
23
target/arm/helper.c | 2 +-
24
1 file changed, 1 insertion(+), 1 deletion(-)
25
26
diff --git a/target/arm/helper.c b/target/arm/helper.c
27
index XXXXXXX..XXXXXXX 100644
28
--- a/target/arm/helper.c
29
+++ b/target/arm/helper.c
30
@@ -XXX,XX +XXX,XX @@ static void arm_reset_sve_state(CPUARMState *env)
31
memset(env->vfp.zregs, 0, sizeof(env->vfp.zregs));
32
/* Recall that FFR is stored as pregs[16]. */
33
memset(env->vfp.pregs, 0, sizeof(env->vfp.pregs));
34
- vfp_set_fpcr(env, 0x0800009f);
35
+ vfp_set_fpsr(env, 0x0800009f);
36
}
37
38
void aarch64_set_svcr(CPUARMState *env, uint64_t new, uint64_t mask)
39
--
40
2.34.1
diff view generated by jsdifflib
New patch
1
Use the FPSR_ named constants in vfp_exceptbits_from_host(),
2
rather than hardcoded magic numbers.
1
3
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Message-id: 20250124162836.2332150-5-peter.maydell@linaro.org
7
---
8
target/arm/vfp_helper.c | 12 ++++++------
9
1 file changed, 6 insertions(+), 6 deletions(-)
10
11
diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c
12
index XXXXXXX..XXXXXXX 100644
13
--- a/target/arm/vfp_helper.c
14
+++ b/target/arm/vfp_helper.c
15
@@ -XXX,XX +XXX,XX @@ static inline int vfp_exceptbits_from_host(int host_bits)
16
int target_bits = 0;
17
18
if (host_bits & float_flag_invalid) {
19
- target_bits |= 1;
20
+ target_bits |= FPSR_IOC;
21
}
22
if (host_bits & float_flag_divbyzero) {
23
- target_bits |= 2;
24
+ target_bits |= FPSR_DZC;
25
}
26
if (host_bits & float_flag_overflow) {
27
- target_bits |= 4;
28
+ target_bits |= FPSR_OFC;
29
}
30
if (host_bits & (float_flag_underflow | float_flag_output_denormal)) {
31
- target_bits |= 8;
32
+ target_bits |= FPSR_UFC;
33
}
34
if (host_bits & float_flag_inexact) {
35
- target_bits |= 0x10;
36
+ target_bits |= FPSR_IXC;
37
}
38
if (host_bits & float_flag_input_denormal) {
39
- target_bits |= 0x80;
40
+ target_bits |= FPSR_IDC;
41
}
42
return target_bits;
43
}
44
--
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
New patch
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
1
10
11
In this patch we add the new float_status fields.
12
13
We will also need to split fp_status_f16, but we will do that
14
as a separate series of patches.
15
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
19
---
20
target/arm/cpu.h | 4 ++++
21
target/arm/tcg/translate.h | 12 ++++++++++++
22
target/arm/cpu.c | 2 ++
23
target/arm/vfp_helper.c | 12 ++++++++++++
24
4 files changed, 30 insertions(+)
25
26
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
27
index XXXXXXX..XXXXXXX 100644
28
--- a/target/arm/cpu.h
29
+++ b/target/arm/cpu.h
30
@@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState {
31
/* There are a number of distinct float control structures:
32
*
33
* fp_status: is the "normal" fp status.
34
+ * fp_status_a32: is the "normal" fp status for AArch32 insns
35
+ * fp_status_a64: is the "normal" fp status for AArch64 insns
36
* fp_status_fp16: used for half-precision calculations
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;
85
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
86
index XXXXXXX..XXXXXXX 100644
87
--- a/target/arm/cpu.c
88
+++ b/target/arm/cpu.c
89
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_reset_hold(Object *obj, ResetType type)
90
set_default_nan_mode(1, &env->vfp.standard_fp_status);
91
set_default_nan_mode(1, &env->vfp.standard_fp_status_f16);
92
arm_set_default_fp_behaviours(&env->vfp.fp_status);
93
+ arm_set_default_fp_behaviours(&env->vfp.fp_status_a32);
94
+ arm_set_default_fp_behaviours(&env->vfp.fp_status_a64);
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);
127
}
128
if (changed & FPCR_FZ16) {
129
@@ -XXX,XX +XXX,XX @@ static void vfp_set_fpcr_to_host(CPUARMState *env, uint32_t val, uint32_t mask)
130
bool ftz_enabled = val & FPCR_FZ;
131
set_flush_to_zero(ftz_enabled, &env->vfp.fp_status);
132
set_flush_inputs_to_zero(ftz_enabled, &env->vfp.fp_status);
133
+ set_flush_to_zero(ftz_enabled, &env->vfp.fp_status_a32);
134
+ set_flush_inputs_to_zero(ftz_enabled, &env->vfp.fp_status_a32);
135
+ set_flush_to_zero(ftz_enabled, &env->vfp.fp_status_a64);
136
+ set_flush_inputs_to_zero(ftz_enabled, &env->vfp.fp_status_a64);
137
}
138
if (changed & FPCR_DN) {
139
bool dnan_enabled = val & FPCR_DN;
140
set_default_nan_mode(dnan_enabled, &env->vfp.fp_status);
141
+ set_default_nan_mode(dnan_enabled, &env->vfp.fp_status_a32);
142
+ set_default_nan_mode(dnan_enabled, &env->vfp.fp_status_a64);
143
set_default_nan_mode(dnan_enabled, &env->vfp.fp_status_f16);
144
}
145
}
146
--
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
New patch
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.
1
4
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
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(-)
11
12
diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c
13
index XXXXXXX..XXXXXXX 100644
14
--- a/target/arm/vfp_helper.c
15
+++ b/target/arm/vfp_helper.c
16
@@ -XXX,XX +XXX,XX @@ uint64_t HELPER(fjcvtzs)(float64 value, float_status *status)
17
18
uint32_t HELPER(vjcvt)(float64 value, CPUARMState *env)
19
{
20
- uint64_t pair = HELPER(fjcvtzs)(value, &env->vfp.fp_status);
21
+ uint64_t pair = HELPER(fjcvtzs)(value, &env->vfp.fp_status_a32);
22
uint32_t result = pair;
23
uint32_t z = (pair >> 32) == 0;
24
25
--
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
New patch
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.
1
5
6
Patch created with
7
perl -p -i -e 's/FPST_FPCR(?!_)/FPST_A32/g' target/arm/tcg/translate-vfp.c
8
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
12
---
13
target/arm/tcg/translate-vfp.c | 54 +++++++++++++++++-----------------
14
1 file changed, 27 insertions(+), 27 deletions(-)
15
16
diff --git a/target/arm/tcg/translate-vfp.c b/target/arm/tcg/translate-vfp.c
17
index XXXXXXX..XXXXXXX 100644
18
--- a/target/arm/tcg/translate-vfp.c
19
+++ b/target/arm/tcg/translate-vfp.c
20
@@ -XXX,XX +XXX,XX @@ static bool trans_VRINT(DisasContext *s, arg_VRINT *a)
21
if (sz == 1) {
22
fpst = fpstatus_ptr(FPST_FPCR_F16);
23
} else {
24
- fpst = fpstatus_ptr(FPST_FPCR);
25
+ fpst = fpstatus_ptr(FPST_A32);
26
}
27
28
tcg_rmode = gen_set_rmode(rounding, fpst);
29
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT(DisasContext *s, arg_VCVT *a)
30
if (sz == 1) {
31
fpst = fpstatus_ptr(FPST_FPCR_F16);
32
} else {
33
- fpst = fpstatus_ptr(FPST_FPCR);
34
+ fpst = fpstatus_ptr(FPST_A32);
35
}
36
37
tcg_shift = tcg_constant_i32(0);
38
@@ -XXX,XX +XXX,XX @@ static bool do_vfp_3op_sp(DisasContext *s, VFPGen3OpSPFn *fn,
39
f0 = tcg_temp_new_i32();
40
f1 = tcg_temp_new_i32();
41
fd = tcg_temp_new_i32();
42
- fpst = fpstatus_ptr(FPST_FPCR);
43
+ fpst = fpstatus_ptr(FPST_A32);
44
45
vfp_load_reg32(f0, vn);
46
vfp_load_reg32(f1, vm);
47
@@ -XXX,XX +XXX,XX @@ static bool do_vfp_3op_dp(DisasContext *s, VFPGen3OpDPFn *fn,
48
f0 = tcg_temp_new_i64();
49
f1 = tcg_temp_new_i64();
50
fd = tcg_temp_new_i64();
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);
260
--
261
2.34.1
diff view generated by jsdifflib
New patch
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.
1
5
6
Patch created with
7
8
perl -p -i -e 's/FPST_FPCR(?!_)/FPST_A64/g' target/arm/tcg/translate-{a64,sve,sme}.c
9
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
13
---
14
target/arm/tcg/translate-a64.c | 70 +++++++++++-----------
15
target/arm/tcg/translate-sme.c | 4 +-
16
target/arm/tcg/translate-sve.c | 106 ++++++++++++++++-----------------
17
3 files changed, 90 insertions(+), 90 deletions(-)
18
19
diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c
20
index XXXXXXX..XXXXXXX 100644
21
--- a/target/arm/tcg/translate-a64.c
22
+++ b/target/arm/tcg/translate-a64.c
23
@@ -XXX,XX +XXX,XX @@ static void gen_gvec_op3_fpst(DisasContext *s, bool is_q, int rd, int rn,
24
int rm, bool is_fp16, int data,
25
gen_helper_gvec_3_ptr *fn)
26
{
27
- TCGv_ptr fpst = fpstatus_ptr(is_fp16 ? FPST_FPCR_F16 : FPST_FPCR);
28
+ TCGv_ptr fpst = fpstatus_ptr(is_fp16 ? FPST_FPCR_F16 : FPST_A64);
29
tcg_gen_gvec_3_ptr(vec_full_reg_offset(s, rd),
30
vec_full_reg_offset(s, rn),
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
327
index XXXXXXX..XXXXXXX 100644
328
--- a/target/arm/tcg/translate-sme.c
329
+++ b/target/arm/tcg/translate-sme.c
330
@@ -XXX,XX +XXX,XX @@ static bool do_outprod_env(DisasContext *s, arg_op *a, MemOp esz,
331
TRANS_FEAT(FMOPA_h, aa64_sme, do_outprod_env, a,
332
MO_32, gen_helper_sme_fmopa_h)
333
TRANS_FEAT(FMOPA_s, aa64_sme, do_outprod_fpst, a,
334
- MO_32, FPST_FPCR, gen_helper_sme_fmopa_s)
335
+ MO_32, FPST_A64, gen_helper_sme_fmopa_s)
336
TRANS_FEAT(FMOPA_d, aa64_sme_f64f64, do_outprod_fpst, a,
337
- MO_64, FPST_FPCR, gen_helper_sme_fmopa_d)
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
343
index XXXXXXX..XXXXXXX 100644
344
--- a/target/arm/tcg/translate-sve.c
345
+++ b/target/arm/tcg/translate-sve.c
346
@@ -XXX,XX +XXX,XX @@ static bool gen_gvec_fpst_arg_zz(DisasContext *s, gen_helper_gvec_2_ptr *fn,
347
arg_rr_esz *a, int data)
348
{
349
return gen_gvec_fpst_zz(s, fn, a->rd, a->rn, data,
350
- a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR);
351
+ a->esz == MO_16 ? FPST_FPCR_F16 : FPST_A64);
352
}
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)
684
--
685
2.34.1
diff view generated by jsdifflib
New patch
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.
1
3
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
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 | 8 +-------
12
4 files changed, 1 insertion(+), 16 deletions(-)
13
14
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
15
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/cpu.h
17
+++ b/target/arm/cpu.h
18
@@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState {
19
20
/* There are a number of distinct float control structures:
21
*
22
- * fp_status: is the "normal" fp status.
23
* fp_status_a32: is the "normal" fp status for AArch32 insns
24
* fp_status_a64: is the "normal" fp status for AArch64 insns
25
* fp_status_fp16: used for half-precision calculations
26
@@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState {
27
* only thing which needs to read the exception flags being
28
* an explicit FPSCR read.
29
*/
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
35
index XXXXXXX..XXXXXXX 100644
36
--- a/target/arm/tcg/translate.h
37
+++ b/target/arm/tcg/translate.h
38
@@ -XXX,XX +XXX,XX @@ static inline CPUARMTBFlags arm_tbflags_from_tb(const TranslationBlock *tb)
39
* Enum for argument to fpstatus_ptr().
40
*/
41
typedef enum ARMFPStatusFlavour {
42
- FPST_FPCR,
43
FPST_A32,
44
FPST_A64,
45
FPST_FPCR_F16,
46
@@ -XXX,XX +XXX,XX @@ typedef enum ARMFPStatusFlavour {
47
* been set up to point to the requested field in the CPU state struct.
48
* The options are:
49
*
50
- * FPST_FPCR
51
- * for non-FP16 operations controlled by the FPCR
52
* FPST_A32
53
* for AArch32 non-FP16 operations controlled by the FPCR
54
* FPST_A64
55
@@ -XXX,XX +XXX,XX @@ static inline TCGv_ptr fpstatus_ptr(ARMFPStatusFlavour flavour)
56
int offset;
57
58
switch (flavour) {
59
- case FPST_FPCR:
60
- offset = offsetof(CPUARMState, vfp.fp_status);
61
- break;
62
case FPST_A32:
63
offset = offsetof(CPUARMState, vfp.fp_status_a32);
64
break;
65
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
66
index XXXXXXX..XXXXXXX 100644
67
--- a/target/arm/cpu.c
68
+++ b/target/arm/cpu.c
69
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_reset_hold(Object *obj, ResetType type)
70
set_flush_inputs_to_zero(1, &env->vfp.standard_fp_status);
71
set_default_nan_mode(1, &env->vfp.standard_fp_status);
72
set_default_nan_mode(1, &env->vfp.standard_fp_status_f16);
73
- arm_set_default_fp_behaviours(&env->vfp.fp_status);
74
arm_set_default_fp_behaviours(&env->vfp.fp_status_a32);
75
arm_set_default_fp_behaviours(&env->vfp.fp_status_a64);
76
arm_set_default_fp_behaviours(&env->vfp.standard_fp_status);
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 inline uint32_t vfp_exceptbits_from_host(int host_bits)
82
83
static uint32_t vfp_get_fpsr_from_host(CPUARMState *env)
84
{
85
- uint32_t i;
86
+ uint32_t i = 0;
87
88
- i = get_float_exception_flags(&env->vfp.fp_status);
89
i |= get_float_exception_flags(&env->vfp.fp_status_a32);
90
i |= get_float_exception_flags(&env->vfp.fp_status_a64);
91
i |= get_float_exception_flags(&env->vfp.standard_fp_status);
92
@@ -XXX,XX +XXX,XX @@ static void vfp_clear_float_status_exc_flags(CPUARMState *env)
93
* values. The caller should have arranged for env->vfp.fpsr to
94
* be the architecturally up-to-date exception flag information first.
95
*/
96
- set_float_exception_flags(0, &env->vfp.fp_status);
97
set_float_exception_flags(0, &env->vfp.fp_status_a32);
98
set_float_exception_flags(0, &env->vfp.fp_status_a64);
99
set_float_exception_flags(0, &env->vfp.fp_status_f16);
100
@@ -XXX,XX +XXX,XX @@ static void vfp_set_fpcr_to_host(CPUARMState *env, uint32_t val, uint32_t mask)
101
i = float_round_to_zero;
102
break;
103
}
104
- set_float_rounding_mode(i, &env->vfp.fp_status);
105
set_float_rounding_mode(i, &env->vfp.fp_status_a32);
106
set_float_rounding_mode(i, &env->vfp.fp_status_a64);
107
set_float_rounding_mode(i, &env->vfp.fp_status_f16);
108
@@ -XXX,XX +XXX,XX @@ static void vfp_set_fpcr_to_host(CPUARMState *env, uint32_t val, uint32_t mask)
109
}
110
if (changed & FPCR_FZ) {
111
bool ftz_enabled = val & FPCR_FZ;
112
- set_flush_to_zero(ftz_enabled, &env->vfp.fp_status);
113
- set_flush_inputs_to_zero(ftz_enabled, &env->vfp.fp_status);
114
set_flush_to_zero(ftz_enabled, &env->vfp.fp_status_a32);
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);
125
--
126
2.34.1
diff view generated by jsdifflib
New patch
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.
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-14-peter.maydell@linaro.org
10
---
11
target/arm/cpu.h | 4 ++++
12
target/arm/tcg/translate.h | 12 ++++++++++++
13
target/arm/cpu.c | 2 ++
14
target/arm/vfp_helper.c | 14 ++++++++++++++
15
4 files changed, 32 insertions(+)
16
17
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
18
index XXXXXXX..XXXXXXX 100644
19
--- a/target/arm/cpu.h
20
+++ b/target/arm/cpu.h
21
@@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState {
22
* fp_status_a32: is the "normal" fp status for AArch32 insns
23
* fp_status_a64: is the "normal" fp status for AArch64 insns
24
* fp_status_fp16: used for half-precision calculations
25
+ * fp_status_fp16_a32: used for AArch32 half-precision calculations
26
+ * fp_status_fp16_a64: used for AArch64 half-precision calculations
27
* standard_fp_status : the ARM "Standard FPSCR Value"
28
* standard_fp_status_fp16 : used for half-precision
29
* calculations with the ARM "Standard FPSCR Value"
30
@@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState {
31
float_status fp_status_a32;
32
float_status fp_status_a64;
33
float_status fp_status_f16;
34
+ float_status fp_status_f16_a32;
35
+ float_status fp_status_f16_a64;
36
float_status standard_fp_status;
37
float_status standard_fp_status_f16;
38
39
diff --git a/target/arm/tcg/translate.h b/target/arm/tcg/translate.h
40
index XXXXXXX..XXXXXXX 100644
41
--- a/target/arm/tcg/translate.h
42
+++ b/target/arm/tcg/translate.h
43
@@ -XXX,XX +XXX,XX @@ typedef enum ARMFPStatusFlavour {
44
FPST_A32,
45
FPST_A64,
46
FPST_FPCR_F16,
47
+ FPST_A32_F16,
48
+ FPST_A64_F16,
49
FPST_STD,
50
FPST_STD_F16,
51
} ARMFPStatusFlavour;
52
@@ -XXX,XX +XXX,XX @@ typedef enum ARMFPStatusFlavour {
53
* for AArch64 non-FP16 operations controlled by the FPCR
54
* FPST_FPCR_F16
55
* for operations controlled by the FPCR where FPCR.FZ16 is to be used
56
+ * FPST_A32_F16
57
+ * for AArch32 operations controlled by the FPCR where FPCR.FZ16 is to be used
58
+ * FPST_A64_F16
59
+ * for AArch64 operations controlled by the FPCR where FPCR.FZ16 is to be used
60
* FPST_STD
61
* for A32/T32 Neon operations using the "standard FPSCR value"
62
* FPST_STD_F16
63
@@ -XXX,XX +XXX,XX @@ static inline TCGv_ptr fpstatus_ptr(ARMFPStatusFlavour flavour)
64
case FPST_FPCR_F16:
65
offset = offsetof(CPUARMState, vfp.fp_status_f16);
66
break;
67
+ case FPST_A32_F16:
68
+ offset = offsetof(CPUARMState, vfp.fp_status_f16_a32);
69
+ break;
70
+ case FPST_A64_F16:
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;
76
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
77
index XXXXXXX..XXXXXXX 100644
78
--- a/target/arm/cpu.c
79
+++ b/target/arm/cpu.c
80
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_reset_hold(Object *obj, ResetType type)
81
arm_set_default_fp_behaviours(&env->vfp.fp_status_a64);
82
arm_set_default_fp_behaviours(&env->vfp.standard_fp_status);
83
arm_set_default_fp_behaviours(&env->vfp.fp_status_f16);
84
+ arm_set_default_fp_behaviours(&env->vfp.fp_status_f16_a32);
85
+ arm_set_default_fp_behaviours(&env->vfp.fp_status_f16_a64);
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);
112
}
113
@@ -XXX,XX +XXX,XX @@ static void vfp_set_fpcr_to_host(CPUARMState *env, uint32_t val, uint32_t mask)
114
set_float_rounding_mode(i, &env->vfp.fp_status_a32);
115
set_float_rounding_mode(i, &env->vfp.fp_status_a64);
116
set_float_rounding_mode(i, &env->vfp.fp_status_f16);
117
+ set_float_rounding_mode(i, &env->vfp.fp_status_f16_a32);
118
+ set_float_rounding_mode(i, &env->vfp.fp_status_f16_a64);
119
}
120
if (changed & FPCR_FZ16) {
121
bool ftz_enabled = val & FPCR_FZ16;
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);
130
}
131
if (changed & FPCR_FZ) {
132
@@ -XXX,XX +XXX,XX @@ static void vfp_set_fpcr_to_host(CPUARMState *env, uint32_t val, uint32_t mask)
133
set_default_nan_mode(dnan_enabled, &env->vfp.fp_status_a32);
134
set_default_nan_mode(dnan_enabled, &env->vfp.fp_status_a64);
135
set_default_nan_mode(dnan_enabled, &env->vfp.fp_status_f16);
136
+ set_default_nan_mode(dnan_enabled, &env->vfp.fp_status_f16_a32);
137
+ set_default_nan_mode(dnan_enabled, &env->vfp.fp_status_f16_a64);
138
}
139
}
140
141
--
142
2.34.1
diff view generated by jsdifflib
New patch
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.
1
3
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Message-id: 20250124162836.2332150-15-peter.maydell@linaro.org
7
---
8
target/arm/tcg/vec_helper.c | 4 ++--
9
target/arm/vfp_helper.c | 2 +-
10
2 files changed, 3 insertions(+), 3 deletions(-)
11
12
diff --git a/target/arm/tcg/vec_helper.c b/target/arm/tcg/vec_helper.c
13
index XXXXXXX..XXXXXXX 100644
14
--- a/target/arm/tcg/vec_helper.c
15
+++ b/target/arm/tcg/vec_helper.c
16
@@ -XXX,XX +XXX,XX @@ void HELPER(gvec_fmlal_a32)(void *vd, void *vn, void *vm,
17
CPUARMState *env, uint32_t desc)
18
{
19
do_fmlal(vd, vn, vm, &env->vfp.standard_fp_status, desc,
20
- get_flush_inputs_to_zero(&env->vfp.fp_status_f16));
21
+ get_flush_inputs_to_zero(&env->vfp.fp_status_f16_a32));
22
}
23
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
47
--
48
2.34.1
diff view generated by jsdifflib
New patch
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.
1
3
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
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(-)
11
12
diff --git a/target/arm/tcg/sme_helper.c b/target/arm/tcg/sme_helper.c
13
index XXXXXXX..XXXXXXX 100644
14
--- a/target/arm/tcg/sme_helper.c
15
+++ b/target/arm/tcg/sme_helper.c
16
@@ -XXX,XX +XXX,XX @@ void HELPER(sme_fmopa_h)(void *vza, void *vzn, void *vzm, void *vpn,
17
float_status fpst_odd, fpst_std, fpst_f16;
18
19
/*
20
- * Make copies of fp_status and fp_status_f16, because this operation
21
+ * Make copies of the fp status fields we use, because this operation
22
* does not update the cumulative fp exception status. It also
23
* produces default NaNs. We also need a second copy of fp_status with
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
32
index XXXXXXX..XXXXXXX 100644
33
--- a/target/arm/tcg/vec_helper.c
34
+++ b/target/arm/tcg/vec_helper.c
35
@@ -XXX,XX +XXX,XX @@ void HELPER(gvec_fmlal_a64)(void *vd, void *vn, void *vm,
36
CPUARMState *env, uint32_t desc)
37
{
38
do_fmlal(vd, vn, vm, &env->vfp.fp_status_a64, desc,
39
- get_flush_inputs_to_zero(&env->vfp.fp_status_f16));
40
+ get_flush_inputs_to_zero(&env->vfp.fp_status_f16_a64));
41
}
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);
71
--
72
2.34.1
diff view generated by jsdifflib
New patch
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.
1
5
6
Patch created with
7
perl -p -i -e 's/FPST_FPCR_F16(?!_)/FPST_A32_F16/g' target/arm/tcg/translate-vfp.c
8
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
---
13
target/arm/tcg/translate-vfp.c | 24 ++++++++++++------------
14
1 file changed, 12 insertions(+), 12 deletions(-)
15
16
diff --git a/target/arm/tcg/translate-vfp.c b/target/arm/tcg/translate-vfp.c
17
index XXXXXXX..XXXXXXX 100644
18
--- a/target/arm/tcg/translate-vfp.c
19
+++ b/target/arm/tcg/translate-vfp.c
20
@@ -XXX,XX +XXX,XX @@ static bool trans_VRINT(DisasContext *s, arg_VRINT *a)
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)
68
{
69
- gen_helper_vfp_sqrth(vd, vm, fpstatus_ptr(FPST_FPCR_F16));
70
+ gen_helper_vfp_sqrth(vd, vm, fpstatus_ptr(FPST_A32_F16));
71
}
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);
127
128
--
129
2.34.1
diff view generated by jsdifflib
New patch
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.
1
5
6
Patch created with
7
perl -p -i -e 's/FPST_FPCR_F16(?!_)/FPST_A64_F16/g' target/arm/tcg/translate-{a64,sve,sme}.c
8
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(-)
16
17
diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c
18
index XXXXXXX..XXXXXXX 100644
19
--- a/target/arm/tcg/translate-a64.c
20
+++ b/target/arm/tcg/translate-a64.c
21
@@ -XXX,XX +XXX,XX @@ static void gen_gvec_op3_fpst(DisasContext *s, bool is_q, int rd, int rn,
22
int rm, bool is_fp16, int data,
23
gen_helper_gvec_3_ptr *fn)
24
{
25
- TCGv_ptr fpst = fpstatus_ptr(is_fp16 ? FPST_FPCR_F16 : FPST_A64);
26
+ TCGv_ptr fpst = fpstatus_ptr(is_fp16 ? FPST_A64_F16 : FPST_A64);
27
tcg_gen_gvec_3_ptr(vec_full_reg_offset(s, rd),
28
vec_full_reg_offset(s, rn),
29
vec_full_reg_offset(s, rm), fpst,
30
@@ -XXX,XX +XXX,XX @@ static void gen_gvec_op4_fpst(DisasContext *s, bool is_q, int rd, int rn,
31
int rm, int ra, bool is_fp16, int data,
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
160
index XXXXXXX..XXXXXXX 100644
161
--- a/target/arm/tcg/translate-sve.c
162
+++ b/target/arm/tcg/translate-sve.c
163
@@ -XXX,XX +XXX,XX @@ static bool gen_gvec_fpst_arg_zz(DisasContext *s, gen_helper_gvec_2_ptr *fn,
164
arg_rr_esz *a, int data)
165
{
166
return gen_gvec_fpst_zz(s, fn, a->rd, a->rn, data,
167
- a->esz == MO_16 ? FPST_FPCR_F16 : FPST_A64);
168
+ a->esz == MO_16 ? FPST_A64_F16 : FPST_A64);
169
}
170
171
/* Invoke an out-of-line helper on 3 Zregs. */
172
@@ -XXX,XX +XXX,XX @@ static bool gen_gvec_fpst_arg_zzz(DisasContext *s, gen_helper_gvec_3_ptr *fn,
173
arg_rrr_esz *a, int data)
174
{
175
return gen_gvec_fpst_zzz(s, fn, a->rd, a->rn, a->rm, data,
176
- a->esz == MO_16 ? FPST_FPCR_F16 : FPST_A64);
177
+ a->esz == MO_16 ? FPST_A64_F16 : FPST_A64);
178
}
179
180
/* Invoke an out-of-line helper on 4 Zregs. */
181
@@ -XXX,XX +XXX,XX @@ static bool gen_gvec_fpst_arg_zpzz(DisasContext *s, gen_helper_gvec_4_ptr *fn,
182
arg_rprr_esz *a)
183
{
184
return gen_gvec_fpst_zzzp(s, fn, a->rd, a->rn, a->rm, a->pg, 0,
185
- a->esz == MO_16 ? FPST_FPCR_F16 : FPST_A64);
186
+ a->esz == MO_16 ? FPST_A64_F16 : FPST_A64);
187
}
188
189
/* Invoke a vector expander on two Zregs and an immediate. */
190
@@ -XXX,XX +XXX,XX @@ static bool do_FMLA_zzxz(DisasContext *s, arg_rrxr_esz *a, bool sub)
191
};
192
return gen_gvec_fpst_zzzz(s, fns[a->esz], a->rd, a->rn, a->rm, a->ra,
193
(a->index << 1) | sub,
194
- a->esz == MO_16 ? FPST_FPCR_F16 : FPST_A64);
195
+ a->esz == MO_16 ? FPST_A64_F16 : FPST_A64);
196
}
197
198
TRANS_FEAT(FMLA_zzxz, aa64_sve, do_FMLA_zzxz, a, false)
199
@@ -XXX,XX +XXX,XX @@ static gen_helper_gvec_3_ptr * const fmul_idx_fns[4] = {
200
};
201
TRANS_FEAT(FMUL_zzx, aa64_sve, gen_gvec_fpst_zzz,
202
fmul_idx_fns[a->esz], a->rd, a->rn, a->rm, a->index,
203
- a->esz == MO_16 ? FPST_FPCR_F16 : FPST_A64)
204
+ a->esz == MO_16 ? FPST_A64_F16 : FPST_A64)
205
206
/*
207
*** SVE Floating Point Fast Reduction Group
208
@@ -XXX,XX +XXX,XX @@ static bool do_reduce(DisasContext *s, arg_rpr_esz *a,
209
210
tcg_gen_addi_ptr(t_zn, tcg_env, vec_full_reg_offset(s, a->rn));
211
tcg_gen_addi_ptr(t_pg, tcg_env, pred_full_reg_offset(s, a->pg));
212
- status = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_A64);
213
+ status = fpstatus_ptr(a->esz == MO_16 ? FPST_A64_F16 : FPST_A64);
214
215
fn(temp, t_zn, t_pg, status, t_desc);
216
217
@@ -XXX,XX +XXX,XX @@ static bool do_ppz_fp(DisasContext *s, arg_rpr_esz *a,
218
if (sve_access_check(s)) {
219
unsigned vsz = vec_full_reg_size(s);
220
TCGv_ptr status =
221
- fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_A64);
222
+ fpstatus_ptr(a->esz == MO_16 ? FPST_A64_F16 : FPST_A64);
223
224
tcg_gen_gvec_3_ptr(pred_full_reg_offset(s, a->rd),
225
vec_full_reg_offset(s, a->rn),
226
@@ -XXX,XX +XXX,XX @@ static gen_helper_gvec_3_ptr * const ftmad_fns[4] = {
227
};
228
TRANS_FEAT_NONSTREAMING(FTMAD, aa64_sve, gen_gvec_fpst_zzz,
229
ftmad_fns[a->esz], a->rd, a->rn, a->rm, a->imm,
230
- a->esz == MO_16 ? FPST_FPCR_F16 : FPST_A64)
231
+ a->esz == MO_16 ? FPST_A64_F16 : FPST_A64)
232
233
/*
234
*** SVE Floating Point Accumulating Reduction Group
235
@@ -XXX,XX +XXX,XX @@ static bool trans_FADDA(DisasContext *s, arg_rprr_esz *a)
236
t_pg = tcg_temp_new_ptr();
237
tcg_gen_addi_ptr(t_rm, tcg_env, vec_full_reg_offset(s, a->rm));
238
tcg_gen_addi_ptr(t_pg, tcg_env, pred_full_reg_offset(s, a->pg));
239
- t_fpst = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_A64);
240
+ t_fpst = fpstatus_ptr(a->esz == MO_16 ? FPST_A64_F16 : FPST_A64);
241
t_desc = tcg_constant_i32(simd_desc(vsz, vsz, 0));
242
243
fns[a->esz - 1](t_val, t_val, t_rm, t_pg, t_fpst, t_desc);
244
@@ -XXX,XX +XXX,XX @@ static void do_fp_scalar(DisasContext *s, int zd, int zn, int pg, bool is_fp16,
245
tcg_gen_addi_ptr(t_zn, tcg_env, vec_full_reg_offset(s, zn));
246
tcg_gen_addi_ptr(t_pg, tcg_env, pred_full_reg_offset(s, pg));
247
248
- status = fpstatus_ptr(is_fp16 ? FPST_FPCR_F16 : FPST_A64);
249
+ status = fpstatus_ptr(is_fp16 ? FPST_A64_F16 : FPST_A64);
250
desc = tcg_constant_i32(simd_desc(vsz, vsz, 0));
251
fn(t_zd, t_zn, t_pg, scalar, status, desc);
252
}
253
@@ -XXX,XX +XXX,XX @@ static bool do_fp_cmp(DisasContext *s, arg_rprr_esz *a,
254
}
255
if (sve_access_check(s)) {
256
unsigned vsz = vec_full_reg_size(s);
257
- TCGv_ptr status = fpstatus_ptr(a->esz == MO_16 ? FPST_FPCR_F16 : FPST_A64);
258
+ TCGv_ptr status = fpstatus_ptr(a->esz == MO_16 ? FPST_A64_F16 : FPST_A64);
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
{
399
--
400
2.34.1
diff view generated by jsdifflib
New patch
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.
1
3
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
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(-)
13
14
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
15
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/cpu.h
17
+++ b/target/arm/cpu.h
18
@@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState {
19
*
20
* fp_status_a32: is the "normal" fp status for AArch32 insns
21
* fp_status_a64: is the "normal" fp status for AArch64 insns
22
- * fp_status_fp16: used for half-precision calculations
23
* fp_status_fp16_a32: used for AArch32 half-precision calculations
24
* fp_status_fp16_a64: used for AArch64 half-precision calculations
25
* standard_fp_status : the ARM "Standard FPSCR Value"
26
@@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState {
27
*/
28
float_status fp_status_a32;
29
float_status fp_status_a64;
30
- float_status fp_status_f16;
31
float_status fp_status_f16_a32;
32
float_status fp_status_f16_a64;
33
float_status standard_fp_status;
34
diff --git a/target/arm/tcg/translate.h b/target/arm/tcg/translate.h
35
index XXXXXXX..XXXXXXX 100644
36
--- a/target/arm/tcg/translate.h
37
+++ b/target/arm/tcg/translate.h
38
@@ -XXX,XX +XXX,XX @@ static inline CPUARMTBFlags arm_tbflags_from_tb(const TranslationBlock *tb)
39
typedef enum ARMFPStatusFlavour {
40
FPST_A32,
41
FPST_A64,
42
- FPST_FPCR_F16,
43
FPST_A32_F16,
44
FPST_A64_F16,
45
FPST_STD,
46
@@ -XXX,XX +XXX,XX @@ typedef enum ARMFPStatusFlavour {
47
* for AArch32 non-FP16 operations controlled by the FPCR
48
* FPST_A64
49
* for AArch64 non-FP16 operations controlled by the FPCR
50
- * FPST_FPCR_F16
51
- * for operations controlled by the FPCR where FPCR.FZ16 is to be used
52
* FPST_A32_F16
53
* for AArch32 operations controlled by the FPCR where FPCR.FZ16 is to be used
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;
65
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
66
index XXXXXXX..XXXXXXX 100644
67
--- a/target/arm/cpu.c
68
+++ b/target/arm/cpu.c
69
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_reset_hold(Object *obj, ResetType type)
70
arm_set_default_fp_behaviours(&env->vfp.fp_status_a32);
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)
99
}
100
set_float_rounding_mode(i, &env->vfp.fp_status_a32);
101
set_float_rounding_mode(i, &env->vfp.fp_status_a64);
102
- set_float_rounding_mode(i, &env->vfp.fp_status_f16);
103
set_float_rounding_mode(i, &env->vfp.fp_status_f16_a32);
104
set_float_rounding_mode(i, &env->vfp.fp_status_f16_a64);
105
}
106
if (changed & FPCR_FZ16) {
107
bool ftz_enabled = val & FPCR_FZ16;
108
- set_flush_to_zero(ftz_enabled, &env->vfp.fp_status_f16);
109
set_flush_to_zero(ftz_enabled, &env->vfp.fp_status_f16_a32);
110
set_flush_to_zero(ftz_enabled, &env->vfp.fp_status_f16_a64);
111
set_flush_to_zero(ftz_enabled, &env->vfp.standard_fp_status_f16);
112
- set_flush_inputs_to_zero(ftz_enabled, &env->vfp.fp_status_f16);
113
set_flush_inputs_to_zero(ftz_enabled, &env->vfp.fp_status_f16_a32);
114
set_flush_inputs_to_zero(ftz_enabled, &env->vfp.fp_status_f16_a64);
115
set_flush_inputs_to_zero(ftz_enabled, &env->vfp.standard_fp_status_f16);
116
@@ -XXX,XX +XXX,XX @@ static void vfp_set_fpcr_to_host(CPUARMState *env, uint32_t val, uint32_t mask)
117
bool dnan_enabled = val & FPCR_DN;
118
set_default_nan_mode(dnan_enabled, &env->vfp.fp_status_a32);
119
set_default_nan_mode(dnan_enabled, &env->vfp.fp_status_a64);
120
- set_default_nan_mode(dnan_enabled, &env->vfp.fp_status_f16);
121
set_default_nan_mode(dnan_enabled, &env->vfp.fp_status_f16_a32);
122
set_default_nan_mode(dnan_enabled, &env->vfp.fp_status_f16_a64);
123
}
124
--
125
2.34.1
diff view generated by jsdifflib
New patch
1
1
Our float_flag_input_denormal exception flag is set when the fpu code
2
flushes an input denormal to zero. This is what many guest
3
architectures (eg classic Arm behaviour) require, but it is not the
4
only donarmal-related reason we might want to set an exception flag.
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
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
25
---
26
include/fpu/softfloat-types.h | 5 +++--
27
fpu/softfloat.c | 4 ++--
28
target/arm/tcg/sve_helper.c | 6 +++---
29
target/arm/vfp_helper.c | 10 +++++-----
30
target/i386/tcg/fpu_helper.c | 6 +++---
31
target/mips/tcg/msa_helper.c | 2 +-
32
target/rx/op_helper.c | 2 +-
33
fpu/softfloat-parts.c.inc | 2 +-
34
8 files changed, 19 insertions(+), 18 deletions(-)
35
36
diff --git a/include/fpu/softfloat-types.h b/include/fpu/softfloat-types.h
37
index XXXXXXX..XXXXXXX 100644
38
--- a/include/fpu/softfloat-types.h
39
+++ b/include/fpu/softfloat-types.h
40
@@ -XXX,XX +XXX,XX @@ enum {
41
float_flag_overflow = 0x0004,
42
float_flag_underflow = 0x0008,
43
float_flag_inexact = 0x0010,
44
- float_flag_input_denormal = 0x0020,
45
+ /* We flushed an input denormal to 0 (because of flush_inputs_to_zero) */
46
+ float_flag_input_denormal_flushed = 0x0020,
47
float_flag_output_denormal = 0x0040,
48
float_flag_invalid_isi = 0x0080, /* inf - inf */
49
float_flag_invalid_imz = 0x0100, /* inf * 0 */
50
@@ -XXX,XX +XXX,XX @@ typedef struct float_status {
51
bool tininess_before_rounding;
52
/* should denormalised results go to zero and set the inexact flag? */
53
bool flush_to_zero;
54
- /* should denormalised inputs go to zero and set the input_denormal flag? */
55
+ /* should denormalised inputs go to zero and set input_denormal_flushed? */
56
bool flush_inputs_to_zero;
57
bool default_nan_mode;
58
/*
59
diff --git a/fpu/softfloat.c b/fpu/softfloat.c
60
index XXXXXXX..XXXXXXX 100644
61
--- a/fpu/softfloat.c
62
+++ b/fpu/softfloat.c
63
@@ -XXX,XX +XXX,XX @@ this code that are retained.
64
if (unlikely(soft_t ## _is_denormal(*a))) { \
65
*a = soft_t ## _set_sign(soft_t ## _zero, \
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 {
219
--
220
2.34.1
diff view generated by jsdifflib
New patch
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"
1
8
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
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-21-peter.maydell@linaro.org
15
---
16
include/fpu/softfloat-types.h | 3 ++-
17
fpu/softfloat.c | 2 +-
18
target/arm/vfp_helper.c | 2 +-
19
target/i386/tcg/fpu_helper.c | 2 +-
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(-)
26
27
diff --git a/include/fpu/softfloat-types.h b/include/fpu/softfloat-types.h
28
index XXXXXXX..XXXXXXX 100644
29
--- a/include/fpu/softfloat-types.h
30
+++ b/include/fpu/softfloat-types.h
31
@@ -XXX,XX +XXX,XX @@ enum {
32
float_flag_inexact = 0x0010,
33
/* We flushed an input denormal to 0 (because of flush_inputs_to_zero) */
34
float_flag_input_denormal_flushed = 0x0020,
35
- float_flag_output_denormal = 0x0040,
36
+ /* We flushed an output denormal to 0 (because of flush_to_zero) */
37
+ float_flag_output_denormal_flushed = 0x0040,
38
float_flag_invalid_isi = 0x0080, /* inf - inf */
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
42
index XXXXXXX..XXXXXXX 100644
43
--- a/fpu/softfloat.c
44
+++ b/fpu/softfloat.c
45
@@ -XXX,XX +XXX,XX @@ floatx80 roundAndPackFloatx80(FloatX80RoundPrec roundingPrecision, bool zSign,
46
}
47
if ( zExp <= 0 ) {
48
if (status->flush_to_zero) {
49
- float_raise(float_flag_output_denormal, status);
50
+ float_raise(float_flag_output_denormal_flushed, status);
51
return packFloatx80(zSign, 0, 0);
52
}
53
isTiny = status->tininess_before_rounding
54
diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c
55
index XXXXXXX..XXXXXXX 100644
56
--- a/target/arm/vfp_helper.c
57
+++ b/target/arm/vfp_helper.c
58
@@ -XXX,XX +XXX,XX @@ static inline uint32_t vfp_exceptbits_from_host(int host_bits)
59
if (host_bits & float_flag_overflow) {
60
target_bits |= FPSR_OFC;
61
}
62
- if (host_bits & (float_flag_underflow | float_flag_output_denormal)) {
63
+ if (host_bits & (float_flag_underflow | float_flag_output_denormal_flushed)) {
64
target_bits |= FPSR_UFC;
65
}
66
if (host_bits & float_flag_inexact) {
67
diff --git a/target/i386/tcg/fpu_helper.c b/target/i386/tcg/fpu_helper.c
68
index XXXXXXX..XXXXXXX 100644
69
--- a/target/i386/tcg/fpu_helper.c
70
+++ b/target/i386/tcg/fpu_helper.c
71
@@ -XXX,XX +XXX,XX @@ void update_mxcsr_from_sse_status(CPUX86State *env)
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));
78
}
79
80
diff --git a/target/m68k/fpu_helper.c b/target/m68k/fpu_helper.c
81
index XXXXXXX..XXXXXXX 100644
82
--- a/target/m68k/fpu_helper.c
83
+++ b/target/m68k/fpu_helper.c
84
@@ -XXX,XX +XXX,XX @@ static int cpu_m68k_exceptbits_from_host(int host_bits)
85
if (host_bits & float_flag_overflow) {
86
target_bits |= 0x40;
87
}
88
- if (host_bits & (float_flag_underflow | float_flag_output_denormal)) {
89
+ if (host_bits & (float_flag_underflow | float_flag_output_denormal_flushed)) {
90
target_bits |= 0x20;
91
}
92
if (host_bits & float_flag_divbyzero) {
93
diff --git a/target/mips/tcg/msa_helper.c b/target/mips/tcg/msa_helper.c
94
index XXXXXXX..XXXXXXX 100644
95
--- a/target/mips/tcg/msa_helper.c
96
+++ b/target/mips/tcg/msa_helper.c
97
@@ -XXX,XX +XXX,XX @@ static inline int update_msacsr(CPUMIPSState *env, int action, int denormal)
98
}
99
100
/* Set Inexact (I) and Underflow (U) when flushing outputs to zero */
101
- if ((ieee_exception_flags & float_flag_output_denormal) &&
102
+ if ((ieee_exception_flags & float_flag_output_denormal_flushed) &&
103
(env->active_tc.msacsr & MSACSR_FS_MASK) != 0) {
104
mips_exception_flags |= FP_INEXACT;
105
if (action & CLEAR_FS_UNDERFLOW) {
106
diff --git a/target/rx/op_helper.c b/target/rx/op_helper.c
107
index XXXXXXX..XXXXXXX 100644
108
--- a/target/rx/op_helper.c
109
+++ b/target/rx/op_helper.c
110
@@ -XXX,XX +XXX,XX @@ static void update_fpsw(CPURXState *env, float32 ret, uintptr_t retaddr)
111
SET_FPSW(X);
112
}
113
if ((xcpt & (float_flag_input_denormal_flushed
114
- | float_flag_output_denormal))
115
+ | float_flag_output_denormal_flushed))
116
&& !FIELD_EX32(env->fpsw, FPSW, DN)) {
117
env->fpsw = FIELD_DP32(env->fpsw, FPSW, CE, 1);
118
}
119
diff --git a/target/tricore/fpu_helper.c b/target/tricore/fpu_helper.c
120
index XXXXXXX..XXXXXXX 100644
121
--- a/target/tricore/fpu_helper.c
122
+++ b/target/tricore/fpu_helper.c
123
@@ -XXX,XX +XXX,XX @@ static inline uint8_t f_get_excp_flags(CPUTriCoreState *env)
124
& (float_flag_invalid
125
| float_flag_overflow
126
| float_flag_underflow
127
- | float_flag_output_denormal
128
+ | float_flag_output_denormal_flushed
129
| float_flag_divbyzero
130
| float_flag_inexact);
131
}
132
@@ -XXX,XX +XXX,XX @@ static void f_update_psw_flags(CPUTriCoreState *env, uint8_t flags)
133
some_excp = 1;
134
}
135
136
- if (flags & float_flag_underflow || flags & float_flag_output_denormal) {
137
+ if (flags & float_flag_underflow || flags & float_flag_output_denormal_flushed) {
138
env->FPU_FU = 1 << 31;
139
some_excp = 1;
140
}
141
@@ -XXX,XX +XXX,XX @@ static void f_update_psw_flags(CPUTriCoreState *env, uint8_t flags)
142
some_excp = 1;
143
}
144
145
- if (flags & float_flag_inexact || flags & float_flag_output_denormal) {
146
+ if (flags & float_flag_inexact || flags & float_flag_output_denormal_flushed) {
147
env->PSW |= 1 << 26;
148
some_excp = 1;
149
}
150
diff --git a/fpu/softfloat-parts.c.inc b/fpu/softfloat-parts.c.inc
151
index XXXXXXX..XXXXXXX 100644
152
--- a/fpu/softfloat-parts.c.inc
153
+++ b/fpu/softfloat-parts.c.inc
154
@@ -XXX,XX +XXX,XX @@ static void partsN(uncanon_normal)(FloatPartsN *p, float_status *s,
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);
163
--
164
2.34.1
diff view generated by jsdifflib
New patch
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.
1
6
7
Correct the comment.
8
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
12
---
13
include/fpu/softfloat-types.h | 2 +-
14
1 file changed, 1 insertion(+), 1 deletion(-)
15
16
diff --git a/include/fpu/softfloat-types.h b/include/fpu/softfloat-types.h
17
index XXXXXXX..XXXXXXX 100644
18
--- a/include/fpu/softfloat-types.h
19
+++ b/include/fpu/softfloat-types.h
20
@@ -XXX,XX +XXX,XX @@ typedef struct float_status {
21
Float3NaNPropRule float_3nan_prop_rule;
22
FloatInfZeroNaNRule float_infzeronan_rule;
23
bool tininess_before_rounding;
24
- /* should denormalised results go to zero and set the inexact flag? */
25
+ /* should denormalised results go to zero and set output_denormal_flushed? */
26
bool flush_to_zero;
27
/* should denormalised inputs go to zero and set input_denormal_flushed? */
28
bool flush_inputs_to_zero;
29
--
30
2.34.1
diff view generated by jsdifflib
New patch
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.
1
5
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.)
12
13
Remove the now-unnecessary advsimd helpers and make the places that
14
generated calls to them use the vfp helpers instead. Many of the
15
helper functions were already unused.
16
17
(The remaining advsimd_ helpers are those which don't have vfp
18
versions.)
19
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
23
---
24
target/arm/tcg/helper-a64.h | 8 --------
25
target/arm/tcg/helper-a64.c | 9 ---------
26
target/arm/tcg/translate-a64.c | 16 ++++++++--------
27
3 files changed, 8 insertions(+), 25 deletions(-)
28
29
diff --git a/target/arm/tcg/helper-a64.h b/target/arm/tcg/helper-a64.h
30
index XXXXXXX..XXXXXXX 100644
31
--- a/target/arm/tcg/helper-a64.h
32
+++ b/target/arm/tcg/helper-a64.h
33
@@ -XXX,XX +XXX,XX @@ DEF_HELPER_FLAGS_2(frecpx_f16, TCG_CALL_NO_RWG, f16, f16, fpst)
34
DEF_HELPER_FLAGS_2(fcvtx_f64_to_f32, TCG_CALL_NO_RWG, f32, f64, fpst)
35
DEF_HELPER_FLAGS_3(crc32_64, TCG_CALL_NO_RWG_SE, i64, i64, i64, i32)
36
DEF_HELPER_FLAGS_3(crc32c_64, TCG_CALL_NO_RWG_SE, i64, i64, i64, i32)
37
-DEF_HELPER_FLAGS_3(advsimd_maxh, TCG_CALL_NO_RWG, f16, f16, f16, fpst)
38
-DEF_HELPER_FLAGS_3(advsimd_minh, TCG_CALL_NO_RWG, f16, f16, f16, fpst)
39
-DEF_HELPER_FLAGS_3(advsimd_maxnumh, TCG_CALL_NO_RWG, f16, f16, f16, fpst)
40
-DEF_HELPER_FLAGS_3(advsimd_minnumh, TCG_CALL_NO_RWG, f16, f16, f16, fpst)
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
49
index XXXXXXX..XXXXXXX 100644
50
--- a/target/arm/tcg/helper-a64.c
51
+++ b/target/arm/tcg/helper-a64.c
52
@@ -XXX,XX +XXX,XX @@ uint32_t ADVSIMD_HELPER(name, h)(uint32_t a, uint32_t b, float_status *fpst) \
53
return float16_ ## name(a, b, fpst); \
54
}
55
56
-ADVSIMD_HALFOP(add)
57
-ADVSIMD_HALFOP(sub)
58
-ADVSIMD_HALFOP(mul)
59
-ADVSIMD_HALFOP(div)
60
-ADVSIMD_HALFOP(min)
61
-ADVSIMD_HALFOP(max)
62
-ADVSIMD_HALFOP(minnum)
63
-ADVSIMD_HALFOP(maxnum)
64
-
65
#define ADVSIMD_TWOHALFOP(name) \
66
uint32_t ADVSIMD_HELPER(name, 2h)(uint32_t two_a, uint32_t two_b, \
67
float_status *fpst) \
68
diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c
69
index XXXXXXX..XXXXXXX 100644
70
--- a/target/arm/tcg/translate-a64.c
71
+++ b/target/arm/tcg/translate-a64.c
72
@@ -XXX,XX +XXX,XX @@ static const FPScalar f_scalar_fmul = {
73
TRANS(FMUL_s, do_fp3_scalar, a, &f_scalar_fmul)
74
75
static const FPScalar f_scalar_fmax = {
76
- gen_helper_advsimd_maxh,
77
+ gen_helper_vfp_maxh,
78
gen_helper_vfp_maxs,
79
gen_helper_vfp_maxd,
80
};
81
TRANS(FMAX_s, do_fp3_scalar, a, &f_scalar_fmax)
82
83
static const FPScalar f_scalar_fmin = {
84
- gen_helper_advsimd_minh,
85
+ gen_helper_vfp_minh,
86
gen_helper_vfp_mins,
87
gen_helper_vfp_mind,
88
};
89
TRANS(FMIN_s, do_fp3_scalar, a, &f_scalar_fmin)
90
91
static const FPScalar f_scalar_fmaxnm = {
92
- gen_helper_advsimd_maxnumh,
93
+ gen_helper_vfp_maxnumh,
94
gen_helper_vfp_maxnums,
95
gen_helper_vfp_maxnumd,
96
};
97
TRANS(FMAXNM_s, do_fp3_scalar, a, &f_scalar_fmaxnm)
98
99
static const FPScalar f_scalar_fminnm = {
100
- gen_helper_advsimd_minnumh,
101
+ gen_helper_vfp_minnumh,
102
gen_helper_vfp_minnums,
103
gen_helper_vfp_minnumd,
104
};
105
@@ -XXX,XX +XXX,XX @@ static bool do_fp_reduction(DisasContext *s, arg_qrr_e *a,
106
return true;
107
}
108
109
-TRANS_FEAT(FMAXNMV_h, aa64_fp16, do_fp_reduction, a, gen_helper_advsimd_maxnumh)
110
-TRANS_FEAT(FMINNMV_h, aa64_fp16, do_fp_reduction, a, gen_helper_advsimd_minnumh)
111
-TRANS_FEAT(FMAXV_h, aa64_fp16, do_fp_reduction, a, gen_helper_advsimd_maxh)
112
-TRANS_FEAT(FMINV_h, aa64_fp16, do_fp_reduction, a, gen_helper_advsimd_minh)
113
+TRANS_FEAT(FMAXNMV_h, aa64_fp16, do_fp_reduction, a, gen_helper_vfp_maxnumh)
114
+TRANS_FEAT(FMINNMV_h, aa64_fp16, do_fp_reduction, a, gen_helper_vfp_minnumh)
115
+TRANS_FEAT(FMAXV_h, aa64_fp16, do_fp_reduction, a, gen_helper_vfp_maxh)
116
+TRANS_FEAT(FMINV_h, aa64_fp16, do_fp_reduction, a, gen_helper_vfp_minh)
117
118
TRANS(FMAXNMV_s, do_fp_reduction, a, gen_helper_vfp_maxnums)
119
TRANS(FMINNMV_s, do_fp_reduction, a, gen_helper_vfp_minnums)
120
--
121
2.34.1
diff view generated by jsdifflib
New patch
1
We should be using the F16-specific float_status for conversions from
2
half-precision, because halfprec inputs never set Input Denormal.
1
3
4
Without FEAT_AHP, using the wrong fpst here had no effect, because
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.
10
11
With FEAT_AHP, the FPCR.AH=1 behaviour sets IDC for
12
input_denormal_used, which we will only ignore in
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
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
20
---
21
target/arm/tcg/translate-a64.c | 9 ++++++---
22
target/arm/tcg/translate-sve.c | 4 ++--
23
2 files changed, 8 insertions(+), 5 deletions(-)
24
25
diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c
26
index XXXXXXX..XXXXXXX 100644
27
--- a/target/arm/tcg/translate-a64.c
28
+++ b/target/arm/tcg/translate-a64.c
29
@@ -XXX,XX +XXX,XX @@ static bool trans_FCVT_s_sh(DisasContext *s, arg_rr *a)
30
if (fp_access_check(s)) {
31
TCGv_i32 tcg_rn = read_fp_hreg(s, a->rn);
32
TCGv_i32 tcg_rd = tcg_temp_new_i32();
33
- TCGv_ptr tcg_fpst = fpstatus_ptr(FPST_A64);
34
+ TCGv_ptr tcg_fpst = fpstatus_ptr(FPST_A64_F16);
35
TCGv_i32 tcg_ahp = get_ahp_flag();
36
37
gen_helper_vfp_fcvt_f16_to_f32(tcg_rd, tcg_rn, tcg_fpst, tcg_ahp);
38
@@ -XXX,XX +XXX,XX @@ static bool trans_FCVT_s_dh(DisasContext *s, arg_rr *a)
39
if (fp_access_check(s)) {
40
TCGv_i32 tcg_rn = read_fp_hreg(s, a->rn);
41
TCGv_i64 tcg_rd = tcg_temp_new_i64();
42
- TCGv_ptr tcg_fpst = fpstatus_ptr(FPST_A64);
43
+ TCGv_ptr tcg_fpst = fpstatus_ptr(FPST_A64_F16);
44
TCGv_i32 tcg_ahp = get_ahp_flag();
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;
49
}
50
51
- fpst = fpstatus_ptr(FPST_A64);
52
if (a->esz == MO_64) {
53
/* 32 -> 64 bit fp conversion */
54
TCGv_i64 tcg_res[2];
55
TCGv_i32 tcg_op = tcg_temp_new_i32();
56
int srcelt = a->q ? 2 : 0;
57
58
+ fpst = fpstatus_ptr(FPST_A64);
59
+
60
for (pass = 0; pass < 2; pass++) {
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,
94
--
95
2.34.1
diff view generated by jsdifflib
New patch
1
From: Hongren Zheng <i@zenithal.me>
1
2
3
When USBPacket in OUT direction has larger payload
4
than the ep_out_buffer (of size 512), a buffer overflow
5
would occur.
6
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
23
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
24
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
25
---
26
hw/usb/canokey.h | 4 ----
27
hw/usb/canokey.c | 6 +++---
28
2 files changed, 3 insertions(+), 7 deletions(-)
29
30
diff --git a/hw/usb/canokey.h b/hw/usb/canokey.h
31
index XXXXXXX..XXXXXXX 100644
32
--- a/hw/usb/canokey.h
33
+++ b/hw/usb/canokey.h
34
@@ -XXX,XX +XXX,XX @@
35
#define CANOKEY_EP_NUM 3
36
/* BULK/INTR IN can be up to 1352 bytes, e.g. get key info */
37
#define CANOKEY_EP_IN_BUFFER_SIZE 2048
38
-/* BULK OUT can be up to 270 bytes, e.g. PIV import cert */
39
-#define CANOKEY_EP_OUT_BUFFER_SIZE 512
40
41
typedef enum {
42
CANOKEY_EP_IN_WAIT,
43
@@ -XXX,XX +XXX,XX @@ typedef struct CanoKeyState {
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;
77
--
78
2.34.1
diff view generated by jsdifflib