From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45686) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XEv6j-0004iQ-HI for qemu-devel@nongnu.org; Wed, 06 Aug 2014 02:54:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XEv6b-0007ma-Q0 for qemu-devel@nongnu.org; Wed, 06 Aug 2014 02:53:57 -0400 Received: from mga01.intel.com ([192.55.52.88]:48322) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XEv6b-0007m7-KX for qemu-devel@nongnu.org; Wed, 06 Aug 2014 02:53:49 -0400 From: Tiejun Chen Date: Wed, 6 Aug 2014 14:50:35 +0800 Message-Id: <1407307835-9692-6-git-send-email-tiejun.chen@intel.com> In-Reply-To: <1407307835-9692-1-git-send-email-tiejun.chen@intel.com> References: <1407307835-9692-1-git-send-email-tiejun.chen@intel.com> Subject: [Qemu-devel] [v4][PATCH 5/5] xen:hw:i386:pc_piix: introduce new machine for IGD passthrough List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: mst@redhat.com Cc: pbonzini@redhat.com, xen-devel@lists.xensource.com, qemu-devel@nongnu.org, stefano.stabellini@eu.citrix.com Now we can introduce a new machine, xenigd, specific to IGD passthrough. This can avoid involving other common codes. Signed-off-by: Tiejun Chen --- hw/i386/pc_piix.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) v4: * Rebase v3: * Rebase v2: * Unify prefix with XEN_IGD_PASSTHROUGH/xen_igd_passthrough like patch #3 diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 2bf8046..9d37f18 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -309,6 +309,15 @@ static void pc_init_pci(MachineState *machine) TYPE_I440FX_PCI_DEVICE); } + +#ifdef CONFIG_XEN +static void xen_igd_passthrough_pc_init_pci(MachineState *machine) +{ + pc_init1(machine, 1, 1, TYPE_I440FX_PCI_HOST_BRIDGE, + TYPE_XEN_IGD_PASSTHROUGH_I440FX_PCI_DEVICE); +} +#endif + static void pc_compat_2_0(MachineState *machine) { /* This value depends on the actual DSDT and SSDT compiled into @@ -457,6 +466,18 @@ static void pc_xen_hvm_init(MachineState *machine) pci_create_simple(bus, -1, "xen-platform"); } } + +static void xen_igd_passthrough_pc_hvm_init(MachineState *machine) +{ + PCIBus *bus; + + xen_igd_passthrough_pc_init_pci(machine); + + bus = pci_find_primary_bus(); + if (bus != NULL) { + pci_create_simple(bus, -1, "xen-platform"); + } +} #endif #define PC_I440FX_MACHINE_OPTIONS \ @@ -906,6 +927,27 @@ static QEMUMachine xenfv_machine = { { /* end of list */ } }, }; + +static QEMUMachine xenigd_machine = { + PC_COMMON_MACHINE_OPTIONS, + .name = "xenigd", + .desc = "Xen Fully-virtualized PC specific to IGD", + .init = xen_igd_passthrough_pc_hvm_init, + .max_cpus = HVM_MAX_VCPUS, + .default_machine_opts = "accel=xen", + .hot_add_cpu = pc_hot_add_cpu, + .compat_props = (GlobalProperty[]) { + /* xenfv has no fwcfg and so does not load acpi from QEMU. + * as such new acpi features don't work. + */ + { + .driver = "PIIX4_PM", + .property = "acpi-pci-hotplug-with-bridge-support", + .value = "off", + }, + { /* end of list */ } + }, +}; #endif static void pc_machine_init(void) @@ -929,6 +971,7 @@ static void pc_machine_init(void) qemu_register_pc_machine(&isapc_machine); #ifdef CONFIG_XEN qemu_register_pc_machine(&xenfv_machine); + qemu_register_pc_machine(&xenigd_machine); #endif } -- 1.9.1