From patchwork Tue Jul 7 05:33:09 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tiejun Chen X-Patchwork-Id: 492056 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 807F7140291 for ; Tue, 7 Jul 2015 15:42:29 +1000 (AEST) Received: from localhost ([::1]:54109 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZCLeF-00067c-M9 for incoming@patchwork.ozlabs.org; Tue, 07 Jul 2015 01:42:27 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34875) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZCLaE-0000JV-Ha for qemu-devel@nongnu.org; Tue, 07 Jul 2015 01:38:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZCLaD-0002KZ-LD for qemu-devel@nongnu.org; Tue, 07 Jul 2015 01:38:18 -0400 Received: from mga02.intel.com ([134.134.136.20]:60642) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZCLaD-0002Hz-G0 for qemu-devel@nongnu.org; Tue, 07 Jul 2015 01:38:17 -0400 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga101.jf.intel.com with ESMTP; 06 Jul 2015 22:38:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.15,420,1432623600"; d="scan'208";a="741933969" Received: from tchen0-linux.bj.intel.com ([10.238.135.75]) by fmsmga001.fm.intel.com with ESMTP; 06 Jul 2015 22:38:15 -0700 From: Tiejun Chen To: stefano.stabellini@eu.citrix.com, mst@redhat.com, pbonzini@redhat.com, ehabkost@redhat.com, rth@twiddle.net Date: Tue, 7 Jul 2015 13:33:09 +0800 Message-Id: <1436247191-13577-9-git-send-email-tiejun.chen@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1436247191-13577-1-git-send-email-tiejun.chen@intel.com> References: <1436247191-13577-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: 134.134.136.20 Cc: qemu-devel@nongnu.org Subject: [Qemu-devel] [v9][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 --- v9: * Move is_igd_vga_passthrough(dev)) from xen_igd_passthrough_isa_bridge_create() into xen_pt_initfn(). hw/xen/xen_pt.c | 21 +++++++++++++++++++++ include/hw/xen/xen.h | 1 + 2 files changed, 22 insertions(+) diff --git a/hw/xen/xen_pt.c b/hw/xen/xen_pt.c index 15b02cb..f764131 100644 --- a/hw/xen/xen_pt.c +++ b/hw/xen/xen_pt.c @@ -684,6 +684,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 +739,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 */ diff --git a/include/hw/xen/xen.h b/include/hw/xen/xen.h index 4356af4..703148e 100644 --- a/include/hw/xen/xen.h +++ b/include/hw/xen/xen.h @@ -51,4 +51,5 @@ void xen_register_framebuffer(struct MemoryRegion *mr); # define HVM_MAX_VCPUS 32 #endif +extern void igd_passthrough_isa_bridge_create(PCIBus *bus, uint16_t gpu_dev_id); #endif /* QEMU_HW_XEN_H */