1 | Nothing too exciting, but does include the last bits of v8.1M support work. | 1 | The following changes since commit e670f6d825d4dee248b311197fd4048469d6772b: |
---|---|---|---|
2 | 2 | ||
3 | -- PMM | 3 | Merge remote-tracking branch 'remotes/legoater/tags/pull-ppc-20220218' into staging (2022-02-20 15:05:41 +0000) |
4 | |||
5 | The following changes since commit e79de63ab1bd1f6550e7b915e433bec1ad1a870a: | ||
6 | |||
7 | Merge remote-tracking branch 'remotes/rth-gitlab/tags/pull-tcg-20210107' into staging (2021-01-07 20:34:05 +0000) | ||
8 | 4 | ||
9 | are available in the Git repository at: | 5 | are available in the Git repository at: |
10 | 6 | ||
11 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20210108 | 7 | https://git.linaro.org/people/pmaydell/qemu-arm.git tags/pull-target-arm-20220221 |
12 | 8 | ||
13 | for you to fetch changes up to c9f8511ea8d2b80723af0fea1f716d752c1b5208: | 9 | for you to fetch changes up to d6333e2543fa41aed4d33f77c808168373e39bff: |
14 | 10 | ||
15 | docs/system: arm: Add sabrelite board description (2021-01-08 15:13:39 +0000) | 11 | ui/cocoa: Fix the leak of qemu_console_get_label (2022-02-21 09:12:18 +0000) |
16 | 12 | ||
17 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
18 | target-arm queue: | 14 | arm, cocoa and misc: |
19 | * intc/arm_gic: Fix gic_irq_signaling_enabled() for vCPUs | 15 | * MAINTAINERS file updates |
20 | * target/arm: Fix MTE0_ACTIVE | 16 | * Mark remaining global TypeInfo instances as const |
21 | * target/arm: Implement v8.1M and Cortex-M55 model | 17 | * checkpatch: Ensure that TypeInfos are const |
22 | * hw/arm/highbank: Drop dead KVM support code | 18 | * tests/qtest: add qtests for npcm7xx sdhci |
23 | * util/qemu-timer: Make timer_free() imply timer_del() | 19 | * arm hvf: Handle unknown ID registers as RES0 |
24 | * various devices: Use ptimer_free() in finalize function | 20 | * Make KVM -cpu max exactly like -cpu host |
25 | * docs/system: arm: Add sabrelite board description | 21 | * Fix '-cpu max' for HVF |
26 | * sabrelite: Minor fixes to allow booting U-Boot | 22 | * Support PAuth extension for hvf |
23 | * Kconfig: Add I2C_DEVICES device group | ||
24 | * Kconfig: Add 'imply I2C_DEVICES' on boards with available i2c bus | ||
25 | * hw/arm/armv7m: Handle disconnected clock inputs | ||
26 | * osdep.h: pull out various things into new header files | ||
27 | * hw/timer: fix a9gtimer vmstate | ||
28 | * hw/arm: add initial mori-bmc board | ||
29 | * ui/cocoa: Remove allowedFileTypes restriction in SavePanel | ||
30 | * ui/cocoa: Do not alert even without block devices | ||
31 | * ui/cocoa: Fix the leak of qemu_console_get_label | ||
27 | 32 | ||
28 | ---------------------------------------------------------------- | 33 | ---------------------------------------------------------------- |
29 | Andrew Jones (1): | 34 | Akihiko Odaki (3): |
30 | hw/arm/virt: Remove virt machine state 'smp_cpus' | 35 | MAINTAINERS: Add Akihiko Odaki to macOS-relateds |
36 | ui/cocoa: Do not alert even without block devices | ||
37 | ui/cocoa: Fix the leak of qemu_console_get_label | ||
31 | 38 | ||
32 | Bin Meng (4): | 39 | Alexander Graf (2): |
33 | hw/misc: imx6_ccm: Update PMU_MISC0 reset value | 40 | hvf: arm: Use macros for sysreg shift/masking |
34 | hw/msic: imx6_ccm: Correct register value for silicon type | 41 | hvf: arm: Handle unknown ID registers as RES0 |
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 | Ani Sinha (1): |
39 | intc/arm_gic: Fix gic_irq_signaling_enabled() for vCPUs | 44 | MAINTAINERS: Adding myself as a reviewer of some components |
40 | 45 | ||
41 | Gan Qixin (7): | 46 | Bernhard Beschow (2): |
42 | digic-timer: Use ptimer_free() in the finalize function to avoid memleaks | 47 | Mark remaining global TypeInfo instances as const |
43 | allwinner-a10-pit: Use ptimer_free() in the finalize function to avoid memleaks | 48 | checkpatch: Ensure that TypeInfos are const |
44 | exynos4210_rtc: Use ptimer_free() in the finalize function to avoid memleaks | ||
45 | exynos4210_pwm: Use ptimer_free() in the finalize function to avoid memleaks | ||
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 | 49 | ||
50 | Peter Maydell (9): | 50 | Patrick Venture (1): |
51 | hw/intc/armv7m_nvic: Correct handling of CCR.BFHFNMIGN | 51 | hw/arm: add initial mori-bmc board |
52 | target/arm: Correct store of FPSCR value via FPCXT_S | ||
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 | 52 | ||
61 | Richard Henderson (1): | 53 | Pavel Dovgalyuk (1): |
62 | target/arm: Fix MTE0_ACTIVE | 54 | hw/timer: fix a9gtimer vmstate |
63 | 55 | ||
64 | docs/system/arm/sabrelite.rst | 119 ++++++++++++++++++++++++++ | 56 | Peter Maydell (14): |
65 | docs/system/target-arm.rst | 1 + | 57 | target/arm: Move '-cpu host' code to cpu64.c |
66 | scripts/coccinelle/timer-del-timer-free.cocci | 18 ++++ | 58 | target/arm: Use aarch64_cpu_register() for 'host' CPU type |
67 | include/hw/arm/virt.h | 3 +- | 59 | target/arm: Make KVM -cpu max exactly like -cpu host |
68 | include/qemu/timer.h | 24 +++--- | 60 | target/arm: Unindent unnecessary else-clause |
69 | block/iscsi.c | 2 - | 61 | target/arm: Fix '-cpu max' for HVF |
70 | block/nbd.c | 1 - | 62 | target/arm: Support PAuth extension for hvf |
71 | block/qcow2.c | 1 - | 63 | Kconfig: Add I2C_DEVICES device group |
72 | hw/arm/highbank.c | 14 +-- | 64 | Kconfig: Add 'imply I2C_DEVICES' on boards with available i2c bus |
73 | hw/arm/musicpal.c | 12 +++ | 65 | hw/arm/armv7m: Handle disconnected clock inputs |
74 | hw/arm/sabrelite.c | 4 + | 66 | include: Move qemu_madvise() and related #defines to new qemu/madvise.h |
75 | hw/arm/virt-acpi-build.c | 9 +- | 67 | include: Move qemu_mprotect_*() to new qemu/mprotect.h |
76 | hw/arm/virt.c | 21 +++-- | 68 | include: Move QEMU_MAP_* constants to mmap-alloc.h |
77 | hw/block/nvme.c | 2 - | 69 | include: Move qemu_[id]cache_* declarations to new qemu/cacheinfo.h |
78 | hw/char/serial.c | 2 - | 70 | include: Move hardware version declarations to new qemu/hw-version.h |
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 | 71 | ||
72 | Philippe Mathieu-Daudé (1): | ||
73 | ui/cocoa: Remove allowedFileTypes restriction in SavePanel | ||
74 | |||
75 | Shengtan Mao (1): | ||
76 | tests/qtest: add qtests for npcm7xx sdhci | ||
77 | |||
78 | docs/devel/kconfig.rst | 8 +- | ||
79 | docs/system/arm/nuvoton.rst | 1 + | ||
80 | include/qemu/cacheinfo.h | 21 +++ | ||
81 | include/qemu/hw-version.h | 27 ++++ | ||
82 | include/qemu/madvise.h | 95 +++++++++++ | ||
83 | include/qemu/mmap-alloc.h | 23 +++ | ||
84 | include/qemu/mprotect.h | 14 ++ | ||
85 | include/qemu/osdep.h | 132 ---------------- | ||
86 | accel/tcg/translate-all.c | 1 + | ||
87 | backends/hostmem-file.c | 1 + | ||
88 | backends/hostmem.c | 1 + | ||
89 | hw/arm/armv7m.c | 26 ++- | ||
90 | hw/arm/npcm7xx_boards.c | 32 ++++ | ||
91 | hw/arm/nseries.c | 1 + | ||
92 | hw/core/generic-loader.c | 2 +- | ||
93 | hw/core/guest-loader.c | 2 +- | ||
94 | hw/display/bcm2835_fb.c | 2 +- | ||
95 | hw/display/i2c-ddc.c | 2 +- | ||
96 | hw/display/macfb.c | 4 +- | ||
97 | hw/display/virtio-vga.c | 2 +- | ||
98 | hw/dma/bcm2835_dma.c | 2 +- | ||
99 | hw/i386/pc_piix.c | 2 +- | ||
100 | hw/i386/sgx-epc.c | 2 +- | ||
101 | hw/ide/core.c | 1 + | ||
102 | hw/intc/bcm2835_ic.c | 2 +- | ||
103 | hw/intc/bcm2836_control.c | 2 +- | ||
104 | hw/ipmi/ipmi.c | 4 +- | ||
105 | hw/mem/nvdimm.c | 2 +- | ||
106 | hw/mem/pc-dimm.c | 2 +- | ||
107 | hw/misc/bcm2835_mbox.c | 2 +- | ||
108 | hw/misc/bcm2835_powermgt.c | 2 +- | ||
109 | hw/misc/bcm2835_property.c | 2 +- | ||
110 | hw/misc/bcm2835_rng.c | 2 +- | ||
111 | hw/misc/pvpanic-isa.c | 2 +- | ||
112 | hw/misc/pvpanic-pci.c | 2 +- | ||
113 | hw/net/fsl_etsec/etsec.c | 2 +- | ||
114 | hw/ppc/prep_systemio.c | 2 +- | ||
115 | hw/ppc/spapr_iommu.c | 2 +- | ||
116 | hw/s390x/s390-pci-bus.c | 2 +- | ||
117 | hw/s390x/sclp.c | 2 +- | ||
118 | hw/s390x/tod-kvm.c | 2 +- | ||
119 | hw/s390x/tod-tcg.c | 2 +- | ||
120 | hw/s390x/tod.c | 2 +- | ||
121 | hw/scsi/lsi53c895a.c | 2 +- | ||
122 | hw/scsi/megasas.c | 1 + | ||
123 | hw/scsi/scsi-bus.c | 1 + | ||
124 | hw/scsi/scsi-disk.c | 1 + | ||
125 | hw/sd/allwinner-sdhost.c | 2 +- | ||
126 | hw/sd/aspeed_sdhci.c | 2 +- | ||
127 | hw/sd/bcm2835_sdhost.c | 2 +- | ||
128 | hw/sd/cadence_sdhci.c | 2 +- | ||
129 | hw/sd/npcm7xx_sdhci.c | 2 +- | ||
130 | hw/timer/a9gtimer.c | 21 +++ | ||
131 | hw/usb/dev-mtp.c | 2 +- | ||
132 | hw/usb/host-libusb.c | 2 +- | ||
133 | hw/vfio/igd.c | 2 +- | ||
134 | hw/virtio/virtio-balloon.c | 1 + | ||
135 | hw/virtio/virtio-pmem.c | 2 +- | ||
136 | migration/postcopy-ram.c | 1 + | ||
137 | migration/qemu-file.c | 1 + | ||
138 | migration/ram.c | 1 + | ||
139 | plugins/loader.c | 1 + | ||
140 | qom/object.c | 4 +- | ||
141 | softmmu/physmem.c | 1 + | ||
142 | softmmu/vl.c | 1 + | ||
143 | target/arm/cpu.c | 30 ---- | ||
144 | target/arm/cpu64.c | 331 +++++++++++++++++++++------------------ | ||
145 | target/arm/hvf/hvf.c | 83 +++++++--- | ||
146 | target/i386/cpu.c | 1 + | ||
147 | target/s390x/cpu_models.c | 1 + | ||
148 | tcg/region.c | 3 + | ||
149 | tcg/tcg.c | 1 + | ||
150 | tests/qtest/npcm7xx_sdhci-test.c | 215 +++++++++++++++++++++++++ | ||
151 | util/atomic64.c | 1 + | ||
152 | util/cacheflush.c | 1 + | ||
153 | util/cacheinfo.c | 1 + | ||
154 | util/osdep.c | 3 + | ||
155 | util/oslib-posix.c | 1 + | ||
156 | MAINTAINERS | 5 + | ||
157 | hw/arm/Kconfig | 10 ++ | ||
158 | hw/i2c/Kconfig | 5 + | ||
159 | hw/rtc/Kconfig | 2 + | ||
160 | hw/sensor/Kconfig | 5 + | ||
161 | scripts/checkpatch.pl | 1 + | ||
162 | tests/qtest/meson.build | 1 + | ||
163 | ui/cocoa.m | 15 +- | ||
164 | 86 files changed, 822 insertions(+), 393 deletions(-) | ||
165 | create mode 100644 include/qemu/cacheinfo.h | ||
166 | create mode 100644 include/qemu/hw-version.h | ||
167 | create mode 100644 include/qemu/madvise.h | ||
168 | create mode 100644 include/qemu/mprotect.h | ||
169 | create mode 100644 tests/qtest/npcm7xx_sdhci-test.c | ||
170 | diff view generated by jsdifflib |
1 | From: Bin Meng <bin.meng@windriver.com> | 1 | From: Ani Sinha <ani@anisinha.ca> |
---|---|---|---|
2 | 2 | ||
3 | At present, when booting U-Boot on QEMU sabrelite, we see: | 3 | Added myself as a reviewer of vmgenid, unimplemented device and empty slot. |
4 | 4 | ||
5 | Net: Board Net Initialization Failed | 5 | Signed-off-by: Ani Sinha <ani@anisinha.ca> |
6 | No ethernet found. | 6 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
7 | 7 | Message-id: 20220131122001.1476101-1-ani@anisinha.ca | |
8 | U-Boot scans PHY at address 4/5/6/7 (see board_eth_init() in the | ||
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> | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
30 | --- | 9 | --- |
31 | hw/arm/sabrelite.c | 4 ++++ | 10 | MAINTAINERS | 3 +++ |
32 | 1 file changed, 4 insertions(+) | 11 | 1 file changed, 3 insertions(+) |
33 | 12 | ||
34 | diff --git a/hw/arm/sabrelite.c b/hw/arm/sabrelite.c | 13 | diff --git a/MAINTAINERS b/MAINTAINERS |
35 | index XXXXXXX..XXXXXXX 100644 | 14 | index XXXXXXX..XXXXXXX 100644 |
36 | --- a/hw/arm/sabrelite.c | 15 | --- a/MAINTAINERS |
37 | +++ b/hw/arm/sabrelite.c | 16 | +++ b/MAINTAINERS |
38 | @@ -XXX,XX +XXX,XX @@ static void sabrelite_init(MachineState *machine) | 17 | @@ -XXX,XX +XXX,XX @@ F: tests/qtest/prom-env-test.c |
39 | 18 | ||
40 | s = FSL_IMX6(object_new(TYPE_FSL_IMX6)); | 19 | VM Generation ID |
41 | object_property_add_child(OBJECT(machine), "soc", OBJECT(s)); | 20 | S: Orphan |
42 | + | 21 | +R: Ani Sinha <ani@anisinha.ca> |
43 | + /* Ethernet PHY address is 6 */ | 22 | F: hw/acpi/vmgenid.c |
44 | + object_property_set_int(OBJECT(s), "fec-phy-num", 6, &error_fatal); | 23 | F: include/hw/acpi/vmgenid.h |
45 | + | 24 | F: docs/specs/vmgenid.txt |
46 | qdev_realize(DEVICE(s), NULL, &error_fatal); | 25 | @@ -XXX,XX +XXX,XX @@ F: hw/misc/led.c |
47 | 26 | Unimplemented device | |
48 | memory_region_add_subregion(get_system_memory(), FSL_IMX6_MMDC_ADDR, | 27 | M: Peter Maydell <peter.maydell@linaro.org> |
28 | R: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
29 | +R: Ani Sinha <ani@anisinha.ca> | ||
30 | S: Maintained | ||
31 | F: include/hw/misc/unimp.h | ||
32 | F: hw/misc/unimp.c | ||
33 | @@ -XXX,XX +XXX,XX @@ F: hw/misc/unimp.c | ||
34 | Empty slot | ||
35 | M: Artyom Tarasenko <atar4qemu@gmail.com> | ||
36 | R: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
37 | +R: Ani Sinha <ani@anisinha.ca> | ||
38 | S: Maintained | ||
39 | F: include/hw/misc/empty_slot.h | ||
40 | F: hw/misc/empty_slot.c | ||
49 | -- | 41 | -- |
50 | 2.20.1 | 42 | 2.25.1 |
51 | 43 | ||
52 | 44 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | 1 | From: Shengtan Mao <stmao@google.com> | |
2 | |||
3 | Reviewed-by: Hao Wu <wuhaotsh@google.com> | ||
4 | Reviewed-by: Chris Rauer <crauer@google.com> | ||
5 | Signed-off-by: Shengtan Mao <stmao@google.com> | ||
6 | Signed-off-by: Patrick Venture <venture@google.com> | ||
7 | Message-id: 20220208181843.4003568-1-venture@google.com | ||
8 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | --- | ||
11 | tests/qtest/npcm7xx_sdhci-test.c | 215 +++++++++++++++++++++++++++++++ | ||
12 | tests/qtest/meson.build | 1 + | ||
13 | 2 files changed, 216 insertions(+) | ||
14 | create mode 100644 tests/qtest/npcm7xx_sdhci-test.c | ||
15 | |||
16 | diff --git a/tests/qtest/npcm7xx_sdhci-test.c b/tests/qtest/npcm7xx_sdhci-test.c | ||
17 | new file mode 100644 | ||
18 | index XXXXXXX..XXXXXXX | ||
19 | --- /dev/null | ||
20 | +++ b/tests/qtest/npcm7xx_sdhci-test.c | ||
21 | @@ -XXX,XX +XXX,XX @@ | ||
22 | +/* | ||
23 | + * QTests for NPCM7xx SD-3.0 / MMC-4.51 Host Controller | ||
24 | + * | ||
25 | + * Copyright (c) 2022 Google LLC | ||
26 | + * | ||
27 | + * This program is free software; you can redistribute it and/or modify it | ||
28 | + * under the terms of the GNU General Public License as published by the | ||
29 | + * Free Software Foundation; either version 2 of the License, or | ||
30 | + * (at your option) any later version. | ||
31 | + * | ||
32 | + * This program is distributed in the hope that it will be useful, but WITHOUT | ||
33 | + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
34 | + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
35 | + * for more details. | ||
36 | + */ | ||
37 | + | ||
38 | +#include "qemu/osdep.h" | ||
39 | +#include "hw/sd/npcm7xx_sdhci.h" | ||
40 | + | ||
41 | +#include "libqos/libqtest.h" | ||
42 | +#include "libqtest-single.h" | ||
43 | +#include "libqos/sdhci-cmd.h" | ||
44 | + | ||
45 | +#define NPCM7XX_REG_SIZE 0x100 | ||
46 | +#define NPCM7XX_MMC_BA 0xF0842000 | ||
47 | +#define NPCM7XX_BLK_SIZE 512 | ||
48 | +#define NPCM7XX_TEST_IMAGE_SIZE (1 << 30) | ||
49 | + | ||
50 | +char *sd_path; | ||
51 | + | ||
52 | +static QTestState *setup_sd_card(void) | ||
53 | +{ | ||
54 | + QTestState *qts = qtest_initf( | ||
55 | + "-machine kudo-bmc " | ||
56 | + "-device sd-card,drive=drive0 " | ||
57 | + "-drive id=drive0,if=none,file=%s,format=raw,auto-read-only=off", | ||
58 | + sd_path); | ||
59 | + | ||
60 | + qtest_writew(qts, NPCM7XX_MMC_BA + SDHC_SWRST, SDHC_RESET_ALL); | ||
61 | + qtest_writew(qts, NPCM7XX_MMC_BA + SDHC_CLKCON, | ||
62 | + SDHC_CLOCK_SDCLK_EN | SDHC_CLOCK_INT_STABLE | | ||
63 | + SDHC_CLOCK_INT_EN); | ||
64 | + sdhci_cmd_regs(qts, NPCM7XX_MMC_BA, 0, 0, 0, 0, SDHC_APP_CMD); | ||
65 | + sdhci_cmd_regs(qts, NPCM7XX_MMC_BA, 0, 0, 0x41200000, 0, (41 << 8)); | ||
66 | + sdhci_cmd_regs(qts, NPCM7XX_MMC_BA, 0, 0, 0, 0, SDHC_ALL_SEND_CID); | ||
67 | + sdhci_cmd_regs(qts, NPCM7XX_MMC_BA, 0, 0, 0, 0, SDHC_SEND_RELATIVE_ADDR); | ||
68 | + sdhci_cmd_regs(qts, NPCM7XX_MMC_BA, 0, 0, 0x45670000, 0, | ||
69 | + SDHC_SELECT_DESELECT_CARD); | ||
70 | + | ||
71 | + return qts; | ||
72 | +} | ||
73 | + | ||
74 | +static void write_sdread(QTestState *qts, const char *msg) | ||
75 | +{ | ||
76 | + int fd, ret; | ||
77 | + size_t len = strlen(msg); | ||
78 | + char *rmsg = g_malloc(len); | ||
79 | + | ||
80 | + /* write message to sd */ | ||
81 | + fd = open(sd_path, O_WRONLY); | ||
82 | + g_assert(fd >= 0); | ||
83 | + ret = write(fd, msg, len); | ||
84 | + close(fd); | ||
85 | + g_assert(ret == len); | ||
86 | + | ||
87 | + /* read message using sdhci */ | ||
88 | + ret = sdhci_read_cmd(qts, NPCM7XX_MMC_BA, rmsg, len); | ||
89 | + g_assert(ret == len); | ||
90 | + g_assert(!strcmp(rmsg, msg)); | ||
91 | + | ||
92 | + g_free(rmsg); | ||
93 | +} | ||
94 | + | ||
95 | +/* Check MMC can read values from sd */ | ||
96 | +static void test_read_sd(void) | ||
97 | +{ | ||
98 | + QTestState *qts = setup_sd_card(); | ||
99 | + | ||
100 | + write_sdread(qts, "hello world"); | ||
101 | + write_sdread(qts, "goodbye"); | ||
102 | + | ||
103 | + qtest_quit(qts); | ||
104 | +} | ||
105 | + | ||
106 | +static void sdwrite_read(QTestState *qts, const char *msg) | ||
107 | +{ | ||
108 | + int fd, ret; | ||
109 | + size_t len = strlen(msg); | ||
110 | + char *rmsg = g_malloc(len); | ||
111 | + | ||
112 | + /* write message using sdhci */ | ||
113 | + sdhci_write_cmd(qts, NPCM7XX_MMC_BA, msg, len, NPCM7XX_BLK_SIZE); | ||
114 | + | ||
115 | + /* read message from sd */ | ||
116 | + fd = open(sd_path, O_RDONLY); | ||
117 | + g_assert(fd >= 0); | ||
118 | + ret = read(fd, rmsg, len); | ||
119 | + close(fd); | ||
120 | + g_assert(ret == len); | ||
121 | + | ||
122 | + g_assert(!strcmp(rmsg, msg)); | ||
123 | + | ||
124 | + g_free(rmsg); | ||
125 | +} | ||
126 | + | ||
127 | +/* Check MMC can write values to sd */ | ||
128 | +static void test_write_sd(void) | ||
129 | +{ | ||
130 | + QTestState *qts = setup_sd_card(); | ||
131 | + | ||
132 | + sdwrite_read(qts, "hello world"); | ||
133 | + sdwrite_read(qts, "goodbye"); | ||
134 | + | ||
135 | + qtest_quit(qts); | ||
136 | +} | ||
137 | + | ||
138 | +/* Check SDHCI has correct default values. */ | ||
139 | +static void test_reset(void) | ||
140 | +{ | ||
141 | + QTestState *qts = qtest_init("-machine kudo-bmc"); | ||
142 | + uint64_t addr = NPCM7XX_MMC_BA; | ||
143 | + uint64_t end_addr = addr + NPCM7XX_REG_SIZE; | ||
144 | + uint16_t prstvals_resets[] = {NPCM7XX_PRSTVALS_0_RESET, | ||
145 | + NPCM7XX_PRSTVALS_1_RESET, | ||
146 | + 0, | ||
147 | + NPCM7XX_PRSTVALS_3_RESET, | ||
148 | + 0, | ||
149 | + 0}; | ||
150 | + int i; | ||
151 | + uint32_t mask; | ||
152 | + | ||
153 | + while (addr < end_addr) { | ||
154 | + switch (addr - NPCM7XX_MMC_BA) { | ||
155 | + case SDHC_PRNSTS: | ||
156 | + /* | ||
157 | + * ignores bits 20 to 24: they are changed when reading registers | ||
158 | + */ | ||
159 | + mask = 0x1f00000; | ||
160 | + g_assert_cmphex(qtest_readl(qts, addr) | mask, ==, | ||
161 | + NPCM7XX_PRSNTS_RESET | mask); | ||
162 | + addr += 4; | ||
163 | + break; | ||
164 | + case SDHC_BLKGAP: | ||
165 | + g_assert_cmphex(qtest_readb(qts, addr), ==, NPCM7XX_BLKGAP_RESET); | ||
166 | + addr += 1; | ||
167 | + break; | ||
168 | + case SDHC_CAPAB: | ||
169 | + g_assert_cmphex(qtest_readq(qts, addr), ==, NPCM7XX_CAPAB_RESET); | ||
170 | + addr += 8; | ||
171 | + break; | ||
172 | + case SDHC_MAXCURR: | ||
173 | + g_assert_cmphex(qtest_readq(qts, addr), ==, NPCM7XX_MAXCURR_RESET); | ||
174 | + addr += 8; | ||
175 | + break; | ||
176 | + case SDHC_HCVER: | ||
177 | + g_assert_cmphex(qtest_readw(qts, addr), ==, NPCM7XX_HCVER_RESET); | ||
178 | + addr += 2; | ||
179 | + break; | ||
180 | + case NPCM7XX_PRSTVALS: | ||
181 | + for (i = 0; i < NPCM7XX_PRSTVALS_SIZE; ++i) { | ||
182 | + g_assert_cmphex(qtest_readw(qts, addr + 2 * i), ==, | ||
183 | + prstvals_resets[i]); | ||
184 | + } | ||
185 | + addr += NPCM7XX_PRSTVALS_SIZE * 2; | ||
186 | + break; | ||
187 | + default: | ||
188 | + g_assert_cmphex(qtest_readb(qts, addr), ==, 0); | ||
189 | + addr += 1; | ||
190 | + } | ||
191 | + } | ||
192 | + | ||
193 | + qtest_quit(qts); | ||
194 | +} | ||
195 | + | ||
196 | +static void drive_destroy(void) | ||
197 | +{ | ||
198 | + unlink(sd_path); | ||
199 | + g_free(sd_path); | ||
200 | +} | ||
201 | + | ||
202 | +static void drive_create(void) | ||
203 | +{ | ||
204 | + int fd, ret; | ||
205 | + GError *error = NULL; | ||
206 | + | ||
207 | + /* Create a temporary raw image */ | ||
208 | + fd = g_file_open_tmp("sdhci_XXXXXX", &sd_path, &error); | ||
209 | + if (fd == -1) { | ||
210 | + fprintf(stderr, "unable to create sdhci file: %s\n", error->message); | ||
211 | + g_error_free(error); | ||
212 | + } | ||
213 | + g_assert(sd_path != NULL); | ||
214 | + | ||
215 | + ret = ftruncate(fd, NPCM7XX_TEST_IMAGE_SIZE); | ||
216 | + g_assert_cmpint(ret, ==, 0); | ||
217 | + g_message("%s", sd_path); | ||
218 | + close(fd); | ||
219 | +} | ||
220 | + | ||
221 | +int main(int argc, char **argv) | ||
222 | +{ | ||
223 | + int ret; | ||
224 | + | ||
225 | + drive_create(); | ||
226 | + | ||
227 | + g_test_init(&argc, &argv, NULL); | ||
228 | + | ||
229 | + qtest_add_func("npcm7xx_sdhci/reset", test_reset); | ||
230 | + qtest_add_func("npcm7xx_sdhci/write_sd", test_write_sd); | ||
231 | + qtest_add_func("npcm7xx_sdhci/read_sd", test_read_sd); | ||
232 | + | ||
233 | + ret = g_test_run(); | ||
234 | + drive_destroy(); | ||
235 | + return ret; | ||
236 | +} | ||
237 | diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build | ||
238 | index XXXXXXX..XXXXXXX 100644 | ||
239 | --- a/tests/qtest/meson.build | ||
240 | +++ b/tests/qtest/meson.build | ||
241 | @@ -XXX,XX +XXX,XX @@ qtests_npcm7xx = \ | ||
242 | 'npcm7xx_gpio-test', | ||
243 | 'npcm7xx_pwm-test', | ||
244 | 'npcm7xx_rng-test', | ||
245 | + 'npcm7xx_sdhci-test', | ||
246 | 'npcm7xx_smbus-test', | ||
247 | 'npcm7xx_timer-test', | ||
248 | 'npcm7xx_watchdog_timer-test'] + \ | ||
249 | -- | ||
250 | 2.25.1 | ||
251 | |||
252 | diff view generated by jsdifflib |
1 | From: Bin Meng <bin.meng@windriver.com> | 1 | From: Alexander Graf <agraf@csgraf.de> |
---|---|---|---|
2 | 2 | ||
3 | Currently when U-Boot boots, it prints "??" for i.MX processor: | 3 | We are parsing the syndrome field for sysregs in multiple places across |
4 | the hvf code, but repeat shift/mask operations with hard coded constants | ||
5 | every time. This is an error prone approach and makes it harder to reason | ||
6 | about the correctness of these operations. | ||
4 | 7 | ||
5 | CPU: Freescale i.MX?? rev1.0 at 792 MHz | 8 | Let's introduce macros that allow us to unify the constants used as well |
9 | as create new helpers to extract fields from the sysreg value. | ||
6 | 10 | ||
7 | The register that was used to determine the silicon type is | 11 | Suggested-by: Peter Maydell <peter.maydell@linaro.org> |
8 | undocumented in the latest IMX6DQRM (Rev. 6, 05/2020), but we | 12 | Signed-off-by: Alexander Graf <agraf@csgraf.de> |
9 | can refer to get_cpu_rev() in arch/arm/mach-imx/mx6/soc.c in | 13 | Reviewed-by: Cameron Esfahani <dirty@apple.com <mailto:dirty@apple.com>> |
10 | the U-Boot source codes that USB_ANALOG_DIGPROG is used. | 14 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
11 | 15 | Message-id: 20220209124135.69183-1-agraf@csgraf.de | |
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> | 16 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
18 | --- | 17 | --- |
19 | hw/misc/imx6_ccm.c | 2 +- | 18 | target/arm/hvf/hvf.c | 69 ++++++++++++++++++++++++++++++-------------- |
20 | 1 file changed, 1 insertion(+), 1 deletion(-) | 19 | 1 file changed, 47 insertions(+), 22 deletions(-) |
21 | 20 | ||
22 | diff --git a/hw/misc/imx6_ccm.c b/hw/misc/imx6_ccm.c | 21 | diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c |
23 | index XXXXXXX..XXXXXXX 100644 | 22 | index XXXXXXX..XXXXXXX 100644 |
24 | --- a/hw/misc/imx6_ccm.c | 23 | --- a/target/arm/hvf/hvf.c |
25 | +++ b/hw/misc/imx6_ccm.c | 24 | +++ b/target/arm/hvf/hvf.c |
26 | @@ -XXX,XX +XXX,XX @@ static void imx6_ccm_reset(DeviceState *dev) | 25 | @@ -XXX,XX +XXX,XX @@ |
27 | s->analog[USB_ANALOG_USB2_VBUS_DETECT] = 0x00000004; | 26 | ENCODE_AA64_CP_REG(CP_REG_ARM64_SYSREG_CP, crn, crm, op0, op1, op2) |
28 | s->analog[USB_ANALOG_USB2_CHRG_DETECT] = 0x00000000; | 27 | #define PL1_WRITE_MASK 0x4 |
29 | s->analog[USB_ANALOG_USB2_MISC] = 0x00000002; | 28 | |
30 | - s->analog[USB_ANALOG_DIGPROG] = 0x00000000; | 29 | +#define SYSREG_OP0_SHIFT 20 |
31 | + s->analog[USB_ANALOG_DIGPROG] = 0x00630000; | 30 | +#define SYSREG_OP0_MASK 0x3 |
32 | 31 | +#define SYSREG_OP0(sysreg) ((sysreg >> SYSREG_OP0_SHIFT) & SYSREG_OP0_MASK) | |
33 | /* all PLLs need to be locked */ | 32 | +#define SYSREG_OP1_SHIFT 14 |
34 | s->analog[CCM_ANALOG_PLL_ARM] |= CCM_ANALOG_PLL_LOCK; | 33 | +#define SYSREG_OP1_MASK 0x7 |
34 | +#define SYSREG_OP1(sysreg) ((sysreg >> SYSREG_OP1_SHIFT) & SYSREG_OP1_MASK) | ||
35 | +#define SYSREG_CRN_SHIFT 10 | ||
36 | +#define SYSREG_CRN_MASK 0xf | ||
37 | +#define SYSREG_CRN(sysreg) ((sysreg >> SYSREG_CRN_SHIFT) & SYSREG_CRN_MASK) | ||
38 | +#define SYSREG_CRM_SHIFT 1 | ||
39 | +#define SYSREG_CRM_MASK 0xf | ||
40 | +#define SYSREG_CRM(sysreg) ((sysreg >> SYSREG_CRM_SHIFT) & SYSREG_CRM_MASK) | ||
41 | +#define SYSREG_OP2_SHIFT 17 | ||
42 | +#define SYSREG_OP2_MASK 0x7 | ||
43 | +#define SYSREG_OP2(sysreg) ((sysreg >> SYSREG_OP2_SHIFT) & SYSREG_OP2_MASK) | ||
44 | + | ||
45 | #define SYSREG(op0, op1, crn, crm, op2) \ | ||
46 | - ((op0 << 20) | (op2 << 17) | (op1 << 14) | (crn << 10) | (crm << 1)) | ||
47 | -#define SYSREG_MASK SYSREG(0x3, 0x7, 0xf, 0xf, 0x7) | ||
48 | + ((op0 << SYSREG_OP0_SHIFT) | \ | ||
49 | + (op1 << SYSREG_OP1_SHIFT) | \ | ||
50 | + (crn << SYSREG_CRN_SHIFT) | \ | ||
51 | + (crm << SYSREG_CRM_SHIFT) | \ | ||
52 | + (op2 << SYSREG_OP2_SHIFT)) | ||
53 | +#define SYSREG_MASK \ | ||
54 | + SYSREG(SYSREG_OP0_MASK, \ | ||
55 | + SYSREG_OP1_MASK, \ | ||
56 | + SYSREG_CRN_MASK, \ | ||
57 | + SYSREG_CRM_MASK, \ | ||
58 | + SYSREG_OP2_MASK) | ||
59 | #define SYSREG_OSLAR_EL1 SYSREG(2, 0, 1, 0, 4) | ||
60 | #define SYSREG_OSLSR_EL1 SYSREG(2, 0, 1, 1, 4) | ||
61 | #define SYSREG_OSDLR_EL1 SYSREG(2, 0, 1, 3, 4) | ||
62 | @@ -XXX,XX +XXX,XX @@ static int hvf_sysreg_read(CPUState *cpu, uint32_t reg, uint32_t rt) | ||
63 | default: | ||
64 | cpu_synchronize_state(cpu); | ||
65 | trace_hvf_unhandled_sysreg_read(env->pc, reg, | ||
66 | - (reg >> 20) & 0x3, | ||
67 | - (reg >> 14) & 0x7, | ||
68 | - (reg >> 10) & 0xf, | ||
69 | - (reg >> 1) & 0xf, | ||
70 | - (reg >> 17) & 0x7); | ||
71 | + SYSREG_OP0(reg), | ||
72 | + SYSREG_OP1(reg), | ||
73 | + SYSREG_CRN(reg), | ||
74 | + SYSREG_CRM(reg), | ||
75 | + SYSREG_OP2(reg)); | ||
76 | hvf_raise_exception(cpu, EXCP_UDEF, syn_uncategorized()); | ||
77 | return 1; | ||
78 | } | ||
79 | |||
80 | trace_hvf_sysreg_read(reg, | ||
81 | - (reg >> 20) & 0x3, | ||
82 | - (reg >> 14) & 0x7, | ||
83 | - (reg >> 10) & 0xf, | ||
84 | - (reg >> 1) & 0xf, | ||
85 | - (reg >> 17) & 0x7, | ||
86 | + SYSREG_OP0(reg), | ||
87 | + SYSREG_OP1(reg), | ||
88 | + SYSREG_CRN(reg), | ||
89 | + SYSREG_CRM(reg), | ||
90 | + SYSREG_OP2(reg), | ||
91 | val); | ||
92 | hvf_set_reg(cpu, rt, val); | ||
93 | |||
94 | @@ -XXX,XX +XXX,XX @@ static int hvf_sysreg_write(CPUState *cpu, uint32_t reg, uint64_t val) | ||
95 | CPUARMState *env = &arm_cpu->env; | ||
96 | |||
97 | trace_hvf_sysreg_write(reg, | ||
98 | - (reg >> 20) & 0x3, | ||
99 | - (reg >> 14) & 0x7, | ||
100 | - (reg >> 10) & 0xf, | ||
101 | - (reg >> 1) & 0xf, | ||
102 | - (reg >> 17) & 0x7, | ||
103 | + SYSREG_OP0(reg), | ||
104 | + SYSREG_OP1(reg), | ||
105 | + SYSREG_CRN(reg), | ||
106 | + SYSREG_CRM(reg), | ||
107 | + SYSREG_OP2(reg), | ||
108 | val); | ||
109 | |||
110 | switch (reg) { | ||
111 | @@ -XXX,XX +XXX,XX @@ static int hvf_sysreg_write(CPUState *cpu, uint32_t reg, uint64_t val) | ||
112 | default: | ||
113 | cpu_synchronize_state(cpu); | ||
114 | trace_hvf_unhandled_sysreg_write(env->pc, reg, | ||
115 | - (reg >> 20) & 0x3, | ||
116 | - (reg >> 14) & 0x7, | ||
117 | - (reg >> 10) & 0xf, | ||
118 | - (reg >> 1) & 0xf, | ||
119 | - (reg >> 17) & 0x7); | ||
120 | + SYSREG_OP0(reg), | ||
121 | + SYSREG_OP1(reg), | ||
122 | + SYSREG_CRN(reg), | ||
123 | + SYSREG_CRM(reg), | ||
124 | + SYSREG_OP2(reg)); | ||
125 | hvf_raise_exception(cpu, EXCP_UDEF, syn_uncategorized()); | ||
126 | return 1; | ||
127 | } | ||
35 | -- | 128 | -- |
36 | 2.20.1 | 129 | 2.25.1 |
37 | 130 | ||
38 | 131 | diff view generated by jsdifflib |
1 | From: Gan Qixin <ganqixin@huawei.com> | 1 | From: Alexander Graf <agraf@csgraf.de> |
---|---|---|---|
2 | 2 | ||
3 | When running device-introspect-test, a memory leak occurred in the | 3 | Recent Linux versions added support to read ID_AA64ISAR2_EL1. On M1, |
4 | exynos4210_mct_init function, so use ptimer_free() in the finalize function to | 4 | those reads trap into QEMU which handles them as faults. |
5 | avoid it. | ||
6 | 5 | ||
7 | ASAN shows memory leak stack: | 6 | However, AArch64 ID registers should always read as RES0. Let's |
7 | handle them accordingly. | ||
8 | 8 | ||
9 | Indirect leak of 96 byte(s) in 1 object(s) allocated from: | 9 | This fixes booting Linux 5.17 guests. |
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 | 10 | ||
24 | Reported-by: Euler Robot <euler.robot@huawei.com> | 11 | Cc: qemu-stable@nongnu.org |
25 | Signed-off-by: Gan Qixin <ganqixin@huawei.com> | 12 | Reported-by: Ivan Babrou <ivan@cloudflare.com> |
13 | Signed-off-by: Alexander Graf <agraf@csgraf.de> | ||
14 | Message-id: 20220209124135.69183-2-agraf@csgraf.de | ||
26 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 15 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
27 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 16 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
28 | --- | 17 | --- |
29 | hw/timer/exynos4210_mct.c | 14 ++++++++++++++ | 18 | target/arm/hvf/hvf.c | 14 ++++++++++++++ |
30 | 1 file changed, 14 insertions(+) | 19 | 1 file changed, 14 insertions(+) |
31 | 20 | ||
32 | diff --git a/hw/timer/exynos4210_mct.c b/hw/timer/exynos4210_mct.c | 21 | diff --git a/target/arm/hvf/hvf.c b/target/arm/hvf/hvf.c |
33 | index XXXXXXX..XXXXXXX 100644 | 22 | index XXXXXXX..XXXXXXX 100644 |
34 | --- a/hw/timer/exynos4210_mct.c | 23 | --- a/target/arm/hvf/hvf.c |
35 | +++ b/hw/timer/exynos4210_mct.c | 24 | +++ b/target/arm/hvf/hvf.c |
36 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_mct_init(Object *obj) | 25 | @@ -XXX,XX +XXX,XX @@ static bool hvf_handle_psci_call(CPUState *cpu) |
37 | sysbus_init_mmio(dev, &s->iomem); | 26 | return true; |
38 | } | 27 | } |
39 | 28 | ||
40 | +static void exynos4210_mct_finalize(Object *obj) | 29 | +static bool is_id_sysreg(uint32_t reg) |
41 | +{ | 30 | +{ |
42 | + int i; | 31 | + return SYSREG_OP0(reg) == 3 && |
43 | + Exynos4210MCTState *s = EXYNOS4210_MCT(obj); | 32 | + SYSREG_OP1(reg) == 0 && |
44 | + | 33 | + SYSREG_CRN(reg) == 0 && |
45 | + ptimer_free(s->g_timer.ptimer_frc); | 34 | + SYSREG_CRM(reg) >= 1 && |
46 | + | 35 | + SYSREG_CRM(reg) < 8; |
47 | + for (i = 0; i < 2; i++) { | ||
48 | + ptimer_free(s->l_timer[i].tick_timer.ptimer_tick); | ||
49 | + ptimer_free(s->l_timer[i].ptimer_frc); | ||
50 | + } | ||
51 | +} | 36 | +} |
52 | + | 37 | + |
53 | static void exynos4210_mct_class_init(ObjectClass *klass, void *data) | 38 | static int hvf_sysreg_read(CPUState *cpu, uint32_t reg, uint32_t rt) |
54 | { | 39 | { |
55 | DeviceClass *dc = DEVICE_CLASS(klass); | 40 | ARMCPU *arm_cpu = ARM_CPU(cpu); |
56 | @@ -XXX,XX +XXX,XX @@ static const TypeInfo exynos4210_mct_info = { | 41 | @@ -XXX,XX +XXX,XX @@ static int hvf_sysreg_read(CPUState *cpu, uint32_t reg, uint32_t rt) |
57 | .parent = TYPE_SYS_BUS_DEVICE, | 42 | /* Dummy register */ |
58 | .instance_size = sizeof(Exynos4210MCTState), | 43 | break; |
59 | .instance_init = exynos4210_mct_init, | 44 | default: |
60 | + .instance_finalize = exynos4210_mct_finalize, | 45 | + if (is_id_sysreg(reg)) { |
61 | .class_init = exynos4210_mct_class_init, | 46 | + /* ID system registers read as RES0 */ |
62 | }; | 47 | + val = 0; |
63 | 48 | + break; | |
49 | + } | ||
50 | cpu_synchronize_state(cpu); | ||
51 | trace_hvf_unhandled_sysreg_read(env->pc, reg, | ||
52 | SYSREG_OP0(reg), | ||
64 | -- | 53 | -- |
65 | 2.20.1 | 54 | 2.25.1 |
66 | 55 | ||
67 | 56 | diff view generated by jsdifflib |
1 | From: Gan Qixin <ganqixin@huawei.com> | 1 | From: Bernhard Beschow <shentey@gmail.com> |
---|---|---|---|
2 | 2 | ||
3 | When running device-introspect-test, a memory leak occurred in the | 3 | More than 1k of TypeInfo instances are already marked as const. Mark the |
4 | mv88w8618_pit_init function, so use ptimer_free() in the finalize function to | 4 | remaining ones, too. |
5 | avoid it. | ||
6 | 5 | ||
7 | ASAN shows memory leak stack: | 6 | This commit was created with: |
7 | git grep -z -l 'static TypeInfo' -- '*.c' | \ | ||
8 | xargs -0 sed -i 's/static TypeInfo/static const TypeInfo/' | ||
8 | 9 | ||
9 | Indirect leak of 192 byte(s) in 4 object(s) allocated from: | 10 | Signed-off-by: Bernhard Beschow <shentey@gmail.com> |
10 | #0 0xffffab97e1f0 in __interceptor_calloc (/lib64/libasan.so.5+0xee1f0) | 11 | Reviewed-by: Alistair Francis <alistair.francis@wdc.com> |
11 | #1 0xffffab256800 in g_malloc0 (/lib64/libglib-2.0.so.0+0x56800) | 12 | Reviewed-by: Thomas Huth <thuth@redhat.com> |
12 | #2 0xaaabf555db84 in timer_new_full /qemu/include/qemu/timer.h:523 | 13 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
13 | #3 0xaaabf555db84 in timer_new /qemu/include/qemu/timer.h:544 | 14 | Reviewed-by: Cédric Le Goater <clg@kaod.org> |
14 | #4 0xaaabf555db84 in timer_new_ns /qemu/include/qemu/timer.h:562 | 15 | Reviewed-by: Igor Mammedov <imammedo@redhat.com> |
15 | #5 0xaaabf555db84 in ptimer_init /qemu/hw/core/ptimer.c:433 | 16 | Acked-by: Corey Minyard <cminyard@mvista.com> |
16 | #6 0xaaabf5bb2290 in mv88w8618_timer_init /qemu/hw/arm/musicpal.c:862 | 17 | Message-id: 20220117145805.173070-2-shentey@gmail.com |
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> | 18 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
28 | --- | 19 | --- |
29 | hw/arm/musicpal.c | 12 ++++++++++++ | 20 | hw/core/generic-loader.c | 2 +- |
30 | 1 file changed, 12 insertions(+) | 21 | hw/core/guest-loader.c | 2 +- |
22 | hw/display/bcm2835_fb.c | 2 +- | ||
23 | hw/display/i2c-ddc.c | 2 +- | ||
24 | hw/display/macfb.c | 4 ++-- | ||
25 | hw/display/virtio-vga.c | 2 +- | ||
26 | hw/dma/bcm2835_dma.c | 2 +- | ||
27 | hw/i386/pc_piix.c | 2 +- | ||
28 | hw/i386/sgx-epc.c | 2 +- | ||
29 | hw/intc/bcm2835_ic.c | 2 +- | ||
30 | hw/intc/bcm2836_control.c | 2 +- | ||
31 | hw/ipmi/ipmi.c | 4 ++-- | ||
32 | hw/mem/nvdimm.c | 2 +- | ||
33 | hw/mem/pc-dimm.c | 2 +- | ||
34 | hw/misc/bcm2835_mbox.c | 2 +- | ||
35 | hw/misc/bcm2835_powermgt.c | 2 +- | ||
36 | hw/misc/bcm2835_property.c | 2 +- | ||
37 | hw/misc/bcm2835_rng.c | 2 +- | ||
38 | hw/misc/pvpanic-isa.c | 2 +- | ||
39 | hw/misc/pvpanic-pci.c | 2 +- | ||
40 | hw/net/fsl_etsec/etsec.c | 2 +- | ||
41 | hw/ppc/prep_systemio.c | 2 +- | ||
42 | hw/ppc/spapr_iommu.c | 2 +- | ||
43 | hw/s390x/s390-pci-bus.c | 2 +- | ||
44 | hw/s390x/sclp.c | 2 +- | ||
45 | hw/s390x/tod-kvm.c | 2 +- | ||
46 | hw/s390x/tod-tcg.c | 2 +- | ||
47 | hw/s390x/tod.c | 2 +- | ||
48 | hw/scsi/lsi53c895a.c | 2 +- | ||
49 | hw/sd/allwinner-sdhost.c | 2 +- | ||
50 | hw/sd/aspeed_sdhci.c | 2 +- | ||
51 | hw/sd/bcm2835_sdhost.c | 2 +- | ||
52 | hw/sd/cadence_sdhci.c | 2 +- | ||
53 | hw/sd/npcm7xx_sdhci.c | 2 +- | ||
54 | hw/usb/dev-mtp.c | 2 +- | ||
55 | hw/usb/host-libusb.c | 2 +- | ||
56 | hw/vfio/igd.c | 2 +- | ||
57 | hw/virtio/virtio-pmem.c | 2 +- | ||
58 | qom/object.c | 4 ++-- | ||
59 | 39 files changed, 42 insertions(+), 42 deletions(-) | ||
31 | 60 | ||
32 | diff --git a/hw/arm/musicpal.c b/hw/arm/musicpal.c | 61 | diff --git a/hw/core/generic-loader.c b/hw/core/generic-loader.c |
33 | index XXXXXXX..XXXXXXX 100644 | 62 | index XXXXXXX..XXXXXXX 100644 |
34 | --- a/hw/arm/musicpal.c | 63 | --- a/hw/core/generic-loader.c |
35 | +++ b/hw/arm/musicpal.c | 64 | +++ b/hw/core/generic-loader.c |
36 | @@ -XXX,XX +XXX,XX @@ static void mv88w8618_pit_init(Object *obj) | 65 | @@ -XXX,XX +XXX,XX @@ static void generic_loader_class_init(ObjectClass *klass, void *data) |
37 | sysbus_init_mmio(dev, &s->iomem); | 66 | set_bit(DEVICE_CATEGORY_MISC, dc->categories); |
38 | } | 67 | } |
39 | 68 | ||
40 | +static void mv88w8618_pit_finalize(Object *obj) | 69 | -static TypeInfo generic_loader_info = { |
41 | +{ | 70 | +static const TypeInfo generic_loader_info = { |
42 | + SysBusDevice *dev = SYS_BUS_DEVICE(obj); | 71 | .name = TYPE_GENERIC_LOADER, |
43 | + mv88w8618_pit_state *s = MV88W8618_PIT(dev); | 72 | .parent = TYPE_DEVICE, |
44 | + int i; | 73 | .instance_size = sizeof(GenericLoaderState), |
45 | + | 74 | diff --git a/hw/core/guest-loader.c b/hw/core/guest-loader.c |
46 | + for (i = 0; i < 4; i++) { | 75 | index XXXXXXX..XXXXXXX 100644 |
47 | + ptimer_free(s->timer[i].ptimer); | 76 | --- a/hw/core/guest-loader.c |
48 | + } | 77 | +++ b/hw/core/guest-loader.c |
49 | +} | 78 | @@ -XXX,XX +XXX,XX @@ static void guest_loader_class_init(ObjectClass *klass, void *data) |
50 | + | 79 | set_bit(DEVICE_CATEGORY_MISC, dc->categories); |
51 | static const VMStateDescription mv88w8618_timer_vmsd = { | 80 | } |
52 | .name = "timer", | 81 | |
53 | .version_id = 1, | 82 | -static TypeInfo guest_loader_info = { |
54 | @@ -XXX,XX +XXX,XX @@ static const TypeInfo mv88w8618_pit_info = { | 83 | +static const TypeInfo guest_loader_info = { |
55 | .parent = TYPE_SYS_BUS_DEVICE, | 84 | .name = TYPE_GUEST_LOADER, |
56 | .instance_size = sizeof(mv88w8618_pit_state), | 85 | .parent = TYPE_DEVICE, |
57 | .instance_init = mv88w8618_pit_init, | 86 | .instance_size = sizeof(GuestLoaderState), |
58 | + .instance_finalize = mv88w8618_pit_finalize, | 87 | diff --git a/hw/display/bcm2835_fb.c b/hw/display/bcm2835_fb.c |
59 | .class_init = mv88w8618_pit_class_init, | 88 | index XXXXXXX..XXXXXXX 100644 |
89 | --- a/hw/display/bcm2835_fb.c | ||
90 | +++ b/hw/display/bcm2835_fb.c | ||
91 | @@ -XXX,XX +XXX,XX @@ static void bcm2835_fb_class_init(ObjectClass *klass, void *data) | ||
92 | dc->vmsd = &vmstate_bcm2835_fb; | ||
93 | } | ||
94 | |||
95 | -static TypeInfo bcm2835_fb_info = { | ||
96 | +static const TypeInfo bcm2835_fb_info = { | ||
97 | .name = TYPE_BCM2835_FB, | ||
98 | .parent = TYPE_SYS_BUS_DEVICE, | ||
99 | .instance_size = sizeof(BCM2835FBState), | ||
100 | diff --git a/hw/display/i2c-ddc.c b/hw/display/i2c-ddc.c | ||
101 | index XXXXXXX..XXXXXXX 100644 | ||
102 | --- a/hw/display/i2c-ddc.c | ||
103 | +++ b/hw/display/i2c-ddc.c | ||
104 | @@ -XXX,XX +XXX,XX @@ static void i2c_ddc_class_init(ObjectClass *oc, void *data) | ||
105 | isc->send = i2c_ddc_tx; | ||
106 | } | ||
107 | |||
108 | -static TypeInfo i2c_ddc_info = { | ||
109 | +static const TypeInfo i2c_ddc_info = { | ||
110 | .name = TYPE_I2CDDC, | ||
111 | .parent = TYPE_I2C_SLAVE, | ||
112 | .instance_size = sizeof(I2CDDCState), | ||
113 | diff --git a/hw/display/macfb.c b/hw/display/macfb.c | ||
114 | index XXXXXXX..XXXXXXX 100644 | ||
115 | --- a/hw/display/macfb.c | ||
116 | +++ b/hw/display/macfb.c | ||
117 | @@ -XXX,XX +XXX,XX @@ static void macfb_nubus_class_init(ObjectClass *klass, void *data) | ||
118 | device_class_set_props(dc, macfb_nubus_properties); | ||
119 | } | ||
120 | |||
121 | -static TypeInfo macfb_sysbus_info = { | ||
122 | +static const TypeInfo macfb_sysbus_info = { | ||
123 | .name = TYPE_MACFB, | ||
124 | .parent = TYPE_SYS_BUS_DEVICE, | ||
125 | .instance_size = sizeof(MacfbSysBusState), | ||
126 | .class_init = macfb_sysbus_class_init, | ||
60 | }; | 127 | }; |
61 | 128 | ||
129 | -static TypeInfo macfb_nubus_info = { | ||
130 | +static const TypeInfo macfb_nubus_info = { | ||
131 | .name = TYPE_NUBUS_MACFB, | ||
132 | .parent = TYPE_NUBUS_DEVICE, | ||
133 | .instance_size = sizeof(MacfbNubusState), | ||
134 | diff --git a/hw/display/virtio-vga.c b/hw/display/virtio-vga.c | ||
135 | index XXXXXXX..XXXXXXX 100644 | ||
136 | --- a/hw/display/virtio-vga.c | ||
137 | +++ b/hw/display/virtio-vga.c | ||
138 | @@ -XXX,XX +XXX,XX @@ static void virtio_vga_base_class_init(ObjectClass *klass, void *data) | ||
139 | virtio_vga_set_big_endian_fb); | ||
140 | } | ||
141 | |||
142 | -static TypeInfo virtio_vga_base_info = { | ||
143 | +static const TypeInfo virtio_vga_base_info = { | ||
144 | .name = TYPE_VIRTIO_VGA_BASE, | ||
145 | .parent = TYPE_VIRTIO_PCI, | ||
146 | .instance_size = sizeof(VirtIOVGABase), | ||
147 | diff --git a/hw/dma/bcm2835_dma.c b/hw/dma/bcm2835_dma.c | ||
148 | index XXXXXXX..XXXXXXX 100644 | ||
149 | --- a/hw/dma/bcm2835_dma.c | ||
150 | +++ b/hw/dma/bcm2835_dma.c | ||
151 | @@ -XXX,XX +XXX,XX @@ static void bcm2835_dma_class_init(ObjectClass *klass, void *data) | ||
152 | dc->vmsd = &vmstate_bcm2835_dma; | ||
153 | } | ||
154 | |||
155 | -static TypeInfo bcm2835_dma_info = { | ||
156 | +static const TypeInfo bcm2835_dma_info = { | ||
157 | .name = TYPE_BCM2835_DMA, | ||
158 | .parent = TYPE_SYS_BUS_DEVICE, | ||
159 | .instance_size = sizeof(BCM2835DMAState), | ||
160 | diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c | ||
161 | index XXXXXXX..XXXXXXX 100644 | ||
162 | --- a/hw/i386/pc_piix.c | ||
163 | +++ b/hw/i386/pc_piix.c | ||
164 | @@ -XXX,XX +XXX,XX @@ static void isa_bridge_class_init(ObjectClass *klass, void *data) | ||
165 | k->class_id = PCI_CLASS_BRIDGE_ISA; | ||
166 | }; | ||
167 | |||
168 | -static TypeInfo isa_bridge_info = { | ||
169 | +static const TypeInfo isa_bridge_info = { | ||
170 | .name = "igd-passthrough-isa-bridge", | ||
171 | .parent = TYPE_PCI_DEVICE, | ||
172 | .instance_size = sizeof(PCIDevice), | ||
173 | diff --git a/hw/i386/sgx-epc.c b/hw/i386/sgx-epc.c | ||
174 | index XXXXXXX..XXXXXXX 100644 | ||
175 | --- a/hw/i386/sgx-epc.c | ||
176 | +++ b/hw/i386/sgx-epc.c | ||
177 | @@ -XXX,XX +XXX,XX @@ static void sgx_epc_class_init(ObjectClass *oc, void *data) | ||
178 | mdc->fill_device_info = sgx_epc_md_fill_device_info; | ||
179 | } | ||
180 | |||
181 | -static TypeInfo sgx_epc_info = { | ||
182 | +static const TypeInfo sgx_epc_info = { | ||
183 | .name = TYPE_SGX_EPC, | ||
184 | .parent = TYPE_DEVICE, | ||
185 | .instance_size = sizeof(SGXEPCDevice), | ||
186 | diff --git a/hw/intc/bcm2835_ic.c b/hw/intc/bcm2835_ic.c | ||
187 | index XXXXXXX..XXXXXXX 100644 | ||
188 | --- a/hw/intc/bcm2835_ic.c | ||
189 | +++ b/hw/intc/bcm2835_ic.c | ||
190 | @@ -XXX,XX +XXX,XX @@ static void bcm2835_ic_class_init(ObjectClass *klass, void *data) | ||
191 | dc->vmsd = &vmstate_bcm2835_ic; | ||
192 | } | ||
193 | |||
194 | -static TypeInfo bcm2835_ic_info = { | ||
195 | +static const TypeInfo bcm2835_ic_info = { | ||
196 | .name = TYPE_BCM2835_IC, | ||
197 | .parent = TYPE_SYS_BUS_DEVICE, | ||
198 | .instance_size = sizeof(BCM2835ICState), | ||
199 | diff --git a/hw/intc/bcm2836_control.c b/hw/intc/bcm2836_control.c | ||
200 | index XXXXXXX..XXXXXXX 100644 | ||
201 | --- a/hw/intc/bcm2836_control.c | ||
202 | +++ b/hw/intc/bcm2836_control.c | ||
203 | @@ -XXX,XX +XXX,XX @@ static void bcm2836_control_class_init(ObjectClass *klass, void *data) | ||
204 | dc->vmsd = &vmstate_bcm2836_control; | ||
205 | } | ||
206 | |||
207 | -static TypeInfo bcm2836_control_info = { | ||
208 | +static const TypeInfo bcm2836_control_info = { | ||
209 | .name = TYPE_BCM2836_CONTROL, | ||
210 | .parent = TYPE_SYS_BUS_DEVICE, | ||
211 | .instance_size = sizeof(BCM2836ControlState), | ||
212 | diff --git a/hw/ipmi/ipmi.c b/hw/ipmi/ipmi.c | ||
213 | index XXXXXXX..XXXXXXX 100644 | ||
214 | --- a/hw/ipmi/ipmi.c | ||
215 | +++ b/hw/ipmi/ipmi.c | ||
216 | @@ -XXX,XX +XXX,XX @@ static void ipmi_interface_class_init(ObjectClass *class, void *data) | ||
217 | ik->do_hw_op = ipmi_do_hw_op; | ||
218 | } | ||
219 | |||
220 | -static TypeInfo ipmi_interface_type_info = { | ||
221 | +static const TypeInfo ipmi_interface_type_info = { | ||
222 | .name = TYPE_IPMI_INTERFACE, | ||
223 | .parent = TYPE_INTERFACE, | ||
224 | .class_size = sizeof(IPMIInterfaceClass), | ||
225 | @@ -XXX,XX +XXX,XX @@ static void bmc_class_init(ObjectClass *oc, void *data) | ||
226 | device_class_set_props(dc, ipmi_bmc_properties); | ||
227 | } | ||
228 | |||
229 | -static TypeInfo ipmi_bmc_type_info = { | ||
230 | +static const TypeInfo ipmi_bmc_type_info = { | ||
231 | .name = TYPE_IPMI_BMC, | ||
232 | .parent = TYPE_DEVICE, | ||
233 | .instance_size = sizeof(IPMIBmc), | ||
234 | diff --git a/hw/mem/nvdimm.c b/hw/mem/nvdimm.c | ||
235 | index XXXXXXX..XXXXXXX 100644 | ||
236 | --- a/hw/mem/nvdimm.c | ||
237 | +++ b/hw/mem/nvdimm.c | ||
238 | @@ -XXX,XX +XXX,XX @@ static void nvdimm_class_init(ObjectClass *oc, void *data) | ||
239 | set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); | ||
240 | } | ||
241 | |||
242 | -static TypeInfo nvdimm_info = { | ||
243 | +static const TypeInfo nvdimm_info = { | ||
244 | .name = TYPE_NVDIMM, | ||
245 | .parent = TYPE_PC_DIMM, | ||
246 | .class_size = sizeof(NVDIMMClass), | ||
247 | diff --git a/hw/mem/pc-dimm.c b/hw/mem/pc-dimm.c | ||
248 | index XXXXXXX..XXXXXXX 100644 | ||
249 | --- a/hw/mem/pc-dimm.c | ||
250 | +++ b/hw/mem/pc-dimm.c | ||
251 | @@ -XXX,XX +XXX,XX @@ static void pc_dimm_class_init(ObjectClass *oc, void *data) | ||
252 | mdc->fill_device_info = pc_dimm_md_fill_device_info; | ||
253 | } | ||
254 | |||
255 | -static TypeInfo pc_dimm_info = { | ||
256 | +static const TypeInfo pc_dimm_info = { | ||
257 | .name = TYPE_PC_DIMM, | ||
258 | .parent = TYPE_DEVICE, | ||
259 | .instance_size = sizeof(PCDIMMDevice), | ||
260 | diff --git a/hw/misc/bcm2835_mbox.c b/hw/misc/bcm2835_mbox.c | ||
261 | index XXXXXXX..XXXXXXX 100644 | ||
262 | --- a/hw/misc/bcm2835_mbox.c | ||
263 | +++ b/hw/misc/bcm2835_mbox.c | ||
264 | @@ -XXX,XX +XXX,XX @@ static void bcm2835_mbox_class_init(ObjectClass *klass, void *data) | ||
265 | dc->vmsd = &vmstate_bcm2835_mbox; | ||
266 | } | ||
267 | |||
268 | -static TypeInfo bcm2835_mbox_info = { | ||
269 | +static const TypeInfo bcm2835_mbox_info = { | ||
270 | .name = TYPE_BCM2835_MBOX, | ||
271 | .parent = TYPE_SYS_BUS_DEVICE, | ||
272 | .instance_size = sizeof(BCM2835MboxState), | ||
273 | diff --git a/hw/misc/bcm2835_powermgt.c b/hw/misc/bcm2835_powermgt.c | ||
274 | index XXXXXXX..XXXXXXX 100644 | ||
275 | --- a/hw/misc/bcm2835_powermgt.c | ||
276 | +++ b/hw/misc/bcm2835_powermgt.c | ||
277 | @@ -XXX,XX +XXX,XX @@ static void bcm2835_powermgt_class_init(ObjectClass *klass, void *data) | ||
278 | dc->vmsd = &vmstate_bcm2835_powermgt; | ||
279 | } | ||
280 | |||
281 | -static TypeInfo bcm2835_powermgt_info = { | ||
282 | +static const TypeInfo bcm2835_powermgt_info = { | ||
283 | .name = TYPE_BCM2835_POWERMGT, | ||
284 | .parent = TYPE_SYS_BUS_DEVICE, | ||
285 | .instance_size = sizeof(BCM2835PowerMgtState), | ||
286 | diff --git a/hw/misc/bcm2835_property.c b/hw/misc/bcm2835_property.c | ||
287 | index XXXXXXX..XXXXXXX 100644 | ||
288 | --- a/hw/misc/bcm2835_property.c | ||
289 | +++ b/hw/misc/bcm2835_property.c | ||
290 | @@ -XXX,XX +XXX,XX @@ static void bcm2835_property_class_init(ObjectClass *klass, void *data) | ||
291 | dc->vmsd = &vmstate_bcm2835_property; | ||
292 | } | ||
293 | |||
294 | -static TypeInfo bcm2835_property_info = { | ||
295 | +static const TypeInfo bcm2835_property_info = { | ||
296 | .name = TYPE_BCM2835_PROPERTY, | ||
297 | .parent = TYPE_SYS_BUS_DEVICE, | ||
298 | .instance_size = sizeof(BCM2835PropertyState), | ||
299 | diff --git a/hw/misc/bcm2835_rng.c b/hw/misc/bcm2835_rng.c | ||
300 | index XXXXXXX..XXXXXXX 100644 | ||
301 | --- a/hw/misc/bcm2835_rng.c | ||
302 | +++ b/hw/misc/bcm2835_rng.c | ||
303 | @@ -XXX,XX +XXX,XX @@ static void bcm2835_rng_class_init(ObjectClass *klass, void *data) | ||
304 | dc->vmsd = &vmstate_bcm2835_rng; | ||
305 | } | ||
306 | |||
307 | -static TypeInfo bcm2835_rng_info = { | ||
308 | +static const TypeInfo bcm2835_rng_info = { | ||
309 | .name = TYPE_BCM2835_RNG, | ||
310 | .parent = TYPE_SYS_BUS_DEVICE, | ||
311 | .instance_size = sizeof(BCM2835RngState), | ||
312 | diff --git a/hw/misc/pvpanic-isa.c b/hw/misc/pvpanic-isa.c | ||
313 | index XXXXXXX..XXXXXXX 100644 | ||
314 | --- a/hw/misc/pvpanic-isa.c | ||
315 | +++ b/hw/misc/pvpanic-isa.c | ||
316 | @@ -XXX,XX +XXX,XX @@ static void pvpanic_isa_class_init(ObjectClass *klass, void *data) | ||
317 | set_bit(DEVICE_CATEGORY_MISC, dc->categories); | ||
318 | } | ||
319 | |||
320 | -static TypeInfo pvpanic_isa_info = { | ||
321 | +static const TypeInfo pvpanic_isa_info = { | ||
322 | .name = TYPE_PVPANIC_ISA_DEVICE, | ||
323 | .parent = TYPE_ISA_DEVICE, | ||
324 | .instance_size = sizeof(PVPanicISAState), | ||
325 | diff --git a/hw/misc/pvpanic-pci.c b/hw/misc/pvpanic-pci.c | ||
326 | index XXXXXXX..XXXXXXX 100644 | ||
327 | --- a/hw/misc/pvpanic-pci.c | ||
328 | +++ b/hw/misc/pvpanic-pci.c | ||
329 | @@ -XXX,XX +XXX,XX @@ static void pvpanic_pci_class_init(ObjectClass *klass, void *data) | ||
330 | set_bit(DEVICE_CATEGORY_MISC, dc->categories); | ||
331 | } | ||
332 | |||
333 | -static TypeInfo pvpanic_pci_info = { | ||
334 | +static const TypeInfo pvpanic_pci_info = { | ||
335 | .name = TYPE_PVPANIC_PCI_DEVICE, | ||
336 | .parent = TYPE_PCI_DEVICE, | ||
337 | .instance_size = sizeof(PVPanicPCIState), | ||
338 | diff --git a/hw/net/fsl_etsec/etsec.c b/hw/net/fsl_etsec/etsec.c | ||
339 | index XXXXXXX..XXXXXXX 100644 | ||
340 | --- a/hw/net/fsl_etsec/etsec.c | ||
341 | +++ b/hw/net/fsl_etsec/etsec.c | ||
342 | @@ -XXX,XX +XXX,XX @@ static void etsec_class_init(ObjectClass *klass, void *data) | ||
343 | dc->user_creatable = true; | ||
344 | } | ||
345 | |||
346 | -static TypeInfo etsec_info = { | ||
347 | +static const TypeInfo etsec_info = { | ||
348 | .name = TYPE_ETSEC_COMMON, | ||
349 | .parent = TYPE_SYS_BUS_DEVICE, | ||
350 | .instance_size = sizeof(eTSEC), | ||
351 | diff --git a/hw/ppc/prep_systemio.c b/hw/ppc/prep_systemio.c | ||
352 | index XXXXXXX..XXXXXXX 100644 | ||
353 | --- a/hw/ppc/prep_systemio.c | ||
354 | +++ b/hw/ppc/prep_systemio.c | ||
355 | @@ -XXX,XX +XXX,XX @@ static void prep_systemio_class_initfn(ObjectClass *klass, void *data) | ||
356 | device_class_set_props(dc, prep_systemio_properties); | ||
357 | } | ||
358 | |||
359 | -static TypeInfo prep_systemio800_info = { | ||
360 | +static const TypeInfo prep_systemio800_info = { | ||
361 | .name = TYPE_PREP_SYSTEMIO, | ||
362 | .parent = TYPE_ISA_DEVICE, | ||
363 | .instance_size = sizeof(PrepSystemIoState), | ||
364 | diff --git a/hw/ppc/spapr_iommu.c b/hw/ppc/spapr_iommu.c | ||
365 | index XXXXXXX..XXXXXXX 100644 | ||
366 | --- a/hw/ppc/spapr_iommu.c | ||
367 | +++ b/hw/ppc/spapr_iommu.c | ||
368 | @@ -XXX,XX +XXX,XX @@ static void spapr_tce_table_class_init(ObjectClass *klass, void *data) | ||
369 | spapr_register_hypercall(H_STUFF_TCE, h_stuff_tce); | ||
370 | } | ||
371 | |||
372 | -static TypeInfo spapr_tce_table_info = { | ||
373 | +static const TypeInfo spapr_tce_table_info = { | ||
374 | .name = TYPE_SPAPR_TCE_TABLE, | ||
375 | .parent = TYPE_DEVICE, | ||
376 | .instance_size = sizeof(SpaprTceTable), | ||
377 | diff --git a/hw/s390x/s390-pci-bus.c b/hw/s390x/s390-pci-bus.c | ||
378 | index XXXXXXX..XXXXXXX 100644 | ||
379 | --- a/hw/s390x/s390-pci-bus.c | ||
380 | +++ b/hw/s390x/s390-pci-bus.c | ||
381 | @@ -XXX,XX +XXX,XX @@ static const TypeInfo s390_pci_device_info = { | ||
382 | .class_init = s390_pci_device_class_init, | ||
383 | }; | ||
384 | |||
385 | -static TypeInfo s390_pci_iommu_info = { | ||
386 | +static const TypeInfo s390_pci_iommu_info = { | ||
387 | .name = TYPE_S390_PCI_IOMMU, | ||
388 | .parent = TYPE_OBJECT, | ||
389 | .instance_size = sizeof(S390PCIIOMMU), | ||
390 | diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c | ||
391 | index XXXXXXX..XXXXXXX 100644 | ||
392 | --- a/hw/s390x/sclp.c | ||
393 | +++ b/hw/s390x/sclp.c | ||
394 | @@ -XXX,XX +XXX,XX @@ static void sclp_class_init(ObjectClass *oc, void *data) | ||
395 | sc->service_interrupt = service_interrupt; | ||
396 | } | ||
397 | |||
398 | -static TypeInfo sclp_info = { | ||
399 | +static const TypeInfo sclp_info = { | ||
400 | .name = TYPE_SCLP, | ||
401 | .parent = TYPE_DEVICE, | ||
402 | .instance_init = sclp_init, | ||
403 | diff --git a/hw/s390x/tod-kvm.c b/hw/s390x/tod-kvm.c | ||
404 | index XXXXXXX..XXXXXXX 100644 | ||
405 | --- a/hw/s390x/tod-kvm.c | ||
406 | +++ b/hw/s390x/tod-kvm.c | ||
407 | @@ -XXX,XX +XXX,XX @@ static void kvm_s390_tod_init(Object *obj) | ||
408 | td->stopped = false; | ||
409 | } | ||
410 | |||
411 | -static TypeInfo kvm_s390_tod_info = { | ||
412 | +static const TypeInfo kvm_s390_tod_info = { | ||
413 | .name = TYPE_KVM_S390_TOD, | ||
414 | .parent = TYPE_S390_TOD, | ||
415 | .instance_size = sizeof(S390TODState), | ||
416 | diff --git a/hw/s390x/tod-tcg.c b/hw/s390x/tod-tcg.c | ||
417 | index XXXXXXX..XXXXXXX 100644 | ||
418 | --- a/hw/s390x/tod-tcg.c | ||
419 | +++ b/hw/s390x/tod-tcg.c | ||
420 | @@ -XXX,XX +XXX,XX @@ static void qemu_s390_tod_init(Object *obj) | ||
421 | } | ||
422 | } | ||
423 | |||
424 | -static TypeInfo qemu_s390_tod_info = { | ||
425 | +static const TypeInfo qemu_s390_tod_info = { | ||
426 | .name = TYPE_QEMU_S390_TOD, | ||
427 | .parent = TYPE_S390_TOD, | ||
428 | .instance_size = sizeof(S390TODState), | ||
429 | diff --git a/hw/s390x/tod.c b/hw/s390x/tod.c | ||
430 | index XXXXXXX..XXXXXXX 100644 | ||
431 | --- a/hw/s390x/tod.c | ||
432 | +++ b/hw/s390x/tod.c | ||
433 | @@ -XXX,XX +XXX,XX @@ static void s390_tod_class_init(ObjectClass *oc, void *data) | ||
434 | dc->user_creatable = false; | ||
435 | } | ||
436 | |||
437 | -static TypeInfo s390_tod_info = { | ||
438 | +static const TypeInfo s390_tod_info = { | ||
439 | .name = TYPE_S390_TOD, | ||
440 | .parent = TYPE_DEVICE, | ||
441 | .instance_size = sizeof(S390TODState), | ||
442 | diff --git a/hw/scsi/lsi53c895a.c b/hw/scsi/lsi53c895a.c | ||
443 | index XXXXXXX..XXXXXXX 100644 | ||
444 | --- a/hw/scsi/lsi53c895a.c | ||
445 | +++ b/hw/scsi/lsi53c895a.c | ||
446 | @@ -XXX,XX +XXX,XX @@ static void lsi53c810_class_init(ObjectClass *klass, void *data) | ||
447 | k->device_id = PCI_DEVICE_ID_LSI_53C810; | ||
448 | } | ||
449 | |||
450 | -static TypeInfo lsi53c810_info = { | ||
451 | +static const TypeInfo lsi53c810_info = { | ||
452 | .name = TYPE_LSI53C810, | ||
453 | .parent = TYPE_LSI53C895A, | ||
454 | .class_init = lsi53c810_class_init, | ||
455 | diff --git a/hw/sd/allwinner-sdhost.c b/hw/sd/allwinner-sdhost.c | ||
456 | index XXXXXXX..XXXXXXX 100644 | ||
457 | --- a/hw/sd/allwinner-sdhost.c | ||
458 | +++ b/hw/sd/allwinner-sdhost.c | ||
459 | @@ -XXX,XX +XXX,XX @@ static void allwinner_sdhost_sun5i_class_init(ObjectClass *klass, void *data) | ||
460 | sc->max_desc_size = 64 * KiB; | ||
461 | } | ||
462 | |||
463 | -static TypeInfo allwinner_sdhost_info = { | ||
464 | +static const TypeInfo allwinner_sdhost_info = { | ||
465 | .name = TYPE_AW_SDHOST, | ||
466 | .parent = TYPE_SYS_BUS_DEVICE, | ||
467 | .instance_init = allwinner_sdhost_init, | ||
468 | diff --git a/hw/sd/aspeed_sdhci.c b/hw/sd/aspeed_sdhci.c | ||
469 | index XXXXXXX..XXXXXXX 100644 | ||
470 | --- a/hw/sd/aspeed_sdhci.c | ||
471 | +++ b/hw/sd/aspeed_sdhci.c | ||
472 | @@ -XXX,XX +XXX,XX @@ static void aspeed_sdhci_class_init(ObjectClass *classp, void *data) | ||
473 | device_class_set_props(dc, aspeed_sdhci_properties); | ||
474 | } | ||
475 | |||
476 | -static TypeInfo aspeed_sdhci_info = { | ||
477 | +static const TypeInfo aspeed_sdhci_info = { | ||
478 | .name = TYPE_ASPEED_SDHCI, | ||
479 | .parent = TYPE_SYS_BUS_DEVICE, | ||
480 | .instance_size = sizeof(AspeedSDHCIState), | ||
481 | diff --git a/hw/sd/bcm2835_sdhost.c b/hw/sd/bcm2835_sdhost.c | ||
482 | index XXXXXXX..XXXXXXX 100644 | ||
483 | --- a/hw/sd/bcm2835_sdhost.c | ||
484 | +++ b/hw/sd/bcm2835_sdhost.c | ||
485 | @@ -XXX,XX +XXX,XX @@ static void bcm2835_sdhost_class_init(ObjectClass *klass, void *data) | ||
486 | dc->vmsd = &vmstate_bcm2835_sdhost; | ||
487 | } | ||
488 | |||
489 | -static TypeInfo bcm2835_sdhost_info = { | ||
490 | +static const TypeInfo bcm2835_sdhost_info = { | ||
491 | .name = TYPE_BCM2835_SDHOST, | ||
492 | .parent = TYPE_SYS_BUS_DEVICE, | ||
493 | .instance_size = sizeof(BCM2835SDHostState), | ||
494 | diff --git a/hw/sd/cadence_sdhci.c b/hw/sd/cadence_sdhci.c | ||
495 | index XXXXXXX..XXXXXXX 100644 | ||
496 | --- a/hw/sd/cadence_sdhci.c | ||
497 | +++ b/hw/sd/cadence_sdhci.c | ||
498 | @@ -XXX,XX +XXX,XX @@ static void cadence_sdhci_class_init(ObjectClass *classp, void *data) | ||
499 | dc->vmsd = &vmstate_cadence_sdhci; | ||
500 | } | ||
501 | |||
502 | -static TypeInfo cadence_sdhci_info = { | ||
503 | +static const TypeInfo cadence_sdhci_info = { | ||
504 | .name = TYPE_CADENCE_SDHCI, | ||
505 | .parent = TYPE_SYS_BUS_DEVICE, | ||
506 | .instance_size = sizeof(CadenceSDHCIState), | ||
507 | diff --git a/hw/sd/npcm7xx_sdhci.c b/hw/sd/npcm7xx_sdhci.c | ||
508 | index XXXXXXX..XXXXXXX 100644 | ||
509 | --- a/hw/sd/npcm7xx_sdhci.c | ||
510 | +++ b/hw/sd/npcm7xx_sdhci.c | ||
511 | @@ -XXX,XX +XXX,XX @@ static void npcm7xx_sdhci_instance_init(Object *obj) | ||
512 | TYPE_SYSBUS_SDHCI); | ||
513 | } | ||
514 | |||
515 | -static TypeInfo npcm7xx_sdhci_info = { | ||
516 | +static const TypeInfo npcm7xx_sdhci_info = { | ||
517 | .name = TYPE_NPCM7XX_SDHCI, | ||
518 | .parent = TYPE_SYS_BUS_DEVICE, | ||
519 | .instance_size = sizeof(NPCM7xxSDHCIState), | ||
520 | diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c | ||
521 | index XXXXXXX..XXXXXXX 100644 | ||
522 | --- a/hw/usb/dev-mtp.c | ||
523 | +++ b/hw/usb/dev-mtp.c | ||
524 | @@ -XXX,XX +XXX,XX @@ static void usb_mtp_class_initfn(ObjectClass *klass, void *data) | ||
525 | device_class_set_props(dc, mtp_properties); | ||
526 | } | ||
527 | |||
528 | -static TypeInfo mtp_info = { | ||
529 | +static const TypeInfo mtp_info = { | ||
530 | .name = TYPE_USB_MTP, | ||
531 | .parent = TYPE_USB_DEVICE, | ||
532 | .instance_size = sizeof(MTPState), | ||
533 | diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c | ||
534 | index XXXXXXX..XXXXXXX 100644 | ||
535 | --- a/hw/usb/host-libusb.c | ||
536 | +++ b/hw/usb/host-libusb.c | ||
537 | @@ -XXX,XX +XXX,XX @@ static void usb_host_class_initfn(ObjectClass *klass, void *data) | ||
538 | set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories); | ||
539 | } | ||
540 | |||
541 | -static TypeInfo usb_host_dev_info = { | ||
542 | +static const TypeInfo usb_host_dev_info = { | ||
543 | .name = TYPE_USB_HOST_DEVICE, | ||
544 | .parent = TYPE_USB_DEVICE, | ||
545 | .instance_size = sizeof(USBHostDevice), | ||
546 | diff --git a/hw/vfio/igd.c b/hw/vfio/igd.c | ||
547 | index XXXXXXX..XXXXXXX 100644 | ||
548 | --- a/hw/vfio/igd.c | ||
549 | +++ b/hw/vfio/igd.c | ||
550 | @@ -XXX,XX +XXX,XX @@ static void vfio_pci_igd_lpc_bridge_class_init(ObjectClass *klass, void *data) | ||
551 | k->class_id = PCI_CLASS_BRIDGE_ISA; | ||
552 | } | ||
553 | |||
554 | -static TypeInfo vfio_pci_igd_lpc_bridge_info = { | ||
555 | +static const TypeInfo vfio_pci_igd_lpc_bridge_info = { | ||
556 | .name = "vfio-pci-igd-lpc-bridge", | ||
557 | .parent = TYPE_PCI_DEVICE, | ||
558 | .class_init = vfio_pci_igd_lpc_bridge_class_init, | ||
559 | diff --git a/hw/virtio/virtio-pmem.c b/hw/virtio/virtio-pmem.c | ||
560 | index XXXXXXX..XXXXXXX 100644 | ||
561 | --- a/hw/virtio/virtio-pmem.c | ||
562 | +++ b/hw/virtio/virtio-pmem.c | ||
563 | @@ -XXX,XX +XXX,XX @@ static void virtio_pmem_class_init(ObjectClass *klass, void *data) | ||
564 | set_bit(DEVICE_CATEGORY_STORAGE, dc->categories); | ||
565 | } | ||
566 | |||
567 | -static TypeInfo virtio_pmem_info = { | ||
568 | +static const TypeInfo virtio_pmem_info = { | ||
569 | .name = TYPE_VIRTIO_PMEM, | ||
570 | .parent = TYPE_VIRTIO_DEVICE, | ||
571 | .class_size = sizeof(VirtIOPMEMClass), | ||
572 | diff --git a/qom/object.c b/qom/object.c | ||
573 | index XXXXXXX..XXXXXXX 100644 | ||
574 | --- a/qom/object.c | ||
575 | +++ b/qom/object.c | ||
576 | @@ -XXX,XX +XXX,XX @@ static void object_class_init(ObjectClass *klass, void *data) | ||
577 | |||
578 | static void register_types(void) | ||
579 | { | ||
580 | - static TypeInfo interface_info = { | ||
581 | + static const TypeInfo interface_info = { | ||
582 | .name = TYPE_INTERFACE, | ||
583 | .class_size = sizeof(InterfaceClass), | ||
584 | .abstract = true, | ||
585 | }; | ||
586 | |||
587 | - static TypeInfo object_info = { | ||
588 | + static const TypeInfo object_info = { | ||
589 | .name = TYPE_OBJECT, | ||
590 | .instance_size = sizeof(Object), | ||
591 | .class_init = object_class_init, | ||
62 | -- | 592 | -- |
63 | 2.20.1 | 593 | 2.25.1 |
64 | 594 | ||
65 | 595 | diff view generated by jsdifflib |
1 | From: Bin Meng <bin.meng@windriver.com> | 1 | From: Bernhard Beschow <shentey@gmail.com> |
---|---|---|---|
2 | 2 | ||
3 | U-Boot expects PMU_MISC0 register bit 7 is set (see init_bandgap() | 3 | Now that all static TypeInfo instances are declared const, prevent that |
4 | in arch/arm/mach-imx/mx6/soc.c) during boot. This bit indicates the | 4 | new non-const instances are created. |
5 | bandgap has stabilized. | ||
6 | 5 | ||
7 | With this change, the latest upstream U-Boot (v2021.01-rc3) for imx6 | 6 | Signed-off-by: Bernhard Beschow <shentey@gmail.com> |
8 | sabrelite board (mx6qsabrelite_defconfig), with a slight change made | 7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
9 | by switching CONFIG_OF_SEPARATE to CONFIG_OF_EMBED, boots to U-Boot | 8 | Message-id: 20220117145805.173070-3-shentey@gmail.com |
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> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
54 | --- | 10 | --- |
55 | hw/misc/imx6_ccm.c | 2 +- | 11 | scripts/checkpatch.pl | 1 + |
56 | 1 file changed, 1 insertion(+), 1 deletion(-) | 12 | 1 file changed, 1 insertion(+) |
57 | 13 | ||
58 | diff --git a/hw/misc/imx6_ccm.c b/hw/misc/imx6_ccm.c | 14 | diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl |
59 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100755 |
60 | --- a/hw/misc/imx6_ccm.c | 16 | --- a/scripts/checkpatch.pl |
61 | +++ b/hw/misc/imx6_ccm.c | 17 | +++ b/scripts/checkpatch.pl |
62 | @@ -XXX,XX +XXX,XX @@ static void imx6_ccm_reset(DeviceState *dev) | 18 | @@ -XXX,XX +XXX,XX @@ sub process { |
63 | s->analog[PMU_REG_3P0] = 0x00000F74; | 19 | SCSIBusInfo| |
64 | s->analog[PMU_REG_2P5] = 0x00005071; | 20 | SCSIReqOps| |
65 | s->analog[PMU_REG_CORE] = 0x00402010; | 21 | Spice[A-Z][a-zA-Z0-9]*Interface| |
66 | - s->analog[PMU_MISC0] = 0x04000000; | 22 | + TypeInfo| |
67 | + s->analog[PMU_MISC0] = 0x04000080; | 23 | USBDesc[A-Z][a-zA-Z0-9]*| |
68 | s->analog[PMU_MISC1] = 0x00000000; | 24 | VhostOps| |
69 | s->analog[PMU_MISC2] = 0x00272727; | 25 | VMStateDescription| |
70 | |||
71 | -- | 26 | -- |
72 | 2.20.1 | 27 | 2.25.1 |
73 | 28 | ||
74 | 29 | diff view generated by jsdifflib |
1 | Implement the v8.1M FPCXT_NS floating-point system register. This is | 1 | Now that KVM has dropped AArch32 host support, the 'host' CPU type is |
---|---|---|---|
2 | a little more complicated than FPCXT_S, because it has specific | 2 | always AArch64, and we can move it to cpu64.c. This move will allow |
3 | handling for "current FP state is inactive", and it only wants to do | 3 | us to share code between it and '-cpu max', which should behave |
4 | PreserveFPState(), not the full set of actions done by | 4 | the same as '-cpu host' when using KVM or HVF. |
5 | ExecuteFPCheck() which vfp_access_check() implements. | ||
6 | 5 | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
8 | Reviewed-by: Andrew Jones <drjones@redhat.com> | ||
9 | Reviewed-by: Alexander Graf <agraf@csgraf.de> | ||
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 10 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
9 | Message-id: 20201210201433.26262-4-peter.maydell@linaro.org | 11 | Message-id: 20220204165506.2846058-2-peter.maydell@linaro.org |
10 | --- | 12 | --- |
11 | target/arm/translate-vfp.c.inc | 102 ++++++++++++++++++++++++++++++++- | 13 | target/arm/cpu.c | 30 ------------------------------ |
12 | 1 file changed, 99 insertions(+), 3 deletions(-) | 14 | target/arm/cpu64.c | 30 ++++++++++++++++++++++++++++++ |
15 | 2 files changed, 30 insertions(+), 30 deletions(-) | ||
13 | 16 | ||
14 | diff --git a/target/arm/translate-vfp.c.inc b/target/arm/translate-vfp.c.inc | 17 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c |
15 | index XXXXXXX..XXXXXXX 100644 | 18 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/target/arm/translate-vfp.c.inc | 19 | --- a/target/arm/cpu.c |
17 | +++ b/target/arm/translate-vfp.c.inc | 20 | +++ b/target/arm/cpu.c |
18 | @@ -XXX,XX +XXX,XX @@ static FPSysRegCheckResult fp_sysreg_checks(DisasContext *s, int regno) | 21 | @@ -XXX,XX +XXX,XX @@ |
19 | } | 22 | #include "sysemu/tcg.h" |
20 | break; | 23 | #include "sysemu/hw_accel.h" |
21 | case ARM_VFP_FPCXT_S: | 24 | #include "kvm_arm.h" |
22 | + case ARM_VFP_FPCXT_NS: | 25 | -#include "hvf_arm.h" |
23 | if (!arm_dc_feature(s, ARM_FEATURE_V8_1M)) { | 26 | #include "disas/capstone.h" |
24 | return false; | 27 | #include "fpu/softfloat.h" |
25 | } | 28 | |
26 | @@ -XXX,XX +XXX,XX @@ static FPSysRegCheckResult fp_sysreg_checks(DisasContext *s, int regno) | 29 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_class_init(ObjectClass *oc, void *data) |
27 | return FPSysRegCheckFailed; | 30 | #endif /* CONFIG_TCG */ |
31 | } | ||
32 | |||
33 | -#if defined(CONFIG_KVM) || defined(CONFIG_HVF) | ||
34 | -static void arm_host_initfn(Object *obj) | ||
35 | -{ | ||
36 | - ARMCPU *cpu = ARM_CPU(obj); | ||
37 | - | ||
38 | -#ifdef CONFIG_KVM | ||
39 | - kvm_arm_set_cpu_features_from_host(cpu); | ||
40 | - if (arm_feature(&cpu->env, ARM_FEATURE_AARCH64)) { | ||
41 | - aarch64_add_sve_properties(obj); | ||
42 | - aarch64_add_pauth_properties(obj); | ||
43 | - } | ||
44 | -#else | ||
45 | - hvf_arm_set_cpu_features_from_host(cpu); | ||
46 | -#endif | ||
47 | - arm_cpu_post_init(obj); | ||
48 | -} | ||
49 | - | ||
50 | -static const TypeInfo host_arm_cpu_type_info = { | ||
51 | - .name = TYPE_ARM_HOST_CPU, | ||
52 | - .parent = TYPE_AARCH64_CPU, | ||
53 | - .instance_init = arm_host_initfn, | ||
54 | -}; | ||
55 | - | ||
56 | -#endif | ||
57 | - | ||
58 | static void arm_cpu_instance_init(Object *obj) | ||
59 | { | ||
60 | ARMCPUClass *acc = ARM_CPU_GET_CLASS(obj); | ||
61 | @@ -XXX,XX +XXX,XX @@ static const TypeInfo arm_cpu_type_info = { | ||
62 | static void arm_cpu_register_types(void) | ||
63 | { | ||
64 | type_register_static(&arm_cpu_type_info); | ||
65 | - | ||
66 | -#if defined(CONFIG_KVM) || defined(CONFIG_HVF) | ||
67 | - type_register_static(&host_arm_cpu_type_info); | ||
68 | -#endif | ||
69 | } | ||
70 | |||
71 | type_init(arm_cpu_register_types) | ||
72 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c | ||
73 | index XXXXXXX..XXXXXXX 100644 | ||
74 | --- a/target/arm/cpu64.c | ||
75 | +++ b/target/arm/cpu64.c | ||
76 | @@ -XXX,XX +XXX,XX @@ | ||
77 | #endif | ||
78 | #include "sysemu/kvm.h" | ||
79 | #include "kvm_arm.h" | ||
80 | +#include "hvf_arm.h" | ||
81 | #include "qapi/visitor.h" | ||
82 | #include "hw/qdev-properties.h" | ||
83 | |||
84 | @@ -XXX,XX +XXX,XX @@ void aarch64_add_pauth_properties(Object *obj) | ||
28 | } | 85 | } |
29 | |||
30 | - if (!vfp_access_check(s)) { | ||
31 | + /* | ||
32 | + * FPCXT_NS is a special case: it has specific handling for | ||
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 | } | 86 | } |
43 | 87 | ||
44 | +static void gen_branch_fpInactive(DisasContext *s, TCGCond cond, | 88 | +#if defined(CONFIG_KVM) || defined(CONFIG_HVF) |
45 | + TCGLabel *label) | 89 | +static void arm_host_initfn(Object *obj) |
46 | +{ | 90 | +{ |
47 | + /* | 91 | + ARMCPU *cpu = ARM_CPU(obj); |
48 | + * FPCXT_NS is a special case: it has specific handling for | ||
49 | + * "current FP state is inactive", and must do the PreserveFPState() | ||
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 | + */ | ||
59 | + assert(cond == TCG_COND_EQ || cond == TCG_COND_NE); | ||
60 | + | 92 | + |
61 | + /* fpInactive = FPCCR_NS.ASPEN == 1 && CONTROL.FPCA == 0 */ | 93 | +#ifdef CONFIG_KVM |
62 | + TCGv_i32 aspen, fpca; | 94 | + kvm_arm_set_cpu_features_from_host(cpu); |
63 | + aspen = load_cpu_field(v7m.fpccr[M_REG_NS]); | 95 | + if (arm_feature(&cpu->env, ARM_FEATURE_AARCH64)) { |
64 | + fpca = load_cpu_field(v7m.control[M_REG_S]); | 96 | + aarch64_add_sve_properties(obj); |
65 | + tcg_gen_andi_i32(aspen, aspen, R_V7M_FPCCR_ASPEN_MASK); | 97 | + aarch64_add_pauth_properties(obj); |
66 | + tcg_gen_xori_i32(aspen, aspen, R_V7M_FPCCR_ASPEN_MASK); | 98 | + } |
67 | + tcg_gen_andi_i32(fpca, fpca, R_V7M_CONTROL_FPCA_MASK); | 99 | +#else |
68 | + tcg_gen_or_i32(fpca, fpca, aspen); | 100 | + hvf_arm_set_cpu_features_from_host(cpu); |
69 | + tcg_gen_brcondi_i32(tcg_invert_cond(cond), fpca, 0, label); | 101 | +#endif |
70 | + tcg_temp_free_i32(aspen); | 102 | + arm_cpu_post_init(obj); |
71 | + tcg_temp_free_i32(fpca); | ||
72 | +} | 103 | +} |
73 | + | 104 | + |
74 | static bool gen_M_fp_sysreg_write(DisasContext *s, int regno, | 105 | +static const TypeInfo host_arm_cpu_type_info = { |
75 | 106 | + .name = TYPE_ARM_HOST_CPU, | |
76 | fp_sysreg_loadfn *loadfn, | 107 | + .parent = TYPE_AARCH64_CPU, |
77 | @@ -XXX,XX +XXX,XX @@ static bool gen_M_fp_sysreg_write(DisasContext *s, int regno, | 108 | + .instance_init = arm_host_initfn, |
78 | { | 109 | +}; |
79 | /* Do a write to an M-profile floating point system register */ | ||
80 | TCGv_i32 tmp; | ||
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 | } | ||
89 | + case ARM_VFP_FPCXT_NS: | ||
90 | + lab_end = gen_new_label(); | ||
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 | } | ||
108 | |||
109 | @@ -XXX,XX +XXX,XX @@ static bool gen_M_fp_sysreg_read(DisasContext *s, int regno, | ||
110 | { | ||
111 | /* Do a read from an M-profile floating point system register */ | ||
112 | TCGv_i32 tmp; | ||
113 | + TCGLabel *lab_end = NULL; | ||
114 | + bool lookup_tb = false; | ||
115 | |||
116 | switch (fp_sysreg_checks(s, regno)) { | ||
117 | case FPSysRegCheckFailed: | ||
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 | + | 110 | + |
131 | + lookup_tb = true; | 111 | +#endif |
132 | + | 112 | + |
133 | + gen_branch_fpInactive(s, TCG_COND_EQ, lab_active); | 113 | /* -cpu max: if KVM is enabled, like -cpu host (best possible with this host); |
134 | + /* fpInactive case: reads as FPDSCR_NS */ | 114 | * otherwise, a CPU with as many features enabled as our emulation supports. |
135 | + TCGv_i32 tmp = load_cpu_field(v7m.fpdscr[M_REG_NS]); | 115 | * The version of '-cpu max' for qemu-system-arm is defined in cpu.c; |
136 | + storefn(s, opaque, tmp); | 116 | @@ -XXX,XX +XXX,XX @@ static void aarch64_cpu_register_types(void) |
137 | + lab_end = gen_new_label(); | 117 | for (i = 0; i < ARRAY_SIZE(aarch64_cpus); ++i) { |
138 | + tcg_gen_br(lab_end); | 118 | aarch64_cpu_register(&aarch64_cpus[i]); |
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 | } | 119 | } |
169 | + | 120 | + |
170 | + if (lab_end) { | 121 | +#if defined(CONFIG_KVM) || defined(CONFIG_HVF) |
171 | + gen_set_label(lab_end); | 122 | + type_register_static(&host_arm_cpu_type_info); |
172 | + } | 123 | +#endif |
173 | + if (lookup_tb) { | ||
174 | + gen_lookup_tb(s); | ||
175 | + } | ||
176 | return true; | ||
177 | } | 124 | } |
178 | 125 | ||
126 | type_init(aarch64_cpu_register_types) | ||
179 | -- | 127 | -- |
180 | 2.20.1 | 128 | 2.25.1 |
181 | 129 | ||
182 | 130 | diff view generated by jsdifflib |
1 | From: Gan Qixin <ganqixin@huawei.com> | 1 | Use the aarch64_cpu_register() machinery to register the 'host' CPU |
---|---|---|---|
2 | type. This doesn't gain us anything functionally, but it does mean | ||
3 | that the code for initializing it looks more like that for the other | ||
4 | CPU types, in that its initfn then doesn't need to call | ||
5 | arm_cpu_post_init() (because aarch64_cpu_instance_init() does that | ||
6 | for it). | ||
2 | 7 | ||
3 | When running device-introspect-test, a memory leak occurred in the | 8 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
4 | mss_timer_init function, so use ptimer_free() in the finalize function to avoid | 9 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
5 | it. | 10 | Reviewed-by: Andrew Jones <drjones@redhat.com> |
11 | Reviewed-by: Alexander Graf <agraf@csgraf.de> | ||
12 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
13 | Message-id: 20220204165506.2846058-3-peter.maydell@linaro.org | ||
14 | --- | ||
15 | target/arm/cpu64.c | 17 ++++------------- | ||
16 | 1 file changed, 4 insertions(+), 13 deletions(-) | ||
6 | 17 | ||
7 | ASAN shows memory leak stack: | 18 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c |
8 | |||
9 | Indirect leak of 192 byte(s) in 2 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 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 | |||
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/mss-timer.c | 13 +++++++++++++ | ||
30 | 1 file changed, 13 insertions(+) | ||
31 | |||
32 | diff --git a/hw/timer/mss-timer.c b/hw/timer/mss-timer.c | ||
33 | index XXXXXXX..XXXXXXX 100644 | 19 | index XXXXXXX..XXXXXXX 100644 |
34 | --- a/hw/timer/mss-timer.c | 20 | --- a/target/arm/cpu64.c |
35 | +++ b/hw/timer/mss-timer.c | 21 | +++ b/target/arm/cpu64.c |
36 | @@ -XXX,XX +XXX,XX @@ static void mss_timer_init(Object *obj) | 22 | @@ -XXX,XX +XXX,XX @@ void aarch64_add_pauth_properties(Object *obj) |
37 | sysbus_init_mmio(SYS_BUS_DEVICE(obj), &t->mmio); | ||
38 | } | 23 | } |
39 | 24 | ||
40 | +static void mss_timer_finalize(Object *obj) | 25 | #if defined(CONFIG_KVM) || defined(CONFIG_HVF) |
41 | +{ | 26 | -static void arm_host_initfn(Object *obj) |
42 | + MSSTimerState *t = MSS_TIMER(obj); | 27 | +static void aarch64_host_initfn(Object *obj) |
43 | + int i; | 28 | { |
44 | + | 29 | ARMCPU *cpu = ARM_CPU(obj); |
45 | + for (i = 0; i < NUM_TIMERS; i++) { | 30 | |
46 | + struct Msf2Timer *st = &t->timers[i]; | 31 | @@ -XXX,XX +XXX,XX @@ static void arm_host_initfn(Object *obj) |
47 | + | 32 | #else |
48 | + ptimer_free(st->ptimer); | 33 | hvf_arm_set_cpu_features_from_host(cpu); |
49 | + } | 34 | #endif |
50 | +} | 35 | - arm_cpu_post_init(obj); |
51 | + | 36 | } |
52 | static const VMStateDescription vmstate_timers = { | 37 | - |
53 | .name = "mss-timer-block", | 38 | -static const TypeInfo host_arm_cpu_type_info = { |
54 | .version_id = 1, | 39 | - .name = TYPE_ARM_HOST_CPU, |
55 | @@ -XXX,XX +XXX,XX @@ static const TypeInfo mss_timer_info = { | 40 | - .parent = TYPE_AARCH64_CPU, |
56 | .parent = TYPE_SYS_BUS_DEVICE, | 41 | - .instance_init = arm_host_initfn, |
57 | .instance_size = sizeof(MSSTimerState), | 42 | -}; |
58 | .instance_init = mss_timer_init, | 43 | - |
59 | + .instance_finalize = mss_timer_finalize, | 44 | #endif |
60 | .class_init = mss_timer_class_init, | 45 | |
46 | /* -cpu max: if KVM is enabled, like -cpu host (best possible with this host); | ||
47 | @@ -XXX,XX +XXX,XX @@ static const ARMCPUInfo aarch64_cpus[] = { | ||
48 | { .name = "cortex-a72", .initfn = aarch64_a72_initfn }, | ||
49 | { .name = "a64fx", .initfn = aarch64_a64fx_initfn }, | ||
50 | { .name = "max", .initfn = aarch64_max_initfn }, | ||
51 | +#if defined(CONFIG_KVM) || defined(CONFIG_HVF) | ||
52 | + { .name = "host", .initfn = aarch64_host_initfn }, | ||
53 | +#endif | ||
61 | }; | 54 | }; |
62 | 55 | ||
56 | static bool aarch64_cpu_get_aarch64(Object *obj, Error **errp) | ||
57 | @@ -XXX,XX +XXX,XX @@ static void aarch64_cpu_register_types(void) | ||
58 | for (i = 0; i < ARRAY_SIZE(aarch64_cpus); ++i) { | ||
59 | aarch64_cpu_register(&aarch64_cpus[i]); | ||
60 | } | ||
61 | - | ||
62 | -#if defined(CONFIG_KVM) || defined(CONFIG_HVF) | ||
63 | - type_register_static(&host_arm_cpu_type_info); | ||
64 | -#endif | ||
65 | } | ||
66 | |||
67 | type_init(aarch64_cpu_register_types) | ||
63 | -- | 68 | -- |
64 | 2.20.1 | 69 | 2.25.1 |
65 | 70 | ||
66 | 71 | diff view generated by jsdifflib |
1 | Now that we have implemented all the features needed by the v8.1M | 1 | Currently for KVM the intention is that '-cpu max' and '-cpu host' |
---|---|---|---|
2 | architecture, we can add the model of the Cortex-M55. This is the | 2 | are the same thing, but because we did this with two separate |
3 | configuration without MVE support; we'll add MVE later. | 3 | pieces of code they have got a little bit out of sync. Specifically, |
4 | 'max' has a 'sve-max-vq' property, and 'host' does not. | ||
5 | |||
6 | Bring the two together by having the initfn for 'max' actually | ||
7 | call the initfn for 'host'. This will result in 'max' no longer | ||
8 | exposing the 'sve-max-vq' property when using KVM. | ||
4 | 9 | ||
5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
12 | Reviewed-by: Andrew Jones <drjones@redhat.com> | ||
13 | Reviewed-by: Alexander Graf <agraf@csgraf.de> | ||
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 14 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
7 | Message-id: 20201210201433.26262-5-peter.maydell@linaro.org | 15 | Message-id: 20220204165506.2846058-4-peter.maydell@linaro.org |
8 | --- | 16 | --- |
9 | target/arm/cpu_tcg.c | 42 ++++++++++++++++++++++++++++++++++++++++++ | 17 | target/arm/cpu64.c | 14 ++++++++------ |
10 | 1 file changed, 42 insertions(+) | 18 | 1 file changed, 8 insertions(+), 6 deletions(-) |
11 | 19 | ||
12 | diff --git a/target/arm/cpu_tcg.c b/target/arm/cpu_tcg.c | 20 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c |
13 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
14 | --- a/target/arm/cpu_tcg.c | 22 | --- a/target/arm/cpu64.c |
15 | +++ b/target/arm/cpu_tcg.c | 23 | +++ b/target/arm/cpu64.c |
16 | @@ -XXX,XX +XXX,XX @@ static void cortex_m33_initfn(Object *obj) | 24 | @@ -XXX,XX +XXX,XX @@ void aarch64_add_pauth_properties(Object *obj) |
17 | cpu->ctr = 0x8000c000; | 25 | } |
18 | } | 26 | } |
19 | 27 | ||
20 | +static void cortex_m55_initfn(Object *obj) | 28 | -#if defined(CONFIG_KVM) || defined(CONFIG_HVF) |
21 | +{ | 29 | static void aarch64_host_initfn(Object *obj) |
30 | { | ||
31 | +#if defined(CONFIG_KVM) | ||
32 | ARMCPU *cpu = ARM_CPU(obj); | ||
33 | - | ||
34 | -#ifdef CONFIG_KVM | ||
35 | kvm_arm_set_cpu_features_from_host(cpu); | ||
36 | if (arm_feature(&cpu->env, ARM_FEATURE_AARCH64)) { | ||
37 | aarch64_add_sve_properties(obj); | ||
38 | aarch64_add_pauth_properties(obj); | ||
39 | } | ||
40 | -#else | ||
41 | +#elif defined(CONFIG_HVF) | ||
22 | + ARMCPU *cpu = ARM_CPU(obj); | 42 | + ARMCPU *cpu = ARM_CPU(obj); |
23 | + | 43 | hvf_arm_set_cpu_features_from_host(cpu); |
24 | + set_feature(&cpu->env, ARM_FEATURE_V8); | 44 | +#else |
25 | + set_feature(&cpu->env, ARM_FEATURE_V8_1M); | 45 | + g_assert_not_reached(); |
26 | + set_feature(&cpu->env, ARM_FEATURE_M); | 46 | #endif |
27 | + set_feature(&cpu->env, ARM_FEATURE_M_MAIN); | 47 | } |
28 | + set_feature(&cpu->env, ARM_FEATURE_M_SECURITY); | 48 | -#endif |
29 | + set_feature(&cpu->env, ARM_FEATURE_THUMB_DSP); | 49 | |
30 | + cpu->midr = 0x410fd221; /* r0p1 */ | 50 | /* -cpu max: if KVM is enabled, like -cpu host (best possible with this host); |
31 | + cpu->revidr = 0; | 51 | * otherwise, a CPU with as many features enabled as our emulation supports. |
32 | + cpu->pmsav7_dregion = 16; | 52 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) |
33 | + cpu->sau_sregion = 8; | 53 | ARMCPU *cpu = ARM_CPU(obj); |
34 | + /* | 54 | |
35 | + * These are the MVFR* values for the FPU, no MVE configuration; | 55 | if (kvm_enabled()) { |
36 | + * we will update them later when we implement MVE | 56 | - kvm_arm_set_cpu_features_from_host(cpu); |
37 | + */ | 57 | + /* With KVM, '-cpu max' is identical to '-cpu host' */ |
38 | + cpu->isar.mvfr0 = 0x10110221; | 58 | + aarch64_host_initfn(obj); |
39 | + cpu->isar.mvfr1 = 0x12100011; | 59 | + return; |
40 | + cpu->isar.mvfr2 = 0x00000040; | 60 | } else { |
41 | + cpu->isar.id_pfr0 = 0x20000030; | 61 | uint64_t t; |
42 | + cpu->isar.id_pfr1 = 0x00000230; | 62 | uint32_t u; |
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 | -- | 63 | -- |
73 | 2.20.1 | 64 | 2.25.1 |
74 | 65 | ||
75 | 66 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | Now that the if() branch of the condition in aarch64_max_initfn() | ||
2 | returns early, we don't need to keep the rest of the code in | ||
3 | the function inside an else block. Remove the else, unindenting | ||
4 | that code. | ||
1 | 5 | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
8 | Reviewed-by: Andrew Jones <drjones@redhat.com> | ||
9 | Reviewed-by: Alexander Graf <agraf@csgraf.de> | ||
10 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
11 | Message-id: 20220204165506.2846058-5-peter.maydell@linaro.org | ||
12 | --- | ||
13 | target/arm/cpu64.c | 289 +++++++++++++++++++++++---------------------- | ||
14 | 1 file changed, 146 insertions(+), 143 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 @@ static void aarch64_host_initfn(Object *obj) | ||
21 | static void aarch64_max_initfn(Object *obj) | ||
22 | { | ||
23 | ARMCPU *cpu = ARM_CPU(obj); | ||
24 | + uint64_t t; | ||
25 | + uint32_t u; | ||
26 | |||
27 | if (kvm_enabled()) { | ||
28 | /* With KVM, '-cpu max' is identical to '-cpu host' */ | ||
29 | aarch64_host_initfn(obj); | ||
30 | return; | ||
31 | - } else { | ||
32 | - uint64_t t; | ||
33 | - uint32_t u; | ||
34 | - aarch64_a57_initfn(obj); | ||
35 | + } | ||
36 | |||
37 | - /* | ||
38 | - * Reset MIDR so the guest doesn't mistake our 'max' CPU type for a real | ||
39 | - * one and try to apply errata workarounds or use impdef features we | ||
40 | - * don't provide. | ||
41 | - * An IMPLEMENTER field of 0 means "reserved for software use"; | ||
42 | - * ARCHITECTURE must be 0xf indicating "v7 or later, check ID registers | ||
43 | - * to see which features are present"; | ||
44 | - * the VARIANT, PARTNUM and REVISION fields are all implementation | ||
45 | - * defined and we choose to define PARTNUM just in case guest | ||
46 | - * code needs to distinguish this QEMU CPU from other software | ||
47 | - * implementations, though this shouldn't be needed. | ||
48 | - */ | ||
49 | - t = FIELD_DP64(0, MIDR_EL1, IMPLEMENTER, 0); | ||
50 | - t = FIELD_DP64(t, MIDR_EL1, ARCHITECTURE, 0xf); | ||
51 | - t = FIELD_DP64(t, MIDR_EL1, PARTNUM, 'Q'); | ||
52 | - t = FIELD_DP64(t, MIDR_EL1, VARIANT, 0); | ||
53 | - t = FIELD_DP64(t, MIDR_EL1, REVISION, 0); | ||
54 | - cpu->midr = t; | ||
55 | + /* '-cpu max' for TCG: we currently do this as "A57 with extra things" */ | ||
56 | |||
57 | - t = cpu->isar.id_aa64isar0; | ||
58 | - t = FIELD_DP64(t, ID_AA64ISAR0, AES, 2); /* AES + PMULL */ | ||
59 | - t = FIELD_DP64(t, ID_AA64ISAR0, SHA1, 1); | ||
60 | - t = FIELD_DP64(t, ID_AA64ISAR0, SHA2, 2); /* SHA512 */ | ||
61 | - t = FIELD_DP64(t, ID_AA64ISAR0, CRC32, 1); | ||
62 | - t = FIELD_DP64(t, ID_AA64ISAR0, ATOMIC, 2); | ||
63 | - t = FIELD_DP64(t, ID_AA64ISAR0, RDM, 1); | ||
64 | - t = FIELD_DP64(t, ID_AA64ISAR0, SHA3, 1); | ||
65 | - t = FIELD_DP64(t, ID_AA64ISAR0, SM3, 1); | ||
66 | - t = FIELD_DP64(t, ID_AA64ISAR0, SM4, 1); | ||
67 | - t = FIELD_DP64(t, ID_AA64ISAR0, DP, 1); | ||
68 | - t = FIELD_DP64(t, ID_AA64ISAR0, FHM, 1); | ||
69 | - t = FIELD_DP64(t, ID_AA64ISAR0, TS, 2); /* v8.5-CondM */ | ||
70 | - t = FIELD_DP64(t, ID_AA64ISAR0, TLB, 2); /* FEAT_TLBIRANGE */ | ||
71 | - t = FIELD_DP64(t, ID_AA64ISAR0, RNDR, 1); | ||
72 | - cpu->isar.id_aa64isar0 = t; | ||
73 | + aarch64_a57_initfn(obj); | ||
74 | |||
75 | - t = cpu->isar.id_aa64isar1; | ||
76 | - t = FIELD_DP64(t, ID_AA64ISAR1, DPB, 2); | ||
77 | - t = FIELD_DP64(t, ID_AA64ISAR1, JSCVT, 1); | ||
78 | - t = FIELD_DP64(t, ID_AA64ISAR1, FCMA, 1); | ||
79 | - t = FIELD_DP64(t, ID_AA64ISAR1, SB, 1); | ||
80 | - t = FIELD_DP64(t, ID_AA64ISAR1, SPECRES, 1); | ||
81 | - t = FIELD_DP64(t, ID_AA64ISAR1, BF16, 1); | ||
82 | - t = FIELD_DP64(t, ID_AA64ISAR1, FRINTTS, 1); | ||
83 | - t = FIELD_DP64(t, ID_AA64ISAR1, LRCPC, 2); /* ARMv8.4-RCPC */ | ||
84 | - t = FIELD_DP64(t, ID_AA64ISAR1, I8MM, 1); | ||
85 | - cpu->isar.id_aa64isar1 = t; | ||
86 | + /* | ||
87 | + * Reset MIDR so the guest doesn't mistake our 'max' CPU type for a real | ||
88 | + * one and try to apply errata workarounds or use impdef features we | ||
89 | + * don't provide. | ||
90 | + * An IMPLEMENTER field of 0 means "reserved for software use"; | ||
91 | + * ARCHITECTURE must be 0xf indicating "v7 or later, check ID registers | ||
92 | + * to see which features are present"; | ||
93 | + * the VARIANT, PARTNUM and REVISION fields are all implementation | ||
94 | + * defined and we choose to define PARTNUM just in case guest | ||
95 | + * code needs to distinguish this QEMU CPU from other software | ||
96 | + * implementations, though this shouldn't be needed. | ||
97 | + */ | ||
98 | + t = FIELD_DP64(0, MIDR_EL1, IMPLEMENTER, 0); | ||
99 | + t = FIELD_DP64(t, MIDR_EL1, ARCHITECTURE, 0xf); | ||
100 | + t = FIELD_DP64(t, MIDR_EL1, PARTNUM, 'Q'); | ||
101 | + t = FIELD_DP64(t, MIDR_EL1, VARIANT, 0); | ||
102 | + t = FIELD_DP64(t, MIDR_EL1, REVISION, 0); | ||
103 | + cpu->midr = t; | ||
104 | |||
105 | - t = cpu->isar.id_aa64pfr0; | ||
106 | - t = FIELD_DP64(t, ID_AA64PFR0, SVE, 1); | ||
107 | - t = FIELD_DP64(t, ID_AA64PFR0, FP, 1); | ||
108 | - t = FIELD_DP64(t, ID_AA64PFR0, ADVSIMD, 1); | ||
109 | - t = FIELD_DP64(t, ID_AA64PFR0, SEL2, 1); | ||
110 | - t = FIELD_DP64(t, ID_AA64PFR0, DIT, 1); | ||
111 | - cpu->isar.id_aa64pfr0 = t; | ||
112 | + t = cpu->isar.id_aa64isar0; | ||
113 | + t = FIELD_DP64(t, ID_AA64ISAR0, AES, 2); /* AES + PMULL */ | ||
114 | + t = FIELD_DP64(t, ID_AA64ISAR0, SHA1, 1); | ||
115 | + t = FIELD_DP64(t, ID_AA64ISAR0, SHA2, 2); /* SHA512 */ | ||
116 | + t = FIELD_DP64(t, ID_AA64ISAR0, CRC32, 1); | ||
117 | + t = FIELD_DP64(t, ID_AA64ISAR0, ATOMIC, 2); | ||
118 | + t = FIELD_DP64(t, ID_AA64ISAR0, RDM, 1); | ||
119 | + t = FIELD_DP64(t, ID_AA64ISAR0, SHA3, 1); | ||
120 | + t = FIELD_DP64(t, ID_AA64ISAR0, SM3, 1); | ||
121 | + t = FIELD_DP64(t, ID_AA64ISAR0, SM4, 1); | ||
122 | + t = FIELD_DP64(t, ID_AA64ISAR0, DP, 1); | ||
123 | + t = FIELD_DP64(t, ID_AA64ISAR0, FHM, 1); | ||
124 | + t = FIELD_DP64(t, ID_AA64ISAR0, TS, 2); /* v8.5-CondM */ | ||
125 | + t = FIELD_DP64(t, ID_AA64ISAR0, TLB, 2); /* FEAT_TLBIRANGE */ | ||
126 | + t = FIELD_DP64(t, ID_AA64ISAR0, RNDR, 1); | ||
127 | + cpu->isar.id_aa64isar0 = t; | ||
128 | |||
129 | - t = cpu->isar.id_aa64pfr1; | ||
130 | - t = FIELD_DP64(t, ID_AA64PFR1, BT, 1); | ||
131 | - t = FIELD_DP64(t, ID_AA64PFR1, SSBS, 2); | ||
132 | - /* | ||
133 | - * Begin with full support for MTE. This will be downgraded to MTE=0 | ||
134 | - * during realize if the board provides no tag memory, much like | ||
135 | - * we do for EL2 with the virtualization=on property. | ||
136 | - */ | ||
137 | - t = FIELD_DP64(t, ID_AA64PFR1, MTE, 3); | ||
138 | - cpu->isar.id_aa64pfr1 = t; | ||
139 | + t = cpu->isar.id_aa64isar1; | ||
140 | + t = FIELD_DP64(t, ID_AA64ISAR1, DPB, 2); | ||
141 | + t = FIELD_DP64(t, ID_AA64ISAR1, JSCVT, 1); | ||
142 | + t = FIELD_DP64(t, ID_AA64ISAR1, FCMA, 1); | ||
143 | + t = FIELD_DP64(t, ID_AA64ISAR1, SB, 1); | ||
144 | + t = FIELD_DP64(t, ID_AA64ISAR1, SPECRES, 1); | ||
145 | + t = FIELD_DP64(t, ID_AA64ISAR1, BF16, 1); | ||
146 | + t = FIELD_DP64(t, ID_AA64ISAR1, FRINTTS, 1); | ||
147 | + t = FIELD_DP64(t, ID_AA64ISAR1, LRCPC, 2); /* ARMv8.4-RCPC */ | ||
148 | + t = FIELD_DP64(t, ID_AA64ISAR1, I8MM, 1); | ||
149 | + cpu->isar.id_aa64isar1 = t; | ||
150 | |||
151 | - t = cpu->isar.id_aa64mmfr0; | ||
152 | - t = FIELD_DP64(t, ID_AA64MMFR0, PARANGE, 5); /* PARange: 48 bits */ | ||
153 | - cpu->isar.id_aa64mmfr0 = t; | ||
154 | + t = cpu->isar.id_aa64pfr0; | ||
155 | + t = FIELD_DP64(t, ID_AA64PFR0, SVE, 1); | ||
156 | + t = FIELD_DP64(t, ID_AA64PFR0, FP, 1); | ||
157 | + t = FIELD_DP64(t, ID_AA64PFR0, ADVSIMD, 1); | ||
158 | + t = FIELD_DP64(t, ID_AA64PFR0, SEL2, 1); | ||
159 | + t = FIELD_DP64(t, ID_AA64PFR0, DIT, 1); | ||
160 | + cpu->isar.id_aa64pfr0 = t; | ||
161 | |||
162 | - t = cpu->isar.id_aa64mmfr1; | ||
163 | - t = FIELD_DP64(t, ID_AA64MMFR1, HPDS, 1); /* HPD */ | ||
164 | - t = FIELD_DP64(t, ID_AA64MMFR1, LO, 1); | ||
165 | - t = FIELD_DP64(t, ID_AA64MMFR1, VH, 1); | ||
166 | - t = FIELD_DP64(t, ID_AA64MMFR1, PAN, 2); /* ATS1E1 */ | ||
167 | - t = FIELD_DP64(t, ID_AA64MMFR1, VMIDBITS, 2); /* VMID16 */ | ||
168 | - t = FIELD_DP64(t, ID_AA64MMFR1, XNX, 1); /* TTS2UXN */ | ||
169 | - cpu->isar.id_aa64mmfr1 = t; | ||
170 | + t = cpu->isar.id_aa64pfr1; | ||
171 | + t = FIELD_DP64(t, ID_AA64PFR1, BT, 1); | ||
172 | + t = FIELD_DP64(t, ID_AA64PFR1, SSBS, 2); | ||
173 | + /* | ||
174 | + * Begin with full support for MTE. This will be downgraded to MTE=0 | ||
175 | + * during realize if the board provides no tag memory, much like | ||
176 | + * we do for EL2 with the virtualization=on property. | ||
177 | + */ | ||
178 | + t = FIELD_DP64(t, ID_AA64PFR1, MTE, 3); | ||
179 | + cpu->isar.id_aa64pfr1 = t; | ||
180 | |||
181 | - t = cpu->isar.id_aa64mmfr2; | ||
182 | - t = FIELD_DP64(t, ID_AA64MMFR2, UAO, 1); | ||
183 | - t = FIELD_DP64(t, ID_AA64MMFR2, CNP, 1); /* TTCNP */ | ||
184 | - t = FIELD_DP64(t, ID_AA64MMFR2, ST, 1); /* TTST */ | ||
185 | - cpu->isar.id_aa64mmfr2 = t; | ||
186 | + t = cpu->isar.id_aa64mmfr0; | ||
187 | + t = FIELD_DP64(t, ID_AA64MMFR0, PARANGE, 5); /* PARange: 48 bits */ | ||
188 | + cpu->isar.id_aa64mmfr0 = t; | ||
189 | |||
190 | - t = cpu->isar.id_aa64zfr0; | ||
191 | - t = FIELD_DP64(t, ID_AA64ZFR0, SVEVER, 1); | ||
192 | - t = FIELD_DP64(t, ID_AA64ZFR0, AES, 2); /* PMULL */ | ||
193 | - t = FIELD_DP64(t, ID_AA64ZFR0, BITPERM, 1); | ||
194 | - t = FIELD_DP64(t, ID_AA64ZFR0, BFLOAT16, 1); | ||
195 | - t = FIELD_DP64(t, ID_AA64ZFR0, SHA3, 1); | ||
196 | - t = FIELD_DP64(t, ID_AA64ZFR0, SM4, 1); | ||
197 | - t = FIELD_DP64(t, ID_AA64ZFR0, I8MM, 1); | ||
198 | - t = FIELD_DP64(t, ID_AA64ZFR0, F32MM, 1); | ||
199 | - t = FIELD_DP64(t, ID_AA64ZFR0, F64MM, 1); | ||
200 | - cpu->isar.id_aa64zfr0 = t; | ||
201 | + t = cpu->isar.id_aa64mmfr1; | ||
202 | + t = FIELD_DP64(t, ID_AA64MMFR1, HPDS, 1); /* HPD */ | ||
203 | + t = FIELD_DP64(t, ID_AA64MMFR1, LO, 1); | ||
204 | + t = FIELD_DP64(t, ID_AA64MMFR1, VH, 1); | ||
205 | + t = FIELD_DP64(t, ID_AA64MMFR1, PAN, 2); /* ATS1E1 */ | ||
206 | + t = FIELD_DP64(t, ID_AA64MMFR1, VMIDBITS, 2); /* VMID16 */ | ||
207 | + t = FIELD_DP64(t, ID_AA64MMFR1, XNX, 1); /* TTS2UXN */ | ||
208 | + cpu->isar.id_aa64mmfr1 = t; | ||
209 | |||
210 | - /* Replicate the same data to the 32-bit id registers. */ | ||
211 | - u = cpu->isar.id_isar5; | ||
212 | - u = FIELD_DP32(u, ID_ISAR5, AES, 2); /* AES + PMULL */ | ||
213 | - u = FIELD_DP32(u, ID_ISAR5, SHA1, 1); | ||
214 | - u = FIELD_DP32(u, ID_ISAR5, SHA2, 1); | ||
215 | - u = FIELD_DP32(u, ID_ISAR5, CRC32, 1); | ||
216 | - u = FIELD_DP32(u, ID_ISAR5, RDM, 1); | ||
217 | - u = FIELD_DP32(u, ID_ISAR5, VCMA, 1); | ||
218 | - cpu->isar.id_isar5 = u; | ||
219 | + t = cpu->isar.id_aa64mmfr2; | ||
220 | + t = FIELD_DP64(t, ID_AA64MMFR2, UAO, 1); | ||
221 | + t = FIELD_DP64(t, ID_AA64MMFR2, CNP, 1); /* TTCNP */ | ||
222 | + t = FIELD_DP64(t, ID_AA64MMFR2, ST, 1); /* TTST */ | ||
223 | + cpu->isar.id_aa64mmfr2 = t; | ||
224 | |||
225 | - u = cpu->isar.id_isar6; | ||
226 | - u = FIELD_DP32(u, ID_ISAR6, JSCVT, 1); | ||
227 | - u = FIELD_DP32(u, ID_ISAR6, DP, 1); | ||
228 | - u = FIELD_DP32(u, ID_ISAR6, FHM, 1); | ||
229 | - u = FIELD_DP32(u, ID_ISAR6, SB, 1); | ||
230 | - u = FIELD_DP32(u, ID_ISAR6, SPECRES, 1); | ||
231 | - u = FIELD_DP32(u, ID_ISAR6, BF16, 1); | ||
232 | - u = FIELD_DP32(u, ID_ISAR6, I8MM, 1); | ||
233 | - cpu->isar.id_isar6 = u; | ||
234 | + t = cpu->isar.id_aa64zfr0; | ||
235 | + t = FIELD_DP64(t, ID_AA64ZFR0, SVEVER, 1); | ||
236 | + t = FIELD_DP64(t, ID_AA64ZFR0, AES, 2); /* PMULL */ | ||
237 | + t = FIELD_DP64(t, ID_AA64ZFR0, BITPERM, 1); | ||
238 | + t = FIELD_DP64(t, ID_AA64ZFR0, BFLOAT16, 1); | ||
239 | + t = FIELD_DP64(t, ID_AA64ZFR0, SHA3, 1); | ||
240 | + t = FIELD_DP64(t, ID_AA64ZFR0, SM4, 1); | ||
241 | + t = FIELD_DP64(t, ID_AA64ZFR0, I8MM, 1); | ||
242 | + t = FIELD_DP64(t, ID_AA64ZFR0, F32MM, 1); | ||
243 | + t = FIELD_DP64(t, ID_AA64ZFR0, F64MM, 1); | ||
244 | + cpu->isar.id_aa64zfr0 = t; | ||
245 | |||
246 | - u = cpu->isar.id_pfr0; | ||
247 | - u = FIELD_DP32(u, ID_PFR0, DIT, 1); | ||
248 | - cpu->isar.id_pfr0 = u; | ||
249 | + /* Replicate the same data to the 32-bit id registers. */ | ||
250 | + u = cpu->isar.id_isar5; | ||
251 | + u = FIELD_DP32(u, ID_ISAR5, AES, 2); /* AES + PMULL */ | ||
252 | + u = FIELD_DP32(u, ID_ISAR5, SHA1, 1); | ||
253 | + u = FIELD_DP32(u, ID_ISAR5, SHA2, 1); | ||
254 | + u = FIELD_DP32(u, ID_ISAR5, CRC32, 1); | ||
255 | + u = FIELD_DP32(u, ID_ISAR5, RDM, 1); | ||
256 | + u = FIELD_DP32(u, ID_ISAR5, VCMA, 1); | ||
257 | + cpu->isar.id_isar5 = u; | ||
258 | |||
259 | - u = cpu->isar.id_pfr2; | ||
260 | - u = FIELD_DP32(u, ID_PFR2, SSBS, 1); | ||
261 | - cpu->isar.id_pfr2 = u; | ||
262 | + u = cpu->isar.id_isar6; | ||
263 | + u = FIELD_DP32(u, ID_ISAR6, JSCVT, 1); | ||
264 | + u = FIELD_DP32(u, ID_ISAR6, DP, 1); | ||
265 | + u = FIELD_DP32(u, ID_ISAR6, FHM, 1); | ||
266 | + u = FIELD_DP32(u, ID_ISAR6, SB, 1); | ||
267 | + u = FIELD_DP32(u, ID_ISAR6, SPECRES, 1); | ||
268 | + u = FIELD_DP32(u, ID_ISAR6, BF16, 1); | ||
269 | + u = FIELD_DP32(u, ID_ISAR6, I8MM, 1); | ||
270 | + cpu->isar.id_isar6 = u; | ||
271 | |||
272 | - u = cpu->isar.id_mmfr3; | ||
273 | - u = FIELD_DP32(u, ID_MMFR3, PAN, 2); /* ATS1E1 */ | ||
274 | - cpu->isar.id_mmfr3 = u; | ||
275 | + u = cpu->isar.id_pfr0; | ||
276 | + u = FIELD_DP32(u, ID_PFR0, DIT, 1); | ||
277 | + cpu->isar.id_pfr0 = u; | ||
278 | |||
279 | - u = cpu->isar.id_mmfr4; | ||
280 | - u = FIELD_DP32(u, ID_MMFR4, HPDS, 1); /* AA32HPD */ | ||
281 | - u = FIELD_DP32(u, ID_MMFR4, AC2, 1); /* ACTLR2, HACTLR2 */ | ||
282 | - u = FIELD_DP32(u, ID_MMFR4, CNP, 1); /* TTCNP */ | ||
283 | - u = FIELD_DP32(u, ID_MMFR4, XNX, 1); /* TTS2UXN */ | ||
284 | - cpu->isar.id_mmfr4 = u; | ||
285 | + u = cpu->isar.id_pfr2; | ||
286 | + u = FIELD_DP32(u, ID_PFR2, SSBS, 1); | ||
287 | + cpu->isar.id_pfr2 = u; | ||
288 | |||
289 | - t = cpu->isar.id_aa64dfr0; | ||
290 | - t = FIELD_DP64(t, ID_AA64DFR0, PMUVER, 5); /* v8.4-PMU */ | ||
291 | - cpu->isar.id_aa64dfr0 = t; | ||
292 | + u = cpu->isar.id_mmfr3; | ||
293 | + u = FIELD_DP32(u, ID_MMFR3, PAN, 2); /* ATS1E1 */ | ||
294 | + cpu->isar.id_mmfr3 = u; | ||
295 | |||
296 | - u = cpu->isar.id_dfr0; | ||
297 | - u = FIELD_DP32(u, ID_DFR0, PERFMON, 5); /* v8.4-PMU */ | ||
298 | - cpu->isar.id_dfr0 = u; | ||
299 | + u = cpu->isar.id_mmfr4; | ||
300 | + u = FIELD_DP32(u, ID_MMFR4, HPDS, 1); /* AA32HPD */ | ||
301 | + u = FIELD_DP32(u, ID_MMFR4, AC2, 1); /* ACTLR2, HACTLR2 */ | ||
302 | + u = FIELD_DP32(u, ID_MMFR4, CNP, 1); /* TTCNP */ | ||
303 | + u = FIELD_DP32(u, ID_MMFR4, XNX, 1); /* TTS2UXN */ | ||
304 | + cpu->isar.id_mmfr4 = u; | ||
305 | |||
306 | - u = cpu->isar.mvfr1; | ||
307 | - u = FIELD_DP32(u, MVFR1, FPHP, 3); /* v8.2-FP16 */ | ||
308 | - u = FIELD_DP32(u, MVFR1, SIMDHP, 2); /* v8.2-FP16 */ | ||
309 | - cpu->isar.mvfr1 = u; | ||
310 | + t = cpu->isar.id_aa64dfr0; | ||
311 | + t = FIELD_DP64(t, ID_AA64DFR0, PMUVER, 5); /* v8.4-PMU */ | ||
312 | + cpu->isar.id_aa64dfr0 = t; | ||
313 | + | ||
314 | + u = cpu->isar.id_dfr0; | ||
315 | + u = FIELD_DP32(u, ID_DFR0, PERFMON, 5); /* v8.4-PMU */ | ||
316 | + cpu->isar.id_dfr0 = u; | ||
317 | + | ||
318 | + u = cpu->isar.mvfr1; | ||
319 | + u = FIELD_DP32(u, MVFR1, FPHP, 3); /* v8.2-FP16 */ | ||
320 | + u = FIELD_DP32(u, MVFR1, SIMDHP, 2); /* v8.2-FP16 */ | ||
321 | + cpu->isar.mvfr1 = u; | ||
322 | |||
323 | #ifdef CONFIG_USER_ONLY | ||
324 | - /* For usermode -cpu max we can use a larger and more efficient DCZ | ||
325 | - * blocksize since we don't have to follow what the hardware does. | ||
326 | - */ | ||
327 | - cpu->ctr = 0x80038003; /* 32 byte I and D cacheline size, VIPT icache */ | ||
328 | - cpu->dcz_blocksize = 7; /* 512 bytes */ | ||
329 | + /* | ||
330 | + * For usermode -cpu max we can use a larger and more efficient DCZ | ||
331 | + * blocksize since we don't have to follow what the hardware does. | ||
332 | + */ | ||
333 | + cpu->ctr = 0x80038003; /* 32 byte I and D cacheline size, VIPT icache */ | ||
334 | + cpu->dcz_blocksize = 7; /* 512 bytes */ | ||
335 | #endif | ||
336 | |||
337 | - bitmap_fill(cpu->sve_vq_supported, ARM_MAX_VQ); | ||
338 | - } | ||
339 | + bitmap_fill(cpu->sve_vq_supported, ARM_MAX_VQ); | ||
340 | |||
341 | aarch64_add_pauth_properties(obj); | ||
342 | aarch64_add_sve_properties(obj); | ||
343 | -- | ||
344 | 2.25.1 | ||
345 | |||
346 | diff view generated by jsdifflib |
New patch | |||
---|---|---|---|
1 | Currently when using hvf we mishandle '-cpu max': we fall through to | ||
2 | the TCG version of its initfn, which then sets a lot of feature bits | ||
3 | that the real host CPU doesn't have. The hvf accelerator code then | ||
4 | exposes these bogus ID register values to the guest because it | ||
5 | doesn't check that the host really has the features. | ||
1 | 6 | ||
7 | Make '-cpu host' be like '-cpu max' for hvf, as we do with kvm. | ||
8 | |||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
10 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
11 | Reviewed-by: Andrew Jones <drjones@redhat.com> | ||
12 | Reviewed-by: Alexander Graf <agraf@csgraf.de> | ||
13 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
14 | Message-id: 20220204165506.2846058-6-peter.maydell@linaro.org | ||
15 | --- | ||
16 | target/arm/cpu64.c | 5 +++-- | ||
17 | 1 file changed, 3 insertions(+), 2 deletions(-) | ||
18 | |||
19 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c | ||
20 | index XXXXXXX..XXXXXXX 100644 | ||
21 | --- a/target/arm/cpu64.c | ||
22 | +++ b/target/arm/cpu64.c | ||
23 | @@ -XXX,XX +XXX,XX @@ | ||
24 | #include "hw/loader.h" | ||
25 | #endif | ||
26 | #include "sysemu/kvm.h" | ||
27 | +#include "sysemu/hvf.h" | ||
28 | #include "kvm_arm.h" | ||
29 | #include "hvf_arm.h" | ||
30 | #include "qapi/visitor.h" | ||
31 | @@ -XXX,XX +XXX,XX @@ static void aarch64_max_initfn(Object *obj) | ||
32 | uint64_t t; | ||
33 | uint32_t u; | ||
34 | |||
35 | - if (kvm_enabled()) { | ||
36 | - /* With KVM, '-cpu max' is identical to '-cpu host' */ | ||
37 | + if (kvm_enabled() || hvf_enabled()) { | ||
38 | + /* With KVM or HVF, '-cpu max' is identical to '-cpu host' */ | ||
39 | aarch64_host_initfn(obj); | ||
40 | return; | ||
41 | } | ||
42 | -- | ||
43 | 2.25.1 | ||
44 | |||
45 | diff view generated by jsdifflib |
1 | The Arm CPU finalize function uses a sequence of timer_del(), timer_deinit(), | 1 | Currently we don't allow guests under hvf to use the PAuth extension, |
---|---|---|---|
2 | timer_free() to free the timer. The timer_deinit() step in this was always | 2 | because we didn't have any special code to handle that, and therefore |
3 | unnecessary, and now the timer_del() is implied by timer_free(), so we can | 3 | in arm_cpu_pauth_finalize() we will sanitize the ID_AA64ISAR1 value |
4 | collapse this down to simply calling timer_free(). | 4 | the guest sees to clear the PAuth related fields. |
5 | |||
6 | Add support for this in the same way that KVM does it, by defaulting | ||
7 | to "PAuth enabled" if the host CPU has it and allowing the user to | ||
8 | disable it via '-cpu pauth=no' on the command line. | ||
5 | 9 | ||
6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 11 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
12 | Reviewed-by: Andrew Jones <drjones@redhat.com> | ||
13 | Reviewed-by: Alexander Graf <agraf@csgraf.de> | ||
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 14 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
9 | Message-id: 20201215154107.3255-5-peter.maydell@linaro.org | 15 | Message-id: 20220204165506.2846058-7-peter.maydell@linaro.org |
10 | --- | 16 | --- |
11 | target/arm/cpu.c | 2 -- | 17 | target/arm/cpu64.c | 14 ++++++++++---- |
12 | 1 file changed, 2 deletions(-) | 18 | 1 file changed, 10 insertions(+), 4 deletions(-) |
13 | 19 | ||
14 | diff --git a/target/arm/cpu.c b/target/arm/cpu.c | 20 | diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c |
15 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/target/arm/cpu.c | 22 | --- a/target/arm/cpu64.c |
17 | +++ b/target/arm/cpu.c | 23 | +++ b/target/arm/cpu64.c |
18 | @@ -XXX,XX +XXX,XX @@ static void arm_cpu_finalizefn(Object *obj) | 24 | @@ -XXX,XX +XXX,XX @@ void arm_cpu_pauth_finalize(ARMCPU *cpu, Error **errp) |
19 | } | 25 | uint64_t t; |
20 | #ifndef CONFIG_USER_ONLY | 26 | |
21 | if (cpu->pmu_timer) { | 27 | /* Exit early if PAuth is enabled, and fall through to disable it */ |
22 | - timer_del(cpu->pmu_timer); | 28 | - if (kvm_enabled() && cpu->prop_pauth) { |
23 | - timer_deinit(cpu->pmu_timer); | 29 | + if ((kvm_enabled() || hvf_enabled()) && cpu->prop_pauth) { |
24 | timer_free(cpu->pmu_timer); | 30 | if (!cpu_isar_feature(aa64_pauth, cpu)) { |
25 | } | 31 | - error_setg(errp, "'pauth' feature not supported by KVM on this host"); |
32 | + error_setg(errp, "'pauth' feature not supported by %s on this host", | ||
33 | + kvm_enabled() ? "KVM" : "hvf"); | ||
34 | } | ||
35 | |||
36 | return; | ||
37 | @@ -XXX,XX +XXX,XX @@ void aarch64_add_pauth_properties(Object *obj) | ||
38 | |||
39 | /* Default to PAUTH on, with the architected algorithm on TCG. */ | ||
40 | qdev_property_add_static(DEVICE(obj), &arm_cpu_pauth_property); | ||
41 | - if (kvm_enabled()) { | ||
42 | + if (kvm_enabled() || hvf_enabled()) { | ||
43 | /* | ||
44 | * Mirror PAuth support from the probed sysregs back into the | ||
45 | - * property for KVM. Is it just a bit backward? Yes it is! | ||
46 | + * property for KVM or hvf. Is it just a bit backward? Yes it is! | ||
47 | + * Note that prop_pauth is true whether the host CPU supports the | ||
48 | + * architected QARMA5 algorithm or the IMPDEF one. We don't | ||
49 | + * provide the separate pauth-impdef property for KVM or hvf, | ||
50 | + * only for TCG. | ||
51 | */ | ||
52 | cpu->prop_pauth = cpu_isar_feature(aa64_pauth, cpu); | ||
53 | } else { | ||
54 | @@ -XXX,XX +XXX,XX @@ static void aarch64_host_initfn(Object *obj) | ||
55 | #elif defined(CONFIG_HVF) | ||
56 | ARMCPU *cpu = ARM_CPU(obj); | ||
57 | hvf_arm_set_cpu_features_from_host(cpu); | ||
58 | + aarch64_add_pauth_properties(obj); | ||
59 | #else | ||
60 | g_assert_not_reached(); | ||
26 | #endif | 61 | #endif |
27 | -- | 62 | -- |
28 | 2.20.1 | 63 | 2.25.1 |
29 | 64 | ||
30 | 65 | diff view generated by jsdifflib |
1 | Currently timer_free() is a simple wrapper for g_free(). This means | 1 | Currently there is no way for a board model's Kconfig stanza to |
---|---|---|---|
2 | that the timer being freed must not be currently active, as otherwise | 2 | say "I have an i2c bus which the user can plug an i2c device into, |
3 | QEMU might crash later when the active list is processed and still | 3 | build all the free-standing i2c devices". The Kconfig mechanism |
4 | has a pointer to freed memory on it. As a result almost all calls to | 4 | for this is the "device group". Add an I2C_DEVICES group along |
5 | timer_free() are preceded by a timer_del() call, as can be seen in | 5 | the same lines as the existing PCI_DEVICES. Simple free-standing |
6 | the output of | 6 | i2c devices which a user might plausibly want to be able to |
7 | git grep -B1 '\<timer_free\>' | 7 | plug in on the QEMU commandline should have |
8 | default y if I2C_DEVICES | ||
9 | and board models which have an i2c bus that is user-accessible | ||
10 | should use | ||
11 | imply I2C_DEVICES | ||
12 | to cause those pluggable devices to be built. | ||
8 | 13 | ||
9 | This is unfortunate API design as it makes it easy to accidentally | 14 | In this commit we mark only a fairly conservative set of i2c devices |
10 | misuse (by forgetting the timer_del()), and the correct use is | 15 | as belonging to the I2C_DEVICES group: the simple sensors and RTCs |
11 | annoyingly verbose. | 16 | (not including PMBus devices or devices which need GPIO lines to be |
12 | 17 | connected). | |
13 | Make timer_free() imply a timer_del(). | ||
14 | 18 | ||
15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 19 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
16 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | 20 | Acked-by: Paolo Bonzini <pbonzini@redhat.com> |
17 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 21 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
18 | Message-id: 20201215154107.3255-2-peter.maydell@linaro.org | 22 | Reviewed-by: Hao Wu <wuhaotsh@google.com> |
23 | Message-id: 20220208155911.3408455-2-peter.maydell@linaro.org | ||
19 | --- | 24 | --- |
20 | include/qemu/timer.h | 24 +++++++++++++----------- | 25 | docs/devel/kconfig.rst | 8 ++++++-- |
21 | 1 file changed, 13 insertions(+), 11 deletions(-) | 26 | hw/i2c/Kconfig | 5 +++++ |
27 | hw/rtc/Kconfig | 2 ++ | ||
28 | hw/sensor/Kconfig | 5 +++++ | ||
29 | 4 files changed, 18 insertions(+), 2 deletions(-) | ||
22 | 30 | ||
23 | diff --git a/include/qemu/timer.h b/include/qemu/timer.h | 31 | diff --git a/docs/devel/kconfig.rst b/docs/devel/kconfig.rst |
24 | index XXXXXXX..XXXXXXX 100644 | 32 | index XXXXXXX..XXXXXXX 100644 |
25 | --- a/include/qemu/timer.h | 33 | --- a/docs/devel/kconfig.rst |
26 | +++ b/include/qemu/timer.h | 34 | +++ b/docs/devel/kconfig.rst |
27 | @@ -XXX,XX +XXX,XX @@ static inline QEMUTimer *timer_new_ms(QEMUClockType type, QEMUTimerCB *cb, | 35 | @@ -XXX,XX +XXX,XX @@ declares its dependencies in different ways: |
28 | */ | 36 | no directive and are not used in the Makefile either; they only appear |
29 | void timer_deinit(QEMUTimer *ts); | 37 | as conditions for ``default y`` directives. |
30 | 38 | ||
31 | -/** | 39 | - QEMU currently has two device groups, ``PCI_DEVICES`` and |
32 | - * timer_free: | 40 | - ``TEST_DEVICES``. PCI devices usually have a ``default y if |
33 | - * @ts: the timer | 41 | + QEMU currently has three device groups, ``PCI_DEVICES``, ``I2C_DEVICES``, |
34 | - * | 42 | + and ``TEST_DEVICES``. PCI devices usually have a ``default y if |
35 | - * Free a timer (it must not be on the active list) | 43 | PCI_DEVICES`` directive rather than just ``default y``. This lets |
36 | - */ | 44 | some boards (notably s390) easily support a subset of PCI devices, |
37 | -static inline void timer_free(QEMUTimer *ts) | 45 | for example only VFIO (passthrough) and virtio-pci devices. |
38 | -{ | 46 | + ``I2C_DEVICES`` is similar to ``PCI_DEVICES``. It contains i2c devices |
39 | - g_free(ts); | 47 | + that users might reasonably want to plug in to an i2c bus on any |
40 | -} | 48 | + board (and not ones which are very board-specific or that need |
41 | - | 49 | + to be wired up in a way that can't be done on the command line). |
42 | /** | 50 | ``TEST_DEVICES`` instead is used for devices that are rarely used on |
43 | * timer_del: | 51 | production virtual machines, but provide useful hooks to test QEMU |
44 | * @ts: the timer | 52 | or KVM. |
45 | @@ -XXX,XX +XXX,XX @@ static inline void timer_free(QEMUTimer *ts) | 53 | diff --git a/hw/i2c/Kconfig b/hw/i2c/Kconfig |
46 | */ | 54 | index XXXXXXX..XXXXXXX 100644 |
47 | void timer_del(QEMUTimer *ts); | 55 | --- a/hw/i2c/Kconfig |
48 | 56 | +++ b/hw/i2c/Kconfig | |
49 | +/** | 57 | @@ -XXX,XX +XXX,XX @@ |
50 | + * timer_free: | 58 | config I2C |
51 | + * @ts: the timer | 59 | bool |
52 | + * | 60 | |
53 | + * Free a timer. This will call timer_del() for you to remove | 61 | +config I2C_DEVICES |
54 | + * the timer from the active list if it was still active. | 62 | + # Device group for i2c devices which can reasonably be user-plugged |
55 | + */ | 63 | + # to any board's i2c bus |
56 | +static inline void timer_free(QEMUTimer *ts) | 64 | + bool |
57 | +{ | ||
58 | + timer_del(ts); | ||
59 | + g_free(ts); | ||
60 | +} | ||
61 | + | 65 | + |
62 | /** | 66 | config SMBUS |
63 | * timer_mod_ns: | 67 | bool |
64 | * @ts: the timer | 68 | select I2C |
69 | diff --git a/hw/rtc/Kconfig b/hw/rtc/Kconfig | ||
70 | index XXXXXXX..XXXXXXX 100644 | ||
71 | --- a/hw/rtc/Kconfig | ||
72 | +++ b/hw/rtc/Kconfig | ||
73 | @@ -XXX,XX +XXX,XX @@ | ||
74 | config DS1338 | ||
75 | bool | ||
76 | depends on I2C | ||
77 | + default y if I2C_DEVICES | ||
78 | |||
79 | config M41T80 | ||
80 | bool | ||
81 | depends on I2C | ||
82 | + default y if I2C_DEVICES | ||
83 | |||
84 | config M48T59 | ||
85 | bool | ||
86 | diff --git a/hw/sensor/Kconfig b/hw/sensor/Kconfig | ||
87 | index XXXXXXX..XXXXXXX 100644 | ||
88 | --- a/hw/sensor/Kconfig | ||
89 | +++ b/hw/sensor/Kconfig | ||
90 | @@ -XXX,XX +XXX,XX @@ | ||
91 | config TMP105 | ||
92 | bool | ||
93 | depends on I2C | ||
94 | + default y if I2C_DEVICES | ||
95 | |||
96 | config TMP421 | ||
97 | bool | ||
98 | depends on I2C | ||
99 | + default y if I2C_DEVICES | ||
100 | |||
101 | config DPS310 | ||
102 | bool | ||
103 | depends on I2C | ||
104 | + default y if I2C_DEVICES | ||
105 | |||
106 | config EMC141X | ||
107 | bool | ||
108 | depends on I2C | ||
109 | + default y if I2C_DEVICES | ||
110 | |||
111 | config ADM1272 | ||
112 | bool | ||
113 | @@ -XXX,XX +XXX,XX @@ config MAX34451 | ||
114 | config LSM303DLHC_MAG | ||
115 | bool | ||
116 | depends on I2C | ||
117 | + default y if I2C_DEVICES | ||
65 | -- | 118 | -- |
66 | 2.20.1 | 119 | 2.25.1 |
67 | 120 | ||
68 | 121 | diff view generated by jsdifflib |
1 | In commit 64f863baeedc8659 we implemented the v8.1M FPCXT_S register, | 1 | For arm boards with an i2c bus which a user could reasonably |
---|---|---|---|
2 | but we got the write behaviour wrong. On read, this register reads | 2 | want to plug arbitrary devices, add 'imply I2C_DEVICES' to the |
3 | bits [27:0] of FPSCR plus the CONTROL.SFPA bit. On write, it doesn't | 3 | Kconfig stanza. |
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 | 4 | ||
15 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
16 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 6 | Acked-by: Paolo Bonzini <pbonzini@redhat.com> |
17 | Message-id: 20201210201433.26262-3-peter.maydell@linaro.org | 7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
8 | Reviewed-by: Hao Wu <wuhaotsh@google.com> | ||
9 | Message-id: 20220208155911.3408455-3-peter.maydell@linaro.org | ||
18 | --- | 10 | --- |
19 | target/arm/translate-vfp.c.inc | 12 ++++++------ | 11 | hw/arm/Kconfig | 10 ++++++++++ |
20 | 1 file changed, 6 insertions(+), 6 deletions(-) | 12 | 1 file changed, 10 insertions(+) |
21 | 13 | ||
22 | diff --git a/target/arm/translate-vfp.c.inc b/target/arm/translate-vfp.c.inc | 14 | diff --git a/hw/arm/Kconfig b/hw/arm/Kconfig |
23 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
24 | --- a/target/arm/translate-vfp.c.inc | 16 | --- a/hw/arm/Kconfig |
25 | +++ b/target/arm/translate-vfp.c.inc | 17 | +++ b/hw/arm/Kconfig |
26 | @@ -XXX,XX +XXX,XX @@ static bool gen_M_fp_sysreg_write(DisasContext *s, int regno, | 18 | @@ -XXX,XX +XXX,XX @@ config DIGIC |
27 | } | 19 | |
28 | case ARM_VFP_FPCXT_S: | 20 | config EXYNOS4 |
29 | { | 21 | bool |
30 | - TCGv_i32 sfpa, control, fpscr; | 22 | + imply I2C_DEVICES |
31 | - /* Set FPSCR[27:0] and CONTROL.SFPA from value */ | 23 | select A9MPCORE |
32 | + TCGv_i32 sfpa, control; | 24 | select I2C |
33 | + /* | 25 | select LAN9118 |
34 | + * Set FPSCR and CONTROL.SFPA from value; the new FPSCR takes | 26 | @@ -XXX,XX +XXX,XX @@ config REALVIEW |
35 | + * bits [27:0] from value and zeroes bits [31:28]. | 27 | bool |
36 | + */ | 28 | imply PCI_DEVICES |
37 | tmp = loadfn(s, opaque); | 29 | imply PCI_TESTDEV |
38 | sfpa = tcg_temp_new_i32(); | 30 | + imply I2C_DEVICES |
39 | tcg_gen_shri_i32(sfpa, tmp, 31); | 31 | select SMC91C111 |
40 | @@ -XXX,XX +XXX,XX @@ static bool gen_M_fp_sysreg_write(DisasContext *s, int regno, | 32 | select LAN9118 |
41 | tcg_gen_deposit_i32(control, control, sfpa, | 33 | select A9MPCORE |
42 | R_V7M_CONTROL_SFPA_SHIFT, 1); | 34 | @@ -XXX,XX +XXX,XX @@ config SABRELITE |
43 | store_cpu_field(control, v7m.control[M_REG_S]); | 35 | |
44 | - fpscr = load_cpu_field(vfp.xregs[ARM_VFP_FPSCR]); | 36 | config STELLARIS |
45 | - tcg_gen_andi_i32(fpscr, fpscr, FPCR_NZCV_MASK); | 37 | bool |
46 | tcg_gen_andi_i32(tmp, tmp, ~FPCR_NZCV_MASK); | 38 | + imply I2C_DEVICES |
47 | - tcg_gen_or_i32(fpscr, fpscr, tmp); | 39 | select ARM_V7M |
48 | - store_cpu_field(fpscr, vfp.xregs[ARM_VFP_FPSCR]); | 40 | select CMSDK_APB_WATCHDOG |
49 | + gen_helper_vfp_set_fpscr(cpu_env, tmp); | 41 | select I2C |
50 | tcg_temp_free_i32(tmp); | 42 | @@ -XXX,XX +XXX,XX @@ config NPCM7XX |
51 | tcg_temp_free_i32(sfpa); | 43 | |
52 | break; | 44 | config FSL_IMX25 |
45 | bool | ||
46 | + imply I2C_DEVICES | ||
47 | select IMX | ||
48 | select IMX_FEC | ||
49 | select IMX_I2C | ||
50 | @@ -XXX,XX +XXX,XX @@ config FSL_IMX25 | ||
51 | |||
52 | config FSL_IMX31 | ||
53 | bool | ||
54 | + imply I2C_DEVICES | ||
55 | select SERIAL | ||
56 | select IMX | ||
57 | select IMX_I2C | ||
58 | @@ -XXX,XX +XXX,XX @@ config FSL_IMX31 | ||
59 | |||
60 | config FSL_IMX6 | ||
61 | bool | ||
62 | + imply I2C_DEVICES | ||
63 | select A9MPCORE | ||
64 | select IMX | ||
65 | select IMX_FEC | ||
66 | @@ -XXX,XX +XXX,XX @@ config ASPEED_SOC | ||
67 | |||
68 | config MPS2 | ||
69 | bool | ||
70 | + imply I2C_DEVICES | ||
71 | select ARMSSE | ||
72 | select LAN9118 | ||
73 | select MPS2_FPGAIO | ||
74 | @@ -XXX,XX +XXX,XX @@ config FSL_IMX7 | ||
75 | bool | ||
76 | imply PCI_DEVICES | ||
77 | imply TEST_DEVICES | ||
78 | + imply I2C_DEVICES | ||
79 | select A15MPCORE | ||
80 | select PCI | ||
81 | select IMX | ||
82 | @@ -XXX,XX +XXX,XX @@ config ARM_SMMUV3 | ||
83 | |||
84 | config FSL_IMX6UL | ||
85 | bool | ||
86 | + imply I2C_DEVICES | ||
87 | select A15MPCORE | ||
88 | select IMX | ||
89 | select IMX_FEC | ||
90 | @@ -XXX,XX +XXX,XX @@ config MICROBIT | ||
91 | |||
92 | config NRF51_SOC | ||
93 | bool | ||
94 | + imply I2C_DEVICES | ||
95 | select I2C | ||
96 | select ARM_V7M | ||
97 | select UNIMP | ||
53 | -- | 98 | -- |
54 | 2.20.1 | 99 | 2.25.1 |
55 | 100 | ||
56 | 101 | diff view generated by jsdifflib |
1 | From: Andrew Jones <drjones@redhat.com> | 1 | In the armv7m object, handle clock inputs that aren't connected. |
---|---|---|---|
2 | This is always an error for 'cpuclk'. For 'refclk' it is OK for this | ||
3 | to be disconnected, but we need to handle it by not trying to connect | ||
4 | a sourceless-clock to the systick device. | ||
2 | 5 | ||
3 | virt machine's 'smp_cpus' and machine->smp.cpus must always have the | 6 | This fixes a bug where on the mps2-an521 and similar boards (which |
4 | same value. And, anywhere we have virt machine state we have machine | 7 | do not have a refclk) the systick device incorrectly reset with |
5 | state. So let's remove the redundancy. Also, to make it easier to see | 8 | SYST_CSR.CLKSOURCE 0 ("use refclk") rather than 1 ("use CPU clock"). |
6 | that machine->smp is the true source for "smp_cpus" and "max_cpus", | ||
7 | avoid passing them in function parameters, preferring instead to get | ||
8 | them from the state. | ||
9 | 9 | ||
10 | No functional change intended. | 10 | Cc: qemu-stable@nongnu.org |
11 | Reported-by: Richard Petri <git@rpls.de> | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
13 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
14 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
15 | Message-id: 20220208171643.3486277-1-peter.maydell@linaro.org | ||
16 | --- | ||
17 | hw/arm/armv7m.c | 26 ++++++++++++++++++++++---- | ||
18 | 1 file changed, 22 insertions(+), 4 deletions(-) | ||
11 | 19 | ||
12 | Signed-off-by: Andrew Jones <drjones@redhat.com> | 20 | diff --git a/hw/arm/armv7m.c b/hw/arm/armv7m.c |
13 | Reviewed-by: David Edmondson <david.edmondson@oracle.com> | ||
14 | Reviewed-by: Ying Fang <fangying1@huawei.com> | ||
15 | Message-id: 20201215174815.51520-1-drjones@redhat.com | ||
16 | [PMM: minor formatting tweak to smp_cpus variable declaration] | ||
17 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | ||
18 | --- | ||
19 | include/hw/arm/virt.h | 3 +-- | ||
20 | hw/arm/virt-acpi-build.c | 9 +++++---- | ||
21 | hw/arm/virt.c | 21 ++++++++++----------- | ||
22 | 3 files changed, 16 insertions(+), 17 deletions(-) | ||
23 | |||
24 | diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h | ||
25 | index XXXXXXX..XXXXXXX 100644 | 21 | index XXXXXXX..XXXXXXX 100644 |
26 | --- a/include/hw/arm/virt.h | 22 | --- a/hw/arm/armv7m.c |
27 | +++ b/include/hw/arm/virt.h | 23 | +++ b/hw/arm/armv7m.c |
28 | @@ -XXX,XX +XXX,XX @@ struct VirtMachineState { | 24 | @@ -XXX,XX +XXX,XX @@ static void armv7m_realize(DeviceState *dev, Error **errp) |
29 | MemMapEntry *memmap; | 25 | return; |
30 | char *pciehb_nodename; | ||
31 | const int *irqmap; | ||
32 | - int smp_cpus; | ||
33 | void *fdt; | ||
34 | int fdt_size; | ||
35 | uint32_t clock_phandle; | ||
36 | @@ -XXX,XX +XXX,XX @@ static inline int virt_gicv3_redist_region_count(VirtMachineState *vms) | ||
37 | |||
38 | assert(vms->gic_version == VIRT_GIC_VERSION_3); | ||
39 | |||
40 | - return vms->smp_cpus > redist0_capacity ? 2 : 1; | ||
41 | + return MACHINE(vms)->smp.cpus > redist0_capacity ? 2 : 1; | ||
42 | } | ||
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 | ||
47 | --- a/hw/arm/virt-acpi-build.c | ||
48 | +++ b/hw/arm/virt-acpi-build.c | ||
49 | @@ -XXX,XX +XXX,XX @@ | ||
50 | |||
51 | #define ACPI_BUILD_TABLE_SIZE 0x20000 | ||
52 | |||
53 | -static void acpi_dsdt_add_cpus(Aml *scope, int smp_cpus) | ||
54 | +static void acpi_dsdt_add_cpus(Aml *scope, VirtMachineState *vms) | ||
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 | } | 26 | } |
93 | 27 | ||
94 | qemu_fdt_add_subnode(vms->fdt, "/timer"); | 28 | + /* cpuclk must be connected; refclk is optional */ |
95 | @@ -XXX,XX +XXX,XX @@ static void fdt_add_cpu_nodes(const VirtMachineState *vms) | 29 | + if (!clock_has_source(s->cpuclk)) { |
96 | int cpu; | 30 | + error_setg(errp, "armv7m: cpuclk must be connected"); |
97 | int addr_cells = 1; | 31 | + return; |
98 | const MachineState *ms = MACHINE(vms); | 32 | + } |
99 | + int smp_cpus = ms->smp.cpus; | 33 | + |
100 | 34 | memory_region_add_subregion_overlap(&s->container, 0, s->board_memory, -1); | |
101 | /* | 35 | |
102 | * From Documentation/devicetree/bindings/arm/cpus.txt | 36 | s->cpu = ARM_CPU(object_new_with_props(s->cpu_type, OBJECT(s), "cpu", |
103 | @@ -XXX,XX +XXX,XX @@ static void fdt_add_cpu_nodes(const VirtMachineState *vms) | 37 | @@ -XXX,XX +XXX,XX @@ static void armv7m_realize(DeviceState *dev, Error **errp) |
104 | * The simplest way to go is to examine affinity IDs of all our CPUs. If | 38 | &s->sysreg_ns_mem); |
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 | } | 39 | } |
138 | 40 | ||
139 | qemu_fdt_add_subnode(vms->fdt, "/pmu"); | 41 | - /* Create and map the systick devices */ |
140 | @@ -XXX,XX +XXX,XX @@ static void finalize_gic_version(VirtMachineState *vms) | 42 | - qdev_connect_clock_in(DEVICE(&s->systick[M_REG_NS]), "refclk", s->refclk); |
141 | * virt_cpu_post_init() must be called after the CPUs have | 43 | + /* |
142 | * been realized and the GIC has been created. | 44 | + * Create and map the systick devices. Note that we only connect |
143 | */ | 45 | + * refclk if it has been connected to us; otherwise the systick |
144 | -static void virt_cpu_post_init(VirtMachineState *vms, int max_cpus, | 46 | + * device gets the wrong answer for clock_has_source(refclk), because |
145 | - MemoryRegion *sysmem) | 47 | + * it has an immediate source (the ARMv7M's clock object) but not |
146 | +static void virt_cpu_post_init(VirtMachineState *vms, MemoryRegion *sysmem) | 48 | + * an ultimate source, and then it won't correctly auto-select the |
147 | { | 49 | + * CPU clock as its only possible clock source. |
148 | + int max_cpus = MACHINE(vms)->smp.max_cpus; | 50 | + */ |
149 | bool aarch64, pmu, steal_time; | 51 | + if (clock_has_source(s->refclk)) { |
150 | CPUState *cpu; | 52 | + qdev_connect_clock_in(DEVICE(&s->systick[M_REG_NS]), "refclk", |
151 | 53 | + s->refclk); | |
152 | @@ -XXX,XX +XXX,XX @@ static void machvirt_init(MachineState *machine) | 54 | + } |
153 | exit(1); | 55 | qdev_connect_clock_in(DEVICE(&s->systick[M_REG_NS]), "cpuclk", s->cpuclk); |
154 | } | 56 | if (!sysbus_realize(SYS_BUS_DEVICE(&s->systick[M_REG_NS]), errp)) { |
155 | 57 | return; | |
156 | - vms->smp_cpus = smp_cpus; | 58 | @@ -XXX,XX +XXX,XX @@ static void armv7m_realize(DeviceState *dev, Error **errp) |
157 | - | 59 | */ |
158 | if (vms->virt && kvm_enabled()) { | 60 | object_initialize_child(OBJECT(dev), "systick-reg-s", |
159 | error_report("mach-virt: KVM does not support providing " | 61 | &s->systick[M_REG_S], TYPE_SYSTICK); |
160 | "Virtualization extensions to the guest CPU"); | 62 | - qdev_connect_clock_in(DEVICE(&s->systick[M_REG_S]), "refclk", |
161 | @@ -XXX,XX +XXX,XX @@ static void machvirt_init(MachineState *machine) | 63 | - s->refclk); |
162 | create_fdt(vms); | 64 | + if (clock_has_source(s->refclk)) { |
163 | 65 | + qdev_connect_clock_in(DEVICE(&s->systick[M_REG_S]), "refclk", | |
164 | possible_cpus = mc->possible_cpu_arch_ids(machine); | 66 | + s->refclk); |
165 | + assert(possible_cpus->len == max_cpus); | 67 | + } |
166 | for (n = 0; n < possible_cpus->len; n++) { | 68 | qdev_connect_clock_in(DEVICE(&s->systick[M_REG_S]), "cpuclk", |
167 | Object *cpuobj; | 69 | s->cpuclk); |
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 | 70 | ||
178 | -- | 71 | -- |
179 | 2.20.1 | 72 | 2.25.1 |
180 | 73 | ||
181 | 74 | diff view generated by jsdifflib |
1 | This commit is the result of running the timer-del-timer-free.cocci | 1 | The function qemu_madvise() and the QEMU_MADV_* constants associated |
---|---|---|---|
2 | script on the whole source tree. | 2 | with it are used in only 10 files. Move them out of osdep.h to a new |
3 | qemu/madvise.h header that is included where it is needed. | ||
3 | 4 | ||
4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
5 | Acked-by: Corey Minyard <cminyard@mvista.com> | 6 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
6 | Acked-by: Paolo Bonzini <pbonzini@redhat.com> | ||
7 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
9 | Message-id: 20201215154107.3255-4-peter.maydell@linaro.org | 8 | Message-id: 20220208200856.3558249-2-peter.maydell@linaro.org |
10 | --- | 9 | --- |
11 | block/iscsi.c | 2 -- | 10 | include/qemu/madvise.h | 95 ++++++++++++++++++++++++++++++++++++++ |
12 | block/nbd.c | 1 - | 11 | include/qemu/osdep.h | 82 -------------------------------- |
13 | block/qcow2.c | 1 - | 12 | backends/hostmem-file.c | 1 + |
14 | hw/block/nvme.c | 2 -- | 13 | backends/hostmem.c | 1 + |
15 | hw/char/serial.c | 2 -- | 14 | hw/virtio/virtio-balloon.c | 1 + |
16 | hw/char/virtio-serial-bus.c | 2 -- | 15 | migration/postcopy-ram.c | 1 + |
17 | hw/ide/core.c | 1 - | 16 | migration/qemu-file.c | 1 + |
18 | hw/input/hid.c | 1 - | 17 | migration/ram.c | 1 + |
19 | hw/intc/apic.c | 1 - | 18 | softmmu/physmem.c | 1 + |
20 | hw/intc/ioapic.c | 1 - | 19 | tcg/region.c | 1 + |
21 | hw/ipmi/ipmi_bmc_extern.c | 1 - | 20 | util/osdep.c | 1 + |
22 | hw/net/e1000.c | 3 --- | 21 | util/oslib-posix.c | 1 + |
23 | hw/net/e1000e_core.c | 8 -------- | 22 | 12 files changed, 105 insertions(+), 82 deletions(-) |
24 | hw/net/pcnet-pci.c | 1 - | 23 | create mode 100644 include/qemu/madvise.h |
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 | 24 | ||
55 | diff --git a/block/iscsi.c b/block/iscsi.c | 25 | diff --git a/include/qemu/madvise.h b/include/qemu/madvise.h |
56 | index XXXXXXX..XXXXXXX 100644 | 26 | new file mode 100644 |
57 | --- a/block/iscsi.c | 27 | index XXXXXXX..XXXXXXX |
58 | +++ b/block/iscsi.c | 28 | --- /dev/null |
59 | @@ -XXX,XX +XXX,XX @@ static void iscsi_detach_aio_context(BlockDriverState *bs) | 29 | +++ b/include/qemu/madvise.h |
60 | iscsilun->events = 0; | 30 | @@ -XXX,XX +XXX,XX @@ |
61 | 31 | +/* | |
62 | if (iscsilun->nop_timer) { | 32 | + * QEMU madvise wrapper functions |
63 | - timer_del(iscsilun->nop_timer); | 33 | + * |
64 | timer_free(iscsilun->nop_timer); | 34 | + * This work is licensed under the terms of the GNU GPL, version 2 or later. |
65 | iscsilun->nop_timer = NULL; | 35 | + * See the COPYING file in the top-level directory. |
66 | } | 36 | + */ |
67 | if (iscsilun->event_timer) { | 37 | + |
68 | - timer_del(iscsilun->event_timer); | 38 | +#ifndef QEMU_MADVISE_H |
69 | timer_free(iscsilun->event_timer); | 39 | +#define QEMU_MADVISE_H |
70 | iscsilun->event_timer = NULL; | 40 | + |
71 | } | 41 | +#define QEMU_MADV_INVALID -1 |
72 | diff --git a/block/nbd.c b/block/nbd.c | 42 | + |
73 | index XXXXXXX..XXXXXXX 100644 | 43 | +#if defined(CONFIG_MADVISE) |
74 | --- a/block/nbd.c | 44 | + |
75 | +++ b/block/nbd.c | 45 | +#define QEMU_MADV_WILLNEED MADV_WILLNEED |
76 | @@ -XXX,XX +XXX,XX @@ static void nbd_recv_coroutines_wake_all(BDRVNBDState *s) | 46 | +#define QEMU_MADV_DONTNEED MADV_DONTNEED |
77 | static void reconnect_delay_timer_del(BDRVNBDState *s) | 47 | +#ifdef MADV_DONTFORK |
78 | { | 48 | +#define QEMU_MADV_DONTFORK MADV_DONTFORK |
79 | if (s->reconnect_delay_timer) { | 49 | +#else |
80 | - timer_del(s->reconnect_delay_timer); | 50 | +#define QEMU_MADV_DONTFORK QEMU_MADV_INVALID |
81 | timer_free(s->reconnect_delay_timer); | 51 | +#endif |
82 | s->reconnect_delay_timer = NULL; | 52 | +#ifdef MADV_MERGEABLE |
83 | } | 53 | +#define QEMU_MADV_MERGEABLE MADV_MERGEABLE |
84 | diff --git a/block/qcow2.c b/block/qcow2.c | 54 | +#else |
85 | index XXXXXXX..XXXXXXX 100644 | 55 | +#define QEMU_MADV_MERGEABLE QEMU_MADV_INVALID |
86 | --- a/block/qcow2.c | 56 | +#endif |
87 | +++ b/block/qcow2.c | 57 | +#ifdef MADV_UNMERGEABLE |
88 | @@ -XXX,XX +XXX,XX @@ static void cache_clean_timer_del(BlockDriverState *bs) | 58 | +#define QEMU_MADV_UNMERGEABLE MADV_UNMERGEABLE |
89 | { | 59 | +#else |
90 | BDRVQcow2State *s = bs->opaque; | 60 | +#define QEMU_MADV_UNMERGEABLE QEMU_MADV_INVALID |
91 | if (s->cache_clean_timer) { | 61 | +#endif |
92 | - timer_del(s->cache_clean_timer); | 62 | +#ifdef MADV_DODUMP |
93 | timer_free(s->cache_clean_timer); | 63 | +#define QEMU_MADV_DODUMP MADV_DODUMP |
94 | s->cache_clean_timer = NULL; | 64 | +#else |
95 | } | 65 | +#define QEMU_MADV_DODUMP QEMU_MADV_INVALID |
96 | diff --git a/hw/block/nvme.c b/hw/block/nvme.c | 66 | +#endif |
97 | index XXXXXXX..XXXXXXX 100644 | 67 | +#ifdef MADV_DONTDUMP |
98 | --- a/hw/block/nvme.c | 68 | +#define QEMU_MADV_DONTDUMP MADV_DONTDUMP |
99 | +++ b/hw/block/nvme.c | 69 | +#else |
100 | @@ -XXX,XX +XXX,XX @@ static uint16_t nvme_io_cmd(NvmeCtrl *n, NvmeRequest *req) | 70 | +#define QEMU_MADV_DONTDUMP QEMU_MADV_INVALID |
101 | static void nvme_free_sq(NvmeSQueue *sq, NvmeCtrl *n) | 71 | +#endif |
102 | { | 72 | +#ifdef MADV_HUGEPAGE |
103 | n->sq[sq->sqid] = NULL; | 73 | +#define QEMU_MADV_HUGEPAGE MADV_HUGEPAGE |
104 | - timer_del(sq->timer); | 74 | +#else |
105 | timer_free(sq->timer); | 75 | +#define QEMU_MADV_HUGEPAGE QEMU_MADV_INVALID |
106 | g_free(sq->io_req); | 76 | +#endif |
107 | if (sq->sqid) { | 77 | +#ifdef MADV_NOHUGEPAGE |
108 | @@ -XXX,XX +XXX,XX @@ static uint16_t nvme_get_log(NvmeCtrl *n, NvmeRequest *req) | 78 | +#define QEMU_MADV_NOHUGEPAGE MADV_NOHUGEPAGE |
109 | static void nvme_free_cq(NvmeCQueue *cq, NvmeCtrl *n) | 79 | +#else |
110 | { | 80 | +#define QEMU_MADV_NOHUGEPAGE QEMU_MADV_INVALID |
111 | n->cq[cq->cqid] = NULL; | 81 | +#endif |
112 | - timer_del(cq->timer); | 82 | +#ifdef MADV_REMOVE |
113 | timer_free(cq->timer); | 83 | +#define QEMU_MADV_REMOVE MADV_REMOVE |
114 | msix_vector_unuse(&n->parent_obj, cq->vector); | 84 | +#else |
115 | if (cq->cqid) { | 85 | +#define QEMU_MADV_REMOVE QEMU_MADV_DONTNEED |
116 | diff --git a/hw/char/serial.c b/hw/char/serial.c | 86 | +#endif |
117 | index XXXXXXX..XXXXXXX 100644 | 87 | +#ifdef MADV_POPULATE_WRITE |
118 | --- a/hw/char/serial.c | 88 | +#define QEMU_MADV_POPULATE_WRITE MADV_POPULATE_WRITE |
119 | +++ b/hw/char/serial.c | 89 | +#else |
120 | @@ -XXX,XX +XXX,XX @@ static void serial_unrealize(DeviceState *dev) | 90 | +#define QEMU_MADV_POPULATE_WRITE QEMU_MADV_INVALID |
121 | 91 | +#endif | |
122 | qemu_chr_fe_deinit(&s->chr, false); | 92 | + |
123 | 93 | +#elif defined(CONFIG_POSIX_MADVISE) | |
124 | - timer_del(s->modem_status_poll); | 94 | + |
125 | timer_free(s->modem_status_poll); | 95 | +#define QEMU_MADV_WILLNEED POSIX_MADV_WILLNEED |
126 | 96 | +#define QEMU_MADV_DONTNEED POSIX_MADV_DONTNEED | |
127 | - timer_del(s->fifo_timeout_timer); | 97 | +#define QEMU_MADV_DONTFORK QEMU_MADV_INVALID |
128 | timer_free(s->fifo_timeout_timer); | 98 | +#define QEMU_MADV_MERGEABLE QEMU_MADV_INVALID |
129 | 99 | +#define QEMU_MADV_UNMERGEABLE QEMU_MADV_INVALID | |
130 | fifo8_destroy(&s->recv_fifo); | 100 | +#define QEMU_MADV_DODUMP QEMU_MADV_INVALID |
131 | diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c | 101 | +#define QEMU_MADV_DONTDUMP QEMU_MADV_INVALID |
132 | index XXXXXXX..XXXXXXX 100644 | 102 | +#define QEMU_MADV_HUGEPAGE QEMU_MADV_INVALID |
133 | --- a/hw/char/virtio-serial-bus.c | 103 | +#define QEMU_MADV_NOHUGEPAGE QEMU_MADV_INVALID |
134 | +++ b/hw/char/virtio-serial-bus.c | 104 | +#define QEMU_MADV_REMOVE QEMU_MADV_DONTNEED |
135 | @@ -XXX,XX +XXX,XX @@ static void virtio_serial_post_load_timer_cb(void *opaque) | 105 | +#define QEMU_MADV_POPULATE_WRITE QEMU_MADV_INVALID |
136 | } | 106 | + |
137 | } | 107 | +#else /* no-op */ |
138 | g_free(s->post_load->connected); | 108 | + |
139 | - timer_del(s->post_load->timer); | 109 | +#define QEMU_MADV_WILLNEED QEMU_MADV_INVALID |
140 | timer_free(s->post_load->timer); | 110 | +#define QEMU_MADV_DONTNEED QEMU_MADV_INVALID |
141 | g_free(s->post_load); | 111 | +#define QEMU_MADV_DONTFORK QEMU_MADV_INVALID |
142 | s->post_load = NULL; | 112 | +#define QEMU_MADV_MERGEABLE QEMU_MADV_INVALID |
143 | @@ -XXX,XX +XXX,XX @@ static void virtio_serial_device_unrealize(DeviceState *dev) | 113 | +#define QEMU_MADV_UNMERGEABLE QEMU_MADV_INVALID |
144 | g_free(vser->ports_map); | 114 | +#define QEMU_MADV_DODUMP QEMU_MADV_INVALID |
145 | if (vser->post_load) { | 115 | +#define QEMU_MADV_DONTDUMP QEMU_MADV_INVALID |
146 | g_free(vser->post_load->connected); | 116 | +#define QEMU_MADV_HUGEPAGE QEMU_MADV_INVALID |
147 | - timer_del(vser->post_load->timer); | 117 | +#define QEMU_MADV_NOHUGEPAGE QEMU_MADV_INVALID |
148 | timer_free(vser->post_load->timer); | 118 | +#define QEMU_MADV_REMOVE QEMU_MADV_INVALID |
149 | g_free(vser->post_load); | 119 | +#define QEMU_MADV_POPULATE_WRITE QEMU_MADV_INVALID |
150 | } | 120 | + |
151 | diff --git a/hw/ide/core.c b/hw/ide/core.c | 121 | +#endif |
152 | index XXXXXXX..XXXXXXX 100644 | 122 | + |
153 | --- a/hw/ide/core.c | 123 | +int qemu_madvise(void *addr, size_t len, int advice); |
154 | +++ b/hw/ide/core.c | 124 | + |
155 | @@ -XXX,XX +XXX,XX @@ void ide_init2(IDEBus *bus, qemu_irq irq) | 125 | +#endif |
156 | 126 | diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h | |
157 | void ide_exit(IDEState *s) | 127 | index XXXXXXX..XXXXXXX 100644 |
158 | { | 128 | --- a/include/qemu/osdep.h |
159 | - timer_del(s->sector_write_timer); | 129 | +++ b/include/qemu/osdep.h |
160 | timer_free(s->sector_write_timer); | 130 | @@ -XXX,XX +XXX,XX @@ static inline void qemu_cleanup_generic_vfree(void *p) |
161 | qemu_vfree(s->smart_selftest_data); | 131 | #define QEMU_MAP_NORESERVE (1 << 3) |
162 | qemu_vfree(s->io_buffer); | 132 | |
163 | diff --git a/hw/input/hid.c b/hw/input/hid.c | 133 | |
164 | index XXXXXXX..XXXXXXX 100644 | 134 | -#define QEMU_MADV_INVALID -1 |
165 | --- a/hw/input/hid.c | 135 | - |
166 | +++ b/hw/input/hid.c | 136 | -#if defined(CONFIG_MADVISE) |
167 | @@ -XXX,XX +XXX,XX @@ static void hid_idle_timer(void *opaque) | 137 | - |
168 | static void hid_del_idle_timer(HIDState *hs) | 138 | -#define QEMU_MADV_WILLNEED MADV_WILLNEED |
169 | { | 139 | -#define QEMU_MADV_DONTNEED MADV_DONTNEED |
170 | if (hs->idle_timer) { | 140 | -#ifdef MADV_DONTFORK |
171 | - timer_del(hs->idle_timer); | 141 | -#define QEMU_MADV_DONTFORK MADV_DONTFORK |
172 | timer_free(hs->idle_timer); | 142 | -#else |
173 | hs->idle_timer = NULL; | 143 | -#define QEMU_MADV_DONTFORK QEMU_MADV_INVALID |
174 | } | 144 | -#endif |
175 | diff --git a/hw/intc/apic.c b/hw/intc/apic.c | 145 | -#ifdef MADV_MERGEABLE |
176 | index XXXXXXX..XXXXXXX 100644 | 146 | -#define QEMU_MADV_MERGEABLE MADV_MERGEABLE |
177 | --- a/hw/intc/apic.c | 147 | -#else |
178 | +++ b/hw/intc/apic.c | 148 | -#define QEMU_MADV_MERGEABLE QEMU_MADV_INVALID |
179 | @@ -XXX,XX +XXX,XX @@ static void apic_unrealize(DeviceState *dev) | 149 | -#endif |
180 | { | 150 | -#ifdef MADV_UNMERGEABLE |
181 | APICCommonState *s = APIC(dev); | 151 | -#define QEMU_MADV_UNMERGEABLE MADV_UNMERGEABLE |
182 | 152 | -#else | |
183 | - timer_del(s->timer); | 153 | -#define QEMU_MADV_UNMERGEABLE QEMU_MADV_INVALID |
184 | timer_free(s->timer); | 154 | -#endif |
185 | local_apics[s->id] = NULL; | 155 | -#ifdef MADV_DODUMP |
186 | } | 156 | -#define QEMU_MADV_DODUMP MADV_DODUMP |
187 | diff --git a/hw/intc/ioapic.c b/hw/intc/ioapic.c | 157 | -#else |
188 | index XXXXXXX..XXXXXXX 100644 | 158 | -#define QEMU_MADV_DODUMP QEMU_MADV_INVALID |
189 | --- a/hw/intc/ioapic.c | 159 | -#endif |
190 | +++ b/hw/intc/ioapic.c | 160 | -#ifdef MADV_DONTDUMP |
191 | @@ -XXX,XX +XXX,XX @@ static void ioapic_unrealize(DeviceState *dev) | 161 | -#define QEMU_MADV_DONTDUMP MADV_DONTDUMP |
192 | { | 162 | -#else |
193 | IOAPICCommonState *s = IOAPIC_COMMON(dev); | 163 | -#define QEMU_MADV_DONTDUMP QEMU_MADV_INVALID |
194 | 164 | -#endif | |
195 | - timer_del(s->delayed_ioapic_service_timer); | 165 | -#ifdef MADV_HUGEPAGE |
196 | timer_free(s->delayed_ioapic_service_timer); | 166 | -#define QEMU_MADV_HUGEPAGE MADV_HUGEPAGE |
197 | } | 167 | -#else |
198 | 168 | -#define QEMU_MADV_HUGEPAGE QEMU_MADV_INVALID | |
199 | diff --git a/hw/ipmi/ipmi_bmc_extern.c b/hw/ipmi/ipmi_bmc_extern.c | 169 | -#endif |
200 | index XXXXXXX..XXXXXXX 100644 | 170 | -#ifdef MADV_NOHUGEPAGE |
201 | --- a/hw/ipmi/ipmi_bmc_extern.c | 171 | -#define QEMU_MADV_NOHUGEPAGE MADV_NOHUGEPAGE |
202 | +++ b/hw/ipmi/ipmi_bmc_extern.c | 172 | -#else |
203 | @@ -XXX,XX +XXX,XX @@ static void ipmi_bmc_extern_finalize(Object *obj) | 173 | -#define QEMU_MADV_NOHUGEPAGE QEMU_MADV_INVALID |
204 | { | 174 | -#endif |
205 | IPMIBmcExtern *ibe = IPMI_BMC_EXTERN(obj); | 175 | -#ifdef MADV_REMOVE |
206 | 176 | -#define QEMU_MADV_REMOVE MADV_REMOVE | |
207 | - timer_del(ibe->extern_timer); | 177 | -#else |
208 | timer_free(ibe->extern_timer); | 178 | -#define QEMU_MADV_REMOVE QEMU_MADV_DONTNEED |
209 | } | 179 | -#endif |
210 | 180 | -#ifdef MADV_POPULATE_WRITE | |
211 | diff --git a/hw/net/e1000.c b/hw/net/e1000.c | 181 | -#define QEMU_MADV_POPULATE_WRITE MADV_POPULATE_WRITE |
212 | index XXXXXXX..XXXXXXX 100644 | 182 | -#else |
213 | --- a/hw/net/e1000.c | 183 | -#define QEMU_MADV_POPULATE_WRITE QEMU_MADV_INVALID |
214 | +++ b/hw/net/e1000.c | 184 | -#endif |
215 | @@ -XXX,XX +XXX,XX @@ pci_e1000_uninit(PCIDevice *dev) | 185 | - |
216 | { | 186 | -#elif defined(CONFIG_POSIX_MADVISE) |
217 | E1000State *d = E1000(dev); | 187 | - |
218 | 188 | -#define QEMU_MADV_WILLNEED POSIX_MADV_WILLNEED | |
219 | - timer_del(d->autoneg_timer); | 189 | -#define QEMU_MADV_DONTNEED POSIX_MADV_DONTNEED |
220 | timer_free(d->autoneg_timer); | 190 | -#define QEMU_MADV_DONTFORK QEMU_MADV_INVALID |
221 | - timer_del(d->mit_timer); | 191 | -#define QEMU_MADV_MERGEABLE QEMU_MADV_INVALID |
222 | timer_free(d->mit_timer); | 192 | -#define QEMU_MADV_UNMERGEABLE QEMU_MADV_INVALID |
223 | - timer_del(d->flush_queue_timer); | 193 | -#define QEMU_MADV_DODUMP QEMU_MADV_INVALID |
224 | timer_free(d->flush_queue_timer); | 194 | -#define QEMU_MADV_DONTDUMP QEMU_MADV_INVALID |
225 | qemu_del_nic(d->nic); | 195 | -#define QEMU_MADV_HUGEPAGE QEMU_MADV_INVALID |
226 | } | 196 | -#define QEMU_MADV_NOHUGEPAGE QEMU_MADV_INVALID |
227 | diff --git a/hw/net/e1000e_core.c b/hw/net/e1000e_core.c | 197 | -#define QEMU_MADV_REMOVE QEMU_MADV_DONTNEED |
228 | index XXXXXXX..XXXXXXX 100644 | 198 | -#define QEMU_MADV_POPULATE_WRITE QEMU_MADV_INVALID |
229 | --- a/hw/net/e1000e_core.c | 199 | - |
230 | +++ b/hw/net/e1000e_core.c | 200 | -#else /* no-op */ |
231 | @@ -XXX,XX +XXX,XX @@ e1000e_intrmgr_pci_unint(E1000ECore *core) | 201 | - |
232 | { | 202 | -#define QEMU_MADV_WILLNEED QEMU_MADV_INVALID |
233 | int i; | 203 | -#define QEMU_MADV_DONTNEED QEMU_MADV_INVALID |
234 | 204 | -#define QEMU_MADV_DONTFORK QEMU_MADV_INVALID | |
235 | - timer_del(core->radv.timer); | 205 | -#define QEMU_MADV_MERGEABLE QEMU_MADV_INVALID |
236 | timer_free(core->radv.timer); | 206 | -#define QEMU_MADV_UNMERGEABLE QEMU_MADV_INVALID |
237 | - timer_del(core->rdtr.timer); | 207 | -#define QEMU_MADV_DODUMP QEMU_MADV_INVALID |
238 | timer_free(core->rdtr.timer); | 208 | -#define QEMU_MADV_DONTDUMP QEMU_MADV_INVALID |
239 | - timer_del(core->raid.timer); | 209 | -#define QEMU_MADV_HUGEPAGE QEMU_MADV_INVALID |
240 | timer_free(core->raid.timer); | 210 | -#define QEMU_MADV_NOHUGEPAGE QEMU_MADV_INVALID |
241 | 211 | -#define QEMU_MADV_REMOVE QEMU_MADV_INVALID | |
242 | - timer_del(core->tadv.timer); | 212 | -#define QEMU_MADV_POPULATE_WRITE QEMU_MADV_INVALID |
243 | timer_free(core->tadv.timer); | 213 | - |
244 | - timer_del(core->tidv.timer); | 214 | -#endif |
245 | timer_free(core->tidv.timer); | 215 | |
246 | 216 | #ifdef _WIN32 | |
247 | - timer_del(core->itr.timer); | 217 | #define HAVE_CHARDEV_SERIAL 1 |
248 | timer_free(core->itr.timer); | 218 | @@ -XXX,XX +XXX,XX @@ void sigaction_invoke(struct sigaction *action, |
249 | 219 | struct qemu_signalfd_siginfo *info); | |
250 | for (i = 0; i < E1000E_MSIX_VEC_NUM; i++) { | 220 | #endif |
251 | - timer_del(core->eitr[i].timer); | 221 | |
252 | timer_free(core->eitr[i].timer); | 222 | -int qemu_madvise(void *addr, size_t len, int advice); |
253 | } | 223 | int qemu_mprotect_rw(void *addr, size_t size); |
254 | } | 224 | int qemu_mprotect_rwx(void *addr, size_t size); |
255 | @@ -XXX,XX +XXX,XX @@ e1000e_core_pci_uninit(E1000ECore *core) | 225 | int qemu_mprotect_none(void *addr, size_t size); |
256 | { | 226 | diff --git a/backends/hostmem-file.c b/backends/hostmem-file.c |
257 | int i; | 227 | index XXXXXXX..XXXXXXX 100644 |
258 | 228 | --- a/backends/hostmem-file.c | |
259 | - timer_del(core->autoneg_timer); | 229 | +++ b/backends/hostmem-file.c |
260 | timer_free(core->autoneg_timer); | 230 | @@ -XXX,XX +XXX,XX @@ |
261 | 231 | #include "qapi/error.h" | |
262 | e1000e_intrmgr_pci_unint(core); | 232 | #include "qemu/error-report.h" |
263 | diff --git a/hw/net/pcnet-pci.c b/hw/net/pcnet-pci.c | 233 | #include "qemu/module.h" |
264 | index XXXXXXX..XXXXXXX 100644 | 234 | +#include "qemu/madvise.h" |
265 | --- a/hw/net/pcnet-pci.c | 235 | #include "sysemu/hostmem.h" |
266 | +++ b/hw/net/pcnet-pci.c | 236 | #include "qom/object_interfaces.h" |
267 | @@ -XXX,XX +XXX,XX @@ static void pci_pcnet_uninit(PCIDevice *dev) | 237 | #include "qom/object.h" |
268 | PCIPCNetState *d = PCI_PCNET(dev); | 238 | diff --git a/backends/hostmem.c b/backends/hostmem.c |
269 | 239 | index XXXXXXX..XXXXXXX 100644 | |
270 | qemu_free_irq(d->state.irq); | 240 | --- a/backends/hostmem.c |
271 | - timer_del(d->state.poll_timer); | 241 | +++ b/backends/hostmem.c |
272 | timer_free(d->state.poll_timer); | 242 | @@ -XXX,XX +XXX,XX @@ |
273 | qemu_del_nic(d->state.nic); | 243 | #include "qemu/config-file.h" |
274 | } | 244 | #include "qom/object_interfaces.h" |
275 | diff --git a/hw/net/rtl8139.c b/hw/net/rtl8139.c | 245 | #include "qemu/mmap-alloc.h" |
276 | index XXXXXXX..XXXXXXX 100644 | 246 | +#include "qemu/madvise.h" |
277 | --- a/hw/net/rtl8139.c | 247 | |
278 | +++ b/hw/net/rtl8139.c | 248 | #ifdef CONFIG_NUMA |
279 | @@ -XXX,XX +XXX,XX @@ static void pci_rtl8139_uninit(PCIDevice *dev) | 249 | #include <numaif.h> |
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 | 250 | diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c |
454 | index XXXXXXX..XXXXXXX 100644 | 251 | index XXXXXXX..XXXXXXX 100644 |
455 | --- a/hw/virtio/virtio-balloon.c | 252 | --- a/hw/virtio/virtio-balloon.c |
456 | +++ b/hw/virtio/virtio-balloon.c | 253 | +++ b/hw/virtio/virtio-balloon.c |
457 | @@ -XXX,XX +XXX,XX @@ static bool balloon_stats_enabled(const VirtIOBalloon *s) | 254 | @@ -XXX,XX +XXX,XX @@ |
458 | static void balloon_stats_destroy_timer(VirtIOBalloon *s) | 255 | #include "qemu/iov.h" |
459 | { | 256 | #include "qemu/module.h" |
460 | if (balloon_stats_enabled(s)) { | 257 | #include "qemu/timer.h" |
461 | - timer_del(s->stats_timer); | 258 | +#include "qemu/madvise.h" |
462 | timer_free(s->stats_timer); | 259 | #include "hw/virtio/virtio.h" |
463 | s->stats_timer = NULL; | 260 | #include "hw/mem/pc-dimm.h" |
464 | s->stats_poll_interval = 0; | 261 | #include "hw/qdev-properties.h" |
465 | diff --git a/hw/virtio/virtio-rng.c b/hw/virtio/virtio-rng.c | 262 | diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c |
466 | index XXXXXXX..XXXXXXX 100644 | 263 | index XXXXXXX..XXXXXXX 100644 |
467 | --- a/hw/virtio/virtio-rng.c | 264 | --- a/migration/postcopy-ram.c |
468 | +++ b/hw/virtio/virtio-rng.c | 265 | +++ b/migration/postcopy-ram.c |
469 | @@ -XXX,XX +XXX,XX @@ static void virtio_rng_device_unrealize(DeviceState *dev) | 266 | @@ -XXX,XX +XXX,XX @@ |
470 | VirtIORNG *vrng = VIRTIO_RNG(dev); | 267 | |
471 | 268 | #include "qemu/osdep.h" | |
472 | qemu_del_vm_change_state_handler(vrng->vmstate); | 269 | #include "qemu/rcu.h" |
473 | - timer_del(vrng->rate_limit_timer); | 270 | +#include "qemu/madvise.h" |
474 | timer_free(vrng->rate_limit_timer); | 271 | #include "exec/target_page.h" |
475 | virtio_del_queue(vdev, 0); | 272 | #include "migration.h" |
476 | virtio_cleanup(vdev); | 273 | #include "qemu-file.h" |
477 | diff --git a/hw/watchdog/wdt_diag288.c b/hw/watchdog/wdt_diag288.c | 274 | diff --git a/migration/qemu-file.c b/migration/qemu-file.c |
478 | index XXXXXXX..XXXXXXX 100644 | 275 | index XXXXXXX..XXXXXXX 100644 |
479 | --- a/hw/watchdog/wdt_diag288.c | 276 | --- a/migration/qemu-file.c |
480 | +++ b/hw/watchdog/wdt_diag288.c | 277 | +++ b/migration/qemu-file.c |
481 | @@ -XXX,XX +XXX,XX @@ static void wdt_diag288_unrealize(DeviceState *dev) | 278 | @@ -XXX,XX +XXX,XX @@ |
482 | { | 279 | */ |
483 | DIAG288State *diag288 = DIAG288(dev); | 280 | #include "qemu/osdep.h" |
484 | 281 | #include <zlib.h> | |
485 | - timer_del(diag288->timer); | 282 | +#include "qemu/madvise.h" |
486 | timer_free(diag288->timer); | 283 | #include "qemu/error-report.h" |
487 | } | 284 | #include "qemu/iov.h" |
488 | 285 | #include "migration.h" | |
489 | diff --git a/hw/watchdog/wdt_i6300esb.c b/hw/watchdog/wdt_i6300esb.c | 286 | diff --git a/migration/ram.c b/migration/ram.c |
490 | index XXXXXXX..XXXXXXX 100644 | 287 | index XXXXXXX..XXXXXXX 100644 |
491 | --- a/hw/watchdog/wdt_i6300esb.c | 288 | --- a/migration/ram.c |
492 | +++ b/hw/watchdog/wdt_i6300esb.c | 289 | +++ b/migration/ram.c |
493 | @@ -XXX,XX +XXX,XX @@ static void i6300esb_exit(PCIDevice *dev) | 290 | @@ -XXX,XX +XXX,XX @@ |
494 | { | 291 | #include "qemu/cutils.h" |
495 | I6300State *d = WATCHDOG_I6300ESB_DEVICE(dev); | 292 | #include "qemu/bitops.h" |
496 | 293 | #include "qemu/bitmap.h" | |
497 | - timer_del(d->timer); | 294 | +#include "qemu/madvise.h" |
498 | timer_free(d->timer); | 295 | #include "qemu/main-loop.h" |
499 | } | 296 | #include "xbzrle.h" |
500 | 297 | #include "ram.h" | |
501 | diff --git a/migration/colo.c b/migration/colo.c | 298 | diff --git a/softmmu/physmem.c b/softmmu/physmem.c |
502 | index XXXXXXX..XXXXXXX 100644 | 299 | index XXXXXXX..XXXXXXX 100644 |
503 | --- a/migration/colo.c | 300 | --- a/softmmu/physmem.c |
504 | +++ b/migration/colo.c | 301 | +++ b/softmmu/physmem.c |
505 | @@ -XXX,XX +XXX,XX @@ out: | 302 | @@ -XXX,XX +XXX,XX @@ |
506 | * error. | 303 | |
507 | */ | 304 | #include "qemu/cutils.h" |
508 | colo_compare_unregister_notifier(&packets_compare_notifier); | 305 | #include "qemu/cacheflush.h" |
509 | - timer_del(s->colo_delay_timer); | 306 | +#include "qemu/madvise.h" |
510 | timer_free(s->colo_delay_timer); | 307 | |
511 | qemu_event_destroy(&s->colo_checkpoint_event); | 308 | #ifdef CONFIG_TCG |
512 | 309 | #include "hw/core/tcg-cpu-ops.h" | |
513 | diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c | 310 | diff --git a/tcg/region.c b/tcg/region.c |
514 | index XXXXXXX..XXXXXXX 100644 | 311 | index XXXXXXX..XXXXXXX 100644 |
515 | --- a/monitor/hmp-cmds.c | 312 | --- a/tcg/region.c |
516 | +++ b/monitor/hmp-cmds.c | 313 | +++ b/tcg/region.c |
517 | @@ -XXX,XX +XXX,XX @@ static void hmp_migrate_status_cb(void *opaque) | 314 | @@ -XXX,XX +XXX,XX @@ |
518 | error_report("%s", info->error_desc); | 315 | |
519 | } | 316 | #include "qemu/osdep.h" |
520 | monitor_resume(status->mon); | 317 | #include "qemu/units.h" |
521 | - timer_del(status->timer); | 318 | +#include "qemu/madvise.h" |
522 | timer_free(status->timer); | 319 | #include "qapi/error.h" |
523 | g_free(status); | 320 | #include "exec/exec-all.h" |
524 | } | 321 | #include "tcg/tcg.h" |
525 | diff --git a/net/announce.c b/net/announce.c | 322 | diff --git a/util/osdep.c b/util/osdep.c |
526 | index XXXXXXX..XXXXXXX 100644 | 323 | index XXXXXXX..XXXXXXX 100644 |
527 | --- a/net/announce.c | 324 | --- a/util/osdep.c |
528 | +++ b/net/announce.c | 325 | +++ b/util/osdep.c |
529 | @@ -XXX,XX +XXX,XX @@ void qemu_announce_timer_del(AnnounceTimer *timer, bool free_named) | 326 | @@ -XXX,XX +XXX,XX @@ extern int madvise(char *, size_t, int); |
530 | { | 327 | #include "qemu/cutils.h" |
531 | bool free_timer = false; | 328 | #include "qemu/sockets.h" |
532 | if (timer->tm) { | 329 | #include "qemu/error-report.h" |
533 | - timer_del(timer->tm); | 330 | +#include "qemu/madvise.h" |
534 | timer_free(timer->tm); | 331 | #include "monitor/monitor.h" |
535 | timer->tm = NULL; | 332 | |
536 | } | 333 | static bool fips_enabled = false; |
537 | diff --git a/net/colo-compare.c b/net/colo-compare.c | 334 | diff --git a/util/oslib-posix.c b/util/oslib-posix.c |
538 | index XXXXXXX..XXXXXXX 100644 | 335 | index XXXXXXX..XXXXXXX 100644 |
539 | --- a/net/colo-compare.c | 336 | --- a/util/oslib-posix.c |
540 | +++ b/net/colo-compare.c | 337 | +++ b/util/oslib-posix.c |
541 | @@ -XXX,XX +XXX,XX @@ static void colo_compare_timer_init(CompareState *s) | 338 | @@ -XXX,XX +XXX,XX @@ |
542 | static void colo_compare_timer_del(CompareState *s) | 339 | #include "trace.h" |
543 | { | 340 | #include "qapi/error.h" |
544 | if (s->packet_check_timer) { | 341 | #include "qemu/error-report.h" |
545 | - timer_del(s->packet_check_timer); | 342 | +#include "qemu/madvise.h" |
546 | timer_free(s->packet_check_timer); | 343 | #include "qemu/sockets.h" |
547 | s->packet_check_timer = NULL; | 344 | #include "qemu/thread.h" |
548 | } | 345 | #include <libgen.h> |
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 | -- | 346 | -- |
624 | 2.20.1 | 347 | 2.25.1 |
625 | 348 | ||
626 | 349 | diff view generated by jsdifflib |
1 | From: Bin Meng <bin.meng@windriver.com> | 1 | The qemu_mprotect_*() family of functions are used in very few files; |
---|---|---|---|
2 | move them from osdep.h to a new qemu/mprotect.h. | ||
2 | 3 | ||
3 | This adds the target guide for SABRE Lite board, and documents how | 4 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
4 | to boot a Linux kernel and U-Boot bootloader. | 5 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
6 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | ||
7 | Message-id: 20220208200856.3558249-3-peter.maydell@linaro.org | ||
8 | --- | ||
9 | include/qemu/mprotect.h | 14 ++++++++++++++ | ||
10 | include/qemu/osdep.h | 4 ---- | ||
11 | tcg/region.c | 1 + | ||
12 | util/osdep.c | 1 + | ||
13 | 4 files changed, 16 insertions(+), 4 deletions(-) | ||
14 | create mode 100644 include/qemu/mprotect.h | ||
5 | 15 | ||
6 | Signed-off-by: Bin Meng <bin.meng@windriver.com> | 16 | diff --git a/include/qemu/mprotect.h b/include/qemu/mprotect.h |
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 | 17 | new file mode 100644 |
18 | index XXXXXXX..XXXXXXX | 18 | index XXXXXXX..XXXXXXX |
19 | --- /dev/null | 19 | --- /dev/null |
20 | +++ b/docs/system/arm/sabrelite.rst | 20 | +++ b/include/qemu/mprotect.h |
21 | @@ -XXX,XX +XXX,XX @@ | 21 | @@ -XXX,XX +XXX,XX @@ |
22 | +Boundary Devices SABRE Lite (``sabrelite``) | 22 | +/* |
23 | +=========================================== | 23 | + * QEMU mprotect functions |
24 | + * | ||
25 | + * This work is licensed under the terms of the GNU GPL, version 2 or later. | ||
26 | + * See the COPYING file in the top-level directory. | ||
27 | + */ | ||
28 | +#ifndef QEMU_MPROTECT_H | ||
29 | +#define QEMU_MPROTECT_H | ||
24 | + | 30 | + |
25 | +Boundary Devices SABRE Lite i.MX6 Development Board is a low-cost development | 31 | +int qemu_mprotect_rw(void *addr, size_t size); |
26 | +platform featuring the powerful Freescale / NXP Semiconductor's i.MX 6 Quad | 32 | +int qemu_mprotect_rwx(void *addr, size_t size); |
27 | +Applications Processor. | 33 | +int qemu_mprotect_none(void *addr, size_t size); |
28 | + | 34 | + |
29 | +Supported devices | 35 | +#endif |
30 | +----------------- | 36 | diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h |
31 | + | ||
32 | +The SABRE Lite machine supports the following devices: | ||
33 | + | ||
34 | + * Up to 4 Cortex A9 cores | ||
35 | + * Generic Interrupt Controller | ||
36 | + * 1 Clock Controller Module | ||
37 | + * 1 System Reset Controller | ||
38 | + * 5 UARTs | ||
39 | + * 2 EPIC timers | ||
40 | + * 1 GPT timer | ||
41 | + * 2 Watchdog timers | ||
42 | + * 1 FEC Ethernet controller | ||
43 | + * 3 I2C controllers | ||
44 | + * 7 GPIO controllers | ||
45 | + * 4 SDHC storage controllers | ||
46 | + * 4 USB 2.0 host controllers | ||
47 | + * 5 ECSPI controllers | ||
48 | + * 1 SST 25VF016B flash | ||
49 | + | ||
50 | +Please note above list is a complete superset the QEMU SABRE Lite machine can | ||
51 | +support. For a normal use case, a device tree blob that represents a real world | ||
52 | +SABRE Lite board, only exposes a subset of devices to the guest software. | ||
53 | + | ||
54 | +Boot options | ||
55 | +------------ | ||
56 | + | ||
57 | +The SABRE Lite machine can start using the standard -kernel functionality | ||
58 | +for loading a Linux kernel, U-Boot bootloader or ELF executable. | ||
59 | + | ||
60 | +Running Linux kernel | ||
61 | +-------------------- | ||
62 | + | ||
63 | +Linux mainline v5.10 release is tested at the time of writing. To build a Linux | ||
64 | +mainline kernel that can be booted by the SABRE Lite machine, simply configure | ||
65 | +the kernel using the imx_v6_v7_defconfig configuration: | ||
66 | + | ||
67 | +.. code-block:: bash | ||
68 | + | ||
69 | + $ export ARCH=arm | ||
70 | + $ export CROSS_COMPILE=arm-linux-gnueabihf- | ||
71 | + $ make imx_v6_v7_defconfig | ||
72 | + $ make | ||
73 | + | ||
74 | +To boot the newly built Linux kernel in QEMU with the SABRE Lite machine, use: | ||
75 | + | ||
76 | +.. code-block:: bash | ||
77 | + | ||
78 | + $ qemu-system-arm -M sabrelite -smp 4 -m 1G \ | ||
79 | + -display none -serial null -serial stdio \ | ||
80 | + -kernel arch/arm/boot/zImage \ | ||
81 | + -dtb arch/arm/boot/dts/imx6q-sabrelite.dtb \ | ||
82 | + -initrd /path/to/rootfs.ext4 \ | ||
83 | + -append "root=/dev/ram" | ||
84 | + | ||
85 | +Running U-Boot | ||
86 | +-------------- | ||
87 | + | ||
88 | +U-Boot mainline v2020.10 release is tested at the time of writing. To build a | ||
89 | +U-Boot mainline bootloader that can be booted by the SABRE Lite machine, use | ||
90 | +the mx6qsabrelite_defconfig with similar commands as described above for Linux: | ||
91 | + | ||
92 | +.. code-block:: bash | ||
93 | + | ||
94 | + $ export CROSS_COMPILE=arm-linux-gnueabihf- | ||
95 | + $ make mx6qsabrelite_defconfig | ||
96 | + | ||
97 | +Note we need to adjust settings by: | ||
98 | + | ||
99 | +.. code-block:: bash | ||
100 | + | ||
101 | + $ make menuconfig | ||
102 | + | ||
103 | +then manually select the following configuration in U-Boot: | ||
104 | + | ||
105 | + Device Tree Control > Provider of DTB for DT Control > Embedded DTB | ||
106 | + | ||
107 | +To start U-Boot using the SABRE Lite machine, provide the u-boot binary to | ||
108 | +the -kernel argument, along with an SD card image with rootfs: | ||
109 | + | ||
110 | +.. code-block:: bash | ||
111 | + | ||
112 | + $ qemu-system-arm -M sabrelite -smp 4 -m 1G \ | ||
113 | + -display none -serial null -serial stdio \ | ||
114 | + -kernel u-boot | ||
115 | + | ||
116 | +The following example shows booting Linux kernel from dhcp, and uses the | ||
117 | +rootfs on an SD card. This requires some additional command line parameters | ||
118 | +for QEMU: | ||
119 | + | ||
120 | +.. code-block:: none | ||
121 | + | ||
122 | + -nic user,tftp=/path/to/kernel/zImage \ | ||
123 | + -drive file=sdcard.img,id=rootfs -device sd-card,drive=rootfs | ||
124 | + | ||
125 | +The directory for the built-in TFTP server should also contain the device tree | ||
126 | +blob of the SABRE Lite board. The sample SD card image was populated with the | ||
127 | +root file system with one single partition. You may adjust the kernel "root=" | ||
128 | +boot parameter accordingly. | ||
129 | + | ||
130 | +After U-Boot boots, type the following commands in the U-Boot command shell to | ||
131 | +boot the Linux kernel: | ||
132 | + | ||
133 | +.. code-block:: none | ||
134 | + | ||
135 | + => setenv ethaddr 00:11:22:33:44:55 | ||
136 | + => setenv bootfile zImage | ||
137 | + => dhcp | ||
138 | + => tftpboot 14000000 imx6q-sabrelite.dtb | ||
139 | + => setenv bootargs root=/dev/mmcblk3p1 | ||
140 | + => bootz 12000000 - 14000000 | ||
141 | diff --git a/docs/system/target-arm.rst b/docs/system/target-arm.rst | ||
142 | index XXXXXXX..XXXXXXX 100644 | 37 | index XXXXXXX..XXXXXXX 100644 |
143 | --- a/docs/system/target-arm.rst | 38 | --- a/include/qemu/osdep.h |
144 | +++ b/docs/system/target-arm.rst | 39 | +++ b/include/qemu/osdep.h |
145 | @@ -XXX,XX +XXX,XX @@ undocumented; you can get a complete list by running | 40 | @@ -XXX,XX +XXX,XX @@ void sigaction_invoke(struct sigaction *action, |
146 | arm/versatile | 41 | struct qemu_signalfd_siginfo *info); |
147 | arm/vexpress | 42 | #endif |
148 | arm/aspeed | 43 | |
149 | + arm/sabrelite | 44 | -int qemu_mprotect_rw(void *addr, size_t size); |
150 | arm/digic | 45 | -int qemu_mprotect_rwx(void *addr, size_t size); |
151 | arm/musicpal | 46 | -int qemu_mprotect_none(void *addr, size_t size); |
152 | arm/gumstix | 47 | - |
48 | /* | ||
49 | * Don't introduce new usage of this function, prefer the following | ||
50 | * qemu_open/qemu_create that take an "Error **errp" | ||
51 | diff --git a/tcg/region.c b/tcg/region.c | ||
52 | index XXXXXXX..XXXXXXX 100644 | ||
53 | --- a/tcg/region.c | ||
54 | +++ b/tcg/region.c | ||
55 | @@ -XXX,XX +XXX,XX @@ | ||
56 | #include "qemu/osdep.h" | ||
57 | #include "qemu/units.h" | ||
58 | #include "qemu/madvise.h" | ||
59 | +#include "qemu/mprotect.h" | ||
60 | #include "qapi/error.h" | ||
61 | #include "exec/exec-all.h" | ||
62 | #include "tcg/tcg.h" | ||
63 | diff --git a/util/osdep.c b/util/osdep.c | ||
64 | index XXXXXXX..XXXXXXX 100644 | ||
65 | --- a/util/osdep.c | ||
66 | +++ b/util/osdep.c | ||
67 | @@ -XXX,XX +XXX,XX @@ extern int madvise(char *, size_t, int); | ||
68 | #include "qemu/sockets.h" | ||
69 | #include "qemu/error-report.h" | ||
70 | #include "qemu/madvise.h" | ||
71 | +#include "qemu/mprotect.h" | ||
72 | #include "monitor/monitor.h" | ||
73 | |||
74 | static bool fips_enabled = false; | ||
153 | -- | 75 | -- |
154 | 2.20.1 | 76 | 2.25.1 |
155 | 77 | ||
156 | 78 | diff view generated by jsdifflib |
1 | The CCR is a register most of whose bits are banked between security | 1 | The QEMU_MAP_* constants are used only as arguments to the |
---|---|---|---|
2 | states but where BFHFNMIGN is not, and we keep it in the non-secure | 2 | qemu_ram_mmap() function. Move them to mmap-alloc.h, where that |
3 | entry of the v7m.ccr[] array. The logic which tries to handle this | 3 | function's prototype is defined. |
4 | bit fails to implement the "RAZ/WI from Nonsecure if AIRCR.BFHFNMINS | ||
5 | is zero" requirement; correct the omission. | ||
6 | 4 | ||
7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 5 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
6 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 7 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
9 | Message-id: 20201210201433.26262-2-peter.maydell@linaro.org | 8 | Message-id: 20220208200856.3558249-4-peter.maydell@linaro.org |
10 | --- | 9 | --- |
11 | hw/intc/armv7m_nvic.c | 15 +++++++++++++++ | 10 | include/qemu/mmap-alloc.h | 23 +++++++++++++++++++++++ |
12 | 1 file changed, 15 insertions(+) | 11 | include/qemu/osdep.h | 25 ------------------------- |
12 | 2 files changed, 23 insertions(+), 25 deletions(-) | ||
13 | 13 | ||
14 | diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c | 14 | diff --git a/include/qemu/mmap-alloc.h b/include/qemu/mmap-alloc.h |
15 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/hw/intc/armv7m_nvic.c | 16 | --- a/include/qemu/mmap-alloc.h |
17 | +++ b/hw/intc/armv7m_nvic.c | 17 | +++ b/include/qemu/mmap-alloc.h |
18 | @@ -XXX,XX +XXX,XX @@ static uint32_t nvic_readl(NVICState *s, uint32_t offset, MemTxAttrs attrs) | 18 | @@ -XXX,XX +XXX,XX @@ void *qemu_ram_mmap(int fd, |
19 | */ | 19 | |
20 | val = cpu->env.v7m.ccr[attrs.secure]; | 20 | void qemu_ram_munmap(int fd, void *ptr, size_t size); |
21 | val |= cpu->env.v7m.ccr[M_REG_NS] & R_V7M_CCR_BFHFNMIGN_MASK; | 21 | |
22 | + /* BFHFNMIGN is RAZ/WI from NS if AIRCR.BFHFNMINS is 0 */ | 22 | +/* |
23 | + if (!attrs.secure) { | 23 | + * Abstraction of PROT_ and MAP_ flags as passed to mmap(), for example, |
24 | + if (!(cpu->env.v7m.aircr & R_V7M_AIRCR_BFHFNMINS_MASK)) { | 24 | + * consumed by qemu_ram_mmap(). |
25 | + val &= ~R_V7M_CCR_BFHFNMIGN_MASK; | 25 | + */ |
26 | + } | 26 | + |
27 | + } | 27 | +/* Map PROT_READ instead of PROT_READ | PROT_WRITE. */ |
28 | return val; | 28 | +#define QEMU_MAP_READONLY (1 << 0) |
29 | case 0xd24: /* System Handler Control and State (SHCSR) */ | 29 | + |
30 | if (!arm_feature(&cpu->env, ARM_FEATURE_V7)) { | 30 | +/* Use MAP_SHARED instead of MAP_PRIVATE. */ |
31 | @@ -XXX,XX +XXX,XX @@ static void nvic_writel(NVICState *s, uint32_t offset, uint32_t value, | 31 | +#define QEMU_MAP_SHARED (1 << 1) |
32 | (cpu->env.v7m.ccr[M_REG_NS] & ~R_V7M_CCR_BFHFNMIGN_MASK) | 32 | + |
33 | | (value & R_V7M_CCR_BFHFNMIGN_MASK); | 33 | +/* |
34 | value &= ~R_V7M_CCR_BFHFNMIGN_MASK; | 34 | + * Use MAP_SYNC | MAP_SHARED_VALIDATE if supported. Ignored without |
35 | + } else { | 35 | + * QEMU_MAP_SHARED. If mapping fails, warn and fallback to !QEMU_MAP_SYNC. |
36 | + /* | 36 | + */ |
37 | + * BFHFNMIGN is RAZ/WI from NS if AIRCR.BFHFNMINS is 0, so | 37 | +#define QEMU_MAP_SYNC (1 << 2) |
38 | + * preserve the state currently in the NS element of the array | 38 | + |
39 | + */ | 39 | +/* |
40 | + if (!(cpu->env.v7m.aircr & R_V7M_AIRCR_BFHFNMINS_MASK)) { | 40 | + * Use MAP_NORESERVE to skip reservation of swap space (or huge pages if |
41 | + value &= ~R_V7M_CCR_BFHFNMIGN_MASK; | 41 | + * applicable). Bail out if not supported/effective. |
42 | + value |= cpu->env.v7m.ccr[M_REG_NS] & R_V7M_CCR_BFHFNMIGN_MASK; | 42 | + */ |
43 | + } | 43 | +#define QEMU_MAP_NORESERVE (1 << 3) |
44 | } | 44 | + |
45 | 45 | #endif | |
46 | cpu->env.v7m.ccr[attrs.secure] = value; | 46 | diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h |
47 | index XXXXXXX..XXXXXXX 100644 | ||
48 | --- a/include/qemu/osdep.h | ||
49 | +++ b/include/qemu/osdep.h | ||
50 | @@ -XXX,XX +XXX,XX @@ static inline void qemu_cleanup_generic_vfree(void *p) | ||
51 | */ | ||
52 | #define QEMU_AUTO_VFREE __attribute__((cleanup(qemu_cleanup_generic_vfree))) | ||
53 | |||
54 | -/* | ||
55 | - * Abstraction of PROT_ and MAP_ flags as passed to mmap(), for example, | ||
56 | - * consumed by qemu_ram_mmap(). | ||
57 | - */ | ||
58 | - | ||
59 | -/* Map PROT_READ instead of PROT_READ | PROT_WRITE. */ | ||
60 | -#define QEMU_MAP_READONLY (1 << 0) | ||
61 | - | ||
62 | -/* Use MAP_SHARED instead of MAP_PRIVATE. */ | ||
63 | -#define QEMU_MAP_SHARED (1 << 1) | ||
64 | - | ||
65 | -/* | ||
66 | - * Use MAP_SYNC | MAP_SHARED_VALIDATE if supported. Ignored without | ||
67 | - * QEMU_MAP_SHARED. If mapping fails, warn and fallback to !QEMU_MAP_SYNC. | ||
68 | - */ | ||
69 | -#define QEMU_MAP_SYNC (1 << 2) | ||
70 | - | ||
71 | -/* | ||
72 | - * Use MAP_NORESERVE to skip reservation of swap space (or huge pages if | ||
73 | - * applicable). Bail out if not supported/effective. | ||
74 | - */ | ||
75 | -#define QEMU_MAP_NORESERVE (1 << 3) | ||
76 | - | ||
77 | - | ||
78 | - | ||
79 | #ifdef _WIN32 | ||
80 | #define HAVE_CHARDEV_SERIAL 1 | ||
81 | #elif defined(__linux__) || defined(__sun__) || defined(__FreeBSD__) \ | ||
47 | -- | 82 | -- |
48 | 2.20.1 | 83 | 2.25.1 |
49 | 84 | ||
50 | 85 | diff view generated by jsdifflib |
1 | Now that timer_free() implicitly calls timer_del(), sequences | 1 | The qemu_icache_linesize, qemu_icache_linesize_log, |
---|---|---|---|
2 | timer_del(mytimer); | 2 | qemu_dcache_linesize, and qemu_dcache_linesize_log variables are not |
3 | timer_free(mytimer); | 3 | used in many files. Move them out of osdep.h to a new |
4 | 4 | qemu/cacheinfo.h, and document them. | |
5 | can be simplified to just | ||
6 | timer_free(mytimer); | ||
7 | |||
8 | Add a Coccinelle script to do this transformation. | ||
9 | 5 | ||
10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
11 | Acked-by: Paolo Bonzini <pbonzini@redhat.com> | 7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
12 | Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> | ||
13 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> | 8 | Reviewed-by: Richard Henderson <richard.henderson@linaro.org> |
14 | Message-id: 20201215154107.3255-3-peter.maydell@linaro.org | 9 | Message-id: 20220208200856.3558249-5-peter.maydell@linaro.org |
15 | --- | 10 | --- |
16 | scripts/coccinelle/timer-del-timer-free.cocci | 18 ++++++++++++++++++ | 11 | include/qemu/cacheinfo.h | 21 +++++++++++++++++++++ |
17 | 1 file changed, 18 insertions(+) | 12 | include/qemu/osdep.h | 5 ----- |
18 | create mode 100644 scripts/coccinelle/timer-del-timer-free.cocci | 13 | accel/tcg/translate-all.c | 1 + |
14 | plugins/loader.c | 1 + | ||
15 | tcg/region.c | 1 + | ||
16 | tcg/tcg.c | 1 + | ||
17 | util/atomic64.c | 1 + | ||
18 | util/cacheflush.c | 1 + | ||
19 | util/cacheinfo.c | 1 + | ||
20 | 9 files changed, 28 insertions(+), 5 deletions(-) | ||
21 | create mode 100644 include/qemu/cacheinfo.h | ||
19 | 22 | ||
20 | diff --git a/scripts/coccinelle/timer-del-timer-free.cocci b/scripts/coccinelle/timer-del-timer-free.cocci | 23 | diff --git a/include/qemu/cacheinfo.h b/include/qemu/cacheinfo.h |
21 | new file mode 100644 | 24 | new file mode 100644 |
22 | index XXXXXXX..XXXXXXX | 25 | index XXXXXXX..XXXXXXX |
23 | --- /dev/null | 26 | --- /dev/null |
24 | +++ b/scripts/coccinelle/timer-del-timer-free.cocci | 27 | +++ b/include/qemu/cacheinfo.h |
25 | @@ -XXX,XX +XXX,XX @@ | 28 | @@ -XXX,XX +XXX,XX @@ |
26 | +// Remove superfluous timer_del() calls | 29 | +/* |
27 | +// | 30 | + * QEMU host cacheinfo information |
28 | +// Copyright Linaro Limited 2020 | 31 | + * |
29 | +// This work is licensed under the terms of the GNU GPLv2 or later. | 32 | + * This work is licensed under the terms of the GNU GPL, version 2 or later. |
30 | +// | 33 | + * See the COPYING file in the top-level directory. |
31 | +// spatch --macro-file scripts/cocci-macro-file.h \ | 34 | + */ |
32 | +// --sp-file scripts/coccinelle/timer-del-timer-free.cocci \ | 35 | +#ifndef QEMU_CACHEINFO_H |
33 | +// --in-place --dir . | 36 | +#define QEMU_CACHEINFO_H |
34 | +// | ||
35 | +// The timer_free() function now implicitly calls timer_del() | ||
36 | +// for you, so calls to timer_del() immediately before the | ||
37 | +// timer_free() of the same timer can be deleted. | ||
38 | + | 37 | + |
39 | +@@ | 38 | +/* |
40 | +expression T; | 39 | + * These variables represent our best guess at the host icache and |
41 | +@@ | 40 | + * dcache sizes, expressed both as the size in bytes and as the |
42 | +-timer_del(T); | 41 | + * base-2 log of the size in bytes. They are initialized at startup |
43 | + timer_free(T); | 42 | + * (via an attribute 'constructor' function). |
43 | + */ | ||
44 | +extern int qemu_icache_linesize; | ||
45 | +extern int qemu_icache_linesize_log; | ||
46 | +extern int qemu_dcache_linesize; | ||
47 | +extern int qemu_dcache_linesize_log; | ||
48 | + | ||
49 | +#endif | ||
50 | diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h | ||
51 | index XXXXXXX..XXXXXXX 100644 | ||
52 | --- a/include/qemu/osdep.h | ||
53 | +++ b/include/qemu/osdep.h | ||
54 | @@ -XXX,XX +XXX,XX @@ pid_t qemu_fork(Error **errp); | ||
55 | extern uintptr_t qemu_real_host_page_size; | ||
56 | extern intptr_t qemu_real_host_page_mask; | ||
57 | |||
58 | -extern int qemu_icache_linesize; | ||
59 | -extern int qemu_icache_linesize_log; | ||
60 | -extern int qemu_dcache_linesize; | ||
61 | -extern int qemu_dcache_linesize_log; | ||
62 | - | ||
63 | /* | ||
64 | * After using getopt or getopt_long, if you need to parse another set | ||
65 | * of options, then you must reset optind. Unfortunately the way to | ||
66 | diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c | ||
67 | index XXXXXXX..XXXXXXX 100644 | ||
68 | --- a/accel/tcg/translate-all.c | ||
69 | +++ b/accel/tcg/translate-all.c | ||
70 | @@ -XXX,XX +XXX,XX @@ | ||
71 | #include "qemu/qemu-print.h" | ||
72 | #include "qemu/timer.h" | ||
73 | #include "qemu/main-loop.h" | ||
74 | +#include "qemu/cacheinfo.h" | ||
75 | #include "exec/log.h" | ||
76 | #include "sysemu/cpus.h" | ||
77 | #include "sysemu/cpu-timers.h" | ||
78 | diff --git a/plugins/loader.c b/plugins/loader.c | ||
79 | index XXXXXXX..XXXXXXX 100644 | ||
80 | --- a/plugins/loader.c | ||
81 | +++ b/plugins/loader.c | ||
82 | @@ -XXX,XX +XXX,XX @@ | ||
83 | #include "qemu/rcu_queue.h" | ||
84 | #include "qemu/qht.h" | ||
85 | #include "qemu/bitmap.h" | ||
86 | +#include "qemu/cacheinfo.h" | ||
87 | #include "qemu/xxhash.h" | ||
88 | #include "qemu/plugin.h" | ||
89 | #include "hw/core/cpu.h" | ||
90 | diff --git a/tcg/region.c b/tcg/region.c | ||
91 | index XXXXXXX..XXXXXXX 100644 | ||
92 | --- a/tcg/region.c | ||
93 | +++ b/tcg/region.c | ||
94 | @@ -XXX,XX +XXX,XX @@ | ||
95 | #include "qemu/units.h" | ||
96 | #include "qemu/madvise.h" | ||
97 | #include "qemu/mprotect.h" | ||
98 | +#include "qemu/cacheinfo.h" | ||
99 | #include "qapi/error.h" | ||
100 | #include "exec/exec-all.h" | ||
101 | #include "tcg/tcg.h" | ||
102 | diff --git a/tcg/tcg.c b/tcg/tcg.c | ||
103 | index XXXXXXX..XXXXXXX 100644 | ||
104 | --- a/tcg/tcg.c | ||
105 | +++ b/tcg/tcg.c | ||
106 | @@ -XXX,XX +XXX,XX @@ | ||
107 | #include "qemu/qemu-print.h" | ||
108 | #include "qemu/timer.h" | ||
109 | #include "qemu/cacheflush.h" | ||
110 | +#include "qemu/cacheinfo.h" | ||
111 | |||
112 | /* Note: the long term plan is to reduce the dependencies on the QEMU | ||
113 | CPU definitions. Currently they are used for qemu_ld/st | ||
114 | diff --git a/util/atomic64.c b/util/atomic64.c | ||
115 | index XXXXXXX..XXXXXXX 100644 | ||
116 | --- a/util/atomic64.c | ||
117 | +++ b/util/atomic64.c | ||
118 | @@ -XXX,XX +XXX,XX @@ | ||
119 | #include "qemu/osdep.h" | ||
120 | #include "qemu/atomic.h" | ||
121 | #include "qemu/thread.h" | ||
122 | +#include "qemu/cacheinfo.h" | ||
123 | |||
124 | #ifdef CONFIG_ATOMIC64 | ||
125 | #error This file must only be compiled if !CONFIG_ATOMIC64 | ||
126 | diff --git a/util/cacheflush.c b/util/cacheflush.c | ||
127 | index XXXXXXX..XXXXXXX 100644 | ||
128 | --- a/util/cacheflush.c | ||
129 | +++ b/util/cacheflush.c | ||
130 | @@ -XXX,XX +XXX,XX @@ | ||
131 | |||
132 | #include "qemu/osdep.h" | ||
133 | #include "qemu/cacheflush.h" | ||
134 | +#include "qemu/cacheinfo.h" | ||
135 | #include "qemu/bitops.h" | ||
136 | |||
137 | |||
138 | diff --git a/util/cacheinfo.c b/util/cacheinfo.c | ||
139 | index XXXXXXX..XXXXXXX 100644 | ||
140 | --- a/util/cacheinfo.c | ||
141 | +++ b/util/cacheinfo.c | ||
142 | @@ -XXX,XX +XXX,XX @@ | ||
143 | #include "qemu/osdep.h" | ||
144 | #include "qemu/host-utils.h" | ||
145 | #include "qemu/atomic.h" | ||
146 | +#include "qemu/cacheinfo.h" | ||
147 | |||
148 | int qemu_icache_linesize = 0; | ||
149 | int qemu_icache_linesize_log; | ||
44 | -- | 150 | -- |
45 | 2.20.1 | 151 | 2.25.1 |
46 | 152 | ||
47 | 153 | diff view generated by jsdifflib |
1 | Support for running KVM on 32-bit Arm hosts was removed in commit | 1 | The "hardware version" machinery (qemu_set_hw_version(), |
---|---|---|---|
2 | 82bf7ae84ce739e. You can still run a 32-bit guest on a 64-bit Arm | 2 | qemu_hw_version(), and the QEMU_HW_VERSION define) is used by fewer |
3 | host CPU, but because Arm KVM requires the host and guest CPU types | 3 | than 10 files. Move it out from osdep.h into a new |
4 | to match, it is not possible to run a guest that requires a Cortex-A9 | 4 | qemu/hw-version.h. |
5 | or Cortex-A15 CPU there. That means that the code in the | ||
6 | highbank/midway board models to support KVM is no longer used, and we | ||
7 | can delete it. | ||
8 | 5 | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 6 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
7 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.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 | Message-id: 20220208200856.3558249-6-peter.maydell@linaro.org |
12 | Message-id: 20201215144215.28482-1-peter.maydell@linaro.org | ||
13 | --- | 10 | --- |
14 | hw/arm/highbank.c | 14 ++++---------- | 11 | include/qemu/hw-version.h | 27 +++++++++++++++++++++++++++ |
15 | 1 file changed, 4 insertions(+), 10 deletions(-) | 12 | include/qemu/osdep.h | 16 ---------------- |
13 | hw/arm/nseries.c | 1 + | ||
14 | hw/ide/core.c | 1 + | ||
15 | hw/scsi/megasas.c | 1 + | ||
16 | hw/scsi/scsi-bus.c | 1 + | ||
17 | hw/scsi/scsi-disk.c | 1 + | ||
18 | softmmu/vl.c | 1 + | ||
19 | target/i386/cpu.c | 1 + | ||
20 | target/s390x/cpu_models.c | 1 + | ||
21 | util/osdep.c | 1 + | ||
22 | 11 files changed, 36 insertions(+), 16 deletions(-) | ||
23 | create mode 100644 include/qemu/hw-version.h | ||
16 | 24 | ||
17 | diff --git a/hw/arm/highbank.c b/hw/arm/highbank.c | 25 | diff --git a/include/qemu/hw-version.h b/include/qemu/hw-version.h |
26 | new file mode 100644 | ||
27 | index XXXXXXX..XXXXXXX | ||
28 | --- /dev/null | ||
29 | +++ b/include/qemu/hw-version.h | ||
30 | @@ -XXX,XX +XXX,XX @@ | ||
31 | +/* | ||
32 | + * QEMU "hardware version" machinery | ||
33 | + * | ||
34 | + * This work is licensed under the terms of the GNU GPL, version 2 or later. | ||
35 | + * See the COPYING file in the top-level directory. | ||
36 | + */ | ||
37 | +#ifndef QEMU_HW_VERSION_H | ||
38 | +#define QEMU_HW_VERSION_H | ||
39 | + | ||
40 | +/* | ||
41 | + * Starting on QEMU 2.5, qemu_hw_version() returns "2.5+" by default | ||
42 | + * instead of QEMU_VERSION, so setting hw_version on MachineClass | ||
43 | + * is no longer mandatory. | ||
44 | + * | ||
45 | + * Do NOT change this string, or it will break compatibility on all | ||
46 | + * machine classes that don't set hw_version. | ||
47 | + */ | ||
48 | +#define QEMU_HW_VERSION "2.5+" | ||
49 | + | ||
50 | +/* QEMU "hardware version" setting. Used to replace code that exposed | ||
51 | + * QEMU_VERSION to guests in the past and need to keep compatibility. | ||
52 | + * Do not use qemu_hw_version() in new code. | ||
53 | + */ | ||
54 | +void qemu_set_hw_version(const char *); | ||
55 | +const char *qemu_hw_version(void); | ||
56 | + | ||
57 | +#endif | ||
58 | diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h | ||
18 | index XXXXXXX..XXXXXXX 100644 | 59 | index XXXXXXX..XXXXXXX 100644 |
19 | --- a/hw/arm/highbank.c | 60 | --- a/include/qemu/osdep.h |
20 | +++ b/hw/arm/highbank.c | 61 | +++ b/include/qemu/osdep.h |
62 | @@ -XXX,XX +XXX,XX @@ static inline void qemu_timersub(const struct timeval *val1, | ||
63 | |||
64 | void qemu_set_cloexec(int fd); | ||
65 | |||
66 | -/* Starting on QEMU 2.5, qemu_hw_version() returns "2.5+" by default | ||
67 | - * instead of QEMU_VERSION, so setting hw_version on MachineClass | ||
68 | - * is no longer mandatory. | ||
69 | - * | ||
70 | - * Do NOT change this string, or it will break compatibility on all | ||
71 | - * machine classes that don't set hw_version. | ||
72 | - */ | ||
73 | -#define QEMU_HW_VERSION "2.5+" | ||
74 | - | ||
75 | -/* QEMU "hardware version" setting. Used to replace code that exposed | ||
76 | - * QEMU_VERSION to guests in the past and need to keep compatibility. | ||
77 | - * Do not use qemu_hw_version() in new code. | ||
78 | - */ | ||
79 | -void qemu_set_hw_version(const char *); | ||
80 | -const char *qemu_hw_version(void); | ||
81 | - | ||
82 | void fips_set_state(bool requested); | ||
83 | bool fips_get_state(void); | ||
84 | |||
85 | diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c | ||
86 | index XXXXXXX..XXXXXXX 100644 | ||
87 | --- a/hw/arm/nseries.c | ||
88 | +++ b/hw/arm/nseries.c | ||
21 | @@ -XXX,XX +XXX,XX @@ | 89 | @@ -XXX,XX +XXX,XX @@ |
22 | #include "hw/arm/boot.h" | 90 | #include "chardev/char.h" |
23 | #include "hw/loader.h" | 91 | #include "qemu/cutils.h" |
24 | #include "net/net.h" | 92 | #include "qemu/bswap.h" |
25 | -#include "sysemu/kvm.h" | 93 | +#include "qemu/hw-version.h" |
94 | #include "sysemu/reset.h" | ||
26 | #include "sysemu/runstate.h" | 95 | #include "sysemu/runstate.h" |
27 | #include "sysemu/sysemu.h" | 96 | #include "sysemu/sysemu.h" |
28 | #include "hw/boards.h" | 97 | diff --git a/hw/ide/core.c b/hw/ide/core.c |
98 | index XXXXXXX..XXXXXXX 100644 | ||
99 | --- a/hw/ide/core.c | ||
100 | +++ b/hw/ide/core.c | ||
29 | @@ -XXX,XX +XXX,XX @@ | 101 | @@ -XXX,XX +XXX,XX @@ |
30 | #include "hw/cpu/a15mpcore.h" | 102 | #include "qemu/error-report.h" |
31 | #include "qemu/log.h" | 103 | #include "qemu/main-loop.h" |
32 | #include "qom/object.h" | 104 | #include "qemu/timer.h" |
33 | +#include "cpu.h" | 105 | +#include "qemu/hw-version.h" |
34 | 106 | #include "sysemu/sysemu.h" | |
35 | #define SMP_BOOT_ADDR 0x100 | 107 | #include "sysemu/blockdev.h" |
36 | #define SMP_BOOT_REG 0x40 | 108 | #include "sysemu/dma.h" |
37 | @@ -XXX,XX +XXX,XX @@ static void calxeda_init(MachineState *machine, enum cxmachines machine_id) | 109 | diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c |
38 | highbank_binfo.loader_start = 0; | 110 | index XXXXXXX..XXXXXXX 100644 |
39 | highbank_binfo.write_secondary_boot = hb_write_secondary; | 111 | --- a/hw/scsi/megasas.c |
40 | highbank_binfo.secondary_cpu_reset_hook = hb_reset_secondary; | 112 | +++ b/hw/scsi/megasas.c |
41 | - if (!kvm_enabled()) { | 113 | @@ -XXX,XX +XXX,XX @@ |
42 | - highbank_binfo.board_setup_addr = BOARD_SETUP_ADDR; | 114 | #include "hw/pci/msix.h" |
43 | - highbank_binfo.write_board_setup = hb_write_board_setup; | 115 | #include "qemu/iov.h" |
44 | - highbank_binfo.secure_board_setup = true; | 116 | #include "qemu/module.h" |
45 | - } else { | 117 | +#include "qemu/hw-version.h" |
46 | - warn_report("cannot load built-in Monitor support " | 118 | #include "hw/scsi/scsi.h" |
47 | - "if KVM is enabled. Some guests (such as Linux) " | 119 | #include "scsi/constants.h" |
48 | - "may not boot."); | 120 | #include "trace.h" |
49 | - } | 121 | diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c |
50 | + highbank_binfo.board_setup_addr = BOARD_SETUP_ADDR; | 122 | index XXXXXXX..XXXXXXX 100644 |
51 | + highbank_binfo.write_board_setup = hb_write_board_setup; | 123 | --- a/hw/scsi/scsi-bus.c |
52 | + highbank_binfo.secure_board_setup = true; | 124 | +++ b/hw/scsi/scsi-bus.c |
53 | 125 | @@ -XXX,XX +XXX,XX @@ | |
54 | arm_load_kernel(ARM_CPU(first_cpu), machine, &highbank_binfo); | 126 | #include "qemu/error-report.h" |
55 | } | 127 | #include "qemu/module.h" |
128 | #include "qemu/option.h" | ||
129 | +#include "qemu/hw-version.h" | ||
130 | #include "hw/qdev-properties.h" | ||
131 | #include "hw/scsi/scsi.h" | ||
132 | #include "migration/qemu-file-types.h" | ||
133 | diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c | ||
134 | index XXXXXXX..XXXXXXX 100644 | ||
135 | --- a/hw/scsi/scsi-disk.c | ||
136 | +++ b/hw/scsi/scsi-disk.c | ||
137 | @@ -XXX,XX +XXX,XX @@ | ||
138 | #include "qemu/error-report.h" | ||
139 | #include "qemu/main-loop.h" | ||
140 | #include "qemu/module.h" | ||
141 | +#include "qemu/hw-version.h" | ||
142 | #include "hw/scsi/scsi.h" | ||
143 | #include "migration/qemu-file-types.h" | ||
144 | #include "migration/vmstate.h" | ||
145 | diff --git a/softmmu/vl.c b/softmmu/vl.c | ||
146 | index XXXXXXX..XXXXXXX 100644 | ||
147 | --- a/softmmu/vl.c | ||
148 | +++ b/softmmu/vl.c | ||
149 | @@ -XXX,XX +XXX,XX @@ | ||
150 | #include "qemu-version.h" | ||
151 | #include "qemu/cutils.h" | ||
152 | #include "qemu/help_option.h" | ||
153 | +#include "qemu/hw-version.h" | ||
154 | #include "qemu/uuid.h" | ||
155 | #include "sysemu/reset.h" | ||
156 | #include "sysemu/runstate.h" | ||
157 | diff --git a/target/i386/cpu.c b/target/i386/cpu.c | ||
158 | index XXXXXXX..XXXXXXX 100644 | ||
159 | --- a/target/i386/cpu.c | ||
160 | +++ b/target/i386/cpu.c | ||
161 | @@ -XXX,XX +XXX,XX @@ | ||
162 | #include "qemu/units.h" | ||
163 | #include "qemu/cutils.h" | ||
164 | #include "qemu/qemu-print.h" | ||
165 | +#include "qemu/hw-version.h" | ||
166 | #include "cpu.h" | ||
167 | #include "tcg/helper-tcg.h" | ||
168 | #include "sysemu/reset.h" | ||
169 | diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c | ||
170 | index XXXXXXX..XXXXXXX 100644 | ||
171 | --- a/target/s390x/cpu_models.c | ||
172 | +++ b/target/s390x/cpu_models.c | ||
173 | @@ -XXX,XX +XXX,XX @@ | ||
174 | #include "qapi/error.h" | ||
175 | #include "qapi/visitor.h" | ||
176 | #include "qemu/module.h" | ||
177 | +#include "qemu/hw-version.h" | ||
178 | #include "qemu/qemu-print.h" | ||
179 | #ifndef CONFIG_USER_ONLY | ||
180 | #include "sysemu/sysemu.h" | ||
181 | diff --git a/util/osdep.c b/util/osdep.c | ||
182 | index XXXXXXX..XXXXXXX 100644 | ||
183 | --- a/util/osdep.c | ||
184 | +++ b/util/osdep.c | ||
185 | @@ -XXX,XX +XXX,XX @@ extern int madvise(char *, size_t, int); | ||
186 | #include "qemu/error-report.h" | ||
187 | #include "qemu/madvise.h" | ||
188 | #include "qemu/mprotect.h" | ||
189 | +#include "qemu/hw-version.h" | ||
190 | #include "monitor/monitor.h" | ||
191 | |||
192 | static bool fips_enabled = false; | ||
56 | -- | 193 | -- |
57 | 2.20.1 | 194 | 2.25.1 |
58 | 195 | ||
59 | 196 | diff view generated by jsdifflib |
1 | From: Gan Qixin <ganqixin@huawei.com> | 1 | From: Akihiko Odaki <akihiko.odaki@gmail.com> |
---|---|---|---|
2 | 2 | ||
3 | When running device-introspect-test, a memory leak occurred in the | 3 | Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com> |
4 | exynos4210_pwm_init function, so use ptimer_free() in the finalize function to | 4 | Reviewed-by: Christian Schoenebeck <qemu_oss@crudebyte.com> |
5 | avoid it. | 5 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
6 | 6 | Message-id: 20220213021215.1974-1-akihiko.odaki@gmail.com | |
7 | ASAN shows memory leak stack: | ||
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> | 7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
28 | --- | 8 | --- |
29 | hw/timer/exynos4210_pwm.c | 11 +++++++++++ | 9 | MAINTAINERS | 2 ++ |
30 | 1 file changed, 11 insertions(+) | 10 | 1 file changed, 2 insertions(+) |
31 | 11 | ||
32 | diff --git a/hw/timer/exynos4210_pwm.c b/hw/timer/exynos4210_pwm.c | 12 | diff --git a/MAINTAINERS b/MAINTAINERS |
33 | index XXXXXXX..XXXXXXX 100644 | 13 | index XXXXXXX..XXXXXXX 100644 |
34 | --- a/hw/timer/exynos4210_pwm.c | 14 | --- a/MAINTAINERS |
35 | +++ b/hw/timer/exynos4210_pwm.c | 15 | +++ b/MAINTAINERS |
36 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_pwm_init(Object *obj) | 16 | @@ -XXX,XX +XXX,XX @@ F: audio/alsaaudio.c |
37 | sysbus_init_mmio(dev, &s->iomem); | 17 | Core Audio framework backend |
38 | } | 18 | M: Gerd Hoffmann <kraxel@redhat.com> |
39 | 19 | R: Christian Schoenebeck <qemu_oss@crudebyte.com> | |
40 | +static void exynos4210_pwm_finalize(Object *obj) | 20 | +R: Akihiko Odaki <akihiko.odaki@gmail.com> |
41 | +{ | 21 | S: Odd Fixes |
42 | + Exynos4210PWMState *s = EXYNOS4210_PWM(obj); | 22 | F: audio/coreaudio.c |
43 | + int i; | 23 | |
44 | + | 24 | @@ -XXX,XX +XXX,XX @@ F: util/drm.c |
45 | + for (i = 0; i < EXYNOS4210_PWM_TIMERS_NUM; i++) { | 25 | |
46 | + ptimer_free(s->timer[i].ptimer); | 26 | Cocoa graphics |
47 | + } | 27 | M: Peter Maydell <peter.maydell@linaro.org> |
48 | +} | 28 | +R: Akihiko Odaki <akihiko.odaki@gmail.com> |
49 | + | 29 | S: Odd Fixes |
50 | static void exynos4210_pwm_class_init(ObjectClass *klass, void *data) | 30 | F: ui/cocoa.m |
51 | { | ||
52 | DeviceClass *dc = DEVICE_CLASS(klass); | ||
53 | @@ -XXX,XX +XXX,XX @@ static const TypeInfo exynos4210_pwm_info = { | ||
54 | .parent = TYPE_SYS_BUS_DEVICE, | ||
55 | .instance_size = sizeof(Exynos4210PWMState), | ||
56 | .instance_init = exynos4210_pwm_init, | ||
57 | + .instance_finalize = exynos4210_pwm_finalize, | ||
58 | .class_init = exynos4210_pwm_class_init, | ||
59 | }; | ||
60 | 31 | ||
61 | -- | 32 | -- |
62 | 2.20.1 | 33 | 2.25.1 |
63 | 34 | ||
64 | 35 | diff view generated by jsdifflib |
1 | From: Gan Qixin <ganqixin@huawei.com> | 1 | From: Pavel Dovgalyuk <pavel.dovgalyuk@ispras.ru> |
---|---|---|---|
2 | 2 | ||
3 | When running device-introspect-test, a memory leak occurred in the a10_pit_init | 3 | A9 gtimer includes global control field and number of per-cpu fields. |
4 | function, so use ptimer_free() in the finalize function to avoid it. | 4 | But only per-cpu ones are migrated. This patch adds a subsection for |
5 | global control field migration. | ||
5 | 6 | ||
6 | ASAN shows memory leak stack: | 7 | Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgalyuk@ispras.ru> |
7 | 8 | Message-id: 164422345976.2186660.1104517592452494510.stgit@pasha-ThinkPad-X280 | |
8 | Indirect leak of 288 byte(s) in 6 object(s) allocated from: | ||
9 | #0 0xffffab97e1f0 in __interceptor_calloc (/lib64/libasan.so.5+0xee1f0) | ||
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> | 9 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> |
26 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 10 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
27 | --- | 11 | --- |
28 | hw/timer/allwinner-a10-pit.c | 11 +++++++++++ | 12 | hw/timer/a9gtimer.c | 21 +++++++++++++++++++++ |
29 | 1 file changed, 11 insertions(+) | 13 | 1 file changed, 21 insertions(+) |
30 | 14 | ||
31 | diff --git a/hw/timer/allwinner-a10-pit.c b/hw/timer/allwinner-a10-pit.c | 15 | diff --git a/hw/timer/a9gtimer.c b/hw/timer/a9gtimer.c |
32 | index XXXXXXX..XXXXXXX 100644 | 16 | index XXXXXXX..XXXXXXX 100644 |
33 | --- a/hw/timer/allwinner-a10-pit.c | 17 | --- a/hw/timer/a9gtimer.c |
34 | +++ b/hw/timer/allwinner-a10-pit.c | 18 | +++ b/hw/timer/a9gtimer.c |
35 | @@ -XXX,XX +XXX,XX @@ static void a10_pit_init(Object *obj) | 19 | @@ -XXX,XX +XXX,XX @@ static void a9_gtimer_realize(DeviceState *dev, Error **errp) |
36 | } | 20 | } |
37 | } | 21 | } |
38 | 22 | ||
39 | +static void a10_pit_finalize(Object *obj) | 23 | +static bool vmstate_a9_gtimer_control_needed(void *opaque) |
40 | +{ | 24 | +{ |
41 | + AwA10PITState *s = AW_A10_PIT(obj); | 25 | + A9GTimerState *s = opaque; |
42 | + int i; | 26 | + return s->control != 0; |
43 | + | ||
44 | + for (i = 0; i < AW_A10_PIT_TIMER_NR; i++) { | ||
45 | + ptimer_free(s->timer[i]); | ||
46 | + } | ||
47 | +} | 27 | +} |
48 | + | 28 | + |
49 | static void a10_pit_class_init(ObjectClass *klass, void *data) | 29 | static const VMStateDescription vmstate_a9_gtimer_per_cpu = { |
50 | { | 30 | .name = "arm.cortex-a9-global-timer.percpu", |
51 | DeviceClass *dc = DEVICE_CLASS(klass); | 31 | .version_id = 1, |
52 | @@ -XXX,XX +XXX,XX @@ static const TypeInfo a10_pit_info = { | 32 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_a9_gtimer_per_cpu = { |
53 | .parent = TYPE_SYS_BUS_DEVICE, | 33 | } |
54 | .instance_size = sizeof(AwA10PITState), | ||
55 | .instance_init = a10_pit_init, | ||
56 | + .instance_finalize = a10_pit_finalize, | ||
57 | .class_init = a10_pit_class_init, | ||
58 | }; | 34 | }; |
59 | 35 | ||
36 | +static const VMStateDescription vmstate_a9_gtimer_control = { | ||
37 | + .name = "arm.cortex-a9-global-timer.control", | ||
38 | + .version_id = 1, | ||
39 | + .minimum_version_id = 1, | ||
40 | + .needed = vmstate_a9_gtimer_control_needed, | ||
41 | + .fields = (VMStateField[]) { | ||
42 | + VMSTATE_UINT32(control, A9GTimerState), | ||
43 | + VMSTATE_END_OF_LIST() | ||
44 | + } | ||
45 | +}; | ||
46 | + | ||
47 | static const VMStateDescription vmstate_a9_gtimer = { | ||
48 | .name = "arm.cortex-a9-global-timer", | ||
49 | .version_id = 1, | ||
50 | @@ -XXX,XX +XXX,XX @@ static const VMStateDescription vmstate_a9_gtimer = { | ||
51 | 1, vmstate_a9_gtimer_per_cpu, | ||
52 | A9GTimerPerCPU), | ||
53 | VMSTATE_END_OF_LIST() | ||
54 | + }, | ||
55 | + .subsections = (const VMStateDescription*[]) { | ||
56 | + &vmstate_a9_gtimer_control, | ||
57 | + NULL | ||
58 | } | ||
59 | }; | ||
60 | |||
60 | -- | 61 | -- |
61 | 2.20.1 | 62 | 2.25.1 |
62 | 63 | ||
63 | 64 | diff view generated by jsdifflib |
1 | From: Gan Qixin <ganqixin@huawei.com> | 1 | From: Patrick Venture <venture@google.com> |
---|---|---|---|
2 | 2 | ||
3 | When running device-introspect-test, a memory leak occurred in the | 3 | This is the BMC attached to the OpenBMC Mori board. |
4 | exynos4210_rtc_init function, so use ptimer_free() in the finalize function to | ||
5 | avoid it. | ||
6 | 4 | ||
7 | ASAN shows memory leak stack: | 5 | Signed-off-by: Patrick Venture <venture@google.com> |
8 | 6 | Reviewed-by: Chris Rauer <crauer@google.com> | |
9 | Indirect leak of 96 byte(s) in 1 object(s) allocated from: | 7 | Reviewed-by: Ilkyun Choi <ikchoi@google.com> |
10 | #0 0xffffab97e1f0 in __interceptor_calloc (/lib64/libasan.so.5+0xee1f0) | 8 | Message-id: 20220208233104.284425-1-venture@google.com |
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> | 9 | 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/rtc/exynos4210_rtc.c | 9 +++++++++ | 12 | docs/system/arm/nuvoton.rst | 1 + |
30 | 1 file changed, 9 insertions(+) | 13 | hw/arm/npcm7xx_boards.c | 32 ++++++++++++++++++++++++++++++++ |
14 | 2 files changed, 33 insertions(+) | ||
31 | 15 | ||
32 | diff --git a/hw/rtc/exynos4210_rtc.c b/hw/rtc/exynos4210_rtc.c | 16 | diff --git a/docs/system/arm/nuvoton.rst b/docs/system/arm/nuvoton.rst |
33 | index XXXXXXX..XXXXXXX 100644 | 17 | index XXXXXXX..XXXXXXX 100644 |
34 | --- a/hw/rtc/exynos4210_rtc.c | 18 | --- a/docs/system/arm/nuvoton.rst |
35 | +++ b/hw/rtc/exynos4210_rtc.c | 19 | +++ b/docs/system/arm/nuvoton.rst |
36 | @@ -XXX,XX +XXX,XX @@ static void exynos4210_rtc_init(Object *obj) | 20 | @@ -XXX,XX +XXX,XX @@ Hyperscale applications. The following machines are based on this chip : |
37 | sysbus_init_mmio(dev, &s->iomem); | 21 | - ``quanta-gbs-bmc`` Quanta GBS server BMC |
22 | - ``quanta-gsj`` Quanta GSJ server BMC | ||
23 | - ``kudo-bmc`` Fii USA Kudo server BMC | ||
24 | +- ``mori-bmc`` Fii USA Mori server BMC | ||
25 | |||
26 | There are also two more SoCs, NPCM710 and NPCM705, which are single-core | ||
27 | variants of NPCM750 and NPCM730, respectively. These are currently not | ||
28 | diff --git a/hw/arm/npcm7xx_boards.c b/hw/arm/npcm7xx_boards.c | ||
29 | index XXXXXXX..XXXXXXX 100644 | ||
30 | --- a/hw/arm/npcm7xx_boards.c | ||
31 | +++ b/hw/arm/npcm7xx_boards.c | ||
32 | @@ -XXX,XX +XXX,XX @@ | ||
33 | #define QUANTA_GSJ_POWER_ON_STRAPS 0x00001fff | ||
34 | #define QUANTA_GBS_POWER_ON_STRAPS 0x000017ff | ||
35 | #define KUDO_BMC_POWER_ON_STRAPS 0x00001fff | ||
36 | +#define MORI_BMC_POWER_ON_STRAPS 0x00001fff | ||
37 | |||
38 | static const char npcm7xx_default_bootrom[] = "npcm7xx_bootrom.bin"; | ||
39 | |||
40 | @@ -XXX,XX +XXX,XX @@ static void kudo_bmc_init(MachineState *machine) | ||
41 | npcm7xx_load_kernel(machine, soc); | ||
38 | } | 42 | } |
39 | 43 | ||
40 | +static void exynos4210_rtc_finalize(Object *obj) | 44 | +static void mori_bmc_init(MachineState *machine) |
41 | +{ | 45 | +{ |
42 | + Exynos4210RTCState *s = EXYNOS4210_RTC(obj); | 46 | + NPCM7xxState *soc; |
43 | + | 47 | + |
44 | + ptimer_free(s->ptimer); | 48 | + soc = npcm7xx_create_soc(machine, MORI_BMC_POWER_ON_STRAPS); |
45 | + ptimer_free(s->ptimer_1Hz); | 49 | + npcm7xx_connect_dram(soc, machine->ram); |
50 | + qdev_realize(DEVICE(soc), NULL, &error_fatal); | ||
51 | + | ||
52 | + npcm7xx_load_bootrom(machine, soc); | ||
53 | + npcm7xx_connect_flash(&soc->fiu[1], 0, "mx66u51235f", | ||
54 | + drive_get(IF_MTD, 3, 0)); | ||
55 | + | ||
56 | + npcm7xx_load_kernel(machine, soc); | ||
46 | +} | 57 | +} |
47 | + | 58 | + |
48 | static void exynos4210_rtc_class_init(ObjectClass *klass, void *data) | 59 | static void npcm7xx_set_soc_type(NPCM7xxMachineClass *nmc, const char *type) |
49 | { | 60 | { |
50 | DeviceClass *dc = DEVICE_CLASS(klass); | 61 | NPCM7xxClass *sc = NPCM7XX_CLASS(object_class_by_name(type)); |
51 | @@ -XXX,XX +XXX,XX @@ static const TypeInfo exynos4210_rtc_info = { | 62 | @@ -XXX,XX +XXX,XX @@ static void kudo_bmc_machine_class_init(ObjectClass *oc, void *data) |
52 | .parent = TYPE_SYS_BUS_DEVICE, | 63 | mc->default_ram_size = 1 * GiB; |
53 | .instance_size = sizeof(Exynos4210RTCState), | ||
54 | .instance_init = exynos4210_rtc_init, | ||
55 | + .instance_finalize = exynos4210_rtc_finalize, | ||
56 | .class_init = exynos4210_rtc_class_init, | ||
57 | }; | 64 | }; |
58 | 65 | ||
66 | +static void mori_bmc_machine_class_init(ObjectClass *oc, void *data) | ||
67 | +{ | ||
68 | + NPCM7xxMachineClass *nmc = NPCM7XX_MACHINE_CLASS(oc); | ||
69 | + MachineClass *mc = MACHINE_CLASS(oc); | ||
70 | + | ||
71 | + npcm7xx_set_soc_type(nmc, TYPE_NPCM730); | ||
72 | + | ||
73 | + mc->desc = "Mori BMC (Cortex-A9)"; | ||
74 | + mc->init = mori_bmc_init; | ||
75 | + mc->default_ram_size = 1 * GiB; | ||
76 | +} | ||
77 | + | ||
78 | static const TypeInfo npcm7xx_machine_types[] = { | ||
79 | { | ||
80 | .name = TYPE_NPCM7XX_MACHINE, | ||
81 | @@ -XXX,XX +XXX,XX @@ static const TypeInfo npcm7xx_machine_types[] = { | ||
82 | .name = MACHINE_TYPE_NAME("kudo-bmc"), | ||
83 | .parent = TYPE_NPCM7XX_MACHINE, | ||
84 | .class_init = kudo_bmc_machine_class_init, | ||
85 | + }, { | ||
86 | + .name = MACHINE_TYPE_NAME("mori-bmc"), | ||
87 | + .parent = TYPE_NPCM7XX_MACHINE, | ||
88 | + .class_init = mori_bmc_machine_class_init, | ||
89 | }, | ||
90 | }; | ||
91 | |||
59 | -- | 92 | -- |
60 | 2.20.1 | 93 | 2.25.1 |
61 | 94 | ||
62 | 95 | diff view generated by jsdifflib |
1 | From: Richard Henderson <richard.henderson@linaro.org> | 1 | From: Philippe Mathieu-Daudé <f4bug@amsat.org> |
---|---|---|---|
2 | 2 | ||
3 | In 50244cc76abc we updated mte_check_fail to match the ARM | 3 | setAllowedFileTypes is deprecated in macOS 12. |
4 | pseudocode, using the correct EL to select the TCF field. | ||
5 | But we failed to update MTE0_ACTIVE the same way, which led | ||
6 | to g_assert_not_reached(). | ||
7 | 4 | ||
8 | Cc: qemu-stable@nongnu.org | 5 | Per Akihiko Odaki [*]: |
9 | Buglink: https://bugs.launchpad.net/bugs/1907137 | 6 | |
10 | Signed-off-by: Richard Henderson <richard.henderson@linaro.org> | 7 | An image file, which is being chosen by the panel, can be a |
11 | Message-id: 20201221204426.88514-1-richard.henderson@linaro.org | 8 | raw file and have a variety of file extensions and many are not |
12 | Reviewed-by: Peter Maydell <peter.maydell@linaro.org> | 9 | covered by the provided list (e.g. "udf"). Other platforms like |
10 | GTK can provide an option to open a file with an extension not | ||
11 | listed, but Cocoa can't. It forces the user to rename the file | ||
12 | to give an extension in the list. Moreover, Cocoa does not tell | ||
13 | which extensions are in the list so the user needs to read the | ||
14 | source code, which is pretty bad. | ||
15 | |||
16 | Since this code is harming the usability rather than improving it, | ||
17 | simply remove the [NSSavePanel allowedFileTypes:] call, fixing: | ||
18 | |||
19 | [2789/6622] Compiling Objective-C object libcommon.fa.p/ui_cocoa.m.o | ||
20 | ui/cocoa.m:1411:16: error: 'setAllowedFileTypes:' is deprecated: first deprecated in macOS 12.0 - Use -allowedContentTypes instead [-Werror,-Wdeprecated-declarations] | ||
21 | [openPanel setAllowedFileTypes: supportedImageFileTypes]; | ||
22 | ^ | ||
23 | /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSSavePanel.h:215:49: note: property 'allowedFileTypes' is declared deprecated here | ||
24 | @property (nullable, copy) NSArray<NSString *> *allowedFileTypes API_DEPRECATED("Use -allowedContentTypes instead", macos(10.3,12.0)); | ||
25 | ^ | ||
26 | /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSSavePanel.h:215:49: note: 'setAllowedFileTypes:' has been explicitly marked deprecated here | ||
27 | FAILED: libcommon.fa.p/ui_cocoa.m.o | ||
28 | |||
29 | [*] https://lore.kernel.org/qemu-devel/4dde2e66-63cb-4390-9538-c032310db3e3@gmail.com/ | ||
30 | |||
31 | Suggested-by: Akihiko Odaki <akihiko.odaki@gmail.com> | ||
32 | Reviewed-by: Roman Bolshakov <r.bolshakov@yadro.com> | ||
33 | Tested-by: Roman Bolshakov <r.bolshakov@yadro.com> | ||
34 | Reviewed-by: Christian Schoenebeck <qemu_oss@crudebyte.com> | ||
35 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
36 | Message-id: 20220215080307.69550-11-f4bug@amsat.org | ||
37 | Reviewed by: Cameron Esfahani <dirty@apple.com> | ||
38 | Reviewed-by: Akihiko Odaki <akihiko.odaki@gmail.com> | ||
39 | Tested-by: Akihiko Odaki <akihiko.odaki@gmail.com> | ||
40 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
13 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 41 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
14 | --- | 42 | --- |
15 | target/arm/helper.c | 2 +- | 43 | ui/cocoa.m | 6 ------ |
16 | 1 file changed, 1 insertion(+), 1 deletion(-) | 44 | 1 file changed, 6 deletions(-) |
17 | 45 | ||
18 | diff --git a/target/arm/helper.c b/target/arm/helper.c | 46 | diff --git a/ui/cocoa.m b/ui/cocoa.m |
19 | index XXXXXXX..XXXXXXX 100644 | 47 | index XXXXXXX..XXXXXXX 100644 |
20 | --- a/target/arm/helper.c | 48 | --- a/ui/cocoa.m |
21 | +++ b/target/arm/helper.c | 49 | +++ b/ui/cocoa.m |
22 | @@ -XXX,XX +XXX,XX @@ static uint32_t rebuild_hflags_a64(CPUARMState *env, int el, int fp_el, | 50 | @@ -XXX,XX +XXX,XX @@ static int gArgc; |
23 | if (FIELD_EX32(flags, TBFLAG_A64, UNPRIV) | 51 | static char **gArgv; |
24 | && tbid | 52 | static bool stretch_video; |
25 | && !(env->pstate & PSTATE_TCO) | 53 | static NSTextField *pauseLabel; |
26 | - && (sctlr & SCTLR_TCF0) | 54 | -static NSArray * supportedImageFileTypes; |
27 | + && (sctlr & SCTLR_TCF) | 55 | |
28 | && allocation_tag_access_enabled(env, 0, sctlr)) { | 56 | static QemuSemaphore display_init_sem; |
29 | flags = FIELD_DP32(flags, TBFLAG_A64, MTE0_ACTIVE, 1); | 57 | static QemuSemaphore app_started_sem; |
30 | } | 58 | @@ -XXX,XX +XXX,XX @@ QemuCocoaView *cocoaView; |
59 | [pauseLabel setTextColor: [NSColor blackColor]]; | ||
60 | [pauseLabel sizeToFit]; | ||
61 | |||
62 | - // set the supported image file types that can be opened | ||
63 | - supportedImageFileTypes = [NSArray arrayWithObjects: @"img", @"iso", @"dmg", | ||
64 | - @"qcow", @"qcow2", @"cloop", @"vmdk", @"cdr", | ||
65 | - @"toast", nil]; | ||
66 | [self make_about_window]; | ||
67 | } | ||
68 | return self; | ||
69 | @@ -XXX,XX +XXX,XX @@ QemuCocoaView *cocoaView; | ||
70 | openPanel = [NSOpenPanel openPanel]; | ||
71 | [openPanel setCanChooseFiles: YES]; | ||
72 | [openPanel setAllowsMultipleSelection: NO]; | ||
73 | - [openPanel setAllowedFileTypes: supportedImageFileTypes]; | ||
74 | if([openPanel runModal] == NSModalResponseOK) { | ||
75 | NSString * file = [[[openPanel URLs] objectAtIndex: 0] path]; | ||
76 | if(file == nil) { | ||
31 | -- | 77 | -- |
32 | 2.20.1 | 78 | 2.25.1 |
33 | 79 | ||
34 | 80 | diff view generated by jsdifflib |
1 | From: Gan Qixin <ganqixin@huawei.com> | 1 | From: Akihiko Odaki <akihiko.odaki@gmail.com> |
---|---|---|---|
2 | 2 | ||
3 | When running device-introspect-test, a memory leak occurred in the | 3 | Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com> |
4 | digic_timer_init function, so use ptimer_free() in the finalize function to | 4 | Message-id: 20220215080307.69550-13-f4bug@amsat.org |
5 | avoid it. | 5 | Message-Id: <20220213021418.2155-1-akihiko.odaki@gmail.com> |
6 | 6 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | |
7 | ASAN shows memory leak stack: | ||
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> | 7 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
28 | --- | 8 | --- |
29 | hw/timer/digic-timer.c | 8 ++++++++ | 9 | ui/cocoa.m | 5 ----- |
30 | 1 file changed, 8 insertions(+) | 10 | 1 file changed, 5 deletions(-) |
31 | 11 | ||
32 | diff --git a/hw/timer/digic-timer.c b/hw/timer/digic-timer.c | 12 | diff --git a/ui/cocoa.m b/ui/cocoa.m |
33 | index XXXXXXX..XXXXXXX 100644 | 13 | index XXXXXXX..XXXXXXX 100644 |
34 | --- a/hw/timer/digic-timer.c | 14 | --- a/ui/cocoa.m |
35 | +++ b/hw/timer/digic-timer.c | 15 | +++ b/ui/cocoa.m |
36 | @@ -XXX,XX +XXX,XX @@ static void digic_timer_init(Object *obj) | 16 | @@ -XXX,XX +XXX,XX @@ static void addRemovableDevicesMenuItems(void) |
37 | sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->iomem); | 17 | |
38 | } | 18 | currentDevice = qmp_query_block(NULL); |
39 | 19 | pointerToFree = currentDevice; | |
40 | +static void digic_timer_finalize(Object *obj) | 20 | - if(currentDevice == NULL) { |
41 | +{ | 21 | - NSBeep(); |
42 | + DigicTimerState *s = DIGIC_TIMER(obj); | 22 | - QEMU_Alert(@"Failed to query for block devices!"); |
43 | + | 23 | - return; |
44 | + ptimer_free(s->ptimer); | 24 | - } |
45 | +} | 25 | |
46 | + | 26 | menu = [[[NSApp mainMenu] itemWithTitle:@"Machine"] submenu]; |
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 | }; | ||
57 | 27 | ||
58 | -- | 28 | -- |
59 | 2.20.1 | 29 | 2.25.1 |
60 | 30 | ||
61 | 31 | diff view generated by jsdifflib |
1 | From: "Edgar E. Iglesias" <edgar.iglesias@xilinx.com> | 1 | From: Akihiko Odaki <akihiko.odaki@gmail.com> |
---|---|---|---|
2 | 2 | ||
3 | Correct the indexing into s->cpu_ctlr for vCPUs. | 3 | Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com> |
4 | |||
5 | Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com> | ||
6 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | 4 | Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> |
7 | Reviewed-by: Luc Michel <luc.michel@greensocs.com> | 5 | Message-id: 20220215080307.69550-14-f4bug@amsat.org |
8 | Message-id: 20201214222154.3480243-2-edgar.iglesias@gmail.com | 6 | Message-Id: <20220213021329.2066-1-akihiko.odaki@gmail.com> |
7 | [PMD: Use g_autofree, suggested by Zoltan BALATON] | ||
8 | Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> | ||
9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 9 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> |
10 | --- | 10 | --- |
11 | hw/intc/arm_gic.c | 4 +++- | 11 | ui/cocoa.m | 4 +++- |
12 | 1 file changed, 3 insertions(+), 1 deletion(-) | 12 | 1 file changed, 3 insertions(+), 1 deletion(-) |
13 | 13 | ||
14 | diff --git a/hw/intc/arm_gic.c b/hw/intc/arm_gic.c | 14 | diff --git a/ui/cocoa.m b/ui/cocoa.m |
15 | index XXXXXXX..XXXXXXX 100644 | 15 | index XXXXXXX..XXXXXXX 100644 |
16 | --- a/hw/intc/arm_gic.c | 16 | --- a/ui/cocoa.m |
17 | +++ b/hw/intc/arm_gic.c | 17 | +++ b/ui/cocoa.m |
18 | @@ -XXX,XX +XXX,XX @@ static inline void gic_get_best_virq(GICState *s, int cpu, | 18 | @@ -XXX,XX +XXX,XX @@ static void create_initial_menus(void) |
19 | static inline bool gic_irq_signaling_enabled(GICState *s, int cpu, bool virt, | 19 | /* Returns a name for a given console */ |
20 | int group_mask) | 20 | static NSString * getConsoleName(QemuConsole * console) |
21 | { | 21 | { |
22 | + int cpu_iface = virt ? (cpu + GIC_NCPU) : cpu; | 22 | - return [NSString stringWithFormat: @"%s", qemu_console_get_label(console)]; |
23 | + g_autofree char *label = qemu_console_get_label(console); | ||
23 | + | 24 | + |
24 | if (!virt && !(s->ctlr & group_mask)) { | 25 | + return [NSString stringWithUTF8String:label]; |
25 | return false; | 26 | } |
26 | } | 27 | |
27 | @@ -XXX,XX +XXX,XX @@ static inline bool gic_irq_signaling_enabled(GICState *s, int cpu, bool virt, | 28 | /* Add an entry to the View menu for each console */ |
28 | return false; | ||
29 | } | ||
30 | |||
31 | - if (!(s->cpu_ctlr[cpu] & group_mask)) { | ||
32 | + if (!(s->cpu_ctlr[cpu_iface] & group_mask)) { | ||
33 | return false; | ||
34 | } | ||
35 | |||
36 | -- | 29 | -- |
37 | 2.20.1 | 30 | 2.25.1 |
38 | 31 | ||
39 | 32 | diff view generated by jsdifflib |