From nobody Sat Oct 25 21:46:14 2025 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.zohomail.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 (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1521706788485217.24752911305063; Thu, 22 Mar 2018 01:19:48 -0700 (PDT) Received: from localhost ([::1]:59393 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyvRk-00016L-F1 for importer@patchew.org; Thu, 22 Mar 2018 04:19:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43273) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyvQr-0000m2-8j for qemu-devel@nongnu.org; Thu, 22 Mar 2018 04:18:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eyvQo-00006Z-Kj for qemu-devel@nongnu.org; Thu, 22 Mar 2018 04:18:45 -0400 Received: from [107.173.13.209] (port=56465 helo=ozlabs.ru) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eyvQo-00006N-ED for qemu-devel@nongnu.org; Thu, 22 Mar 2018 04:18:42 -0400 Received: from vpl1.ozlabs.ibm.com (localhost [IPv6:::1]) by ozlabs.ru (Postfix) with ESMTP id 97429AE8000A; Thu, 22 Mar 2018 04:17:53 -0400 (EDT) From: Alexey Kardashevskiy To: qemu-devel@nongnu.org Date: Thu, 22 Mar 2018 19:18:37 +1100 Message-Id: <20180322081837.21460-1-aik@ozlabs.ru> X-Mailer: git-send-email 2.11.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 107.173.13.209 Subject: [Qemu-devel] [PATCH qemu] vfio: Print address space address when cannot map MMIO for DMA 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: Alexey Kardashevskiy , Auger Eric , Alex Williamson 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" The 567b5b309abe ("vfio/pci: Relax DMA map errors for MMIO regions") added an error message if a passed memory section address or size is not aligned to the minimal IOMMU page size. However although it checks offset_within_address_space for the alignment, offset_within_region is printed instead which makes it harder to find out what device caused the message so this replaces offset_within_region with offset_within_address_space. While we are here, this replaces '..' with 'size=3D' (as the second number is a size, not an end offset) and adds a memory region name. Fixes: 567b5b309abe "vfio/pci: Relax DMA map errors for MMIO regions" Signed-off-by: Alexey Kardashevskiy --- Message on slightly hacked QEMU (iommu pagesize=3D8K) looks now like this: qemu-system-x86_64: Region "0000:00:1a.0 BAR 0 mmaps[0]" 0xfebc0000 size=3D= 0x1000 is not aligned to 0x2000 and cannot be mapped for DMA --- hw/vfio/common.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/vfio/common.c b/hw/vfio/common.c index 5e84716..e2db596 100644 --- a/hw/vfio/common.c +++ b/hw/vfio/common.c @@ -548,10 +548,11 @@ static void vfio_listener_region_add(MemoryListener *= listener, hwaddr pgmask =3D (1ULL << ctz64(hostwin->iova_pgsizes)) - 1; =20 if ((iova & pgmask) || (int128_get64(llsize) & pgmask)) { - error_report("Region 0x%"HWADDR_PRIx"..0x%"HWADDR_PRIx + error_report("Region \"%s\" 0x%"HWADDR_PRIx" size=3D0x%"HWADDR= _PRIx " is not aligned to 0x%"HWADDR_PRIx " and cannot be mapped for DMA", - section->offset_within_region, + memory_region_name(section->mr), + section->offset_within_address_space, int128_getlo(section->size), pgmask + 1); return; --=20 2.11.0