From nobody Thu Apr 25 19:23:22 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 148676308528766.92668485457307; Fri, 10 Feb 2017 13:44:45 -0800 (PST) Received: from localhost ([::1]:46137 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ccIzi-0000EG-6z for importer@patchew.org; Fri, 10 Feb 2017 16:44:42 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46052) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ccIyE-0007qT-0S for qemu-devel@nongnu.org; Fri, 10 Feb 2017 16:43:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ccIyA-0002bU-Rv for qemu-devel@nongnu.org; Fri, 10 Feb 2017 16:43:10 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46158) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ccIyA-0002bO-MY for qemu-devel@nongnu.org; Fri, 10 Feb 2017 16:43:06 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C95DD61D17 for ; Fri, 10 Feb 2017 21:43:06 +0000 (UTC) Received: from gimli.home (ovpn-116-233.phx2.redhat.com [10.3.116.233]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1ALh6HK004183; Fri, 10 Feb 2017 16:43:06 -0500 From: Alex Williamson To: qemu-devel@nongnu.org Date: Fri, 10 Feb 2017 14:43:05 -0700 Message-ID: <20170210214255.22071.40864.stgit@gimli.home> In-Reply-To: <20170210214127.22071.16525.stgit@gimli.home> References: <20170210214127.22071.16525.stgit@gimli.home> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 10 Feb 2017 21:43:06 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 1/3] vfio-pci: Fix GTT wrap-around for Skylake+ IGD X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Previous IGD, up through Broadwell, only seem to write GTT values into the first 1MB of space allocated for the BDSM, but clearly the GTT can be multiple MB in size. Our test in vfio_igd_quirk_data_write() correctly filters out indexes beyond 1MB, but given the 1MB mask we're using, we re-apply writes only to the first 1MB of the guest allocated BDSM. We can't assume either the host or guest BDSM is naturally aligned, so we can't simply apply a different mask. Instead, save the host BDSM and do the arithmetic to subtract the host value to get the BDSM offset and add it to the guest allocated BDSM. Reported-by: Alexander Indenbaum Tested-by: Alexander Indenbaum Signed-off-by: Alex Williamson --- hw/vfio/pci-quirks.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hw/vfio/pci-quirks.c b/hw/vfio/pci-quirks.c index 6c771f778bd0..ec0feca376f6 100644 --- a/hw/vfio/pci-quirks.c +++ b/hw/vfio/pci-quirks.c @@ -1041,6 +1041,7 @@ static int igd_gen(VFIOPCIDevice *vdev) typedef struct VFIOIGDQuirk { struct VFIOPCIDevice *vdev; uint32_t index; + uint32_t bdsm; } VFIOIGDQuirk; =20 #define IGD_GMCH 0x50 /* Graphics Control Register */ @@ -1304,7 +1305,7 @@ static void vfio_igd_quirk_data_write(void *opaque, h= waddr addr, "BIOS reserved stolen memory. Unsupported BIOS?"= ); } =20 - val =3D base | (data & ((1 << 20) - 1)); + val =3D data - igd->bdsm + base; } else { val =3D 0; /* upper 32bits of pte, we only enable below 4G PTE= s */ } @@ -1503,6 +1504,8 @@ static void vfio_probe_igd_bar4_quirk(VFIOPCIDevice *= vdev, int nr) igd =3D quirk->data =3D g_malloc0(sizeof(*igd)); igd->vdev =3D vdev; igd->index =3D ~0; + igd->bdsm =3D vfio_pci_read_config(&vdev->pdev, IGD_BDSM, 4); + igd->bdsm &=3D ~((1 << 20) - 1); /* 1MB aligned */ =20 memory_region_init_io(&quirk->mem[0], OBJECT(vdev), &vfio_igd_index_qu= irk, igd, "vfio-igd-index-quirk", 4); From nobody Thu Apr 25 19:23:22 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486763261613516.9738296239775; Fri, 10 Feb 2017 13:47:41 -0800 (PST) Received: from localhost ([::1]:46154 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ccJ2a-0003Bk-8Q for importer@patchew.org; Fri, 10 Feb 2017 16:47:40 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46133) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ccIyY-00086r-Mq for qemu-devel@nongnu.org; Fri, 10 Feb 2017 16:43:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ccIyV-0002e6-JG for qemu-devel@nongnu.org; Fri, 10 Feb 2017 16:43:30 -0500 Received: from mx1.redhat.com ([209.132.183.28]:53236) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ccIyV-0002dz-DT for qemu-devel@nongnu.org; Fri, 10 Feb 2017 16:43:27 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 865C9C04BD21 for ; Fri, 10 Feb 2017 21:43:27 +0000 (UTC) Received: from gimli.home (ovpn-116-233.phx2.redhat.com [10.3.116.233]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1ALhR6N010385; Fri, 10 Feb 2017 16:43:27 -0500 From: Alex Williamson To: qemu-devel@nongnu.org Date: Fri, 10 Feb 2017 14:43:25 -0700 Message-ID: <20170210214310.22071.4158.stgit@gimli.home> In-Reply-To: <20170210214127.22071.16525.stgit@gimli.home> References: <20170210214127.22071.16525.stgit@gimli.home> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Fri, 10 Feb 2017 21:43:27 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 2/3] hw/vfio/pci-quirks: Set category of the "vfio-pci-igd-lpc-bridge" device X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 From: Thomas Huth The device has "bridge" in its name, so it should obviously be in the category DEVICE_CATEGORY_BRIDGE. Signed-off-by: Thomas Huth Signed-off-by: Alex Williamson --- hw/vfio/pci-quirks.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/vfio/pci-quirks.c b/hw/vfio/pci-quirks.c index ec0feca376f6..e9b493b939db 100644 --- a/hw/vfio/pci-quirks.c +++ b/hw/vfio/pci-quirks.c @@ -1186,6 +1186,7 @@ static void vfio_pci_igd_lpc_bridge_class_init(Object= Class *klass, void *data) DeviceClass *dc =3D DEVICE_CLASS(klass); PCIDeviceClass *k =3D PCI_DEVICE_CLASS(klass); =20 + set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories); dc->desc =3D "VFIO dummy ISA/LPC bridge for IGD assignment"; dc->hotpluggable =3D false; k->realize =3D vfio_pci_igd_lpc_bridge_realize; From nobody Thu Apr 25 19:23:22 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1486763121793546.9686429999504; Fri, 10 Feb 2017 13:45:21 -0800 (PST) Received: from localhost ([::1]:46140 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ccJ0K-0000jY-EA for importer@patchew.org; Fri, 10 Feb 2017 16:45:20 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46180) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ccIyq-0008Kv-M0 for qemu-devel@nongnu.org; Fri, 10 Feb 2017 16:43:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ccIyn-0002g8-IW for qemu-devel@nongnu.org; Fri, 10 Feb 2017 16:43:48 -0500 Received: from mx1.redhat.com ([209.132.183.28]:46938) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1ccIyn-0002g3-CE for qemu-devel@nongnu.org; Fri, 10 Feb 2017 16:43:45 -0500 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 65EE33DBD9 for ; Fri, 10 Feb 2017 21:43:45 +0000 (UTC) Received: from gimli.home (ovpn-116-233.phx2.redhat.com [10.3.116.233]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1ALhi0o026753; Fri, 10 Feb 2017 16:43:45 -0500 From: Alex Williamson To: qemu-devel@nongnu.org Date: Fri, 10 Feb 2017 14:43:43 -0700 Message-ID: <20170210214331.22071.65786.stgit@gimli.home> In-Reply-To: <20170210214127.22071.16525.stgit@gimli.home> References: <20170210214127.22071.16525.stgit@gimli.home> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Fri, 10 Feb 2017 21:43:45 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PULL 3/3] hw/vfio: Add CONFIG switches for calxeda-xgmac and amd-xgbe X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 From: Thomas Huth Both devices seem to be specific to the ARM platform. It's confusing for the users if they show up on other target architectures, too (e.g. when the user runs QEMU with "-device ?" to get a list of supported devices). Thus let's introduce proper configuration switches so that the devices are only compiled and included when they are really required. Signed-off-by: Thomas Huth Signed-off-by: Alex Williamson --- default-configs/arm-softmmu.mak | 2 ++ hw/vfio/Makefile.objs | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/default-configs/arm-softmmu.mak b/default-configs/arm-softmmu.= mak index 824fa71ba957..fdf40893aace 100644 --- a/default-configs/arm-softmmu.mak +++ b/default-configs/arm-softmmu.mak @@ -95,6 +95,8 @@ CONFIG_VERSATILE_PCI=3Dy CONFIG_VERSATILE_I2C=3Dy =20 CONFIG_PCI_GENERIC=3Dy +CONFIG_VFIO_XGMAC=3Dy +CONFIG_VFIO_AMD_XGBE=3Dy =20 CONFIG_SDHCI=3Dy CONFIG_INTEGRATOR_DEBUG=3Dy diff --git a/hw/vfio/Makefile.objs b/hw/vfio/Makefile.objs index c25e32b02999..05e7fbb93fd4 100644 --- a/hw/vfio/Makefile.objs +++ b/hw/vfio/Makefile.objs @@ -2,7 +2,7 @@ ifeq ($(CONFIG_LINUX), y) obj-$(CONFIG_SOFTMMU) +=3D common.o obj-$(CONFIG_PCI) +=3D pci.o pci-quirks.o obj-$(CONFIG_SOFTMMU) +=3D platform.o -obj-$(CONFIG_SOFTMMU) +=3D calxeda-xgmac.o -obj-$(CONFIG_SOFTMMU) +=3D amd-xgbe.o +obj-$(CONFIG_VFIO_XGMAC) +=3D calxeda-xgmac.o +obj-$(CONFIG_VFIO_AMD_XGBE) +=3D amd-xgbe.o obj-$(CONFIG_SOFTMMU) +=3D spapr.o endif