From patchwork Tue Jan 5 11:41:38 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 7954181 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 23C08BEEE5 for ; Tue, 5 Jan 2016 11:44:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4204320160 for ; Tue, 5 Jan 2016 11:44:47 +0000 (UTC) Received: from lists.xen.org (lists.xenproject.org [50.57.142.19]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 665B620145 for ; Tue, 5 Jan 2016 11:44:46 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aGQ0B-0004iv-2S; Tue, 05 Jan 2016 11:42:11 +0000 Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aGQ06-0004fc-Ds for xen-devel@lists.xensource.com; Tue, 05 Jan 2016 11:42:06 +0000 Received: from [85.158.143.35] by server-3.bemta-4.messagelabs.com id A7/47-31122-E0CAB865; Tue, 05 Jan 2016 11:42:06 +0000 X-Env-Sender: kraxel@redhat.com X-Msg-Ref: server-10.tower-21.messagelabs.com!1451994122!8468634!1 X-Originating-IP: [209.132.183.28] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMjA5LjEzMi4xODMuMjggPT4gNTQwNjQ=\n X-StarScan-Received: X-StarScan-Version: 7.35.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 30479 invoked from network); 5 Jan 2016 11:42:03 -0000 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by server-10.tower-21.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 5 Jan 2016 11:42:03 -0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id C1AE019CB95; Tue, 5 Jan 2016 11:42:01 +0000 (UTC) Received: from nilsson.home.kraxel.org (ovpn-116-22.ams2.redhat.com [10.36.116.22]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u05Bg0fD009573; Tue, 5 Jan 2016 06:42:00 -0500 Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id EC49B80DE7; Tue, 5 Jan 2016 12:41:57 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Tue, 5 Jan 2016 12:41:38 +0100 Message-Id: <1451994098-6972-12-git-send-email-kraxel@redhat.com> In-Reply-To: <1451994098-6972-1-git-send-email-kraxel@redhat.com> References: <1451994098-6972-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 Cc: igvt-g@ml01.01.org, xen-devel@lists.xensource.com, Eduardo Habkost , Stefano Stabellini , "Michael S. Tsirkin" , Cao jin , vfio-users@redhat.com, Paolo Bonzini , Richard Henderson , Gerd Hoffmann Subject: [Xen-devel] [PATCH v3 11/11] igd: move igd-passthrough-isa-bridge creation to machine init X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch moves igd-passthrough-isa-bridge creation out of the xen passthrough code into machine init. It is triggered by the igd-passthru=on machine option. Advantages: * This works for on both xen and kvm. * It is activated for the pc machine type only, q35 has a real isa bridge on 1f.0 and must be handled differently. The q35 plan is https://lkml.org/lkml/2015/11/26/183 (should land in the next merge window, i.e. linux 4.5). * If we don't need it any more some day (intel is busy removing chipset dependencies from the guest driver) we have a single machine switch to just turn off all igd passthru chipset tweaks. Signed-off-by: Gerd Hoffmann --- hw/i386/pc_piix.c | 6 ++++++ hw/xen/xen_pt.c | 14 -------------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index f36222e..2afbbd3 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -281,6 +281,12 @@ static void pc_init1(MachineState *machine, if (pcmc->pci_enabled) { pc_pci_device_init(pci_bus); } + +#ifdef CONFIG_LINUX + if (machine->igd_gfx_passthru) { + igd_passthrough_isa_bridge_create(pci_bus); + } +#endif } /* Looking for a pc_compat_2_4() function? It doesn't exist. diff --git a/hw/xen/xen_pt.c b/hw/xen/xen_pt.c index 18a7f72..5f626c9 100644 --- a/hw/xen/xen_pt.c +++ b/hw/xen/xen_pt.c @@ -685,17 +685,6 @@ 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); -} - /* destroy. */ static void xen_pt_destroy(PCIDevice *d) { @@ -810,9 +799,6 @@ static int xen_pt_initfn(PCIDevice *d) 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 */