Skip to contentSkip to conversation

memory: Constify IOMMUTLBEvent in memory_region_notify_iommu*()

PATCH In review Philippe Mathieu-Daudé 2 participants 6 messages Jun 12, 2024 – Jun 18, 2024

lore
Share & tools
lore
#0 lore raw

cover memory: Constify IOMMUTLBEvent in memory_region_notify_iommu*()

Trivial patches using const IOMMUTLBEvent.

Philippe Mathieu-Daudé (3):
memory: Constify IOMMUTLBEvent in memory_region_notify_iommu_one()
memory: Constify IOMMUTLBEvent in memory_region_notify_iommu() hw/i386/iommu: Constify IOMMUTLBEvent in vtd_page_walk_hook prototype

 include/exec/memory.h | 4 ++--
 hw/i386/intel_iommu.c | 8 ++++----
 system/memory.c       | 6 +++---
 3 files changed, 9 insertions(+), 9 deletions(-)
Signature · 1 line
2.41.0
#1 lore raw

PATCH 1/3 memory: Constify IOMMUTLBEvent in memory_region_notify_iommu_one()

@event access is read-only.

---
 include/exec/memory.h | 2 +-
 system/memory.c       | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
include/exec/memory.h +1 -1
index 1be58f694c..2bf5e23b6a 100644
@@ -1852,7 +1852,7 @@ void memory_region_notify_iommu(IOMMUMemoryRegion *iommu_mr,
  *         range.
  */
 void memory_region_notify_iommu_one(IOMMUNotifier *notifier,
-                                    IOMMUTLBEvent *event);
+                                    const IOMMUTLBEvent *event);
 
 /**
  * memory_region_unmap_iommu_notifier_range: notify a unmap for an IOMMU
system/memory.c +2 -2
index 74cd73ebc7..f3a37c97c1 100644
@@ -2006,9 +2006,9 @@ void memory_region_unregister_iommu_notifier(MemoryRegion *mr,
 }
 
 void memory_region_notify_iommu_one(IOMMUNotifier *notifier,
-                                    IOMMUTLBEvent *event)
+                                    const IOMMUTLBEvent *event)
 {
-    IOMMUTLBEntry *entry = &event->entry;
+    const IOMMUTLBEntry *entry = &event->entry;
     hwaddr entry_end = entry->iova + entry->addr_mask;
     IOMMUTLBEntry tmp = *entry;
 
Signature · 1 line
2.41.0
#2 lore raw

PATCH 2/3 memory: Constify IOMMUTLBEvent in memory_region_notify_iommu()

In reply to Philippe Mathieu-Daudé

@event access is read-only.

---
 include/exec/memory.h | 2 +-
 system/memory.c       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
include/exec/memory.h +1 -1
index 2bf5e23b6a..2d7c278b9f 100644
@@ -1837,7 +1837,7 @@ uint64_t memory_region_iommu_get_min_page_size(IOMMUMemoryRegion *iommu_mr);
  */
 void memory_region_notify_iommu(IOMMUMemoryRegion *iommu_mr,
                                 int iommu_idx,
-                                IOMMUTLBEvent event);
+                                const IOMMUTLBEvent event);
 
 /**
  * memory_region_notify_iommu_one: notify a change in an IOMMU translation
system/memory.c +1 -1
index f3a37c97c1..47c600df63 100644
@@ -2052,7 +2052,7 @@ void memory_region_unmap_iommu_notifier_range(IOMMUNotifier *notifier)
 
 void memory_region_notify_iommu(IOMMUMemoryRegion *iommu_mr,
                                 int iommu_idx,
-                                IOMMUTLBEvent event)
+                                const IOMMUTLBEvent event)
 {
     IOMMUNotifier *iommu_notifier;
 
Signature · 1 line
2.41.0
#3 lore raw

PATCH 3/3 hw/i386/iommu: Constify IOMMUTLBEvent in vtd_page_walk_hook prototype

In reply to Philippe Mathieu-Daudé

@event access is read-only.

---
 hw/i386/intel_iommu.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
hw/i386/intel_iommu.c +4 -4
index cc8e59674e..c4350e0ff0 100644
@@ -1170,7 +1170,7 @@ static int vtd_iova_to_slpte(IntelIOMMUState *s, VTDContextEntry *ce,
     }
 }
 
-typedef int (*vtd_page_walk_hook)(IOMMUTLBEvent *event, void *private);
+typedef int (*vtd_page_walk_hook)(const IOMMUTLBEvent *event, void *private);
 
 /**
  * Constant information used during page walking
@@ -1533,7 +1533,7 @@ static int vtd_dev_to_context_entry(IntelIOMMUState *s, uint8_t bus_num,
     return 0;
 }
 
-static int vtd_sync_shadow_page_hook(IOMMUTLBEvent *event,
+static int vtd_sync_shadow_page_hook(const IOMMUTLBEvent *event,
                                      void *private)
 {
     memory_region_notify_iommu(private, 0, *event);
@@ -2219,7 +2219,7 @@ static void vtd_iotlb_page_invalidate_notify(IntelIOMMUState *s,
                  * page tables.  We just deliver the PSI down to
                  * invalidate caches.
                  */
-                IOMMUTLBEvent event = {
+                const IOMMUTLBEvent event = {
                     .type = IOMMU_NOTIFIER_UNMAP,
                     .entry = {
                         .target_as = &address_space_memory,
@@ -3889,7 +3889,7 @@ static void vtd_address_space_refresh_all(IntelIOMMUState *s)
     vtd_switch_address_space_all(s);
 }
 
-static int vtd_replay_hook(IOMMUTLBEvent *event, void *private)
+static int vtd_replay_hook(const IOMMUTLBEvent *event, void *private)
 {
     memory_region_notify_iommu_one(private, event);
     return 0;
Signature · 1 line
2.41.0
Reviewed-by on the v1 series
#4 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 6 lines · Philippe Mathieu-Daudé

Trivial patches using const IOMMUTLBEvent.

Philippe Mathieu-Daudé (3):
memory: Constify IOMMUTLBEvent in memory_region_notify_iommu_one()
memory: Constify IOMMUTLBEvent in memory_region_notify_iommu() hw/i386/iommu: Constify IOMMUTLBEvent in vtd_page_walk_hook prototype

Signature · 1 line
Peter Xu
#5 lore raw
In reply to Philippe Mathieu-Daudé
Quoted 6 lines · Philippe Mathieu-Daudé

Trivial patches using const IOMMUTLBEvent.

Philippe Mathieu-Daudé (3):
memory: Constify IOMMUTLBEvent in memory_region_notify_iommu_one()
memory: Constify IOMMUTLBEvent in memory_region_notify_iommu() hw/i386/iommu: Constify IOMMUTLBEvent in vtd_page_walk_hook prototype

Series queued.