From 56a0cce196c4ab4e8ceb480c93c4401c4ea32c65 Mon Sep 17 00:00:00 2001 From: David Woodhouse Date: Tue, 17 Jan 2023 13:51:22 +0000 Subject: [PATCH] hw/xen: Automatically add xen-platform PCI device for emulated Xen guests 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 have 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 --- hw/i386/pc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/i386/pc.c b/hw/i386/pc.c index a12a7a67e9..5ec3518b9e 100644 --- a/hw/i386/pc.c +++ b/hw/i386/pc.c @@ -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 -- 2.50.1