Blame SOURCES/kvm-vfio-common-remove-spurious-warning-on-vfio_listener.patch

586cba
From 3de8fb9f3dba18d04efa10b70bcec641035effc5 Mon Sep 17 00:00:00 2001
586cba
From: Eric Auger <eric.auger@redhat.com>
586cba
Date: Tue, 24 May 2022 05:14:05 -0400
586cba
Subject: [PATCH 16/16] vfio/common: remove spurious warning on
586cba
 vfio_listener_region_del
586cba
586cba
RH-Author: Eric Auger <eric.auger@redhat.com>
586cba
RH-MergeRequest: 101: vfio/common: remove spurious warning on vfio_listener_region_del
586cba
RH-Commit: [1/1] dac688b8a981ebb964fea79ea198c329b9cdb551 (eauger1/centos-qemu-kvm)
586cba
RH-Bugzilla: 2086262
586cba
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
586cba
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
586cba
RH-Acked-by: Alex Williamson <None>
586cba
586cba
    Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2086262
586cba
    Brew: https://brewweb.engineering.redhat.com/brew/taskinfo?taskID=45876133
586cba
    Upstream Status: YES
586cba
    Tested: With TPM-CRB and VFIO
586cba
586cba
851d6d1a0f ("vfio/common: remove spurious tpm-crb-cmd misalignment
586cba
warning") removed the warning on vfio_listener_region_add() path.
586cba
586cba
However the same warning also hits on region_del path. Let's remove
586cba
it and reword the dynamic trace as this can be called on both
586cba
map and unmap path.
586cba
586cba
Contextual Conflict in hw/vfio/common.c
586cba
We don't have 8e3b0cbb721 ("Replace qemu_real_host_page variables with inlined functions")
586cba
586cba
Signed-off-by: Eric Auger <eric.auger@redhat.com>
586cba
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
586cba
Link: https://lore.kernel.org/r/20220524091405.416256-1-eric.auger@redhat.com
586cba
Fixes: 851d6d1a0ff2 ("vfio/common: remove spurious tpm-crb-cmd misalignment warning")
586cba
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
586cba
(cherry picked from commit ec6600be0dc16982181c7ad80d94c143c0807dd2)
586cba
Signed-off-by: Eric Auger <eric.auger@redhat.com>
586cba
---
586cba
 hw/vfio/common.c     | 10 +++++++++-
586cba
 hw/vfio/trace-events |  2 +-
586cba
 2 files changed, 10 insertions(+), 2 deletions(-)
586cba
586cba
diff --git a/hw/vfio/common.c b/hw/vfio/common.c
586cba
index 0fbe0d47af..637981f9a1 100644
586cba
--- a/hw/vfio/common.c
586cba
+++ b/hw/vfio/common.c
586cba
@@ -1145,7 +1145,15 @@ static void vfio_listener_region_del(MemoryListener *listener,
586cba
     if (unlikely((section->offset_within_address_space &
586cba
                   ~qemu_real_host_page_mask) !=
586cba
                  (section->offset_within_region & ~qemu_real_host_page_mask))) {
586cba
-        error_report("%s received unaligned region", __func__);
586cba
+        if (!vfio_known_safe_misalignment(section)) {
586cba
+            error_report("%s received unaligned region %s iova=0x%"PRIx64
586cba
+                         " offset_within_region=0x%"PRIx64
586cba
+                         " qemu_real_host_page_size=0x%"PRIxPTR,
586cba
+                         __func__, memory_region_name(section->mr),
586cba
+                         section->offset_within_address_space,
586cba
+                         section->offset_within_region,
586cba
+                         qemu_real_host_page_size);
586cba
+        }
586cba
         return;
586cba
     }
586cba
 
586cba
diff --git a/hw/vfio/trace-events b/hw/vfio/trace-events
586cba
index 582882db91..73dffe9e00 100644
586cba
--- a/hw/vfio/trace-events
586cba
+++ b/hw/vfio/trace-events
586cba
@@ -100,7 +100,7 @@ vfio_listener_region_add_skip(uint64_t start, uint64_t end) "SKIPPING region_add
586cba
 vfio_spapr_group_attach(int groupfd, int tablefd) "Attached groupfd %d to liobn fd %d"
586cba
 vfio_listener_region_add_iommu(uint64_t start, uint64_t end) "region_add [iommu] 0x%"PRIx64" - 0x%"PRIx64
586cba
 vfio_listener_region_add_ram(uint64_t iova_start, uint64_t iova_end, void *vaddr) "region_add [ram] 0x%"PRIx64" - 0x%"PRIx64" [%p]"
586cba
-vfio_known_safe_misalignment(const char *name, uint64_t iova, uint64_t offset_within_region, uintptr_t page_size) "Region \"%s\" iova=0x%"PRIx64" offset_within_region=0x%"PRIx64" qemu_real_host_page_size=0x%"PRIxPTR ": cannot be mapped for DMA"
586cba
+vfio_known_safe_misalignment(const char *name, uint64_t iova, uint64_t offset_within_region, uintptr_t page_size) "Region \"%s\" iova=0x%"PRIx64" offset_within_region=0x%"PRIx64" qemu_real_host_page_size=0x%"PRIxPTR
586cba
 vfio_listener_region_add_no_dma_map(const char *name, uint64_t iova, uint64_t size, uint64_t page_size) "Region \"%s\" 0x%"PRIx64" size=0x%"PRIx64" is not aligned to 0x%"PRIx64" and cannot be mapped for DMA"
586cba
 vfio_listener_region_del_skip(uint64_t start, uint64_t end) "SKIPPING region_del 0x%"PRIx64" - 0x%"PRIx64
586cba
 vfio_listener_region_del(uint64_t start, uint64_t end) "region_del 0x%"PRIx64" - 0x%"PRIx64
586cba
-- 
586cba
2.31.1
586cba