From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56523) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xlv0i-00074E-7H for qemu-devel@nongnu.org; Wed, 05 Nov 2014 02:28:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Xlv0b-0006AN-Gk for qemu-devel@nongnu.org; Wed, 05 Nov 2014 02:28:08 -0500 Received: from mga11.intel.com ([192.55.52.93]:52706) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Xlv0b-00069y-Bj for qemu-devel@nongnu.org; Wed, 05 Nov 2014 02:28:01 -0500 From: Tiejun Chen Date: Wed, 5 Nov 2014 15:22:59 +0800 Message-Id: <1415172179-7965-2-git-send-email-tiejun.chen@intel.com> In-Reply-To: <1415172179-7965-1-git-send-email-tiejun.chen@intel.com> References: <1415172179-7965-1-git-send-email-tiejun.chen@intel.com> Subject: [Qemu-devel] [RFC][PATCH 2/2] xen:i386:pc_piix: create isa bridge specific to IGD passthrough List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: mst@redhat.com, pbonzini@redhat.com, rth@twiddle.net, aliguori@amazon.com Cc: xen-devel@lists.xensource.com, allen.m.kay@intel.com, qemu-devel@nongnu.org Currently IGD drivers always need to access PCH by 1f.0, and PCH vendor/device id is used to identify the card. Signed-off-by: Tiejun Chen --- hw/i386/pc_piix.c | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index b559181..b19c7a9 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -50,7 +50,7 @@ #include "cpu.h" #include "qemu/error-report.h" #ifdef CONFIG_XEN -# include +#include #endif #define MAX_IDE_BUS 2 @@ -452,6 +452,31 @@ static void pc_init_isa(MachineState *machine) } #ifdef CONFIG_XEN +static void xen_igd_passthrough_isa_bridge_create(PCIBus *bus) +{ + struct PCIDevice *dev; + Error *local_err = NULL; + uint16_t device_id = 0xffff; + + /* Currently IGD drivers always need to access PCH by 1f.0. */ + dev = pci_create_simple(bus, PCI_DEVFN(0x1f, 0), + "xen-igd-passthrough-isa-bridge"); + + /* Identify PCH card with its own real vendor/device ids. + * Here that vendor id is always PCI_VENDOR_ID_INTEL. + */ + if (dev) { + device_id = object_property_get_int(OBJECT(dev), "device-id", + &local_err); + if (!local_err && device_id != 0xffff) { + pci_config_set_device_id(dev->config, device_id); + return; + } + } + + fprintf(stderr, "xen set xen-igd-passthrough-isa-bridge failed\n"); +} + static void pc_xen_hvm_init(MachineState *machine) { PCIBus *bus; @@ -461,6 +486,7 @@ static void pc_xen_hvm_init(MachineState *machine) bus = pci_find_primary_bus(); if (bus != NULL) { pci_create_simple(bus, -1, "xen-platform"); + xen_igd_passthrough_isa_bridge_create(bus); } } #endif -- 1.9.1