From: "Michael S. Tsirkin" <mst@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
"Aleksandar Rikalo" <aleksandar.rikalo@syrmia.com>,
"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
"Ani Sinha" <ani@anisinha.ca>,
"Igor Mammedov" <imammedo@redhat.com>,
"Aurelien Jarno" <aurelien@aurel32.net>
Subject: [PULL 06/35] hw/acpi: refactor acpi hp modules so that targets can just use what they need
Date: Sat, 4 Sep 2021 17:36:12 -0400 [thread overview]
Message-ID: <20210904213506.486886-7-mst@redhat.com> (raw)
In-Reply-To: <20210904213506.486886-1-mst@redhat.com>
From: Ani Sinha <ani@anisinha.ca>
Currently various acpi hotplug modules like cpu hotplug, memory hotplug, pci
hotplug, nvdimm hotplug are all pulled in when CONFIG_ACPI_X86 is turned on.
This brings in support for whole lot of subsystems that some targets like
mips does not need. They are added just to satisfy symbol dependencies. This
is ugly and should be avoided. Targets should be able to pull in just what they
need and no more. For example, mips only needs support for PIIX4 and does not
need acpi pci hotplug support or cpu hotplug support or memory hotplug support
etc. This change is an effort to clean this up.
In this change, new config variables are added for various acpi hotplug
subsystems. Targets like mips can only enable PIIX4 support and not the rest
of all the other modules which were being previously pulled in as a part of
CONFIG_ACPI_X86. Function stubs make sure that symbols which piix4 needs but
are not required by mips (for example, symbols specific to pci hotplug etc)
are available to satisfy the dependencies.
Currently, this change only addresses issues with mips malta targets. In future
we might be able to clean up other targets which are similarly pulling in lot
of unnecessary hotplug modules by enabling ACPI_X86.
This change should also address issues such as the following:
https://gitlab.com/qemu-project/qemu/-/issues/221
https://gitlab.com/qemu-project/qemu/-/issues/193
Signed-off-by: Ani Sinha <ani@anisinha.ca>
Message-Id: <20210812071409.492299-1-ani@anisinha.ca>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
configs/devices/mips-softmmu/common.mak | 5 +--
hw/acpi/acpi-cpu-hotplug-stub.c | 50 +++++++++++++++++++++++++
hw/acpi/acpi-mem-hotplug-stub.c | 35 +++++++++++++++++
hw/acpi/acpi-nvdimm-stub.c | 8 ++++
hw/acpi/acpi-pci-hotplug-stub.c | 47 +++++++++++++++++++++++
hw/acpi/Kconfig | 10 +++++
hw/acpi/meson.build | 14 +++++--
7 files changed, 161 insertions(+), 8 deletions(-)
create mode 100644 hw/acpi/acpi-cpu-hotplug-stub.c
create mode 100644 hw/acpi/acpi-mem-hotplug-stub.c
create mode 100644 hw/acpi/acpi-nvdimm-stub.c
create mode 100644 hw/acpi/acpi-pci-hotplug-stub.c
diff --git a/configs/devices/mips-softmmu/common.mak b/configs/devices/mips-softmmu/common.mak
index ea78fe7275..752b62b1e6 100644
--- a/configs/devices/mips-softmmu/common.mak
+++ b/configs/devices/mips-softmmu/common.mak
@@ -18,10 +18,7 @@ CONFIG_PCSPK=y
CONFIG_PCKBD=y
CONFIG_FDC=y
CONFIG_ACPI=y
-CONFIG_ACPI_X86=y
-CONFIG_ACPI_MEMORY_HOTPLUG=y
-CONFIG_ACPI_NVDIMM=y
-CONFIG_ACPI_CPU_HOTPLUG=y
+CONFIG_ACPI_PIIX4=y
CONFIG_APM=y
CONFIG_I8257=y
CONFIG_PIIX4=y
diff --git a/hw/acpi/acpi-cpu-hotplug-stub.c b/hw/acpi/acpi-cpu-hotplug-stub.c
new file mode 100644
index 0000000000..3fc4b14c26
--- /dev/null
+++ b/hw/acpi/acpi-cpu-hotplug-stub.c
@@ -0,0 +1,50 @@
+#include "qemu/osdep.h"
+#include "hw/acpi/cpu_hotplug.h"
+#include "migration/vmstate.h"
+
+
+/* Following stubs are all related to ACPI cpu hotplug */
+const VMStateDescription vmstate_cpu_hotplug;
+
+void acpi_switch_to_modern_cphp(AcpiCpuHotplug *gpe_cpu,
+ CPUHotplugState *cpuhp_state,
+ uint16_t io_port)
+{
+ return;
+}
+
+void legacy_acpi_cpu_hotplug_init(MemoryRegion *parent, Object *owner,
+ AcpiCpuHotplug *gpe_cpu, uint16_t base)
+{
+ return;
+}
+
+void acpi_cpu_ospm_status(CPUHotplugState *cpu_st, ACPIOSTInfoList ***list)
+{
+ return;
+}
+
+void acpi_cpu_plug_cb(HotplugHandler *hotplug_dev,
+ CPUHotplugState *cpu_st, DeviceState *dev, Error **errp)
+{
+ return;
+}
+
+void legacy_acpi_cpu_plug_cb(HotplugHandler *hotplug_dev,
+ AcpiCpuHotplug *g, DeviceState *dev, Error **errp)
+{
+ return;
+}
+
+void acpi_cpu_unplug_cb(CPUHotplugState *cpu_st,
+ DeviceState *dev, Error **errp)
+{
+ return;
+}
+
+void acpi_cpu_unplug_request_cb(HotplugHandler *hotplug_dev,
+ CPUHotplugState *cpu_st,
+ DeviceState *dev, Error **errp)
+{
+ return;
+}
diff --git a/hw/acpi/acpi-mem-hotplug-stub.c b/hw/acpi/acpi-mem-hotplug-stub.c
new file mode 100644
index 0000000000..73a076a265
--- /dev/null
+++ b/hw/acpi/acpi-mem-hotplug-stub.c
@@ -0,0 +1,35 @@
+#include "qemu/osdep.h"
+#include "hw/acpi/memory_hotplug.h"
+#include "migration/vmstate.h"
+
+const VMStateDescription vmstate_memory_hotplug;
+
+void acpi_memory_hotplug_init(MemoryRegion *as, Object *owner,
+ MemHotplugState *state, hwaddr io_base)
+{
+ return;
+}
+
+void acpi_memory_ospm_status(MemHotplugState *mem_st, ACPIOSTInfoList ***list)
+{
+ return;
+}
+
+void acpi_memory_plug_cb(HotplugHandler *hotplug_dev, MemHotplugState *mem_st,
+ DeviceState *dev, Error **errp)
+{
+ return;
+}
+
+void acpi_memory_unplug_cb(MemHotplugState *mem_st,
+ DeviceState *dev, Error **errp)
+{
+ return;
+}
+
+void acpi_memory_unplug_request_cb(HotplugHandler *hotplug_dev,
+ MemHotplugState *mem_st,
+ DeviceState *dev, Error **errp)
+{
+ return;
+}
diff --git a/hw/acpi/acpi-nvdimm-stub.c b/hw/acpi/acpi-nvdimm-stub.c
new file mode 100644
index 0000000000..8baff9be6f
--- /dev/null
+++ b/hw/acpi/acpi-nvdimm-stub.c
@@ -0,0 +1,8 @@
+#include "qemu/osdep.h"
+#include "hw/mem/nvdimm.h"
+#include "hw/hotplug.h"
+
+void nvdimm_acpi_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev)
+{
+ return;
+}
diff --git a/hw/acpi/acpi-pci-hotplug-stub.c b/hw/acpi/acpi-pci-hotplug-stub.c
new file mode 100644
index 0000000000..734e4c5986
--- /dev/null
+++ b/hw/acpi/acpi-pci-hotplug-stub.c
@@ -0,0 +1,47 @@
+#include "qemu/osdep.h"
+#include "hw/acpi/pcihp.h"
+#include "migration/vmstate.h"
+
+const VMStateDescription vmstate_acpi_pcihp_pci_status;
+
+void acpi_pcihp_init(Object *owner, AcpiPciHpState *s, PCIBus *root_bus,
+ MemoryRegion *address_space_io, bool bridges_enabled,
+ uint16_t io_base)
+{
+ return;
+}
+
+void acpi_pcihp_device_plug_cb(HotplugHandler *hotplug_dev, AcpiPciHpState *s,
+ DeviceState *dev, Error **errp)
+{
+ return;
+}
+
+void acpi_pcihp_device_pre_plug_cb(HotplugHandler *hotplug_dev,
+ DeviceState *dev, Error **errp)
+{
+ return;
+}
+
+void acpi_pcihp_device_unplug_cb(HotplugHandler *hotplug_dev, AcpiPciHpState *s,
+ DeviceState *dev, Error **errp)
+{
+ return;
+}
+
+void acpi_pcihp_device_unplug_request_cb(HotplugHandler *hotplug_dev,
+ AcpiPciHpState *s, DeviceState *dev,
+ Error **errp)
+{
+ return;
+}
+
+void acpi_pcihp_reset(AcpiPciHpState *s, bool acpihp_root_off)
+{
+ return;
+}
+
+bool vmstate_acpi_pcihp_use_acpi_index(void *opaque, int version_id)
+{
+ return false;
+}
diff --git a/hw/acpi/Kconfig b/hw/acpi/Kconfig
index cfc4ede8d9..3b5e118c54 100644
--- a/hw/acpi/Kconfig
+++ b/hw/acpi/Kconfig
@@ -8,6 +8,8 @@ config ACPI_X86
select ACPI_CPU_HOTPLUG
select ACPI_MEMORY_HOTPLUG
select ACPI_HMAT
+ select ACPI_PIIX4
+ select ACPI_PCIHP
config ACPI_X86_ICH
bool
@@ -24,6 +26,14 @@ config ACPI_NVDIMM
bool
depends on ACPI
+config ACPI_PIIX4
+ bool
+ depends on ACPI
+
+config ACPI_PCIHP
+ bool
+ depends on ACPI
+
config ACPI_HMAT
bool
depends on ACPI
diff --git a/hw/acpi/meson.build b/hw/acpi/meson.build
index 29f804d13e..7d8c0eb43e 100644
--- a/hw/acpi/meson.build
+++ b/hw/acpi/meson.build
@@ -6,16 +6,20 @@ acpi_ss.add(files(
'core.c',
'utils.c',
))
-acpi_ss.add(when: 'CONFIG_ACPI_CPU_HOTPLUG', if_true: files('cpu.c'))
-acpi_ss.add(when: 'CONFIG_ACPI_CPU_HOTPLUG', if_true: files('cpu_hotplug.c'))
+acpi_ss.add(when: 'CONFIG_ACPI_CPU_HOTPLUG', if_true: files('cpu.c', 'cpu_hotplug.c'))
+acpi_ss.add(when: 'CONFIG_ACPI_CPU_HOTPLUG', if_false: files('acpi-cpu-hotplug-stub.c'))
acpi_ss.add(when: 'CONFIG_ACPI_MEMORY_HOTPLUG', if_true: files('memory_hotplug.c'))
+acpi_ss.add(when: 'CONFIG_ACPI_MEMORY_HOTPLUG', if_false: files('acpi-mem-hotplug-stub.c'))
acpi_ss.add(when: 'CONFIG_ACPI_NVDIMM', if_true: files('nvdimm.c'))
+acpi_ss.add(when: 'CONFIG_ACPI_NVDIMM', if_false: files('acpi-nvdimm-stub.c'))
acpi_ss.add(when: 'CONFIG_ACPI_PCI', if_true: files('pci.c'))
acpi_ss.add(when: 'CONFIG_ACPI_VMGENID', if_true: files('vmgenid.c'))
acpi_ss.add(when: 'CONFIG_ACPI_HW_REDUCED', if_true: files('generic_event_device.c'))
acpi_ss.add(when: 'CONFIG_ACPI_HMAT', if_true: files('hmat.c'))
acpi_ss.add(when: 'CONFIG_ACPI_APEI', if_true: files('ghes.c'), if_false: files('ghes-stub.c'))
-acpi_ss.add(when: 'CONFIG_ACPI_X86', if_true: files('piix4.c', 'pcihp.c'))
+acpi_ss.add(when: 'CONFIG_ACPI_PIIX4', if_true: files('piix4.c'))
+acpi_ss.add(when: 'CONFIG_ACPI_PCIHP', if_true: files('pcihp.c'))
+acpi_ss.add(when: 'CONFIG_ACPI_PCIHP', if_false: files('acpi-pci-hotplug-stub.c'))
acpi_ss.add(when: 'CONFIG_ACPI_X86_ICH', if_true: files('ich9.c', 'tco.c'))
acpi_ss.add(when: 'CONFIG_IPMI', if_true: files('ipmi.c'), if_false: files('ipmi-stub.c'))
acpi_ss.add(when: 'CONFIG_PC', if_false: files('acpi-x86-stub.c'))
@@ -23,4 +27,6 @@ acpi_ss.add(when: 'CONFIG_TPM', if_true: files('tpm.c'))
softmmu_ss.add(when: 'CONFIG_ACPI', if_false: files('acpi-stub.c', 'aml-build-stub.c', 'ghes-stub.c'))
softmmu_ss.add_all(when: 'CONFIG_ACPI', if_true: acpi_ss)
softmmu_ss.add(when: 'CONFIG_ALL', if_true: files('acpi-stub.c', 'aml-build-stub.c',
- 'acpi-x86-stub.c', 'ipmi-stub.c', 'ghes-stub.c'))
+ 'acpi-x86-stub.c', 'ipmi-stub.c', 'ghes-stub.c',
+ 'acpi-mem-hotplug-stub.c', 'acpi-cpu-hotplug-stub.c',
+ 'acpi-pci-hotplug-stub.c', 'acpi-nvdimm-stub.c'))
--
MST
next prev parent reply other threads:[~2021-09-04 21:41 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-04 21:35 [PULL 00/35] pc,pci,virtio: fixes, cleanups Michael S. Tsirkin
2021-09-04 21:35 ` [PULL 01/35] vhost-vdpa: Do not send empty IOTLB update batches Michael S. Tsirkin
2021-09-04 21:35 ` [PULL 02/35] hw/virtio: Fix leak of host-notifier memory-region Michael S. Tsirkin
2021-09-04 21:36 ` [PULL 03/35] vhost: make SET_VRING_ADDR, SET_FEATURES send replies Michael S. Tsirkin
2021-09-04 21:36 ` [PULL 04/35] hw/acpi: define PIIX4 acpi pci hotplug property strings at a single place Michael S. Tsirkin
2021-09-04 21:36 ` [PULL 05/35] q35: catch invalid cpu hotplug configuration Michael S. Tsirkin
2021-09-04 21:36 ` Michael S. Tsirkin [this message]
2021-09-06 9:58 ` [PULL 06/35] hw/acpi: refactor acpi hp modules so that targets can just use what they need Philippe Mathieu-Daudé
2021-09-06 10:03 ` Ani Sinha
2021-09-06 10:24 ` Philippe Mathieu-Daudé
2021-09-06 10:49 ` Ani Sinha
2021-09-07 5:55 ` Ani Sinha
2021-09-07 6:13 ` Philippe Mathieu-Daudé
2021-09-07 6:34 ` Ani Sinha
2021-09-07 9:49 ` Ani Sinha
2022-07-19 16:12 ` Peter Maydell
2022-07-19 16:21 ` Peter Maydell
2022-07-20 18:37 ` Ani Sinha
2022-07-20 21:34 ` Peter Maydell
2022-07-20 22:13 ` Ani Sinha
2022-07-21 10:51 ` BB
2022-07-21 12:35 ` Dr. David Alan Gilbert
2022-07-25 17:57 ` Ani Sinha
2021-09-04 21:36 ` [PULL 07/35] hw/virtio: move vhost_set_backend_type() to vhost.c Michael S. Tsirkin
2021-09-04 21:36 ` [PULL 08/35] vhost-user: add missing space in error message Michael S. Tsirkin
2021-09-04 21:36 ` [PULL 09/35] acpi: Delete broken ACPI_GED_X86 macro Michael S. Tsirkin
2021-09-04 21:36 ` [PULL 10/35] Use PCI_HOST_BRIDGE macro Michael S. Tsirkin
2021-09-04 21:36 ` [PULL 11/35] virtio-balloon: don't start free page hinting if postcopy is possible Michael S. Tsirkin
2021-09-04 21:36 ` [PULL 12/35] virtio-balloon: free page hinting cleanups Michael S. Tsirkin
2021-09-04 21:36 ` [PULL 13/35] virtio-bus: introduce iommu_enabled() Michael S. Tsirkin
2021-09-04 21:36 ` [PULL 14/35] virtio-pci: implement iommu_enabled() Michael S. Tsirkin
2021-09-04 21:36 ` [PULL 15/35] vhost: correctly detect the enabling IOMMU Michael S. Tsirkin
2021-09-04 21:36 ` [PULL 16/35] hw/i386/acpi-build: Get NUMA information from struct NumaState Michael S. Tsirkin
2021-09-04 21:36 ` [PULL 17/35] hw/pci: remove all references to find_i440fx function Michael S. Tsirkin
2021-09-04 21:36 ` [PULL 18/35] hw/acpi: use existing references to pci device struct within functions Michael S. Tsirkin
2021-09-04 21:36 ` [PULL 19/35] MAINTAINERS: Added myself as a reviewer for acpi/smbios subsystem Michael S. Tsirkin
2021-09-04 21:36 ` [PULL 20/35] hw/virtio: Document virtio_queue_packed_empty_rcu is called within RCU Michael S. Tsirkin
2021-09-04 21:37 ` [PULL 21/35] hw/virtio: Remove NULL check in virtio_free_region_cache() Michael S. Tsirkin
2021-09-04 21:37 ` [PULL 22/35] hw/virtio: Add flatview update in vhost_user_cleanup() Michael S. Tsirkin
2021-09-04 21:37 ` [PULL 23/35] tests/vhost-user-bridge.c: Sanity check socket path length Michael S. Tsirkin
2021-09-04 21:37 ` [PULL 24/35] tests/vhost-user-bridge.c: Fix typo in help message Michael S. Tsirkin
2021-09-04 21:37 ` [PULL 25/35] vhost-vdpa: remove unused variable "acked_features" Michael S. Tsirkin
2021-09-04 21:37 ` [PULL 26/35] vhost-vdpa: correctly return err in vhost_vdpa_set_backend_cap() Michael S. Tsirkin
2021-09-04 21:37 ` [PULL 27/35] vhost_net: remove the meaningless assignment in vhost_net_start_one() Michael S. Tsirkin
2021-09-04 21:37 ` [PULL 28/35] vhost: use unsigned int for nvqs Michael S. Tsirkin
2021-09-04 21:37 ` [PULL 29/35] vhost_net: do not assume nvqs is always 2 Michael S. Tsirkin
2021-09-04 21:37 ` [PULL 30/35] vhost-vdpa: remove the unnecessary check in vhost_vdpa_add() Michael S. Tsirkin
2021-09-04 21:37 ` [PULL 31/35] vhost-vdpa: don't cleanup twice " Michael S. Tsirkin
2021-09-04 21:37 ` [PULL 32/35] vhost-vdpa: fix leaking of vhost_net " Michael S. Tsirkin
2021-09-04 21:37 ` [PULL 33/35] vhost-vdpa: tweak the error label " Michael S. Tsirkin
2021-09-04 21:37 ` [PULL 34/35] vhost-vdpa: fix the wrong assertion in vhost_vdpa_init() Michael S. Tsirkin
2021-09-04 21:37 ` [PULL 35/35] vhost-vdpa: remove the unncessary queue_index assignment Michael S. Tsirkin
2021-09-06 9:41 ` [PULL 00/35] pc,pci,virtio: fixes, cleanups Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210904213506.486886-7-mst@redhat.com \
--to=mst@redhat.com \
--cc=aleksandar.rikalo@syrmia.com \
--cc=ani@anisinha.ca \
--cc=aurelien@aurel32.net \
--cc=f4bug@amsat.org \
--cc=imammedo@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).