]> xenbits.xensource.com Git - people/pauldu/qemu.git/commitdiff
hw/xen: Automatically add xen-platform PCI device for emulated Xen guests
authorDavid Woodhouse <dwmw@amazon.co.uk>
Tue, 17 Jan 2023 13:51:22 +0000 (13:51 +0000)
committerDavid Woodhouse <dwmw@amazon.co.uk>
Fri, 20 Jan 2023 12:28:52 +0000 (12:28 +0000)
It isn't strictly mandatory but Linux guests at least will only map their
grant tables over the dummy BAR that it provides, and don't sufficient wit
to map them in any other unused part of their guest address space. So
include it by default for minimal surprise factor.

As I come to document "how to run a Xen guest in QEMU", this means one
fewer thing to tell the user about, according to the mantra of "if it
needs documenting, fix it first, then document what remains".

Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
hw/i386/pc.c

index a12a7a67e9b2b17a42e93ed3410f0406a3cfc6af..5ec3518b9e11e340fb66c6e8ef6b674d0d645615 100644 (file)
@@ -1313,6 +1313,9 @@ void pc_basic_device_init(struct PCMachineState *pcms,
 #ifdef CONFIG_XEN_EMU
     if (xen_mode == XEN_EMULATE) {
         xen_evtchn_connect_gsis(gsi);
+        if (pcms->bus) {
+            pci_create_simple(pcms->bus, -1, "xen-platform");
+        }
     }
 #endif