[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] i440FX-pcihost: add 'allow-hotplug' property for configuring whe
From: |
lichun |
Subject: |
[PATCH] i440FX-pcihost: add 'allow-hotplug' property for configuring whether to expose the BSEL to the guest. |
Date: |
Tue, 19 Nov 2019 17:51:20 +0800 |
Signed-off-by: lichun <address@hidden>
---
hw/acpi/pcihp.c | 2 +-
hw/pci-host/i440fx.c | 11 +++++++++++
include/hw/pci-host/i440fx.h | 1 +
3 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/hw/acpi/pcihp.c b/hw/acpi/pcihp.c
index 8413348..4f5e0d3 100644
--- a/hw/acpi/pcihp.c
+++ b/hw/acpi/pcihp.c
@@ -98,7 +98,7 @@ static void acpi_set_pci_info(void)
bsel_is_set = true;
bus = find_i440fx(); /* TODO: Q35 support */
- if (bus) {
+ if (bus && i440fx_allow_hotplug()) {
/* Scan all PCI buses. Set property to enable acpi based hotplug. */
pci_for_each_bus_depth_first(bus, acpi_set_bsel, NULL, &bsel_alloc);
}
diff --git a/hw/pci-host/i440fx.c b/hw/pci-host/i440fx.c
index f271311..32bf9bf 100644
--- a/hw/pci-host/i440fx.c
+++ b/hw/pci-host/i440fx.c
@@ -49,6 +49,7 @@ typedef struct I440FXState {
uint64_t pci_hole64_size;
bool pci_hole64_fix;
uint32_t short_root_bus;
+ bool allow_hotplug;
} I440FXState;
#define I440FX_PCI_DEVICE(obj) \
@@ -354,6 +355,15 @@ PCIBus *find_i440fx(void)
return s ? s->bus : NULL;
}
+bool i440fx_allow_hotplug(void)
+{
+ I440FXState *s;
+
+ s = I440FX_PCI_HOST_BRIDGE(object_resolve_path("/machine/i440fx", NULL));
+
+ return s ? s->allow_hotplug : true;
+}
+
static void i440fx_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
@@ -487,6 +497,7 @@ static Property i440fx_props[] = {
pci_hole64_size, I440FX_PCI_HOST_HOLE64_SIZE_DEFAULT),
DEFINE_PROP_UINT32("short_root_bus", I440FXState, short_root_bus, 0),
DEFINE_PROP_BOOL("x-pci-hole64-fix", I440FXState, pci_hole64_fix, true),
+ DEFINE_PROP_BOOL("allow-hotplug", I440FXState, allow_hotplug, true),
DEFINE_PROP_END_OF_LIST(),
};
diff --git a/include/hw/pci-host/i440fx.h b/include/hw/pci-host/i440fx.h
index f54e646..4a607e9 100644
--- a/include/hw/pci-host/i440fx.h
+++ b/include/hw/pci-host/i440fx.h
@@ -32,5 +32,6 @@ PCIBus *i440fx_init(const char *host_type, const char
*pci_type,
MemoryRegion *ram_memory);
PCIBus *find_i440fx(void);
+bool i440fx_allow_hotplug(void);
#endif
--
1.8.3.1
- [PATCH] i440FX-pcihost: add 'allow-hotplug' property for configuring whether to expose the BSEL to the guest.,
lichun <=