On 9/29/25 11:32, Philippe Mathieu-Daudé wrote:
Factor address_space_memory_is_io() out of cpu_physical_memory_is_io()
passing the address space and range length as argument.

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
---
  include/system/memory.h | 10 ++++++++++
  system/physmem.c        | 21 ++++++++++++---------
  2 files changed, 22 insertions(+), 9 deletions(-)

diff --git a/include/system/memory.h b/include/system/memory.h
index aa85fc27a10..6cfa22d7a80 100644
--- a/include/system/memory.h
+++ b/include/system/memory.h
@@ -3029,6 +3029,16 @@ static inline MemoryRegion 
*address_space_translate(AddressSpace *as,
  bool address_space_access_valid(AddressSpace *as, hwaddr addr, hwaddr len,
                                  bool is_write, MemTxAttrs attrs);
+/**
+ * address_space_memory_is_io: check whether an address space range is
+ *                             I/O memory.
+ *
+ * @as: #AddressSpace to be accessed
+ * @addr: address within that address space
+ * @len: length of the area to be checked
+ */
+bool address_space_memory_is_io(AddressSpace *as, hwaddr addr, hwaddr len);

I don't think 'len' makes sense.
What are you doing if [addr, addr+len) crosses MemoryRegions?


+bool address_space_memory_is_io(AddressSpace *as, hwaddr addr, hwaddr len)
+{
+    MemoryRegion*mr;

Missing space.

+
+    RCU_READ_LOCK_GUARD();
+    mr = address_space_translate(as, addr, &addr, &len, false,
+                                 MEMTXATTRS_UNSPECIFIED);

Just pass NULL as the plen parameter.


r~

Reply via email to