* Re: [PATCH] i440FX-pcihost: add 'allow-hotplug' property for configuring whether to expose the BSEL to the guest.
2019-11-19 9:51 [PATCH] i440FX-pcihost: add 'allow-hotplug' property for configuring whether to expose the BSEL to the guest lichun
@ 2019-11-19 7:19 ` Igor Mammedov
0 siblings, 0 replies; 2+ messages in thread
From: Igor Mammedov @ 2019-11-19 7:19 UTC (permalink / raw)
To: lichun; +Cc: qemu-devel, mst
On Tue, 19 Nov 2019 17:51:20 +0800
lichun <706701795@qq.com> wrote:
...
here should go rationale why it's needed.
> Signed-off-by: lichun <706701795@qq.com>
> ---
> 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
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH] i440FX-pcihost: add 'allow-hotplug' property for configuring whether to expose the BSEL to the guest.
@ 2019-11-19 9:51 lichun
2019-11-19 7:19 ` Igor Mammedov
0 siblings, 1 reply; 2+ messages in thread
From: lichun @ 2019-11-19 9:51 UTC (permalink / raw)
To: qemu-devel; +Cc: imammedo, 706701795, mst
Signed-off-by: lichun <706701795@qq.com>
---
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-11-19 7:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-19 9:51 [PATCH] i440FX-pcihost: add 'allow-hotplug' property for configuring whether to expose the BSEL to the guest lichun
2019-11-19 7:19 ` Igor Mammedov
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).