diff mbox series

[1/2] vfio/common: Add trace point when a MMIO RAM section less than minimum size

Message ID 20210823115640.817-2-jiangkunkun@huawei.com
State New
Headers show
Series vfio/common: Some fixes about region_add/region_del | expand

Commit Message

Kunkun Jiang Aug. 23, 2021, 11:56 a.m. UTC
I recently did some tests about the 82599 NIC, and found a strange
scenario. The MSIX-Table size of this NIC is 0x30 and the offset
in Bar 3(64KB) is 0x0. And CPU page size is 64KB. The region_add()
will return early at 'int128_ge((int128_make64(iova), llend))' and
hasn't any message. Let's add a trace point to informed users.

Signed-off-by: Kunkun Jiang <jiangkunkun@huawei.com>
---
 hw/vfio/common.c | 7 +++++++
 1 file changed, 7 insertions(+)
diff mbox series

Patch

diff --git a/hw/vfio/common.c b/hw/vfio/common.c
index 7d80f43e39..bbb8d1ea0c 100644
--- a/hw/vfio/common.c
+++ b/hw/vfio/common.c
@@ -892,6 +892,13 @@  static void vfio_listener_region_add(MemoryListener *listener,
     llend = int128_and(llend, int128_exts64(qemu_real_host_page_mask));
 
     if (int128_ge(int128_make64(iova), llend)) {
+        if (memory_region_is_ram_device(section->mr)) {
+            trace_vfio_listener_region_add_no_dma_map(
+                memory_region_name(section->mr),
+                section->offset_within_address_space,
+                int128_getlo(section->size),
+                qemu_real_host_page_size);
+        }
         return;
     }
     end = int128_get64(int128_sub(llend, int128_one()));