qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alexey Kardashevskiy <aik@ozlabs.ru>
To: qemu-devel@nongnu.org
Cc: Alexey Kardashevskiy <aik@ozlabs.ru>,
	Alex Williamson <alex.williamson@redhat.com>,
	Auger Eric <eric.auger@redhat.com>
Subject: [Qemu-devel] [PATCH qemu] vfio: Print address space address when cannot map MMIO for DMA
Date: Thu, 22 Mar 2018 19:18:37 +1100	[thread overview]
Message-ID: <20180322081837.21460-1-aik@ozlabs.ru> (raw)

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=' (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 <aik@ozlabs.ru>
---

Message on slightly hacked QEMU (iommu pagesize=8K) looks now like this:

qemu-system-x86_64: Region "0000:00:1a.0 BAR 0 mmaps[0]" 0xfebc0000 size=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 = (1ULL << ctz64(hostwin->iova_pgsizes)) - 1;
 
         if ((iova & pgmask) || (int128_get64(llsize) & pgmask)) {
-            error_report("Region 0x%"HWADDR_PRIx"..0x%"HWADDR_PRIx
+            error_report("Region \"%s\" 0x%"HWADDR_PRIx" size=0x%"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;
-- 
2.11.0

             reply	other threads:[~2018-03-22  8:18 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-22  8:18 Alexey Kardashevskiy [this message]
2018-03-28 21:03 ` [Qemu-devel] [PATCH qemu] vfio: Print address space address when cannot map MMIO for DMA Auger Eric
2018-03-28 22:13   ` Alex Williamson
2018-03-29 14:42     ` Auger Eric
2018-03-29 16:03       ` Alex Williamson
2018-03-29  1:55   ` Alexey Kardashevskiy
2018-03-29 10:14     ` Auger Eric
2018-04-03  3:30       ` Alexey Kardashevskiy
2018-04-03  7:06         ` Auger Eric
2018-03-29 16:09     ` Alex Williamson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180322081837.21460-1-aik@ozlabs.ru \
    --to=aik@ozlabs.ru \
    --cc=alex.williamson@redhat.com \
    --cc=eric.auger@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).