1
The following changes since commit 5bab95dc74d43bbb28c6a96d24c810a664432057:
1
First arm pullreq of the cycle; this is mostly my softfloat NaN
2
handling series. (Lots more in my to-review queue, but I don't
3
like pullreqs growing too close to a hundred patches at a time :-))
2
4
3
Merge tag 'pull-request-2024-01-24' of https://gitlab.com/thuth/qemu into staging (2024-01-25 12:33:42 +0000)
5
thanks
6
-- PMM
7
8
The following changes since commit 97f2796a3736ed37a1b85dc1c76a6c45b829dd17:
9
10
Open 10.0 development tree (2024-12-10 17:41:17 +0000)
4
11
5
are available in the Git repository at:
12
are available in the Git repository at:
6
13
7
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20240126
14
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20241211
8
15
9
for you to fetch changes up to 5e6be95ed1578c7cfac2082b39384d99fd912508:
16
for you to fetch changes up to 1abe28d519239eea5cf9620bb13149423e5665f8:
10
17
11
hw/arm: add PCIe to Freescale i.MX6 (2024-01-26 12:23:04 +0000)
18
MAINTAINERS: Add correct email address for Vikram Garhwal (2024-12-11 15:31:09 +0000)
12
19
13
----------------------------------------------------------------
20
----------------------------------------------------------------
14
target-arm queue:
21
target-arm queue:
15
* Fix VNCR fault detection logic
22
* hw/net/lan9118: Extract PHY model, reuse with imx_fec, fix bugs
16
* Fix A64 scalar SQSHRN and SQRSHRN
23
* fpu: Make muladd NaN handling runtime-selected, not compile-time
17
* Fix incorrect aa64_tidcp1 feature check
24
* fpu: Make default NaN pattern runtime-selected, not compile-time
18
* hw/arm/virt.c: Remove newline from error_report() string
25
* fpu: Minor NaN-related cleanups
19
* hw/arm/musicpal: Convert to qemu_add_kbd_event_handler()
26
* MAINTAINERS: email address updates
20
* hw/arm/allwinner-a10: Unconditionally map the USB Host controllers
21
* hw/arm/nseries: Unconditionally map the TUSB6010 USB Host controller
22
* hw/arm: Add EHCI/OHCI controllers to Allwinner R40 and Bananapi board
23
* hw/arm: Add AHCI/SATA controller to Allwinner R40 and Bananapi board
24
* hw/arm: Add watchdog timer to Allwinner H40 and Bananapi board
25
* arm: various include header cleanups
26
* cleanups to allow some files to be built only once
27
* fsl-imx6ul: Add various missing unimplemented devices
28
* docs/system/arm/virt.rst: Add note on CPU features off by default
29
* hw/char/imx_serial: Implement receive FIFO and ageing timer
30
* target/xtensa: fix OOB TLB entry access
31
* bswap.h: Fix const_le64() macro
32
* hw/arm: add PCIe to Freescale i.MX6
33
27
34
----------------------------------------------------------------
28
----------------------------------------------------------------
35
Guenter Roeck (4):
29
Bernhard Beschow (5):
36
hw/arm: Add EHCI/OHCI controllers to Allwinner R40 and Bananapi board
30
hw/net/lan9118: Extract lan9118_phy
37
hw/arm: Add AHCI/SATA controller to Allwinner R40 and Bananapi board
31
hw/net/lan9118_phy: Reuse in imx_fec and consolidate implementations
38
hw/arm: Add watchdog timer to Allwinner H40 and Bananapi board
32
hw/net/lan9118_phy: Fix off-by-one error in MII_ANLPAR register
39
fsl-imx6ul: Add various missing unimplemented devices
33
hw/net/lan9118_phy: Reuse MII constants
34
hw/net/lan9118_phy: Add missing 100 mbps full duplex advertisement
40
35
41
Gustavo Romero (1):
36
Leif Lindholm (1):
42
docs/system/arm/virt.rst: Add note on CPU features off by default
37
MAINTAINERS: update email address for Leif Lindholm
43
38
44
Max Filippov (1):
39
Peter Maydell (54):
45
target/xtensa: fix OOB TLB entry access
40
fpu: handle raising Invalid for infzero in pick_nan_muladd
41
fpu: Check for default_nan_mode before calling pickNaNMulAdd
42
softfloat: Allow runtime choice of inf * 0 + NaN result
43
tests/fp: Explicitly set inf-zero-nan rule
44
target/arm: Set FloatInfZeroNaNRule explicitly
45
target/s390: Set FloatInfZeroNaNRule explicitly
46
target/ppc: Set FloatInfZeroNaNRule explicitly
47
target/mips: Set FloatInfZeroNaNRule explicitly
48
target/sparc: Set FloatInfZeroNaNRule explicitly
49
target/xtensa: Set FloatInfZeroNaNRule explicitly
50
target/x86: Set FloatInfZeroNaNRule explicitly
51
target/loongarch: Set FloatInfZeroNaNRule explicitly
52
target/hppa: Set FloatInfZeroNaNRule explicitly
53
softfloat: Pass have_snan to pickNaNMulAdd
54
softfloat: Allow runtime choice of NaN propagation for muladd
55
tests/fp: Explicitly set 3-NaN propagation rule
56
target/arm: Set Float3NaNPropRule explicitly
57
target/loongarch: Set Float3NaNPropRule explicitly
58
target/ppc: Set Float3NaNPropRule explicitly
59
target/s390x: Set Float3NaNPropRule explicitly
60
target/sparc: Set Float3NaNPropRule explicitly
61
target/mips: Set Float3NaNPropRule explicitly
62
target/xtensa: Set Float3NaNPropRule explicitly
63
target/i386: Set Float3NaNPropRule explicitly
64
target/hppa: Set Float3NaNPropRule explicitly
65
fpu: Remove use_first_nan field from float_status
66
target/m68k: Don't pass NULL float_status to floatx80_default_nan()
67
softfloat: Create floatx80 default NaN from parts64_default_nan
68
target/loongarch: Use normal float_status in fclass_s and fclass_d helpers
69
target/m68k: In frem helper, initialize local float_status from env->fp_status
70
target/m68k: Init local float_status from env fp_status in gdb get/set reg
71
target/sparc: Initialize local scratch float_status from env->fp_status
72
target/ppc: Use env->fp_status in helper_compute_fprf functions
73
fpu: Allow runtime choice of default NaN value
74
tests/fp: Set default NaN pattern explicitly
75
target/microblaze: Set default NaN pattern explicitly
76
target/i386: Set default NaN pattern explicitly
77
target/hppa: Set default NaN pattern explicitly
78
target/alpha: Set default NaN pattern explicitly
79
target/arm: Set default NaN pattern explicitly
80
target/loongarch: Set default NaN pattern explicitly
81
target/m68k: Set default NaN pattern explicitly
82
target/mips: Set default NaN pattern explicitly
83
target/openrisc: Set default NaN pattern explicitly
84
target/ppc: Set default NaN pattern explicitly
85
target/sh4: Set default NaN pattern explicitly
86
target/rx: Set default NaN pattern explicitly
87
target/s390x: Set default NaN pattern explicitly
88
target/sparc: Set default NaN pattern explicitly
89
target/xtensa: Set default NaN pattern explicitly
90
target/hexagon: Set default NaN pattern explicitly
91
target/riscv: Set default NaN pattern explicitly
92
target/tricore: Set default NaN pattern explicitly
93
fpu: Remove default handling for dnan_pattern
46
94
47
Nikita Ostrenkov (1):
95
Richard Henderson (11):
48
hw/arm: add PCIe to Freescale i.MX6
96
target/arm: Copy entire float_status in is_ebf
97
softfloat: Inline pickNaNMulAdd
98
softfloat: Use goto for default nan case in pick_nan_muladd
99
softfloat: Remove which from parts_pick_nan_muladd
100
softfloat: Pad array size in pick_nan_muladd
101
softfloat: Move propagateFloatx80NaN to softfloat.c
102
softfloat: Use parts_pick_nan in propagateFloatx80NaN
103
softfloat: Inline pickNaN
104
softfloat: Share code between parts_pick_nan cases
105
softfloat: Sink frac_cmp in parts_pick_nan until needed
106
softfloat: Replace WHICH with RET in parts_pick_nan
49
107
50
Peter Maydell (6):
108
Vikram Garhwal (1):
51
target/arm: Fix VNCR fault detection logic
109
MAINTAINERS: Add correct email address for Vikram Garhwal
52
hw/arm/virt.c: Remove newline from error_report() string
53
hw/arm/musicpal: Convert to qemu_add_kbd_event_handler()
54
target/arm: Fix A64 scalar SQSHRN and SQRSHRN
55
bswap.h: Fix const_le64() macro
56
target/arm: Fix incorrect aa64_tidcp1 feature check
57
110
58
Philippe Mathieu-Daudé (20):
111
MAINTAINERS | 4 +-
59
hw/arm/allwinner-a10: Unconditionally map the USB Host controllers
112
include/fpu/softfloat-helpers.h | 38 +++-
60
hw/arm/nseries: Unconditionally map the TUSB6010 USB Host controller
113
include/fpu/softfloat-types.h | 89 +++++++-
61
hw/arm/exynos4210: Include missing 'exec/tswap.h' header
114
include/hw/net/imx_fec.h | 9 +-
62
hw/arm/xilinx_zynq: Include missing 'exec/tswap.h' header
115
include/hw/net/lan9118_phy.h | 37 ++++
63
hw/arm/smmuv3: Include missing 'hw/registerfields.h' header
116
include/hw/net/mii.h | 6 +
64
hw/arm/xlnx-versal: Include missing 'cpu.h' header
117
target/mips/fpu_helper.h | 20 ++
65
target/arm/cpu-features: Include missing 'hw/registerfields.h' header
118
target/sparc/helper.h | 4 +-
66
target/arm/cpregs: Include missing 'hw/registerfields.h' header
119
fpu/softfloat.c | 19 ++
67
target/arm/cpregs: Include missing 'kvm-consts.h' header
120
hw/net/imx_fec.c | 146 ++------------
68
target/arm: Expose arm_cpu_mp_affinity() in 'multiprocessing.h' header
121
hw/net/lan9118.c | 137 ++-----------
69
target/arm: Declare ARM_CPU_TYPE_NAME/SUFFIX in 'cpu-qom.h'
122
hw/net/lan9118_phy.c | 222 ++++++++++++++++++++
70
hw/cpu/a9mpcore: Build it only once
123
linux-user/arm/nwfpe/fpa11.c | 5 +
71
hw/misc/xlnx-versal-crl: Include generic 'cpu-qom.h' instead of 'cpu.h'
124
target/alpha/cpu.c | 2 +
72
hw/misc/xlnx-versal-crl: Build it only once
125
target/arm/cpu.c | 10 +
73
target/arm: Expose M-profile register bank index definitions
126
target/arm/tcg/vec_helper.c | 20 +-
74
hw/arm/armv7m: Make 'hw/intc/armv7m_nvic.h' a target agnostic header
127
target/hexagon/cpu.c | 2 +
75
target/arm: Move ARM_CPU_IRQ/FIQ definitions to 'cpu-qom.h' header
128
target/hppa/fpu_helper.c | 12 ++
76
target/arm: Move e2h_access() helper around
129
target/i386/tcg/fpu_helper.c | 12 ++
77
target/arm: Move GTimer definitions to new 'gtimer.h' header
130
target/loongarch/tcg/fpu_helper.c | 14 +-
78
hw/arm: Build various units only once
131
target/m68k/cpu.c | 14 +-
79
132
target/m68k/fpu_helper.c | 6 +-
80
Rayhan Faizel (1):
133
target/m68k/helper.c | 6 +-
81
hw/char/imx_serial: Implement receive FIFO and ageing timer
134
target/microblaze/cpu.c | 2 +
82
135
target/mips/msa.c | 10 +
83
Richard Henderson (2):
136
target/openrisc/cpu.c | 2 +
84
target/arm: Rename arm_cpu_mp_affinity
137
target/ppc/cpu_init.c | 19 ++
85
target/arm: Create arm_cpu_mp_affinity
138
target/ppc/fpu_helper.c | 3 +-
86
139
target/riscv/cpu.c | 2 +
87
docs/system/arm/bananapi_m2u.rst | 5 +-
140
target/rx/cpu.c | 2 +
88
docs/system/arm/virt.rst | 13 ++++
141
target/s390x/cpu.c | 5 +
89
hw/arm/smmuv3-internal.h | 1 +
142
target/sh4/cpu.c | 2 +
90
include/hw/arm/allwinner-r40.h | 15 +++++
143
target/sparc/cpu.c | 6 +
91
include/hw/arm/fsl-imx6.h | 44 +++++++------
144
target/sparc/fop_helper.c | 8 +-
92
include/hw/arm/fsl-imx6ul.h | 2 +
145
target/sparc/translate.c | 4 +-
93
include/hw/arm/xlnx-versal.h | 1 +
146
target/tricore/helper.c | 2 +
94
include/hw/char/imx_serial.h | 20 +++++-
147
target/xtensa/cpu.c | 4 +
95
include/hw/intc/armv7m_nvic.h | 2 +-
148
target/xtensa/fpu_helper.c | 3 +-
96
include/hw/misc/xlnx-versal-crl.h | 2 +-
149
tests/fp/fp-bench.c | 7 +
97
include/qemu/bswap.h | 16 ++---
150
tests/fp/fp-test-log2.c | 1 +
98
target/arm/cpregs.h | 3 +
151
tests/fp/fp-test.c | 7 +
99
target/arm/cpu-features.h | 4 +-
152
fpu/softfloat-parts.c.inc | 152 +++++++++++---
100
target/arm/cpu-qom.h | 24 +++++++
153
fpu/softfloat-specialize.c.inc | 412 ++------------------------------------
101
target/arm/cpu.h | 34 +---------
154
.mailmap | 5 +-
102
target/arm/gtimer.h | 21 ++++++
155
hw/net/Kconfig | 5 +
103
target/arm/multiprocessing.h | 16 +++++
156
hw/net/meson.build | 1 +
104
hw/arm/allwinner-a10.c | 50 ++++++--------
157
hw/net/trace-events | 10 +-
105
hw/arm/allwinner-h3.c | 2 +
158
47 files changed, 778 insertions(+), 730 deletions(-)
106
hw/arm/allwinner-r40.c | 69 +++++++++++++++++++-
159
create mode 100644 include/hw/net/lan9118_phy.h
107
hw/arm/armv7m.c | 2 +
160
create mode 100644 hw/net/lan9118_phy.c
108
hw/arm/aspeed_ast2400.c | 1 +
109
hw/arm/aspeed_ast2600.c | 1 +
110
hw/arm/bcm2836.c | 2 +
111
hw/arm/collie.c | 1 -
112
hw/arm/exynos4210.c | 2 +
113
hw/arm/fsl-imx25.c | 1 +
114
hw/arm/fsl-imx31.c | 1 +
115
hw/arm/fsl-imx6.c | 26 ++++++++
116
hw/arm/fsl-imx6ul.c | 31 +++++++++
117
hw/arm/fsl-imx7.c | 1 +
118
hw/arm/gumstix.c | 1 -
119
hw/arm/highbank.c | 1 +
120
hw/arm/integratorcp.c | 2 +-
121
hw/arm/mainstone.c | 1 -
122
hw/arm/musicpal.c | 133 ++++++++++++++++++--------------------
123
hw/arm/npcm7xx.c | 3 +-
124
hw/arm/nseries.c | 4 +-
125
hw/arm/omap1.c | 1 +
126
hw/arm/omap2.c | 2 +-
127
hw/arm/omap_sx1.c | 1 -
128
hw/arm/palm.c | 1 -
129
hw/arm/realview.c | 1 +
130
hw/arm/sbsa-ref.c | 4 +-
131
hw/arm/spitz.c | 1 -
132
hw/arm/strongarm.c | 2 +-
133
hw/arm/versatilepb.c | 2 +-
134
hw/arm/vexpress.c | 2 +-
135
hw/arm/virt-acpi-build.c | 4 +-
136
hw/arm/virt.c | 15 +++--
137
hw/arm/xilinx_zynq.c | 3 +-
138
hw/arm/xlnx-versal-virt.c | 5 +-
139
hw/arm/xlnx-versal.c | 2 +
140
hw/arm/xlnx-zynqmp.c | 2 +
141
hw/arm/z2.c | 1 -
142
hw/char/imx_serial.c | 102 +++++++++++++++++++++++++----
143
hw/cpu/a15mpcore.c | 1 +
144
hw/cpu/a9mpcore.c | 2 +-
145
hw/misc/xlnx-versal-crl.c | 5 +-
146
target/arm/arm-powerctl.c | 3 +-
147
target/arm/cpu.c | 13 +++-
148
target/arm/helper.c | 30 +++++----
149
target/arm/hvf/hvf.c | 6 +-
150
target/arm/kvm.c | 1 +
151
target/arm/machine.c | 1 +
152
target/arm/tcg/psci.c | 3 +-
153
target/arm/tcg/tlb_helper.c | 2 +-
154
target/arm/tcg/translate-a64.c | 2 +-
155
target/xtensa/mmu_helper.c | 47 ++++++++++----
156
hw/arm/Kconfig | 6 ++
157
hw/arm/meson.build | 23 +++----
158
hw/cpu/meson.build | 2 +-
159
hw/misc/meson.build | 2 +-
160
73 files changed, 597 insertions(+), 261 deletions(-)
161
create mode 100644 target/arm/gtimer.h
162
create mode 100644 target/arm/multiprocessing.h
163
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
1
From: Bernhard Beschow <shentey@gmail.com>
2
2
3
Move Arm A-class Generic Timer definitions to the new
3
A very similar implementation of the same device exists in imx_fec. Prepare for
4
"target/arm/gtimer.h" header so units in hw/ which don't
4
a common implementation by extracting a device model into its own files.
5
need access to ARMCPU internals can use them without
6
having to include the huge "cpu.h".
7
5
8
Suggested-by: Richard Henderson <richard.henderson@linaro.org>
6
Some migration state has been moved into the new device model which breaks
9
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
7
migration compatibility for the following machines:
10
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
* smdkc210
11
Message-id: 20240118200643.29037-20-philmd@linaro.org
9
* realview-*
10
* vexpress-*
11
* kzm
12
* mps2-*
13
14
While breaking migration ABI, fix the size of the MII registers to be 16 bit,
15
as defined by IEEE 802.3u.
16
17
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
18
Tested-by: Guenter Roeck <linux@roeck-us.net>
19
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
20
Message-id: 20241102125724.532843-2-shentey@gmail.com
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
21
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
22
---
14
target/arm/cpu.h | 8 +-------
23
include/hw/net/lan9118_phy.h | 37 ++++++++
15
target/arm/gtimer.h | 21 +++++++++++++++++++++
24
hw/net/lan9118.c | 137 +++++-----------------------
16
hw/arm/allwinner-h3.c | 1 +
25
hw/net/lan9118_phy.c | 169 +++++++++++++++++++++++++++++++++++
17
hw/arm/allwinner-r40.c | 1 +
26
hw/net/Kconfig | 4 +
18
hw/arm/bcm2836.c | 1 +
27
hw/net/meson.build | 1 +
19
hw/arm/sbsa-ref.c | 1 +
28
5 files changed, 233 insertions(+), 115 deletions(-)
20
hw/arm/virt.c | 1 +
29
create mode 100644 include/hw/net/lan9118_phy.h
21
hw/arm/xlnx-versal.c | 1 +
30
create mode 100644 hw/net/lan9118_phy.c
22
hw/arm/xlnx-zynqmp.c | 1 +
23
hw/cpu/a15mpcore.c | 1 +
24
target/arm/cpu.c | 1 +
25
target/arm/helper.c | 1 +
26
target/arm/hvf/hvf.c | 1 +
27
target/arm/kvm.c | 1 +
28
target/arm/machine.c | 1 +
29
15 files changed, 35 insertions(+), 7 deletions(-)
30
create mode 100644 target/arm/gtimer.h
31
31
32
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
32
diff --git a/include/hw/net/lan9118_phy.h b/include/hw/net/lan9118_phy.h
33
index XXXXXXX..XXXXXXX 100644
34
--- a/target/arm/cpu.h
35
+++ b/target/arm/cpu.h
36
@@ -XXX,XX +XXX,XX @@
37
#include "exec/cpu-defs.h"
38
#include "qapi/qapi-types-common.h"
39
#include "target/arm/multiprocessing.h"
40
+#include "target/arm/gtimer.h"
41
42
/* ARM processors have a weak memory model */
43
#define TCG_GUEST_DEFAULT_MO (0)
44
@@ -XXX,XX +XXX,XX @@ typedef struct ARMGenericTimer {
45
uint64_t ctl; /* Timer Control register */
46
} ARMGenericTimer;
47
48
-#define GTIMER_PHYS 0
49
-#define GTIMER_VIRT 1
50
-#define GTIMER_HYP 2
51
-#define GTIMER_SEC 3
52
-#define GTIMER_HYPVIRT 4
53
-#define NUM_GTIMERS 5
54
-
55
#define VTCR_NSW (1u << 29)
56
#define VTCR_NSA (1u << 30)
57
#define VSTCR_SW VTCR_NSW
58
diff --git a/target/arm/gtimer.h b/target/arm/gtimer.h
59
new file mode 100644
33
new file mode 100644
60
index XXXXXXX..XXXXXXX
34
index XXXXXXX..XXXXXXX
61
--- /dev/null
35
--- /dev/null
62
+++ b/target/arm/gtimer.h
36
+++ b/include/hw/net/lan9118_phy.h
63
@@ -XXX,XX +XXX,XX @@
37
@@ -XXX,XX +XXX,XX @@
64
+/*
38
+/*
65
+ * ARM generic timer definitions for Arm A-class CPU
39
+ * SMSC LAN9118 PHY emulation
66
+ *
40
+ *
67
+ * Copyright (c) 2003 Fabrice Bellard
41
+ * Copyright (c) 2009 CodeSourcery, LLC.
42
+ * Written by Paul Brook
68
+ *
43
+ *
69
+ * SPDX-License-Identifier: LGPL-2.1-or-later
44
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
45
+ * See the COPYING file in the top-level directory.
70
+ */
46
+ */
71
+
47
+
72
+#ifndef TARGET_ARM_GTIMER_H
48
+#ifndef HW_NET_LAN9118_PHY_H
73
+#define TARGET_ARM_GTIMER_H
49
+#define HW_NET_LAN9118_PHY_H
74
+
50
+
75
+enum {
51
+#include "qom/object.h"
76
+ GTIMER_PHYS = 0,
52
+#include "hw/sysbus.h"
77
+ GTIMER_VIRT = 1,
53
+
78
+ GTIMER_HYP = 2,
54
+#define TYPE_LAN9118_PHY "lan9118-phy"
79
+ GTIMER_SEC = 3,
55
+OBJECT_DECLARE_SIMPLE_TYPE(Lan9118PhyState, LAN9118_PHY)
80
+ GTIMER_HYPVIRT = 4,
56
+
81
+#define NUM_GTIMERS 5
57
+typedef struct Lan9118PhyState {
58
+ SysBusDevice parent_obj;
59
+
60
+ uint16_t status;
61
+ uint16_t control;
62
+ uint16_t advertise;
63
+ uint16_t ints;
64
+ uint16_t int_mask;
65
+ qemu_irq irq;
66
+ bool link_down;
67
+} Lan9118PhyState;
68
+
69
+void lan9118_phy_update_link(Lan9118PhyState *s, bool link_down);
70
+void lan9118_phy_reset(Lan9118PhyState *s);
71
+uint16_t lan9118_phy_read(Lan9118PhyState *s, int reg);
72
+void lan9118_phy_write(Lan9118PhyState *s, int reg, uint16_t val);
73
+
74
+#endif
75
diff --git a/hw/net/lan9118.c b/hw/net/lan9118.c
76
index XXXXXXX..XXXXXXX 100644
77
--- a/hw/net/lan9118.c
78
+++ b/hw/net/lan9118.c
79
@@ -XXX,XX +XXX,XX @@
80
#include "net/net.h"
81
#include "net/eth.h"
82
#include "hw/irq.h"
83
+#include "hw/net/lan9118_phy.h"
84
#include "hw/net/lan9118.h"
85
#include "hw/ptimer.h"
86
#include "hw/qdev-properties.h"
87
@@ -XXX,XX +XXX,XX @@ do { printf("lan9118: " fmt , ## __VA_ARGS__); } while (0)
88
#define MAC_CR_RXEN 0x00000004
89
#define MAC_CR_RESERVED 0x7f404213
90
91
-#define PHY_INT_ENERGYON 0x80
92
-#define PHY_INT_AUTONEG_COMPLETE 0x40
93
-#define PHY_INT_FAULT 0x20
94
-#define PHY_INT_DOWN 0x10
95
-#define PHY_INT_AUTONEG_LP 0x08
96
-#define PHY_INT_PARFAULT 0x04
97
-#define PHY_INT_AUTONEG_PAGE 0x02
98
-
99
#define GPT_TIMER_EN 0x20000000
100
101
/*
102
@@ -XXX,XX +XXX,XX @@ struct lan9118_state {
103
uint32_t mac_mii_data;
104
uint32_t mac_flow;
105
106
- uint32_t phy_status;
107
- uint32_t phy_control;
108
- uint32_t phy_advertise;
109
- uint32_t phy_int;
110
- uint32_t phy_int_mask;
111
+ Lan9118PhyState mii;
112
+ IRQState mii_irq;
113
114
int32_t eeprom_writable;
115
uint8_t eeprom[128];
116
@@ -XXX,XX +XXX,XX @@ struct lan9118_state {
117
118
static const VMStateDescription vmstate_lan9118 = {
119
.name = "lan9118",
120
- .version_id = 2,
121
- .minimum_version_id = 1,
122
+ .version_id = 3,
123
+ .minimum_version_id = 3,
124
.fields = (const VMStateField[]) {
125
VMSTATE_PTIMER(timer, lan9118_state),
126
VMSTATE_UINT32(irq_cfg, lan9118_state),
127
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_lan9118 = {
128
VMSTATE_UINT32(mac_mii_acc, lan9118_state),
129
VMSTATE_UINT32(mac_mii_data, lan9118_state),
130
VMSTATE_UINT32(mac_flow, lan9118_state),
131
- VMSTATE_UINT32(phy_status, lan9118_state),
132
- VMSTATE_UINT32(phy_control, lan9118_state),
133
- VMSTATE_UINT32(phy_advertise, lan9118_state),
134
- VMSTATE_UINT32(phy_int, lan9118_state),
135
- VMSTATE_UINT32(phy_int_mask, lan9118_state),
136
VMSTATE_INT32(eeprom_writable, lan9118_state),
137
VMSTATE_UINT8_ARRAY(eeprom, lan9118_state, 128),
138
VMSTATE_INT32(tx_fifo_size, lan9118_state),
139
@@ -XXX,XX +XXX,XX @@ static void lan9118_reload_eeprom(lan9118_state *s)
140
lan9118_mac_changed(s);
141
}
142
143
-static void phy_update_irq(lan9118_state *s)
144
+static void lan9118_update_irq(void *opaque, int n, int level)
145
{
146
- if (s->phy_int & s->phy_int_mask) {
147
+ lan9118_state *s = opaque;
148
+
149
+ if (level) {
150
s->int_sts |= PHY_INT;
151
} else {
152
s->int_sts &= ~PHY_INT;
153
@@ -XXX,XX +XXX,XX @@ static void phy_update_irq(lan9118_state *s)
154
lan9118_update(s);
155
}
156
157
-static void phy_update_link(lan9118_state *s)
158
-{
159
- /* Autonegotiation status mirrors link status. */
160
- if (qemu_get_queue(s->nic)->link_down) {
161
- s->phy_status &= ~0x0024;
162
- s->phy_int |= PHY_INT_DOWN;
163
- } else {
164
- s->phy_status |= 0x0024;
165
- s->phy_int |= PHY_INT_ENERGYON;
166
- s->phy_int |= PHY_INT_AUTONEG_COMPLETE;
167
- }
168
- phy_update_irq(s);
169
-}
170
-
171
static void lan9118_set_link(NetClientState *nc)
172
{
173
- phy_update_link(qemu_get_nic_opaque(nc));
174
-}
175
-
176
-static void phy_reset(lan9118_state *s)
177
-{
178
- s->phy_status = 0x7809;
179
- s->phy_control = 0x3000;
180
- s->phy_advertise = 0x01e1;
181
- s->phy_int_mask = 0;
182
- s->phy_int = 0;
183
- phy_update_link(s);
184
+ lan9118_phy_update_link(&LAN9118(qemu_get_nic_opaque(nc))->mii,
185
+ nc->link_down);
186
}
187
188
static void lan9118_reset(DeviceState *d)
189
@@ -XXX,XX +XXX,XX @@ static void lan9118_reset(DeviceState *d)
190
s->read_word_n = 0;
191
s->write_word_n = 0;
192
193
- phy_reset(s);
194
-
195
s->eeprom_writable = 0;
196
lan9118_reload_eeprom(s);
197
}
198
@@ -XXX,XX +XXX,XX @@ static void do_tx_packet(lan9118_state *s)
199
uint32_t status;
200
201
/* FIXME: Honor TX disable, and allow queueing of packets. */
202
- if (s->phy_control & 0x4000) {
203
+ if (s->mii.control & 0x4000) {
204
/* This assumes the receive routine doesn't touch the VLANClient. */
205
qemu_receive_packet(qemu_get_queue(s->nic), s->txp->data, s->txp->len);
206
} else {
207
@@ -XXX,XX +XXX,XX @@ static void tx_fifo_push(lan9118_state *s, uint32_t val)
208
}
209
}
210
211
-static uint32_t do_phy_read(lan9118_state *s, int reg)
212
-{
213
- uint32_t val;
214
-
215
- switch (reg) {
216
- case 0: /* Basic Control */
217
- return s->phy_control;
218
- case 1: /* Basic Status */
219
- return s->phy_status;
220
- case 2: /* ID1 */
221
- return 0x0007;
222
- case 3: /* ID2 */
223
- return 0xc0d1;
224
- case 4: /* Auto-neg advertisement */
225
- return s->phy_advertise;
226
- case 5: /* Auto-neg Link Partner Ability */
227
- return 0x0f71;
228
- case 6: /* Auto-neg Expansion */
229
- return 1;
230
- /* TODO 17, 18, 27, 29, 30, 31 */
231
- case 29: /* Interrupt source. */
232
- val = s->phy_int;
233
- s->phy_int = 0;
234
- phy_update_irq(s);
235
- return val;
236
- case 30: /* Interrupt mask */
237
- return s->phy_int_mask;
238
- default:
239
- qemu_log_mask(LOG_GUEST_ERROR,
240
- "do_phy_read: PHY read reg %d\n", reg);
241
- return 0;
242
- }
243
-}
244
-
245
-static void do_phy_write(lan9118_state *s, int reg, uint32_t val)
246
-{
247
- switch (reg) {
248
- case 0: /* Basic Control */
249
- if (val & 0x8000) {
250
- phy_reset(s);
251
- break;
252
- }
253
- s->phy_control = val & 0x7980;
254
- /* Complete autonegotiation immediately. */
255
- if (val & 0x1000) {
256
- s->phy_status |= 0x0020;
257
- }
258
- break;
259
- case 4: /* Auto-neg advertisement */
260
- s->phy_advertise = (val & 0x2d7f) | 0x80;
261
- break;
262
- /* TODO 17, 18, 27, 31 */
263
- case 30: /* Interrupt mask */
264
- s->phy_int_mask = val & 0xff;
265
- phy_update_irq(s);
266
- break;
267
- default:
268
- qemu_log_mask(LOG_GUEST_ERROR,
269
- "do_phy_write: PHY write reg %d = 0x%04x\n", reg, val);
270
- }
271
-}
272
-
273
static void do_mac_write(lan9118_state *s, int reg, uint32_t val)
274
{
275
switch (reg) {
276
@@ -XXX,XX +XXX,XX @@ static void do_mac_write(lan9118_state *s, int reg, uint32_t val)
277
if (val & 2) {
278
DPRINTF("PHY write %d = 0x%04x\n",
279
(val >> 6) & 0x1f, s->mac_mii_data);
280
- do_phy_write(s, (val >> 6) & 0x1f, s->mac_mii_data);
281
+ lan9118_phy_write(&s->mii, (val >> 6) & 0x1f, s->mac_mii_data);
282
} else {
283
- s->mac_mii_data = do_phy_read(s, (val >> 6) & 0x1f);
284
+ s->mac_mii_data = lan9118_phy_read(&s->mii, (val >> 6) & 0x1f);
285
DPRINTF("PHY read %d = 0x%04x\n",
286
(val >> 6) & 0x1f, s->mac_mii_data);
287
}
288
@@ -XXX,XX +XXX,XX @@ static void lan9118_writel(void *opaque, hwaddr offset,
289
break;
290
case CSR_PMT_CTRL:
291
if (val & 0x400) {
292
- phy_reset(s);
293
+ lan9118_phy_reset(&s->mii);
294
}
295
s->pmt_ctrl &= ~0x34e;
296
s->pmt_ctrl |= (val & 0x34e);
297
@@ -XXX,XX +XXX,XX @@ static void lan9118_realize(DeviceState *dev, Error **errp)
298
const MemoryRegionOps *mem_ops =
299
s->mode_16bit ? &lan9118_16bit_mem_ops : &lan9118_mem_ops;
300
301
+ qemu_init_irq(&s->mii_irq, lan9118_update_irq, s, 0);
302
+ object_initialize_child(OBJECT(s), "mii", &s->mii, TYPE_LAN9118_PHY);
303
+ if (!sysbus_realize_and_unref(SYS_BUS_DEVICE(&s->mii), errp)) {
304
+ return;
305
+ }
306
+ qdev_connect_gpio_out(DEVICE(&s->mii), 0, &s->mii_irq);
307
+
308
memory_region_init_io(&s->mmio, OBJECT(dev), mem_ops, s,
309
"lan9118-mmio", 0x100);
310
sysbus_init_mmio(sbd, &s->mmio);
311
diff --git a/hw/net/lan9118_phy.c b/hw/net/lan9118_phy.c
312
new file mode 100644
313
index XXXXXXX..XXXXXXX
314
--- /dev/null
315
+++ b/hw/net/lan9118_phy.c
316
@@ -XXX,XX +XXX,XX @@
317
+/*
318
+ * SMSC LAN9118 PHY emulation
319
+ *
320
+ * Copyright (c) 2009 CodeSourcery, LLC.
321
+ * Written by Paul Brook
322
+ *
323
+ * This code is licensed under the GNU GPL v2
324
+ *
325
+ * Contributions after 2012-01-13 are licensed under the terms of the
326
+ * GNU GPL, version 2 or (at your option) any later version.
327
+ */
328
+
329
+#include "qemu/osdep.h"
330
+#include "hw/net/lan9118_phy.h"
331
+#include "hw/irq.h"
332
+#include "hw/resettable.h"
333
+#include "migration/vmstate.h"
334
+#include "qemu/log.h"
335
+
336
+#define PHY_INT_ENERGYON (1 << 7)
337
+#define PHY_INT_AUTONEG_COMPLETE (1 << 6)
338
+#define PHY_INT_FAULT (1 << 5)
339
+#define PHY_INT_DOWN (1 << 4)
340
+#define PHY_INT_AUTONEG_LP (1 << 3)
341
+#define PHY_INT_PARFAULT (1 << 2)
342
+#define PHY_INT_AUTONEG_PAGE (1 << 1)
343
+
344
+static void lan9118_phy_update_irq(Lan9118PhyState *s)
345
+{
346
+ qemu_set_irq(s->irq, !!(s->ints & s->int_mask));
347
+}
348
+
349
+uint16_t lan9118_phy_read(Lan9118PhyState *s, int reg)
350
+{
351
+ uint16_t val;
352
+
353
+ switch (reg) {
354
+ case 0: /* Basic Control */
355
+ return s->control;
356
+ case 1: /* Basic Status */
357
+ return s->status;
358
+ case 2: /* ID1 */
359
+ return 0x0007;
360
+ case 3: /* ID2 */
361
+ return 0xc0d1;
362
+ case 4: /* Auto-neg advertisement */
363
+ return s->advertise;
364
+ case 5: /* Auto-neg Link Partner Ability */
365
+ return 0x0f71;
366
+ case 6: /* Auto-neg Expansion */
367
+ return 1;
368
+ /* TODO 17, 18, 27, 29, 30, 31 */
369
+ case 29: /* Interrupt source. */
370
+ val = s->ints;
371
+ s->ints = 0;
372
+ lan9118_phy_update_irq(s);
373
+ return val;
374
+ case 30: /* Interrupt mask */
375
+ return s->int_mask;
376
+ default:
377
+ qemu_log_mask(LOG_GUEST_ERROR,
378
+ "lan9118_phy_read: PHY read reg %d\n", reg);
379
+ return 0;
380
+ }
381
+}
382
+
383
+void lan9118_phy_write(Lan9118PhyState *s, int reg, uint16_t val)
384
+{
385
+ switch (reg) {
386
+ case 0: /* Basic Control */
387
+ if (val & 0x8000) {
388
+ lan9118_phy_reset(s);
389
+ break;
390
+ }
391
+ s->control = val & 0x7980;
392
+ /* Complete autonegotiation immediately. */
393
+ if (val & 0x1000) {
394
+ s->status |= 0x0020;
395
+ }
396
+ break;
397
+ case 4: /* Auto-neg advertisement */
398
+ s->advertise = (val & 0x2d7f) | 0x80;
399
+ break;
400
+ /* TODO 17, 18, 27, 31 */
401
+ case 30: /* Interrupt mask */
402
+ s->int_mask = val & 0xff;
403
+ lan9118_phy_update_irq(s);
404
+ break;
405
+ default:
406
+ qemu_log_mask(LOG_GUEST_ERROR,
407
+ "lan9118_phy_write: PHY write reg %d = 0x%04x\n", reg, val);
408
+ }
409
+}
410
+
411
+void lan9118_phy_update_link(Lan9118PhyState *s, bool link_down)
412
+{
413
+ s->link_down = link_down;
414
+
415
+ /* Autonegotiation status mirrors link status. */
416
+ if (link_down) {
417
+ s->status &= ~0x0024;
418
+ s->ints |= PHY_INT_DOWN;
419
+ } else {
420
+ s->status |= 0x0024;
421
+ s->ints |= PHY_INT_ENERGYON;
422
+ s->ints |= PHY_INT_AUTONEG_COMPLETE;
423
+ }
424
+ lan9118_phy_update_irq(s);
425
+}
426
+
427
+void lan9118_phy_reset(Lan9118PhyState *s)
428
+{
429
+ s->control = 0x3000;
430
+ s->status = 0x7809;
431
+ s->advertise = 0x01e1;
432
+ s->int_mask = 0;
433
+ s->ints = 0;
434
+ lan9118_phy_update_link(s, s->link_down);
435
+}
436
+
437
+static void lan9118_phy_reset_hold(Object *obj, ResetType type)
438
+{
439
+ Lan9118PhyState *s = LAN9118_PHY(obj);
440
+
441
+ lan9118_phy_reset(s);
442
+}
443
+
444
+static void lan9118_phy_init(Object *obj)
445
+{
446
+ Lan9118PhyState *s = LAN9118_PHY(obj);
447
+
448
+ qdev_init_gpio_out(DEVICE(s), &s->irq, 1);
449
+}
450
+
451
+static const VMStateDescription vmstate_lan9118_phy = {
452
+ .name = "lan9118-phy",
453
+ .version_id = 1,
454
+ .minimum_version_id = 1,
455
+ .fields = (const VMStateField[]) {
456
+ VMSTATE_UINT16(control, Lan9118PhyState),
457
+ VMSTATE_UINT16(status, Lan9118PhyState),
458
+ VMSTATE_UINT16(advertise, Lan9118PhyState),
459
+ VMSTATE_UINT16(ints, Lan9118PhyState),
460
+ VMSTATE_UINT16(int_mask, Lan9118PhyState),
461
+ VMSTATE_BOOL(link_down, Lan9118PhyState),
462
+ VMSTATE_END_OF_LIST()
463
+ }
82
+};
464
+};
83
+
465
+
84
+#endif
466
+static void lan9118_phy_class_init(ObjectClass *klass, void *data)
85
diff --git a/hw/arm/allwinner-h3.c b/hw/arm/allwinner-h3.c
467
+{
468
+ ResettableClass *rc = RESETTABLE_CLASS(klass);
469
+ DeviceClass *dc = DEVICE_CLASS(klass);
470
+
471
+ rc->phases.hold = lan9118_phy_reset_hold;
472
+ dc->vmsd = &vmstate_lan9118_phy;
473
+}
474
+
475
+static const TypeInfo types[] = {
476
+ {
477
+ .name = TYPE_LAN9118_PHY,
478
+ .parent = TYPE_SYS_BUS_DEVICE,
479
+ .instance_size = sizeof(Lan9118PhyState),
480
+ .instance_init = lan9118_phy_init,
481
+ .class_init = lan9118_phy_class_init,
482
+ }
483
+};
484
+
485
+DEFINE_TYPES(types)
486
diff --git a/hw/net/Kconfig b/hw/net/Kconfig
86
index XXXXXXX..XXXXXXX 100644
487
index XXXXXXX..XXXXXXX 100644
87
--- a/hw/arm/allwinner-h3.c
488
--- a/hw/net/Kconfig
88
+++ b/hw/arm/allwinner-h3.c
489
+++ b/hw/net/Kconfig
89
@@ -XXX,XX +XXX,XX @@
490
@@ -XXX,XX +XXX,XX @@ config VMXNET3_PCI
90
#include "sysemu/sysemu.h"
491
config SMC91C111
91
#include "hw/arm/allwinner-h3.h"
492
bool
92
#include "target/arm/cpu-qom.h"
493
93
+#include "target/arm/gtimer.h"
494
+config LAN9118_PHY
94
495
+ bool
95
/* Memory map */
496
+
96
const hwaddr allwinner_h3_memmap[] = {
497
config LAN9118
97
diff --git a/hw/arm/allwinner-r40.c b/hw/arm/allwinner-r40.c
498
bool
499
+ select LAN9118_PHY
500
select PTIMER
501
502
config NE2000_ISA
503
diff --git a/hw/net/meson.build b/hw/net/meson.build
98
index XXXXXXX..XXXXXXX 100644
504
index XXXXXXX..XXXXXXX 100644
99
--- a/hw/arm/allwinner-r40.c
505
--- a/hw/net/meson.build
100
+++ b/hw/arm/allwinner-r40.c
506
+++ b/hw/net/meson.build
101
@@ -XXX,XX +XXX,XX @@
507
@@ -XXX,XX +XXX,XX @@ system_ss.add(when: 'CONFIG_VMXNET3_PCI', if_true: files('vmxnet3.c'))
102
#include "hw/arm/allwinner-r40.h"
508
103
#include "hw/misc/allwinner-r40-dramc.h"
509
system_ss.add(when: 'CONFIG_SMC91C111', if_true: files('smc91c111.c'))
104
#include "target/arm/cpu-qom.h"
510
system_ss.add(when: 'CONFIG_LAN9118', if_true: files('lan9118.c'))
105
+#include "target/arm/gtimer.h"
511
+system_ss.add(when: 'CONFIG_LAN9118_PHY', if_true: files('lan9118_phy.c'))
106
512
system_ss.add(when: 'CONFIG_NE2000_ISA', if_true: files('ne2000-isa.c'))
107
/* Memory map */
513
system_ss.add(when: 'CONFIG_OPENCORES_ETH', if_true: files('opencores_eth.c'))
108
const hwaddr allwinner_r40_memmap[] = {
514
system_ss.add(when: 'CONFIG_XGMAC', if_true: files('xgmac.c'))
109
diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c
110
index XXXXXXX..XXXXXXX 100644
111
--- a/hw/arm/bcm2836.c
112
+++ b/hw/arm/bcm2836.c
113
@@ -XXX,XX +XXX,XX @@
114
#include "hw/arm/raspi_platform.h"
115
#include "hw/sysbus.h"
116
#include "target/arm/cpu-qom.h"
117
+#include "target/arm/gtimer.h"
118
119
struct BCM283XClass {
120
/*< private >*/
121
diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c
122
index XXXXXXX..XXXXXXX 100644
123
--- a/hw/arm/sbsa-ref.c
124
+++ b/hw/arm/sbsa-ref.c
125
@@ -XXX,XX +XXX,XX @@
126
#include "qapi/qmp/qlist.h"
127
#include "qom/object.h"
128
#include "target/arm/cpu-qom.h"
129
+#include "target/arm/gtimer.h"
130
131
#define RAMLIMIT_GB 8192
132
#define RAMLIMIT_BYTES (RAMLIMIT_GB * GiB)
133
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
134
index XXXXXXX..XXXXXXX 100644
135
--- a/hw/arm/virt.c
136
+++ b/hw/arm/virt.c
137
@@ -XXX,XX +XXX,XX @@
138
#include "target/arm/cpu-qom.h"
139
#include "target/arm/internals.h"
140
#include "target/arm/multiprocessing.h"
141
+#include "target/arm/gtimer.h"
142
#include "hw/mem/pc-dimm.h"
143
#include "hw/mem/nvdimm.h"
144
#include "hw/acpi/generic_event_device.h"
145
diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
146
index XXXXXXX..XXXXXXX 100644
147
--- a/hw/arm/xlnx-versal.c
148
+++ b/hw/arm/xlnx-versal.c
149
@@ -XXX,XX +XXX,XX @@
150
#include "hw/arm/xlnx-versal.h"
151
#include "qemu/log.h"
152
#include "target/arm/cpu-qom.h"
153
+#include "target/arm/gtimer.h"
154
155
#define XLNX_VERSAL_ACPU_TYPE ARM_CPU_TYPE_NAME("cortex-a72")
156
#define XLNX_VERSAL_RCPU_TYPE ARM_CPU_TYPE_NAME("cortex-r5f")
157
diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c
158
index XXXXXXX..XXXXXXX 100644
159
--- a/hw/arm/xlnx-zynqmp.c
160
+++ b/hw/arm/xlnx-zynqmp.c
161
@@ -XXX,XX +XXX,XX @@
162
#include "sysemu/sysemu.h"
163
#include "kvm_arm.h"
164
#include "target/arm/cpu-qom.h"
165
+#include "target/arm/gtimer.h"
166
167
#define GIC_NUM_SPI_INTR 160
168
169
diff --git a/hw/cpu/a15mpcore.c b/hw/cpu/a15mpcore.c
170
index XXXXXXX..XXXXXXX 100644
171
--- a/hw/cpu/a15mpcore.c
172
+++ b/hw/cpu/a15mpcore.c
173
@@ -XXX,XX +XXX,XX @@
174
#include "hw/qdev-properties.h"
175
#include "sysemu/kvm.h"
176
#include "kvm_arm.h"
177
+#include "target/arm/gtimer.h"
178
179
static void a15mp_priv_set_irq(void *opaque, int irq, int level)
180
{
181
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
182
index XXXXXXX..XXXXXXX 100644
183
--- a/target/arm/cpu.c
184
+++ b/target/arm/cpu.c
185
@@ -XXX,XX +XXX,XX @@
186
#include "fpu/softfloat.h"
187
#include "cpregs.h"
188
#include "target/arm/cpu-qom.h"
189
+#include "target/arm/gtimer.h"
190
191
static void arm_cpu_set_pc(CPUState *cs, vaddr value)
192
{
193
diff --git a/target/arm/helper.c b/target/arm/helper.c
194
index XXXXXXX..XXXXXXX 100644
195
--- a/target/arm/helper.c
196
+++ b/target/arm/helper.c
197
@@ -XXX,XX +XXX,XX @@
198
#include "semihosting/common-semi.h"
199
#endif
200
#include "cpregs.h"
201
+#include "target/arm/gtimer.h"
202
203
#define ARM_CPU_FREQ 1000000000 /* FIXME: 1 GHz, should be configurable */
204
205
diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c
206
index XXXXXXX..XXXXXXX 100644
207
--- a/target/arm/hvf/hvf.c
208
+++ b/target/arm/hvf/hvf.c
209
@@ -XXX,XX +XXX,XX @@
210
#include "target/arm/cpu.h"
211
#include "target/arm/internals.h"
212
#include "target/arm/multiprocessing.h"
213
+#include "target/arm/gtimer.h"
214
#include "trace/trace-target_arm_hvf.h"
215
#include "migration/vmstate.h"
216
217
diff --git a/target/arm/kvm.c b/target/arm/kvm.c
218
index XXXXXXX..XXXXXXX 100644
219
--- a/target/arm/kvm.c
220
+++ b/target/arm/kvm.c
221
@@ -XXX,XX +XXX,XX @@
222
#include "qemu/log.h"
223
#include "hw/acpi/acpi.h"
224
#include "hw/acpi/ghes.h"
225
+#include "target/arm/gtimer.h"
226
227
const KVMCapabilityInfo kvm_arch_required_capabilities[] = {
228
KVM_CAP_LAST_INFO
229
diff --git a/target/arm/machine.c b/target/arm/machine.c
230
index XXXXXXX..XXXXXXX 100644
231
--- a/target/arm/machine.c
232
+++ b/target/arm/machine.c
233
@@ -XXX,XX +XXX,XX @@
234
#include "internals.h"
235
#include "cpu-features.h"
236
#include "migration/cpu.h"
237
+#include "target/arm/gtimer.h"
238
239
static bool vfp_needed(void *opaque)
240
{
241
--
515
--
242
2.34.1
516
2.34.1
243
244
diff view generated by jsdifflib
1
From: Rayhan Faizel <rayhan.faizel@gmail.com>
1
From: Bernhard Beschow <shentey@gmail.com>
2
2
3
This patch implements a 32 half word FIFO as per imx serial device
3
imx_fec models the same PHY as lan9118_phy. The code is almost the same with
4
specifications. If a non empty FIFO is below the trigger level, an
4
imx_fec having more logging and tracing. Merge these improvements into
5
ageing timer will tick for a duration of 8 characters. On expiry,
5
lan9118_phy and reuse in imx_fec to fix the code duplication.
6
AGTIM will be set triggering an interrupt. AGTIM timer resets when
7
there is activity in the receive FIFO.
8
6
9
Otherwise, RRDY is set when trigger level is exceeded. The receive
7
Some migration state how resides in the new device model which breaks migration
10
trigger level is 8 in newer kernel versions and 1 in older ones.
8
compatibility for the following machines:
9
* imx25-pdk
10
* sabrelite
11
* mcimx7d-sabre
12
* mcimx6ul-evk
11
13
12
This change will break migration compatibility for the imx boards.
14
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
13
15
Tested-by: Guenter Roeck <linux@roeck-us.net>
14
Signed-off-by: Rayhan Faizel <rayhan.faizel@gmail.com>
15
Message-id: 20240125151931.83494-1-rayhan.faizel@gmail.com
16
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
16
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
17
[PMM: commit message tidyups]
17
Message-id: 20241102125724.532843-3-shentey@gmail.com
18
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
18
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
19
---
19
---
20
include/hw/char/imx_serial.h | 20 ++++++-
20
include/hw/net/imx_fec.h | 9 ++-
21
hw/char/imx_serial.c | 102 ++++++++++++++++++++++++++++++-----
21
hw/net/imx_fec.c | 146 ++++-----------------------------------
22
2 files changed, 108 insertions(+), 14 deletions(-)
22
hw/net/lan9118_phy.c | 82 ++++++++++++++++------
23
hw/net/Kconfig | 1 +
24
hw/net/trace-events | 10 +--
25
5 files changed, 85 insertions(+), 163 deletions(-)
23
26
24
diff --git a/include/hw/char/imx_serial.h b/include/hw/char/imx_serial.h
27
diff --git a/include/hw/net/imx_fec.h b/include/hw/net/imx_fec.h
25
index XXXXXXX..XXXXXXX 100644
28
index XXXXXXX..XXXXXXX 100644
26
--- a/include/hw/char/imx_serial.h
29
--- a/include/hw/net/imx_fec.h
27
+++ b/include/hw/char/imx_serial.h
30
+++ b/include/hw/net/imx_fec.h
28
@@ -XXX,XX +XXX,XX @@
31
@@ -XXX,XX +XXX,XX @@ OBJECT_DECLARE_SIMPLE_TYPE(IMXFECState, IMX_FEC)
32
#define TYPE_IMX_ENET "imx.enet"
33
29
#include "hw/sysbus.h"
34
#include "hw/sysbus.h"
30
#include "chardev/char-fe.h"
35
+#include "hw/net/lan9118_phy.h"
31
#include "qom/object.h"
36
+#include "hw/irq.h"
32
+#include "qemu/fifo32.h"
37
#include "net/net.h"
33
38
34
#define TYPE_IMX_SERIAL "imx.serial"
39
#define ENET_EIR 1
35
OBJECT_DECLARE_SIMPLE_TYPE(IMXSerialState, IMX_SERIAL)
40
@@ -XXX,XX +XXX,XX @@ struct IMXFECState {
36
41
uint32_t tx_descriptor[ENET_TX_RING_NUM];
37
+#define FIFO_SIZE 32
42
uint32_t tx_ring_num;
38
+
43
39
#define URXD_CHARRDY (1<<15) /* character read is valid */
44
- uint32_t phy_status;
40
#define URXD_ERR (1<<14) /* Character has error */
45
- uint32_t phy_control;
41
+#define URXD_OVRRUN (1<<13) /* 32nd character in RX FIFO */
46
- uint32_t phy_advertise;
42
#define URXD_FRMERR (1<<12) /* Character has frame error */
47
- uint32_t phy_int;
43
#define URXD_BRK (1<<11) /* Break received */
48
- uint32_t phy_int_mask;
44
49
+ Lan9118PhyState mii;
45
@@ -XXX,XX +XXX,XX @@ OBJECT_DECLARE_SIMPLE_TYPE(IMXSerialState, IMX_SERIAL)
50
+ IRQState mii_irq;
46
#define UCR1_TXMPTYEN (1<<6) /* Tx Empty Interrupt Enable */
51
uint32_t phy_num;
47
#define UCR1_UARTEN (1<<0) /* UART Enable */
52
bool phy_connected;
48
53
struct IMXFECState *phy_consumer;
49
+#define UCR2_ATEN (1<<3) /* Ageing Timer Enable */
54
diff --git a/hw/net/imx_fec.c b/hw/net/imx_fec.c
50
#define UCR2_TXEN (1<<2) /* Transmitter enable */
51
#define UCR2_RXEN (1<<1) /* Receiver enable */
52
#define UCR2_SRST (1<<0) /* Reset complete */
53
54
#define UCR4_DREN BIT(0) /* Receive Data Ready interrupt enable */
55
+#define UCR4_OREN BIT(1) /* Overrun interrupt enable */
56
#define UCR4_TCEN BIT(3) /* TX complete interrupt enable */
57
#define UCR4_WKEN BIT(7) /* WAKE interrupt enable */
58
59
@@ -XXX,XX +XXX,XX @@ OBJECT_DECLARE_SIMPLE_TYPE(IMXSerialState, IMX_SERIAL)
60
#define UTS1_TXFULL (1<<4)
61
#define UTS1_RXFULL (1<<3)
62
63
+#define TL_MASK 0x3f
64
+
65
+ /* Bit time in nanoseconds assuming maximum baud rate of 115200 */
66
+#define BIT_TIME_NS 8681
67
+
68
+/* Assume 8 bits per character */
69
+#define NUM_BITS 8
70
+
71
+/* Ageing timer triggers after 8 characters */
72
+#define AGE_DURATION_NS (8 * NUM_BITS * BIT_TIME_NS)
73
+
74
struct IMXSerialState {
75
/*< private >*/
76
SysBusDevice parent_obj;
77
78
/*< public >*/
79
MemoryRegion iomem;
80
- int32_t readbuff;
81
+ QEMUTimer ageing_timer;
82
+ Fifo32 rx_fifo;
83
84
uint32_t usr1;
85
uint32_t usr2;
86
diff --git a/hw/char/imx_serial.c b/hw/char/imx_serial.c
87
index XXXXXXX..XXXXXXX 100644
55
index XXXXXXX..XXXXXXX 100644
88
--- a/hw/char/imx_serial.c
56
--- a/hw/net/imx_fec.c
89
+++ b/hw/char/imx_serial.c
57
+++ b/hw/net/imx_fec.c
90
@@ -XXX,XX +XXX,XX @@
58
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_imx_eth_txdescs = {
91
#include "migration/vmstate.h"
59
92
#include "qemu/log.h"
60
static const VMStateDescription vmstate_imx_eth = {
93
#include "qemu/module.h"
61
.name = TYPE_IMX_FEC,
94
+#include "qemu/fifo32.h"
95
96
#ifndef DEBUG_IMX_UART
97
#define DEBUG_IMX_UART 0
98
@@ -XXX,XX +XXX,XX @@
99
100
static const VMStateDescription vmstate_imx_serial = {
101
.name = TYPE_IMX_SERIAL,
102
- .version_id = 2,
62
- .version_id = 2,
103
- .minimum_version_id = 2,
63
- .minimum_version_id = 2,
104
+ .version_id = 3,
64
+ .version_id = 3,
105
+ .minimum_version_id = 3,
65
+ .minimum_version_id = 3,
106
.fields = (const VMStateField[]) {
66
.fields = (const VMStateField[]) {
107
- VMSTATE_INT32(readbuff, IMXSerialState),
67
VMSTATE_UINT32_ARRAY(regs, IMXFECState, ENET_MAX),
108
+ VMSTATE_FIFO32(rx_fifo, IMXSerialState),
68
VMSTATE_UINT32(rx_descriptor, IMXFECState),
109
+ VMSTATE_TIMER(ageing_timer, IMXSerialState),
69
VMSTATE_UINT32(tx_descriptor[0], IMXFECState),
110
VMSTATE_UINT32(usr1, IMXSerialState),
70
- VMSTATE_UINT32(phy_status, IMXFECState),
111
VMSTATE_UINT32(usr2, IMXSerialState),
71
- VMSTATE_UINT32(phy_control, IMXFECState),
112
VMSTATE_UINT32(ucr1, IMXSerialState),
72
- VMSTATE_UINT32(phy_advertise, IMXFECState),
113
@@ -XXX,XX +XXX,XX @@ static void imx_update(IMXSerialState *s)
73
- VMSTATE_UINT32(phy_int, IMXFECState),
114
* following:
74
- VMSTATE_UINT32(phy_int_mask, IMXFECState),
115
*/
75
VMSTATE_END_OF_LIST()
116
usr1 = s->usr1 & s->ucr1 & (USR1_TRDY | USR1_RRDY);
76
},
117
+ /*
77
.subsections = (const VMStateDescription * const []) {
118
+ * Interrupt if AGTIM is set (ageing timer interrupt in RxFIFO)
78
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_imx_eth = {
119
+ */
79
},
120
+ usr1 |= (s->ucr2 & UCR2_ATEN) ? (s->usr1 & USR1_AGTIM) : 0;
80
};
121
/*
81
122
* Bits that we want in USR2 are not as conveniently laid out,
82
-#define PHY_INT_ENERGYON (1 << 7)
123
* unfortunately.
83
-#define PHY_INT_AUTONEG_COMPLETE (1 << 6)
124
@@ -XXX,XX +XXX,XX @@ static void imx_update(IMXSerialState *s)
84
-#define PHY_INT_FAULT (1 << 5)
125
mask = (s->ucr1 & UCR1_TXMPTYEN) ? USR2_TXFE : 0;
85
-#define PHY_INT_DOWN (1 << 4)
126
/*
86
-#define PHY_INT_AUTONEG_LP (1 << 3)
127
* TCEN and TXDC are both bit 3
87
-#define PHY_INT_PARFAULT (1 << 2)
128
+ * ORE and OREN are both bit 1
88
-#define PHY_INT_AUTONEG_PAGE (1 << 1)
129
* RDR and DREN are both bit 0
89
-
130
*/
90
static void imx_eth_update(IMXFECState *s);
131
- mask |= s->ucr4 & (UCR4_WKEN | UCR4_TCEN | UCR4_DREN);
91
132
+ mask |= s->ucr4 & (UCR4_WKEN | UCR4_TCEN | UCR4_DREN | UCR4_OREN);
92
/*
133
93
@@ -XXX,XX +XXX,XX @@ static void imx_eth_update(IMXFECState *s);
134
usr2 = s->usr2 & mask;
94
* For now we don't handle any GPIO/interrupt line, so the OS will
135
95
* have to poll for the PHY status.
136
qemu_set_irq(s->irq, usr1 || usr2);
96
*/
137
}
97
-static void imx_phy_update_irq(IMXFECState *s)
138
98
+static void imx_phy_update_irq(void *opaque, int n, int level)
139
+static void imx_serial_rx_fifo_push(IMXSerialState *s, uint32_t value)
99
{
140
+{
100
- imx_eth_update(s);
141
+ uint32_t pushed_value = value;
101
-}
142
+ if (fifo32_is_full(&s->rx_fifo)) {
102
-
143
+ /* Set ORE if FIFO is already full */
103
-static void imx_phy_update_link(IMXFECState *s)
144
+ s->usr2 |= USR2_ORE;
104
-{
145
+ } else {
105
- /* Autonegotiation status mirrors link status. */
146
+ if (fifo32_num_used(&s->rx_fifo) == FIFO_SIZE - 1) {
106
- if (qemu_get_queue(s->nic)->link_down) {
147
+ /* Set OVRRUN on 32nd character in FIFO */
107
- trace_imx_phy_update_link("down");
148
+ pushed_value |= URXD_ERR | URXD_OVRRUN;
108
- s->phy_status &= ~0x0024;
149
+ }
109
- s->phy_int |= PHY_INT_DOWN;
150
+ fifo32_push(&s->rx_fifo, pushed_value);
110
- } else {
111
- trace_imx_phy_update_link("up");
112
- s->phy_status |= 0x0024;
113
- s->phy_int |= PHY_INT_ENERGYON;
114
- s->phy_int |= PHY_INT_AUTONEG_COMPLETE;
115
- }
116
- imx_phy_update_irq(s);
117
+ imx_eth_update(opaque);
118
}
119
120
static void imx_eth_set_link(NetClientState *nc)
121
{
122
- imx_phy_update_link(IMX_FEC(qemu_get_nic_opaque(nc)));
123
-}
124
-
125
-static void imx_phy_reset(IMXFECState *s)
126
-{
127
- trace_imx_phy_reset();
128
-
129
- s->phy_status = 0x7809;
130
- s->phy_control = 0x3000;
131
- s->phy_advertise = 0x01e1;
132
- s->phy_int_mask = 0;
133
- s->phy_int = 0;
134
- imx_phy_update_link(s);
135
+ lan9118_phy_update_link(&IMX_FEC(qemu_get_nic_opaque(nc))->mii,
136
+ nc->link_down);
137
}
138
139
static uint32_t imx_phy_read(IMXFECState *s, int reg)
140
{
141
- uint32_t val;
142
uint32_t phy = reg / 32;
143
144
if (!s->phy_connected) {
145
@@ -XXX,XX +XXX,XX @@ static uint32_t imx_phy_read(IMXFECState *s, int reg)
146
147
reg %= 32;
148
149
- switch (reg) {
150
- case 0: /* Basic Control */
151
- val = s->phy_control;
152
- break;
153
- case 1: /* Basic Status */
154
- val = s->phy_status;
155
- break;
156
- case 2: /* ID1 */
157
- val = 0x0007;
158
- break;
159
- case 3: /* ID2 */
160
- val = 0xc0d1;
161
- break;
162
- case 4: /* Auto-neg advertisement */
163
- val = s->phy_advertise;
164
- break;
165
- case 5: /* Auto-neg Link Partner Ability */
166
- val = 0x0f71;
167
- break;
168
- case 6: /* Auto-neg Expansion */
169
- val = 1;
170
- break;
171
- case 29: /* Interrupt source. */
172
- val = s->phy_int;
173
- s->phy_int = 0;
174
- imx_phy_update_irq(s);
175
- break;
176
- case 30: /* Interrupt mask */
177
- val = s->phy_int_mask;
178
- break;
179
- case 17:
180
- case 18:
181
- case 27:
182
- case 31:
183
- qemu_log_mask(LOG_UNIMP, "[%s.phy]%s: reg %d not implemented\n",
184
- TYPE_IMX_FEC, __func__, reg);
185
- val = 0;
186
- break;
187
- default:
188
- qemu_log_mask(LOG_GUEST_ERROR, "[%s.phy]%s: Bad address at offset %d\n",
189
- TYPE_IMX_FEC, __func__, reg);
190
- val = 0;
191
- break;
192
- }
193
-
194
- trace_imx_phy_read(val, phy, reg);
195
-
196
- return val;
197
+ return lan9118_phy_read(&s->mii, reg);
198
}
199
200
static void imx_phy_write(IMXFECState *s, int reg, uint32_t val)
201
@@ -XXX,XX +XXX,XX @@ static void imx_phy_write(IMXFECState *s, int reg, uint32_t val)
202
203
reg %= 32;
204
205
- trace_imx_phy_write(val, phy, reg);
206
-
207
- switch (reg) {
208
- case 0: /* Basic Control */
209
- if (val & 0x8000) {
210
- imx_phy_reset(s);
211
- } else {
212
- s->phy_control = val & 0x7980;
213
- /* Complete autonegotiation immediately. */
214
- if (val & 0x1000) {
215
- s->phy_status |= 0x0020;
216
- }
217
- }
218
- break;
219
- case 4: /* Auto-neg advertisement */
220
- s->phy_advertise = (val & 0x2d7f) | 0x80;
221
- break;
222
- case 30: /* Interrupt mask */
223
- s->phy_int_mask = val & 0xff;
224
- imx_phy_update_irq(s);
225
- break;
226
- case 17:
227
- case 18:
228
- case 27:
229
- case 31:
230
- qemu_log_mask(LOG_UNIMP, "[%s.phy)%s: reg %d not implemented\n",
231
- TYPE_IMX_FEC, __func__, reg);
232
- break;
233
- default:
234
- qemu_log_mask(LOG_GUEST_ERROR, "[%s.phy]%s: Bad address at offset %d\n",
235
- TYPE_IMX_FEC, __func__, reg);
236
- break;
237
- }
238
+ lan9118_phy_write(&s->mii, reg, val);
239
}
240
241
static void imx_fec_read_bd(IMXFECBufDesc *bd, dma_addr_t addr)
242
@@ -XXX,XX +XXX,XX @@ static void imx_eth_reset(DeviceState *d)
243
244
s->rx_descriptor = 0;
245
memset(s->tx_descriptor, 0, sizeof(s->tx_descriptor));
246
-
247
- /* We also reset the PHY */
248
- imx_phy_reset(s);
249
}
250
251
static uint32_t imx_default_read(IMXFECState *s, uint32_t index)
252
@@ -XXX,XX +XXX,XX @@ static void imx_eth_realize(DeviceState *dev, Error **errp)
253
sysbus_init_irq(sbd, &s->irq[0]);
254
sysbus_init_irq(sbd, &s->irq[1]);
255
256
+ qemu_init_irq(&s->mii_irq, imx_phy_update_irq, s, 0);
257
+ object_initialize_child(OBJECT(s), "mii", &s->mii, TYPE_LAN9118_PHY);
258
+ if (!sysbus_realize_and_unref(SYS_BUS_DEVICE(&s->mii), errp)) {
259
+ return;
151
+ }
260
+ }
152
+}
261
+ qdev_connect_gpio_out(DEVICE(&s->mii), 0, &s->mii_irq);
153
+
262
+
154
+static uint32_t imx_serial_rx_fifo_pop(IMXSerialState *s)
263
qemu_macaddr_default_if_unset(&s->conf.macaddr);
155
+{
264
156
+ if (fifo32_is_empty(&s->rx_fifo)) {
265
s->nic = qemu_new_nic(&imx_eth_net_info, &s->conf,
157
+ return 0;
266
diff --git a/hw/net/lan9118_phy.c b/hw/net/lan9118_phy.c
158
+ }
267
index XXXXXXX..XXXXXXX 100644
159
+ return fifo32_pop(&s->rx_fifo);
268
--- a/hw/net/lan9118_phy.c
160
+}
269
+++ b/hw/net/lan9118_phy.c
161
+
270
@@ -XXX,XX +XXX,XX @@
162
+static void imx_serial_rx_fifo_ageing_timer_int(void *opaque)
271
* Copyright (c) 2009 CodeSourcery, LLC.
163
+{
272
* Written by Paul Brook
164
+ IMXSerialState *s = (IMXSerialState *) opaque;
273
*
165
+ s->usr1 |= USR1_AGTIM;
274
+ * Copyright (c) 2013 Jean-Christophe Dubois. <jcd@tribudubois.net>
166
+ imx_update(s);
275
+ *
167
+}
276
* This code is licensed under the GNU GPL v2
168
+
277
*
169
+static void imx_serial_rx_fifo_ageing_timer_restart(void *opaque)
278
* Contributions after 2012-01-13 are licensed under the terms of the
170
+{
279
@@ -XXX,XX +XXX,XX @@
171
+ /*
280
#include "hw/resettable.h"
172
+ * Ageing timer starts ticking when
281
#include "migration/vmstate.h"
173
+ * RX FIFO is non empty and below trigger level.
282
#include "qemu/log.h"
174
+ * Timer is reset if new character is received or
283
+#include "trace.h"
175
+ * a FIFO read occurs.
284
176
+ * Timer triggers an interrupt when duration of
285
#define PHY_INT_ENERGYON (1 << 7)
177
+ * 8 characters has passed (assuming 115200 baudrate).
286
#define PHY_INT_AUTONEG_COMPLETE (1 << 6)
178
+ */
287
@@ -XXX,XX +XXX,XX @@ uint16_t lan9118_phy_read(Lan9118PhyState *s, int reg)
179
+ IMXSerialState *s = (IMXSerialState *) opaque;
288
180
+
289
switch (reg) {
181
+ if (!(s->usr1 & USR1_RRDY) && !(s->uts1 & UTS1_RXEMPTY)) {
290
case 0: /* Basic Control */
182
+ timer_mod_ns(&s->ageing_timer,
291
- return s->control;
183
+ qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + AGE_DURATION_NS);
292
+ val = s->control;
184
+ } else {
293
+ break;
185
+ timer_del(&s->ageing_timer);
294
case 1: /* Basic Status */
186
+ }
295
- return s->status;
187
+}
296
+ val = s->status;
188
+
297
+ break;
189
static void imx_serial_reset(IMXSerialState *s)
298
case 2: /* ID1 */
299
- return 0x0007;
300
+ val = 0x0007;
301
+ break;
302
case 3: /* ID2 */
303
- return 0xc0d1;
304
+ val = 0xc0d1;
305
+ break;
306
case 4: /* Auto-neg advertisement */
307
- return s->advertise;
308
+ val = s->advertise;
309
+ break;
310
case 5: /* Auto-neg Link Partner Ability */
311
- return 0x0f71;
312
+ val = 0x0f71;
313
+ break;
314
case 6: /* Auto-neg Expansion */
315
- return 1;
316
- /* TODO 17, 18, 27, 29, 30, 31 */
317
+ val = 1;
318
+ break;
319
case 29: /* Interrupt source. */
320
val = s->ints;
321
s->ints = 0;
322
lan9118_phy_update_irq(s);
323
- return val;
324
+ break;
325
case 30: /* Interrupt mask */
326
- return s->int_mask;
327
+ val = s->int_mask;
328
+ break;
329
+ case 17:
330
+ case 18:
331
+ case 27:
332
+ case 31:
333
+ qemu_log_mask(LOG_UNIMP, "%s: reg %d not implemented\n",
334
+ __func__, reg);
335
+ val = 0;
336
+ break;
337
default:
338
- qemu_log_mask(LOG_GUEST_ERROR,
339
- "lan9118_phy_read: PHY read reg %d\n", reg);
340
- return 0;
341
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad address at offset %d\n",
342
+ __func__, reg);
343
+ val = 0;
344
+ break;
345
}
346
+
347
+ trace_lan9118_phy_read(val, reg);
348
+
349
+ return val;
350
}
351
352
void lan9118_phy_write(Lan9118PhyState *s, int reg, uint16_t val)
190
{
353
{
191
354
+ trace_lan9118_phy_write(val, reg);
192
@@ -XXX,XX +XXX,XX @@ static void imx_serial_reset(IMXSerialState *s)
355
+
193
s->ucr3 = 0x700;
356
switch (reg) {
194
s->ubmr = 0;
357
case 0: /* Basic Control */
195
s->ubrc = 4;
358
if (val & 0x8000) {
196
- s->readbuff = URXD_ERR;
359
lan9118_phy_reset(s);
197
+
360
- break;
198
+ fifo32_reset(&s->rx_fifo);
361
- }
199
+ timer_del(&s->ageing_timer);
362
- s->control = val & 0x7980;
200
}
363
- /* Complete autonegotiation immediately. */
201
364
- if (val & 0x1000) {
202
static void imx_serial_reset_at_boot(DeviceState *dev)
365
- s->status |= 0x0020;
203
@@ -XXX,XX +XXX,XX @@ static uint64_t imx_serial_read(void *opaque, hwaddr offset,
366
+ } else {
204
unsigned size)
367
+ s->control = val & 0x7980;
368
+ /* Complete autonegotiation immediately. */
369
+ if (val & 0x1000) {
370
+ s->status |= 0x0020;
371
+ }
372
}
373
break;
374
case 4: /* Auto-neg advertisement */
375
s->advertise = (val & 0x2d7f) | 0x80;
376
break;
377
- /* TODO 17, 18, 27, 31 */
378
case 30: /* Interrupt mask */
379
s->int_mask = val & 0xff;
380
lan9118_phy_update_irq(s);
381
break;
382
+ case 17:
383
+ case 18:
384
+ case 27:
385
+ case 31:
386
+ qemu_log_mask(LOG_UNIMP, "%s: reg %d not implemented\n",
387
+ __func__, reg);
388
+ break;
389
default:
390
- qemu_log_mask(LOG_GUEST_ERROR,
391
- "lan9118_phy_write: PHY write reg %d = 0x%04x\n", reg, val);
392
+ qemu_log_mask(LOG_GUEST_ERROR, "%s: Bad address at offset %d\n",
393
+ __func__, reg);
394
+ break;
395
}
396
}
397
398
@@ -XXX,XX +XXX,XX @@ void lan9118_phy_update_link(Lan9118PhyState *s, bool link_down)
399
400
/* Autonegotiation status mirrors link status. */
401
if (link_down) {
402
+ trace_lan9118_phy_update_link("down");
403
s->status &= ~0x0024;
404
s->ints |= PHY_INT_DOWN;
405
} else {
406
+ trace_lan9118_phy_update_link("up");
407
s->status |= 0x0024;
408
s->ints |= PHY_INT_ENERGYON;
409
s->ints |= PHY_INT_AUTONEG_COMPLETE;
410
@@ -XXX,XX +XXX,XX @@ void lan9118_phy_update_link(Lan9118PhyState *s, bool link_down)
411
412
void lan9118_phy_reset(Lan9118PhyState *s)
205
{
413
{
206
IMXSerialState *s = (IMXSerialState *)opaque;
414
+ trace_lan9118_phy_reset();
207
- uint32_t c;
415
+
208
+ uint32_t c, rx_used;
416
s->control = 0x3000;
209
+ uint8_t rxtl = s->ufcr & TL_MASK;
417
s->status = 0x7809;
210
418
s->advertise = 0x01e1;
211
DPRINTF("read(offset=0x%" HWADDR_PRIx ")\n", offset);
419
@@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_lan9118_phy = {
212
420
.version_id = 1,
213
switch (offset >> 2) {
421
.minimum_version_id = 1,
214
case 0x0: /* URXD */
422
.fields = (const VMStateField[]) {
215
- c = s->readbuff;
423
- VMSTATE_UINT16(control, Lan9118PhyState),
216
+ c = imx_serial_rx_fifo_pop(s);
424
VMSTATE_UINT16(status, Lan9118PhyState),
217
if (!(s->uts1 & UTS1_RXEMPTY)) {
425
+ VMSTATE_UINT16(control, Lan9118PhyState),
218
/* Character is valid */
426
VMSTATE_UINT16(advertise, Lan9118PhyState),
219
c |= URXD_CHARRDY;
427
VMSTATE_UINT16(ints, Lan9118PhyState),
220
- s->usr1 &= ~USR1_RRDY;
428
VMSTATE_UINT16(int_mask, Lan9118PhyState),
221
- s->usr2 &= ~USR2_RDR;
429
diff --git a/hw/net/Kconfig b/hw/net/Kconfig
222
- s->uts1 |= UTS1_RXEMPTY;
430
index XXXXXXX..XXXXXXX 100644
223
+ rx_used = fifo32_num_used(&s->rx_fifo);
431
--- a/hw/net/Kconfig
224
+ /* Clear RRDY if below threshold */
432
+++ b/hw/net/Kconfig
225
+ if (rx_used < rxtl) {
433
@@ -XXX,XX +XXX,XX @@ config ALLWINNER_SUN8I_EMAC
226
+ s->usr1 &= ~USR1_RRDY;
434
227
+ }
435
config IMX_FEC
228
+ if (rx_used == 0) {
436
bool
229
+ s->usr2 &= ~USR2_RDR;
437
+ select LAN9118_PHY
230
+ s->uts1 |= UTS1_RXEMPTY;
438
231
+ }
439
config CADENCE
232
imx_update(s);
440
bool
233
+ imx_serial_rx_fifo_ageing_timer_restart(s);
441
diff --git a/hw/net/trace-events b/hw/net/trace-events
234
qemu_chr_fe_accept_input(&s->chr);
442
index XXXXXXX..XXXXXXX 100644
235
}
443
--- a/hw/net/trace-events
236
return c;
444
+++ b/hw/net/trace-events
237
@@ -XXX,XX +XXX,XX @@ static void imx_serial_write(void *opaque, hwaddr offset,
445
@@ -XXX,XX +XXX,XX @@ allwinner_sun8i_emac_set_link(bool active) "Set link: active=%u"
238
static int imx_can_receive(void *opaque)
446
allwinner_sun8i_emac_read(uint64_t offset, uint64_t val) "MMIO read: offset=0x%" PRIx64 " value=0x%" PRIx64
239
{
447
allwinner_sun8i_emac_write(uint64_t offset, uint64_t val) "MMIO write: offset=0x%" PRIx64 " value=0x%" PRIx64
240
IMXSerialState *s = (IMXSerialState *)opaque;
448
241
- return !(s->usr1 & USR1_RRDY);
449
+# lan9118_phy.c
242
+ return s->ucr2 & UCR2_RXEN && fifo32_num_used(&s->rx_fifo) < FIFO_SIZE;
450
+lan9118_phy_read(uint16_t val, int reg) "[0x%02x] -> 0x%04" PRIx16
243
}
451
+lan9118_phy_write(uint16_t val, int reg) "[0x%02x] <- 0x%04" PRIx16
244
452
+lan9118_phy_update_link(const char *s) "%s"
245
static void imx_put_data(void *opaque, uint32_t value)
453
+lan9118_phy_reset(void) ""
246
{
454
+
247
IMXSerialState *s = (IMXSerialState *)opaque;
455
# lance.c
248
+ uint8_t rxtl = s->ufcr & TL_MASK;
456
lance_mem_readw(uint64_t addr, uint32_t ret) "addr=0x%"PRIx64"val=0x%04x"
249
457
lance_mem_writew(uint64_t addr, uint32_t val) "addr=0x%"PRIx64"val=0x%04x"
250
DPRINTF("received char\n");
458
@@ -XXX,XX +XXX,XX @@ i82596_set_multicast(uint16_t count) "Added %d multicast entries"
251
+ imx_serial_rx_fifo_push(s, value);
459
i82596_channel_attention(void *s) "%p: Received CHANNEL ATTENTION"
252
+ if (fifo32_num_used(&s->rx_fifo) >= rxtl) {
460
253
+ s->usr1 |= USR1_RRDY;
461
# imx_fec.c
254
+ }
462
-imx_phy_read(uint32_t val, int phy, int reg) "0x%04"PRIx32" <= phy[%d].reg[%d]"
255
+
463
imx_phy_read_num(int phy, int configured) "read request from unconfigured phy %d (configured %d)"
256
+ imx_serial_rx_fifo_ageing_timer_restart(s);
464
-imx_phy_write(uint32_t val, int phy, int reg) "0x%04"PRIx32" => phy[%d].reg[%d]"
257
465
imx_phy_write_num(int phy, int configured) "write request to unconfigured phy %d (configured %d)"
258
- s->usr1 |= USR1_RRDY;
466
-imx_phy_update_link(const char *s) "%s"
259
s->usr2 |= USR2_RDR;
467
-imx_phy_reset(void) ""
260
s->uts1 &= ~UTS1_RXEMPTY;
468
imx_fec_read_bd(uint64_t addr, int flags, int len, int data) "tx_bd 0x%"PRIx64" flags 0x%04x len %d data 0x%08x"
261
- s->readbuff = value;
469
imx_enet_read_bd(uint64_t addr, int flags, int len, int data, int options, int status) "tx_bd 0x%"PRIx64" flags 0x%04x len %d data 0x%08x option 0x%04x status 0x%04x"
262
if (value & URXD_BRK) {
470
imx_eth_tx_bd_busy(void) "tx_bd ran out of descriptors to transmit"
263
s->usr2 |= USR2_BRCD;
264
}
265
@@ -XXX,XX +XXX,XX @@ static void imx_serial_realize(DeviceState *dev, Error **errp)
266
{
267
IMXSerialState *s = IMX_SERIAL(dev);
268
269
+ fifo32_create(&s->rx_fifo, FIFO_SIZE);
270
+ timer_init_ns(&s->ageing_timer, QEMU_CLOCK_VIRTUAL,
271
+ imx_serial_rx_fifo_ageing_timer_int, s);
272
+
273
DPRINTF("char dev for uart: %p\n", qemu_chr_fe_get_driver(&s->chr));
274
275
qemu_chr_fe_set_handlers(&s->chr, imx_can_receive, imx_receive,
276
--
471
--
277
2.34.1
472
2.34.1
diff view generated by jsdifflib
1
From: Gustavo Romero <gustavo.romero@linaro.org>
1
From: Bernhard Beschow <shentey@gmail.com>
2
2
3
Add a note on CPU features that are off by default in `virt` machines.
3
Turns 0x70 into 0xe0 (== 0x70 << 1) which adds the missing MII_ANLPAR_TX and
4
Some CPU features will remain off even if a CPU-capable CPU (e.g.,
4
fixes the MSB of selector field to be zero, as specified in the datasheet.
5
`-cpu max`) is selected because they require support in both the CPU
6
itself and in the wider system. Therefore, the user, besides selecting a
7
CPU that supports such features, must also turn on the feature using a
8
machine option.
9
5
10
Signed-off-by: Gustavo Romero <gustavo.romero@linaro.org>
6
Fixes: 2a424990170b "LAN9118 emulation"
11
Message-id: 20240122211215.95073-1-gustavo.romero@linaro.org
7
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
8
Tested-by: Guenter Roeck <linux@roeck-us.net>
12
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
10
Message-id: 20241102125724.532843-4-shentey@gmail.com
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
---
12
---
15
docs/system/arm/virt.rst | 13 +++++++++++++
13
hw/net/lan9118_phy.c | 2 +-
16
1 file changed, 13 insertions(+)
14
1 file changed, 1 insertion(+), 1 deletion(-)
17
15
18
diff --git a/docs/system/arm/virt.rst b/docs/system/arm/virt.rst
16
diff --git a/hw/net/lan9118_phy.c b/hw/net/lan9118_phy.c
19
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
20
--- a/docs/system/arm/virt.rst
18
--- a/hw/net/lan9118_phy.c
21
+++ b/docs/system/arm/virt.rst
19
+++ b/hw/net/lan9118_phy.c
22
@@ -XXX,XX +XXX,XX @@ Supported guest CPU types:
20
@@ -XXX,XX +XXX,XX @@ uint16_t lan9118_phy_read(Lan9118PhyState *s, int reg)
23
Note that the default is ``cortex-a15``, so for an AArch64 guest you must
21
val = s->advertise;
24
specify a CPU type.
22
break;
25
23
case 5: /* Auto-neg Link Partner Ability */
26
+Also, please note that passing ``max`` CPU (i.e. ``-cpu max``) won't
24
- val = 0x0f71;
27
+enable all the CPU features for a given ``virt`` machine. Where a CPU
25
+ val = 0x0fe1;
28
+architectural feature requires support in both the CPU itself and in the
26
break;
29
+wider system (e.g. the MTE feature), it may not be enabled by default,
27
case 6: /* Auto-neg Expansion */
30
+but instead requires a machine option to enable it.
28
val = 1;
31
+
32
+For example, MTE support must be enabled with ``-machine virt,mte=on``,
33
+as well as by selecting an MTE-capable CPU (e.g., ``max``) with the
34
+``-cpu`` option.
35
+
36
+See the machine-specific options below, or check them for a given machine
37
+by passing the ``help`` suboption, like: ``-machine virt-9.0,help``.
38
+
39
Graphics output is available, but unlike the x86 PC machine types
40
there is no default display device enabled: you should select one from
41
the Display devices section of "-device help". The recommended option
42
--
29
--
43
2.34.1
30
2.34.1
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
1
From: Bernhard Beschow <shentey@gmail.com>
2
2
3
hw/arm/exynos4210.c calls tswap32() which is declared
3
Prefer named constants over magic values for better readability.
4
in "exec/tswap.h". Include it in order to avoid when
5
refactoring unrelated headers:
6
4
7
hw/arm/exynos4210.c:499:22: error: call to undeclared function 'tswap32';
5
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
6
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
9
smpboot[n] = tswap32(smpboot[n]);
7
Tested-by: Guenter Roeck <linux@roeck-us.net>
10
^
8
Message-id: 20241102125724.532843-5-shentey@gmail.com
11
12
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
13
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
14
Message-id: 20240118200643.29037-2-philmd@linaro.org
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
---
10
---
17
hw/arm/exynos4210.c | 1 +
11
include/hw/net/mii.h | 6 +++++
18
1 file changed, 1 insertion(+)
12
hw/net/lan9118_phy.c | 63 ++++++++++++++++++++++++++++----------------
13
2 files changed, 46 insertions(+), 23 deletions(-)
19
14
20
diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c
15
diff --git a/include/hw/net/mii.h b/include/hw/net/mii.h
21
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
22
--- a/hw/arm/exynos4210.c
17
--- a/include/hw/net/mii.h
23
+++ b/hw/arm/exynos4210.c
18
+++ b/include/hw/net/mii.h
24
@@ -XXX,XX +XXX,XX @@
19
@@ -XXX,XX +XXX,XX @@
20
#define MII_BMSR_JABBER (1 << 1) /* Jabber detected */
21
#define MII_BMSR_EXTCAP (1 << 0) /* Ext-reg capability */
22
23
+#define MII_ANAR_RFAULT (1 << 13) /* Say we can detect faults */
24
#define MII_ANAR_PAUSE_ASYM (1 << 11) /* Try for asymmetric pause */
25
#define MII_ANAR_PAUSE (1 << 10) /* Try for pause */
26
#define MII_ANAR_TXFD (1 << 8)
27
@@ -XXX,XX +XXX,XX @@
28
#define MII_ANAR_10FD (1 << 6)
29
#define MII_ANAR_10 (1 << 5)
30
#define MII_ANAR_CSMACD (1 << 0)
31
+#define MII_ANAR_SELECT (0x001f) /* Selector bits */
32
33
#define MII_ANLPAR_ACK (1 << 14)
34
#define MII_ANLPAR_PAUSEASY (1 << 11) /* can pause asymmetrically */
35
@@ -XXX,XX +XXX,XX @@
36
#define RTL8201CP_PHYID1 0x0000
37
#define RTL8201CP_PHYID2 0x8201
38
39
+/* SMSC LAN9118 */
40
+#define SMSCLAN9118_PHYID1 0x0007
41
+#define SMSCLAN9118_PHYID2 0xc0d1
42
+
43
/* RealTek 8211E */
44
#define RTL8211E_PHYID1 0x001c
45
#define RTL8211E_PHYID2 0xc915
46
diff --git a/hw/net/lan9118_phy.c b/hw/net/lan9118_phy.c
47
index XXXXXXX..XXXXXXX 100644
48
--- a/hw/net/lan9118_phy.c
49
+++ b/hw/net/lan9118_phy.c
50
@@ -XXX,XX +XXX,XX @@
25
51
26
#include "qemu/osdep.h"
52
#include "qemu/osdep.h"
27
#include "qapi/error.h"
53
#include "hw/net/lan9118_phy.h"
28
+#include "exec/tswap.h"
54
+#include "hw/net/mii.h"
29
#include "cpu.h"
30
#include "hw/cpu/a9mpcore.h"
31
#include "hw/irq.h"
55
#include "hw/irq.h"
56
#include "hw/resettable.h"
57
#include "migration/vmstate.h"
58
@@ -XXX,XX +XXX,XX @@ uint16_t lan9118_phy_read(Lan9118PhyState *s, int reg)
59
uint16_t val;
60
61
switch (reg) {
62
- case 0: /* Basic Control */
63
+ case MII_BMCR:
64
val = s->control;
65
break;
66
- case 1: /* Basic Status */
67
+ case MII_BMSR:
68
val = s->status;
69
break;
70
- case 2: /* ID1 */
71
- val = 0x0007;
72
+ case MII_PHYID1:
73
+ val = SMSCLAN9118_PHYID1;
74
break;
75
- case 3: /* ID2 */
76
- val = 0xc0d1;
77
+ case MII_PHYID2:
78
+ val = SMSCLAN9118_PHYID2;
79
break;
80
- case 4: /* Auto-neg advertisement */
81
+ case MII_ANAR:
82
val = s->advertise;
83
break;
84
- case 5: /* Auto-neg Link Partner Ability */
85
- val = 0x0fe1;
86
+ case MII_ANLPAR:
87
+ val = MII_ANLPAR_PAUSEASY | MII_ANLPAR_PAUSE | MII_ANLPAR_T4 |
88
+ MII_ANLPAR_TXFD | MII_ANLPAR_TX | MII_ANLPAR_10FD |
89
+ MII_ANLPAR_10 | MII_ANLPAR_CSMACD;
90
break;
91
- case 6: /* Auto-neg Expansion */
92
- val = 1;
93
+ case MII_ANER:
94
+ val = MII_ANER_NWAY;
95
break;
96
case 29: /* Interrupt source. */
97
val = s->ints;
98
@@ -XXX,XX +XXX,XX @@ void lan9118_phy_write(Lan9118PhyState *s, int reg, uint16_t val)
99
trace_lan9118_phy_write(val, reg);
100
101
switch (reg) {
102
- case 0: /* Basic Control */
103
- if (val & 0x8000) {
104
+ case MII_BMCR:
105
+ if (val & MII_BMCR_RESET) {
106
lan9118_phy_reset(s);
107
} else {
108
- s->control = val & 0x7980;
109
+ s->control = val & (MII_BMCR_LOOPBACK | MII_BMCR_SPEED100 |
110
+ MII_BMCR_AUTOEN | MII_BMCR_PDOWN | MII_BMCR_FD |
111
+ MII_BMCR_CTST);
112
/* Complete autonegotiation immediately. */
113
- if (val & 0x1000) {
114
- s->status |= 0x0020;
115
+ if (val & MII_BMCR_AUTOEN) {
116
+ s->status |= MII_BMSR_AN_COMP;
117
}
118
}
119
break;
120
- case 4: /* Auto-neg advertisement */
121
- s->advertise = (val & 0x2d7f) | 0x80;
122
+ case MII_ANAR:
123
+ s->advertise = (val & (MII_ANAR_RFAULT | MII_ANAR_PAUSE_ASYM |
124
+ MII_ANAR_PAUSE | MII_ANAR_10FD | MII_ANAR_10 |
125
+ MII_ANAR_SELECT))
126
+ | MII_ANAR_TX;
127
break;
128
case 30: /* Interrupt mask */
129
s->int_mask = val & 0xff;
130
@@ -XXX,XX +XXX,XX @@ void lan9118_phy_update_link(Lan9118PhyState *s, bool link_down)
131
/* Autonegotiation status mirrors link status. */
132
if (link_down) {
133
trace_lan9118_phy_update_link("down");
134
- s->status &= ~0x0024;
135
+ s->status &= ~(MII_BMSR_AN_COMP | MII_BMSR_LINK_ST);
136
s->ints |= PHY_INT_DOWN;
137
} else {
138
trace_lan9118_phy_update_link("up");
139
- s->status |= 0x0024;
140
+ s->status |= MII_BMSR_AN_COMP | MII_BMSR_LINK_ST;
141
s->ints |= PHY_INT_ENERGYON;
142
s->ints |= PHY_INT_AUTONEG_COMPLETE;
143
}
144
@@ -XXX,XX +XXX,XX @@ void lan9118_phy_reset(Lan9118PhyState *s)
145
{
146
trace_lan9118_phy_reset();
147
148
- s->control = 0x3000;
149
- s->status = 0x7809;
150
- s->advertise = 0x01e1;
151
+ s->control = MII_BMCR_AUTOEN | MII_BMCR_SPEED100;
152
+ s->status = MII_BMSR_100TX_FD
153
+ | MII_BMSR_100TX_HD
154
+ | MII_BMSR_10T_FD
155
+ | MII_BMSR_10T_HD
156
+ | MII_BMSR_AUTONEG
157
+ | MII_BMSR_EXTCAP;
158
+ s->advertise = MII_ANAR_TXFD
159
+ | MII_ANAR_TX
160
+ | MII_ANAR_10FD
161
+ | MII_ANAR_10
162
+ | MII_ANAR_CSMACD;
163
s->int_mask = 0;
164
s->ints = 0;
165
lan9118_phy_update_link(s, s->link_down);
32
--
166
--
33
2.34.1
167
2.34.1
34
35
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
1
From: Bernhard Beschow <shentey@gmail.com>
2
2
3
Various files in hw/arm/ don't require "cpu.h" anymore.
3
The real device advertises this mode and the device model already advertises
4
Except virt-acpi-build.c, all of them don't require any
4
100 mbps half duplex and 10 mbps full+half duplex. So advertise this mode to
5
ARM specific knowledge anymore and can be build once as
5
make the model more realistic.
6
target agnostic units. Update meson accordingly.
7
6
8
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
10
Message-id: 20240118200643.29037-21-philmd@linaro.org
9
Tested-by: Guenter Roeck <linux@roeck-us.net>
10
Message-id: 20241102125724.532843-6-shentey@gmail.com
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
---
12
---
13
hw/arm/collie.c | 1 -
13
hw/net/lan9118_phy.c | 4 ++--
14
hw/arm/gumstix.c | 1 -
14
1 file changed, 2 insertions(+), 2 deletions(-)
15
hw/arm/integratorcp.c | 1 -
16
hw/arm/mainstone.c | 1 -
17
hw/arm/musicpal.c | 1 -
18
hw/arm/omap2.c | 1 -
19
hw/arm/omap_sx1.c | 1 -
20
hw/arm/palm.c | 1 -
21
hw/arm/spitz.c | 1 -
22
hw/arm/strongarm.c | 1 -
23
hw/arm/versatilepb.c | 1 -
24
hw/arm/vexpress.c | 1 -
25
hw/arm/virt-acpi-build.c | 1 -
26
hw/arm/xilinx_zynq.c | 1 -
27
hw/arm/xlnx-versal-virt.c | 1 -
28
hw/arm/z2.c | 1 -
29
hw/arm/meson.build | 23 ++++++++++++-----------
30
17 files changed, 12 insertions(+), 27 deletions(-)
31
15
32
diff --git a/hw/arm/collie.c b/hw/arm/collie.c
16
diff --git a/hw/net/lan9118_phy.c b/hw/net/lan9118_phy.c
33
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
34
--- a/hw/arm/collie.c
18
--- a/hw/net/lan9118_phy.c
35
+++ b/hw/arm/collie.c
19
+++ b/hw/net/lan9118_phy.c
36
@@ -XXX,XX +XXX,XX @@
20
@@ -XXX,XX +XXX,XX @@ void lan9118_phy_write(Lan9118PhyState *s, int reg, uint16_t val)
37
#include "hw/arm/boot.h"
21
break;
38
#include "hw/block/flash.h"
22
case MII_ANAR:
39
#include "exec/address-spaces.h"
23
s->advertise = (val & (MII_ANAR_RFAULT | MII_ANAR_PAUSE_ASYM |
40
-#include "cpu.h"
24
- MII_ANAR_PAUSE | MII_ANAR_10FD | MII_ANAR_10 |
41
#include "qom/object.h"
25
- MII_ANAR_SELECT))
42
#include "qemu/error-report.h"
26
+ MII_ANAR_PAUSE | MII_ANAR_TXFD | MII_ANAR_10FD |
43
27
+ MII_ANAR_10 | MII_ANAR_SELECT))
44
diff --git a/hw/arm/gumstix.c b/hw/arm/gumstix.c
28
| MII_ANAR_TX;
45
index XXXXXXX..XXXXXXX 100644
29
break;
46
--- a/hw/arm/gumstix.c
30
case 30: /* Interrupt mask */
47
+++ b/hw/arm/gumstix.c
48
@@ -XXX,XX +XXX,XX @@
49
#include "hw/boards.h"
50
#include "exec/address-spaces.h"
51
#include "sysemu/qtest.h"
52
-#include "cpu.h"
53
54
#define CONNEX_FLASH_SIZE (16 * MiB)
55
#define CONNEX_RAM_SIZE (64 * MiB)
56
diff --git a/hw/arm/integratorcp.c b/hw/arm/integratorcp.c
57
index XXXXXXX..XXXXXXX 100644
58
--- a/hw/arm/integratorcp.c
59
+++ b/hw/arm/integratorcp.c
60
@@ -XXX,XX +XXX,XX @@
61
62
#include "qemu/osdep.h"
63
#include "qapi/error.h"
64
-#include "cpu.h"
65
#include "hw/sysbus.h"
66
#include "migration/vmstate.h"
67
#include "hw/boards.h"
68
diff --git a/hw/arm/mainstone.c b/hw/arm/mainstone.c
69
index XXXXXXX..XXXXXXX 100644
70
--- a/hw/arm/mainstone.c
71
+++ b/hw/arm/mainstone.c
72
@@ -XXX,XX +XXX,XX @@
73
#include "hw/block/flash.h"
74
#include "hw/sysbus.h"
75
#include "exec/address-spaces.h"
76
-#include "cpu.h"
77
78
/* Device addresses */
79
#define MST_FPGA_PHYS    0x08000000
80
diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c
81
index XXXXXXX..XXXXXXX 100644
82
--- a/hw/arm/musicpal.c
83
+++ b/hw/arm/musicpal.c
84
@@ -XXX,XX +XXX,XX @@
85
#include "qemu/osdep.h"
86
#include "qemu/units.h"
87
#include "qapi/error.h"
88
-#include "cpu.h"
89
#include "hw/sysbus.h"
90
#include "migration/vmstate.h"
91
#include "hw/arm/boot.h"
92
diff --git a/hw/arm/omap2.c b/hw/arm/omap2.c
93
index XXXXXXX..XXXXXXX 100644
94
--- a/hw/arm/omap2.c
95
+++ b/hw/arm/omap2.c
96
@@ -XXX,XX +XXX,XX @@
97
#include "qemu/osdep.h"
98
#include "qemu/error-report.h"
99
#include "qapi/error.h"
100
-#include "cpu.h"
101
#include "exec/address-spaces.h"
102
#include "sysemu/blockdev.h"
103
#include "sysemu/qtest.h"
104
diff --git a/hw/arm/omap_sx1.c b/hw/arm/omap_sx1.c
105
index XXXXXXX..XXXXXXX 100644
106
--- a/hw/arm/omap_sx1.c
107
+++ b/hw/arm/omap_sx1.c
108
@@ -XXX,XX +XXX,XX @@
109
#include "hw/block/flash.h"
110
#include "sysemu/qtest.h"
111
#include "exec/address-spaces.h"
112
-#include "cpu.h"
113
#include "qemu/cutils.h"
114
#include "qemu/error-report.h"
115
116
diff --git a/hw/arm/palm.c b/hw/arm/palm.c
117
index XXXXXXX..XXXXXXX 100644
118
--- a/hw/arm/palm.c
119
+++ b/hw/arm/palm.c
120
@@ -XXX,XX +XXX,XX @@
121
#include "hw/input/tsc2xxx.h"
122
#include "hw/irq.h"
123
#include "hw/loader.h"
124
-#include "cpu.h"
125
#include "qemu/cutils.h"
126
#include "qom/object.h"
127
#include "qemu/error-report.h"
128
diff --git a/hw/arm/spitz.c b/hw/arm/spitz.c
129
index XXXXXXX..XXXXXXX 100644
130
--- a/hw/arm/spitz.c
131
+++ b/hw/arm/spitz.c
132
@@ -XXX,XX +XXX,XX @@
133
#include "hw/adc/max111x.h"
134
#include "migration/vmstate.h"
135
#include "exec/address-spaces.h"
136
-#include "cpu.h"
137
#include "qom/object.h"
138
#include "audio/audio.h"
139
140
diff --git a/hw/arm/strongarm.c b/hw/arm/strongarm.c
141
index XXXXXXX..XXXXXXX 100644
142
--- a/hw/arm/strongarm.c
143
+++ b/hw/arm/strongarm.c
144
@@ -XXX,XX +XXX,XX @@
145
*/
146
147
#include "qemu/osdep.h"
148
-#include "cpu.h"
149
#include "hw/irq.h"
150
#include "hw/qdev-properties.h"
151
#include "hw/qdev-properties-system.h"
152
diff --git a/hw/arm/versatilepb.c b/hw/arm/versatilepb.c
153
index XXXXXXX..XXXXXXX 100644
154
--- a/hw/arm/versatilepb.c
155
+++ b/hw/arm/versatilepb.c
156
@@ -XXX,XX +XXX,XX @@
157
158
#include "qemu/osdep.h"
159
#include "qapi/error.h"
160
-#include "cpu.h"
161
#include "hw/sysbus.h"
162
#include "migration/vmstate.h"
163
#include "hw/arm/boot.h"
164
diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c
165
index XXXXXXX..XXXXXXX 100644
166
--- a/hw/arm/vexpress.c
167
+++ b/hw/arm/vexpress.c
168
@@ -XXX,XX +XXX,XX @@
169
#include "qemu/osdep.h"
170
#include "qapi/error.h"
171
#include "qemu/datadir.h"
172
-#include "cpu.h"
173
#include "hw/sysbus.h"
174
#include "hw/arm/boot.h"
175
#include "hw/arm/primecell.h"
176
diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
177
index XXXXXXX..XXXXXXX 100644
178
--- a/hw/arm/virt-acpi-build.c
179
+++ b/hw/arm/virt-acpi-build.c
180
@@ -XXX,XX +XXX,XX @@
181
#include "qemu/error-report.h"
182
#include "trace.h"
183
#include "hw/core/cpu.h"
184
-#include "target/arm/cpu.h"
185
#include "hw/acpi/acpi-defs.h"
186
#include "hw/acpi/acpi.h"
187
#include "hw/nvram/fw_cfg_acpi.h"
188
diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c
189
index XXXXXXX..XXXXXXX 100644
190
--- a/hw/arm/xilinx_zynq.c
191
+++ b/hw/arm/xilinx_zynq.c
192
@@ -XXX,XX +XXX,XX @@
193
#include "qemu/osdep.h"
194
#include "qemu/units.h"
195
#include "qapi/error.h"
196
-#include "cpu.h"
197
#include "hw/sysbus.h"
198
#include "hw/arm/boot.h"
199
#include "net/net.h"
200
diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c
201
index XXXXXXX..XXXXXXX 100644
202
--- a/hw/arm/xlnx-versal-virt.c
203
+++ b/hw/arm/xlnx-versal-virt.c
204
@@ -XXX,XX +XXX,XX @@
205
#include "hw/boards.h"
206
#include "hw/sysbus.h"
207
#include "hw/arm/fdt.h"
208
-#include "cpu.h"
209
#include "hw/qdev-properties.h"
210
#include "hw/arm/xlnx-versal.h"
211
#include "hw/arm/boot.h"
212
diff --git a/hw/arm/z2.c b/hw/arm/z2.c
213
index XXXXXXX..XXXXXXX 100644
214
--- a/hw/arm/z2.c
215
+++ b/hw/arm/z2.c
216
@@ -XXX,XX +XXX,XX @@
217
#include "hw/audio/wm8750.h"
218
#include "audio/audio.h"
219
#include "exec/address-spaces.h"
220
-#include "cpu.h"
221
#include "qom/object.h"
222
#include "qapi/error.h"
223
224
diff --git a/hw/arm/meson.build b/hw/arm/meson.build
225
index XXXXXXX..XXXXXXX 100644
226
--- a/hw/arm/meson.build
227
+++ b/hw/arm/meson.build
228
@@ -XXX,XX +XXX,XX @@ arm_ss.add(when: 'CONFIG_INTEGRATOR', if_true: files('integratorcp.c'))
229
arm_ss.add(when: 'CONFIG_MAINSTONE', if_true: files('mainstone.c'))
230
arm_ss.add(when: 'CONFIG_MICROBIT', if_true: files('microbit.c'))
231
arm_ss.add(when: 'CONFIG_MUSICPAL', if_true: files('musicpal.c'))
232
-arm_ss.add(when: 'CONFIG_NETDUINO2', if_true: files('netduino2.c'))
233
arm_ss.add(when: 'CONFIG_NETDUINOPLUS2', if_true: files('netduinoplus2.c'))
234
arm_ss.add(when: 'CONFIG_OLIMEX_STM32_H405', if_true: files('olimex-stm32-h405.c'))
235
arm_ss.add(when: 'CONFIG_NPCM7XX', if_true: files('npcm7xx.c', 'npcm7xx_boards.c'))
236
arm_ss.add(when: 'CONFIG_NSERIES', if_true: files('nseries.c'))
237
-arm_ss.add(when: 'CONFIG_SX1', if_true: files('omap_sx1.c'))
238
-arm_ss.add(when: 'CONFIG_CHEETAH', if_true: files('palm.c'))
239
-arm_ss.add(when: 'CONFIG_GUMSTIX', if_true: files('gumstix.c'))
240
-arm_ss.add(when: 'CONFIG_SPITZ', if_true: files('spitz.c'))
241
-arm_ss.add(when: 'CONFIG_Z2', if_true: files('z2.c'))
242
arm_ss.add(when: 'CONFIG_REALVIEW', if_true: files('realview.c'))
243
arm_ss.add(when: 'CONFIG_SBSA_REF', if_true: files('sbsa-ref.c'))
244
arm_ss.add(when: 'CONFIG_STELLARIS', if_true: files('stellaris.c'))
245
arm_ss.add(when: 'CONFIG_STM32VLDISCOVERY', if_true: files('stm32vldiscovery.c'))
246
-arm_ss.add(when: 'CONFIG_COLLIE', if_true: files('collie.c'))
247
-arm_ss.add(when: 'CONFIG_VERSATILE', if_true: files('versatilepb.c'))
248
-arm_ss.add(when: 'CONFIG_VEXPRESS', if_true: files('vexpress.c'))
249
arm_ss.add(when: 'CONFIG_ZYNQ', if_true: files('xilinx_zynq.c'))
250
arm_ss.add(when: 'CONFIG_SABRELITE', if_true: files('sabrelite.c'))
251
252
@@ -XXX,XX +XXX,XX @@ arm_ss.add(when: 'CONFIG_ARM_V7M', if_true: files('armv7m.c'))
253
arm_ss.add(when: 'CONFIG_EXYNOS4', if_true: files('exynos4210.c'))
254
arm_ss.add(when: 'CONFIG_PXA2XX', if_true: files('pxa2xx.c', 'pxa2xx_gpio.c', 'pxa2xx_pic.c'))
255
arm_ss.add(when: 'CONFIG_DIGIC', if_true: files('digic.c'))
256
-arm_ss.add(when: 'CONFIG_OMAP', if_true: files('omap1.c', 'omap2.c'))
257
-arm_ss.add(when: 'CONFIG_STRONGARM', if_true: files('strongarm.c'))
258
+arm_ss.add(when: 'CONFIG_OMAP', if_true: files('omap1.c'))
259
arm_ss.add(when: 'CONFIG_ALLWINNER_A10', if_true: files('allwinner-a10.c', 'cubieboard.c'))
260
arm_ss.add(when: 'CONFIG_ALLWINNER_H3', if_true: files('allwinner-h3.c', 'orangepi.c'))
261
arm_ss.add(when: 'CONFIG_ALLWINNER_R40', if_true: files('allwinner-r40.c', 'bananapi_m2u.c'))
262
@@ -XXX,XX +XXX,XX @@ arm_ss.add(when: 'CONFIG_NRF51_SOC', if_true: files('nrf51_soc.c'))
263
arm_ss.add(when: 'CONFIG_XEN', if_true: files('xen_arm.c'))
264
265
system_ss.add(when: 'CONFIG_ARM_SMMUV3', if_true: files('smmu-common.c'))
266
+system_ss.add(when: 'CONFIG_CHEETAH', if_true: files('palm.c'))
267
+system_ss.add(when: 'CONFIG_COLLIE', if_true: files('collie.c'))
268
system_ss.add(when: 'CONFIG_EXYNOS4', if_true: files('exynos4_boards.c'))
269
+system_ss.add(when: 'CONFIG_GUMSTIX', if_true: files('gumstix.c'))
270
+system_ss.add(when: 'CONFIG_NETDUINO2', if_true: files('netduino2.c'))
271
+system_ss.add(when: 'CONFIG_OMAP', if_true: files('omap2.c'))
272
system_ss.add(when: 'CONFIG_RASPI', if_true: files('bcm2835_peripherals.c'))
273
+system_ss.add(when: 'CONFIG_SPITZ', if_true: files('spitz.c'))
274
+system_ss.add(when: 'CONFIG_STRONGARM', if_true: files('strongarm.c'))
275
+system_ss.add(when: 'CONFIG_SX1', if_true: files('omap_sx1.c'))
276
system_ss.add(when: 'CONFIG_TOSA', if_true: files('tosa.c'))
277
+system_ss.add(when: 'CONFIG_VERSATILE', if_true: files('versatilepb.c'))
278
+system_ss.add(when: 'CONFIG_VEXPRESS', if_true: files('vexpress.c'))
279
+system_ss.add(when: 'CONFIG_Z2', if_true: files('z2.c'))
280
281
hw_arch += {'arm': arm_ss}
282
--
31
--
283
2.34.1
32
2.34.1
284
285
diff view generated by jsdifflib
New patch
1
For IEEE fused multiply-add, the (0 * inf) + NaN case should raise
2
Invalid for the multiplication of 0 by infinity. Currently we handle
3
this in the per-architecture ifdef ladder in pickNaNMulAdd().
4
However, since this isn't really architecture specific we can hoist
5
it up to the generic code.
1
6
7
For the cases where the infzero test in pickNaNMulAdd was
8
returning 2, we can delete the check entirely and allow the
9
code to fall into the normal pick-a-NaN handling, because this
10
will return 2 anyway (input 'c' being the only NaN in this case).
11
For the cases where infzero was returning 3 to indicate "return
12
the default NaN", we must retain that "return 3".
13
14
For Arm, this looks like it might be a behaviour change because we
15
used to set float_flag_invalid | float_flag_invalid_imz only if C is
16
a quiet NaN. However, it is not, because Arm target code never looks
17
at float_flag_invalid_imz, and for the (0 * inf) + SNaN case we
18
already raised float_flag_invalid via the "abc_mask &
19
float_cmask_snan" check in pick_nan_muladd.
20
21
For any target architecture using the "default implementation" at the
22
bottom of the ifdef, this is a behaviour change but will be fixing a
23
bug (where we failed to raise the Invalid exception for (0 * inf +
24
QNaN). The architectures using the default case are:
25
* hppa
26
* i386
27
* sh4
28
* tricore
29
30
The x86, Tricore and SH4 CPU architecture manuals are clear that this
31
should have raised Invalid; HPPA is a bit vaguer but still seems
32
clear enough.
33
34
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
35
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
36
Message-id: 20241202131347.498124-2-peter.maydell@linaro.org
37
---
38
fpu/softfloat-parts.c.inc | 13 +++++++------
39
fpu/softfloat-specialize.c.inc | 29 +----------------------------
40
2 files changed, 8 insertions(+), 34 deletions(-)
41
42
diff --git a/fpu/softfloat-parts.c.inc b/fpu/softfloat-parts.c.inc
43
index XXXXXXX..XXXXXXX 100644
44
--- a/fpu/softfloat-parts.c.inc
45
+++ b/fpu/softfloat-parts.c.inc
46
@@ -XXX,XX +XXX,XX @@ static FloatPartsN *partsN(pick_nan_muladd)(FloatPartsN *a, FloatPartsN *b,
47
int ab_mask, int abc_mask)
48
{
49
int which;
50
+ bool infzero = (ab_mask == float_cmask_infzero);
51
52
if (unlikely(abc_mask & float_cmask_snan)) {
53
float_raise(float_flag_invalid | float_flag_invalid_snan, s);
54
}
55
56
- which = pickNaNMulAdd(a->cls, b->cls, c->cls,
57
- ab_mask == float_cmask_infzero, s);
58
+ if (infzero) {
59
+ /* This is (0 * inf) + NaN or (inf * 0) + NaN */
60
+ float_raise(float_flag_invalid | float_flag_invalid_imz, s);
61
+ }
62
+
63
+ which = pickNaNMulAdd(a->cls, b->cls, c->cls, infzero, s);
64
65
if (s->default_nan_mode || which == 3) {
66
- /*
67
- * Note that this check is after pickNaNMulAdd so that function
68
- * has an opportunity to set the Invalid flag for infzero.
69
- */
70
parts_default_nan(a, s);
71
return a;
72
}
73
diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc
74
index XXXXXXX..XXXXXXX 100644
75
--- a/fpu/softfloat-specialize.c.inc
76
+++ b/fpu/softfloat-specialize.c.inc
77
@@ -XXX,XX +XXX,XX @@ static int pickNaNMulAdd(FloatClass a_cls, FloatClass b_cls, FloatClass c_cls,
78
* the default NaN
79
*/
80
if (infzero && is_qnan(c_cls)) {
81
- float_raise(float_flag_invalid | float_flag_invalid_imz, status);
82
return 3;
83
}
84
85
@@ -XXX,XX +XXX,XX @@ static int pickNaNMulAdd(FloatClass a_cls, FloatClass b_cls, FloatClass c_cls,
86
* case sets InvalidOp and returns the default NaN
87
*/
88
if (infzero) {
89
- float_raise(float_flag_invalid | float_flag_invalid_imz, status);
90
return 3;
91
}
92
/* Prefer sNaN over qNaN, in the a, b, c order. */
93
@@ -XXX,XX +XXX,XX @@ static int pickNaNMulAdd(FloatClass a_cls, FloatClass b_cls, FloatClass c_cls,
94
* For MIPS systems that conform to IEEE754-2008, the (inf,zero,nan)
95
* case sets InvalidOp and returns the input value 'c'
96
*/
97
- if (infzero) {
98
- float_raise(float_flag_invalid | float_flag_invalid_imz, status);
99
- return 2;
100
- }
101
/* Prefer sNaN over qNaN, in the c, a, b order. */
102
if (is_snan(c_cls)) {
103
return 2;
104
@@ -XXX,XX +XXX,XX @@ static int pickNaNMulAdd(FloatClass a_cls, FloatClass b_cls, FloatClass c_cls,
105
* For LoongArch systems that conform to IEEE754-2008, the (inf,zero,nan)
106
* case sets InvalidOp and returns the input value 'c'
107
*/
108
- if (infzero) {
109
- float_raise(float_flag_invalid | float_flag_invalid_imz, status);
110
- return 2;
111
- }
112
+
113
/* Prefer sNaN over qNaN, in the c, a, b order. */
114
if (is_snan(c_cls)) {
115
return 2;
116
@@ -XXX,XX +XXX,XX @@ static int pickNaNMulAdd(FloatClass a_cls, FloatClass b_cls, FloatClass c_cls,
117
* to return an input NaN if we have one (ie c) rather than generating
118
* a default NaN
119
*/
120
- if (infzero) {
121
- float_raise(float_flag_invalid | float_flag_invalid_imz, status);
122
- return 2;
123
- }
124
125
/* If fRA is a NaN return it; otherwise if fRB is a NaN return it;
126
* otherwise return fRC. Note that muladd on PPC is (fRA * fRC) + frB
127
@@ -XXX,XX +XXX,XX @@ static int pickNaNMulAdd(FloatClass a_cls, FloatClass b_cls, FloatClass c_cls,
128
return 1;
129
}
130
#elif defined(TARGET_RISCV)
131
- /* For RISC-V, InvalidOp is set when multiplicands are Inf and zero */
132
- if (infzero) {
133
- float_raise(float_flag_invalid | float_flag_invalid_imz, status);
134
- }
135
return 3; /* default NaN */
136
#elif defined(TARGET_S390X)
137
if (infzero) {
138
- float_raise(float_flag_invalid | float_flag_invalid_imz, status);
139
return 3;
140
}
141
142
@@ -XXX,XX +XXX,XX @@ static int pickNaNMulAdd(FloatClass a_cls, FloatClass b_cls, FloatClass c_cls,
143
return 2;
144
}
145
#elif defined(TARGET_SPARC)
146
- /* For (inf,0,nan) return c. */
147
- if (infzero) {
148
- float_raise(float_flag_invalid | float_flag_invalid_imz, status);
149
- return 2;
150
- }
151
/* Prefer SNaN over QNaN, order C, B, A. */
152
if (is_snan(c_cls)) {
153
return 2;
154
@@ -XXX,XX +XXX,XX @@ static int pickNaNMulAdd(FloatClass a_cls, FloatClass b_cls, FloatClass c_cls,
155
* For Xtensa, the (inf,zero,nan) case sets InvalidOp and returns
156
* an input NaN if we have one (ie c).
157
*/
158
- if (infzero) {
159
- float_raise(float_flag_invalid | float_flag_invalid_imz, status);
160
- return 2;
161
- }
162
if (status->use_first_nan) {
163
if (is_nan(a_cls)) {
164
return 0;
165
--
166
2.34.1
diff view generated by jsdifflib
New patch
1
If the target sets default_nan_mode then we're always going to return
2
the default NaN, and pickNaNMulAdd() no longer has any side effects.
3
For consistency with pickNaN(), check for default_nan_mode before
4
calling pickNaNMulAdd().
1
5
6
When we convert pickNaNMulAdd() to allow runtime selection of the NaN
7
propagation rule, this means we won't have to make the targets which
8
use default_nan_mode also set a propagation rule.
9
10
Since RiscV always uses default_nan_mode, this allows us to remove
11
its ifdef case from pickNaNMulAdd().
12
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
15
Message-id: 20241202131347.498124-3-peter.maydell@linaro.org
16
---
17
fpu/softfloat-parts.c.inc | 8 ++++++--
18
fpu/softfloat-specialize.c.inc | 9 +++++++--
19
2 files changed, 13 insertions(+), 4 deletions(-)
20
21
diff --git a/fpu/softfloat-parts.c.inc b/fpu/softfloat-parts.c.inc
22
index XXXXXXX..XXXXXXX 100644
23
--- a/fpu/softfloat-parts.c.inc
24
+++ b/fpu/softfloat-parts.c.inc
25
@@ -XXX,XX +XXX,XX @@ static FloatPartsN *partsN(pick_nan_muladd)(FloatPartsN *a, FloatPartsN *b,
26
float_raise(float_flag_invalid | float_flag_invalid_imz, s);
27
}
28
29
- which = pickNaNMulAdd(a->cls, b->cls, c->cls, infzero, s);
30
+ if (s->default_nan_mode) {
31
+ which = 3;
32
+ } else {
33
+ which = pickNaNMulAdd(a->cls, b->cls, c->cls, infzero, s);
34
+ }
35
36
- if (s->default_nan_mode || which == 3) {
37
+ if (which == 3) {
38
parts_default_nan(a, s);
39
return a;
40
}
41
diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc
42
index XXXXXXX..XXXXXXX 100644
43
--- a/fpu/softfloat-specialize.c.inc
44
+++ b/fpu/softfloat-specialize.c.inc
45
@@ -XXX,XX +XXX,XX @@ static int pickNaN(FloatClass a_cls, FloatClass b_cls,
46
static int pickNaNMulAdd(FloatClass a_cls, FloatClass b_cls, FloatClass c_cls,
47
bool infzero, float_status *status)
48
{
49
+ /*
50
+ * We guarantee not to require the target to tell us how to
51
+ * pick a NaN if we're always returning the default NaN.
52
+ * But if we're not in default-NaN mode then the target must
53
+ * specify.
54
+ */
55
+ assert(!status->default_nan_mode);
56
#if defined(TARGET_ARM)
57
/* For ARM, the (inf,zero,qnan) case sets InvalidOp and returns
58
* the default NaN
59
@@ -XXX,XX +XXX,XX @@ static int pickNaNMulAdd(FloatClass a_cls, FloatClass b_cls, FloatClass c_cls,
60
} else {
61
return 1;
62
}
63
-#elif defined(TARGET_RISCV)
64
- return 3; /* default NaN */
65
#elif defined(TARGET_S390X)
66
if (infzero) {
67
return 3;
68
--
69
2.34.1
diff view generated by jsdifflib
New patch
1
1
IEEE 758 does not define a fixed rule for what NaN to return in
2
the case of a fused multiply-add of inf * 0 + NaN. Different
3
architectures thus do different things:
4
* some return the default NaN
5
* some return the input NaN
6
* Arm returns the default NaN if the input NaN is quiet,
7
and the input NaN if it is signalling
8
9
We want to make this logic be runtime selected rather than
10
hardcoded into the binary, because:
11
* this will let us have multiple targets in one QEMU binary
12
* the Arm FEAT_AFP architectural feature includes letting
13
the guest select a NaN propagation rule at runtime
14
15
In this commit we add an enum for the propagation rule, the field in
16
float_status, and the corresponding getters and setters. We change
17
pickNaNMulAdd to honour this, but because all targets still leave
18
this field at its default 0 value, the fallback logic will pick the
19
rule type with the old ifdef ladder.
20
21
Note that four architectures both use the muladd softfloat functions
22
and did not have a branch of the ifdef ladder to specify their
23
behaviour (and so were ending up with the "default" case, probably
24
wrongly): i386, HPPA, SH4 and Tricore. SH4 and Tricore both set
25
default_nan_mode, and so will never get into pickNaNMulAdd(). For
26
HPPA and i386 we retain the same behaviour as the old default-case,
27
which is to not ever return the default NaN. This might not be
28
correct but it is not a behaviour change.
29
30
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
31
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
32
Message-id: 20241202131347.498124-4-peter.maydell@linaro.org
33
---
34
include/fpu/softfloat-helpers.h | 11 ++++
35
include/fpu/softfloat-types.h | 23 +++++++++
36
fpu/softfloat-specialize.c.inc | 91 ++++++++++++++++++++++-----------
37
3 files changed, 95 insertions(+), 30 deletions(-)
38
39
diff --git a/include/fpu/softfloat-helpers.h b/include/fpu/softfloat-helpers.h
40
index XXXXXXX..XXXXXXX 100644
41
--- a/include/fpu/softfloat-helpers.h
42
+++ b/include/fpu/softfloat-helpers.h
43
@@ -XXX,XX +XXX,XX @@ static inline void set_float_2nan_prop_rule(Float2NaNPropRule rule,
44
status->float_2nan_prop_rule = rule;
45
}
46
47
+static inline void set_float_infzeronan_rule(FloatInfZeroNaNRule rule,
48
+ float_status *status)
49
+{
50
+ status->float_infzeronan_rule = rule;
51
+}
52
+
53
static inline void set_flush_to_zero(bool val, float_status *status)
54
{
55
status->flush_to_zero = val;
56
@@ -XXX,XX +XXX,XX @@ static inline Float2NaNPropRule get_float_2nan_prop_rule(float_status *status)
57
return status->float_2nan_prop_rule;
58
}
59
60
+static inline FloatInfZeroNaNRule get_float_infzeronan_rule(float_status *status)
61
+{
62
+ return status->float_infzeronan_rule;
63
+}
64
+
65
static inline bool get_flush_to_zero(float_status *status)
66
{
67
return status->flush_to_zero;
68
diff --git a/include/fpu/softfloat-types.h b/include/fpu/softfloat-types.h
69
index XXXXXXX..XXXXXXX 100644
70
--- a/include/fpu/softfloat-types.h
71
+++ b/include/fpu/softfloat-types.h
72
@@ -XXX,XX +XXX,XX @@ typedef enum __attribute__((__packed__)) {
73
float_2nan_prop_x87,
74
} Float2NaNPropRule;
75
76
+/*
77
+ * Rule for result of fused multiply-add 0 * Inf + NaN.
78
+ * This must be a NaN, but implementations differ on whether this
79
+ * is the input NaN or the default NaN.
80
+ *
81
+ * You don't need to set this if default_nan_mode is enabled.
82
+ * When not in default-NaN mode, it is an error for the target
83
+ * not to set the rule in float_status if it uses muladd, and we
84
+ * will assert if we need to handle an input NaN and no rule was
85
+ * selected.
86
+ */
87
+typedef enum __attribute__((__packed__)) {
88
+ /* No propagation rule specified */
89
+ float_infzeronan_none = 0,
90
+ /* Result is never the default NaN (so always the input NaN) */
91
+ float_infzeronan_dnan_never,
92
+ /* Result is always the default NaN */
93
+ float_infzeronan_dnan_always,
94
+ /* Result is the default NaN if the input NaN is quiet */
95
+ float_infzeronan_dnan_if_qnan,
96
+} FloatInfZeroNaNRule;
97
+
98
/*
99
* Floating Point Status. Individual architectures may maintain
100
* several versions of float_status for different functions. The
101
@@ -XXX,XX +XXX,XX @@ typedef struct float_status {
102
FloatRoundMode float_rounding_mode;
103
FloatX80RoundPrec floatx80_rounding_precision;
104
Float2NaNPropRule float_2nan_prop_rule;
105
+ FloatInfZeroNaNRule float_infzeronan_rule;
106
bool tininess_before_rounding;
107
/* should denormalised results go to zero and set the inexact flag? */
108
bool flush_to_zero;
109
diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc
110
index XXXXXXX..XXXXXXX 100644
111
--- a/fpu/softfloat-specialize.c.inc
112
+++ b/fpu/softfloat-specialize.c.inc
113
@@ -XXX,XX +XXX,XX @@ static int pickNaN(FloatClass a_cls, FloatClass b_cls,
114
static int pickNaNMulAdd(FloatClass a_cls, FloatClass b_cls, FloatClass c_cls,
115
bool infzero, float_status *status)
116
{
117
+ FloatInfZeroNaNRule rule = status->float_infzeronan_rule;
118
+
119
/*
120
* We guarantee not to require the target to tell us how to
121
* pick a NaN if we're always returning the default NaN.
122
@@ -XXX,XX +XXX,XX @@ static int pickNaNMulAdd(FloatClass a_cls, FloatClass b_cls, FloatClass c_cls,
123
* specify.
124
*/
125
assert(!status->default_nan_mode);
126
+
127
+ if (rule == float_infzeronan_none) {
128
+ /*
129
+ * Temporarily fall back to ifdef ladder
130
+ */
131
#if defined(TARGET_ARM)
132
- /* For ARM, the (inf,zero,qnan) case sets InvalidOp and returns
133
- * the default NaN
134
- */
135
- if (infzero && is_qnan(c_cls)) {
136
- return 3;
137
+ /*
138
+ * For ARM, the (inf,zero,qnan) case returns the default NaN,
139
+ * but (inf,zero,snan) returns the input NaN.
140
+ */
141
+ rule = float_infzeronan_dnan_if_qnan;
142
+#elif defined(TARGET_MIPS)
143
+ if (snan_bit_is_one(status)) {
144
+ /*
145
+ * For MIPS systems that conform to IEEE754-1985, the (inf,zero,nan)
146
+ * case sets InvalidOp and returns the default NaN
147
+ */
148
+ rule = float_infzeronan_dnan_always;
149
+ } else {
150
+ /*
151
+ * For MIPS systems that conform to IEEE754-2008, the (inf,zero,nan)
152
+ * case sets InvalidOp and returns the input value 'c'
153
+ */
154
+ rule = float_infzeronan_dnan_never;
155
+ }
156
+#elif defined(TARGET_PPC) || defined(TARGET_SPARC) || \
157
+ defined(TARGET_XTENSA) || defined(TARGET_HPPA) || \
158
+ defined(TARGET_I386) || defined(TARGET_LOONGARCH)
159
+ /*
160
+ * For LoongArch systems that conform to IEEE754-2008, the (inf,zero,nan)
161
+ * case sets InvalidOp and returns the input value 'c'
162
+ */
163
+ /*
164
+ * For PPC, the (inf,zero,qnan) case sets InvalidOp, but we prefer
165
+ * to return an input NaN if we have one (ie c) rather than generating
166
+ * a default NaN
167
+ */
168
+ rule = float_infzeronan_dnan_never;
169
+#elif defined(TARGET_S390X)
170
+ rule = float_infzeronan_dnan_always;
171
+#endif
172
}
173
174
+ if (infzero) {
175
+ /*
176
+ * Inf * 0 + NaN -- some implementations return the default NaN here,
177
+ * and some return the input NaN.
178
+ */
179
+ switch (rule) {
180
+ case float_infzeronan_dnan_never:
181
+ return 2;
182
+ case float_infzeronan_dnan_always:
183
+ return 3;
184
+ case float_infzeronan_dnan_if_qnan:
185
+ return is_qnan(c_cls) ? 3 : 2;
186
+ default:
187
+ g_assert_not_reached();
188
+ }
189
+ }
190
+
191
+#if defined(TARGET_ARM)
192
+
193
/* This looks different from the ARM ARM pseudocode, because the ARM ARM
194
* puts the operands to a fused mac operation (a*b)+c in the order c,a,b.
195
*/
196
@@ -XXX,XX +XXX,XX @@ static int pickNaNMulAdd(FloatClass a_cls, FloatClass b_cls, FloatClass c_cls,
197
}
198
#elif defined(TARGET_MIPS)
199
if (snan_bit_is_one(status)) {
200
- /*
201
- * For MIPS systems that conform to IEEE754-1985, the (inf,zero,nan)
202
- * case sets InvalidOp and returns the default NaN
203
- */
204
- if (infzero) {
205
- return 3;
206
- }
207
/* Prefer sNaN over qNaN, in the a, b, c order. */
208
if (is_snan(a_cls)) {
209
return 0;
210
@@ -XXX,XX +XXX,XX @@ static int pickNaNMulAdd(FloatClass a_cls, FloatClass b_cls, FloatClass c_cls,
211
return 2;
212
}
213
} else {
214
- /*
215
- * For MIPS systems that conform to IEEE754-2008, the (inf,zero,nan)
216
- * case sets InvalidOp and returns the input value 'c'
217
- */
218
/* Prefer sNaN over qNaN, in the c, a, b order. */
219
if (is_snan(c_cls)) {
220
return 2;
221
@@ -XXX,XX +XXX,XX @@ static int pickNaNMulAdd(FloatClass a_cls, FloatClass b_cls, FloatClass c_cls,
222
}
223
}
224
#elif defined(TARGET_LOONGARCH64)
225
- /*
226
- * For LoongArch systems that conform to IEEE754-2008, the (inf,zero,nan)
227
- * case sets InvalidOp and returns the input value 'c'
228
- */
229
-
230
/* Prefer sNaN over qNaN, in the c, a, b order. */
231
if (is_snan(c_cls)) {
232
return 2;
233
@@ -XXX,XX +XXX,XX @@ static int pickNaNMulAdd(FloatClass a_cls, FloatClass b_cls, FloatClass c_cls,
234
return 1;
235
}
236
#elif defined(TARGET_PPC)
237
- /* For PPC, the (inf,zero,qnan) case sets InvalidOp, but we prefer
238
- * to return an input NaN if we have one (ie c) rather than generating
239
- * a default NaN
240
- */
241
-
242
/* If fRA is a NaN return it; otherwise if fRB is a NaN return it;
243
* otherwise return fRC. Note that muladd on PPC is (fRA * fRC) + frB
244
*/
245
@@ -XXX,XX +XXX,XX @@ static int pickNaNMulAdd(FloatClass a_cls, FloatClass b_cls, FloatClass c_cls,
246
return 1;
247
}
248
#elif defined(TARGET_S390X)
249
- if (infzero) {
250
- return 3;
251
- }
252
-
253
if (is_snan(a_cls)) {
254
return 0;
255
} else if (is_snan(b_cls)) {
256
--
257
2.34.1
diff view generated by jsdifflib
1
From: Guenter Roeck <linux@roeck-us.net>
1
Explicitly set a rule in the softfloat tests for the inf-zero-nan
2
muladd special case. In meson.build we put -DTARGET_ARM in fpcflags,
3
and so we should select here the Arm rule of
4
float_infzeronan_dnan_if_qnan.
2
5
3
Add MMDC, OCOTP, SQPI, CAAM, and USBMISC as unimplemented devices.
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Message-id: 20241202131347.498124-5-peter.maydell@linaro.org
9
---
10
tests/fp/fp-bench.c | 5 +++++
11
tests/fp/fp-test.c | 5 +++++
12
2 files changed, 10 insertions(+)
4
13
5
This allows operating systems such as Linux to run emulations such as
14
diff --git a/tests/fp/fp-bench.c b/tests/fp/fp-bench.c
6
mcimx6ul-evk.
7
8
Before commit 0cd4926b85 ("Refactor i.MX6UL processor code"), the affected
9
memory ranges were covered by the unimplemented DAP device. The commit
10
reduced the DAP address range from 0x100000 to 4kB, and the emulation
11
thus no longer covered the various unimplemented devices in the affected
12
address range.
13
14
Fixes: 0cd4926b85 ("Refactor i.MX6UL processor code")
15
Cc: Jean-Christophe Dubois <jcd@tribudubois.net>
16
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
17
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
18
Message-id: 20240120005356.2599547-1-linux@roeck-us.net
19
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
20
---
21
include/hw/arm/fsl-imx6ul.h | 2 ++
22
hw/arm/fsl-imx6ul.c | 30 ++++++++++++++++++++++++++++++
23
2 files changed, 32 insertions(+)
24
25
diff --git a/include/hw/arm/fsl-imx6ul.h b/include/hw/arm/fsl-imx6ul.h
26
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
27
--- a/include/hw/arm/fsl-imx6ul.h
16
--- a/tests/fp/fp-bench.c
28
+++ b/include/hw/arm/fsl-imx6ul.h
17
+++ b/tests/fp/fp-bench.c
29
@@ -XXX,XX +XXX,XX @@ enum FslIMX6ULMemoryMap {
18
@@ -XXX,XX +XXX,XX @@ static void run_bench(void)
30
FSL_IMX6UL_ENET1_ADDR = 0x02188000,
19
{
31
20
bench_func_t f;
32
FSL_IMX6UL_USBO2_USBMISC_ADDR = 0x02184800,
21
33
+ FSL_IMX6UL_USBO2_USBMISC_SIZE = 0x200,
22
+ /*
34
+
23
+ * These implementation-defined choices for various things IEEE
35
FSL_IMX6UL_USBO2_USB1_ADDR = 0x02184000,
24
+ * doesn't specify match those used by the Arm architecture.
36
FSL_IMX6UL_USBO2_USB2_ADDR = 0x02184200,
25
+ */
37
26
set_float_2nan_prop_rule(float_2nan_prop_s_ab, &soft_status);
38
diff --git a/hw/arm/fsl-imx6ul.c b/hw/arm/fsl-imx6ul.c
27
+ set_float_infzeronan_rule(float_infzeronan_dnan_if_qnan, &soft_status);
28
29
f = bench_funcs[operation][precision];
30
g_assert(f);
31
diff --git a/tests/fp/fp-test.c b/tests/fp/fp-test.c
39
index XXXXXXX..XXXXXXX 100644
32
index XXXXXXX..XXXXXXX 100644
40
--- a/hw/arm/fsl-imx6ul.c
33
--- a/tests/fp/fp-test.c
41
+++ b/hw/arm/fsl-imx6ul.c
34
+++ b/tests/fp/fp-test.c
42
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6ul_realize(DeviceState *dev, Error **errp)
35
@@ -XXX,XX +XXX,XX @@ void run_test(void)
43
create_unimplemented_device("a7mpcore-dap", FSL_IMX6UL_A7MPCORE_DAP_ADDR,
36
{
44
FSL_IMX6UL_A7MPCORE_DAP_SIZE);
37
unsigned int i;
45
38
46
+ /*
39
+ /*
47
+ * MMDC
40
+ * These implementation-defined choices for various things IEEE
41
+ * doesn't specify match those used by the Arm architecture.
48
+ */
42
+ */
49
+ create_unimplemented_device("a7mpcore-mmdc", FSL_IMX6UL_MMDC_CFG_ADDR,
43
set_float_2nan_prop_rule(float_2nan_prop_s_ab, &qsf);
50
+ FSL_IMX6UL_MMDC_CFG_SIZE);
44
+ set_float_infzeronan_rule(float_infzeronan_dnan_if_qnan, &qsf);
51
+
45
52
+ /*
46
genCases_setLevel(test_level);
53
+ * OCOTP
47
verCases_maxErrorCount = n_max_errors;
54
+ */
55
+ create_unimplemented_device("a7mpcore-ocotp", FSL_IMX6UL_OCOTP_CTRL_ADDR,
56
+ FSL_IMX6UL_OCOTP_CTRL_SIZE);
57
+
58
+ /*
59
+ * QSPI
60
+ */
61
+ create_unimplemented_device("a7mpcore-qspi", FSL_IMX6UL_QSPI_ADDR,
62
+ FSL_IMX6UL_QSPI_SIZE);
63
+
64
+ /*
65
+ * CAAM
66
+ */
67
+ create_unimplemented_device("a7mpcore-qspi", FSL_IMX6UL_CAAM_ADDR,
68
+ FSL_IMX6UL_CAAM_SIZE);
69
+
70
+ /*
71
+ * USBMISC
72
+ */
73
+ create_unimplemented_device("a7mpcore-usbmisc", FSL_IMX6UL_USBO2_USBMISC_ADDR,
74
+ FSL_IMX6UL_USBO2_USBMISC_SIZE);
75
+
76
/*
77
* GPTs
78
*/
79
--
48
--
80
2.34.1
49
2.34.1
81
82
diff view generated by jsdifflib
New patch
1
Set the FloatInfZeroNaNRule explicitly for the Arm target,
2
so we can remove the ifdef from pickNaNMulAdd().
1
3
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Message-id: 20241202131347.498124-6-peter.maydell@linaro.org
7
---
8
target/arm/cpu.c | 3 +++
9
fpu/softfloat-specialize.c.inc | 8 +-------
10
2 files changed, 4 insertions(+), 7 deletions(-)
11
12
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
13
index XXXXXXX..XXXXXXX 100644
14
--- a/target/arm/cpu.c
15
+++ b/target/arm/cpu.c
16
@@ -XXX,XX +XXX,XX @@ void arm_register_el_change_hook(ARMCPU *cpu, ARMELChangeHookFn *hook,
17
* * tininess-before-rounding
18
* * 2-input NaN propagation prefers SNaN over QNaN, and then
19
* operand A over operand B (see FPProcessNaNs() pseudocode)
20
+ * * 0 * Inf + NaN returns the default NaN if the input NaN is quiet,
21
+ * and the input NaN if it is signalling
22
*/
23
static void arm_set_default_fp_behaviours(float_status *s)
24
{
25
set_float_detect_tininess(float_tininess_before_rounding, s);
26
set_float_2nan_prop_rule(float_2nan_prop_s_ab, s);
27
+ set_float_infzeronan_rule(float_infzeronan_dnan_if_qnan, s);
28
}
29
30
static void cp_reg_reset(gpointer key, gpointer value, gpointer opaque)
31
diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc
32
index XXXXXXX..XXXXXXX 100644
33
--- a/fpu/softfloat-specialize.c.inc
34
+++ b/fpu/softfloat-specialize.c.inc
35
@@ -XXX,XX +XXX,XX @@ static int pickNaNMulAdd(FloatClass a_cls, FloatClass b_cls, FloatClass c_cls,
36
/*
37
* Temporarily fall back to ifdef ladder
38
*/
39
-#if defined(TARGET_ARM)
40
- /*
41
- * For ARM, the (inf,zero,qnan) case returns the default NaN,
42
- * but (inf,zero,snan) returns the input NaN.
43
- */
44
- rule = float_infzeronan_dnan_if_qnan;
45
-#elif defined(TARGET_MIPS)
46
+#if defined(TARGET_MIPS)
47
if (snan_bit_is_one(status)) {
48
/*
49
* For MIPS systems that conform to IEEE754-1985, the (inf,zero,nan)
50
--
51
2.34.1
diff view generated by jsdifflib
New patch
1
Set the FloatInfZeroNaNRule explicitly for s390, so we
2
can remove the ifdef from pickNaNMulAdd().
1
3
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Message-id: 20241202131347.498124-7-peter.maydell@linaro.org
7
---
8
target/s390x/cpu.c | 2 ++
9
fpu/softfloat-specialize.c.inc | 2 --
10
2 files changed, 2 insertions(+), 2 deletions(-)
11
12
diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
13
index XXXXXXX..XXXXXXX 100644
14
--- a/target/s390x/cpu.c
15
+++ b/target/s390x/cpu.c
16
@@ -XXX,XX +XXX,XX @@ static void s390_cpu_reset_hold(Object *obj, ResetType type)
17
set_float_detect_tininess(float_tininess_before_rounding,
18
&env->fpu_status);
19
set_float_2nan_prop_rule(float_2nan_prop_s_ab, &env->fpu_status);
20
+ set_float_infzeronan_rule(float_infzeronan_dnan_always,
21
+ &env->fpu_status);
22
/* fall through */
23
case RESET_TYPE_S390_CPU_NORMAL:
24
env->psw.mask &= ~PSW_MASK_RI;
25
diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc
26
index XXXXXXX..XXXXXXX 100644
27
--- a/fpu/softfloat-specialize.c.inc
28
+++ b/fpu/softfloat-specialize.c.inc
29
@@ -XXX,XX +XXX,XX @@ static int pickNaNMulAdd(FloatClass a_cls, FloatClass b_cls, FloatClass c_cls,
30
* a default NaN
31
*/
32
rule = float_infzeronan_dnan_never;
33
-#elif defined(TARGET_S390X)
34
- rule = float_infzeronan_dnan_always;
35
#endif
36
}
37
38
--
39
2.34.1
diff view generated by jsdifflib
New patch
1
Set the FloatInfZeroNaNRule explicitly for the PPC target,
2
so we can remove the ifdef from pickNaNMulAdd().
1
3
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Message-id: 20241202131347.498124-8-peter.maydell@linaro.org
7
---
8
target/ppc/cpu_init.c | 7 +++++++
9
fpu/softfloat-specialize.c.inc | 7 +------
10
2 files changed, 8 insertions(+), 6 deletions(-)
11
12
diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c
13
index XXXXXXX..XXXXXXX 100644
14
--- a/target/ppc/cpu_init.c
15
+++ b/target/ppc/cpu_init.c
16
@@ -XXX,XX +XXX,XX @@ static void ppc_cpu_reset_hold(Object *obj, ResetType type)
17
*/
18
set_float_2nan_prop_rule(float_2nan_prop_ab, &env->fp_status);
19
set_float_2nan_prop_rule(float_2nan_prop_ab, &env->vec_status);
20
+ /*
21
+ * For PPC, the (inf,zero,qnan) case sets InvalidOp, but we prefer
22
+ * to return an input NaN if we have one (ie c) rather than generating
23
+ * a default NaN
24
+ */
25
+ set_float_infzeronan_rule(float_infzeronan_dnan_never, &env->fp_status);
26
+ set_float_infzeronan_rule(float_infzeronan_dnan_never, &env->vec_status);
27
28
for (i = 0; i < ARRAY_SIZE(env->spr_cb); i++) {
29
ppc_spr_t *spr = &env->spr_cb[i];
30
diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc
31
index XXXXXXX..XXXXXXX 100644
32
--- a/fpu/softfloat-specialize.c.inc
33
+++ b/fpu/softfloat-specialize.c.inc
34
@@ -XXX,XX +XXX,XX @@ static int pickNaNMulAdd(FloatClass a_cls, FloatClass b_cls, FloatClass c_cls,
35
*/
36
rule = float_infzeronan_dnan_never;
37
}
38
-#elif defined(TARGET_PPC) || defined(TARGET_SPARC) || \
39
+#elif defined(TARGET_SPARC) || \
40
defined(TARGET_XTENSA) || defined(TARGET_HPPA) || \
41
defined(TARGET_I386) || defined(TARGET_LOONGARCH)
42
/*
43
* For LoongArch systems that conform to IEEE754-2008, the (inf,zero,nan)
44
* case sets InvalidOp and returns the input value 'c'
45
*/
46
- /*
47
- * For PPC, the (inf,zero,qnan) case sets InvalidOp, but we prefer
48
- * to return an input NaN if we have one (ie c) rather than generating
49
- * a default NaN
50
- */
51
rule = float_infzeronan_dnan_never;
52
#endif
53
}
54
--
55
2.34.1
diff view generated by jsdifflib
New patch
1
Set the FloatInfZeroNaNRule explicitly for the MIPS target,
2
so we can remove the ifdef from pickNaNMulAdd().
1
3
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Message-id: 20241202131347.498124-9-peter.maydell@linaro.org
7
---
8
target/mips/fpu_helper.h | 9 +++++++++
9
target/mips/msa.c | 4 ++++
10
fpu/softfloat-specialize.c.inc | 16 +---------------
11
3 files changed, 14 insertions(+), 15 deletions(-)
12
13
diff --git a/target/mips/fpu_helper.h b/target/mips/fpu_helper.h
14
index XXXXXXX..XXXXXXX 100644
15
--- a/target/mips/fpu_helper.h
16
+++ b/target/mips/fpu_helper.h
17
@@ -XXX,XX +XXX,XX @@ static inline void restore_flush_mode(CPUMIPSState *env)
18
static inline void restore_snan_bit_mode(CPUMIPSState *env)
19
{
20
bool nan2008 = env->active_fpu.fcr31 & (1 << FCR31_NAN2008);
21
+ FloatInfZeroNaNRule izn_rule;
22
23
/*
24
* With nan2008, SNaNs are silenced in the usual way.
25
@@ -XXX,XX +XXX,XX @@ static inline void restore_snan_bit_mode(CPUMIPSState *env)
26
*/
27
set_snan_bit_is_one(!nan2008, &env->active_fpu.fp_status);
28
set_default_nan_mode(!nan2008, &env->active_fpu.fp_status);
29
+ /*
30
+ * For MIPS systems that conform to IEEE754-1985, the (inf,zero,nan)
31
+ * case sets InvalidOp and returns the default NaN.
32
+ * For MIPS systems that conform to IEEE754-2008, the (inf,zero,nan)
33
+ * case sets InvalidOp and returns the input value 'c'.
34
+ */
35
+ izn_rule = nan2008 ? float_infzeronan_dnan_never : float_infzeronan_dnan_always;
36
+ set_float_infzeronan_rule(izn_rule, &env->active_fpu.fp_status);
37
}
38
39
static inline void restore_fp_status(CPUMIPSState *env)
40
diff --git a/target/mips/msa.c b/target/mips/msa.c
41
index XXXXXXX..XXXXXXX 100644
42
--- a/target/mips/msa.c
43
+++ b/target/mips/msa.c
44
@@ -XXX,XX +XXX,XX @@ void msa_reset(CPUMIPSState *env)
45
46
/* set proper signanling bit meaning ("1" means "quiet") */
47
set_snan_bit_is_one(0, &env->active_tc.msa_fp_status);
48
+
49
+ /* Inf * 0 + NaN returns the input NaN */
50
+ set_float_infzeronan_rule(float_infzeronan_dnan_never,
51
+ &env->active_tc.msa_fp_status);
52
}
53
diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc
54
index XXXXXXX..XXXXXXX 100644
55
--- a/fpu/softfloat-specialize.c.inc
56
+++ b/fpu/softfloat-specialize.c.inc
57
@@ -XXX,XX +XXX,XX @@ static int pickNaNMulAdd(FloatClass a_cls, FloatClass b_cls, FloatClass c_cls,
58
/*
59
* Temporarily fall back to ifdef ladder
60
*/
61
-#if defined(TARGET_MIPS)
62
- if (snan_bit_is_one(status)) {
63
- /*
64
- * For MIPS systems that conform to IEEE754-1985, the (inf,zero,nan)
65
- * case sets InvalidOp and returns the default NaN
66
- */
67
- rule = float_infzeronan_dnan_always;
68
- } else {
69
- /*
70
- * For MIPS systems that conform to IEEE754-2008, the (inf,zero,nan)
71
- * case sets InvalidOp and returns the input value 'c'
72
- */
73
- rule = float_infzeronan_dnan_never;
74
- }
75
-#elif defined(TARGET_SPARC) || \
76
+#if defined(TARGET_SPARC) || \
77
defined(TARGET_XTENSA) || defined(TARGET_HPPA) || \
78
defined(TARGET_I386) || defined(TARGET_LOONGARCH)
79
/*
80
--
81
2.34.1
diff view generated by jsdifflib
New patch
1
Set the FloatInfZeroNaNRule explicitly for the SPARC target,
2
so we can remove the ifdef from pickNaNMulAdd().
1
3
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Message-id: 20241202131347.498124-10-peter.maydell@linaro.org
7
---
8
target/sparc/cpu.c | 2 ++
9
fpu/softfloat-specialize.c.inc | 3 +--
10
2 files changed, 3 insertions(+), 2 deletions(-)
11
12
diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c
13
index XXXXXXX..XXXXXXX 100644
14
--- a/target/sparc/cpu.c
15
+++ b/target/sparc/cpu.c
16
@@ -XXX,XX +XXX,XX @@ static void sparc_cpu_realizefn(DeviceState *dev, Error **errp)
17
* the CPU state struct so it won't get zeroed on reset.
18
*/
19
set_float_2nan_prop_rule(float_2nan_prop_s_ba, &env->fp_status);
20
+ /* For inf * 0 + NaN, return the input NaN */
21
+ set_float_infzeronan_rule(float_infzeronan_dnan_never, &env->fp_status);
22
23
cpu_exec_realizefn(cs, &local_err);
24
if (local_err != NULL) {
25
diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc
26
index XXXXXXX..XXXXXXX 100644
27
--- a/fpu/softfloat-specialize.c.inc
28
+++ b/fpu/softfloat-specialize.c.inc
29
@@ -XXX,XX +XXX,XX @@ static int pickNaNMulAdd(FloatClass a_cls, FloatClass b_cls, FloatClass c_cls,
30
/*
31
* Temporarily fall back to ifdef ladder
32
*/
33
-#if defined(TARGET_SPARC) || \
34
- defined(TARGET_XTENSA) || defined(TARGET_HPPA) || \
35
+#if defined(TARGET_XTENSA) || defined(TARGET_HPPA) || \
36
defined(TARGET_I386) || defined(TARGET_LOONGARCH)
37
/*
38
* For LoongArch systems that conform to IEEE754-2008, the (inf,zero,nan)
39
--
40
2.34.1
diff view generated by jsdifflib
New patch
1
Set the FloatInfZeroNaNRule explicitly for the xtensa target,
2
so we can remove the ifdef from pickNaNMulAdd().
1
3
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Message-id: 20241202131347.498124-11-peter.maydell@linaro.org
7
---
8
target/xtensa/cpu.c | 2 ++
9
fpu/softfloat-specialize.c.inc | 2 +-
10
2 files changed, 3 insertions(+), 1 deletion(-)
11
12
diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c
13
index XXXXXXX..XXXXXXX 100644
14
--- a/target/xtensa/cpu.c
15
+++ b/target/xtensa/cpu.c
16
@@ -XXX,XX +XXX,XX @@ static void xtensa_cpu_reset_hold(Object *obj, ResetType type)
17
reset_mmu(env);
18
cs->halted = env->runstall;
19
#endif
20
+ /* For inf * 0 + NaN, return the input NaN */
21
+ set_float_infzeronan_rule(float_infzeronan_dnan_never, &env->fp_status);
22
set_no_signaling_nans(!dfpu, &env->fp_status);
23
xtensa_use_first_nan(env, !dfpu);
24
}
25
diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc
26
index XXXXXXX..XXXXXXX 100644
27
--- a/fpu/softfloat-specialize.c.inc
28
+++ b/fpu/softfloat-specialize.c.inc
29
@@ -XXX,XX +XXX,XX @@ static int pickNaNMulAdd(FloatClass a_cls, FloatClass b_cls, FloatClass c_cls,
30
/*
31
* Temporarily fall back to ifdef ladder
32
*/
33
-#if defined(TARGET_XTENSA) || defined(TARGET_HPPA) || \
34
+#if defined(TARGET_HPPA) || \
35
defined(TARGET_I386) || defined(TARGET_LOONGARCH)
36
/*
37
* For LoongArch systems that conform to IEEE754-2008, the (inf,zero,nan)
38
--
39
2.34.1
diff view generated by jsdifflib
New patch
1
Set the FloatInfZeroNaNRule explicitly for the x86 target.
1
2
3
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
Message-id: 20241202131347.498124-12-peter.maydell@linaro.org
6
---
7
target/i386/tcg/fpu_helper.c | 7 +++++++
8
fpu/softfloat-specialize.c.inc | 2 +-
9
2 files changed, 8 insertions(+), 1 deletion(-)
10
11
diff --git a/target/i386/tcg/fpu_helper.c b/target/i386/tcg/fpu_helper.c
12
index XXXXXXX..XXXXXXX 100644
13
--- a/target/i386/tcg/fpu_helper.c
14
+++ b/target/i386/tcg/fpu_helper.c
15
@@ -XXX,XX +XXX,XX @@ void cpu_init_fp_statuses(CPUX86State *env)
16
*/
17
set_float_2nan_prop_rule(float_2nan_prop_x87, &env->mmx_status);
18
set_float_2nan_prop_rule(float_2nan_prop_x87, &env->sse_status);
19
+ /*
20
+ * Only SSE has multiply-add instructions. In the SDM Section 14.5.2
21
+ * "Fused-Multiply-ADD (FMA) Numeric Behavior" the NaN handling is
22
+ * specified -- for 0 * inf + NaN the input NaN is selected, and if
23
+ * there are multiple input NaNs they are selected in the order a, b, c.
24
+ */
25
+ set_float_infzeronan_rule(float_infzeronan_dnan_never, &env->sse_status);
26
}
27
28
static inline uint8_t save_exception_flags(CPUX86State *env)
29
diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc
30
index XXXXXXX..XXXXXXX 100644
31
--- a/fpu/softfloat-specialize.c.inc
32
+++ b/fpu/softfloat-specialize.c.inc
33
@@ -XXX,XX +XXX,XX @@ static int pickNaNMulAdd(FloatClass a_cls, FloatClass b_cls, FloatClass c_cls,
34
* Temporarily fall back to ifdef ladder
35
*/
36
#if defined(TARGET_HPPA) || \
37
- defined(TARGET_I386) || defined(TARGET_LOONGARCH)
38
+ defined(TARGET_LOONGARCH)
39
/*
40
* For LoongArch systems that conform to IEEE754-2008, the (inf,zero,nan)
41
* case sets InvalidOp and returns the input value 'c'
42
--
43
2.34.1
diff view generated by jsdifflib
New patch
1
Set the FloatInfZeroNaNRule explicitly for the loongarch target.
1
2
3
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
Message-id: 20241202131347.498124-13-peter.maydell@linaro.org
6
---
7
target/loongarch/tcg/fpu_helper.c | 5 +++++
8
fpu/softfloat-specialize.c.inc | 7 +------
9
2 files changed, 6 insertions(+), 6 deletions(-)
10
11
diff --git a/target/loongarch/tcg/fpu_helper.c b/target/loongarch/tcg/fpu_helper.c
12
index XXXXXXX..XXXXXXX 100644
13
--- a/target/loongarch/tcg/fpu_helper.c
14
+++ b/target/loongarch/tcg/fpu_helper.c
15
@@ -XXX,XX +XXX,XX @@ void restore_fp_status(CPULoongArchState *env)
16
&env->fp_status);
17
set_flush_to_zero(0, &env->fp_status);
18
set_float_2nan_prop_rule(float_2nan_prop_s_ab, &env->fp_status);
19
+ /*
20
+ * For LoongArch systems that conform to IEEE754-2008, the (inf,zero,nan)
21
+ * case sets InvalidOp and returns the input value 'c'
22
+ */
23
+ set_float_infzeronan_rule(float_infzeronan_dnan_never, &env->fp_status);
24
}
25
26
int ieee_ex_to_loongarch(int xcpt)
27
diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc
28
index XXXXXXX..XXXXXXX 100644
29
--- a/fpu/softfloat-specialize.c.inc
30
+++ b/fpu/softfloat-specialize.c.inc
31
@@ -XXX,XX +XXX,XX @@ static int pickNaNMulAdd(FloatClass a_cls, FloatClass b_cls, FloatClass c_cls,
32
/*
33
* Temporarily fall back to ifdef ladder
34
*/
35
-#if defined(TARGET_HPPA) || \
36
- defined(TARGET_LOONGARCH)
37
- /*
38
- * For LoongArch systems that conform to IEEE754-2008, the (inf,zero,nan)
39
- * case sets InvalidOp and returns the input value 'c'
40
- */
41
+#if defined(TARGET_HPPA)
42
rule = float_infzeronan_dnan_never;
43
#endif
44
}
45
--
46
2.34.1
diff view generated by jsdifflib
New patch
1
Set the FloatInfZeroNaNRule explicitly for the HPPA target,
2
so we can remove the ifdef from pickNaNMulAdd().
1
3
4
As this is the last target to be converted to explicitly setting
5
the rule, we can remove the fallback code in pickNaNMulAdd()
6
entirely.
7
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
10
Message-id: 20241202131347.498124-14-peter.maydell@linaro.org
11
---
12
target/hppa/fpu_helper.c | 2 ++
13
fpu/softfloat-specialize.c.inc | 13 +------------
14
2 files changed, 3 insertions(+), 12 deletions(-)
15
16
diff --git a/target/hppa/fpu_helper.c b/target/hppa/fpu_helper.c
17
index XXXXXXX..XXXXXXX 100644
18
--- a/target/hppa/fpu_helper.c
19
+++ b/target/hppa/fpu_helper.c
20
@@ -XXX,XX +XXX,XX @@ void HELPER(loaded_fr0)(CPUHPPAState *env)
21
* HPPA does note implement a CPU reset method at all...
22
*/
23
set_float_2nan_prop_rule(float_2nan_prop_s_ab, &env->fp_status);
24
+ /* For inf * 0 + NaN, return the input NaN */
25
+ set_float_infzeronan_rule(float_infzeronan_dnan_never, &env->fp_status);
26
}
27
28
void cpu_hppa_loaded_fr0(CPUHPPAState *env)
29
diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc
30
index XXXXXXX..XXXXXXX 100644
31
--- a/fpu/softfloat-specialize.c.inc
32
+++ b/fpu/softfloat-specialize.c.inc
33
@@ -XXX,XX +XXX,XX @@ static int pickNaN(FloatClass a_cls, FloatClass b_cls,
34
static int pickNaNMulAdd(FloatClass a_cls, FloatClass b_cls, FloatClass c_cls,
35
bool infzero, float_status *status)
36
{
37
- FloatInfZeroNaNRule rule = status->float_infzeronan_rule;
38
-
39
/*
40
* We guarantee not to require the target to tell us how to
41
* pick a NaN if we're always returning the default NaN.
42
@@ -XXX,XX +XXX,XX @@ static int pickNaNMulAdd(FloatClass a_cls, FloatClass b_cls, FloatClass c_cls,
43
*/
44
assert(!status->default_nan_mode);
45
46
- if (rule == float_infzeronan_none) {
47
- /*
48
- * Temporarily fall back to ifdef ladder
49
- */
50
-#if defined(TARGET_HPPA)
51
- rule = float_infzeronan_dnan_never;
52
-#endif
53
- }
54
-
55
if (infzero) {
56
/*
57
* Inf * 0 + NaN -- some implementations return the default NaN here,
58
* and some return the input NaN.
59
*/
60
- switch (rule) {
61
+ switch (status->float_infzeronan_rule) {
62
case float_infzeronan_dnan_never:
63
return 2;
64
case float_infzeronan_dnan_always:
65
--
66
2.34.1
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
1
The new implementation of pickNaNMulAdd() will find it convenient
2
to know whether at least one of the three arguments to the muladd
3
was a signaling NaN. We already calculate that in the caller,
4
so pass it in as a new bool have_snan.
2
5
3
The USB Controllers are part of the chipset, thus are
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
always present and mapped in memory.
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20241202131347.498124-15-peter.maydell@linaro.org
9
---
10
fpu/softfloat-parts.c.inc | 5 +++--
11
fpu/softfloat-specialize.c.inc | 2 +-
12
2 files changed, 4 insertions(+), 3 deletions(-)
5
13
6
This is a migration compatibility break for the cubieboard
14
diff --git a/fpu/softfloat-parts.c.inc b/fpu/softfloat-parts.c.inc
7
machine started with the '-usb none' option.
8
9
Reported-by: Guenter Roeck <linux@roeck-us.net>
10
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
11
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
12
Tested-by: Guenter Roeck <linux@roeck-us.net>
13
Message-id: 20240119215106.45776-2-philmd@linaro.org
14
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
---
17
hw/arm/allwinner-a10.c | 49 +++++++++++++++++-------------------------
18
1 file changed, 20 insertions(+), 29 deletions(-)
19
20
diff --git a/hw/arm/allwinner-a10.c b/hw/arm/allwinner-a10.c
21
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
22
--- a/hw/arm/allwinner-a10.c
16
--- a/fpu/softfloat-parts.c.inc
23
+++ b/hw/arm/allwinner-a10.c
17
+++ b/fpu/softfloat-parts.c.inc
24
@@ -XXX,XX +XXX,XX @@ static void aw_a10_init(Object *obj)
18
@@ -XXX,XX +XXX,XX @@ static FloatPartsN *partsN(pick_nan_muladd)(FloatPartsN *a, FloatPartsN *b,
25
19
{
26
object_initialize_child(obj, "i2c0", &s->i2c0, TYPE_AW_I2C);
20
int which;
27
21
bool infzero = (ab_mask == float_cmask_infzero);
28
- if (machine_usb(current_machine)) {
22
+ bool have_snan = (abc_mask & float_cmask_snan);
29
- int i;
23
30
-
24
- if (unlikely(abc_mask & float_cmask_snan)) {
31
- for (i = 0; i < AW_A10_NUM_USB; i++) {
25
+ if (unlikely(have_snan)) {
32
- object_initialize_child(obj, "ehci[*]", &s->ehci[i],
26
float_raise(float_flag_invalid | float_flag_invalid_snan, s);
33
- TYPE_PLATFORM_EHCI);
34
- object_initialize_child(obj, "ohci[*]", &s->ohci[i],
35
- TYPE_SYSBUS_OHCI);
36
- }
37
+ for (size_t i = 0; i < AW_A10_NUM_USB; i++) {
38
+ object_initialize_child(obj, "ehci[*]", &s->ehci[i],
39
+ TYPE_PLATFORM_EHCI);
40
+ object_initialize_child(obj, "ohci[*]", &s->ohci[i], TYPE_SYSBUS_OHCI);
41
}
27
}
42
28
43
object_initialize_child(obj, "mmc0", &s->mmc0, TYPE_AW_SDHOST_SUN4I);
29
@@ -XXX,XX +XXX,XX @@ static FloatPartsN *partsN(pick_nan_muladd)(FloatPartsN *a, FloatPartsN *b,
44
@@ -XXX,XX +XXX,XX @@ static void aw_a10_realize(DeviceState *dev, Error **errp)
30
if (s->default_nan_mode) {
45
qdev_get_gpio_in(dev, 1),
31
which = 3;
46
115200, serial_hd(0), DEVICE_NATIVE_ENDIAN);
32
} else {
47
33
- which = pickNaNMulAdd(a->cls, b->cls, c->cls, infzero, s);
48
- if (machine_usb(current_machine)) {
34
+ which = pickNaNMulAdd(a->cls, b->cls, c->cls, infzero, have_snan, s);
49
- int i;
50
+ for (size_t i = 0; i < AW_A10_NUM_USB; i++) {
51
+ g_autofree char *bus = g_strdup_printf("usb-bus.%zu", i);
52
53
- for (i = 0; i < AW_A10_NUM_USB; i++) {
54
- g_autofree char *bus = g_strdup_printf("usb-bus.%d", i);
55
+ object_property_set_bool(OBJECT(&s->ehci[i]), "companion-enable",
56
+ true, &error_fatal);
57
+ sysbus_realize(SYS_BUS_DEVICE(&s->ehci[i]), &error_fatal);
58
+ sysbus_mmio_map(SYS_BUS_DEVICE(&s->ehci[i]), 0,
59
+ AW_A10_EHCI_BASE + i * 0x8000);
60
+ sysbus_connect_irq(SYS_BUS_DEVICE(&s->ehci[i]), 0,
61
+ qdev_get_gpio_in(dev, 39 + i));
62
63
- object_property_set_bool(OBJECT(&s->ehci[i]), "companion-enable",
64
- true, &error_fatal);
65
- sysbus_realize(SYS_BUS_DEVICE(&s->ehci[i]), &error_fatal);
66
- sysbus_mmio_map(SYS_BUS_DEVICE(&s->ehci[i]), 0,
67
- AW_A10_EHCI_BASE + i * 0x8000);
68
- sysbus_connect_irq(SYS_BUS_DEVICE(&s->ehci[i]), 0,
69
- qdev_get_gpio_in(dev, 39 + i));
70
-
71
- object_property_set_str(OBJECT(&s->ohci[i]), "masterbus", bus,
72
- &error_fatal);
73
- sysbus_realize(SYS_BUS_DEVICE(&s->ohci[i]), &error_fatal);
74
- sysbus_mmio_map(SYS_BUS_DEVICE(&s->ohci[i]), 0,
75
- AW_A10_OHCI_BASE + i * 0x8000);
76
- sysbus_connect_irq(SYS_BUS_DEVICE(&s->ohci[i]), 0,
77
- qdev_get_gpio_in(dev, 64 + i));
78
- }
79
+ object_property_set_str(OBJECT(&s->ohci[i]), "masterbus", bus,
80
+ &error_fatal);
81
+ sysbus_realize(SYS_BUS_DEVICE(&s->ohci[i]), &error_fatal);
82
+ sysbus_mmio_map(SYS_BUS_DEVICE(&s->ohci[i]), 0,
83
+ AW_A10_OHCI_BASE + i * 0x8000);
84
+ sysbus_connect_irq(SYS_BUS_DEVICE(&s->ohci[i]), 0,
85
+ qdev_get_gpio_in(dev, 64 + i));
86
}
35
}
87
36
88
/* SD/MMC */
37
if (which == 3) {
38
diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc
39
index XXXXXXX..XXXXXXX 100644
40
--- a/fpu/softfloat-specialize.c.inc
41
+++ b/fpu/softfloat-specialize.c.inc
42
@@ -XXX,XX +XXX,XX @@ static int pickNaN(FloatClass a_cls, FloatClass b_cls,
43
| Return values : 0 : a; 1 : b; 2 : c; 3 : default-NaN
44
*----------------------------------------------------------------------------*/
45
static int pickNaNMulAdd(FloatClass a_cls, FloatClass b_cls, FloatClass c_cls,
46
- bool infzero, float_status *status)
47
+ bool infzero, bool have_snan, float_status *status)
48
{
49
/*
50
* We guarantee not to require the target to tell us how to
89
--
51
--
90
2.34.1
52
2.34.1
91
92
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
1
IEEE 758 does not define a fixed rule for which NaN to pick as the
2
2
result if both operands of a 3-operand fused multiply-add operation
3
target/arm/cpregs.h uses the FIELD() macro defined in
3
are NaNs. As a result different architectures have ended up with
4
"hw/registerfields.h". Include it in order to avoid when
4
different rules for propagating NaNs.
5
refactoring unrelated headers:
5
6
6
QEMU currently hardcodes the NaN propagation logic into the binary
7
target/arm/cpregs.h:347:30: error: expected identifier
7
because pickNaNMulAdd() has an ifdef ladder for different targets.
8
FIELD(HFGRTR_EL2, AFSR0_EL1, 0, 1)
8
We want to make the propagation rule instead be selectable at
9
^
9
runtime, because:
10
10
* this will let us have multiple targets in one QEMU binary
11
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
11
* the Arm FEAT_AFP architectural feature includes letting
12
the guest select a NaN propagation rule at runtime
13
14
In this commit we add an enum for the propagation rule, the field in
15
float_status, and the corresponding getters and setters. We change
16
pickNaNMulAdd to honour this, but because all targets still leave
17
this field at its default 0 value, the fallback logic will pick the
18
rule type with the old ifdef ladder.
19
20
It's valid not to set a propagation rule if default_nan_mode is
21
enabled, because in that case there's no need to pick a NaN; all the
22
callers of pickNaNMulAdd() catch this case and skip calling it.
23
24
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
25
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
13
Message-id: 20240118200643.29037-7-philmd@linaro.org
26
Message-id: 20241202131347.498124-16-peter.maydell@linaro.org
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
---
27
---
16
target/arm/cpregs.h | 2 ++
28
include/fpu/softfloat-helpers.h | 11 +++
17
1 file changed, 2 insertions(+)
29
include/fpu/softfloat-types.h | 55 +++++++++++
18
30
fpu/softfloat-specialize.c.inc | 167 ++++++++------------------------
19
diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h
31
3 files changed, 107 insertions(+), 126 deletions(-)
32
33
diff --git a/include/fpu/softfloat-helpers.h b/include/fpu/softfloat-helpers.h
20
index XXXXXXX..XXXXXXX 100644
34
index XXXXXXX..XXXXXXX 100644
21
--- a/target/arm/cpregs.h
35
--- a/include/fpu/softfloat-helpers.h
22
+++ b/target/arm/cpregs.h
36
+++ b/include/fpu/softfloat-helpers.h
23
@@ -XXX,XX +XXX,XX @@
37
@@ -XXX,XX +XXX,XX @@ static inline void set_float_2nan_prop_rule(Float2NaNPropRule rule,
24
#ifndef TARGET_ARM_CPREGS_H
38
status->float_2nan_prop_rule = rule;
25
#define TARGET_ARM_CPREGS_H
39
}
40
41
+static inline void set_float_3nan_prop_rule(Float3NaNPropRule rule,
42
+ float_status *status)
43
+{
44
+ status->float_3nan_prop_rule = rule;
45
+}
46
+
47
static inline void set_float_infzeronan_rule(FloatInfZeroNaNRule rule,
48
float_status *status)
49
{
50
@@ -XXX,XX +XXX,XX @@ static inline Float2NaNPropRule get_float_2nan_prop_rule(float_status *status)
51
return status->float_2nan_prop_rule;
52
}
53
54
+static inline Float3NaNPropRule get_float_3nan_prop_rule(float_status *status)
55
+{
56
+ return status->float_3nan_prop_rule;
57
+}
58
+
59
static inline FloatInfZeroNaNRule get_float_infzeronan_rule(float_status *status)
60
{
61
return status->float_infzeronan_rule;
62
diff --git a/include/fpu/softfloat-types.h b/include/fpu/softfloat-types.h
63
index XXXXXXX..XXXXXXX 100644
64
--- a/include/fpu/softfloat-types.h
65
+++ b/include/fpu/softfloat-types.h
66
@@ -XXX,XX +XXX,XX @@ this code that are retained.
67
#ifndef SOFTFLOAT_TYPES_H
68
#define SOFTFLOAT_TYPES_H
26
69
27
+#include "hw/registerfields.h"
70
+#include "hw/registerfields.h"
28
+
71
+
29
/*
72
/*
30
* ARMCPRegInfo type field bits:
73
* Software IEC/IEEE floating-point types.
31
*/
74
*/
75
@@ -XXX,XX +XXX,XX @@ typedef enum __attribute__((__packed__)) {
76
float_2nan_prop_x87,
77
} Float2NaNPropRule;
78
79
+/*
80
+ * 3-input NaN propagation rule, for fused multiply-add. Individual
81
+ * architectures have different rules for which input NaN is
82
+ * propagated to the output when there is more than one NaN on the
83
+ * input.
84
+ *
85
+ * If default_nan_mode is enabled then it is valid not to set a NaN
86
+ * propagation rule, because the softfloat code guarantees not to try
87
+ * to pick a NaN to propagate in default NaN mode. When not in
88
+ * default-NaN mode, it is an error for the target not to set the rule
89
+ * in float_status if it uses a muladd, and we will assert if we need
90
+ * to handle an input NaN and no rule was selected.
91
+ *
92
+ * The naming scheme for Float3NaNPropRule values is:
93
+ * float_3nan_prop_s_abc:
94
+ * = "Prefer SNaN over QNaN, then operand A over B over C"
95
+ * float_3nan_prop_abc:
96
+ * = "Prefer A over B over C regardless of SNaN vs QNAN"
97
+ *
98
+ * For QEMU, the multiply-add operation is A * B + C.
99
+ */
100
+
101
+/*
102
+ * We set the Float3NaNPropRule enum values up so we can select the
103
+ * right value in pickNaNMulAdd in a data driven way.
104
+ */
105
+FIELD(3NAN, 1ST, 0, 2) /* which operand is most preferred ? */
106
+FIELD(3NAN, 2ND, 2, 2) /* which operand is next most preferred ? */
107
+FIELD(3NAN, 3RD, 4, 2) /* which operand is least preferred ? */
108
+FIELD(3NAN, SNAN, 6, 1) /* do we prefer SNaN over QNaN ? */
109
+
110
+#define PROPRULE(X, Y, Z) \
111
+ ((X << R_3NAN_1ST_SHIFT) | (Y << R_3NAN_2ND_SHIFT) | (Z << R_3NAN_3RD_SHIFT))
112
+
113
+typedef enum __attribute__((__packed__)) {
114
+ float_3nan_prop_none = 0, /* No propagation rule specified */
115
+ float_3nan_prop_abc = PROPRULE(0, 1, 2),
116
+ float_3nan_prop_acb = PROPRULE(0, 2, 1),
117
+ float_3nan_prop_bac = PROPRULE(1, 0, 2),
118
+ float_3nan_prop_bca = PROPRULE(1, 2, 0),
119
+ float_3nan_prop_cab = PROPRULE(2, 0, 1),
120
+ float_3nan_prop_cba = PROPRULE(2, 1, 0),
121
+ float_3nan_prop_s_abc = float_3nan_prop_abc | R_3NAN_SNAN_MASK,
122
+ float_3nan_prop_s_acb = float_3nan_prop_acb | R_3NAN_SNAN_MASK,
123
+ float_3nan_prop_s_bac = float_3nan_prop_bac | R_3NAN_SNAN_MASK,
124
+ float_3nan_prop_s_bca = float_3nan_prop_bca | R_3NAN_SNAN_MASK,
125
+ float_3nan_prop_s_cab = float_3nan_prop_cab | R_3NAN_SNAN_MASK,
126
+ float_3nan_prop_s_cba = float_3nan_prop_cba | R_3NAN_SNAN_MASK,
127
+} Float3NaNPropRule;
128
+
129
+#undef PROPRULE
130
+
131
/*
132
* Rule for result of fused multiply-add 0 * Inf + NaN.
133
* This must be a NaN, but implementations differ on whether this
134
@@ -XXX,XX +XXX,XX @@ typedef struct float_status {
135
FloatRoundMode float_rounding_mode;
136
FloatX80RoundPrec floatx80_rounding_precision;
137
Float2NaNPropRule float_2nan_prop_rule;
138
+ Float3NaNPropRule float_3nan_prop_rule;
139
FloatInfZeroNaNRule float_infzeronan_rule;
140
bool tininess_before_rounding;
141
/* should denormalised results go to zero and set the inexact flag? */
142
diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc
143
index XXXXXXX..XXXXXXX 100644
144
--- a/fpu/softfloat-specialize.c.inc
145
+++ b/fpu/softfloat-specialize.c.inc
146
@@ -XXX,XX +XXX,XX @@ static int pickNaN(FloatClass a_cls, FloatClass b_cls,
147
static int pickNaNMulAdd(FloatClass a_cls, FloatClass b_cls, FloatClass c_cls,
148
bool infzero, bool have_snan, float_status *status)
149
{
150
+ FloatClass cls[3] = { a_cls, b_cls, c_cls };
151
+ Float3NaNPropRule rule = status->float_3nan_prop_rule;
152
+ int which;
153
+
154
/*
155
* We guarantee not to require the target to tell us how to
156
* pick a NaN if we're always returning the default NaN.
157
@@ -XXX,XX +XXX,XX @@ static int pickNaNMulAdd(FloatClass a_cls, FloatClass b_cls, FloatClass c_cls,
158
}
159
}
160
161
+ if (rule == float_3nan_prop_none) {
162
#if defined(TARGET_ARM)
163
-
164
- /* This looks different from the ARM ARM pseudocode, because the ARM ARM
165
- * puts the operands to a fused mac operation (a*b)+c in the order c,a,b.
166
- */
167
- if (is_snan(c_cls)) {
168
- return 2;
169
- } else if (is_snan(a_cls)) {
170
- return 0;
171
- } else if (is_snan(b_cls)) {
172
- return 1;
173
- } else if (is_qnan(c_cls)) {
174
- return 2;
175
- } else if (is_qnan(a_cls)) {
176
- return 0;
177
- } else {
178
- return 1;
179
- }
180
+ /*
181
+ * This looks different from the ARM ARM pseudocode, because the ARM ARM
182
+ * puts the operands to a fused mac operation (a*b)+c in the order c,a,b
183
+ */
184
+ rule = float_3nan_prop_s_cab;
185
#elif defined(TARGET_MIPS)
186
- if (snan_bit_is_one(status)) {
187
- /* Prefer sNaN over qNaN, in the a, b, c order. */
188
- if (is_snan(a_cls)) {
189
- return 0;
190
- } else if (is_snan(b_cls)) {
191
- return 1;
192
- } else if (is_snan(c_cls)) {
193
- return 2;
194
- } else if (is_qnan(a_cls)) {
195
- return 0;
196
- } else if (is_qnan(b_cls)) {
197
- return 1;
198
+ if (snan_bit_is_one(status)) {
199
+ rule = float_3nan_prop_s_abc;
200
} else {
201
- return 2;
202
+ rule = float_3nan_prop_s_cab;
203
}
204
- } else {
205
- /* Prefer sNaN over qNaN, in the c, a, b order. */
206
- if (is_snan(c_cls)) {
207
- return 2;
208
- } else if (is_snan(a_cls)) {
209
- return 0;
210
- } else if (is_snan(b_cls)) {
211
- return 1;
212
- } else if (is_qnan(c_cls)) {
213
- return 2;
214
- } else if (is_qnan(a_cls)) {
215
- return 0;
216
- } else {
217
- return 1;
218
- }
219
- }
220
#elif defined(TARGET_LOONGARCH64)
221
- /* Prefer sNaN over qNaN, in the c, a, b order. */
222
- if (is_snan(c_cls)) {
223
- return 2;
224
- } else if (is_snan(a_cls)) {
225
- return 0;
226
- } else if (is_snan(b_cls)) {
227
- return 1;
228
- } else if (is_qnan(c_cls)) {
229
- return 2;
230
- } else if (is_qnan(a_cls)) {
231
- return 0;
232
- } else {
233
- return 1;
234
- }
235
+ rule = float_3nan_prop_s_cab;
236
#elif defined(TARGET_PPC)
237
- /* If fRA is a NaN return it; otherwise if fRB is a NaN return it;
238
- * otherwise return fRC. Note that muladd on PPC is (fRA * fRC) + frB
239
- */
240
- if (is_nan(a_cls)) {
241
- return 0;
242
- } else if (is_nan(c_cls)) {
243
- return 2;
244
- } else {
245
- return 1;
246
- }
247
+ /*
248
+ * If fRA is a NaN return it; otherwise if fRB is a NaN return it;
249
+ * otherwise return fRC. Note that muladd on PPC is (fRA * fRC) + frB
250
+ */
251
+ rule = float_3nan_prop_acb;
252
#elif defined(TARGET_S390X)
253
- if (is_snan(a_cls)) {
254
- return 0;
255
- } else if (is_snan(b_cls)) {
256
- return 1;
257
- } else if (is_snan(c_cls)) {
258
- return 2;
259
- } else if (is_qnan(a_cls)) {
260
- return 0;
261
- } else if (is_qnan(b_cls)) {
262
- return 1;
263
- } else {
264
- return 2;
265
- }
266
+ rule = float_3nan_prop_s_abc;
267
#elif defined(TARGET_SPARC)
268
- /* Prefer SNaN over QNaN, order C, B, A. */
269
- if (is_snan(c_cls)) {
270
- return 2;
271
- } else if (is_snan(b_cls)) {
272
- return 1;
273
- } else if (is_snan(a_cls)) {
274
- return 0;
275
- } else if (is_qnan(c_cls)) {
276
- return 2;
277
- } else if (is_qnan(b_cls)) {
278
- return 1;
279
- } else {
280
- return 0;
281
- }
282
+ rule = float_3nan_prop_s_cba;
283
#elif defined(TARGET_XTENSA)
284
- /*
285
- * For Xtensa, the (inf,zero,nan) case sets InvalidOp and returns
286
- * an input NaN if we have one (ie c).
287
- */
288
- if (status->use_first_nan) {
289
- if (is_nan(a_cls)) {
290
- return 0;
291
- } else if (is_nan(b_cls)) {
292
- return 1;
293
+ if (status->use_first_nan) {
294
+ rule = float_3nan_prop_abc;
295
} else {
296
- return 2;
297
+ rule = float_3nan_prop_cba;
298
}
299
- } else {
300
- if (is_nan(c_cls)) {
301
- return 2;
302
- } else if (is_nan(b_cls)) {
303
- return 1;
304
- } else {
305
- return 0;
306
- }
307
- }
308
#else
309
- /* A default implementation: prefer a to b to c.
310
- * This is unlikely to actually match any real implementation.
311
- */
312
- if (is_nan(a_cls)) {
313
- return 0;
314
- } else if (is_nan(b_cls)) {
315
- return 1;
316
- } else {
317
- return 2;
318
- }
319
+ rule = float_3nan_prop_abc;
320
#endif
321
+ }
322
+
323
+ assert(rule != float_3nan_prop_none);
324
+ if (have_snan && (rule & R_3NAN_SNAN_MASK)) {
325
+ /* We have at least one SNaN input and should prefer it */
326
+ do {
327
+ which = rule & R_3NAN_1ST_MASK;
328
+ rule >>= R_3NAN_1ST_LENGTH;
329
+ } while (!is_snan(cls[which]));
330
+ } else {
331
+ do {
332
+ which = rule & R_3NAN_1ST_MASK;
333
+ rule >>= R_3NAN_1ST_LENGTH;
334
+ } while (!is_nan(cls[which]));
335
+ }
336
+ return which;
337
}
338
339
/*----------------------------------------------------------------------------
32
--
340
--
33
2.34.1
341
2.34.1
34
35
diff view generated by jsdifflib
New patch
1
Explicitly set a rule in the softfloat tests for propagating NaNs in
2
the muladd case. In meson.build we put -DTARGET_ARM in fpcflags, and
3
so we should select here the Arm rule of float_3nan_prop_s_cab.
1
4
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Message-id: 20241202131347.498124-17-peter.maydell@linaro.org
8
---
9
tests/fp/fp-bench.c | 1 +
10
tests/fp/fp-test.c | 1 +
11
2 files changed, 2 insertions(+)
12
13
diff --git a/tests/fp/fp-bench.c b/tests/fp/fp-bench.c
14
index XXXXXXX..XXXXXXX 100644
15
--- a/tests/fp/fp-bench.c
16
+++ b/tests/fp/fp-bench.c
17
@@ -XXX,XX +XXX,XX @@ static void run_bench(void)
18
* doesn't specify match those used by the Arm architecture.
19
*/
20
set_float_2nan_prop_rule(float_2nan_prop_s_ab, &soft_status);
21
+ set_float_3nan_prop_rule(float_3nan_prop_s_cab, &soft_status);
22
set_float_infzeronan_rule(float_infzeronan_dnan_if_qnan, &soft_status);
23
24
f = bench_funcs[operation][precision];
25
diff --git a/tests/fp/fp-test.c b/tests/fp/fp-test.c
26
index XXXXXXX..XXXXXXX 100644
27
--- a/tests/fp/fp-test.c
28
+++ b/tests/fp/fp-test.c
29
@@ -XXX,XX +XXX,XX @@ void run_test(void)
30
* doesn't specify match those used by the Arm architecture.
31
*/
32
set_float_2nan_prop_rule(float_2nan_prop_s_ab, &qsf);
33
+ set_float_3nan_prop_rule(float_3nan_prop_s_cab, &qsf);
34
set_float_infzeronan_rule(float_infzeronan_dnan_if_qnan, &qsf);
35
36
genCases_setLevel(test_level);
37
--
38
2.34.1
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
1
Set the Float3NaNPropRule explicitly for Arm, and remove the
2
ifdef from pickNaNMulAdd().
2
3
3
The ARM_CPU_IRQ/FIQ definitions are used to index the GPIO
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
IRQ created calling qdev_init_gpio_in() in ARMCPU instance_init()
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
handler. To allow non-ARM code to raise interrupt on ARM cores,
6
Message-id: 20241202131347.498124-18-peter.maydell@linaro.org
6
move they to 'target/arm/cpu-qom.h' which is non-ARM specific and
7
---
7
can be included by any hw/ file.
8
target/arm/cpu.c | 5 +++++
9
fpu/softfloat-specialize.c.inc | 8 +-------
10
2 files changed, 6 insertions(+), 7 deletions(-)
8
11
9
File list to include the new header generated using:
10
11
$ git grep -wEl 'ARM_CPU_(\w*IRQ|FIQ)'
12
13
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
14
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
15
Message-id: 20240118200643.29037-18-philmd@linaro.org
16
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
17
---
18
target/arm/cpu-qom.h | 6 ++++++
19
target/arm/cpu.h | 6 ------
20
hw/arm/allwinner-a10.c | 1 +
21
hw/arm/allwinner-h3.c | 1 +
22
hw/arm/allwinner-r40.c | 1 +
23
hw/arm/armv7m.c | 1 +
24
hw/arm/aspeed_ast2400.c | 1 +
25
hw/arm/aspeed_ast2600.c | 1 +
26
hw/arm/bcm2836.c | 1 +
27
hw/arm/exynos4210.c | 1 +
28
hw/arm/fsl-imx25.c | 1 +
29
hw/arm/fsl-imx31.c | 1 +
30
hw/arm/fsl-imx6.c | 1 +
31
hw/arm/fsl-imx6ul.c | 1 +
32
hw/arm/fsl-imx7.c | 1 +
33
hw/arm/highbank.c | 1 +
34
hw/arm/integratorcp.c | 1 +
35
hw/arm/musicpal.c | 1 +
36
hw/arm/npcm7xx.c | 1 +
37
hw/arm/omap1.c | 1 +
38
hw/arm/omap2.c | 1 +
39
hw/arm/realview.c | 1 +
40
hw/arm/sbsa-ref.c | 1 +
41
hw/arm/strongarm.c | 1 +
42
hw/arm/versatilepb.c | 1 +
43
hw/arm/vexpress.c | 1 +
44
hw/arm/virt.c | 1 +
45
hw/arm/xilinx_zynq.c | 1 +
46
hw/arm/xlnx-versal.c | 1 +
47
hw/arm/xlnx-zynqmp.c | 1 +
48
target/arm/cpu.c | 1 +
49
31 files changed, 35 insertions(+), 6 deletions(-)
50
51
diff --git a/target/arm/cpu-qom.h b/target/arm/cpu-qom.h
52
index XXXXXXX..XXXXXXX 100644
53
--- a/target/arm/cpu-qom.h
54
+++ b/target/arm/cpu-qom.h
55
@@ -XXX,XX +XXX,XX @@ DECLARE_CLASS_CHECKERS(AArch64CPUClass, AARCH64_CPU,
56
#define ARM_CPU_TYPE_SUFFIX "-" TYPE_ARM_CPU
57
#define ARM_CPU_TYPE_NAME(name) (name ARM_CPU_TYPE_SUFFIX)
58
59
+/* Meanings of the ARMCPU object's four inbound GPIO lines */
60
+#define ARM_CPU_IRQ 0
61
+#define ARM_CPU_FIQ 1
62
+#define ARM_CPU_VIRQ 2
63
+#define ARM_CPU_VFIQ 3
64
+
65
/* For M profile, some registers are banked secure vs non-secure;
66
* these are represented as a 2-element array where the first element
67
* is the non-secure copy and the second is the secure copy.
68
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
69
index XXXXXXX..XXXXXXX 100644
70
--- a/target/arm/cpu.h
71
+++ b/target/arm/cpu.h
72
@@ -XXX,XX +XXX,XX @@
73
#define offsetofhigh32(S, M) (offsetof(S, M) + sizeof(uint32_t))
74
#endif
75
76
-/* Meanings of the ARMCPU object's four inbound GPIO lines */
77
-#define ARM_CPU_IRQ 0
78
-#define ARM_CPU_FIQ 1
79
-#define ARM_CPU_VIRQ 2
80
-#define ARM_CPU_VFIQ 3
81
-
82
/* ARM-specific extra insn start words:
83
* 1: Conditional execution bits
84
* 2: Partial exception syndrome for data aborts
85
diff --git a/hw/arm/allwinner-a10.c b/hw/arm/allwinner-a10.c
86
index XXXXXXX..XXXXXXX 100644
87
--- a/hw/arm/allwinner-a10.c
88
+++ b/hw/arm/allwinner-a10.c
89
@@ -XXX,XX +XXX,XX @@
90
#include "hw/boards.h"
91
#include "hw/usb/hcd-ohci.h"
92
#include "hw/loader.h"
93
+#include "target/arm/cpu-qom.h"
94
95
#define AW_A10_SRAM_A_BASE 0x00000000
96
#define AW_A10_DRAMC_BASE 0x01c01000
97
diff --git a/hw/arm/allwinner-h3.c b/hw/arm/allwinner-h3.c
98
index XXXXXXX..XXXXXXX 100644
99
--- a/hw/arm/allwinner-h3.c
100
+++ b/hw/arm/allwinner-h3.c
101
@@ -XXX,XX +XXX,XX @@
102
#include "hw/loader.h"
103
#include "sysemu/sysemu.h"
104
#include "hw/arm/allwinner-h3.h"
105
+#include "target/arm/cpu-qom.h"
106
107
/* Memory map */
108
const hwaddr allwinner_h3_memmap[] = {
109
diff --git a/hw/arm/allwinner-r40.c b/hw/arm/allwinner-r40.c
110
index XXXXXXX..XXXXXXX 100644
111
--- a/hw/arm/allwinner-r40.c
112
+++ b/hw/arm/allwinner-r40.c
113
@@ -XXX,XX +XXX,XX @@
114
#include "sysemu/sysemu.h"
115
#include "hw/arm/allwinner-r40.h"
116
#include "hw/misc/allwinner-r40-dramc.h"
117
+#include "target/arm/cpu-qom.h"
118
119
/* Memory map */
120
const hwaddr allwinner_r40_memmap[] = {
121
diff --git a/hw/arm/armv7m.c b/hw/arm/armv7m.c
122
index XXXXXXX..XXXXXXX 100644
123
--- a/hw/arm/armv7m.c
124
+++ b/hw/arm/armv7m.c
125
@@ -XXX,XX +XXX,XX @@
126
#include "target/arm/idau.h"
127
#include "target/arm/cpu.h"
128
#include "target/arm/cpu-features.h"
129
+#include "target/arm/cpu-qom.h"
130
#include "migration/vmstate.h"
131
132
/* Bitbanded IO. Each word corresponds to a single bit. */
133
diff --git a/hw/arm/aspeed_ast2400.c b/hw/arm/aspeed_ast2400.c
134
index XXXXXXX..XXXXXXX 100644
135
--- a/hw/arm/aspeed_ast2400.c
136
+++ b/hw/arm/aspeed_ast2400.c
137
@@ -XXX,XX +XXX,XX @@
138
#include "hw/i2c/aspeed_i2c.h"
139
#include "net/net.h"
140
#include "sysemu/sysemu.h"
141
+#include "target/arm/cpu-qom.h"
142
143
#define ASPEED_SOC_IOMEM_SIZE 0x00200000
144
145
diff --git a/hw/arm/aspeed_ast2600.c b/hw/arm/aspeed_ast2600.c
146
index XXXXXXX..XXXXXXX 100644
147
--- a/hw/arm/aspeed_ast2600.c
148
+++ b/hw/arm/aspeed_ast2600.c
149
@@ -XXX,XX +XXX,XX @@
150
#include "hw/i2c/aspeed_i2c.h"
151
#include "net/net.h"
152
#include "sysemu/sysemu.h"
153
+#include "target/arm/cpu-qom.h"
154
155
#define ASPEED_SOC_IOMEM_SIZE 0x00200000
156
#define ASPEED_SOC_DPMCU_SIZE 0x00040000
157
diff --git a/hw/arm/bcm2836.c b/hw/arm/bcm2836.c
158
index XXXXXXX..XXXXXXX 100644
159
--- a/hw/arm/bcm2836.c
160
+++ b/hw/arm/bcm2836.c
161
@@ -XXX,XX +XXX,XX @@
162
#include "hw/arm/bcm2836.h"
163
#include "hw/arm/raspi_platform.h"
164
#include "hw/sysbus.h"
165
+#include "target/arm/cpu-qom.h"
166
167
struct BCM283XClass {
168
/*< private >*/
169
diff --git a/hw/arm/exynos4210.c b/hw/arm/exynos4210.c
170
index XXXXXXX..XXXXXXX 100644
171
--- a/hw/arm/exynos4210.c
172
+++ b/hw/arm/exynos4210.c
173
@@ -XXX,XX +XXX,XX @@
174
#include "hw/arm/exynos4210.h"
175
#include "hw/sd/sdhci.h"
176
#include "hw/usb/hcd-ehci.h"
177
+#include "target/arm/cpu-qom.h"
178
179
#define EXYNOS4210_CHIPID_ADDR 0x10000000
180
181
diff --git a/hw/arm/fsl-imx25.c b/hw/arm/fsl-imx25.c
182
index XXXXXXX..XXXXXXX 100644
183
--- a/hw/arm/fsl-imx25.c
184
+++ b/hw/arm/fsl-imx25.c
185
@@ -XXX,XX +XXX,XX @@
186
#include "sysemu/sysemu.h"
187
#include "hw/qdev-properties.h"
188
#include "chardev/char.h"
189
+#include "target/arm/cpu-qom.h"
190
191
#define IMX25_ESDHC_CAPABILITIES 0x07e20000
192
193
diff --git a/hw/arm/fsl-imx31.c b/hw/arm/fsl-imx31.c
194
index XXXXXXX..XXXXXXX 100644
195
--- a/hw/arm/fsl-imx31.c
196
+++ b/hw/arm/fsl-imx31.c
197
@@ -XXX,XX +XXX,XX @@
198
#include "exec/address-spaces.h"
199
#include "hw/qdev-properties.h"
200
#include "chardev/char.h"
201
+#include "target/arm/cpu-qom.h"
202
203
static void fsl_imx31_init(Object *obj)
204
{
205
diff --git a/hw/arm/fsl-imx6.c b/hw/arm/fsl-imx6.c
206
index XXXXXXX..XXXXXXX 100644
207
--- a/hw/arm/fsl-imx6.c
208
+++ b/hw/arm/fsl-imx6.c
209
@@ -XXX,XX +XXX,XX @@
210
#include "chardev/char.h"
211
#include "qemu/error-report.h"
212
#include "qemu/module.h"
213
+#include "target/arm/cpu-qom.h"
214
215
#define IMX6_ESDHC_CAPABILITIES 0x057834b4
216
217
diff --git a/hw/arm/fsl-imx6ul.c b/hw/arm/fsl-imx6ul.c
218
index XXXXXXX..XXXXXXX 100644
219
--- a/hw/arm/fsl-imx6ul.c
220
+++ b/hw/arm/fsl-imx6ul.c
221
@@ -XXX,XX +XXX,XX @@
222
#include "sysemu/sysemu.h"
223
#include "qemu/error-report.h"
224
#include "qemu/module.h"
225
+#include "target/arm/cpu-qom.h"
226
227
#define NAME_SIZE 20
228
229
diff --git a/hw/arm/fsl-imx7.c b/hw/arm/fsl-imx7.c
230
index XXXXXXX..XXXXXXX 100644
231
--- a/hw/arm/fsl-imx7.c
232
+++ b/hw/arm/fsl-imx7.c
233
@@ -XXX,XX +XXX,XX @@
234
#include "sysemu/sysemu.h"
235
#include "qemu/error-report.h"
236
#include "qemu/module.h"
237
+#include "target/arm/cpu-qom.h"
238
239
#define NAME_SIZE 20
240
241
diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c
242
index XXXXXXX..XXXXXXX 100644
243
--- a/hw/arm/highbank.c
244
+++ b/hw/arm/highbank.c
245
@@ -XXX,XX +XXX,XX @@
246
#include "qemu/log.h"
247
#include "qom/object.h"
248
#include "cpu.h"
249
+#include "target/arm/cpu-qom.h"
250
251
#define SMP_BOOT_ADDR 0x100
252
#define SMP_BOOT_REG 0x40
253
diff --git a/hw/arm/integratorcp.c b/hw/arm/integratorcp.c
254
index XXXXXXX..XXXXXXX 100644
255
--- a/hw/arm/integratorcp.c
256
+++ b/hw/arm/integratorcp.c
257
@@ -XXX,XX +XXX,XX @@
258
#include "hw/sd/sd.h"
259
#include "qom/object.h"
260
#include "audio/audio.h"
261
+#include "target/arm/cpu-qom.h"
262
263
#define TYPE_INTEGRATOR_CM "integrator_core"
264
OBJECT_DECLARE_SIMPLE_TYPE(IntegratorCMState, INTEGRATOR_CM)
265
diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c
266
index XXXXXXX..XXXXXXX 100644
267
--- a/hw/arm/musicpal.c
268
+++ b/hw/arm/musicpal.c
269
@@ -XXX,XX +XXX,XX @@
270
#include "hw/net/mv88w8618_eth.h"
271
#include "audio/audio.h"
272
#include "qemu/error-report.h"
273
+#include "target/arm/cpu-qom.h"
274
275
#define MP_MISC_BASE 0x80002000
276
#define MP_MISC_SIZE 0x00001000
277
diff --git a/hw/arm/npcm7xx.c b/hw/arm/npcm7xx.c
278
index XXXXXXX..XXXXXXX 100644
279
--- a/hw/arm/npcm7xx.c
280
+++ b/hw/arm/npcm7xx.c
281
@@ -XXX,XX +XXX,XX @@
282
#include "qapi/error.h"
283
#include "qemu/units.h"
284
#include "sysemu/sysemu.h"
285
+#include "target/arm/cpu-qom.h"
286
287
/*
288
* This covers the whole MMIO space. We'll use this to catch any MMIO accesses
289
diff --git a/hw/arm/omap1.c b/hw/arm/omap1.c
290
index XXXXXXX..XXXXXXX 100644
291
--- a/hw/arm/omap1.c
292
+++ b/hw/arm/omap1.c
293
@@ -XXX,XX +XXX,XX @@
294
#include "hw/sysbus.h"
295
#include "qemu/cutils.h"
296
#include "qemu/bcd.h"
297
+#include "target/arm/cpu-qom.h"
298
299
static inline void omap_log_badwidth(const char *funcname, hwaddr addr, int sz)
300
{
301
diff --git a/hw/arm/omap2.c b/hw/arm/omap2.c
302
index XXXXXXX..XXXXXXX 100644
303
--- a/hw/arm/omap2.c
304
+++ b/hw/arm/omap2.c
305
@@ -XXX,XX +XXX,XX @@
306
#include "hw/sysbus.h"
307
#include "hw/boards.h"
308
#include "audio/audio.h"
309
+#include "target/arm/cpu-qom.h"
310
311
/* Enhanced Audio Controller (CODEC only) */
312
struct omap_eac_s {
313
diff --git a/hw/arm/realview.c b/hw/arm/realview.c
314
index XXXXXXX..XXXXXXX 100644
315
--- a/hw/arm/realview.c
316
+++ b/hw/arm/realview.c
317
@@ -XXX,XX +XXX,XX @@
318
#include "hw/i2c/arm_sbcon_i2c.h"
319
#include "hw/sd/sd.h"
320
#include "audio/audio.h"
321
+#include "target/arm/cpu-qom.h"
322
323
#define SMP_BOOT_ADDR 0xe0000000
324
#define SMP_BOOTREG_ADDR 0x10000030
325
diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c
326
index XXXXXXX..XXXXXXX 100644
327
--- a/hw/arm/sbsa-ref.c
328
+++ b/hw/arm/sbsa-ref.c
329
@@ -XXX,XX +XXX,XX @@
330
#include "net/net.h"
331
#include "qapi/qmp/qlist.h"
332
#include "qom/object.h"
333
+#include "target/arm/cpu-qom.h"
334
335
#define RAMLIMIT_GB 8192
336
#define RAMLIMIT_BYTES (RAMLIMIT_GB * GiB)
337
diff --git a/hw/arm/strongarm.c b/hw/arm/strongarm.c
338
index XXXXXXX..XXXXXXX 100644
339
--- a/hw/arm/strongarm.c
340
+++ b/hw/arm/strongarm.c
341
@@ -XXX,XX +XXX,XX @@
342
#include "qemu/cutils.h"
343
#include "qemu/log.h"
344
#include "qom/object.h"
345
+#include "target/arm/cpu-qom.h"
346
347
//#define DEBUG
348
349
diff --git a/hw/arm/versatilepb.c b/hw/arm/versatilepb.c
350
index XXXXXXX..XXXXXXX 100644
351
--- a/hw/arm/versatilepb.c
352
+++ b/hw/arm/versatilepb.c
353
@@ -XXX,XX +XXX,XX @@
354
#include "hw/sd/sd.h"
355
#include "qom/object.h"
356
#include "audio/audio.h"
357
+#include "target/arm/cpu-qom.h"
358
359
#define VERSATILE_FLASH_ADDR 0x34000000
360
#define VERSATILE_FLASH_SIZE (64 * 1024 * 1024)
361
diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c
362
index XXXXXXX..XXXXXXX 100644
363
--- a/hw/arm/vexpress.c
364
+++ b/hw/arm/vexpress.c
365
@@ -XXX,XX +XXX,XX @@
366
#include "qapi/qmp/qlist.h"
367
#include "qom/object.h"
368
#include "audio/audio.h"
369
+#include "target/arm/cpu-qom.h"
370
371
#define VEXPRESS_BOARD_ID 0x8e0
372
#define VEXPRESS_FLASH_SIZE (64 * 1024 * 1024)
373
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
374
index XXXXXXX..XXXXXXX 100644
375
--- a/hw/arm/virt.c
376
+++ b/hw/arm/virt.c
377
@@ -XXX,XX +XXX,XX @@
378
#include "standard-headers/linux/input.h"
379
#include "hw/arm/smmuv3.h"
380
#include "hw/acpi/acpi.h"
381
+#include "target/arm/cpu-qom.h"
382
#include "target/arm/internals.h"
383
#include "target/arm/multiprocessing.h"
384
#include "hw/mem/pc-dimm.h"
385
diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c
386
index XXXXXXX..XXXXXXX 100644
387
--- a/hw/arm/xilinx_zynq.c
388
+++ b/hw/arm/xilinx_zynq.c
389
@@ -XXX,XX +XXX,XX @@
390
#include "sysemu/reset.h"
391
#include "qom/object.h"
392
#include "exec/tswap.h"
393
+#include "target/arm/cpu-qom.h"
394
395
#define TYPE_ZYNQ_MACHINE MACHINE_TYPE_NAME("xilinx-zynq-a9")
396
OBJECT_DECLARE_SIMPLE_TYPE(ZynqMachineState, ZYNQ_MACHINE)
397
diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
398
index XXXXXXX..XXXXXXX 100644
399
--- a/hw/arm/xlnx-versal.c
400
+++ b/hw/arm/xlnx-versal.c
401
@@ -XXX,XX +XXX,XX @@
402
#include "hw/misc/unimp.h"
403
#include "hw/arm/xlnx-versal.h"
404
#include "qemu/log.h"
405
+#include "target/arm/cpu-qom.h"
406
407
#define XLNX_VERSAL_ACPU_TYPE ARM_CPU_TYPE_NAME("cortex-a72")
408
#define XLNX_VERSAL_RCPU_TYPE ARM_CPU_TYPE_NAME("cortex-r5f")
409
diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c
410
index XXXXXXX..XXXXXXX 100644
411
--- a/hw/arm/xlnx-zynqmp.c
412
+++ b/hw/arm/xlnx-zynqmp.c
413
@@ -XXX,XX +XXX,XX @@
414
#include "sysemu/kvm.h"
415
#include "sysemu/sysemu.h"
416
#include "kvm_arm.h"
417
+#include "target/arm/cpu-qom.h"
418
419
#define GIC_NUM_SPI_INTR 160
420
421
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
12
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
422
index XXXXXXX..XXXXXXX 100644
13
index XXXXXXX..XXXXXXX 100644
423
--- a/target/arm/cpu.c
14
--- a/target/arm/cpu.c
424
+++ b/target/arm/cpu.c
15
+++ b/target/arm/cpu.c
425
@@ -XXX,XX +XXX,XX @@
16
@@ -XXX,XX +XXX,XX @@ void arm_register_el_change_hook(ARMCPU *cpu, ARMELChangeHookFn *hook,
426
#include "disas/capstone.h"
17
* * tininess-before-rounding
427
#include "fpu/softfloat.h"
18
* * 2-input NaN propagation prefers SNaN over QNaN, and then
428
#include "cpregs.h"
19
* operand A over operand B (see FPProcessNaNs() pseudocode)
429
+#include "target/arm/cpu-qom.h"
20
+ * * 3-input NaN propagation prefers SNaN over QNaN, and then
430
21
+ * operand C over A over B (see FPProcessNaNs3() pseudocode,
431
static void arm_cpu_set_pc(CPUState *cs, vaddr value)
22
+ * but note that for QEMU muladd is a * b + c, whereas for
23
+ * the pseudocode function the arguments are in the order c, a, b.
24
* * 0 * Inf + NaN returns the default NaN if the input NaN is quiet,
25
* and the input NaN if it is signalling
26
*/
27
@@ -XXX,XX +XXX,XX @@ static void arm_set_default_fp_behaviours(float_status *s)
432
{
28
{
29
set_float_detect_tininess(float_tininess_before_rounding, s);
30
set_float_2nan_prop_rule(float_2nan_prop_s_ab, s);
31
+ set_float_3nan_prop_rule(float_3nan_prop_s_cab, s);
32
set_float_infzeronan_rule(float_infzeronan_dnan_if_qnan, s);
33
}
34
35
diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc
36
index XXXXXXX..XXXXXXX 100644
37
--- a/fpu/softfloat-specialize.c.inc
38
+++ b/fpu/softfloat-specialize.c.inc
39
@@ -XXX,XX +XXX,XX @@ static int pickNaNMulAdd(FloatClass a_cls, FloatClass b_cls, FloatClass c_cls,
40
}
41
42
if (rule == float_3nan_prop_none) {
43
-#if defined(TARGET_ARM)
44
- /*
45
- * This looks different from the ARM ARM pseudocode, because the ARM ARM
46
- * puts the operands to a fused mac operation (a*b)+c in the order c,a,b
47
- */
48
- rule = float_3nan_prop_s_cab;
49
-#elif defined(TARGET_MIPS)
50
+#if defined(TARGET_MIPS)
51
if (snan_bit_is_one(status)) {
52
rule = float_3nan_prop_s_abc;
53
} else {
433
--
54
--
434
2.34.1
55
2.34.1
435
436
diff view generated by jsdifflib
New patch
1
Set the Float3NaNPropRule explicitly for loongarch, and remove the
2
ifdef from pickNaNMulAdd().
1
3
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Message-id: 20241202131347.498124-19-peter.maydell@linaro.org
7
---
8
target/loongarch/tcg/fpu_helper.c | 1 +
9
fpu/softfloat-specialize.c.inc | 2 --
10
2 files changed, 1 insertion(+), 2 deletions(-)
11
12
diff --git a/target/loongarch/tcg/fpu_helper.c b/target/loongarch/tcg/fpu_helper.c
13
index XXXXXXX..XXXXXXX 100644
14
--- a/target/loongarch/tcg/fpu_helper.c
15
+++ b/target/loongarch/tcg/fpu_helper.c
16
@@ -XXX,XX +XXX,XX @@ void restore_fp_status(CPULoongArchState *env)
17
* case sets InvalidOp and returns the input value 'c'
18
*/
19
set_float_infzeronan_rule(float_infzeronan_dnan_never, &env->fp_status);
20
+ set_float_3nan_prop_rule(float_3nan_prop_s_cab, &env->fp_status);
21
}
22
23
int ieee_ex_to_loongarch(int xcpt)
24
diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc
25
index XXXXXXX..XXXXXXX 100644
26
--- a/fpu/softfloat-specialize.c.inc
27
+++ b/fpu/softfloat-specialize.c.inc
28
@@ -XXX,XX +XXX,XX @@ static int pickNaNMulAdd(FloatClass a_cls, FloatClass b_cls, FloatClass c_cls,
29
} else {
30
rule = float_3nan_prop_s_cab;
31
}
32
-#elif defined(TARGET_LOONGARCH64)
33
- rule = float_3nan_prop_s_cab;
34
#elif defined(TARGET_PPC)
35
/*
36
* If fRA is a NaN return it; otherwise if fRB is a NaN return it;
37
--
38
2.34.1
diff view generated by jsdifflib
New patch
1
Set the Float3NaNPropRule explicitly for PPC, and remove the
2
ifdef from pickNaNMulAdd().
1
3
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Message-id: 20241202131347.498124-20-peter.maydell@linaro.org
7
---
8
target/ppc/cpu_init.c | 8 ++++++++
9
fpu/softfloat-specialize.c.inc | 6 ------
10
2 files changed, 8 insertions(+), 6 deletions(-)
11
12
diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c
13
index XXXXXXX..XXXXXXX 100644
14
--- a/target/ppc/cpu_init.c
15
+++ b/target/ppc/cpu_init.c
16
@@ -XXX,XX +XXX,XX @@ static void ppc_cpu_reset_hold(Object *obj, ResetType type)
17
*/
18
set_float_2nan_prop_rule(float_2nan_prop_ab, &env->fp_status);
19
set_float_2nan_prop_rule(float_2nan_prop_ab, &env->vec_status);
20
+ /*
21
+ * NaN propagation for fused multiply-add:
22
+ * if fRA is a NaN return it; otherwise if fRB is a NaN return it;
23
+ * otherwise return fRC. Note that muladd on PPC is (fRA * fRC) + frB
24
+ * whereas QEMU labels the operands as (a * b) + c.
25
+ */
26
+ set_float_3nan_prop_rule(float_3nan_prop_acb, &env->fp_status);
27
+ set_float_3nan_prop_rule(float_3nan_prop_acb, &env->vec_status);
28
/*
29
* For PPC, the (inf,zero,qnan) case sets InvalidOp, but we prefer
30
* to return an input NaN if we have one (ie c) rather than generating
31
diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc
32
index XXXXXXX..XXXXXXX 100644
33
--- a/fpu/softfloat-specialize.c.inc
34
+++ b/fpu/softfloat-specialize.c.inc
35
@@ -XXX,XX +XXX,XX @@ static int pickNaNMulAdd(FloatClass a_cls, FloatClass b_cls, FloatClass c_cls,
36
} else {
37
rule = float_3nan_prop_s_cab;
38
}
39
-#elif defined(TARGET_PPC)
40
- /*
41
- * If fRA is a NaN return it; otherwise if fRB is a NaN return it;
42
- * otherwise return fRC. Note that muladd on PPC is (fRA * fRC) + frB
43
- */
44
- rule = float_3nan_prop_acb;
45
#elif defined(TARGET_S390X)
46
rule = float_3nan_prop_s_abc;
47
#elif defined(TARGET_SPARC)
48
--
49
2.34.1
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
1
Set the Float3NaNPropRule explicitly for s390x, and remove the
2
ifdef from pickNaNMulAdd().
2
3
3
hw/misc/xlnx-versal-crl.c doesn't require "cpu.h"
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
anymore. By removing it, the unit become target
5
agnostic: we can build it once. Update meson.
6
7
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20240118200643.29037-15-philmd@linaro.org
6
Message-id: 20241202131347.498124-21-peter.maydell@linaro.org
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
7
---
12
hw/misc/xlnx-versal-crl.c | 1 -
8
target/s390x/cpu.c | 1 +
13
hw/misc/meson.build | 2 +-
9
fpu/softfloat-specialize.c.inc | 2 --
14
2 files changed, 1 insertion(+), 2 deletions(-)
10
2 files changed, 1 insertion(+), 2 deletions(-)
15
11
16
diff --git a/hw/misc/xlnx-versal-crl.c b/hw/misc/xlnx-versal-crl.c
12
diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
17
index XXXXXXX..XXXXXXX 100644
13
index XXXXXXX..XXXXXXX 100644
18
--- a/hw/misc/xlnx-versal-crl.c
14
--- a/target/s390x/cpu.c
19
+++ b/hw/misc/xlnx-versal-crl.c
15
+++ b/target/s390x/cpu.c
20
@@ -XXX,XX +XXX,XX @@
16
@@ -XXX,XX +XXX,XX @@ static void s390_cpu_reset_hold(Object *obj, ResetType type)
21
#include "hw/register.h"
17
set_float_detect_tininess(float_tininess_before_rounding,
22
#include "hw/resettable.h"
18
&env->fpu_status);
23
19
set_float_2nan_prop_rule(float_2nan_prop_s_ab, &env->fpu_status);
24
-#include "target/arm/cpu.h"
20
+ set_float_3nan_prop_rule(float_3nan_prop_s_abc, &env->fpu_status);
25
#include "target/arm/arm-powerctl.h"
21
set_float_infzeronan_rule(float_infzeronan_dnan_always,
26
#include "target/arm/multiprocessing.h"
22
&env->fpu_status);
27
#include "hw/misc/xlnx-versal-crl.h"
23
/* fall through */
28
diff --git a/hw/misc/meson.build b/hw/misc/meson.build
24
diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc
29
index XXXXXXX..XXXXXXX 100644
25
index XXXXXXX..XXXXXXX 100644
30
--- a/hw/misc/meson.build
26
--- a/fpu/softfloat-specialize.c.inc
31
+++ b/hw/misc/meson.build
27
+++ b/fpu/softfloat-specialize.c.inc
32
@@ -XXX,XX +XXX,XX @@ system_ss.add(when: 'CONFIG_SLAVIO', if_true: files('slavio_misc.c'))
28
@@ -XXX,XX +XXX,XX @@ static int pickNaNMulAdd(FloatClass a_cls, FloatClass b_cls, FloatClass c_cls,
33
system_ss.add(when: 'CONFIG_ZYNQ', if_true: files('zynq_slcr.c'))
29
} else {
34
system_ss.add(when: 'CONFIG_XLNX_ZYNQMP_ARM', if_true: files('xlnx-zynqmp-crf.c'))
30
rule = float_3nan_prop_s_cab;
35
system_ss.add(when: 'CONFIG_XLNX_ZYNQMP_ARM', if_true: files('xlnx-zynqmp-apu-ctrl.c'))
31
}
36
-specific_ss.add(when: 'CONFIG_XLNX_VERSAL', if_true: files('xlnx-versal-crl.c'))
32
-#elif defined(TARGET_S390X)
37
system_ss.add(when: 'CONFIG_XLNX_VERSAL', if_true: files(
33
- rule = float_3nan_prop_s_abc;
38
+ 'xlnx-versal-crl.c',
34
#elif defined(TARGET_SPARC)
39
'xlnx-versal-xramc.c',
35
rule = float_3nan_prop_s_cba;
40
'xlnx-versal-pmc-iou-slcr.c',
36
#elif defined(TARGET_XTENSA)
41
'xlnx-versal-cfu.c',
42
--
37
--
43
2.34.1
38
2.34.1
44
45
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
1
Set the Float3NaNPropRule explicitly for SPARC, and remove the
2
ifdef from pickNaNMulAdd().
2
3
3
hw/cpu/a9mpcore.c doesn't require "cpu.h" anymore.
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
By removing it, the unit become target agnostic:
5
we can build it once. Update meson.
6
7
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20240118200643.29037-13-philmd@linaro.org
6
Message-id: 20241202131347.498124-22-peter.maydell@linaro.org
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
7
---
12
hw/cpu/a9mpcore.c | 2 +-
8
target/sparc/cpu.c | 2 ++
13
hw/cpu/meson.build | 2 +-
9
fpu/softfloat-specialize.c.inc | 2 --
14
2 files changed, 2 insertions(+), 2 deletions(-)
10
2 files changed, 2 insertions(+), 2 deletions(-)
15
11
16
diff --git a/hw/cpu/a9mpcore.c b/hw/cpu/a9mpcore.c
12
diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c
17
index XXXXXXX..XXXXXXX 100644
13
index XXXXXXX..XXXXXXX 100644
18
--- a/hw/cpu/a9mpcore.c
14
--- a/target/sparc/cpu.c
19
+++ b/hw/cpu/a9mpcore.c
15
+++ b/target/sparc/cpu.c
20
@@ -XXX,XX +XXX,XX @@
16
@@ -XXX,XX +XXX,XX @@ static void sparc_cpu_realizefn(DeviceState *dev, Error **errp)
21
#include "hw/irq.h"
17
* the CPU state struct so it won't get zeroed on reset.
22
#include "hw/qdev-properties.h"
18
*/
23
#include "hw/core/cpu.h"
19
set_float_2nan_prop_rule(float_2nan_prop_s_ba, &env->fp_status);
24
-#include "cpu.h"
20
+ /* For fused-multiply add, prefer SNaN over QNaN, then C->B->A */
25
+#include "target/arm/cpu-qom.h"
21
+ set_float_3nan_prop_rule(float_3nan_prop_s_cba, &env->fp_status);
26
22
/* For inf * 0 + NaN, return the input NaN */
27
#define A9_GIC_NUM_PRIORITY_BITS 5
23
set_float_infzeronan_rule(float_infzeronan_dnan_never, &env->fp_status);
28
24
29
diff --git a/hw/cpu/meson.build b/hw/cpu/meson.build
25
diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc
30
index XXXXXXX..XXXXXXX 100644
26
index XXXXXXX..XXXXXXX 100644
31
--- a/hw/cpu/meson.build
27
--- a/fpu/softfloat-specialize.c.inc
32
+++ b/hw/cpu/meson.build
28
+++ b/fpu/softfloat-specialize.c.inc
33
@@ -XXX,XX +XXX,XX @@ system_ss.add(files('core.c', 'cluster.c'))
29
@@ -XXX,XX +XXX,XX @@ static int pickNaNMulAdd(FloatClass a_cls, FloatClass b_cls, FloatClass c_cls,
34
30
} else {
35
system_ss.add(when: 'CONFIG_ARM11MPCORE', if_true: files('arm11mpcore.c'))
31
rule = float_3nan_prop_s_cab;
36
system_ss.add(when: 'CONFIG_REALVIEW', if_true: files('realview_mpcore.c'))
32
}
37
-specific_ss.add(when: 'CONFIG_A9MPCORE', if_true: files('a9mpcore.c'))
33
-#elif defined(TARGET_SPARC)
38
+system_ss.add(when: 'CONFIG_A9MPCORE', if_true: files('a9mpcore.c'))
34
- rule = float_3nan_prop_s_cba;
39
specific_ss.add(when: 'CONFIG_A15MPCORE', if_true: files('a15mpcore.c'))
35
#elif defined(TARGET_XTENSA)
36
if (status->use_first_nan) {
37
rule = float_3nan_prop_abc;
40
--
38
--
41
2.34.1
39
2.34.1
42
43
diff view generated by jsdifflib
New patch
1
Set the Float3NaNPropRule explicitly for Arm, and remove the
2
ifdef from pickNaNMulAdd().
1
3
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Message-id: 20241202131347.498124-23-peter.maydell@linaro.org
7
---
8
target/mips/fpu_helper.h | 4 ++++
9
target/mips/msa.c | 3 +++
10
fpu/softfloat-specialize.c.inc | 8 +-------
11
3 files changed, 8 insertions(+), 7 deletions(-)
12
13
diff --git a/target/mips/fpu_helper.h b/target/mips/fpu_helper.h
14
index XXXXXXX..XXXXXXX 100644
15
--- a/target/mips/fpu_helper.h
16
+++ b/target/mips/fpu_helper.h
17
@@ -XXX,XX +XXX,XX @@ static inline void restore_snan_bit_mode(CPUMIPSState *env)
18
{
19
bool nan2008 = env->active_fpu.fcr31 & (1 << FCR31_NAN2008);
20
FloatInfZeroNaNRule izn_rule;
21
+ Float3NaNPropRule nan3_rule;
22
23
/*
24
* With nan2008, SNaNs are silenced in the usual way.
25
@@ -XXX,XX +XXX,XX @@ static inline void restore_snan_bit_mode(CPUMIPSState *env)
26
*/
27
izn_rule = nan2008 ? float_infzeronan_dnan_never : float_infzeronan_dnan_always;
28
set_float_infzeronan_rule(izn_rule, &env->active_fpu.fp_status);
29
+ nan3_rule = nan2008 ? float_3nan_prop_s_cab : float_3nan_prop_s_abc;
30
+ set_float_3nan_prop_rule(nan3_rule, &env->active_fpu.fp_status);
31
+
32
}
33
34
static inline void restore_fp_status(CPUMIPSState *env)
35
diff --git a/target/mips/msa.c b/target/mips/msa.c
36
index XXXXXXX..XXXXXXX 100644
37
--- a/target/mips/msa.c
38
+++ b/target/mips/msa.c
39
@@ -XXX,XX +XXX,XX @@ void msa_reset(CPUMIPSState *env)
40
set_float_2nan_prop_rule(float_2nan_prop_s_ab,
41
&env->active_tc.msa_fp_status);
42
43
+ set_float_3nan_prop_rule(float_3nan_prop_s_cab,
44
+ &env->active_tc.msa_fp_status);
45
+
46
/* clear float_status exception flags */
47
set_float_exception_flags(0, &env->active_tc.msa_fp_status);
48
49
diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc
50
index XXXXXXX..XXXXXXX 100644
51
--- a/fpu/softfloat-specialize.c.inc
52
+++ b/fpu/softfloat-specialize.c.inc
53
@@ -XXX,XX +XXX,XX @@ static int pickNaNMulAdd(FloatClass a_cls, FloatClass b_cls, FloatClass c_cls,
54
}
55
56
if (rule == float_3nan_prop_none) {
57
-#if defined(TARGET_MIPS)
58
- if (snan_bit_is_one(status)) {
59
- rule = float_3nan_prop_s_abc;
60
- } else {
61
- rule = float_3nan_prop_s_cab;
62
- }
63
-#elif defined(TARGET_XTENSA)
64
+#if defined(TARGET_XTENSA)
65
if (status->use_first_nan) {
66
rule = float_3nan_prop_abc;
67
} else {
68
--
69
2.34.1
diff view generated by jsdifflib
New patch
1
Set the Float3NaNPropRule explicitly for xtensa, and remove the
2
ifdef from pickNaNMulAdd().
1
3
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Message-id: 20241202131347.498124-24-peter.maydell@linaro.org
7
---
8
target/xtensa/fpu_helper.c | 2 ++
9
fpu/softfloat-specialize.c.inc | 8 --------
10
2 files changed, 2 insertions(+), 8 deletions(-)
11
12
diff --git a/target/xtensa/fpu_helper.c b/target/xtensa/fpu_helper.c
13
index XXXXXXX..XXXXXXX 100644
14
--- a/target/xtensa/fpu_helper.c
15
+++ b/target/xtensa/fpu_helper.c
16
@@ -XXX,XX +XXX,XX @@ void xtensa_use_first_nan(CPUXtensaState *env, bool use_first)
17
set_use_first_nan(use_first, &env->fp_status);
18
set_float_2nan_prop_rule(use_first ? float_2nan_prop_ab : float_2nan_prop_ba,
19
&env->fp_status);
20
+ set_float_3nan_prop_rule(use_first ? float_3nan_prop_abc : float_3nan_prop_cba,
21
+ &env->fp_status);
22
}
23
24
void HELPER(wur_fpu2k_fcr)(CPUXtensaState *env, uint32_t v)
25
diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc
26
index XXXXXXX..XXXXXXX 100644
27
--- a/fpu/softfloat-specialize.c.inc
28
+++ b/fpu/softfloat-specialize.c.inc
29
@@ -XXX,XX +XXX,XX @@ static int pickNaNMulAdd(FloatClass a_cls, FloatClass b_cls, FloatClass c_cls,
30
}
31
32
if (rule == float_3nan_prop_none) {
33
-#if defined(TARGET_XTENSA)
34
- if (status->use_first_nan) {
35
- rule = float_3nan_prop_abc;
36
- } else {
37
- rule = float_3nan_prop_cba;
38
- }
39
-#else
40
rule = float_3nan_prop_abc;
41
-#endif
42
}
43
44
assert(rule != float_3nan_prop_none);
45
--
46
2.34.1
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
1
Set the Float3NaNPropRule explicitly for i386. We had no
2
i386-specific behaviour in the old ifdef ladder, so we were using the
3
default "prefer a then b then c" fallback; this is actually the
4
correct per-the-spec handling for i386.
2
5
3
include/hw/arm/xlnx-versal.h uses the ARMCPU structure which
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
is defined in the "target/arm/cpu.h" header. Include it in
5
order to avoid when refactoring unrelated headers:
6
7
In file included from hw/arm/xlnx-versal-virt.c:20:
8
include/hw/arm/xlnx-versal.h:62:23: error: array has incomplete element type 'ARMCPU' (aka 'struct ArchCPU')
9
ARMCPU cpu[XLNX_VERSAL_NR_ACPUS];
10
^
11
12
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
13
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
14
Message-id: 20240118200643.29037-5-philmd@linaro.org
8
Message-id: 20241202131347.498124-25-peter.maydell@linaro.org
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
---
9
---
17
include/hw/arm/xlnx-versal.h | 1 +
10
target/i386/tcg/fpu_helper.c | 1 +
18
1 file changed, 1 insertion(+)
11
1 file changed, 1 insertion(+)
19
12
20
diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h
13
diff --git a/target/i386/tcg/fpu_helper.c b/target/i386/tcg/fpu_helper.c
21
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
22
--- a/include/hw/arm/xlnx-versal.h
15
--- a/target/i386/tcg/fpu_helper.c
23
+++ b/include/hw/arm/xlnx-versal.h
16
+++ b/target/i386/tcg/fpu_helper.c
24
@@ -XXX,XX +XXX,XX @@
17
@@ -XXX,XX +XXX,XX @@ void cpu_init_fp_statuses(CPUX86State *env)
25
#include "hw/net/xlnx-versal-canfd.h"
18
* there are multiple input NaNs they are selected in the order a, b, c.
26
#include "hw/misc/xlnx-versal-cfu.h"
19
*/
27
#include "hw/misc/xlnx-versal-cframe-reg.h"
20
set_float_infzeronan_rule(float_infzeronan_dnan_never, &env->sse_status);
28
+#include "target/arm/cpu.h"
21
+ set_float_3nan_prop_rule(float_3nan_prop_abc, &env->sse_status);
29
22
}
30
#define TYPE_XLNX_VERSAL "xlnx-versal"
23
31
OBJECT_DECLARE_SIMPLE_TYPE(Versal, XLNX_VERSAL)
24
static inline uint8_t save_exception_flags(CPUX86State *env)
32
--
25
--
33
2.34.1
26
2.34.1
34
35
diff view generated by jsdifflib
1
Convert the musicpal key input device to use
1
Set the Float3NaNPropRule explicitly for HPPA, and remove the
2
qemu_add_kbd_event_handler(). This lets us simplify it because we no
2
ifdef from pickNaNMulAdd().
3
longer need to track whether we're in the middle of a PS/2 multibyte
4
key sequence.
5
3
6
In the conversion we move the keyboard handler registration from init
4
HPPA is the only target that was using the default branch of the
7
to realize, because devices shouldn't disturb the state of the
5
ifdef ladder (other targets either do not use muladd or set
8
simulation by doing things like registering input handlers until
6
default_nan_mode), so we can remove the ifdef fallback entirely now
9
they're realized, so that device objects can be introspected
7
(allowing the "rule not set" case to fall into the default of the
10
safely.
8
switch statement and assert).
11
9
12
The behaviour where key-repeat is permitted for the arrow-keys only
10
We add a TODO note that the HPPA rule is probably wrong; this is
13
is intentional (added in commit 7c6ce4baedfcd0c), so we retain it,
11
not a behavioural change for this refactoring.
14
and add a comment to that effect.
15
16
This is a migration compatibility break for musicpal.
17
12
18
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
19
Tested-by: Alex Bennée <alex.bennee@linaro.org>
14
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
20
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
15
Message-id: 20241202131347.498124-26-peter.maydell@linaro.org
21
Message-id: 20231103182750.855577-1-peter.maydell@linaro.org
22
---
16
---
23
hw/arm/musicpal.c | 131 +++++++++++++++++++++-------------------------
17
target/hppa/fpu_helper.c | 8 ++++++++
24
1 file changed, 61 insertions(+), 70 deletions(-)
18
fpu/softfloat-specialize.c.inc | 4 ----
19
2 files changed, 8 insertions(+), 4 deletions(-)
25
20
26
diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c
21
diff --git a/target/hppa/fpu_helper.c b/target/hppa/fpu_helper.c
27
index XXXXXXX..XXXXXXX 100644
22
index XXXXXXX..XXXXXXX 100644
28
--- a/hw/arm/musicpal.c
23
--- a/target/hppa/fpu_helper.c
29
+++ b/hw/arm/musicpal.c
24
+++ b/target/hppa/fpu_helper.c
30
@@ -XXX,XX +XXX,XX @@ static const TypeInfo musicpal_gpio_info = {
25
@@ -XXX,XX +XXX,XX @@ void HELPER(loaded_fr0)(CPUHPPAState *env)
31
};
26
* HPPA does note implement a CPU reset method at all...
32
27
*/
33
/* Keyboard codes & masks */
28
set_float_2nan_prop_rule(float_2nan_prop_s_ab, &env->fp_status);
34
-#define KEY_RELEASED 0x80
35
-#define KEY_CODE 0x7f
36
-
37
-#define KEYCODE_TAB 0x0f
38
-#define KEYCODE_ENTER 0x1c
39
-#define KEYCODE_F 0x21
40
-#define KEYCODE_M 0x32
41
-
42
-#define KEYCODE_EXTENDED 0xe0
43
-#define KEYCODE_UP 0x48
44
-#define KEYCODE_DOWN 0x50
45
-#define KEYCODE_LEFT 0x4b
46
-#define KEYCODE_RIGHT 0x4d
47
-
48
#define MP_KEY_WHEEL_VOL (1 << 0)
49
#define MP_KEY_WHEEL_VOL_INV (1 << 1)
50
#define MP_KEY_WHEEL_NAV (1 << 2)
51
@@ -XXX,XX +XXX,XX @@ struct musicpal_key_state {
52
SysBusDevice parent_obj;
53
/*< public >*/
54
55
- uint32_t kbd_extended;
56
uint32_t pressed_keys;
57
qemu_irq out[8];
58
};
59
60
-static void musicpal_key_event(void *opaque, int keycode)
61
+static void musicpal_key_event(DeviceState *dev, QemuConsole *src,
62
+ InputEvent *evt)
63
{
64
- musicpal_key_state *s = opaque;
65
+ musicpal_key_state *s = MUSICPAL_KEY(dev);
66
+ InputKeyEvent *key = evt->u.key.data;
67
+ int qcode = qemu_input_key_value_to_qcode(key->key);
68
uint32_t event = 0;
69
int i;
70
71
- if (keycode == KEYCODE_EXTENDED) {
72
- s->kbd_extended = 1;
73
- return;
74
+ switch (qcode) {
75
+ case Q_KEY_CODE_UP:
76
+ event = MP_KEY_WHEEL_NAV | MP_KEY_WHEEL_NAV_INV;
77
+ break;
78
+
79
+ case Q_KEY_CODE_DOWN:
80
+ event = MP_KEY_WHEEL_NAV;
81
+ break;
82
+
83
+ case Q_KEY_CODE_LEFT:
84
+ event = MP_KEY_WHEEL_VOL | MP_KEY_WHEEL_VOL_INV;
85
+ break;
86
+
87
+ case Q_KEY_CODE_RIGHT:
88
+ event = MP_KEY_WHEEL_VOL;
89
+ break;
90
+
91
+ case Q_KEY_CODE_F:
92
+ event = MP_KEY_BTN_FAVORITS;
93
+ break;
94
+
95
+ case Q_KEY_CODE_TAB:
96
+ event = MP_KEY_BTN_VOLUME;
97
+ break;
98
+
99
+ case Q_KEY_CODE_RET:
100
+ event = MP_KEY_BTN_NAVIGATION;
101
+ break;
102
+
103
+ case Q_KEY_CODE_M:
104
+ event = MP_KEY_BTN_MENU;
105
+ break;
106
}
107
108
- if (s->kbd_extended) {
109
- switch (keycode & KEY_CODE) {
110
- case KEYCODE_UP:
111
- event = MP_KEY_WHEEL_NAV | MP_KEY_WHEEL_NAV_INV;
112
- break;
113
-
114
- case KEYCODE_DOWN:
115
- event = MP_KEY_WHEEL_NAV;
116
- break;
117
-
118
- case KEYCODE_LEFT:
119
- event = MP_KEY_WHEEL_VOL | MP_KEY_WHEEL_VOL_INV;
120
- break;
121
-
122
- case KEYCODE_RIGHT:
123
- event = MP_KEY_WHEEL_VOL;
124
- break;
125
- }
126
- } else {
127
- switch (keycode & KEY_CODE) {
128
- case KEYCODE_F:
129
- event = MP_KEY_BTN_FAVORITS;
130
- break;
131
-
132
- case KEYCODE_TAB:
133
- event = MP_KEY_BTN_VOLUME;
134
- break;
135
-
136
- case KEYCODE_ENTER:
137
- event = MP_KEY_BTN_NAVIGATION;
138
- break;
139
-
140
- case KEYCODE_M:
141
- event = MP_KEY_BTN_MENU;
142
- break;
143
- }
144
- /* Do not repeat already pressed buttons */
145
- if (!(keycode & KEY_RELEASED) && (s->pressed_keys & event)) {
146
+ /*
29
+ /*
147
+ * We allow repeated wheel-events when the arrow keys are held down,
30
+ * TODO: The HPPA architecture reference only documents its NaN
148
+ * but do not repeat already-pressed buttons for the other key inputs.
31
+ * propagation rule for 2-operand operations. Testing on real hardware
32
+ * might be necessary to confirm whether this order for muladd is correct.
33
+ * Not preferring the SNaN is almost certainly incorrect as it diverges
34
+ * from the documented rules for 2-operand operations.
149
+ */
35
+ */
150
+ if (!(event & (MP_KEY_WHEEL_NAV | MP_KEY_WHEEL_VOL))) {
36
+ set_float_3nan_prop_rule(float_3nan_prop_abc, &env->fp_status);
151
+ if (key->down && (s->pressed_keys & event)) {
37
/* For inf * 0 + NaN, return the input NaN */
152
event = 0;
38
set_float_infzeronan_rule(float_infzeronan_dnan_never, &env->fp_status);
39
}
40
diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc
41
index XXXXXXX..XXXXXXX 100644
42
--- a/fpu/softfloat-specialize.c.inc
43
+++ b/fpu/softfloat-specialize.c.inc
44
@@ -XXX,XX +XXX,XX @@ static int pickNaNMulAdd(FloatClass a_cls, FloatClass b_cls, FloatClass c_cls,
153
}
45
}
154
}
46
}
155
47
156
if (event) {
48
- if (rule == float_3nan_prop_none) {
157
/* Raise GPIO pin first if repeating a key */
49
- rule = float_3nan_prop_abc;
158
- if (!(keycode & KEY_RELEASED) && (s->pressed_keys & event)) {
50
- }
159
+ if (key->down && (s->pressed_keys & event)) {
160
for (i = 0; i <= 7; i++) {
161
if (event & (1 << i)) {
162
qemu_set_irq(s->out[i], 1);
163
@@ -XXX,XX +XXX,XX @@ static void musicpal_key_event(void *opaque, int keycode)
164
}
165
for (i = 0; i <= 7; i++) {
166
if (event & (1 << i)) {
167
- qemu_set_irq(s->out[i], !!(keycode & KEY_RELEASED));
168
+ qemu_set_irq(s->out[i], !key->down);
169
}
170
}
171
- if (keycode & KEY_RELEASED) {
172
- s->pressed_keys &= ~event;
173
- } else {
174
+ if (key->down) {
175
s->pressed_keys |= event;
176
+ } else {
177
+ s->pressed_keys &= ~event;
178
}
179
}
180
-
51
-
181
- s->kbd_extended = 0;
52
assert(rule != float_3nan_prop_none);
182
}
53
if (have_snan && (rule & R_3NAN_SNAN_MASK)) {
183
54
/* We have at least one SNaN input and should prefer it */
184
static void musicpal_key_init(Object *obj)
185
@@ -XXX,XX +XXX,XX @@ static void musicpal_key_init(Object *obj)
186
DeviceState *dev = DEVICE(sbd);
187
musicpal_key_state *s = MUSICPAL_KEY(dev);
188
189
- s->kbd_extended = 0;
190
s->pressed_keys = 0;
191
192
qdev_init_gpio_out(dev, s->out, ARRAY_SIZE(s->out));
193
+}
194
195
- qemu_add_kbd_event_handler(musicpal_key_event, s);
196
+static const QemuInputHandler musicpal_key_handler = {
197
+ .name = "musicpal_key",
198
+ .mask = INPUT_EVENT_MASK_KEY,
199
+ .event = musicpal_key_event,
200
+};
201
+
202
+static void musicpal_key_realize(DeviceState *dev, Error **errp)
203
+{
204
+ qemu_input_handler_register(dev, &musicpal_key_handler);
205
}
206
207
static const VMStateDescription musicpal_key_vmsd = {
208
.name = "musicpal_key",
209
- .version_id = 1,
210
- .minimum_version_id = 1,
211
+ .version_id = 2,
212
+ .minimum_version_id = 2,
213
.fields = (const VMStateField[]) {
214
- VMSTATE_UINT32(kbd_extended, musicpal_key_state),
215
VMSTATE_UINT32(pressed_keys, musicpal_key_state),
216
VMSTATE_END_OF_LIST()
217
}
218
@@ -XXX,XX +XXX,XX @@ static void musicpal_key_class_init(ObjectClass *klass, void *data)
219
DeviceClass *dc = DEVICE_CLASS(klass);
220
221
dc->vmsd = &musicpal_key_vmsd;
222
+ dc->realize = musicpal_key_realize;
223
}
224
225
static const TypeInfo musicpal_key_info = {
226
--
55
--
227
2.34.1
56
2.34.1
228
229
diff view generated by jsdifflib
New patch
1
The use_first_nan field in float_status was an xtensa-specific way to
2
select at runtime from two different NaN propagation rules. Now that
3
xtensa is using the target-agnostic NaN propagation rule selection
4
that we've just added, we can remove use_first_nan, because there is
5
no longer any code that reads it.
1
6
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20241202131347.498124-27-peter.maydell@linaro.org
10
---
11
include/fpu/softfloat-helpers.h | 5 -----
12
include/fpu/softfloat-types.h | 1 -
13
target/xtensa/fpu_helper.c | 1 -
14
3 files changed, 7 deletions(-)
15
16
diff --git a/include/fpu/softfloat-helpers.h b/include/fpu/softfloat-helpers.h
17
index XXXXXXX..XXXXXXX 100644
18
--- a/include/fpu/softfloat-helpers.h
19
+++ b/include/fpu/softfloat-helpers.h
20
@@ -XXX,XX +XXX,XX @@ static inline void set_snan_bit_is_one(bool val, float_status *status)
21
status->snan_bit_is_one = val;
22
}
23
24
-static inline void set_use_first_nan(bool val, float_status *status)
25
-{
26
- status->use_first_nan = val;
27
-}
28
-
29
static inline void set_no_signaling_nans(bool val, float_status *status)
30
{
31
status->no_signaling_nans = val;
32
diff --git a/include/fpu/softfloat-types.h b/include/fpu/softfloat-types.h
33
index XXXXXXX..XXXXXXX 100644
34
--- a/include/fpu/softfloat-types.h
35
+++ b/include/fpu/softfloat-types.h
36
@@ -XXX,XX +XXX,XX @@ typedef struct float_status {
37
* softfloat-specialize.inc.c)
38
*/
39
bool snan_bit_is_one;
40
- bool use_first_nan;
41
bool no_signaling_nans;
42
/* should overflowed results subtract re_bias to its exponent? */
43
bool rebias_overflow;
44
diff --git a/target/xtensa/fpu_helper.c b/target/xtensa/fpu_helper.c
45
index XXXXXXX..XXXXXXX 100644
46
--- a/target/xtensa/fpu_helper.c
47
+++ b/target/xtensa/fpu_helper.c
48
@@ -XXX,XX +XXX,XX @@ static const struct {
49
50
void xtensa_use_first_nan(CPUXtensaState *env, bool use_first)
51
{
52
- set_use_first_nan(use_first, &env->fp_status);
53
set_float_2nan_prop_rule(use_first ? float_2nan_prop_ab : float_2nan_prop_ba,
54
&env->fp_status);
55
set_float_3nan_prop_rule(use_first ? float_3nan_prop_abc : float_3nan_prop_cba,
56
--
57
2.34.1
diff view generated by jsdifflib
New patch
1
Currently m68k_cpu_reset_hold() calls floatx80_default_nan(NULL)
2
to get the NaN bit pattern to reset the FPU registers. This
3
works because it happens that our implementation of
4
floatx80_default_nan() doesn't actually look at the float_status
5
pointer except for TARGET_MIPS. However, this isn't guaranteed,
6
and to be able to remove the ifdef in floatx80_default_nan()
7
we're going to need a real float_status here.
1
8
9
Rearrange m68k_cpu_reset_hold() so that we initialize env->fp_status
10
earlier, and thus can pass it to floatx80_default_nan().
11
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
14
Message-id: 20241202131347.498124-28-peter.maydell@linaro.org
15
---
16
target/m68k/cpu.c | 12 +++++++-----
17
1 file changed, 7 insertions(+), 5 deletions(-)
18
19
diff --git a/target/m68k/cpu.c b/target/m68k/cpu.c
20
index XXXXXXX..XXXXXXX 100644
21
--- a/target/m68k/cpu.c
22
+++ b/target/m68k/cpu.c
23
@@ -XXX,XX +XXX,XX @@ static void m68k_cpu_reset_hold(Object *obj, ResetType type)
24
CPUState *cs = CPU(obj);
25
M68kCPUClass *mcc = M68K_CPU_GET_CLASS(obj);
26
CPUM68KState *env = cpu_env(cs);
27
- floatx80 nan = floatx80_default_nan(NULL);
28
+ floatx80 nan;
29
int i;
30
31
if (mcc->parent_phases.hold) {
32
@@ -XXX,XX +XXX,XX @@ static void m68k_cpu_reset_hold(Object *obj, ResetType type)
33
#else
34
cpu_m68k_set_sr(env, SR_S | SR_I);
35
#endif
36
- for (i = 0; i < 8; i++) {
37
- env->fregs[i].d = nan;
38
- }
39
- cpu_m68k_set_fpcr(env, 0);
40
/*
41
* M68000 FAMILY PROGRAMMER'S REFERENCE MANUAL
42
* 3.4 FLOATING-POINT INSTRUCTION DETAILS
43
@@ -XXX,XX +XXX,XX @@ static void m68k_cpu_reset_hold(Object *obj, ResetType type)
44
* preceding paragraph for nonsignaling NaNs.
45
*/
46
set_float_2nan_prop_rule(float_2nan_prop_ab, &env->fp_status);
47
+
48
+ nan = floatx80_default_nan(&env->fp_status);
49
+ for (i = 0; i < 8; i++) {
50
+ env->fregs[i].d = nan;
51
+ }
52
+ cpu_m68k_set_fpcr(env, 0);
53
env->fpsr = 0;
54
55
/* TODO: We should set PC from the interrupt vector. */
56
--
57
2.34.1
diff view generated by jsdifflib
New patch
1
We create our 128-bit default NaN by calling parts64_default_nan()
2
and then adjusting the result. We can do the same trick for creating
3
the floatx80 default NaN, which lets us drop a target ifdef.
1
4
5
floatx80 is used only by:
6
i386
7
m68k
8
arm nwfpe old floating-point emulation emulation support
9
(which is essentially dead, especially the parts involving floatx80)
10
PPC (only in the xsrqpxp instruction, which just rounds an input
11
value by converting to floatx80 and back, so will never generate
12
the default NaN)
13
14
The floatx80 default NaN as currently implemented is:
15
m68k: sign = 0, exp = 1...1, int = 1, frac = 1....1
16
i386: sign = 1, exp = 1...1, int = 1, frac = 10...0
17
18
These are the same as the parts64_default_nan for these architectures.
19
20
This is technically a possible behaviour change for arm linux-user
21
nwfpe emulation emulation, because the default NaN will now have the
22
sign bit clear. But we were already generating a different floatx80
23
default NaN from the real kernel emulation we are supposedly
24
following, which appears to use an all-bits-1 value:
25
https://elixir.bootlin.com/linux/v6.12/source/arch/arm/nwfpe/softfloat-specialize#L267
26
27
This won't affect the only "real" use of the nwfpe emulation, which
28
is ancient binaries that used it as part of the old floating point
29
calling convention; that only uses loads and stores of 32 and 64 bit
30
floats, not any of the floatx80 behaviour the original hardware had.
31
We also get the nwfpe float64 default NaN value wrong:
32
https://elixir.bootlin.com/linux/v6.12/source/arch/arm/nwfpe/softfloat-specialize#L166
33
so if we ever cared about this obscure corner the right fix would be
34
to correct that so nwfpe used its own default-NaN setting rather
35
than the Arm VFP one.
36
37
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
38
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
39
Message-id: 20241202131347.498124-29-peter.maydell@linaro.org
40
---
41
fpu/softfloat-specialize.c.inc | 20 ++++++++++----------
42
1 file changed, 10 insertions(+), 10 deletions(-)
43
44
diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc
45
index XXXXXXX..XXXXXXX 100644
46
--- a/fpu/softfloat-specialize.c.inc
47
+++ b/fpu/softfloat-specialize.c.inc
48
@@ -XXX,XX +XXX,XX @@ static void parts128_silence_nan(FloatParts128 *p, float_status *status)
49
floatx80 floatx80_default_nan(float_status *status)
50
{
51
floatx80 r;
52
+ /*
53
+ * Extrapolate from the choices made by parts64_default_nan to fill
54
+ * in the floatx80 format. We assume that floatx80's explicit
55
+ * integer bit is always set (this is true for i386 and m68k,
56
+ * which are the only real users of this format).
57
+ */
58
+ FloatParts64 p64;
59
+ parts64_default_nan(&p64, status);
60
61
- /* None of the targets that have snan_bit_is_one use floatx80. */
62
- assert(!snan_bit_is_one(status));
63
-#if defined(TARGET_M68K)
64
- r.low = UINT64_C(0xFFFFFFFFFFFFFFFF);
65
- r.high = 0x7FFF;
66
-#else
67
- /* X86 */
68
- r.low = UINT64_C(0xC000000000000000);
69
- r.high = 0xFFFF;
70
-#endif
71
+ r.high = 0x7FFF | (p64.sign << 15);
72
+ r.low = (1ULL << DECOMPOSED_BINARY_POINT) | p64.frac;
73
return r;
74
}
75
76
--
77
2.34.1
diff view generated by jsdifflib
New patch
1
In target/loongarch's helper_fclass_s() and helper_fclass_d() we pass
2
a zero-initialized float_status struct to float32_is_quiet_nan() and
3
float64_is_quiet_nan(), with the cryptic comment "for
4
snan_bit_is_one".
1
5
6
This pattern appears to have been copied from target/riscv, where it
7
is used because the functions there do not have ready access to the
8
CPU state struct. The comment presumably refers to the fact that the
9
main reason the is_quiet_nan() functions want the float_state is
10
because they want to know about the snan_bit_is_one config.
11
12
In the loongarch helpers, though, we have the CPU state struct
13
to hand. Use the usual env->fp_status here. This avoids our needing
14
to track that we need to update the initializer of the local
15
float_status structs when the core softfloat code adds new
16
options for targets to configure their behaviour.
17
18
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
19
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
20
Message-id: 20241202131347.498124-30-peter.maydell@linaro.org
21
---
22
target/loongarch/tcg/fpu_helper.c | 6 ++----
23
1 file changed, 2 insertions(+), 4 deletions(-)
24
25
diff --git a/target/loongarch/tcg/fpu_helper.c b/target/loongarch/tcg/fpu_helper.c
26
index XXXXXXX..XXXXXXX 100644
27
--- a/target/loongarch/tcg/fpu_helper.c
28
+++ b/target/loongarch/tcg/fpu_helper.c
29
@@ -XXX,XX +XXX,XX @@ uint64_t helper_fclass_s(CPULoongArchState *env, uint64_t fj)
30
} else if (float32_is_zero_or_denormal(f)) {
31
return sign ? 1 << 4 : 1 << 8;
32
} else if (float32_is_any_nan(f)) {
33
- float_status s = { }; /* for snan_bit_is_one */
34
- return float32_is_quiet_nan(f, &s) ? 1 << 1 : 1 << 0;
35
+ return float32_is_quiet_nan(f, &env->fp_status) ? 1 << 1 : 1 << 0;
36
} else {
37
return sign ? 1 << 3 : 1 << 7;
38
}
39
@@ -XXX,XX +XXX,XX @@ uint64_t helper_fclass_d(CPULoongArchState *env, uint64_t fj)
40
} else if (float64_is_zero_or_denormal(f)) {
41
return sign ? 1 << 4 : 1 << 8;
42
} else if (float64_is_any_nan(f)) {
43
- float_status s = { }; /* for snan_bit_is_one */
44
- return float64_is_quiet_nan(f, &s) ? 1 << 1 : 1 << 0;
45
+ return float64_is_quiet_nan(f, &env->fp_status) ? 1 << 1 : 1 << 0;
46
} else {
47
return sign ? 1 << 3 : 1 << 7;
48
}
49
--
50
2.34.1
diff view generated by jsdifflib
New patch
1
In the frem helper, we have a local float_status because we want to
2
execute the floatx80_div() with a custom rounding mode. Instead of
3
zero-initializing the local float_status and then having to set it up
4
with the m68k standard behaviour (including the NaN propagation rule
5
and copying the rounding precision from env->fp_status), initialize
6
it as a complete copy of env->fp_status. This will avoid our having
7
to add new code in this function for every new config knob we add
8
to fp_status.
1
9
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
12
Message-id: 20241202131347.498124-31-peter.maydell@linaro.org
13
---
14
target/m68k/fpu_helper.c | 6 ++----
15
1 file changed, 2 insertions(+), 4 deletions(-)
16
17
diff --git a/target/m68k/fpu_helper.c b/target/m68k/fpu_helper.c
18
index XXXXXXX..XXXXXXX 100644
19
--- a/target/m68k/fpu_helper.c
20
+++ b/target/m68k/fpu_helper.c
21
@@ -XXX,XX +XXX,XX @@ void HELPER(frem)(CPUM68KState *env, FPReg *res, FPReg *val0, FPReg *val1)
22
23
fp_rem = floatx80_rem(val1->d, val0->d, &env->fp_status);
24
if (!floatx80_is_any_nan(fp_rem)) {
25
- float_status fp_status = { };
26
+ /* Use local temporary fp_status to set different rounding mode */
27
+ float_status fp_status = env->fp_status;
28
uint32_t quotient;
29
int sign;
30
31
/* Calculate quotient directly using round to nearest mode */
32
- set_float_2nan_prop_rule(float_2nan_prop_ab, &fp_status);
33
set_float_rounding_mode(float_round_nearest_even, &fp_status);
34
- set_floatx80_rounding_precision(
35
- get_floatx80_rounding_precision(&env->fp_status), &fp_status);
36
fp_quot.d = floatx80_div(val1->d, val0->d, &fp_status);
37
38
sign = extractFloatx80Sign(fp_quot.d);
39
--
40
2.34.1
diff view generated by jsdifflib
New patch
1
In cf_fpu_gdb_get_reg() and cf_fpu_gdb_set_reg() we do the conversion
2
from float64 to floatx80 using a scratch float_status, because we
3
don't want the conversion to affect the CPU's floating point exception
4
status. Currently we use a zero-initialized float_status. This will
5
get steadily more awkward as we add config knobs to float_status
6
that the target must initialize. Avoid having to add any of that
7
configuration here by instead initializing our local float_status
8
from the env->fp_status.
1
9
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
12
Message-id: 20241202131347.498124-32-peter.maydell@linaro.org
13
---
14
target/m68k/helper.c | 6 ++++--
15
1 file changed, 4 insertions(+), 2 deletions(-)
16
17
diff --git a/target/m68k/helper.c b/target/m68k/helper.c
18
index XXXXXXX..XXXXXXX 100644
19
--- a/target/m68k/helper.c
20
+++ b/target/m68k/helper.c
21
@@ -XXX,XX +XXX,XX @@ static int cf_fpu_gdb_get_reg(CPUState *cs, GByteArray *mem_buf, int n)
22
CPUM68KState *env = &cpu->env;
23
24
if (n < 8) {
25
- float_status s = {};
26
+ /* Use scratch float_status so any exceptions don't change CPU state */
27
+ float_status s = env->fp_status;
28
return gdb_get_reg64(mem_buf, floatx80_to_float64(env->fregs[n].d, &s));
29
}
30
switch (n) {
31
@@ -XXX,XX +XXX,XX @@ static int cf_fpu_gdb_set_reg(CPUState *cs, uint8_t *mem_buf, int n)
32
CPUM68KState *env = &cpu->env;
33
34
if (n < 8) {
35
- float_status s = {};
36
+ /* Use scratch float_status so any exceptions don't change CPU state */
37
+ float_status s = env->fp_status;
38
env->fregs[n].d = float64_to_floatx80(ldq_be_p(mem_buf), &s);
39
return 8;
40
}
41
--
42
2.34.1
diff view generated by jsdifflib
1
From: Max Filippov <jcmvbkbc@gmail.com>
1
In the helper functions flcmps and flcmpd we use a scratch float_status
2
so that we don't change the CPU state if the comparison raises any
3
floating point exception flags. Instead of zero-initializing this
4
scratch float_status, initialize it as a copy of env->fp_status. This
5
avoids the need to explicitly initialize settings like the NaN
6
propagation rule or others we might add to softfloat in future.
2
7
3
r[id]tlb[01], [iw][id]tlb opcodes use TLB way index passed in a register
8
To do this we need to pass the CPU env pointer in to the helper.
4
by the guest. The host uses 3 bits of the index for ITLB indexing and 4
5
bits for DTLB, but there's only 7 entries in the ITLB array and 10 in
6
the DTLB array, so a malicious guest may trigger out-of-bound access to
7
these arrays.
8
9
9
Change split_tlb_entry_spec return type to bool to indicate whether TLB
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
way passed to it is valid. Change get_tlb_entry to return NULL in case
11
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
11
invalid TLB way is requested. Add assertion to xtensa_tlb_get_entry that
12
Message-id: 20241202131347.498124-33-peter.maydell@linaro.org
12
requested TLB way and entry indices are valid. Add checks to the
13
---
13
[rwi]tlb helpers that requested TLB way is valid and return 0 or do
14
target/sparc/helper.h | 4 ++--
14
nothing when it's not.
15
target/sparc/fop_helper.c | 8 ++++----
16
target/sparc/translate.c | 4 ++--
17
3 files changed, 8 insertions(+), 8 deletions(-)
15
18
16
Cc: qemu-stable@nongnu.org
19
diff --git a/target/sparc/helper.h b/target/sparc/helper.h
17
Fixes: b67ea0cd7441 ("target-xtensa: implement memory protection options")
18
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
19
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
20
Message-id: 20231215120307.545381-1-jcmvbkbc@gmail.com
21
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
22
---
23
target/xtensa/mmu_helper.c | 47 ++++++++++++++++++++++++++++----------
24
1 file changed, 35 insertions(+), 12 deletions(-)
25
26
diff --git a/target/xtensa/mmu_helper.c b/target/xtensa/mmu_helper.c
27
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
28
--- a/target/xtensa/mmu_helper.c
21
--- a/target/sparc/helper.h
29
+++ b/target/xtensa/mmu_helper.c
22
+++ b/target/sparc/helper.h
30
@@ -XXX,XX +XXX,XX @@ static void split_tlb_entry_spec_way(const CPUXtensaState *env, uint32_t v,
23
@@ -XXX,XX +XXX,XX @@ DEF_HELPER_FLAGS_3(fcmpd, TCG_CALL_NO_WG, i32, env, f64, f64)
31
* Split TLB address into TLB way, entry index and VPN (with index).
24
DEF_HELPER_FLAGS_3(fcmped, TCG_CALL_NO_WG, i32, env, f64, f64)
32
* See ISA, 4.6.5.5 - 4.6.5.8 for the TLB addressing format
25
DEF_HELPER_FLAGS_3(fcmpq, TCG_CALL_NO_WG, i32, env, i128, i128)
33
*/
26
DEF_HELPER_FLAGS_3(fcmpeq, TCG_CALL_NO_WG, i32, env, i128, i128)
34
-static void split_tlb_entry_spec(CPUXtensaState *env, uint32_t v, bool dtlb,
27
-DEF_HELPER_FLAGS_2(flcmps, TCG_CALL_NO_RWG_SE, i32, f32, f32)
35
- uint32_t *vpn, uint32_t *wi, uint32_t *ei)
28
-DEF_HELPER_FLAGS_2(flcmpd, TCG_CALL_NO_RWG_SE, i32, f64, f64)
36
+static bool split_tlb_entry_spec(CPUXtensaState *env, uint32_t v, bool dtlb,
29
+DEF_HELPER_FLAGS_3(flcmps, TCG_CALL_NO_RWG_SE, i32, env, f32, f32)
37
+ uint32_t *vpn, uint32_t *wi, uint32_t *ei)
30
+DEF_HELPER_FLAGS_3(flcmpd, TCG_CALL_NO_RWG_SE, i32, env, f64, f64)
31
DEF_HELPER_2(raise_exception, noreturn, env, int)
32
33
DEF_HELPER_FLAGS_3(faddd, TCG_CALL_NO_WG, f64, env, f64, f64)
34
diff --git a/target/sparc/fop_helper.c b/target/sparc/fop_helper.c
35
index XXXXXXX..XXXXXXX 100644
36
--- a/target/sparc/fop_helper.c
37
+++ b/target/sparc/fop_helper.c
38
@@ -XXX,XX +XXX,XX @@ uint32_t helper_fcmpeq(CPUSPARCState *env, Int128 src1, Int128 src2)
39
return finish_fcmp(env, r, GETPC());
40
}
41
42
-uint32_t helper_flcmps(float32 src1, float32 src2)
43
+uint32_t helper_flcmps(CPUSPARCState *env, float32 src1, float32 src2)
38
{
44
{
39
if (xtensa_option_enabled(env->config, XTENSA_OPTION_MMU)) {
45
/*
40
*wi = v & (dtlb ? 0xf : 0x7);
46
* FLCMP never raises an exception nor modifies any FSR fields.
41
- split_tlb_entry_spec_way(env, v, dtlb, vpn, *wi, ei);
47
* Perform the comparison with a dummy fp environment.
42
+ if (*wi < (dtlb ? env->config->dtlb.nways : env->config->itlb.nways)) {
48
*/
43
+ split_tlb_entry_spec_way(env, v, dtlb, vpn, *wi, ei);
49
- float_status discard = { };
44
+ return true;
50
+ float_status discard = env->fp_status;
45
+ } else {
51
FloatRelation r;
46
+ return false;
52
47
+ }
53
set_float_2nan_prop_rule(float_2nan_prop_s_ba, &discard);
48
} else {
54
@@ -XXX,XX +XXX,XX @@ uint32_t helper_flcmps(float32 src1, float32 src2)
49
*vpn = v & REGION_PAGE_MASK;
55
g_assert_not_reached();
50
*wi = 0;
51
*ei = (v >> 29) & 0x7;
52
+ return true;
53
}
54
}
56
}
55
57
56
static xtensa_tlb_entry *xtensa_tlb_get_entry(CPUXtensaState *env, bool dtlb,
58
-uint32_t helper_flcmpd(float64 src1, float64 src2)
57
unsigned wi, unsigned ei)
59
+uint32_t helper_flcmpd(CPUSPARCState *env, float64 src1, float64 src2)
58
{
60
{
59
+ const xtensa_tlb *tlb = dtlb ? &env->config->dtlb : &env->config->itlb;
61
- float_status discard = { };
60
+
62
+ float_status discard = env->fp_status;
61
+ assert(wi < tlb->nways && ei < tlb->way_size[wi]);
63
FloatRelation r;
62
return dtlb ?
64
63
env->dtlb[wi] + ei :
65
set_float_2nan_prop_rule(float_2nan_prop_s_ba, &discard);
64
env->itlb[wi] + ei;
66
diff --git a/target/sparc/translate.c b/target/sparc/translate.c
65
@@ -XXX,XX +XXX,XX @@ static xtensa_tlb_entry *get_tlb_entry(CPUXtensaState *env,
67
index XXXXXXX..XXXXXXX 100644
66
uint32_t wi;
68
--- a/target/sparc/translate.c
67
uint32_t ei;
69
+++ b/target/sparc/translate.c
68
70
@@ -XXX,XX +XXX,XX @@ static bool trans_FLCMPs(DisasContext *dc, arg_FLCMPs *a)
69
- split_tlb_entry_spec(env, v, dtlb, &vpn, &wi, &ei);
71
70
- if (pwi) {
72
src1 = gen_load_fpr_F(dc, a->rs1);
71
- *pwi = wi;
73
src2 = gen_load_fpr_F(dc, a->rs2);
72
+ if (split_tlb_entry_spec(env, v, dtlb, &vpn, &wi, &ei)) {
74
- gen_helper_flcmps(cpu_fcc[a->cc], src1, src2);
73
+ if (pwi) {
75
+ gen_helper_flcmps(cpu_fcc[a->cc], tcg_env, src1, src2);
74
+ *pwi = wi;
76
return advance_pc(dc);
75
+ }
76
+ return xtensa_tlb_get_entry(env, dtlb, wi, ei);
77
+ } else {
78
+ return NULL;
79
}
80
- return xtensa_tlb_get_entry(env, dtlb, wi, ei);
81
}
77
}
82
78
83
static void xtensa_tlb_set_entry_mmu(const CPUXtensaState *env,
79
@@ -XXX,XX +XXX,XX @@ static bool trans_FLCMPd(DisasContext *dc, arg_FLCMPd *a)
84
@@ -XXX,XX +XXX,XX @@ uint32_t HELPER(rtlb0)(CPUXtensaState *env, uint32_t v, uint32_t dtlb)
80
85
if (xtensa_option_enabled(env->config, XTENSA_OPTION_MMU)) {
81
src1 = gen_load_fpr_D(dc, a->rs1);
86
uint32_t wi;
82
src2 = gen_load_fpr_D(dc, a->rs2);
87
const xtensa_tlb_entry *entry = get_tlb_entry(env, v, dtlb, &wi);
83
- gen_helper_flcmpd(cpu_fcc[a->cc], src1, src2);
88
- return (entry->vaddr & get_vpn_mask(env, dtlb, wi)) | entry->asid;
84
+ gen_helper_flcmpd(cpu_fcc[a->cc], tcg_env, src1, src2);
89
+
85
return advance_pc(dc);
90
+ if (entry) {
91
+ return (entry->vaddr & get_vpn_mask(env, dtlb, wi)) | entry->asid;
92
+ } else {
93
+ return 0;
94
+ }
95
} else {
96
return v & REGION_PAGE_MASK;
97
}
98
@@ -XXX,XX +XXX,XX @@ uint32_t HELPER(rtlb0)(CPUXtensaState *env, uint32_t v, uint32_t dtlb)
99
uint32_t HELPER(rtlb1)(CPUXtensaState *env, uint32_t v, uint32_t dtlb)
100
{
101
const xtensa_tlb_entry *entry = get_tlb_entry(env, v, dtlb, NULL);
102
- return entry->paddr | entry->attr;
103
+
104
+ if (entry) {
105
+ return entry->paddr | entry->attr;
106
+ } else {
107
+ return 0;
108
+ }
109
}
86
}
110
87
111
void HELPER(itlb)(CPUXtensaState *env, uint32_t v, uint32_t dtlb)
112
@@ -XXX,XX +XXX,XX @@ void HELPER(itlb)(CPUXtensaState *env, uint32_t v, uint32_t dtlb)
113
if (xtensa_option_enabled(env->config, XTENSA_OPTION_MMU)) {
114
uint32_t wi;
115
xtensa_tlb_entry *entry = get_tlb_entry(env, v, dtlb, &wi);
116
- if (entry->variable && entry->asid) {
117
+ if (entry && entry->variable && entry->asid) {
118
tlb_flush_page(env_cpu(env), entry->vaddr);
119
entry->asid = 0;
120
}
121
@@ -XXX,XX +XXX,XX @@ void HELPER(wtlb)(CPUXtensaState *env, uint32_t p, uint32_t v, uint32_t dtlb)
122
uint32_t vpn;
123
uint32_t wi;
124
uint32_t ei;
125
- split_tlb_entry_spec(env, v, dtlb, &vpn, &wi, &ei);
126
- xtensa_tlb_set_entry(env, dtlb, wi, ei, vpn, p);
127
+ if (split_tlb_entry_spec(env, v, dtlb, &vpn, &wi, &ei)) {
128
+ xtensa_tlb_set_entry(env, dtlb, wi, ei, vpn, p);
129
+ }
130
}
131
132
/*!
133
--
88
--
134
2.34.1
89
2.34.1
diff view generated by jsdifflib
New patch
1
In the helper_compute_fprf functions, we pass a dummy float_status
2
in to the is_signaling_nan() function. This is unnecessary, because
3
we have convenient access to the CPU env pointer here and that
4
is already set up with the correct values for the snan_bit_is_one
5
and no_signaling_nans config settings. is_signaling_nan() doesn't
6
ever update the fp_status with any exception flags, so there is
7
no reason not to use env->fp_status here.
1
8
9
Use env->fp_status instead of the dummy fp_status.
10
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
13
Message-id: 20241202131347.498124-34-peter.maydell@linaro.org
14
---
15
target/ppc/fpu_helper.c | 3 +--
16
1 file changed, 1 insertion(+), 2 deletions(-)
17
18
diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c
19
index XXXXXXX..XXXXXXX 100644
20
--- a/target/ppc/fpu_helper.c
21
+++ b/target/ppc/fpu_helper.c
22
@@ -XXX,XX +XXX,XX @@ void helper_compute_fprf_##tp(CPUPPCState *env, tp arg) \
23
} else if (tp##_is_infinity(arg)) { \
24
fprf = neg ? 0x09 << FPSCR_FPRF : 0x05 << FPSCR_FPRF; \
25
} else { \
26
- float_status dummy = { }; /* snan_bit_is_one = 0 */ \
27
- if (tp##_is_signaling_nan(arg, &dummy)) { \
28
+ if (tp##_is_signaling_nan(arg, &env->fp_status)) { \
29
fprf = 0x00 << FPSCR_FPRF; \
30
} else { \
31
fprf = 0x11 << FPSCR_FPRF; \
32
--
33
2.34.1
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
Now than we can access the M-profile bank index
3
Now that float_status has a bunch of fp parameters,
4
definitions from the target-agnostic "cpu-qom.h"
4
it is easier to copy an existing structure than create
5
header, we don't need the huge "cpu.h" anymore
5
one from scratch. Begin by copying the structure that
6
(except in hw/arm/armv7m.c). Reduce its inclusion
6
corresponds to the FPSR and make only the adjustments
7
to the source unit.
7
required for BFloat16 semantics.
8
8
9
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
9
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
10
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
10
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
11
Message-id: 20240118200643.29037-17-philmd@linaro.org
11
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
12
Message-id: 20241203203949.483774-2-richard.henderson@linaro.org
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
14
---
14
include/hw/intc/armv7m_nvic.h | 2 +-
15
target/arm/tcg/vec_helper.c | 20 +++++++-------------
15
hw/arm/armv7m.c | 1 +
16
1 file changed, 7 insertions(+), 13 deletions(-)
16
2 files changed, 2 insertions(+), 1 deletion(-)
17
17
18
diff --git a/include/hw/intc/armv7m_nvic.h b/include/hw/intc/armv7m_nvic.h
18
diff --git a/target/arm/tcg/vec_helper.c b/target/arm/tcg/vec_helper.c
19
index XXXXXXX..XXXXXXX 100644
19
index XXXXXXX..XXXXXXX 100644
20
--- a/include/hw/intc/armv7m_nvic.h
20
--- a/target/arm/tcg/vec_helper.c
21
+++ b/include/hw/intc/armv7m_nvic.h
21
+++ b/target/arm/tcg/vec_helper.c
22
@@ -XXX,XX +XXX,XX @@
22
@@ -XXX,XX +XXX,XX @@ bool is_ebf(CPUARMState *env, float_status *statusp, float_status *oddstatusp)
23
#ifndef HW_ARM_ARMV7M_NVIC_H
23
* no effect on AArch32 instructions.
24
#define HW_ARM_ARMV7M_NVIC_H
24
*/
25
25
bool ebf = is_a64(env) && env->vfp.fpcr & FPCR_EBF;
26
-#include "target/arm/cpu.h"
26
- *statusp = (float_status){
27
+#include "target/arm/cpu-qom.h"
27
- .tininess_before_rounding = float_tininess_before_rounding,
28
#include "hw/sysbus.h"
28
- .float_rounding_mode = float_round_to_odd_inf,
29
#include "hw/timer/armv7m_systick.h"
29
- .flush_to_zero = true,
30
#include "qom/object.h"
30
- .flush_inputs_to_zero = true,
31
diff --git a/hw/arm/armv7m.c b/hw/arm/armv7m.c
31
- .default_nan_mode = true,
32
index XXXXXXX..XXXXXXX 100644
32
- };
33
--- a/hw/arm/armv7m.c
33
+
34
+++ b/hw/arm/armv7m.c
34
+ *statusp = env->vfp.fp_status;
35
@@ -XXX,XX +XXX,XX @@
35
+ set_default_nan_mode(true, statusp);
36
#include "qemu/module.h"
36
37
#include "qemu/log.h"
37
if (ebf) {
38
#include "target/arm/idau.h"
38
- float_status *fpst = &env->vfp.fp_status;
39
+#include "target/arm/cpu.h"
39
- set_flush_to_zero(get_flush_to_zero(fpst), statusp);
40
#include "target/arm/cpu-features.h"
40
- set_flush_inputs_to_zero(get_flush_inputs_to_zero(fpst), statusp);
41
#include "migration/vmstate.h"
41
- set_float_rounding_mode(get_float_rounding_mode(fpst), statusp);
42
-
43
/* EBF=1 needs to do a step with round-to-odd semantics */
44
*oddstatusp = *statusp;
45
set_float_rounding_mode(float_round_to_odd, oddstatusp);
46
+ } else {
47
+ set_flush_to_zero(true, statusp);
48
+ set_flush_inputs_to_zero(true, statusp);
49
+ set_float_rounding_mode(float_round_to_odd_inf, statusp);
50
}
51
-
52
return ebf;
53
}
42
54
43
--
55
--
44
2.34.1
56
2.34.1
45
57
46
58
diff view generated by jsdifflib
New patch
1
Currently we hardcode the default NaN value in parts64_default_nan()
2
using a compile-time ifdef ladder. This is awkward for two cases:
3
* for single-QEMU-binary we can't hard-code target-specifics like this
4
* for Arm FEAT_AFP the default NaN value depends on FPCR.AH
5
(specifically the sign bit is different)
1
6
7
Add a field to float_status to specify the default NaN value; fall
8
back to the old ifdef behaviour if these are not set.
9
10
The default NaN value is specified by setting a uint8_t to a
11
pattern corresponding to the sign and upper fraction parts of
12
the NaN; the lower bits of the fraction are set from bit 0 of
13
the pattern.
14
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
17
Message-id: 20241202131347.498124-35-peter.maydell@linaro.org
18
---
19
include/fpu/softfloat-helpers.h | 11 +++++++
20
include/fpu/softfloat-types.h | 10 ++++++
21
fpu/softfloat-specialize.c.inc | 55 ++++++++++++++++++++-------------
22
3 files changed, 54 insertions(+), 22 deletions(-)
23
24
diff --git a/include/fpu/softfloat-helpers.h b/include/fpu/softfloat-helpers.h
25
index XXXXXXX..XXXXXXX 100644
26
--- a/include/fpu/softfloat-helpers.h
27
+++ b/include/fpu/softfloat-helpers.h
28
@@ -XXX,XX +XXX,XX @@ static inline void set_float_infzeronan_rule(FloatInfZeroNaNRule rule,
29
status->float_infzeronan_rule = rule;
30
}
31
32
+static inline void set_float_default_nan_pattern(uint8_t dnan_pattern,
33
+ float_status *status)
34
+{
35
+ status->default_nan_pattern = dnan_pattern;
36
+}
37
+
38
static inline void set_flush_to_zero(bool val, float_status *status)
39
{
40
status->flush_to_zero = val;
41
@@ -XXX,XX +XXX,XX @@ static inline FloatInfZeroNaNRule get_float_infzeronan_rule(float_status *status
42
return status->float_infzeronan_rule;
43
}
44
45
+static inline uint8_t get_float_default_nan_pattern(float_status *status)
46
+{
47
+ return status->default_nan_pattern;
48
+}
49
+
50
static inline bool get_flush_to_zero(float_status *status)
51
{
52
return status->flush_to_zero;
53
diff --git a/include/fpu/softfloat-types.h b/include/fpu/softfloat-types.h
54
index XXXXXXX..XXXXXXX 100644
55
--- a/include/fpu/softfloat-types.h
56
+++ b/include/fpu/softfloat-types.h
57
@@ -XXX,XX +XXX,XX @@ typedef struct float_status {
58
/* should denormalised inputs go to zero and set the input_denormal flag? */
59
bool flush_inputs_to_zero;
60
bool default_nan_mode;
61
+ /*
62
+ * The pattern to use for the default NaN. Here the high bit specifies
63
+ * the default NaN's sign bit, and bits 6..0 specify the high bits of the
64
+ * fractional part. The low bits of the fractional part are copies of bit 0.
65
+ * The exponent of the default NaN is (as for any NaN) always all 1s.
66
+ * Note that a value of 0 here is not a valid NaN. The target must set
67
+ * this to the correct non-zero value, or we will assert when trying to
68
+ * create a default NaN.
69
+ */
70
+ uint8_t default_nan_pattern;
71
/*
72
* The flags below are not used on all specializations and may
73
* constant fold away (see snan_bit_is_one()/no_signalling_nans() in
74
diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc
75
index XXXXXXX..XXXXXXX 100644
76
--- a/fpu/softfloat-specialize.c.inc
77
+++ b/fpu/softfloat-specialize.c.inc
78
@@ -XXX,XX +XXX,XX @@ static void parts64_default_nan(FloatParts64 *p, float_status *status)
79
{
80
bool sign = 0;
81
uint64_t frac;
82
+ uint8_t dnan_pattern = status->default_nan_pattern;
83
84
+ if (dnan_pattern == 0) {
85
#if defined(TARGET_SPARC) || defined(TARGET_M68K)
86
- /* !snan_bit_is_one, set all bits */
87
- frac = (1ULL << DECOMPOSED_BINARY_POINT) - 1;
88
-#elif defined(TARGET_I386) || defined(TARGET_X86_64) \
89
+ /* Sign bit clear, all frac bits set */
90
+ dnan_pattern = 0b01111111;
91
+#elif defined(TARGET_I386) || defined(TARGET_X86_64) \
92
|| defined(TARGET_MICROBLAZE)
93
- /* !snan_bit_is_one, set sign and msb */
94
- frac = 1ULL << (DECOMPOSED_BINARY_POINT - 1);
95
- sign = 1;
96
+ /* Sign bit set, most significant frac bit set */
97
+ dnan_pattern = 0b11000000;
98
#elif defined(TARGET_HPPA)
99
- /* snan_bit_is_one, set msb-1. */
100
- frac = 1ULL << (DECOMPOSED_BINARY_POINT - 2);
101
+ /* Sign bit clear, msb-1 frac bit set */
102
+ dnan_pattern = 0b00100000;
103
#elif defined(TARGET_HEXAGON)
104
- sign = 1;
105
- frac = ~0ULL;
106
+ /* Sign bit set, all frac bits set. */
107
+ dnan_pattern = 0b11111111;
108
#else
109
- /*
110
- * This case is true for Alpha, ARM, MIPS, OpenRISC, PPC, RISC-V,
111
- * S390, SH4, TriCore, and Xtensa. Our other supported targets
112
- * do not have floating-point.
113
- */
114
- if (snan_bit_is_one(status)) {
115
- /* set all bits other than msb */
116
- frac = (1ULL << (DECOMPOSED_BINARY_POINT - 1)) - 1;
117
- } else {
118
- /* set msb */
119
- frac = 1ULL << (DECOMPOSED_BINARY_POINT - 1);
120
- }
121
+ /*
122
+ * This case is true for Alpha, ARM, MIPS, OpenRISC, PPC, RISC-V,
123
+ * S390, SH4, TriCore, and Xtensa. Our other supported targets
124
+ * do not have floating-point.
125
+ */
126
+ if (snan_bit_is_one(status)) {
127
+ /* sign bit clear, set all frac bits other than msb */
128
+ dnan_pattern = 0b00111111;
129
+ } else {
130
+ /* sign bit clear, set frac msb */
131
+ dnan_pattern = 0b01000000;
132
+ }
133
#endif
134
+ }
135
+ assert(dnan_pattern != 0);
136
+
137
+ sign = dnan_pattern >> 7;
138
+ /*
139
+ * Place default_nan_pattern [6:0] into bits [62:56],
140
+ * and replecate bit [0] down into [55:0]
141
+ */
142
+ frac = deposit64(0, DECOMPOSED_BINARY_POINT - 7, 7, dnan_pattern);
143
+ frac = deposit64(frac, 0, DECOMPOSED_BINARY_POINT - 7, -(dnan_pattern & 1));
144
145
*p = (FloatParts64) {
146
.cls = float_class_qnan,
147
--
148
2.34.1
diff view generated by jsdifflib
New patch
1
Set the default NaN pattern explicitly for the tests/fp code.
1
2
3
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
Message-id: 20241202131347.498124-36-peter.maydell@linaro.org
6
---
7
tests/fp/fp-bench.c | 1 +
8
tests/fp/fp-test-log2.c | 1 +
9
tests/fp/fp-test.c | 1 +
10
3 files changed, 3 insertions(+)
11
12
diff --git a/tests/fp/fp-bench.c b/tests/fp/fp-bench.c
13
index XXXXXXX..XXXXXXX 100644
14
--- a/tests/fp/fp-bench.c
15
+++ b/tests/fp/fp-bench.c
16
@@ -XXX,XX +XXX,XX @@ static void run_bench(void)
17
set_float_2nan_prop_rule(float_2nan_prop_s_ab, &soft_status);
18
set_float_3nan_prop_rule(float_3nan_prop_s_cab, &soft_status);
19
set_float_infzeronan_rule(float_infzeronan_dnan_if_qnan, &soft_status);
20
+ set_float_default_nan_pattern(0b01000000, &soft_status);
21
22
f = bench_funcs[operation][precision];
23
g_assert(f);
24
diff --git a/tests/fp/fp-test-log2.c b/tests/fp/fp-test-log2.c
25
index XXXXXXX..XXXXXXX 100644
26
--- a/tests/fp/fp-test-log2.c
27
+++ b/tests/fp/fp-test-log2.c
28
@@ -XXX,XX +XXX,XX @@ int main(int ac, char **av)
29
int i;
30
31
set_float_2nan_prop_rule(float_2nan_prop_s_ab, &qsf);
32
+ set_float_default_nan_pattern(0b01000000, &qsf);
33
set_float_rounding_mode(float_round_nearest_even, &qsf);
34
35
test.d = 0.0;
36
diff --git a/tests/fp/fp-test.c b/tests/fp/fp-test.c
37
index XXXXXXX..XXXXXXX 100644
38
--- a/tests/fp/fp-test.c
39
+++ b/tests/fp/fp-test.c
40
@@ -XXX,XX +XXX,XX @@ void run_test(void)
41
*/
42
set_float_2nan_prop_rule(float_2nan_prop_s_ab, &qsf);
43
set_float_3nan_prop_rule(float_3nan_prop_s_cab, &qsf);
44
+ set_float_default_nan_pattern(0b01000000, &qsf);
45
set_float_infzeronan_rule(float_infzeronan_dnan_if_qnan, &qsf);
46
47
genCases_setLevel(test_level);
48
--
49
2.34.1
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
1
Set the default NaN pattern explicitly, and remove the ifdef from
2
parts64_default_nan().
2
3
3
Missed in commit 2d56be5a29 ("target: Declare
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
FOO_CPU_TYPE_NAME/SUFFIX in 'cpu-qom.h'"). See
5
it for more details.
6
7
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20240118200643.29037-12-philmd@linaro.org
6
Message-id: 20241202131347.498124-37-peter.maydell@linaro.org
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
7
---
12
target/arm/cpu-qom.h | 3 +++
8
target/microblaze/cpu.c | 2 ++
13
target/arm/cpu.h | 2 --
9
fpu/softfloat-specialize.c.inc | 3 +--
14
2 files changed, 3 insertions(+), 2 deletions(-)
10
2 files changed, 3 insertions(+), 2 deletions(-)
15
11
16
diff --git a/target/arm/cpu-qom.h b/target/arm/cpu-qom.h
12
diff --git a/target/microblaze/cpu.c b/target/microblaze/cpu.c
17
index XXXXXXX..XXXXXXX 100644
13
index XXXXXXX..XXXXXXX 100644
18
--- a/target/arm/cpu-qom.h
14
--- a/target/microblaze/cpu.c
19
+++ b/target/arm/cpu-qom.h
15
+++ b/target/microblaze/cpu.c
20
@@ -XXX,XX +XXX,XX @@ typedef struct AArch64CPUClass AArch64CPUClass;
16
@@ -XXX,XX +XXX,XX @@ static void mb_cpu_reset_hold(Object *obj, ResetType type)
21
DECLARE_CLASS_CHECKERS(AArch64CPUClass, AARCH64_CPU,
17
* this architecture.
22
TYPE_AARCH64_CPU)
18
*/
23
19
set_float_2nan_prop_rule(float_2nan_prop_x87, &env->fp_status);
24
+#define ARM_CPU_TYPE_SUFFIX "-" TYPE_ARM_CPU
20
+ /* Default NaN: sign bit set, most significant frac bit set */
25
+#define ARM_CPU_TYPE_NAME(name) (name ARM_CPU_TYPE_SUFFIX)
21
+ set_float_default_nan_pattern(0b11000000, &env->fp_status);
26
+
22
27
#endif
23
#if defined(CONFIG_USER_ONLY)
28
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
24
/* start in user mode with interrupts enabled. */
25
diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc
29
index XXXXXXX..XXXXXXX 100644
26
index XXXXXXX..XXXXXXX 100644
30
--- a/target/arm/cpu.h
27
--- a/fpu/softfloat-specialize.c.inc
31
+++ b/target/arm/cpu.h
28
+++ b/fpu/softfloat-specialize.c.inc
32
@@ -XXX,XX +XXX,XX @@ bool write_cpustate_to_list(ARMCPU *cpu, bool kvm_sync);
29
@@ -XXX,XX +XXX,XX @@ static void parts64_default_nan(FloatParts64 *p, float_status *status)
33
#define ARM_CPUID_TI915T 0x54029152
30
#if defined(TARGET_SPARC) || defined(TARGET_M68K)
34
#define ARM_CPUID_TI925T 0x54029252
31
/* Sign bit clear, all frac bits set */
35
32
dnan_pattern = 0b01111111;
36
-#define ARM_CPU_TYPE_SUFFIX "-" TYPE_ARM_CPU
33
-#elif defined(TARGET_I386) || defined(TARGET_X86_64) \
37
-#define ARM_CPU_TYPE_NAME(name) (name ARM_CPU_TYPE_SUFFIX)
34
- || defined(TARGET_MICROBLAZE)
38
#define CPU_RESOLVING_TYPE TYPE_ARM_CPU
35
+#elif defined(TARGET_I386) || defined(TARGET_X86_64)
39
36
/* Sign bit set, most significant frac bit set */
40
#define TYPE_ARM_HOST_CPU "host-" TYPE_ARM_CPU
37
dnan_pattern = 0b11000000;
38
#elif defined(TARGET_HPPA)
41
--
39
--
42
2.34.1
40
2.34.1
43
44
diff view generated by jsdifflib
New patch
1
Set the default NaN pattern explicitly, and remove the ifdef from
2
parts64_default_nan().
1
3
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Message-id: 20241202131347.498124-38-peter.maydell@linaro.org
7
---
8
target/i386/tcg/fpu_helper.c | 4 ++++
9
fpu/softfloat-specialize.c.inc | 3 ---
10
2 files changed, 4 insertions(+), 3 deletions(-)
11
12
diff --git a/target/i386/tcg/fpu_helper.c b/target/i386/tcg/fpu_helper.c
13
index XXXXXXX..XXXXXXX 100644
14
--- a/target/i386/tcg/fpu_helper.c
15
+++ b/target/i386/tcg/fpu_helper.c
16
@@ -XXX,XX +XXX,XX @@ void cpu_init_fp_statuses(CPUX86State *env)
17
*/
18
set_float_infzeronan_rule(float_infzeronan_dnan_never, &env->sse_status);
19
set_float_3nan_prop_rule(float_3nan_prop_abc, &env->sse_status);
20
+ /* Default NaN: sign bit set, most significant frac bit set */
21
+ set_float_default_nan_pattern(0b11000000, &env->fp_status);
22
+ set_float_default_nan_pattern(0b11000000, &env->mmx_status);
23
+ set_float_default_nan_pattern(0b11000000, &env->sse_status);
24
}
25
26
static inline uint8_t save_exception_flags(CPUX86State *env)
27
diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc
28
index XXXXXXX..XXXXXXX 100644
29
--- a/fpu/softfloat-specialize.c.inc
30
+++ b/fpu/softfloat-specialize.c.inc
31
@@ -XXX,XX +XXX,XX @@ static void parts64_default_nan(FloatParts64 *p, float_status *status)
32
#if defined(TARGET_SPARC) || defined(TARGET_M68K)
33
/* Sign bit clear, all frac bits set */
34
dnan_pattern = 0b01111111;
35
-#elif defined(TARGET_I386) || defined(TARGET_X86_64)
36
- /* Sign bit set, most significant frac bit set */
37
- dnan_pattern = 0b11000000;
38
#elif defined(TARGET_HPPA)
39
/* Sign bit clear, msb-1 frac bit set */
40
dnan_pattern = 0b00100000;
41
--
42
2.34.1
diff view generated by jsdifflib
New patch
1
Set the default NaN pattern explicitly, and remove the ifdef from
2
parts64_default_nan().
1
3
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Message-id: 20241202131347.498124-39-peter.maydell@linaro.org
7
---
8
target/hppa/fpu_helper.c | 2 ++
9
fpu/softfloat-specialize.c.inc | 3 ---
10
2 files changed, 2 insertions(+), 3 deletions(-)
11
12
diff --git a/target/hppa/fpu_helper.c b/target/hppa/fpu_helper.c
13
index XXXXXXX..XXXXXXX 100644
14
--- a/target/hppa/fpu_helper.c
15
+++ b/target/hppa/fpu_helper.c
16
@@ -XXX,XX +XXX,XX @@ void HELPER(loaded_fr0)(CPUHPPAState *env)
17
set_float_3nan_prop_rule(float_3nan_prop_abc, &env->fp_status);
18
/* For inf * 0 + NaN, return the input NaN */
19
set_float_infzeronan_rule(float_infzeronan_dnan_never, &env->fp_status);
20
+ /* Default NaN: sign bit clear, msb-1 frac bit set */
21
+ set_float_default_nan_pattern(0b00100000, &env->fp_status);
22
}
23
24
void cpu_hppa_loaded_fr0(CPUHPPAState *env)
25
diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc
26
index XXXXXXX..XXXXXXX 100644
27
--- a/fpu/softfloat-specialize.c.inc
28
+++ b/fpu/softfloat-specialize.c.inc
29
@@ -XXX,XX +XXX,XX @@ static void parts64_default_nan(FloatParts64 *p, float_status *status)
30
#if defined(TARGET_SPARC) || defined(TARGET_M68K)
31
/* Sign bit clear, all frac bits set */
32
dnan_pattern = 0b01111111;
33
-#elif defined(TARGET_HPPA)
34
- /* Sign bit clear, msb-1 frac bit set */
35
- dnan_pattern = 0b00100000;
36
#elif defined(TARGET_HEXAGON)
37
/* Sign bit set, all frac bits set. */
38
dnan_pattern = 0b11111111;
39
--
40
2.34.1
diff view generated by jsdifflib
New patch
1
Set the default NaN pattern explicitly for the alpha target.
1
2
3
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
Message-id: 20241202131347.498124-40-peter.maydell@linaro.org
6
---
7
target/alpha/cpu.c | 2 ++
8
1 file changed, 2 insertions(+)
9
10
diff --git a/target/alpha/cpu.c b/target/alpha/cpu.c
11
index XXXXXXX..XXXXXXX 100644
12
--- a/target/alpha/cpu.c
13
+++ b/target/alpha/cpu.c
14
@@ -XXX,XX +XXX,XX @@ static void alpha_cpu_initfn(Object *obj)
15
* operand in Fa. That is float_2nan_prop_ba.
16
*/
17
set_float_2nan_prop_rule(float_2nan_prop_x87, &env->fp_status);
18
+ /* Default NaN: sign bit clear, msb frac bit set */
19
+ set_float_default_nan_pattern(0b01000000, &env->fp_status);
20
#if defined(CONFIG_USER_ONLY)
21
env->flags = ENV_FLAG_PS_USER | ENV_FLAG_FEN;
22
cpu_alpha_store_fpcr(env, (uint64_t)(FPCR_INVD | FPCR_DZED | FPCR_OVFD
23
--
24
2.34.1
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
1
Set the default NaN pattern explicitly for the arm target.
2
This includes setting it for the old linux-user nwfpe emulation.
3
For nwfpe, our default doesn't match the real kernel, but we
4
avoid making a behaviour change in this commit.
2
5
3
Declare arm_cpu_mp_affinity() prototype in the new
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
"target/arm/multiprocessing.h" header so units in
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
hw/arm/ can use it without having to include the huge
8
Message-id: 20241202131347.498124-41-peter.maydell@linaro.org
6
target-specific "cpu.h".
9
---
10
linux-user/arm/nwfpe/fpa11.c | 5 +++++
11
target/arm/cpu.c | 2 ++
12
2 files changed, 7 insertions(+)
7
13
8
File list to include the new header generated using:
14
diff --git a/linux-user/arm/nwfpe/fpa11.c b/linux-user/arm/nwfpe/fpa11.c
9
10
$ git grep -lw arm_cpu_mp_affinity
11
12
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
13
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
14
Message-id: 20240118200643.29037-11-philmd@linaro.org
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
---
17
target/arm/cpu.h | 6 +-----
18
target/arm/multiprocessing.h | 16 ++++++++++++++++
19
hw/arm/virt-acpi-build.c | 1 +
20
hw/arm/virt.c | 1 +
21
hw/arm/xlnx-versal-virt.c | 1 +
22
hw/misc/xlnx-versal-crl.c | 1 +
23
target/arm/arm-powerctl.c | 1 +
24
target/arm/cpu.c | 5 +++++
25
target/arm/hvf/hvf.c | 1 +
26
target/arm/tcg/psci.c | 1 +
27
10 files changed, 29 insertions(+), 5 deletions(-)
28
create mode 100644 target/arm/multiprocessing.h
29
30
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
31
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
32
--- a/target/arm/cpu.h
16
--- a/linux-user/arm/nwfpe/fpa11.c
33
+++ b/target/arm/cpu.h
17
+++ b/linux-user/arm/nwfpe/fpa11.c
34
@@ -XXX,XX +XXX,XX @@
18
@@ -XXX,XX +XXX,XX @@ void resetFPA11(void)
35
#include "cpu-qom.h"
19
* this late date.
36
#include "exec/cpu-defs.h"
20
*/
37
#include "qapi/qapi-types-common.h"
21
set_float_2nan_prop_rule(float_2nan_prop_s_ab, &fpa11->fp_status);
38
+#include "target/arm/multiprocessing.h"
22
+ /*
39
23
+ * Use the same default NaN value as Arm VFP. This doesn't match
40
/* ARM processors have a weak memory model */
24
+ * the Linux kernel's nwfpe emulation, which uses an all-1s value.
41
#define TCG_GUEST_DEFAULT_MO (0)
25
+ */
42
@@ -XXX,XX +XXX,XX @@ void arm_cpu_post_init(Object *obj);
26
+ set_float_default_nan_pattern(0b01000000, &fpa11->fp_status);
43
27
}
44
uint64_t arm_build_mp_affinity(int idx, uint8_t clustersz);
28
45
29
void SetRoundingMode(const unsigned int opcode)
46
-static inline uint64_t arm_cpu_mp_affinity(ARMCPU *cpu)
47
-{
48
- return cpu->mp_affinity;
49
-}
50
-
51
#ifndef CONFIG_USER_ONLY
52
extern const VMStateDescription vmstate_arm_cpu;
53
54
diff --git a/target/arm/multiprocessing.h b/target/arm/multiprocessing.h
55
new file mode 100644
56
index XXXXXXX..XXXXXXX
57
--- /dev/null
58
+++ b/target/arm/multiprocessing.h
59
@@ -XXX,XX +XXX,XX @@
60
+/*
61
+ * ARM multiprocessor CPU helpers
62
+ *
63
+ * Copyright (c) 2003 Fabrice Bellard
64
+ *
65
+ * SPDX-License-Identifier: LGPL-2.1-or-later
66
+ */
67
+
68
+#ifndef TARGET_ARM_MULTIPROCESSING_H
69
+#define TARGET_ARM_MULTIPROCESSING_H
70
+
71
+#include "target/arm/cpu-qom.h"
72
+
73
+uint64_t arm_cpu_mp_affinity(ARMCPU *cpu);
74
+
75
+#endif
76
diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
77
index XXXXXXX..XXXXXXX 100644
78
--- a/hw/arm/virt-acpi-build.c
79
+++ b/hw/arm/virt-acpi-build.c
80
@@ -XXX,XX +XXX,XX @@
81
#include "hw/acpi/ghes.h"
82
#include "hw/acpi/viot.h"
83
#include "hw/virtio/virtio-acpi.h"
84
+#include "target/arm/multiprocessing.h"
85
86
#define ARM_SPI_BASE 32
87
88
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
89
index XXXXXXX..XXXXXXX 100644
90
--- a/hw/arm/virt.c
91
+++ b/hw/arm/virt.c
92
@@ -XXX,XX +XXX,XX @@
93
#include "hw/arm/smmuv3.h"
94
#include "hw/acpi/acpi.h"
95
#include "target/arm/internals.h"
96
+#include "target/arm/multiprocessing.h"
97
#include "hw/mem/pc-dimm.h"
98
#include "hw/mem/nvdimm.h"
99
#include "hw/acpi/generic_event_device.h"
100
diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c
101
index XXXXXXX..XXXXXXX 100644
102
--- a/hw/arm/xlnx-versal-virt.c
103
+++ b/hw/arm/xlnx-versal-virt.c
104
@@ -XXX,XX +XXX,XX @@
105
#include "hw/qdev-properties.h"
106
#include "hw/arm/xlnx-versal.h"
107
#include "hw/arm/boot.h"
108
+#include "target/arm/multiprocessing.h"
109
#include "qom/object.h"
110
111
#define TYPE_XLNX_VERSAL_VIRT_MACHINE MACHINE_TYPE_NAME("xlnx-versal-virt")
112
diff --git a/hw/misc/xlnx-versal-crl.c b/hw/misc/xlnx-versal-crl.c
113
index XXXXXXX..XXXXXXX 100644
114
--- a/hw/misc/xlnx-versal-crl.c
115
+++ b/hw/misc/xlnx-versal-crl.c
116
@@ -XXX,XX +XXX,XX @@
117
#include "hw/resettable.h"
118
119
#include "target/arm/arm-powerctl.h"
120
+#include "target/arm/multiprocessing.h"
121
#include "hw/misc/xlnx-versal-crl.h"
122
123
#ifndef XLNX_VERSAL_CRL_ERR_DEBUG
124
diff --git a/target/arm/arm-powerctl.c b/target/arm/arm-powerctl.c
125
index XXXXXXX..XXXXXXX 100644
126
--- a/target/arm/arm-powerctl.c
127
+++ b/target/arm/arm-powerctl.c
128
@@ -XXX,XX +XXX,XX @@
129
#include "qemu/log.h"
130
#include "qemu/main-loop.h"
131
#include "sysemu/tcg.h"
132
+#include "target/arm/multiprocessing.h"
133
134
#ifndef DEBUG_ARM_POWERCTL
135
#define DEBUG_ARM_POWERCTL 0
136
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
30
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
137
index XXXXXXX..XXXXXXX 100644
31
index XXXXXXX..XXXXXXX 100644
138
--- a/target/arm/cpu.c
32
--- a/target/arm/cpu.c
139
+++ b/target/arm/cpu.c
33
+++ b/target/arm/cpu.c
140
@@ -XXX,XX +XXX,XX @@ uint64_t arm_build_mp_affinity(int idx, uint8_t clustersz)
34
@@ -XXX,XX +XXX,XX @@ void arm_register_el_change_hook(ARMCPU *cpu, ARMELChangeHookFn *hook,
141
return (Aff1 << ARM_AFF1_SHIFT) | Aff0;
35
* the pseudocode function the arguments are in the order c, a, b.
36
* * 0 * Inf + NaN returns the default NaN if the input NaN is quiet,
37
* and the input NaN if it is signalling
38
+ * * Default NaN has sign bit clear, msb frac bit set
39
*/
40
static void arm_set_default_fp_behaviours(float_status *s)
41
{
42
@@ -XXX,XX +XXX,XX @@ static void arm_set_default_fp_behaviours(float_status *s)
43
set_float_2nan_prop_rule(float_2nan_prop_s_ab, s);
44
set_float_3nan_prop_rule(float_3nan_prop_s_cab, s);
45
set_float_infzeronan_rule(float_infzeronan_dnan_if_qnan, s);
46
+ set_float_default_nan_pattern(0b01000000, s);
142
}
47
}
143
48
144
+uint64_t arm_cpu_mp_affinity(ARMCPU *cpu)
49
static void cp_reg_reset(gpointer key, gpointer value, gpointer opaque)
145
+{
146
+ return cpu->mp_affinity;
147
+}
148
+
149
static void arm_cpu_initfn(Object *obj)
150
{
151
ARMCPU *cpu = ARM_CPU(obj);
152
diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c
153
index XXXXXXX..XXXXXXX 100644
154
--- a/target/arm/hvf/hvf.c
155
+++ b/target/arm/hvf/hvf.c
156
@@ -XXX,XX +XXX,XX @@
157
#include "arm-powerctl.h"
158
#include "target/arm/cpu.h"
159
#include "target/arm/internals.h"
160
+#include "target/arm/multiprocessing.h"
161
#include "trace/trace-target_arm_hvf.h"
162
#include "migration/vmstate.h"
163
164
diff --git a/target/arm/tcg/psci.c b/target/arm/tcg/psci.c
165
index XXXXXXX..XXXXXXX 100644
166
--- a/target/arm/tcg/psci.c
167
+++ b/target/arm/tcg/psci.c
168
@@ -XXX,XX +XXX,XX @@
169
#include "sysemu/runstate.h"
170
#include "internals.h"
171
#include "arm-powerctl.h"
172
+#include "target/arm/multiprocessing.h"
173
174
bool arm_is_psci_call(ARMCPU *cpu, int excp_type)
175
{
176
--
50
--
177
2.34.1
51
2.34.1
178
179
diff view generated by jsdifflib
New patch
1
Set the default NaN pattern explicitly for loongarch.
1
2
3
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
Message-id: 20241202131347.498124-42-peter.maydell@linaro.org
6
---
7
target/loongarch/tcg/fpu_helper.c | 2 ++
8
1 file changed, 2 insertions(+)
9
10
diff --git a/target/loongarch/tcg/fpu_helper.c b/target/loongarch/tcg/fpu_helper.c
11
index XXXXXXX..XXXXXXX 100644
12
--- a/target/loongarch/tcg/fpu_helper.c
13
+++ b/target/loongarch/tcg/fpu_helper.c
14
@@ -XXX,XX +XXX,XX @@ void restore_fp_status(CPULoongArchState *env)
15
*/
16
set_float_infzeronan_rule(float_infzeronan_dnan_never, &env->fp_status);
17
set_float_3nan_prop_rule(float_3nan_prop_s_cab, &env->fp_status);
18
+ /* Default NaN: sign bit clear, msb frac bit set */
19
+ set_float_default_nan_pattern(0b01000000, &env->fp_status);
20
}
21
22
int ieee_ex_to_loongarch(int xcpt)
23
--
24
2.34.1
diff view generated by jsdifflib
New patch
1
Set the default NaN pattern explicitly for m68k.
1
2
3
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
Message-id: 20241202131347.498124-43-peter.maydell@linaro.org
6
---
7
target/m68k/cpu.c | 2 ++
8
fpu/softfloat-specialize.c.inc | 2 +-
9
2 files changed, 3 insertions(+), 1 deletion(-)
10
11
diff --git a/target/m68k/cpu.c b/target/m68k/cpu.c
12
index XXXXXXX..XXXXXXX 100644
13
--- a/target/m68k/cpu.c
14
+++ b/target/m68k/cpu.c
15
@@ -XXX,XX +XXX,XX @@ static void m68k_cpu_reset_hold(Object *obj, ResetType type)
16
* preceding paragraph for nonsignaling NaNs.
17
*/
18
set_float_2nan_prop_rule(float_2nan_prop_ab, &env->fp_status);
19
+ /* Default NaN: sign bit clear, all frac bits set */
20
+ set_float_default_nan_pattern(0b01111111, &env->fp_status);
21
22
nan = floatx80_default_nan(&env->fp_status);
23
for (i = 0; i < 8; i++) {
24
diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc
25
index XXXXXXX..XXXXXXX 100644
26
--- a/fpu/softfloat-specialize.c.inc
27
+++ b/fpu/softfloat-specialize.c.inc
28
@@ -XXX,XX +XXX,XX @@ static void parts64_default_nan(FloatParts64 *p, float_status *status)
29
uint8_t dnan_pattern = status->default_nan_pattern;
30
31
if (dnan_pattern == 0) {
32
-#if defined(TARGET_SPARC) || defined(TARGET_M68K)
33
+#if defined(TARGET_SPARC)
34
/* Sign bit clear, all frac bits set */
35
dnan_pattern = 0b01111111;
36
#elif defined(TARGET_HEXAGON)
37
--
38
2.34.1
diff view generated by jsdifflib
New patch
1
Set the default NaN pattern explicitly for MIPS. Note that this
2
is our only target which currently changes the default NaN
3
at runtime (which it was previously doing indirectly when it
4
changed the snan_bit_is_one setting).
1
5
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20241202131347.498124-44-peter.maydell@linaro.org
9
---
10
target/mips/fpu_helper.h | 7 +++++++
11
target/mips/msa.c | 3 +++
12
2 files changed, 10 insertions(+)
13
14
diff --git a/target/mips/fpu_helper.h b/target/mips/fpu_helper.h
15
index XXXXXXX..XXXXXXX 100644
16
--- a/target/mips/fpu_helper.h
17
+++ b/target/mips/fpu_helper.h
18
@@ -XXX,XX +XXX,XX @@ static inline void restore_snan_bit_mode(CPUMIPSState *env)
19
set_float_infzeronan_rule(izn_rule, &env->active_fpu.fp_status);
20
nan3_rule = nan2008 ? float_3nan_prop_s_cab : float_3nan_prop_s_abc;
21
set_float_3nan_prop_rule(nan3_rule, &env->active_fpu.fp_status);
22
+ /*
23
+ * With nan2008, the default NaN value has the sign bit clear and the
24
+ * frac msb set; with the older mode, the sign bit is clear, and all
25
+ * frac bits except the msb are set.
26
+ */
27
+ set_float_default_nan_pattern(nan2008 ? 0b01000000 : 0b00111111,
28
+ &env->active_fpu.fp_status);
29
30
}
31
32
diff --git a/target/mips/msa.c b/target/mips/msa.c
33
index XXXXXXX..XXXXXXX 100644
34
--- a/target/mips/msa.c
35
+++ b/target/mips/msa.c
36
@@ -XXX,XX +XXX,XX @@ void msa_reset(CPUMIPSState *env)
37
/* Inf * 0 + NaN returns the input NaN */
38
set_float_infzeronan_rule(float_infzeronan_dnan_never,
39
&env->active_tc.msa_fp_status);
40
+ /* Default NaN: sign bit clear, frac msb set */
41
+ set_float_default_nan_pattern(0b01000000,
42
+ &env->active_tc.msa_fp_status);
43
}
44
--
45
2.34.1
diff view generated by jsdifflib
New patch
1
Set the default NaN pattern explicitly for openrisc.
1
2
3
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
Message-id: 20241202131347.498124-45-peter.maydell@linaro.org
6
---
7
target/openrisc/cpu.c | 2 ++
8
1 file changed, 2 insertions(+)
9
10
diff --git a/target/openrisc/cpu.c b/target/openrisc/cpu.c
11
index XXXXXXX..XXXXXXX 100644
12
--- a/target/openrisc/cpu.c
13
+++ b/target/openrisc/cpu.c
14
@@ -XXX,XX +XXX,XX @@ static void openrisc_cpu_reset_hold(Object *obj, ResetType type)
15
*/
16
set_float_2nan_prop_rule(float_2nan_prop_x87, &cpu->env.fp_status);
17
18
+ /* Default NaN: sign bit clear, frac msb set */
19
+ set_float_default_nan_pattern(0b01000000, &cpu->env.fp_status);
20
21
#ifndef CONFIG_USER_ONLY
22
cpu->env.picmr = 0x00000000;
23
--
24
2.34.1
diff view generated by jsdifflib
New patch
1
Set the default NaN pattern explicitly for ppc.
1
2
3
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
Message-id: 20241202131347.498124-46-peter.maydell@linaro.org
6
---
7
target/ppc/cpu_init.c | 4 ++++
8
1 file changed, 4 insertions(+)
9
10
diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c
11
index XXXXXXX..XXXXXXX 100644
12
--- a/target/ppc/cpu_init.c
13
+++ b/target/ppc/cpu_init.c
14
@@ -XXX,XX +XXX,XX @@ static void ppc_cpu_reset_hold(Object *obj, ResetType type)
15
set_float_infzeronan_rule(float_infzeronan_dnan_never, &env->fp_status);
16
set_float_infzeronan_rule(float_infzeronan_dnan_never, &env->vec_status);
17
18
+ /* Default NaN: sign bit clear, set frac msb */
19
+ set_float_default_nan_pattern(0b01000000, &env->fp_status);
20
+ set_float_default_nan_pattern(0b01000000, &env->vec_status);
21
+
22
for (i = 0; i < ARRAY_SIZE(env->spr_cb); i++) {
23
ppc_spr_t *spr = &env->spr_cb[i];
24
25
--
26
2.34.1
diff view generated by jsdifflib
New patch
1
Set the default NaN pattern explicitly for sh4. Note that sh4
2
is one of the only three targets (the others being HPPA and
3
sometimes MIPS) that has snan_bit_is_one set.
1
4
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Message-id: 20241202131347.498124-47-peter.maydell@linaro.org
8
---
9
target/sh4/cpu.c | 2 ++
10
1 file changed, 2 insertions(+)
11
12
diff --git a/target/sh4/cpu.c b/target/sh4/cpu.c
13
index XXXXXXX..XXXXXXX 100644
14
--- a/target/sh4/cpu.c
15
+++ b/target/sh4/cpu.c
16
@@ -XXX,XX +XXX,XX @@ static void superh_cpu_reset_hold(Object *obj, ResetType type)
17
set_flush_to_zero(1, &env->fp_status);
18
#endif
19
set_default_nan_mode(1, &env->fp_status);
20
+ /* sign bit clear, set all frac bits other than msb */
21
+ set_float_default_nan_pattern(0b00111111, &env->fp_status);
22
}
23
24
static void superh_cpu_disas_set_info(CPUState *cpu, disassemble_info *info)
25
--
26
2.34.1
diff view generated by jsdifflib
New patch
1
Set the default NaN pattern explicitly for rx.
1
2
3
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
Message-id: 20241202131347.498124-48-peter.maydell@linaro.org
6
---
7
target/rx/cpu.c | 2 ++
8
1 file changed, 2 insertions(+)
9
10
diff --git a/target/rx/cpu.c b/target/rx/cpu.c
11
index XXXXXXX..XXXXXXX 100644
12
--- a/target/rx/cpu.c
13
+++ b/target/rx/cpu.c
14
@@ -XXX,XX +XXX,XX @@ static void rx_cpu_reset_hold(Object *obj, ResetType type)
15
* then prefer dest over source", which is float_2nan_prop_s_ab.
16
*/
17
set_float_2nan_prop_rule(float_2nan_prop_x87, &env->fp_status);
18
+ /* Default NaN value: sign bit clear, set frac msb */
19
+ set_float_default_nan_pattern(0b01000000, &env->fp_status);
20
}
21
22
static ObjectClass *rx_cpu_class_by_name(const char *cpu_model)
23
--
24
2.34.1
diff view generated by jsdifflib
1
The const_le64() macro introduced in commit 845d80a8c7b187 turns out
1
Set the default NaN pattern explicitly for s390x.
2
to have a bug which means that on big-endian systems the compiler
3
complains if the argument isn't already a 64-bit type. This hasn't
4
caused a problem yet, because there are no in-tree uses, but it
5
means it's not possible for anybody to add one without it failing CI.
6
2
7
This example is from an attempted use of it with the argument '0',
3
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
from the s390 CI runner's gcc:
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
Message-id: 20241202131347.498124-49-peter.maydell@linaro.org
6
---
7
target/s390x/cpu.c | 2 ++
8
1 file changed, 2 insertions(+)
9
9
10
../block/blklogwrites.c: In function ‘blk_log_writes_co_do_log’:
10
diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
11
../include/qemu/bswap.h:148:36: error: left shift count >= width of
12
type [-Werror=shift-count-overflow]
13
148 | ((((_x) & 0x00000000000000ffU) << 56) | \
14
| ^~
15
../block/blklogwrites.c:409:27: note: in expansion of macro ‘const_le64’
16
409 | .nr_entries = const_le64(0),
17
| ^~~~~~~~~~
18
../include/qemu/bswap.h:149:36: error: left shift count >= width of
19
type [-Werror=shift-count-overflow]
20
149 | (((_x) & 0x000000000000ff00U) << 40) | \
21
| ^~
22
../block/blklogwrites.c:409:27: note: in expansion of macro ‘const_le64’
23
409 | .nr_entries = const_le64(0),
24
| ^~~~~~~~~~
25
cc1: all warnings being treated as errors
26
27
Fix this by making all the constants in the macro have the ULL
28
suffix. This will cause them all to be 64-bit integers, which means
29
the result of the logical & will also be an unsigned 64-bit type,
30
even if the input to the macro is a smaller type, and so the shifts
31
will be in range.
32
33
Fixes: 845d80a8c7b187 ("qemu/bswap: Add const_le64()")
34
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
35
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
36
Reviewed-by: Thomas Huth <thuth@redhat.com>
37
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
38
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
39
Message-id: 20240122173735.472951-1-peter.maydell@linaro.org
40
---
41
include/qemu/bswap.h | 16 ++++++++--------
42
1 file changed, 8 insertions(+), 8 deletions(-)
43
44
diff --git a/include/qemu/bswap.h b/include/qemu/bswap.h
45
index XXXXXXX..XXXXXXX 100644
11
index XXXXXXX..XXXXXXX 100644
46
--- a/include/qemu/bswap.h
12
--- a/target/s390x/cpu.c
47
+++ b/include/qemu/bswap.h
13
+++ b/target/s390x/cpu.c
48
@@ -XXX,XX +XXX,XX @@ CPU_CONVERT(le, 64, uint64_t)
14
@@ -XXX,XX +XXX,XX @@ static void s390_cpu_reset_hold(Object *obj, ResetType type)
49
*/
15
set_float_3nan_prop_rule(float_3nan_prop_s_abc, &env->fpu_status);
50
#if HOST_BIG_ENDIAN
16
set_float_infzeronan_rule(float_infzeronan_dnan_always,
51
# define const_le64(_x) \
17
&env->fpu_status);
52
- ((((_x) & 0x00000000000000ffU) << 56) | \
18
+ /* Default NaN value: sign bit clear, frac msb set */
53
- (((_x) & 0x000000000000ff00U) << 40) | \
19
+ set_float_default_nan_pattern(0b01000000, &env->fpu_status);
54
- (((_x) & 0x0000000000ff0000U) << 24) | \
20
/* fall through */
55
- (((_x) & 0x00000000ff000000U) << 8) | \
21
case RESET_TYPE_S390_CPU_NORMAL:
56
- (((_x) & 0x000000ff00000000U) >> 8) | \
22
env->psw.mask &= ~PSW_MASK_RI;
57
- (((_x) & 0x0000ff0000000000U) >> 24) | \
58
- (((_x) & 0x00ff000000000000U) >> 40) | \
59
- (((_x) & 0xff00000000000000U) >> 56))
60
+ ((((_x) & 0x00000000000000ffULL) << 56) | \
61
+ (((_x) & 0x000000000000ff00ULL) << 40) | \
62
+ (((_x) & 0x0000000000ff0000ULL) << 24) | \
63
+ (((_x) & 0x00000000ff000000ULL) << 8) | \
64
+ (((_x) & 0x000000ff00000000ULL) >> 8) | \
65
+ (((_x) & 0x0000ff0000000000ULL) >> 24) | \
66
+ (((_x) & 0x00ff000000000000ULL) >> 40) | \
67
+ (((_x) & 0xff00000000000000ULL) >> 56))
68
# define const_le32(_x) \
69
((((_x) & 0x000000ffU) << 24) | \
70
(((_x) & 0x0000ff00U) << 8) | \
71
--
23
--
72
2.34.1
24
2.34.1
73
74
diff view generated by jsdifflib
1
In commit 1b7bc9b5c8bf374dd we changed handle_vec_simd_sqshrn() so
1
Set the default NaN pattern explicitly for SPARC, and remove
2
that instead of starting with a 0 value and depositing in each new
2
the ifdef from parts64_default_nan.
3
element from the narrowing operation, it instead started with the raw
4
result of the narrowing operation of the first element.
5
3
6
This is fine in the vector case, because the deposit operations for
7
the second and subsequent elements will always overwrite any higher
8
bits that might have been in the first element's result value in
9
tcg_rd. However in the scalar case we only go through this loop
10
once. The effect is that for a signed narrowing operation, if the
11
result is negative then we will now return a value where the bits
12
above the first element are incorrectly 1 (because the narrowfn
13
returns a sign-extended result, not one that is truncated to the
14
element size).
15
16
Fix this by using an extract operation to get exactly the correct
17
bits of the output of the narrowfn for element 1, instead of a
18
plain move.
19
20
Cc: qemu-stable@nongnu.org
21
Fixes: 1b7bc9b5c8bf374dd3 ("target/arm: Avoid tcg_const_ptr in handle_vec_simd_sqshrn")
22
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2089
23
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
24
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
25
Message-id: 20240123153416.877308-1-peter.maydell@linaro.org
6
Message-id: 20241202131347.498124-50-peter.maydell@linaro.org
26
---
7
---
27
target/arm/tcg/translate-a64.c | 2 +-
8
target/sparc/cpu.c | 2 ++
28
1 file changed, 1 insertion(+), 1 deletion(-)
9
fpu/softfloat-specialize.c.inc | 5 +----
10
2 files changed, 3 insertions(+), 4 deletions(-)
29
11
30
diff --git a/target/arm/tcg/translate-a64.c b/target/arm/tcg/translate-a64.c
12
diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c
31
index XXXXXXX..XXXXXXX 100644
13
index XXXXXXX..XXXXXXX 100644
32
--- a/target/arm/tcg/translate-a64.c
14
--- a/target/sparc/cpu.c
33
+++ b/target/arm/tcg/translate-a64.c
15
+++ b/target/sparc/cpu.c
34
@@ -XXX,XX +XXX,XX @@ static void handle_vec_simd_sqshrn(DisasContext *s, bool is_scalar, bool is_q,
16
@@ -XXX,XX +XXX,XX @@ static void sparc_cpu_realizefn(DeviceState *dev, Error **errp)
35
narrowfn(tcg_rd_narrowed, tcg_env, tcg_rd);
17
set_float_3nan_prop_rule(float_3nan_prop_s_cba, &env->fp_status);
36
tcg_gen_extu_i32_i64(tcg_rd, tcg_rd_narrowed);
18
/* For inf * 0 + NaN, return the input NaN */
37
if (i == 0) {
19
set_float_infzeronan_rule(float_infzeronan_dnan_never, &env->fp_status);
38
- tcg_gen_mov_i64(tcg_final, tcg_rd);
20
+ /* Default NaN value: sign bit clear, all frac bits set */
39
+ tcg_gen_extract_i64(tcg_final, tcg_rd, 0, esize);
21
+ set_float_default_nan_pattern(0b01111111, &env->fp_status);
40
} else {
22
41
tcg_gen_deposit_i64(tcg_final, tcg_final, tcg_rd, esize * i, esize);
23
cpu_exec_realizefn(cs, &local_err);
42
}
24
if (local_err != NULL) {
25
diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc
26
index XXXXXXX..XXXXXXX 100644
27
--- a/fpu/softfloat-specialize.c.inc
28
+++ b/fpu/softfloat-specialize.c.inc
29
@@ -XXX,XX +XXX,XX @@ static void parts64_default_nan(FloatParts64 *p, float_status *status)
30
uint8_t dnan_pattern = status->default_nan_pattern;
31
32
if (dnan_pattern == 0) {
33
-#if defined(TARGET_SPARC)
34
- /* Sign bit clear, all frac bits set */
35
- dnan_pattern = 0b01111111;
36
-#elif defined(TARGET_HEXAGON)
37
+#if defined(TARGET_HEXAGON)
38
/* Sign bit set, all frac bits set. */
39
dnan_pattern = 0b11111111;
40
#else
43
--
41
--
44
2.34.1
42
2.34.1
diff view generated by jsdifflib
1
From: Nikita Ostrenkov <n.ostrenkov@gmail.com>
1
Set the default NaN pattern explicitly for xtensa.
2
2
3
Signed-off-by: Nikita Ostrenkov <n.ostrenkov@gmail.com>
4
Message-id: 20240108140325.1291-1-n.ostrenkov@gmail.com
5
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
3
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
Message-id: 20241202131347.498124-51-peter.maydell@linaro.org
7
---
6
---
8
include/hw/arm/fsl-imx6.h | 44 ++++++++++++++++++++-------------------
7
target/xtensa/cpu.c | 2 ++
9
hw/arm/fsl-imx6.c | 25 ++++++++++++++++++++++
8
1 file changed, 2 insertions(+)
10
hw/arm/Kconfig | 2 ++
11
3 files changed, 50 insertions(+), 21 deletions(-)
12
9
13
diff --git a/include/hw/arm/fsl-imx6.h b/include/hw/arm/fsl-imx6.h
10
diff --git a/target/xtensa/cpu.c b/target/xtensa/cpu.c
14
index XXXXXXX..XXXXXXX 100644
11
index XXXXXXX..XXXXXXX 100644
15
--- a/include/hw/arm/fsl-imx6.h
12
--- a/target/xtensa/cpu.c
16
+++ b/include/hw/arm/fsl-imx6.h
13
+++ b/target/xtensa/cpu.c
17
@@ -XXX,XX +XXX,XX @@
14
@@ -XXX,XX +XXX,XX @@ static void xtensa_cpu_reset_hold(Object *obj, ResetType type)
18
#include "hw/net/imx_fec.h"
15
/* For inf * 0 + NaN, return the input NaN */
19
#include "hw/usb/chipidea.h"
16
set_float_infzeronan_rule(float_infzeronan_dnan_never, &env->fp_status);
20
#include "hw/usb/imx-usb-phy.h"
17
set_no_signaling_nans(!dfpu, &env->fp_status);
21
+#include "hw/pci-host/designware.h"
18
+ /* Default NaN value: sign bit clear, set frac msb */
22
#include "exec/memory.h"
19
+ set_float_default_nan_pattern(0b01000000, &env->fp_status);
23
#include "cpu.h"
20
xtensa_use_first_nan(env, !dfpu);
24
#include "qom/object.h"
25
@@ -XXX,XX +XXX,XX @@ struct FslIMX6State {
26
DeviceState parent_obj;
27
28
/*< public >*/
29
- ARMCPU cpu[FSL_IMX6_NUM_CPUS];
30
- A9MPPrivState a9mpcore;
31
- IMX6CCMState ccm;
32
- IMX6SRCState src;
33
- IMX7SNVSState snvs;
34
- IMXSerialState uart[FSL_IMX6_NUM_UARTS];
35
- IMXGPTState gpt;
36
- IMXEPITState epit[FSL_IMX6_NUM_EPITS];
37
- IMXI2CState i2c[FSL_IMX6_NUM_I2CS];
38
- IMXGPIOState gpio[FSL_IMX6_NUM_GPIOS];
39
- SDHCIState esdhc[FSL_IMX6_NUM_ESDHCS];
40
- IMXSPIState spi[FSL_IMX6_NUM_ECSPIS];
41
- IMX2WdtState wdt[FSL_IMX6_NUM_WDTS];
42
- IMXUSBPHYState usbphy[FSL_IMX6_NUM_USB_PHYS];
43
- ChipideaState usb[FSL_IMX6_NUM_USBS];
44
- IMXFECState eth;
45
- MemoryRegion rom;
46
- MemoryRegion caam;
47
- MemoryRegion ocram;
48
- MemoryRegion ocram_alias;
49
- uint32_t phy_num;
50
+ ARMCPU cpu[FSL_IMX6_NUM_CPUS];
51
+ A9MPPrivState a9mpcore;
52
+ IMX6CCMState ccm;
53
+ IMX6SRCState src;
54
+ IMX7SNVSState snvs;
55
+ IMXSerialState uart[FSL_IMX6_NUM_UARTS];
56
+ IMXGPTState gpt;
57
+ IMXEPITState epit[FSL_IMX6_NUM_EPITS];
58
+ IMXI2CState i2c[FSL_IMX6_NUM_I2CS];
59
+ IMXGPIOState gpio[FSL_IMX6_NUM_GPIOS];
60
+ SDHCIState esdhc[FSL_IMX6_NUM_ESDHCS];
61
+ IMXSPIState spi[FSL_IMX6_NUM_ECSPIS];
62
+ IMX2WdtState wdt[FSL_IMX6_NUM_WDTS];
63
+ IMXUSBPHYState usbphy[FSL_IMX6_NUM_USB_PHYS];
64
+ ChipideaState usb[FSL_IMX6_NUM_USBS];
65
+ IMXFECState eth;
66
+ DesignwarePCIEHost pcie;
67
+ MemoryRegion rom;
68
+ MemoryRegion caam;
69
+ MemoryRegion ocram;
70
+ MemoryRegion ocram_alias;
71
+ uint32_t phy_num;
72
};
73
74
75
diff --git a/hw/arm/fsl-imx6.c b/hw/arm/fsl-imx6.c
76
index XXXXXXX..XXXXXXX 100644
77
--- a/hw/arm/fsl-imx6.c
78
+++ b/hw/arm/fsl-imx6.c
79
@@ -XXX,XX +XXX,XX @@
80
#include "qemu/osdep.h"
81
#include "qapi/error.h"
82
#include "hw/arm/fsl-imx6.h"
83
+#include "hw/misc/unimp.h"
84
#include "hw/usb/imx-usb-phy.h"
85
#include "hw/boards.h"
86
#include "hw/qdev-properties.h"
87
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6_init(Object *obj)
88
89
90
object_initialize_child(obj, "eth", &s->eth, TYPE_IMX_ENET);
91
+
92
+ object_initialize_child(obj, "pcie", &s->pcie, TYPE_DESIGNWARE_PCIE_HOST);
93
}
21
}
94
22
95
static void fsl_imx6_realize(DeviceState *dev, Error **errp)
96
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp)
97
MachineState *ms = MACHINE(qdev_get_machine());
98
FslIMX6State *s = FSL_IMX6(dev);
99
uint16_t i;
100
+ qemu_irq irq;
101
unsigned int smp_cpus = ms->smp.cpus;
102
103
if (smp_cpus > FSL_IMX6_NUM_CPUS) {
104
@@ -XXX,XX +XXX,XX @@ static void fsl_imx6_realize(DeviceState *dev, Error **errp)
105
FSL_IMX6_WDOGn_IRQ[i]));
106
}
107
108
+ /*
109
+ * PCIe
110
+ */
111
+ sysbus_realize(SYS_BUS_DEVICE(&s->pcie), &error_abort);
112
+ sysbus_mmio_map(SYS_BUS_DEVICE(&s->pcie), 0, FSL_IMX6_PCIe_REG_ADDR);
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
+ sysbus_connect_irq(SYS_BUS_DEVICE(&s->pcie), 3, irq);
122
+
123
+ /*
124
+ * PCIe PHY
125
+ */
126
+ create_unimplemented_device("pcie-phy", FSL_IMX6_PCIe_ADDR,
127
+ FSL_IMX6_PCIe_SIZE);
128
+
129
/* ROM memory */
130
if (!memory_region_init_rom(&s->rom, OBJECT(dev), "imx6.rom",
131
FSL_IMX6_ROM_SIZE, errp)) {
132
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
133
index XXXXXXX..XXXXXXX 100644
134
--- a/hw/arm/Kconfig
135
+++ b/hw/arm/Kconfig
136
@@ -XXX,XX +XXX,XX @@ config FSL_IMX31
137
138
config FSL_IMX6
139
bool
140
+ imply PCIE_DEVICES
141
imply I2C_DEVICES
142
select A9MPCORE
143
select IMX
144
@@ -XXX,XX +XXX,XX @@ config FSL_IMX6
145
select IMX_USBPHY
146
select WDT_IMX2
147
select PL310 # cache controller
148
+ select PCI_EXPRESS_DESIGNWARE
149
select SDHCI
150
151
config ASPEED_SOC
152
--
23
--
153
2.34.1
24
2.34.1
diff view generated by jsdifflib
1
A typo in the implementation of isar_feature_aa64_tidcp1() means we
1
Set the default NaN pattern explicitly for hexagon.
2
were checking the field in the wrong ID register, so we might have
2
Remove the ifdef from parts64_default_nan(); the only
3
provided the feature on CPUs that don't have it and not provided
3
remaining unconverted targets all use the default case.
4
it on CPUs that should have it. Correct this bug.
5
4
6
Cc: qemu-stable@nongnu.org
7
Fixes: 9cd0c0dec97be9 "target/arm: Implement FEAT_TIDCP1"
8
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2120
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
11
Message-id: 20240123160333.958841-1-peter.maydell@linaro.org
7
Message-id: 20241202131347.498124-52-peter.maydell@linaro.org
12
---
8
---
13
target/arm/cpu-features.h | 2 +-
9
target/hexagon/cpu.c | 2 ++
14
1 file changed, 1 insertion(+), 1 deletion(-)
10
fpu/softfloat-specialize.c.inc | 5 -----
11
2 files changed, 2 insertions(+), 5 deletions(-)
15
12
16
diff --git a/target/arm/cpu-features.h b/target/arm/cpu-features.h
13
diff --git a/target/hexagon/cpu.c b/target/hexagon/cpu.c
17
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
18
--- a/target/arm/cpu-features.h
15
--- a/target/hexagon/cpu.c
19
+++ b/target/arm/cpu-features.h
16
+++ b/target/hexagon/cpu.c
20
@@ -XXX,XX +XXX,XX @@ static inline bool isar_feature_aa64_hcx(const ARMISARegisters *id)
17
@@ -XXX,XX +XXX,XX @@ static void hexagon_cpu_reset_hold(Object *obj, ResetType type)
21
18
22
static inline bool isar_feature_aa64_tidcp1(const ARMISARegisters *id)
19
set_default_nan_mode(1, &env->fp_status);
23
{
20
set_float_detect_tininess(float_tininess_before_rounding, &env->fp_status);
24
- return FIELD_EX64(id->id_aa64mmfr2, ID_AA64MMFR1, TIDCP1) != 0;
21
+ /* Default NaN value: sign bit set, all frac bits set */
25
+ return FIELD_EX64(id->id_aa64mmfr1, ID_AA64MMFR1, TIDCP1) != 0;
22
+ set_float_default_nan_pattern(0b11111111, &env->fp_status);
26
}
23
}
27
24
28
static inline bool isar_feature_aa64_hafs(const ARMISARegisters *id)
25
static void hexagon_cpu_disas_set_info(CPUState *s, disassemble_info *info)
26
diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc
27
index XXXXXXX..XXXXXXX 100644
28
--- a/fpu/softfloat-specialize.c.inc
29
+++ b/fpu/softfloat-specialize.c.inc
30
@@ -XXX,XX +XXX,XX @@ static void parts64_default_nan(FloatParts64 *p, float_status *status)
31
uint8_t dnan_pattern = status->default_nan_pattern;
32
33
if (dnan_pattern == 0) {
34
-#if defined(TARGET_HEXAGON)
35
- /* Sign bit set, all frac bits set. */
36
- dnan_pattern = 0b11111111;
37
-#else
38
/*
39
* This case is true for Alpha, ARM, MIPS, OpenRISC, PPC, RISC-V,
40
* S390, SH4, TriCore, and Xtensa. Our other supported targets
41
@@ -XXX,XX +XXX,XX @@ static void parts64_default_nan(FloatParts64 *p, float_status *status)
42
/* sign bit clear, set frac msb */
43
dnan_pattern = 0b01000000;
44
}
45
-#endif
46
}
47
assert(dnan_pattern != 0);
48
29
--
49
--
30
2.34.1
50
2.34.1
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
1
Set the default NaN pattern explicitly for riscv.
2
2
3
e2h_access() was added in commit bb5972e439 ("target/arm:
3
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Add VHE timer register redirection and aliasing") close to
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
the generic_timer_cp_reginfo[] array, but isn't used until
5
Message-id: 20241202131347.498124-53-peter.maydell@linaro.org
6
vhe_reginfo[] definition. Move it closer to the other e2h
6
---
7
helpers.
7
target/riscv/cpu.c | 2 ++
8
1 file changed, 2 insertions(+)
8
9
9
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
10
diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c
10
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
11
Message-id: 20240118200643.29037-19-philmd@linaro.org
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
14
target/arm/helper.c | 29 +++++++++++++++--------------
15
1 file changed, 15 insertions(+), 14 deletions(-)
16
17
diff --git a/target/arm/helper.c b/target/arm/helper.c
18
index XXXXXXX..XXXXXXX 100644
11
index XXXXXXX..XXXXXXX 100644
19
--- a/target/arm/helper.c
12
--- a/target/riscv/cpu.c
20
+++ b/target/arm/helper.c
13
+++ b/target/riscv/cpu.c
21
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo generic_timer_cp_reginfo[] = {
14
@@ -XXX,XX +XXX,XX @@ static void riscv_cpu_reset_hold(Object *obj, ResetType type)
22
},
15
cs->exception_index = RISCV_EXCP_NONE;
23
};
16
env->load_res = -1;
24
17
set_default_nan_mode(1, &env->fp_status);
25
-static CPAccessResult e2h_access(CPUARMState *env, const ARMCPRegInfo *ri,
18
+ /* Default NaN value: sign bit clear, frac msb set */
26
- bool isread)
19
+ set_float_default_nan_pattern(0b01000000, &env->fp_status);
27
-{
20
env->vill = true;
28
- if (arm_current_el(env) == 1) {
29
- /* This must be a FEAT_NV access */
30
- /* TODO: FEAT_ECV will need to check CNTHCTL_EL2 here */
31
- return CP_ACCESS_OK;
32
- }
33
- if (!(arm_hcr_el2_eff(env) & HCR_E2H)) {
34
- return CP_ACCESS_TRAP;
35
- }
36
- return CP_ACCESS_OK;
37
-}
38
-
39
#else
40
41
/*
42
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo el3_cp_reginfo[] = {
43
};
44
21
45
#ifndef CONFIG_USER_ONLY
22
#ifndef CONFIG_USER_ONLY
46
+
47
+static CPAccessResult e2h_access(CPUARMState *env, const ARMCPRegInfo *ri,
48
+ bool isread)
49
+{
50
+ if (arm_current_el(env) == 1) {
51
+ /* This must be a FEAT_NV access */
52
+ /* TODO: FEAT_ECV will need to check CNTHCTL_EL2 here */
53
+ return CP_ACCESS_OK;
54
+ }
55
+ if (!(arm_hcr_el2_eff(env) & HCR_E2H)) {
56
+ return CP_ACCESS_TRAP;
57
+ }
58
+ return CP_ACCESS_OK;
59
+}
60
+
61
/* Test if system register redirection is to occur in the current state. */
62
static bool redirect_for_e2h(CPUARMState *env)
63
{
64
--
23
--
65
2.34.1
24
2.34.1
66
67
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
1
Set the default NaN pattern explicitly for tricore.
2
2
3
The ARMv7M QDev container accesses the QDev SysTickState
3
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
by its secure/non-secure bank index. In order to make
4
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
the "hw/intc/armv7m_nvic.h" header target-agnostic in
5
Message-id: 20241202131347.498124-54-peter.maydell@linaro.org
6
the next commit, first move the M-profile bank index
6
---
7
definitions to "target/arm/cpu-qom.h".
7
target/tricore/helper.c | 2 ++
8
1 file changed, 2 insertions(+)
8
9
9
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
10
diff --git a/target/tricore/helper.c b/target/tricore/helper.c
10
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
11
Message-id: 20240118200643.29037-16-philmd@linaro.org
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
14
target/arm/cpu-qom.h | 15 +++++++++++++++
15
target/arm/cpu.h | 15 ---------------
16
2 files changed, 15 insertions(+), 15 deletions(-)
17
18
diff --git a/target/arm/cpu-qom.h b/target/arm/cpu-qom.h
19
index XXXXXXX..XXXXXXX 100644
11
index XXXXXXX..XXXXXXX 100644
20
--- a/target/arm/cpu-qom.h
12
--- a/target/tricore/helper.c
21
+++ b/target/arm/cpu-qom.h
13
+++ b/target/tricore/helper.c
22
@@ -XXX,XX +XXX,XX @@ DECLARE_CLASS_CHECKERS(AArch64CPUClass, AARCH64_CPU,
14
@@ -XXX,XX +XXX,XX @@ void fpu_set_state(CPUTriCoreState *env)
23
#define ARM_CPU_TYPE_SUFFIX "-" TYPE_ARM_CPU
15
set_flush_to_zero(1, &env->fp_status);
24
#define ARM_CPU_TYPE_NAME(name) (name ARM_CPU_TYPE_SUFFIX)
16
set_float_detect_tininess(float_tininess_before_rounding, &env->fp_status);
25
17
set_default_nan_mode(1, &env->fp_status);
26
+/* For M profile, some registers are banked secure vs non-secure;
18
+ /* Default NaN pattern: sign bit clear, frac msb set */
27
+ * these are represented as a 2-element array where the first element
19
+ set_float_default_nan_pattern(0b01000000, &env->fp_status);
28
+ * is the non-secure copy and the second is the secure copy.
20
}
29
+ * When the CPU does not have implement the security extension then
21
30
+ * only the first element is used.
22
uint32_t psw_read(CPUTriCoreState *env)
31
+ * This means that the copy for the current security state can be
32
+ * accessed via env->registerfield[env->v7m.secure] (whether the security
33
+ * extension is implemented or not).
34
+ */
35
+enum {
36
+ M_REG_NS = 0,
37
+ M_REG_S = 1,
38
+ M_REG_NUM_BANKS = 2,
39
+};
40
+
41
#endif
42
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
43
index XXXXXXX..XXXXXXX 100644
44
--- a/target/arm/cpu.h
45
+++ b/target/arm/cpu.h
46
@@ -XXX,XX +XXX,XX @@
47
#define ARMV7M_EXCP_PENDSV 14
48
#define ARMV7M_EXCP_SYSTICK 15
49
50
-/* For M profile, some registers are banked secure vs non-secure;
51
- * these are represented as a 2-element array where the first element
52
- * is the non-secure copy and the second is the secure copy.
53
- * When the CPU does not have implement the security extension then
54
- * only the first element is used.
55
- * This means that the copy for the current security state can be
56
- * accessed via env->registerfield[env->v7m.secure] (whether the security
57
- * extension is implemented or not).
58
- */
59
-enum {
60
- M_REG_NS = 0,
61
- M_REG_S = 1,
62
- M_REG_NUM_BANKS = 2,
63
-};
64
-
65
/* ARM-specific interrupt pending bits. */
66
#define CPU_INTERRUPT_FIQ CPU_INTERRUPT_TGT_EXT_1
67
#define CPU_INTERRUPT_VIRQ CPU_INTERRUPT_TGT_EXT_2
68
--
23
--
69
2.34.1
24
2.34.1
70
71
diff view generated by jsdifflib
1
error_report() strings should not include trailing newlines; remove
1
Now that all our targets have bene converted to explicitly specify
2
the newline from the error we print when devices won't fit into the
2
their pattern for the default NaN value we can remove the remaining
3
address space of the CPU.
3
fallback code in parts64_default_nan().
4
5
This commit also fixes the accidental hardcoded tabs that were in
6
this line, since we have to touch the line anyway.
7
4
8
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
10
Message-id: 20240118131649.2726375-1-peter.maydell@linaro.org
7
Message-id: 20241202131347.498124-55-peter.maydell@linaro.org
11
---
8
---
12
hw/arm/virt.c | 4 ++--
9
fpu/softfloat-specialize.c.inc | 14 --------------
13
1 file changed, 2 insertions(+), 2 deletions(-)
10
1 file changed, 14 deletions(-)
14
11
15
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
12
diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc
16
index XXXXXXX..XXXXXXX 100644
13
index XXXXXXX..XXXXXXX 100644
17
--- a/hw/arm/virt.c
14
--- a/fpu/softfloat-specialize.c.inc
18
+++ b/hw/arm/virt.c
15
+++ b/fpu/softfloat-specialize.c.inc
19
@@ -XXX,XX +XXX,XX @@ static void virt_set_memmap(VirtMachineState *vms, int pa_bits)
16
@@ -XXX,XX +XXX,XX @@ static void parts64_default_nan(FloatParts64 *p, float_status *status)
20
/* Base address of the high IO region */
17
uint64_t frac;
21
memtop = base = device_memory_base + ROUND_UP(device_memory_size, GiB);
18
uint8_t dnan_pattern = status->default_nan_pattern;
22
if (memtop > BIT_ULL(pa_bits)) {
19
23
-     error_report("Addressing limited to %d bits, but memory exceeds it by %llu bytes\n",
20
- if (dnan_pattern == 0) {
24
-             pa_bits, memtop - BIT_ULL(pa_bits));
21
- /*
25
+ error_report("Addressing limited to %d bits, but memory exceeds it by %llu bytes",
22
- * This case is true for Alpha, ARM, MIPS, OpenRISC, PPC, RISC-V,
26
+ pa_bits, memtop - BIT_ULL(pa_bits));
23
- * S390, SH4, TriCore, and Xtensa. Our other supported targets
27
exit(EXIT_FAILURE);
24
- * do not have floating-point.
28
}
25
- */
29
if (base < device_memory_base) {
26
- if (snan_bit_is_one(status)) {
27
- /* sign bit clear, set all frac bits other than msb */
28
- dnan_pattern = 0b00111111;
29
- } else {
30
- /* sign bit clear, set frac msb */
31
- dnan_pattern = 0b01000000;
32
- }
33
- }
34
assert(dnan_pattern != 0);
35
36
sign = dnan_pattern >> 7;
30
--
37
--
31
2.34.1
38
2.34.1
32
33
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
"target/arm/cpu.h" is target specific, any file including it
3
Inline pickNaNMulAdd into its only caller. This makes
4
becomes target specific too, thus this is the same for any file
4
one assert redundant with the immediately preceding IF.
5
including "hw/misc/xlnx-versal-crl.h".
6
5
7
"hw/misc/xlnx-versal-crl.h" doesn't require any target specific
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
definition however, only the target-agnostic QOM definitions
7
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
9
from "target/arm/cpu-qom.h". Include the latter header to avoid
8
Message-id: 20241203203949.483774-3-richard.henderson@linaro.org
10
tainting unnecessary objects as target-specific.
9
[PMM: keep comment from old code in new location]
11
12
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
13
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
14
Message-id: 20240118200643.29037-14-philmd@linaro.org
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
---
11
---
17
include/hw/misc/xlnx-versal-crl.h | 2 +-
12
fpu/softfloat-parts.c.inc | 41 +++++++++++++++++++++++++-
18
hw/misc/xlnx-versal-crl.c | 1 +
13
fpu/softfloat-specialize.c.inc | 54 ----------------------------------
19
2 files changed, 2 insertions(+), 1 deletion(-)
14
2 files changed, 40 insertions(+), 55 deletions(-)
20
15
21
diff --git a/include/hw/misc/xlnx-versal-crl.h b/include/hw/misc/xlnx-versal-crl.h
16
diff --git a/fpu/softfloat-parts.c.inc b/fpu/softfloat-parts.c.inc
22
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
23
--- a/include/hw/misc/xlnx-versal-crl.h
18
--- a/fpu/softfloat-parts.c.inc
24
+++ b/include/hw/misc/xlnx-versal-crl.h
19
+++ b/fpu/softfloat-parts.c.inc
25
@@ -XXX,XX +XXX,XX @@
20
@@ -XXX,XX +XXX,XX @@ static FloatPartsN *partsN(pick_nan_muladd)(FloatPartsN *a, FloatPartsN *b,
26
21
}
27
#include "hw/sysbus.h"
22
28
#include "hw/register.h"
23
if (s->default_nan_mode) {
29
-#include "target/arm/cpu.h"
24
+ /*
30
+#include "target/arm/cpu-qom.h"
25
+ * We guarantee not to require the target to tell us how to
31
26
+ * pick a NaN if we're always returning the default NaN.
32
#define TYPE_XLNX_VERSAL_CRL "xlnx-versal-crl"
27
+ * But if we're not in default-NaN mode then the target must
33
OBJECT_DECLARE_SIMPLE_TYPE(XlnxVersalCRL, XLNX_VERSAL_CRL)
28
+ * specify.
34
diff --git a/hw/misc/xlnx-versal-crl.c b/hw/misc/xlnx-versal-crl.c
29
+ */
30
which = 3;
31
+ } else if (infzero) {
32
+ /*
33
+ * Inf * 0 + NaN -- some implementations return the
34
+ * default NaN here, and some return the input NaN.
35
+ */
36
+ switch (s->float_infzeronan_rule) {
37
+ case float_infzeronan_dnan_never:
38
+ which = 2;
39
+ break;
40
+ case float_infzeronan_dnan_always:
41
+ which = 3;
42
+ break;
43
+ case float_infzeronan_dnan_if_qnan:
44
+ which = is_qnan(c->cls) ? 3 : 2;
45
+ break;
46
+ default:
47
+ g_assert_not_reached();
48
+ }
49
} else {
50
- which = pickNaNMulAdd(a->cls, b->cls, c->cls, infzero, have_snan, s);
51
+ FloatClass cls[3] = { a->cls, b->cls, c->cls };
52
+ Float3NaNPropRule rule = s->float_3nan_prop_rule;
53
+
54
+ assert(rule != float_3nan_prop_none);
55
+ if (have_snan && (rule & R_3NAN_SNAN_MASK)) {
56
+ /* We have at least one SNaN input and should prefer it */
57
+ do {
58
+ which = rule & R_3NAN_1ST_MASK;
59
+ rule >>= R_3NAN_1ST_LENGTH;
60
+ } while (!is_snan(cls[which]));
61
+ } else {
62
+ do {
63
+ which = rule & R_3NAN_1ST_MASK;
64
+ rule >>= R_3NAN_1ST_LENGTH;
65
+ } while (!is_nan(cls[which]));
66
+ }
67
}
68
69
if (which == 3) {
70
diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc
35
index XXXXXXX..XXXXXXX 100644
71
index XXXXXXX..XXXXXXX 100644
36
--- a/hw/misc/xlnx-versal-crl.c
72
--- a/fpu/softfloat-specialize.c.inc
37
+++ b/hw/misc/xlnx-versal-crl.c
73
+++ b/fpu/softfloat-specialize.c.inc
38
@@ -XXX,XX +XXX,XX @@
74
@@ -XXX,XX +XXX,XX @@ static int pickNaN(FloatClass a_cls, FloatClass b_cls,
39
#include "hw/register.h"
75
}
40
#include "hw/resettable.h"
76
}
41
77
42
+#include "target/arm/cpu.h"
78
-/*----------------------------------------------------------------------------
43
#include "target/arm/arm-powerctl.h"
79
-| Select which NaN to propagate for a three-input operation.
44
#include "target/arm/multiprocessing.h"
80
-| For the moment we assume that no CPU needs the 'larger significand'
45
#include "hw/misc/xlnx-versal-crl.h"
81
-| information.
82
-| Return values : 0 : a; 1 : b; 2 : c; 3 : default-NaN
83
-*----------------------------------------------------------------------------*/
84
-static int pickNaNMulAdd(FloatClass a_cls, FloatClass b_cls, FloatClass c_cls,
85
- bool infzero, bool have_snan, float_status *status)
86
-{
87
- FloatClass cls[3] = { a_cls, b_cls, c_cls };
88
- Float3NaNPropRule rule = status->float_3nan_prop_rule;
89
- int which;
90
-
91
- /*
92
- * We guarantee not to require the target to tell us how to
93
- * pick a NaN if we're always returning the default NaN.
94
- * But if we're not in default-NaN mode then the target must
95
- * specify.
96
- */
97
- assert(!status->default_nan_mode);
98
-
99
- if (infzero) {
100
- /*
101
- * Inf * 0 + NaN -- some implementations return the default NaN here,
102
- * and some return the input NaN.
103
- */
104
- switch (status->float_infzeronan_rule) {
105
- case float_infzeronan_dnan_never:
106
- return 2;
107
- case float_infzeronan_dnan_always:
108
- return 3;
109
- case float_infzeronan_dnan_if_qnan:
110
- return is_qnan(c_cls) ? 3 : 2;
111
- default:
112
- g_assert_not_reached();
113
- }
114
- }
115
-
116
- assert(rule != float_3nan_prop_none);
117
- if (have_snan && (rule & R_3NAN_SNAN_MASK)) {
118
- /* We have at least one SNaN input and should prefer it */
119
- do {
120
- which = rule & R_3NAN_1ST_MASK;
121
- rule >>= R_3NAN_1ST_LENGTH;
122
- } while (!is_snan(cls[which]));
123
- } else {
124
- do {
125
- which = rule & R_3NAN_1ST_MASK;
126
- rule >>= R_3NAN_1ST_LENGTH;
127
- } while (!is_nan(cls[which]));
128
- }
129
- return which;
130
-}
131
-
132
/*----------------------------------------------------------------------------
133
| Returns 1 if the double-precision floating-point value `a' is a quiet
134
| NaN; otherwise returns 0.
46
--
135
--
47
2.34.1
136
2.34.1
48
137
49
138
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
target/arm/cpregs.h uses the CP_REG_ARCH_* definitions
3
Remove "3" as a special case for which and simply
4
from "target/arm/kvm-consts.h". Include it in order to
4
branch to return the desired value.
5
avoid when refactoring unrelated headers:
6
5
7
target/arm/cpregs.h:191:18: error: use of undeclared identifier 'CP_REG_ARCH_MASK'
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
if ((kvmid & CP_REG_ARCH_MASK) == CP_REG_ARM64) {
7
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
9
^
8
Message-id: 20241203203949.483774-4-richard.henderson@linaro.org
10
11
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
12
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
13
Message-id: 20240118200643.29037-8-philmd@linaro.org
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
---
10
---
16
target/arm/cpregs.h | 1 +
11
fpu/softfloat-parts.c.inc | 20 ++++++++++----------
17
1 file changed, 1 insertion(+)
12
1 file changed, 10 insertions(+), 10 deletions(-)
18
13
19
diff --git a/target/arm/cpregs.h b/target/arm/cpregs.h
14
diff --git a/fpu/softfloat-parts.c.inc b/fpu/softfloat-parts.c.inc
20
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
21
--- a/target/arm/cpregs.h
16
--- a/fpu/softfloat-parts.c.inc
22
+++ b/target/arm/cpregs.h
17
+++ b/fpu/softfloat-parts.c.inc
23
@@ -XXX,XX +XXX,XX @@
18
@@ -XXX,XX +XXX,XX @@ static FloatPartsN *partsN(pick_nan_muladd)(FloatPartsN *a, FloatPartsN *b,
24
#define TARGET_ARM_CPREGS_H
19
* But if we're not in default-NaN mode then the target must
25
20
* specify.
26
#include "hw/registerfields.h"
21
*/
27
+#include "target/arm/kvm-consts.h"
22
- which = 3;
23
+ goto default_nan;
24
} else if (infzero) {
25
/*
26
* Inf * 0 + NaN -- some implementations return the
27
@@ -XXX,XX +XXX,XX @@ static FloatPartsN *partsN(pick_nan_muladd)(FloatPartsN *a, FloatPartsN *b,
28
*/
29
switch (s->float_infzeronan_rule) {
30
case float_infzeronan_dnan_never:
31
- which = 2;
32
break;
33
case float_infzeronan_dnan_always:
34
- which = 3;
35
- break;
36
+ goto default_nan;
37
case float_infzeronan_dnan_if_qnan:
38
- which = is_qnan(c->cls) ? 3 : 2;
39
+ if (is_qnan(c->cls)) {
40
+ goto default_nan;
41
+ }
42
break;
43
default:
44
g_assert_not_reached();
45
}
46
+ which = 2;
47
} else {
48
FloatClass cls[3] = { a->cls, b->cls, c->cls };
49
Float3NaNPropRule rule = s->float_3nan_prop_rule;
50
@@ -XXX,XX +XXX,XX @@ static FloatPartsN *partsN(pick_nan_muladd)(FloatPartsN *a, FloatPartsN *b,
51
}
52
}
53
54
- if (which == 3) {
55
- parts_default_nan(a, s);
56
- return a;
57
- }
58
-
59
switch (which) {
60
case 0:
61
break;
62
@@ -XXX,XX +XXX,XX @@ static FloatPartsN *partsN(pick_nan_muladd)(FloatPartsN *a, FloatPartsN *b,
63
parts_silence_nan(a, s);
64
}
65
return a;
66
+
67
+ default_nan:
68
+ parts_default_nan(a, s);
69
+ return a;
70
}
28
71
29
/*
72
/*
30
* ARMCPRegInfo type field bits:
31
--
73
--
32
2.34.1
74
2.34.1
33
75
34
76
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
hw/arm/smmuv3-internal.h uses the REG32() and FIELD()
3
Assign the pointer return value to 'a' directly,
4
macros defined in "hw/registerfields.h". Include it in
4
rather than going through an intermediary index.
5
order to avoid when refactoring unrelated headers:
6
5
7
In file included from ../../hw/arm/smmuv3.c:34:
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
hw/arm/smmuv3-internal.h:36:28: error: expected identifier
7
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
9
REG32(IDR0, 0x0)
8
Message-id: 20241203203949.483774-5-richard.henderson@linaro.org
10
^
11
hw/arm/smmuv3-internal.h:37:5: error: expected function body after function declarator
12
FIELD(IDR0, S2P, 0 , 1)
13
^
14
15
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
16
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
17
Message-id: 20240118200643.29037-4-philmd@linaro.org
18
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
19
---
10
---
20
hw/arm/smmuv3-internal.h | 1 +
11
fpu/softfloat-parts.c.inc | 32 ++++++++++----------------------
21
1 file changed, 1 insertion(+)
12
1 file changed, 10 insertions(+), 22 deletions(-)
22
13
23
diff --git a/hw/arm/smmuv3-internal.h b/hw/arm/smmuv3-internal.h
14
diff --git a/fpu/softfloat-parts.c.inc b/fpu/softfloat-parts.c.inc
24
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
25
--- a/hw/arm/smmuv3-internal.h
16
--- a/fpu/softfloat-parts.c.inc
26
+++ b/hw/arm/smmuv3-internal.h
17
+++ b/fpu/softfloat-parts.c.inc
27
@@ -XXX,XX +XXX,XX @@
18
@@ -XXX,XX +XXX,XX @@ static FloatPartsN *partsN(pick_nan_muladd)(FloatPartsN *a, FloatPartsN *b,
28
#ifndef HW_ARM_SMMUV3_INTERNAL_H
19
FloatPartsN *c, float_status *s,
29
#define HW_ARM_SMMUV3_INTERNAL_H
20
int ab_mask, int abc_mask)
30
21
{
31
+#include "hw/registerfields.h"
22
- int which;
32
#include "hw/arm/smmu-common.h"
23
bool infzero = (ab_mask == float_cmask_infzero);
33
24
bool have_snan = (abc_mask & float_cmask_snan);
34
typedef enum SMMUTranslationStatus {
25
+ FloatPartsN *ret;
26
27
if (unlikely(have_snan)) {
28
float_raise(float_flag_invalid | float_flag_invalid_snan, s);
29
@@ -XXX,XX +XXX,XX @@ static FloatPartsN *partsN(pick_nan_muladd)(FloatPartsN *a, FloatPartsN *b,
30
default:
31
g_assert_not_reached();
32
}
33
- which = 2;
34
+ ret = c;
35
} else {
36
- FloatClass cls[3] = { a->cls, b->cls, c->cls };
37
+ FloatPartsN *val[3] = { a, b, c };
38
Float3NaNPropRule rule = s->float_3nan_prop_rule;
39
40
assert(rule != float_3nan_prop_none);
41
if (have_snan && (rule & R_3NAN_SNAN_MASK)) {
42
/* We have at least one SNaN input and should prefer it */
43
do {
44
- which = rule & R_3NAN_1ST_MASK;
45
+ ret = val[rule & R_3NAN_1ST_MASK];
46
rule >>= R_3NAN_1ST_LENGTH;
47
- } while (!is_snan(cls[which]));
48
+ } while (!is_snan(ret->cls));
49
} else {
50
do {
51
- which = rule & R_3NAN_1ST_MASK;
52
+ ret = val[rule & R_3NAN_1ST_MASK];
53
rule >>= R_3NAN_1ST_LENGTH;
54
- } while (!is_nan(cls[which]));
55
+ } while (!is_nan(ret->cls));
56
}
57
}
58
59
- switch (which) {
60
- case 0:
61
- break;
62
- case 1:
63
- a = b;
64
- break;
65
- case 2:
66
- a = c;
67
- break;
68
- default:
69
- g_assert_not_reached();
70
+ if (is_snan(ret->cls)) {
71
+ parts_silence_nan(ret, s);
72
}
73
- if (is_snan(a->cls)) {
74
- parts_silence_nan(a, s);
75
- }
76
- return a;
77
+ return ret;
78
79
default_nan:
80
parts_default_nan(a, s);
35
--
81
--
36
2.34.1
82
2.34.1
37
83
38
84
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
hw/arm/xilinx_zynq.c calls tswap32() which is declared
3
While all indices into val[] should be in [0-2], the mask
4
in "exec/tswap.h". Include it in order to avoid when
4
applied is two bits. To help static analysis see there is
5
refactoring unrelated headers:
5
no possibility of read beyond the end of the array, pad the
6
array to 4 entries, with the final being (implicitly) NULL.
6
7
7
hw/arm/xilinx_zynq.c:103:31: error: call to undeclared function 'tswap32';
8
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
9
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
9
board_setup_blob[n] = tswap32(board_setup_blob[n]);
10
Message-id: 20241203203949.483774-6-richard.henderson@linaro.org
10
^
11
12
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
13
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
14
Message-id: 20240118200643.29037-3-philmd@linaro.org
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
---
12
---
17
hw/arm/xilinx_zynq.c | 1 +
13
fpu/softfloat-parts.c.inc | 2 +-
18
1 file changed, 1 insertion(+)
14
1 file changed, 1 insertion(+), 1 deletion(-)
19
15
20
diff --git a/hw/arm/xilinx_zynq.c b/hw/arm/xilinx_zynq.c
16
diff --git a/fpu/softfloat-parts.c.inc b/fpu/softfloat-parts.c.inc
21
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
22
--- a/hw/arm/xilinx_zynq.c
18
--- a/fpu/softfloat-parts.c.inc
23
+++ b/hw/arm/xilinx_zynq.c
19
+++ b/fpu/softfloat-parts.c.inc
24
@@ -XXX,XX +XXX,XX @@
20
@@ -XXX,XX +XXX,XX @@ static FloatPartsN *partsN(pick_nan_muladd)(FloatPartsN *a, FloatPartsN *b,
25
#include "hw/qdev-clock.h"
21
}
26
#include "sysemu/reset.h"
22
ret = c;
27
#include "qom/object.h"
23
} else {
28
+#include "exec/tswap.h"
24
- FloatPartsN *val[3] = { a, b, c };
29
25
+ FloatPartsN *val[R_3NAN_1ST_MASK + 1] = { a, b, c };
30
#define TYPE_ZYNQ_MACHINE MACHINE_TYPE_NAME("xilinx-zynq-a9")
26
Float3NaNPropRule rule = s->float_3nan_prop_rule;
31
OBJECT_DECLARE_SIMPLE_TYPE(ZynqMachineState, ZYNQ_MACHINE)
27
28
assert(rule != float_3nan_prop_none);
32
--
29
--
33
2.34.1
30
2.34.1
34
31
35
32
diff view generated by jsdifflib
1
From: Guenter Roeck <linux@roeck-us.net>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
Allwinner R40 supports two USB host ports shared between a USB 2.0 EHCI
3
This function is part of the public interface and
4
host controller and a USB 1.1 OHCI host controller. Add support for both
4
is not "specialized" to any target in any way.
5
of them.
6
5
7
If machine USB support is not enabled, create unimplemented devices
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
for the USB memory ranges to avoid crashes when booting Linux.
7
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
8
Message-id: 20241203203949.483774-7-richard.henderson@linaro.org
10
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
11
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
12
Message-id: 20240115182757.1095012-2-linux@roeck-us.net
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
---
10
---
15
docs/system/arm/bananapi_m2u.rst | 2 +-
11
fpu/softfloat.c | 52 ++++++++++++++++++++++++++++++++++
16
include/hw/arm/allwinner-r40.h | 9 ++++++
12
fpu/softfloat-specialize.c.inc | 52 ----------------------------------
17
hw/arm/allwinner-r40.c | 47 ++++++++++++++++++++++++++++++--
13
2 files changed, 52 insertions(+), 52 deletions(-)
18
hw/arm/Kconfig | 2 ++
19
4 files changed, 57 insertions(+), 3 deletions(-)
20
14
21
diff --git a/docs/system/arm/bananapi_m2u.rst b/docs/system/arm/bananapi_m2u.rst
15
diff --git a/fpu/softfloat.c b/fpu/softfloat.c
22
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
23
--- a/docs/system/arm/bananapi_m2u.rst
17
--- a/fpu/softfloat.c
24
+++ b/docs/system/arm/bananapi_m2u.rst
18
+++ b/fpu/softfloat.c
25
@@ -XXX,XX +XXX,XX @@ The Banana Pi M2U machine supports the following devices:
19
@@ -XXX,XX +XXX,XX @@ void normalizeFloatx80Subnormal(uint64_t aSig, int32_t *zExpPtr,
26
* GMAC ethernet
20
*zExpPtr = 1 - shiftCount;
27
* Clock Control Unit
21
}
28
* TWI (I2C)
22
29
+ * USB 2.0
23
+/*----------------------------------------------------------------------------
30
24
+| Takes two extended double-precision floating-point values `a' and `b', one
31
Limitations
25
+| of which is a NaN, and returns the appropriate NaN result. If either `a' or
32
"""""""""""
26
+| `b' is a signaling NaN, the invalid exception is raised.
33
@@ -XXX,XX +XXX,XX @@ Currently, Banana Pi M2U does *not* support the following features:
27
+*----------------------------------------------------------------------------*/
34
- Audio output
28
+
35
- Hardware Watchdog
29
+floatx80 propagateFloatx80NaN(floatx80 a, floatx80 b, float_status *status)
36
- Real Time Clock
30
+{
37
-- USB 2.0 interfaces
31
+ bool aIsLargerSignificand;
38
32
+ FloatClass a_cls, b_cls;
39
Also see the 'unimplemented' array in the Allwinner R40 SoC module
33
+
40
for a complete list of unimplemented I/O devices: ``./hw/arm/allwinner-r40.c``
34
+ /* This is not complete, but is good enough for pickNaN. */
41
diff --git a/include/hw/arm/allwinner-r40.h b/include/hw/arm/allwinner-r40.h
35
+ a_cls = (!floatx80_is_any_nan(a)
42
index XXXXXXX..XXXXXXX 100644
36
+ ? float_class_normal
43
--- a/include/hw/arm/allwinner-r40.h
37
+ : floatx80_is_signaling_nan(a, status)
44
+++ b/include/hw/arm/allwinner-r40.h
38
+ ? float_class_snan
45
@@ -XXX,XX +XXX,XX @@
39
+ : float_class_qnan);
46
#include "hw/i2c/allwinner-i2c.h"
40
+ b_cls = (!floatx80_is_any_nan(b)
47
#include "hw/net/allwinner_emac.h"
41
+ ? float_class_normal
48
#include "hw/net/allwinner-sun8i-emac.h"
42
+ : floatx80_is_signaling_nan(b, status)
49
+#include "hw/usb/hcd-ohci.h"
43
+ ? float_class_snan
50
+#include "hw/usb/hcd-ehci.h"
44
+ : float_class_qnan);
51
#include "target/arm/cpu.h"
45
+
52
#include "sysemu/block-backend.h"
46
+ if (is_snan(a_cls) || is_snan(b_cls)) {
53
47
+ float_raise(float_flag_invalid, status);
54
@@ -XXX,XX +XXX,XX @@ enum {
55
AW_R40_DEV_MMC1,
56
AW_R40_DEV_MMC2,
57
AW_R40_DEV_MMC3,
58
+ AW_R40_DEV_EHCI1,
59
+ AW_R40_DEV_OHCI1,
60
+ AW_R40_DEV_EHCI2,
61
+ AW_R40_DEV_OHCI2,
62
AW_R40_DEV_CCU,
63
AW_R40_DEV_PIT,
64
AW_R40_DEV_UART0,
65
@@ -XXX,XX +XXX,XX @@ OBJECT_DECLARE_SIMPLE_TYPE(AwR40State, AW_R40)
66
* which are currently emulated by the R40 SoC code.
67
*/
68
#define AW_R40_NUM_MMCS 4
69
+#define AW_R40_NUM_USB 2
70
#define AW_R40_NUM_UARTS 8
71
72
struct AwR40State {
73
@@ -XXX,XX +XXX,XX @@ struct AwR40State {
74
AwSRAMCState sramc;
75
AwA10PITState timer;
76
AwSdHostState mmc[AW_R40_NUM_MMCS];
77
+ EHCISysBusState ehci[AW_R40_NUM_USB];
78
+ OHCISysBusState ohci[AW_R40_NUM_USB];
79
AwR40ClockCtlState ccu;
80
AwR40DramCtlState dramc;
81
AWI2CState i2c0;
82
diff --git a/hw/arm/allwinner-r40.c b/hw/arm/allwinner-r40.c
83
index XXXXXXX..XXXXXXX 100644
84
--- a/hw/arm/allwinner-r40.c
85
+++ b/hw/arm/allwinner-r40.c
86
@@ -XXX,XX +XXX,XX @@
87
#include "qemu/bswap.h"
88
#include "qemu/module.h"
89
#include "qemu/units.h"
90
+#include "hw/boards.h"
91
#include "hw/qdev-core.h"
92
#include "hw/sysbus.h"
93
#include "hw/char/serial.h"
94
@@ -XXX,XX +XXX,XX @@ const hwaddr allwinner_r40_memmap[] = {
95
[AW_R40_DEV_MMC1] = 0x01c10000,
96
[AW_R40_DEV_MMC2] = 0x01c11000,
97
[AW_R40_DEV_MMC3] = 0x01c12000,
98
+ [AW_R40_DEV_EHCI1] = 0x01c19000,
99
+ [AW_R40_DEV_OHCI1] = 0x01c19400,
100
+ [AW_R40_DEV_EHCI2] = 0x01c1c000,
101
+ [AW_R40_DEV_OHCI2] = 0x01c1c400,
102
[AW_R40_DEV_CCU] = 0x01c20000,
103
[AW_R40_DEV_PIT] = 0x01c20c00,
104
[AW_R40_DEV_UART0] = 0x01c28000,
105
@@ -XXX,XX +XXX,XX @@ static struct AwR40Unimplemented r40_unimplemented[] = {
106
{ "crypto", 0x01c15000, 4 * KiB },
107
{ "spi2", 0x01c17000, 4 * KiB },
108
{ "sata", 0x01c18000, 4 * KiB },
109
- { "usb1-host", 0x01c19000, 4 * KiB },
110
+ { "usb1-phy", 0x01c19800, 2 * KiB },
111
{ "sid", 0x01c1b000, 4 * KiB },
112
- { "usb2-host", 0x01c1c000, 4 * KiB },
113
+ { "usb2-phy", 0x01c1c800, 2 * KiB },
114
{ "cs1", 0x01c1d000, 4 * KiB },
115
{ "spi3", 0x01c1f000, 4 * KiB },
116
{ "rtc", 0x01c20400, 1 * KiB },
117
@@ -XXX,XX +XXX,XX @@ enum {
118
AW_R40_GIC_SPI_MMC2 = 34,
119
AW_R40_GIC_SPI_MMC3 = 35,
120
AW_R40_GIC_SPI_EMAC = 55,
121
+ AW_R40_GIC_SPI_OHCI1 = 64,
122
+ AW_R40_GIC_SPI_OHCI2 = 65,
123
+ AW_R40_GIC_SPI_EHCI1 = 76,
124
+ AW_R40_GIC_SPI_EHCI2 = 78,
125
AW_R40_GIC_SPI_GMAC = 85,
126
};
127
128
@@ -XXX,XX +XXX,XX @@ static void allwinner_r40_init(Object *obj)
129
TYPE_AW_SDHOST_SUN50I_A64);
130
}
131
132
+ for (size_t i = 0; i < AW_R40_NUM_USB; i++) {
133
+ object_initialize_child(obj, "ehci[*]", &s->ehci[i],
134
+ TYPE_PLATFORM_EHCI);
135
+ object_initialize_child(obj, "ohci[*]", &s->ohci[i],
136
+ TYPE_SYSBUS_OHCI);
137
+ }
48
+ }
138
+
49
+
139
object_initialize_child(obj, "twi0", &s->i2c0, TYPE_AW_I2C_SUN6I);
50
+ if (status->default_nan_mode) {
140
51
+ return floatx80_default_nan(status);
141
object_initialize_child(obj, "emac", &s->emac, TYPE_AW_EMAC);
142
@@ -XXX,XX +XXX,XX @@ static void allwinner_r40_realize(DeviceState *dev, Error **errp)
143
sysbus_realize(SYS_BUS_DEVICE(&s->ccu), &error_fatal);
144
sysbus_mmio_map(SYS_BUS_DEVICE(&s->ccu), 0, s->memmap[AW_R40_DEV_CCU]);
145
146
+ /* USB */
147
+ for (size_t i = 0; i < AW_R40_NUM_USB; i++) {
148
+ g_autofree char *bus = g_strdup_printf("usb-bus.%zu", i);
149
+
150
+ object_property_set_bool(OBJECT(&s->ehci[i]), "companion-enable", true,
151
+ &error_fatal);
152
+ sysbus_realize(SYS_BUS_DEVICE(&s->ehci[i]), &error_fatal);
153
+ sysbus_mmio_map(SYS_BUS_DEVICE(&s->ehci[i]), 0,
154
+ allwinner_r40_memmap[i ? AW_R40_DEV_EHCI2
155
+ : AW_R40_DEV_EHCI1]);
156
+ sysbus_connect_irq(SYS_BUS_DEVICE(&s->ehci[i]), 0,
157
+ qdev_get_gpio_in(DEVICE(&s->gic),
158
+ i ? AW_R40_GIC_SPI_EHCI2
159
+ : AW_R40_GIC_SPI_EHCI1));
160
+
161
+ object_property_set_str(OBJECT(&s->ohci[i]), "masterbus", bus,
162
+ &error_fatal);
163
+ sysbus_realize(SYS_BUS_DEVICE(&s->ohci[i]), &error_fatal);
164
+ sysbus_mmio_map(SYS_BUS_DEVICE(&s->ohci[i]), 0,
165
+ allwinner_r40_memmap[i ? AW_R40_DEV_OHCI2
166
+ : AW_R40_DEV_OHCI1]);
167
+ sysbus_connect_irq(SYS_BUS_DEVICE(&s->ohci[i]), 0,
168
+ qdev_get_gpio_in(DEVICE(&s->gic),
169
+ i ? AW_R40_GIC_SPI_OHCI2
170
+ : AW_R40_GIC_SPI_OHCI1));
171
+ }
52
+ }
172
+
53
+
173
/* SD/MMC */
54
+ if (a.low < b.low) {
174
for (int i = 0; i < AW_R40_NUM_MMCS; i++) {
55
+ aIsLargerSignificand = 0;
175
qemu_irq irq = qdev_get_gpio_in(DEVICE(&s->gic),
56
+ } else if (b.low < a.low) {
176
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
57
+ aIsLargerSignificand = 1;
58
+ } else {
59
+ aIsLargerSignificand = (a.high < b.high) ? 1 : 0;
60
+ }
61
+
62
+ if (pickNaN(a_cls, b_cls, aIsLargerSignificand, status)) {
63
+ if (is_snan(b_cls)) {
64
+ return floatx80_silence_nan(b, status);
65
+ }
66
+ return b;
67
+ } else {
68
+ if (is_snan(a_cls)) {
69
+ return floatx80_silence_nan(a, status);
70
+ }
71
+ return a;
72
+ }
73
+}
74
+
75
/*----------------------------------------------------------------------------
76
| Takes an abstract floating-point value having sign `zSign', exponent `zExp',
77
| and extended significand formed by the concatenation of `zSig0' and `zSig1',
78
diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc
177
index XXXXXXX..XXXXXXX 100644
79
index XXXXXXX..XXXXXXX 100644
178
--- a/hw/arm/Kconfig
80
--- a/fpu/softfloat-specialize.c.inc
179
+++ b/hw/arm/Kconfig
81
+++ b/fpu/softfloat-specialize.c.inc
180
@@ -XXX,XX +XXX,XX @@ config ALLWINNER_R40
82
@@ -XXX,XX +XXX,XX @@ floatx80 floatx80_silence_nan(floatx80 a, float_status *status)
181
select ARM_TIMER
83
return a;
182
select ARM_GIC
84
}
183
select UNIMP
85
184
+ select USB_OHCI
86
-/*----------------------------------------------------------------------------
185
+ select USB_EHCI_SYSBUS
87
-| Takes two extended double-precision floating-point values `a' and `b', one
186
select SD
88
-| of which is a NaN, and returns the appropriate NaN result. If either `a' or
187
89
-| `b' is a signaling NaN, the invalid exception is raised.
188
config RASPI
90
-*----------------------------------------------------------------------------*/
91
-
92
-floatx80 propagateFloatx80NaN(floatx80 a, floatx80 b, float_status *status)
93
-{
94
- bool aIsLargerSignificand;
95
- FloatClass a_cls, b_cls;
96
-
97
- /* This is not complete, but is good enough for pickNaN. */
98
- a_cls = (!floatx80_is_any_nan(a)
99
- ? float_class_normal
100
- : floatx80_is_signaling_nan(a, status)
101
- ? float_class_snan
102
- : float_class_qnan);
103
- b_cls = (!floatx80_is_any_nan(b)
104
- ? float_class_normal
105
- : floatx80_is_signaling_nan(b, status)
106
- ? float_class_snan
107
- : float_class_qnan);
108
-
109
- if (is_snan(a_cls) || is_snan(b_cls)) {
110
- float_raise(float_flag_invalid, status);
111
- }
112
-
113
- if (status->default_nan_mode) {
114
- return floatx80_default_nan(status);
115
- }
116
-
117
- if (a.low < b.low) {
118
- aIsLargerSignificand = 0;
119
- } else if (b.low < a.low) {
120
- aIsLargerSignificand = 1;
121
- } else {
122
- aIsLargerSignificand = (a.high < b.high) ? 1 : 0;
123
- }
124
-
125
- if (pickNaN(a_cls, b_cls, aIsLargerSignificand, status)) {
126
- if (is_snan(b_cls)) {
127
- return floatx80_silence_nan(b, status);
128
- }
129
- return b;
130
- } else {
131
- if (is_snan(a_cls)) {
132
- return floatx80_silence_nan(a, status);
133
- }
134
- return a;
135
- }
136
-}
137
-
138
/*----------------------------------------------------------------------------
139
| Returns 1 if the quadruple-precision floating-point value `a' is a quiet
140
| NaN; otherwise returns 0.
189
--
141
--
190
2.34.1
142
2.34.1
191
192
diff view generated by jsdifflib
1
In arm_deliver_fault() we check for whether the fault is caused
1
From: Richard Henderson <richard.henderson@linaro.org>
2
by a data abort due to an access to a FEAT_NV2 sysreg in the
3
memory pointed to by the VNCR. Unfortunately part of the
4
condition checks the wrong argument to the function, meaning
5
that it would spuriously trigger, resulting in some instruction
6
aborts being taken to the wrong EL and reported incorrectly.
7
2
8
Use the right variable in the condition.
3
Unpacking and repacking the parts may be slightly more work
4
than we did before, but we get to reuse more code. For a
5
code path handling exceptional values, this is an improvement.
9
6
10
Fixes: 674e5345275d425 ("target/arm: Report VNCR_EL2 based faults correctly")
7
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
11
Reported-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
8
Message-id: 20241203203949.483774-8-richard.henderson@linaro.org
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Tested-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
10
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
14
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
15
Message-id: 20240116165605.2523055-1-peter.maydell@linaro.org
16
---
11
---
17
target/arm/tcg/tlb_helper.c | 2 +-
12
fpu/softfloat.c | 43 +++++--------------------------------------
18
1 file changed, 1 insertion(+), 1 deletion(-)
13
1 file changed, 5 insertions(+), 38 deletions(-)
19
14
20
diff --git a/target/arm/tcg/tlb_helper.c b/target/arm/tcg/tlb_helper.c
15
diff --git a/fpu/softfloat.c b/fpu/softfloat.c
21
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
22
--- a/target/arm/tcg/tlb_helper.c
17
--- a/fpu/softfloat.c
23
+++ b/target/arm/tcg/tlb_helper.c
18
+++ b/fpu/softfloat.c
24
@@ -XXX,XX +XXX,XX @@ void arm_deliver_fault(ARMCPU *cpu, vaddr addr,
19
@@ -XXX,XX +XXX,XX @@ void normalizeFloatx80Subnormal(uint64_t aSig, int32_t *zExpPtr,
25
* (and indeed syndrome does not have the EC field in it,
20
26
* because we masked that out in disas_set_insn_syndrome())
21
floatx80 propagateFloatx80NaN(floatx80 a, floatx80 b, float_status *status)
27
*/
22
{
28
- bool is_vncr = (mmu_idx != MMU_INST_FETCH) &&
23
- bool aIsLargerSignificand;
29
+ bool is_vncr = (access_type != MMU_INST_FETCH) &&
24
- FloatClass a_cls, b_cls;
30
(env->exception.syndrome & ARM_EL_VNCR);
25
+ FloatParts128 pa, pb, *pr;
31
26
32
if (is_vncr) {
27
- /* This is not complete, but is good enough for pickNaN. */
28
- a_cls = (!floatx80_is_any_nan(a)
29
- ? float_class_normal
30
- : floatx80_is_signaling_nan(a, status)
31
- ? float_class_snan
32
- : float_class_qnan);
33
- b_cls = (!floatx80_is_any_nan(b)
34
- ? float_class_normal
35
- : floatx80_is_signaling_nan(b, status)
36
- ? float_class_snan
37
- : float_class_qnan);
38
-
39
- if (is_snan(a_cls) || is_snan(b_cls)) {
40
- float_raise(float_flag_invalid, status);
41
- }
42
-
43
- if (status->default_nan_mode) {
44
+ if (!floatx80_unpack_canonical(&pa, a, status) ||
45
+ !floatx80_unpack_canonical(&pb, b, status)) {
46
return floatx80_default_nan(status);
47
}
48
49
- if (a.low < b.low) {
50
- aIsLargerSignificand = 0;
51
- } else if (b.low < a.low) {
52
- aIsLargerSignificand = 1;
53
- } else {
54
- aIsLargerSignificand = (a.high < b.high) ? 1 : 0;
55
- }
56
-
57
- if (pickNaN(a_cls, b_cls, aIsLargerSignificand, status)) {
58
- if (is_snan(b_cls)) {
59
- return floatx80_silence_nan(b, status);
60
- }
61
- return b;
62
- } else {
63
- if (is_snan(a_cls)) {
64
- return floatx80_silence_nan(a, status);
65
- }
66
- return a;
67
- }
68
+ pr = parts_pick_nan(&pa, &pb, status);
69
+ return floatx80_round_pack_canonical(pr, status);
70
}
71
72
/*----------------------------------------------------------------------------
33
--
73
--
34
2.34.1
74
2.34.1
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
Rename to arm_build_mp_affinity. This frees up the name for
3
Inline pickNaN into its only caller. This makes one assert
4
other usage, and emphasizes that the cpu object is not involved.
4
redundant with the immediately preceding IF.
5
5
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
7
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20241203203949.483774-9-richard.henderson@linaro.org
9
Message-id: 20240118200643.29037-9-philmd@linaro.org
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
---
10
---
12
target/arm/cpu.h | 2 +-
11
fpu/softfloat-parts.c.inc | 82 +++++++++++++++++++++++++----
13
hw/arm/npcm7xx.c | 2 +-
12
fpu/softfloat-specialize.c.inc | 96 ----------------------------------
14
hw/arm/sbsa-ref.c | 2 +-
13
2 files changed, 73 insertions(+), 105 deletions(-)
15
hw/arm/virt.c | 2 +-
14
16
target/arm/cpu.c | 6 +++---
15
diff --git a/fpu/softfloat-parts.c.inc b/fpu/softfloat-parts.c.inc
17
5 files changed, 7 insertions(+), 7 deletions(-)
18
19
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
20
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
21
--- a/target/arm/cpu.h
17
--- a/fpu/softfloat-parts.c.inc
22
+++ b/target/arm/cpu.h
18
+++ b/fpu/softfloat-parts.c.inc
23
@@ -XXX,XX +XXX,XX @@ void arm_cpu_post_init(Object *obj);
19
@@ -XXX,XX +XXX,XX @@ static void partsN(return_nan)(FloatPartsN *a, float_status *s)
24
(ARM_AFF0_MASK | ARM_AFF1_MASK | ARM_AFF2_MASK | ARM_AFF3_MASK)
20
static FloatPartsN *partsN(pick_nan)(FloatPartsN *a, FloatPartsN *b,
25
#define ARM64_AFFINITY_INVALID (~ARM64_AFFINITY_MASK)
21
float_status *s)
26
22
{
27
-uint64_t arm_cpu_mp_affinity(int idx, uint8_t clustersz);
23
+ int cmp, which;
28
+uint64_t arm_build_mp_affinity(int idx, uint8_t clustersz);
24
+
29
25
if (is_snan(a->cls) || is_snan(b->cls)) {
30
#ifndef CONFIG_USER_ONLY
26
float_raise(float_flag_invalid | float_flag_invalid_snan, s);
31
extern const VMStateDescription vmstate_arm_cpu;
27
}
32
diff --git a/hw/arm/npcm7xx.c b/hw/arm/npcm7xx.c
28
29
if (s->default_nan_mode) {
30
parts_default_nan(a, s);
31
- } else {
32
- int cmp = frac_cmp(a, b);
33
- if (cmp == 0) {
34
- cmp = a->sign < b->sign;
35
- }
36
+ return a;
37
+ }
38
39
- if (pickNaN(a->cls, b->cls, cmp > 0, s)) {
40
- a = b;
41
- }
42
+ cmp = frac_cmp(a, b);
43
+ if (cmp == 0) {
44
+ cmp = a->sign < b->sign;
45
+ }
46
+
47
+ switch (s->float_2nan_prop_rule) {
48
+ case float_2nan_prop_s_ab:
49
if (is_snan(a->cls)) {
50
- parts_silence_nan(a, s);
51
+ which = 0;
52
+ } else if (is_snan(b->cls)) {
53
+ which = 1;
54
+ } else if (is_qnan(a->cls)) {
55
+ which = 0;
56
+ } else {
57
+ which = 1;
58
}
59
+ break;
60
+ case float_2nan_prop_s_ba:
61
+ if (is_snan(b->cls)) {
62
+ which = 1;
63
+ } else if (is_snan(a->cls)) {
64
+ which = 0;
65
+ } else if (is_qnan(b->cls)) {
66
+ which = 1;
67
+ } else {
68
+ which = 0;
69
+ }
70
+ break;
71
+ case float_2nan_prop_ab:
72
+ which = is_nan(a->cls) ? 0 : 1;
73
+ break;
74
+ case float_2nan_prop_ba:
75
+ which = is_nan(b->cls) ? 1 : 0;
76
+ break;
77
+ case float_2nan_prop_x87:
78
+ /*
79
+ * This implements x87 NaN propagation rules:
80
+ * SNaN + QNaN => return the QNaN
81
+ * two SNaNs => return the one with the larger significand, silenced
82
+ * two QNaNs => return the one with the larger significand
83
+ * SNaN and a non-NaN => return the SNaN, silenced
84
+ * QNaN and a non-NaN => return the QNaN
85
+ *
86
+ * If we get down to comparing significands and they are the same,
87
+ * return the NaN with the positive sign bit (if any).
88
+ */
89
+ if (is_snan(a->cls)) {
90
+ if (is_snan(b->cls)) {
91
+ which = cmp > 0 ? 0 : 1;
92
+ } else {
93
+ which = is_qnan(b->cls) ? 1 : 0;
94
+ }
95
+ } else if (is_qnan(a->cls)) {
96
+ if (is_snan(b->cls) || !is_qnan(b->cls)) {
97
+ which = 0;
98
+ } else {
99
+ which = cmp > 0 ? 0 : 1;
100
+ }
101
+ } else {
102
+ which = 1;
103
+ }
104
+ break;
105
+ default:
106
+ g_assert_not_reached();
107
+ }
108
+
109
+ if (which) {
110
+ a = b;
111
+ }
112
+ if (is_snan(a->cls)) {
113
+ parts_silence_nan(a, s);
114
}
115
return a;
116
}
117
diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc
33
index XXXXXXX..XXXXXXX 100644
118
index XXXXXXX..XXXXXXX 100644
34
--- a/hw/arm/npcm7xx.c
119
--- a/fpu/softfloat-specialize.c.inc
35
+++ b/hw/arm/npcm7xx.c
120
+++ b/fpu/softfloat-specialize.c.inc
36
@@ -XXX,XX +XXX,XX @@ static void npcm7xx_realize(DeviceState *dev, Error **errp)
121
@@ -XXX,XX +XXX,XX @@ bool float32_is_signaling_nan(float32 a_, float_status *status)
37
/* CPUs */
38
for (i = 0; i < nc->num_cpus; i++) {
39
object_property_set_int(OBJECT(&s->cpu[i]), "mp-affinity",
40
- arm_cpu_mp_affinity(i, NPCM7XX_MAX_NUM_CPUS),
41
+ arm_build_mp_affinity(i, NPCM7XX_MAX_NUM_CPUS),
42
&error_abort);
43
object_property_set_int(OBJECT(&s->cpu[i]), "reset-cbar",
44
NPCM7XX_GIC_CPU_IF_ADDR, &error_abort);
45
diff --git a/hw/arm/sbsa-ref.c b/hw/arm/sbsa-ref.c
46
index XXXXXXX..XXXXXXX 100644
47
--- a/hw/arm/sbsa-ref.c
48
+++ b/hw/arm/sbsa-ref.c
49
@@ -XXX,XX +XXX,XX @@ static const int sbsa_ref_irqmap[] = {
50
static uint64_t sbsa_ref_cpu_mp_affinity(SBSAMachineState *sms, int idx)
51
{
52
uint8_t clustersz = ARM_DEFAULT_CPUS_PER_CLUSTER;
53
- return arm_cpu_mp_affinity(idx, clustersz);
54
+ return arm_build_mp_affinity(idx, clustersz);
55
}
56
57
static void sbsa_fdt_add_gic_node(SBSAMachineState *sms)
58
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
59
index XXXXXXX..XXXXXXX 100644
60
--- a/hw/arm/virt.c
61
+++ b/hw/arm/virt.c
62
@@ -XXX,XX +XXX,XX @@ static uint64_t virt_cpu_mp_affinity(VirtMachineState *vms, int idx)
63
clustersz = GICV3_TARGETLIST_BITS;
64
}
65
}
66
- return arm_cpu_mp_affinity(idx, clustersz);
67
+ return arm_build_mp_affinity(idx, clustersz);
68
}
69
70
static inline bool *virt_get_high_memmap_enabled(VirtMachineState *vms,
71
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
72
index XXXXXXX..XXXXXXX 100644
73
--- a/target/arm/cpu.c
74
+++ b/target/arm/cpu.c
75
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_dump_state(CPUState *cs, FILE *f, int flags)
76
}
122
}
77
}
123
}
78
124
79
-uint64_t arm_cpu_mp_affinity(int idx, uint8_t clustersz)
125
-/*----------------------------------------------------------------------------
80
+uint64_t arm_build_mp_affinity(int idx, uint8_t clustersz)
126
-| Select which NaN to propagate for a two-input operation.
81
{
127
-| IEEE754 doesn't specify all the details of this, so the
82
uint32_t Aff1 = idx / clustersz;
128
-| algorithm is target-specific.
83
uint32_t Aff0 = idx % clustersz;
129
-| The routine is passed various bits of information about the
84
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)
130
-| two NaNs and should return 0 to select NaN a and 1 for NaN b.
85
* so these bits always RAZ.
131
-| Note that signalling NaNs are always squashed to quiet NaNs
86
*/
132
-| by the caller, by calling floatXX_silence_nan() before
87
if (cpu->mp_affinity == ARM64_AFFINITY_INVALID) {
133
-| returning them.
88
- cpu->mp_affinity = arm_cpu_mp_affinity(cs->cpu_index,
134
-|
89
- ARM_DEFAULT_CPUS_PER_CLUSTER);
135
-| aIsLargerSignificand is only valid if both a and b are NaNs
90
+ cpu->mp_affinity = arm_build_mp_affinity(cs->cpu_index,
136
-| of some kind, and is true if a has the larger significand,
91
+ ARM_DEFAULT_CPUS_PER_CLUSTER);
137
-| or if both a and b have the same significand but a is
92
}
138
-| positive but b is negative. It is only needed for the x87
93
139
-| tie-break rule.
94
if (cpu->reset_hivecs) {
140
-*----------------------------------------------------------------------------*/
141
-
142
-static int pickNaN(FloatClass a_cls, FloatClass b_cls,
143
- bool aIsLargerSignificand, float_status *status)
144
-{
145
- /*
146
- * We guarantee not to require the target to tell us how to
147
- * pick a NaN if we're always returning the default NaN.
148
- * But if we're not in default-NaN mode then the target must
149
- * specify via set_float_2nan_prop_rule().
150
- */
151
- assert(!status->default_nan_mode);
152
-
153
- switch (status->float_2nan_prop_rule) {
154
- case float_2nan_prop_s_ab:
155
- if (is_snan(a_cls)) {
156
- return 0;
157
- } else if (is_snan(b_cls)) {
158
- return 1;
159
- } else if (is_qnan(a_cls)) {
160
- return 0;
161
- } else {
162
- return 1;
163
- }
164
- break;
165
- case float_2nan_prop_s_ba:
166
- if (is_snan(b_cls)) {
167
- return 1;
168
- } else if (is_snan(a_cls)) {
169
- return 0;
170
- } else if (is_qnan(b_cls)) {
171
- return 1;
172
- } else {
173
- return 0;
174
- }
175
- break;
176
- case float_2nan_prop_ab:
177
- if (is_nan(a_cls)) {
178
- return 0;
179
- } else {
180
- return 1;
181
- }
182
- break;
183
- case float_2nan_prop_ba:
184
- if (is_nan(b_cls)) {
185
- return 1;
186
- } else {
187
- return 0;
188
- }
189
- break;
190
- case float_2nan_prop_x87:
191
- /*
192
- * This implements x87 NaN propagation rules:
193
- * SNaN + QNaN => return the QNaN
194
- * two SNaNs => return the one with the larger significand, silenced
195
- * two QNaNs => return the one with the larger significand
196
- * SNaN and a non-NaN => return the SNaN, silenced
197
- * QNaN and a non-NaN => return the QNaN
198
- *
199
- * If we get down to comparing significands and they are the same,
200
- * return the NaN with the positive sign bit (if any).
201
- */
202
- if (is_snan(a_cls)) {
203
- if (is_snan(b_cls)) {
204
- return aIsLargerSignificand ? 0 : 1;
205
- }
206
- return is_qnan(b_cls) ? 1 : 0;
207
- } else if (is_qnan(a_cls)) {
208
- if (is_snan(b_cls) || !is_qnan(b_cls)) {
209
- return 0;
210
- } else {
211
- return aIsLargerSignificand ? 0 : 1;
212
- }
213
- } else {
214
- return 1;
215
- }
216
- default:
217
- g_assert_not_reached();
218
- }
219
-}
220
-
221
/*----------------------------------------------------------------------------
222
| Returns 1 if the double-precision floating-point value `a' is a quiet
223
| NaN; otherwise returns 0.
95
--
224
--
96
2.34.1
225
2.34.1
97
226
98
227
diff view generated by jsdifflib
1
From: Guenter Roeck <linux@roeck-us.net>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
Add watchdog timer support to Allwinner-H40 and Bananapi.
3
Remember if there was an SNaN, and use that to simplify
4
The watchdog timer is added as an overlay to the Timer
4
float_2nan_prop_s_{ab,ba} to only the snan component.
5
module memory map.
5
Then, fall through to the corresponding
6
float_2nan_prop_{ab,ba} case to handle any remaining
7
nans, which must be quiet.
6
8
7
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
9
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
8
Reviewed-by: Strahinja Jankovic <strahinja.p.jankovic@gmail.com>
10
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
9
Message-id: 20240115182757.1095012-4-linux@roeck-us.net
11
Message-id: 20241203203949.483774-10-richard.henderson@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
docs/system/arm/bananapi_m2u.rst | 2 +-
14
fpu/softfloat-parts.c.inc | 32 ++++++++++++--------------------
13
include/hw/arm/allwinner-r40.h | 3 +++
15
1 file changed, 12 insertions(+), 20 deletions(-)
14
hw/arm/allwinner-r40.c | 8 ++++++++
15
hw/arm/Kconfig | 1 +
16
4 files changed, 13 insertions(+), 1 deletion(-)
17
16
18
diff --git a/docs/system/arm/bananapi_m2u.rst b/docs/system/arm/bananapi_m2u.rst
17
diff --git a/fpu/softfloat-parts.c.inc b/fpu/softfloat-parts.c.inc
19
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
20
--- a/docs/system/arm/bananapi_m2u.rst
19
--- a/fpu/softfloat-parts.c.inc
21
+++ b/docs/system/arm/bananapi_m2u.rst
20
+++ b/fpu/softfloat-parts.c.inc
22
@@ -XXX,XX +XXX,XX @@ The Banana Pi M2U machine supports the following devices:
21
@@ -XXX,XX +XXX,XX @@ static void partsN(return_nan)(FloatPartsN *a, float_status *s)
23
* SATA
22
static FloatPartsN *partsN(pick_nan)(FloatPartsN *a, FloatPartsN *b,
24
* TWI (I2C)
23
float_status *s)
25
* USB 2.0
24
{
26
+ * Hardware Watchdog
25
+ bool have_snan = false;
27
26
int cmp, which;
28
Limitations
27
29
"""""""""""
28
if (is_snan(a->cls) || is_snan(b->cls)) {
30
@@ -XXX,XX +XXX,XX @@ Currently, Banana Pi M2U does *not* support the following features:
29
float_raise(float_flag_invalid | float_flag_invalid_snan, s);
31
30
+ have_snan = true;
32
- Graphical output via HDMI, GPU and/or the Display Engine
31
}
33
- Audio output
32
34
-- Hardware Watchdog
33
if (s->default_nan_mode) {
35
- Real Time Clock
34
@@ -XXX,XX +XXX,XX @@ static FloatPartsN *partsN(pick_nan)(FloatPartsN *a, FloatPartsN *b,
36
35
37
Also see the 'unimplemented' array in the Allwinner R40 SoC module
36
switch (s->float_2nan_prop_rule) {
38
diff --git a/include/hw/arm/allwinner-r40.h b/include/hw/arm/allwinner-r40.h
37
case float_2nan_prop_s_ab:
39
index XXXXXXX..XXXXXXX 100644
38
- if (is_snan(a->cls)) {
40
--- a/include/hw/arm/allwinner-r40.h
39
- which = 0;
41
+++ b/include/hw/arm/allwinner-r40.h
40
- } else if (is_snan(b->cls)) {
42
@@ -XXX,XX +XXX,XX @@
41
- which = 1;
43
#include "hw/net/allwinner-sun8i-emac.h"
42
- } else if (is_qnan(a->cls)) {
44
#include "hw/usb/hcd-ohci.h"
43
- which = 0;
45
#include "hw/usb/hcd-ehci.h"
44
- } else {
46
+#include "hw/watchdog/allwinner-wdt.h"
45
- which = 1;
47
#include "target/arm/cpu.h"
46
+ if (have_snan) {
48
#include "sysemu/block-backend.h"
47
+ which = is_snan(a->cls) ? 0 : 1;
49
48
+ break;
50
@@ -XXX,XX +XXX,XX @@ enum {
49
}
51
AW_R40_DEV_OHCI2,
50
- break;
52
AW_R40_DEV_CCU,
51
- case float_2nan_prop_s_ba:
53
AW_R40_DEV_PIT,
52
- if (is_snan(b->cls)) {
54
+ AW_R40_DEV_WDT,
53
- which = 1;
55
AW_R40_DEV_UART0,
54
- } else if (is_snan(a->cls)) {
56
AW_R40_DEV_UART1,
55
- which = 0;
57
AW_R40_DEV_UART2,
56
- } else if (is_qnan(b->cls)) {
58
@@ -XXX,XX +XXX,XX @@ struct AwR40State {
57
- which = 1;
59
const hwaddr *memmap;
58
- } else {
60
AwSRAMCState sramc;
59
- which = 0;
61
AwA10PITState timer;
60
- }
62
+ AwWdtState wdt;
61
- break;
63
AllwinnerAHCIState sata;
62
+ /* fall through */
64
AwSdHostState mmc[AW_R40_NUM_MMCS];
63
case float_2nan_prop_ab:
65
EHCISysBusState ehci[AW_R40_NUM_USB];
64
which = is_nan(a->cls) ? 0 : 1;
66
diff --git a/hw/arm/allwinner-r40.c b/hw/arm/allwinner-r40.c
65
break;
67
index XXXXXXX..XXXXXXX 100644
66
+ case float_2nan_prop_s_ba:
68
--- a/hw/arm/allwinner-r40.c
67
+ if (have_snan) {
69
+++ b/hw/arm/allwinner-r40.c
68
+ which = is_snan(b->cls) ? 1 : 0;
70
@@ -XXX,XX +XXX,XX @@ const hwaddr allwinner_r40_memmap[] = {
69
+ break;
71
[AW_R40_DEV_OHCI2] = 0x01c1c400,
70
+ }
72
[AW_R40_DEV_CCU] = 0x01c20000,
71
+ /* fall through */
73
[AW_R40_DEV_PIT] = 0x01c20c00,
72
case float_2nan_prop_ba:
74
+ [AW_R40_DEV_WDT] = 0x01c20c90,
73
which = is_nan(b->cls) ? 1 : 0;
75
[AW_R40_DEV_UART0] = 0x01c28000,
74
break;
76
[AW_R40_DEV_UART1] = 0x01c28400,
77
[AW_R40_DEV_UART2] = 0x01c28800,
78
@@ -XXX,XX +XXX,XX @@ static void allwinner_r40_init(Object *obj)
79
object_property_add_alias(obj, "clk1-freq", OBJECT(&s->timer),
80
"clk1-freq");
81
82
+ object_initialize_child(obj, "wdt", &s->wdt, TYPE_AW_WDT_SUN4I);
83
+
84
object_initialize_child(obj, "ccu", &s->ccu, TYPE_AW_R40_CCU);
85
86
for (int i = 0; i < AW_R40_NUM_MMCS; i++) {
87
@@ -XXX,XX +XXX,XX @@ static void allwinner_r40_realize(DeviceState *dev, Error **errp)
88
sysbus_connect_irq(SYS_BUS_DEVICE(&s->emac), 0,
89
qdev_get_gpio_in(DEVICE(&s->gic), AW_R40_GIC_SPI_EMAC));
90
91
+ /* WDT */
92
+ sysbus_realize(SYS_BUS_DEVICE(&s->wdt), &error_fatal);
93
+ sysbus_mmio_map_overlap(SYS_BUS_DEVICE(&s->wdt), 0,
94
+ allwinner_r40_memmap[AW_R40_DEV_WDT], 1);
95
+
96
/* Unimplemented devices */
97
for (unsigned i = 0; i < ARRAY_SIZE(r40_unimplemented); i++) {
98
create_unimplemented_device(r40_unimplemented[i].device_name,
99
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
100
index XXXXXXX..XXXXXXX 100644
101
--- a/hw/arm/Kconfig
102
+++ b/hw/arm/Kconfig
103
@@ -XXX,XX +XXX,XX @@ config ALLWINNER_R40
104
select AHCI
105
select ALLWINNER_SRAMC
106
select ALLWINNER_A10_PIT
107
+ select ALLWINNER_WDT
108
select AXP2XX_PMU
109
select SERIAL
110
select ARM_TIMER
111
--
75
--
112
2.34.1
76
2.34.1
diff view generated by jsdifflib
1
From: Guenter Roeck <linux@roeck-us.net>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
Allwinner R40 supports an AHCI compliant SATA controller.
3
Move the fractional comparison to the end of the
4
Add support for it.
4
float_2nan_prop_x87 case. This is not required for
5
any other 2nan propagation rule. Reorganize the
6
x87 case itself to break out of the switch when the
7
fractional comparison is not required.
5
8
6
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
9
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
7
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
10
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
8
Message-id: 20240115182757.1095012-3-linux@roeck-us.net
11
Message-id: 20241203203949.483774-11-richard.henderson@linaro.org
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
13
---
11
docs/system/arm/bananapi_m2u.rst | 1 +
14
fpu/softfloat-parts.c.inc | 19 +++++++++----------
12
include/hw/arm/allwinner-r40.h | 3 +++
15
1 file changed, 9 insertions(+), 10 deletions(-)
13
hw/arm/allwinner-r40.c | 12 +++++++++++-
14
hw/arm/Kconfig | 1 +
15
4 files changed, 16 insertions(+), 1 deletion(-)
16
16
17
diff --git a/docs/system/arm/bananapi_m2u.rst b/docs/system/arm/bananapi_m2u.rst
17
diff --git a/fpu/softfloat-parts.c.inc b/fpu/softfloat-parts.c.inc
18
index XXXXXXX..XXXXXXX 100644
18
index XXXXXXX..XXXXXXX 100644
19
--- a/docs/system/arm/bananapi_m2u.rst
19
--- a/fpu/softfloat-parts.c.inc
20
+++ b/docs/system/arm/bananapi_m2u.rst
20
+++ b/fpu/softfloat-parts.c.inc
21
@@ -XXX,XX +XXX,XX @@ The Banana Pi M2U machine supports the following devices:
21
@@ -XXX,XX +XXX,XX @@ static FloatPartsN *partsN(pick_nan)(FloatPartsN *a, FloatPartsN *b,
22
* EMAC ethernet
22
return a;
23
* GMAC ethernet
24
* Clock Control Unit
25
+ * SATA
26
* TWI (I2C)
27
* USB 2.0
28
29
diff --git a/include/hw/arm/allwinner-r40.h b/include/hw/arm/allwinner-r40.h
30
index XXXXXXX..XXXXXXX 100644
31
--- a/include/hw/arm/allwinner-r40.h
32
+++ b/include/hw/arm/allwinner-r40.h
33
@@ -XXX,XX +XXX,XX @@
34
35
#include "qom/object.h"
36
#include "hw/timer/allwinner-a10-pit.h"
37
+#include "hw/ide/ahci.h"
38
#include "hw/intc/arm_gic.h"
39
#include "hw/sd/allwinner-sdhost.h"
40
#include "hw/misc/allwinner-r40-ccu.h"
41
@@ -XXX,XX +XXX,XX @@ enum {
42
AW_R40_DEV_MMC1,
43
AW_R40_DEV_MMC2,
44
AW_R40_DEV_MMC3,
45
+ AW_R40_DEV_AHCI,
46
AW_R40_DEV_EHCI1,
47
AW_R40_DEV_OHCI1,
48
AW_R40_DEV_EHCI2,
49
@@ -XXX,XX +XXX,XX @@ struct AwR40State {
50
const hwaddr *memmap;
51
AwSRAMCState sramc;
52
AwA10PITState timer;
53
+ AllwinnerAHCIState sata;
54
AwSdHostState mmc[AW_R40_NUM_MMCS];
55
EHCISysBusState ehci[AW_R40_NUM_USB];
56
OHCISysBusState ohci[AW_R40_NUM_USB];
57
diff --git a/hw/arm/allwinner-r40.c b/hw/arm/allwinner-r40.c
58
index XXXXXXX..XXXXXXX 100644
59
--- a/hw/arm/allwinner-r40.c
60
+++ b/hw/arm/allwinner-r40.c
61
@@ -XXX,XX +XXX,XX @@ const hwaddr allwinner_r40_memmap[] = {
62
[AW_R40_DEV_MMC1] = 0x01c10000,
63
[AW_R40_DEV_MMC2] = 0x01c11000,
64
[AW_R40_DEV_MMC3] = 0x01c12000,
65
+ [AW_R40_DEV_AHCI] = 0x01c18000,
66
[AW_R40_DEV_EHCI1] = 0x01c19000,
67
[AW_R40_DEV_OHCI1] = 0x01c19400,
68
[AW_R40_DEV_EHCI2] = 0x01c1c000,
69
@@ -XXX,XX +XXX,XX @@ static struct AwR40Unimplemented r40_unimplemented[] = {
70
{ "usb0-host", 0x01c14000, 4 * KiB },
71
{ "crypto", 0x01c15000, 4 * KiB },
72
{ "spi2", 0x01c17000, 4 * KiB },
73
- { "sata", 0x01c18000, 4 * KiB },
74
{ "usb1-phy", 0x01c19800, 2 * KiB },
75
{ "sid", 0x01c1b000, 4 * KiB },
76
{ "usb2-phy", 0x01c1c800, 2 * KiB },
77
@@ -XXX,XX +XXX,XX @@ enum {
78
AW_R40_GIC_SPI_MMC2 = 34,
79
AW_R40_GIC_SPI_MMC3 = 35,
80
AW_R40_GIC_SPI_EMAC = 55,
81
+ AW_R40_GIC_SPI_AHCI = 56,
82
AW_R40_GIC_SPI_OHCI1 = 64,
83
AW_R40_GIC_SPI_OHCI2 = 65,
84
AW_R40_GIC_SPI_EHCI1 = 76,
85
@@ -XXX,XX +XXX,XX @@ static void allwinner_r40_init(Object *obj)
86
TYPE_AW_SDHOST_SUN50I_A64);
87
}
23
}
88
24
89
+ object_initialize_child(obj, "sata", &s->sata, TYPE_ALLWINNER_AHCI);
25
- cmp = frac_cmp(a, b);
90
+
26
- if (cmp == 0) {
91
for (size_t i = 0; i < AW_R40_NUM_USB; i++) {
27
- cmp = a->sign < b->sign;
92
object_initialize_child(obj, "ehci[*]", &s->ehci[i],
28
- }
93
TYPE_PLATFORM_EHCI);
29
-
94
@@ -XXX,XX +XXX,XX @@ static void allwinner_r40_realize(DeviceState *dev, Error **errp)
30
switch (s->float_2nan_prop_rule) {
95
sysbus_realize(SYS_BUS_DEVICE(&s->ccu), &error_fatal);
31
case float_2nan_prop_s_ab:
96
sysbus_mmio_map(SYS_BUS_DEVICE(&s->ccu), 0, s->memmap[AW_R40_DEV_CCU]);
32
if (have_snan) {
97
33
@@ -XXX,XX +XXX,XX @@ static FloatPartsN *partsN(pick_nan)(FloatPartsN *a, FloatPartsN *b,
98
+ /* SATA / AHCI */
34
* return the NaN with the positive sign bit (if any).
99
+ sysbus_realize(SYS_BUS_DEVICE(&s->sata), &error_fatal);
35
*/
100
+ sysbus_mmio_map(SYS_BUS_DEVICE(&s->sata), 0,
36
if (is_snan(a->cls)) {
101
+ allwinner_r40_memmap[AW_R40_DEV_AHCI]);
37
- if (is_snan(b->cls)) {
102
+ sysbus_connect_irq(SYS_BUS_DEVICE(&s->sata), 0,
38
- which = cmp > 0 ? 0 : 1;
103
+ qdev_get_gpio_in(DEVICE(&s->gic), AW_R40_GIC_SPI_AHCI));
39
- } else {
104
+
40
+ if (!is_snan(b->cls)) {
105
/* USB */
41
which = is_qnan(b->cls) ? 1 : 0;
106
for (size_t i = 0; i < AW_R40_NUM_USB; i++) {
42
+ break;
107
g_autofree char *bus = g_strdup_printf("usb-bus.%zu", i);
43
}
108
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
44
} else if (is_qnan(a->cls)) {
109
index XXXXXXX..XXXXXXX 100644
45
if (is_snan(b->cls) || !is_qnan(b->cls)) {
110
--- a/hw/arm/Kconfig
46
which = 0;
111
+++ b/hw/arm/Kconfig
47
- } else {
112
@@ -XXX,XX +XXX,XX @@ config ALLWINNER_H3
48
- which = cmp > 0 ? 0 : 1;
113
config ALLWINNER_R40
49
+ break;
114
bool
50
}
115
default y if TCG && ARM
51
} else {
116
+ select AHCI
52
which = 1;
117
select ALLWINNER_SRAMC
53
+ break;
118
select ALLWINNER_A10_PIT
54
}
119
select AXP2XX_PMU
55
+ cmp = frac_cmp(a, b);
56
+ if (cmp == 0) {
57
+ cmp = a->sign < b->sign;
58
+ }
59
+ which = cmp > 0 ? 0 : 1;
60
break;
61
default:
62
g_assert_not_reached();
120
--
63
--
121
2.34.1
64
2.34.1
122
123
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
From: Richard Henderson <richard.henderson@linaro.org>
2
2
3
Wrapper to return the mp affinity bits from the cpu.
3
Replace the "index" selecting between A and B with a result variable
4
of the proper type. This improves clarity within the function.
4
5
5
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
6
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
7
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Message-id: 20241203203949.483774-12-richard.henderson@linaro.org
8
Message-id: 20240118200643.29037-10-philmd@linaro.org
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
10
---
11
target/arm/cpu.h | 5 +++++
11
fpu/softfloat-parts.c.inc | 28 +++++++++++++---------------
12
hw/arm/virt-acpi-build.c | 2 +-
12
1 file changed, 13 insertions(+), 15 deletions(-)
13
hw/arm/virt.c | 6 +++---
14
hw/arm/xlnx-versal-virt.c | 3 ++-
15
hw/misc/xlnx-versal-crl.c | 4 ++--
16
target/arm/arm-powerctl.c | 2 +-
17
target/arm/hvf/hvf.c | 4 ++--
18
target/arm/tcg/psci.c | 2 +-
19
8 files changed, 17 insertions(+), 11 deletions(-)
20
13
21
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
14
diff --git a/fpu/softfloat-parts.c.inc b/fpu/softfloat-parts.c.inc
22
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
23
--- a/target/arm/cpu.h
16
--- a/fpu/softfloat-parts.c.inc
24
+++ b/target/arm/cpu.h
17
+++ b/fpu/softfloat-parts.c.inc
25
@@ -XXX,XX +XXX,XX @@ void arm_cpu_post_init(Object *obj);
18
@@ -XXX,XX +XXX,XX @@ static FloatPartsN *partsN(pick_nan)(FloatPartsN *a, FloatPartsN *b,
26
19
float_status *s)
27
uint64_t arm_build_mp_affinity(int idx, uint8_t clustersz);
20
{
28
21
bool have_snan = false;
29
+static inline uint64_t arm_cpu_mp_affinity(ARMCPU *cpu)
22
- int cmp, which;
30
+{
23
+ FloatPartsN *ret;
31
+ return cpu->mp_affinity;
24
+ int cmp;
32
+}
25
33
+
26
if (is_snan(a->cls) || is_snan(b->cls)) {
34
#ifndef CONFIG_USER_ONLY
27
float_raise(float_flag_invalid | float_flag_invalid_snan, s);
35
extern const VMStateDescription vmstate_arm_cpu;
28
@@ -XXX,XX +XXX,XX @@ static FloatPartsN *partsN(pick_nan)(FloatPartsN *a, FloatPartsN *b,
36
29
switch (s->float_2nan_prop_rule) {
37
diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
30
case float_2nan_prop_s_ab:
38
index XXXXXXX..XXXXXXX 100644
31
if (have_snan) {
39
--- a/hw/arm/virt-acpi-build.c
32
- which = is_snan(a->cls) ? 0 : 1;
40
+++ b/hw/arm/virt-acpi-build.c
33
+ ret = is_snan(a->cls) ? a : b;
41
@@ -XXX,XX +XXX,XX @@ build_madt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
42
build_append_int_noprefix(table_data, vgic_interrupt, 4);
43
build_append_int_noprefix(table_data, 0, 8); /* GICR Base Address*/
44
/* MPIDR */
45
- build_append_int_noprefix(table_data, armcpu->mp_affinity, 8);
46
+ build_append_int_noprefix(table_data, arm_cpu_mp_affinity(armcpu), 8);
47
/* Processor Power Efficiency Class */
48
build_append_int_noprefix(table_data, 0, 1);
49
/* Reserved */
50
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
51
index XXXXXXX..XXXXXXX 100644
52
--- a/hw/arm/virt.c
53
+++ b/hw/arm/virt.c
54
@@ -XXX,XX +XXX,XX @@ static void fdt_add_cpu_nodes(const VirtMachineState *vms)
55
for (cpu = 0; cpu < smp_cpus; cpu++) {
56
ARMCPU *armcpu = ARM_CPU(qemu_get_cpu(cpu));
57
58
- if (armcpu->mp_affinity & ARM_AFF3_MASK) {
59
+ if (arm_cpu_mp_affinity(armcpu) & ARM_AFF3_MASK) {
60
addr_cells = 2;
61
break;
34
break;
62
}
35
}
63
@@ -XXX,XX +XXX,XX @@ static void fdt_add_cpu_nodes(const VirtMachineState *vms)
36
/* fall through */
64
37
case float_2nan_prop_ab:
65
if (addr_cells == 2) {
38
- which = is_nan(a->cls) ? 0 : 1;
66
qemu_fdt_setprop_u64(ms->fdt, nodename, "reg",
39
+ ret = is_nan(a->cls) ? a : b;
67
- armcpu->mp_affinity);
40
break;
68
+ arm_cpu_mp_affinity(armcpu));
41
case float_2nan_prop_s_ba:
42
if (have_snan) {
43
- which = is_snan(b->cls) ? 1 : 0;
44
+ ret = is_snan(b->cls) ? b : a;
45
break;
46
}
47
/* fall through */
48
case float_2nan_prop_ba:
49
- which = is_nan(b->cls) ? 1 : 0;
50
+ ret = is_nan(b->cls) ? b : a;
51
break;
52
case float_2nan_prop_x87:
53
/*
54
@@ -XXX,XX +XXX,XX @@ static FloatPartsN *partsN(pick_nan)(FloatPartsN *a, FloatPartsN *b,
55
*/
56
if (is_snan(a->cls)) {
57
if (!is_snan(b->cls)) {
58
- which = is_qnan(b->cls) ? 1 : 0;
59
+ ret = is_qnan(b->cls) ? b : a;
60
break;
61
}
62
} else if (is_qnan(a->cls)) {
63
if (is_snan(b->cls) || !is_qnan(b->cls)) {
64
- which = 0;
65
+ ret = a;
66
break;
67
}
69
} else {
68
} else {
70
qemu_fdt_setprop_cell(ms->fdt, nodename, "reg",
69
- which = 1;
71
- armcpu->mp_affinity);
70
+ ret = b;
72
+ arm_cpu_mp_affinity(armcpu));
71
break;
73
}
72
}
74
73
cmp = frac_cmp(a, b);
75
if (ms->possible_cpus->cpus[cs->cpu_index].props.has_node_id) {
74
if (cmp == 0) {
76
diff --git a/hw/arm/xlnx-versal-virt.c b/hw/arm/xlnx-versal-virt.c
75
cmp = a->sign < b->sign;
77
index XXXXXXX..XXXXXXX 100644
78
--- a/hw/arm/xlnx-versal-virt.c
79
+++ b/hw/arm/xlnx-versal-virt.c
80
@@ -XXX,XX +XXX,XX @@ static void fdt_add_cpu_nodes(VersalVirt *s, uint32_t psci_conduit)
81
ARMCPU *armcpu = ARM_CPU(qemu_get_cpu(i));
82
83
qemu_fdt_add_subnode(s->fdt, name);
84
- qemu_fdt_setprop_cell(s->fdt, name, "reg", armcpu->mp_affinity);
85
+ qemu_fdt_setprop_cell(s->fdt, name, "reg",
86
+ arm_cpu_mp_affinity(armcpu));
87
if (psci_conduit != QEMU_PSCI_CONDUIT_DISABLED) {
88
qemu_fdt_setprop_string(s->fdt, name, "enable-method", "psci");
89
}
76
}
90
diff --git a/hw/misc/xlnx-versal-crl.c b/hw/misc/xlnx-versal-crl.c
77
- which = cmp > 0 ? 0 : 1;
91
index XXXXXXX..XXXXXXX 100644
78
+ ret = cmp > 0 ? a : b;
92
--- a/hw/misc/xlnx-versal-crl.c
79
break;
93
+++ b/hw/misc/xlnx-versal-crl.c
80
default:
94
@@ -XXX,XX +XXX,XX @@ static void crl_reset_cpu(XlnxVersalCRL *s, ARMCPU *armcpu,
81
g_assert_not_reached();
95
bool rst_old, bool rst_new)
96
{
97
if (rst_new) {
98
- arm_set_cpu_off(armcpu->mp_affinity);
99
+ arm_set_cpu_off(arm_cpu_mp_affinity(armcpu));
100
} else {
101
- arm_set_cpu_on_and_reset(armcpu->mp_affinity);
102
+ arm_set_cpu_on_and_reset(arm_cpu_mp_affinity(armcpu));
103
}
82
}
83
84
- if (which) {
85
- a = b;
86
+ if (is_snan(ret->cls)) {
87
+ parts_silence_nan(ret, s);
88
}
89
- if (is_snan(a->cls)) {
90
- parts_silence_nan(a, s);
91
- }
92
- return a;
93
+ return ret;
104
}
94
}
105
95
106
diff --git a/target/arm/arm-powerctl.c b/target/arm/arm-powerctl.c
96
static FloatPartsN *partsN(pick_nan_muladd)(FloatPartsN *a, FloatPartsN *b,
107
index XXXXXXX..XXXXXXX 100644
108
--- a/target/arm/arm-powerctl.c
109
+++ b/target/arm/arm-powerctl.c
110
@@ -XXX,XX +XXX,XX @@ CPUState *arm_get_cpu_by_id(uint64_t id)
111
CPU_FOREACH(cpu) {
112
ARMCPU *armcpu = ARM_CPU(cpu);
113
114
- if (armcpu->mp_affinity == id) {
115
+ if (arm_cpu_mp_affinity(armcpu) == id) {
116
return cpu;
117
}
118
}
119
diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c
120
index XXXXXXX..XXXXXXX 100644
121
--- a/target/arm/hvf/hvf.c
122
+++ b/target/arm/hvf/hvf.c
123
@@ -XXX,XX +XXX,XX @@ static void hvf_raise_exception(CPUState *cpu, uint32_t excp,
124
125
static void hvf_psci_cpu_off(ARMCPU *arm_cpu)
126
{
127
- int32_t ret = arm_set_cpu_off(arm_cpu->mp_affinity);
128
+ int32_t ret = arm_set_cpu_off(arm_cpu_mp_affinity(arm_cpu));
129
assert(ret == QEMU_ARM_POWERCTL_RET_SUCCESS);
130
}
131
132
@@ -XXX,XX +XXX,XX @@ static bool hvf_handle_psci_call(CPUState *cpu)
133
int32_t ret = 0;
134
135
trace_hvf_psci_call(param[0], param[1], param[2], param[3],
136
- arm_cpu->mp_affinity);
137
+ arm_cpu_mp_affinity(arm_cpu));
138
139
switch (param[0]) {
140
case QEMU_PSCI_0_2_FN_PSCI_VERSION:
141
diff --git a/target/arm/tcg/psci.c b/target/arm/tcg/psci.c
142
index XXXXXXX..XXXXXXX 100644
143
--- a/target/arm/tcg/psci.c
144
+++ b/target/arm/tcg/psci.c
145
@@ -XXX,XX +XXX,XX @@ err:
146
return;
147
148
cpu_off:
149
- ret = arm_set_cpu_off(cpu->mp_affinity);
150
+ ret = arm_set_cpu_off(arm_cpu_mp_affinity(cpu));
151
/* notreached */
152
/* sanity check in case something failed */
153
assert(ret == QEMU_ARM_POWERCTL_RET_SUCCESS);
154
--
97
--
155
2.34.1
98
2.34.1
156
99
157
100
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
1
From: Leif Lindholm <quic_llindhol@quicinc.com>
2
2
3
The TUSB6010 USB controller is soldered on the N800 and N810
3
I'm migrating to Qualcomm's new open source email infrastructure, so
4
tablets, thus is always present.
4
update my email address, and update the mailmap to match.
5
5
6
This is a migration compatibility break for the n800/n810
6
Signed-off-by: Leif Lindholm <leif.lindholm@oss.qualcomm.com>
7
machines started with the '-usb none' option.
7
Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com>
8
8
Reviewed-by: Brian Cain <brian.cain@oss.qualcomm.com>
9
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
9
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
10
Message-id: 20240119215106.45776-3-philmd@linaro.org
10
Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org>
11
[PMM: fixed commit message typo]
11
Message-id: 20241205114047.1125842-1-leif.lindholm@oss.qualcomm.com
12
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
---
13
---
15
hw/arm/nseries.c | 4 +---
14
MAINTAINERS | 2 +-
16
1 file changed, 1 insertion(+), 3 deletions(-)
15
.mailmap | 5 +++--
16
2 files changed, 4 insertions(+), 3 deletions(-)
17
17
18
diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c
18
diff --git a/MAINTAINERS b/MAINTAINERS
19
index XXXXXXX..XXXXXXX 100644
19
index XXXXXXX..XXXXXXX 100644
20
--- a/hw/arm/nseries.c
20
--- a/MAINTAINERS
21
+++ b/hw/arm/nseries.c
21
+++ b/MAINTAINERS
22
@@ -XXX,XX +XXX,XX @@ static void n8x0_init(MachineState *machine,
22
@@ -XXX,XX +XXX,XX @@ F: include/hw/ssi/imx_spi.h
23
n8x0_spi_setup(s);
23
SBSA-REF
24
n8x0_dss_setup(s);
24
M: Radoslaw Biernacki <rad@semihalf.com>
25
n8x0_cbus_setup(s);
25
M: Peter Maydell <peter.maydell@linaro.org>
26
- if (machine_usb(machine)) {
26
-R: Leif Lindholm <quic_llindhol@quicinc.com>
27
- n8x0_usb_setup(s);
27
+R: Leif Lindholm <leif.lindholm@oss.qualcomm.com>
28
- }
28
R: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org>
29
+ n8x0_usb_setup(s);
29
L: qemu-arm@nongnu.org
30
30
S: Maintained
31
if (machine->kernel_filename) {
31
diff --git a/.mailmap b/.mailmap
32
/* Or at the linux loader. */
32
index XXXXXXX..XXXXXXX 100644
33
--- a/.mailmap
34
+++ b/.mailmap
35
@@ -XXX,XX +XXX,XX @@ Huacai Chen <chenhuacai@kernel.org> <chenhc@lemote.com>
36
Huacai Chen <chenhuacai@kernel.org> <chenhuacai@loongson.cn>
37
James Hogan <jhogan@kernel.org> <james.hogan@imgtec.com>
38
Juan Quintela <quintela@trasno.org> <quintela@redhat.com>
39
-Leif Lindholm <quic_llindhol@quicinc.com> <leif.lindholm@linaro.org>
40
-Leif Lindholm <quic_llindhol@quicinc.com> <leif@nuviainc.com>
41
+Leif Lindholm <leif.lindholm@oss.qualcomm.com> <quic_llindhol@quicinc.com>
42
+Leif Lindholm <leif.lindholm@oss.qualcomm.com> <leif.lindholm@linaro.org>
43
+Leif Lindholm <leif.lindholm@oss.qualcomm.com> <leif@nuviainc.com>
44
Luc Michel <luc@lmichel.fr> <luc.michel@git.antfield.fr>
45
Luc Michel <luc@lmichel.fr> <luc.michel@greensocs.com>
46
Luc Michel <luc@lmichel.fr> <lmichel@kalray.eu>
33
--
47
--
34
2.34.1
48
2.34.1
35
49
36
50
diff view generated by jsdifflib
1
From: Philippe Mathieu-Daudé <philmd@linaro.org>
1
From: Vikram Garhwal <vikram.garhwal@bytedance.com>
2
2
3
target/arm/cpu-features.h uses the FIELD_EX32() macro
3
Previously, maintainer role was paused due to inactive email id. Commit id:
4
defined in "hw/registerfields.h". Include it in order
4
c009d715721861984c4987bcc78b7ee183e86d75.
5
to avoid when refactoring unrelated headers:
6
5
7
target/arm/cpu-features.h:44:12: error: call to undeclared function 'FIELD_EX32';
6
Signed-off-by: Vikram Garhwal <vikram.garhwal@bytedance.com>
8
ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
7
Reviewed-by: Francisco Iglesias <francisco.iglesias@amd.com>
9
return FIELD_EX32(id->id_isar0, ID_ISAR0, DIVIDE) != 0;
8
Message-id: 20241204184205.12952-1-vikram.garhwal@bytedance.com
10
^
11
12
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
13
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
14
Message-id: 20240118200643.29037-6-philmd@linaro.org
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
---
10
---
17
target/arm/cpu-features.h | 2 ++
11
MAINTAINERS | 2 ++
18
1 file changed, 2 insertions(+)
12
1 file changed, 2 insertions(+)
19
13
20
diff --git a/target/arm/cpu-features.h b/target/arm/cpu-features.h
14
diff --git a/MAINTAINERS b/MAINTAINERS
21
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
22
--- a/target/arm/cpu-features.h
16
--- a/MAINTAINERS
23
+++ b/target/arm/cpu-features.h
17
+++ b/MAINTAINERS
24
@@ -XXX,XX +XXX,XX @@
18
@@ -XXX,XX +XXX,XX @@ F: tests/qtest/fuzz-sb16-test.c
25
#ifndef TARGET_ARM_FEATURES_H
19
26
#define TARGET_ARM_FEATURES_H
20
Xilinx CAN
27
21
M: Francisco Iglesias <francisco.iglesias@amd.com>
28
+#include "hw/registerfields.h"
22
+M: Vikram Garhwal <vikram.garhwal@bytedance.com>
29
+
23
S: Maintained
30
/*
24
F: hw/net/can/xlnx-*
31
* Naming convention for isar_feature functions:
25
F: include/hw/net/xlnx-*
32
* Functions which test 32-bit ID registers should have _aa32_ in
26
@@ -XXX,XX +XXX,XX @@ F: include/hw/rx/
27
CAN bus subsystem and hardware
28
M: Pavel Pisa <pisa@cmp.felk.cvut.cz>
29
M: Francisco Iglesias <francisco.iglesias@amd.com>
30
+M: Vikram Garhwal <vikram.garhwal@bytedance.com>
31
S: Maintained
32
W: https://canbus.pages.fel.cvut.cz/
33
F: net/can/*
33
--
34
--
34
2.34.1
35
2.34.1
35
36
diff view generated by jsdifflib