On 7/30/25 12:58, Duan, Zhenzhong wrote:


-----Original Message-----
From: Cédric Le Goater <c...@redhat.com>
Subject: Re: [PATCH v4 18/20] vfio: Add a new element bypass_ro in
VFIOContainerBase

On 7/29/25 11:20, Zhenzhong Duan wrote:
When bypass_ro is true, read only memory section is bypassed from
mapping in the container.

This is a preparing patch to workaround Intel ERRATA_772415.

Signed-off-by: Zhenzhong Duan <zhenzhong.d...@intel.com>
---
   include/hw/vfio/vfio-container-base.h |  1 +
   hw/vfio/listener.c                    | 13 +++++++++----
   2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/include/hw/vfio/vfio-container-base.h
b/include/hw/vfio/vfio-container-base.h
index bded6e993f..31fd784d76 100644
--- a/include/hw/vfio/vfio-container-base.h
+++ b/include/hw/vfio/vfio-container-base.h
@@ -51,6 +51,7 @@ typedef struct VFIOContainerBase {
       QLIST_HEAD(, VFIODevice) device_list;
       GList *iova_ranges;
       NotifierWithReturn cpr_reboot_notifier;
+    bool bypass_ro;
   } VFIOContainerBase;

   typedef struct VFIOGuestIOMMU {
diff --git a/hw/vfio/listener.c b/hw/vfio/listener.c
index f498e23a93..c64aa4539e 100644
--- a/hw/vfio/listener.c
+++ b/hw/vfio/listener.c
@@ -364,7 +364,8 @@ static bool
vfio_known_safe_misalignment(MemoryRegionSection *section)
       return true;
   }

-static bool vfio_listener_valid_section(MemoryRegionSection *section,
+static bool vfio_listener_valid_section(VFIOContainerBase *bcontainer,
+                                        MemoryRegionSection
*section,
                                           const char *name)

Instead of adding a 'VFIOContainerBase *' argument, I would add an
extra 'bool bypass_ro' argument.

Done, see 
https://github.com/yiliu1765/qemu/commit/b0be8bfc9a899334819f3f4f0704e47116944a53

I don't think the extra 'bool bypass_ro' are useful. A part from that,
looks good.


Thanks,

C.


Opportunistically, I also introduced another patch to bypass dirty tracking for 
readonly region, see 
https://github.com/yiliu1765/qemu/commit/a21ce0afd8aec5d5a9e6de46cf46757530cb7d9f



Reply via email to