[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 4/7] physmem: disallow direct access to RAM DEVICE in address_
From: |
David Hildenbrand |
Subject: |
[PATCH v2 4/7] physmem: disallow direct access to RAM DEVICE in address_space_write_rom() |
Date: |
Fri, 24 Jan 2025 16:45:29 +0100 |
As documented in commit 4a2e242bbb306 ("memory: Don't use memcpy for
ram_device regions"), we disallow direct access to RAM DEVICE regions.
This change implies that address_space_write_rom() and
cpu_memory_rw_debug() won't be able to write to RAM DEVICE regions. It
will also affect cpu_flush_icache_range(), but it's only used by
hw/core/loader.c after writing to ROM, so it is expected to not apply
here with RAM DEVICE.
This fixes direct access to these regions where we don't want direct
access. We'll extend cpu_memory_rw_debug() next to also be able to write to
these (and IO) regions.
This is a preparation for further changes.
Cc: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: David Hildenbrand <david@redhat.com>
---
system/physmem.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/system/physmem.c b/system/physmem.c
index c76503aea8..2d4f8110e8 100644
--- a/system/physmem.c
+++ b/system/physmem.c
@@ -3029,8 +3029,7 @@ static inline MemTxResult
address_space_write_rom_internal(AddressSpace *as,
l = len;
mr = address_space_translate(as, addr, &addr1, &l, true, attrs);
- if (!(memory_region_is_ram(mr) ||
- memory_region_is_romd(mr))) {
+ if (!memory_region_supports_direct_access(mr)) {
l = memory_access_size(mr, l, addr1);
} else {
/* ROM/RAM case */
--
2.47.1
- [PATCH v2 0/7] physmem: teach cpu_memory_rw_debug() to write to more memory regions, David Hildenbrand, 2025/01/24
- [PATCH v2 6/7] hmp: use cpu_get_phys_page_debug() in hmp_gva2gpa(), David Hildenbrand, 2025/01/24
- [PATCH v2 1/7] physmem: factor out memory_region_is_ram_device() check in memory_access_is_direct(), David Hildenbrand, 2025/01/24
- [PATCH v2 3/7] physmem: factor out direct access check into memory_region_supports_direct_access(), David Hildenbrand, 2025/01/24
- [PATCH v2 5/7] memory: pass MemTxAttrs to memory_access_is_direct(), David Hildenbrand, 2025/01/24
- [PATCH v2 4/7] physmem: disallow direct access to RAM DEVICE in address_space_write_rom(),
David Hildenbrand <=
- [PATCH v2 7/7] physmem: teach cpu_memory_rw_debug() to write to more memory regions, David Hildenbrand, 2025/01/24
- [PATCH v2 2/7] physmem: factor out RAM/ROMD check in memory_access_is_direct(), David Hildenbrand, 2025/01/24