From patchwork Wed Jul 15 05:37:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tiejun Chen X-Patchwork-Id: 495417 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 04C1F140291 for ; Wed, 15 Jul 2015 15:48:38 +1000 (AEST) Received: from localhost ([::1]:33921 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZFFYa-00089q-9n for incoming@patchwork.ozlabs.org; Wed, 15 Jul 2015 01:48:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35018) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZFFTS-0007Tw-GX for qemu-devel@nongnu.org; Wed, 15 Jul 2015 01:43:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZFFTR-00057U-Is for qemu-devel@nongnu.org; Wed, 15 Jul 2015 01:43:18 -0400 Received: from mga11.intel.com ([192.55.52.93]:50366) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZFFTR-000531-EF for qemu-devel@nongnu.org; Wed, 15 Jul 2015 01:43:17 -0400 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP; 14 Jul 2015 22:43:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,477,1432623600"; d="scan'208";a="729142054" Received: from tchen0-linux.bj.intel.com ([10.238.135.75]) by orsmga001.jf.intel.com with ESMTP; 14 Jul 2015 22:43:15 -0700 From: Tiejun Chen To: stefano.stabellini@eu.citrix.com, mst@redhat.com, pbonzini@redhat.com, ehabkost@redhat.com, rth@twiddle.net Date: Wed, 15 Jul 2015 13:37:48 +0800 Message-Id: <1436938670-7677-9-git-send-email-tiejun.chen@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1436938670-7677-1-git-send-email-tiejun.chen@intel.com> References: <1436938670-7677-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.93 Cc: qemu-devel@nongnu.org Subject: [Qemu-devel] [v10][PATCH 08/10] xen, gfx passthrough: register a isa bridge 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 Currently we just register this isa bridge when we use IGD passthrough in Xen side. Signed-off-by: Tiejun Chen Acked-by: Stefano Stabellini --- v10: * Don't extern igd_passthrough_isa_bridge_create() in the include/hw/xen/xen.h file. Instead, move inside the include/hw/i386/pc.h file in patch #7 v9: * Move is_igd_vga_passthrough(dev)) from xen_igd_passthrough_isa_bridge_create() into xen_pt_initfn(). hw/xen/xen_pt.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/hw/xen/xen_pt.c b/hw/xen/xen_pt.c index 15b02cb..d67bccf 100644 --- a/hw/xen/xen_pt.c +++ b/hw/xen/xen_pt.c @@ -56,6 +56,7 @@ #include "hw/pci/pci.h" #include "hw/xen/xen.h" +#include "hw/i386/pc.h" #include "hw/xen/xen_backend.h" #include "xen_pt.h" #include "qemu/range.h" @@ -684,6 +685,17 @@ static const MemoryListener xen_pt_io_listener = { .priority = 10, }; +static void +xen_igd_passthrough_isa_bridge_create(XenPCIPassthroughState *s, + XenHostPCIDevice *dev) +{ + uint16_t gpu_dev_id; + PCIDevice *d = &s->dev; + + gpu_dev_id = dev->device_id; + igd_passthrough_isa_bridge_create(d->bus, gpu_dev_id); +} + /* init */ static int xen_pt_initfn(PCIDevice *d) @@ -728,11 +740,21 @@ static int xen_pt_initfn(PCIDevice *d) /* Setup VGA bios for passthrough GFX */ if ((s->real_device.domain == 0) && (s->real_device.bus == 0) && (s->real_device.dev == 2) && (s->real_device.func == 0)) { + if (!is_igd_vga_passthrough(&s->real_device)) { + XEN_PT_ERR(d, "Need to enable igd-passthru if you're trying" + " to passthrough IGD GFX.\n"); + xen_host_pci_device_put(&s->real_device); + return -1; + } + if (xen_pt_setup_vga(s, &s->real_device) < 0) { XEN_PT_ERR(d, "Setup VGA BIOS of passthrough GFX failed!\n"); xen_host_pci_device_put(&s->real_device); return -1; } + + /* Register ISA bridge for passthrough GFX. */ + xen_igd_passthrough_isa_bridge_create(s, &s->real_device); } /* Handle real device's MMIO/PIO BARs */