1
Nothing too exciting, but does include the last bits of v8.1M support work.
1
More accumulated patches from during the freeze...
2
2
3
-- PMM
3
The following changes since commit c83fcfaf8a54d0d034bd0edf7bbb3b0d16669be9:
4
4
5
The following changes since commit e79de63ab1bd1f6550e7b915e433bec1ad1a870a:
5
Merge remote-tracking branch 'remotes/armbru/tags/pull-qapi-2021-08-26' into staging (2021-08-26 13:42:34 +0100)
6
7
Merge remote-tracking branch 'remotes/rth-gitlab/tags/pull-tcg-20210107' into staging (2021-01-07 20:34:05 +0000)
8
6
9
are available in the Git repository at:
7
are available in the Git repository at:
10
8
11
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20210108
9
https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20210826
12
10
13
for you to fetch changes up to c9f8511ea8d2b80723af0fea1f716d752c1b5208:
11
for you to fetch changes up to d2e6f370138a7f32bc28b20dcd55374b7a638f39:
14
12
15
docs/system: arm: Add sabrelite board description (2021-01-08 15:13:39 +0000)
13
hw/arm/xlnx-zynqmp: Add unimplemented APU mmio (2021-08-26 17:02:01 +0100)
16
14
17
----------------------------------------------------------------
15
----------------------------------------------------------------
18
target-arm queue:
16
target-arm queue:
19
* intc/arm_gic: Fix gic_irq_signaling_enabled() for vCPUs
17
* hw/dma/xlnx-zdma, xlnx_csu_dma: Require 'dma' link property to be set
20
* target/arm: Fix MTE0_ACTIVE
18
* hw/arm/Kconfig: no need to enable ACPI_MEMORY_HOTPLUG/ACPI_NVDIMM explicitly
21
* target/arm: Implement v8.1M and Cortex-M55 model
19
* target/arm/cpu: Introduce sve_vq_supported bitmap
22
* hw/arm/highbank: Drop dead KVM support code
20
* docs/specs: Convert ACPI spec docs to rST
23
* util/qemu-timer: Make timer_free() imply timer_del()
21
* arch_init: Clean up and refactoring
24
* various devices: Use ptimer_free() in finalize function
22
* hw/core/loader: In gunzip(), check index is in range before use, not after
25
* docs/system: arm: Add sabrelite board description
23
* softmmu/physmem.c: Remove unneeded NULL check in qemu_ram_alloc_from_fd()
26
* sabrelite: Minor fixes to allow booting U-Boot
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
27
32
28
----------------------------------------------------------------
33
----------------------------------------------------------------
29
Andrew Jones (1):
34
Andrew Jones (4):
30
hw/arm/virt: Remove virt machine state 'smp_cpus'
35
target/arm/cpu: Introduce sve_vq_supported bitmap
36
target/arm/kvm64: Ensure sve vls map is completely clear
37
target/arm/cpu64: Replace kvm_supported with sve_vq_supported
38
target/arm/cpu64: Validate sve vector lengths are supported
31
39
32
Bin Meng (4):
40
Ani Sinha (1):
33
hw/misc: imx6_ccm: Update PMU_MISC0 reset value
41
hw/arm/Kconfig: no need to enable ACPI_MEMORY_HOTPLUG/ACPI_NVDIMM explicitly
34
hw/msic: imx6_ccm: Correct register value for silicon type
35
hw/arm: sabrelite: Connect the Ethernet PHY at address 6
36
docs/system: arm: Add sabrelite board description
37
42
38
Edgar E. Iglesias (1):
43
Peter Maydell (26):
39
intc/arm_gic: Fix gic_irq_signaling_enabled() for vCPUs
44
docs/specs/acpu_cpu_hotplug: Convert to rST
45
docs/specs/acpi_mem_hotplug: Convert to rST
46
docs/specs/acpi_pci_hotplug: Convert to rST
47
docs/specs/acpi_nvdimm: Convert to rST
48
MAINTAINERS: Add ACPI specs documents to ACPI and NVDIMM sections
49
softmmu: Use accel_find("xen") instead of xen_available()
50
monitor: Use accel_find("kvm") instead of kvm_available()
51
softmmu/arch_init.c: Trim down include list
52
meson.build: Define QEMU_ARCH in config-target.h
53
arch_init.h: Add QEMU_ARCH_HEXAGON
54
arch_init.h: Move QEMU_ARCH_VIRTIO_* to qdev-monitor.c
55
arch_init.h: Don't include arch_init.h unnecessarily
56
stubs: Remove unused arch_type.c stub
57
hw/core/loader: In gunzip(), check index is in range before use, not after
58
softmmu/physmem.c: Remove unneeded NULL check in qemu_ram_alloc_from_fd()
59
softmmu/physmem.c: Check return value from realpath()
60
net: Zero sockaddr_in in parse_host_port()
61
gdbstub: Zero-initialize sockaddr structs
62
tests/qtest/ipmi-bt-test: Zero-initialize sockaddr struct
63
tests/tcg/multiarch/linux-test: Zero-initialize sockaddr structs
64
raspi: Use error_fatal for SoC realize errors, not error_abort
65
target/arm: Avoid assertion trying to use KVM and multiple ASes
66
hw/arm/virt: Delete EL3 error checksnow provided in CPU realize
67
target/arm: Implement HSTR.TTEE
68
target/arm: Implement HSTR.TJDBX
69
target/arm: Do hflags rebuild in cpsr_write()
40
70
41
Gan Qixin (7):
71
Philippe Mathieu-Daudé (4):
42
digic-timer: Use ptimer_free() in the finalize function to avoid memleaks
72
hw/arm/xlnx-zynqmp: Realize qspi controller *after* qspi_dma
43
allwinner-a10-pit: Use ptimer_free() in the finalize function to avoid memleaks
73
hw/dma/xlnx_csu_dma: Run trivial checks early in realize()
44
exynos4210_rtc: Use ptimer_free() in the finalize function to avoid memleaks
74
hw/dma/xlnx_csu_dma: Always expect 'dma' link property to be set
45
exynos4210_pwm: Use ptimer_free() in the finalize function to avoid memleaks
75
hw/dma/xlnx-zdma Always expect 'dma' link property to be set
46
mss-timer: Use ptimer_free() in the finalize function to avoid memleaks
47
musicpal: Use ptimer_free() in the finalize function to avoid memleaks
48
exynos4210_mct: Use ptimer_free() in the finalize function to avoid memleaks
49
76
50
Peter Maydell (9):
77
Tong Ho (2):
51
hw/intc/armv7m_nvic: Correct handling of CCR.BFHFNMIGN
78
hw/arm/xlnx-versal: Add unimplemented APU mmio
52
target/arm: Correct store of FPSCR value via FPCXT_S
79
hw/arm/xlnx-zynqmp: Add unimplemented APU mmio
53
target/arm: Implement FPCXT_NS fp system register
54
target/arm: Implement Cortex-M55 model
55
hw/arm/highbank: Drop dead KVM support code
56
util/qemu-timer: Make timer_free() imply timer_del()
57
scripts/coccinelle: New script to remove unnecessary timer_del() calls
58
Remove superfluous timer_del() calls
59
target/arm: Remove timer_del()/timer_deinit() before timer_free()
60
80
61
Richard Henderson (1):
81
docs/specs/acpi_cpu_hotplug.rst | 235 +++++++++++++++++++++
62
target/arm: Fix MTE0_ACTIVE
82
docs/specs/acpi_cpu_hotplug.txt | 160 --------------
83
docs/specs/acpi_mem_hotplug.rst | 128 +++++++++++
84
docs/specs/acpi_mem_hotplug.txt | 94 ---------
85
docs/specs/acpi_nvdimm.rst | 228 ++++++++++++++++++++
86
docs/specs/acpi_nvdimm.txt | 188 -----------------
87
.../{acpi_pci_hotplug.txt => acpi_pci_hotplug.rst} | 37 ++--
88
docs/specs/index.rst | 4 +
89
meson.build | 2 +
90
include/hw/arm/xlnx-versal.h | 2 +
91
include/hw/arm/xlnx-zynqmp.h | 7 +
92
include/hw/dma/xlnx-zdma.h | 2 +-
93
include/hw/dma/xlnx_csu_dma.h | 2 +-
94
include/sysemu/arch_init.h | 15 +-
95
target/arm/cpu.h | 17 +-
96
target/arm/helper.h | 2 +
97
target/arm/syndrome.h | 7 +
98
blockdev.c | 1 -
99
gdbstub.c | 4 +-
100
hw/arm/raspi.c | 2 +-
101
hw/arm/virt.c | 5 -
102
hw/arm/xlnx-versal.c | 4 +
103
hw/arm/xlnx-zynqmp.c | 86 ++++++--
104
hw/core/loader.c | 35 ++-
105
hw/dma/xlnx-zdma.c | 24 +--
106
hw/dma/xlnx_csu_dma.c | 31 ++-
107
hw/i386/pc.c | 1 -
108
hw/i386/pc_piix.c | 1 -
109
hw/i386/pc_q35.c | 1 -
110
hw/mips/jazz.c | 1 -
111
hw/mips/malta.c | 1 -
112
hw/ppc/prep.c | 1 -
113
hw/riscv/sifive_e.c | 1 -
114
hw/riscv/sifive_u.c | 1 -
115
hw/riscv/spike.c | 1 -
116
hw/riscv/virt.c | 1 -
117
linux-user/arm/signal.c | 2 -
118
monitor/qmp-cmds.c | 3 +-
119
net/net.c | 2 +
120
softmmu/arch_init.c | 66 ------
121
softmmu/physmem.c | 5 +-
122
softmmu/qdev-monitor.c | 9 +
123
softmmu/vl.c | 6 +-
124
stubs/arch_type.c | 4 -
125
target/arm/cpu.c | 23 ++
126
target/arm/cpu64.c | 118 +++++------
127
target/arm/helper.c | 40 +++-
128
target/arm/kvm64.c | 2 +-
129
target/arm/op_helper.c | 16 ++
130
target/arm/translate.c | 12 ++
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
63
147
64
docs/system/arm/sabrelite.rst | 119 ++++++++++++++++++++++++++
65
docs/system/target-arm.rst | 1 +
66
scripts/coccinelle/timer-del-timer-free.cocci | 18 ++++
67
include/hw/arm/virt.h | 3 +-
68
include/qemu/timer.h | 24 +++---
69
block/iscsi.c | 2 -
70
block/nbd.c | 1 -
71
block/qcow2.c | 1 -
72
hw/arm/highbank.c | 14 +--
73
hw/arm/musicpal.c | 12 +++
74
hw/arm/sabrelite.c | 4 +
75
hw/arm/virt-acpi-build.c | 9 +-
76
hw/arm/virt.c | 21 +++--
77
hw/block/nvme.c | 2 -
78
hw/char/serial.c | 2 -
79
hw/char/virtio-serial-bus.c | 2 -
80
hw/ide/core.c | 1 -
81
hw/input/hid.c | 1 -
82
hw/intc/apic.c | 1 -
83
hw/intc/arm_gic.c | 4 +-
84
hw/intc/armv7m_nvic.c | 15 ++++
85
hw/intc/ioapic.c | 1 -
86
hw/ipmi/ipmi_bmc_extern.c | 1 -
87
hw/misc/imx6_ccm.c | 4 +-
88
hw/net/e1000.c | 3 -
89
hw/net/e1000e_core.c | 8 --
90
hw/net/pcnet-pci.c | 1 -
91
hw/net/rtl8139.c | 1 -
92
hw/net/spapr_llan.c | 1 -
93
hw/net/virtio-net.c | 2 -
94
hw/rtc/exynos4210_rtc.c | 9 ++
95
hw/s390x/s390-pci-inst.c | 1 -
96
hw/sd/sd.c | 1 -
97
hw/sd/sdhci.c | 2 -
98
hw/timer/allwinner-a10-pit.c | 11 +++
99
hw/timer/digic-timer.c | 8 ++
100
hw/timer/exynos4210_mct.c | 14 +++
101
hw/timer/exynos4210_pwm.c | 11 +++
102
hw/timer/mss-timer.c | 13 +++
103
hw/usb/dev-hub.c | 1 -
104
hw/usb/hcd-ehci.c | 1 -
105
hw/usb/hcd-ohci-pci.c | 1 -
106
hw/usb/hcd-uhci.c | 1 -
107
hw/usb/hcd-xhci.c | 1 -
108
hw/usb/redirect.c | 1 -
109
hw/vfio/display.c | 1 -
110
hw/virtio/vhost-vsock-common.c | 1 -
111
hw/virtio/virtio-balloon.c | 1 -
112
hw/virtio/virtio-rng.c | 1 -
113
hw/watchdog/wdt_diag288.c | 1 -
114
hw/watchdog/wdt_i6300esb.c | 1 -
115
migration/colo.c | 1 -
116
monitor/hmp-cmds.c | 1 -
117
net/announce.c | 1 -
118
net/colo-compare.c | 1 -
119
net/slirp.c | 1 -
120
replay/replay-debugging.c | 1 -
121
target/arm/cpu.c | 2 -
122
target/arm/cpu_tcg.c | 42 +++++++++
123
target/arm/helper.c | 2 +-
124
target/s390x/cpu.c | 2 -
125
ui/console.c | 1 -
126
ui/spice-core.c | 1 -
127
util/throttle.c | 1 -
128
target/arm/translate-vfp.c.inc | 114 ++++++++++++++++++++++--
129
65 files changed, 421 insertions(+), 111 deletions(-)
130
create mode 100644 docs/system/arm/sabrelite.rst
131
create mode 100644 scripts/coccinelle/timer-del-timer-free.cocci
132
diff view generated by jsdifflib
1
From: Gan Qixin <ganqixin@huawei.com>
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
2
2
3
When running device-introspect-test, a memory leak occurred in the
3
If we link QOM object (a) as a property of QOM object (b),
4
mv88w8618_pit_init function, so use ptimer_free() in the finalize function to
4
we must set the property *before* (b) is realized.
5
avoid it.
6
5
7
ASAN shows memory leak stack:
6
Move QSPI realization *after* QSPI DMA.
8
7
9
Indirect leak of 192 byte(s) in 4 object(s) allocated from:
8
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
10
#0 0xffffab97e1f0 in __interceptor_calloc (/lib64/libasan.so.5+0xee1f0)
9
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
11
#1 0xffffab256800 in g_malloc0 (/lib64/libglib-2.0.so.0+0x56800)
10
Message-id: 20210819163422.2863447-2-philmd@redhat.com
12
#2 0xaaabf555db84 in timer_new_full /qemu/include/qemu/timer.h:523
13
#3 0xaaabf555db84 in timer_new /qemu/include/qemu/timer.h:544
14
#4 0xaaabf555db84 in timer_new_ns /qemu/include/qemu/timer.h:562
15
#5 0xaaabf555db84 in ptimer_init /qemu/hw/core/ptimer.c:433
16
#6 0xaaabf5bb2290 in mv88w8618_timer_init /qemu/hw/arm/musicpal.c:862
17
#7 0xaaabf5bb2290 in mv88w8618_pit_init /qemu/hw/arm/musicpal.c:954
18
#8 0xaaabf6339f6c in object_initialize_with_type /qemu/qom/object.c:515
19
#9 0xaaabf633a1e0 in object_new_with_type /qemu/qom/object.c:729
20
#10 0xaaabf6375e40 in qmp_device_list_properties /qemu/qom/qom-qmp-cmds.c:153
21
#11 0xaaabf5a95540 in qdev_device_help /qemu/softmmu/qdev-monitor.c:283
22
#12 0xaaabf5a96940 in qmp_device_add /qemu/softmmu/qdev-monitor.c:801
23
24
Reported-by: Euler Robot <euler.robot@huawei.com>
25
Signed-off-by: Gan Qixin <ganqixin@huawei.com>
26
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
27
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
28
---
12
---
29
hw/arm/musicpal.c | 12 ++++++++++++
13
hw/arm/xlnx-zynqmp.c | 42 ++++++++++++++++++++----------------------
30
1 file changed, 12 insertions(+)
14
1 file changed, 20 insertions(+), 22 deletions(-)
31
15
32
diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c
16
diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c
33
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
34
--- a/hw/arm/musicpal.c
18
--- a/hw/arm/xlnx-zynqmp.c
35
+++ b/hw/arm/musicpal.c
19
+++ b/hw/arm/xlnx-zynqmp.c
36
@@ -XXX,XX +XXX,XX @@ static void mv88w8618_pit_init(Object *obj)
20
@@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp)
37
sysbus_init_mmio(dev, &s->iomem);
21
g_free(bus_name);
22
}
23
24
- if (!sysbus_realize(SYS_BUS_DEVICE(&s->qspi), errp)) {
25
- return;
26
- }
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
- }
43
-
44
if (!sysbus_realize(SYS_BUS_DEVICE(&s->dp), errp)) {
45
return;
46
}
47
@@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp)
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
+
54
+ if (!object_property_set_link(OBJECT(&s->qspi), "stream-connected-dma",
55
+ OBJECT(&s->qspi_dma), errp)) {
56
+ return;
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
+ }
38
}
73
}
39
74
40
+static void mv88w8618_pit_finalize(Object *obj)
75
static Property xlnx_zynqmp_props[] = {
41
+{
42
+ SysBusDevice *dev = SYS_BUS_DEVICE(obj);
43
+ mv88w8618_pit_state *s = MV88W8618_PIT(dev);
44
+ int i;
45
+
46
+ for (i = 0; i < 4; i++) {
47
+ ptimer_free(s->timer[i].ptimer);
48
+ }
49
+}
50
+
51
static const VMStateDescription mv88w8618_timer_vmsd = {
52
.name = "timer",
53
.version_id = 1,
54
@@ -XXX,XX +XXX,XX @@ static const TypeInfo mv88w8618_pit_info = {
55
.parent = TYPE_SYS_BUS_DEVICE,
56
.instance_size = sizeof(mv88w8618_pit_state),
57
.instance_init = mv88w8618_pit_init,
58
+ .instance_finalize = mv88w8618_pit_finalize,
59
.class_init = mv88w8618_pit_class_init,
60
};
61
62
--
76
--
63
2.20.1
77
2.20.1
64
78
65
79
diff view generated by jsdifflib
1
From: Gan Qixin <ganqixin@huawei.com>
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
2
2
3
When running device-introspect-test, a memory leak occurred in the
3
If some property are not set, we'll return indicating a failure,
4
exynos4210_mct_init function, so use ptimer_free() in the finalize function to
4
so it is pointless to allocate / initialize some fields too early.
5
avoid it.
5
Move the trivial checks earlier in realize().
6
6
7
ASAN shows memory leak stack:
7
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
8
8
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
9
Indirect leak of 96 byte(s) in 1 object(s) allocated from:
9
Message-id: 20210819163422.2863447-3-philmd@redhat.com
10
#0 0xffffab97e1f0 in __interceptor_calloc (/lib64/libasan.so.5+0xee1f0)
11
#1 0xffffab256800 in g_malloc0 (/lib64/libglib-2.0.so.0+0x56800)
12
#2 0xaaabf555db78 in ptimer_init /qemu/hw/core/ptimer.c:432
13
#3 0xaaabf56b01a0 in exynos4210_mct_init /qemu/hw/timer/exynos4210_mct.c:1505
14
#4 0xaaabf6339f6c in object_initialize_with_type /qemu/qom/object.c:515
15
#5 0xaaabf633a1e0 in object_new_with_type /qemu/qom/object.c:729
16
#6 0xaaabf6375e40 in qmp_device_list_properties /qemu/qom/qom-qmp-cmds.c:153
17
#7 0xaaabf653d8ec in qmp_marshal_device_list_properties /qemu/qapi/qapi-commands-qdev.c:59
18
#8 0xaaabf6587d08 in do_qmp_dispatch_bh /qemu/qapi/qmp-dispatch.c:110
19
#9 0xaaabf6552708 in aio_bh_call /qemu/util/async.c:136
20
#10 0xaaabf6552708 in aio_bh_poll /qemu/util/async.c:164
21
#11 0xaaabf655f19c in aio_dispatch /qemu/util/aio-posix.c:381
22
#12 0xaaabf65523f4 in aio_ctx_dispatch /qemu/util/async.c:306
23
24
Reported-by: Euler Robot <euler.robot@huawei.com>
25
Signed-off-by: Gan Qixin <ganqixin@huawei.com>
26
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
27
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
28
---
11
---
29
hw/timer/exynos4210_mct.c | 14 ++++++++++++++
12
hw/dma/xlnx_csu_dma.c | 10 +++++-----
30
1 file changed, 14 insertions(+)
13
1 file changed, 5 insertions(+), 5 deletions(-)
31
14
32
diff --git a/hw/timer/exynos4210_mct.c b/hw/timer/exynos4210_mct.c
15
diff --git a/hw/dma/xlnx_csu_dma.c b/hw/dma/xlnx_csu_dma.c
33
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
34
--- a/hw/timer/exynos4210_mct.c
17
--- a/hw/dma/xlnx_csu_dma.c
35
+++ b/hw/timer/exynos4210_mct.c
18
+++ b/hw/dma/xlnx_csu_dma.c
36
@@ -XXX,XX +XXX,XX @@ static void exynos4210_mct_init(Object *obj)
19
@@ -XXX,XX +XXX,XX @@ static void xlnx_csu_dma_realize(DeviceState *dev, Error **errp)
37
sysbus_init_mmio(dev, &s->iomem);
20
XlnxCSUDMA *s = XLNX_CSU_DMA(dev);
38
}
21
RegisterInfoArray *reg_array;
39
22
40
+static void exynos4210_mct_finalize(Object *obj)
23
+ if (!s->is_dst && !s->tx_dev) {
41
+{
24
+ error_setg(errp, "zynqmp.csu-dma: Stream not connected");
42
+ int i;
25
+ return;
43
+ Exynos4210MCTState *s = EXYNOS4210_MCT(obj);
26
+ }
44
+
27
+
45
+ ptimer_free(s->g_timer.ptimer_frc);
28
reg_array =
46
+
29
register_init_block32(dev, xlnx_csu_dma_regs_info[!!s->is_dst],
47
+ for (i = 0; i < 2; i++) {
30
XLNX_CSU_DMA_R_MAX,
48
+ ptimer_free(s->l_timer[i].tick_timer.ptimer_tick);
31
@@ -XXX,XX +XXX,XX @@ static void xlnx_csu_dma_realize(DeviceState *dev, Error **errp)
49
+ ptimer_free(s->l_timer[i].ptimer_frc);
32
sysbus_init_mmio(SYS_BUS_DEVICE(dev), &s->iomem);
50
+ }
33
sysbus_init_irq(SYS_BUS_DEVICE(dev), &s->irq);
51
+}
34
52
+
35
- if (!s->is_dst && !s->tx_dev) {
53
static void exynos4210_mct_class_init(ObjectClass *klass, void *data)
36
- error_setg(errp, "zynqmp.csu-dma: Stream not connected");
54
{
37
- return;
55
DeviceClass *dc = DEVICE_CLASS(klass);
38
- }
56
@@ -XXX,XX +XXX,XX @@ static const TypeInfo exynos4210_mct_info = {
39
-
57
.parent = TYPE_SYS_BUS_DEVICE,
40
s->src_timer = ptimer_init(xlnx_csu_dma_src_timeout_hit,
58
.instance_size = sizeof(Exynos4210MCTState),
41
s, PTIMER_POLICY_DEFAULT);
59
.instance_init = exynos4210_mct_init,
60
+ .instance_finalize = exynos4210_mct_finalize,
61
.class_init = exynos4210_mct_class_init,
62
};
63
42
64
--
43
--
65
2.20.1
44
2.20.1
66
45
67
46
diff view generated by jsdifflib
New patch
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
1
2
3
Simplify by always passing a MemoryRegion property to the device.
4
Doing so we can move the AddressSpace field to the device struct,
5
removing need for heap allocation.
6
7
Update the Xilinx ZynqMP SoC model to pass the default system
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>
13
Message-id: 20210819163422.2863447-4-philmd@redhat.com
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
---
16
include/hw/dma/xlnx_csu_dma.h | 2 +-
17
hw/arm/xlnx-zynqmp.c | 4 ++++
18
hw/dma/xlnx_csu_dma.c | 21 ++++++++++-----------
19
3 files changed, 15 insertions(+), 12 deletions(-)
20
21
diff --git a/include/hw/dma/xlnx_csu_dma.h b/include/hw/dma/xlnx_csu_dma.h
22
index XXXXXXX..XXXXXXX 100644
23
--- a/include/hw/dma/xlnx_csu_dma.h
24
+++ b/include/hw/dma/xlnx_csu_dma.h
25
@@ -XXX,XX +XXX,XX @@ typedef struct XlnxCSUDMA {
26
MemoryRegion iomem;
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
}
41
42
+ if (!object_property_set_link(OBJECT(&s->qspi_dma), "dma",
43
+ OBJECT(system_memory), errp)) {
44
+ return;
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
- }
105
-
106
s->attr = MEMTXATTRS_UNSPECIFIED;
107
108
s->r_size_last_word = 0;
109
--
110
2.20.1
111
112
diff view generated by jsdifflib
1
From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com>
1
From: Philippe Mathieu-Daudé <philmd@redhat.com>
2
2
3
Correct the indexing into s->cpu_ctlr for vCPUs.
3
Simplify by always passing a MemoryRegion property to the device.
4
Doing so we can move the AddressSpace field to the device struct,
5
removing need for heap allocation.
4
6
5
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
7
Update the Xilinx ZynqMP / Versal SoC models to pass the default
6
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
8
system memory instead of a NULL value.
7
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
9
8
Message-id: 20201214222154.3480243-2-edgar.iglesias@gmail.com
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
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
14
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
15
---
11
hw/intc/arm_gic.c | 4 +++-
16
include/hw/dma/xlnx-zdma.h | 2 +-
12
1 file changed, 3 insertions(+), 1 deletion(-)
17
hw/arm/xlnx-versal.c | 2 ++
18
hw/arm/xlnx-zynqmp.c | 8 ++++++++
19
hw/dma/xlnx-zdma.c | 24 ++++++++++++------------
20
4 files changed, 23 insertions(+), 13 deletions(-)
13
21
14
diff --git a/hw/intc/arm_gic.c b/hw/intc/arm_gic.c
22
diff --git a/include/hw/dma/xlnx-zdma.h b/include/hw/dma/xlnx-zdma.h
15
index XXXXXXX..XXXXXXX 100644
23
index XXXXXXX..XXXXXXX 100644
16
--- a/hw/intc/arm_gic.c
24
--- a/include/hw/dma/xlnx-zdma.h
17
+++ b/hw/intc/arm_gic.c
25
+++ b/include/hw/dma/xlnx-zdma.h
18
@@ -XXX,XX +XXX,XX @@ static inline void gic_get_best_virq(GICState *s, int cpu,
26
@@ -XXX,XX +XXX,XX @@ struct XlnxZDMA {
19
static inline bool gic_irq_signaling_enabled(GICState *s, int cpu, bool virt,
27
MemoryRegion iomem;
20
int group_mask)
28
MemTxAttrs attr;
21
{
29
MemoryRegion *dma_mr;
22
+ int cpu_iface = virt ? (cpu + GIC_NCPU) : cpu;
30
- AddressSpace *dma_as;
23
+
31
+ AddressSpace dma_as;
24
if (!virt && !(s->ctlr & group_mask)) {
32
qemu_irq irq_zdma_ch_imr;
33
34
struct {
35
diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
36
index XXXXXXX..XXXXXXX 100644
37
--- a/hw/arm/xlnx-versal.c
38
+++ b/hw/arm/xlnx-versal.c
39
@@ -XXX,XX +XXX,XX @@ static void versal_create_admas(Versal *s, qemu_irq *pic)
40
TYPE_XLNX_ZDMA);
41
dev = DEVICE(&s->lpd.iou.adma[i]);
42
object_property_set_int(OBJECT(dev), "bus-width", 128, &error_abort);
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
}
56
+ if (!object_property_set_link(OBJECT(&s->gdma[i]), "dma",
57
+ OBJECT(system_memory), errp)) {
58
+ return;
59
+ }
60
if (!sysbus_realize(SYS_BUS_DEVICE(&s->gdma[i]), errp)) {
61
return;
62
}
63
@@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp)
64
}
65
66
for (i = 0; i < XLNX_ZYNQMP_NUM_ADMA_CH; i++) {
67
+ if (!object_property_set_link(OBJECT(&s->adma[i]), "dma",
68
+ OBJECT(system_memory), errp)) {
69
+ return;
70
+ }
71
if (!sysbus_realize(SYS_BUS_DEVICE(&s->adma[i]), errp)) {
72
return;
73
}
74
diff --git a/hw/dma/xlnx-zdma.c b/hw/dma/xlnx-zdma.c
75
index XXXXXXX..XXXXXXX 100644
76
--- a/hw/dma/xlnx-zdma.c
77
+++ b/hw/dma/xlnx-zdma.c
78
@@ -XXX,XX +XXX,XX @@ static bool zdma_load_descriptor(XlnxZDMA *s, uint64_t addr,
25
return false;
79
return false;
26
}
80
}
27
@@ -XXX,XX +XXX,XX @@ static inline bool gic_irq_signaling_enabled(GICState *s, int cpu, bool virt,
81
28
return false;
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);
29
}
97
}
30
98
31
- if (!(s->cpu_ctlr[cpu] & group_mask)) {
99
zdma_put_regaddr64(s, basereg, next);
32
+ if (!(s->cpu_ctlr[cpu_iface] & group_mask)) {
100
@@ -XXX,XX +XXX,XX @@ static void zdma_write_dst(XlnxZDMA *s, uint8_t *buf, uint32_t len)
33
return false;
101
}
102
}
103
104
- address_space_write(s->dma_as, s->dsc_dst.addr, s->attr, buf, dlen);
105
+ address_space_write(&s->dma_as, s->dsc_dst.addr, s->attr, buf, dlen);
106
if (burst_type == AXI_BURST_INCR) {
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
}
112
} else {
113
- address_space_read(s->dma_as, src_addr, s->attr, s->buf, len);
114
+ address_space_read(&s->dma_as, src_addr, s->attr, s->buf, len);
115
if (burst_type == AXI_BURST_INCR) {
116
src_addr += len;
117
}
118
@@ -XXX,XX +XXX,XX @@ static void zdma_realize(DeviceState *dev, Error **errp)
119
XlnxZDMA *s = XLNX_ZDMA(dev);
120
unsigned int i;
121
122
+ if (!s->dma_mr) {
123
+ error_setg(errp, TYPE_XLNX_ZDMA " 'dma' link not set");
124
+ return;
125
+ }
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
};
34
}
133
}
134
135
- if (s->dma_mr) {
136
- s->dma_as = g_malloc0(sizeof(AddressSpace));
137
- address_space_init(s->dma_as, s->dma_mr, NULL);
138
- } else {
139
- s->dma_as = &address_space_memory;
140
- }
141
s->attr = MEMTXATTRS_UNSPECIFIED;
142
}
35
143
36
--
144
--
37
2.20.1
145
2.20.1
38
146
39
147
diff view generated by jsdifflib
New patch
1
From: Ani Sinha <ani@anisinha.ca>
1
2
3
Since commit
4
36b79e3219d ("hw/acpi/Kconfig: Add missing Kconfig dependencies (build error)"),
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
9
Signed-off-by: Ani Sinha <ani@anisinha.ca>
10
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
11
Message-id: 20210819162637.518507-1-ani@anisinha.ca
12
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
---
14
hw/arm/Kconfig | 2 --
15
1 file changed, 2 deletions(-)
16
17
diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig
18
index XXXXXXX..XXXXXXX 100644
19
--- a/hw/arm/Kconfig
20
+++ b/hw/arm/Kconfig
21
@@ -XXX,XX +XXX,XX @@ config ARM_VIRT
22
select ACPI_PCI
23
select MEM_DEVICE
24
select DIMM
25
- select ACPI_MEMORY_HOTPLUG
26
select ACPI_HW_REDUCED
27
- select ACPI_NVDIMM
28
select ACPI_APEI
29
30
config CHEETAH
31
--
32
2.20.1
33
34
diff view generated by jsdifflib
1
From: Andrew Jones <drjones@redhat.com>
1
From: Andrew Jones <drjones@redhat.com>
2
2
3
virt machine's 'smp_cpus' and machine->smp.cpus must always have the
3
Allow CPUs that support SVE to specify which SVE vector lengths they
4
same value. And, anywhere we have virt machine state we have machine
4
support by setting them in this bitmap. Currently only the 'max' and
5
state. So let's remove the redundancy. Also, to make it easier to see
5
'host' CPU types supports SVE and 'host' requires KVM which obtains
6
that machine->smp is the true source for "smp_cpus" and "max_cpus",
6
its supported bitmap from the host. So, we only need to initialize the
7
avoid passing them in function parameters, preferring instead to get
7
bitmap for 'max' with TCG. And, since 'max' should support all SVE
8
them from the state.
8
vector lengths we simply fill the bitmap. Future CPU types may have
9
9
less trivial maps though.
10
No functional change intended.
11
10
12
Signed-off-by: Andrew Jones <drjones@redhat.com>
11
Signed-off-by: Andrew Jones <drjones@redhat.com>
13
Reviewed-by: David Edmondson <david.edmondson@oracle.com>
12
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
14
Reviewed-by: Ying Fang <fangying1@huawei.com>
13
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
15
Message-id: 20201215174815.51520-1-drjones@redhat.com
14
Message-id: 20210823160647.34028-2-drjones@redhat.com
16
[PMM: minor formatting tweak to smp_cpus variable declaration]
17
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
18
---
16
---
19
include/hw/arm/virt.h | 3 +--
17
target/arm/cpu.h | 4 ++++
20
hw/arm/virt-acpi-build.c | 9 +++++----
18
target/arm/cpu64.c | 2 ++
21
hw/arm/virt.c | 21 ++++++++++-----------
19
2 files changed, 6 insertions(+)
22
3 files changed, 16 insertions(+), 17 deletions(-)
23
20
24
diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h
21
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
25
index XXXXXXX..XXXXXXX 100644
22
index XXXXXXX..XXXXXXX 100644
26
--- a/include/hw/arm/virt.h
23
--- a/target/arm/cpu.h
27
+++ b/include/hw/arm/virt.h
24
+++ b/target/arm/cpu.h
28
@@ -XXX,XX +XXX,XX @@ struct VirtMachineState {
25
@@ -XXX,XX +XXX,XX @@ struct ARMCPU {
29
MemMapEntry *memmap;
26
* While processing properties during initialization, corresponding
30
char *pciehb_nodename;
27
* sve_vq_init bits are set for bits in sve_vq_map that have been
31
const int *irqmap;
28
* set by properties.
32
- int smp_cpus;
29
+ *
33
void *fdt;
30
+ * Bits set in sve_vq_supported represent valid vector lengths for
34
int fdt_size;
31
+ * the CPU type.
35
uint32_t clock_phandle;
32
*/
36
@@ -XXX,XX +XXX,XX @@ static inline int virt_gicv3_redist_region_count(VirtMachineState *vms)
33
DECLARE_BITMAP(sve_vq_map, ARM_MAX_VQ);
37
34
DECLARE_BITMAP(sve_vq_init, ARM_MAX_VQ);
38
assert(vms->gic_version == VIRT_GIC_VERSION_3);
35
+ DECLARE_BITMAP(sve_vq_supported, ARM_MAX_VQ);
39
36
40
- return vms->smp_cpus > redist0_capacity ? 2 : 1;
37
/* Generic timer counter frequency, in Hz */
41
+ return MACHINE(vms)->smp.cpus > redist0_capacity ? 2 : 1;
38
uint64_t gt_cntfrq_hz;
42
}
39
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
43
44
#endif /* QEMU_ARM_VIRT_H */
45
diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
46
index XXXXXXX..XXXXXXX 100644
40
index XXXXXXX..XXXXXXX 100644
47
--- a/hw/arm/virt-acpi-build.c
41
--- a/target/arm/cpu64.c
48
+++ b/hw/arm/virt-acpi-build.c
42
+++ b/target/arm/cpu64.c
49
@@ -XXX,XX +XXX,XX @@
43
@@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj)
50
44
/* Default to PAUTH on, with the architected algorithm. */
51
#define ACPI_BUILD_TABLE_SIZE 0x20000
45
qdev_property_add_static(DEVICE(obj), &arm_cpu_pauth_property);
52
46
qdev_property_add_static(DEVICE(obj), &arm_cpu_pauth_impdef_property);
53
-static void acpi_dsdt_add_cpus(Aml *scope, int smp_cpus)
47
+
54
+static void acpi_dsdt_add_cpus(Aml *scope, VirtMachineState *vms)
48
+ bitmap_fill(cpu->sve_vq_supported, ARM_MAX_VQ);
55
{
56
+ MachineState *ms = MACHINE(vms);
57
uint16_t i;
58
59
- for (i = 0; i < smp_cpus; i++) {
60
+ for (i = 0; i < ms->smp.cpus; i++) {
61
Aml *dev = aml_device("C%.03X", i);
62
aml_append(dev, aml_name_decl("_HID", aml_string("ACPI0007")));
63
aml_append(dev, aml_name_decl("_UID", aml_int(i)));
64
@@ -XXX,XX +XXX,XX @@ build_madt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
65
gicd->base_address = cpu_to_le64(memmap[VIRT_GIC_DIST].base);
66
gicd->version = vms->gic_version;
67
68
- for (i = 0; i < vms->smp_cpus; i++) {
69
+ for (i = 0; i < MACHINE(vms)->smp.cpus; i++) {
70
AcpiMadtGenericCpuInterface *gicc = acpi_data_push(table_data,
71
sizeof(*gicc));
72
ARMCPU *armcpu = ARM_CPU(qemu_get_cpu(i));
73
@@ -XXX,XX +XXX,XX @@ build_dsdt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
74
* the RTC ACPI device at all when using UEFI.
75
*/
76
scope = aml_scope("\\_SB");
77
- acpi_dsdt_add_cpus(scope, vms->smp_cpus);
78
+ acpi_dsdt_add_cpus(scope, vms);
79
acpi_dsdt_add_uart(scope, &memmap[VIRT_UART],
80
(irqmap[VIRT_UART] + ARM_SPI_BASE));
81
if (vmc->acpi_expose_flash) {
82
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
83
index XXXXXXX..XXXXXXX 100644
84
--- a/hw/arm/virt.c
85
+++ b/hw/arm/virt.c
86
@@ -XXX,XX +XXX,XX @@ static void fdt_add_timer_nodes(const VirtMachineState *vms)
87
if (vms->gic_version == VIRT_GIC_VERSION_2) {
88
irqflags = deposit32(irqflags, GIC_FDT_IRQ_PPI_CPU_START,
89
GIC_FDT_IRQ_PPI_CPU_WIDTH,
90
- (1 << vms->smp_cpus) - 1);
91
+ (1 << MACHINE(vms)->smp.cpus) - 1);
92
}
49
}
93
50
94
qemu_fdt_add_subnode(vms->fdt, "/timer");
51
aarch64_add_sve_properties(obj);
95
@@ -XXX,XX +XXX,XX @@ static void fdt_add_cpu_nodes(const VirtMachineState *vms)
96
int cpu;
97
int addr_cells = 1;
98
const MachineState *ms = MACHINE(vms);
99
+ int smp_cpus = ms->smp.cpus;
100
101
/*
102
* From Documentation/devicetree/bindings/arm/cpus.txt
103
@@ -XXX,XX +XXX,XX @@ static void fdt_add_cpu_nodes(const VirtMachineState *vms)
104
* The simplest way to go is to examine affinity IDs of all our CPUs. If
105
* at least one of them has Aff3 populated, we set #address-cells to 2.
106
*/
107
- for (cpu = 0; cpu < vms->smp_cpus; cpu++) {
108
+ for (cpu = 0; cpu < smp_cpus; cpu++) {
109
ARMCPU *armcpu = ARM_CPU(qemu_get_cpu(cpu));
110
111
if (armcpu->mp_affinity & ARM_AFF3_MASK) {
112
@@ -XXX,XX +XXX,XX @@ static void fdt_add_cpu_nodes(const VirtMachineState *vms)
113
qemu_fdt_setprop_cell(vms->fdt, "/cpus", "#address-cells", addr_cells);
114
qemu_fdt_setprop_cell(vms->fdt, "/cpus", "#size-cells", 0x0);
115
116
- for (cpu = vms->smp_cpus - 1; cpu >= 0; cpu--) {
117
+ for (cpu = smp_cpus - 1; cpu >= 0; cpu--) {
118
char *nodename = g_strdup_printf("/cpus/cpu@%d", cpu);
119
ARMCPU *armcpu = ARM_CPU(qemu_get_cpu(cpu));
120
CPUState *cs = CPU(armcpu);
121
@@ -XXX,XX +XXX,XX @@ static void fdt_add_cpu_nodes(const VirtMachineState *vms)
122
qemu_fdt_setprop_string(vms->fdt, nodename, "compatible",
123
armcpu->dtb_compatible);
124
125
- if (vms->psci_conduit != QEMU_PSCI_CONDUIT_DISABLED
126
- && vms->smp_cpus > 1) {
127
+ if (vms->psci_conduit != QEMU_PSCI_CONDUIT_DISABLED && smp_cpus > 1) {
128
qemu_fdt_setprop_string(vms->fdt, nodename,
129
"enable-method", "psci");
130
}
131
@@ -XXX,XX +XXX,XX @@ static void fdt_add_pmu_nodes(const VirtMachineState *vms)
132
if (vms->gic_version == VIRT_GIC_VERSION_2) {
133
irqflags = deposit32(irqflags, GIC_FDT_IRQ_PPI_CPU_START,
134
GIC_FDT_IRQ_PPI_CPU_WIDTH,
135
- (1 << vms->smp_cpus) - 1);
136
+ (1 << MACHINE(vms)->smp.cpus) - 1);
137
}
138
139
qemu_fdt_add_subnode(vms->fdt, "/pmu");
140
@@ -XXX,XX +XXX,XX @@ static void finalize_gic_version(VirtMachineState *vms)
141
* virt_cpu_post_init() must be called after the CPUs have
142
* been realized and the GIC has been created.
143
*/
144
-static void virt_cpu_post_init(VirtMachineState *vms, int max_cpus,
145
- MemoryRegion *sysmem)
146
+static void virt_cpu_post_init(VirtMachineState *vms, MemoryRegion *sysmem)
147
{
148
+ int max_cpus = MACHINE(vms)->smp.max_cpus;
149
bool aarch64, pmu, steal_time;
150
CPUState *cpu;
151
152
@@ -XXX,XX +XXX,XX @@ static void machvirt_init(MachineState *machine)
153
exit(1);
154
}
155
156
- vms->smp_cpus = smp_cpus;
157
-
158
if (vms->virt && kvm_enabled()) {
159
error_report("mach-virt: KVM does not support providing "
160
"Virtualization extensions to the guest CPU");
161
@@ -XXX,XX +XXX,XX @@ static void machvirt_init(MachineState *machine)
162
create_fdt(vms);
163
164
possible_cpus = mc->possible_cpu_arch_ids(machine);
165
+ assert(possible_cpus->len == max_cpus);
166
for (n = 0; n < possible_cpus->len; n++) {
167
Object *cpuobj;
168
CPUState *cs;
169
@@ -XXX,XX +XXX,XX @@ static void machvirt_init(MachineState *machine)
170
171
create_gic(vms);
172
173
- virt_cpu_post_init(vms, possible_cpus->len, sysmem);
174
+ virt_cpu_post_init(vms, sysmem);
175
176
fdt_add_pmu_nodes(vms);
177
178
--
52
--
179
2.20.1
53
2.20.1
180
54
181
55
diff view generated by jsdifflib
1
From: Bin Meng <bin.meng@windriver.com>
1
From: Andrew Jones <drjones@redhat.com>
2
2
3
Currently when U-Boot boots, it prints "??" for i.MX processor:
3
bitmap_clear() only clears the given range. While the given
4
range should be sufficient in this case we might as well be
5
100% sure all bits are zeroed by using bitmap_zero().
4
6
5
CPU: Freescale i.MX?? rev1.0 at 792 MHz
7
Signed-off-by: Andrew Jones <drjones@redhat.com>
6
8
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
7
The register that was used to determine the silicon type is
9
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
undocumented in the latest IMX6DQRM (Rev. 6, 05/2020), but we
10
Message-id: 20210823160647.34028-3-drjones@redhat.com
9
can refer to get_cpu_rev() in arch/arm/mach-imx/mx6/soc.c in
10
the U-Boot source codes that USB_ANALOG_DIGPROG is used.
11
12
Update its reset value to indicate i.MX6Q.
13
14
Signed-off-by: Bin Meng <bin.meng@windriver.com>
15
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
16
Message-id: 20210106063504.10841-3-bmeng.cn@gmail.com
17
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
18
---
12
---
19
hw/misc/imx6_ccm.c | 2 +-
13
target/arm/kvm64.c | 2 +-
20
1 file changed, 1 insertion(+), 1 deletion(-)
14
1 file changed, 1 insertion(+), 1 deletion(-)
21
15
22
diff --git a/hw/misc/imx6_ccm.c b/hw/misc/imx6_ccm.c
16
diff --git a/target/arm/kvm64.c b/target/arm/kvm64.c
23
index XXXXXXX..XXXXXXX 100644
17
index XXXXXXX..XXXXXXX 100644
24
--- a/hw/misc/imx6_ccm.c
18
--- a/target/arm/kvm64.c
25
+++ b/hw/misc/imx6_ccm.c
19
+++ b/target/arm/kvm64.c
26
@@ -XXX,XX +XXX,XX @@ static void imx6_ccm_reset(DeviceState *dev)
20
@@ -XXX,XX +XXX,XX @@ void kvm_arm_sve_get_vls(CPUState *cs, unsigned long *map)
27
s->analog[USB_ANALOG_USB2_VBUS_DETECT] = 0x00000004;
21
uint32_t vq = 0;
28
s->analog[USB_ANALOG_USB2_CHRG_DETECT] = 0x00000000;
22
int i, j;
29
s->analog[USB_ANALOG_USB2_MISC] = 0x00000002;
23
30
- s->analog[USB_ANALOG_DIGPROG] = 0x00000000;
24
- bitmap_clear(map, 0, ARM_MAX_VQ);
31
+ s->analog[USB_ANALOG_DIGPROG] = 0x00630000;
25
+ bitmap_zero(map, ARM_MAX_VQ);
32
26
33
/* all PLLs need to be locked */
27
/*
34
s->analog[CCM_ANALOG_PLL_ARM] |= CCM_ANALOG_PLL_LOCK;
28
* KVM ensures all host CPUs support the same set of vector lengths.
35
--
29
--
36
2.20.1
30
2.20.1
37
31
38
32
diff view generated by jsdifflib
New patch
1
From: Andrew Jones <drjones@redhat.com>
1
2
3
Now that we have an ARMCPU member sve_vq_supported we no longer
4
need the local kvm_supported bitmap for KVM's supported vector
5
lengths.
6
7
Signed-off-by: Andrew Jones <drjones@redhat.com>
8
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
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>
12
---
13
target/arm/cpu64.c | 19 +++++++++++--------
14
1 file changed, 11 insertions(+), 8 deletions(-)
15
16
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
17
index XXXXXXX..XXXXXXX 100644
18
--- a/target/arm/cpu64.c
19
+++ b/target/arm/cpu64.c
20
@@ -XXX,XX +XXX,XX @@ void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp)
21
* any of the above. Finally, if SVE is not disabled, then at least one
22
* vector length must be enabled.
23
*/
24
- DECLARE_BITMAP(kvm_supported, ARM_MAX_VQ);
25
DECLARE_BITMAP(tmp, ARM_MAX_VQ);
26
uint32_t vq, max_vq = 0;
27
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
}
42
@@ -XXX,XX +XXX,XX @@ void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp)
43
* For KVM we have to automatically enable all supported unitialized
44
* lengths, even when the smaller lengths are not all powers-of-two.
45
*/
46
- bitmap_andnot(tmp, kvm_supported, cpu->sve_vq_init, max_vq);
47
+ bitmap_andnot(tmp, cpu->sve_vq_supported, cpu->sve_vq_init, max_vq);
48
bitmap_or(cpu->sve_vq_map, cpu->sve_vq_map, tmp, max_vq);
49
} else {
50
/* Propagate enabled bits down through required powers-of-two. */
51
@@ -XXX,XX +XXX,XX @@ void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp)
52
/* Disabling a supported length disables all larger lengths. */
53
for (vq = 1; vq <= ARM_MAX_VQ; ++vq) {
54
if (test_bit(vq - 1, cpu->sve_vq_init) &&
55
- test_bit(vq - 1, kvm_supported)) {
56
+ test_bit(vq - 1, cpu->sve_vq_supported)) {
57
break;
58
}
59
}
60
max_vq = vq <= ARM_MAX_VQ ? vq - 1 : ARM_MAX_VQ;
61
- bitmap_andnot(cpu->sve_vq_map, kvm_supported,
62
+ bitmap_andnot(cpu->sve_vq_map, cpu->sve_vq_supported,
63
cpu->sve_vq_init, max_vq);
64
if (max_vq == 0 || bitmap_empty(cpu->sve_vq_map, max_vq)) {
65
error_setg(errp, "cannot disable sve%d", vq * 128);
66
@@ -XXX,XX +XXX,XX @@ void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp)
67
68
if (kvm_enabled()) {
69
/* Ensure the set of lengths matches what KVM supports. */
70
- bitmap_xor(tmp, cpu->sve_vq_map, kvm_supported, max_vq);
71
+ bitmap_xor(tmp, cpu->sve_vq_map, cpu->sve_vq_supported, max_vq);
72
if (!bitmap_empty(tmp, max_vq)) {
73
vq = find_last_bit(tmp, max_vq) + 1;
74
if (test_bit(vq - 1, cpu->sve_vq_map)) {
75
--
76
2.20.1
77
78
diff view generated by jsdifflib
New patch
1
From: Andrew Jones <drjones@redhat.com>
1
2
3
Future CPU types may specify which vector lengths are supported.
4
We can apply nearly the same logic to validate those lengths
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
12
Signed-off-by: Andrew Jones <drjones@redhat.com>
13
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
14
Message-id: 20210823160647.34028-5-drjones@redhat.com
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
---
17
target/arm/cpu64.c | 101 ++++++++++++++++++++-------------------------
18
1 file changed, 45 insertions(+), 56 deletions(-)
19
20
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
21
index XXXXXXX..XXXXXXX 100644
22
--- a/target/arm/cpu64.c
23
+++ b/target/arm/cpu64.c
24
@@ -XXX,XX +XXX,XX @@ void arm_cpu_sve_finalize(ARMCPU *cpu, Error **errp)
25
break;
26
}
27
}
28
- max_vq = vq <= ARM_MAX_VQ ? vq - 1 : ARM_MAX_VQ;
29
- bitmap_andnot(cpu->sve_vq_map, cpu->sve_vq_supported,
30
- cpu->sve_vq_init, max_vq);
31
- if (max_vq == 0 || bitmap_empty(cpu->sve_vq_map, max_vq)) {
32
- error_setg(errp, "cannot disable sve%d", vq * 128);
33
- error_append_hint(errp, "Disabling sve%d results in all "
34
- "vector lengths being disabled.\n",
35
- vq * 128);
36
- error_append_hint(errp, "With SVE enabled, at least one "
37
- "vector length must be enabled.\n");
38
- return;
39
- }
40
} else {
41
/* Disabling a power-of-two disables all larger lengths. */
42
- if (test_bit(0, cpu->sve_vq_init)) {
43
- error_setg(errp, "cannot disable sve128");
44
- error_append_hint(errp, "Disabling sve128 results in all "
45
- "vector lengths being disabled.\n");
46
- error_append_hint(errp, "With SVE enabled, at least one "
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
}
151
}
152
--
153
2.20.1
154
155
diff view generated by jsdifflib
New patch
1
Do a basic conversion of the acpi_cpu_hotplug spec document to rST.
1
2
3
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
5
Message-id: 20210727170414.3368-2-peter.maydell@linaro.org
6
---
7
docs/specs/acpi_cpu_hotplug.rst | 235 ++++++++++++++++++++++++++++++++
8
docs/specs/acpi_cpu_hotplug.txt | 160 ----------------------
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
14
diff --git a/docs/specs/acpi_cpu_hotplug.rst b/docs/specs/acpi_cpu_hotplug.rst
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
423
--- a/docs/specs/index.rst
424
+++ b/docs/specs/index.rst
425
@@ -XXX,XX +XXX,XX @@ guest hardware that is specific to QEMU.
426
acpi_hw_reduced_hotplug
427
tpm
428
acpi_hest_ghes
429
+ acpi_cpu_hotplug
430
--
431
2.20.1
432
433
diff view generated by jsdifflib
1
Now that timer_free() implicitly calls timer_del(), sequences
1
Convert the acpi memory hotplug spec to rST.
2
timer_del(mytimer);
2
3
timer_free(mytimer);
3
Note that this includes converting a lot of weird whitespace
4
4
characters to plain old spaces (the rST parser does not like
5
can be simplified to just
5
whatever the old ones were).
6
timer_free(mytimer);
7
8
Add a Coccinelle script to do this transformation.
9
6
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
8
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
12
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
9
Message-id: 20210727170414.3368-3-peter.maydell@linaro.org
13
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
14
Message-id: 20201215154107.3255-3-peter.maydell@linaro.org
15
---
10
---
16
scripts/coccinelle/timer-del-timer-free.cocci | 18 ++++++++++++++++++
11
docs/specs/acpi_mem_hotplug.rst | 128 ++++++++++++++++++++++++++++++++
17
1 file changed, 18 insertions(+)
12
docs/specs/acpi_mem_hotplug.txt | 94 -----------------------
18
create mode 100644 scripts/coccinelle/timer-del-timer-free.cocci
13
docs/specs/index.rst | 1 +
19
14
3 files changed, 129 insertions(+), 94 deletions(-)
20
diff --git a/scripts/coccinelle/timer-del-timer-free.cocci b/scripts/coccinelle/timer-del-timer-free.cocci
15
create mode 100644 docs/specs/acpi_mem_hotplug.rst
16
delete mode 100644 docs/specs/acpi_mem_hotplug.txt
17
18
diff --git a/docs/specs/acpi_mem_hotplug.rst b/docs/specs/acpi_mem_hotplug.rst
21
new file mode 100644
19
new file mode 100644
22
index XXXXXXX..XXXXXXX
20
index XXXXXXX..XXXXXXX
23
--- /dev/null
21
--- /dev/null
24
+++ b/scripts/coccinelle/timer-del-timer-free.cocci
22
+++ b/docs/specs/acpi_mem_hotplug.rst
25
@@ -XXX,XX +XXX,XX @@
23
@@ -XXX,XX +XXX,XX @@
26
+// Remove superfluous timer_del() calls
24
+QEMU<->ACPI BIOS memory hotplug interface
27
+//
25
+=========================================
28
+// Copyright Linaro Limited 2020
26
+
29
+// This work is licensed under the terms of the GNU GPLv2 or later.
27
+ACPI BIOS GPE.3 handler is dedicated for notifying OS about memory hot-add
30
+//
28
+and hot-remove events.
31
+// spatch --macro-file scripts/cocci-macro-file.h \
29
+
32
+// --sp-file scripts/coccinelle/timer-del-timer-free.cocci \
30
+Memory hot-plug interface (IO port 0xa00-0xa17, 1-4 byte access)
33
+// --in-place --dir .
31
+----------------------------------------------------------------
34
+//
32
+
35
+// The timer_free() function now implicitly calls timer_del()
33
+Read access behavior
36
+// for you, so calls to timer_del() immediately before the
34
+^^^^^^^^^^^^^^^^^^^^
37
+// timer_free() of the same timer can be deleted.
35
+
38
+
36
+[0x0-0x3]
39
+@@
37
+ Lo part of memory device phys address
40
+expression T;
38
+[0x4-0x7]
41
+@@
39
+ Hi part of memory device phys address
42
+-timer_del(T);
40
+[0x8-0xb]
43
+ timer_free(T);
41
+ Lo part of memory device size in bytes
42
+[0xc-0xf]
43
+ Hi part of memory device size in bytes
44
+[0x10-0x13]
45
+ Memory device proximity domain
46
+[0x14]
47
+ Memory device status fields
48
+
49
+ bits:
50
+
51
+ 0:
52
+ Device is enabled and may be used by guest
53
+ 1:
54
+ Device insert event, used to distinguish device for which
55
+ no device check event to OSPM was issued.
56
+ It's valid only when bit 1 is set.
57
+ 2:
58
+ Device remove event, used to distinguish device for which
59
+ no device eject request to OSPM was issued.
60
+ 3-7:
61
+ reserved and should be ignored by OSPM
62
+
63
+[0x15-0x17]
64
+ reserved
65
+
66
+Write access behavior
67
+^^^^^^^^^^^^^^^^^^^^^
68
+
69
+
70
+[0x0-0x3]
71
+ Memory device slot selector, selects active memory device.
72
+ All following accesses to other registers in 0xa00-0xa17
73
+ region will read/store data from/to selected memory device.
74
+[0x4-0x7]
75
+ OST event code reported by OSPM
76
+[0x8-0xb]
77
+ OST status code reported by OSPM
78
+[0xc-0x13]
79
+ reserved, writes into it are ignored
80
+[0x14]
81
+ Memory device control fields
82
+
83
+ bits:
84
+
85
+ 0:
86
+ reserved, OSPM must clear it before writing to register.
87
+ Due to BUG in versions prior 2.4 that field isn't cleared
88
+ when other fields are written. Keep it reserved and don't
89
+ try to reuse it.
90
+ 1:
91
+ if set to 1 clears device insert event, set by OSPM
92
+ after it has emitted device check event for the
93
+ selected memory device
94
+ 2:
95
+ if set to 1 clears device remove event, set by OSPM
96
+ after it has emitted device eject request for the
97
+ selected memory device
98
+ 3:
99
+ if set to 1 initiates device eject, set by OSPM when it
100
+ triggers memory device removal and calls _EJ0 method
101
+ 4-7:
102
+ reserved, OSPM must clear them before writing to register
103
+
104
+Selecting memory device slot beyond present range has no effect on platform:
105
+
106
+- write accesses to memory hot-plug registers not documented above are ignored
107
+- read accesses to memory hot-plug registers not documented above return
108
+ all bits set to 1.
109
+
110
+Memory hot remove process diagram
111
+---------------------------------
112
+
113
+::
114
+
115
+ +-------------+ +-----------------------+ +------------------+
116
+ | 1. QEMU | | 2. QEMU | |3. QEMU |
117
+ | device_del +---->+ device unplug request +----->+Send SCI to guest,|
118
+ | | | cb | |return control to |
119
+ | | | | |management |
120
+ +-------------+ +-----------------------+ +------------------+
121
+
122
+ +---------------------------------------------------------------------+
123
+
124
+ +---------------------+ +-------------------------+
125
+ | OSPM: | remove event | OSPM: |
126
+ | send Eject Request, | | Scan memory devices |
127
+ | clear remove event +<-------------+ for event flags |
128
+ | | | |
129
+ +---------------------+ +-------------------------+
130
+ |
131
+ |
132
+ +---------v--------+ +-----------------------+
133
+ | Guest OS: | success | OSPM: |
134
+ | process Ejection +----------->+ Execute _EJ0 method, |
135
+ | request | | set eject bit in flags|
136
+ +------------------+ +-----------------------+
137
+ |failure |
138
+ v v
139
+ +------------------------+ +-----------------------+
140
+ | OSPM: | | QEMU: |
141
+ | set OST event & status | | call device unplug cb |
142
+ | fields | | |
143
+ +------------------------+ +-----------------------+
144
+ | |
145
+ v v
146
+ +------------------+ +-------------------+
147
+ |QEMU: | |QEMU: |
148
+ |Send OST QMP event| |Send device deleted|
149
+ | | |QMP event |
150
+ +------------------+ | |
151
+ +-------------------+
152
diff --git a/docs/specs/acpi_mem_hotplug.txt b/docs/specs/acpi_mem_hotplug.txt
153
deleted file mode 100644
154
index XXXXXXX..XXXXXXX
155
--- a/docs/specs/acpi_mem_hotplug.txt
156
+++ /dev/null
157
@@ -XXX,XX +XXX,XX @@
158
-QEMU<->ACPI BIOS memory hotplug interface
159
---------------------------------------
160
-
161
-ACPI BIOS GPE.3 handler is dedicated for notifying OS about memory hot-add
162
-and hot-remove events.
163
-
164
-Memory hot-plug interface (IO port 0xa00-0xa17, 1-4 byte access):
165
----------------------------------------------------------------
166
-0xa00:
167
- read access:
168
- [0x0-0x3] Lo part of memory device phys address
169
- [0x4-0x7] Hi part of memory device phys address
170
- [0x8-0xb] Lo part of memory device size in bytes
171
- [0xc-0xf] Hi part of memory device size in bytes
172
- [0x10-0x13] Memory device proximity domain
173
- [0x14] Memory device status fields
174
- bits:
175
- 0: Device is enabled and may be used by guest
176
- 1: Device insert event, used to distinguish device for which
177
- no device check event to OSPM was issued.
178
- It's valid only when bit 1 is set.
179
- 2: Device remove event, used to distinguish device for which
180
- no device eject request to OSPM was issued.
181
- 3-7: reserved and should be ignored by OSPM
182
- [0x15-0x17] reserved
183
-
184
- write access:
185
- [0x0-0x3] Memory device slot selector, selects active memory device.
186
- All following accesses to other registers in 0xa00-0xa17
187
- region will read/store data from/to selected memory device.
188
- [0x4-0x7] OST event code reported by OSPM
189
- [0x8-0xb] OST status code reported by OSPM
190
- [0xc-0x13] reserved, writes into it are ignored
191
- [0x14] Memory device control fields
192
- bits:
193
- 0: reserved, OSPM must clear it before writing to register.
194
- Due to BUG in versions prior 2.4 that field isn't cleared
195
- when other fields are written. Keep it reserved and don't
196
- try to reuse it.
197
- 1: if set to 1 clears device insert event, set by OSPM
198
- after it has emitted device check event for the
199
- selected memory device
200
- 2: if set to 1 clears device remove event, set by OSPM
201
- after it has emitted device eject request for the
202
- selected memory device
203
- 3: if set to 1 initiates device eject, set by OSPM when it
204
- triggers memory device removal and calls _EJ0 method
205
- 4-7: reserved, OSPM must clear them before writing to register
206
-
207
-Selecting memory device slot beyond present range has no effect on platform:
208
- - write accesses to memory hot-plug registers not documented above are
209
- ignored
210
- - read accesses to memory hot-plug registers not documented above return
211
- all bits set to 1.
212
-
213
-Memory hot remove process diagram:
214
-----------------------------------
215
- +-------------+     +-----------------------+      +------------------+     
216
- |  1. QEMU    |     | 2. QEMU               |      |3. QEMU           |     
217
- |  device_del +---->+ device unplug request +----->+Send SCI to guest,|     
218
- |             |     |         cb            |      |return control to |     
219
- +-------------+     +-----------------------+      |management        |     
220
-                                                    +------------------+     
221
-                                                                             
222
- +---------------------------------------------------------------------+     
223
-                                                                             
224
- +---------------------+              +-------------------------+            
225
- | OSPM:               | remove event | OSPM:                   |            
226
- | send Eject Request, |              | Scan memory devices     |            
227
- | clear remove event  +<-------------+ for event flags         |            
228
- |                     |              |                         |            
229
- +---------------------+              +-------------------------+            
230
-           |                                                                 
231
-           |                                                                 
232
- +---------v--------+            +-----------------------+                   
233
- | Guest OS:        |  success   | OSPM:                 |                   
234
- | process Ejection +----------->+ Execute _EJ0 method,  |                   
235
- | request          |            | set eject bit in flags|                   
236
- +------------------+            +-----------------------+                   
237
-           |failure                         |                                
238
-           v                                v                                
239
- +------------------------+      +-----------------------+                   
240
- | OSPM:                  |      | QEMU:                 |                   
241
- | set OST event & status |      | call device unplug cb |                   
242
- | fields                 |      |                       |                   
243
- +------------------------+      +-----------------------+                   
244
-          |                                  |                               
245
-          v                                  v                               
246
- +------------------+              +-------------------+                     
247
- |QEMU:             |              |QEMU:              |                     
248
- |Send OST QMP event|              |Send device deleted|                     
249
- |                  |              |QMP event          |                     
250
- +------------------+              |                   |                     
251
-                                   +-------------------+
252
diff --git a/docs/specs/index.rst b/docs/specs/index.rst
253
index XXXXXXX..XXXXXXX 100644
254
--- a/docs/specs/index.rst
255
+++ b/docs/specs/index.rst
256
@@ -XXX,XX +XXX,XX @@ guest hardware that is specific to QEMU.
257
tpm
258
acpi_hest_ghes
259
acpi_cpu_hotplug
260
+ acpi_mem_hotplug
44
--
261
--
45
2.20.1
262
2.20.1
46
263
47
264
diff view generated by jsdifflib
New patch
1
Convert the PCI hotplug spec document to rST.
1
2
3
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
5
---
6
...i_pci_hotplug.txt => acpi_pci_hotplug.rst} | 37 ++++++++++---------
7
docs/specs/index.rst | 1 +
8
2 files changed, 21 insertions(+), 17 deletions(-)
9
rename docs/specs/{acpi_pci_hotplug.txt => acpi_pci_hotplug.rst} (51%)
10
11
diff --git a/docs/specs/acpi_pci_hotplug.txt b/docs/specs/acpi_pci_hotplug.rst
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
16
--- a/docs/specs/acpi_pci_hotplug.txt
17
+++ b/docs/specs/acpi_pci_hotplug.rst
18
@@ -XXX,XX +XXX,XX @@
19
QEMU<->ACPI BIOS PCI hotplug interface
20
---------------------------------------
21
+======================================
22
23
QEMU supports PCI hotplug via ACPI, for PCI bus 0. This document
24
describes the interface between QEMU and the ACPI BIOS.
25
26
-ACPI GPE block (IO ports 0xafe0-0xafe3, byte access):
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
--
94
2.20.1
95
96
diff view generated by jsdifflib
1
From: Bin Meng <bin.meng@windriver.com>
1
Convert the ACPI NVDIMM spec document to rST.
2
2
3
This adds the target guide for SABRE Lite board, and documents how
3
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
to boot a Linux kernel and U-Boot bootloader.
4
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
5
Message-id: 20210727170414.3368-5-peter.maydell@linaro.org
6
---
7
docs/specs/acpi_nvdimm.rst | 228 +++++++++++++++++++++++++++++++++++++
8
docs/specs/acpi_nvdimm.txt | 188 ------------------------------
9
docs/specs/index.rst | 1 +
10
3 files changed, 229 insertions(+), 188 deletions(-)
11
create mode 100644 docs/specs/acpi_nvdimm.rst
12
delete mode 100644 docs/specs/acpi_nvdimm.txt
5
13
6
Signed-off-by: Bin Meng <bin.meng@windriver.com>
14
diff --git a/docs/specs/acpi_nvdimm.rst b/docs/specs/acpi_nvdimm.rst
7
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
8
Message-id: 20210106063504.10841-5-bmeng.cn@gmail.com
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
---
11
docs/system/arm/sabrelite.rst | 119 ++++++++++++++++++++++++++++++++++
12
docs/system/target-arm.rst | 1 +
13
2 files changed, 120 insertions(+)
14
create mode 100644 docs/system/arm/sabrelite.rst
15
16
diff --git a/docs/system/arm/sabrelite.rst b/docs/system/arm/sabrelite.rst
17
new file mode 100644
15
new file mode 100644
18
index XXXXXXX..XXXXXXX
16
index XXXXXXX..XXXXXXX
19
--- /dev/null
17
--- /dev/null
20
+++ b/docs/system/arm/sabrelite.rst
18
+++ b/docs/specs/acpi_nvdimm.rst
21
@@ -XXX,XX +XXX,XX @@
19
@@ -XXX,XX +XXX,XX @@
22
+Boundary Devices SABRE Lite (``sabrelite``)
20
+QEMU<->ACPI BIOS NVDIMM interface
23
+===========================================
21
+=================================
24
+
22
+
25
+Boundary Devices SABRE Lite i.MX6 Development Board is a low-cost development
23
+QEMU supports NVDIMM via ACPI. This document describes the basic concepts of
26
+platform featuring the powerful Freescale / NXP Semiconductor's i.MX 6 Quad
24
+NVDIMM ACPI and the interface between QEMU and the ACPI BIOS.
27
+Applications Processor.
25
+
28
+
26
+NVDIMM ACPI Background
29
+Supported devices
27
+----------------------
30
+-----------------
28
+
31
+
29
+NVDIMM is introduced in ACPI 6.0 which defines an NVDIMM root device under
32
+The SABRE Lite machine supports the following devices:
30
+_SB scope with a _HID of "ACPI0012". For each NVDIMM present or intended
33
+
31
+to be supported by platform, platform firmware also exposes an ACPI
34
+ * Up to 4 Cortex A9 cores
32
+Namespace Device under the root device.
35
+ * Generic Interrupt Controller
33
+
36
+ * 1 Clock Controller Module
34
+The NVDIMM child devices under the NVDIMM root device are defined with _ADR
37
+ * 1 System Reset Controller
35
+corresponding to the NFIT device handle. The NVDIMM root device and the
38
+ * 5 UARTs
36
+NVDIMM devices can have device specific methods (_DSM) to provide additional
39
+ * 2 EPIC timers
37
+functions specific to a particular NVDIMM implementation.
40
+ * 1 GPT timer
38
+
41
+ * 2 Watchdog timers
39
+This is an example from ACPI 6.0, a platform contains one NVDIMM::
42
+ * 1 FEC Ethernet controller
40
+
43
+ * 3 I2C controllers
41
+ Scope (\_SB){
44
+ * 7 GPIO controllers
42
+ Device (NVDR) // Root device
45
+ * 4 SDHC storage controllers
43
+ {
46
+ * 4 USB 2.0 host controllers
44
+ Name (_HID, "ACPI0012")
47
+ * 5 ECSPI controllers
45
+ Method (_STA) {...}
48
+ * 1 SST 25VF016B flash
46
+ Method (_FIT) {...}
49
+
47
+ Method (_DSM, ...) {...}
50
+Please note above list is a complete superset the QEMU SABRE Lite machine can
48
+ Device (NVD)
51
+support. For a normal use case, a device tree blob that represents a real world
49
+ {
52
+SABRE Lite board, only exposes a subset of devices to the guest software.
50
+ Name(_ADR, h) //where h is NFIT Device Handle for this NVDIMM
53
+
51
+ Method (_DSM, ...) {...}
54
+Boot options
52
+ }
55
+------------
53
+ }
56
+
54
+ }
57
+The SABRE Lite machine can start using the standard -kernel functionality
55
+
58
+for loading a Linux kernel, U-Boot bootloader or ELF executable.
56
+Methods supported on both NVDIMM root device and NVDIMM device
59
+
57
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
60
+Running Linux kernel
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
61
+--------------------
156
+--------------------
62
+
157
+
63
+Linux mainline v5.10 release is tested at the time of writing. To build a Linux
158
+"MEMA" indicates the address of memory page allocated by BIOS.
64
+mainline kernel that can be booted by the SABRE Lite machine, simply configure
159
+
65
+the kernel using the imx_v6_v7_defconfig configuration:
160
+::
66
+
161
+
67
+.. code-block:: bash
162
+ +----------------------+ +-----------------------+
68
+
163
+ | 1. OSPM | | 2. OSPM |
69
+ $ export ARCH=arm
164
+ | save _DSM input data | | write "MEMA" to | Exit to QEMU
70
+ $ export CROSS_COMPILE=arm-linux-gnueabihf-
165
+ | to the page +----->| IO port 0x0a18 +------------+
71
+ $ make imx_v6_v7_defconfig
166
+ | indicated by "MEMA" | | | |
72
+ $ make
167
+ +----------------------+ +-----------------------+ |
73
+
168
+ |
74
+To boot the newly built Linux kernel in QEMU with the SABRE Lite machine, use:
169
+ v
75
+
170
+ +--------------------+ +-----------+ +------------------+--------+
76
+.. code-block:: bash
171
+ | 5 QEMU | | 4 QEMU | | 3. QEMU |
77
+
172
+ | write _DSM result | | emulate | | get _DSM input data from |
78
+ $ qemu-system-arm -M sabrelite -smp 4 -m 1G \
173
+ | to the page +<------+ _DSM +<-----+ the page indicated by the |
79
+ -display none -serial null -serial stdio \
174
+ | | | | | value from the IO port |
80
+ -kernel arch/arm/boot/zImage \
175
+ +--------+-----------+ +-----------+ +---------------------------+
81
+ -dtb arch/arm/boot/dts/imx6q-sabrelite.dtb \
176
+ |
82
+ -initrd /path/to/rootfs.ext4 \
177
+ | Enter Guest
83
+ -append "root=/dev/ram"
178
+ |
84
+
179
+ v
85
+Running U-Boot
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
86
+--------------
188
+--------------
87
+
189
+
88
+U-Boot mainline v2020.10 release is tested at the time of writing. To build a
190
+ACPI BIOS GPE.4 handler is dedicated for notifying OS about nvdimm device
89
+U-Boot mainline bootloader that can be booted by the SABRE Lite machine, use
191
+hot-add event.
90
+the mx6qsabrelite_defconfig with similar commands as described above for Linux:
192
+
91
+
193
+QEMU internal use only _DSM functions
92
+.. code-block:: bash
194
+-------------------------------------
93
+
195
+
94
+ $ export CROSS_COMPILE=arm-linux-gnueabihf-
196
+Read FIT
95
+ $ make mx6qsabrelite_defconfig
197
+^^^^^^^^
96
+
198
+
97
+Note we need to adjust settings by:
199
+_FIT method uses _DSM method to fetch NFIT structures blob from QEMU
98
+
200
+in 1 page sized increments which are then concatenated and returned
99
+.. code-block:: bash
201
+as _FIT method result.
100
+
202
+
101
+ $ make menuconfig
203
+Input parameters:
102
+
204
+
103
+then manually select the following configuration in U-Boot:
205
+Arg0
104
+
206
+ UUID {set to 648B9CF2-CDA1-4312-8AD9-49C4AF32BD62}
105
+ Device Tree Control > Provider of DTB for DT Control > Embedded DTB
207
+Arg1
106
+
208
+ Revision ID (set to 1)
107
+To start U-Boot using the SABRE Lite machine, provide the u-boot binary to
209
+Arg2
108
+the -kernel argument, along with an SD card image with rootfs:
210
+ Function Index, 0x1
109
+
211
+Arg3
110
+.. code-block:: bash
212
+ A package containing a buffer whose layout is as follows:
111
+
213
+
112
+ $ qemu-system-arm -M sabrelite -smp 4 -m 1G \
214
+ +----------+--------+--------+-------------------------------------------+
113
+ -display none -serial null -serial stdio \
215
+ | Field | Length | Offset | Description |
114
+ -kernel u-boot
216
+ +----------+--------+--------+-------------------------------------------+
115
+
217
+ | offset | 4 | 0 | offset in QEMU's NFIT structures blob to |
116
+The following example shows booting Linux kernel from dhcp, and uses the
218
+ | | | | read from |
117
+rootfs on an SD card. This requires some additional command line parameters
219
+ +----------+--------+--------+-------------------------------------------+
118
+for QEMU:
220
+
119
+
221
+Output layout in the dsm memory page:
120
+.. code-block:: none
222
+
121
+
223
+ +----------+--------+--------+-------------------------------------------+
122
+ -nic user,tftp=/path/to/kernel/zImage \
224
+ | Field | Length | Offset | Description |
123
+ -drive file=sdcard.img,id=rootfs -device sd-card,drive=rootfs
225
+ +----------+--------+--------+-------------------------------------------+
124
+
226
+ | length | 4 | 0 | length of entire returned data |
125
+The directory for the built-in TFTP server should also contain the device tree
227
+ | | | | (including this header) |
126
+blob of the SABRE Lite board. The sample SD card image was populated with the
228
+ +----------+--------+--------+-------------------------------------------+
127
+root file system with one single partition. You may adjust the kernel "root="
229
+ | | | | return status codes |
128
+boot parameter accordingly.
230
+ | | | | |
129
+
231
+ | | | | - 0x0 - success |
130
+After U-Boot boots, type the following commands in the U-Boot command shell to
232
+ | | | | - 0x100 - error caused by NFIT update |
131
+boot the Linux kernel:
233
+ | status | 4 | 4 | while read by _FIT wasn't completed |
132
+
234
+ | | | | - other codes follow Chapter 3 in |
133
+.. code-block:: none
235
+ | | | | DSM Spec Rev1 |
134
+
236
+ +----------+--------+--------+-------------------------------------------+
135
+ => setenv ethaddr 00:11:22:33:44:55
237
+ | fit data | Varies | 8 | contains FIT data. This field is present |
136
+ => setenv bootfile zImage
238
+ | | | | if status field is 0. |
137
+ => dhcp
239
+ +----------+--------+--------+-------------------------------------------+
138
+ => tftpboot 14000000 imx6q-sabrelite.dtb
240
+
139
+ => setenv bootargs root=/dev/mmcblk3p1
241
+The FIT offset is maintained by the OSPM itself, current offset plus
140
+ => bootz 12000000 - 14000000
242
+the size of the fit data returned by the function is the next offset
141
diff --git a/docs/system/target-arm.rst b/docs/system/target-arm.rst
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
-}
288
-
289
-Method supported on both NVDIMM root device and NVDIMM device
290
-_DSM (Device Specific Method)
291
- It is a control method that enables devices to provide device specific
292
- control functions that are consumed by the device driver.
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
142
index XXXXXXX..XXXXXXX 100644
443
index XXXXXXX..XXXXXXX 100644
143
--- a/docs/system/target-arm.rst
444
--- a/docs/specs/index.rst
144
+++ b/docs/system/target-arm.rst
445
+++ b/docs/specs/index.rst
145
@@ -XXX,XX +XXX,XX @@ undocumented; you can get a complete list by running
446
@@ -XXX,XX +XXX,XX @@ guest hardware that is specific to QEMU.
146
arm/versatile
447
acpi_cpu_hotplug
147
arm/vexpress
448
acpi_mem_hotplug
148
arm/aspeed
449
acpi_pci_hotplug
149
+ arm/sabrelite
450
+ acpi_nvdimm
150
arm/digic
151
arm/musicpal
152
arm/gumstix
153
--
451
--
154
2.20.1
452
2.20.1
155
453
156
454
diff view generated by jsdifflib
New patch
1
Add entries for the ACPI specs documents in docs/specs to
2
appropriate sections of MAINTAINERS.
1
3
4
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
---
8
MAINTAINERS | 5 +++++
9
1 file changed, 5 insertions(+)
10
11
diff --git a/MAINTAINERS b/MAINTAINERS
12
index XXXXXXX..XXXXXXX 100644
13
--- a/MAINTAINERS
14
+++ b/MAINTAINERS
15
@@ -XXX,XX +XXX,XX @@ F: qapi/acpi.json
16
F: tests/qtest/bios-tables-test*
17
F: tests/qtest/acpi-utils.[hc]
18
F: tests/data/acpi/
19
+F: docs/specs/acpi_cpu_hotplug.rst
20
+F: docs/specs/acpi_mem_hotplug.rst
21
+F: docs/specs/acpi_pci_hotplug.rst
22
+F: docs/specs/acpi_hw_reduced_hotplug.rst
23
24
ACPI/HEST/GHES
25
R: Dongjiu Geng <gengdongjiu1@gmail.com>
26
@@ -XXX,XX +XXX,XX @@ F: hw/acpi/nvdimm.c
27
F: hw/mem/nvdimm.c
28
F: include/hw/mem/nvdimm.h
29
F: docs/nvdimm.txt
30
+F: docs/specs/acpi_nvdimm.rst
31
32
e1000x
33
M: Dmitry Fleytman <dmitry.fleytman@gmail.com>
34
--
35
2.20.1
36
37
diff view generated by jsdifflib
New patch
1
The xen_available() function is used only to produce an error
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.
1
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
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
12
Message-id: 20210730105947.28215-2-peter.maydell@linaro.org
13
---
14
include/sysemu/arch_init.h | 1 -
15
softmmu/arch_init.c | 9 ---------
16
softmmu/vl.c | 6 +++---
17
3 files changed, 3 insertions(+), 13 deletions(-)
18
19
diff --git a/include/sysemu/arch_init.h b/include/sysemu/arch_init.h
20
index XXXXXXX..XXXXXXX 100644
21
--- a/include/sysemu/arch_init.h
22
+++ b/include/sysemu/arch_init.h
23
@@ -XXX,XX +XXX,XX @@ enum {
24
extern const uint32_t arch_type;
25
26
int kvm_available(void);
27
-int xen_available(void);
28
29
/* default virtio transport per architecture */
30
#define QEMU_ARCH_VIRTIO_PCI (QEMU_ARCH_ALPHA | QEMU_ARCH_ARM | \
31
diff --git a/softmmu/arch_init.c b/softmmu/arch_init.c
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
--
78
2.20.1
79
80
diff view generated by jsdifflib
New patch
1
The kvm_available() function reports whether KVM support was
2
compiled into the QEMU binary; it returns the value of the
3
CONFIG_KVM define.
1
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
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
12
Message-id: 20210730105947.28215-3-peter.maydell@linaro.org
13
---
14
include/sysemu/arch_init.h | 2 --
15
monitor/qmp-cmds.c | 2 +-
16
softmmu/arch_init.c | 9 ---------
17
3 files changed, 1 insertion(+), 12 deletions(-)
18
19
diff --git a/include/sysemu/arch_init.h b/include/sysemu/arch_init.h
20
index XXXXXXX..XXXXXXX 100644
21
--- a/include/sysemu/arch_init.h
22
+++ b/include/sysemu/arch_init.h
23
@@ -XXX,XX +XXX,XX @@ enum {
24
25
extern const uint32_t arch_type;
26
27
-int kvm_available(void);
28
-
29
/* default virtio transport per architecture */
30
#define QEMU_ARCH_VIRTIO_PCI (QEMU_ARCH_ALPHA | QEMU_ARCH_ARM | \
31
QEMU_ARCH_HPPA | QEMU_ARCH_I386 | \
32
diff --git a/monitor/qmp-cmds.c b/monitor/qmp-cmds.c
33
index XXXXXXX..XXXXXXX 100644
34
--- a/monitor/qmp-cmds.c
35
+++ b/monitor/qmp-cmds.c
36
@@ -XXX,XX +XXX,XX @@ KvmInfo *qmp_query_kvm(Error **errp)
37
KvmInfo *info = g_malloc0(sizeof(*info));
38
39
info->enabled = kvm_enabled();
40
- info->present = kvm_available();
41
+ info->present = accel_find("kvm");
42
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
59
- return 0;
60
-#endif
61
-}
62
--
63
2.20.1
64
65
diff view generated by jsdifflib
1
Now that we have implemented all the features needed by the v8.1M
1
arch_init.c does very little but has a long list of #include lines.
2
architecture, we can add the model of the Cortex-M55. This is the
2
Remove all the unnecessary ones.
3
configuration without MVE support; we'll add MVE later.
4
3
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
7
Message-id: 20201210201433.26262-5-peter.maydell@linaro.org
6
Message-id: 20210730105947.28215-4-peter.maydell@linaro.org
8
---
7
---
9
target/arm/cpu_tcg.c | 42 ++++++++++++++++++++++++++++++++++++++++++
8
softmmu/arch_init.c | 7 -------
10
1 file changed, 42 insertions(+)
9
1 file changed, 7 deletions(-)
11
10
12
diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c
11
diff --git a/softmmu/arch_init.c b/softmmu/arch_init.c
13
index XXXXXXX..XXXXXXX 100644
12
index XXXXXXX..XXXXXXX 100644
14
--- a/target/arm/cpu_tcg.c
13
--- a/softmmu/arch_init.c
15
+++ b/target/arm/cpu_tcg.c
14
+++ b/softmmu/arch_init.c
16
@@ -XXX,XX +XXX,XX @@ static void cortex_m33_initfn(Object *obj)
15
@@ -XXX,XX +XXX,XX @@
17
cpu->ctr = 0x8000c000;
16
*/
18
}
17
#include "qemu/osdep.h"
19
18
#include "sysemu/arch_init.h"
20
+static void cortex_m55_initfn(Object *obj)
19
-#include "hw/pci/pci.h"
21
+{
20
-#include "hw/audio/soundhw.h"
22
+ ARMCPU *cpu = ARM_CPU(obj);
21
-#include "qapi/error.h"
23
+
22
-#include "qemu/config-file.h"
24
+ set_feature(&cpu->env, ARM_FEATURE_V8);
23
-#include "qemu/error-report.h"
25
+ set_feature(&cpu->env, ARM_FEATURE_V8_1M);
24
-#include "hw/acpi/acpi.h"
26
+ set_feature(&cpu->env, ARM_FEATURE_M);
25
-#include "qemu/help_option.h"
27
+ set_feature(&cpu->env, ARM_FEATURE_M_MAIN);
26
28
+ set_feature(&cpu->env, ARM_FEATURE_M_SECURITY);
27
#ifdef TARGET_SPARC
29
+ set_feature(&cpu->env, ARM_FEATURE_THUMB_DSP);
28
int graphic_width = 1024;
30
+ cpu->midr = 0x410fd221; /* r0p1 */
31
+ cpu->revidr = 0;
32
+ cpu->pmsav7_dregion = 16;
33
+ cpu->sau_sregion = 8;
34
+ /*
35
+ * These are the MVFR* values for the FPU, no MVE configuration;
36
+ * we will update them later when we implement MVE
37
+ */
38
+ cpu->isar.mvfr0 = 0x10110221;
39
+ cpu->isar.mvfr1 = 0x12100011;
40
+ cpu->isar.mvfr2 = 0x00000040;
41
+ cpu->isar.id_pfr0 = 0x20000030;
42
+ cpu->isar.id_pfr1 = 0x00000230;
43
+ cpu->isar.id_dfr0 = 0x10200000;
44
+ cpu->id_afr0 = 0x00000000;
45
+ cpu->isar.id_mmfr0 = 0x00111040;
46
+ cpu->isar.id_mmfr1 = 0x00000000;
47
+ cpu->isar.id_mmfr2 = 0x01000000;
48
+ cpu->isar.id_mmfr3 = 0x00000011;
49
+ cpu->isar.id_isar0 = 0x01103110;
50
+ cpu->isar.id_isar1 = 0x02212000;
51
+ cpu->isar.id_isar2 = 0x20232232;
52
+ cpu->isar.id_isar3 = 0x01111131;
53
+ cpu->isar.id_isar4 = 0x01310132;
54
+ cpu->isar.id_isar5 = 0x00000000;
55
+ cpu->isar.id_isar6 = 0x00000000;
56
+ cpu->clidr = 0x00000000; /* caches not implemented */
57
+ cpu->ctr = 0x8303c003;
58
+}
59
+
60
static const ARMCPRegInfo cortexr5_cp_reginfo[] = {
61
/* Dummy the TCM region regs for the moment */
62
{ .name = "ATCM", .cp = 15, .opc1 = 0, .crn = 9, .crm = 1, .opc2 = 0,
63
@@ -XXX,XX +XXX,XX @@ static const ARMCPUInfo arm_tcg_cpus[] = {
64
.class_init = arm_v7m_class_init },
65
{ .name = "cortex-m33", .initfn = cortex_m33_initfn,
66
.class_init = arm_v7m_class_init },
67
+ { .name = "cortex-m55", .initfn = cortex_m55_initfn,
68
+ .class_init = arm_v7m_class_init },
69
{ .name = "cortex-r5", .initfn = cortex_r5_initfn },
70
{ .name = "cortex-r5f", .initfn = cortex_r5f_initfn },
71
{ .name = "ti925t", .initfn = ti925t_initfn },
72
--
29
--
73
2.20.1
30
2.20.1
74
31
75
32
diff view generated by jsdifflib
1
This commit is the result of running the timer-del-timer-free.cocci
1
Instead of using an ifdef ladder in arch_init.c (which we then have
2
script on the whole source tree.
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.
3
5
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Acked-by: Corey Minyard <cminyard@mvista.com>
6
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
7
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
7
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20201215154107.3255-4-peter.maydell@linaro.org
9
Message-id: 20210730105947.28215-5-peter.maydell@linaro.org
10
---
10
---
11
block/iscsi.c | 2 --
11
meson.build | 2 ++
12
block/nbd.c | 1 -
12
softmmu/arch_init.c | 41 -----------------------------------------
13
block/qcow2.c | 1 -
13
2 files changed, 2 insertions(+), 41 deletions(-)
14
hw/block/nvme.c | 2 --
15
hw/char/serial.c | 2 --
16
hw/char/virtio-serial-bus.c | 2 --
17
hw/ide/core.c | 1 -
18
hw/input/hid.c | 1 -
19
hw/intc/apic.c | 1 -
20
hw/intc/ioapic.c | 1 -
21
hw/ipmi/ipmi_bmc_extern.c | 1 -
22
hw/net/e1000.c | 3 ---
23
hw/net/e1000e_core.c | 8 --------
24
hw/net/pcnet-pci.c | 1 -
25
hw/net/rtl8139.c | 1 -
26
hw/net/spapr_llan.c | 1 -
27
hw/net/virtio-net.c | 2 --
28
hw/s390x/s390-pci-inst.c | 1 -
29
hw/sd/sd.c | 1 -
30
hw/sd/sdhci.c | 2 --
31
hw/usb/dev-hub.c | 1 -
32
hw/usb/hcd-ehci.c | 1 -
33
hw/usb/hcd-ohci-pci.c | 1 -
34
hw/usb/hcd-uhci.c | 1 -
35
hw/usb/hcd-xhci.c | 1 -
36
hw/usb/redirect.c | 1 -
37
hw/vfio/display.c | 1 -
38
hw/virtio/vhost-vsock-common.c | 1 -
39
hw/virtio/virtio-balloon.c | 1 -
40
hw/virtio/virtio-rng.c | 1 -
41
hw/watchdog/wdt_diag288.c | 1 -
42
hw/watchdog/wdt_i6300esb.c | 1 -
43
migration/colo.c | 1 -
44
monitor/hmp-cmds.c | 1 -
45
net/announce.c | 1 -
46
net/colo-compare.c | 1 -
47
net/slirp.c | 1 -
48
replay/replay-debugging.c | 1 -
49
target/s390x/cpu.c | 2 --
50
ui/console.c | 1 -
51
ui/spice-core.c | 1 -
52
util/throttle.c | 1 -
53
42 files changed, 58 deletions(-)
54
14
55
diff --git a/block/iscsi.c b/block/iscsi.c
15
diff --git a/meson.build b/meson.build
56
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
57
--- a/block/iscsi.c
17
--- a/meson.build
58
+++ b/block/iscsi.c
18
+++ b/meson.build
59
@@ -XXX,XX +XXX,XX @@ static void iscsi_detach_aio_context(BlockDriverState *bs)
19
@@ -XXX,XX +XXX,XX @@ foreach target : target_dirs
60
iscsilun->events = 0;
20
config_target_data.set(k, v)
61
21
endif
62
if (iscsilun->nop_timer) {
22
endforeach
63
- timer_del(iscsilun->nop_timer);
23
+ config_target_data.set('QEMU_ARCH',
64
timer_free(iscsilun->nop_timer);
24
+ 'QEMU_ARCH_' + config_target['TARGET_BASE_ARCH'].to_upper())
65
iscsilun->nop_timer = NULL;
25
config_target_h += {target: configure_file(output: target + '-config-target.h',
66
}
26
configuration: config_target_data)}
67
if (iscsilun->event_timer) {
27
68
- timer_del(iscsilun->event_timer);
28
diff --git a/softmmu/arch_init.c b/softmmu/arch_init.c
69
timer_free(iscsilun->event_timer);
70
iscsilun->event_timer = NULL;
71
}
72
diff --git a/block/nbd.c b/block/nbd.c
73
index XXXXXXX..XXXXXXX 100644
29
index XXXXXXX..XXXXXXX 100644
74
--- a/block/nbd.c
30
--- a/softmmu/arch_init.c
75
+++ b/block/nbd.c
31
+++ b/softmmu/arch_init.c
76
@@ -XXX,XX +XXX,XX @@ static void nbd_recv_coroutines_wake_all(BDRVNBDState *s)
32
@@ -XXX,XX +XXX,XX @@ int graphic_height = 600;
77
static void reconnect_delay_timer_del(BDRVNBDState *s)
33
int graphic_depth = 32;
78
{
34
#endif
79
if (s->reconnect_delay_timer) {
35
80
- timer_del(s->reconnect_delay_timer);
36
-
81
timer_free(s->reconnect_delay_timer);
37
-#if defined(TARGET_ALPHA)
82
s->reconnect_delay_timer = NULL;
38
-#define QEMU_ARCH QEMU_ARCH_ALPHA
83
}
39
-#elif defined(TARGET_ARM)
84
diff --git a/block/qcow2.c b/block/qcow2.c
40
-#define QEMU_ARCH QEMU_ARCH_ARM
85
index XXXXXXX..XXXXXXX 100644
41
-#elif defined(TARGET_CRIS)
86
--- a/block/qcow2.c
42
-#define QEMU_ARCH QEMU_ARCH_CRIS
87
+++ b/block/qcow2.c
43
-#elif defined(TARGET_HPPA)
88
@@ -XXX,XX +XXX,XX @@ static void cache_clean_timer_del(BlockDriverState *bs)
44
-#define QEMU_ARCH QEMU_ARCH_HPPA
89
{
45
-#elif defined(TARGET_I386)
90
BDRVQcow2State *s = bs->opaque;
46
-#define QEMU_ARCH QEMU_ARCH_I386
91
if (s->cache_clean_timer) {
47
-#elif defined(TARGET_M68K)
92
- timer_del(s->cache_clean_timer);
48
-#define QEMU_ARCH QEMU_ARCH_M68K
93
timer_free(s->cache_clean_timer);
49
-#elif defined(TARGET_MICROBLAZE)
94
s->cache_clean_timer = NULL;
50
-#define QEMU_ARCH QEMU_ARCH_MICROBLAZE
95
}
51
-#elif defined(TARGET_MIPS)
96
diff --git a/hw/block/nvme.c b/hw/block/nvme.c
52
-#define QEMU_ARCH QEMU_ARCH_MIPS
97
index XXXXXXX..XXXXXXX 100644
53
-#elif defined(TARGET_NIOS2)
98
--- a/hw/block/nvme.c
54
-#define QEMU_ARCH QEMU_ARCH_NIOS2
99
+++ b/hw/block/nvme.c
55
-#elif defined(TARGET_OPENRISC)
100
@@ -XXX,XX +XXX,XX @@ static uint16_t nvme_io_cmd(NvmeCtrl *n, NvmeRequest *req)
56
-#define QEMU_ARCH QEMU_ARCH_OPENRISC
101
static void nvme_free_sq(NvmeSQueue *sq, NvmeCtrl *n)
57
-#elif defined(TARGET_PPC)
102
{
58
-#define QEMU_ARCH QEMU_ARCH_PPC
103
n->sq[sq->sqid] = NULL;
59
-#elif defined(TARGET_RISCV)
104
- timer_del(sq->timer);
60
-#define QEMU_ARCH QEMU_ARCH_RISCV
105
timer_free(sq->timer);
61
-#elif defined(TARGET_RX)
106
g_free(sq->io_req);
62
-#define QEMU_ARCH QEMU_ARCH_RX
107
if (sq->sqid) {
63
-#elif defined(TARGET_S390X)
108
@@ -XXX,XX +XXX,XX @@ static uint16_t nvme_get_log(NvmeCtrl *n, NvmeRequest *req)
64
-#define QEMU_ARCH QEMU_ARCH_S390X
109
static void nvme_free_cq(NvmeCQueue *cq, NvmeCtrl *n)
65
-#elif defined(TARGET_SH4)
110
{
66
-#define QEMU_ARCH QEMU_ARCH_SH4
111
n->cq[cq->cqid] = NULL;
67
-#elif defined(TARGET_SPARC)
112
- timer_del(cq->timer);
68
-#define QEMU_ARCH QEMU_ARCH_SPARC
113
timer_free(cq->timer);
69
-#elif defined(TARGET_TRICORE)
114
msix_vector_unuse(&n->parent_obj, cq->vector);
70
-#define QEMU_ARCH QEMU_ARCH_TRICORE
115
if (cq->cqid) {
71
-#elif defined(TARGET_XTENSA)
116
diff --git a/hw/char/serial.c b/hw/char/serial.c
72
-#define QEMU_ARCH QEMU_ARCH_XTENSA
117
index XXXXXXX..XXXXXXX 100644
73
-#elif defined(TARGET_AVR)
118
--- a/hw/char/serial.c
74
-#define QEMU_ARCH QEMU_ARCH_AVR
119
+++ b/hw/char/serial.c
75
-#endif
120
@@ -XXX,XX +XXX,XX @@ static void serial_unrealize(DeviceState *dev)
76
-
121
77
const uint32_t arch_type = QEMU_ARCH;
122
qemu_chr_fe_deinit(&s->chr, false);
123
124
- timer_del(s->modem_status_poll);
125
timer_free(s->modem_status_poll);
126
127
- timer_del(s->fifo_timeout_timer);
128
timer_free(s->fifo_timeout_timer);
129
130
fifo8_destroy(&s->recv_fifo);
131
diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c
132
index XXXXXXX..XXXXXXX 100644
133
--- a/hw/char/virtio-serial-bus.c
134
+++ b/hw/char/virtio-serial-bus.c
135
@@ -XXX,XX +XXX,XX @@ static void virtio_serial_post_load_timer_cb(void *opaque)
136
}
137
}
138
g_free(s->post_load->connected);
139
- timer_del(s->post_load->timer);
140
timer_free(s->post_load->timer);
141
g_free(s->post_load);
142
s->post_load = NULL;
143
@@ -XXX,XX +XXX,XX @@ static void virtio_serial_device_unrealize(DeviceState *dev)
144
g_free(vser->ports_map);
145
if (vser->post_load) {
146
g_free(vser->post_load->connected);
147
- timer_del(vser->post_load->timer);
148
timer_free(vser->post_load->timer);
149
g_free(vser->post_load);
150
}
151
diff --git a/hw/ide/core.c b/hw/ide/core.c
152
index XXXXXXX..XXXXXXX 100644
153
--- a/hw/ide/core.c
154
+++ b/hw/ide/core.c
155
@@ -XXX,XX +XXX,XX @@ void ide_init2(IDEBus *bus, qemu_irq irq)
156
157
void ide_exit(IDEState *s)
158
{
159
- timer_del(s->sector_write_timer);
160
timer_free(s->sector_write_timer);
161
qemu_vfree(s->smart_selftest_data);
162
qemu_vfree(s->io_buffer);
163
diff --git a/hw/input/hid.c b/hw/input/hid.c
164
index XXXXXXX..XXXXXXX 100644
165
--- a/hw/input/hid.c
166
+++ b/hw/input/hid.c
167
@@ -XXX,XX +XXX,XX @@ static void hid_idle_timer(void *opaque)
168
static void hid_del_idle_timer(HIDState *hs)
169
{
170
if (hs->idle_timer) {
171
- timer_del(hs->idle_timer);
172
timer_free(hs->idle_timer);
173
hs->idle_timer = NULL;
174
}
175
diff --git a/hw/intc/apic.c b/hw/intc/apic.c
176
index XXXXXXX..XXXXXXX 100644
177
--- a/hw/intc/apic.c
178
+++ b/hw/intc/apic.c
179
@@ -XXX,XX +XXX,XX @@ static void apic_unrealize(DeviceState *dev)
180
{
181
APICCommonState *s = APIC(dev);
182
183
- timer_del(s->timer);
184
timer_free(s->timer);
185
local_apics[s->id] = NULL;
186
}
187
diff --git a/hw/intc/ioapic.c b/hw/intc/ioapic.c
188
index XXXXXXX..XXXXXXX 100644
189
--- a/hw/intc/ioapic.c
190
+++ b/hw/intc/ioapic.c
191
@@ -XXX,XX +XXX,XX @@ static void ioapic_unrealize(DeviceState *dev)
192
{
193
IOAPICCommonState *s = IOAPIC_COMMON(dev);
194
195
- timer_del(s->delayed_ioapic_service_timer);
196
timer_free(s->delayed_ioapic_service_timer);
197
}
198
199
diff --git a/hw/ipmi/ipmi_bmc_extern.c b/hw/ipmi/ipmi_bmc_extern.c
200
index XXXXXXX..XXXXXXX 100644
201
--- a/hw/ipmi/ipmi_bmc_extern.c
202
+++ b/hw/ipmi/ipmi_bmc_extern.c
203
@@ -XXX,XX +XXX,XX @@ static void ipmi_bmc_extern_finalize(Object *obj)
204
{
205
IPMIBmcExtern *ibe = IPMI_BMC_EXTERN(obj);
206
207
- timer_del(ibe->extern_timer);
208
timer_free(ibe->extern_timer);
209
}
210
211
diff --git a/hw/net/e1000.c b/hw/net/e1000.c
212
index XXXXXXX..XXXXXXX 100644
213
--- a/hw/net/e1000.c
214
+++ b/hw/net/e1000.c
215
@@ -XXX,XX +XXX,XX @@ pci_e1000_uninit(PCIDevice *dev)
216
{
217
E1000State *d = E1000(dev);
218
219
- timer_del(d->autoneg_timer);
220
timer_free(d->autoneg_timer);
221
- timer_del(d->mit_timer);
222
timer_free(d->mit_timer);
223
- timer_del(d->flush_queue_timer);
224
timer_free(d->flush_queue_timer);
225
qemu_del_nic(d->nic);
226
}
227
diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c
228
index XXXXXXX..XXXXXXX 100644
229
--- a/hw/net/e1000e_core.c
230
+++ b/hw/net/e1000e_core.c
231
@@ -XXX,XX +XXX,XX @@ e1000e_intrmgr_pci_unint(E1000ECore *core)
232
{
233
int i;
234
235
- timer_del(core->radv.timer);
236
timer_free(core->radv.timer);
237
- timer_del(core->rdtr.timer);
238
timer_free(core->rdtr.timer);
239
- timer_del(core->raid.timer);
240
timer_free(core->raid.timer);
241
242
- timer_del(core->tadv.timer);
243
timer_free(core->tadv.timer);
244
- timer_del(core->tidv.timer);
245
timer_free(core->tidv.timer);
246
247
- timer_del(core->itr.timer);
248
timer_free(core->itr.timer);
249
250
for (i = 0; i < E1000E_MSIX_VEC_NUM; i++) {
251
- timer_del(core->eitr[i].timer);
252
timer_free(core->eitr[i].timer);
253
}
254
}
255
@@ -XXX,XX +XXX,XX @@ e1000e_core_pci_uninit(E1000ECore *core)
256
{
257
int i;
258
259
- timer_del(core->autoneg_timer);
260
timer_free(core->autoneg_timer);
261
262
e1000e_intrmgr_pci_unint(core);
263
diff --git a/hw/net/pcnet-pci.c b/hw/net/pcnet-pci.c
264
index XXXXXXX..XXXXXXX 100644
265
--- a/hw/net/pcnet-pci.c
266
+++ b/hw/net/pcnet-pci.c
267
@@ -XXX,XX +XXX,XX @@ static void pci_pcnet_uninit(PCIDevice *dev)
268
PCIPCNetState *d = PCI_PCNET(dev);
269
270
qemu_free_irq(d->state.irq);
271
- timer_del(d->state.poll_timer);
272
timer_free(d->state.poll_timer);
273
qemu_del_nic(d->state.nic);
274
}
275
diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c
276
index XXXXXXX..XXXXXXX 100644
277
--- a/hw/net/rtl8139.c
278
+++ b/hw/net/rtl8139.c
279
@@ -XXX,XX +XXX,XX @@ static void pci_rtl8139_uninit(PCIDevice *dev)
280
281
g_free(s->cplus_txbuffer);
282
s->cplus_txbuffer = NULL;
283
- timer_del(s->timer);
284
timer_free(s->timer);
285
qemu_del_nic(s->nic);
286
}
287
diff --git a/hw/net/spapr_llan.c b/hw/net/spapr_llan.c
288
index XXXXXXX..XXXXXXX 100644
289
--- a/hw/net/spapr_llan.c
290
+++ b/hw/net/spapr_llan.c
291
@@ -XXX,XX +XXX,XX @@ static void spapr_vlan_instance_finalize(Object *obj)
292
}
293
294
if (dev->rxp_timer) {
295
- timer_del(dev->rxp_timer);
296
timer_free(dev->rxp_timer);
297
}
298
}
299
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
300
index XXXXXXX..XXXXXXX 100644
301
--- a/hw/net/virtio-net.c
302
+++ b/hw/net/virtio-net.c
303
@@ -XXX,XX +XXX,XX @@ static void virtio_net_rsc_cleanup(VirtIONet *n)
304
g_free(seg);
305
}
306
307
- timer_del(chain->drain_timer);
308
timer_free(chain->drain_timer);
309
QTAILQ_REMOVE(&n->rsc_chains, chain, next);
310
g_free(chain);
311
@@ -XXX,XX +XXX,XX @@ static void virtio_net_del_queue(VirtIONet *n, int index)
312
313
virtio_del_queue(vdev, index * 2);
314
if (q->tx_timer) {
315
- timer_del(q->tx_timer);
316
timer_free(q->tx_timer);
317
q->tx_timer = NULL;
318
} else {
319
diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c
320
index XXXXXXX..XXXXXXX 100644
321
--- a/hw/s390x/s390-pci-inst.c
322
+++ b/hw/s390x/s390-pci-inst.c
323
@@ -XXX,XX +XXX,XX @@ void pci_dereg_ioat(S390PCIIOMMU *iommu)
324
void fmb_timer_free(S390PCIBusDevice *pbdev)
325
{
326
if (pbdev->fmb_timer) {
327
- timer_del(pbdev->fmb_timer);
328
timer_free(pbdev->fmb_timer);
329
pbdev->fmb_timer = NULL;
330
}
331
diff --git a/hw/sd/sd.c b/hw/sd/sd.c
332
index XXXXXXX..XXXXXXX 100644
333
--- a/hw/sd/sd.c
334
+++ b/hw/sd/sd.c
335
@@ -XXX,XX +XXX,XX @@ static void sd_instance_finalize(Object *obj)
336
{
337
SDState *sd = SD_CARD(obj);
338
339
- timer_del(sd->ocr_power_timer);
340
timer_free(sd->ocr_power_timer);
341
}
342
343
diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c
344
index XXXXXXX..XXXXXXX 100644
345
--- a/hw/sd/sdhci.c
346
+++ b/hw/sd/sdhci.c
347
@@ -XXX,XX +XXX,XX @@ void sdhci_initfn(SDHCIState *s)
348
349
void sdhci_uninitfn(SDHCIState *s)
350
{
351
- timer_del(s->insert_timer);
352
timer_free(s->insert_timer);
353
- timer_del(s->transfer_timer);
354
timer_free(s->transfer_timer);
355
356
g_free(s->fifo_buffer);
357
diff --git a/hw/usb/dev-hub.c b/hw/usb/dev-hub.c
358
index XXXXXXX..XXXXXXX 100644
359
--- a/hw/usb/dev-hub.c
360
+++ b/hw/usb/dev-hub.c
361
@@ -XXX,XX +XXX,XX @@ static void usb_hub_unrealize(USBDevice *dev)
362
&s->ports[i].port);
363
}
364
365
- timer_del(s->port_timer);
366
timer_free(s->port_timer);
367
}
368
369
diff --git a/hw/usb/hcd-ehci.c b/hw/usb/hcd-ehci.c
370
index XXXXXXX..XXXXXXX 100644
371
--- a/hw/usb/hcd-ehci.c
372
+++ b/hw/usb/hcd-ehci.c
373
@@ -XXX,XX +XXX,XX @@ void usb_ehci_unrealize(EHCIState *s, DeviceState *dev)
374
trace_usb_ehci_unrealize();
375
376
if (s->frame_timer) {
377
- timer_del(s->frame_timer);
378
timer_free(s->frame_timer);
379
s->frame_timer = NULL;
380
}
381
diff --git a/hw/usb/hcd-ohci-pci.c b/hw/usb/hcd-ohci-pci.c
382
index XXXXXXX..XXXXXXX 100644
383
--- a/hw/usb/hcd-ohci-pci.c
384
+++ b/hw/usb/hcd-ohci-pci.c
385
@@ -XXX,XX +XXX,XX @@ static void usb_ohci_exit(PCIDevice *dev)
386
usb_bus_release(&s->bus);
387
}
388
389
- timer_del(s->eof_timer);
390
timer_free(s->eof_timer);
391
}
392
393
diff --git a/hw/usb/hcd-uhci.c b/hw/usb/hcd-uhci.c
394
index XXXXXXX..XXXXXXX 100644
395
--- a/hw/usb/hcd-uhci.c
396
+++ b/hw/usb/hcd-uhci.c
397
@@ -XXX,XX +XXX,XX @@ static void usb_uhci_exit(PCIDevice *dev)
398
trace_usb_uhci_exit();
399
400
if (s->frame_timer) {
401
- timer_del(s->frame_timer);
402
timer_free(s->frame_timer);
403
s->frame_timer = NULL;
404
}
405
diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
406
index XXXXXXX..XXXXXXX 100644
407
--- a/hw/usb/hcd-xhci.c
408
+++ b/hw/usb/hcd-xhci.c
409
@@ -XXX,XX +XXX,XX @@ static void usb_xhci_unrealize(DeviceState *dev)
410
}
411
412
if (xhci->mfwrap_timer) {
413
- timer_del(xhci->mfwrap_timer);
414
timer_free(xhci->mfwrap_timer);
415
xhci->mfwrap_timer = NULL;
416
}
417
diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
418
index XXXXXXX..XXXXXXX 100644
419
--- a/hw/usb/redirect.c
420
+++ b/hw/usb/redirect.c
421
@@ -XXX,XX +XXX,XX @@ static void usbredir_unrealize(USBDevice *udev)
422
qemu_bh_delete(dev->chardev_close_bh);
423
qemu_bh_delete(dev->device_reject_bh);
424
425
- timer_del(dev->attach_timer);
426
timer_free(dev->attach_timer);
427
428
usbredir_cleanup_device_queues(dev);
429
diff --git a/hw/vfio/display.c b/hw/vfio/display.c
430
index XXXXXXX..XXXXXXX 100644
431
--- a/hw/vfio/display.c
432
+++ b/hw/vfio/display.c
433
@@ -XXX,XX +XXX,XX @@ static void vfio_display_edid_exit(VFIODisplay *dpy)
434
435
g_free(dpy->edid_regs);
436
g_free(dpy->edid_blob);
437
- timer_del(dpy->edid_link_timer);
438
timer_free(dpy->edid_link_timer);
439
}
440
441
diff --git a/hw/virtio/vhost-vsock-common.c b/hw/virtio/vhost-vsock-common.c
442
index XXXXXXX..XXXXXXX 100644
443
--- a/hw/virtio/vhost-vsock-common.c
444
+++ b/hw/virtio/vhost-vsock-common.c
445
@@ -XXX,XX +XXX,XX @@ static void vhost_vsock_common_post_load_timer_cleanup(VHostVSockCommon *vvc)
446
return;
447
}
448
449
- timer_del(vvc->post_load_timer);
450
timer_free(vvc->post_load_timer);
451
vvc->post_load_timer = NULL;
452
}
453
diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
454
index XXXXXXX..XXXXXXX 100644
455
--- a/hw/virtio/virtio-balloon.c
456
+++ b/hw/virtio/virtio-balloon.c
457
@@ -XXX,XX +XXX,XX @@ static bool balloon_stats_enabled(const VirtIOBalloon *s)
458
static void balloon_stats_destroy_timer(VirtIOBalloon *s)
459
{
460
if (balloon_stats_enabled(s)) {
461
- timer_del(s->stats_timer);
462
timer_free(s->stats_timer);
463
s->stats_timer = NULL;
464
s->stats_poll_interval = 0;
465
diff --git a/hw/virtio/virtio-rng.c b/hw/virtio/virtio-rng.c
466
index XXXXXXX..XXXXXXX 100644
467
--- a/hw/virtio/virtio-rng.c
468
+++ b/hw/virtio/virtio-rng.c
469
@@ -XXX,XX +XXX,XX @@ static void virtio_rng_device_unrealize(DeviceState *dev)
470
VirtIORNG *vrng = VIRTIO_RNG(dev);
471
472
qemu_del_vm_change_state_handler(vrng->vmstate);
473
- timer_del(vrng->rate_limit_timer);
474
timer_free(vrng->rate_limit_timer);
475
virtio_del_queue(vdev, 0);
476
virtio_cleanup(vdev);
477
diff --git a/hw/watchdog/wdt_diag288.c b/hw/watchdog/wdt_diag288.c
478
index XXXXXXX..XXXXXXX 100644
479
--- a/hw/watchdog/wdt_diag288.c
480
+++ b/hw/watchdog/wdt_diag288.c
481
@@ -XXX,XX +XXX,XX @@ static void wdt_diag288_unrealize(DeviceState *dev)
482
{
483
DIAG288State *diag288 = DIAG288(dev);
484
485
- timer_del(diag288->timer);
486
timer_free(diag288->timer);
487
}
488
489
diff --git a/hw/watchdog/wdt_i6300esb.c b/hw/watchdog/wdt_i6300esb.c
490
index XXXXXXX..XXXXXXX 100644
491
--- a/hw/watchdog/wdt_i6300esb.c
492
+++ b/hw/watchdog/wdt_i6300esb.c
493
@@ -XXX,XX +XXX,XX @@ static void i6300esb_exit(PCIDevice *dev)
494
{
495
I6300State *d = WATCHDOG_I6300ESB_DEVICE(dev);
496
497
- timer_del(d->timer);
498
timer_free(d->timer);
499
}
500
501
diff --git a/migration/colo.c b/migration/colo.c
502
index XXXXXXX..XXXXXXX 100644
503
--- a/migration/colo.c
504
+++ b/migration/colo.c
505
@@ -XXX,XX +XXX,XX @@ out:
506
* error.
507
*/
508
colo_compare_unregister_notifier(&packets_compare_notifier);
509
- timer_del(s->colo_delay_timer);
510
timer_free(s->colo_delay_timer);
511
qemu_event_destroy(&s->colo_checkpoint_event);
512
513
diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
514
index XXXXXXX..XXXXXXX 100644
515
--- a/monitor/hmp-cmds.c
516
+++ b/monitor/hmp-cmds.c
517
@@ -XXX,XX +XXX,XX @@ static void hmp_migrate_status_cb(void *opaque)
518
error_report("%s", info->error_desc);
519
}
520
monitor_resume(status->mon);
521
- timer_del(status->timer);
522
timer_free(status->timer);
523
g_free(status);
524
}
525
diff --git a/net/announce.c b/net/announce.c
526
index XXXXXXX..XXXXXXX 100644
527
--- a/net/announce.c
528
+++ b/net/announce.c
529
@@ -XXX,XX +XXX,XX @@ void qemu_announce_timer_del(AnnounceTimer *timer, bool free_named)
530
{
531
bool free_timer = false;
532
if (timer->tm) {
533
- timer_del(timer->tm);
534
timer_free(timer->tm);
535
timer->tm = NULL;
536
}
537
diff --git a/net/colo-compare.c b/net/colo-compare.c
538
index XXXXXXX..XXXXXXX 100644
539
--- a/net/colo-compare.c
540
+++ b/net/colo-compare.c
541
@@ -XXX,XX +XXX,XX @@ static void colo_compare_timer_init(CompareState *s)
542
static void colo_compare_timer_del(CompareState *s)
543
{
544
if (s->packet_check_timer) {
545
- timer_del(s->packet_check_timer);
546
timer_free(s->packet_check_timer);
547
s->packet_check_timer = NULL;
548
}
549
diff --git a/net/slirp.c b/net/slirp.c
550
index XXXXXXX..XXXXXXX 100644
551
--- a/net/slirp.c
552
+++ b/net/slirp.c
553
@@ -XXX,XX +XXX,XX @@ static void *net_slirp_timer_new(SlirpTimerCb cb,
554
555
static void net_slirp_timer_free(void *timer, void *opaque)
556
{
557
- timer_del(timer);
558
timer_free(timer);
559
}
560
561
diff --git a/replay/replay-debugging.c b/replay/replay-debugging.c
562
index XXXXXXX..XXXXXXX 100644
563
--- a/replay/replay-debugging.c
564
+++ b/replay/replay-debugging.c
565
@@ -XXX,XX +XXX,XX @@ static void replay_delete_break(void)
566
assert(replay_mutex_locked());
567
568
if (replay_break_timer) {
569
- timer_del(replay_break_timer);
570
timer_free(replay_break_timer);
571
replay_break_timer = NULL;
572
}
573
diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
574
index XXXXXXX..XXXXXXX 100644
575
--- a/target/s390x/cpu.c
576
+++ b/target/s390x/cpu.c
577
@@ -XXX,XX +XXX,XX @@ static void s390_cpu_finalize(Object *obj)
578
#if !defined(CONFIG_USER_ONLY)
579
S390CPU *cpu = S390_CPU(obj);
580
581
- timer_del(cpu->env.tod_timer);
582
timer_free(cpu->env.tod_timer);
583
- timer_del(cpu->env.cpu_timer);
584
timer_free(cpu->env.cpu_timer);
585
586
qemu_unregister_reset(s390_cpu_machine_reset_cb, cpu);
587
diff --git a/ui/console.c b/ui/console.c
588
index XXXXXXX..XXXXXXX 100644
589
--- a/ui/console.c
590
+++ b/ui/console.c
591
@@ -XXX,XX +XXX,XX @@ static void gui_setup_refresh(DisplayState *ds)
592
timer_mod(ds->gui_timer, qemu_clock_get_ms(QEMU_CLOCK_REALTIME));
593
}
594
if (!need_timer && ds->gui_timer != NULL) {
595
- timer_del(ds->gui_timer);
596
timer_free(ds->gui_timer);
597
ds->gui_timer = NULL;
598
}
599
diff --git a/ui/spice-core.c b/ui/spice-core.c
600
index XXXXXXX..XXXXXXX 100644
601
--- a/ui/spice-core.c
602
+++ b/ui/spice-core.c
603
@@ -XXX,XX +XXX,XX @@ static void timer_cancel(SpiceTimer *timer)
604
605
static void timer_remove(SpiceTimer *timer)
606
{
607
- timer_del(timer->timer);
608
timer_free(timer->timer);
609
g_free(timer);
610
}
611
diff --git a/util/throttle.c b/util/throttle.c
612
index XXXXXXX..XXXXXXX 100644
613
--- a/util/throttle.c
614
+++ b/util/throttle.c
615
@@ -XXX,XX +XXX,XX @@ static void throttle_timer_destroy(QEMUTimer **timer)
616
{
617
assert(*timer != NULL);
618
619
- timer_del(*timer);
620
timer_free(*timer);
621
*timer = NULL;
622
}
623
--
78
--
624
2.20.1
79
2.20.1
625
80
626
81
diff view generated by jsdifflib
New patch
1
When Hexagon was added we forgot to add it to the QEMU_ARCH_*
2
enumeration. This doesn't cause a visible effect because at the
3
moment Hexagon is linux-user only and the QEMU_ARCH_* constants are
4
only used in softmmu, but we might as well add it in, since it's the
5
only architecture currently missing from the list.
1
6
7
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>
10
Reviewed-by: Taylor Simpson <tsimpson@quicinc.com>
11
Message-id: 20210730105947.28215-6-peter.maydell@linaro.org
12
---
13
include/sysemu/arch_init.h | 1 +
14
1 file changed, 1 insertion(+)
15
16
diff --git a/include/sysemu/arch_init.h b/include/sysemu/arch_init.h
17
index XXXXXXX..XXXXXXX 100644
18
--- a/include/sysemu/arch_init.h
19
+++ b/include/sysemu/arch_init.h
20
@@ -XXX,XX +XXX,XX @@ enum {
21
QEMU_ARCH_RISCV = (1 << 19),
22
QEMU_ARCH_RX = (1 << 20),
23
QEMU_ARCH_AVR = (1 << 21),
24
+ QEMU_ARCH_HEXAGON = (1 << 22),
25
26
QEMU_ARCH_NONE = (1 << 31),
27
};
28
--
29
2.20.1
30
31
diff view generated by jsdifflib
1
In commit 64f863baeedc8659 we implemented the v8.1M FPCXT_S register,
1
The QEMU_ARCH_VIRTIO_* defines are used only in one file,
2
but we got the write behaviour wrong. On read, this register reads
2
qdev-monitor.c. Move them to that file.
3
bits [27:0] of FPSCR plus the CONTROL.SFPA bit. On write, it doesn't
4
just write back those bits -- it writes a value to the whole FPSCR,
5
whose upper 4 bits are zeroes.
6
7
We also incorrectly implemented the write-to-FPSCR as a simple store
8
to vfp.xregs; this skips the "update the softfloat flags" part of
9
the vfp_set_fpscr helper so the value would read back correctly but
10
not actually take effect.
11
12
Fix both of these things by doing a complete write to the FPSCR
13
using the helper function.
14
3
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
17
Message-id: 20201210201433.26262-3-peter.maydell@linaro.org
6
Reviewed-by: Markus Armbruster <armbru@redhat.com>
7
Message-id: 20210730105947.28215-7-peter.maydell@linaro.org
18
---
8
---
19
target/arm/translate-vfp.c.inc | 12 ++++++------
9
include/sysemu/arch_init.h | 9 ---------
20
1 file changed, 6 insertions(+), 6 deletions(-)
10
softmmu/qdev-monitor.c | 9 +++++++++
11
2 files changed, 9 insertions(+), 9 deletions(-)
21
12
22
diff --git a/target/arm/translate-vfp.c.inc b/target/arm/translate-vfp.c.inc
13
diff --git a/include/sysemu/arch_init.h b/include/sysemu/arch_init.h
23
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
24
--- a/target/arm/translate-vfp.c.inc
15
--- a/include/sysemu/arch_init.h
25
+++ b/target/arm/translate-vfp.c.inc
16
+++ b/include/sysemu/arch_init.h
26
@@ -XXX,XX +XXX,XX @@ static bool gen_M_fp_sysreg_write(DisasContext *s, int regno,
17
@@ -XXX,XX +XXX,XX @@ enum {
27
}
18
28
case ARM_VFP_FPCXT_S:
19
extern const uint32_t arch_type;
29
{
20
30
- TCGv_i32 sfpa, control, fpscr;
21
-/* default virtio transport per architecture */
31
- /* Set FPSCR[27:0] and CONTROL.SFPA from value */
22
-#define QEMU_ARCH_VIRTIO_PCI (QEMU_ARCH_ALPHA | QEMU_ARCH_ARM | \
32
+ TCGv_i32 sfpa, control;
23
- QEMU_ARCH_HPPA | QEMU_ARCH_I386 | \
33
+ /*
24
- QEMU_ARCH_MIPS | QEMU_ARCH_PPC | \
34
+ * Set FPSCR and CONTROL.SFPA from value; the new FPSCR takes
25
- QEMU_ARCH_RISCV | QEMU_ARCH_SH4 | \
35
+ * bits [27:0] from value and zeroes bits [31:28].
26
- QEMU_ARCH_SPARC | QEMU_ARCH_XTENSA)
36
+ */
27
-#define QEMU_ARCH_VIRTIO_CCW (QEMU_ARCH_S390X)
37
tmp = loadfn(s, opaque);
28
-#define QEMU_ARCH_VIRTIO_MMIO (QEMU_ARCH_M68K)
38
sfpa = tcg_temp_new_i32();
29
-
39
tcg_gen_shri_i32(sfpa, tmp, 31);
30
#endif
40
@@ -XXX,XX +XXX,XX @@ static bool gen_M_fp_sysreg_write(DisasContext *s, int regno,
31
diff --git a/softmmu/qdev-monitor.c b/softmmu/qdev-monitor.c
41
tcg_gen_deposit_i32(control, control, sfpa,
32
index XXXXXXX..XXXXXXX 100644
42
R_V7M_CONTROL_SFPA_SHIFT, 1);
33
--- a/softmmu/qdev-monitor.c
43
store_cpu_field(control, v7m.control[M_REG_S]);
34
+++ b/softmmu/qdev-monitor.c
44
- fpscr = load_cpu_field(vfp.xregs[ARM_VFP_FPSCR]);
35
@@ -XXX,XX +XXX,XX @@ typedef struct QDevAlias
45
- tcg_gen_andi_i32(fpscr, fpscr, FPCR_NZCV_MASK);
36
uint32_t arch_mask;
46
tcg_gen_andi_i32(tmp, tmp, ~FPCR_NZCV_MASK);
37
} QDevAlias;
47
- tcg_gen_or_i32(fpscr, fpscr, tmp);
38
48
- store_cpu_field(fpscr, vfp.xregs[ARM_VFP_FPSCR]);
39
+/* default virtio transport per architecture */
49
+ gen_helper_vfp_set_fpscr(cpu_env, tmp);
40
+#define QEMU_ARCH_VIRTIO_PCI (QEMU_ARCH_ALPHA | QEMU_ARCH_ARM | \
50
tcg_temp_free_i32(tmp);
41
+ QEMU_ARCH_HPPA | QEMU_ARCH_I386 | \
51
tcg_temp_free_i32(sfpa);
42
+ QEMU_ARCH_MIPS | QEMU_ARCH_PPC | \
52
break;
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 */
53
--
51
--
54
2.20.1
52
2.20.1
55
53
56
54
diff view generated by jsdifflib
1
Currently timer_free() is a simple wrapper for g_free(). This means
1
arch_init.h only defines the QEMU_ARCH_* enumeration and the
2
that the timer being freed must not be currently active, as otherwise
2
arch_type global. Don't include it in files that don't use those.
3
QEMU might crash later when the active list is processed and still
4
has a pointer to freed memory on it. As a result almost all calls to
5
timer_free() are preceded by a timer_del() call, as can be seen in
6
the output of
7
git grep -B1 '\<timer_free\>'
8
9
This is unfortunate API design as it makes it easy to accidentally
10
misuse (by forgetting the timer_del()), and the correct use is
11
annoyingly verbose.
12
13
Make timer_free() imply a timer_del().
14
3
15
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
5
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
17
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
18
Message-id: 20201215154107.3255-2-peter.maydell@linaro.org
7
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
8
Message-id: 20210730105947.28215-8-peter.maydell@linaro.org
19
---
9
---
20
include/qemu/timer.h | 24 +++++++++++++-----------
10
blockdev.c | 1 -
21
1 file changed, 13 insertions(+), 11 deletions(-)
11
hw/i386/pc.c | 1 -
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(-)
22
25
23
diff --git a/include/qemu/timer.h b/include/qemu/timer.h
26
diff --git a/blockdev.c b/blockdev.c
24
index XXXXXXX..XXXXXXX 100644
27
index XXXXXXX..XXXXXXX 100644
25
--- a/include/qemu/timer.h
28
--- a/blockdev.c
26
+++ b/include/qemu/timer.h
29
+++ b/blockdev.c
27
@@ -XXX,XX +XXX,XX @@ static inline QEMUTimer *timer_new_ms(QEMUClockType type, QEMUTimerCB *cb,
30
@@ -XXX,XX +XXX,XX @@
28
*/
31
#include "sysemu/iothread.h"
29
void timer_deinit(QEMUTimer *ts);
32
#include "block/block_int.h"
30
33
#include "block/trace.h"
31
-/**
34
-#include "sysemu/arch_init.h"
32
- * timer_free:
35
#include "sysemu/runstate.h"
33
- * @ts: the timer
36
#include "sysemu/replay.h"
34
- *
37
#include "qemu/cutils.h"
35
- * Free a timer (it must not be on the active list)
38
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
36
- */
39
index XXXXXXX..XXXXXXX 100644
37
-static inline void timer_free(QEMUTimer *ts)
40
--- a/hw/i386/pc.c
38
-{
41
+++ b/hw/i386/pc.c
39
- g_free(ts);
42
@@ -XXX,XX +XXX,XX @@
40
-}
43
#include "hw/xen/start_info.h"
41
-
44
#include "ui/qemu-spice.h"
42
/**
45
#include "exec/memory.h"
43
* timer_del:
46
-#include "sysemu/arch_init.h"
44
* @ts: the timer
47
#include "qemu/bitmap.h"
45
@@ -XXX,XX +XXX,XX @@ static inline void timer_free(QEMUTimer *ts)
48
#include "qemu/config-file.h"
46
*/
49
#include "qemu/error-report.h"
47
void timer_del(QEMUTimer *ts);
50
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
48
51
index XXXXXXX..XXXXXXX 100644
49
+/**
52
--- a/hw/i386/pc_piix.c
50
+ * timer_free:
53
+++ b/hw/i386/pc_piix.c
51
+ * @ts: the timer
54
@@ -XXX,XX +XXX,XX @@
52
+ *
55
#include "sysemu/kvm.h"
53
+ * Free a timer. This will call timer_del() for you to remove
56
#include "hw/kvm/clock.h"
54
+ * the timer from the active list if it was still active.
57
#include "hw/sysbus.h"
55
+ */
58
-#include "sysemu/arch_init.h"
56
+static inline void timer_free(QEMUTimer *ts)
59
#include "hw/i2c/smbus_eeprom.h"
57
+{
60
#include "hw/xen/xen-x86.h"
58
+ timer_del(ts);
61
#include "exec/memory.h"
59
+ g_free(ts);
62
diff --git a/hw/i386/pc_q35.c b/hw/i386/pc_q35.c
60
+}
63
index XXXXXXX..XXXXXXX 100644
61
+
64
--- a/hw/i386/pc_q35.c
62
/**
65
+++ b/hw/i386/pc_q35.c
63
* timer_mod_ns:
66
@@ -XXX,XX +XXX,XX @@
64
* @ts: the timer
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
171
index XXXXXXX..XXXXXXX 100644
172
--- a/target/ppc/cpu_init.c
173
+++ b/target/ppc/cpu_init.c
174
@@ -XXX,XX +XXX,XX @@
175
#include "disas/dis-asm.h"
176
#include "exec/gdbstub.h"
177
#include "kvm_ppc.h"
178
-#include "sysemu/arch_init.h"
179
#include "sysemu/cpus.h"
180
#include "sysemu/hw_accel.h"
181
#include "sysemu/tcg.h"
182
diff --git a/target/s390x/cpu-sysemu.c b/target/s390x/cpu-sysemu.c
183
index XXXXXXX..XXXXXXX 100644
184
--- a/target/s390x/cpu-sysemu.c
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"
65
--
194
--
66
2.20.1
195
2.20.1
67
196
68
197
diff view generated by jsdifflib
1
From: Gan Qixin <ganqixin@huawei.com>
1
We added a stub for the arch_type global in commit 5964ed56d9a1 so
2
that we could compile blockdev.c into the tools. However, in commit
3
9db1d3a2be9bf we removed the only use of arch_type from blockdev.c.
4
The stub is therefore no longer needed, and we can delete it again,
5
together with the QEMU_ARCH_NONE value that only the stub was using.
2
6
3
When running device-introspect-test, a memory leak occurred in the
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
digic_timer_init function, so use ptimer_free() in the finalize function to
8
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
5
avoid it.
9
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
10
Message-id: 20210730105947.28215-9-peter.maydell@linaro.org
11
---
12
include/sysemu/arch_init.h | 2 --
13
stubs/arch_type.c | 4 ----
14
stubs/meson.build | 1 -
15
3 files changed, 7 deletions(-)
16
delete mode 100644 stubs/arch_type.c
6
17
7
ASAN shows memory leak stack:
18
diff --git a/include/sysemu/arch_init.h b/include/sysemu/arch_init.h
8
9
Indirect leak of 288 byte(s) in 3 object(s) allocated from:
10
#0 0xffffab97e1f0 in __interceptor_calloc (/lib64/libasan.so.5+0xee1f0)
11
#1 0xffffab256800 in g_malloc0 (/lib64/libglib-2.0.so.0+0x56800)
12
#2 0xaaabf555db78 in ptimer_init /qemu/hw/core/ptimer.c:432
13
#3 0xaaabf5b04084 in digic_timer_init /qemu/hw/timer/digic-timer.c:142
14
#4 0xaaabf6339f6c in object_initialize_with_type /qemu/qom/object.c:515
15
#5 0xaaabf633ca04 in object_initialize_child_with_propsv /qemu/qom/object.c:564
16
#6 0xaaabf633cc08 in object_initialize_child_with_props /qemu/qom/object.c:547
17
#7 0xaaabf5b40e84 in digic_init /qemu/hw/arm/digic.c:46
18
#8 0xaaabf6339f6c in object_initialize_with_type /qemu/qom/object.c:515
19
#9 0xaaabf633a1e0 in object_new_with_type /qemu/qom/object.c:729
20
#10 0xaaabf6375e40 in qmp_device_list_properties /qemu/qom/qom-qmp-cmds.c:153
21
#11 0xaaabf653d8ec in qmp_marshal_device_list_properties /qemu/qapi/qapi-commands-qdev.c:59
22
#12 0xaaabf6587d08 in do_qmp_dispatch_bh /qemu/qapi/qmp-dispatch.c:110
23
24
Reported-by: Euler Robot <euler.robot@huawei.com>
25
Signed-off-by: Gan Qixin <ganqixin@huawei.com>
26
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
27
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
28
---
29
hw/timer/digic-timer.c | 8 ++++++++
30
1 file changed, 8 insertions(+)
31
32
diff --git a/hw/timer/digic-timer.c b/hw/timer/digic-timer.c
33
index XXXXXXX..XXXXXXX 100644
19
index XXXXXXX..XXXXXXX 100644
34
--- a/hw/timer/digic-timer.c
20
--- a/include/sysemu/arch_init.h
35
+++ b/hw/timer/digic-timer.c
21
+++ b/include/sysemu/arch_init.h
36
@@ -XXX,XX +XXX,XX @@ static void digic_timer_init(Object *obj)
22
@@ -XXX,XX +XXX,XX @@ enum {
37
sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->iomem);
23
QEMU_ARCH_RX = (1 << 20),
38
}
24
QEMU_ARCH_AVR = (1 << 21),
39
25
QEMU_ARCH_HEXAGON = (1 << 22),
40
+static void digic_timer_finalize(Object *obj)
26
-
41
+{
27
- QEMU_ARCH_NONE = (1 << 31),
42
+ DigicTimerState *s = DIGIC_TIMER(obj);
43
+
44
+ ptimer_free(s->ptimer);
45
+}
46
+
47
static void digic_timer_class_init(ObjectClass *klass, void *class_data)
48
{
49
DeviceClass *dc = DEVICE_CLASS(klass);
50
@@ -XXX,XX +XXX,XX @@ static const TypeInfo digic_timer_info = {
51
.parent = TYPE_SYS_BUS_DEVICE,
52
.instance_size = sizeof(DigicTimerState),
53
.instance_init = digic_timer_init,
54
+ .instance_finalize = digic_timer_finalize,
55
.class_init = digic_timer_class_init,
56
};
28
};
57
29
30
extern const uint32_t arch_type;
31
diff --git a/stubs/arch_type.c b/stubs/arch_type.c
32
deleted file mode 100644
33
index XXXXXXX..XXXXXXX
34
--- a/stubs/arch_type.c
35
+++ /dev/null
36
@@ -XXX,XX +XXX,XX @@
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
43
--- a/stubs/meson.build
44
+++ b/stubs/meson.build
45
@@ -XXX,XX +XXX,XX @@
46
-stub_ss.add(files('arch_type.c'))
47
stub_ss.add(files('bdrv-next-monitor-owned.c'))
48
stub_ss.add(files('blk-commit-all.c'))
49
stub_ss.add(files('blk-exp-close-all.c'))
58
--
50
--
59
2.20.1
51
2.20.1
60
52
61
53
diff view generated by jsdifflib
1
From: Gan Qixin <ganqixin@huawei.com>
1
The gunzip() function reads various fields from a passed in source
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.
2
7
3
When running device-introspect-test, a memory leak occurred in the
8
You can see this with valgrind:
4
mss_timer_init function, so use ptimer_free() in the finalize function to avoid
5
it.
6
9
7
ASAN shows memory leak stack:
10
$ printf "%b" '\x1f\x8b' > /tmp/image
11
$ valgrind qemu-system-aarch64 -display none -M virt -cpu max -kernel /tmp/image
12
[...]
13
==19224== Invalid read of size 1
14
==19224== at 0x67302E: gunzip (loader.c:558)
15
==19224== by 0x673907: load_image_gzipped_buffer (loader.c:788)
16
==19224== by 0xA18032: load_aarch64_image (boot.c:932)
17
==19224== by 0xA18489: arm_setup_direct_kernel_boot (boot.c:1063)
18
==19224== by 0xA18D90: arm_load_kernel (boot.c:1317)
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)
8
38
9
Indirect leak of 192 byte(s) in 2 object(s) allocated from:
39
Check that we have enough bytes of data to read the header bytes that
10
#0 0xffffab97e1f0 in __interceptor_calloc (/lib64/libasan.so.5+0xee1f0)
40
we read before we read them.
11
#1 0xffffab256800 in g_malloc0 (/lib64/libglib-2.0.so.0+0x56800)
12
#2 0xaaabf555db78 in ptimer_init /qemu/hw/core/ptimer.c:432
13
#3 0xaaabf58a0010 in mss_timer_init /qemu/hw/timer/mss-timer.c:235
14
#4 0xaaabf6339f6c in object_initialize_with_type /qemu/qom/object.c:515
15
#5 0xaaabf633ca04 in object_initialize_child_with_propsv /qemu/qom/object.c:564
16
#6 0xaaabf633cc08 in object_initialize_child_with_props /qemu/qom/object.c:547
17
#7 0xaaabf5b8316c in m2sxxx_soc_initfn /qemu/hw/arm/msf2-soc.c:70
18
#8 0xaaabf6339f6c in object_initialize_with_type /qemu/qom/object.c:515
19
#9 0xaaabf633a1e0 in object_new_with_type /qemu/qom/object.c:729
20
#10 0xaaabf6375e40 in qmp_device_list_properties /qemu/qom/qom-qmp-cmds.c:153
21
#11 0xaaabf653d8ec in qmp_marshal_device_list_properties /qemu/qapi/qapi-commands-qdev.c:59
22
#12 0xaaabf6587d08 in do_qmp_dispatch_bh /qemu/qapi/qmp-dispatch.c:110
23
41
24
Reported-by: Euler Robot <euler.robot@huawei.com>
42
Fixes: Coverity 1458997
25
Signed-off-by: Gan Qixin <ganqixin@huawei.com>
26
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
27
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
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
28
---
46
---
29
hw/timer/mss-timer.c | 13 +++++++++++++
47
hw/core/loader.c | 35 +++++++++++++++++++++++++----------
30
1 file changed, 13 insertions(+)
48
1 file changed, 25 insertions(+), 10 deletions(-)
31
49
32
diff --git a/hw/timer/mss-timer.c b/hw/timer/mss-timer.c
50
diff --git a/hw/core/loader.c b/hw/core/loader.c
33
index XXXXXXX..XXXXXXX 100644
51
index XXXXXXX..XXXXXXX 100644
34
--- a/hw/timer/mss-timer.c
52
--- a/hw/core/loader.c
35
+++ b/hw/timer/mss-timer.c
53
+++ b/hw/core/loader.c
36
@@ -XXX,XX +XXX,XX @@ static void mss_timer_init(Object *obj)
54
@@ -XXX,XX +XXX,XX @@ ssize_t gunzip(void *dst, size_t dstlen, uint8_t *src, size_t srclen)
37
sysbus_init_mmio(SYS_BUS_DEVICE(obj), &t->mmio);
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
}
66
- if ((flags & EXTRA_FIELD) != 0)
67
+ if ((flags & EXTRA_FIELD) != 0) {
68
+ if (srclen < 12) {
69
+ goto toosmall;
70
+ }
71
i = 12 + src[10] + (src[11] << 8);
72
- if ((flags & ORIG_NAME) != 0)
73
- while (src[i++] != 0)
74
- ;
75
- if ((flags & COMMENT) != 0)
76
- while (src[i++] != 0)
77
- ;
78
- if ((flags & HEAD_CRC) != 0)
79
+ }
80
+ if ((flags & ORIG_NAME) != 0) {
81
+ while (i < srclen && src[i++] != 0) {
82
+ /* do nothing */
83
+ }
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
}
98
99
s.zalloc = zalloc;
100
@@ -XXX,XX +XXX,XX @@ ssize_t gunzip(void *dst, size_t dstlen, uint8_t *src, size_t srclen)
101
inflateEnd(&s);
102
103
return dstbytes;
104
+
105
+toosmall:
106
+ puts("Error: gunzip out of data in header\n");
107
+ return -1;
38
}
108
}
39
109
40
+static void mss_timer_finalize(Object *obj)
110
/* Load a U-Boot image. */
41
+{
42
+ MSSTimerState *t = MSS_TIMER(obj);
43
+ int i;
44
+
45
+ for (i = 0; i < NUM_TIMERS; i++) {
46
+ struct Msf2Timer *st = &t->timers[i];
47
+
48
+ ptimer_free(st->ptimer);
49
+ }
50
+}
51
+
52
static const VMStateDescription vmstate_timers = {
53
.name = "mss-timer-block",
54
.version_id = 1,
55
@@ -XXX,XX +XXX,XX @@ static const TypeInfo mss_timer_info = {
56
.parent = TYPE_SYS_BUS_DEVICE,
57
.instance_size = sizeof(MSSTimerState),
58
.instance_init = mss_timer_init,
59
+ .instance_finalize = mss_timer_finalize,
60
.class_init = mss_timer_class_init,
61
};
62
63
--
111
--
64
2.20.1
112
2.20.1
65
113
66
114
diff view generated by jsdifflib
New patch
1
In the alignment check added to qemu_ram_alloc_from_fd() in commit
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.
1
7
8
Fixes: Coverity 1459867
9
Fixes: ce317be98d ("exec: fetch the alignment of Linux devdax pmem character device nodes")
10
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11
Reviewed-by: Jingqi Liu <jingqi.liu@intel.com>
12
Message-id: 20210812150624.29139-1-peter.maydell@linaro.org
13
---
14
softmmu/physmem.c | 2 +-
15
1 file changed, 1 insertion(+), 1 deletion(-)
16
17
diff --git a/softmmu/physmem.c b/softmmu/physmem.c
18
index XXXXXXX..XXXXXXX 100644
19
--- a/softmmu/physmem.c
20
+++ b/softmmu/physmem.c
21
@@ -XXX,XX +XXX,XX @@ RAMBlock *qemu_ram_alloc_from_fd(ram_addr_t size, MemoryRegion *mr,
22
}
23
24
file_align = get_file_align(fd);
25
- if (file_align > 0 && mr && file_align > mr->align) {
26
+ if (file_align > 0 && file_align > mr->align) {
27
error_setg(errp, "backing store align 0x%" PRIx64
28
" is larger than 'align' option 0x%" PRIx64,
29
file_align, mr->align);
30
--
31
2.20.1
32
33
diff view generated by jsdifflib
New patch
1
The realpath() function can return NULL on error, so we need to check
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.
1
5
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>
9
Reviewed-by: Jingqi Liu <jingqi.liu@intel.com>
10
Message-id: 20210812151525.31456-1-peter.maydell@linaro.org
11
---
12
softmmu/physmem.c | 3 +++
13
1 file changed, 3 insertions(+)
14
15
diff --git a/softmmu/physmem.c b/softmmu/physmem.c
16
index XXXXXXX..XXXXXXX 100644
17
--- a/softmmu/physmem.c
18
+++ b/softmmu/physmem.c
19
@@ -XXX,XX +XXX,XX @@ static int64_t get_file_align(int fd)
20
path = g_strdup_printf("/sys/dev/char/%d:%d",
21
major(st.st_rdev), minor(st.st_rdev));
22
rpath = realpath(path, NULL);
23
+ if (!rpath) {
24
+ return -errno;
25
+ }
26
27
rc = daxctl_new(&ctx);
28
if (rc) {
29
--
30
2.20.1
31
32
diff view generated by jsdifflib
New patch
1
We don't currently zero-initialize the 'struct sockaddr_in' that
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.
1
8
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>
13
Reviewed-by: Eric Blake <eblake@redhat.com>
14
Message-id: 20210813150506.7768-2-peter.maydell@linaro.org
15
---
16
net/net.c | 2 ++
17
1 file changed, 2 insertions(+)
18
19
diff --git a/net/net.c b/net/net.c
20
index XXXXXXX..XXXXXXX 100644
21
--- a/net/net.c
22
+++ b/net/net.c
23
@@ -XXX,XX +XXX,XX @@ int parse_host_port(struct sockaddr_in *saddr, const char *str,
24
const char *addr, *p, *r;
25
int port, ret = 0;
26
27
+ memset(saddr, 0, sizeof(*saddr));
28
+
29
substrings = g_strsplit(str, ":", 2);
30
if (!substrings || !substrings[0] || !substrings[1]) {
31
error_setg(errp, "host address '%s' doesn't contain ':' "
32
--
33
2.20.1
34
35
diff view generated by jsdifflib
1
From: Gan Qixin <ganqixin@huawei.com>
1
Zero-initialize sockaddr_in and sockaddr_un structs that we're about
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.
2
5
3
When running device-introspect-test, a memory leak occurred in the
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
exynos4210_rtc_init function, so use ptimer_free() in the finalize function to
7
Reviewed-by: Eric Blake <eblake@redhat.com>
5
avoid it.
8
Message-id: 20210813150506.7768-3-peter.maydell@linaro.org
9
---
10
gdbstub.c | 4 ++--
11
1 file changed, 2 insertions(+), 2 deletions(-)
6
12
7
ASAN shows memory leak stack:
13
diff --git a/gdbstub.c b/gdbstub.c
8
9
Indirect leak of 96 byte(s) in 1 object(s) allocated from:
10
#0 0xffffab97e1f0 in __interceptor_calloc (/lib64/libasan.so.5+0xee1f0)
11
#1 0xffffab256800 in g_malloc0 (/lib64/libglib-2.0.so.0+0x56800)
12
#2 0xaaabf555db78 in ptimer_init /qemu/hw/core/ptimer.c:432
13
#3 0xaaabf57b3934 in exynos4210_rtc_init /qemu/hw/rtc/exynos4210_rtc.c:567
14
#4 0xaaabf6339f6c in object_initialize_with_type /qemu/qom/object.c:515
15
#5 0xaaabf633a1e0 in object_new_with_type /qemu/qom/object.c:729
16
#6 0xaaabf6375e40 in qmp_device_list_properties /qemu/qom/qom-qmp-cmds.c:153
17
#7 0xaaabf653d8ec in qmp_marshal_device_list_properties /qemu/qapi/qapi-commands-qdev.c:59
18
#8 0xaaabf6587d08 in do_qmp_dispatch_bh /qemu/qapi/qmp-dispatch.c:110
19
#9 0xaaabf6552708 in aio_bh_call /qemu/util/async.c:136
20
#10 0xaaabf6552708 in aio_bh_poll /qemu/util/async.c:164
21
#11 0xaaabf655f19c in aio_dispatch /qemu/util/aio-posix.c:381
22
#12 0xaaabf65523f4 in aio_ctx_dispatch /qemu/util/async.c:306
23
24
Reported-by: Euler Robot <euler.robot@huawei.com>
25
Signed-off-by: Gan Qixin <ganqixin@huawei.com>
26
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
27
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
28
---
29
hw/rtc/exynos4210_rtc.c | 9 +++++++++
30
1 file changed, 9 insertions(+)
31
32
diff --git a/hw/rtc/exynos4210_rtc.c b/hw/rtc/exynos4210_rtc.c
33
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
34
--- a/hw/rtc/exynos4210_rtc.c
15
--- a/gdbstub.c
35
+++ b/hw/rtc/exynos4210_rtc.c
16
+++ b/gdbstub.c
36
@@ -XXX,XX +XXX,XX @@ static void exynos4210_rtc_init(Object *obj)
17
@@ -XXX,XX +XXX,XX @@ static bool gdb_accept_socket(int gdb_fd)
37
sysbus_init_mmio(dev, &s->iomem);
18
38
}
19
static int gdbserver_open_socket(const char *path)
39
40
+static void exynos4210_rtc_finalize(Object *obj)
41
+{
42
+ Exynos4210RTCState *s = EXYNOS4210_RTC(obj);
43
+
44
+ ptimer_free(s->ptimer);
45
+ ptimer_free(s->ptimer_1Hz);
46
+}
47
+
48
static void exynos4210_rtc_class_init(ObjectClass *klass, void *data)
49
{
20
{
50
DeviceClass *dc = DEVICE_CLASS(klass);
21
- struct sockaddr_un sockaddr;
51
@@ -XXX,XX +XXX,XX @@ static const TypeInfo exynos4210_rtc_info = {
22
+ struct sockaddr_un sockaddr = {};
52
.parent = TYPE_SYS_BUS_DEVICE,
23
int fd, ret;
53
.instance_size = sizeof(Exynos4210RTCState),
24
54
.instance_init = exynos4210_rtc_init,
25
fd = socket(AF_UNIX, SOCK_STREAM, 0);
55
+ .instance_finalize = exynos4210_rtc_finalize,
26
@@ -XXX,XX +XXX,XX @@ static int gdbserver_open_socket(const char *path)
56
.class_init = exynos4210_rtc_class_init,
27
57
};
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;
58
34
59
--
35
--
60
2.20.1
36
2.20.1
61
37
62
38
diff view generated by jsdifflib
1
From: Bin Meng <bin.meng@windriver.com>
1
Zero-initialize the sockaddr_in struct that we're about to fill in
2
and pass to bind(), to ensure we don't leave possible
3
implementation-defined extension fields as uninitialized garbage.
2
4
3
U-Boot expects PMU_MISC0 register bit 7 is set (see init_bandgap()
4
in arch/arm/mach-imx/mx6/soc.c) during boot. This bit indicates the
5
bandgap has stabilized.
6
7
With this change, the latest upstream U-Boot (v2021.01-rc3) for imx6
8
sabrelite board (mx6qsabrelite_defconfig), with a slight change made
9
by switching CONFIG_OF_SEPARATE to CONFIG_OF_EMBED, boots to U-Boot
10
shell on QEMU with the following command:
11
12
$ qemu-system-arm -M sabrelite -smp 4 -m 1G -kernel u-boot \
13
-display none -serial null -serial stdio
14
15
Boot log below:
16
17
U-Boot 2021.01-rc3 (Dec 12 2020 - 17:40:02 +0800)
18
19
CPU: Freescale i.MX?? rev1.0 at 792 MHz
20
Reset cause: POR
21
Model: Freescale i.MX6 Quad SABRE Lite Board
22
Board: SABRE Lite
23
I2C: ready
24
DRAM: 1 GiB
25
force_idle_bus: sda=0 scl=0 sda.gp=0x5c scl.gp=0x55
26
force_idle_bus: failed to clear bus, sda=0 scl=0
27
force_idle_bus: sda=0 scl=0 sda.gp=0x6d scl.gp=0x6c
28
force_idle_bus: failed to clear bus, sda=0 scl=0
29
force_idle_bus: sda=0 scl=0 sda.gp=0xcb scl.gp=0x5
30
force_idle_bus: failed to clear bus, sda=0 scl=0
31
MMC: FSL_SDHC: 0, FSL_SDHC: 1
32
Loading Environment from MMC... *** Warning - No block device, using default environment
33
34
In: serial
35
Out: serial
36
Err: serial
37
Net: Board Net Initialization Failed
38
No ethernet found.
39
starting USB...
40
Bus usb@2184000: usb dr_mode not found
41
USB EHCI 1.00
42
Bus usb@2184200: USB EHCI 1.00
43
scanning bus usb@2184000 for devices... 1 USB Device(s) found
44
scanning bus usb@2184200 for devices... 1 USB Device(s) found
45
scanning usb for storage devices... 0 Storage Device(s) found
46
scanning usb for ethernet devices... 0 Ethernet Device(s) found
47
Hit any key to stop autoboot: 0
48
=>
49
50
Signed-off-by: Bin Meng <bin.meng@windriver.com>
51
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
52
Message-id: 20210106063504.10841-2-bmeng.cn@gmail.com
53
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
6
Reviewed-by: Eric Blake <eblake@redhat.com>
7
Reviewed-by: Corey Minyard <cminyard@mvista.com>
8
Acked-by: Thomas Huth <thuth@redhat.com>
9
Message-id: 20210813150506.7768-4-peter.maydell@linaro.org
54
---
10
---
55
hw/misc/imx6_ccm.c | 2 +-
11
tests/qtest/ipmi-bt-test.c | 2 +-
56
1 file changed, 1 insertion(+), 1 deletion(-)
12
1 file changed, 1 insertion(+), 1 deletion(-)
57
13
58
diff --git a/hw/misc/imx6_ccm.c b/hw/misc/imx6_ccm.c
14
diff --git a/tests/qtest/ipmi-bt-test.c b/tests/qtest/ipmi-bt-test.c
59
index XXXXXXX..XXXXXXX 100644
15
index XXXXXXX..XXXXXXX 100644
60
--- a/hw/misc/imx6_ccm.c
16
--- a/tests/qtest/ipmi-bt-test.c
61
+++ b/hw/misc/imx6_ccm.c
17
+++ b/tests/qtest/ipmi-bt-test.c
62
@@ -XXX,XX +XXX,XX @@ static void imx6_ccm_reset(DeviceState *dev)
18
@@ -XXX,XX +XXX,XX @@ static void test_enable_irq(void)
63
s->analog[PMU_REG_3P0] = 0x00000F74;
19
*/
64
s->analog[PMU_REG_2P5] = 0x00005071;
20
static void open_socket(void)
65
s->analog[PMU_REG_CORE] = 0x00402010;
21
{
66
- s->analog[PMU_MISC0] = 0x04000000;
22
- struct sockaddr_in myaddr;
67
+ s->analog[PMU_MISC0] = 0x04000080;
23
+ struct sockaddr_in myaddr = {};
68
s->analog[PMU_MISC1] = 0x00000000;
24
socklen_t addrlen;
69
s->analog[PMU_MISC2] = 0x00272727;
25
70
26
myaddr.sin_family = AF_INET;
71
--
27
--
72
2.20.1
28
2.20.1
73
29
74
30
diff view generated by jsdifflib
New patch
1
Zero-initialize sockaddr_in and sockaddr_un structs that we're about
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.
1
5
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Reviewed-by: Eric Blake <eblake@redhat.com>
8
Message-id: 20210813150506.7768-5-peter.maydell@linaro.org
9
---
10
tests/tcg/multiarch/linux-test.c | 4 ++--
11
1 file changed, 2 insertions(+), 2 deletions(-)
12
13
diff --git a/tests/tcg/multiarch/linux-test.c b/tests/tcg/multiarch/linux-test.c
14
index XXXXXXX..XXXXXXX 100644
15
--- a/tests/tcg/multiarch/linux-test.c
16
+++ b/tests/tcg/multiarch/linux-test.c
17
@@ -XXX,XX +XXX,XX @@ static void test_time(void)
18
static int server_socket(void)
19
{
20
int val, fd;
21
- struct sockaddr_in sockaddr;
22
+ struct sockaddr_in sockaddr = {};
23
24
/* server socket */
25
fd = chk_error(socket(PF_INET, SOCK_STREAM, 0));
26
@@ -XXX,XX +XXX,XX @@ static int server_socket(void)
27
static int client_socket(uint16_t port)
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
--
36
2.20.1
37
38
diff view generated by jsdifflib
1
Support for running KVM on 32-bit Arm hosts was removed in commit
1
The SoC realize can fail for legitimate reasons, because it propagates
2
82bf7ae84ce739e. You can still run a 32-bit guest on a 64-bit Arm
2
errors up from CPU realize, which in turn can be provoked by user
3
host CPU, but because Arm KVM requires the host and guest CPU types
3
error in setting commandline options. Use error_fatal so we report
4
to match, it is not possible to run a guest that requires a Cortex-A9
4
the error message to the user and exit, rather than asserting
5
or Cortex-A15 CPU there. That means that the code in the
5
via error_abort.
6
highbank/midway board models to support KVM is no longer used, and we
7
can delete it.
8
6
9
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
10
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
11
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
9
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
12
Message-id: 20201215144215.28482-1-peter.maydell@linaro.org
10
Message-id: 20210816135842.25302-2-peter.maydell@linaro.org
13
---
11
---
14
hw/arm/highbank.c | 14 ++++----------
12
hw/arm/raspi.c | 2 +-
15
1 file changed, 4 insertions(+), 10 deletions(-)
13
1 file changed, 1 insertion(+), 1 deletion(-)
16
14
17
diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c
15
diff --git a/hw/arm/raspi.c b/hw/arm/raspi.c
18
index XXXXXXX..XXXXXXX 100644
16
index XXXXXXX..XXXXXXX 100644
19
--- a/hw/arm/highbank.c
17
--- a/hw/arm/raspi.c
20
+++ b/hw/arm/highbank.c
18
+++ b/hw/arm/raspi.c
21
@@ -XXX,XX +XXX,XX @@
19
@@ -XXX,XX +XXX,XX @@ static void raspi_machine_init(MachineState *machine)
22
#include "hw/arm/boot.h"
20
object_property_add_const_link(OBJECT(&s->soc), "ram", OBJECT(machine->ram));
23
#include "hw/loader.h"
21
object_property_set_int(OBJECT(&s->soc), "board-rev", board_rev,
24
#include "net/net.h"
22
&error_abort);
25
-#include "sysemu/kvm.h"
23
- qdev_realize(DEVICE(&s->soc), NULL, &error_abort);
26
#include "sysemu/runstate.h"
24
+ qdev_realize(DEVICE(&s->soc), NULL, &error_fatal);
27
#include "sysemu/sysemu.h"
25
28
#include "hw/boards.h"
26
/* Create and plug in the SD cards */
29
@@ -XXX,XX +XXX,XX @@
27
di = drive_get_next(IF_SD);
30
#include "hw/cpu/a15mpcore.h"
31
#include "qemu/log.h"
32
#include "qom/object.h"
33
+#include "cpu.h"
34
35
#define SMP_BOOT_ADDR 0x100
36
#define SMP_BOOT_REG 0x40
37
@@ -XXX,XX +XXX,XX @@ static void calxeda_init(MachineState *machine, enum cxmachines machine_id)
38
highbank_binfo.loader_start = 0;
39
highbank_binfo.write_secondary_boot = hb_write_secondary;
40
highbank_binfo.secondary_cpu_reset_hook = hb_reset_secondary;
41
- if (!kvm_enabled()) {
42
- highbank_binfo.board_setup_addr = BOARD_SETUP_ADDR;
43
- highbank_binfo.write_board_setup = hb_write_board_setup;
44
- highbank_binfo.secure_board_setup = true;
45
- } else {
46
- warn_report("cannot load built-in Monitor support "
47
- "if KVM is enabled. Some guests (such as Linux) "
48
- "may not boot.");
49
- }
50
+ highbank_binfo.board_setup_addr = BOARD_SETUP_ADDR;
51
+ highbank_binfo.write_board_setup = hb_write_board_setup;
52
+ highbank_binfo.secure_board_setup = true;
53
54
arm_load_kernel(ARM_CPU(first_cpu), machine, &highbank_binfo);
55
}
56
--
28
--
57
2.20.1
29
2.20.1
58
30
59
31
diff view generated by jsdifflib
1
The Arm CPU finalize function uses a sequence of timer_del(), timer_deinit(),
1
KVM cannot support multiple address spaces per CPU; if you try to
2
timer_free() to free the timer. The timer_deinit() step in this was always
2
create more than one then cpu_address_space_init() will assert.
3
unnecessary, and now the timer_del() is implied by timer_free(), so we can
4
collapse this down to simply calling timer_free().
5
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
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
26
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>
27
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20201215154107.3255-5-peter.maydell@linaro.org
28
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
29
Message-id: 20210816135842.25302-3-peter.maydell@linaro.org
10
---
30
---
11
target/arm/cpu.c | 2 --
31
target/arm/cpu.c | 23 +++++++++++++++++++++++
12
1 file changed, 2 deletions(-)
32
1 file changed, 23 insertions(+)
13
33
14
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
34
diff --git a/target/arm/cpu.c b/target/arm/cpu.c
15
index XXXXXXX..XXXXXXX 100644
35
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/cpu.c
36
--- a/target/arm/cpu.c
17
+++ b/target/arm/cpu.c
37
+++ b/target/arm/cpu.c
18
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_finalizefn(Object *obj)
38
@@ -XXX,XX +XXX,XX @@ static void arm_cpu_realizefn(DeviceState *dev, Error **errp)
39
}
19
}
40
}
20
#ifndef CONFIG_USER_ONLY
41
21
if (cpu->pmu_timer) {
42
+ if (kvm_enabled()) {
22
- timer_del(cpu->pmu_timer);
43
+ /*
23
- timer_deinit(cpu->pmu_timer);
44
+ * Catch all the cases which might cause us to create more than one
24
timer_free(cpu->pmu_timer);
45
+ * address space for the CPU (otherwise we will assert() later in
25
}
46
+ * cpu_address_space_init()).
26
#endif
47
+ */
48
+ if (arm_feature(env, ARM_FEATURE_M)) {
49
+ error_setg(errp,
50
+ "Cannot enable KVM when using an M-profile guest CPU");
51
+ return;
52
+ }
53
+ if (cpu->has_el3) {
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
27
--
68
--
28
2.20.1
69
2.20.1
29
70
30
71
diff view generated by jsdifflib
1
The CCR is a register most of whose bits are banked between security
1
Now that the CPU realize function will fail cleanly if we ask for EL3
2
states but where BFHFNMIGN is not, and we keep it in the non-secure
2
when KVM is enabled, we don't need to check for errors explicitly in
3
entry of the v7m.ccr[] array. The logic which tries to handle this
3
the virt board code. The reported message is slightly different;
4
bit fails to implement the "RAZ/WI from Nonsecure if AIRCR.BFHFNMINS
4
it is now:
5
is zero" requirement; correct the omission.
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
9
We don't delete the MTE check because there the logic is more
10
complex; deleting the check would work but makes the error message
11
less helpful, as it would read:
12
qemu-system-aarch64: MTE requested, but not supported by the guest CPU
13
instead of:
14
qemu-system-aarch64: mach-virt: KVM does not support providing MTE to the guest CPU
6
15
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
16
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
17
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20201210201433.26262-2-peter.maydell@linaro.org
18
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
19
Message-id: 20210816135842.25302-4-peter.maydell@linaro.org
10
---
20
---
11
hw/intc/armv7m_nvic.c | 15 +++++++++++++++
21
hw/arm/virt.c | 5 -----
12
1 file changed, 15 insertions(+)
22
1 file changed, 5 deletions(-)
13
23
14
diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c
24
diff --git a/hw/arm/virt.c b/hw/arm/virt.c
15
index XXXXXXX..XXXXXXX 100644
25
index XXXXXXX..XXXXXXX 100644
16
--- a/hw/intc/armv7m_nvic.c
26
--- a/hw/arm/virt.c
17
+++ b/hw/intc/armv7m_nvic.c
27
+++ b/hw/arm/virt.c
18
@@ -XXX,XX +XXX,XX @@ static uint32_t nvic_readl(NVICState *s, uint32_t offset, MemTxAttrs attrs)
28
@@ -XXX,XX +XXX,XX @@ static void machvirt_init(MachineState *machine)
19
*/
29
}
20
val = cpu->env.v7m.ccr[attrs.secure];
30
21
val |= cpu->env.v7m.ccr[M_REG_NS] & R_V7M_CCR_BFHFNMIGN_MASK;
31
if (vms->secure) {
22
+ /* BFHFNMIGN is RAZ/WI from NS if AIRCR.BFHFNMINS is 0 */
32
- if (kvm_enabled()) {
23
+ if (!attrs.secure) {
33
- error_report("mach-virt: KVM does not support Security extensions");
24
+ if (!(cpu->env.v7m.aircr & R_V7M_AIRCR_BFHFNMINS_MASK)) {
34
- exit(1);
25
+ val &= ~R_V7M_CCR_BFHFNMIGN_MASK;
35
- }
26
+ }
36
-
27
+ }
37
/*
28
return val;
38
* The Secure view of the world is the same as the NonSecure,
29
case 0xd24: /* System Handler Control and State (SHCSR) */
39
* but with a few extra devices. Create it as a container region
30
if (!arm_feature(&cpu->env, ARM_FEATURE_V7)) {
31
@@ -XXX,XX +XXX,XX @@ static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value,
32
(cpu->env.v7m.ccr[M_REG_NS] & ~R_V7M_CCR_BFHFNMIGN_MASK)
33
| (value & R_V7M_CCR_BFHFNMIGN_MASK);
34
value &= ~R_V7M_CCR_BFHFNMIGN_MASK;
35
+ } else {
36
+ /*
37
+ * BFHFNMIGN is RAZ/WI from NS if AIRCR.BFHFNMINS is 0, so
38
+ * preserve the state currently in the NS element of the array
39
+ */
40
+ if (!(cpu->env.v7m.aircr & R_V7M_AIRCR_BFHFNMINS_MASK)) {
41
+ value &= ~R_V7M_CCR_BFHFNMIGN_MASK;
42
+ value |= cpu->env.v7m.ccr[M_REG_NS] & R_V7M_CCR_BFHFNMIGN_MASK;
43
+ }
44
}
45
46
cpu->env.v7m.ccr[attrs.secure] = value;
47
--
40
--
48
2.20.1
41
2.20.1
49
42
50
43
diff view generated by jsdifflib
1
Implement the v8.1M FPCXT_NS floating-point system register. This is
1
In v7, the HSTR register has a TTEE bit which allows EL0/EL1 accesses
2
a little more complicated than FPCXT_S, because it has specific
2
to the Thumb2EE TEECR and TEEHBR registers to be trapped to the
3
handling for "current FP state is inactive", and it only wants to do
3
hypervisor. Implement these traps.
4
PreserveFPState(), not the full set of actions done by
5
ExecuteFPCheck() which vfp_access_check() implements.
6
4
7
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
5
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
8
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
6
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
9
Message-id: 20201210201433.26262-4-peter.maydell@linaro.org
7
Message-id: 20210816180305.20137-2-peter.maydell@linaro.org
10
---
8
---
11
target/arm/translate-vfp.c.inc | 102 ++++++++++++++++++++++++++++++++-
9
target/arm/cpu.h | 2 ++
12
1 file changed, 99 insertions(+), 3 deletions(-)
10
target/arm/helper.c | 18 ++++++++++++++++--
11
2 files changed, 18 insertions(+), 2 deletions(-)
13
12
14
diff --git a/target/arm/translate-vfp.c.inc b/target/arm/translate-vfp.c.inc
13
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
15
index XXXXXXX..XXXXXXX 100644
14
index XXXXXXX..XXXXXXX 100644
16
--- a/target/arm/translate-vfp.c.inc
15
--- a/target/arm/cpu.h
17
+++ b/target/arm/translate-vfp.c.inc
16
+++ b/target/arm/cpu.h
18
@@ -XXX,XX +XXX,XX @@ static FPSysRegCheckResult fp_sysreg_checks(DisasContext *s, int regno)
17
@@ -XXX,XX +XXX,XX @@ static inline void xpsr_write(CPUARMState *env, uint32_t val, uint32_t mask)
19
}
18
#define SCR_ENSCXT (1U << 25)
20
break;
19
#define SCR_ATA (1U << 26)
21
case ARM_VFP_FPCXT_S:
20
22
+ case ARM_VFP_FPCXT_NS:
21
+#define HSTR_TTEE (1 << 16)
23
if (!arm_dc_feature(s, ARM_FEATURE_V8_1M)) {
22
+
24
return false;
23
/* Return the current FPSCR value. */
25
}
24
uint32_t vfp_get_fpscr(CPUARMState *env);
26
@@ -XXX,XX +XXX,XX @@ static FPSysRegCheckResult fp_sysreg_checks(DisasContext *s, int regno)
25
void vfp_set_fpscr(CPUARMState *env, uint32_t val);
27
return FPSysRegCheckFailed;
26
diff --git a/target/arm/helper.c b/target/arm/helper.c
28
}
27
index XXXXXXX..XXXXXXX 100644
29
28
--- a/target/arm/helper.c
30
- if (!vfp_access_check(s)) {
29
+++ b/target/arm/helper.c
31
+ /*
30
@@ -XXX,XX +XXX,XX @@ static void teecr_write(CPUARMState *env, const ARMCPRegInfo *ri,
32
+ * FPCXT_NS is a special case: it has specific handling for
31
env->teecr = value;
33
+ * "current FP state is inactive", and must do the PreserveFPState()
34
+ * but not the usual full set of actions done by ExecuteFPCheck().
35
+ * So we don't call vfp_access_check() and the callers must handle this.
36
+ */
37
+ if (regno != ARM_VFP_FPCXT_NS && !vfp_access_check(s)) {
38
return FPSysRegCheckDone;
39
}
40
-
41
return FPSysRegCheckContinue;
42
}
32
}
43
33
44
+static void gen_branch_fpInactive(DisasContext *s, TCGCond cond,
34
+static CPAccessResult teecr_access(CPUARMState *env, const ARMCPRegInfo *ri,
45
+ TCGLabel *label)
35
+ bool isread)
46
+{
36
+{
47
+ /*
37
+ /*
48
+ * FPCXT_NS is a special case: it has specific handling for
38
+ * HSTR.TTEE only exists in v7A, not v8A, but v8A doesn't have T2EE
49
+ * "current FP state is inactive", and must do the PreserveFPState()
39
+ * at all, so we don't need to check whether we're v8A.
50
+ * but not the usual full set of actions done by ExecuteFPCheck().
51
+ * We don't have a TB flag that matches the fpInactive check, so we
52
+ * do it at runtime as we don't expect FPCXT_NS accesses to be frequent.
53
+ *
54
+ * Emit code that checks fpInactive and does a conditional
55
+ * branch to label based on it:
56
+ * if cond is TCG_COND_NE then branch if fpInactive != 0 (ie if inactive)
57
+ * if cond is TCG_COND_EQ then branch if fpInactive == 0 (ie if active)
58
+ */
40
+ */
59
+ assert(cond == TCG_COND_EQ || cond == TCG_COND_NE);
41
+ if (arm_current_el(env) < 2 && !arm_is_secure_below_el3(env) &&
60
+
42
+ (env->cp15.hstr_el2 & HSTR_TTEE)) {
61
+ /* fpInactive = FPCCR_NS.ASPEN == 1 && CONTROL.FPCA == 0 */
43
+ return CP_ACCESS_TRAP_EL2;
62
+ TCGv_i32 aspen, fpca;
44
+ }
63
+ aspen = load_cpu_field(v7m.fpccr[M_REG_NS]);
45
+ return CP_ACCESS_OK;
64
+ fpca = load_cpu_field(v7m.control[M_REG_S]);
65
+ tcg_gen_andi_i32(aspen, aspen, R_V7M_FPCCR_ASPEN_MASK);
66
+ tcg_gen_xori_i32(aspen, aspen, R_V7M_FPCCR_ASPEN_MASK);
67
+ tcg_gen_andi_i32(fpca, fpca, R_V7M_CONTROL_FPCA_MASK);
68
+ tcg_gen_or_i32(fpca, fpca, aspen);
69
+ tcg_gen_brcondi_i32(tcg_invert_cond(cond), fpca, 0, label);
70
+ tcg_temp_free_i32(aspen);
71
+ tcg_temp_free_i32(fpca);
72
+}
46
+}
73
+
47
+
74
static bool gen_M_fp_sysreg_write(DisasContext *s, int regno,
48
static CPAccessResult teehbr_access(CPUARMState *env, const ARMCPRegInfo *ri,
75
49
bool isread)
76
fp_sysreg_loadfn *loadfn,
77
@@ -XXX,XX +XXX,XX @@ static bool gen_M_fp_sysreg_write(DisasContext *s, int regno,
78
{
50
{
79
/* Do a write to an M-profile floating point system register */
51
if (arm_current_el(env) == 0 && (env->teecr & 1)) {
80
TCGv_i32 tmp;
52
return CP_ACCESS_TRAP;
81
+ TCGLabel *lab_end = NULL;
82
83
switch (fp_sysreg_checks(s, regno)) {
84
case FPSysRegCheckFailed:
85
@@ -XXX,XX +XXX,XX @@ static bool gen_M_fp_sysreg_write(DisasContext *s, int regno,
86
tcg_temp_free_i32(tmp);
87
break;
88
}
53
}
89
+ case ARM_VFP_FPCXT_NS:
54
- return CP_ACCESS_OK;
90
+ lab_end = gen_new_label();
55
+ return teecr_access(env, ri, isread);
91
+ /* fpInactive case: write is a NOP, so branch to end */
92
+ gen_branch_fpInactive(s, TCG_COND_NE, lab_end);
93
+ /* !fpInactive: PreserveFPState(), and reads same as FPCXT_S */
94
+ gen_preserve_fp_state(s);
95
+ /* fall through */
96
case ARM_VFP_FPCXT_S:
97
{
98
TCGv_i32 sfpa, control;
99
@@ -XXX,XX +XXX,XX @@ static bool gen_M_fp_sysreg_write(DisasContext *s, int regno,
100
default:
101
g_assert_not_reached();
102
}
103
+ if (lab_end) {
104
+ gen_set_label(lab_end);
105
+ }
106
return true;
107
}
56
}
108
57
109
@@ -XXX,XX +XXX,XX @@ static bool gen_M_fp_sysreg_read(DisasContext *s, int regno,
58
static const ARMCPRegInfo t2ee_cp_reginfo[] = {
110
{
59
{ .name = "TEECR", .cp = 14, .crn = 0, .crm = 0, .opc1 = 6, .opc2 = 0,
111
/* Do a read from an M-profile floating point system register */
60
.access = PL1_RW, .fieldoffset = offsetof(CPUARMState, teecr),
112
TCGv_i32 tmp;
61
.resetvalue = 0,
113
+ TCGLabel *lab_end = NULL;
62
- .writefn = teecr_write },
114
+ bool lookup_tb = false;
63
+ .writefn = teecr_write, .accessfn = teecr_access },
115
64
{ .name = "TEEHBR", .cp = 14, .crn = 1, .crm = 0, .opc1 = 6, .opc2 = 0,
116
switch (fp_sysreg_checks(s, regno)) {
65
.access = PL0_RW, .fieldoffset = offsetof(CPUARMState, teehbr),
117
case FPSysRegCheckFailed:
66
.accessfn = teehbr_access, .resetvalue = 0 },
118
@@ -XXX,XX +XXX,XX @@ static bool gen_M_fp_sysreg_read(DisasContext *s, int regno,
119
fpscr = load_cpu_field(v7m.fpdscr[M_REG_NS]);
120
gen_helper_vfp_set_fpscr(cpu_env, fpscr);
121
tcg_temp_free_i32(fpscr);
122
- gen_lookup_tb(s);
123
+ lookup_tb = true;
124
+ break;
125
+ }
126
+ case ARM_VFP_FPCXT_NS:
127
+ {
128
+ TCGv_i32 control, sfpa, fpscr, fpdscr, zero;
129
+ TCGLabel *lab_active = gen_new_label();
130
+
131
+ lookup_tb = true;
132
+
133
+ gen_branch_fpInactive(s, TCG_COND_EQ, lab_active);
134
+ /* fpInactive case: reads as FPDSCR_NS */
135
+ TCGv_i32 tmp = load_cpu_field(v7m.fpdscr[M_REG_NS]);
136
+ storefn(s, opaque, tmp);
137
+ lab_end = gen_new_label();
138
+ tcg_gen_br(lab_end);
139
+
140
+ gen_set_label(lab_active);
141
+ /* !fpInactive: Reads the same as FPCXT_S, but side effects differ */
142
+ gen_preserve_fp_state(s);
143
+ tmp = tcg_temp_new_i32();
144
+ sfpa = tcg_temp_new_i32();
145
+ fpscr = tcg_temp_new_i32();
146
+ gen_helper_vfp_get_fpscr(fpscr, cpu_env);
147
+ tcg_gen_andi_i32(tmp, fpscr, ~FPCR_NZCV_MASK);
148
+ control = load_cpu_field(v7m.control[M_REG_S]);
149
+ tcg_gen_andi_i32(sfpa, control, R_V7M_CONTROL_SFPA_MASK);
150
+ tcg_gen_shli_i32(sfpa, sfpa, 31 - R_V7M_CONTROL_SFPA_SHIFT);
151
+ tcg_gen_or_i32(tmp, tmp, sfpa);
152
+ tcg_temp_free_i32(control);
153
+ /* Store result before updating FPSCR, in case it faults */
154
+ storefn(s, opaque, tmp);
155
+ /* If SFPA is zero then set FPSCR from FPDSCR_NS */
156
+ fpdscr = load_cpu_field(v7m.fpdscr[M_REG_NS]);
157
+ zero = tcg_const_i32(0);
158
+ tcg_gen_movcond_i32(TCG_COND_EQ, fpscr, sfpa, zero, fpdscr, fpscr);
159
+ gen_helper_vfp_set_fpscr(cpu_env, fpscr);
160
+ tcg_temp_free_i32(zero);
161
+ tcg_temp_free_i32(sfpa);
162
+ tcg_temp_free_i32(fpdscr);
163
+ tcg_temp_free_i32(fpscr);
164
break;
165
}
166
default:
167
g_assert_not_reached();
168
}
169
+
170
+ if (lab_end) {
171
+ gen_set_label(lab_end);
172
+ }
173
+ if (lookup_tb) {
174
+ gen_lookup_tb(s);
175
+ }
176
return true;
177
}
178
179
--
67
--
180
2.20.1
68
2.20.1
181
69
182
70
diff view generated by jsdifflib
1
From: Gan Qixin <ganqixin@huawei.com>
1
In v7A, the HSTR register has a TJDBX bit which traps NS EL0/EL1
2
access to the JOSCR and JMCR trivial Jazelle registers, and also BXJ.
3
Implement these traps. In v8A this HSTR bit doesn't exist, so don't
4
trap for v8A CPUs.
2
5
3
When running device-introspect-test, a memory leak occurred in the
6
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
4
exynos4210_pwm_init function, so use ptimer_free() in the finalize function to
7
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
5
avoid it.
8
Message-id: 20210816180305.20137-3-peter.maydell@linaro.org
9
---
10
target/arm/cpu.h | 1 +
11
target/arm/helper.h | 2 ++
12
target/arm/syndrome.h | 7 +++++++
13
target/arm/helper.c | 17 +++++++++++++++++
14
target/arm/op_helper.c | 16 ++++++++++++++++
15
target/arm/translate.c | 12 ++++++++++++
16
6 files changed, 55 insertions(+)
6
17
7
ASAN shows memory leak stack:
18
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
8
9
Indirect leak of 240 byte(s) in 5 object(s) allocated from:
10
#0 0xffffab97e1f0 in __interceptor_calloc (/lib64/libasan.so.5+0xee1f0)
11
#1 0xffffab256800 in g_malloc0 (/lib64/libglib-2.0.so.0+0x56800)
12
#2 0xaaabf555db84 in timer_new_full /qemu/include/qemu/timer.h:523
13
#3 0xaaabf555db84 in timer_new /qemu/include/qemu/timer.h:544
14
#4 0xaaabf555db84 in timer_new_ns /qemu/include/qemu/timer.h:562
15
#5 0xaaabf555db84 in ptimer_init /qemu/hw/core/ptimer.c:433
16
#6 0xaaabf56a36cc in exynos4210_pwm_init /qemu/hw/timer/exynos4210_pwm.c:401
17
#7 0xaaabf6339f6c in object_initialize_with_type /qemu/qom/object.c:515
18
#8 0xaaabf633a1e0 in object_new_with_type /qemu/qom/object.c:729
19
#9 0xaaabf6375e40 in qmp_device_list_properties /qemu/qom/qom-qmp-cmds.c:153
20
#10 0xaaabf653d8ec in qmp_marshal_device_list_properties /qemu/qapi/qapi-commands-qdev.c:59
21
#11 0xaaabf6587d08 in do_qmp_dispatch_bh /qemu/qapi/qmp-dispatch.c:110
22
#12 0xaaabf6552708 in aio_bh_call /qemu/util/async.c:136
23
24
Reported-by: Euler Robot <euler.robot@huawei.com>
25
Signed-off-by: Gan Qixin <ganqixin@huawei.com>
26
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
27
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
28
---
29
hw/timer/exynos4210_pwm.c | 11 +++++++++++
30
1 file changed, 11 insertions(+)
31
32
diff --git a/hw/timer/exynos4210_pwm.c b/hw/timer/exynos4210_pwm.c
33
index XXXXXXX..XXXXXXX 100644
19
index XXXXXXX..XXXXXXX 100644
34
--- a/hw/timer/exynos4210_pwm.c
20
--- a/target/arm/cpu.h
35
+++ b/hw/timer/exynos4210_pwm.c
21
+++ b/target/arm/cpu.h
36
@@ -XXX,XX +XXX,XX @@ static void exynos4210_pwm_init(Object *obj)
22
@@ -XXX,XX +XXX,XX @@ static inline void xpsr_write(CPUARMState *env, uint32_t val, uint32_t mask)
37
sysbus_init_mmio(dev, &s->iomem);
23
#define SCR_ATA (1U << 26)
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;
38
}
57
}
39
58
40
+static void exynos4210_pwm_finalize(Object *obj)
59
+static inline uint32_t syn_bxjtrap(int cv, int cond, int rm)
41
+{
60
+{
42
+ Exynos4210PWMState *s = EXYNOS4210_PWM(obj);
61
+ return (EC_BXJTRAP << ARM_EL_EC_SHIFT) | ARM_EL_IL |
43
+ int i;
62
+ (cv << 24) | (cond << 20) | rm;
63
+}
44
+
64
+
45
+ for (i = 0; i < EXYNOS4210_PWM_TIMERS_NUM; i++) {
65
static inline uint32_t syn_insn_abort(int same_el, int ea, int s1ptw, int fsc)
46
+ ptimer_free(s->timer[i].ptimer);
66
{
67
return (EC_INSNABORT << ARM_EL_EC_SHIFT) | (same_el << ARM_EL_EC_SHIFT)
68
diff --git a/target/arm/helper.c b/target/arm/helper.c
69
index XXXXXXX..XXXXXXX 100644
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
}
75
76
+static CPAccessResult access_joscr_jmcr(CPUARMState *env,
77
+ const ARMCPRegInfo *ri, bool isread)
78
+{
79
+ /*
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
+}
90
+
91
static const ARMCPRegInfo jazelle_regs[] = {
92
{ .name = "JIDR",
93
.cp = 14, .crn = 0, .crm = 0, .opc1 = 7, .opc2 = 0,
94
@@ -XXX,XX +XXX,XX @@ static const ARMCPRegInfo jazelle_regs[] = {
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
108
--- a/target/arm/op_helper.c
109
+++ b/target/arm/op_helper.c
110
@@ -XXX,XX +XXX,XX @@ void HELPER(setend)(CPUARMState *env)
111
arm_rebuild_hflags(env);
112
}
113
114
+void HELPER(check_bxj_trap)(CPUARMState *env, uint32_t rm)
115
+{
116
+ /*
117
+ * Only called if in NS EL0 or EL1 for a BXJ for a v7A CPU;
118
+ * check if HSTR.TJDBX means we need to trap to EL2.
119
+ */
120
+ if (env->cp15.hstr_el2 & HSTR_TJDBX) {
121
+ /*
122
+ * We know the condition code check passed, so take the IMPDEF
123
+ * choice to always report CV=1 COND 0xe
124
+ */
125
+ uint32_t syn = syn_bxjtrap(1, 0xe, rm);
126
+ raise_exception_ra(env, EXCP_HYP_TRAP, syn, 2, GETPC());
47
+ }
127
+ }
48
+}
128
+}
49
+
129
+
50
static void exynos4210_pwm_class_init(ObjectClass *klass, void *data)
130
#ifndef CONFIG_USER_ONLY
51
{
131
/* Function checks whether WFx (WFI/WFE) instructions are set up to be trapped.
52
DeviceClass *dc = DEVICE_CLASS(klass);
132
* The function returns the target EL (1-3) if the instruction is to be trapped;
53
@@ -XXX,XX +XXX,XX @@ static const TypeInfo exynos4210_pwm_info = {
133
diff --git a/target/arm/translate.c b/target/arm/translate.c
54
.parent = TYPE_SYS_BUS_DEVICE,
134
index XXXXXXX..XXXXXXX 100644
55
.instance_size = sizeof(Exynos4210PWMState),
135
--- a/target/arm/translate.c
56
.instance_init = exynos4210_pwm_init,
136
+++ b/target/arm/translate.c
57
+ .instance_finalize = exynos4210_pwm_finalize,
137
@@ -XXX,XX +XXX,XX @@ static bool trans_BXJ(DisasContext *s, arg_BXJ *a)
58
.class_init = exynos4210_pwm_class_init,
138
if (!ENABLE_ARCH_5J || arm_dc_feature(s, ARM_FEATURE_M)) {
59
};
139
return false;
60
140
}
141
+ /*
142
+ * v7A allows BXJ to be trapped via HSTR.TJDBX. We don't waste a
143
+ * TBFLAGS bit on a basically-never-happens case, so call a helper
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
+ */
148
+ if (!arm_dc_feature(s, ARM_FEATURE_V8) &&
149
+ arm_dc_feature(s, ARM_FEATURE_EL2) &&
150
+ s->current_el < 2 && s->ns) {
151
+ gen_helper_check_bxj_trap(cpu_env, tcg_constant_i32(a->rm));
152
+ }
153
/* Trivial implementation equivalent to bx. */
154
gen_bx(s, load_reg(s, a->rm));
155
return true;
61
--
156
--
62
2.20.1
157
2.20.1
63
158
64
159
diff view generated by jsdifflib
1
From: Richard Henderson <richard.henderson@linaro.org>
1
Currently we rely on all the callsites of cpsr_write() to rebuild the
2
cached hflags if they change one of the CPSR bits which we use as a
3
TB flag and cache in hflags. This is a bit awkward when we want to
4
change the set of CPSR bits that we cache, because it means we need
5
to re-audit all the cpsr_write() callsites to see which flags they
6
are writing and whether they now need to rebuild the hflags.
2
7
3
In 50244cc76abc we updated mte_check_fail to match the ARM
8
Switch instead to making cpsr_write() call arm_rebuild_hflags()
4
pseudocode, using the correct EL to select the TCF field.
9
itself if one of the bits being changed is a cached bit.
5
But we failed to update MTE0_ACTIVE the same way, which led
6
to g_assert_not_reached().
7
10
8
Cc: qemu-stable@nongnu.org
11
We don't do the rebuild for the CPSRWriteRaw write type, because that
9
Buglink: https://bugs.launchpad.net/bugs/1907137
12
kind of write is generally doing something special anyway. For the
10
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
13
CPSRWriteRaw callsites in the KVM code and inbound migration we
11
Message-id: 20201221204426.88514-1-richard.henderson@linaro.org
14
definitely don't want to recalculate the hflags; the callsites in
12
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
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
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
28
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
29
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
30
Message-id: 20210817201843.3829-1-peter.maydell@linaro.org
14
---
31
---
15
target/arm/helper.c | 2 +-
32
target/arm/cpu.h | 10 ++++++++--
16
1 file changed, 1 insertion(+), 1 deletion(-)
33
linux-user/arm/signal.c | 2 --
34
target/arm/helper.c | 5 +++++
35
3 files changed, 13 insertions(+), 4 deletions(-)
17
36
37
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
38
index XXXXXXX..XXXXXXX 100644
39
--- a/target/arm/cpu.h
40
+++ b/target/arm/cpu.h
41
@@ -XXX,XX +XXX,XX @@ uint32_t cpsr_read(CPUARMState *env);
42
typedef enum CPSRWriteType {
43
CPSRWriteByInstr = 0, /* from guest MSR or CPS */
44
CPSRWriteExceptionReturn = 1, /* from guest exception return insn */
45
- CPSRWriteRaw = 2, /* trust values, do not switch reg banks */
46
+ CPSRWriteRaw = 2,
47
+ /* trust values, no reg bank switch, no hflags rebuild */
48
CPSRWriteByGDBStub = 3, /* from the GDB stub */
49
} CPSRWriteType;
50
51
-/* Set the CPSR. Note that some bits of mask must be all-set or all-clear.*/
52
+/*
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
63
--- a/linux-user/arm/signal.c
64
+++ b/linux-user/arm/signal.c
65
@@ -XXX,XX +XXX,XX @@ setup_return(CPUARMState *env, struct target_sigaction *ka,
66
env->regs[14] = retcode;
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
}
73
@@ -XXX,XX +XXX,XX @@ restore_sigcontext(CPUARMState *env, struct target_sigcontext *sc)
74
__get_user(env->regs[15], &sc->arm_pc);
75
__get_user(cpsr, &sc->arm_cpsr);
76
cpsr_write(env, cpsr, CPSR_USER | CPSR_EXEC, CPSRWriteByInstr);
77
- arm_rebuild_hflags(env);
78
79
err |= !valid_user_regs(env);
80
18
diff --git a/target/arm/helper.c b/target/arm/helper.c
81
diff --git a/target/arm/helper.c b/target/arm/helper.c
19
index XXXXXXX..XXXXXXX 100644
82
index XXXXXXX..XXXXXXX 100644
20
--- a/target/arm/helper.c
83
--- a/target/arm/helper.c
21
+++ b/target/arm/helper.c
84
+++ b/target/arm/helper.c
22
@@ -XXX,XX +XXX,XX @@ static uint32_t rebuild_hflags_a64(CPUARMState *env, int el, int fp_el,
85
@@ -XXX,XX +XXX,XX @@ void cpsr_write(CPUARMState *env, uint32_t val, uint32_t mask,
23
if (FIELD_EX32(flags, TBFLAG_A64, UNPRIV)
86
CPSRWriteType write_type)
24
&& tbid
87
{
25
&& !(env->pstate & PSTATE_TCO)
88
uint32_t changed_daif;
26
- && (sctlr & SCTLR_TCF0)
89
+ bool rebuild_hflags = (write_type != CPSRWriteRaw) &&
27
+ && (sctlr & SCTLR_TCF)
90
+ (mask & (CPSR_M | CPSR_E | CPSR_IL));
28
&& allocation_tag_access_enabled(env, 0, sctlr)) {
91
29
flags = FIELD_DP32(flags, TBFLAG_A64, MTE0_ACTIVE, 1);
92
if (mask & CPSR_NZCV) {
30
}
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
}
102
103
/* Sign/zero extend */
31
--
104
--
32
2.20.1
105
2.20.1
33
106
34
107
diff view generated by jsdifflib
1
From: Bin Meng <bin.meng@windriver.com>
1
From: Tong Ho <tong.ho@xilinx.com>
2
2
3
At present, when booting U-Boot on QEMU sabrelite, we see:
3
Add unimplemented APU mmio region to xlnx-versal for booting
4
bare-metal guests built with standalone bsp, which access the
5
region from one of the following places:
6
https://github.com/Xilinx/embeddedsw/blob/release-2020.2/lib/bsp/standalone/src/arm/ARMv8/64bit/armclang/boot.S#L139
7
https://github.com/Xilinx/embeddedsw/blob/release-2020.2/lib/bsp/standalone/src/arm/ARMv8/64bit/gcc/boot.S#L183
4
8
5
Net: Board Net Initialization Failed
9
Acked-by: Alistair Francis <alistair.francis@wdc.com>
6
No ethernet found.
10
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
7
11
Signed-off-by: Tong Ho <tong.ho@xilinx.com>
8
U-Boot scans PHY at address 4/5/6/7 (see board_eth_init() in the
12
Message-id: 20210823173818.201259-2-tong.ho@xilinx.com
9
U-Boot source: board/boundary/nitrogen6x/nitrogen6x.c). On the real
10
board, the Ethernet PHY is at address 6. Adjust this by updating the
11
"fec-phy-num" property of the fsl_imx6 SoC object.
12
13
With this change, U-Boot sees the PHY but complains MAC address:
14
15
Net: using phy at 6
16
FEC [PRIME]
17
Error: FEC address not set.
18
19
This is due to U-Boot tries to read the MAC address from the fuse,
20
which QEMU does not have any valid content filled in. However this
21
does not prevent the Ethernet from working in QEMU. We just need to
22
set up the MAC address later in the U-Boot command shell, by:
23
24
=> setenv ethaddr 00:11:22:33:44:55
25
26
Signed-off-by: Bin Meng <bin.meng@windriver.com>
27
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
28
Message-id: 20210106063504.10841-4-bmeng.cn@gmail.com
29
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
30
---
14
---
31
hw/arm/sabrelite.c | 4 ++++
15
include/hw/arm/xlnx-versal.h | 2 ++
32
1 file changed, 4 insertions(+)
16
hw/arm/xlnx-versal.c | 2 ++
17
2 files changed, 4 insertions(+)
33
18
34
diff --git a/hw/arm/sabrelite.c b/hw/arm/sabrelite.c
19
diff --git a/include/hw/arm/xlnx-versal.h b/include/hw/arm/xlnx-versal.h
35
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
36
--- a/hw/arm/sabrelite.c
21
--- a/include/hw/arm/xlnx-versal.h
37
+++ b/hw/arm/sabrelite.c
22
+++ b/include/hw/arm/xlnx-versal.h
38
@@ -XXX,XX +XXX,XX @@ static void sabrelite_init(MachineState *machine)
23
@@ -XXX,XX +XXX,XX @@ struct Versal {
39
24
#define MM_IOU_SCNTRS_SIZE 0x10000
40
s = FSL_IMX6(object_new(TYPE_FSL_IMX6));
25
#define MM_FPD_CRF 0xfd1a0000U
41
object_property_add_child(OBJECT(machine), "soc", OBJECT(s));
26
#define MM_FPD_CRF_SIZE 0x140000
42
+
27
+#define MM_FPD_FPD_APU 0xfd5c0000
43
+ /* Ethernet PHY address is 6 */
28
+#define MM_FPD_FPD_APU_SIZE 0x100
44
+ object_property_set_int(OBJECT(s), "fec-phy-num", 6, &error_fatal);
29
45
+
30
#define MM_PMC_SD0 0xf1040000U
46
qdev_realize(DEVICE(s), NULL, &error_fatal);
31
#define MM_PMC_SD0_SIZE 0x10000
47
32
diff --git a/hw/arm/xlnx-versal.c b/hw/arm/xlnx-versal.c
48
memory_region_add_subregion(get_system_memory(), FSL_IMX6_MMDC_ADDR,
33
index XXXXXXX..XXXXXXX 100644
34
--- a/hw/arm/xlnx-versal.c
35
+++ b/hw/arm/xlnx-versal.c
36
@@ -XXX,XX +XXX,XX @@ static void versal_unimp(Versal *s)
37
MM_CRL, MM_CRL_SIZE);
38
versal_unimp_area(s, "crf", &s->mr_ps,
39
MM_FPD_CRF, MM_FPD_CRF_SIZE);
40
+ versal_unimp_area(s, "apu", &s->mr_ps,
41
+ MM_FPD_FPD_APU, MM_FPD_FPD_APU_SIZE);
42
versal_unimp_area(s, "crp", &s->mr_ps,
43
MM_PMC_CRP, MM_PMC_CRP_SIZE);
44
versal_unimp_area(s, "iou-scntr", &s->mr_ps,
49
--
45
--
50
2.20.1
46
2.20.1
51
47
52
48
diff view generated by jsdifflib
1
From: Gan Qixin <ganqixin@huawei.com>
1
From: Tong Ho <tong.ho@xilinx.com>
2
2
3
When running device-introspect-test, a memory leak occurred in the a10_pit_init
3
Add unimplemented APU mmio region to xlnx-zynqmp for booting
4
function, so use ptimer_free() in the finalize function to avoid it.
4
bare-metal guests built with standalone bsp, which access the
5
region from one of the following places:
6
https://github.com/Xilinx/embeddedsw/blob/release-2020.2/lib/bsp/standalone/src/arm/ARMv8/64bit/armclang/boot.S#L139
7
https://github.com/Xilinx/embeddedsw/blob/release-2020.2/lib/bsp/standalone/src/arm/ARMv8/64bit/gcc/boot.S#L183
5
8
6
ASAN shows memory leak stack:
9
Acked-by: Alistair Francis <alistair.francis@wdc.com>
7
10
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>
8
Indirect leak of 288 byte(s) in 6 object(s) allocated from:
11
Signed-off-by: Tong Ho <tong.ho@xilinx.com>
9
#0 0xffffab97e1f0 in __interceptor_calloc (/lib64/libasan.so.5+0xee1f0)
12
Message-id: 20210823173818.201259-3-tong.ho@xilinx.com
10
#1 0xffffab256800 in g_malloc0 (/lib64/libglib-2.0.so.0+0x56800)
11
#2 0xaaabf555db84 in timer_new_full /qemu/include/qemu/timer.h:523
12
#3 0xaaabf555db84 in timer_new /qemu/include/qemu/timer.h:544
13
#4 0xaaabf555db84 in timer_new_ns /qemu/include/qemu/timer.h:562
14
#5 0xaaabf555db84 in ptimer_init /qemu/hw/core/ptimer.c:433
15
#6 0xaaabf57415e8 in a10_pit_init /qemu/hw/timer/allwinner-a10-pit.c:278
16
#7 0xaaabf6339f6c in object_initialize_with_type /qemu/qom/object.c:515
17
#8 0xaaabf633ca04 in object_initialize_child_with_propsv /qemu/qom/object.c:564
18
#9 0xaaabf633cc08 in object_initialize_child_with_props /qemu/qom/object.c:547
19
#10 0xaaabf5b94680 in aw_a10_init /qemu/hw/arm/allwinner-a10.c:49
20
#11 0xaaabf6339f6c in object_initialize_with_type /qemu/qom/object.c:515
21
#12 0xaaabf633a1e0 in object_new_with_type /qemu/qom/object.c:729
22
23
Reported-by: Euler Robot <euler.robot@huawei.com>
24
Signed-off-by: Gan Qixin <ganqixin@huawei.com>
25
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
26
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
13
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
27
---
14
---
28
hw/timer/allwinner-a10-pit.c | 11 +++++++++++
15
include/hw/arm/xlnx-zynqmp.h | 7 +++++++
29
1 file changed, 11 insertions(+)
16
hw/arm/xlnx-zynqmp.c | 32 ++++++++++++++++++++++++++++++++
17
2 files changed, 39 insertions(+)
30
18
31
diff --git a/hw/timer/allwinner-a10-pit.c b/hw/timer/allwinner-a10-pit.c
19
diff --git a/include/hw/arm/xlnx-zynqmp.h b/include/hw/arm/xlnx-zynqmp.h
32
index XXXXXXX..XXXXXXX 100644
20
index XXXXXXX..XXXXXXX 100644
33
--- a/hw/timer/allwinner-a10-pit.c
21
--- a/include/hw/arm/xlnx-zynqmp.h
34
+++ b/hw/timer/allwinner-a10-pit.c
22
+++ b/include/hw/arm/xlnx-zynqmp.h
35
@@ -XXX,XX +XXX,XX @@ static void a10_pit_init(Object *obj)
23
@@ -XXX,XX +XXX,XX @@ OBJECT_DECLARE_SIMPLE_TYPE(XlnxZynqMPState, XLNX_ZYNQMP)
36
}
24
#define XLNX_ZYNQMP_MAX_RAM_SIZE (XLNX_ZYNQMP_MAX_LOW_RAM_SIZE + \
25
XLNX_ZYNQMP_MAX_HIGH_RAM_SIZE)
26
27
+/*
28
+ * Unimplemented mmio regions needed to boot some images.
29
+ */
30
+#define XLNX_ZYNQMP_NUM_UNIMP_AREAS 1
31
+
32
struct XlnxZynqMPState {
33
/*< private >*/
34
DeviceState parent_obj;
35
@@ -XXX,XX +XXX,XX @@ struct XlnxZynqMPState {
36
MemoryRegion *ddr_ram;
37
MemoryRegion ddr_ram_low, ddr_ram_high;
38
39
+ MemoryRegion mr_unimp[XLNX_ZYNQMP_NUM_UNIMP_AREAS];
40
+
41
CadenceGEMState gem[XLNX_ZYNQMP_NUM_GEMS];
42
CadenceUARTState uart[XLNX_ZYNQMP_NUM_UARTS];
43
XlnxZynqMPCANState can[XLNX_ZYNQMP_NUM_CAN];
44
diff --git a/hw/arm/xlnx-zynqmp.c b/hw/arm/xlnx-zynqmp.c
45
index XXXXXXX..XXXXXXX 100644
46
--- a/hw/arm/xlnx-zynqmp.c
47
+++ b/hw/arm/xlnx-zynqmp.c
48
@@ -XXX,XX +XXX,XX @@
49
#include "qemu/module.h"
50
#include "hw/arm/xlnx-zynqmp.h"
51
#include "hw/intc/arm_gic_common.h"
52
+#include "hw/misc/unimp.h"
53
#include "hw/boards.h"
54
#include "sysemu/kvm.h"
55
#include "sysemu/sysemu.h"
56
@@ -XXX,XX +XXX,XX @@
57
#define DPDMA_ADDR 0xfd4c0000
58
#define DPDMA_IRQ 116
59
60
+#define APU_ADDR 0xfd5c0000
61
+#define APU_SIZE 0x100
62
+
63
#define IPI_ADDR 0xFF300000
64
#define IPI_IRQ 64
65
66
@@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_create_rpu(MachineState *ms, XlnxZynqMPState *s,
67
qdev_realize(DEVICE(&s->rpu_cluster), NULL, &error_fatal);
37
}
68
}
38
69
39
+static void a10_pit_finalize(Object *obj)
70
+static void xlnx_zynqmp_create_unimp_mmio(XlnxZynqMPState *s)
40
+{
71
+{
41
+ AwA10PITState *s = AW_A10_PIT(obj);
72
+ static const struct UnimpInfo {
42
+ int i;
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;
43
+
80
+
44
+ for (i = 0; i < AW_A10_PIT_TIMER_NR; i++) {
81
+ for (nr = 0; nr < ARRAY_SIZE(unimp_areas); nr++) {
45
+ ptimer_free(s->timer[i]);
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);
46
+ }
93
+ }
47
+}
94
+}
48
+
95
+
49
static void a10_pit_class_init(ObjectClass *klass, void *data)
96
static void xlnx_zynqmp_init(Object *obj)
50
{
97
{
51
DeviceClass *dc = DEVICE_CLASS(klass);
98
MachineState *ms = MACHINE(qdev_get_machine());
52
@@ -XXX,XX +XXX,XX @@ static const TypeInfo a10_pit_info = {
99
@@ -XXX,XX +XXX,XX @@ static void xlnx_zynqmp_realize(DeviceState *dev, Error **errp)
53
.parent = TYPE_SYS_BUS_DEVICE,
100
sysbus_mmio_map(SYS_BUS_DEVICE(&s->rtc), 0, RTC_ADDR);
54
.instance_size = sizeof(AwA10PITState),
101
sysbus_connect_irq(SYS_BUS_DEVICE(&s->rtc), 0, gic_spi[RTC_IRQ]);
55
.instance_init = a10_pit_init,
102
56
+ .instance_finalize = a10_pit_finalize,
103
+ xlnx_zynqmp_create_unimp_mmio(s);
57
.class_init = a10_pit_class_init,
104
+
58
};
105
for (i = 0; i < XLNX_ZYNQMP_NUM_GDMA_CH; i++) {
59
106
if (!object_property_set_uint(OBJECT(&s->gdma[i]), "bus-width", 128,
107
errp)) {
60
--
108
--
61
2.20.1
109
2.20.1
62
110
63
111
diff view generated by jsdifflib