From patchwork Fri Mar 4 08:41:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 8500301 Return-Path: X-Original-To: patchwork-qemu-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 20659C0553 for ; Fri, 4 Mar 2016 08:43:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8906B201F2 for ; Fri, 4 Mar 2016 08:43:32 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id DC0322014A for ; Fri, 4 Mar 2016 08:43:31 +0000 (UTC) Received: from localhost ([::1]:39651 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ablKd-0005mA-AI for patchwork-qemu-devel@patchwork.kernel.org; Fri, 04 Mar 2016 03:43:31 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52604) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ablJC-0003cN-G7 for qemu-devel@nongnu.org; Fri, 04 Mar 2016 03:42:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ablJ9-00051J-8s for qemu-devel@nongnu.org; Fri, 04 Mar 2016 03:42:02 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41515) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ablJ9-000516-4N for qemu-devel@nongnu.org; Fri, 04 Mar 2016 03:41:59 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id BD42772081 for ; Fri, 4 Mar 2016 08:41:58 +0000 (UTC) Received: from nilsson.home.kraxel.org (ovpn-116-34.ams2.redhat.com [10.36.116.34]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u248fvFe013724; Fri, 4 Mar 2016 03:41:58 -0500 Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id DBB67816A2; Fri, 4 Mar 2016 09:41:56 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Fri, 4 Mar 2016 09:41:53 +0100 Message-Id: <1457080913-30018-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Fri, 04 Mar 2016 08:41:58 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Cc: Alex Williamson , Gerd Hoffmann Subject: [Qemu-devel] [PATCH v2] vfio/igd: handle q35 machine type 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 Basically skip the lpc quirks with -M q35. Applies on top of the vfio-igd patch series by alex. Signed-off-by: Gerd Hoffmann --- hw/vfio/pci-quirks.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/hw/vfio/pci-quirks.c b/hw/vfio/pci-quirks.c index 5828362..1757e3d 100644 --- a/hw/vfio/pci-quirks.c +++ b/hw/vfio/pci-quirks.c @@ -12,6 +12,7 @@ #include "qemu/osdep.h" #include "hw/nvram/fw_cfg.h" +#include "hw/i386/ich9.h" #include "pci.h" #include "trace.h" #include "qemu/range.h" @@ -1410,6 +1411,7 @@ int vfio_pci_igd_lpc_init(VFIOPCIDevice *vdev, struct vfio_region_info *region) { DeviceClass *dc = DEVICE_GET_CLASS(vdev); + PCIBus *bus; PCIDevice *lpc_bridge; int ret; @@ -1423,6 +1425,19 @@ int vfio_pci_igd_lpc_init(VFIOPCIDevice *vdev, dc->hotpluggable = false; + bus = pci_device_root_bus(&vdev->pdev); + lpc_bridge = pci_find_device(bus, 0, PCI_DEVFN(0x1f, 0)); + if (lpc_bridge) { + const char *type = object_get_typename(OBJECT(lpc_bridge)); + if (strcmp(type, TYPE_ICH9_LPC_DEVICE) == 0) { + /* + * q35 lpc present, leave it as-is. + * linux kernel 4.5+ can deal with this. + */ + return 0; + } + } + lpc_bridge = pci_create_simple(pci_device_root_bus(&vdev->pdev), PCI_DEVFN(0x1f, 0), "vfio-pci-igd-lpc-bridge");