qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: lichun <706701795@qq.com>
To: qemu-devel@nongnu.org
Cc: imammedo@redhat.com, 706701795@qq.com, mst@redhat.com
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	[thread overview]
Message-ID: <1574157080-7724-1-git-send-email-706701795@qq.com> (raw)

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



             reply	other threads:[~2019-11-19  2:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-19  9:51 lichun [this message]
2019-11-19  7:19 ` [PATCH] i440FX-pcihost: add 'allow-hotplug' property for configuring whether to expose the BSEL to the guest Igor Mammedov

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=1574157080-7724-1-git-send-email-706701795@qq.com \
    --to=706701795@qq.com \
    --cc=imammedo@redhat.com \
    --cc=mst@redhat.com \
    --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).