1 | More accumulated patches from during the freeze... | 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 | The following changes since commit c83fcfaf8a54d0d034bd0edf7bbb3b0d16669be9: | 5 | thanks |
6 | -- PMM | ||
4 | 7 | ||
5 | Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2021-08-26' into staging (2021-08-26 13:42:34 +0100) | 8 | The following changes since commit 97f2796a3736ed37a1b85dc1c76a6c45b829dd17: |
9 | |||
10 | Open 10.0 development tree (2024-12-10 17:41:17 +0000) | ||
6 | 11 | ||
7 | are available in the Git repository at: | 12 | are available in the Git repository at: |
8 | 13 | ||
9 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20210826 | 14 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20241211 |
10 | 15 | ||
11 | for you to fetch changes up to d2e6f370138a7f32bc28b20dcd55374b7a638f39: | 16 | for you to fetch changes up to 1abe28d519239eea5cf9620bb13149423e5665f8: |
12 | 17 | ||
13 | hw/arm/xlnx-zynqmp: Add unimplemented APU mmio (2021-08-26 17:02:01 +0100) | 18 | MAINTAINERS: Add correct email address for Vikram Garhwal (2024-12-11 15:31:09 +0000) |
14 | 19 | ||
15 | ---------------------------------------------------------------- | 20 | ---------------------------------------------------------------- |
16 | target-arm queue: | 21 | target-arm queue: |
17 | * hw/dma/xlnx-zdma, xlnx_csu_dma: Require 'dma' link property to be set | 22 | * hw/net/lan9118: Extract PHY model, reuse with imx_fec, fix bugs |
18 | * hw/arm/Kconfig: no need to enable ACPI_MEMORY_HOTPLUG/ACPI_NVDIMM explicitly | 23 | * fpu: Make muladd NaN handling runtime-selected, not compile-time |
19 | * target/arm/cpu: Introduce sve_vq_supported bitmap | 24 | * fpu: Make default NaN pattern runtime-selected, not compile-time |
20 | * docs/specs: Convert ACPI spec docs to rST | 25 | * fpu: Minor NaN-related cleanups |
21 | * arch_init: Clean up and refactoring | 26 | * MAINTAINERS: email address updates |
22 | * hw/core/loader: In gunzip(), check index is in range before use, not after | ||
23 | * softmmu/physmem.c: Remove unneeded NULL check in qemu_ram_alloc_from_fd() | ||
24 | * softmmu/physmem.c: Check return value from realpath() | ||
25 | * Zero-initialize sockaddr_in structs | ||
26 | * raspi: Use error_fatal for SoC realize errors, not error_abort | ||
27 | * target/arm: Avoid assertion trying to use KVM and multiple ASes | ||
28 | * target/arm: Implement HSTR.TTEE | ||
29 | * target/arm: Implement HSTR.TJDBX | ||
30 | * target/arm: Do hflags rebuild in cpsr_write() | ||
31 | * hw/arm/xlnx-versal, xlnx-zynqmp: Add unimplemented APU mmio | ||
32 | 27 | ||
33 | ---------------------------------------------------------------- | 28 | ---------------------------------------------------------------- |
34 | Andrew Jones (4): | 29 | Bernhard Beschow (5): |
35 | target/arm/cpu: Introduce sve_vq_supported bitmap | 30 | hw/net/lan9118: Extract lan9118_phy |
36 | target/arm/kvm64: Ensure sve vls map is completely clear | 31 | hw/net/lan9118_phy: Reuse in imx_fec and consolidate implementations |
37 | target/arm/cpu64: Replace kvm_supported with sve_vq_supported | 32 | hw/net/lan9118_phy: Fix off-by-one error in MII_ANLPAR register |
38 | target/arm/cpu64: Validate sve vector lengths are supported | 33 | hw/net/lan9118_phy: Reuse MII constants |
34 | hw/net/lan9118_phy: Add missing 100 mbps full duplex advertisement | ||
39 | 35 | ||
40 | Ani Sinha (1): | 36 | Leif Lindholm (1): |
41 | hw/arm/Kconfig: no need to enable ACPI_MEMORY_HOTPLUG/ACPI_NVDIMM explicitly | 37 | MAINTAINERS: update email address for Leif Lindholm |
42 | 38 | ||
43 | Peter Maydell (26): | 39 | Peter Maydell (54): |
44 | docs/specs/acpu_cpu_hotplug: Convert to rST | 40 | fpu: handle raising Invalid for infzero in pick_nan_muladd |
45 | docs/specs/acpi_mem_hotplug: Convert to rST | 41 | fpu: Check for default_nan_mode before calling pickNaNMulAdd |
46 | docs/specs/acpi_pci_hotplug: Convert to rST | 42 | softfloat: Allow runtime choice of inf * 0 + NaN result |
47 | docs/specs/acpi_nvdimm: Convert to rST | 43 | tests/fp: Explicitly set inf-zero-nan rule |
48 | MAINTAINERS: Add ACPI specs documents to ACPI and NVDIMM sections | 44 | target/arm: Set FloatInfZeroNaNRule explicitly |
49 | softmmu: Use accel_find("xen") instead of xen_available() | 45 | target/s390: Set FloatInfZeroNaNRule explicitly |
50 | monitor: Use accel_find("kvm") instead of kvm_available() | 46 | target/ppc: Set FloatInfZeroNaNRule explicitly |
51 | softmmu/arch_init.c: Trim down include list | 47 | target/mips: Set FloatInfZeroNaNRule explicitly |
52 | meson.build: Define QEMU_ARCH in config-target.h | 48 | target/sparc: Set FloatInfZeroNaNRule explicitly |
53 | arch_init.h: Add QEMU_ARCH_HEXAGON | 49 | target/xtensa: Set FloatInfZeroNaNRule explicitly |
54 | arch_init.h: Move QEMU_ARCH_VIRTIO_* to qdev-monitor.c | 50 | target/x86: Set FloatInfZeroNaNRule explicitly |
55 | arch_init.h: Don't include arch_init.h unnecessarily | 51 | target/loongarch: Set FloatInfZeroNaNRule explicitly |
56 | stubs: Remove unused arch_type.c stub | 52 | target/hppa: Set FloatInfZeroNaNRule explicitly |
57 | hw/core/loader: In gunzip(), check index is in range before use, not after | 53 | softfloat: Pass have_snan to pickNaNMulAdd |
58 | softmmu/physmem.c: Remove unneeded NULL check in qemu_ram_alloc_from_fd() | 54 | softfloat: Allow runtime choice of NaN propagation for muladd |
59 | softmmu/physmem.c: Check return value from realpath() | 55 | tests/fp: Explicitly set 3-NaN propagation rule |
60 | net: Zero sockaddr_in in parse_host_port() | 56 | target/arm: Set Float3NaNPropRule explicitly |
61 | gdbstub: Zero-initialize sockaddr structs | 57 | target/loongarch: Set Float3NaNPropRule explicitly |
62 | tests/qtest/ipmi-bt-test: Zero-initialize sockaddr struct | 58 | target/ppc: Set Float3NaNPropRule explicitly |
63 | tests/tcg/multiarch/linux-test: Zero-initialize sockaddr structs | 59 | target/s390x: Set Float3NaNPropRule explicitly |
64 | raspi: Use error_fatal for SoC realize errors, not error_abort | 60 | target/sparc: Set Float3NaNPropRule explicitly |
65 | target/arm: Avoid assertion trying to use KVM and multiple ASes | 61 | target/mips: Set Float3NaNPropRule explicitly |
66 | hw/arm/virt: Delete EL3 error checksnow provided in CPU realize | 62 | target/xtensa: Set Float3NaNPropRule explicitly |
67 | target/arm: Implement HSTR.TTEE | 63 | target/i386: Set Float3NaNPropRule explicitly |
68 | target/arm: Implement HSTR.TJDBX | 64 | target/hppa: Set Float3NaNPropRule explicitly |
69 | target/arm: Do hflags rebuild in cpsr_write() | 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 | ||
70 | 94 | ||
71 | Philippe Mathieu-Daudé (4): | 95 | Richard Henderson (11): |
72 | hw/arm/xlnx-zynqmp: Realize qspi controller *after* qspi_dma | 96 | target/arm: Copy entire float_status in is_ebf |
73 | hw/dma/xlnx_csu_dma: Run trivial checks early in realize() | 97 | softfloat: Inline pickNaNMulAdd |
74 | hw/dma/xlnx_csu_dma: Always expect 'dma' link property to be set | 98 | softfloat: Use goto for default nan case in pick_nan_muladd |
75 | hw/dma/xlnx-zdma Always expect 'dma' link property to be set | 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 | ||
76 | 107 | ||
77 | Tong Ho (2): | 108 | Vikram Garhwal (1): |
78 | hw/arm/xlnx-versal: Add unimplemented APU mmio | 109 | MAINTAINERS: Add correct email address for Vikram Garhwal |
79 | hw/arm/xlnx-zynqmp: Add unimplemented APU mmio | ||
80 | 110 | ||
81 | docs/specs/acpi_cpu_hotplug.rst | 235 +++++++++++++++++++++ | 111 | MAINTAINERS | 4 +- |
82 | docs/specs/acpi_cpu_hotplug.txt | 160 -------------- | 112 | include/fpu/softfloat-helpers.h | 38 +++- |
83 | docs/specs/acpi_mem_hotplug.rst | 128 +++++++++++ | 113 | include/fpu/softfloat-types.h | 89 +++++++- |
84 | docs/specs/acpi_mem_hotplug.txt | 94 --------- | 114 | include/hw/net/imx_fec.h | 9 +- |
85 | docs/specs/acpi_nvdimm.rst | 228 ++++++++++++++++++++ | 115 | include/hw/net/lan9118_phy.h | 37 ++++ |
86 | docs/specs/acpi_nvdimm.txt | 188 ----------------- | 116 | include/hw/net/mii.h | 6 + |
87 | .../{acpi_pci_hotplug.txt => acpi_pci_hotplug.rst} | 37 ++-- | 117 | target/mips/fpu_helper.h | 20 ++ |
88 | docs/specs/index.rst | 4 + | 118 | target/sparc/helper.h | 4 +- |
89 | meson.build | 2 + | 119 | fpu/softfloat.c | 19 ++ |
90 | include/hw/arm/xlnx-versal.h | 2 + | 120 | hw/net/imx_fec.c | 146 ++------------ |
91 | include/hw/arm/xlnx-zynqmp.h | 7 + | 121 | hw/net/lan9118.c | 137 ++----------- |
92 | include/hw/dma/xlnx-zdma.h | 2 +- | 122 | hw/net/lan9118_phy.c | 222 ++++++++++++++++++++ |
93 | include/hw/dma/xlnx_csu_dma.h | 2 +- | 123 | linux-user/arm/nwfpe/fpa11.c | 5 + |
94 | include/sysemu/arch_init.h | 15 +- | 124 | target/alpha/cpu.c | 2 + |
95 | target/arm/cpu.h | 17 +- | 125 | target/arm/cpu.c | 10 + |
96 | target/arm/helper.h | 2 + | 126 | target/arm/tcg/vec_helper.c | 20 +- |
97 | target/arm/syndrome.h | 7 + | 127 | target/hexagon/cpu.c | 2 + |
98 | blockdev.c | 1 - | 128 | target/hppa/fpu_helper.c | 12 ++ |
99 | gdbstub.c | 4 +- | 129 | target/i386/tcg/fpu_helper.c | 12 ++ |
100 | hw/arm/raspi.c | 2 +- | 130 | target/loongarch/tcg/fpu_helper.c | 14 +- |
101 | hw/arm/virt.c | 5 - | 131 | target/m68k/cpu.c | 14 +- |
102 | hw/arm/xlnx-versal.c | 4 + | 132 | target/m68k/fpu_helper.c | 6 +- |
103 | hw/arm/xlnx-zynqmp.c | 86 ++++++-- | 133 | target/m68k/helper.c | 6 +- |
104 | hw/core/loader.c | 35 ++- | 134 | target/microblaze/cpu.c | 2 + |
105 | hw/dma/xlnx-zdma.c | 24 +-- | 135 | target/mips/msa.c | 10 + |
106 | hw/dma/xlnx_csu_dma.c | 31 ++- | 136 | target/openrisc/cpu.c | 2 + |
107 | hw/i386/pc.c | 1 - | 137 | target/ppc/cpu_init.c | 19 ++ |
108 | hw/i386/pc_piix.c | 1 - | 138 | target/ppc/fpu_helper.c | 3 +- |
109 | hw/i386/pc_q35.c | 1 - | 139 | target/riscv/cpu.c | 2 + |
110 | hw/mips/jazz.c | 1 - | 140 | target/rx/cpu.c | 2 + |
111 | hw/mips/malta.c | 1 - | 141 | target/s390x/cpu.c | 5 + |
112 | hw/ppc/prep.c | 1 - | 142 | target/sh4/cpu.c | 2 + |
113 | hw/riscv/sifive_e.c | 1 - | 143 | target/sparc/cpu.c | 6 + |
114 | hw/riscv/sifive_u.c | 1 - | 144 | target/sparc/fop_helper.c | 8 +- |
115 | hw/riscv/spike.c | 1 - | 145 | target/sparc/translate.c | 4 +- |
116 | hw/riscv/virt.c | 1 - | 146 | target/tricore/helper.c | 2 + |
117 | linux-user/arm/signal.c | 2 - | 147 | target/xtensa/cpu.c | 4 + |
118 | monitor/qmp-cmds.c | 3 +- | 148 | target/xtensa/fpu_helper.c | 3 +- |
119 | net/net.c | 2 + | 149 | tests/fp/fp-bench.c | 7 + |
120 | softmmu/arch_init.c | 66 ------ | 150 | tests/fp/fp-test-log2.c | 1 + |
121 | softmmu/physmem.c | 5 +- | 151 | tests/fp/fp-test.c | 7 + |
122 | softmmu/qdev-monitor.c | 9 + | 152 | fpu/softfloat-parts.c.inc | 152 +++++++++++--- |
123 | softmmu/vl.c | 6 +- | 153 | fpu/softfloat-specialize.c.inc | 412 ++------------------------------------ |
124 | stubs/arch_type.c | 4 - | 154 | .mailmap | 5 +- |
125 | target/arm/cpu.c | 23 ++ | 155 | hw/net/Kconfig | 5 + |
126 | target/arm/cpu64.c | 118 +++++------ | 156 | hw/net/meson.build | 1 + |
127 | target/arm/helper.c | 40 +++- | 157 | hw/net/trace-events | 10 +- |
128 | target/arm/kvm64.c | 2 +- | 158 | 47 files changed, 778 insertions(+), 730 deletions(-) |
129 | target/arm/op_helper.c | 16 ++ | 159 | create mode 100644 include/hw/net/lan9118_phy.h |
130 | target/arm/translate.c | 12 ++ | 160 | create mode 100644 hw/net/lan9118_phy.c |
131 | target/ppc/cpu_init.c | 1 - | ||
132 | target/s390x/cpu-sysemu.c | 1 - | ||
133 | tests/qtest/ipmi-bt-test.c | 2 +- | ||
134 | tests/tcg/multiarch/linux-test.c | 4 +- | ||
135 | MAINTAINERS | 5 + | ||
136 | hw/arm/Kconfig | 2 - | ||
137 | stubs/meson.build | 1 - | ||
138 | 57 files changed, 949 insertions(+), 707 deletions(-) | ||
139 | create mode 100644 docs/specs/acpi_cpu_hotplug.rst | ||
140 | delete mode 100644 docs/specs/acpi_cpu_hotplug.txt | ||
141 | create mode 100644 docs/specs/acpi_mem_hotplug.rst | ||
142 | delete mode 100644 docs/specs/acpi_mem_hotplug.txt | ||
143 | create mode 100644 docs/specs/acpi_nvdimm.rst | ||
144 | delete mode 100644 docs/specs/acpi_nvdimm.txt | ||
145 | rename docs/specs/{acpi_pci_hotplug.txt => acpi_pci_hotplug.rst} (51%) | ||
146 | delete mode 100644 stubs/arch_type.c | ||
147 | diff view generated by jsdifflib |
1 | Convert the acpi memory hotplug spec to rST. | 1 | From: Bernhard Beschow <shentey@gmail.com> |
---|---|---|---|
2 | 2 | ||
3 | Note that this includes converting a lot of weird whitespace | 3 | A very similar implementation of the same device exists in imx_fec. Prepare for |
4 | characters to plain old spaces (the rST parser does not like | 4 | a common implementation by extracting a device model into its own files. |
5 | whatever the old ones were). | ||
6 | 5 | ||
6 | Some migration state has been moved into the new device model which breaks | ||
7 | migration compatibility for the following machines: | ||
8 | * smdkc210 | ||
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 | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 21 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Reviewed-by: Igor Mammedov <imammedo@redhat.com> | ||
9 | Message-id: 20210727170414.3368-3-peter.maydell@linaro.org | ||
10 | --- | 22 | --- |
11 | docs/specs/acpi_mem_hotplug.rst | 128 ++++++++++++++++++++++++++++++++ | 23 | include/hw/net/lan9118_phy.h | 37 ++++++++ |
12 | docs/specs/acpi_mem_hotplug.txt | 94 ----------------------- | 24 | hw/net/lan9118.c | 137 +++++----------------------- |
13 | docs/specs/index.rst | 1 + | 25 | hw/net/lan9118_phy.c | 169 +++++++++++++++++++++++++++++++++++ |
14 | 3 files changed, 129 insertions(+), 94 deletions(-) | 26 | hw/net/Kconfig | 4 + |
15 | create mode 100644 docs/specs/acpi_mem_hotplug.rst | 27 | hw/net/meson.build | 1 + |
16 | delete mode 100644 docs/specs/acpi_mem_hotplug.txt | 28 | 5 files changed, 233 insertions(+), 115 deletions(-) |
29 | create mode 100644 include/hw/net/lan9118_phy.h | ||
30 | create mode 100644 hw/net/lan9118_phy.c | ||
17 | 31 | ||
18 | diff --git a/docs/specs/acpi_mem_hotplug.rst b/docs/specs/acpi_mem_hotplug.rst | 32 | diff --git a/include/hw/net/lan9118_phy.h b/include/hw/net/lan9118_phy.h |
19 | new file mode 100644 | 33 | new file mode 100644 |
20 | index XXXXXXX..XXXXXXX | 34 | index XXXXXXX..XXXXXXX |
21 | --- /dev/null | 35 | --- /dev/null |
22 | +++ b/docs/specs/acpi_mem_hotplug.rst | 36 | +++ b/include/hw/net/lan9118_phy.h |
23 | @@ -XXX,XX +XXX,XX @@ | 37 | @@ -XXX,XX +XXX,XX @@ |
24 | +QEMU<->ACPI BIOS memory hotplug interface | 38 | +/* |
25 | +========================================= | 39 | + * SMSC LAN9118 PHY emulation |
26 | + | 40 | + * |
27 | +ACPI BIOS GPE.3 handler is dedicated for notifying OS about memory hot-add | 41 | + * Copyright (c) 2009 CodeSourcery, LLC. |
28 | +and hot-remove events. | 42 | + * Written by Paul Brook |
29 | + | 43 | + * |
30 | +Memory hot-plug interface (IO port 0xa00-0xa17, 1-4 byte access) | 44 | + * This work is licensed under the terms of the GNU GPL, version 2 or later. |
31 | +---------------------------------------------------------------- | 45 | + * See the COPYING file in the top-level directory. |
32 | + | 46 | + */ |
33 | +Read access behavior | 47 | + |
34 | +^^^^^^^^^^^^^^^^^^^^ | 48 | +#ifndef HW_NET_LAN9118_PHY_H |
35 | + | 49 | +#define HW_NET_LAN9118_PHY_H |
36 | +[0x0-0x3] | 50 | + |
37 | + Lo part of memory device phys address | 51 | +#include "qom/object.h" |
38 | +[0x4-0x7] | 52 | +#include "hw/sysbus.h" |
39 | + Hi part of memory device phys address | 53 | + |
40 | +[0x8-0xb] | 54 | +#define TYPE_LAN9118_PHY "lan9118-phy" |
41 | + Lo part of memory device size in bytes | 55 | +OBJECT_DECLARE_SIMPLE_TYPE(Lan9118PhyState, LAN9118_PHY) |
42 | +[0xc-0xf] | 56 | + |
43 | + Hi part of memory device size in bytes | 57 | +typedef struct Lan9118PhyState { |
44 | +[0x10-0x13] | 58 | + SysBusDevice parent_obj; |
45 | + Memory device proximity domain | 59 | + |
46 | +[0x14] | 60 | + uint16_t status; |
47 | + Memory device status fields | 61 | + uint16_t control; |
48 | + | 62 | + uint16_t advertise; |
49 | + bits: | 63 | + uint16_t ints; |
50 | + | 64 | + uint16_t int_mask; |
51 | + 0: | 65 | + qemu_irq irq; |
52 | + Device is enabled and may be used by guest | 66 | + bool link_down; |
53 | + 1: | 67 | +} Lan9118PhyState; |
54 | + Device insert event, used to distinguish device for which | 68 | + |
55 | + no device check event to OSPM was issued. | 69 | +void lan9118_phy_update_link(Lan9118PhyState *s, bool link_down); |
56 | + It's valid only when bit 1 is set. | 70 | +void lan9118_phy_reset(Lan9118PhyState *s); |
57 | + 2: | 71 | +uint16_t lan9118_phy_read(Lan9118PhyState *s, int reg); |
58 | + Device remove event, used to distinguish device for which | 72 | +void lan9118_phy_write(Lan9118PhyState *s, int reg, uint16_t val); |
59 | + no device eject request to OSPM was issued. | 73 | + |
60 | + 3-7: | 74 | +#endif |
61 | + reserved and should be ignored by OSPM | 75 | diff --git a/hw/net/lan9118.c b/hw/net/lan9118.c |
62 | + | 76 | index XXXXXXX..XXXXXXX 100644 |
63 | +[0x15-0x17] | 77 | --- a/hw/net/lan9118.c |
64 | + reserved | 78 | +++ b/hw/net/lan9118.c |
65 | + | 79 | @@ -XXX,XX +XXX,XX @@ |
66 | +Write access behavior | 80 | #include "net/net.h" |
67 | +^^^^^^^^^^^^^^^^^^^^^ | 81 | #include "net/eth.h" |
68 | + | 82 | #include "hw/irq.h" |
69 | + | 83 | +#include "hw/net/lan9118_phy.h" |
70 | +[0x0-0x3] | 84 | #include "hw/net/lan9118.h" |
71 | + Memory device slot selector, selects active memory device. | 85 | #include "hw/ptimer.h" |
72 | + All following accesses to other registers in 0xa00-0xa17 | 86 | #include "hw/qdev-properties.h" |
73 | + region will read/store data from/to selected memory device. | 87 | @@ -XXX,XX +XXX,XX @@ do { printf("lan9118: " fmt , ## __VA_ARGS__); } while (0) |
74 | +[0x4-0x7] | 88 | #define MAC_CR_RXEN 0x00000004 |
75 | + OST event code reported by OSPM | 89 | #define MAC_CR_RESERVED 0x7f404213 |
76 | +[0x8-0xb] | 90 | |
77 | + OST status code reported by OSPM | 91 | -#define PHY_INT_ENERGYON 0x80 |
78 | +[0xc-0x13] | 92 | -#define PHY_INT_AUTONEG_COMPLETE 0x40 |
79 | + reserved, writes into it are ignored | 93 | -#define PHY_INT_FAULT 0x20 |
80 | +[0x14] | 94 | -#define PHY_INT_DOWN 0x10 |
81 | + Memory device control fields | 95 | -#define PHY_INT_AUTONEG_LP 0x08 |
82 | + | 96 | -#define PHY_INT_PARFAULT 0x04 |
83 | + bits: | 97 | -#define PHY_INT_AUTONEG_PAGE 0x02 |
84 | + | 98 | - |
85 | + 0: | 99 | #define GPT_TIMER_EN 0x20000000 |
86 | + reserved, OSPM must clear it before writing to register. | 100 | |
87 | + Due to BUG in versions prior 2.4 that field isn't cleared | 101 | /* |
88 | + when other fields are written. Keep it reserved and don't | 102 | @@ -XXX,XX +XXX,XX @@ struct lan9118_state { |
89 | + try to reuse it. | 103 | uint32_t mac_mii_data; |
90 | + 1: | 104 | uint32_t mac_flow; |
91 | + if set to 1 clears device insert event, set by OSPM | 105 | |
92 | + after it has emitted device check event for the | 106 | - uint32_t phy_status; |
93 | + selected memory device | 107 | - uint32_t phy_control; |
94 | + 2: | 108 | - uint32_t phy_advertise; |
95 | + if set to 1 clears device remove event, set by OSPM | 109 | - uint32_t phy_int; |
96 | + after it has emitted device eject request for the | 110 | - uint32_t phy_int_mask; |
97 | + selected memory device | 111 | + Lan9118PhyState mii; |
98 | + 3: | 112 | + IRQState mii_irq; |
99 | + if set to 1 initiates device eject, set by OSPM when it | 113 | |
100 | + triggers memory device removal and calls _EJ0 method | 114 | int32_t eeprom_writable; |
101 | + 4-7: | 115 | uint8_t eeprom[128]; |
102 | + reserved, OSPM must clear them before writing to register | 116 | @@ -XXX,XX +XXX,XX @@ struct lan9118_state { |
103 | + | 117 | |
104 | +Selecting memory device slot beyond present range has no effect on platform: | 118 | static const VMStateDescription vmstate_lan9118 = { |
105 | + | 119 | .name = "lan9118", |
106 | +- write accesses to memory hot-plug registers not documented above are ignored | 120 | - .version_id = 2, |
107 | +- read accesses to memory hot-plug registers not documented above return | 121 | - .minimum_version_id = 1, |
108 | + all bits set to 1. | 122 | + .version_id = 3, |
109 | + | 123 | + .minimum_version_id = 3, |
110 | +Memory hot remove process diagram | 124 | .fields = (const VMStateField[]) { |
111 | +--------------------------------- | 125 | VMSTATE_PTIMER(timer, lan9118_state), |
112 | + | 126 | VMSTATE_UINT32(irq_cfg, lan9118_state), |
113 | +:: | 127 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_lan9118 = { |
114 | + | 128 | VMSTATE_UINT32(mac_mii_acc, lan9118_state), |
115 | + +-------------+ +-----------------------+ +------------------+ | 129 | VMSTATE_UINT32(mac_mii_data, lan9118_state), |
116 | + | 1. QEMU | | 2. QEMU | |3. QEMU | | 130 | VMSTATE_UINT32(mac_flow, lan9118_state), |
117 | + | device_del +---->+ device unplug request +----->+Send SCI to guest,| | 131 | - VMSTATE_UINT32(phy_status, lan9118_state), |
118 | + | | | cb | |return control to | | 132 | - VMSTATE_UINT32(phy_control, lan9118_state), |
119 | + | | | | |management | | 133 | - VMSTATE_UINT32(phy_advertise, lan9118_state), |
120 | + +-------------+ +-----------------------+ +------------------+ | 134 | - VMSTATE_UINT32(phy_int, lan9118_state), |
121 | + | 135 | - VMSTATE_UINT32(phy_int_mask, lan9118_state), |
122 | + +---------------------------------------------------------------------+ | 136 | VMSTATE_INT32(eeprom_writable, lan9118_state), |
123 | + | 137 | VMSTATE_UINT8_ARRAY(eeprom, lan9118_state, 128), |
124 | + +---------------------+ +-------------------------+ | 138 | VMSTATE_INT32(tx_fifo_size, lan9118_state), |
125 | + | OSPM: | remove event | OSPM: | | 139 | @@ -XXX,XX +XXX,XX @@ static void lan9118_reload_eeprom(lan9118_state *s) |
126 | + | send Eject Request, | | Scan memory devices | | 140 | lan9118_mac_changed(s); |
127 | + | clear remove event +<-------------+ for event flags | | 141 | } |
128 | + | | | | | 142 | |
129 | + +---------------------+ +-------------------------+ | 143 | -static void phy_update_irq(lan9118_state *s) |
130 | + | | 144 | +static void lan9118_update_irq(void *opaque, int n, int level) |
131 | + | | 145 | { |
132 | + +---------v--------+ +-----------------------+ | 146 | - if (s->phy_int & s->phy_int_mask) { |
133 | + | Guest OS: | success | OSPM: | | 147 | + lan9118_state *s = opaque; |
134 | + | process Ejection +----------->+ Execute _EJ0 method, | | 148 | + |
135 | + | request | | set eject bit in flags| | 149 | + if (level) { |
136 | + +------------------+ +-----------------------+ | 150 | s->int_sts |= PHY_INT; |
137 | + |failure | | 151 | } else { |
138 | + v v | 152 | s->int_sts &= ~PHY_INT; |
139 | + +------------------------+ +-----------------------+ | 153 | @@ -XXX,XX +XXX,XX @@ static void phy_update_irq(lan9118_state *s) |
140 | + | OSPM: | | QEMU: | | 154 | lan9118_update(s); |
141 | + | set OST event & status | | call device unplug cb | | 155 | } |
142 | + | fields | | | | 156 | |
143 | + +------------------------+ +-----------------------+ | 157 | -static void phy_update_link(lan9118_state *s) |
144 | + | | | 158 | -{ |
145 | + v v | 159 | - /* Autonegotiation status mirrors link status. */ |
146 | + +------------------+ +-------------------+ | 160 | - if (qemu_get_queue(s->nic)->link_down) { |
147 | + |QEMU: | |QEMU: | | 161 | - s->phy_status &= ~0x0024; |
148 | + |Send OST QMP event| |Send device deleted| | 162 | - s->phy_int |= PHY_INT_DOWN; |
149 | + | | |QMP event | | 163 | - } else { |
150 | + +------------------+ | | | 164 | - s->phy_status |= 0x0024; |
151 | + +-------------------+ | 165 | - s->phy_int |= PHY_INT_ENERGYON; |
152 | diff --git a/docs/specs/acpi_mem_hotplug.txt b/docs/specs/acpi_mem_hotplug.txt | 166 | - s->phy_int |= PHY_INT_AUTONEG_COMPLETE; |
153 | deleted file mode 100644 | 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 | ||
154 | index XXXXXXX..XXXXXXX | 313 | index XXXXXXX..XXXXXXX |
155 | --- a/docs/specs/acpi_mem_hotplug.txt | 314 | --- /dev/null |
156 | +++ /dev/null | 315 | +++ b/hw/net/lan9118_phy.c |
157 | @@ -XXX,XX +XXX,XX @@ | 316 | @@ -XXX,XX +XXX,XX @@ |
158 | -QEMU<->ACPI BIOS memory hotplug interface | 317 | +/* |
159 | --------------------------------------- | 318 | + * SMSC LAN9118 PHY emulation |
160 | - | 319 | + * |
161 | -ACPI BIOS GPE.3 handler is dedicated for notifying OS about memory hot-add | 320 | + * Copyright (c) 2009 CodeSourcery, LLC. |
162 | -and hot-remove events. | 321 | + * Written by Paul Brook |
163 | - | 322 | + * |
164 | -Memory hot-plug interface (IO port 0xa00-0xa17, 1-4 byte access): | 323 | + * This code is licensed under the GNU GPL v2 |
165 | ---------------------------------------------------------------- | 324 | + * |
166 | -0xa00: | 325 | + * Contributions after 2012-01-13 are licensed under the terms of the |
167 | - read access: | 326 | + * GNU GPL, version 2 or (at your option) any later version. |
168 | - [0x0-0x3] Lo part of memory device phys address | 327 | + */ |
169 | - [0x4-0x7] Hi part of memory device phys address | 328 | + |
170 | - [0x8-0xb] Lo part of memory device size in bytes | 329 | +#include "qemu/osdep.h" |
171 | - [0xc-0xf] Hi part of memory device size in bytes | 330 | +#include "hw/net/lan9118_phy.h" |
172 | - [0x10-0x13] Memory device proximity domain | 331 | +#include "hw/irq.h" |
173 | - [0x14] Memory device status fields | 332 | +#include "hw/resettable.h" |
174 | - bits: | 333 | +#include "migration/vmstate.h" |
175 | - 0: Device is enabled and may be used by guest | 334 | +#include "qemu/log.h" |
176 | - 1: Device insert event, used to distinguish device for which | 335 | + |
177 | - no device check event to OSPM was issued. | 336 | +#define PHY_INT_ENERGYON (1 << 7) |
178 | - It's valid only when bit 1 is set. | 337 | +#define PHY_INT_AUTONEG_COMPLETE (1 << 6) |
179 | - 2: Device remove event, used to distinguish device for which | 338 | +#define PHY_INT_FAULT (1 << 5) |
180 | - no device eject request to OSPM was issued. | 339 | +#define PHY_INT_DOWN (1 << 4) |
181 | - 3-7: reserved and should be ignored by OSPM | 340 | +#define PHY_INT_AUTONEG_LP (1 << 3) |
182 | - [0x15-0x17] reserved | 341 | +#define PHY_INT_PARFAULT (1 << 2) |
183 | - | 342 | +#define PHY_INT_AUTONEG_PAGE (1 << 1) |
184 | - write access: | 343 | + |
185 | - [0x0-0x3] Memory device slot selector, selects active memory device. | 344 | +static void lan9118_phy_update_irq(Lan9118PhyState *s) |
186 | - All following accesses to other registers in 0xa00-0xa17 | 345 | +{ |
187 | - region will read/store data from/to selected memory device. | 346 | + qemu_set_irq(s->irq, !!(s->ints & s->int_mask)); |
188 | - [0x4-0x7] OST event code reported by OSPM | 347 | +} |
189 | - [0x8-0xb] OST status code reported by OSPM | 348 | + |
190 | - [0xc-0x13] reserved, writes into it are ignored | 349 | +uint16_t lan9118_phy_read(Lan9118PhyState *s, int reg) |
191 | - [0x14] Memory device control fields | 350 | +{ |
192 | - bits: | 351 | + uint16_t val; |
193 | - 0: reserved, OSPM must clear it before writing to register. | 352 | + |
194 | - Due to BUG in versions prior 2.4 that field isn't cleared | 353 | + switch (reg) { |
195 | - when other fields are written. Keep it reserved and don't | 354 | + case 0: /* Basic Control */ |
196 | - try to reuse it. | 355 | + return s->control; |
197 | - 1: if set to 1 clears device insert event, set by OSPM | 356 | + case 1: /* Basic Status */ |
198 | - after it has emitted device check event for the | 357 | + return s->status; |
199 | - selected memory device | 358 | + case 2: /* ID1 */ |
200 | - 2: if set to 1 clears device remove event, set by OSPM | 359 | + return 0x0007; |
201 | - after it has emitted device eject request for the | 360 | + case 3: /* ID2 */ |
202 | - selected memory device | 361 | + return 0xc0d1; |
203 | - 3: if set to 1 initiates device eject, set by OSPM when it | 362 | + case 4: /* Auto-neg advertisement */ |
204 | - triggers memory device removal and calls _EJ0 method | 363 | + return s->advertise; |
205 | - 4-7: reserved, OSPM must clear them before writing to register | 364 | + case 5: /* Auto-neg Link Partner Ability */ |
206 | - | 365 | + return 0x0f71; |
207 | -Selecting memory device slot beyond present range has no effect on platform: | 366 | + case 6: /* Auto-neg Expansion */ |
208 | - - write accesses to memory hot-plug registers not documented above are | 367 | + return 1; |
209 | - ignored | 368 | + /* TODO 17, 18, 27, 29, 30, 31 */ |
210 | - - read accesses to memory hot-plug registers not documented above return | 369 | + case 29: /* Interrupt source. */ |
211 | - all bits set to 1. | 370 | + val = s->ints; |
212 | - | 371 | + s->ints = 0; |
213 | -Memory hot remove process diagram: | 372 | + lan9118_phy_update_irq(s); |
214 | ----------------------------------- | 373 | + return val; |
215 | - +-------------+ +-----------------------+ +------------------+ | 374 | + case 30: /* Interrupt mask */ |
216 | - | 1. QEMU | | 2. QEMU | |3. QEMU | | 375 | + return s->int_mask; |
217 | - | device_del +---->+ device unplug request +----->+Send SCI to guest,| | 376 | + default: |
218 | - | | | cb | |return control to | | 377 | + qemu_log_mask(LOG_GUEST_ERROR, |
219 | - +-------------+ +-----------------------+ |management | | 378 | + "lan9118_phy_read: PHY read reg %d\n", reg); |
220 | - +------------------+ | 379 | + return 0; |
221 | - | 380 | + } |
222 | - +---------------------------------------------------------------------+ | 381 | +} |
223 | - | 382 | + |
224 | - +---------------------+ +-------------------------+ | 383 | +void lan9118_phy_write(Lan9118PhyState *s, int reg, uint16_t val) |
225 | - | OSPM: | remove event | OSPM: | | 384 | +{ |
226 | - | send Eject Request, | | Scan memory devices | | 385 | + switch (reg) { |
227 | - | clear remove event +<-------------+ for event flags | | 386 | + case 0: /* Basic Control */ |
228 | - | | | | | 387 | + if (val & 0x8000) { |
229 | - +---------------------+ +-------------------------+ | 388 | + lan9118_phy_reset(s); |
230 | - | | 389 | + break; |
231 | - | | 390 | + } |
232 | - +---------v--------+ +-----------------------+ | 391 | + s->control = val & 0x7980; |
233 | - | Guest OS: | success | OSPM: | | 392 | + /* Complete autonegotiation immediately. */ |
234 | - | process Ejection +----------->+ Execute _EJ0 method, | | 393 | + if (val & 0x1000) { |
235 | - | request | | set eject bit in flags| | 394 | + s->status |= 0x0020; |
236 | - +------------------+ +-----------------------+ | 395 | + } |
237 | - |failure | | 396 | + break; |
238 | - v v | 397 | + case 4: /* Auto-neg advertisement */ |
239 | - +------------------------+ +-----------------------+ | 398 | + s->advertise = (val & 0x2d7f) | 0x80; |
240 | - | OSPM: | | QEMU: | | 399 | + break; |
241 | - | set OST event & status | | call device unplug cb | | 400 | + /* TODO 17, 18, 27, 31 */ |
242 | - | fields | | | | 401 | + case 30: /* Interrupt mask */ |
243 | - +------------------------+ +-----------------------+ | 402 | + s->int_mask = val & 0xff; |
244 | - | | | 403 | + lan9118_phy_update_irq(s); |
245 | - v v | 404 | + break; |
246 | - +------------------+ +-------------------+ | 405 | + default: |
247 | - |QEMU: | |QEMU: | | 406 | + qemu_log_mask(LOG_GUEST_ERROR, |
248 | - |Send OST QMP event| |Send device deleted| | 407 | + "lan9118_phy_write: PHY write reg %d = 0x%04x\n", reg, val); |
249 | - | | |QMP event | | 408 | + } |
250 | - +------------------+ | | | 409 | +} |
251 | - +-------------------+ | 410 | + |
252 | diff --git a/docs/specs/index.rst b/docs/specs/index.rst | 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 | + } | ||
464 | +}; | ||
465 | + | ||
466 | +static void lan9118_phy_class_init(ObjectClass *klass, void *data) | ||
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 | ||
253 | index XXXXXXX..XXXXXXX 100644 | 487 | index XXXXXXX..XXXXXXX 100644 |
254 | --- a/docs/specs/index.rst | 488 | --- a/hw/net/Kconfig |
255 | +++ b/docs/specs/index.rst | 489 | +++ b/hw/net/Kconfig |
256 | @@ -XXX,XX +XXX,XX @@ guest hardware that is specific to QEMU. | 490 | @@ -XXX,XX +XXX,XX @@ config VMXNET3_PCI |
257 | tpm | 491 | config SMC91C111 |
258 | acpi_hest_ghes | 492 | bool |
259 | acpi_cpu_hotplug | 493 | |
260 | + acpi_mem_hotplug | 494 | +config LAN9118_PHY |
495 | + bool | ||
496 | + | ||
497 | config LAN9118 | ||
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 | ||
504 | index XXXXXXX..XXXXXXX 100644 | ||
505 | --- a/hw/net/meson.build | ||
506 | +++ b/hw/net/meson.build | ||
507 | @@ -XXX,XX +XXX,XX @@ system_ss.add(when: 'CONFIG_VMXNET3_PCI', if_true: files('vmxnet3.c')) | ||
508 | |||
509 | system_ss.add(when: 'CONFIG_SMC91C111', if_true: files('smc91c111.c')) | ||
510 | system_ss.add(when: 'CONFIG_LAN9118', if_true: files('lan9118.c')) | ||
511 | +system_ss.add(when: 'CONFIG_LAN9118_PHY', if_true: files('lan9118_phy.c')) | ||
512 | system_ss.add(when: 'CONFIG_NE2000_ISA', if_true: files('ne2000-isa.c')) | ||
513 | system_ss.add(when: 'CONFIG_OPENCORES_ETH', if_true: files('opencores_eth.c')) | ||
514 | system_ss.add(when: 'CONFIG_XGMAC', if_true: files('xgmac.c')) | ||
261 | -- | 515 | -- |
262 | 2.20.1 | 516 | 2.34.1 |
263 | |||
264 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Bernhard Beschow <shentey@gmail.com> | ||
1 | 2 | ||
3 | imx_fec models the same PHY as lan9118_phy. The code is almost the same with | ||
4 | imx_fec having more logging and tracing. Merge these improvements into | ||
5 | lan9118_phy and reuse in imx_fec to fix the code duplication. | ||
6 | |||
7 | Some migration state how resides in the new device model which breaks migration | ||
8 | compatibility for the following machines: | ||
9 | * imx25-pdk | ||
10 | * sabrelite | ||
11 | * mcimx7d-sabre | ||
12 | * mcimx6ul-evk | ||
13 | |||
14 | Signed-off-by: Bernhard Beschow <shentey@gmail.com> | ||
15 | Tested-by: Guenter Roeck <linux@roeck-us.net> | ||
16 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
17 | Message-id: 20241102125724.532843-3-shentey@gmail.com | ||
18 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
19 | --- | ||
20 | include/hw/net/imx_fec.h | 9 ++- | ||
21 | hw/net/imx_fec.c | 146 ++++----------------------------------- | ||
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(-) | ||
26 | |||
27 | diff --git a/include/hw/net/imx_fec.h b/include/hw/net/imx_fec.h | ||
28 | index XXXXXXX..XXXXXXX 100644 | ||
29 | --- a/include/hw/net/imx_fec.h | ||
30 | +++ b/include/hw/net/imx_fec.h | ||
31 | @@ -XXX,XX +XXX,XX @@ OBJECT_DECLARE_SIMPLE_TYPE(IMXFECState, IMX_FEC) | ||
32 | #define TYPE_IMX_ENET "imx.enet" | ||
33 | |||
34 | #include "hw/sysbus.h" | ||
35 | +#include "hw/net/lan9118_phy.h" | ||
36 | +#include "hw/irq.h" | ||
37 | #include "net/net.h" | ||
38 | |||
39 | #define ENET_EIR 1 | ||
40 | @@ -XXX,XX +XXX,XX @@ struct IMXFECState { | ||
41 | uint32_t tx_descriptor[ENET_TX_RING_NUM]; | ||
42 | uint32_t tx_ring_num; | ||
43 | |||
44 | - uint32_t phy_status; | ||
45 | - uint32_t phy_control; | ||
46 | - uint32_t phy_advertise; | ||
47 | - uint32_t phy_int; | ||
48 | - uint32_t phy_int_mask; | ||
49 | + Lan9118PhyState mii; | ||
50 | + IRQState mii_irq; | ||
51 | uint32_t phy_num; | ||
52 | bool phy_connected; | ||
53 | struct IMXFECState *phy_consumer; | ||
54 | diff --git a/hw/net/imx_fec.c b/hw/net/imx_fec.c | ||
55 | index XXXXXXX..XXXXXXX 100644 | ||
56 | --- a/hw/net/imx_fec.c | ||
57 | +++ b/hw/net/imx_fec.c | ||
58 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_imx_eth_txdescs = { | ||
59 | |||
60 | static const VMStateDescription vmstate_imx_eth = { | ||
61 | .name = TYPE_IMX_FEC, | ||
62 | - .version_id = 2, | ||
63 | - .minimum_version_id = 2, | ||
64 | + .version_id = 3, | ||
65 | + .minimum_version_id = 3, | ||
66 | .fields = (const VMStateField[]) { | ||
67 | VMSTATE_UINT32_ARRAY(regs, IMXFECState, ENET_MAX), | ||
68 | VMSTATE_UINT32(rx_descriptor, IMXFECState), | ||
69 | VMSTATE_UINT32(tx_descriptor[0], IMXFECState), | ||
70 | - VMSTATE_UINT32(phy_status, IMXFECState), | ||
71 | - VMSTATE_UINT32(phy_control, IMXFECState), | ||
72 | - VMSTATE_UINT32(phy_advertise, IMXFECState), | ||
73 | - VMSTATE_UINT32(phy_int, IMXFECState), | ||
74 | - VMSTATE_UINT32(phy_int_mask, IMXFECState), | ||
75 | VMSTATE_END_OF_LIST() | ||
76 | }, | ||
77 | .subsections = (const VMStateDescription * const []) { | ||
78 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_imx_eth = { | ||
79 | }, | ||
80 | }; | ||
81 | |||
82 | -#define PHY_INT_ENERGYON (1 << 7) | ||
83 | -#define PHY_INT_AUTONEG_COMPLETE (1 << 6) | ||
84 | -#define PHY_INT_FAULT (1 << 5) | ||
85 | -#define PHY_INT_DOWN (1 << 4) | ||
86 | -#define PHY_INT_AUTONEG_LP (1 << 3) | ||
87 | -#define PHY_INT_PARFAULT (1 << 2) | ||
88 | -#define PHY_INT_AUTONEG_PAGE (1 << 1) | ||
89 | - | ||
90 | static void imx_eth_update(IMXFECState *s); | ||
91 | |||
92 | /* | ||
93 | @@ -XXX,XX +XXX,XX @@ static void imx_eth_update(IMXFECState *s); | ||
94 | * For now we don't handle any GPIO/interrupt line, so the OS will | ||
95 | * have to poll for the PHY status. | ||
96 | */ | ||
97 | -static void imx_phy_update_irq(IMXFECState *s) | ||
98 | +static void imx_phy_update_irq(void *opaque, int n, int level) | ||
99 | { | ||
100 | - imx_eth_update(s); | ||
101 | -} | ||
102 | - | ||
103 | -static void imx_phy_update_link(IMXFECState *s) | ||
104 | -{ | ||
105 | - /* Autonegotiation status mirrors link status. */ | ||
106 | - if (qemu_get_queue(s->nic)->link_down) { | ||
107 | - trace_imx_phy_update_link("down"); | ||
108 | - s->phy_status &= ~0x0024; | ||
109 | - s->phy_int |= PHY_INT_DOWN; | ||
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; | ||
260 | + } | ||
261 | + qdev_connect_gpio_out(DEVICE(&s->mii), 0, &s->mii_irq); | ||
262 | + | ||
263 | qemu_macaddr_default_if_unset(&s->conf.macaddr); | ||
264 | |||
265 | s->nic = qemu_new_nic(&imx_eth_net_info, &s->conf, | ||
266 | diff --git a/hw/net/lan9118_phy.c b/hw/net/lan9118_phy.c | ||
267 | index XXXXXXX..XXXXXXX 100644 | ||
268 | --- a/hw/net/lan9118_phy.c | ||
269 | +++ b/hw/net/lan9118_phy.c | ||
270 | @@ -XXX,XX +XXX,XX @@ | ||
271 | * Copyright (c) 2009 CodeSourcery, LLC. | ||
272 | * Written by Paul Brook | ||
273 | * | ||
274 | + * Copyright (c) 2013 Jean-Christophe Dubois. <jcd@tribudubois.net> | ||
275 | + * | ||
276 | * This code is licensed under the GNU GPL v2 | ||
277 | * | ||
278 | * Contributions after 2012-01-13 are licensed under the terms of the | ||
279 | @@ -XXX,XX +XXX,XX @@ | ||
280 | #include "hw/resettable.h" | ||
281 | #include "migration/vmstate.h" | ||
282 | #include "qemu/log.h" | ||
283 | +#include "trace.h" | ||
284 | |||
285 | #define PHY_INT_ENERGYON (1 << 7) | ||
286 | #define PHY_INT_AUTONEG_COMPLETE (1 << 6) | ||
287 | @@ -XXX,XX +XXX,XX @@ uint16_t lan9118_phy_read(Lan9118PhyState *s, int reg) | ||
288 | |||
289 | switch (reg) { | ||
290 | case 0: /* Basic Control */ | ||
291 | - return s->control; | ||
292 | + val = s->control; | ||
293 | + break; | ||
294 | case 1: /* Basic Status */ | ||
295 | - return s->status; | ||
296 | + val = s->status; | ||
297 | + break; | ||
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) | ||
353 | { | ||
354 | + trace_lan9118_phy_write(val, reg); | ||
355 | + | ||
356 | switch (reg) { | ||
357 | case 0: /* Basic Control */ | ||
358 | if (val & 0x8000) { | ||
359 | lan9118_phy_reset(s); | ||
360 | - break; | ||
361 | - } | ||
362 | - s->control = val & 0x7980; | ||
363 | - /* Complete autonegotiation immediately. */ | ||
364 | - if (val & 0x1000) { | ||
365 | - s->status |= 0x0020; | ||
366 | + } else { | ||
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) | ||
413 | { | ||
414 | + trace_lan9118_phy_reset(); | ||
415 | + | ||
416 | s->control = 0x3000; | ||
417 | s->status = 0x7809; | ||
418 | s->advertise = 0x01e1; | ||
419 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_lan9118_phy = { | ||
420 | .version_id = 1, | ||
421 | .minimum_version_id = 1, | ||
422 | .fields = (const VMStateField[]) { | ||
423 | - VMSTATE_UINT16(control, Lan9118PhyState), | ||
424 | VMSTATE_UINT16(status, Lan9118PhyState), | ||
425 | + VMSTATE_UINT16(control, Lan9118PhyState), | ||
426 | VMSTATE_UINT16(advertise, Lan9118PhyState), | ||
427 | VMSTATE_UINT16(ints, Lan9118PhyState), | ||
428 | VMSTATE_UINT16(int_mask, Lan9118PhyState), | ||
429 | diff --git a/hw/net/Kconfig b/hw/net/Kconfig | ||
430 | index XXXXXXX..XXXXXXX 100644 | ||
431 | --- a/hw/net/Kconfig | ||
432 | +++ b/hw/net/Kconfig | ||
433 | @@ -XXX,XX +XXX,XX @@ config ALLWINNER_SUN8I_EMAC | ||
434 | |||
435 | config IMX_FEC | ||
436 | bool | ||
437 | + select LAN9118_PHY | ||
438 | |||
439 | config CADENCE | ||
440 | bool | ||
441 | diff --git a/hw/net/trace-events b/hw/net/trace-events | ||
442 | index XXXXXXX..XXXXXXX 100644 | ||
443 | --- a/hw/net/trace-events | ||
444 | +++ b/hw/net/trace-events | ||
445 | @@ -XXX,XX +XXX,XX @@ allwinner_sun8i_emac_set_link(bool active) "Set link: active=%u" | ||
446 | allwinner_sun8i_emac_read(uint64_t offset, uint64_t val) "MMIO read: offset=0x%" PRIx64 " value=0x%" PRIx64 | ||
447 | allwinner_sun8i_emac_write(uint64_t offset, uint64_t val) "MMIO write: offset=0x%" PRIx64 " value=0x%" PRIx64 | ||
448 | |||
449 | +# lan9118_phy.c | ||
450 | +lan9118_phy_read(uint16_t val, int reg) "[0x%02x] -> 0x%04" PRIx16 | ||
451 | +lan9118_phy_write(uint16_t val, int reg) "[0x%02x] <- 0x%04" PRIx16 | ||
452 | +lan9118_phy_update_link(const char *s) "%s" | ||
453 | +lan9118_phy_reset(void) "" | ||
454 | + | ||
455 | # lance.c | ||
456 | lance_mem_readw(uint64_t addr, uint32_t ret) "addr=0x%"PRIx64"val=0x%04x" | ||
457 | lance_mem_writew(uint64_t addr, uint32_t val) "addr=0x%"PRIx64"val=0x%04x" | ||
458 | @@ -XXX,XX +XXX,XX @@ i82596_set_multicast(uint16_t count) "Added %d multicast entries" | ||
459 | i82596_channel_attention(void *s) "%p: Received CHANNEL ATTENTION" | ||
460 | |||
461 | # imx_fec.c | ||
462 | -imx_phy_read(uint32_t val, int phy, int reg) "0x%04"PRIx32" <= phy[%d].reg[%d]" | ||
463 | imx_phy_read_num(int phy, int configured) "read request from unconfigured phy %d (configured %d)" | ||
464 | -imx_phy_write(uint32_t val, int phy, int reg) "0x%04"PRIx32" => phy[%d].reg[%d]" | ||
465 | imx_phy_write_num(int phy, int configured) "write request to unconfigured phy %d (configured %d)" | ||
466 | -imx_phy_update_link(const char *s) "%s" | ||
467 | -imx_phy_reset(void) "" | ||
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" | ||
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" | ||
470 | imx_eth_tx_bd_busy(void) "tx_bd ran out of descriptors to transmit" | ||
471 | -- | ||
472 | 2.34.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Bernhard Beschow <shentey@gmail.com> | ||
1 | 2 | ||
3 | Turns 0x70 into 0xe0 (== 0x70 << 1) which adds the missing MII_ANLPAR_TX and | ||
4 | fixes the MSB of selector field to be zero, as specified in the datasheet. | ||
5 | |||
6 | Fixes: 2a424990170b "LAN9118 emulation" | ||
7 | Signed-off-by: Bernhard Beschow <shentey@gmail.com> | ||
8 | Tested-by: Guenter Roeck <linux@roeck-us.net> | ||
9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | Message-id: 20241102125724.532843-4-shentey@gmail.com | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
12 | --- | ||
13 | hw/net/lan9118_phy.c | 2 +- | ||
14 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
15 | |||
16 | diff --git a/hw/net/lan9118_phy.c b/hw/net/lan9118_phy.c | ||
17 | index XXXXXXX..XXXXXXX 100644 | ||
18 | --- a/hw/net/lan9118_phy.c | ||
19 | +++ b/hw/net/lan9118_phy.c | ||
20 | @@ -XXX,XX +XXX,XX @@ uint16_t lan9118_phy_read(Lan9118PhyState *s, int reg) | ||
21 | val = s->advertise; | ||
22 | break; | ||
23 | case 5: /* Auto-neg Link Partner Ability */ | ||
24 | - val = 0x0f71; | ||
25 | + val = 0x0fe1; | ||
26 | break; | ||
27 | case 6: /* Auto-neg Expansion */ | ||
28 | val = 1; | ||
29 | -- | ||
30 | 2.34.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Bernhard Beschow <shentey@gmail.com> | ||
1 | 2 | ||
3 | Prefer named constants over magic values for better readability. | ||
4 | |||
5 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
6 | Signed-off-by: Bernhard Beschow <shentey@gmail.com> | ||
7 | Tested-by: Guenter Roeck <linux@roeck-us.net> | ||
8 | Message-id: 20241102125724.532843-5-shentey@gmail.com | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | include/hw/net/mii.h | 6 +++++ | ||
12 | hw/net/lan9118_phy.c | 63 ++++++++++++++++++++++++++++---------------- | ||
13 | 2 files changed, 46 insertions(+), 23 deletions(-) | ||
14 | |||
15 | diff --git a/include/hw/net/mii.h b/include/hw/net/mii.h | ||
16 | index XXXXXXX..XXXXXXX 100644 | ||
17 | --- a/include/hw/net/mii.h | ||
18 | +++ b/include/hw/net/mii.h | ||
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 @@ | ||
51 | |||
52 | #include "qemu/osdep.h" | ||
53 | #include "hw/net/lan9118_phy.h" | ||
54 | +#include "hw/net/mii.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); | ||
166 | -- | ||
167 | 2.34.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | From: Bernhard Beschow <shentey@gmail.com> | ||
1 | 2 | ||
3 | The real device advertises this mode and the device model already advertises | ||
4 | 100 mbps half duplex and 10 mbps full+half duplex. So advertise this mode to | ||
5 | make the model more realistic. | ||
6 | |||
7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
8 | Signed-off-by: Bernhard Beschow <shentey@gmail.com> | ||
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> | ||
12 | --- | ||
13 | hw/net/lan9118_phy.c | 4 ++-- | ||
14 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
15 | |||
16 | diff --git a/hw/net/lan9118_phy.c b/hw/net/lan9118_phy.c | ||
17 | index XXXXXXX..XXXXXXX 100644 | ||
18 | --- a/hw/net/lan9118_phy.c | ||
19 | +++ b/hw/net/lan9118_phy.c | ||
20 | @@ -XXX,XX +XXX,XX @@ void lan9118_phy_write(Lan9118PhyState *s, int reg, uint16_t val) | ||
21 | break; | ||
22 | case MII_ANAR: | ||
23 | s->advertise = (val & (MII_ANAR_RFAULT | MII_ANAR_PAUSE_ASYM | | ||
24 | - MII_ANAR_PAUSE | MII_ANAR_10FD | MII_ANAR_10 | | ||
25 | - MII_ANAR_SELECT)) | ||
26 | + MII_ANAR_PAUSE | MII_ANAR_TXFD | MII_ANAR_10FD | | ||
27 | + MII_ANAR_10 | MII_ANAR_SELECT)) | ||
28 | | MII_ANAR_TX; | ||
29 | break; | ||
30 | case 30: /* Interrupt mask */ | ||
31 | -- | ||
32 | 2.34.1 | 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 |
New patch | |||
---|---|---|---|
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. | ||
1 | 5 | ||
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(+) | ||
13 | |||
14 | diff --git a/tests/fp/fp-bench.c b/tests/fp/fp-bench.c | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/tests/fp/fp-bench.c | ||
17 | +++ b/tests/fp/fp-bench.c | ||
18 | @@ -XXX,XX +XXX,XX @@ static void run_bench(void) | ||
19 | { | ||
20 | bench_func_t f; | ||
21 | |||
22 | + /* | ||
23 | + * These implementation-defined choices for various things IEEE | ||
24 | + * doesn't specify match those used by the Arm architecture. | ||
25 | + */ | ||
26 | set_float_2nan_prop_rule(float_2nan_prop_s_ab, &soft_status); | ||
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 | ||
32 | index XXXXXXX..XXXXXXX 100644 | ||
33 | --- a/tests/fp/fp-test.c | ||
34 | +++ b/tests/fp/fp-test.c | ||
35 | @@ -XXX,XX +XXX,XX @@ void run_test(void) | ||
36 | { | ||
37 | unsigned int i; | ||
38 | |||
39 | + /* | ||
40 | + * These implementation-defined choices for various things IEEE | ||
41 | + * doesn't specify match those used by the Arm architecture. | ||
42 | + */ | ||
43 | set_float_2nan_prop_rule(float_2nan_prop_s_ab, &qsf); | ||
44 | + set_float_infzeronan_rule(float_infzeronan_dnan_if_qnan, &qsf); | ||
45 | |||
46 | genCases_setLevel(test_level); | ||
47 | verCases_maxErrorCount = n_max_errors; | ||
48 | -- | ||
49 | 2.34.1 | 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 |
New patch | |||
---|---|---|---|
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. | ||
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-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(-) | ||
13 | |||
14 | diff --git a/fpu/softfloat-parts.c.inc b/fpu/softfloat-parts.c.inc | ||
15 | index XXXXXXX..XXXXXXX 100644 | ||
16 | --- a/fpu/softfloat-parts.c.inc | ||
17 | +++ b/fpu/softfloat-parts.c.inc | ||
18 | @@ -XXX,XX +XXX,XX @@ static FloatPartsN *partsN(pick_nan_muladd)(FloatPartsN *a, FloatPartsN *b, | ||
19 | { | ||
20 | int which; | ||
21 | bool infzero = (ab_mask == float_cmask_infzero); | ||
22 | + bool have_snan = (abc_mask & float_cmask_snan); | ||
23 | |||
24 | - if (unlikely(abc_mask & float_cmask_snan)) { | ||
25 | + if (unlikely(have_snan)) { | ||
26 | float_raise(float_flag_invalid | float_flag_invalid_snan, s); | ||
27 | } | ||
28 | |||
29 | @@ -XXX,XX +XXX,XX @@ static FloatPartsN *partsN(pick_nan_muladd)(FloatPartsN *a, FloatPartsN *b, | ||
30 | if (s->default_nan_mode) { | ||
31 | which = 3; | ||
32 | } else { | ||
33 | - which = pickNaNMulAdd(a->cls, b->cls, c->cls, infzero, s); | ||
34 | + which = pickNaNMulAdd(a->cls, b->cls, c->cls, infzero, have_snan, s); | ||
35 | } | ||
36 | |||
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 | ||
51 | -- | ||
52 | 2.34.1 | diff view generated by jsdifflib |
1 | From: Tong Ho <tong.ho@xilinx.com> | 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 | Add unimplemented APU mmio region to xlnx-zynqmp for booting | 3 | are NaNs. As a result different architectures have ended up with |
4 | bare-metal guests built with standalone bsp, which access the | 4 | different rules for propagating NaNs. |
5 | region from one of the following places: | 5 | |
6 | https://github.com/Xilinx/embeddedsw/blob/release-2020.2/lib/bsp/standalone/src/arm/ARMv8/64bit/armclang/boot.S#L139 | 6 | QEMU currently hardcodes the NaN propagation logic into the binary |
7 | https://github.com/Xilinx/embeddedsw/blob/release-2020.2/lib/bsp/standalone/src/arm/ARMv8/64bit/gcc/boot.S#L183 | 7 | because pickNaNMulAdd() has an ifdef ladder for different targets. |
8 | 8 | We want to make the propagation rule instead be selectable at | |
9 | Acked-by: Alistair Francis <alistair.francis@wdc.com> | 9 | runtime, because: |
10 | Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 10 | * this will let us have multiple targets in one QEMU binary |
11 | Signed-off-by: Tong Ho <tong.ho@xilinx.com> | 11 | * the Arm FEAT_AFP architectural feature includes letting |
12 | Message-id: 20210823173818.201259-3-tong.ho@xilinx.com | 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 | |||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 24 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
25 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
26 | Message-id: 20241202131347.498124-16-peter.maydell@linaro.org | ||
14 | --- | 27 | --- |
15 | include/hw/arm/xlnx-zynqmp.h | 7 +++++++ | 28 | include/fpu/softfloat-helpers.h | 11 +++ |
16 | hw/arm/xlnx-zynqmp.c | 32 ++++++++++++++++++++++++++++++++ | 29 | include/fpu/softfloat-types.h | 55 +++++++++++ |
17 | 2 files changed, 39 insertions(+) | 30 | fpu/softfloat-specialize.c.inc | 167 ++++++++------------------------ |
18 | 31 | 3 files changed, 107 insertions(+), 126 deletions(-) | |
19 | diff --git a/include/hw/arm/xlnx-zynqmp.h b/include/hw/arm/xlnx-zynqmp.h | 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/include/hw/arm/xlnx-zynqmp.h | 35 | --- a/include/fpu/softfloat-helpers.h |
22 | +++ b/include/hw/arm/xlnx-zynqmp.h | 36 | +++ b/include/fpu/softfloat-helpers.h |
23 | @@ -XXX,XX +XXX,XX @@ OBJECT_DECLARE_SIMPLE_TYPE(XlnxZynqMPState, XLNX_ZYNQMP) | 37 | @@ -XXX,XX +XXX,XX @@ static inline void set_float_2nan_prop_rule(Float2NaNPropRule rule, |
24 | #define XLNX_ZYNQMP_MAX_RAM_SIZE (XLNX_ZYNQMP_MAX_LOW_RAM_SIZE + \ | 38 | status->float_2nan_prop_rule = rule; |
25 | XLNX_ZYNQMP_MAX_HIGH_RAM_SIZE) | 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 | ||
69 | |||
70 | +#include "hw/registerfields.h" | ||
71 | + | ||
72 | /* | ||
73 | * Software IEC/IEEE floating-point types. | ||
74 | */ | ||
75 | @@ -XXX,XX +XXX,XX @@ typedef enum __attribute__((__packed__)) { | ||
76 | float_2nan_prop_x87, | ||
77 | } Float2NaNPropRule; | ||
26 | 78 | ||
27 | +/* | 79 | +/* |
28 | + * Unimplemented mmio regions needed to boot some images. | 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. | ||
29 | + */ | 99 | + */ |
30 | +#define XLNX_ZYNQMP_NUM_UNIMP_AREAS 1 | 100 | + |
31 | + | 101 | +/* |
32 | struct XlnxZynqMPState { | 102 | + * We set the Float3NaNPropRule enum values up so we can select the |
33 | /*< private >*/ | 103 | + * right value in pickNaNMulAdd in a data driven way. |
34 | DeviceState parent_obj; | 104 | + */ |
35 | @@ -XXX,XX +XXX,XX @@ struct XlnxZynqMPState { | 105 | +FIELD(3NAN, 1ST, 0, 2) /* which operand is most preferred ? */ |
36 | MemoryRegion *ddr_ram; | 106 | +FIELD(3NAN, 2ND, 2, 2) /* which operand is next most preferred ? */ |
37 | MemoryRegion ddr_ram_low, ddr_ram_high; | 107 | +FIELD(3NAN, 3RD, 4, 2) /* which operand is least preferred ? */ |
38 | 108 | +FIELD(3NAN, SNAN, 6, 1) /* do we prefer SNaN over QNaN ? */ | |
39 | + MemoryRegion mr_unimp[XLNX_ZYNQMP_NUM_UNIMP_AREAS]; | 109 | + |
40 | + | 110 | +#define PROPRULE(X, Y, Z) \ |
41 | CadenceGEMState gem[XLNX_ZYNQMP_NUM_GEMS]; | 111 | + ((X << R_3NAN_1ST_SHIFT) | (Y << R_3NAN_2ND_SHIFT) | (Z << R_3NAN_3RD_SHIFT)) |
42 | CadenceUARTState uart[XLNX_ZYNQMP_NUM_UARTS]; | 112 | + |
43 | XlnxZynqMPCANState can[XLNX_ZYNQMP_NUM_CAN]; | 113 | +typedef enum __attribute__((__packed__)) { |
44 | diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c | 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 | ||
45 | index XXXXXXX..XXXXXXX 100644 | 143 | index XXXXXXX..XXXXXXX 100644 |
46 | --- a/hw/arm/xlnx-zynqmp.c | 144 | --- a/fpu/softfloat-specialize.c.inc |
47 | +++ b/hw/arm/xlnx-zynqmp.c | 145 | +++ b/fpu/softfloat-specialize.c.inc |
48 | @@ -XXX,XX +XXX,XX @@ | 146 | @@ -XXX,XX +XXX,XX @@ static int pickNaN(FloatClass a_cls, FloatClass b_cls, |
49 | #include "qemu/module.h" | 147 | static int pickNaNMulAdd(FloatClass a_cls, FloatClass b_cls, FloatClass c_cls, |
50 | #include "hw/arm/xlnx-zynqmp.h" | 148 | bool infzero, bool have_snan, float_status *status) |
51 | #include "hw/intc/arm_gic_common.h" | 149 | { |
52 | +#include "hw/misc/unimp.h" | 150 | + FloatClass cls[3] = { a_cls, b_cls, c_cls }; |
53 | #include "hw/boards.h" | 151 | + Float3NaNPropRule rule = status->float_3nan_prop_rule; |
54 | #include "sysemu/kvm.h" | 152 | + int which; |
55 | #include "sysemu/sysemu.h" | 153 | + |
56 | @@ -XXX,XX +XXX,XX @@ | 154 | /* |
57 | #define DPDMA_ADDR 0xfd4c0000 | 155 | * We guarantee not to require the target to tell us how to |
58 | #define DPDMA_IRQ 116 | 156 | * pick a NaN if we're always returning the default NaN. |
59 | 157 | @@ -XXX,XX +XXX,XX @@ static int pickNaNMulAdd(FloatClass a_cls, FloatClass b_cls, FloatClass c_cls, | |
60 | +#define APU_ADDR 0xfd5c0000 | 158 | } |
61 | +#define APU_SIZE 0x100 | 159 | } |
62 | + | 160 | |
63 | #define IPI_ADDR 0xFF300000 | 161 | + if (rule == float_3nan_prop_none) { |
64 | #define IPI_IRQ 64 | 162 | #if defined(TARGET_ARM) |
65 | 163 | - | |
66 | @@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_create_rpu(MachineState *ms, XlnxZynqMPState *s, | 164 | - /* This looks different from the ARM ARM pseudocode, because the ARM ARM |
67 | qdev_realize(DEVICE(&s->rpu_cluster), NULL, &error_fatal); | 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; | ||
68 | } | 337 | } |
69 | 338 | ||
70 | +static void xlnx_zynqmp_create_unimp_mmio(XlnxZynqMPState *s) | 339 | /*---------------------------------------------------------------------------- |
71 | +{ | ||
72 | + static const struct UnimpInfo { | ||
73 | + const char *name; | ||
74 | + hwaddr base; | ||
75 | + hwaddr size; | ||
76 | + } unimp_areas[ARRAY_SIZE(s->mr_unimp)] = { | ||
77 | + { .name = "apu", APU_ADDR, APU_SIZE }, | ||
78 | + }; | ||
79 | + unsigned int nr; | ||
80 | + | ||
81 | + for (nr = 0; nr < ARRAY_SIZE(unimp_areas); nr++) { | ||
82 | + const struct UnimpInfo *info = &unimp_areas[nr]; | ||
83 | + DeviceState *dev = qdev_new(TYPE_UNIMPLEMENTED_DEVICE); | ||
84 | + SysBusDevice *sbd = SYS_BUS_DEVICE(dev); | ||
85 | + | ||
86 | + assert(info->name && info->base && info->size > 0); | ||
87 | + qdev_prop_set_string(dev, "name", info->name); | ||
88 | + qdev_prop_set_uint64(dev, "size", info->size); | ||
89 | + object_property_add_child(OBJECT(s), info->name, OBJECT(dev)); | ||
90 | + | ||
91 | + sysbus_realize_and_unref(sbd, &error_fatal); | ||
92 | + sysbus_mmio_map(sbd, 0, info->base); | ||
93 | + } | ||
94 | +} | ||
95 | + | ||
96 | static void xlnx_zynqmp_init(Object *obj) | ||
97 | { | ||
98 | MachineState *ms = MACHINE(qdev_get_machine()); | ||
99 | @@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp) | ||
100 | sysbus_mmio_map(SYS_BUS_DEVICE(&s->rtc), 0, RTC_ADDR); | ||
101 | sysbus_connect_irq(SYS_BUS_DEVICE(&s->rtc), 0, gic_spi[RTC_IRQ]); | ||
102 | |||
103 | + xlnx_zynqmp_create_unimp_mmio(s); | ||
104 | + | ||
105 | for (i = 0; i < XLNX_ZYNQMP_NUM_GDMA_CH; i++) { | ||
106 | if (!object_property_set_uint(OBJECT(&s->gdma[i]), "bus-width", 128, | ||
107 | errp)) { | ||
108 | -- | 340 | -- |
109 | 2.20.1 | 341 | 2.34.1 |
110 | |||
111 | 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 | KVM cannot support multiple address spaces per CPU; if you try to | 1 | Set the Float3NaNPropRule explicitly for Arm, and remove the |
---|---|---|---|
2 | create more than one then cpu_address_space_init() will assert. | 2 | ifdef from pickNaNMulAdd(). |
3 | 3 | ||
4 | In the Arm CPU realize function, detect the configurations which | ||
5 | would cause us to need more than one AS, and cleanly fail the | ||
6 | realize rather than blundering on into the assertion. This | ||
7 | turns this: | ||
8 | $ qemu-system-aarch64 -enable-kvm -display none -cpu max -machine raspi3b | ||
9 | qemu-system-aarch64: ../../softmmu/physmem.c:747: cpu_address_space_init: Assertion `asidx == 0 || !kvm_enabled()' failed. | ||
10 | Aborted | ||
11 | |||
12 | into: | ||
13 | $ qemu-system-aarch64 -enable-kvm -display none -machine raspi3b | ||
14 | qemu-system-aarch64: Cannot enable KVM when guest CPU has EL3 enabled | ||
15 | |||
16 | and this: | ||
17 | $ qemu-system-aarch64 -enable-kvm -display none -machine mps3-an524 | ||
18 | qemu-system-aarch64: ../../softmmu/physmem.c:747: cpu_address_space_init: Assertion `asidx == 0 || !kvm_enabled()' failed. | ||
19 | Aborted | ||
20 | |||
21 | into: | ||
22 | $ qemu-system-aarch64 -enable-kvm -display none -machine mps3-an524 | ||
23 | qemu-system-aarch64: Cannot enable KVM when using an M-profile guest CPU | ||
24 | |||
25 | Fixes: https://gitlab.com/qemu-project/qemu/-/issues/528 | ||
26 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
27 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
28 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 6 | Message-id: 20241202131347.498124-18-peter.maydell@linaro.org |
29 | Message-id: 20210816135842.25302-3-peter.maydell@linaro.org | ||
30 | --- | 7 | --- |
31 | target/arm/cpu.c | 23 +++++++++++++++++++++++ | 8 | target/arm/cpu.c | 5 +++++ |
32 | 1 file changed, 23 insertions(+) | 9 | fpu/softfloat-specialize.c.inc | 8 +------- |
10 | 2 files changed, 6 insertions(+), 7 deletions(-) | ||
33 | 11 | ||
34 | 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 |
35 | index XXXXXXX..XXXXXXX 100644 | 13 | index XXXXXXX..XXXXXXX 100644 |
36 | --- a/target/arm/cpu.c | 14 | --- a/target/arm/cpu.c |
37 | +++ b/target/arm/cpu.c | 15 | +++ b/target/arm/cpu.c |
38 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp) | 16 | @@ -XXX,XX +XXX,XX @@ void arm_register_el_change_hook(ARMCPU *cpu, ARMELChangeHookFn *hook, |
39 | } | 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 | + * * 3-input NaN propagation prefers SNaN over QNaN, and then | ||
21 | + * operand C over A over B (see FPProcessNaNs3() pseudocode, | ||
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) | ||
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 | } | 40 | } |
41 | 41 | ||
42 | + if (kvm_enabled()) { | 42 | if (rule == float_3nan_prop_none) { |
43 | + /* | 43 | -#if defined(TARGET_ARM) |
44 | + * Catch all the cases which might cause us to create more than one | 44 | - /* |
45 | + * address space for the CPU (otherwise we will assert() later in | 45 | - * This looks different from the ARM ARM pseudocode, because the ARM ARM |
46 | + * cpu_address_space_init()). | 46 | - * puts the operands to a fused mac operation (a*b)+c in the order c,a,b |
47 | + */ | 47 | - */ |
48 | + if (arm_feature(env, ARM_FEATURE_M)) { | 48 | - rule = float_3nan_prop_s_cab; |
49 | + error_setg(errp, | 49 | -#elif defined(TARGET_MIPS) |
50 | + "Cannot enable KVM when using an M-profile guest CPU"); | 50 | +#if defined(TARGET_MIPS) |
51 | + return; | 51 | if (snan_bit_is_one(status)) { |
52 | + } | 52 | rule = float_3nan_prop_s_abc; |
53 | + if (cpu->has_el3) { | 53 | } else { |
54 | + error_setg(errp, | ||
55 | + "Cannot enable KVM when guest CPU has EL3 enabled"); | ||
56 | + return; | ||
57 | + } | ||
58 | + if (cpu->tag_memory) { | ||
59 | + error_setg(errp, | ||
60 | + "Cannot enable KVM when guest CPUs has MTE enabled"); | ||
61 | + return; | ||
62 | + } | ||
63 | + } | ||
64 | + | ||
65 | { | ||
66 | uint64_t scale; | ||
67 | |||
68 | -- | 54 | -- |
69 | 2.20.1 | 55 | 2.34.1 |
70 | |||
71 | 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 |
New patch | |||
---|---|---|---|
1 | Set the Float3NaNPropRule explicitly for s390x, 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-21-peter.maydell@linaro.org | ||
7 | --- | ||
8 | target/s390x/cpu.c | 1 + | ||
9 | fpu/softfloat-specialize.c.inc | 2 -- | ||
10 | 2 files changed, 1 insertion(+), 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_3nan_prop_rule(float_3nan_prop_s_abc, &env->fpu_status); | ||
21 | set_float_infzeronan_rule(float_infzeronan_dnan_always, | ||
22 | &env->fpu_status); | ||
23 | /* fall through */ | ||
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_S390X) | ||
33 | - rule = float_3nan_prop_s_abc; | ||
34 | #elif defined(TARGET_SPARC) | ||
35 | rule = float_3nan_prop_s_cba; | ||
36 | #elif defined(TARGET_XTENSA) | ||
37 | -- | ||
38 | 2.34.1 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | Set the Float3NaNPropRule explicitly for SPARC, 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-22-peter.maydell@linaro.org | ||
7 | --- | ||
8 | target/sparc/cpu.c | 2 ++ | ||
9 | fpu/softfloat-specialize.c.inc | 2 -- | ||
10 | 2 files changed, 2 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 fused-multiply add, prefer SNaN over QNaN, then C->B->A */ | ||
21 | + set_float_3nan_prop_rule(float_3nan_prop_s_cba, &env->fp_status); | ||
22 | /* For inf * 0 + NaN, return the input NaN */ | ||
23 | set_float_infzeronan_rule(float_infzeronan_dnan_never, &env->fp_status); | ||
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 | } else { | ||
31 | rule = float_3nan_prop_s_cab; | ||
32 | } | ||
33 | -#elif defined(TARGET_SPARC) | ||
34 | - rule = float_3nan_prop_s_cba; | ||
35 | #elif defined(TARGET_XTENSA) | ||
36 | if (status->use_first_nan) { | ||
37 | rule = float_3nan_prop_abc; | ||
38 | -- | ||
39 | 2.34.1 | 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 | When Hexagon was added we forgot to add it to the QEMU_ARCH_* | 1 | Set the Float3NaNPropRule explicitly for i386. We had no |
---|---|---|---|
2 | enumeration. This doesn't cause a visible effect because at the | 2 | i386-specific behaviour in the old ifdef ladder, so we were using the |
3 | moment Hexagon is linux-user only and the QEMU_ARCH_* constants are | 3 | default "prefer a then b then c" fallback; this is actually the |
4 | only used in softmmu, but we might as well add it in, since it's the | 4 | correct per-the-spec handling for i386. |
5 | only architecture currently missing from the list. | ||
6 | 5 | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
10 | Reviewed-by: Taylor Simpson <tsimpson@quicinc.com> | 8 | Message-id: 20241202131347.498124-25-peter.maydell@linaro.org |
11 | Message-id: 20210730105947.28215-6-peter.maydell@linaro.org | ||
12 | --- | 9 | --- |
13 | include/sysemu/arch_init.h | 1 + | 10 | target/i386/tcg/fpu_helper.c | 1 + |
14 | 1 file changed, 1 insertion(+) | 11 | 1 file changed, 1 insertion(+) |
15 | 12 | ||
16 | diff --git a/include/sysemu/arch_init.h b/include/sysemu/arch_init.h | 13 | diff --git a/target/i386/tcg/fpu_helper.c b/target/i386/tcg/fpu_helper.c |
17 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/include/sysemu/arch_init.h | 15 | --- a/target/i386/tcg/fpu_helper.c |
19 | +++ b/include/sysemu/arch_init.h | 16 | +++ b/target/i386/tcg/fpu_helper.c |
20 | @@ -XXX,XX +XXX,XX @@ enum { | 17 | @@ -XXX,XX +XXX,XX @@ void cpu_init_fp_statuses(CPUX86State *env) |
21 | QEMU_ARCH_RISCV = (1 << 19), | 18 | * there are multiple input NaNs they are selected in the order a, b, c. |
22 | QEMU_ARCH_RX = (1 << 20), | 19 | */ |
23 | QEMU_ARCH_AVR = (1 << 21), | 20 | set_float_infzeronan_rule(float_infzeronan_dnan_never, &env->sse_status); |
24 | + QEMU_ARCH_HEXAGON = (1 << 22), | 21 | + set_float_3nan_prop_rule(float_3nan_prop_abc, &env->sse_status); |
25 | 22 | } | |
26 | QEMU_ARCH_NONE = (1 << 31), | 23 | |
27 | }; | 24 | static inline uint8_t save_exception_flags(CPUX86State *env) |
28 | -- | 25 | -- |
29 | 2.20.1 | 26 | 2.34.1 |
30 | |||
31 | diff view generated by jsdifflib |
1 | Now that the CPU realize function will fail cleanly if we ask for EL3 | 1 | Set the Float3NaNPropRule explicitly for HPPA, and remove the |
---|---|---|---|
2 | when KVM is enabled, we don't need to check for errors explicitly in | 2 | ifdef from pickNaNMulAdd(). |
3 | the virt board code. The reported message is slightly different; | ||
4 | it is now: | ||
5 | qemu-system-aarch64: Cannot enable KVM when guest CPU has EL3 enabled | ||
6 | instead of: | ||
7 | qemu-system-aarch64: mach-virt: KVM does not support Security extensions | ||
8 | 3 | ||
9 | We don't delete the MTE check because there the logic is more | 4 | HPPA is the only target that was using the default branch of the |
10 | complex; deleting the check would work but makes the error message | 5 | ifdef ladder (other targets either do not use muladd or set |
11 | less helpful, as it would read: | 6 | default_nan_mode), so we can remove the ifdef fallback entirely now |
12 | qemu-system-aarch64: MTE requested, but not supported by the guest CPU | 7 | (allowing the "rule not set" case to fall into the default of the |
13 | instead of: | 8 | switch statement and assert). |
14 | qemu-system-aarch64: mach-virt: KVM does not support providing MTE to the guest CPU | 9 | |
10 | We add a TODO note that the HPPA rule is probably wrong; this is | ||
11 | not a behavioural change for this refactoring. | ||
15 | 12 | ||
16 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
17 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 14 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
18 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 15 | Message-id: 20241202131347.498124-26-peter.maydell@linaro.org |
19 | Message-id: 20210816135842.25302-4-peter.maydell@linaro.org | ||
20 | --- | 16 | --- |
21 | hw/arm/virt.c | 5 ----- | 17 | target/hppa/fpu_helper.c | 8 ++++++++ |
22 | 1 file changed, 5 deletions(-) | 18 | fpu/softfloat-specialize.c.inc | 4 ---- |
19 | 2 files changed, 8 insertions(+), 4 deletions(-) | ||
23 | 20 | ||
24 | diff --git a/hw/arm/virt.c b/hw/arm/virt.c | 21 | diff --git a/target/hppa/fpu_helper.c b/target/hppa/fpu_helper.c |
25 | index XXXXXXX..XXXXXXX 100644 | 22 | index XXXXXXX..XXXXXXX 100644 |
26 | --- a/hw/arm/virt.c | 23 | --- a/target/hppa/fpu_helper.c |
27 | +++ b/hw/arm/virt.c | 24 | +++ b/target/hppa/fpu_helper.c |
28 | @@ -XXX,XX +XXX,XX @@ static void machvirt_init(MachineState *machine) | 25 | @@ -XXX,XX +XXX,XX @@ void HELPER(loaded_fr0)(CPUHPPAState *env) |
26 | * HPPA does note implement a CPU reset method at all... | ||
27 | */ | ||
28 | set_float_2nan_prop_rule(float_2nan_prop_s_ab, &env->fp_status); | ||
29 | + /* | ||
30 | + * TODO: The HPPA architecture reference only documents its NaN | ||
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. | ||
35 | + */ | ||
36 | + set_float_3nan_prop_rule(float_3nan_prop_abc, &env->fp_status); | ||
37 | /* For inf * 0 + NaN, return the input NaN */ | ||
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, | ||
45 | } | ||
29 | } | 46 | } |
30 | 47 | ||
31 | if (vms->secure) { | 48 | - if (rule == float_3nan_prop_none) { |
32 | - if (kvm_enabled()) { | 49 | - rule = float_3nan_prop_abc; |
33 | - error_report("mach-virt: KVM does not support Security extensions"); | 50 | - } |
34 | - exit(1); | ||
35 | - } | ||
36 | - | 51 | - |
37 | /* | 52 | assert(rule != float_3nan_prop_none); |
38 | * The Secure view of the world is the same as the NonSecure, | 53 | if (have_snan && (rule & R_3NAN_SNAN_MASK)) { |
39 | * but with a few extra devices. Create it as a container region | 54 | /* We have at least one SNaN input and should prefer it */ |
40 | -- | 55 | -- |
41 | 2.20.1 | 56 | 2.34.1 |
42 | |||
43 | diff view generated by jsdifflib |
1 | Convert the ACPI NVDIMM spec document to rST. | 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. | ||
2 | 6 | ||
3 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
4 | Reviewed-by: Igor Mammedov <imammedo@redhat.com> | 8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
5 | Message-id: 20210727170414.3368-5-peter.maydell@linaro.org | 9 | Message-id: 20241202131347.498124-27-peter.maydell@linaro.org |
6 | --- | 10 | --- |
7 | docs/specs/acpi_nvdimm.rst | 228 +++++++++++++++++++++++++++++++++++++ | 11 | include/fpu/softfloat-helpers.h | 5 ----- |
8 | docs/specs/acpi_nvdimm.txt | 188 ------------------------------ | 12 | include/fpu/softfloat-types.h | 1 - |
9 | docs/specs/index.rst | 1 + | 13 | target/xtensa/fpu_helper.c | 1 - |
10 | 3 files changed, 229 insertions(+), 188 deletions(-) | 14 | 3 files changed, 7 deletions(-) |
11 | create mode 100644 docs/specs/acpi_nvdimm.rst | ||
12 | delete mode 100644 docs/specs/acpi_nvdimm.txt | ||
13 | 15 | ||
14 | diff --git a/docs/specs/acpi_nvdimm.rst b/docs/specs/acpi_nvdimm.rst | 16 | diff --git a/include/fpu/softfloat-helpers.h b/include/fpu/softfloat-helpers.h |
15 | new file mode 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
16 | index XXXXXXX..XXXXXXX | 18 | --- a/include/fpu/softfloat-helpers.h |
17 | --- /dev/null | 19 | +++ b/include/fpu/softfloat-helpers.h |
18 | +++ b/docs/specs/acpi_nvdimm.rst | 20 | @@ -XXX,XX +XXX,XX @@ static inline void set_snan_bit_is_one(bool val, float_status *status) |
19 | @@ -XXX,XX +XXX,XX @@ | 21 | status->snan_bit_is_one = val; |
20 | +QEMU<->ACPI BIOS NVDIMM interface | 22 | } |
21 | +================================= | 23 | |
22 | + | 24 | -static inline void set_use_first_nan(bool val, float_status *status) |
23 | +QEMU supports NVDIMM via ACPI. This document describes the basic concepts of | 25 | -{ |
24 | +NVDIMM ACPI and the interface between QEMU and the ACPI BIOS. | 26 | - status->use_first_nan = val; |
25 | + | ||
26 | +NVDIMM ACPI Background | ||
27 | +---------------------- | ||
28 | + | ||
29 | +NVDIMM is introduced in ACPI 6.0 which defines an NVDIMM root device under | ||
30 | +_SB scope with a _HID of "ACPI0012". For each NVDIMM present or intended | ||
31 | +to be supported by platform, platform firmware also exposes an ACPI | ||
32 | +Namespace Device under the root device. | ||
33 | + | ||
34 | +The NVDIMM child devices under the NVDIMM root device are defined with _ADR | ||
35 | +corresponding to the NFIT device handle. The NVDIMM root device and the | ||
36 | +NVDIMM devices can have device specific methods (_DSM) to provide additional | ||
37 | +functions specific to a particular NVDIMM implementation. | ||
38 | + | ||
39 | +This is an example from ACPI 6.0, a platform contains one NVDIMM:: | ||
40 | + | ||
41 | + Scope (\_SB){ | ||
42 | + Device (NVDR) // Root device | ||
43 | + { | ||
44 | + Name (_HID, "ACPI0012") | ||
45 | + Method (_STA) {...} | ||
46 | + Method (_FIT) {...} | ||
47 | + Method (_DSM, ...) {...} | ||
48 | + Device (NVD) | ||
49 | + { | ||
50 | + Name(_ADR, h) //where h is NFIT Device Handle for this NVDIMM | ||
51 | + Method (_DSM, ...) {...} | ||
52 | + } | ||
53 | + } | ||
54 | + } | ||
55 | + | ||
56 | +Methods supported on both NVDIMM root device and NVDIMM device | ||
57 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
58 | + | ||
59 | +_DSM (Device Specific Method) | ||
60 | + It is a control method that enables devices to provide device specific | ||
61 | + control functions that are consumed by the device driver. | ||
62 | + The NVDIMM DSM specification can be found at | ||
63 | + http://pmem.io/documents/NVDIMM_DSM_Interface_Example.pdf | ||
64 | + | ||
65 | + Arguments: | ||
66 | + | ||
67 | + Arg0 | ||
68 | + A Buffer containing a UUID (16 Bytes) | ||
69 | + Arg1 | ||
70 | + An Integer containing the Revision ID (4 Bytes) | ||
71 | + Arg2 | ||
72 | + An Integer containing the Function Index (4 Bytes) | ||
73 | + Arg3 | ||
74 | + A package containing parameters for the function specified by the | ||
75 | + UUID, Revision ID, and Function Index | ||
76 | + | ||
77 | + Return Value: | ||
78 | + | ||
79 | + If Function Index = 0, a Buffer containing a function index bitfield. | ||
80 | + Otherwise, the return value and type depends on the UUID, revision ID | ||
81 | + and function index which are described in the DSM specification. | ||
82 | + | ||
83 | +Methods on NVDIMM ROOT Device | ||
84 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
85 | + | ||
86 | +_FIT(Firmware Interface Table) | ||
87 | + It evaluates to a buffer returning data in the format of a series of NFIT | ||
88 | + Type Structure. | ||
89 | + | ||
90 | + Arguments: None | ||
91 | + | ||
92 | + Return Value: | ||
93 | + A Buffer containing a list of NFIT Type structure entries. | ||
94 | + | ||
95 | + The detailed definition of the structure can be found at ACPI 6.0: 5.2.25 | ||
96 | + NVDIMM Firmware Interface Table (NFIT). | ||
97 | + | ||
98 | +QEMU NVDIMM Implementation | ||
99 | +-------------------------- | ||
100 | + | ||
101 | +QEMU uses 4 bytes IO Port starting from 0x0a18 and a RAM-based memory page | ||
102 | +for NVDIMM ACPI. | ||
103 | + | ||
104 | +Memory: | ||
105 | + QEMU uses BIOS Linker/loader feature to ask BIOS to allocate a memory | ||
106 | + page and dynamically patch its address into an int32 object named "MEMA" | ||
107 | + in ACPI. | ||
108 | + | ||
109 | + This page is RAM-based and it is used to transfer data between _DSM | ||
110 | + method and QEMU. If ACPI has control, this pages is owned by ACPI which | ||
111 | + writes _DSM input data to it, otherwise, it is owned by QEMU which | ||
112 | + emulates _DSM access and writes the output data to it. | ||
113 | + | ||
114 | + ACPI writes _DSM Input Data (based on the offset in the page): | ||
115 | + | ||
116 | + [0x0 - 0x3] | ||
117 | + 4 bytes, NVDIMM Device Handle. | ||
118 | + | ||
119 | + The handle is completely QEMU internal thing, the values in | ||
120 | + range [1, 0xFFFF] indicate nvdimm device. Other values are | ||
121 | + reserved for other purposes. | ||
122 | + | ||
123 | + Reserved handles: | ||
124 | + | ||
125 | + - 0 is reserved for nvdimm root device named NVDR. | ||
126 | + - 0x10000 is reserved for QEMU internal DSM function called on | ||
127 | + the root device. | ||
128 | + | ||
129 | + [0x4 - 0x7] | ||
130 | + 4 bytes, Revision ID, that is the Arg1 of _DSM method. | ||
131 | + | ||
132 | + [0x8 - 0xB] | ||
133 | + 4 bytes. Function Index, that is the Arg2 of _DSM method. | ||
134 | + | ||
135 | + [0xC - 0xFFF] | ||
136 | + 4084 bytes, the Arg3 of _DSM method. | ||
137 | + | ||
138 | + QEMU writes Output Data (based on the offset in the page): | ||
139 | + | ||
140 | + [0x0 - 0x3] | ||
141 | + 4 bytes, the length of result | ||
142 | + | ||
143 | + [0x4 - 0xFFF] | ||
144 | + 4092 bytes, the DSM result filled by QEMU | ||
145 | + | ||
146 | +IO Port 0x0a18 - 0xa1b: | ||
147 | + ACPI writes the address of the memory page allocated by BIOS to this | ||
148 | + port then QEMU gets the control and fills the result in the memory page. | ||
149 | + | ||
150 | + Write Access: | ||
151 | + | ||
152 | + [0x0a18 - 0xa1b] | ||
153 | + 4 bytes, the address of the memory page allocated by BIOS. | ||
154 | + | ||
155 | +_DSM process diagram | ||
156 | +-------------------- | ||
157 | + | ||
158 | +"MEMA" indicates the address of memory page allocated by BIOS. | ||
159 | + | ||
160 | +:: | ||
161 | + | ||
162 | + +----------------------+ +-----------------------+ | ||
163 | + | 1. OSPM | | 2. OSPM | | ||
164 | + | save _DSM input data | | write "MEMA" to | Exit to QEMU | ||
165 | + | to the page +----->| IO port 0x0a18 +------------+ | ||
166 | + | indicated by "MEMA" | | | | | ||
167 | + +----------------------+ +-----------------------+ | | ||
168 | + | | ||
169 | + v | ||
170 | + +--------------------+ +-----------+ +------------------+--------+ | ||
171 | + | 5 QEMU | | 4 QEMU | | 3. QEMU | | ||
172 | + | write _DSM result | | emulate | | get _DSM input data from | | ||
173 | + | to the page +<------+ _DSM +<-----+ the page indicated by the | | ||
174 | + | | | | | value from the IO port | | ||
175 | + +--------+-----------+ +-----------+ +---------------------------+ | ||
176 | + | | ||
177 | + | Enter Guest | ||
178 | + | | ||
179 | + v | ||
180 | + +--------------------------+ +--------------+ | ||
181 | + | 6 OSPM | | 7 OSPM | | ||
182 | + | result size is returned | | _DSM return | | ||
183 | + | by reading DSM +----->+ | | ||
184 | + | result from the page | | | | ||
185 | + +--------------------------+ +--------------+ | ||
186 | + | ||
187 | +NVDIMM hotplug | ||
188 | +-------------- | ||
189 | + | ||
190 | +ACPI BIOS GPE.4 handler is dedicated for notifying OS about nvdimm device | ||
191 | +hot-add event. | ||
192 | + | ||
193 | +QEMU internal use only _DSM functions | ||
194 | +------------------------------------- | ||
195 | + | ||
196 | +Read FIT | ||
197 | +^^^^^^^^ | ||
198 | + | ||
199 | +_FIT method uses _DSM method to fetch NFIT structures blob from QEMU | ||
200 | +in 1 page sized increments which are then concatenated and returned | ||
201 | +as _FIT method result. | ||
202 | + | ||
203 | +Input parameters: | ||
204 | + | ||
205 | +Arg0 | ||
206 | + UUID {set to 648B9CF2-CDA1-4312-8AD9-49C4AF32BD62} | ||
207 | +Arg1 | ||
208 | + Revision ID (set to 1) | ||
209 | +Arg2 | ||
210 | + Function Index, 0x1 | ||
211 | +Arg3 | ||
212 | + A package containing a buffer whose layout is as follows: | ||
213 | + | ||
214 | + +----------+--------+--------+-------------------------------------------+ | ||
215 | + | Field | Length | Offset | Description | | ||
216 | + +----------+--------+--------+-------------------------------------------+ | ||
217 | + | offset | 4 | 0 | offset in QEMU's NFIT structures blob to | | ||
218 | + | | | | read from | | ||
219 | + +----------+--------+--------+-------------------------------------------+ | ||
220 | + | ||
221 | +Output layout in the dsm memory page: | ||
222 | + | ||
223 | + +----------+--------+--------+-------------------------------------------+ | ||
224 | + | Field | Length | Offset | Description | | ||
225 | + +----------+--------+--------+-------------------------------------------+ | ||
226 | + | length | 4 | 0 | length of entire returned data | | ||
227 | + | | | | (including this header) | | ||
228 | + +----------+--------+--------+-------------------------------------------+ | ||
229 | + | | | | return status codes | | ||
230 | + | | | | | | ||
231 | + | | | | - 0x0 - success | | ||
232 | + | | | | - 0x100 - error caused by NFIT update | | ||
233 | + | status | 4 | 4 | while read by _FIT wasn't completed | | ||
234 | + | | | | - other codes follow Chapter 3 in | | ||
235 | + | | | | DSM Spec Rev1 | | ||
236 | + +----------+--------+--------+-------------------------------------------+ | ||
237 | + | fit data | Varies | 8 | contains FIT data. This field is present | | ||
238 | + | | | | if status field is 0. | | ||
239 | + +----------+--------+--------+-------------------------------------------+ | ||
240 | + | ||
241 | +The FIT offset is maintained by the OSPM itself, current offset plus | ||
242 | +the size of the fit data returned by the function is the next offset | ||
243 | +OSPM should read. When all FIT data has been read out, zero fit data | ||
244 | +size is returned. | ||
245 | + | ||
246 | +If it returns status code 0x100, OSPM should restart to read FIT (read | ||
247 | +from offset 0 again). | ||
248 | diff --git a/docs/specs/acpi_nvdimm.txt b/docs/specs/acpi_nvdimm.txt | ||
249 | deleted file mode 100644 | ||
250 | index XXXXXXX..XXXXXXX | ||
251 | --- a/docs/specs/acpi_nvdimm.txt | ||
252 | +++ /dev/null | ||
253 | @@ -XXX,XX +XXX,XX @@ | ||
254 | -QEMU<->ACPI BIOS NVDIMM interface | ||
255 | ---------------------------------- | ||
256 | - | ||
257 | -QEMU supports NVDIMM via ACPI. This document describes the basic concepts of | ||
258 | -NVDIMM ACPI and the interface between QEMU and the ACPI BIOS. | ||
259 | - | ||
260 | -NVDIMM ACPI Background | ||
261 | ----------------------- | ||
262 | -NVDIMM is introduced in ACPI 6.0 which defines an NVDIMM root device under | ||
263 | -_SB scope with a _HID of “ACPI0012”. For each NVDIMM present or intended | ||
264 | -to be supported by platform, platform firmware also exposes an ACPI | ||
265 | -Namespace Device under the root device. | ||
266 | - | ||
267 | -The NVDIMM child devices under the NVDIMM root device are defined with _ADR | ||
268 | -corresponding to the NFIT device handle. The NVDIMM root device and the | ||
269 | -NVDIMM devices can have device specific methods (_DSM) to provide additional | ||
270 | -functions specific to a particular NVDIMM implementation. | ||
271 | - | ||
272 | -This is an example from ACPI 6.0, a platform contains one NVDIMM: | ||
273 | - | ||
274 | -Scope (\_SB){ | ||
275 | - Device (NVDR) // Root device | ||
276 | - { | ||
277 | - Name (_HID, “ACPI0012”) | ||
278 | - Method (_STA) {...} | ||
279 | - Method (_FIT) {...} | ||
280 | - Method (_DSM, ...) {...} | ||
281 | - Device (NVD) | ||
282 | - { | ||
283 | - Name(_ADR, h) //where h is NFIT Device Handle for this NVDIMM | ||
284 | - Method (_DSM, ...) {...} | ||
285 | - } | ||
286 | - } | ||
287 | -} | 27 | -} |
288 | - | 28 | - |
289 | -Method supported on both NVDIMM root device and NVDIMM device | 29 | static inline void set_no_signaling_nans(bool val, float_status *status) |
290 | -_DSM (Device Specific Method) | 30 | { |
291 | - It is a control method that enables devices to provide device specific | 31 | status->no_signaling_nans = val; |
292 | - control functions that are consumed by the device driver. | 32 | diff --git a/include/fpu/softfloat-types.h b/include/fpu/softfloat-types.h |
293 | - The NVDIMM DSM specification can be found at: | ||
294 | - http://pmem.io/documents/NVDIMM_DSM_Interface_Example.pdf | ||
295 | - | ||
296 | - Arguments: | ||
297 | - Arg0 – A Buffer containing a UUID (16 Bytes) | ||
298 | - Arg1 – An Integer containing the Revision ID (4 Bytes) | ||
299 | - Arg2 – An Integer containing the Function Index (4 Bytes) | ||
300 | - Arg3 – A package containing parameters for the function specified by the | ||
301 | - UUID, Revision ID, and Function Index | ||
302 | - | ||
303 | - Return Value: | ||
304 | - If Function Index = 0, a Buffer containing a function index bitfield. | ||
305 | - Otherwise, the return value and type depends on the UUID, revision ID | ||
306 | - and function index which are described in the DSM specification. | ||
307 | - | ||
308 | -Methods on NVDIMM ROOT Device | ||
309 | -_FIT(Firmware Interface Table) | ||
310 | - It evaluates to a buffer returning data in the format of a series of NFIT | ||
311 | - Type Structure. | ||
312 | - | ||
313 | - Arguments: None | ||
314 | - | ||
315 | - Return Value: | ||
316 | - A Buffer containing a list of NFIT Type structure entries. | ||
317 | - | ||
318 | - The detailed definition of the structure can be found at ACPI 6.0: 5.2.25 | ||
319 | - NVDIMM Firmware Interface Table (NFIT). | ||
320 | - | ||
321 | -QEMU NVDIMM Implementation | ||
322 | -========================== | ||
323 | -QEMU uses 4 bytes IO Port starting from 0x0a18 and a RAM-based memory page | ||
324 | -for NVDIMM ACPI. | ||
325 | - | ||
326 | -Memory: | ||
327 | - QEMU uses BIOS Linker/loader feature to ask BIOS to allocate a memory | ||
328 | - page and dynamically patch its address into an int32 object named "MEMA" | ||
329 | - in ACPI. | ||
330 | - | ||
331 | - This page is RAM-based and it is used to transfer data between _DSM | ||
332 | - method and QEMU. If ACPI has control, this pages is owned by ACPI which | ||
333 | - writes _DSM input data to it, otherwise, it is owned by QEMU which | ||
334 | - emulates _DSM access and writes the output data to it. | ||
335 | - | ||
336 | - ACPI writes _DSM Input Data (based on the offset in the page): | ||
337 | - [0x0 - 0x3]: 4 bytes, NVDIMM Device Handle. | ||
338 | - | ||
339 | - The handle is completely QEMU internal thing, the values in | ||
340 | - range [1, 0xFFFF] indicate nvdimm device. Other values are | ||
341 | - reserved for other purposes. | ||
342 | - | ||
343 | - Reserved handles: | ||
344 | - 0 is reserved for nvdimm root device named NVDR. | ||
345 | - 0x10000 is reserved for QEMU internal DSM function called on | ||
346 | - the root device. | ||
347 | - | ||
348 | - [0x4 - 0x7]: 4 bytes, Revision ID, that is the Arg1 of _DSM method. | ||
349 | - [0x8 - 0xB]: 4 bytes. Function Index, that is the Arg2 of _DSM method. | ||
350 | - [0xC - 0xFFF]: 4084 bytes, the Arg3 of _DSM method. | ||
351 | - | ||
352 | - QEMU Writes Output Data (based on the offset in the page): | ||
353 | - [0x0 - 0x3]: 4 bytes, the length of result | ||
354 | - [0x4 - 0xFFF]: 4092 bytes, the DSM result filled by QEMU | ||
355 | - | ||
356 | -IO Port 0x0a18 - 0xa1b: | ||
357 | - ACPI writes the address of the memory page allocated by BIOS to this | ||
358 | - port then QEMU gets the control and fills the result in the memory page. | ||
359 | - | ||
360 | - write Access: | ||
361 | - [0x0a18 - 0xa1b]: 4 bytes, the address of the memory page allocated | ||
362 | - by BIOS. | ||
363 | - | ||
364 | -_DSM process diagram: | ||
365 | ---------------------- | ||
366 | -"MEMA" indicates the address of memory page allocated by BIOS. | ||
367 | - | ||
368 | - +----------------------+ +-----------------------+ | ||
369 | - | 1. OSPM | | 2. OSPM | | ||
370 | - | save _DSM input data | | write "MEMA" to | Exit to QEMU | ||
371 | - | to the page +----->| IO port 0x0a18 +------------+ | ||
372 | - | indicated by "MEMA" | | | | | ||
373 | - +----------------------+ +-----------------------+ | | ||
374 | - | | ||
375 | - v | ||
376 | - +------------- ----+ +-----------+ +------------------+--------+ | ||
377 | - | 5 QEMU | | 4 QEMU | | 3. QEMU | | ||
378 | - | write _DSM result | | emulate | | get _DSM input data from | | ||
379 | - | to the page +<------+ _DSM +<-----+ the page indicated by the | | ||
380 | - | | | | | value from the IO port | | ||
381 | - +--------+-----------+ +-----------+ +---------------------------+ | ||
382 | - | | ||
383 | - | Enter Guest | ||
384 | - | | ||
385 | - v | ||
386 | - +--------------------------+ +--------------+ | ||
387 | - | 6 OSPM | | 7 OSPM | | ||
388 | - | result size is returned | | _DSM return | | ||
389 | - | by reading DSM +----->+ | | ||
390 | - | result from the page | | | | ||
391 | - +--------------------------+ +--------------+ | ||
392 | - | ||
393 | -NVDIMM hotplug | ||
394 | --------------- | ||
395 | -ACPI BIOS GPE.4 handler is dedicated for notifying OS about nvdimm device | ||
396 | -hot-add event. | ||
397 | - | ||
398 | -QEMU internal use only _DSM function | ||
399 | ------------------------------------- | ||
400 | -1) Read FIT | ||
401 | - _FIT method uses _DSM method to fetch NFIT structures blob from QEMU | ||
402 | - in 1 page sized increments which are then concatenated and returned | ||
403 | - as _FIT method result. | ||
404 | - | ||
405 | - Input parameters: | ||
406 | - Arg0 – UUID {set to 648B9CF2-CDA1-4312-8AD9-49C4AF32BD62} | ||
407 | - Arg1 – Revision ID (set to 1) | ||
408 | - Arg2 - Function Index, 0x1 | ||
409 | - Arg3 - A package containing a buffer whose layout is as follows: | ||
410 | - | ||
411 | - +----------+--------+--------+-------------------------------------------+ | ||
412 | - | Field | Length | Offset | Description | | ||
413 | - +----------+--------+--------+-------------------------------------------+ | ||
414 | - | offset | 4 | 0 | offset in QEMU's NFIT structures blob to | | ||
415 | - | | | | read from | | ||
416 | - +----------+--------+--------+-------------------------------------------+ | ||
417 | - | ||
418 | - Output layout in the dsm memory page: | ||
419 | - +----------+--------+--------+-------------------------------------------+ | ||
420 | - | Field | Length | Offset | Description | | ||
421 | - +----------+--------+--------+-------------------------------------------+ | ||
422 | - | length | 4 | 0 | length of entire returned data | | ||
423 | - | | | | (including this header) | | ||
424 | - +----------+-----------------+-------------------------------------------+ | ||
425 | - | | | | return status codes | | ||
426 | - | | | | 0x0 - success | | ||
427 | - | | | | 0x100 - error caused by NFIT update while | | ||
428 | - | status | 4 | 4 | read by _FIT wasn't completed, other | | ||
429 | - | | | | codes follow Chapter 3 in DSM Spec Rev1 | | ||
430 | - +----------+-----------------+-------------------------------------------+ | ||
431 | - | fit data | Varies | 8 | contains FIT data, this field is present | | ||
432 | - | | | | if status field is 0; | | ||
433 | - +----------+--------+--------+-------------------------------------------+ | ||
434 | - | ||
435 | - The FIT offset is maintained by the OSPM itself, current offset plus | ||
436 | - the size of the fit data returned by the function is the next offset | ||
437 | - OSPM should read. When all FIT data has been read out, zero fit data | ||
438 | - size is returned. | ||
439 | - | ||
440 | - If it returns status code 0x100, OSPM should restart to read FIT (read | ||
441 | - from offset 0 again). | ||
442 | diff --git a/docs/specs/index.rst b/docs/specs/index.rst | ||
443 | index XXXXXXX..XXXXXXX 100644 | 33 | index XXXXXXX..XXXXXXX 100644 |
444 | --- a/docs/specs/index.rst | 34 | --- a/include/fpu/softfloat-types.h |
445 | +++ b/docs/specs/index.rst | 35 | +++ b/include/fpu/softfloat-types.h |
446 | @@ -XXX,XX +XXX,XX @@ guest hardware that is specific to QEMU. | 36 | @@ -XXX,XX +XXX,XX @@ typedef struct float_status { |
447 | acpi_cpu_hotplug | 37 | * softfloat-specialize.inc.c) |
448 | acpi_mem_hotplug | 38 | */ |
449 | acpi_pci_hotplug | 39 | bool snan_bit_is_one; |
450 | + acpi_nvdimm | 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, | ||
451 | -- | 56 | -- |
452 | 2.20.1 | 57 | 2.34.1 |
453 | |||
454 | 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 | Currently we rely on all the callsites of cpsr_write() to rebuild the | 1 | In the helper functions flcmps and flcmpd we use a scratch float_status |
---|---|---|---|
2 | cached hflags if they change one of the CPSR bits which we use as a | 2 | so that we don't change the CPU state if the comparison raises any |
3 | TB flag and cache in hflags. This is a bit awkward when we want to | 3 | floating point exception flags. Instead of zero-initializing this |
4 | change the set of CPSR bits that we cache, because it means we need | 4 | scratch float_status, initialize it as a copy of env->fp_status. This |
5 | to re-audit all the cpsr_write() callsites to see which flags they | 5 | avoids the need to explicitly initialize settings like the NaN |
6 | are writing and whether they now need to rebuild the hflags. | 6 | propagation rule or others we might add to softfloat in future. |
7 | 7 | ||
8 | Switch instead to making cpsr_write() call arm_rebuild_hflags() | 8 | To do this we need to pass the CPU env pointer in to the helper. |
9 | itself if one of the bits being changed is a cached bit. | ||
10 | |||
11 | We don't do the rebuild for the CPSRWriteRaw write type, because that | ||
12 | kind of write is generally doing something special anyway. For the | ||
13 | CPSRWriteRaw callsites in the KVM code and inbound migration we | ||
14 | definitely don't want to recalculate the hflags; the callsites in | ||
15 | boot.c and arm-powerctl.c have to do a rebuild-hflags call themselves | ||
16 | anyway because of other CPU state changes they make. | ||
17 | |||
18 | This allows us to drop explicit arm_rebuild_hflags() calls in a | ||
19 | couple of places where the only reason we needed to call it was the | ||
20 | CPSR write. | ||
21 | |||
22 | This fixes a bug where we were incorrectly failing to rebuild hflags | ||
23 | in the code path for a gdbstub write to CPSR, which meant that you | ||
24 | could make QEMU assert by breaking into a running guest, altering the | ||
25 | CPSR to change the value of, for example, CPSR.E, and then | ||
26 | continuing. | ||
27 | 9 | ||
28 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
29 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 11 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
30 | Message-id: 20210817201843.3829-1-peter.maydell@linaro.org | 12 | Message-id: 20241202131347.498124-33-peter.maydell@linaro.org |
31 | --- | 13 | --- |
32 | target/arm/cpu.h | 10 ++++++++-- | 14 | target/sparc/helper.h | 4 ++-- |
33 | linux-user/arm/signal.c | 2 -- | 15 | target/sparc/fop_helper.c | 8 ++++---- |
34 | target/arm/helper.c | 5 +++++ | 16 | target/sparc/translate.c | 4 ++-- |
35 | 3 files changed, 13 insertions(+), 4 deletions(-) | 17 | 3 files changed, 8 insertions(+), 8 deletions(-) |
36 | 18 | ||
37 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | 19 | diff --git a/target/sparc/helper.h b/target/sparc/helper.h |
38 | index XXXXXXX..XXXXXXX 100644 | 20 | index XXXXXXX..XXXXXXX 100644 |
39 | --- a/target/arm/cpu.h | 21 | --- a/target/sparc/helper.h |
40 | +++ b/target/arm/cpu.h | 22 | +++ b/target/sparc/helper.h |
41 | @@ -XXX,XX +XXX,XX @@ uint32_t cpsr_read(CPUARMState *env); | 23 | @@ -XXX,XX +XXX,XX @@ DEF_HELPER_FLAGS_3(fcmpd, TCG_CALL_NO_WG, i32, env, f64, f64) |
42 | typedef enum CPSRWriteType { | 24 | DEF_HELPER_FLAGS_3(fcmped, TCG_CALL_NO_WG, i32, env, f64, f64) |
43 | CPSRWriteByInstr = 0, /* from guest MSR or CPS */ | 25 | DEF_HELPER_FLAGS_3(fcmpq, TCG_CALL_NO_WG, i32, env, i128, i128) |
44 | CPSRWriteExceptionReturn = 1, /* from guest exception return insn */ | 26 | DEF_HELPER_FLAGS_3(fcmpeq, TCG_CALL_NO_WG, i32, env, i128, i128) |
45 | - CPSRWriteRaw = 2, /* trust values, do not switch reg banks */ | 27 | -DEF_HELPER_FLAGS_2(flcmps, TCG_CALL_NO_RWG_SE, i32, f32, f32) |
46 | + CPSRWriteRaw = 2, | 28 | -DEF_HELPER_FLAGS_2(flcmpd, TCG_CALL_NO_RWG_SE, i32, f64, f64) |
47 | + /* trust values, no reg bank switch, no hflags rebuild */ | 29 | +DEF_HELPER_FLAGS_3(flcmps, TCG_CALL_NO_RWG_SE, i32, env, f32, f32) |
48 | CPSRWriteByGDBStub = 3, /* from the GDB stub */ | 30 | +DEF_HELPER_FLAGS_3(flcmpd, TCG_CALL_NO_RWG_SE, i32, env, f64, f64) |
49 | } CPSRWriteType; | 31 | DEF_HELPER_2(raise_exception, noreturn, env, int) |
50 | 32 | ||
51 | -/* Set the CPSR. Note that some bits of mask must be all-set or all-clear.*/ | 33 | DEF_HELPER_FLAGS_3(faddd, TCG_CALL_NO_WG, f64, env, f64, f64) |
52 | +/* | 34 | diff --git a/target/sparc/fop_helper.c b/target/sparc/fop_helper.c |
53 | + * Set the CPSR. Note that some bits of mask must be all-set or all-clear. | ||
54 | + * This will do an arm_rebuild_hflags() if any of the bits in @mask | ||
55 | + * correspond to TB flags bits cached in the hflags, unless @write_type | ||
56 | + * is CPSRWriteRaw. | ||
57 | + */ | ||
58 | void cpsr_write(CPUARMState *env, uint32_t val, uint32_t mask, | ||
59 | CPSRWriteType write_type); | ||
60 | |||
61 | diff --git a/linux-user/arm/signal.c b/linux-user/arm/signal.c | ||
62 | index XXXXXXX..XXXXXXX 100644 | 35 | index XXXXXXX..XXXXXXX 100644 |
63 | --- a/linux-user/arm/signal.c | 36 | --- a/target/sparc/fop_helper.c |
64 | +++ b/linux-user/arm/signal.c | 37 | +++ b/target/sparc/fop_helper.c |
65 | @@ -XXX,XX +XXX,XX @@ setup_return(CPUARMState *env, struct target_sigaction *ka, | 38 | @@ -XXX,XX +XXX,XX @@ uint32_t helper_fcmpeq(CPUSPARCState *env, Int128 src1, Int128 src2) |
66 | env->regs[14] = retcode; | 39 | return finish_fcmp(env, r, GETPC()); |
67 | env->regs[15] = handler & (thumb ? ~1 : ~3); | ||
68 | cpsr_write(env, cpsr, CPSR_IT | CPSR_T | CPSR_E, CPSRWriteByInstr); | ||
69 | - arm_rebuild_hflags(env); | ||
70 | |||
71 | return 0; | ||
72 | } | 40 | } |
73 | @@ -XXX,XX +XXX,XX @@ restore_sigcontext(CPUARMState *env, struct target_sigcontext *sc) | 41 | |
74 | __get_user(env->regs[15], &sc->arm_pc); | 42 | -uint32_t helper_flcmps(float32 src1, float32 src2) |
75 | __get_user(cpsr, &sc->arm_cpsr); | 43 | +uint32_t helper_flcmps(CPUSPARCState *env, float32 src1, float32 src2) |
76 | cpsr_write(env, cpsr, CPSR_USER | CPSR_EXEC, CPSRWriteByInstr); | 44 | { |
77 | - arm_rebuild_hflags(env); | 45 | /* |
78 | 46 | * FLCMP never raises an exception nor modifies any FSR fields. | |
79 | err |= !valid_user_regs(env); | 47 | * Perform the comparison with a dummy fp environment. |
80 | 48 | */ | |
81 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 49 | - float_status discard = { }; |
50 | + float_status discard = env->fp_status; | ||
51 | FloatRelation r; | ||
52 | |||
53 | set_float_2nan_prop_rule(float_2nan_prop_s_ba, &discard); | ||
54 | @@ -XXX,XX +XXX,XX @@ uint32_t helper_flcmps(float32 src1, float32 src2) | ||
55 | g_assert_not_reached(); | ||
56 | } | ||
57 | |||
58 | -uint32_t helper_flcmpd(float64 src1, float64 src2) | ||
59 | +uint32_t helper_flcmpd(CPUSPARCState *env, float64 src1, float64 src2) | ||
60 | { | ||
61 | - float_status discard = { }; | ||
62 | + float_status discard = env->fp_status; | ||
63 | FloatRelation r; | ||
64 | |||
65 | set_float_2nan_prop_rule(float_2nan_prop_s_ba, &discard); | ||
66 | diff --git a/target/sparc/translate.c b/target/sparc/translate.c | ||
82 | index XXXXXXX..XXXXXXX 100644 | 67 | index XXXXXXX..XXXXXXX 100644 |
83 | --- a/target/arm/helper.c | 68 | --- a/target/sparc/translate.c |
84 | +++ b/target/arm/helper.c | 69 | +++ b/target/sparc/translate.c |
85 | @@ -XXX,XX +XXX,XX @@ void cpsr_write(CPUARMState *env, uint32_t val, uint32_t mask, | 70 | @@ -XXX,XX +XXX,XX @@ static bool trans_FLCMPs(DisasContext *dc, arg_FLCMPs *a) |
86 | CPSRWriteType write_type) | 71 | |
87 | { | 72 | src1 = gen_load_fpr_F(dc, a->rs1); |
88 | uint32_t changed_daif; | 73 | src2 = gen_load_fpr_F(dc, a->rs2); |
89 | + bool rebuild_hflags = (write_type != CPSRWriteRaw) && | 74 | - gen_helper_flcmps(cpu_fcc[a->cc], src1, src2); |
90 | + (mask & (CPSR_M | CPSR_E | CPSR_IL)); | 75 | + gen_helper_flcmps(cpu_fcc[a->cc], tcg_env, src1, src2); |
91 | 76 | return advance_pc(dc); | |
92 | if (mask & CPSR_NZCV) { | ||
93 | env->ZF = (~val) & CPSR_Z; | ||
94 | @@ -XXX,XX +XXX,XX @@ void cpsr_write(CPUARMState *env, uint32_t val, uint32_t mask, | ||
95 | } | ||
96 | mask &= ~CACHED_CPSR_BITS; | ||
97 | env->uncached_cpsr = (env->uncached_cpsr & ~mask) | (val & mask); | ||
98 | + if (rebuild_hflags) { | ||
99 | + arm_rebuild_hflags(env); | ||
100 | + } | ||
101 | } | 77 | } |
102 | 78 | ||
103 | /* Sign/zero extend */ | 79 | @@ -XXX,XX +XXX,XX @@ static bool trans_FLCMPd(DisasContext *dc, arg_FLCMPd *a) |
80 | |||
81 | src1 = gen_load_fpr_D(dc, a->rs1); | ||
82 | src2 = gen_load_fpr_D(dc, a->rs2); | ||
83 | - gen_helper_flcmpd(cpu_fcc[a->cc], src1, src2); | ||
84 | + gen_helper_flcmpd(cpu_fcc[a->cc], tcg_env, src1, src2); | ||
85 | return advance_pc(dc); | ||
86 | } | ||
87 | |||
104 | -- | 88 | -- |
105 | 2.20.1 | 89 | 2.34.1 |
106 | |||
107 | 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: Tong Ho <tong.ho@xilinx.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Add unimplemented APU mmio region to xlnx-versal for booting | 3 | Now that float_status has a bunch of fp parameters, |
4 | bare-metal guests built with standalone bsp, which access the | 4 | it is easier to copy an existing structure than create |
5 | region from one of the following places: | 5 | one from scratch. Begin by copying the structure that |
6 | https://github.com/Xilinx/embeddedsw/blob/release-2020.2/lib/bsp/standalone/src/arm/ARMv8/64bit/armclang/boot.S#L139 | 6 | corresponds to the FPSR and make only the adjustments |
7 | https://github.com/Xilinx/embeddedsw/blob/release-2020.2/lib/bsp/standalone/src/arm/ARMv8/64bit/gcc/boot.S#L183 | 7 | required for BFloat16 semantics. |
8 | 8 | ||
9 | Acked-by: Alistair Francis <alistair.francis@wdc.com> | 9 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
10 | Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | 10 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
11 | Signed-off-by: Tong Ho <tong.ho@xilinx.com> | 11 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
12 | Message-id: 20210823173818.201259-2-tong.ho@xilinx.com | 12 | Message-id: 20241203203949.483774-2-richard.henderson@linaro.org |
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
14 | --- | 14 | --- |
15 | include/hw/arm/xlnx-versal.h | 2 ++ | 15 | target/arm/tcg/vec_helper.c | 20 +++++++------------- |
16 | hw/arm/xlnx-versal.c | 2 ++ | 16 | 1 file changed, 7 insertions(+), 13 deletions(-) |
17 | 2 files changed, 4 insertions(+) | ||
18 | 17 | ||
19 | diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h | 18 | diff --git a/target/arm/tcg/vec_helper.c b/target/arm/tcg/vec_helper.c |
20 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/include/hw/arm/xlnx-versal.h | 20 | --- a/target/arm/tcg/vec_helper.c |
22 | +++ b/include/hw/arm/xlnx-versal.h | 21 | +++ b/target/arm/tcg/vec_helper.c |
23 | @@ -XXX,XX +XXX,XX @@ struct Versal { | 22 | @@ -XXX,XX +XXX,XX @@ bool is_ebf(CPUARMState *env, float_status *statusp, float_status *oddstatusp) |
24 | #define MM_IOU_SCNTRS_SIZE 0x10000 | 23 | * no effect on AArch32 instructions. |
25 | #define MM_FPD_CRF 0xfd1a0000U | 24 | */ |
26 | #define MM_FPD_CRF_SIZE 0x140000 | 25 | bool ebf = is_a64(env) && env->vfp.fpcr & FPCR_EBF; |
27 | +#define MM_FPD_FPD_APU 0xfd5c0000 | 26 | - *statusp = (float_status){ |
28 | +#define MM_FPD_FPD_APU_SIZE 0x100 | 27 | - .tininess_before_rounding = float_tininess_before_rounding, |
29 | 28 | - .float_rounding_mode = float_round_to_odd_inf, | |
30 | #define MM_PMC_SD0 0xf1040000U | 29 | - .flush_to_zero = true, |
31 | #define MM_PMC_SD0_SIZE 0x10000 | 30 | - .flush_inputs_to_zero = true, |
32 | diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c | 31 | - .default_nan_mode = true, |
33 | index XXXXXXX..XXXXXXX 100644 | 32 | - }; |
34 | --- a/hw/arm/xlnx-versal.c | 33 | + |
35 | +++ b/hw/arm/xlnx-versal.c | 34 | + *statusp = env->vfp.fp_status; |
36 | @@ -XXX,XX +XXX,XX @@ static void versal_unimp(Versal *s) | 35 | + set_default_nan_mode(true, statusp); |
37 | MM_CRL, MM_CRL_SIZE); | 36 | |
38 | versal_unimp_area(s, "crf", &s->mr_ps, | 37 | if (ebf) { |
39 | MM_FPD_CRF, MM_FPD_CRF_SIZE); | 38 | - float_status *fpst = &env->vfp.fp_status; |
40 | + versal_unimp_area(s, "apu", &s->mr_ps, | 39 | - set_flush_to_zero(get_flush_to_zero(fpst), statusp); |
41 | + MM_FPD_FPD_APU, MM_FPD_FPD_APU_SIZE); | 40 | - set_flush_inputs_to_zero(get_flush_inputs_to_zero(fpst), statusp); |
42 | versal_unimp_area(s, "crp", &s->mr_ps, | 41 | - set_float_rounding_mode(get_float_rounding_mode(fpst), statusp); |
43 | MM_PMC_CRP, MM_PMC_CRP_SIZE); | 42 | - |
44 | versal_unimp_area(s, "iou-scntr", &s->mr_ps, | 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 | } | ||
54 | |||
45 | -- | 55 | -- |
46 | 2.20.1 | 56 | 2.34.1 |
47 | 57 | ||
48 | 58 | diff view generated by jsdifflib |
1 | In v7A, the HSTR register has a TJDBX bit which traps NS EL0/EL1 | 1 | Currently we hardcode the default NaN value in parts64_default_nan() |
---|---|---|---|
2 | access to the JOSCR and JMCR trivial Jazelle registers, and also BXJ. | 2 | using a compile-time ifdef ladder. This is awkward for two cases: |
3 | Implement these traps. In v8A this HSTR bit doesn't exist, so don't | 3 | * for single-QEMU-binary we can't hard-code target-specifics like this |
4 | trap for v8A CPUs. | 4 | * for Arm FEAT_AFP the default NaN value depends on FPCR.AH |
5 | (specifically the sign bit is different) | ||
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. | ||
5 | 14 | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 16 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
8 | Message-id: 20210816180305.20137-3-peter.maydell@linaro.org | 17 | Message-id: 20241202131347.498124-35-peter.maydell@linaro.org |
9 | --- | 18 | --- |
10 | target/arm/cpu.h | 1 + | 19 | include/fpu/softfloat-helpers.h | 11 +++++++ |
11 | target/arm/helper.h | 2 ++ | 20 | include/fpu/softfloat-types.h | 10 ++++++ |
12 | target/arm/syndrome.h | 7 +++++++ | 21 | fpu/softfloat-specialize.c.inc | 55 ++++++++++++++++++++------------- |
13 | target/arm/helper.c | 17 +++++++++++++++++ | 22 | 3 files changed, 54 insertions(+), 22 deletions(-) |
14 | target/arm/op_helper.c | 16 ++++++++++++++++ | ||
15 | target/arm/translate.c | 12 ++++++++++++ | ||
16 | 6 files changed, 55 insertions(+) | ||
17 | 23 | ||
18 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | 24 | diff --git a/include/fpu/softfloat-helpers.h b/include/fpu/softfloat-helpers.h |
19 | index XXXXXXX..XXXXXXX 100644 | 25 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/target/arm/cpu.h | 26 | --- a/include/fpu/softfloat-helpers.h |
21 | +++ b/target/arm/cpu.h | 27 | +++ b/include/fpu/softfloat-helpers.h |
22 | @@ -XXX,XX +XXX,XX @@ static inline void xpsr_write(CPUARMState *env, uint32_t val, uint32_t mask) | 28 | @@ -XXX,XX +XXX,XX @@ static inline void set_float_infzeronan_rule(FloatInfZeroNaNRule rule, |
23 | #define SCR_ATA (1U << 26) | 29 | status->float_infzeronan_rule = rule; |
24 | |||
25 | #define HSTR_TTEE (1 << 16) | ||
26 | +#define HSTR_TJDBX (1 << 17) | ||
27 | |||
28 | /* Return the current FPSCR value. */ | ||
29 | uint32_t vfp_get_fpscr(CPUARMState *env); | ||
30 | diff --git a/target/arm/helper.h b/target/arm/helper.h | ||
31 | index XXXXXXX..XXXXXXX 100644 | ||
32 | --- a/target/arm/helper.h | ||
33 | +++ b/target/arm/helper.h | ||
34 | @@ -XXX,XX +XXX,XX @@ DEF_HELPER_2(v7m_vlldm, void, env, i32) | ||
35 | |||
36 | DEF_HELPER_2(v8m_stackcheck, void, env, i32) | ||
37 | |||
38 | +DEF_HELPER_FLAGS_2(check_bxj_trap, TCG_CALL_NO_WG, void, env, i32) | ||
39 | + | ||
40 | DEF_HELPER_4(access_check_cp_reg, void, env, ptr, i32, i32) | ||
41 | DEF_HELPER_3(set_cp_reg, void, env, ptr, i32) | ||
42 | DEF_HELPER_2(get_cp_reg, i32, env, ptr) | ||
43 | diff --git a/target/arm/syndrome.h b/target/arm/syndrome.h | ||
44 | index XXXXXXX..XXXXXXX 100644 | ||
45 | --- a/target/arm/syndrome.h | ||
46 | +++ b/target/arm/syndrome.h | ||
47 | @@ -XXX,XX +XXX,XX @@ enum arm_exception_class { | ||
48 | EC_ADVSIMDFPACCESSTRAP = 0x07, | ||
49 | EC_FPIDTRAP = 0x08, | ||
50 | EC_PACTRAP = 0x09, | ||
51 | + EC_BXJTRAP = 0x0a, | ||
52 | EC_CP14RRTTRAP = 0x0c, | ||
53 | EC_BTITRAP = 0x0d, | ||
54 | EC_ILLEGALSTATE = 0x0e, | ||
55 | @@ -XXX,XX +XXX,XX @@ static inline uint32_t syn_btitrap(int btype) | ||
56 | return (EC_BTITRAP << ARM_EL_EC_SHIFT) | btype; | ||
57 | } | 30 | } |
58 | 31 | ||
59 | +static inline uint32_t syn_bxjtrap(int cv, int cond, int rm) | 32 | +static inline void set_float_default_nan_pattern(uint8_t dnan_pattern, |
33 | + float_status *status) | ||
60 | +{ | 34 | +{ |
61 | + return (EC_BXJTRAP << ARM_EL_EC_SHIFT) | ARM_EL_IL | | 35 | + status->default_nan_pattern = dnan_pattern; |
62 | + (cv << 24) | (cond << 20) | rm; | ||
63 | +} | 36 | +} |
64 | + | 37 | + |
65 | static inline uint32_t syn_insn_abort(int same_el, int ea, int s1ptw, int fsc) | 38 | static inline void set_flush_to_zero(bool val, float_status *status) |
66 | { | 39 | { |
67 | return (EC_INSNABORT << ARM_EL_EC_SHIFT) | (same_el << ARM_EL_EC_SHIFT) | 40 | status->flush_to_zero = val; |
68 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 41 | @@ -XXX,XX +XXX,XX @@ static inline FloatInfZeroNaNRule get_float_infzeronan_rule(float_status *status |
69 | index XXXXXXX..XXXXXXX 100644 | 42 | return status->float_infzeronan_rule; |
70 | --- a/target/arm/helper.c | ||
71 | +++ b/target/arm/helper.c | ||
72 | @@ -XXX,XX +XXX,XX @@ static CPAccessResult access_jazelle(CPUARMState *env, const ARMCPRegInfo *ri, | ||
73 | return CP_ACCESS_OK; | ||
74 | } | 43 | } |
75 | 44 | ||
76 | +static CPAccessResult access_joscr_jmcr(CPUARMState *env, | 45 | +static inline uint8_t get_float_default_nan_pattern(float_status *status) |
77 | + const ARMCPRegInfo *ri, bool isread) | ||
78 | +{ | 46 | +{ |
79 | + /* | 47 | + return status->default_nan_pattern; |
80 | + * HSTR.TJDBX traps JOSCR and JMCR accesses, but it exists only | ||
81 | + * in v7A, not in v8A. | ||
82 | + */ | ||
83 | + if (!arm_feature(env, ARM_FEATURE_V8) && | ||
84 | + arm_current_el(env) < 2 && !arm_is_secure_below_el3(env) && | ||
85 | + (env->cp15.hstr_el2 & HSTR_TJDBX)) { | ||
86 | + return CP_ACCESS_TRAP_EL2; | ||
87 | + } | ||
88 | + return CP_ACCESS_OK; | ||
89 | +} | 48 | +} |
90 | + | 49 | + |
91 | static const ARMCPRegInfo jazelle_regs[] = { | 50 | static inline bool get_flush_to_zero(float_status *status) |
92 | { .name = "JIDR", | 51 | { |
93 | .cp = 14, .crn = 0, .crm = 0, .opc1 = 7, .opc2 = 0, | 52 | return status->flush_to_zero; |
94 | @@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo jazelle_regs[] = { | 53 | diff --git a/include/fpu/softfloat-types.h b/include/fpu/softfloat-types.h |
95 | .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
96 | { .name = "JOSCR", | ||
97 | .cp = 14, .crn = 1, .crm = 0, .opc1 = 7, .opc2 = 0, | ||
98 | + .accessfn = access_joscr_jmcr, | ||
99 | .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
100 | { .name = "JMCR", | ||
101 | .cp = 14, .crn = 2, .crm = 0, .opc1 = 7, .opc2 = 0, | ||
102 | + .accessfn = access_joscr_jmcr, | ||
103 | .access = PL1_RW, .type = ARM_CP_CONST, .resetvalue = 0 }, | ||
104 | REGINFO_SENTINEL | ||
105 | }; | ||
106 | diff --git a/target/arm/op_helper.c b/target/arm/op_helper.c | ||
107 | index XXXXXXX..XXXXXXX 100644 | 54 | index XXXXXXX..XXXXXXX 100644 |
108 | --- a/target/arm/op_helper.c | 55 | --- a/include/fpu/softfloat-types.h |
109 | +++ b/target/arm/op_helper.c | 56 | +++ b/include/fpu/softfloat-types.h |
110 | @@ -XXX,XX +XXX,XX @@ void HELPER(setend)(CPUARMState *env) | 57 | @@ -XXX,XX +XXX,XX @@ typedef struct float_status { |
111 | arm_rebuild_hflags(env); | 58 | /* should denormalised inputs go to zero and set the input_denormal flag? */ |
112 | } | 59 | bool flush_inputs_to_zero; |
113 | 60 | bool default_nan_mode; | |
114 | +void HELPER(check_bxj_trap)(CPUARMState *env, uint32_t rm) | ||
115 | +{ | ||
116 | + /* | 61 | + /* |
117 | + * Only called if in NS EL0 or EL1 for a BXJ for a v7A CPU; | 62 | + * The pattern to use for the default NaN. Here the high bit specifies |
118 | + * check if HSTR.TJDBX means we need to trap to EL2. | 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. | ||
119 | + */ | 69 | + */ |
120 | + if (env->cp15.hstr_el2 & HSTR_TJDBX) { | 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 | + /* | 121 | + /* |
122 | + * We know the condition code check passed, so take the IMPDEF | 122 | + * This case is true for Alpha, ARM, MIPS, OpenRISC, PPC, RISC-V, |
123 | + * choice to always report CV=1 COND 0xe | 123 | + * S390, SH4, TriCore, and Xtensa. Our other supported targets |
124 | + * do not have floating-point. | ||
124 | + */ | 125 | + */ |
125 | + uint32_t syn = syn_bxjtrap(1, 0xe, rm); | 126 | + if (snan_bit_is_one(status)) { |
126 | + raise_exception_ra(env, EXCP_HYP_TRAP, syn, 2, GETPC()); | 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 | ||
127 | + } | 134 | + } |
128 | +} | 135 | + assert(dnan_pattern != 0); |
129 | + | 136 | + |
130 | #ifndef CONFIG_USER_ONLY | 137 | + sign = dnan_pattern >> 7; |
131 | /* Function checks whether WFx (WFI/WFE) instructions are set up to be trapped. | ||
132 | * The function returns the target EL (1-3) if the instruction is to be trapped; | ||
133 | diff --git a/target/arm/translate.c b/target/arm/translate.c | ||
134 | index XXXXXXX..XXXXXXX 100644 | ||
135 | --- a/target/arm/translate.c | ||
136 | +++ b/target/arm/translate.c | ||
137 | @@ -XXX,XX +XXX,XX @@ static bool trans_BXJ(DisasContext *s, arg_BXJ *a) | ||
138 | if (!ENABLE_ARCH_5J || arm_dc_feature(s, ARM_FEATURE_M)) { | ||
139 | return false; | ||
140 | } | ||
141 | + /* | 138 | + /* |
142 | + * v7A allows BXJ to be trapped via HSTR.TJDBX. We don't waste a | 139 | + * Place default_nan_pattern [6:0] into bits [62:56], |
143 | + * TBFLAGS bit on a basically-never-happens case, so call a helper | 140 | + * and replecate bit [0] down into [55:0] |
144 | + * function to check for the trap and raise the exception if needed | ||
145 | + * (passing it the register number for the syndrome value). | ||
146 | + * v8A doesn't have this HSTR bit. | ||
147 | + */ | 141 | + */ |
148 | + if (!arm_dc_feature(s, ARM_FEATURE_V8) && | 142 | + frac = deposit64(0, DECOMPOSED_BINARY_POINT - 7, 7, dnan_pattern); |
149 | + arm_dc_feature(s, ARM_FEATURE_EL2) && | 143 | + frac = deposit64(frac, 0, DECOMPOSED_BINARY_POINT - 7, -(dnan_pattern & 1)); |
150 | + s->current_el < 2 && s->ns) { | 144 | |
151 | + gen_helper_check_bxj_trap(cpu_env, tcg_constant_i32(a->rm)); | 145 | *p = (FloatParts64) { |
152 | + } | 146 | .cls = float_class_qnan, |
153 | /* Trivial implementation equivalent to bx. */ | ||
154 | gen_bx(s, load_reg(s, a->rm)); | ||
155 | return true; | ||
156 | -- | 147 | -- |
157 | 2.20.1 | 148 | 2.34.1 |
158 | |||
159 | 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 |
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-37-peter.maydell@linaro.org | ||
7 | --- | ||
8 | target/microblaze/cpu.c | 2 ++ | ||
9 | fpu/softfloat-specialize.c.inc | 3 +-- | ||
10 | 2 files changed, 3 insertions(+), 2 deletions(-) | ||
11 | |||
12 | diff --git a/target/microblaze/cpu.c b/target/microblaze/cpu.c | ||
13 | index XXXXXXX..XXXXXXX 100644 | ||
14 | --- a/target/microblaze/cpu.c | ||
15 | +++ b/target/microblaze/cpu.c | ||
16 | @@ -XXX,XX +XXX,XX @@ static void mb_cpu_reset_hold(Object *obj, ResetType type) | ||
17 | * this architecture. | ||
18 | */ | ||
19 | set_float_2nan_prop_rule(float_2nan_prop_x87, &env->fp_status); | ||
20 | + /* Default NaN: sign bit set, most significant frac bit set */ | ||
21 | + set_float_default_nan_pattern(0b11000000, &env->fp_status); | ||
22 | |||
23 | #if defined(CONFIG_USER_ONLY) | ||
24 | /* start in user mode with interrupts enabled. */ | ||
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_I386) || defined(TARGET_X86_64) \ | ||
34 | - || defined(TARGET_MICROBLAZE) | ||
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 | -- | ||
40 | 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-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 |
1 | The SoC realize can fail for legitimate reasons, because it propagates | 1 | Set the default NaN pattern explicitly for the alpha target. |
---|---|---|---|
2 | errors up from CPU realize, which in turn can be provoked by user | ||
3 | error in setting commandline options. Use error_fatal so we report | ||
4 | the error message to the user and exit, rather than asserting | ||
5 | via error_abort. | ||
6 | 2 | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 3 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 4 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
9 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 5 | Message-id: 20241202131347.498124-40-peter.maydell@linaro.org |
10 | Message-id: 20210816135842.25302-2-peter.maydell@linaro.org | ||
11 | --- | 6 | --- |
12 | hw/arm/raspi.c | 2 +- | 7 | target/alpha/cpu.c | 2 ++ |
13 | 1 file changed, 1 insertion(+), 1 deletion(-) | 8 | 1 file changed, 2 insertions(+) |
14 | 9 | ||
15 | diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c | 10 | diff --git a/target/alpha/cpu.c b/target/alpha/cpu.c |
16 | index XXXXXXX..XXXXXXX 100644 | 11 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/hw/arm/raspi.c | 12 | --- a/target/alpha/cpu.c |
18 | +++ b/hw/arm/raspi.c | 13 | +++ b/target/alpha/cpu.c |
19 | @@ -XXX,XX +XXX,XX @@ static void raspi_machine_init(MachineState *machine) | 14 | @@ -XXX,XX +XXX,XX @@ static void alpha_cpu_initfn(Object *obj) |
20 | object_property_add_const_link(OBJECT(&s->soc), "ram", OBJECT(machine->ram)); | 15 | * operand in Fa. That is float_2nan_prop_ba. |
21 | object_property_set_int(OBJECT(&s->soc), "board-rev", board_rev, | 16 | */ |
22 | &error_abort); | 17 | set_float_2nan_prop_rule(float_2nan_prop_x87, &env->fp_status); |
23 | - qdev_realize(DEVICE(&s->soc), NULL, &error_abort); | 18 | + /* Default NaN: sign bit clear, msb frac bit set */ |
24 | + qdev_realize(DEVICE(&s->soc), NULL, &error_fatal); | 19 | + set_float_default_nan_pattern(0b01000000, &env->fp_status); |
25 | 20 | #if defined(CONFIG_USER_ONLY) | |
26 | /* Create and plug in the SD cards */ | 21 | env->flags = ENV_FLAG_PS_USER | ENV_FLAG_FEN; |
27 | di = drive_get_next(IF_SD); | 22 | cpu_alpha_store_fpcr(env, (uint64_t)(FPCR_INVD | FPCR_DZED | FPCR_OVFD |
28 | -- | 23 | -- |
29 | 2.20.1 | 24 | 2.34.1 |
30 | |||
31 | diff view generated by jsdifflib |
1 | Zero-initialize sockaddr_in and sockaddr_un structs that we're about | 1 | Set the default NaN pattern explicitly for the arm target. |
---|---|---|---|
2 | to fill in and pass to bind() or connect(), to ensure we don't leave | 2 | This includes setting it for the old linux-user nwfpe emulation. |
3 | possible implementation-defined extension fields as uninitialized | 3 | For nwfpe, our default doesn't match the real kernel, but we |
4 | garbage. | 4 | avoid making a behaviour change in this commit. |
5 | 5 | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Eric Blake <eblake@redhat.com> | 7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
8 | Message-id: 20210813150506.7768-5-peter.maydell@linaro.org | 8 | Message-id: 20241202131347.498124-41-peter.maydell@linaro.org |
9 | --- | 9 | --- |
10 | tests/tcg/multiarch/linux-test.c | 4 ++-- | 10 | linux-user/arm/nwfpe/fpa11.c | 5 +++++ |
11 | 1 file changed, 2 insertions(+), 2 deletions(-) | 11 | target/arm/cpu.c | 2 ++ |
12 | 2 files changed, 7 insertions(+) | ||
12 | 13 | ||
13 | diff --git a/tests/tcg/multiarch/linux-test.c b/tests/tcg/multiarch/linux-test.c | 14 | diff --git a/linux-user/arm/nwfpe/fpa11.c b/linux-user/arm/nwfpe/fpa11.c |
14 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/tests/tcg/multiarch/linux-test.c | 16 | --- a/linux-user/arm/nwfpe/fpa11.c |
16 | +++ b/tests/tcg/multiarch/linux-test.c | 17 | +++ b/linux-user/arm/nwfpe/fpa11.c |
17 | @@ -XXX,XX +XXX,XX @@ static void test_time(void) | 18 | @@ -XXX,XX +XXX,XX @@ void resetFPA11(void) |
18 | static int server_socket(void) | 19 | * this late date. |
20 | */ | ||
21 | set_float_2nan_prop_rule(float_2nan_prop_s_ab, &fpa11->fp_status); | ||
22 | + /* | ||
23 | + * Use the same default NaN value as Arm VFP. This doesn't match | ||
24 | + * the Linux kernel's nwfpe emulation, which uses an all-1s value. | ||
25 | + */ | ||
26 | + set_float_default_nan_pattern(0b01000000, &fpa11->fp_status); | ||
27 | } | ||
28 | |||
29 | void SetRoundingMode(const unsigned int opcode) | ||
30 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c | ||
31 | index XXXXXXX..XXXXXXX 100644 | ||
32 | --- a/target/arm/cpu.c | ||
33 | +++ b/target/arm/cpu.c | ||
34 | @@ -XXX,XX +XXX,XX @@ void arm_register_el_change_hook(ARMCPU *cpu, ARMELChangeHookFn *hook, | ||
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) | ||
19 | { | 41 | { |
20 | int val, fd; | 42 | @@ -XXX,XX +XXX,XX @@ static void arm_set_default_fp_behaviours(float_status *s) |
21 | - struct sockaddr_in sockaddr; | 43 | set_float_2nan_prop_rule(float_2nan_prop_s_ab, s); |
22 | + struct sockaddr_in sockaddr = {}; | 44 | set_float_3nan_prop_rule(float_3nan_prop_s_cab, s); |
23 | 45 | set_float_infzeronan_rule(float_infzeronan_dnan_if_qnan, s); | |
24 | /* server socket */ | 46 | + set_float_default_nan_pattern(0b01000000, s); |
25 | fd = chk_error(socket(PF_INET, SOCK_STREAM, 0)); | 47 | } |
26 | @@ -XXX,XX +XXX,XX @@ static int server_socket(void) | 48 | |
27 | static int client_socket(uint16_t port) | 49 | static void cp_reg_reset(gpointer key, gpointer value, gpointer opaque) |
28 | { | ||
29 | int fd; | ||
30 | - struct sockaddr_in sockaddr; | ||
31 | + struct sockaddr_in sockaddr = {}; | ||
32 | |||
33 | /* server socket */ | ||
34 | fd = chk_error(socket(PF_INET, SOCK_STREAM, 0)); | ||
35 | -- | 50 | -- |
36 | 2.20.1 | 51 | 2.34.1 |
37 | |||
38 | diff view generated by jsdifflib |
1 | Zero-initialize the sockaddr_in struct that we're about to fill in | 1 | Set the default NaN pattern explicitly for loongarch. |
---|---|---|---|
2 | and pass to bind(), to ensure we don't leave possible | ||
3 | implementation-defined extension fields as uninitialized garbage. | ||
4 | 2 | ||
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 3 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
6 | Reviewed-by: Eric Blake <eblake@redhat.com> | 4 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
7 | Reviewed-by: Corey Minyard <cminyard@mvista.com> | 5 | Message-id: 20241202131347.498124-42-peter.maydell@linaro.org |
8 | Acked-by: Thomas Huth <thuth@redhat.com> | ||
9 | Message-id: 20210813150506.7768-4-peter.maydell@linaro.org | ||
10 | --- | 6 | --- |
11 | tests/qtest/ipmi-bt-test.c | 2 +- | 7 | target/loongarch/tcg/fpu_helper.c | 2 ++ |
12 | 1 file changed, 1 insertion(+), 1 deletion(-) | 8 | 1 file changed, 2 insertions(+) |
13 | 9 | ||
14 | diff --git a/tests/qtest/ipmi-bt-test.c b/tests/qtest/ipmi-bt-test.c | 10 | diff --git a/target/loongarch/tcg/fpu_helper.c b/target/loongarch/tcg/fpu_helper.c |
15 | index XXXXXXX..XXXXXXX 100644 | 11 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/tests/qtest/ipmi-bt-test.c | 12 | --- a/target/loongarch/tcg/fpu_helper.c |
17 | +++ b/tests/qtest/ipmi-bt-test.c | 13 | +++ b/target/loongarch/tcg/fpu_helper.c |
18 | @@ -XXX,XX +XXX,XX @@ static void test_enable_irq(void) | 14 | @@ -XXX,XX +XXX,XX @@ void restore_fp_status(CPULoongArchState *env) |
19 | */ | 15 | */ |
20 | static void open_socket(void) | 16 | set_float_infzeronan_rule(float_infzeronan_dnan_never, &env->fp_status); |
21 | { | 17 | set_float_3nan_prop_rule(float_3nan_prop_s_cab, &env->fp_status); |
22 | - struct sockaddr_in myaddr; | 18 | + /* Default NaN: sign bit clear, msb frac bit set */ |
23 | + struct sockaddr_in myaddr = {}; | 19 | + set_float_default_nan_pattern(0b01000000, &env->fp_status); |
24 | socklen_t addrlen; | 20 | } |
25 | 21 | ||
26 | myaddr.sin_family = AF_INET; | 22 | int ieee_ex_to_loongarch(int xcpt) |
27 | -- | 23 | -- |
28 | 2.20.1 | 24 | 2.34.1 |
29 | |||
30 | diff view generated by jsdifflib |
1 | The realpath() function can return NULL on error, so we need to check | 1 | Set the default NaN pattern explicitly for m68k. |
---|---|---|---|
2 | for it to avoid crashing when we try to strstr() into it. | ||
3 | This can happen if we run out of memory, or if /sys/ is not mounted, | ||
4 | among other situations. | ||
5 | 2 | ||
6 | Fixes: Coverity 1459913, 1460474 | ||
7 | Fixes: ce317be98db0 ("exec: fetch the alignment of Linux devdax pmem character device nodes") | ||
8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 3 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Reviewed-by: Jingqi Liu <jingqi.liu@intel.com> | 4 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
10 | Message-id: 20210812151525.31456-1-peter.maydell@linaro.org | 5 | Message-id: 20241202131347.498124-43-peter.maydell@linaro.org |
11 | --- | 6 | --- |
12 | softmmu/physmem.c | 3 +++ | 7 | target/m68k/cpu.c | 2 ++ |
13 | 1 file changed, 3 insertions(+) | 8 | fpu/softfloat-specialize.c.inc | 2 +- |
9 | 2 files changed, 3 insertions(+), 1 deletion(-) | ||
14 | 10 | ||
15 | diff --git a/softmmu/physmem.c b/softmmu/physmem.c | 11 | diff --git a/target/m68k/cpu.c b/target/m68k/cpu.c |
16 | index XXXXXXX..XXXXXXX 100644 | 12 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/softmmu/physmem.c | 13 | --- a/target/m68k/cpu.c |
18 | +++ b/softmmu/physmem.c | 14 | +++ b/target/m68k/cpu.c |
19 | @@ -XXX,XX +XXX,XX @@ static int64_t get_file_align(int fd) | 15 | @@ -XXX,XX +XXX,XX @@ static void m68k_cpu_reset_hold(Object *obj, ResetType type) |
20 | path = g_strdup_printf("/sys/dev/char/%d:%d", | 16 | * preceding paragraph for nonsignaling NaNs. |
21 | major(st.st_rdev), minor(st.st_rdev)); | 17 | */ |
22 | rpath = realpath(path, NULL); | 18 | set_float_2nan_prop_rule(float_2nan_prop_ab, &env->fp_status); |
23 | + if (!rpath) { | 19 | + /* Default NaN: sign bit clear, all frac bits set */ |
24 | + return -errno; | 20 | + set_float_default_nan_pattern(0b01111111, &env->fp_status); |
25 | + } | 21 | |
26 | 22 | nan = floatx80_default_nan(&env->fp_status); | |
27 | rc = daxctl_new(&ctx); | 23 | for (i = 0; i < 8; i++) { |
28 | if (rc) { | 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) | ||
29 | -- | 37 | -- |
30 | 2.20.1 | 38 | 2.34.1 |
31 | |||
32 | diff view generated by jsdifflib |
1 | We added a stub for the arch_type global in commit 5964ed56d9a1 so | 1 | Set the default NaN pattern explicitly for MIPS. Note that this |
---|---|---|---|
2 | that we could compile blockdev.c into the tools. However, in commit | 2 | is our only target which currently changes the default NaN |
3 | 9db1d3a2be9bf we removed the only use of arch_type from blockdev.c. | 3 | at runtime (which it was previously doing indirectly when it |
4 | The stub is therefore no longer needed, and we can delete it again, | 4 | changed the snan_bit_is_one setting). |
5 | together with the QEMU_ARCH_NONE value that only the stub was using. | ||
6 | 5 | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
8 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
10 | Message-id: 20210730105947.28215-9-peter.maydell@linaro.org | 8 | Message-id: 20241202131347.498124-44-peter.maydell@linaro.org |
11 | --- | 9 | --- |
12 | include/sysemu/arch_init.h | 2 -- | 10 | target/mips/fpu_helper.h | 7 +++++++ |
13 | stubs/arch_type.c | 4 ---- | 11 | target/mips/msa.c | 3 +++ |
14 | stubs/meson.build | 1 - | 12 | 2 files changed, 10 insertions(+) |
15 | 3 files changed, 7 deletions(-) | ||
16 | delete mode 100644 stubs/arch_type.c | ||
17 | 13 | ||
18 | diff --git a/include/sysemu/arch_init.h b/include/sysemu/arch_init.h | 14 | diff --git a/target/mips/fpu_helper.h b/target/mips/fpu_helper.h |
19 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/include/sysemu/arch_init.h | 16 | --- a/target/mips/fpu_helper.h |
21 | +++ b/include/sysemu/arch_init.h | 17 | +++ b/target/mips/fpu_helper.h |
22 | @@ -XXX,XX +XXX,XX @@ enum { | 18 | @@ -XXX,XX +XXX,XX @@ static inline void restore_snan_bit_mode(CPUMIPSState *env) |
23 | QEMU_ARCH_RX = (1 << 20), | 19 | set_float_infzeronan_rule(izn_rule, &env->active_fpu.fp_status); |
24 | QEMU_ARCH_AVR = (1 << 21), | 20 | nan3_rule = nan2008 ? float_3nan_prop_s_cab : float_3nan_prop_s_abc; |
25 | QEMU_ARCH_HEXAGON = (1 << 22), | 21 | set_float_3nan_prop_rule(nan3_rule, &env->active_fpu.fp_status); |
26 | - | 22 | + /* |
27 | - QEMU_ARCH_NONE = (1 << 31), | 23 | + * With nan2008, the default NaN value has the sign bit clear and the |
28 | }; | 24 | + * frac msb set; with the older mode, the sign bit is clear, and all |
29 | 25 | + * frac bits except the msb are set. | |
30 | extern const uint32_t arch_type; | 26 | + */ |
31 | diff --git a/stubs/arch_type.c b/stubs/arch_type.c | 27 | + set_float_default_nan_pattern(nan2008 ? 0b01000000 : 0b00111111, |
32 | deleted file mode 100644 | 28 | + &env->active_fpu.fp_status); |
33 | index XXXXXXX..XXXXXXX | 29 | |
34 | --- a/stubs/arch_type.c | 30 | } |
35 | +++ /dev/null | 31 | |
36 | @@ -XXX,XX +XXX,XX @@ | 32 | diff --git a/target/mips/msa.c b/target/mips/msa.c |
37 | -#include "qemu/osdep.h" | ||
38 | -#include "sysemu/arch_init.h" | ||
39 | - | ||
40 | -const uint32_t arch_type = QEMU_ARCH_NONE; | ||
41 | diff --git a/stubs/meson.build b/stubs/meson.build | ||
42 | index XXXXXXX..XXXXXXX 100644 | 33 | index XXXXXXX..XXXXXXX 100644 |
43 | --- a/stubs/meson.build | 34 | --- a/target/mips/msa.c |
44 | +++ b/stubs/meson.build | 35 | +++ b/target/mips/msa.c |
45 | @@ -XXX,XX +XXX,XX @@ | 36 | @@ -XXX,XX +XXX,XX @@ void msa_reset(CPUMIPSState *env) |
46 | -stub_ss.add(files('arch_type.c')) | 37 | /* Inf * 0 + NaN returns the input NaN */ |
47 | stub_ss.add(files('bdrv-next-monitor-owned.c')) | 38 | set_float_infzeronan_rule(float_infzeronan_dnan_never, |
48 | stub_ss.add(files('blk-commit-all.c')) | 39 | &env->active_tc.msa_fp_status); |
49 | stub_ss.add(files('blk-exp-close-all.c')) | 40 | + /* Default NaN: sign bit clear, frac msb set */ |
41 | + set_float_default_nan_pattern(0b01000000, | ||
42 | + &env->active_tc.msa_fp_status); | ||
43 | } | ||
50 | -- | 44 | -- |
51 | 2.20.1 | 45 | 2.34.1 |
52 | |||
53 | diff view generated by jsdifflib |
1 | We don't currently zero-initialize the 'struct sockaddr_in' that | 1 | Set the default NaN pattern explicitly for openrisc. |
---|---|---|---|
2 | parse_host_port() fills in, so any fields we don't explicitly | ||
3 | initialize might be left as random garbage. POSIX states that | ||
4 | implementations may define extensions in sockaddr_in, and that those | ||
5 | extensions must not trigger if zero-initialized. So not zero | ||
6 | initializing might result in inadvertently triggering an impdef | ||
7 | extension. | ||
8 | 2 | ||
9 | memset() the sockaddr_in before we start to fill it in. | ||
10 | |||
11 | Fixes: Coverity CID 1005338 | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 3 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | Reviewed-by: Eric Blake <eblake@redhat.com> | 4 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
14 | Message-id: 20210813150506.7768-2-peter.maydell@linaro.org | 5 | Message-id: 20241202131347.498124-45-peter.maydell@linaro.org |
15 | --- | 6 | --- |
16 | net/net.c | 2 ++ | 7 | target/openrisc/cpu.c | 2 ++ |
17 | 1 file changed, 2 insertions(+) | 8 | 1 file changed, 2 insertions(+) |
18 | 9 | ||
19 | diff --git a/net/net.c b/net/net.c | 10 | diff --git a/target/openrisc/cpu.c b/target/openrisc/cpu.c |
20 | index XXXXXXX..XXXXXXX 100644 | 11 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/net/net.c | 12 | --- a/target/openrisc/cpu.c |
22 | +++ b/net/net.c | 13 | +++ b/target/openrisc/cpu.c |
23 | @@ -XXX,XX +XXX,XX @@ int parse_host_port(struct sockaddr_in *saddr, const char *str, | 14 | @@ -XXX,XX +XXX,XX @@ static void openrisc_cpu_reset_hold(Object *obj, ResetType type) |
24 | const char *addr, *p, *r; | 15 | */ |
25 | int port, ret = 0; | 16 | set_float_2nan_prop_rule(float_2nan_prop_x87, &cpu->env.fp_status); |
26 | 17 | ||
27 | + memset(saddr, 0, sizeof(*saddr)); | 18 | + /* Default NaN: sign bit clear, frac msb set */ |
28 | + | 19 | + set_float_default_nan_pattern(0b01000000, &cpu->env.fp_status); |
29 | substrings = g_strsplit(str, ":", 2); | 20 | |
30 | if (!substrings || !substrings[0] || !substrings[1]) { | 21 | #ifndef CONFIG_USER_ONLY |
31 | error_setg(errp, "host address '%s' doesn't contain ':' " | 22 | cpu->env.picmr = 0x00000000; |
32 | -- | 23 | -- |
33 | 2.20.1 | 24 | 2.34.1 |
34 | |||
35 | diff view generated by jsdifflib |
1 | arch_init.h only defines the QEMU_ARCH_* enumeration and the | 1 | Set the default NaN pattern explicitly for ppc. |
---|---|---|---|
2 | arch_type global. Don't include it in files that don't use those. | ||
3 | 2 | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 3 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 4 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
7 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 5 | Message-id: 20241202131347.498124-46-peter.maydell@linaro.org |
8 | Message-id: 20210730105947.28215-8-peter.maydell@linaro.org | ||
9 | --- | 6 | --- |
10 | blockdev.c | 1 - | 7 | target/ppc/cpu_init.c | 4 ++++ |
11 | hw/i386/pc.c | 1 - | 8 | 1 file changed, 4 insertions(+) |
12 | hw/i386/pc_piix.c | 1 - | ||
13 | hw/i386/pc_q35.c | 1 - | ||
14 | hw/mips/jazz.c | 1 - | ||
15 | hw/mips/malta.c | 1 - | ||
16 | hw/ppc/prep.c | 1 - | ||
17 | hw/riscv/sifive_e.c | 1 - | ||
18 | hw/riscv/sifive_u.c | 1 - | ||
19 | hw/riscv/spike.c | 1 - | ||
20 | hw/riscv/virt.c | 1 - | ||
21 | monitor/qmp-cmds.c | 1 - | ||
22 | target/ppc/cpu_init.c | 1 - | ||
23 | target/s390x/cpu-sysemu.c | 1 - | ||
24 | 14 files changed, 14 deletions(-) | ||
25 | 9 | ||
26 | diff --git a/blockdev.c b/blockdev.c | ||
27 | index XXXXXXX..XXXXXXX 100644 | ||
28 | --- a/blockdev.c | ||
29 | +++ b/blockdev.c | ||
30 | @@ -XXX,XX +XXX,XX @@ | ||
31 | #include "sysemu/iothread.h" | ||
32 | #include "block/block_int.h" | ||
33 | #include "block/trace.h" | ||
34 | -#include "sysemu/arch_init.h" | ||
35 | #include "sysemu/runstate.h" | ||
36 | #include "sysemu/replay.h" | ||
37 | #include "qemu/cutils.h" | ||
38 | diff --git a/hw/i386/pc.c b/hw/i386/pc.c | ||
39 | index XXXXXXX..XXXXXXX 100644 | ||
40 | --- a/hw/i386/pc.c | ||
41 | +++ b/hw/i386/pc.c | ||
42 | @@ -XXX,XX +XXX,XX @@ | ||
43 | #include "hw/xen/start_info.h" | ||
44 | #include "ui/qemu-spice.h" | ||
45 | #include "exec/memory.h" | ||
46 | -#include "sysemu/arch_init.h" | ||
47 | #include "qemu/bitmap.h" | ||
48 | #include "qemu/config-file.h" | ||
49 | #include "qemu/error-report.h" | ||
50 | diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c | ||
51 | index XXXXXXX..XXXXXXX 100644 | ||
52 | --- a/hw/i386/pc_piix.c | ||
53 | +++ b/hw/i386/pc_piix.c | ||
54 | @@ -XXX,XX +XXX,XX @@ | ||
55 | #include "sysemu/kvm.h" | ||
56 | #include "hw/kvm/clock.h" | ||
57 | #include "hw/sysbus.h" | ||
58 | -#include "sysemu/arch_init.h" | ||
59 | #include "hw/i2c/smbus_eeprom.h" | ||
60 | #include "hw/xen/xen-x86.h" | ||
61 | #include "exec/memory.h" | ||
62 | diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c | ||
63 | index XXXXXXX..XXXXXXX 100644 | ||
64 | --- a/hw/i386/pc_q35.c | ||
65 | +++ b/hw/i386/pc_q35.c | ||
66 | @@ -XXX,XX +XXX,XX @@ | ||
67 | #include "qemu/osdep.h" | ||
68 | #include "qemu/units.h" | ||
69 | #include "hw/loader.h" | ||
70 | -#include "sysemu/arch_init.h" | ||
71 | #include "hw/i2c/smbus_eeprom.h" | ||
72 | #include "hw/rtc/mc146818rtc.h" | ||
73 | #include "sysemu/kvm.h" | ||
74 | diff --git a/hw/mips/jazz.c b/hw/mips/jazz.c | ||
75 | index XXXXXXX..XXXXXXX 100644 | ||
76 | --- a/hw/mips/jazz.c | ||
77 | +++ b/hw/mips/jazz.c | ||
78 | @@ -XXX,XX +XXX,XX @@ | ||
79 | #include "hw/isa/isa.h" | ||
80 | #include "hw/block/fdc.h" | ||
81 | #include "sysemu/sysemu.h" | ||
82 | -#include "sysemu/arch_init.h" | ||
83 | #include "hw/boards.h" | ||
84 | #include "net/net.h" | ||
85 | #include "hw/scsi/esp.h" | ||
86 | diff --git a/hw/mips/malta.c b/hw/mips/malta.c | ||
87 | index XXXXXXX..XXXXXXX 100644 | ||
88 | --- a/hw/mips/malta.c | ||
89 | +++ b/hw/mips/malta.c | ||
90 | @@ -XXX,XX +XXX,XX @@ | ||
91 | #include "hw/mips/mips.h" | ||
92 | #include "hw/mips/cpudevs.h" | ||
93 | #include "hw/pci/pci.h" | ||
94 | -#include "sysemu/arch_init.h" | ||
95 | #include "qemu/log.h" | ||
96 | #include "hw/mips/bios.h" | ||
97 | #include "hw/ide.h" | ||
98 | diff --git a/hw/ppc/prep.c b/hw/ppc/prep.c | ||
99 | index XXXXXXX..XXXXXXX 100644 | ||
100 | --- a/hw/ppc/prep.c | ||
101 | +++ b/hw/ppc/prep.c | ||
102 | @@ -XXX,XX +XXX,XX @@ | ||
103 | #include "hw/rtc/mc146818rtc.h" | ||
104 | #include "hw/isa/pc87312.h" | ||
105 | #include "hw/qdev-properties.h" | ||
106 | -#include "sysemu/arch_init.h" | ||
107 | #include "sysemu/kvm.h" | ||
108 | #include "sysemu/reset.h" | ||
109 | #include "trace.h" | ||
110 | diff --git a/hw/riscv/sifive_e.c b/hw/riscv/sifive_e.c | ||
111 | index XXXXXXX..XXXXXXX 100644 | ||
112 | --- a/hw/riscv/sifive_e.c | ||
113 | +++ b/hw/riscv/sifive_e.c | ||
114 | @@ -XXX,XX +XXX,XX @@ | ||
115 | #include "hw/intc/sifive_plic.h" | ||
116 | #include "hw/misc/sifive_e_prci.h" | ||
117 | #include "chardev/char.h" | ||
118 | -#include "sysemu/arch_init.h" | ||
119 | #include "sysemu/sysemu.h" | ||
120 | |||
121 | static const MemMapEntry sifive_e_memmap[] = { | ||
122 | diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c | ||
123 | index XXXXXXX..XXXXXXX 100644 | ||
124 | --- a/hw/riscv/sifive_u.c | ||
125 | +++ b/hw/riscv/sifive_u.c | ||
126 | @@ -XXX,XX +XXX,XX @@ | ||
127 | #include "hw/intc/sifive_plic.h" | ||
128 | #include "chardev/char.h" | ||
129 | #include "net/eth.h" | ||
130 | -#include "sysemu/arch_init.h" | ||
131 | #include "sysemu/device_tree.h" | ||
132 | #include "sysemu/runstate.h" | ||
133 | #include "sysemu/sysemu.h" | ||
134 | diff --git a/hw/riscv/spike.c b/hw/riscv/spike.c | ||
135 | index XXXXXXX..XXXXXXX 100644 | ||
136 | --- a/hw/riscv/spike.c | ||
137 | +++ b/hw/riscv/spike.c | ||
138 | @@ -XXX,XX +XXX,XX @@ | ||
139 | #include "hw/char/riscv_htif.h" | ||
140 | #include "hw/intc/sifive_clint.h" | ||
141 | #include "chardev/char.h" | ||
142 | -#include "sysemu/arch_init.h" | ||
143 | #include "sysemu/device_tree.h" | ||
144 | #include "sysemu/sysemu.h" | ||
145 | |||
146 | diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c | ||
147 | index XXXXXXX..XXXXXXX 100644 | ||
148 | --- a/hw/riscv/virt.c | ||
149 | +++ b/hw/riscv/virt.c | ||
150 | @@ -XXX,XX +XXX,XX @@ | ||
151 | #include "hw/intc/sifive_plic.h" | ||
152 | #include "hw/misc/sifive_test.h" | ||
153 | #include "chardev/char.h" | ||
154 | -#include "sysemu/arch_init.h" | ||
155 | #include "sysemu/device_tree.h" | ||
156 | #include "sysemu/sysemu.h" | ||
157 | #include "hw/pci/pci.h" | ||
158 | diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c | ||
159 | index XXXXXXX..XXXXXXX 100644 | ||
160 | --- a/monitor/qmp-cmds.c | ||
161 | +++ b/monitor/qmp-cmds.c | ||
162 | @@ -XXX,XX +XXX,XX @@ | ||
163 | #include "sysemu/kvm.h" | ||
164 | #include "sysemu/runstate.h" | ||
165 | #include "sysemu/runstate-action.h" | ||
166 | -#include "sysemu/arch_init.h" | ||
167 | #include "sysemu/blockdev.h" | ||
168 | #include "sysemu/block-backend.h" | ||
169 | #include "qapi/error.h" | ||
170 | diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c | 10 | diff --git a/target/ppc/cpu_init.c b/target/ppc/cpu_init.c |
171 | index XXXXXXX..XXXXXXX 100644 | 11 | index XXXXXXX..XXXXXXX 100644 |
172 | --- a/target/ppc/cpu_init.c | 12 | --- a/target/ppc/cpu_init.c |
173 | +++ b/target/ppc/cpu_init.c | 13 | +++ b/target/ppc/cpu_init.c |
174 | @@ -XXX,XX +XXX,XX @@ | 14 | @@ -XXX,XX +XXX,XX @@ static void ppc_cpu_reset_hold(Object *obj, ResetType type) |
175 | #include "disas/dis-asm.h" | 15 | set_float_infzeronan_rule(float_infzeronan_dnan_never, &env->fp_status); |
176 | #include "exec/gdbstub.h" | 16 | set_float_infzeronan_rule(float_infzeronan_dnan_never, &env->vec_status); |
177 | #include "kvm_ppc.h" | 17 | |
178 | -#include "sysemu/arch_init.h" | 18 | + /* Default NaN: sign bit clear, set frac msb */ |
179 | #include "sysemu/cpus.h" | 19 | + set_float_default_nan_pattern(0b01000000, &env->fp_status); |
180 | #include "sysemu/hw_accel.h" | 20 | + set_float_default_nan_pattern(0b01000000, &env->vec_status); |
181 | #include "sysemu/tcg.h" | 21 | + |
182 | diff --git a/target/s390x/cpu-sysemu.c b/target/s390x/cpu-sysemu.c | 22 | for (i = 0; i < ARRAY_SIZE(env->spr_cb); i++) { |
183 | index XXXXXXX..XXXXXXX 100644 | 23 | ppc_spr_t *spr = &env->spr_cb[i]; |
184 | --- a/target/s390x/cpu-sysemu.c | 24 | |
185 | +++ b/target/s390x/cpu-sysemu.c | ||
186 | @@ -XXX,XX +XXX,XX @@ | ||
187 | |||
188 | #include "hw/s390x/pv.h" | ||
189 | #include "hw/boards.h" | ||
190 | -#include "sysemu/arch_init.h" | ||
191 | #include "sysemu/sysemu.h" | ||
192 | #include "sysemu/tcg.h" | ||
193 | #include "hw/core/sysemu-cpu-ops.h" | ||
194 | -- | 25 | -- |
195 | 2.20.1 | 26 | 2.34.1 |
196 | |||
197 | diff view generated by jsdifflib |
1 | The QEMU_ARCH_VIRTIO_* defines are used only in one file, | 1 | Set the default NaN pattern explicitly for sh4. Note that sh4 |
---|---|---|---|
2 | qdev-monitor.c. Move them to that file. | 2 | is one of the only three targets (the others being HPPA and |
3 | sometimes MIPS) that has snan_bit_is_one set. | ||
3 | 4 | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
6 | Reviewed-by: Markus Armbruster <armbru@redhat.com> | 7 | Message-id: 20241202131347.498124-47-peter.maydell@linaro.org |
7 | Message-id: 20210730105947.28215-7-peter.maydell@linaro.org | ||
8 | --- | 8 | --- |
9 | include/sysemu/arch_init.h | 9 --------- | 9 | target/sh4/cpu.c | 2 ++ |
10 | softmmu/qdev-monitor.c | 9 +++++++++ | 10 | 1 file changed, 2 insertions(+) |
11 | 2 files changed, 9 insertions(+), 9 deletions(-) | ||
12 | 11 | ||
13 | diff --git a/include/sysemu/arch_init.h b/include/sysemu/arch_init.h | 12 | diff --git a/target/sh4/cpu.c b/target/sh4/cpu.c |
14 | index XXXXXXX..XXXXXXX 100644 | 13 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/include/sysemu/arch_init.h | 14 | --- a/target/sh4/cpu.c |
16 | +++ b/include/sysemu/arch_init.h | 15 | +++ b/target/sh4/cpu.c |
17 | @@ -XXX,XX +XXX,XX @@ enum { | 16 | @@ -XXX,XX +XXX,XX @@ static void superh_cpu_reset_hold(Object *obj, ResetType type) |
18 | 17 | set_flush_to_zero(1, &env->fp_status); | |
19 | extern const uint32_t arch_type; | ||
20 | |||
21 | -/* default virtio transport per architecture */ | ||
22 | -#define QEMU_ARCH_VIRTIO_PCI (QEMU_ARCH_ALPHA | QEMU_ARCH_ARM | \ | ||
23 | - QEMU_ARCH_HPPA | QEMU_ARCH_I386 | \ | ||
24 | - QEMU_ARCH_MIPS | QEMU_ARCH_PPC | \ | ||
25 | - QEMU_ARCH_RISCV | QEMU_ARCH_SH4 | \ | ||
26 | - QEMU_ARCH_SPARC | QEMU_ARCH_XTENSA) | ||
27 | -#define QEMU_ARCH_VIRTIO_CCW (QEMU_ARCH_S390X) | ||
28 | -#define QEMU_ARCH_VIRTIO_MMIO (QEMU_ARCH_M68K) | ||
29 | - | ||
30 | #endif | 18 | #endif |
31 | diff --git a/softmmu/qdev-monitor.c b/softmmu/qdev-monitor.c | 19 | set_default_nan_mode(1, &env->fp_status); |
32 | index XXXXXXX..XXXXXXX 100644 | 20 | + /* sign bit clear, set all frac bits other than msb */ |
33 | --- a/softmmu/qdev-monitor.c | 21 | + set_float_default_nan_pattern(0b00111111, &env->fp_status); |
34 | +++ b/softmmu/qdev-monitor.c | 22 | } |
35 | @@ -XXX,XX +XXX,XX @@ typedef struct QDevAlias | 23 | |
36 | uint32_t arch_mask; | 24 | static void superh_cpu_disas_set_info(CPUState *cpu, disassemble_info *info) |
37 | } QDevAlias; | ||
38 | |||
39 | +/* default virtio transport per architecture */ | ||
40 | +#define QEMU_ARCH_VIRTIO_PCI (QEMU_ARCH_ALPHA | QEMU_ARCH_ARM | \ | ||
41 | + QEMU_ARCH_HPPA | QEMU_ARCH_I386 | \ | ||
42 | + QEMU_ARCH_MIPS | QEMU_ARCH_PPC | \ | ||
43 | + QEMU_ARCH_RISCV | QEMU_ARCH_SH4 | \ | ||
44 | + QEMU_ARCH_SPARC | QEMU_ARCH_XTENSA) | ||
45 | +#define QEMU_ARCH_VIRTIO_CCW (QEMU_ARCH_S390X) | ||
46 | +#define QEMU_ARCH_VIRTIO_MMIO (QEMU_ARCH_M68K) | ||
47 | + | ||
48 | /* Please keep this table sorted by typename. */ | ||
49 | static const QDevAlias qdev_alias_table[] = { | ||
50 | { "AC97", "ac97" }, /* -soundhw name */ | ||
51 | -- | 25 | -- |
52 | 2.20.1 | 26 | 2.34.1 |
53 | |||
54 | diff view generated by jsdifflib |
1 | In v7, the HSTR register has a TTEE bit which allows EL0/EL1 accesses | 1 | Set the default NaN pattern explicitly for rx. |
---|---|---|---|
2 | to the Thumb2EE TEECR and TEEHBR registers to be trapped to the | ||
3 | hypervisor. Implement these traps. | ||
4 | 2 | ||
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 3 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 4 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
7 | Message-id: 20210816180305.20137-2-peter.maydell@linaro.org | 5 | Message-id: 20241202131347.498124-48-peter.maydell@linaro.org |
8 | --- | 6 | --- |
9 | target/arm/cpu.h | 2 ++ | 7 | target/rx/cpu.c | 2 ++ |
10 | target/arm/helper.c | 18 ++++++++++++++++-- | 8 | 1 file changed, 2 insertions(+) |
11 | 2 files changed, 18 insertions(+), 2 deletions(-) | ||
12 | 9 | ||
13 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | 10 | diff --git a/target/rx/cpu.c b/target/rx/cpu.c |
14 | index XXXXXXX..XXXXXXX 100644 | 11 | index XXXXXXX..XXXXXXX 100644 |
15 | --- a/target/arm/cpu.h | 12 | --- a/target/rx/cpu.c |
16 | +++ b/target/arm/cpu.h | 13 | +++ b/target/rx/cpu.c |
17 | @@ -XXX,XX +XXX,XX @@ static inline void xpsr_write(CPUARMState *env, uint32_t val, uint32_t mask) | 14 | @@ -XXX,XX +XXX,XX @@ static void rx_cpu_reset_hold(Object *obj, ResetType type) |
18 | #define SCR_ENSCXT (1U << 25) | 15 | * then prefer dest over source", which is float_2nan_prop_s_ab. |
19 | #define SCR_ATA (1U << 26) | 16 | */ |
20 | 17 | set_float_2nan_prop_rule(float_2nan_prop_x87, &env->fp_status); | |
21 | +#define HSTR_TTEE (1 << 16) | 18 | + /* Default NaN value: sign bit clear, set frac msb */ |
22 | + | 19 | + set_float_default_nan_pattern(0b01000000, &env->fp_status); |
23 | /* Return the current FPSCR value. */ | ||
24 | uint32_t vfp_get_fpscr(CPUARMState *env); | ||
25 | void vfp_set_fpscr(CPUARMState *env, uint32_t val); | ||
26 | diff --git a/target/arm/helper.c b/target/arm/helper.c | ||
27 | index XXXXXXX..XXXXXXX 100644 | ||
28 | --- a/target/arm/helper.c | ||
29 | +++ b/target/arm/helper.c | ||
30 | @@ -XXX,XX +XXX,XX @@ static void teecr_write(CPUARMState *env, const ARMCPRegInfo *ri, | ||
31 | env->teecr = value; | ||
32 | } | 20 | } |
33 | 21 | ||
34 | +static CPAccessResult teecr_access(CPUARMState *env, const ARMCPRegInfo *ri, | 22 | static ObjectClass *rx_cpu_class_by_name(const char *cpu_model) |
35 | + bool isread) | ||
36 | +{ | ||
37 | + /* | ||
38 | + * HSTR.TTEE only exists in v7A, not v8A, but v8A doesn't have T2EE | ||
39 | + * at all, so we don't need to check whether we're v8A. | ||
40 | + */ | ||
41 | + if (arm_current_el(env) < 2 && !arm_is_secure_below_el3(env) && | ||
42 | + (env->cp15.hstr_el2 & HSTR_TTEE)) { | ||
43 | + return CP_ACCESS_TRAP_EL2; | ||
44 | + } | ||
45 | + return CP_ACCESS_OK; | ||
46 | +} | ||
47 | + | ||
48 | static CPAccessResult teehbr_access(CPUARMState *env, const ARMCPRegInfo *ri, | ||
49 | bool isread) | ||
50 | { | ||
51 | if (arm_current_el(env) == 0 && (env->teecr & 1)) { | ||
52 | return CP_ACCESS_TRAP; | ||
53 | } | ||
54 | - return CP_ACCESS_OK; | ||
55 | + return teecr_access(env, ri, isread); | ||
56 | } | ||
57 | |||
58 | static const ARMCPRegInfo t2ee_cp_reginfo[] = { | ||
59 | { .name = "TEECR", .cp = 14, .crn = 0, .crm = 0, .opc1 = 6, .opc2 = 0, | ||
60 | .access = PL1_RW, .fieldoffset = offsetof(CPUARMState, teecr), | ||
61 | .resetvalue = 0, | ||
62 | - .writefn = teecr_write }, | ||
63 | + .writefn = teecr_write, .accessfn = teecr_access }, | ||
64 | { .name = "TEEHBR", .cp = 14, .crn = 1, .crm = 0, .opc1 = 6, .opc2 = 0, | ||
65 | .access = PL0_RW, .fieldoffset = offsetof(CPUARMState, teehbr), | ||
66 | .accessfn = teehbr_access, .resetvalue = 0 }, | ||
67 | -- | 23 | -- |
68 | 2.20.1 | 24 | 2.34.1 |
69 | |||
70 | diff view generated by jsdifflib |
1 | Instead of using an ifdef ladder in arch_init.c (which we then have | 1 | Set the default NaN pattern explicitly for s390x. |
---|---|---|---|
2 | to manually update every time we add or remove a target | ||
3 | architecture), have meson.build put "#define QEMU_ARCH QEMU_ARCH_FOO" | ||
4 | in the config-target.h file. | ||
5 | 2 | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 3 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 4 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
9 | Message-id: 20210730105947.28215-5-peter.maydell@linaro.org | 5 | Message-id: 20241202131347.498124-49-peter.maydell@linaro.org |
10 | --- | 6 | --- |
11 | meson.build | 2 ++ | 7 | target/s390x/cpu.c | 2 ++ |
12 | softmmu/arch_init.c | 41 ----------------------------------------- | 8 | 1 file changed, 2 insertions(+) |
13 | 2 files changed, 2 insertions(+), 41 deletions(-) | ||
14 | 9 | ||
15 | diff --git a/meson.build b/meson.build | 10 | diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c |
16 | index XXXXXXX..XXXXXXX 100644 | 11 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/meson.build | 12 | --- a/target/s390x/cpu.c |
18 | +++ b/meson.build | 13 | +++ b/target/s390x/cpu.c |
19 | @@ -XXX,XX +XXX,XX @@ foreach target : target_dirs | 14 | @@ -XXX,XX +XXX,XX @@ static void s390_cpu_reset_hold(Object *obj, ResetType type) |
20 | config_target_data.set(k, v) | 15 | set_float_3nan_prop_rule(float_3nan_prop_s_abc, &env->fpu_status); |
21 | endif | 16 | set_float_infzeronan_rule(float_infzeronan_dnan_always, |
22 | endforeach | 17 | &env->fpu_status); |
23 | + config_target_data.set('QEMU_ARCH', | 18 | + /* Default NaN value: sign bit clear, frac msb set */ |
24 | + 'QEMU_ARCH_' + config_target['TARGET_BASE_ARCH'].to_upper()) | 19 | + set_float_default_nan_pattern(0b01000000, &env->fpu_status); |
25 | config_target_h += {target: configure_file(output: target + '-config-target.h', | 20 | /* fall through */ |
26 | configuration: config_target_data)} | 21 | case RESET_TYPE_S390_CPU_NORMAL: |
27 | 22 | env->psw.mask &= ~PSW_MASK_RI; | |
28 | diff --git a/softmmu/arch_init.c b/softmmu/arch_init.c | ||
29 | index XXXXXXX..XXXXXXX 100644 | ||
30 | --- a/softmmu/arch_init.c | ||
31 | +++ b/softmmu/arch_init.c | ||
32 | @@ -XXX,XX +XXX,XX @@ int graphic_height = 600; | ||
33 | int graphic_depth = 32; | ||
34 | #endif | ||
35 | |||
36 | - | ||
37 | -#if defined(TARGET_ALPHA) | ||
38 | -#define QEMU_ARCH QEMU_ARCH_ALPHA | ||
39 | -#elif defined(TARGET_ARM) | ||
40 | -#define QEMU_ARCH QEMU_ARCH_ARM | ||
41 | -#elif defined(TARGET_CRIS) | ||
42 | -#define QEMU_ARCH QEMU_ARCH_CRIS | ||
43 | -#elif defined(TARGET_HPPA) | ||
44 | -#define QEMU_ARCH QEMU_ARCH_HPPA | ||
45 | -#elif defined(TARGET_I386) | ||
46 | -#define QEMU_ARCH QEMU_ARCH_I386 | ||
47 | -#elif defined(TARGET_M68K) | ||
48 | -#define QEMU_ARCH QEMU_ARCH_M68K | ||
49 | -#elif defined(TARGET_MICROBLAZE) | ||
50 | -#define QEMU_ARCH QEMU_ARCH_MICROBLAZE | ||
51 | -#elif defined(TARGET_MIPS) | ||
52 | -#define QEMU_ARCH QEMU_ARCH_MIPS | ||
53 | -#elif defined(TARGET_NIOS2) | ||
54 | -#define QEMU_ARCH QEMU_ARCH_NIOS2 | ||
55 | -#elif defined(TARGET_OPENRISC) | ||
56 | -#define QEMU_ARCH QEMU_ARCH_OPENRISC | ||
57 | -#elif defined(TARGET_PPC) | ||
58 | -#define QEMU_ARCH QEMU_ARCH_PPC | ||
59 | -#elif defined(TARGET_RISCV) | ||
60 | -#define QEMU_ARCH QEMU_ARCH_RISCV | ||
61 | -#elif defined(TARGET_RX) | ||
62 | -#define QEMU_ARCH QEMU_ARCH_RX | ||
63 | -#elif defined(TARGET_S390X) | ||
64 | -#define QEMU_ARCH QEMU_ARCH_S390X | ||
65 | -#elif defined(TARGET_SH4) | ||
66 | -#define QEMU_ARCH QEMU_ARCH_SH4 | ||
67 | -#elif defined(TARGET_SPARC) | ||
68 | -#define QEMU_ARCH QEMU_ARCH_SPARC | ||
69 | -#elif defined(TARGET_TRICORE) | ||
70 | -#define QEMU_ARCH QEMU_ARCH_TRICORE | ||
71 | -#elif defined(TARGET_XTENSA) | ||
72 | -#define QEMU_ARCH QEMU_ARCH_XTENSA | ||
73 | -#elif defined(TARGET_AVR) | ||
74 | -#define QEMU_ARCH QEMU_ARCH_AVR | ||
75 | -#endif | ||
76 | - | ||
77 | const uint32_t arch_type = QEMU_ARCH; | ||
78 | -- | 23 | -- |
79 | 2.20.1 | 24 | 2.34.1 |
80 | |||
81 | diff view generated by jsdifflib |
1 | arch_init.c does very little but has a long list of #include lines. | 1 | Set the default NaN pattern explicitly for SPARC, and remove |
---|---|---|---|
2 | Remove all the unnecessary ones. | 2 | the ifdef from parts64_default_nan. |
3 | 3 | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 5 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
6 | Message-id: 20210730105947.28215-4-peter.maydell@linaro.org | 6 | Message-id: 20241202131347.498124-50-peter.maydell@linaro.org |
7 | --- | 7 | --- |
8 | softmmu/arch_init.c | 7 ------- | 8 | target/sparc/cpu.c | 2 ++ |
9 | 1 file changed, 7 deletions(-) | 9 | fpu/softfloat-specialize.c.inc | 5 +---- |
10 | 2 files changed, 3 insertions(+), 4 deletions(-) | ||
10 | 11 | ||
11 | diff --git a/softmmu/arch_init.c b/softmmu/arch_init.c | 12 | diff --git a/target/sparc/cpu.c b/target/sparc/cpu.c |
12 | index XXXXXXX..XXXXXXX 100644 | 13 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/softmmu/arch_init.c | 14 | --- a/target/sparc/cpu.c |
14 | +++ b/softmmu/arch_init.c | 15 | +++ b/target/sparc/cpu.c |
15 | @@ -XXX,XX +XXX,XX @@ | 16 | @@ -XXX,XX +XXX,XX @@ static void sparc_cpu_realizefn(DeviceState *dev, Error **errp) |
16 | */ | 17 | set_float_3nan_prop_rule(float_3nan_prop_s_cba, &env->fp_status); |
17 | #include "qemu/osdep.h" | 18 | /* For inf * 0 + NaN, return the input NaN */ |
18 | #include "sysemu/arch_init.h" | 19 | set_float_infzeronan_rule(float_infzeronan_dnan_never, &env->fp_status); |
19 | -#include "hw/pci/pci.h" | 20 | + /* Default NaN value: sign bit clear, all frac bits set */ |
20 | -#include "hw/audio/soundhw.h" | 21 | + set_float_default_nan_pattern(0b01111111, &env->fp_status); |
21 | -#include "qapi/error.h" | 22 | |
22 | -#include "qemu/config-file.h" | 23 | cpu_exec_realizefn(cs, &local_err); |
23 | -#include "qemu/error-report.h" | 24 | if (local_err != NULL) { |
24 | -#include "hw/acpi/acpi.h" | 25 | diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc |
25 | -#include "qemu/help_option.h" | 26 | index XXXXXXX..XXXXXXX 100644 |
26 | 27 | --- a/fpu/softfloat-specialize.c.inc | |
27 | #ifdef TARGET_SPARC | 28 | +++ b/fpu/softfloat-specialize.c.inc |
28 | int graphic_width = 1024; | 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 | ||
29 | -- | 41 | -- |
30 | 2.20.1 | 42 | 2.34.1 |
31 | |||
32 | diff view generated by jsdifflib |
1 | Zero-initialize sockaddr_in and sockaddr_un structs that we're about | 1 | Set the default NaN pattern explicitly for xtensa. |
---|---|---|---|
2 | to fill in and pass to bind() or connect(), to ensure we don't leave | ||
3 | possible implementation-defined extension fields as uninitialized | ||
4 | garbage. | ||
5 | 2 | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 3 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Eric Blake <eblake@redhat.com> | 4 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
8 | Message-id: 20210813150506.7768-3-peter.maydell@linaro.org | 5 | Message-id: 20241202131347.498124-51-peter.maydell@linaro.org |
9 | --- | 6 | --- |
10 | gdbstub.c | 4 ++-- | 7 | target/xtensa/cpu.c | 2 ++ |
11 | 1 file changed, 2 insertions(+), 2 deletions(-) | 8 | 1 file changed, 2 insertions(+) |
12 | 9 | ||
13 | diff --git a/gdbstub.c b/gdbstub.c | 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/gdbstub.c | 12 | --- a/target/xtensa/cpu.c |
16 | +++ b/gdbstub.c | 13 | +++ b/target/xtensa/cpu.c |
17 | @@ -XXX,XX +XXX,XX @@ static bool gdb_accept_socket(int gdb_fd) | 14 | @@ -XXX,XX +XXX,XX @@ static void xtensa_cpu_reset_hold(Object *obj, ResetType type) |
18 | 15 | /* For inf * 0 + NaN, return the input NaN */ | |
19 | static int gdbserver_open_socket(const char *path) | 16 | set_float_infzeronan_rule(float_infzeronan_dnan_never, &env->fp_status); |
20 | { | 17 | set_no_signaling_nans(!dfpu, &env->fp_status); |
21 | - struct sockaddr_un sockaddr; | 18 | + /* Default NaN value: sign bit clear, set frac msb */ |
22 | + struct sockaddr_un sockaddr = {}; | 19 | + set_float_default_nan_pattern(0b01000000, &env->fp_status); |
23 | int fd, ret; | 20 | xtensa_use_first_nan(env, !dfpu); |
24 | 21 | } | |
25 | fd = socket(AF_UNIX, SOCK_STREAM, 0); | ||
26 | @@ -XXX,XX +XXX,XX @@ static int gdbserver_open_socket(const char *path) | ||
27 | |||
28 | static bool gdb_accept_tcp(int gdb_fd) | ||
29 | { | ||
30 | - struct sockaddr_in sockaddr; | ||
31 | + struct sockaddr_in sockaddr = {}; | ||
32 | socklen_t len; | ||
33 | int fd; | ||
34 | 22 | ||
35 | -- | 23 | -- |
36 | 2.20.1 | 24 | 2.34.1 |
37 | |||
38 | diff view generated by jsdifflib |
1 | The kvm_available() function reports whether KVM support was | 1 | Set the default NaN pattern explicitly for hexagon. |
---|---|---|---|
2 | compiled into the QEMU binary; it returns the value of the | 2 | Remove the ifdef from parts64_default_nan(); the only |
3 | CONFIG_KVM define. | 3 | remaining unconverted targets all use the default case. |
4 | |||
5 | The only place in the codebase where we use this function is | ||
6 | in qmp_query_kvm(). Now that accelerators are based on QOM | ||
7 | classes we can instead use accel_find("kvm") and remove the | ||
8 | kvm_available() function. | ||
9 | 4 | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
12 | Message-id: 20210730105947.28215-3-peter.maydell@linaro.org | 7 | Message-id: 20241202131347.498124-52-peter.maydell@linaro.org |
13 | --- | 8 | --- |
14 | include/sysemu/arch_init.h | 2 -- | 9 | target/hexagon/cpu.c | 2 ++ |
15 | monitor/qmp-cmds.c | 2 +- | 10 | fpu/softfloat-specialize.c.inc | 5 ----- |
16 | softmmu/arch_init.c | 9 --------- | 11 | 2 files changed, 2 insertions(+), 5 deletions(-) |
17 | 3 files changed, 1 insertion(+), 12 deletions(-) | ||
18 | 12 | ||
19 | diff --git a/include/sysemu/arch_init.h b/include/sysemu/arch_init.h | 13 | diff --git a/target/hexagon/cpu.c b/target/hexagon/cpu.c |
20 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/include/sysemu/arch_init.h | 15 | --- a/target/hexagon/cpu.c |
22 | +++ b/include/sysemu/arch_init.h | 16 | +++ b/target/hexagon/cpu.c |
23 | @@ -XXX,XX +XXX,XX @@ enum { | 17 | @@ -XXX,XX +XXX,XX @@ static void hexagon_cpu_reset_hold(Object *obj, ResetType type) |
24 | 18 | ||
25 | extern const uint32_t arch_type; | 19 | set_default_nan_mode(1, &env->fp_status); |
26 | 20 | set_float_detect_tininess(float_tininess_before_rounding, &env->fp_status); | |
27 | -int kvm_available(void); | 21 | + /* Default NaN value: sign bit set, all frac bits set */ |
28 | - | 22 | + set_float_default_nan_pattern(0b11111111, &env->fp_status); |
29 | /* default virtio transport per architecture */ | 23 | } |
30 | #define QEMU_ARCH_VIRTIO_PCI (QEMU_ARCH_ALPHA | QEMU_ARCH_ARM | \ | 24 | |
31 | QEMU_ARCH_HPPA | QEMU_ARCH_I386 | \ | 25 | static void hexagon_cpu_disas_set_info(CPUState *s, disassemble_info *info) |
32 | diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c | 26 | diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc |
33 | index XXXXXXX..XXXXXXX 100644 | 27 | index XXXXXXX..XXXXXXX 100644 |
34 | --- a/monitor/qmp-cmds.c | 28 | --- a/fpu/softfloat-specialize.c.inc |
35 | +++ b/monitor/qmp-cmds.c | 29 | +++ b/fpu/softfloat-specialize.c.inc |
36 | @@ -XXX,XX +XXX,XX @@ KvmInfo *qmp_query_kvm(Error **errp) | 30 | @@ -XXX,XX +XXX,XX @@ static void parts64_default_nan(FloatParts64 *p, float_status *status) |
37 | KvmInfo *info = g_malloc0(sizeof(*info)); | 31 | uint8_t dnan_pattern = status->default_nan_pattern; |
38 | 32 | ||
39 | info->enabled = kvm_enabled(); | 33 | if (dnan_pattern == 0) { |
40 | - info->present = kvm_available(); | 34 | -#if defined(TARGET_HEXAGON) |
41 | + info->present = accel_find("kvm"); | 35 | - /* Sign bit set, all frac bits set. */ |
42 | 36 | - dnan_pattern = 0b11111111; | |
43 | return info; | ||
44 | } | ||
45 | diff --git a/softmmu/arch_init.c b/softmmu/arch_init.c | ||
46 | index XXXXXXX..XXXXXXX 100644 | ||
47 | --- a/softmmu/arch_init.c | ||
48 | +++ b/softmmu/arch_init.c | ||
49 | @@ -XXX,XX +XXX,XX @@ int graphic_depth = 32; | ||
50 | #endif | ||
51 | |||
52 | const uint32_t arch_type = QEMU_ARCH; | ||
53 | - | ||
54 | -int kvm_available(void) | ||
55 | -{ | ||
56 | -#ifdef CONFIG_KVM | ||
57 | - return 1; | ||
58 | -#else | 37 | -#else |
59 | - return 0; | 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 | } | ||
60 | -#endif | 45 | -#endif |
61 | -} | 46 | } |
47 | assert(dnan_pattern != 0); | ||
48 | |||
62 | -- | 49 | -- |
63 | 2.20.1 | 50 | 2.34.1 |
64 | |||
65 | diff view generated by jsdifflib |
1 | The xen_available() function is used only to produce an error | 1 | Set the default NaN pattern explicitly for riscv. |
---|---|---|---|
2 | for some Xen-specific command line options in QEMU binaries where | ||
3 | Xen support was not compiled in: it just returns the value of | ||
4 | the CONFIG_XEN define. | ||
5 | |||
6 | Now that accelerators are QOM classes, we can check for | ||
7 | "does this binary have Xen compiled in" with accel_find("xen"), | ||
8 | and drop the xen_available() function. | ||
9 | 2 | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 3 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 4 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
12 | Message-id: 20210730105947.28215-2-peter.maydell@linaro.org | 5 | Message-id: 20241202131347.498124-53-peter.maydell@linaro.org |
13 | --- | 6 | --- |
14 | include/sysemu/arch_init.h | 1 - | 7 | target/riscv/cpu.c | 2 ++ |
15 | softmmu/arch_init.c | 9 --------- | 8 | 1 file changed, 2 insertions(+) |
16 | softmmu/vl.c | 6 +++--- | ||
17 | 3 files changed, 3 insertions(+), 13 deletions(-) | ||
18 | 9 | ||
19 | diff --git a/include/sysemu/arch_init.h b/include/sysemu/arch_init.h | 10 | diff --git a/target/riscv/cpu.c b/target/riscv/cpu.c |
20 | index XXXXXXX..XXXXXXX 100644 | 11 | index XXXXXXX..XXXXXXX 100644 |
21 | --- a/include/sysemu/arch_init.h | 12 | --- a/target/riscv/cpu.c |
22 | +++ b/include/sysemu/arch_init.h | 13 | +++ b/target/riscv/cpu.c |
23 | @@ -XXX,XX +XXX,XX @@ enum { | 14 | @@ -XXX,XX +XXX,XX @@ static void riscv_cpu_reset_hold(Object *obj, ResetType type) |
24 | extern const uint32_t arch_type; | 15 | cs->exception_index = RISCV_EXCP_NONE; |
25 | 16 | env->load_res = -1; | |
26 | int kvm_available(void); | 17 | set_default_nan_mode(1, &env->fp_status); |
27 | -int xen_available(void); | 18 | + /* Default NaN value: sign bit clear, frac msb set */ |
28 | 19 | + set_float_default_nan_pattern(0b01000000, &env->fp_status); | |
29 | /* default virtio transport per architecture */ | 20 | env->vill = true; |
30 | #define QEMU_ARCH_VIRTIO_PCI (QEMU_ARCH_ALPHA | QEMU_ARCH_ARM | \ | 21 | |
31 | diff --git a/softmmu/arch_init.c b/softmmu/arch_init.c | 22 | #ifndef CONFIG_USER_ONLY |
32 | index XXXXXXX..XXXXXXX 100644 | ||
33 | --- a/softmmu/arch_init.c | ||
34 | +++ b/softmmu/arch_init.c | ||
35 | @@ -XXX,XX +XXX,XX @@ int kvm_available(void) | ||
36 | return 0; | ||
37 | #endif | ||
38 | } | ||
39 | - | ||
40 | -int xen_available(void) | ||
41 | -{ | ||
42 | -#ifdef CONFIG_XEN | ||
43 | - return 1; | ||
44 | -#else | ||
45 | - return 0; | ||
46 | -#endif | ||
47 | -} | ||
48 | diff --git a/softmmu/vl.c b/softmmu/vl.c | ||
49 | index XXXXXXX..XXXXXXX 100644 | ||
50 | --- a/softmmu/vl.c | ||
51 | +++ b/softmmu/vl.c | ||
52 | @@ -XXX,XX +XXX,XX @@ void qemu_init(int argc, char **argv, char **envp) | ||
53 | has_defaults = 0; | ||
54 | break; | ||
55 | case QEMU_OPTION_xen_domid: | ||
56 | - if (!(xen_available())) { | ||
57 | + if (!(accel_find("xen"))) { | ||
58 | error_report("Option not supported for this target"); | ||
59 | exit(1); | ||
60 | } | ||
61 | xen_domid = atoi(optarg); | ||
62 | break; | ||
63 | case QEMU_OPTION_xen_attach: | ||
64 | - if (!(xen_available())) { | ||
65 | + if (!(accel_find("xen"))) { | ||
66 | error_report("Option not supported for this target"); | ||
67 | exit(1); | ||
68 | } | ||
69 | xen_mode = XEN_ATTACH; | ||
70 | break; | ||
71 | case QEMU_OPTION_xen_domid_restrict: | ||
72 | - if (!(xen_available())) { | ||
73 | + if (!(accel_find("xen"))) { | ||
74 | error_report("Option not supported for this target"); | ||
75 | exit(1); | ||
76 | } | ||
77 | -- | 23 | -- |
78 | 2.20.1 | 24 | 2.34.1 |
79 | |||
80 | diff view generated by jsdifflib |
1 | Convert the PCI hotplug spec document to rST. | 1 | Set the default NaN pattern explicitly for tricore. |
---|---|---|---|
2 | 2 | ||
3 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 3 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
4 | Reviewed-by: Igor Mammedov <imammedo@redhat.com> | 4 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
5 | Message-id: 20241202131347.498124-54-peter.maydell@linaro.org | ||
5 | --- | 6 | --- |
6 | ...i_pci_hotplug.txt => acpi_pci_hotplug.rst} | 37 ++++++++++--------- | 7 | target/tricore/helper.c | 2 ++ |
7 | docs/specs/index.rst | 1 + | 8 | 1 file changed, 2 insertions(+) |
8 | 2 files changed, 21 insertions(+), 17 deletions(-) | ||
9 | rename docs/specs/{acpi_pci_hotplug.txt => acpi_pci_hotplug.rst} (51%) | ||
10 | 9 | ||
11 | diff --git a/docs/specs/acpi_pci_hotplug.txt b/docs/specs/acpi_pci_hotplug.rst | 10 | diff --git a/target/tricore/helper.c b/target/tricore/helper.c |
12 | similarity index 51% | ||
13 | rename from docs/specs/acpi_pci_hotplug.txt | ||
14 | rename to docs/specs/acpi_pci_hotplug.rst | ||
15 | index XXXXXXX..XXXXXXX 100644 | 11 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/docs/specs/acpi_pci_hotplug.txt | 12 | --- a/target/tricore/helper.c |
17 | +++ b/docs/specs/acpi_pci_hotplug.rst | 13 | +++ b/target/tricore/helper.c |
18 | @@ -XXX,XX +XXX,XX @@ | 14 | @@ -XXX,XX +XXX,XX @@ void fpu_set_state(CPUTriCoreState *env) |
19 | QEMU<->ACPI BIOS PCI hotplug interface | 15 | set_flush_to_zero(1, &env->fp_status); |
20 | --------------------------------------- | 16 | set_float_detect_tininess(float_tininess_before_rounding, &env->fp_status); |
21 | +====================================== | 17 | set_default_nan_mode(1, &env->fp_status); |
22 | 18 | + /* Default NaN pattern: sign bit clear, frac msb set */ | |
23 | QEMU supports PCI hotplug via ACPI, for PCI bus 0. This document | 19 | + set_float_default_nan_pattern(0b01000000, &env->fp_status); |
24 | describes the interface between QEMU and the ACPI BIOS. | 20 | } |
25 | 21 | ||
26 | -ACPI GPE block (IO ports 0xafe0-0xafe3, byte access): | 22 | uint32_t psw_read(CPUTriCoreState *env) |
27 | ------------------------------------------ | ||
28 | +ACPI GPE block (IO ports 0xafe0-0xafe3, byte access) | ||
29 | +---------------------------------------------------- | ||
30 | |||
31 | Generic ACPI GPE block. Bit 1 (GPE.1) used to notify PCI hotplug/eject | ||
32 | event to ACPI BIOS, via SCI interrupt. | ||
33 | |||
34 | -PCI slot injection notification pending (IO port 0xae00-0xae03, 4-byte access): | ||
35 | ---------------------------------------------------------------- | ||
36 | +PCI slot injection notification pending (IO port 0xae00-0xae03, 4-byte access) | ||
37 | +------------------------------------------------------------------------------ | ||
38 | + | ||
39 | Slot injection notification pending. One bit per slot. | ||
40 | |||
41 | Read by ACPI BIOS GPE.1 handler to notify OS of injection | ||
42 | events. Read-only. | ||
43 | |||
44 | -PCI slot removal notification (IO port 0xae04-0xae07, 4-byte access): | ||
45 | ------------------------------------------------------ | ||
46 | +PCI slot removal notification (IO port 0xae04-0xae07, 4-byte access) | ||
47 | +-------------------------------------------------------------------- | ||
48 | + | ||
49 | Slot removal notification pending. One bit per slot. | ||
50 | |||
51 | Read by ACPI BIOS GPE.1 handler to notify OS of removal | ||
52 | events. Read-only. | ||
53 | |||
54 | -PCI device eject (IO port 0xae08-0xae0b, 4-byte access): | ||
55 | ----------------------------------------- | ||
56 | +PCI device eject (IO port 0xae08-0xae0b, 4-byte access) | ||
57 | +------------------------------------------------------- | ||
58 | |||
59 | Write: Used by ACPI BIOS _EJ0 method to request device removal. | ||
60 | One bit per slot. | ||
61 | |||
62 | Read: Hotplug features register. Used by platform to identify features | ||
63 | available. Current base feature set (no bits set): | ||
64 | - - Read-only "up" register @0xae00, 4-byte access, bit per slot | ||
65 | - - Read-only "down" register @0xae04, 4-byte access, bit per slot | ||
66 | - - Read/write "eject" register @0xae08, 4-byte access, | ||
67 | - write: bit per slot eject, read: hotplug feature set | ||
68 | - - Read-only hotplug capable register @0xae0c, 4-byte access, bit per slot | ||
69 | |||
70 | -PCI removability status (IO port 0xae0c-0xae0f, 4-byte access): | ||
71 | ------------------------------------------------ | ||
72 | +- Read-only "up" register @0xae00, 4-byte access, bit per slot | ||
73 | +- Read-only "down" register @0xae04, 4-byte access, bit per slot | ||
74 | +- Read/write "eject" register @0xae08, 4-byte access, | ||
75 | + write: bit per slot eject, read: hotplug feature set | ||
76 | +- Read-only hotplug capable register @0xae0c, 4-byte access, bit per slot | ||
77 | + | ||
78 | +PCI removability status (IO port 0xae0c-0xae0f, 4-byte access) | ||
79 | +-------------------------------------------------------------- | ||
80 | |||
81 | Used by ACPI BIOS _RMV method to indicate removability status to OS. One | ||
82 | -bit per slot. Read-only | ||
83 | +bit per slot. Read-only. | ||
84 | diff --git a/docs/specs/index.rst b/docs/specs/index.rst | ||
85 | index XXXXXXX..XXXXXXX 100644 | ||
86 | --- a/docs/specs/index.rst | ||
87 | +++ b/docs/specs/index.rst | ||
88 | @@ -XXX,XX +XXX,XX @@ guest hardware that is specific to QEMU. | ||
89 | acpi_hest_ghes | ||
90 | acpi_cpu_hotplug | ||
91 | acpi_mem_hotplug | ||
92 | + acpi_pci_hotplug | ||
93 | -- | 23 | -- |
94 | 2.20.1 | 24 | 2.34.1 |
95 | |||
96 | diff view generated by jsdifflib |
1 | Do a basic conversion of the acpi_cpu_hotplug spec document to rST. | 1 | Now that all our targets have bene converted to explicitly specify |
---|---|---|---|
2 | their pattern for the default NaN value we can remove the remaining | ||
3 | fallback code in parts64_default_nan(). | ||
2 | 4 | ||
3 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
4 | Reviewed-by: Igor Mammedov <imammedo@redhat.com> | 6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
5 | Message-id: 20210727170414.3368-2-peter.maydell@linaro.org | 7 | Message-id: 20241202131347.498124-55-peter.maydell@linaro.org |
6 | --- | 8 | --- |
7 | docs/specs/acpi_cpu_hotplug.rst | 235 ++++++++++++++++++++++++++++++++ | 9 | fpu/softfloat-specialize.c.inc | 14 -------------- |
8 | docs/specs/acpi_cpu_hotplug.txt | 160 ---------------------- | 10 | 1 file changed, 14 deletions(-) |
9 | docs/specs/index.rst | 1 + | ||
10 | 3 files changed, 236 insertions(+), 160 deletions(-) | ||
11 | create mode 100644 docs/specs/acpi_cpu_hotplug.rst | ||
12 | delete mode 100644 docs/specs/acpi_cpu_hotplug.txt | ||
13 | 11 | ||
14 | diff --git a/docs/specs/acpi_cpu_hotplug.rst b/docs/specs/acpi_cpu_hotplug.rst | 12 | diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc |
15 | new file mode 100644 | ||
16 | index XXXXXXX..XXXXXXX | ||
17 | --- /dev/null | ||
18 | +++ b/docs/specs/acpi_cpu_hotplug.rst | ||
19 | @@ -XXX,XX +XXX,XX @@ | ||
20 | +QEMU<->ACPI BIOS CPU hotplug interface | ||
21 | +====================================== | ||
22 | + | ||
23 | +QEMU supports CPU hotplug via ACPI. This document | ||
24 | +describes the interface between QEMU and the ACPI BIOS. | ||
25 | + | ||
26 | +ACPI BIOS GPE.2 handler is dedicated for notifying OS about CPU hot-add | ||
27 | +and hot-remove events. | ||
28 | + | ||
29 | + | ||
30 | +Legacy ACPI CPU hotplug interface registers | ||
31 | +------------------------------------------- | ||
32 | + | ||
33 | +CPU present bitmap for: | ||
34 | + | ||
35 | +- ICH9-LPC (IO port 0x0cd8-0xcf7, 1-byte access) | ||
36 | +- PIIX-PM (IO port 0xaf00-0xaf1f, 1-byte access) | ||
37 | +- One bit per CPU. Bit position reflects corresponding CPU APIC ID. Read-only. | ||
38 | +- The first DWORD in bitmap is used in write mode to switch from legacy | ||
39 | + to modern CPU hotplug interface, write 0 into it to do switch. | ||
40 | + | ||
41 | +QEMU sets corresponding CPU bit on hot-add event and issues SCI | ||
42 | +with GPE.2 event set. CPU present map is read by ACPI BIOS GPE.2 handler | ||
43 | +to notify OS about CPU hot-add events. CPU hot-remove isn't supported. | ||
44 | + | ||
45 | + | ||
46 | +Modern ACPI CPU hotplug interface registers | ||
47 | +------------------------------------------- | ||
48 | + | ||
49 | +Register block base address: | ||
50 | + | ||
51 | +- ICH9-LPC IO port 0x0cd8 | ||
52 | +- PIIX-PM IO port 0xaf00 | ||
53 | + | ||
54 | +Register block size: | ||
55 | + | ||
56 | +- ACPI_CPU_HOTPLUG_REG_LEN = 12 | ||
57 | + | ||
58 | +All accesses to registers described below, imply little-endian byte order. | ||
59 | + | ||
60 | +Reserved registers behavior: | ||
61 | + | ||
62 | +- write accesses are ignored | ||
63 | +- read accesses return all bits set to 0. | ||
64 | + | ||
65 | +The last stored value in 'CPU selector' must refer to a possible CPU, otherwise | ||
66 | + | ||
67 | +- reads from any register return 0 | ||
68 | +- writes to any other register are ignored until valid value is stored into it | ||
69 | + | ||
70 | +On QEMU start, 'CPU selector' is initialized to a valid value, on reset it | ||
71 | +keeps the current value. | ||
72 | + | ||
73 | +Read access behavior | ||
74 | +^^^^^^^^^^^^^^^^^^^^ | ||
75 | + | ||
76 | +offset [0x0-0x3] | ||
77 | + Command data 2: (DWORD access) | ||
78 | + | ||
79 | + If value last stored in 'Command field' is: | ||
80 | + | ||
81 | + 0: | ||
82 | + reads as 0x0 | ||
83 | + 3: | ||
84 | + upper 32 bits of architecture specific CPU ID value | ||
85 | + other values: | ||
86 | + reserved | ||
87 | + | ||
88 | +offset [0x4] | ||
89 | + CPU device status fields: (1 byte access) | ||
90 | + | ||
91 | + bits: | ||
92 | + | ||
93 | + 0: | ||
94 | + Device is enabled and may be used by guest | ||
95 | + 1: | ||
96 | + Device insert event, used to distinguish device for which | ||
97 | + no device check event to OSPM was issued. | ||
98 | + It's valid only when bit 0 is set. | ||
99 | + 2: | ||
100 | + Device remove event, used to distinguish device for which | ||
101 | + no device eject request to OSPM was issued. Firmware must | ||
102 | + ignore this bit. | ||
103 | + 3: | ||
104 | + reserved and should be ignored by OSPM | ||
105 | + 4: | ||
106 | + if set to 1, OSPM requests firmware to perform device eject. | ||
107 | + 5-7: | ||
108 | + reserved and should be ignored by OSPM | ||
109 | + | ||
110 | +offset [0x5-0x7] | ||
111 | + reserved | ||
112 | + | ||
113 | +offset [0x8] | ||
114 | + Command data: (DWORD access) | ||
115 | + | ||
116 | + If value last stored in 'Command field' is one of: | ||
117 | + | ||
118 | + 0: | ||
119 | + contains 'CPU selector' value of a CPU with pending event[s] | ||
120 | + 3: | ||
121 | + lower 32 bits of architecture specific CPU ID value | ||
122 | + (in x86 case: APIC ID) | ||
123 | + otherwise: | ||
124 | + contains 0 | ||
125 | + | ||
126 | +Write access behavior | ||
127 | +^^^^^^^^^^^^^^^^^^^^^ | ||
128 | + | ||
129 | +offset [0x0-0x3] | ||
130 | + CPU selector: (DWORD access) | ||
131 | + | ||
132 | + Selects active CPU device. All following accesses to other | ||
133 | + registers will read/store data from/to selected CPU. | ||
134 | + Valid values: [0 .. max_cpus) | ||
135 | + | ||
136 | +offset [0x4] | ||
137 | + CPU device control fields: (1 byte access) | ||
138 | + | ||
139 | + bits: | ||
140 | + | ||
141 | + 0: | ||
142 | + reserved, OSPM must clear it before writing to register. | ||
143 | + 1: | ||
144 | + if set to 1 clears device insert event, set by OSPM | ||
145 | + after it has emitted device check event for the | ||
146 | + selected CPU device | ||
147 | + 2: | ||
148 | + if set to 1 clears device remove event, set by OSPM | ||
149 | + after it has emitted device eject request for the | ||
150 | + selected CPU device. | ||
151 | + 3: | ||
152 | + if set to 1 initiates device eject, set by OSPM when it | ||
153 | + triggers CPU device removal and calls _EJ0 method or by firmware | ||
154 | + when bit #4 is set. In case bit #4 were set, it's cleared as | ||
155 | + part of device eject. | ||
156 | + 4: | ||
157 | + if set to 1, OSPM hands over device eject to firmware. | ||
158 | + Firmware shall issue device eject request as described above | ||
159 | + (bit #3) and OSPM should not touch device eject bit (#3) in case | ||
160 | + it's asked firmware to perform CPU device eject. | ||
161 | + 5-7: | ||
162 | + reserved, OSPM must clear them before writing to register | ||
163 | + | ||
164 | +offset[0x5] | ||
165 | + Command field: (1 byte access) | ||
166 | + | ||
167 | + value: | ||
168 | + | ||
169 | + 0: | ||
170 | + selects a CPU device with inserting/removing events and | ||
171 | + following reads from 'Command data' register return | ||
172 | + selected CPU ('CPU selector' value). | ||
173 | + If no CPU with events found, the current 'CPU selector' doesn't | ||
174 | + change and corresponding insert/remove event flags are not modified. | ||
175 | + | ||
176 | + 1: | ||
177 | + following writes to 'Command data' register set OST event | ||
178 | + register in QEMU | ||
179 | + 2: | ||
180 | + following writes to 'Command data' register set OST status | ||
181 | + register in QEMU | ||
182 | + 3: | ||
183 | + following reads from 'Command data' and 'Command data 2' return | ||
184 | + architecture specific CPU ID value for currently selected CPU. | ||
185 | + other values: | ||
186 | + reserved | ||
187 | + | ||
188 | +offset [0x6-0x7] | ||
189 | + reserved | ||
190 | + | ||
191 | +offset [0x8] | ||
192 | + Command data: (DWORD access) | ||
193 | + | ||
194 | + If last stored 'Command field' value is: | ||
195 | + | ||
196 | + 1: | ||
197 | + stores value into OST event register | ||
198 | + 2: | ||
199 | + stores value into OST status register, triggers | ||
200 | + ACPI_DEVICE_OST QMP event from QEMU to external applications | ||
201 | + with current values of OST event and status registers. | ||
202 | + other values: | ||
203 | + reserved | ||
204 | + | ||
205 | +Typical usecases | ||
206 | +---------------- | ||
207 | + | ||
208 | +(x86) Detecting and enabling modern CPU hotplug interface | ||
209 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
210 | + | ||
211 | +QEMU starts with legacy CPU hotplug interface enabled. Detecting and | ||
212 | +switching to modern interface is based on the 2 legacy CPU hotplug features: | ||
213 | + | ||
214 | +#. Writes into CPU bitmap are ignored. | ||
215 | +#. CPU bitmap always has bit #0 set, corresponding to boot CPU. | ||
216 | + | ||
217 | +Use following steps to detect and enable modern CPU hotplug interface: | ||
218 | + | ||
219 | +#. Store 0x0 to the 'CPU selector' register, attempting to switch to modern mode | ||
220 | +#. Store 0x0 to the 'CPU selector' register, to ensure valid selector value | ||
221 | +#. Store 0x0 to the 'Command field' register | ||
222 | +#. Read the 'Command data 2' register. | ||
223 | + If read value is 0x0, the modern interface is enabled. | ||
224 | + Otherwise legacy or no CPU hotplug interface available | ||
225 | + | ||
226 | +Get a cpu with pending event | ||
227 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
228 | + | ||
229 | +#. Store 0x0 to the 'CPU selector' register. | ||
230 | +#. Store 0x0 to the 'Command field' register. | ||
231 | +#. Read the 'CPU device status fields' register. | ||
232 | +#. If both bit #1 and bit #2 are clear in the value read, there is no CPU | ||
233 | + with a pending event and selected CPU remains unchanged. | ||
234 | +#. Otherwise, read the 'Command data' register. The value read is the | ||
235 | + selector of the CPU with the pending event (which is already selected). | ||
236 | + | ||
237 | +Enumerate CPUs present/non present CPUs | ||
238 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
239 | + | ||
240 | +#. Set the present CPU count to 0. | ||
241 | +#. Set the iterator to 0. | ||
242 | +#. Store 0x0 to the 'CPU selector' register, to ensure that it's in | ||
243 | + a valid state and that access to other registers won't be ignored. | ||
244 | +#. Store 0x0 to the 'Command field' register to make 'Command data' | ||
245 | + register return 'CPU selector' value of selected CPU | ||
246 | +#. Read the 'CPU device status fields' register. | ||
247 | +#. If bit #0 is set, increment the present CPU count. | ||
248 | +#. Increment the iterator. | ||
249 | +#. Store the iterator to the 'CPU selector' register. | ||
250 | +#. Read the 'Command data' register. | ||
251 | +#. If the value read is not zero, goto 05. | ||
252 | +#. Otherwise store 0x0 to the 'CPU selector' register, to put it | ||
253 | + into a valid state and exit. | ||
254 | + The iterator at this point equals "max_cpus". | ||
255 | diff --git a/docs/specs/acpi_cpu_hotplug.txt b/docs/specs/acpi_cpu_hotplug.txt | ||
256 | deleted file mode 100644 | ||
257 | index XXXXXXX..XXXXXXX | ||
258 | --- a/docs/specs/acpi_cpu_hotplug.txt | ||
259 | +++ /dev/null | ||
260 | @@ -XXX,XX +XXX,XX @@ | ||
261 | -QEMU<->ACPI BIOS CPU hotplug interface | ||
262 | --------------------------------------- | ||
263 | - | ||
264 | -QEMU supports CPU hotplug via ACPI. This document | ||
265 | -describes the interface between QEMU and the ACPI BIOS. | ||
266 | - | ||
267 | -ACPI BIOS GPE.2 handler is dedicated for notifying OS about CPU hot-add | ||
268 | -and hot-remove events. | ||
269 | - | ||
270 | -============================================ | ||
271 | -Legacy ACPI CPU hotplug interface registers: | ||
272 | --------------------------------------------- | ||
273 | -CPU present bitmap for: | ||
274 | - ICH9-LPC (IO port 0x0cd8-0xcf7, 1-byte access) | ||
275 | - PIIX-PM (IO port 0xaf00-0xaf1f, 1-byte access) | ||
276 | - One bit per CPU. Bit position reflects corresponding CPU APIC ID. Read-only. | ||
277 | - The first DWORD in bitmap is used in write mode to switch from legacy | ||
278 | - to modern CPU hotplug interface, write 0 into it to do switch. | ||
279 | ---------------------------------------------------------------- | ||
280 | -QEMU sets corresponding CPU bit on hot-add event and issues SCI | ||
281 | -with GPE.2 event set. CPU present map is read by ACPI BIOS GPE.2 handler | ||
282 | -to notify OS about CPU hot-add events. CPU hot-remove isn't supported. | ||
283 | - | ||
284 | -===================================== | ||
285 | -Modern ACPI CPU hotplug interface registers: | ||
286 | -------------------------------------- | ||
287 | -Register block base address: | ||
288 | - ICH9-LPC IO port 0x0cd8 | ||
289 | - PIIX-PM IO port 0xaf00 | ||
290 | -Register block size: | ||
291 | - ACPI_CPU_HOTPLUG_REG_LEN = 12 | ||
292 | - | ||
293 | -All accesses to registers described below, imply little-endian byte order. | ||
294 | - | ||
295 | -Reserved resisters behavior: | ||
296 | - - write accesses are ignored | ||
297 | - - read accesses return all bits set to 0. | ||
298 | - | ||
299 | -The last stored value in 'CPU selector' must refer to a possible CPU, otherwise | ||
300 | - - reads from any register return 0 | ||
301 | - - writes to any other register are ignored until valid value is stored into it | ||
302 | -On QEMU start, 'CPU selector' is initialized to a valid value, on reset it | ||
303 | -keeps the current value. | ||
304 | - | ||
305 | -read access: | ||
306 | - offset: | ||
307 | - [0x0-0x3] Command data 2: (DWORD access) | ||
308 | - if value last stored in 'Command field': | ||
309 | - 0: reads as 0x0 | ||
310 | - 3: upper 32 bits of architecture specific CPU ID value | ||
311 | - other values: reserved | ||
312 | - [0x4] CPU device status fields: (1 byte access) | ||
313 | - bits: | ||
314 | - 0: Device is enabled and may be used by guest | ||
315 | - 1: Device insert event, used to distinguish device for which | ||
316 | - no device check event to OSPM was issued. | ||
317 | - It's valid only when bit 0 is set. | ||
318 | - 2: Device remove event, used to distinguish device for which | ||
319 | - no device eject request to OSPM was issued. Firmware must | ||
320 | - ignore this bit. | ||
321 | - 3: reserved and should be ignored by OSPM | ||
322 | - 4: if set to 1, OSPM requests firmware to perform device eject. | ||
323 | - 5-7: reserved and should be ignored by OSPM | ||
324 | - [0x5-0x7] reserved | ||
325 | - [0x8] Command data: (DWORD access) | ||
326 | - contains 0 unless value last stored in 'Command field' is one of: | ||
327 | - 0: contains 'CPU selector' value of a CPU with pending event[s] | ||
328 | - 3: lower 32 bits of architecture specific CPU ID value | ||
329 | - (in x86 case: APIC ID) | ||
330 | - | ||
331 | -write access: | ||
332 | - offset: | ||
333 | - [0x0-0x3] CPU selector: (DWORD access) | ||
334 | - selects active CPU device. All following accesses to other | ||
335 | - registers will read/store data from/to selected CPU. | ||
336 | - Valid values: [0 .. max_cpus) | ||
337 | - [0x4] CPU device control fields: (1 byte access) | ||
338 | - bits: | ||
339 | - 0: reserved, OSPM must clear it before writing to register. | ||
340 | - 1: if set to 1 clears device insert event, set by OSPM | ||
341 | - after it has emitted device check event for the | ||
342 | - selected CPU device | ||
343 | - 2: if set to 1 clears device remove event, set by OSPM | ||
344 | - after it has emitted device eject request for the | ||
345 | - selected CPU device. | ||
346 | - 3: if set to 1 initiates device eject, set by OSPM when it | ||
347 | - triggers CPU device removal and calls _EJ0 method or by firmware | ||
348 | - when bit #4 is set. In case bit #4 were set, it's cleared as | ||
349 | - part of device eject. | ||
350 | - 4: if set to 1, OSPM hands over device eject to firmware. | ||
351 | - Firmware shall issue device eject request as described above | ||
352 | - (bit #3) and OSPM should not touch device eject bit (#3) in case | ||
353 | - it's asked firmware to perform CPU device eject. | ||
354 | - 5-7: reserved, OSPM must clear them before writing to register | ||
355 | - [0x5] Command field: (1 byte access) | ||
356 | - value: | ||
357 | - 0: selects a CPU device with inserting/removing events and | ||
358 | - following reads from 'Command data' register return | ||
359 | - selected CPU ('CPU selector' value). | ||
360 | - If no CPU with events found, the current 'CPU selector' doesn't | ||
361 | - change and corresponding insert/remove event flags are not modified. | ||
362 | - 1: following writes to 'Command data' register set OST event | ||
363 | - register in QEMU | ||
364 | - 2: following writes to 'Command data' register set OST status | ||
365 | - register in QEMU | ||
366 | - 3: following reads from 'Command data' and 'Command data 2' return | ||
367 | - architecture specific CPU ID value for currently selected CPU. | ||
368 | - other values: reserved | ||
369 | - [0x6-0x7] reserved | ||
370 | - [0x8] Command data: (DWORD access) | ||
371 | - if last stored 'Command field' value: | ||
372 | - 1: stores value into OST event register | ||
373 | - 2: stores value into OST status register, triggers | ||
374 | - ACPI_DEVICE_OST QMP event from QEMU to external applications | ||
375 | - with current values of OST event and status registers. | ||
376 | - other values: reserved | ||
377 | - | ||
378 | -Typical usecases: | ||
379 | - - (x86) Detecting and enabling modern CPU hotplug interface. | ||
380 | - QEMU starts with legacy CPU hotplug interface enabled. Detecting and | ||
381 | - switching to modern interface is based on the 2 legacy CPU hotplug features: | ||
382 | - 1. Writes into CPU bitmap are ignored. | ||
383 | - 2. CPU bitmap always has bit#0 set, corresponding to boot CPU. | ||
384 | - | ||
385 | - Use following steps to detect and enable modern CPU hotplug interface: | ||
386 | - 1. Store 0x0 to the 'CPU selector' register, | ||
387 | - attempting to switch to modern mode | ||
388 | - 2. Store 0x0 to the 'CPU selector' register, | ||
389 | - to ensure valid selector value | ||
390 | - 3. Store 0x0 to the 'Command field' register, | ||
391 | - 4. Read the 'Command data 2' register. | ||
392 | - If read value is 0x0, the modern interface is enabled. | ||
393 | - Otherwise legacy or no CPU hotplug interface available | ||
394 | - | ||
395 | - - Get a cpu with pending event | ||
396 | - 1. Store 0x0 to the 'CPU selector' register. | ||
397 | - 2. Store 0x0 to the 'Command field' register. | ||
398 | - 3. Read the 'CPU device status fields' register. | ||
399 | - 4. If both bit#1 and bit#2 are clear in the value read, there is no CPU | ||
400 | - with a pending event and selected CPU remains unchanged. | ||
401 | - 5. Otherwise, read the 'Command data' register. The value read is the | ||
402 | - selector of the CPU with the pending event (which is already | ||
403 | - selected). | ||
404 | - | ||
405 | - - Enumerate CPUs present/non present CPUs | ||
406 | - 01. Set the present CPU count to 0. | ||
407 | - 02. Set the iterator to 0. | ||
408 | - 03. Store 0x0 to the 'CPU selector' register, to ensure that it's in | ||
409 | - a valid state and that access to other registers won't be ignored. | ||
410 | - 04. Store 0x0 to the 'Command field' register to make 'Command data' | ||
411 | - register return 'CPU selector' value of selected CPU | ||
412 | - 05. Read the 'CPU device status fields' register. | ||
413 | - 06. If bit#0 is set, increment the present CPU count. | ||
414 | - 07. Increment the iterator. | ||
415 | - 08. Store the iterator to the 'CPU selector' register. | ||
416 | - 09. Read the 'Command data' register. | ||
417 | - 10. If the value read is not zero, goto 05. | ||
418 | - 11. Otherwise store 0x0 to the 'CPU selector' register, to put it | ||
419 | - into a valid state and exit. | ||
420 | - The iterator at this point equals "max_cpus". | ||
421 | diff --git a/docs/specs/index.rst b/docs/specs/index.rst | ||
422 | index XXXXXXX..XXXXXXX 100644 | 13 | index XXXXXXX..XXXXXXX 100644 |
423 | --- a/docs/specs/index.rst | 14 | --- a/fpu/softfloat-specialize.c.inc |
424 | +++ b/docs/specs/index.rst | 15 | +++ b/fpu/softfloat-specialize.c.inc |
425 | @@ -XXX,XX +XXX,XX @@ guest hardware that is specific to QEMU. | 16 | @@ -XXX,XX +XXX,XX @@ static void parts64_default_nan(FloatParts64 *p, float_status *status) |
426 | acpi_hw_reduced_hotplug | 17 | uint64_t frac; |
427 | tpm | 18 | uint8_t dnan_pattern = status->default_nan_pattern; |
428 | acpi_hest_ghes | 19 | |
429 | + acpi_cpu_hotplug | 20 | - if (dnan_pattern == 0) { |
21 | - /* | ||
22 | - * This case is true for Alpha, ARM, MIPS, OpenRISC, PPC, RISC-V, | ||
23 | - * S390, SH4, TriCore, and Xtensa. Our other supported targets | ||
24 | - * do not have floating-point. | ||
25 | - */ | ||
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; | ||
430 | -- | 37 | -- |
431 | 2.20.1 | 38 | 2.34.1 |
432 | |||
433 | diff view generated by jsdifflib |
1 | The gunzip() function reads various fields from a passed in source | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | buffer in order to skip a header before passing the actual compressed | ||
3 | data to the zlib inflate() function. It does check whether the | ||
4 | passed in buffer is too small, but unfortunately it checks that only | ||
5 | after reading bytes from the src buffer, so it could read off the end | ||
6 | of the buffer. | ||
7 | 2 | ||
8 | You can see this with valgrind: | 3 | Inline pickNaNMulAdd into its only caller. This makes |
4 | one assert redundant with the immediately preceding IF. | ||
9 | 5 | ||
10 | $ printf "%b" '\x1f\x8b' > /tmp/image | 6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
11 | $ valgrind qemu-system-aarch64 -display none -M virt -cpu max -kernel /tmp/image | 7 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
12 | [...] | 8 | Message-id: 20241203203949.483774-3-richard.henderson@linaro.org |
13 | ==19224== Invalid read of size 1 | 9 | [PMM: keep comment from old code in new location] |
14 | ==19224== at 0x67302E: gunzip (loader.c:558) | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
15 | ==19224== by 0x673907: load_image_gzipped_buffer (loader.c:788) | 11 | --- |
16 | ==19224== by 0xA18032: load_aarch64_image (boot.c:932) | 12 | fpu/softfloat-parts.c.inc | 41 +++++++++++++++++++++++++- |
17 | ==19224== by 0xA18489: arm_setup_direct_kernel_boot (boot.c:1063) | 13 | fpu/softfloat-specialize.c.inc | 54 ---------------------------------- |
18 | ==19224== by 0xA18D90: arm_load_kernel (boot.c:1317) | 14 | 2 files changed, 40 insertions(+), 55 deletions(-) |
19 | ==19224== by 0x9F3651: machvirt_init (virt.c:2114) | ||
20 | ==19224== by 0x794B7A: machine_run_board_init (machine.c:1272) | ||
21 | ==19224== by 0xD5CAD3: qemu_init_board (vl.c:2618) | ||
22 | ==19224== by 0xD5CCA6: qmp_x_exit_preconfig (vl.c:2692) | ||
23 | ==19224== by 0xD5F32E: qemu_init (vl.c:3713) | ||
24 | ==19224== by 0x5ADDB1: main (main.c:49) | ||
25 | ==19224== Address 0x3802a873 is 0 bytes after a block of size 3 alloc'd | ||
26 | ==19224== at 0x4C31B0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) | ||
27 | ==19224== by 0x61E7657: g_file_get_contents (in /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0.5600.4) | ||
28 | ==19224== by 0x673895: load_image_gzipped_buffer (loader.c:771) | ||
29 | ==19224== by 0xA18032: load_aarch64_image (boot.c:932) | ||
30 | ==19224== by 0xA18489: arm_setup_direct_kernel_boot (boot.c:1063) | ||
31 | ==19224== by 0xA18D90: arm_load_kernel (boot.c:1317) | ||
32 | ==19224== by 0x9F3651: machvirt_init (virt.c:2114) | ||
33 | ==19224== by 0x794B7A: machine_run_board_init (machine.c:1272) | ||
34 | ==19224== by 0xD5CAD3: qemu_init_board (vl.c:2618) | ||
35 | ==19224== by 0xD5CCA6: qmp_x_exit_preconfig (vl.c:2692) | ||
36 | ==19224== by 0xD5F32E: qemu_init (vl.c:3713) | ||
37 | ==19224== by 0x5ADDB1: main (main.c:49) | ||
38 | 15 | ||
39 | Check that we have enough bytes of data to read the header bytes that | 16 | diff --git a/fpu/softfloat-parts.c.inc b/fpu/softfloat-parts.c.inc |
40 | we read before we read them. | ||
41 | |||
42 | Fixes: Coverity 1458997 | ||
43 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
44 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
45 | Message-id: 20210812141803.20913-1-peter.maydell@linaro.org | ||
46 | --- | ||
47 | hw/core/loader.c | 35 +++++++++++++++++++++++++---------- | ||
48 | 1 file changed, 25 insertions(+), 10 deletions(-) | ||
49 | |||
50 | diff --git a/hw/core/loader.c b/hw/core/loader.c | ||
51 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
52 | --- a/hw/core/loader.c | 18 | --- a/fpu/softfloat-parts.c.inc |
53 | +++ b/hw/core/loader.c | 19 | +++ b/fpu/softfloat-parts.c.inc |
54 | @@ -XXX,XX +XXX,XX @@ ssize_t gunzip(void *dst, size_t dstlen, uint8_t *src, size_t srclen) | 20 | @@ -XXX,XX +XXX,XX @@ static FloatPartsN *partsN(pick_nan_muladd)(FloatPartsN *a, FloatPartsN *b, |
55 | |||
56 | /* skip header */ | ||
57 | i = 10; | ||
58 | + if (srclen < 4) { | ||
59 | + goto toosmall; | ||
60 | + } | ||
61 | flags = src[3]; | ||
62 | if (src[2] != DEFLATED || (flags & RESERVED) != 0) { | ||
63 | puts ("Error: Bad gzipped data\n"); | ||
64 | return -1; | ||
65 | } | 21 | } |
66 | - if ((flags & EXTRA_FIELD) != 0) | 22 | |
67 | + if ((flags & EXTRA_FIELD) != 0) { | 23 | if (s->default_nan_mode) { |
68 | + if (srclen < 12) { | 24 | + /* |
69 | + goto toosmall; | 25 | + * We guarantee not to require the target to tell us how to |
26 | + * pick a NaN if we're always returning the default NaN. | ||
27 | + * But if we're not in default-NaN mode then the target must | ||
28 | + * specify. | ||
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(); | ||
70 | + } | 48 | + } |
71 | i = 12 + src[10] + (src[11] << 8); | 49 | } else { |
72 | - if ((flags & ORIG_NAME) != 0) | 50 | - which = pickNaNMulAdd(a->cls, b->cls, c->cls, infzero, have_snan, s); |
73 | - while (src[i++] != 0) | 51 | + FloatClass cls[3] = { a->cls, b->cls, c->cls }; |
74 | - ; | 52 | + Float3NaNPropRule rule = s->float_3nan_prop_rule; |
75 | - if ((flags & COMMENT) != 0) | 53 | + |
76 | - while (src[i++] != 0) | 54 | + assert(rule != float_3nan_prop_none); |
77 | - ; | 55 | + if (have_snan && (rule & R_3NAN_SNAN_MASK)) { |
78 | - if ((flags & HEAD_CRC) != 0) | 56 | + /* We have at least one SNaN input and should prefer it */ |
79 | + } | 57 | + do { |
80 | + if ((flags & ORIG_NAME) != 0) { | 58 | + which = rule & R_3NAN_1ST_MASK; |
81 | + while (i < srclen && src[i++] != 0) { | 59 | + rule >>= R_3NAN_1ST_LENGTH; |
82 | + /* do nothing */ | 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])); | ||
83 | + } | 66 | + } |
84 | + } | ||
85 | + if ((flags & COMMENT) != 0) { | ||
86 | + while (i < srclen && src[i++] != 0) { | ||
87 | + /* do nothing */ | ||
88 | + } | ||
89 | + } | ||
90 | + if ((flags & HEAD_CRC) != 0) { | ||
91 | i += 2; | ||
92 | + } | ||
93 | if (i >= srclen) { | ||
94 | - puts ("Error: gunzip out of data in header\n"); | ||
95 | - return -1; | ||
96 | + goto toosmall; | ||
97 | } | 67 | } |
98 | 68 | ||
99 | s.zalloc = zalloc; | 69 | if (which == 3) { |
100 | @@ -XXX,XX +XXX,XX @@ ssize_t gunzip(void *dst, size_t dstlen, uint8_t *src, size_t srclen) | 70 | diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc |
101 | inflateEnd(&s); | 71 | index XXXXXXX..XXXXXXX 100644 |
102 | 72 | --- a/fpu/softfloat-specialize.c.inc | |
103 | return dstbytes; | 73 | +++ b/fpu/softfloat-specialize.c.inc |
104 | + | 74 | @@ -XXX,XX +XXX,XX @@ static int pickNaN(FloatClass a_cls, FloatClass b_cls, |
105 | +toosmall: | 75 | } |
106 | + puts("Error: gunzip out of data in header\n"); | ||
107 | + return -1; | ||
108 | } | 76 | } |
109 | 77 | ||
110 | /* Load a U-Boot image. */ | 78 | -/*---------------------------------------------------------------------------- |
79 | -| Select which NaN to propagate for a three-input operation. | ||
80 | -| For the moment we assume that no CPU needs the 'larger significand' | ||
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. | ||
111 | -- | 135 | -- |
112 | 2.20.1 | 136 | 2.34.1 |
113 | 137 | ||
114 | 138 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | If we link QOM object (a) as a property of QOM object (b), | 3 | Remove "3" as a special case for which and simply |
4 | we must set the property *before* (b) is realized. | 4 | branch to return the desired value. |
5 | 5 | ||
6 | Move QSPI realization *after* QSPI DMA. | 6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
7 | 7 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | |
8 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 8 | Message-id: 20241203203949.483774-4-richard.henderson@linaro.org |
9 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | ||
10 | Message-id: 20210819163422.2863447-2-philmd@redhat.com | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 10 | --- |
13 | hw/arm/xlnx-zynqmp.c | 42 ++++++++++++++++++++---------------------- | 11 | fpu/softfloat-parts.c.inc | 20 ++++++++++---------- |
14 | 1 file changed, 20 insertions(+), 22 deletions(-) | 12 | 1 file changed, 10 insertions(+), 10 deletions(-) |
15 | 13 | ||
16 | diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c | 14 | diff --git a/fpu/softfloat-parts.c.inc b/fpu/softfloat-parts.c.inc |
17 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/hw/arm/xlnx-zynqmp.c | 16 | --- a/fpu/softfloat-parts.c.inc |
19 | +++ b/hw/arm/xlnx-zynqmp.c | 17 | +++ b/fpu/softfloat-parts.c.inc |
20 | @@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp) | 18 | @@ -XXX,XX +XXX,XX @@ static FloatPartsN *partsN(pick_nan_muladd)(FloatPartsN *a, FloatPartsN *b, |
21 | g_free(bus_name); | 19 | * But if we're not in default-NaN mode then the target must |
20 | * specify. | ||
21 | */ | ||
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 | } | ||
22 | } | 52 | } |
23 | 53 | ||
24 | - if (!sysbus_realize(SYS_BUS_DEVICE(&s->qspi), errp)) { | 54 | - if (which == 3) { |
25 | - return; | 55 | - parts_default_nan(a, s); |
26 | - } | 56 | - return a; |
27 | - sysbus_mmio_map(SYS_BUS_DEVICE(&s->qspi), 0, QSPI_ADDR); | ||
28 | - sysbus_mmio_map(SYS_BUS_DEVICE(&s->qspi), 1, LQSPI_ADDR); | ||
29 | - sysbus_connect_irq(SYS_BUS_DEVICE(&s->qspi), 0, gic_spi[QSPI_IRQ]); | ||
30 | - | ||
31 | - for (i = 0; i < XLNX_ZYNQMP_NUM_QSPI_BUS; i++) { | ||
32 | - gchar *bus_name; | ||
33 | - gchar *target_bus; | ||
34 | - | ||
35 | - /* Alias controller SPI bus to the SoC itself */ | ||
36 | - bus_name = g_strdup_printf("qspi%d", i); | ||
37 | - target_bus = g_strdup_printf("spi%d", i); | ||
38 | - object_property_add_alias(OBJECT(s), bus_name, | ||
39 | - OBJECT(&s->qspi), target_bus); | ||
40 | - g_free(bus_name); | ||
41 | - g_free(target_bus); | ||
42 | - } | 57 | - } |
43 | - | 58 | - |
44 | if (!sysbus_realize(SYS_BUS_DEVICE(&s->dp), errp)) { | 59 | switch (which) { |
45 | return; | 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); | ||
46 | } | 64 | } |
47 | @@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp) | 65 | return a; |
48 | |||
49 | sysbus_mmio_map(SYS_BUS_DEVICE(&s->qspi_dma), 0, QSPI_DMA_ADDR); | ||
50 | sysbus_connect_irq(SYS_BUS_DEVICE(&s->qspi_dma), 0, gic_spi[QSPI_IRQ]); | ||
51 | - object_property_set_link(OBJECT(&s->qspi), "stream-connected-dma", | ||
52 | - OBJECT(&s->qspi_dma), errp); | ||
53 | + | 66 | + |
54 | + if (!object_property_set_link(OBJECT(&s->qspi), "stream-connected-dma", | 67 | + default_nan: |
55 | + OBJECT(&s->qspi_dma), errp)) { | 68 | + parts_default_nan(a, s); |
56 | + return; | 69 | + return a; |
57 | + } | ||
58 | + if (!sysbus_realize(SYS_BUS_DEVICE(&s->qspi), errp)) { | ||
59 | + return; | ||
60 | + } | ||
61 | + sysbus_mmio_map(SYS_BUS_DEVICE(&s->qspi), 0, QSPI_ADDR); | ||
62 | + sysbus_mmio_map(SYS_BUS_DEVICE(&s->qspi), 1, LQSPI_ADDR); | ||
63 | + sysbus_connect_irq(SYS_BUS_DEVICE(&s->qspi), 0, gic_spi[QSPI_IRQ]); | ||
64 | + | ||
65 | + for (i = 0; i < XLNX_ZYNQMP_NUM_QSPI_BUS; i++) { | ||
66 | + g_autofree gchar *bus_name = g_strdup_printf("qspi%d", i); | ||
67 | + g_autofree gchar *target_bus = g_strdup_printf("spi%d", i); | ||
68 | + | ||
69 | + /* Alias controller SPI bus to the SoC itself */ | ||
70 | + object_property_add_alias(OBJECT(s), bus_name, | ||
71 | + OBJECT(&s->qspi), target_bus); | ||
72 | + } | ||
73 | } | 70 | } |
74 | 71 | ||
75 | static Property xlnx_zynqmp_props[] = { | 72 | /* |
76 | -- | 73 | -- |
77 | 2.20.1 | 74 | 2.34.1 |
78 | 75 | ||
79 | 76 | diff view generated by jsdifflib |
1 | From: Andrew Jones <drjones@redhat.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Future CPU types may specify which vector lengths are supported. | 3 | Assign the pointer return value to 'a' directly, |
4 | We can apply nearly the same logic to validate those lengths | 4 | rather than going through an intermediary index. |
5 | as we do for KVM's supported vector lengths. We merge the code | ||
6 | where we can, but unfortunately can't completely merge it because | ||
7 | KVM requires all vector lengths, power-of-two or not, smaller than | ||
8 | the maximum enabled length to also be enabled. The architecture | ||
9 | only requires all the power-of-two lengths, though, so TCG will | ||
10 | only enforce that. | ||
11 | 5 | ||
12 | Signed-off-by: Andrew Jones <drjones@redhat.com> | 6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
13 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 7 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
14 | Message-id: 20210823160647.34028-5-drjones@redhat.com | 8 | Message-id: 20241203203949.483774-5-richard.henderson@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/cpu64.c | 101 ++++++++++++++++++++------------------------- | 11 | fpu/softfloat-parts.c.inc | 32 ++++++++++---------------------- |
18 | 1 file changed, 45 insertions(+), 56 deletions(-) | 12 | 1 file changed, 10 insertions(+), 22 deletions(-) |
19 | 13 | ||
20 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c | 14 | diff --git a/fpu/softfloat-parts.c.inc b/fpu/softfloat-parts.c.inc |
21 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
22 | --- a/target/arm/cpu64.c | 16 | --- a/fpu/softfloat-parts.c.inc |
23 | +++ b/target/arm/cpu64.c | 17 | +++ b/fpu/softfloat-parts.c.inc |
24 | @@ -XXX,XX +XXX,XX @@ void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp) | 18 | @@ -XXX,XX +XXX,XX @@ static FloatPartsN *partsN(pick_nan_muladd)(FloatPartsN *a, FloatPartsN *b, |
25 | break; | 19 | FloatPartsN *c, float_status *s, |
26 | } | 20 | int ab_mask, int abc_mask) |
27 | } | 21 | { |
28 | - max_vq = vq <= ARM_MAX_VQ ? vq - 1 : ARM_MAX_VQ; | 22 | - int which; |
29 | - bitmap_andnot(cpu->sve_vq_map, cpu->sve_vq_supported, | 23 | bool infzero = (ab_mask == float_cmask_infzero); |
30 | - cpu->sve_vq_init, max_vq); | 24 | bool have_snan = (abc_mask & float_cmask_snan); |
31 | - if (max_vq == 0 || bitmap_empty(cpu->sve_vq_map, max_vq)) { | 25 | + FloatPartsN *ret; |
32 | - error_setg(errp, "cannot disable sve%d", vq * 128); | 26 | |
33 | - error_append_hint(errp, "Disabling sve%d results in all " | 27 | if (unlikely(have_snan)) { |
34 | - "vector lengths being disabled.\n", | 28 | float_raise(float_flag_invalid | float_flag_invalid_snan, s); |
35 | - vq * 128); | 29 | @@ -XXX,XX +XXX,XX @@ static FloatPartsN *partsN(pick_nan_muladd)(FloatPartsN *a, FloatPartsN *b, |
36 | - error_append_hint(errp, "With SVE enabled, at least one " | 30 | default: |
37 | - "vector length must be enabled.\n"); | 31 | g_assert_not_reached(); |
38 | - return; | 32 | } |
39 | - } | 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)); | ||
40 | } else { | 49 | } else { |
41 | /* Disabling a power-of-two disables all larger lengths. */ | 50 | do { |
42 | - if (test_bit(0, cpu->sve_vq_init)) { | 51 | - which = rule & R_3NAN_1ST_MASK; |
43 | - error_setg(errp, "cannot disable sve128"); | 52 | + ret = val[rule & R_3NAN_1ST_MASK]; |
44 | - error_append_hint(errp, "Disabling sve128 results in all " | 53 | rule >>= R_3NAN_1ST_LENGTH; |
45 | - "vector lengths being disabled.\n"); | 54 | - } while (!is_nan(cls[which])); |
46 | - error_append_hint(errp, "With SVE enabled, at least one " | 55 | + } while (!is_nan(ret->cls)); |
47 | - "vector length must be enabled.\n"); | ||
48 | - return; | ||
49 | - } | ||
50 | - for (vq = 2; vq <= ARM_MAX_VQ; vq <<= 1) { | ||
51 | + for (vq = 1; vq <= ARM_MAX_VQ; vq <<= 1) { | ||
52 | if (test_bit(vq - 1, cpu->sve_vq_init)) { | ||
53 | break; | ||
54 | } | ||
55 | } | ||
56 | - max_vq = vq <= ARM_MAX_VQ ? vq - 1 : ARM_MAX_VQ; | ||
57 | - bitmap_complement(cpu->sve_vq_map, cpu->sve_vq_init, max_vq); | ||
58 | + } | ||
59 | + | ||
60 | + max_vq = vq <= ARM_MAX_VQ ? vq - 1 : ARM_MAX_VQ; | ||
61 | + bitmap_andnot(cpu->sve_vq_map, cpu->sve_vq_supported, | ||
62 | + cpu->sve_vq_init, max_vq); | ||
63 | + if (max_vq == 0 || bitmap_empty(cpu->sve_vq_map, max_vq)) { | ||
64 | + error_setg(errp, "cannot disable sve%d", vq * 128); | ||
65 | + error_append_hint(errp, "Disabling sve%d results in all " | ||
66 | + "vector lengths being disabled.\n", | ||
67 | + vq * 128); | ||
68 | + error_append_hint(errp, "With SVE enabled, at least one " | ||
69 | + "vector length must be enabled.\n"); | ||
70 | + return; | ||
71 | } | ||
72 | |||
73 | max_vq = find_last_bit(cpu->sve_vq_map, max_vq) + 1; | ||
74 | @@ -XXX,XX +XXX,XX @@ void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp) | ||
75 | assert(max_vq != 0); | ||
76 | bitmap_clear(cpu->sve_vq_map, max_vq, ARM_MAX_VQ - max_vq); | ||
77 | |||
78 | - if (kvm_enabled()) { | ||
79 | - /* Ensure the set of lengths matches what KVM supports. */ | ||
80 | - bitmap_xor(tmp, cpu->sve_vq_map, cpu->sve_vq_supported, max_vq); | ||
81 | - if (!bitmap_empty(tmp, max_vq)) { | ||
82 | - vq = find_last_bit(tmp, max_vq) + 1; | ||
83 | - if (test_bit(vq - 1, cpu->sve_vq_map)) { | ||
84 | - if (cpu->sve_max_vq) { | ||
85 | - error_setg(errp, "cannot set sve-max-vq=%d", | ||
86 | - cpu->sve_max_vq); | ||
87 | - error_append_hint(errp, "This KVM host does not support " | ||
88 | - "the vector length %d-bits.\n", | ||
89 | - vq * 128); | ||
90 | - error_append_hint(errp, "It may not be possible to use " | ||
91 | - "sve-max-vq with this KVM host. Try " | ||
92 | - "using only sve<N> properties.\n"); | ||
93 | - } else { | ||
94 | - error_setg(errp, "cannot enable sve%d", vq * 128); | ||
95 | - error_append_hint(errp, "This KVM host does not support " | ||
96 | - "the vector length %d-bits.\n", | ||
97 | - vq * 128); | ||
98 | - } | ||
99 | + /* Ensure the set of lengths matches what is supported. */ | ||
100 | + bitmap_xor(tmp, cpu->sve_vq_map, cpu->sve_vq_supported, max_vq); | ||
101 | + if (!bitmap_empty(tmp, max_vq)) { | ||
102 | + vq = find_last_bit(tmp, max_vq) + 1; | ||
103 | + if (test_bit(vq - 1, cpu->sve_vq_map)) { | ||
104 | + if (cpu->sve_max_vq) { | ||
105 | + error_setg(errp, "cannot set sve-max-vq=%d", cpu->sve_max_vq); | ||
106 | + error_append_hint(errp, "This CPU does not support " | ||
107 | + "the vector length %d-bits.\n", vq * 128); | ||
108 | + error_append_hint(errp, "It may not be possible to use " | ||
109 | + "sve-max-vq with this CPU. Try " | ||
110 | + "using only sve<N> properties.\n"); | ||
111 | } else { | ||
112 | + error_setg(errp, "cannot enable sve%d", vq * 128); | ||
113 | + error_append_hint(errp, "This CPU does not support " | ||
114 | + "the vector length %d-bits.\n", vq * 128); | ||
115 | + } | ||
116 | + return; | ||
117 | + } else { | ||
118 | + if (kvm_enabled()) { | ||
119 | error_setg(errp, "cannot disable sve%d", vq * 128); | ||
120 | error_append_hint(errp, "The KVM host requires all " | ||
121 | "supported vector lengths smaller " | ||
122 | "than %d bits to also be enabled.\n", | ||
123 | max_vq * 128); | ||
124 | - } | ||
125 | - return; | ||
126 | - } | ||
127 | - } else { | ||
128 | - /* Ensure all required powers-of-two are enabled. */ | ||
129 | - for (vq = pow2floor(max_vq); vq >= 1; vq >>= 1) { | ||
130 | - if (!test_bit(vq - 1, cpu->sve_vq_map)) { | ||
131 | - error_setg(errp, "cannot disable sve%d", vq * 128); | ||
132 | - error_append_hint(errp, "sve%d is required as it " | ||
133 | - "is a power-of-two length smaller than " | ||
134 | - "the maximum, sve%d\n", | ||
135 | - vq * 128, max_vq * 128); | ||
136 | return; | ||
137 | + } else { | ||
138 | + /* Ensure all required powers-of-two are enabled. */ | ||
139 | + for (vq = pow2floor(max_vq); vq >= 1; vq >>= 1) { | ||
140 | + if (!test_bit(vq - 1, cpu->sve_vq_map)) { | ||
141 | + error_setg(errp, "cannot disable sve%d", vq * 128); | ||
142 | + error_append_hint(errp, "sve%d is required as it " | ||
143 | + "is a power-of-two length smaller " | ||
144 | + "than the maximum, sve%d\n", | ||
145 | + vq * 128, max_vq * 128); | ||
146 | + return; | ||
147 | + } | ||
148 | + } | ||
149 | } | ||
150 | } | 56 | } |
151 | } | 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); | ||
152 | -- | 81 | -- |
153 | 2.20.1 | 82 | 2.34.1 |
154 | 83 | ||
155 | 84 | diff view generated by jsdifflib |
1 | From: Andrew Jones <drjones@redhat.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | bitmap_clear() only clears the given range. While the given | 3 | While all indices into val[] should be in [0-2], the mask |
4 | range should be sufficient in this case we might as well be | 4 | applied is two bits. To help static analysis see there is |
5 | 100% sure all bits are zeroed by using bitmap_zero(). | 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 | Signed-off-by: Andrew Jones <drjones@redhat.com> | 8 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
8 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 9 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 10 | Message-id: 20241203203949.483774-6-richard.henderson@linaro.org |
10 | Message-id: 20210823160647.34028-3-drjones@redhat.com | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 12 | --- |
13 | target/arm/kvm64.c | 2 +- | 13 | fpu/softfloat-parts.c.inc | 2 +- |
14 | 1 file changed, 1 insertion(+), 1 deletion(-) | 14 | 1 file changed, 1 insertion(+), 1 deletion(-) |
15 | 15 | ||
16 | diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c | 16 | diff --git a/fpu/softfloat-parts.c.inc b/fpu/softfloat-parts.c.inc |
17 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/target/arm/kvm64.c | 18 | --- a/fpu/softfloat-parts.c.inc |
19 | +++ b/target/arm/kvm64.c | 19 | +++ b/fpu/softfloat-parts.c.inc |
20 | @@ -XXX,XX +XXX,XX @@ void kvm_arm_sve_get_vls(CPUState *cs, unsigned long *map) | 20 | @@ -XXX,XX +XXX,XX @@ static FloatPartsN *partsN(pick_nan_muladd)(FloatPartsN *a, FloatPartsN *b, |
21 | uint32_t vq = 0; | 21 | } |
22 | int i, j; | 22 | ret = c; |
23 | 23 | } else { | |
24 | - bitmap_clear(map, 0, ARM_MAX_VQ); | 24 | - FloatPartsN *val[3] = { a, b, c }; |
25 | + bitmap_zero(map, ARM_MAX_VQ); | 25 | + FloatPartsN *val[R_3NAN_1ST_MASK + 1] = { a, b, c }; |
26 | 26 | Float3NaNPropRule rule = s->float_3nan_prop_rule; | |
27 | /* | 27 | |
28 | * KVM ensures all host CPUs support the same set of vector lengths. | 28 | assert(rule != float_3nan_prop_none); |
29 | -- | 29 | -- |
30 | 2.20.1 | 30 | 2.34.1 |
31 | 31 | ||
32 | 32 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | If some property are not set, we'll return indicating a failure, | 3 | This function is part of the public interface and |
4 | so it is pointless to allocate / initialize some fields too early. | 4 | is not "specialized" to any target in any way. |
5 | Move the trivial checks earlier in realize(). | ||
6 | 5 | ||
7 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
8 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> | 7 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
9 | Message-id: 20210819163422.2863447-3-philmd@redhat.com | 8 | Message-id: 20241203203949.483774-7-richard.henderson@linaro.org |
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | --- | 10 | --- |
12 | hw/dma/xlnx_csu_dma.c | 10 +++++----- | 11 | fpu/softfloat.c | 52 ++++++++++++++++++++++++++++++++++ |
13 | 1 file changed, 5 insertions(+), 5 deletions(-) | 12 | fpu/softfloat-specialize.c.inc | 52 ---------------------------------- |
13 | 2 files changed, 52 insertions(+), 52 deletions(-) | ||
14 | 14 | ||
15 | diff --git a/hw/dma/xlnx_csu_dma.c b/hw/dma/xlnx_csu_dma.c | 15 | diff --git a/fpu/softfloat.c b/fpu/softfloat.c |
16 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
17 | --- a/hw/dma/xlnx_csu_dma.c | 17 | --- a/fpu/softfloat.c |
18 | +++ b/hw/dma/xlnx_csu_dma.c | 18 | +++ b/fpu/softfloat.c |
19 | @@ -XXX,XX +XXX,XX @@ static void xlnx_csu_dma_realize(DeviceState *dev, Error **errp) | 19 | @@ -XXX,XX +XXX,XX @@ void normalizeFloatx80Subnormal(uint64_t aSig, int32_t *zExpPtr, |
20 | XlnxCSUDMA *s = XLNX_CSU_DMA(dev); | 20 | *zExpPtr = 1 - shiftCount; |
21 | RegisterInfoArray *reg_array; | 21 | } |
22 | 22 | ||
23 | + if (!s->is_dst && !s->tx_dev) { | 23 | +/*---------------------------------------------------------------------------- |
24 | + error_setg(errp, "zynqmp.csu-dma: Stream not connected"); | 24 | +| Takes two extended double-precision floating-point values `a' and `b', one |
25 | + return; | 25 | +| of which is a NaN, and returns the appropriate NaN result. If either `a' or |
26 | +| `b' is a signaling NaN, the invalid exception is raised. | ||
27 | +*----------------------------------------------------------------------------*/ | ||
28 | + | ||
29 | +floatx80 propagateFloatx80NaN(floatx80 a, floatx80 b, float_status *status) | ||
30 | +{ | ||
31 | + bool aIsLargerSignificand; | ||
32 | + FloatClass a_cls, b_cls; | ||
33 | + | ||
34 | + /* This is not complete, but is good enough for pickNaN. */ | ||
35 | + a_cls = (!floatx80_is_any_nan(a) | ||
36 | + ? float_class_normal | ||
37 | + : floatx80_is_signaling_nan(a, status) | ||
38 | + ? float_class_snan | ||
39 | + : float_class_qnan); | ||
40 | + b_cls = (!floatx80_is_any_nan(b) | ||
41 | + ? float_class_normal | ||
42 | + : floatx80_is_signaling_nan(b, status) | ||
43 | + ? float_class_snan | ||
44 | + : float_class_qnan); | ||
45 | + | ||
46 | + if (is_snan(a_cls) || is_snan(b_cls)) { | ||
47 | + float_raise(float_flag_invalid, status); | ||
26 | + } | 48 | + } |
27 | + | 49 | + |
28 | reg_array = | 50 | + if (status->default_nan_mode) { |
29 | register_init_block32(dev, xlnx_csu_dma_regs_info[!!s->is_dst], | 51 | + return floatx80_default_nan(status); |
30 | XLNX_CSU_DMA_R_MAX, | 52 | + } |
31 | @@ -XXX,XX +XXX,XX @@ static void xlnx_csu_dma_realize(DeviceState *dev, Error **errp) | 53 | + |
32 | sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->iomem); | 54 | + if (a.low < b.low) { |
33 | sysbus_init_irq(SYS_BUS_DEVICE(dev), &s->irq); | 55 | + aIsLargerSignificand = 0; |
34 | 56 | + } else if (b.low < a.low) { | |
35 | - if (!s->is_dst && !s->tx_dev) { | 57 | + aIsLargerSignificand = 1; |
36 | - error_setg(errp, "zynqmp.csu-dma: Stream not connected"); | 58 | + } else { |
37 | - return; | 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 | ||
79 | index XXXXXXX..XXXXXXX 100644 | ||
80 | --- a/fpu/softfloat-specialize.c.inc | ||
81 | +++ b/fpu/softfloat-specialize.c.inc | ||
82 | @@ -XXX,XX +XXX,XX @@ floatx80 floatx80_silence_nan(floatx80 a, float_status *status) | ||
83 | return a; | ||
84 | } | ||
85 | |||
86 | -/*---------------------------------------------------------------------------- | ||
87 | -| Takes two extended double-precision floating-point values `a' and `b', one | ||
88 | -| of which is a NaN, and returns the appropriate NaN result. If either `a' or | ||
89 | -| `b' is a signaling NaN, the invalid exception is raised. | ||
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); | ||
38 | - } | 111 | - } |
39 | - | 112 | - |
40 | s->src_timer = ptimer_init(xlnx_csu_dma_src_timeout_hit, | 113 | - if (status->default_nan_mode) { |
41 | s, PTIMER_POLICY_DEFAULT); | 114 | - return floatx80_default_nan(status); |
42 | 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. | ||
43 | -- | 141 | -- |
44 | 2.20.1 | 142 | 2.34.1 |
45 | |||
46 | diff view generated by jsdifflib |
1 | In the alignment check added to qemu_ram_alloc_from_fd() in commit | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | ce317be98db0dfdfa, the condition includes a check that 'mr' is not | ||
3 | NULL. This check is unnecessary because we can assume that the | ||
4 | caller always passes us a valid MemoryRegion, and indeed later in the | ||
5 | function we assume mr is not NULL when we pass it to file_ram_alloc() | ||
6 | as new_block->mr. Remove it. | ||
7 | 2 | ||
8 | Fixes: Coverity 1459867 | 3 | Unpacking and repacking the parts may be slightly more work |
9 | Fixes: ce317be98d ("exec: fetch the alignment of Linux devdax pmem character device nodes") | 4 | than we did before, but we get to reuse more code. For a |
5 | code path handling exceptional values, this is an improvement. | ||
6 | |||
7 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | ||
8 | Message-id: 20241203203949.483774-8-richard.henderson@linaro.org | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | Reviewed-by: Jingqi Liu <jingqi.liu@intel.com> | 10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
12 | Message-id: 20210812150624.29139-1-peter.maydell@linaro.org | ||
13 | --- | 11 | --- |
14 | softmmu/physmem.c | 2 +- | 12 | fpu/softfloat.c | 43 +++++-------------------------------------- |
15 | 1 file changed, 1 insertion(+), 1 deletion(-) | 13 | 1 file changed, 5 insertions(+), 38 deletions(-) |
16 | 14 | ||
17 | diff --git a/softmmu/physmem.c b/softmmu/physmem.c | 15 | diff --git a/fpu/softfloat.c b/fpu/softfloat.c |
18 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/softmmu/physmem.c | 17 | --- a/fpu/softfloat.c |
20 | +++ b/softmmu/physmem.c | 18 | +++ b/fpu/softfloat.c |
21 | @@ -XXX,XX +XXX,XX @@ RAMBlock *qemu_ram_alloc_from_fd(ram_addr_t size, MemoryRegion *mr, | 19 | @@ -XXX,XX +XXX,XX @@ void normalizeFloatx80Subnormal(uint64_t aSig, int32_t *zExpPtr, |
20 | |||
21 | floatx80 propagateFloatx80NaN(floatx80 a, floatx80 b, float_status *status) | ||
22 | { | ||
23 | - bool aIsLargerSignificand; | ||
24 | - FloatClass a_cls, b_cls; | ||
25 | + FloatParts128 pa, pb, *pr; | ||
26 | |||
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); | ||
22 | } | 47 | } |
23 | 48 | ||
24 | file_align = get_file_align(fd); | 49 | - if (a.low < b.low) { |
25 | - if (file_align > 0 && mr && file_align > mr->align) { | 50 | - aIsLargerSignificand = 0; |
26 | + if (file_align > 0 && file_align > mr->align) { | 51 | - } else if (b.low < a.low) { |
27 | error_setg(errp, "backing store align 0x%" PRIx64 | 52 | - aIsLargerSignificand = 1; |
28 | " is larger than 'align' option 0x%" PRIx64, | 53 | - } else { |
29 | file_align, mr->align); | 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 | /*---------------------------------------------------------------------------- | ||
30 | -- | 73 | -- |
31 | 2.20.1 | 74 | 2.34.1 |
32 | |||
33 | diff view generated by jsdifflib |
1 | From: Andrew Jones <drjones@redhat.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Now that we have an ARMCPU member sve_vq_supported we no longer | 3 | Inline pickNaN into its only caller. This makes one assert |
4 | need the local kvm_supported bitmap for KVM's supported vector | 4 | redundant with the immediately preceding IF. |
5 | lengths. | 5 | |
6 | 6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | |
7 | Signed-off-by: Andrew Jones <drjones@redhat.com> | 7 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
8 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 8 | Message-id: 20241203203949.483774-9-richard.henderson@linaro.org |
9 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
10 | Message-id: 20210823160647.34028-4-drjones@redhat.com | ||
11 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
12 | --- | 10 | --- |
13 | target/arm/cpu64.c | 19 +++++++++++-------- | 11 | fpu/softfloat-parts.c.inc | 82 +++++++++++++++++++++++++---- |
14 | 1 file changed, 11 insertions(+), 8 deletions(-) | 12 | fpu/softfloat-specialize.c.inc | 96 ---------------------------------- |
15 | 13 | 2 files changed, 73 insertions(+), 105 deletions(-) | |
16 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c | 14 | |
15 | diff --git a/fpu/softfloat-parts.c.inc b/fpu/softfloat-parts.c.inc | ||
17 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
18 | --- a/target/arm/cpu64.c | 17 | --- a/fpu/softfloat-parts.c.inc |
19 | +++ b/target/arm/cpu64.c | 18 | +++ b/fpu/softfloat-parts.c.inc |
20 | @@ -XXX,XX +XXX,XX @@ void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp) | 19 | @@ -XXX,XX +XXX,XX @@ static void partsN(return_nan)(FloatPartsN *a, float_status *s) |
21 | * any of the above. Finally, if SVE is not disabled, then at least one | 20 | static FloatPartsN *partsN(pick_nan)(FloatPartsN *a, FloatPartsN *b, |
22 | * vector length must be enabled. | 21 | float_status *s) |
23 | */ | 22 | { |
24 | - DECLARE_BITMAP(kvm_supported, ARM_MAX_VQ); | 23 | + int cmp, which; |
25 | DECLARE_BITMAP(tmp, ARM_MAX_VQ); | 24 | + |
26 | uint32_t vq, max_vq = 0; | 25 | if (is_snan(a->cls) || is_snan(b->cls)) { |
27 | 26 | float_raise(float_flag_invalid | float_flag_invalid_snan, s); | |
28 | - /* Collect the set of vector lengths supported by KVM. */ | ||
29 | - bitmap_zero(kvm_supported, ARM_MAX_VQ); | ||
30 | + /* | ||
31 | + * CPU models specify a set of supported vector lengths which are | ||
32 | + * enabled by default. Attempting to enable any vector length not set | ||
33 | + * in the supported bitmap results in an error. When KVM is enabled we | ||
34 | + * fetch the supported bitmap from the host. | ||
35 | + */ | ||
36 | if (kvm_enabled() && kvm_arm_sve_supported()) { | ||
37 | - kvm_arm_sve_get_vls(CPU(cpu), kvm_supported); | ||
38 | + kvm_arm_sve_get_vls(CPU(cpu), cpu->sve_vq_supported); | ||
39 | } else if (kvm_enabled()) { | ||
40 | assert(!cpu_isar_feature(aa64_sve, cpu)); | ||
41 | } | 27 | } |
42 | @@ -XXX,XX +XXX,XX @@ void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp) | 28 | |
43 | * For KVM we have to automatically enable all supported unitialized | 29 | if (s->default_nan_mode) { |
44 | * lengths, even when the smaller lengths are not all powers-of-two. | 30 | parts_default_nan(a, s); |
45 | */ | 31 | - } else { |
46 | - bitmap_andnot(tmp, kvm_supported, cpu->sve_vq_init, max_vq); | 32 | - int cmp = frac_cmp(a, b); |
47 | + bitmap_andnot(tmp, cpu->sve_vq_supported, cpu->sve_vq_init, max_vq); | 33 | - if (cmp == 0) { |
48 | bitmap_or(cpu->sve_vq_map, cpu->sve_vq_map, tmp, max_vq); | 34 | - cmp = a->sign < b->sign; |
49 | } else { | 35 | - } |
50 | /* Propagate enabled bits down through required powers-of-two. */ | 36 | + return a; |
51 | @@ -XXX,XX +XXX,XX @@ void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp) | 37 | + } |
52 | /* Disabling a supported length disables all larger lengths. */ | 38 | |
53 | for (vq = 1; vq <= ARM_MAX_VQ; ++vq) { | 39 | - if (pickNaN(a->cls, b->cls, cmp > 0, s)) { |
54 | if (test_bit(vq - 1, cpu->sve_vq_init) && | 40 | - a = b; |
55 | - test_bit(vq - 1, kvm_supported)) { | 41 | - } |
56 | + test_bit(vq - 1, cpu->sve_vq_supported)) { | 42 | + cmp = frac_cmp(a, b); |
57 | break; | 43 | + if (cmp == 0) { |
58 | } | 44 | + cmp = a->sign < b->sign; |
59 | } | 45 | + } |
60 | max_vq = vq <= ARM_MAX_VQ ? vq - 1 : ARM_MAX_VQ; | 46 | + |
61 | - bitmap_andnot(cpu->sve_vq_map, kvm_supported, | 47 | + switch (s->float_2nan_prop_rule) { |
62 | + bitmap_andnot(cpu->sve_vq_map, cpu->sve_vq_supported, | 48 | + case float_2nan_prop_s_ab: |
63 | cpu->sve_vq_init, max_vq); | 49 | if (is_snan(a->cls)) { |
64 | if (max_vq == 0 || bitmap_empty(cpu->sve_vq_map, max_vq)) { | 50 | - parts_silence_nan(a, s); |
65 | error_setg(errp, "cannot disable sve%d", vq * 128); | 51 | + which = 0; |
66 | @@ -XXX,XX +XXX,XX @@ void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp) | 52 | + } else if (is_snan(b->cls)) { |
67 | 53 | + which = 1; | |
68 | if (kvm_enabled()) { | 54 | + } else if (is_qnan(a->cls)) { |
69 | /* Ensure the set of lengths matches what KVM supports. */ | 55 | + which = 0; |
70 | - bitmap_xor(tmp, cpu->sve_vq_map, kvm_supported, max_vq); | 56 | + } else { |
71 | + bitmap_xor(tmp, cpu->sve_vq_map, cpu->sve_vq_supported, max_vq); | 57 | + which = 1; |
72 | if (!bitmap_empty(tmp, max_vq)) { | 58 | } |
73 | vq = find_last_bit(tmp, max_vq) + 1; | 59 | + break; |
74 | if (test_bit(vq - 1, cpu->sve_vq_map)) { | 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 | ||
118 | index XXXXXXX..XXXXXXX 100644 | ||
119 | --- a/fpu/softfloat-specialize.c.inc | ||
120 | +++ b/fpu/softfloat-specialize.c.inc | ||
121 | @@ -XXX,XX +XXX,XX @@ bool float32_is_signaling_nan(float32 a_, float_status *status) | ||
122 | } | ||
123 | } | ||
124 | |||
125 | -/*---------------------------------------------------------------------------- | ||
126 | -| Select which NaN to propagate for a two-input operation. | ||
127 | -| IEEE754 doesn't specify all the details of this, so the | ||
128 | -| algorithm is target-specific. | ||
129 | -| The routine is passed various bits of information about the | ||
130 | -| two NaNs and should return 0 to select NaN a and 1 for NaN b. | ||
131 | -| Note that signalling NaNs are always squashed to quiet NaNs | ||
132 | -| by the caller, by calling floatXX_silence_nan() before | ||
133 | -| returning them. | ||
134 | -| | ||
135 | -| aIsLargerSignificand is only valid if both a and b are NaNs | ||
136 | -| of some kind, and is true if a has the larger significand, | ||
137 | -| or if both a and b have the same significand but a is | ||
138 | -| positive but b is negative. It is only needed for the x87 | ||
139 | -| tie-break rule. | ||
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. | ||
75 | -- | 224 | -- |
76 | 2.20.1 | 225 | 2.34.1 |
77 | 226 | ||
78 | 227 | diff view generated by jsdifflib |
1 | From: Andrew Jones <drjones@redhat.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Allow CPUs that support SVE to specify which SVE vector lengths they | 3 | Remember if there was an SNaN, and use that to simplify |
4 | support by setting them in this bitmap. Currently only the 'max' and | 4 | float_2nan_prop_s_{ab,ba} to only the snan component. |
5 | 'host' CPU types supports SVE and 'host' requires KVM which obtains | 5 | Then, fall through to the corresponding |
6 | its supported bitmap from the host. So, we only need to initialize the | 6 | float_2nan_prop_{ab,ba} case to handle any remaining |
7 | bitmap for 'max' with TCG. And, since 'max' should support all SVE | 7 | nans, which must be quiet. |
8 | vector lengths we simply fill the bitmap. Future CPU types may have | ||
9 | less trivial maps though. | ||
10 | 8 | ||
11 | Signed-off-by: Andrew Jones <drjones@redhat.com> | 9 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
12 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
13 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 11 | Message-id: 20241203203949.483774-10-richard.henderson@linaro.org |
14 | Message-id: 20210823160647.34028-2-drjones@redhat.com | ||
15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
16 | --- | 13 | --- |
17 | target/arm/cpu.h | 4 ++++ | 14 | fpu/softfloat-parts.c.inc | 32 ++++++++++++-------------------- |
18 | target/arm/cpu64.c | 2 ++ | 15 | 1 file changed, 12 insertions(+), 20 deletions(-) |
19 | 2 files changed, 6 insertions(+) | ||
20 | 16 | ||
21 | diff --git a/target/arm/cpu.h b/target/arm/cpu.h | 17 | diff --git a/fpu/softfloat-parts.c.inc b/fpu/softfloat-parts.c.inc |
22 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
23 | --- a/target/arm/cpu.h | 19 | --- a/fpu/softfloat-parts.c.inc |
24 | +++ b/target/arm/cpu.h | 20 | +++ b/fpu/softfloat-parts.c.inc |
25 | @@ -XXX,XX +XXX,XX @@ struct ARMCPU { | 21 | @@ -XXX,XX +XXX,XX @@ static void partsN(return_nan)(FloatPartsN *a, float_status *s) |
26 | * While processing properties during initialization, corresponding | 22 | static FloatPartsN *partsN(pick_nan)(FloatPartsN *a, FloatPartsN *b, |
27 | * sve_vq_init bits are set for bits in sve_vq_map that have been | 23 | float_status *s) |
28 | * set by properties. | 24 | { |
29 | + * | 25 | + bool have_snan = false; |
30 | + * Bits set in sve_vq_supported represent valid vector lengths for | 26 | int cmp, which; |
31 | + * the CPU type. | 27 | |
32 | */ | 28 | if (is_snan(a->cls) || is_snan(b->cls)) { |
33 | DECLARE_BITMAP(sve_vq_map, ARM_MAX_VQ); | 29 | float_raise(float_flag_invalid | float_flag_invalid_snan, s); |
34 | DECLARE_BITMAP(sve_vq_init, ARM_MAX_VQ); | 30 | + have_snan = true; |
35 | + DECLARE_BITMAP(sve_vq_supported, ARM_MAX_VQ); | ||
36 | |||
37 | /* Generic timer counter frequency, in Hz */ | ||
38 | uint64_t gt_cntfrq_hz; | ||
39 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c | ||
40 | index XXXXXXX..XXXXXXX 100644 | ||
41 | --- a/target/arm/cpu64.c | ||
42 | +++ b/target/arm/cpu64.c | ||
43 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) | ||
44 | /* Default to PAUTH on, with the architected algorithm. */ | ||
45 | qdev_property_add_static(DEVICE(obj), &arm_cpu_pauth_property); | ||
46 | qdev_property_add_static(DEVICE(obj), &arm_cpu_pauth_impdef_property); | ||
47 | + | ||
48 | + bitmap_fill(cpu->sve_vq_supported, ARM_MAX_VQ); | ||
49 | } | 31 | } |
50 | 32 | ||
51 | aarch64_add_sve_properties(obj); | 33 | if (s->default_nan_mode) { |
34 | @@ -XXX,XX +XXX,XX @@ static FloatPartsN *partsN(pick_nan)(FloatPartsN *a, FloatPartsN *b, | ||
35 | |||
36 | switch (s->float_2nan_prop_rule) { | ||
37 | case float_2nan_prop_s_ab: | ||
38 | - if (is_snan(a->cls)) { | ||
39 | - which = 0; | ||
40 | - } else if (is_snan(b->cls)) { | ||
41 | - which = 1; | ||
42 | - } else if (is_qnan(a->cls)) { | ||
43 | - which = 0; | ||
44 | - } else { | ||
45 | - which = 1; | ||
46 | + if (have_snan) { | ||
47 | + which = is_snan(a->cls) ? 0 : 1; | ||
48 | + break; | ||
49 | } | ||
50 | - break; | ||
51 | - case float_2nan_prop_s_ba: | ||
52 | - if (is_snan(b->cls)) { | ||
53 | - which = 1; | ||
54 | - } else if (is_snan(a->cls)) { | ||
55 | - which = 0; | ||
56 | - } else if (is_qnan(b->cls)) { | ||
57 | - which = 1; | ||
58 | - } else { | ||
59 | - which = 0; | ||
60 | - } | ||
61 | - break; | ||
62 | + /* fall through */ | ||
63 | case float_2nan_prop_ab: | ||
64 | which = is_nan(a->cls) ? 0 : 1; | ||
65 | break; | ||
66 | + case float_2nan_prop_s_ba: | ||
67 | + if (have_snan) { | ||
68 | + which = is_snan(b->cls) ? 1 : 0; | ||
69 | + break; | ||
70 | + } | ||
71 | + /* fall through */ | ||
72 | case float_2nan_prop_ba: | ||
73 | which = is_nan(b->cls) ? 1 : 0; | ||
74 | break; | ||
52 | -- | 75 | -- |
53 | 2.20.1 | 76 | 2.34.1 |
54 | |||
55 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Simplify by always passing a MemoryRegion property to the device. | 3 | Move the fractional comparison to the end of the |
4 | Doing so we can move the AddressSpace field to the device struct, | 4 | float_2nan_prop_x87 case. This is not required for |
5 | removing need for heap allocation. | 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. | ||
6 | 8 | ||
7 | Update the Xilinx ZynqMP SoC model to pass the default system | 9 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
8 | memory instead of a NULL value. | ||
9 | |||
10 | Suggested-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
12 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
13 | Message-id: 20210819163422.2863447-4-philmd@redhat.com | 11 | Message-id: 20241203203949.483774-11-richard.henderson@linaro.org |
14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
15 | --- | 13 | --- |
16 | include/hw/dma/xlnx_csu_dma.h | 2 +- | 14 | fpu/softfloat-parts.c.inc | 19 +++++++++---------- |
17 | hw/arm/xlnx-zynqmp.c | 4 ++++ | 15 | 1 file changed, 9 insertions(+), 10 deletions(-) |
18 | hw/dma/xlnx_csu_dma.c | 21 ++++++++++----------- | ||
19 | 3 files changed, 15 insertions(+), 12 deletions(-) | ||
20 | 16 | ||
21 | diff --git a/include/hw/dma/xlnx_csu_dma.h b/include/hw/dma/xlnx_csu_dma.h | 17 | diff --git a/fpu/softfloat-parts.c.inc b/fpu/softfloat-parts.c.inc |
22 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
23 | --- a/include/hw/dma/xlnx_csu_dma.h | 19 | --- a/fpu/softfloat-parts.c.inc |
24 | +++ b/include/hw/dma/xlnx_csu_dma.h | 20 | +++ b/fpu/softfloat-parts.c.inc |
25 | @@ -XXX,XX +XXX,XX @@ typedef struct XlnxCSUDMA { | 21 | @@ -XXX,XX +XXX,XX @@ static FloatPartsN *partsN(pick_nan)(FloatPartsN *a, FloatPartsN *b, |
26 | MemoryRegion iomem; | 22 | return a; |
27 | MemTxAttrs attr; | ||
28 | MemoryRegion *dma_mr; | ||
29 | - AddressSpace *dma_as; | ||
30 | + AddressSpace dma_as; | ||
31 | qemu_irq irq; | ||
32 | StreamSink *tx_dev; /* Used as generic StreamSink */ | ||
33 | ptimer_state *src_timer; | ||
34 | diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c | ||
35 | index XXXXXXX..XXXXXXX 100644 | ||
36 | --- a/hw/arm/xlnx-zynqmp.c | ||
37 | +++ b/hw/arm/xlnx-zynqmp.c | ||
38 | @@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp) | ||
39 | gic_spi[adma_ch_intr[i]]); | ||
40 | } | 23 | } |
41 | 24 | ||
42 | + if (!object_property_set_link(OBJECT(&s->qspi_dma), "dma", | 25 | - cmp = frac_cmp(a, b); |
43 | + OBJECT(system_memory), errp)) { | 26 | - if (cmp == 0) { |
44 | + return; | 27 | - cmp = a->sign < b->sign; |
45 | + } | ||
46 | if (!sysbus_realize(SYS_BUS_DEVICE(&s->qspi_dma), errp)) { | ||
47 | return; | ||
48 | } | ||
49 | diff --git a/hw/dma/xlnx_csu_dma.c b/hw/dma/xlnx_csu_dma.c | ||
50 | index XXXXXXX..XXXXXXX 100644 | ||
51 | --- a/hw/dma/xlnx_csu_dma.c | ||
52 | +++ b/hw/dma/xlnx_csu_dma.c | ||
53 | @@ -XXX,XX +XXX,XX @@ static uint32_t xlnx_csu_dma_read(XlnxCSUDMA *s, uint8_t *buf, uint32_t len) | ||
54 | for (i = 0; i < len && (result == MEMTX_OK); i += s->width) { | ||
55 | uint32_t mlen = MIN(len - i, s->width); | ||
56 | |||
57 | - result = address_space_rw(s->dma_as, addr, s->attr, | ||
58 | + result = address_space_rw(&s->dma_as, addr, s->attr, | ||
59 | buf + i, mlen, false); | ||
60 | } | ||
61 | } else { | ||
62 | - result = address_space_rw(s->dma_as, addr, s->attr, buf, len, false); | ||
63 | + result = address_space_rw(&s->dma_as, addr, s->attr, buf, len, false); | ||
64 | } | ||
65 | |||
66 | if (result == MEMTX_OK) { | ||
67 | @@ -XXX,XX +XXX,XX @@ static uint32_t xlnx_csu_dma_write(XlnxCSUDMA *s, uint8_t *buf, uint32_t len) | ||
68 | for (i = 0; i < len && (result == MEMTX_OK); i += s->width) { | ||
69 | uint32_t mlen = MIN(len - i, s->width); | ||
70 | |||
71 | - result = address_space_rw(s->dma_as, addr, s->attr, | ||
72 | + result = address_space_rw(&s->dma_as, addr, s->attr, | ||
73 | buf, mlen, true); | ||
74 | buf += mlen; | ||
75 | } | ||
76 | } else { | ||
77 | - result = address_space_rw(s->dma_as, addr, s->attr, buf, len, true); | ||
78 | + result = address_space_rw(&s->dma_as, addr, s->attr, buf, len, true); | ||
79 | } | ||
80 | |||
81 | if (result != MEMTX_OK) { | ||
82 | @@ -XXX,XX +XXX,XX @@ static void xlnx_csu_dma_realize(DeviceState *dev, Error **errp) | ||
83 | return; | ||
84 | } | ||
85 | |||
86 | + if (!s->dma_mr) { | ||
87 | + error_setg(errp, TYPE_XLNX_CSU_DMA " 'dma' link not set"); | ||
88 | + return; | ||
89 | + } | ||
90 | + address_space_init(&s->dma_as, s->dma_mr, "csu-dma"); | ||
91 | + | ||
92 | reg_array = | ||
93 | register_init_block32(dev, xlnx_csu_dma_regs_info[!!s->is_dst], | ||
94 | XLNX_CSU_DMA_R_MAX, | ||
95 | @@ -XXX,XX +XXX,XX @@ static void xlnx_csu_dma_realize(DeviceState *dev, Error **errp) | ||
96 | s->src_timer = ptimer_init(xlnx_csu_dma_src_timeout_hit, | ||
97 | s, PTIMER_POLICY_DEFAULT); | ||
98 | |||
99 | - if (s->dma_mr) { | ||
100 | - s->dma_as = g_malloc0(sizeof(AddressSpace)); | ||
101 | - address_space_init(s->dma_as, s->dma_mr, NULL); | ||
102 | - } else { | ||
103 | - s->dma_as = &address_space_memory; | ||
104 | - } | 28 | - } |
105 | - | 29 | - |
106 | s->attr = MEMTXATTRS_UNSPECIFIED; | 30 | switch (s->float_2nan_prop_rule) { |
107 | 31 | case float_2nan_prop_s_ab: | |
108 | s->r_size_last_word = 0; | 32 | if (have_snan) { |
33 | @@ -XXX,XX +XXX,XX @@ static FloatPartsN *partsN(pick_nan)(FloatPartsN *a, FloatPartsN *b, | ||
34 | * return the NaN with the positive sign bit (if any). | ||
35 | */ | ||
36 | if (is_snan(a->cls)) { | ||
37 | - if (is_snan(b->cls)) { | ||
38 | - which = cmp > 0 ? 0 : 1; | ||
39 | - } else { | ||
40 | + if (!is_snan(b->cls)) { | ||
41 | which = is_qnan(b->cls) ? 1 : 0; | ||
42 | + break; | ||
43 | } | ||
44 | } else if (is_qnan(a->cls)) { | ||
45 | if (is_snan(b->cls) || !is_qnan(b->cls)) { | ||
46 | which = 0; | ||
47 | - } else { | ||
48 | - which = cmp > 0 ? 0 : 1; | ||
49 | + break; | ||
50 | } | ||
51 | } else { | ||
52 | which = 1; | ||
53 | + break; | ||
54 | } | ||
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(); | ||
109 | -- | 63 | -- |
110 | 2.20.1 | 64 | 2.34.1 |
111 | |||
112 | diff view generated by jsdifflib |
1 | From: Philippe Mathieu-Daudé <philmd@redhat.com> | 1 | From: Richard Henderson <richard.henderson@linaro.org> |
---|---|---|---|
2 | 2 | ||
3 | Simplify by always passing a MemoryRegion property to the device. | 3 | Replace the "index" selecting between A and B with a result variable |
4 | Doing so we can move the AddressSpace field to the device struct, | 4 | of the proper type. This improves clarity within the function. |
5 | removing need for heap allocation. | ||
6 | 5 | ||
7 | Update the Xilinx ZynqMP / Versal SoC models to pass the default | 6 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> |
8 | system memory instead of a NULL value. | 7 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> |
9 | 8 | Message-id: 20241203203949.483774-12-richard.henderson@linaro.org | |
10 | Suggested-by: Peter Maydell <peter.maydell@linaro.org> | ||
11 | Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
12 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | Message-id: 20210819163422.2863447-5-philmd@redhat.com | ||
14 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
15 | --- | 10 | --- |
16 | include/hw/dma/xlnx-zdma.h | 2 +- | 11 | fpu/softfloat-parts.c.inc | 28 +++++++++++++--------------- |
17 | hw/arm/xlnx-versal.c | 2 ++ | 12 | 1 file changed, 13 insertions(+), 15 deletions(-) |
18 | hw/arm/xlnx-zynqmp.c | 8 ++++++++ | ||
19 | hw/dma/xlnx-zdma.c | 24 ++++++++++++------------ | ||
20 | 4 files changed, 23 insertions(+), 13 deletions(-) | ||
21 | 13 | ||
22 | diff --git a/include/hw/dma/xlnx-zdma.h b/include/hw/dma/xlnx-zdma.h | 14 | diff --git a/fpu/softfloat-parts.c.inc b/fpu/softfloat-parts.c.inc |
23 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
24 | --- a/include/hw/dma/xlnx-zdma.h | 16 | --- a/fpu/softfloat-parts.c.inc |
25 | +++ b/include/hw/dma/xlnx-zdma.h | 17 | +++ b/fpu/softfloat-parts.c.inc |
26 | @@ -XXX,XX +XXX,XX @@ struct XlnxZDMA { | 18 | @@ -XXX,XX +XXX,XX @@ static FloatPartsN *partsN(pick_nan)(FloatPartsN *a, FloatPartsN *b, |
27 | MemoryRegion iomem; | 19 | float_status *s) |
28 | MemTxAttrs attr; | 20 | { |
29 | MemoryRegion *dma_mr; | 21 | bool have_snan = false; |
30 | - AddressSpace *dma_as; | 22 | - int cmp, which; |
31 | + AddressSpace dma_as; | 23 | + FloatPartsN *ret; |
32 | qemu_irq irq_zdma_ch_imr; | 24 | + int cmp; |
33 | 25 | ||
34 | struct { | 26 | if (is_snan(a->cls) || is_snan(b->cls)) { |
35 | diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c | 27 | float_raise(float_flag_invalid | float_flag_invalid_snan, s); |
36 | index XXXXXXX..XXXXXXX 100644 | 28 | @@ -XXX,XX +XXX,XX @@ static FloatPartsN *partsN(pick_nan)(FloatPartsN *a, FloatPartsN *b, |
37 | --- a/hw/arm/xlnx-versal.c | 29 | switch (s->float_2nan_prop_rule) { |
38 | +++ b/hw/arm/xlnx-versal.c | 30 | case float_2nan_prop_s_ab: |
39 | @@ -XXX,XX +XXX,XX @@ static void versal_create_admas(Versal *s, qemu_irq *pic) | 31 | if (have_snan) { |
40 | TYPE_XLNX_ZDMA); | 32 | - which = is_snan(a->cls) ? 0 : 1; |
41 | dev = DEVICE(&s->lpd.iou.adma[i]); | 33 | + ret = is_snan(a->cls) ? a : b; |
42 | object_property_set_int(OBJECT(dev), "bus-width", 128, &error_abort); | 34 | break; |
43 | + object_property_set_link(OBJECT(dev), "dma", | ||
44 | + OBJECT(get_system_memory()), &error_fatal); | ||
45 | sysbus_realize(SYS_BUS_DEVICE(dev), &error_fatal); | ||
46 | |||
47 | mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(dev), 0); | ||
48 | diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c | ||
49 | index XXXXXXX..XXXXXXX 100644 | ||
50 | --- a/hw/arm/xlnx-zynqmp.c | ||
51 | +++ b/hw/arm/xlnx-zynqmp.c | ||
52 | @@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp) | ||
53 | errp)) { | ||
54 | return; | ||
55 | } | 35 | } |
56 | + if (!object_property_set_link(OBJECT(&s->gdma[i]), "dma", | 36 | /* fall through */ |
57 | + OBJECT(system_memory), errp)) { | 37 | case float_2nan_prop_ab: |
58 | + return; | 38 | - which = is_nan(a->cls) ? 0 : 1; |
59 | + } | 39 | + ret = is_nan(a->cls) ? a : b; |
60 | if (!sysbus_realize(SYS_BUS_DEVICE(&s->gdma[i]), errp)) { | 40 | break; |
61 | return; | 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; | ||
62 | } | 46 | } |
63 | @@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp) | 47 | /* fall through */ |
64 | } | 48 | case float_2nan_prop_ba: |
65 | 49 | - which = is_nan(b->cls) ? 1 : 0; | |
66 | for (i = 0; i < XLNX_ZYNQMP_NUM_ADMA_CH; i++) { | 50 | + ret = is_nan(b->cls) ? b : a; |
67 | + if (!object_property_set_link(OBJECT(&s->adma[i]), "dma", | 51 | break; |
68 | + OBJECT(system_memory), errp)) { | 52 | case float_2nan_prop_x87: |
69 | + return; | 53 | /* |
70 | + } | 54 | @@ -XXX,XX +XXX,XX @@ static FloatPartsN *partsN(pick_nan)(FloatPartsN *a, FloatPartsN *b, |
71 | if (!sysbus_realize(SYS_BUS_DEVICE(&s->adma[i]), errp)) { | 55 | */ |
72 | return; | 56 | if (is_snan(a->cls)) { |
73 | } | 57 | if (!is_snan(b->cls)) { |
74 | diff --git a/hw/dma/xlnx-zdma.c b/hw/dma/xlnx-zdma.c | 58 | - which = is_qnan(b->cls) ? 1 : 0; |
75 | index XXXXXXX..XXXXXXX 100644 | 59 | + ret = is_qnan(b->cls) ? b : a; |
76 | --- a/hw/dma/xlnx-zdma.c | 60 | break; |
77 | +++ b/hw/dma/xlnx-zdma.c | ||
78 | @@ -XXX,XX +XXX,XX @@ static bool zdma_load_descriptor(XlnxZDMA *s, uint64_t addr, | ||
79 | return false; | ||
80 | } | ||
81 | |||
82 | - descr->addr = address_space_ldq_le(s->dma_as, addr, s->attr, NULL); | ||
83 | - descr->size = address_space_ldl_le(s->dma_as, addr + 8, s->attr, NULL); | ||
84 | - descr->attr = address_space_ldl_le(s->dma_as, addr + 12, s->attr, NULL); | ||
85 | + descr->addr = address_space_ldq_le(&s->dma_as, addr, s->attr, NULL); | ||
86 | + descr->size = address_space_ldl_le(&s->dma_as, addr + 8, s->attr, NULL); | ||
87 | + descr->attr = address_space_ldl_le(&s->dma_as, addr + 12, s->attr, NULL); | ||
88 | return true; | ||
89 | } | ||
90 | |||
91 | @@ -XXX,XX +XXX,XX @@ static void zdma_update_descr_addr(XlnxZDMA *s, bool type, | ||
92 | } else { | ||
93 | addr = zdma_get_regaddr64(s, basereg); | ||
94 | addr += sizeof(s->dsc_dst); | ||
95 | - next = address_space_ldq_le(s->dma_as, addr, s->attr, NULL); | ||
96 | + next = address_space_ldq_le(&s->dma_as, addr, s->attr, NULL); | ||
97 | } | ||
98 | |||
99 | zdma_put_regaddr64(s, basereg, next); | ||
100 | @@ -XXX,XX +XXX,XX @@ static void zdma_write_dst(XlnxZDMA *s, uint8_t *buf, uint32_t len) | ||
101 | } | 61 | } |
102 | } | 62 | } else if (is_qnan(a->cls)) { |
103 | 63 | if (is_snan(b->cls) || !is_qnan(b->cls)) { | |
104 | - address_space_write(s->dma_as, s->dsc_dst.addr, s->attr, buf, dlen); | 64 | - which = 0; |
105 | + address_space_write(&s->dma_as, s->dsc_dst.addr, s->attr, buf, dlen); | 65 | + ret = a; |
106 | if (burst_type == AXI_BURST_INCR) { | 66 | break; |
107 | s->dsc_dst.addr += dlen; | ||
108 | } | ||
109 | @@ -XXX,XX +XXX,XX @@ static void zdma_process_descr(XlnxZDMA *s) | ||
110 | len = s->cfg.bus_width / 8; | ||
111 | } | 67 | } |
112 | } else { | 68 | } else { |
113 | - address_space_read(s->dma_as, src_addr, s->attr, s->buf, len); | 69 | - which = 1; |
114 | + address_space_read(&s->dma_as, src_addr, s->attr, s->buf, len); | 70 | + ret = b; |
115 | if (burst_type == AXI_BURST_INCR) { | 71 | break; |
116 | src_addr += len; | 72 | } |
117 | } | 73 | cmp = frac_cmp(a, b); |
118 | @@ -XXX,XX +XXX,XX @@ static void zdma_realize(DeviceState *dev, Error **errp) | 74 | if (cmp == 0) { |
119 | XlnxZDMA *s = XLNX_ZDMA(dev); | 75 | cmp = a->sign < b->sign; |
120 | unsigned int i; | 76 | } |
121 | 77 | - which = cmp > 0 ? 0 : 1; | |
122 | + if (!s->dma_mr) { | 78 | + ret = cmp > 0 ? a : b; |
123 | + error_setg(errp, TYPE_XLNX_ZDMA " 'dma' link not set"); | 79 | break; |
124 | + return; | 80 | default: |
125 | + } | 81 | g_assert_not_reached(); |
126 | + address_space_init(&s->dma_as, s->dma_mr, "zdma-dma"); | ||
127 | + | ||
128 | for (i = 0; i < ARRAY_SIZE(zdma_regs_info); ++i) { | ||
129 | RegisterInfo *r = &s->regs_info[zdma_regs_info[i].addr / 4]; | ||
130 | |||
131 | @@ -XXX,XX +XXX,XX @@ static void zdma_realize(DeviceState *dev, Error **errp) | ||
132 | }; | ||
133 | } | 82 | } |
134 | 83 | ||
135 | - if (s->dma_mr) { | 84 | - if (which) { |
136 | - s->dma_as = g_malloc0(sizeof(AddressSpace)); | 85 | - a = b; |
137 | - address_space_init(s->dma_as, s->dma_mr, NULL); | 86 | + if (is_snan(ret->cls)) { |
138 | - } else { | 87 | + parts_silence_nan(ret, s); |
139 | - s->dma_as = &address_space_memory; | 88 | } |
89 | - if (is_snan(a->cls)) { | ||
90 | - parts_silence_nan(a, s); | ||
140 | - } | 91 | - } |
141 | s->attr = MEMTXATTRS_UNSPECIFIED; | 92 | - return a; |
93 | + return ret; | ||
142 | } | 94 | } |
143 | 95 | ||
96 | static FloatPartsN *partsN(pick_nan_muladd)(FloatPartsN *a, FloatPartsN *b, | ||
144 | -- | 97 | -- |
145 | 2.20.1 | 98 | 2.34.1 |
146 | 99 | ||
147 | 100 | diff view generated by jsdifflib |
1 | From: Ani Sinha <ani@anisinha.ca> | 1 | From: Leif Lindholm <quic_llindhol@quicinc.com> |
---|---|---|---|
2 | 2 | ||
3 | Since commit | 3 | I'm migrating to Qualcomm's new open source email infrastructure, so |
4 | 36b79e3219d ("hw/acpi/Kconfig: Add missing Kconfig dependencies (build error)"), | 4 | update my email address, and update the mailmap to match. |
5 | ACPI_MEMORY_HOTPLUG and ACPI_NVDIMM is implicitly turned on when | ||
6 | ACPI_HW_REDUCED is selected. ACPI_HW_REDUCED is already enabled. No need to | ||
7 | turn on ACPI_MEMORY_HOTPLUG or ACPI_NVDIMM explicitly. This is a minor cleanup. | ||
8 | 5 | ||
9 | Signed-off-by: Ani Sinha <ani@anisinha.ca> | 6 | Signed-off-by: Leif Lindholm <leif.lindholm@oss.qualcomm.com> |
10 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 7 | Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com> |
11 | Message-id: 20210819162637.518507-1-ani@anisinha.ca | 8 | Reviewed-by: Brian Cain <brian.cain@oss.qualcomm.com> |
9 | Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
10 | Tested-by: Philippe Mathieu-Daudé <philmd@linaro.org> | ||
11 | Message-id: 20241205114047.1125842-1-leif.lindholm@oss.qualcomm.com | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
13 | --- | 13 | --- |
14 | hw/arm/Kconfig | 2 -- | 14 | MAINTAINERS | 2 +- |
15 | 1 file changed, 2 deletions(-) | 15 | .mailmap | 5 +++-- |
16 | 2 files changed, 4 insertions(+), 3 deletions(-) | ||
16 | 17 | ||
17 | diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig | 18 | diff --git a/MAINTAINERS b/MAINTAINERS |
18 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/hw/arm/Kconfig | 20 | --- a/MAINTAINERS |
20 | +++ b/hw/arm/Kconfig | 21 | +++ b/MAINTAINERS |
21 | @@ -XXX,XX +XXX,XX @@ config ARM_VIRT | 22 | @@ -XXX,XX +XXX,XX @@ F: include/hw/ssi/imx_spi.h |
22 | select ACPI_PCI | 23 | SBSA-REF |
23 | select MEM_DEVICE | 24 | M: Radoslaw Biernacki <rad@semihalf.com> |
24 | select DIMM | 25 | M: Peter Maydell <peter.maydell@linaro.org> |
25 | - select ACPI_MEMORY_HOTPLUG | 26 | -R: Leif Lindholm <quic_llindhol@quicinc.com> |
26 | select ACPI_HW_REDUCED | 27 | +R: Leif Lindholm <leif.lindholm@oss.qualcomm.com> |
27 | - select ACPI_NVDIMM | 28 | R: Marcin Juszkiewicz <marcin.juszkiewicz@linaro.org> |
28 | select ACPI_APEI | 29 | L: qemu-arm@nongnu.org |
29 | 30 | S: Maintained | |
30 | config CHEETAH | 31 | diff --git a/.mailmap b/.mailmap |
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> | ||
31 | -- | 47 | -- |
32 | 2.20.1 | 48 | 2.34.1 |
33 | 49 | ||
34 | 50 | diff view generated by jsdifflib |
1 | Add entries for the ACPI specs documents in docs/specs to | 1 | From: Vikram Garhwal <vikram.garhwal@bytedance.com> |
---|---|---|---|
2 | appropriate sections of MAINTAINERS. | ||
3 | 2 | ||
3 | Previously, maintainer role was paused due to inactive email id. Commit id: | ||
4 | c009d715721861984c4987bcc78b7ee183e86d75. | ||
5 | |||
6 | Signed-off-by: Vikram Garhwal <vikram.garhwal@bytedance.com> | ||
7 | Reviewed-by: Francisco Iglesias <francisco.iglesias@amd.com> | ||
8 | Message-id: 20241204184205.12952-1-vikram.garhwal@bytedance.com | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Reviewed-by: Igor Mammedov <imammedo@redhat.com> | ||
6 | Message-id: 20210727170414.3368-6-peter.maydell@linaro.org | ||
7 | --- | 10 | --- |
8 | MAINTAINERS | 5 +++++ | 11 | MAINTAINERS | 2 ++ |
9 | 1 file changed, 5 insertions(+) | 12 | 1 file changed, 2 insertions(+) |
10 | 13 | ||
11 | diff --git a/MAINTAINERS b/MAINTAINERS | 14 | diff --git a/MAINTAINERS b/MAINTAINERS |
12 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
13 | --- a/MAINTAINERS | 16 | --- a/MAINTAINERS |
14 | +++ b/MAINTAINERS | 17 | +++ b/MAINTAINERS |
15 | @@ -XXX,XX +XXX,XX @@ F: qapi/acpi.json | 18 | @@ -XXX,XX +XXX,XX @@ F: tests/qtest/fuzz-sb16-test.c |
16 | F: tests/qtest/bios-tables-test* | 19 | |
17 | F: tests/qtest/acpi-utils.[hc] | 20 | Xilinx CAN |
18 | F: tests/data/acpi/ | 21 | M: Francisco Iglesias <francisco.iglesias@amd.com> |
19 | +F: docs/specs/acpi_cpu_hotplug.rst | 22 | +M: Vikram Garhwal <vikram.garhwal@bytedance.com> |
20 | +F: docs/specs/acpi_mem_hotplug.rst | 23 | S: Maintained |
21 | +F: docs/specs/acpi_pci_hotplug.rst | 24 | F: hw/net/can/xlnx-* |
22 | +F: docs/specs/acpi_hw_reduced_hotplug.rst | 25 | F: include/hw/net/xlnx-* |
23 | 26 | @@ -XXX,XX +XXX,XX @@ F: include/hw/rx/ | |
24 | ACPI/HEST/GHES | 27 | CAN bus subsystem and hardware |
25 | R: Dongjiu Geng <gengdongjiu1@gmail.com> | 28 | M: Pavel Pisa <pisa@cmp.felk.cvut.cz> |
26 | @@ -XXX,XX +XXX,XX @@ F: hw/acpi/nvdimm.c | 29 | M: Francisco Iglesias <francisco.iglesias@amd.com> |
27 | F: hw/mem/nvdimm.c | 30 | +M: Vikram Garhwal <vikram.garhwal@bytedance.com> |
28 | F: include/hw/mem/nvdimm.h | 31 | S: Maintained |
29 | F: docs/nvdimm.txt | 32 | W: https://canbus.pages.fel.cvut.cz/ |
30 | +F: docs/specs/acpi_nvdimm.rst | 33 | F: net/can/* |
31 | |||
32 | e1000x | ||
33 | M: Dmitry Fleytman <dmitry.fleytman@gmail.com> | ||
34 | -- | 34 | -- |
35 | 2.20.1 | 35 | 2.34.1 |
36 | |||
37 | diff view generated by jsdifflib |