From nobody Thu Apr 25 09:21:51 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 1486645105045529.7073651910921; Thu, 9 Feb 2017 04:58:25 -0800 (PST) Received: from localhost ([::1]:37452 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cboIp-0006fa-UD for importer@patchew.org; Thu, 09 Feb 2017 07:58:23 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59203) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cboDz-0002c0-Fn for qemu-devel@nongnu.org; Thu, 09 Feb 2017 07:53:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cboDy-0007QS-GS for qemu-devel@nongnu.org; Thu, 09 Feb 2017 07:53:23 -0500 Received: from mx2.suse.de ([195.135.220.15]:54704) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cboDs-0007O0-74; Thu, 09 Feb 2017 07:53:16 -0500 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id D4471AD63; Thu, 9 Feb 2017 12:53:14 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de From: Alexander Graf To: qemu-devel@nongnu.org Date: Thu, 9 Feb 2017 13:53:27 +0100 Message-Id: <1486644810-33181-2-git-send-email-agraf@suse.de> X-Mailer: git-send-email 1.8.5.6 In-Reply-To: <1486644810-33181-1-git-send-email-agraf@suse.de> References: <1486644810-33181-1-git-send-email-agraf@suse.de> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy] X-Received-From: 195.135.220.15 Subject: [Qemu-devel] [PATCH v2 1/4] target-arm: Declare virtio-mmio as dma-coherent in dt 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: , Cc: Ard Biesheuvel , qemu-arm@nongnu.org, Laszlo Ersek , Shannon Zhao , mst@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" QEMU emulated hardware is always dma coherent with its guest. We do annotate that correctly on the PCI host controller, but left out virtio-mmio. Recent kernels have started to interpret that flag rather than take dma coherency as granted with virtio-mmio. While that is considered a kernel bug, as it breaks previously working systems, it showed that our dt description is incomplete. This patch adds the respective marker that allows guest OSs to evaluate that our virtio-mmio devices are indeed cache coherent. Signed-off-by: Alexander Graf Reviewed-by: Ard Biesheuvel Reviewed-by: Laszlo Ersek --- hw/arm/vexpress.c | 1 + hw/arm/virt.c | 1 + 2 files changed, 2 insertions(+) diff --git a/hw/arm/vexpress.c b/hw/arm/vexpress.c index 58760f4..e057568 100644 --- a/hw/arm/vexpress.c +++ b/hw/arm/vexpress.c @@ -452,6 +452,7 @@ static int add_virtio_mmio_node(void *fdt, uint32_t ace= lls, uint32_t scells, acells, addr, scells, size); qemu_fdt_setprop_cells(fdt, nodename, "interrupt-parent", intc); qemu_fdt_setprop_cells(fdt, nodename, "interrupts", 0, irq, 1); + qemu_fdt_setprop(fdt, nodename, "dma-coherent", NULL, 0); g_free(nodename); if (rc) { return -1; diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 1f216cf..14881fa 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -797,6 +797,7 @@ static void create_virtio_devices(const VirtMachineStat= e *vms, qemu_irq *pic) qemu_fdt_setprop_cells(vms->fdt, nodename, "interrupts", GIC_FDT_IRQ_TYPE_SPI, irq, GIC_FDT_IRQ_FLAGS_EDGE_LO_HI); + qemu_fdt_setprop(vms->fdt, nodename, "dma-coherent", NULL, 0); g_free(nodename); } } --=20 2.10.0 From nobody Thu Apr 25 09:21:51 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 1486644908252293.5679126675741; Thu, 9 Feb 2017 04:55:08 -0800 (PST) Received: from localhost ([::1]:37431 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cboFf-0003aX-1P for importer@patchew.org; Thu, 09 Feb 2017 07:55:07 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59188) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cboDy-0002be-Su for qemu-devel@nongnu.org; Thu, 09 Feb 2017 07:53:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cboDy-0007Q8-9d for qemu-devel@nongnu.org; Thu, 09 Feb 2017 07:53:22 -0500 Received: from mx2.suse.de ([195.135.220.15]:54706) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cboDs-0007O1-6h; Thu, 09 Feb 2017 07:53:16 -0500 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id E934BAD95; Thu, 9 Feb 2017 12:53:14 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de From: Alexander Graf To: qemu-devel@nongnu.org Date: Thu, 9 Feb 2017 13:53:28 +0100 Message-Id: <1486644810-33181-3-git-send-email-agraf@suse.de> X-Mailer: git-send-email 1.8.5.6 In-Reply-To: <1486644810-33181-1-git-send-email-agraf@suse.de> References: <1486644810-33181-1-git-send-email-agraf@suse.de> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy] X-Received-From: 195.135.220.15 Subject: [Qemu-devel] [PATCH v2 2/4] hw/arm/virt: Declare virtio-mmio as dma cache coherent in ACPI 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: , Cc: Ard Biesheuvel , qemu-arm@nongnu.org, Laszlo Ersek , Shannon Zhao , mst@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Virtio-mmio devices can directly access guest memory and do so in cache coherent fashion. Tell the guest about that fact when it's using ACPI. Signed-off-by: Alexander Graf Reviewed-by: Ard Biesheuvel Reviewed-by: Laszlo Ersek Reviewed-by: Shannon Zhao --- hw/arm/virt-acpi-build.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index 07a10ac..8955a9d 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -135,6 +135,7 @@ static void acpi_dsdt_add_virtio(Aml *scope, Aml *dev =3D aml_device("VR%02u", i); aml_append(dev, aml_name_decl("_HID", aml_string("LNRO0005"))); aml_append(dev, aml_name_decl("_UID", aml_int(i))); + aml_append(dev, aml_name_decl("_CCA", aml_int(1))); =20 Aml *crs =3D aml_resource_template(); aml_append(crs, aml_memory32_fixed(base, size, AML_READ_WRITE)); --=20 2.10.0 From nobody Thu Apr 25 09:21:51 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 148664492356676.34631231308515; Thu, 9 Feb 2017 04:55:23 -0800 (PST) Received: from localhost ([::1]:37432 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cboFu-0003mx-8E for importer@patchew.org; Thu, 09 Feb 2017 07:55:22 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59194) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cboDz-0002bg-4t for qemu-devel@nongnu.org; Thu, 09 Feb 2017 07:53:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cboDy-0007QN-Cv for qemu-devel@nongnu.org; Thu, 09 Feb 2017 07:53:23 -0500 Received: from mx2.suse.de ([195.135.220.15]:54710) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cboDs-0007O2-6v; Thu, 09 Feb 2017 07:53:16 -0500 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 05948ADA7; Thu, 9 Feb 2017 12:53:15 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de From: Alexander Graf To: qemu-devel@nongnu.org Date: Thu, 9 Feb 2017 13:53:29 +0100 Message-Id: <1486644810-33181-4-git-send-email-agraf@suse.de> X-Mailer: git-send-email 1.8.5.6 In-Reply-To: <1486644810-33181-1-git-send-email-agraf@suse.de> References: <1486644810-33181-1-git-send-email-agraf@suse.de> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy] X-Received-From: 195.135.220.15 Subject: [Qemu-devel] [PATCH v2 3/4] hw/arm/virt: Declare fwcfg as dma cache coherent in ACPI 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: , Cc: Ard Biesheuvel , qemu-arm@nongnu.org, Laszlo Ersek , Shannon Zhao , mst@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Fw-cfg recently learned how to directly access guest memory and does so in cache coherent fashion. Tell the guest about that fact when it's using ACPI. Signed-off-by: Alexander Graf Reviewed-by: Ard Biesheuvel Reviewed-by: Laszlo Ersek Reviewed-by: Shannon Zhao --- hw/arm/virt-acpi-build.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index 8955a9d..0835e59 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -90,6 +90,7 @@ static void acpi_dsdt_add_fw_cfg(Aml *scope, const MemMap= Entry *fw_cfg_memmap) aml_append(dev, aml_name_decl("_HID", aml_string("QEMU0002"))); /* device present, functioning, decoding, not shown in UI */ aml_append(dev, aml_name_decl("_STA", aml_int(0xB))); + aml_append(dev, aml_name_decl("_CCA", aml_int(1))); =20 Aml *crs =3D aml_resource_template(); aml_append(crs, aml_memory32_fixed(fw_cfg_memmap->base, --=20 2.10.0 From nobody Thu Apr 25 09:21:51 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 1486645093603734.0721730354851; Thu, 9 Feb 2017 04:58:13 -0800 (PST) Received: from localhost ([::1]:37451 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cboIe-0006Xc-Fy for importer@patchew.org; Thu, 09 Feb 2017 07:58:12 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59190) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cboDy-0002bf-TX for qemu-devel@nongnu.org; Thu, 09 Feb 2017 07:53:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cboDy-0007QD-Ah for qemu-devel@nongnu.org; Thu, 09 Feb 2017 07:53:23 -0500 Received: from mx2.suse.de ([195.135.220.15]:54717) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cboDs-0007O3-6y; Thu, 09 Feb 2017 07:53:16 -0500 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 0B92EADB2; Thu, 9 Feb 2017 12:53:15 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de From: Alexander Graf To: qemu-devel@nongnu.org Date: Thu, 9 Feb 2017 13:53:30 +0100 Message-Id: <1486644810-33181-5-git-send-email-agraf@suse.de> X-Mailer: git-send-email 1.8.5.6 In-Reply-To: <1486644810-33181-1-git-send-email-agraf@suse.de> References: <1486644810-33181-1-git-send-email-agraf@suse.de> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy] X-Received-From: 195.135.220.15 Subject: [Qemu-devel] [PATCH v2 4/4] hw/arm/virt: Declare fwcfg as dma cache coherent in dt 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: , Cc: Ard Biesheuvel , qemu-arm@nongnu.org, Laszlo Ersek , Shannon Zhao , mst@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Fw-cfg recently learned how to directly access guest memory and does so in cache coherent fashion. Tell the guest about that fact when it's using DT. Signed-off-by: Alexander Graf Reviewed-by: Ard Biesheuvel Reviewed-by: Laszlo Ersek --- hw/arm/virt.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 14881fa..da9622f 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -929,6 +929,7 @@ static FWCfgState *create_fw_cfg(const VirtMachineState= *vms, AddressSpace *as) "compatible", "qemu,fw-cfg-mmio"); qemu_fdt_setprop_sized_cells(vms->fdt, nodename, "reg", 2, base, 2, size); + qemu_fdt_setprop(vms->fdt, nodename, "dma-coherent", NULL, 0); g_free(nodename); return fw_cfg; } --=20 2.10.0