i440FX-pcihost: add 'allow-hotplug' property for configuring whether to expose the BSEL to the guest.
PATCH 1/1 i440FX-pcihost: add 'allow-hotplug' property for configuring whether to expose the BSEL to the guest.
Signed-off-by lichun <[email protected]>
--- 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(-)
hw/acpi/pcihp.c +1 -1
@@ -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); }
hw/pci-host/i440fx.c +11 -0
@@ -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(), };
include/hw/pci-host/i440fx.h +1 -0
@@ -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
Signature · 1 line
1.8.3.1
On Tue, 19 Nov 2019 17:51:20 +0800
lichun <[email protected]> wrote:
...
here should go rationale why it's needed.
Quoted 67 lines
Signed-off-by lichun <[email protected]>--- 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(-)hw/acpi/pcihp.c +1
-1@@ -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); }hw/pci-host/i440fx.c +11
-0@@ -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(), };include/hw/pci-host/i440fx.h +1
-0@@ -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