qemu/Include-sysemu-sysemu.h-a-lot-less.patch
Jiabo Feng 9df0eb3b5b QEMU update to version 4.1.0-83
- hw/virtio/virtio-crypto: Protect from DMA re-entrancy bugs(CVE-2024-3446)
- hw/char/virtio-serial-bus: Protect from DMA re-entrancy bugs(CVE-2024-3446)
- hw/display/virtio-gpu: Protect from DMA re-entrancy bugs(CVE-2024-3446)
- hw/virtio: Introduce virtio_bh_new_guarded() helper
- hw: replace most qemu_bh_new calls with qemu_bh_new_guarded
- checkpatch: add qemu_bh_new/aio_bh_new checks
- async: avoid use-after-free on re-entrancy guard
- async: Add an optional reentrancy guard to the BH API
- util/async: add a human-readable name to BHs for debugging
- hw/sd/sdhci: Do not update TRNMOD when Command Inhibit (DAT) is set
- Include sysemu/sysemu.h a lot less

Signed-off-by: Jiabo Feng <fengjiabo1@huawei.com>
2024-04-23 22:03:19 +08:00

428 lines
13 KiB
Diff

From a848381352be1e0f2fe25ef0983e86a37c99dc87 Mon Sep 17 00:00:00 2001
From: Markus Armbruster <armbru@redhat.com>
Date: Mon, 12 Aug 2019 07:23:57 +0200
Subject: [PATCH] Include sysemu/sysemu.h a lot less
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
In my "build everything" tree, changing sysemu/sysemu.h triggers a
recompile of some 5400 out of 6600 objects (not counting tests and
objects that don't depend on qemu/osdep.h).
hw/qdev-core.h includes sysemu/sysemu.h since recent commit e965ffa70a
"qdev: add qdev_add_vm_change_state_handler()". This is a bad idea:
hw/qdev-core.h is widely included.
Move the declaration of qdev_add_vm_change_state_handler() to
sysemu/sysemu.h, and drop the problematic include from hw/qdev-core.h.
Touching sysemu/sysemu.h now recompiles some 1800 objects.
qemu/uuid.h also drops from 5400 to 1800. A few more headers show
smaller improvement: qemu/notify.h drops from 5600 to 5200,
qemu/timer.h from 5600 to 4500, and qapi/qapi-types-run-state.h from
5500 to 5000.
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-Id: <20190812052359.30071-28-armbru@redhat.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: liuxiangdong <liuxiangdong5@huawei.com>
---
accel/kvm/kvm-all.c | 1 +
backends/hostmem.c | 1 +
cpus.c | 1 +
hw/arm/allwinner-a10.c | 1 +
hw/arm/aspeed_soc.c | 1 +
hw/arm/kzm.c | 1 +
hw/arm/msf2-soc.c | 1 +
hw/arm/stm32f205_soc.c | 1 +
hw/char/serial-isa.c | 1 +
hw/char/xen_console.c | 1 +
hw/core/numa.c | 1 +
hw/core/vm-change-state-handler.c | 1 +
hw/display/qxl-render.c | 1 +
hw/i386/xen/xen-hvm.c | 1 +
hw/i386/xen/xen-mapcache.c | 1 +
hw/intc/ioapic.c | 1 +
hw/riscv/sifive_e.c | 1 +
hw/riscv/sifive_u.c | 1 +
hw/riscv/spike.c | 1 +
hw/riscv/virt.c | 1 +
hw/sparc64/niagara.c | 2 +-
hw/xen/xen-common.c | 1 +
hw/xen/xen_devconfig.c | 1 +
hw/xenpv/xen_machine_pv.c | 1 +
include/hw/qdev-core.h | 5 -----
include/sysemu/sysemu.h | 3 +++
migration/global_state.c | 1 +
migration/migration.c | 1 +
migration/savevm.c | 1 +
29 files changed, 30 insertions(+), 6 deletions(-)
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index 84edbe8bb1..5deac12aed 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -30,6 +30,7 @@
#include "exec/gdbstub.h"
#include "sysemu/kvm_int.h"
#include "sysemu/cpus.h"
+#include "sysemu/sysemu.h"
#include "qemu/bswap.h"
#include "exec/memory.h"
#include "exec/ram_addr.h"
diff --git a/backends/hostmem.c b/backends/hostmem.c
index 9e1b3a0afc..35b0c91467 100644
--- a/backends/hostmem.c
+++ b/backends/hostmem.c
@@ -12,6 +12,7 @@
#include "qemu/osdep.h"
#include "sysemu/hostmem.h"
+#include "sysemu/sysemu.h"
#include "hw/boards.h"
#include "qapi/error.h"
#include "qapi/qapi-builtin-visit.h"
diff --git a/cpus.c b/cpus.c
index 927a00aa90..b2a26a1f11 100644
--- a/cpus.c
+++ b/cpus.c
@@ -40,6 +40,7 @@
#include "sysemu/kvm.h"
#include "sysemu/hax.h"
#include "sysemu/hvf.h"
+#include "sysemu/sysemu.h"
#include "sysemu/whpx.h"
#include "exec/exec-all.h"
diff --git a/hw/arm/allwinner-a10.c b/hw/arm/allwinner-a10.c
index 35e906ca54..60e33efa0c 100644
--- a/hw/arm/allwinner-a10.c
+++ b/hw/arm/allwinner-a10.c
@@ -22,6 +22,7 @@
#include "hw/sysbus.h"
#include "hw/arm/allwinner-a10.h"
#include "hw/misc/unimp.h"
+#include "sysemu/sysemu.h"
static void aw_a10_init(Object *obj)
{
diff --git a/hw/arm/aspeed_soc.c b/hw/arm/aspeed_soc.c
index c6fb3700f2..9ee8104832 100644
--- a/hw/arm/aspeed_soc.c
+++ b/hw/arm/aspeed_soc.c
@@ -22,6 +22,7 @@
#include "qemu/error-report.h"
#include "hw/i2c/aspeed_i2c.h"
#include "net/net.h"
+#include "sysemu/sysemu.h"
#define ASPEED_SOC_IOMEM_SIZE 0x00200000
diff --git a/hw/arm/kzm.c b/hw/arm/kzm.c
index 59d2102dc5..2f052e1f8c 100644
--- a/hw/arm/kzm.c
+++ b/hw/arm/kzm.c
@@ -24,6 +24,7 @@
#include "hw/net/lan9118.h"
#include "hw/char/serial.h"
#include "sysemu/qtest.h"
+#include "sysemu/sysemu.h"
/* Memory map for Kzm Emulation Baseboard:
* 0x00000000-0x7fffffff See i.MX31 SOC for support
diff --git a/hw/arm/msf2-soc.c b/hw/arm/msf2-soc.c
index 1ccb644df7..3e479b8fa5 100644
--- a/hw/arm/msf2-soc.c
+++ b/hw/arm/msf2-soc.c
@@ -30,6 +30,7 @@
#include "hw/boards.h"
#include "hw/arm/msf2-soc.h"
#include "hw/misc/unimp.h"
+#include "sysemu/sysemu.h"
#define MSF2_TIMER_BASE 0x40004000
#define MSF2_SYSREG_BASE 0x40038000
diff --git a/hw/arm/stm32f205_soc.c b/hw/arm/stm32f205_soc.c
index c08041a1c5..634a527f04 100644
--- a/hw/arm/stm32f205_soc.c
+++ b/hw/arm/stm32f205_soc.c
@@ -28,6 +28,7 @@
#include "hw/arm/boot.h"
#include "exec/address-spaces.h"
#include "hw/arm/stm32f205_soc.h"
+#include "sysemu/sysemu.h"
/* At the moment only Timer 2 to 5 are modelled */
static const uint32_t timer_addr[STM_NUM_TIMERS] = { 0x40000000, 0x40000400,
diff --git a/hw/char/serial-isa.c b/hw/char/serial-isa.c
index 610426111a..ce48c80552 100644
--- a/hw/char/serial-isa.c
+++ b/hw/char/serial-isa.c
@@ -26,6 +26,7 @@
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qemu/module.h"
+#include "sysemu/sysemu.h"
#include "hw/char/serial.h"
#include "hw/isa/isa.h"
diff --git a/hw/char/xen_console.c b/hw/char/xen_console.c
index 47e1092263..cd37454356 100644
--- a/hw/char/xen_console.c
+++ b/hw/char/xen_console.c
@@ -25,6 +25,7 @@
#include "qapi/error.h"
#include "hw/hw.h"
+#include "sysemu/sysemu.h"
#include "chardev/char-fe.h"
#include "hw/xen/xen-legacy-backend.h"
diff --git a/hw/core/numa.c b/hw/core/numa.c
index a11431483c..7010234cc3 100644
--- a/hw/core/numa.c
+++ b/hw/core/numa.c
@@ -24,6 +24,7 @@
#include "qemu/osdep.h"
#include "sysemu/numa.h"
+#include "sysemu/sysemu.h"
#include "exec/cpu-common.h"
#include "exec/ramlist.h"
#include "qemu/bitmap.h"
diff --git a/hw/core/vm-change-state-handler.c b/hw/core/vm-change-state-handler.c
index f814813bdd..0097c6359d 100644
--- a/hw/core/vm-change-state-handler.c
+++ b/hw/core/vm-change-state-handler.c
@@ -17,6 +17,7 @@
#include "qemu/osdep.h"
#include "hw/qdev.h"
+#include "sysemu/sysemu.h"
static int qdev_get_dev_tree_depth(DeviceState *dev)
{
diff --git a/hw/display/qxl-render.c b/hw/display/qxl-render.c
index c2a619095b..bce29bb2d6 100644
--- a/hw/display/qxl-render.c
+++ b/hw/display/qxl-render.c
@@ -21,6 +21,7 @@
#include "qemu/osdep.h"
#include "qxl.h"
+#include "sysemu/sysemu.h"
#include "trace.h"
static void qxl_blit(PCIQXLDevice *qxl, QXLRect *rect)
diff --git a/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c
index e8e79e0917..f3e2e55175 100644
--- a/hw/i386/xen/xen-hvm.c
+++ b/hw/i386/xen/xen-hvm.c
@@ -22,6 +22,7 @@
#include "qapi/qapi-commands-misc.h"
#include "qemu/error-report.h"
#include "qemu/range.h"
+#include "sysemu/sysemu.h"
#include "sysemu/xen-mapcache.h"
#include "trace.h"
#include "exec/address-spaces.h"
diff --git a/hw/i386/xen/xen-mapcache.c b/hw/i386/xen/xen-mapcache.c
index dc73c86c61..09656f9f11 100644
--- a/hw/i386/xen/xen-mapcache.c
+++ b/hw/i386/xen/xen-mapcache.c
@@ -17,6 +17,7 @@
#include "hw/xen/xen-legacy-backend.h"
#include "qemu/bitmap.h"
+#include "sysemu/sysemu.h"
#include "sysemu/xen-mapcache.h"
#include "trace.h"
diff --git a/hw/intc/ioapic.c b/hw/intc/ioapic.c
index e99c37cceb..7947c5c2f2 100644
--- a/hw/intc/ioapic.c
+++ b/hw/intc/ioapic.c
@@ -30,6 +30,7 @@
#include "hw/i386/ioapic_internal.h"
#include "hw/pci/msi.h"
#include "sysemu/kvm.h"
+#include "sysemu/sysemu.h"
#include "hw/i386/apic-msidef.h"
#include "hw/i386/x86-iommu.h"
#include "trace.h"
diff --git a/hw/riscv/sifive_e.c b/hw/riscv/sifive_e.c
index 2a499d8ed2..f5b1c7bbf0 100644
--- a/hw/riscv/sifive_e.c
+++ b/hw/riscv/sifive_e.c
@@ -47,6 +47,7 @@
#include "hw/riscv/boot.h"
#include "chardev/char.h"
#include "sysemu/arch_init.h"
+#include "sysemu/sysemu.h"
#include "exec/address-spaces.h"
static const struct MemmapEntry {
diff --git a/hw/riscv/sifive_u.c b/hw/riscv/sifive_u.c
index 71b8083c05..aeddb09375 100644
--- a/hw/riscv/sifive_u.c
+++ b/hw/riscv/sifive_u.c
@@ -45,6 +45,7 @@
#include "chardev/char.h"
#include "sysemu/arch_init.h"
#include "sysemu/device_tree.h"
+#include "sysemu/sysemu.h"
#include "exec/address-spaces.h"
#include <libfdt.h>
diff --git a/hw/riscv/spike.c b/hw/riscv/spike.c
index 2991b341a2..f0cdc0daca 100644
--- a/hw/riscv/spike.c
+++ b/hw/riscv/spike.c
@@ -41,6 +41,7 @@
#include "sysemu/arch_init.h"
#include "sysemu/device_tree.h"
#include "sysemu/qtest.h"
+#include "sysemu/sysemu.h"
#include "exec/address-spaces.h"
#include <libfdt.h>
diff --git a/hw/riscv/virt.c b/hw/riscv/virt.c
index 25faf3b417..a9da15d360 100644
--- a/hw/riscv/virt.c
+++ b/hw/riscv/virt.c
@@ -38,6 +38,7 @@
#include "chardev/char.h"
#include "sysemu/arch_init.h"
#include "sysemu/device_tree.h"
+#include "sysemu/sysemu.h"
#include "exec/address-spaces.h"
#include "hw/pci/pci.h"
#include "hw/pci-host/gpex.h"
diff --git a/hw/sparc64/niagara.c b/hw/sparc64/niagara.c
index dc0ce7eda4..55656d7100 100644
--- a/hw/sparc64/niagara.c
+++ b/hw/sparc64/niagara.c
@@ -36,7 +36,7 @@
#include "sysemu/block-backend.h"
#include "qemu/error-report.h"
#include "sysemu/qtest.h"
-
+#include "sysemu/sysemu.h"
typedef struct NiagaraBoardState {
MemoryRegion hv_ram;
diff --git a/hw/xen/xen-common.c b/hw/xen/xen-common.c
index 32503cfc1c..76621da2f5 100644
--- a/hw/xen/xen-common.c
+++ b/hw/xen/xen-common.c
@@ -14,6 +14,7 @@
#include "hw/xen/xen-legacy-backend.h"
#include "chardev/char.h"
#include "sysemu/accel.h"
+#include "sysemu/sysemu.h"
#include "migration/misc.h"
#include "migration/global_state.h"
diff --git a/hw/xen/xen_devconfig.c b/hw/xen/xen_devconfig.c
index 315dbc9c51..46ee4a7f02 100644
--- a/hw/xen/xen_devconfig.c
+++ b/hw/xen/xen_devconfig.c
@@ -2,6 +2,7 @@
#include "hw/xen/xen-legacy-backend.h"
#include "qemu/option.h"
#include "sysemu/blockdev.h"
+#include "sysemu/sysemu.h"
/* ------------------------------------------------------------- */
diff --git a/hw/xenpv/xen_machine_pv.c b/hw/xenpv/xen_machine_pv.c
index dcaf2a01a3..267bd60dfc 100644
--- a/hw/xenpv/xen_machine_pv.c
+++ b/hw/xenpv/xen_machine_pv.c
@@ -29,6 +29,7 @@
#include "hw/xen/xen-legacy-backend.h"
#include "hw/xen/xen-bus.h"
#include "sysemu/block-backend.h"
+#include "sysemu/sysemu.h"
static void xen_init_pv(MachineState *machine)
{
diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
index 364771f3a2..02257cae78 100644
--- a/include/hw/qdev-core.h
+++ b/include/hw/qdev-core.h
@@ -6,7 +6,6 @@
#include "qom/object.h"
#include "hw/irq.h"
#include "hw/hotplug.h"
-#include "sysemu/sysemu.h"
enum {
DEV_NVECTORS_UNSPECIFIED = -1,
@@ -461,8 +460,4 @@ static inline bool qbus_is_hotpluggable(BusState *bus)
void device_listener_register(DeviceListener *listener);
void device_listener_unregister(DeviceListener *listener);
-VMChangeStateEntry *qdev_add_vm_change_state_handler(DeviceState *dev,
- VMChangeStateHandler *cb,
- void *opaque);
-
#endif
diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index 984c439ac9..a8be0a2d82 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -31,6 +31,9 @@ VMChangeStateEntry *qemu_add_vm_change_state_handler(VMChangeStateHandler *cb,
void *opaque);
VMChangeStateEntry *qemu_add_vm_change_state_handler_prio(
VMChangeStateHandler *cb, void *opaque, int priority);
+VMChangeStateEntry *qdev_add_vm_change_state_handler(DeviceState *dev,
+ VMChangeStateHandler *cb,
+ void *opaque);
void qemu_del_vm_change_state_handler(VMChangeStateEntry *e);
void vm_state_notify(int running, RunState state);
diff --git a/migration/global_state.c b/migration/global_state.c
index 2c8c447239..7cba868979 100644
--- a/migration/global_state.c
+++ b/migration/global_state.c
@@ -13,6 +13,7 @@
#include "qemu/osdep.h"
#include "qemu/cutils.h"
#include "qemu/error-report.h"
+#include "sysemu/sysemu.h"
#include "qapi/error.h"
#include "migration.h"
#include "migration/global_state.h"
diff --git a/migration/migration.c b/migration/migration.c
index 8f2fc2b4ff..aec3060b0f 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -20,6 +20,7 @@
#include "exec.h"
#include "fd.h"
#include "socket.h"
+#include "sysemu/sysemu.h"
#include "rdma.h"
#include "ram.h"
#include "migration/global_state.h"
diff --git a/migration/savevm.c b/migration/savevm.c
index 480c511b19..23d6befed5 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -55,6 +55,7 @@
#include "io/channel-buffer.h"
#include "io/channel-file.h"
#include "sysemu/replay.h"
+#include "sysemu/sysemu.h"
#include "qjson.h"
#include "migration/colo.h"
#include "qemu/bitmap.h"
--
2.27.0