1
A big pullreq by number of patches, but most of them are just docs
1
Hi; here's another arm pullreq; by volume most of this is
2
updates or MAINTAINERS file fixes. The actual code changes are pretty
2
refactoring from me, but there are also some bugfixes and
3
minimal bugfixes.
3
other bits and pieces here.
4
4
5
thanks
5
thanks
6
-- PMM
6
-- PMM
7
7
8
The following changes since commit 8cc30eb1400fc01f2b139cdd3dc524f8b84dbe07:
8
The following changes since commit ed734377ab3f3f3cc15d7aa301a87ab6370f2eed:
9
9
10
Merge remote-tracking branch 'remotes/mcayland/tags/qemu-sparc-20201122' into staging (2020-11-22 15:02:52 +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)
11
11
12
are available in the Git repository at:
12
are available in the Git repository at:
13
13
14
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20201123
14
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20250128-1
15
15
16
for you to fetch changes up to c6ff78563ad2971f289168c7cae6ecb0b4359516:
16
for you to fetch changes up to 664280abddcb3cacc9c6204706bb739fcc1316f7:
17
17
18
docs/system/pr-manager.rst: Fix minor docs nits (2020-11-23 11:10:04 +0000)
18
hw/usb/canokey: Fix buffer overflow for OUT packet (2025-01-28 18:40:19 +0000)
19
19
20
----------------------------------------------------------------
20
----------------------------------------------------------------
21
target-arm queue:
21
target-arm queue:
22
* incorporate 'orphan' rST docs into manuals
22
* hw/arm: Remove various uses of first_cpu global
23
* linux-user/arm: Deliver SIGTRAP for UDF patterns used as breakpoints
23
* hw/char/imx_serial: Fix reset value of UFCR register
24
* target/arm: Make SYS_HEAPINFO work with RAM that doesn't start at 0
24
* hw/char/imx_serial: Update all state before restarting ageing timer
25
* document raspi boards and tosa
25
* hw/pci-host/designware: Expose MSI IRQ
26
* docs/system: Deprecate raspi2/raspi3 machine aliases
26
* hw/arm/stellaris: refactoring, cleanup
27
* docs/system/arm: Document OpenPOWER Witherspoon BMC model Front LEDs
27
* hw/arm/stellaris: map both I2C controllers
28
* MAINTAINERS: add lines for docs files for Arm boards
28
* tests/functional: Add a test for the arm microbit machine
29
* hw/intc: fix heap-buffer-overflow in rxicu_realize()
29
* target/arm: arm_reset_sve_state() should set FPSR, not FPCR
30
* hw/arm: Fix bad print format specifiers
30
* target/arm: refactorings preparatory to FEAT_AFP implementation
31
* target/arm: fix stage 2 page-walks in 32-bit emulation
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
32
34
33
----------------------------------------------------------------
35
----------------------------------------------------------------
34
AlexChen (1):
36
Bernhard Beschow (3):
35
hw/arm: Fix bad print 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
36
40
37
Chen Qun (1):
41
Hongren Zheng (1):
38
hw/intc: fix heap-buffer-overflow in rxicu_realize()
42
hw/usb/canokey: Fix buffer overflow for OUT packet
39
43
40
Peter Maydell (11):
44
Peter Maydell (22):
41
target/arm: Make SYS_HEAPINFO work with RAM that doesn't start at 0
45
target/arm: arm_reset_sve_state() should set FPSR, not FPCR
42
linux-user/arm: Deliver SIGTRAP for UDF patterns used as breakpoints
46
target/arm: Use FPSR_ constants in vfp_exceptbits_from_host()
43
docs: Move virtio-net-failover.rst into the system manual
47
target/arm: Use uint32_t in vfp_exceptbits_from_host()
44
docs: Move cpu-hotplug.rst into the system manual
48
target/arm: Define new fp_status_a32 and fp_status_a64
45
docs: Move virtio-pmem.rst into the system manual
49
target/arm: Use vfp.fp_status_a64 in A64-only helper functions
46
docs/system/virtio-pmem.rst: Fix minor style issues
50
target/arm: Use fp_status_a64 or fp_status_a32 in is_ebf()
47
docs: Split out 'pc' machine model docs into their own file
51
target/arm: Use fp_status_a32 in vjvct helper
48
docs: Move microvm.rst into the system manual
52
target/arm: Use fp_status_a32 in vfp_cmp helpers
49
docs: Move pr-manager.rst into the system manual
53
target/arm: Use FPST_A32 in A32 decoder
50
docs: Split qemu-pr-helper documentation into tools manual
54
target/arm: Use FPST_A64 in A64 decoder
51
docs/system/pr-manager.rst: Fix minor docs nits
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
52
67
53
Philippe Mathieu-Daudé (10):
68
Philippe Mathieu-Daudé (9):
54
MAINTAINERS: Cover system/arm/cpu-features.rst with ARM TCG CPUs
69
hw/arm/nrf51: Rename ARMv7MState 'cpu' -> 'armv7m'
55
MAINTAINERS: Cover system/arm/aspeed.rst with ASPEED BMC machines
70
hw/arm/stellaris: Add 'armv7m' local variable
56
MAINTAINERS: Cover system/arm/nuvoton.rst with Nuvoton NPCM7xx
71
hw/arm/v7m: Remove use of &first_cpu in machine_init()
57
MAINTAINERS: Fix system/arm/orangepi.rst path
72
hw/arm/stellaris: Link each board schematic
58
MAINTAINERS: Cover system/arm/sbsa.rst with SBSA-REF machine
73
hw/arm/stellaris: Constify read-only arrays
59
MAINTAINERS: Cover system/arm/sx1.rst with OMAP machines
74
hw/arm/stellaris: Remove incorrect unimplemented i2c-0 at 0x40002000
60
docs/system: Deprecate raspi2/raspi3 machine aliases
75
hw/arm/stellaris: Replace magic numbers by definitions
61
docs/system/arm: Document the various raspi boards
76
hw/arm/stellaris: Use DEVCAP macro to access DeviceCapability registers
62
docs/system/arm: Document OpenPOWER Witherspoon BMC model Front LEDs
77
hw/arm/stellaris: Map both I2C controllers
63
docs/system/arm: Document the Sharp Zaurus SL-6000
64
78
65
Rémi Denis-Courmont (1):
79
Thomas Huth (1):
66
target/arm: fix stage 2 page-walks in 32-bit emulation
80
tests/functional: Add a test for the arm microbit machine
67
81
68
docs/meson.build | 1 +
82
MAINTAINERS | 1 +
69
docs/system/arm/aspeed.rst | 1 +
83
hw/usb/canokey.h | 4 --
70
docs/system/arm/raspi.rst | 43 +++++++++++++++
84
include/fpu/softfloat-types.h | 10 +--
71
docs/system/arm/xscale.rst | 20 ++++---
85
include/hw/arm/fsl-imx6.h | 4 +-
72
docs/{ => system}/cpu-hotplug.rst | 0
86
include/hw/arm/fsl-imx7.h | 4 +-
73
docs/system/deprecated.rst | 7 +++
87
include/hw/arm/nrf51_soc.h | 2 +-
74
docs/{ => system/i386}/microvm.rst | 5 +-
88
include/hw/char/imx_serial.h | 2 +-
75
docs/system/i386/pc.rst | 7 +++
89
include/hw/pci-host/designware.h | 1 +
76
docs/system/index.rst | 4 ++
90
target/arm/cpu.h | 12 ++--
77
docs/{ => system}/pr-manager.rst | 44 +++------------
91
target/arm/tcg/helper-a64.h | 8 ---
78
docs/system/target-arm.rst | 1 +
92
target/arm/tcg/translate.h | 32 ++++++---
79
docs/system/target-i386.rst | 19 +++++--
93
fpu/softfloat.c | 6 +-
80
docs/{ => system}/virtio-net-failover.rst | 0
94
hw/arm/b-l475e-iot01a.c | 2 +-
81
docs/system/virtio-pmem.rst | 76 ++++++++++++++++++++++++++
95
hw/arm/fsl-imx6.c | 13 +++-
82
docs/tools/conf.py | 2 +
96
hw/arm/fsl-imx7.c | 13 +++-
83
docs/tools/index.rst | 1 +
97
hw/arm/microbit.c | 2 +-
84
docs/tools/qemu-pr-helper.rst | 90 +++++++++++++++++++++++++++++++
98
hw/arm/mps2-tz.c | 2 +-
85
docs/virtio-pmem.rst | 76 --------------------------
99
hw/arm/mps2.c | 2 +-
86
hw/arm/pxa2xx.c | 2 +-
100
hw/arm/msf2-som.c | 2 +-
87
hw/arm/spitz.c | 2 +-
101
hw/arm/musca.c | 2 +-
88
hw/arm/tosa.c | 2 +-
102
hw/arm/netduino2.c | 2 +-
89
hw/intc/rx_icu.c | 18 +++----
103
hw/arm/netduinoplus2.c | 2 +-
90
linux-user/arm/cpu_loop.c | 28 ++++++++++
104
hw/arm/nrf51_soc.c | 18 ++---
91
target/arm/arm-semi.c | 12 +++--
105
hw/arm/olimex-stm32-h405.c | 2 +-
92
target/arm/helper.c | 4 +-
106
hw/arm/stellaris.c | 118 +++++++++++++++++++-----------
93
MAINTAINERS | 8 ++-
107
hw/arm/stm32vldiscovery.c | 2 +-
94
26 files changed, 326 insertions(+), 147 deletions(-)
108
hw/char/imx_serial.c | 7 +-
95
create mode 100644 docs/system/arm/raspi.rst
109
hw/pci-host/designware.c | 7 +-
96
rename docs/{ => system}/cpu-hotplug.rst (100%)
110
hw/usb/canokey.c | 6 +-
97
rename docs/{ => system/i386}/microvm.rst (98%)
111
target/arm/cpu.c | 6 +-
98
create mode 100644 docs/system/i386/pc.rst
112
target/arm/helper.c | 2 +-
99
rename docs/{ => system}/pr-manager.rst (68%)
113
target/arm/tcg/helper-a64.c | 9 ---
100
rename docs/{ => system}/virtio-net-failover.rst (100%)
114
target/arm/tcg/sme_helper.c | 6 +-
101
create mode 100644 docs/system/virtio-pmem.rst
115
target/arm/tcg/sve_helper.c | 6 +-
102
create mode 100644 docs/tools/qemu-pr-helper.rst
116
target/arm/tcg/translate-a64.c | 103 ++++++++++++++-------------
103
delete mode 100644 docs/virtio-pmem.rst
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
104
133
diff view generated by jsdifflib
1
From: Chen Qun <kuhn.chenqun@huawei.com>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
When 'j = icu->nr_sense – 1', the 'j < icu->nr_sense' condition is true,
3
The ARMv7MState object is not simply a CPU, it also
4
then 'j = icu->nr_sense', the'icu->init_sense[j]' has out-of-bounds access.
4
contains the NVIC, SysTick timer, and various MemoryRegions.
5
5
6
The asan showed stack:
6
Rename the field as 'armv7m', like other Cortex-M boards.
7
ERROR: AddressSanitizer: heap-buffer-overflow on address 0x604000004d7d at pc 0x55852cd26a76 bp 0x7ffe39f26200 sp 0x7ffe39f261f0
8
READ of size 1 at 0x604000004d7d thread T0
9
#0 0x55852cd26a75 in rxicu_realize ../hw/intc/rx_icu.c:311
10
#1 0x55852cf075f7 in device_set_realized ../hw/core/qdev.c:886
11
#2 0x55852cd4a32f in property_set_bool ../qom/object.c:2251
12
#3 0x55852cd4f9bb in object_property_set ../qom/object.c:1398
13
#4 0x55852cd54f3f in object_property_set_qobject ../qom/qom-qobject.c:28
14
#5 0x55852cd4fc3f in object_property_set_bool ../qom/object.c:1465
15
#6 0x55852cbf0b27 in register_icu ../hw/rx/rx62n.c:156
16
#7 0x55852cbf12a6 in rx62n_realize ../hw/rx/rx62n.c:261
17
#8 0x55852cf075f7 in device_set_realized ../hw/core/qdev.c:886
18
#9 0x55852cd4a32f in property_set_bool ../qom/object.c:2251
19
#10 0x55852cd4f9bb in object_property_set ../qom/object.c:1398
20
#11 0x55852cd54f3f in object_property_set_qobject ../qom/qom-qobject.c:28
21
#12 0x55852cd4fc3f in object_property_set_bool ../qom/object.c:1465
22
#13 0x55852cbf1a85 in rx_gdbsim_init ../hw/rx/rx-gdbsim.c:109
23
#14 0x55852cd22de0 in qemu_init ../softmmu/vl.c:4380
24
#15 0x55852ca57088 in main ../softmmu/main.c:49
25
#16 0x7feefafa5d42 in __libc_start_main (/lib64/libc.so.6+0x26d42)
26
7
27
Add the 'ice->src[i].sense' initialize to the default value, and then
8
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
28
process init_sense array to identify which irqs should be level-triggered.
9
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
29
10
Message-id: 20250112225614.33723-2-philmd@linaro.org
30
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
31
Reported-by: Euler Robot <euler.robot@huawei.com>
32
Signed-off-by: Chen Qun <kuhn.chenqun@huawei.com>
33
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
34
Message-id: 20201111141733.2358800-1-kuhn.chenqun@huawei.com
35
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
36
---
12
---
37
hw/intc/rx_icu.c | 18 ++++++++----------
13
include/hw/arm/nrf51_soc.h | 2 +-
38
1 file changed, 8 insertions(+), 10 deletions(-)
14
hw/arm/nrf51_soc.c | 18 +++++++++---------
15
2 files changed, 10 insertions(+), 10 deletions(-)
39
16
40
diff --git a/hw/intc/rx_icu.c b/hw/intc/rx_icu.c
17
diff --git a/include/hw/arm/nrf51_soc.h b/include/hw/arm/nrf51_soc.h
41
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
42
--- a/hw/intc/rx_icu.c
19
--- a/include/hw/arm/nrf51_soc.h
43
+++ b/hw/intc/rx_icu.c
20
+++ b/include/hw/arm/nrf51_soc.h
44
@@ -XXX,XX +XXX,XX @@ static const MemoryRegionOps icu_ops = {
21
@@ -XXX,XX +XXX,XX @@ struct NRF51State {
45
static void rxicu_realize(DeviceState *dev, Error **errp)
22
SysBusDevice parent_obj;
46
{
23
47
RXICUState *icu = RX_ICU(dev);
24
/*< public >*/
48
- int i, j;
25
- ARMv7MState cpu;
49
+ int i;
26
+ ARMv7MState armv7m;
50
27
51
if (icu->init_sense == NULL) {
28
NRF51UARTState uart;
52
qemu_log_mask(LOG_GUEST_ERROR,
29
NRF51RNGState rng;
53
"rx_icu: trigger-level property must be set.");
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)) {
54
return;
51
return;
55
}
52
}
56
- for (i = j = 0; i < NR_IRQS; i++) {
53
57
- if (icu->init_sense[j] == i) {
54
@@ -XXX,XX +XXX,XX @@ static void nrf51_soc_realize(DeviceState *dev_soc, Error **errp)
58
- icu->src[i].sense = TRG_LEVEL;
55
mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->uart), 0);
59
- if (j < icu->nr_sense) {
56
memory_region_add_subregion_overlap(&s->container, NRF51_UART_BASE, mr, 0);
60
- j++;
57
sysbus_connect_irq(SYS_BUS_DEVICE(&s->uart), 0,
61
- }
58
- qdev_get_gpio_in(DEVICE(&s->cpu),
62
- } else {
59
+ qdev_get_gpio_in(DEVICE(&s->armv7m),
63
- icu->src[i].sense = TRG_PEDGE;
60
BASE_TO_IRQ(NRF51_UART_BASE)));
64
- }
61
65
+
62
/* RNG */
66
+ for (i = 0; i < NR_IRQS; i++) {
63
@@ -XXX,XX +XXX,XX @@ static void nrf51_soc_realize(DeviceState *dev_soc, Error **errp)
67
+ icu->src[i].sense = TRG_PEDGE;
64
mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->rng), 0);
68
+ }
65
memory_region_add_subregion_overlap(&s->container, NRF51_RNG_BASE, mr, 0);
69
+ for (i = 0; i < icu->nr_sense; i++) {
66
sysbus_connect_irq(SYS_BUS_DEVICE(&s->rng), 0,
70
+ uint8_t irqno = icu->init_sense[i];
67
- qdev_get_gpio_in(DEVICE(&s->cpu),
71
+ icu->src[irqno].sense = TRG_LEVEL;
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)));
72
}
79
}
73
icu->req_irq = -1;
80
74
}
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");
75
--
95
--
76
2.20.1
96
2.34.1
77
97
78
98
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
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
1
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
3
---
12
---
4
docs/system/index.rst | 1 +
13
hw/arm/stellaris.c | 21 +++++++++++----------
5
docs/{ => system}/virtio-pmem.rst | 0
14
1 file changed, 11 insertions(+), 10 deletions(-)
6
2 files changed, 1 insertion(+)
7
rename docs/{ => system}/virtio-pmem.rst (100%)
8
15
9
diff --git a/docs/system/index.rst b/docs/system/index.rst
16
diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c
10
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
11
--- a/docs/system/index.rst
18
--- a/hw/arm/stellaris.c
12
+++ b/docs/system/index.rst
19
+++ b/hw/arm/stellaris.c
13
@@ -XXX,XX +XXX,XX @@ Contents:
20
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
14
gdb
21
*/
15
managed-startup
22
16
cpu-hotplug
23
Object *soc_container;
17
+ virtio-pmem
24
- DeviceState *gpio_dev[7], *nvic;
18
targets
25
+ DeviceState *gpio_dev[7], *armv7m, *nvic;
19
security
26
qemu_irq gpio_in[7][8];
20
deprecated
27
qemu_irq gpio_out[7][8];
21
diff --git a/docs/virtio-pmem.rst b/docs/system/virtio-pmem.rst
28
qemu_irq adc;
22
similarity index 100%
29
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
23
rename from docs/virtio-pmem.rst
30
qdev_prop_set_uint32(ssys_dev, "dc4", board->dc4);
24
rename to docs/system/virtio-pmem.rst
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);
25
--
59
--
26
2.20.1
60
2.34.1
27
61
28
62
diff view generated by jsdifflib
1
From: AlexChen <alex.chen@huawei.com>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
We should use printf format specifier "%u" instead of "%i" for
3
When instanciating the machine model, the machine_init()
4
argument of type "unsigned int".
4
implementations usually create the CPUs, so have access
5
to its first CPU. Use that rather then the &first_cpu
6
global.
5
7
6
Reported-by: Euler Robot <euler.robot@huawei.com>
8
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
7
Signed-off-by: Alex Chen <alex.chen@huawei.com>
9
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
8
Message-id: 5F9FD78B.8000300@huawei.com
10
Reviewed-by: Samuel Tardieu <sam@rfc1149.net>
9
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
11
Message-id: 20250112225614.33723-4-philmd@linaro.org
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
13
---
12
hw/arm/pxa2xx.c | 2 +-
14
hw/arm/b-l475e-iot01a.c | 2 +-
13
hw/arm/spitz.c | 2 +-
15
hw/arm/microbit.c | 2 +-
14
hw/arm/tosa.c | 2 +-
16
hw/arm/mps2-tz.c | 2 +-
15
3 files changed, 3 insertions(+), 3 deletions(-)
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(-)
16
26
17
diff --git a/hw/arm/pxa2xx.c b/hw/arm/pxa2xx.c
27
diff --git a/hw/arm/b-l475e-iot01a.c b/hw/arm/b-l475e-iot01a.c
18
index XXXXXXX..XXXXXXX 100644
28
index XXXXXXX..XXXXXXX 100644
19
--- a/hw/arm/pxa2xx.c
29
--- a/hw/arm/b-l475e-iot01a.c
20
+++ b/hw/arm/pxa2xx.c
30
+++ b/hw/arm/b-l475e-iot01a.c
21
@@ -XXX,XX +XXX,XX @@ static void pxa2xx_ssp_write(void *opaque, hwaddr addr,
31
@@ -XXX,XX +XXX,XX @@ static void bl475e_init(MachineState *machine)
22
if (value & SSCR0_MOD)
32
sysbus_realize(SYS_BUS_DEVICE(&s->soc), &error_fatal);
23
printf("%s: Attempt to use network mode\n", __func__);
33
24
if (s->enable && SSCR0_DSS(value) < 4)
34
sc = STM32L4X5_SOC_GET_CLASS(&s->soc);
25
- printf("%s: Wrong data size: %i bits\n", __func__,
35
- armv7m_load_kernel(ARM_CPU(first_cpu), machine->kernel_filename, 0,
26
+ printf("%s: Wrong data size: %u bits\n", __func__,
36
+ armv7m_load_kernel(s->soc.armv7m.cpu, machine->kernel_filename, 0,
27
SSCR0_DSS(value));
37
sc->flash_size);
28
if (!(value & SSCR0_SSE)) {
38
29
s->sssr = 0;
39
if (object_class_by_name(TYPE_DM163)) {
30
diff --git a/hw/arm/spitz.c b/hw/arm/spitz.c
40
diff --git a/hw/arm/microbit.c b/hw/arm/microbit.c
31
index XXXXXXX..XXXXXXX 100644
41
index XXXXXXX..XXXXXXX 100644
32
--- a/hw/arm/spitz.c
42
--- a/hw/arm/microbit.c
33
+++ b/hw/arm/spitz.c
43
+++ b/hw/arm/microbit.c
34
@@ -XXX,XX +XXX,XX @@ struct SpitzLCDTG {
44
@@ -XXX,XX +XXX,XX @@ static void microbit_init(MachineState *machine)
35
static void spitz_bl_update(SpitzLCDTG *s)
45
memory_region_add_subregion_overlap(&s->nrf51.container, NRF51_TWI_BASE,
36
{
46
mr, -1);
37
if (s->bl_power && s->bl_intensity)
47
38
- zaurus_printf("LCD Backlight now at %i/63\n", s->bl_intensity);
48
- armv7m_load_kernel(ARM_CPU(first_cpu), machine->kernel_filename,
39
+ zaurus_printf("LCD Backlight now at %u/63\n", s->bl_intensity);
49
+ armv7m_load_kernel(s->nrf51.armv7m.cpu, machine->kernel_filename,
40
else
50
0, s->nrf51.flash_size);
41
zaurus_printf("LCD Backlight now off\n");
42
}
51
}
43
diff --git a/hw/arm/tosa.c b/hw/arm/tosa.c
52
53
diff --git a/hw/arm/mps2-tz.c b/hw/arm/mps2-tz.c
44
index XXXXXXX..XXXXXXX 100644
54
index XXXXXXX..XXXXXXX 100644
45
--- a/hw/arm/tosa.c
55
--- a/hw/arm/mps2-tz.c
46
+++ b/hw/arm/tosa.c
56
+++ b/hw/arm/mps2-tz.c
47
@@ -XXX,XX +XXX,XX @@ static void tosa_gpio_setup(PXA2xxState *cpu,
57
@@ -XXX,XX +XXX,XX @@ static void mps2tz_common_init(MachineState *machine)
48
58
mms->remap_irq);
49
static uint32_t tosa_ssp_tansfer(SSISlave *dev, uint32_t value)
59
}
50
{
60
51
- fprintf(stderr, "TG: %d %02x\n", value >> 5, value & 0x1f);
61
- armv7m_load_kernel(ARM_CPU(first_cpu), machine->kernel_filename,
52
+ fprintf(stderr, "TG: %u %02x\n", value >> 5, value & 0x1f);
62
+ armv7m_load_kernel(mms->iotkit.armv7m[0].cpu, machine->kernel_filename,
53
return 0;
63
0, boot_ram_size(mms));
54
}
64
}
55
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);
169
}
56
--
170
--
57
2.20.1
171
2.34.1
58
172
59
173
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: Bernhard Beschow <shentey@gmail.com>
2
2
3
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
3
The value of the UCFR register is respected when echoing characters to the
4
Message-id: 20201120154545.2504625-7-f4bug@amsat.org
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>
5
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
11
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
---
13
---
8
MAINTAINERS | 1 +
14
include/hw/char/imx_serial.h | 2 +-
9
1 file changed, 1 insertion(+)
15
hw/char/imx_serial.c | 1 +
16
2 files changed, 2 insertions(+), 1 deletion(-)
10
17
11
diff --git a/MAINTAINERS b/MAINTAINERS
18
diff --git a/include/hw/char/imx_serial.h b/include/hw/char/imx_serial.h
12
index XXXXXXX..XXXXXXX 100644
19
index XXXXXXX..XXXXXXX 100644
13
--- a/MAINTAINERS
20
--- a/include/hw/char/imx_serial.h
14
+++ b/MAINTAINERS
21
+++ b/include/hw/char/imx_serial.h
15
@@ -XXX,XX +XXX,XX @@ L: qemu-arm@nongnu.org
22
@@ -XXX,XX +XXX,XX @@ struct IMXSerialState {
16
S: Maintained
23
uint32_t ucr1;
17
F: hw/*/omap*
24
uint32_t ucr2;
18
F: include/hw/arm/omap.h
25
uint32_t uts1;
19
+F: docs/system/arm/sx1.rst
26
+ uint32_t ufcr;
20
27
21
IPack
28
/*
22
M: Alberto Garcia <berto@igalia.com>
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);
23
--
49
--
24
2.20.1
50
2.34.1
25
26
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: Bernhard Beschow <shentey@gmail.com>
2
2
3
List the 'tosa' machine with the XScale-based PDAs models.
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.
4
6
5
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
7
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
6
Message-id: 20201120173953.2539469-5-f4bug@amsat.org
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
---
10
---
10
docs/system/arm/xscale.rst | 20 +++++++++++++-------
11
hw/char/imx_serial.c | 6 +++---
11
1 file changed, 13 insertions(+), 7 deletions(-)
12
1 file changed, 3 insertions(+), 3 deletions(-)
12
13
13
diff --git a/docs/system/arm/xscale.rst b/docs/system/arm/xscale.rst
14
diff --git a/hw/char/imx_serial.c b/hw/char/imx_serial.c
14
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
15
--- a/docs/system/arm/xscale.rst
16
--- a/hw/char/imx_serial.c
16
+++ b/docs/system/arm/xscale.rst
17
+++ b/hw/char/imx_serial.c
17
@@ -XXX,XX +XXX,XX @@
18
@@ -XXX,XX +XXX,XX @@ static void imx_put_data(void *opaque, uint32_t value)
18
-Sharp XScale-based PDA models (``akita``, ``borzoi``, ``spitz``, ``terrier``)
19
if (fifo32_num_used(&s->rx_fifo) >= rxtl) {
19
-=============================================================================
20
s->usr1 |= USR1_RRDY;
20
+Sharp XScale-based PDA models (``akita``, ``borzoi``, ``spitz``, ``terrier``, ``tosa``)
21
}
21
+=======================================================================================
22
-
22
23
- imx_serial_rx_fifo_ageing_timer_restart(s);
23
-The XScale-based clamshell PDA models (\"Spitz\", \"Akita\", \"Borzoi\"
24
-
24
-and \"Terrier\") emulation includes the following peripherals:
25
s->usr2 |= USR2_RDR;
25
+The Sharp Zaurus are PDAs based on XScale, able to run Linux ('SL series').
26
s->uts1 &= ~UTS1_RXEMPTY;
26
27
if (value & URXD_BRK) {
27
-- Intel PXA270 System-on-chip (ARMv5TE core)
28
s->usr2 |= USR2_BRCD;
28
+The SL-6000 (\"Tosa\"), released in 2005, uses a PXA255 System-on-chip.
29
}
29
30
-- NAND Flash memory
31
+The SL-C3000 (\"Spitz\"), SL-C1000 (\"Akita\"), SL-C3100 (\"Borzoi\") and
32
+SL-C3200 (\"Terrier\") use a PXA270.
33
+
30
+
34
+The clamshell PDA models emulation includes the following peripherals:
31
+ imx_serial_rx_fifo_ageing_timer_restart(s);
35
+
32
+
36
+- Intel PXA255/PXA270 System-on-chip (ARMv5TE core)
33
imx_update(s);
37
+
34
}
38
+- NAND Flash memory - not in \"Tosa\"
39
40
- IBM/Hitachi DSCM microdrive in a PXA PCMCIA slot - not in \"Akita\"
41
42
-- On-chip OHCI USB controller
43
+- On-chip OHCI USB controller - not in \"Tosa\"
44
45
- On-chip LCD controller
46
35
47
--
36
--
48
2.20.1
37
2.34.1
49
50
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: Bernhard Beschow <shentey@gmail.com>
2
2
3
Fixes: 0553ef42571 ("docs: add Orange Pi PC document")
3
Fixes INTD and MSI interrupts poking the same IRQ line without keeping track of
4
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
4
each other's IRQ level. Furthermore, SoCs such as the i.MX 8M Plus don't share
5
Reviewed-by: Niek Linnenbank <nieklinnenbank@gmail.com>
5
the MSI IRQ with the INTx lines, so expose it as a dedicated pin.
6
Message-id: 20201120154545.2504625-5-f4bug@amsat.org
6
7
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
---
10
---
10
MAINTAINERS | 2 +-
11
include/hw/arm/fsl-imx6.h | 4 +++-
11
1 file changed, 1 insertion(+), 1 deletion(-)
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(-)
12
19
13
diff --git a/MAINTAINERS b/MAINTAINERS
20
diff --git a/include/hw/arm/fsl-imx6.h b/include/hw/arm/fsl-imx6.h
14
index XXXXXXX..XXXXXXX 100644
21
index XXXXXXX..XXXXXXX 100644
15
--- a/MAINTAINERS
22
--- a/include/hw/arm/fsl-imx6.h
16
+++ b/MAINTAINERS
23
+++ b/include/hw/arm/fsl-imx6.h
17
@@ -XXX,XX +XXX,XX @@ S: Maintained
24
@@ -XXX,XX +XXX,XX @@
18
F: hw/*/allwinner-h3*
25
#include "hw/usb/chipidea.h"
19
F: include/hw/*/allwinner-h3*
26
#include "hw/usb/imx-usb-phy.h"
20
F: hw/arm/orangepi.c
27
#include "hw/pci-host/designware.h"
21
-F: docs/system/orangepi.rst
28
+#include "hw/or-irq.h"
22
+F: docs/system/arm/orangepi.rst
29
#include "exec/memory.h"
23
30
#include "cpu.h"
24
ARM PrimeCell and CMSDK devices
31
#include "qom/object.h"
25
M: Peter Maydell <peter.maydell@linaro.org>
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),
205
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
206
index XXXXXXX..XXXXXXX 100644
207
--- a/hw/arm/Kconfig
208
+++ b/hw/arm/Kconfig
209
@@ -XXX,XX +XXX,XX @@ config FSL_IMX6
210
select PL310 # cache controller
211
select PCI_EXPRESS_DESIGNWARE
212
select SDHCI
213
+ select OR_IRQ
214
215
config ASPEED_SOC
216
bool
217
@@ -XXX,XX +XXX,XX @@ config FSL_IMX7
218
select WDT_IMX2
219
select PCI_EXPRESS_DESIGNWARE
220
select SDHCI
221
+ select OR_IRQ
222
select UNIMP
223
224
config ARM_SMMUV3
26
--
225
--
27
2.20.1
226
2.34.1
28
29
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
Document the 3 front LEDs modeled on the OpenPOWER Witherspoon BMC
3
Board schematic is useful to corroborate GPIOs/IRQs wiring.
4
(see commit 7cfbde5ea1c "hw/arm/aspeed: Add the 3 front LEDs drived
5
by the PCA9552 #1").
6
4
7
Reviewed-by: Cédric Le Goater <clg@kaod.org>
5
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
8
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Message-id: 20201120173953.2539469-4-f4bug@amsat.org
7
Message-id: 20250110160204.74997-2-philmd@linaro.org
8
[PMM: Use https:// URLs]
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
10
---
12
docs/system/arm/aspeed.rst | 1 +
11
hw/arm/stellaris.c | 8 ++++++++
13
1 file changed, 1 insertion(+)
12
1 file changed, 8 insertions(+)
14
13
15
diff --git a/docs/system/arm/aspeed.rst b/docs/system/arm/aspeed.rst
14
diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c
16
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
17
--- a/docs/system/arm/aspeed.rst
16
--- a/hw/arm/stellaris.c
18
+++ b/docs/system/arm/aspeed.rst
17
+++ b/hw/arm/stellaris.c
19
@@ -XXX,XX +XXX,XX @@ Supported devices
18
@@ -XXX,XX +XXX,XX @@ static void lm3s6965evb_init(MachineState *machine)
20
* GPIO Controller (Master only)
19
stellaris_init(machine, &stellaris_boards[1]);
21
* UART
20
}
22
* Ethernet controllers
21
23
+ * Front LEDs (PCA9552 on I2C bus)
22
+/*
24
23
+ * Stellaris LM3S811 Evaluation Board Schematics:
25
24
+ * https://www.ti.com/lit/ug/symlink/spmu030.pdf
26
Missing devices
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);
27
--
40
--
28
2.20.1
41
2.34.1
29
42
30
43
diff view generated by jsdifflib
1
Fix a couple of nits in pr-manager.rst:
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
* the title marker for the top level heading is overlength
3
* stray capital 'R' in the middle of a sentence
4
2
3
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
4
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
5
Message-id: 20250110160204.74997-3-philmd@linaro.org
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
7
---
7
---
8
docs/system/pr-manager.rst | 6 +++---
8
hw/arm/stellaris.c | 6 +++---
9
1 file changed, 3 insertions(+), 3 deletions(-)
9
1 file changed, 3 insertions(+), 3 deletions(-)
10
10
11
diff --git a/docs/system/pr-manager.rst b/docs/system/pr-manager.rst
11
diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c
12
index XXXXXXX..XXXXXXX 100644
12
index XXXXXXX..XXXXXXX 100644
13
--- a/docs/system/pr-manager.rst
13
--- a/hw/arm/stellaris.c
14
+++ b/docs/system/pr-manager.rst
14
+++ b/hw/arm/stellaris.c
15
@@ -XXX,XX +XXX,XX @@
15
@@ -XXX,XX +XXX,XX @@ static void ssys_update(ssys_state *s)
16
-======================================
16
qemu_set_irq(s->irq, (s->int_status & s->int_mask) != 0);
17
+===============================
17
}
18
Persistent reservation managers
18
19
-======================================
19
-static uint32_t pllcfg_sandstorm[16] = {
20
+===============================
20
+static const uint32_t pllcfg_sandstorm[16] = {
21
21
0x31c0, /* 1 Mhz */
22
-SCSI persistent Reservations allow restricting access to block devices
22
0x1ae0, /* 1.8432 Mhz */
23
+SCSI persistent reservations allow restricting access to block devices
23
0x18c0, /* 2 Mhz */
24
to specific initiators in a shared storage setup. When implementing
24
@@ -XXX,XX +XXX,XX @@ static uint32_t pllcfg_sandstorm[16] = {
25
clustering of virtual machines, it is a common requirement for virtual
25
0x585b /* 8.192 Mhz */
26
machines to send persistent reservation SCSI commands. However,
26
};
27
28
-static uint32_t pllcfg_fury[16] = {
29
+static const uint32_t pllcfg_fury[16] = {
30
0x3200, /* 1 Mhz */
31
0x1b20, /* 1.8432 Mhz */
32
0x1900, /* 2 Mhz */
33
@@ -XXX,XX +XXX,XX @@ static void stellaris_adc_init(Object *obj)
34
}
35
36
/* Board init. */
37
-static stellaris_board_info stellaris_boards[] = {
38
+static const stellaris_board_info stellaris_boards[] = {
39
{ "LM3S811EVB",
40
0,
41
0x0032000e,
27
--
42
--
28
2.20.1
43
2.34.1
29
44
30
45
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
Document the following Raspberry Pi models:
3
There is nothing mapped at 0x40002000.
4
4
5
- raspi0 Raspberry Pi Zero (revision 1.2)
5
I2C#0 is already mapped at 0x40021000.
6
- raspi1ap Raspberry Pi A+ (revision 1.1)
7
- raspi2b Raspberry Pi 2B (revision 1.1)
8
- raspi3ap Raspberry Pi 3A+ (revision 1.0)
9
- raspi3b Raspberry Pi 3B (revision 1.2)
10
6
7
Remove the invalid mapping added in commits aecfbbc97a2 & 394c8bbfb7a.
8
9
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
11
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
10
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
11
Message-id: 20250110160204.74997-4-philmd@linaro.org
13
Message-id: 20201120173953.2539469-3-f4bug@amsat.org
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
---
13
---
16
docs/system/arm/raspi.rst | 43 ++++++++++++++++++++++++++++++++++++++
14
hw/arm/stellaris.c | 2 --
17
docs/system/target-arm.rst | 1 +
15
1 file changed, 2 deletions(-)
18
MAINTAINERS | 1 +
19
3 files changed, 45 insertions(+)
20
create mode 100644 docs/system/arm/raspi.rst
21
16
22
diff --git a/docs/system/arm/raspi.rst b/docs/system/arm/raspi.rst
17
diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c
23
new file mode 100644
24
index XXXXXXX..XXXXXXX
25
--- /dev/null
26
+++ b/docs/system/arm/raspi.rst
27
@@ -XXX,XX +XXX,XX @@
28
+Raspberry Pi boards (``raspi0``, ``raspi1ap``, ``raspi2b``, ``raspi3ap``, ``raspi3b``)
29
+======================================================================================
30
+
31
+
32
+QEMU provides models of the following Raspberry Pi boards:
33
+
34
+``raspi0`` and ``raspi1ap``
35
+ ARM1176JZF-S core, 512 MiB of RAM
36
+``raspi2b``
37
+ Cortex-A7 (4 cores), 1 GiB of RAM
38
+``raspi3ap``
39
+ Cortex-A53 (4 cores), 512 MiB of RAM
40
+``raspi3b``
41
+ Cortex-A53 (4 cores), 1 GiB of RAM
42
+
43
+
44
+Implemented devices
45
+-------------------
46
+
47
+ * ARM1176JZF-S, Cortex-A7 or Cortex-A53 CPU
48
+ * Interrupt controller
49
+ * DMA controller
50
+ * Clock and reset controller (CPRMAN)
51
+ * System Timer
52
+ * GPIO controller
53
+ * Serial ports (BCM2835 AUX - 16550 based - and PL011)
54
+ * Random Number Generator (RNG)
55
+ * Frame Buffer
56
+ * USB host (USBH)
57
+ * GPIO controller
58
+ * SD/MMC host controller
59
+ * SoC thermal sensor
60
+ * USB2 host controller (DWC2 and MPHI)
61
+ * MailBox controller (MBOX)
62
+ * VideoCore firmware (property)
63
+
64
+
65
+Missing devices
66
+---------------
67
+
68
+ * Peripheral SPI controller (SPI)
69
+ * Analog to Digital Converter (ADC)
70
+ * Pulse Width Modulation (PWM)
71
diff --git a/docs/system/target-arm.rst b/docs/system/target-arm.rst
72
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
73
--- a/docs/system/target-arm.rst
19
--- a/hw/arm/stellaris.c
74
+++ b/docs/system/target-arm.rst
20
+++ b/hw/arm/stellaris.c
75
@@ -XXX,XX +XXX,XX @@ undocumented; you can get a complete list by running
21
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
76
arm/nuvoton
22
* http://www.ti.com/lit/ds/symlink/lm3s6965.pdf
77
arm/orangepi
23
*
78
arm/palm
24
* 40000000 wdtimer
79
+ arm/raspi
25
- * 40002000 i2c (unimplemented)
80
arm/xscale
26
* 40004000 GPIO
81
arm/collie
27
* 40005000 GPIO
82
arm/sx1
28
* 40006000 GPIO
83
diff --git a/MAINTAINERS b/MAINTAINERS
29
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
84
index XXXXXXX..XXXXXXX 100644
30
/* Add dummy regions for the devices we don't implement yet,
85
--- a/MAINTAINERS
31
* so guest accesses don't cause unlogged crashes.
86
+++ b/MAINTAINERS
32
*/
87
@@ -XXX,XX +XXX,XX @@ F: hw/arm/raspi_platform.h
33
- create_unimplemented_device("i2c-0", 0x40002000, 0x1000);
88
F: hw/*/bcm283*
34
create_unimplemented_device("i2c-2", 0x40021000, 0x1000);
89
F: include/hw/arm/raspi*
35
create_unimplemented_device("PWM", 0x40028000, 0x1000);
90
F: include/hw/*/bcm283*
36
create_unimplemented_device("QEI-0", 0x4002c000, 0x1000);
91
+F: docs/system/arm/raspi.rst
92
93
Real View
94
M: Peter Maydell <peter.maydell@linaro.org>
95
--
37
--
96
2.20.1
38
2.34.1
97
39
98
40
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
Since commit aa35ec2213b ("hw/arm/raspi: Use more specific
3
Add definitions for the number of controllers.
4
machine names") the raspi2/raspi3 machines have been renamed
5
as raspi2b/raspi3b.
6
4
7
Note, rather than the raspi3b, the raspi3ap introduced in
5
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
8
commit 5be94252d34 ("hw/arm/raspi: Add the Raspberry Pi 3
9
model A+") is a closer match to what QEMU models, but only
10
provides 512 MB of RAM.
11
12
As more Raspberry Pi 2/3 models are emulated, in order
13
to avoid confusion, deprecate the raspi2/raspi3 machine
14
aliases.
15
16
ACKed-by: Peter Krempa <pkrempa@redhat.com>
17
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
18
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
7
Message-id: 20250110160204.74997-5-philmd@linaro.org
19
Message-id: 20201120173953.2539469-2-f4bug@amsat.org
20
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
21
---
9
---
22
docs/system/deprecated.rst | 7 +++++++
10
hw/arm/stellaris.c | 25 +++++++++++++++----------
23
1 file changed, 7 insertions(+)
11
1 file changed, 15 insertions(+), 10 deletions(-)
24
12
25
diff --git a/docs/system/deprecated.rst b/docs/system/deprecated.rst
13
diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c
26
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
27
--- a/docs/system/deprecated.rst
15
--- a/hw/arm/stellaris.c
28
+++ b/docs/system/deprecated.rst
16
+++ b/hw/arm/stellaris.c
29
@@ -XXX,XX +XXX,XX @@ This machine has been renamed ``fuloong2e``.
17
@@ -XXX,XX +XXX,XX @@
30
These machine types are very old and likely can not be used for live migration
18
#define NUM_IRQ_LINES 64
31
from old QEMU versions anymore. A newer machine type should be used instead.
19
#define NUM_PRIO_BITS 3
32
20
33
+Raspberry Pi ``raspi2`` and ``raspi3`` machines (since 5.2)
21
+#define NUM_GPIO 7
34
+'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
22
+#define NUM_UART 4
23
+#define NUM_GPTM 4
24
+#define NUM_I2C 2
35
+
25
+
36
+The Raspberry Pi machines come in various models (A, A+, B, B+). To be able
26
typedef const struct {
37
+to distinguish which model QEMU is implementing, the ``raspi2`` and ``raspi3``
27
const char *name;
38
+machines have been renamed ``raspi2b`` and ``raspi3b``.
28
uint32_t did0;
39
+
29
@@ -XXX,XX +XXX,XX @@ static const stellaris_board_info stellaris_boards[] = {
40
Device options
30
41
--------------
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;
42
85
43
--
86
--
44
2.20.1
87
2.34.1
45
88
46
89
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
3
Add definitions (DCx_periph) for the DeviceCapability bits,
4
Message-id: 20201120154545.2504625-6-f4bug@amsat.org
4
replace direct bitmask checks with the DEV_CAP() macro,
5
which use the extract/deposit API.
6
7
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
5
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
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
---
11
---
8
MAINTAINERS | 1 +
12
hw/arm/stellaris.c | 37 +++++++++++++++++++++++++++++--------
9
1 file changed, 1 insertion(+)
13
1 file changed, 29 insertions(+), 8 deletions(-)
10
14
11
diff --git a/MAINTAINERS b/MAINTAINERS
15
diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c
12
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
13
--- a/MAINTAINERS
17
--- a/hw/arm/stellaris.c
14
+++ b/MAINTAINERS
18
+++ b/hw/arm/stellaris.c
15
@@ -XXX,XX +XXX,XX @@ R: Leif Lindholm <leif@nuviainc.com>
19
@@ -XXX,XX +XXX,XX @@
16
L: qemu-arm@nongnu.org
20
*/
17
S: Maintained
21
18
F: hw/arm/sbsa-ref.c
22
#include "qemu/osdep.h"
19
+F: docs/system/arm/sbsa.rst
23
+#include "qemu/bitops.h"
20
24
#include "qapi/error.h"
21
Sharp SL-5500 (Collie) PDA
25
#include "hw/core/split-irq.h"
22
M: Peter Maydell <peter.maydell@linaro.org>
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;
65
}
66
for (i = 0; i < NUM_GPTM; i++) {
67
- if (board->dc2 & (0x10000 << i)) {
68
+ if (DEV_CAP(2, GPTM(i))) {
69
SysBusDevice *sbd;
70
71
dev = qdev_new(TYPE_STELLARIS_GPTM);
72
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
73
}
74
}
75
76
- if (board->dc1 & (1 << 3)) { /* watchdog present */
77
+ if (DEV_CAP(1, WDT)) {
78
dev = qdev_new(TYPE_LUMINARY_WATCHDOG);
79
object_property_add_child(soc_container, "wdg", OBJECT(dev));
80
qdev_connect_clock_in(dev, "WDOGCLK",
81
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
82
83
84
for (i = 0; i < NUM_GPIO; i++) {
85
- if (board->dc4 & (1 << i)) {
86
+ if (DEV_CAP(4, GPIO(i))) {
87
gpio_dev[i] = sysbus_create_simple("pl061_luminary", gpio_addr[i],
88
qdev_get_gpio_in(nvic,
89
gpio_irq[i]));
90
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
91
}
92
}
93
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)
100
}
101
102
for (i = 0; i < NUM_UART; i++) {
103
- if (board->dc2 & (1 << i)) {
104
+ if (DEV_CAP(2, UART(i))) {
105
SysBusDevice *sbd;
106
107
dev = qdev_new("pl011_luminary");
108
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
109
sysbus_connect_irq(sbd, 0, qdev_get_gpio_in(nvic, uart_irq[i]));
110
}
111
}
112
- if (board->dc2 & (1 << 4)) {
113
+ if (DEV_CAP(2, SSI)) {
114
dev = sysbus_create_simple("pl022", 0x40008000,
115
qdev_get_gpio_in(nvic, 7));
116
if (board->peripherals & BP_OLED_SSI) {
117
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
118
qemu_irq_raise(gpio_out[GPIO_D][0]);
119
}
120
}
121
- if (board->dc4 & (1 << 28)) {
122
+ if (DEV_CAP(4, EMAC)) {
123
DeviceState *enet;
124
125
enet = qdev_new("stellaris_enet");
23
--
126
--
24
2.20.1
127
2.34.1
25
128
26
129
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
2
2
3
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
3
There are 2 I2C controllers, map them both, removing
4
Message-id: 20201120154545.2504625-4-f4bug@amsat.org
4
the unimplemented one. Keep the OLED controller on the
5
first I2C bus.
6
7
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
5
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Message-id: 20250110160204.74997-7-philmd@linaro.org
10
[PMM: tweak to appease maybe-use-uninitialized warning]
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
---
12
---
8
MAINTAINERS | 1 +
13
hw/arm/stellaris.c | 21 +++++++++++++--------
9
1 file changed, 1 insertion(+)
14
1 file changed, 13 insertions(+), 8 deletions(-)
10
15
11
diff --git a/MAINTAINERS b/MAINTAINERS
16
diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c
12
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
13
--- a/MAINTAINERS
18
--- a/hw/arm/stellaris.c
14
+++ b/MAINTAINERS
19
+++ b/hw/arm/stellaris.c
15
@@ -XXX,XX +XXX,XX @@ F: include/hw/*/npcm7xx*
20
@@ -XXX,XX +XXX,XX @@ static void stellaris_init(MachineState *ms, stellaris_board_info *board)
16
F: tests/qtest/npcm7xx*
21
{ 0x40004000, 0x40005000, 0x40006000, 0x40007000,
17
F: pc-bios/npcm7xx_bootrom.bin
22
0x40024000, 0x40025000, 0x40026000};
18
F: roms/vbootrom
23
static const int gpio_irq[NUM_GPIO] = {0, 1, 2, 3, 4, 30, 31};
19
+F: docs/system/arm/nuvoton.rst
24
+ static const uint32_t i2c_addr[NUM_I2C] = {0x40020000, 0x40021000};
20
25
+ static const int i2c_irq[NUM_I2C] = {8, 37};
21
nSeries
26
22
M: Andrzej Zaborowski <balrogg@gmail.com>
27
/* Memory map of SoC devices, from
28
* Stellaris LM3S6965 Microcontroller Data Sheet (rev I)
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);
23
--
71
--
24
2.20.1
72
2.34.1
25
73
26
74
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: Thomas Huth <thuth@redhat.com>
2
2
3
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
3
We don't have any functional tests for this machine yet, thus let's
4
Reviewed-by: Cédric Le Goater <clg@kaod.org>
4
add a test with a MicroPython binary that is available online
5
Message-id: 20201120154545.2504625-3-f4bug@amsat.org
5
(thanks to Joel Stanley for providing it, see:
6
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
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
---
12
---
9
MAINTAINERS | 1 +
13
MAINTAINERS | 1 +
10
1 file changed, 1 insertion(+)
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
11
18
12
diff --git a/MAINTAINERS b/MAINTAINERS
19
diff --git a/MAINTAINERS b/MAINTAINERS
13
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
14
--- a/MAINTAINERS
21
--- a/MAINTAINERS
15
+++ b/MAINTAINERS
22
+++ b/MAINTAINERS
16
@@ -XXX,XX +XXX,XX @@ F: include/hw/*/*aspeed*
23
@@ -XXX,XX +XXX,XX @@ F: hw/*/microbit*.c
17
F: include/hw/misc/pca9552*.h
24
F: include/hw/*/nrf51*.h
18
F: hw/net/ftgmac100.c
25
F: include/hw/*/microbit*.h
19
F: include/hw/net/ftgmac100.h
26
F: tests/qtest/microbit-test.c
20
+F: docs/system/arm/aspeed.rst
27
+F: tests/functional/test_arm_microbit.py
21
28
F: docs/system/arm/nrf.rst
22
NRF51
29
23
M: Joel Stanley <joel@jms.id.au>
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
48
@@ -XXX,XX +XXX,XX @@
49
+#!/usr/bin/env python3
50
+#
51
+# SPDX-License-Identifier: GPL-2.0-or-later
52
+#
53
+# Copyright 2025, The QEMU Project Developers.
54
+#
55
+# A functional test that runs MicroPython on the arm microbit machine.
56
+
57
+from qemu_test import QemuSystemTest, Asset, exec_command_and_wait_for_pattern
58
+from qemu_test import wait_for_console_pattern
59
+
60
+
61
+class MicrobitMachine(QemuSystemTest):
62
+
63
+ ASSET_MICRO = Asset('https://ozlabs.org/~joel/microbit-micropython.hex',
64
+ '021641f93dfb11767d4978dbb3ca7f475d1b13c69e7f4aec3382f212636bffd6')
65
+
66
+ def test_arm_microbit(self):
67
+ self.set_machine('microbit')
68
+
69
+ micropython = self.ASSET_MICRO.fetch()
70
+ self.vm.set_console()
71
+ self.vm.add_args('-device', f'loader,file={micropython}')
72
+ self.vm.launch()
73
+ wait_for_console_pattern(self, 'Type "help()" for more information.')
74
+ exec_command_and_wait_for_pattern(self, 'import machine as mch', '>>>')
75
+ exec_command_and_wait_for_pattern(self, 'mch.reset()', 'MicroPython')
76
+ wait_for_console_pattern(self, '>>>')
77
+
78
+if __name__ == '__main__':
79
+ QemuSystemTest.main()
24
--
80
--
25
2.20.1
81
2.34.1
26
82
27
83
diff view generated by jsdifflib
1
From: Rémi Denis-Courmont <remi.denis.courmont@huawei.com>
1
The pseudocode ResetSVEState() does:
2
FPSR = ZeroExtend(0x0800009f<31:0>, 64);
3
but QEMU's arm_reset_sve_state() called vfp_set_fpcr() by accident.
2
4
3
Using a target unsigned long would limit the Input Address to a LPAE
5
Before the advent of FEAT_AFP, this was only setting a collection of
4
page-walk to 32 bits on AArch32 and 64 bits on AArch64. This is okay
6
RES0 bits, which vfp_set_fpsr() would then ignore, so the only effect
5
for stage 1 or on AArch64, but it is insufficient for stage 2 on
7
was that we didn't actually set the FPSR the way we are supposed to
6
AArch32. In that later case, the Input Address can have up to 40 bits.
8
do. Once FEAT_AFP is implemented, setting the bottom bits of FPSR
9
will change the floating point behaviour.
7
10
8
Signed-off-by: Rémi Denis-Courmont <remi.denis.courmont@huawei.com>
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>
9
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
20
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
10
Message-id: 20201118150414.18360-1-remi@remlab.net
21
Message-id: 20250124162836.2332150-4-peter.maydell@linaro.org
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
---
22
---
13
target/arm/helper.c | 4 ++--
23
target/arm/helper.c | 2 +-
14
1 file changed, 2 insertions(+), 2 deletions(-)
24
1 file changed, 1 insertion(+), 1 deletion(-)
15
25
16
diff --git a/target/arm/helper.c b/target/arm/helper.c
26
diff --git a/target/arm/helper.c b/target/arm/helper.c
17
index XXXXXXX..XXXXXXX 100644
27
index XXXXXXX..XXXXXXX 100644
18
--- a/target/arm/helper.c
28
--- a/target/arm/helper.c
19
+++ b/target/arm/helper.c
29
+++ b/target/arm/helper.c
20
@@ -XXX,XX +XXX,XX @@
30
@@ -XXX,XX +XXX,XX @@ static void arm_reset_sve_state(CPUARMState *env)
21
31
memset(env->vfp.zregs, 0, sizeof(env->vfp.zregs));
22
#ifndef CONFIG_USER_ONLY
32
/* Recall that FFR is stored as pregs[16]. */
23
33
memset(env->vfp.pregs, 0, sizeof(env->vfp.pregs));
24
-static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address,
34
- vfp_set_fpcr(env, 0x0800009f);
25
+static bool get_phys_addr_lpae(CPUARMState *env, uint64_t address,
35
+ vfp_set_fpsr(env, 0x0800009f);
26
MMUAccessType access_type, ARMMMUIdx mmu_idx,
36
}
27
bool s1_is_el0,
37
28
hwaddr *phys_ptr, MemTxAttrs *txattrs, int *prot,
38
void aarch64_set_svcr(CPUARMState *env, uint64_t new, uint64_t mask)
29
@@ -XXX,XX +XXX,XX @@ static ARMVAParameters aa32_va_parameters(CPUARMState *env, uint32_t va,
30
* @fi: set to fault info if the translation fails
31
* @cacheattrs: (if non-NULL) set to the cacheability/shareability attributes
32
*/
33
-static bool get_phys_addr_lpae(CPUARMState *env, target_ulong address,
34
+static bool get_phys_addr_lpae(CPUARMState *env, uint64_t address,
35
MMUAccessType access_type, ARMMMUIdx mmu_idx,
36
bool s1_is_el0,
37
hwaddr *phys_ptr, MemTxAttrs *txattrs, int *prot,
38
--
39
--
39
2.20.1
40
2.34.1
40
41
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
1
Split the documentation of the qemu-pr-helper binary into the tools
1
We directly use fp_status_f16 in a handful of helpers that are
2
manual, and give it a manpage like our other standalone executables.
2
AArch64-specific; switch to fp_status_f16_a64 for these.
3
3
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Message-id: 20250124162836.2332150-16-peter.maydell@linaro.org
6
---
7
---
7
docs/meson.build | 1 +
8
target/arm/tcg/sme_helper.c | 4 ++--
8
docs/system/pr-manager.rst | 38 ++-------------
9
target/arm/tcg/vec_helper.c | 8 ++++----
9
docs/tools/conf.py | 2 +
10
2 files changed, 6 insertions(+), 6 deletions(-)
10
docs/tools/index.rst | 1 +
11
docs/tools/qemu-pr-helper.rst | 90 +++++++++++++++++++++++++++++++++++
12
5 files changed, 99 insertions(+), 33 deletions(-)
13
create mode 100644 docs/tools/qemu-pr-helper.rst
14
11
15
diff --git a/docs/meson.build b/docs/meson.build
12
diff --git a/target/arm/tcg/sme_helper.c b/target/arm/tcg/sme_helper.c
16
index XXXXXXX..XXXXXXX 100644
13
index XXXXXXX..XXXXXXX 100644
17
--- a/docs/meson.build
14
--- a/target/arm/tcg/sme_helper.c
18
+++ b/docs/meson.build
15
+++ b/target/arm/tcg/sme_helper.c
19
@@ -XXX,XX +XXX,XX @@ if build_docs
16
@@ -XXX,XX +XXX,XX @@ void HELPER(sme_fmopa_h)(void *vza, void *vzn, void *vzm, void *vpn,
20
'tools': {
17
float_status fpst_odd, fpst_std, fpst_f16;
21
'qemu-img.1': (have_tools ? 'man1' : ''),
18
22
'qemu-nbd.8': (have_tools ? 'man8' : ''),
19
/*
23
+ 'qemu-pr-helper.8': (have_tools ? 'man8' : ''),
20
- * Make copies of fp_status and fp_status_f16, because this operation
24
'qemu-trace-stap.1': (config_host.has_key('CONFIG_TRACE_SYSTEMTAP') ? 'man1' : ''),
21
+ * Make copies of the fp status fields we use, because this operation
25
'virtfs-proxy-helper.1': (have_virtfs_proxy_helper ? 'man1' : ''),
22
* does not update the cumulative fp exception status. It also
26
'virtiofsd.1': (have_virtiofsd ? 'man1' : ''),
23
* produces default NaNs. We also need a second copy of fp_status with
27
diff --git a/docs/system/pr-manager.rst b/docs/system/pr-manager.rst
24
* round-to-odd -- see above.
25
*/
26
- fpst_f16 = env->vfp.fp_status_f16;
27
+ fpst_f16 = env->vfp.fp_status_f16_a64;
28
fpst_std = env->vfp.fp_status_a64;
29
set_default_nan_mode(true, &fpst_std);
30
set_default_nan_mode(true, &fpst_f16);
31
diff --git a/target/arm/tcg/vec_helper.c b/target/arm/tcg/vec_helper.c
28
index XXXXXXX..XXXXXXX 100644
32
index XXXXXXX..XXXXXXX 100644
29
--- a/docs/system/pr-manager.rst
33
--- a/target/arm/tcg/vec_helper.c
30
+++ b/docs/system/pr-manager.rst
34
+++ b/target/arm/tcg/vec_helper.c
31
@@ -XXX,XX +XXX,XX @@ Alternatively, using ``-blockdev``::
35
@@ -XXX,XX +XXX,XX @@ void HELPER(gvec_fmlal_a64)(void *vd, void *vn, void *vm,
32
-blockdev node-name=hd,driver=raw,file.driver=host_device,file.filename=/dev/sdb,file.pr-manager=helper0
36
CPUARMState *env, uint32_t desc)
33
-device scsi-block,drive=hd
37
{
34
38
do_fmlal(vd, vn, vm, &env->vfp.fp_status_a64, desc,
35
-----------------------------------
39
- get_flush_inputs_to_zero(&env->vfp.fp_status_f16));
36
-Invoking :program:`qemu-pr-helper`
40
+ get_flush_inputs_to_zero(&env->vfp.fp_status_f16_a64));
37
-----------------------------------
41
}
38
-
42
39
-QEMU provides an implementation of the persistent reservation helper,
43
void HELPER(sve2_fmlal_zzzw_s)(void *vd, void *vn, void *vm, void *va,
40
-called :program:`qemu-pr-helper`. The helper should be started as a
44
@@ -XXX,XX +XXX,XX @@ void HELPER(sve2_fmlal_zzzw_s)(void *vd, void *vn, void *vm, void *va,
41
-system service and supports the following option:
45
uint16_t negn = extract32(desc, SIMD_DATA_SHIFT, 1) << 15;
42
-
46
intptr_t sel = extract32(desc, SIMD_DATA_SHIFT + 1, 1) * sizeof(float16);
43
--d, --daemon run in the background
47
float_status *status = &env->vfp.fp_status_a64;
44
--q, --quiet decrease verbosity
48
- bool fz16 = get_flush_inputs_to_zero(&env->vfp.fp_status_f16);
45
--v, --verbose increase verbosity
49
+ bool fz16 = get_flush_inputs_to_zero(&env->vfp.fp_status_f16_a64);
46
--f, --pidfile=path PID file when running as a daemon
50
47
--k, --socket=path path to the socket
51
for (i = 0; i < oprsz; i += sizeof(float32)) {
48
--T, --trace=trace-opts tracing options
52
float16 nn_16 = *(float16 *)(vn + H1_2(i + sel)) ^ negn;
49
-
53
@@ -XXX,XX +XXX,XX @@ void HELPER(gvec_fmlal_idx_a64)(void *vd, void *vn, void *vm,
50
-By default, the socket and PID file are placed in the runtime state
54
CPUARMState *env, uint32_t desc)
51
-directory, for example :file:`/var/run/qemu-pr-helper.sock` and
55
{
52
-:file:`/var/run/qemu-pr-helper.pid`. The PID file is not created
56
do_fmlal_idx(vd, vn, vm, &env->vfp.fp_status_a64, desc,
53
-unless :option:`-d` is passed too.
57
- get_flush_inputs_to_zero(&env->vfp.fp_status_f16));
54
-
58
+ get_flush_inputs_to_zero(&env->vfp.fp_status_f16_a64));
55
-:program:`qemu-pr-helper` can also use the systemd socket activation
59
}
56
-protocol. In this case, the systemd socket unit should specify a
60
57
-Unix stream socket, like this::
61
void HELPER(sve2_fmlal_zzxw_s)(void *vd, void *vn, void *vm, void *va,
58
-
62
@@ -XXX,XX +XXX,XX @@ void HELPER(sve2_fmlal_zzxw_s)(void *vd, void *vn, void *vm, void *va,
59
- [Socket]
63
intptr_t sel = extract32(desc, SIMD_DATA_SHIFT + 1, 1) * sizeof(float16);
60
- ListenStream=/var/run/qemu-pr-helper.sock
64
intptr_t idx = extract32(desc, SIMD_DATA_SHIFT + 2, 3) * sizeof(float16);
61
-
65
float_status *status = &env->vfp.fp_status_a64;
62
-After connecting to the socket, :program:`qemu-pr-helper`` can optionally drop
66
- bool fz16 = get_flush_inputs_to_zero(&env->vfp.fp_status_f16);
63
-root privileges, except for those capabilities that are needed for
67
+ bool fz16 = get_flush_inputs_to_zero(&env->vfp.fp_status_f16_a64);
64
-its operation. To do this, add the following options:
68
65
-
69
for (i = 0; i < oprsz; i += 16) {
66
--u, --user=user user to drop privileges to
70
float16 mm_16 = *(float16 *)(vm + i + idx);
67
--g, --group=group group to drop privileges to
68
+You will also need to ensure that the helper program
69
+:command:`qemu-pr-helper` is running, and that it has been
70
+set up to use the same socket filename as your QEMU commandline
71
+specifies. See the qemu-pr-helper documentation or manpage for
72
+further details.
73
74
---------------------------------------------
75
Multipath devices and persistent reservations
76
diff --git a/docs/tools/conf.py b/docs/tools/conf.py
77
index XXXXXXX..XXXXXXX 100644
78
--- a/docs/tools/conf.py
79
+++ b/docs/tools/conf.py
80
@@ -XXX,XX +XXX,XX @@ man_pages = [
81
['Fabrice Bellard'], 1),
82
('qemu-nbd', 'qemu-nbd', u'QEMU Disk Network Block Device Server',
83
['Anthony Liguori <anthony@codemonkey.ws>'], 8),
84
+ ('qemu-pr-helper', 'qemu-pr-helper', 'QEMU persistent reservation helper',
85
+ [], 8),
86
('qemu-trace-stap', 'qemu-trace-stap', u'QEMU SystemTap trace tool',
87
[], 1),
88
('virtfs-proxy-helper', 'virtfs-proxy-helper',
89
diff --git a/docs/tools/index.rst b/docs/tools/index.rst
90
index XXXXXXX..XXXXXXX 100644
91
--- a/docs/tools/index.rst
92
+++ b/docs/tools/index.rst
93
@@ -XXX,XX +XXX,XX @@ Contents:
94
95
qemu-img
96
qemu-nbd
97
+ qemu-pr-helper
98
qemu-trace-stap
99
virtfs-proxy-helper
100
virtiofsd
101
diff --git a/docs/tools/qemu-pr-helper.rst b/docs/tools/qemu-pr-helper.rst
102
new file mode 100644
103
index XXXXXXX..XXXXXXX
104
--- /dev/null
105
+++ b/docs/tools/qemu-pr-helper.rst
106
@@ -XXX,XX +XXX,XX @@
107
+QEMU persistent reservation helper
108
+==================================
109
+
110
+Synopsis
111
+--------
112
+
113
+**qemu-pr-helper** [*OPTION*]
114
+
115
+Description
116
+-----------
117
+
118
+Implements the persistent reservation helper for QEMU.
119
+
120
+SCSI persistent reservations allow restricting access to block devices
121
+to specific initiators in a shared storage setup. When implementing
122
+clustering of virtual machines, it is a common requirement for virtual
123
+machines to send persistent reservation SCSI commands. However,
124
+the operating system restricts sending these commands to unprivileged
125
+programs because incorrect usage can disrupt regular operation of the
126
+storage fabric. QEMU's SCSI passthrough devices ``scsi-block``
127
+and ``scsi-generic`` support passing guest persistent reservation
128
+requests to a privileged external helper program. :program:`qemu-pr-helper`
129
+is that external helper; it creates a socket which QEMU can
130
+connect to to communicate with it.
131
+
132
+If you want to run VMs in a setup like this, this helper should be
133
+started as a system service, and you should read the QEMU manual
134
+section on "persistent reservation managers" to find out how to
135
+configure QEMU to connect to the socket created by
136
+:program:`qemu-pr-helper`.
137
+
138
+After connecting to the socket, :program:`qemu-pr-helper` can
139
+optionally drop root privileges, except for those capabilities that
140
+are needed for its operation.
141
+
142
+:program:`qemu-pr-helper` can also use the systemd socket activation
143
+protocol. In this case, the systemd socket unit should specify a
144
+Unix stream socket, like this::
145
+
146
+ [Socket]
147
+ ListenStream=/var/run/qemu-pr-helper.sock
148
+
149
+Options
150
+-------
151
+
152
+.. program:: qemu-pr-helper
153
+
154
+.. option:: -d, --daemon
155
+
156
+ run in the background (and create a PID file)
157
+
158
+.. option:: -q, --quiet
159
+
160
+ decrease verbosity
161
+
162
+.. option:: -v, --verbose
163
+
164
+ increase verbosity
165
+
166
+.. option:: -f, --pidfile=PATH
167
+
168
+ PID file when running as a daemon. By default the PID file
169
+ is created in the system runtime state directory, for example
170
+ :file:`/var/run/qemu-pr-helper.pid`.
171
+
172
+.. option:: -k, --socket=PATH
173
+
174
+ path to the socket. By default the socket is created in
175
+ the system runtime state directory, for example
176
+ :file:`/var/run/qemu-pr-helper.sock`.
177
+
178
+.. option:: -T, --trace [[enable=]PATTERN][,events=FILE][,file=FILE]
179
+
180
+ .. include:: ../qemu-option-trace.rst.inc
181
+
182
+.. option:: -u, --user=USER
183
+
184
+ user to drop privileges to
185
+
186
+.. option:: -g, --group=GROUP
187
+
188
+ group to drop privileges to
189
+
190
+.. option:: -h, --help
191
+
192
+ Display a help message and exit.
193
+
194
+.. option:: -V, --version
195
+
196
+ Display version information and exit.
197
--
71
--
198
2.20.1
72
2.34.1
199
200
diff view generated by jsdifflib
1
Currently target-i386.rst includes the documentation of the 'pc'
1
In the A32 decoder, use FPST_A32_F16 rather than FPST_FPCR_F16.
2
machine model inline. Split it out into its own file, in a
2
By doing an automated conversion of the whole file we avoid possibly
3
similar way to target-i386.rst; this gives us a place to put
3
using more than one fpst value in a set_rmode/op/restore_rmode
4
documentation of other i386 machine models, such as 'microvm'.
4
sequence.
5
6
Patch created with
7
perl -p -i -e 's/FPST_FPCR_F16(?!_)/FPST_A32_F16/g' target/arm/tcg/translate-vfp.c
5
8
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
10
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
11
Message-id: 20250124162836.2332150-17-peter.maydell@linaro.org
8
---
12
---
9
docs/system/i386/pc.rst | 7 +++++++
13
target/arm/tcg/translate-vfp.c | 24 ++++++++++++------------
10
docs/system/target-i386.rst | 18 +++++++++++++-----
14
1 file changed, 12 insertions(+), 12 deletions(-)
11
2 files changed, 20 insertions(+), 5 deletions(-)
12
create mode 100644 docs/system/i386/pc.rst
13
15
14
diff --git a/docs/system/i386/pc.rst b/docs/system/i386/pc.rst
16
diff --git a/target/arm/tcg/translate-vfp.c b/target/arm/tcg/translate-vfp.c
15
new file mode 100644
16
index XXXXXXX..XXXXXXX
17
--- /dev/null
18
+++ b/docs/system/i386/pc.rst
19
@@ -XXX,XX +XXX,XX @@
20
+i440fx PC (``pc-i440fx``, ``pc``)
21
+=================================
22
+
23
+Peripherals
24
+~~~~~~~~~~~
25
+
26
+.. include:: ../target-i386-desc.rst.inc
27
diff --git a/docs/system/target-i386.rst b/docs/system/target-i386.rst
28
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
29
--- a/docs/system/target-i386.rst
18
--- a/target/arm/tcg/translate-vfp.c
30
+++ b/docs/system/target-i386.rst
19
+++ b/target/arm/tcg/translate-vfp.c
31
@@ -XXX,XX +XXX,XX @@
20
@@ -XXX,XX +XXX,XX @@ static bool trans_VRINT(DisasContext *s, arg_VRINT *a)
32
.. _QEMU-PC-System-emulator:
21
}
33
22
34
-x86 (PC) System emulator
23
if (sz == 1) {
35
-------------------------
24
- fpst = fpstatus_ptr(FPST_FPCR_F16);
36
+x86 System emulator
25
+ fpst = fpstatus_ptr(FPST_A32_F16);
37
+-------------------
26
} else {
38
27
fpst = fpstatus_ptr(FPST_A32);
39
.. _pcsys_005fdevices:
28
}
40
29
@@ -XXX,XX +XXX,XX @@ static bool trans_VCVT(DisasContext *s, arg_VCVT *a)
41
-Peripherals
30
}
42
-~~~~~~~~~~~
31
43
+Board-specific documentation
32
if (sz == 1) {
44
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
33
- fpst = fpstatus_ptr(FPST_FPCR_F16);
45
34
+ fpst = fpstatus_ptr(FPST_A32_F16);
46
-.. include:: target-i386-desc.rst.inc
35
} else {
47
+..
36
fpst = fpstatus_ptr(FPST_A32);
48
+ This table of contents should be kept sorted alphabetically
37
}
49
+ by the title text of each file, which isn't the same ordering
38
@@ -XXX,XX +XXX,XX @@ static bool do_vfp_3op_hp(DisasContext *s, VFPGen3OpSPFn *fn,
50
+ as an alphabetical sort by filename.
39
/*
51
+
40
* Do a half-precision operation. Functionally this is
52
+.. toctree::
41
* the same as do_vfp_3op_sp(), except:
53
+ :maxdepth: 1
42
- * - it uses the FPST_FPCR_F16
54
+
43
+ * - it uses the FPST_A32_F16
55
+ i386/pc
44
* - it doesn't need the VFP vector handling (fp16 is a
56
45
* v8 feature, and in v8 VFP vectors don't exist)
57
.. include:: cpu-models-x86.rst.inc
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);
58
127
59
--
128
--
60
2.20.1
129
2.34.1
61
62
diff view generated by jsdifflib
1
Move the pr-manager documentation into the system manual.
1
In the A32 decoder, use FPST_A64_F16 rather than FPST_FPCR_F16.
2
Some of it (the documentation of the pr-manager-helper tool)
2
By doing an automated conversion of the whole file we avoid possibly
3
should be in tools, but we will split it up after moving it.
3
using more than one fpst value in a set_rmode/op/restore_rmode
4
sequence.
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
4
8
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
10
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
11
Message-id: 20250124162836.2332150-18-peter.maydell@linaro.org
7
---
12
---
8
docs/system/index.rst | 1 +
13
target/arm/tcg/translate-a64.c | 32 ++++++++---------
9
docs/{ => system}/pr-manager.rst | 0
14
target/arm/tcg/translate-sve.c | 66 +++++++++++++++++-----------------
10
2 files changed, 1 insertion(+)
15
2 files changed, 49 insertions(+), 49 deletions(-)
11
rename docs/{ => system}/pr-manager.rst (100%)
12
16
13
diff --git a/docs/system/index.rst b/docs/system/index.rst
17
diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c
14
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
15
--- a/docs/system/index.rst
19
--- a/target/arm/tcg/translate-a64.c
16
+++ b/docs/system/index.rst
20
+++ b/target/arm/tcg/translate-a64.c
17
@@ -XXX,XX +XXX,XX @@ Contents:
21
@@ -XXX,XX +XXX,XX @@ static void gen_gvec_op3_fpst(DisasContext *s, bool is_q, int rd, int rn,
18
managed-startup
22
int rm, bool is_fp16, int data,
19
cpu-hotplug
23
gen_helper_gvec_3_ptr *fn)
20
virtio-pmem
24
{
21
+ pr-manager
25
- TCGv_ptr fpst = fpstatus_ptr(is_fp16 ? FPST_FPCR_F16 : FPST_A64);
22
targets
26
+ TCGv_ptr fpst = fpstatus_ptr(is_fp16 ? FPST_A64_F16 : FPST_A64);
23
security
27
tcg_gen_gvec_3_ptr(vec_full_reg_offset(s, rd),
24
deprecated
28
vec_full_reg_offset(s, rn),
25
diff --git a/docs/pr-manager.rst b/docs/system/pr-manager.rst
29
vec_full_reg_offset(s, rm), fpst,
26
similarity index 100%
30
@@ -XXX,XX +XXX,XX @@ static void gen_gvec_op4_fpst(DisasContext *s, bool is_q, int rd, int rn,
27
rename from docs/pr-manager.rst
31
int rm, int ra, bool is_fp16, int data,
28
rename to docs/system/pr-manager.rst
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
{
29
--
399
--
30
2.20.1
400
2.34.1
31
32
diff view generated by jsdifflib
1
Now that target-i386.rst has a place to list documentation of
1
Now we have moved all the uses of vfp.fp_status_f16 and FPST_FPCR_F16
2
machines other than the 'pc' machine, we have a place we can
2
to the new A32 or A64 fields, we can remove these.
3
move the microvm documentation to.
4
3
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Message-id: 20250124162836.2332150-19-peter.maydell@linaro.org
7
---
7
---
8
docs/{ => system/i386}/microvm.rst | 5 ++---
8
target/arm/cpu.h | 2 --
9
docs/system/target-i386.rst | 1 +
9
target/arm/tcg/translate.h | 6 ------
10
2 files changed, 3 insertions(+), 3 deletions(-)
10
target/arm/cpu.c | 1 -
11
rename docs/{ => system/i386}/microvm.rst (98%)
11
target/arm/vfp_helper.c | 7 -------
12
4 files changed, 16 deletions(-)
12
13
13
diff --git a/docs/microvm.rst b/docs/system/i386/microvm.rst
14
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
14
similarity index 98%
15
rename from docs/microvm.rst
16
rename to docs/system/i386/microvm.rst
17
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
18
--- a/docs/microvm.rst
16
--- a/target/arm/cpu.h
19
+++ b/docs/system/i386/microvm.rst
17
+++ b/target/arm/cpu.h
20
@@ -XXX,XX +XXX,XX @@
18
@@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState {
21
-====================
19
*
22
-microvm Machine Type
20
* fp_status_a32: is the "normal" fp status for AArch32 insns
23
-====================
21
* fp_status_a64: is the "normal" fp status for AArch64 insns
24
+'microvm' virtual platform (``microvm``)
22
- * fp_status_fp16: used for half-precision calculations
25
+========================================
23
* fp_status_fp16_a32: used for AArch32 half-precision calculations
26
24
* fp_status_fp16_a64: used for AArch64 half-precision calculations
27
``microvm`` is a machine type inspired by ``Firecracker`` and
25
* standard_fp_status : the ARM "Standard FPSCR Value"
28
constructed after its machine model.
26
@@ -XXX,XX +XXX,XX @@ typedef struct CPUArchState {
29
diff --git a/docs/system/target-i386.rst b/docs/system/target-i386.rst
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
30
index XXXXXXX..XXXXXXX 100644
35
index XXXXXXX..XXXXXXX 100644
31
--- a/docs/system/target-i386.rst
36
--- a/target/arm/tcg/translate.h
32
+++ b/docs/system/target-i386.rst
37
+++ b/target/arm/tcg/translate.h
33
@@ -XXX,XX +XXX,XX @@ Board-specific documentation
38
@@ -XXX,XX +XXX,XX @@ static inline CPUARMTBFlags arm_tbflags_from_tb(const TranslationBlock *tb)
34
.. toctree::
39
typedef enum ARMFPStatusFlavour {
35
:maxdepth: 1
40
FPST_A32,
36
41
FPST_A64,
37
+ i386/microvm
42
- FPST_FPCR_F16,
38
i386/pc
43
FPST_A32_F16,
39
44
FPST_A64_F16,
40
.. include:: cpu-models-x86.rst.inc
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
}
41
--
124
--
42
2.20.1
125
2.34.1
43
44
diff view generated by jsdifflib
1
The virtio-pmem documentation has some minor style issues we hadn't
1
Our float_flag_input_denormal exception flag is set when the fpu code
2
noticed since we weren't rendering it in our docs:
2
flushes an input denormal to zero. This is what many guest
3
3
architectures (eg classic Arm behaviour) require, but it is not the
4
* Sphinx doesn't complain about overlong title-underlining the
4
only donarmal-related reason we might want to set an exception flag.
5
way it complains about too-short underlining, but it looks odd;
5
The x86 behaviour (which we do not currently model correctly) wants
6
make the underlines of section headers the right length
6
to see an exception flag when a denormal input is *not* flushed to
7
7
zero and is actually used in an arithmetic operation. Arm's FEAT_AFP
8
* Indent of paragraphs makes them render as blockquotes;
8
also wants these semantics.
9
remove the indent so they just render as normal text
9
10
10
Rename float_flag_input_denormal to float_flag_input_denormal_flushed
11
* Leading 'o' isn't rst markup, so it just renders as a literal
11
to make it clearer when it is set and to allow us to add a new
12
"o"; reformat as a subsection heading instead
12
float_flag_input_denormal_used next to it for the x86/FEAT_AFP
13
13
semantics.
14
* "QEMU" in the document title and section headings are a bit
14
15
odd and unnecessary since this is the QEMU manual; delete
15
Commit created with
16
or rephrase them
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
17
18
* There's no need to specify what QEMU version the device first
18
and manual editing of softfloat-types.h and softfloat.c to clean
19
appeared in.
19
up the indentation afterwards and to fix a comment which wasn't
20
using the full name of the flag.
20
21
21
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
22
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
22
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
23
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
23
Reviewed-by: Pankaj Gupta <pankaj.gupta@cloud.ionos.com>
24
Message-id: 20250124162836.2332150-20-peter.maydell@linaro.org
24
---
25
---
25
docs/system/virtio-pmem.rst | 60 ++++++++++++++++++-------------------
26
include/fpu/softfloat-types.h | 5 +++--
26
1 file changed, 30 insertions(+), 30 deletions(-)
27
fpu/softfloat.c | 4 ++--
27
28
target/arm/tcg/sve_helper.c | 6 +++---
28
diff --git a/docs/system/virtio-pmem.rst b/docs/system/virtio-pmem.rst
29
target/arm/vfp_helper.c | 10 +++++-----
29
index XXXXXXX..XXXXXXX 100644
30
target/i386/tcg/fpu_helper.c | 6 +++---
30
--- a/docs/system/virtio-pmem.rst
31
target/mips/tcg/msa_helper.c | 2 +-
31
+++ b/docs/system/virtio-pmem.rst
32
target/rx/op_helper.c | 2 +-
32
@@ -XXX,XX +XXX,XX @@
33
fpu/softfloat-parts.c.inc | 2 +-
33
34
8 files changed, 19 insertions(+), 18 deletions(-)
34
-========================
35
35
-QEMU virtio pmem
36
diff --git a/include/fpu/softfloat-types.h b/include/fpu/softfloat-types.h
36
-========================
37
index XXXXXXX..XXXXXXX 100644
37
+===========
38
--- a/include/fpu/softfloat-types.h
38
+virtio pmem
39
+++ b/include/fpu/softfloat-types.h
39
+===========
40
@@ -XXX,XX +XXX,XX @@ enum {
40
41
float_flag_overflow = 0x0004,
41
- This document explains the setup and usage of the virtio pmem device
42
float_flag_underflow = 0x0008,
42
- which is available since QEMU v4.1.0.
43
float_flag_inexact = 0x0010,
43
-
44
- float_flag_input_denormal = 0x0020,
44
- The virtio pmem device is a paravirtualized persistent memory device
45
+ /* We flushed an input denormal to 0 (because of flush_inputs_to_zero) */
45
- on regular (i.e non-NVDIMM) storage.
46
+ float_flag_input_denormal_flushed = 0x0020,
46
+This document explains the setup and usage of the virtio pmem device.
47
float_flag_output_denormal = 0x0040,
47
+The virtio pmem device is a paravirtualized persistent memory device
48
float_flag_invalid_isi = 0x0080, /* inf - inf */
48
+on regular (i.e non-NVDIMM) storage.
49
float_flag_invalid_imz = 0x0100, /* inf * 0 */
49
50
@@ -XXX,XX +XXX,XX @@ typedef struct float_status {
50
Usecase
51
bool tininess_before_rounding;
51
---------
52
/* should denormalised results go to zero and set the inexact flag? */
52
+-------
53
bool flush_to_zero;
53
54
- /* should denormalised inputs go to zero and set the input_denormal flag? */
54
- Virtio pmem allows to bypass the guest page cache and directly use
55
+ /* should denormalised inputs go to zero and set input_denormal_flushed? */
55
- host page cache. This reduces guest memory footprint as the host can
56
bool flush_inputs_to_zero;
56
- make efficient memory reclaim decisions under memory pressure.
57
bool default_nan_mode;
57
+Virtio pmem allows to bypass the guest page cache and directly use
58
/*
58
+host page cache. This reduces guest memory footprint as the host can
59
diff --git a/fpu/softfloat.c b/fpu/softfloat.c
59
+make efficient memory reclaim decisions under memory pressure.
60
index XXXXXXX..XXXXXXX 100644
60
61
--- a/fpu/softfloat.c
61
-o How does virtio-pmem compare to the nvdimm emulation supported by QEMU?
62
+++ b/fpu/softfloat.c
62
+How does virtio-pmem compare to the nvdimm emulation?
63
@@ -XXX,XX +XXX,XX @@ this code that are retained.
63
+-----------------------------------------------------
64
if (unlikely(soft_t ## _is_denormal(*a))) { \
64
65
*a = soft_t ## _set_sign(soft_t ## _zero, \
65
- NVDIMM emulation on regular (i.e. non-NVDIMM) host storage does not
66
soft_t ## _is_neg(*a)); \
66
- persist the guest writes as there are no defined semantics in the device
67
- float_raise(float_flag_input_denormal, s); \
67
- specification. The virtio pmem device provides guest write persistence
68
+ float_raise(float_flag_input_denormal_flushed, s); \
68
- on non-NVDIMM host storage.
69
} \
69
+NVDIMM emulation on regular (i.e. non-NVDIMM) host storage does not
70
}
70
+persist the guest writes as there are no defined semantics in the device
71
71
+specification. The virtio pmem device provides guest write persistence
72
@@ -XXX,XX +XXX,XX @@ float128 float128_silence_nan(float128 a, float_status *status)
72
+on non-NVDIMM host storage.
73
static bool parts_squash_denormal(FloatParts64 p, float_status *status)
73
74
{
74
virtio pmem usage
75
if (p.exp == 0 && p.frac != 0) {
75
-----------------
76
- float_raise(float_flag_input_denormal, status);
76
77
+ float_raise(float_flag_input_denormal_flushed, status);
77
- A virtio pmem device backed by a memory-backend-file can be created on
78
return true;
78
- the QEMU command line as in the following example::
79
}
79
+A virtio pmem device backed by a memory-backend-file can be created on
80
80
+the QEMU command line as in the following example::
81
diff --git a/target/arm/tcg/sve_helper.c b/target/arm/tcg/sve_helper.c
81
82
index XXXXXXX..XXXXXXX 100644
82
-object memory-backend-file,id=mem1,share,mem-path=./virtio_pmem.img,size=4G
83
--- a/target/arm/tcg/sve_helper.c
83
-device virtio-pmem-pci,memdev=mem1,id=nv1
84
+++ b/target/arm/tcg/sve_helper.c
84
85
@@ -XXX,XX +XXX,XX @@ static int16_t do_float16_logb_as_int(float16 a, float_status *s)
85
- where:
86
return -15 - clz32(frac);
86
+where:
87
}
87
88
/* flush to zero */
88
- "object memory-backend-file,id=mem1,share,mem-path=<image>, size=<image size>"
89
- float_raise(float_flag_input_denormal, s);
89
creates a backend file with the specified size.
90
+ float_raise(float_flag_input_denormal_flushed, s);
90
@@ -XXX,XX +XXX,XX @@ virtio pmem usage
91
}
91
- "device virtio-pmem-pci,id=nvdimm1,memdev=mem1" creates a virtio pmem
92
} else if (unlikely(exp == 0x1f)) {
92
pci device whose storage is provided by above memory backend device.
93
if (frac == 0) {
93
94
@@ -XXX,XX +XXX,XX @@ static int32_t do_float32_logb_as_int(float32 a, float_status *s)
94
- Multiple virtio pmem devices can be created if multiple pairs of "-object"
95
return -127 - clz32(frac);
95
- and "-device" are provided.
96
}
96
+Multiple virtio pmem devices can be created if multiple pairs of "-object"
97
/* flush to zero */
97
+and "-device" are provided.
98
- float_raise(float_flag_input_denormal, s);
98
99
+ float_raise(float_flag_input_denormal_flushed, s);
99
Hotplug
100
}
100
-------
101
} else if (unlikely(exp == 0xff)) {
101
@@ -XXX,XX +XXX,XX @@ the guest::
102
if (frac == 0) {
102
Guest Data Persistence
103
@@ -XXX,XX +XXX,XX @@ static int64_t do_float64_logb_as_int(float64 a, float_status *s)
103
----------------------
104
return -1023 - clz64(frac);
104
105
}
105
- Guest data persistence on non-NVDIMM requires guest userspace applications
106
/* flush to zero */
106
- to perform fsync/msync. This is different from a real nvdimm backend where
107
- float_raise(float_flag_input_denormal, s);
107
- no additional fsync/msync is required. This is to persist guest writes in
108
+ float_raise(float_flag_input_denormal_flushed, s);
108
- host backing file which otherwise remains in host page cache and there is
109
}
109
- risk of losing the data in case of power failure.
110
} else if (unlikely(exp == 0x7ff)) {
110
+Guest data persistence on non-NVDIMM requires guest userspace applications
111
if (frac == 0) {
111
+to perform fsync/msync. This is different from a real nvdimm backend where
112
diff --git a/target/arm/vfp_helper.c b/target/arm/vfp_helper.c
112
+no additional fsync/msync is required. This is to persist guest writes in
113
index XXXXXXX..XXXXXXX 100644
113
+host backing file which otherwise remains in host page cache and there is
114
--- a/target/arm/vfp_helper.c
114
+risk of losing the data in case of power failure.
115
+++ b/target/arm/vfp_helper.c
115
116
@@ -XXX,XX +XXX,XX @@ static inline uint32_t vfp_exceptbits_from_host(int host_bits)
116
- With virtio pmem device, MAP_SYNC mmap flag is not supported. This provides
117
if (host_bits & float_flag_inexact) {
117
- a hint to application to perform fsync for write persistence.
118
target_bits |= FPSR_IXC;
118
+With virtio pmem device, MAP_SYNC mmap flag is not supported. This provides
119
}
119
+a hint to application to perform fsync for write persistence.
120
- if (host_bits & float_flag_input_denormal) {
120
121
+ if (host_bits & float_flag_input_denormal_flushed) {
121
Limitations
122
target_bits |= FPSR_IDC;
122
-------------
123
}
123
+-----------
124
return target_bits;
124
+
125
@@ -XXX,XX +XXX,XX @@ static uint32_t vfp_get_fpsr_from_host(CPUARMState *env)
125
- Real nvdimm device backend is not supported.
126
i |= get_float_exception_flags(&env->vfp.standard_fp_status);
126
- virtio pmem hotunplug is not supported.
127
/* FZ16 does not generate an input denormal exception. */
127
- ACPI NVDIMM features like regions/namespaces are not supported.
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 {
128
--
219
--
129
2.20.1
220
2.34.1
130
131
diff view generated by jsdifflib
1
The cpu-hotplug.rst documentation is currently orphan and not
1
Our float_flag_output_denormal exception flag is set when
2
included in any manual; move it into the system manual.
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"
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
3
11
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
13
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
14
Message-id: 20250124162836.2332150-21-peter.maydell@linaro.org
6
---
15
---
7
docs/{ => system}/cpu-hotplug.rst | 0
16
include/fpu/softfloat-types.h | 3 ++-
8
docs/system/index.rst | 1 +
17
fpu/softfloat.c | 2 +-
9
2 files changed, 1 insertion(+)
18
target/arm/vfp_helper.c | 2 +-
10
rename docs/{ => system}/cpu-hotplug.rst (100%)
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(-)
11
26
12
diff --git a/docs/cpu-hotplug.rst b/docs/system/cpu-hotplug.rst
27
diff --git a/include/fpu/softfloat-types.h b/include/fpu/softfloat-types.h
13
similarity index 100%
14
rename from docs/cpu-hotplug.rst
15
rename to docs/system/cpu-hotplug.rst
16
diff --git a/docs/system/index.rst b/docs/system/index.rst
17
index XXXXXXX..XXXXXXX 100644
28
index XXXXXXX..XXXXXXX 100644
18
--- a/docs/system/index.rst
29
--- a/include/fpu/softfloat-types.h
19
+++ b/docs/system/index.rst
30
+++ b/include/fpu/softfloat-types.h
20
@@ -XXX,XX +XXX,XX @@ Contents:
31
@@ -XXX,XX +XXX,XX @@ enum {
21
tls
32
float_flag_inexact = 0x0010,
22
gdb
33
/* We flushed an input denormal to 0 (because of flush_inputs_to_zero) */
23
managed-startup
34
float_flag_input_denormal_flushed = 0x0020,
24
+ cpu-hotplug
35
- float_flag_output_denormal = 0x0040,
25
targets
36
+ /* We flushed an output denormal to 0 (because of flush_to_zero) */
26
security
37
+ float_flag_output_denormal_flushed = 0x0040,
27
deprecated
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);
28
--
163
--
29
2.20.1
164
2.34.1
30
31
diff view generated by jsdifflib
1
The virtio-net-failover documentation is currently orphan and
1
In softfloat-types.h a comment documents that if the float_status
2
not included in any manual; move it into the system manual,
2
field flush_to_zero is set then we flush denormalised results to 0
3
immediately following the general network emulation section.
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.
6
7
Correct the comment.
4
8
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
10
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
11
Message-id: 20250124162836.2332150-22-peter.maydell@linaro.org
7
---
12
---
8
docs/system/index.rst | 1 +
13
include/fpu/softfloat-types.h | 2 +-
9
docs/{ => system}/virtio-net-failover.rst | 0
14
1 file changed, 1 insertion(+), 1 deletion(-)
10
2 files changed, 1 insertion(+)
11
rename docs/{ => system}/virtio-net-failover.rst (100%)
12
15
13
diff --git a/docs/system/index.rst b/docs/system/index.rst
16
diff --git a/include/fpu/softfloat-types.h b/include/fpu/softfloat-types.h
14
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
15
--- a/docs/system/index.rst
18
--- a/include/fpu/softfloat-types.h
16
+++ b/docs/system/index.rst
19
+++ b/include/fpu/softfloat-types.h
17
@@ -XXX,XX +XXX,XX @@ Contents:
20
@@ -XXX,XX +XXX,XX @@ typedef struct float_status {
18
monitor
21
Float3NaNPropRule float_3nan_prop_rule;
19
images
22
FloatInfZeroNaNRule float_infzeronan_rule;
20
net
23
bool tininess_before_rounding;
21
+ virtio-net-failover
24
- /* should denormalised results go to zero and set the inexact flag? */
22
usb
25
+ /* should denormalised results go to zero and set output_denormal_flushed? */
23
ivshmem
26
bool flush_to_zero;
24
linuxboot
27
/* should denormalised inputs go to zero and set input_denormal_flushed? */
25
diff --git a/docs/virtio-net-failover.rst b/docs/system/virtio-net-failover.rst
28
bool flush_inputs_to_zero;
26
similarity index 100%
27
rename from docs/virtio-net-failover.rst
28
rename to docs/system/virtio-net-failover.rst
29
--
29
--
30
2.20.1
30
2.34.1
31
32
diff view generated by jsdifflib
1
The Linux kernel doesn't use the official bkpt insn for breakpoints;
1
The advsimd_addh etc helpers defined in helper-a64.c are identical to
2
instead it uses three instructions in the guaranteed-to-UNDEF space,
2
the vfp_addh etc helpers defined in helper-vfp.c: both take two
3
and generates SIGTRAP for these rather than the SIGILL that most
3
float16 inputs (in a uint32_t type) plus a float_status* and are
4
UNDEF insns generate:
4
simple wrappers around the softfloat float16_* functions.
5
5
6
https://elixir.bootlin.com/linux/v5.9.8/source/arch/arm/kernel/ptrace.c#L197
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.)
7
12
8
Make QEMU treat these insns specially too. The main benefit of this
13
Remove the now-unnecessary advsimd helpers and make the places that
9
is that if you're running a debugger on a guest program that runs
14
generated calls to them use the vfp helpers instead. Many of the
10
into a GCC __builtin_trap() or LLVM "trap because execution should
15
helper functions were already unused.
11
never reach here" then you'll get the expected signal rather than a
16
12
SIGILL.
17
(The remaining advsimd_ helpers are those which don't have vfp
18
versions.)
13
19
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
20
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
21
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
16
Message-id: 20201117155634.6924-1-peter.maydell@linaro.org
22
Message-id: 20250124162836.2332150-26-peter.maydell@linaro.org
17
---
23
---
18
linux-user/arm/cpu_loop.c | 28 ++++++++++++++++++++++++++++
24
target/arm/tcg/helper-a64.h | 8 --------
19
1 file changed, 28 insertions(+)
25
target/arm/tcg/helper-a64.c | 9 ---------
26
target/arm/tcg/translate-a64.c | 16 ++++++++--------
27
3 files changed, 8 insertions(+), 25 deletions(-)
20
28
21
diff --git a/linux-user/arm/cpu_loop.c b/linux-user/arm/cpu_loop.c
29
diff --git a/target/arm/tcg/helper-a64.h b/target/arm/tcg/helper-a64.h
22
index XXXXXXX..XXXXXXX 100644
30
index XXXXXXX..XXXXXXX 100644
23
--- a/linux-user/arm/cpu_loop.c
31
--- a/target/arm/tcg/helper-a64.h
24
+++ b/linux-user/arm/cpu_loop.c
32
+++ b/target/arm/tcg/helper-a64.h
25
@@ -XXX,XX +XXX,XX @@ do_kernel_trap(CPUARMState *env)
33
@@ -XXX,XX +XXX,XX @@ DEF_HELPER_FLAGS_2(frecpx_f16, TCG_CALL_NO_RWG, f16, f16, fpst)
26
return 0;
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); \
27
}
54
}
28
55
29
+static bool insn_is_linux_bkpt(uint32_t opcode, bool is_thumb)
56
-ADVSIMD_HALFOP(add)
30
+{
57
-ADVSIMD_HALFOP(sub)
31
+ /*
58
-ADVSIMD_HALFOP(mul)
32
+ * Return true if this insn is one of the three magic UDF insns
59
-ADVSIMD_HALFOP(div)
33
+ * which the kernel treats as breakpoint insns.
60
-ADVSIMD_HALFOP(min)
34
+ */
61
-ADVSIMD_HALFOP(max)
35
+ if (!is_thumb) {
62
-ADVSIMD_HALFOP(minnum)
36
+ return (opcode & 0x0fffffff) == 0x07f001f0;
63
-ADVSIMD_HALFOP(maxnum)
37
+ } else {
64
-
38
+ /*
65
#define ADVSIMD_TWOHALFOP(name) \
39
+ * Note that we get the two halves of the 32-bit T32 insn
66
uint32_t ADVSIMD_HELPER(name, 2h)(uint32_t two_a, uint32_t two_b, \
40
+ * in the opposite order to the value the kernel uses in
67
float_status *fpst) \
41
+ * its undef_hook struct.
68
diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c
42
+ */
69
index XXXXXXX..XXXXXXX 100644
43
+ return ((opcode & 0xffff) == 0xde01) || (opcode == 0xa000f7f0);
70
--- a/target/arm/tcg/translate-a64.c
44
+ }
71
+++ b/target/arm/tcg/translate-a64.c
45
+}
72
@@ -XXX,XX +XXX,XX @@ static const FPScalar f_scalar_fmul = {
46
+
73
TRANS(FMUL_s, do_fp3_scalar, a, &f_scalar_fmul)
47
void cpu_loop(CPUARMState *env)
74
48
{
75
static const FPScalar f_scalar_fmax = {
49
CPUState *cs = env_cpu(env);
76
- gen_helper_advsimd_maxh,
50
@@ -XXX,XX +XXX,XX @@ void cpu_loop(CPUARMState *env)
77
+ gen_helper_vfp_maxh,
51
/* FIXME - what to do if get_user() fails? */
78
gen_helper_vfp_maxs,
52
get_user_code_u32(opcode, env->regs[15], env);
79
gen_helper_vfp_maxd,
53
80
};
54
+ /*
81
TRANS(FMAX_s, do_fp3_scalar, a, &f_scalar_fmax)
55
+ * The Linux kernel treats some UDF patterns specially
82
56
+ * to use as breakpoints (instead of the architectural
83
static const FPScalar f_scalar_fmin = {
57
+ * bkpt insn). These should trigger a SIGTRAP rather
84
- gen_helper_advsimd_minh,
58
+ * than SIGILL.
85
+ gen_helper_vfp_minh,
59
+ */
86
gen_helper_vfp_mins,
60
+ if (insn_is_linux_bkpt(opcode, env->thumb)) {
87
gen_helper_vfp_mind,
61
+ goto excp_debug;
88
};
62
+ }
89
TRANS(FMIN_s, do_fp3_scalar, a, &f_scalar_fmin)
63
+
90
64
rc = EmulateAll(opcode, &ts->fpa, env);
91
static const FPScalar f_scalar_fmaxnm = {
65
if (rc == 0) { /* illegal instruction */
92
- gen_helper_advsimd_maxnumh,
66
info.si_signo = TARGET_SIGILL;
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)
67
--
120
--
68
2.20.1
121
2.34.1
69
70
diff view generated by jsdifflib
1
The semihosting SYS_HEAPINFO call is supposed to return an array
1
We should be using the F16-specific float_status for conversions from
2
of four guest addresses:
2
half-precision, because halfprec inputs never set Input Denormal.
3
* base of heap memory
4
* limit of heap memory
5
* base of stack memory
6
* limit of stack memory
7
3
8
Some semihosting programs (including those compiled to use the
4
Without FEAT_AHP, using the wrong fpst here had no effect, because
9
'newlib' embedded C library) use this call to work out where they
5
the only difference between the A64_F16 and A64 fpst is its handling
10
should initialize themselves to.
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.
11
10
12
QEMU's implementation when in system emulation mode is very
11
With FEAT_AHP, the FPCR.AH=1 behaviour sets IDC for
13
simplistic: we say that the heap starts halfway into RAM and
12
input_denormal_used, which we will only ignore in
14
continues to the end of RAM, and the stack starts at the top of RAM
13
vfp_get_fpsr_from_host() for the A64_F16 fpst; so it matters that we
15
and works down to the bottom. Unfortunately the code assumes that
14
use that one for f16 inputs (and the normal one for single/double to
16
the base address of RAM is at address 0, so on boards like 'virt'
15
f16 conversions).
17
where this is not true the addresses returned will all be wrong and
18
the guest application will usually crash.
19
20
Conveniently since all Arm boards call arm_load_kernel() we have the
21
base address of the main RAM block in the arm_boot_info struct which
22
is accessible via the CPU object. Use this to return sensible values
23
from SYS_HEAPINFO.
24
16
25
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
17
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
26
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
18
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
27
Message-id: 20201119092346.32356-1-peter.maydell@linaro.org
19
Message-id: 20250124162836.2332150-27-peter.maydell@linaro.org
28
---
20
---
29
target/arm/arm-semi.c | 12 ++++++++----
21
target/arm/tcg/translate-a64.c | 9 ++++++---
30
1 file changed, 8 insertions(+), 4 deletions(-)
22
target/arm/tcg/translate-sve.c | 4 ++--
23
2 files changed, 8 insertions(+), 5 deletions(-)
31
24
32
diff --git a/target/arm/arm-semi.c b/target/arm/arm-semi.c
25
diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c
33
index XXXXXXX..XXXXXXX 100644
26
index XXXXXXX..XXXXXXX 100644
34
--- a/target/arm/arm-semi.c
27
--- a/target/arm/tcg/translate-a64.c
35
+++ b/target/arm/arm-semi.c
28
+++ b/target/arm/tcg/translate-a64.c
36
@@ -XXX,XX +XXX,XX @@
29
@@ -XXX,XX +XXX,XX @@ static bool trans_FCVT_s_sh(DisasContext *s, arg_rr *a)
37
#else
30
if (fp_access_check(s)) {
38
#include "exec/gdbstub.h"
31
TCGv_i32 tcg_rn = read_fp_hreg(s, a->rn);
39
#include "qemu/cutils.h"
32
TCGv_i32 tcg_rd = tcg_temp_new_i32();
40
+#include "hw/arm/boot.h"
33
- TCGv_ptr tcg_fpst = fpstatus_ptr(FPST_A64);
41
#endif
34
+ TCGv_ptr tcg_fpst = fpstatus_ptr(FPST_A64_F16);
42
35
TCGv_i32 tcg_ahp = get_ahp_flag();
43
#define TARGET_SYS_OPEN 0x01
36
44
@@ -XXX,XX +XXX,XX @@ target_ulong do_arm_semihosting(CPUARMState *env)
37
gen_helper_vfp_fcvt_f16_to_f32(tcg_rd, tcg_rn, tcg_fpst, tcg_ahp);
45
int i;
38
@@ -XXX,XX +XXX,XX @@ static bool trans_FCVT_s_dh(DisasContext *s, arg_rr *a)
46
#ifdef CONFIG_USER_ONLY
39
if (fp_access_check(s)) {
47
TaskState *ts = cs->opaque;
40
TCGv_i32 tcg_rn = read_fp_hreg(s, a->rn);
48
+#else
41
TCGv_i64 tcg_rd = tcg_temp_new_i64();
49
+ const struct arm_boot_info *info = env->boot_info;
42
- TCGv_ptr tcg_fpst = fpstatus_ptr(FPST_A64);
50
+ target_ulong rambase = info->loader_start;
43
+ TCGv_ptr tcg_fpst = fpstatus_ptr(FPST_A64_F16);
51
#endif
44
TCGv_i32 tcg_ahp = get_ahp_flag();
52
45
53
GET_ARG(0);
46
gen_helper_vfp_fcvt_f16_to_f64(tcg_rd, tcg_rn, tcg_fpst, tcg_ahp);
54
@@ -XXX,XX +XXX,XX @@ target_ulong do_arm_semihosting(CPUARMState *env)
47
@@ -XXX,XX +XXX,XX @@ static bool trans_FCVTL_v(DisasContext *s, arg_qrr_e *a)
55
#else
48
return true;
56
limit = ram_size;
49
}
57
/* TODO: Make this use the limit of the loaded application. */
50
58
- retvals[0] = limit / 2;
51
- fpst = fpstatus_ptr(FPST_A64);
59
- retvals[1] = limit;
52
if (a->esz == MO_64) {
60
- retvals[2] = limit; /* Stack base */
53
/* 32 -> 64 bit fp conversion */
61
- retvals[3] = 0; /* Stack limit. */
54
TCGv_i64 tcg_res[2];
62
+ retvals[0] = rambase + limit / 2;
55
TCGv_i32 tcg_op = tcg_temp_new_i32();
63
+ retvals[1] = rambase + limit;
56
int srcelt = a->q ? 2 : 0;
64
+ retvals[2] = rambase + limit; /* Stack base */
57
65
+ retvals[3] = rambase; /* Stack limit. */
58
+ fpst = fpstatus_ptr(FPST_A64);
66
#endif
59
+
67
60
for (pass = 0; pass < 2; pass++) {
68
for (i = 0; i < ARRAY_SIZE(retvals); i++) {
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,
69
--
94
--
70
2.20.1
95
2.34.1
71
72
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <f4bug@amsat.org>
1
From: Hongren Zheng <i@zenithal.me>
2
2
3
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
3
When USBPacket in OUT direction has larger payload
4
Message-id: 20201120154545.2504625-2-f4bug@amsat.org
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
5
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
23
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
24
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
---
25
---
8
MAINTAINERS | 1 +
26
hw/usb/canokey.h | 4 ----
9
1 file changed, 1 insertion(+)
27
hw/usb/canokey.c | 6 +++---
28
2 files changed, 3 insertions(+), 7 deletions(-)
10
29
11
diff --git a/MAINTAINERS b/MAINTAINERS
30
diff --git a/hw/usb/canokey.h b/hw/usb/canokey.h
12
index XXXXXXX..XXXXXXX 100644
31
index XXXXXXX..XXXXXXX 100644
13
--- a/MAINTAINERS
32
--- a/hw/usb/canokey.h
14
+++ b/MAINTAINERS
33
+++ b/hw/usb/canokey.h
15
@@ -XXX,XX +XXX,XX @@ F: disas/arm.c
34
@@ -XXX,XX +XXX,XX @@
16
F: disas/arm-a64.cc
35
#define CANOKEY_EP_NUM 3
17
F: disas/libvixl/
36
/* BULK/INTR IN can be up to 1352 bytes, e.g. get key info */
18
F: docs/system/target-arm.rst
37
#define CANOKEY_EP_IN_BUFFER_SIZE 2048
19
+F: docs/system/arm/cpu-features.rst
38
-/* BULK OUT can be up to 270 bytes, e.g. PIV import cert */
20
39
-#define CANOKEY_EP_OUT_BUFFER_SIZE 512
21
ARM SMMU
40
22
M: Eric Auger <eric.auger@redhat.com>
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;
23
--
77
--
24
2.20.1
78
2.34.1
25
26
diff view generated by jsdifflib