From patchwork Thu Aug 21 01:28:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tiejun Chen X-Patchwork-Id: 381841 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 8DB5B140114 for ; Thu, 21 Aug 2014 11:35:16 +1000 (EST) Received: from localhost ([::1]:58107 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XKHHW-0005BX-Px for incoming@patchwork.ozlabs.org; Wed, 20 Aug 2014 21:35:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50964) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XKHFq-0002nM-6X for qemu-devel@nongnu.org; Wed, 20 Aug 2014 21:33:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XKHFk-0001ef-2u for qemu-devel@nongnu.org; Wed, 20 Aug 2014 21:33:30 -0400 Received: from mga14.intel.com ([192.55.52.115]:7150) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XKHFj-0001d4-Uv for qemu-devel@nongnu.org; Wed, 20 Aug 2014 21:33:24 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga103.fm.intel.com with ESMTP; 20 Aug 2014 18:25:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.01,906,1400050800"; d="scan'208";a="579633315" Received: from tchen0-linux.bj.intel.com ([10.238.154.58]) by fmsmga001.fm.intel.com with ESMTP; 20 Aug 2014 18:31:47 -0700 From: Tiejun Chen To: mst@redhat.com Date: Thu, 21 Aug 2014 09:28:28 +0800 Message-Id: <1408584508-5946-3-git-send-email-tiejun.chen@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1408584508-5946-1-git-send-email-tiejun.chen@intel.com> References: <1408584508-5946-1-git-send-email-tiejun.chen@intel.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 192.55.52.115 Cc: xen-devel@lists.xensource.com, allen.m.kay@intel.com, qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH 2/2] xen:i386:pc_piix: create isa bridge specific to IGD passthrough X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Currenjly this ISA bridge should be fixed at 1f.0, and pass the real vendor/device ids as the driver expect. Signed-off-by: Tiejun Chen --- hw/i386/pc_piix.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 7710724..b131fa3 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -50,7 +50,8 @@ #include "cpu.h" #include "qemu/error-report.h" #ifdef CONFIG_XEN -# include +#include +#include #endif #define MAX_IDE_BUS 2 @@ -463,6 +464,26 @@ static void pc_xen_hvm_init(MachineState *machine) } } +static void xen_igd_passthrough_isa_bridge_create(PCIBus *bus) +{ + struct PCIDevice *dev; + XenHostPCIDevice hdev; + int r = 0; + + /* This shoudl be fixed at 1f.0 then pass vendor/device ids. + */ + dev = pci_create_simple(bus, PCI_DEVFN(0x1f, 0), + "xen-igd-passthrough-isa-bridge"); + if (dev) { + r = xen_host_pci_device_get(&hdev, 0, 0, PCI_DEVFN(0x1f, 0), 0); + if (!r) { + pci_config_set_vendor_id(dev->config, hdev.vendor_id); + pci_config_set_device_id(dev->config, hdev.device_id); + } else + fprintf(stderr, "xen set xen-igd-passthrough-isa-bridge failed\n"); + } +} + static void xen_igd_passthrough_pc_hvm_init(MachineState *machine) { PCIBus *bus; @@ -472,6 +493,7 @@ static void xen_igd_passthrough_pc_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