diff mbox series

[RFC,QEMU,14/18] softmmu: Add ram block check to map the xen ram memory

Message ID 20230312092244.451465-15-ray.huang@amd.com (mailing list archive)
State New, archived
Headers show
Series Add VirtIO GPU and Passthrough GPU support on Xen | expand

Commit Message

Huang Rui March 12, 2023, 9:22 a.m. UTC
The xen ram memory should be mapped with addr instead of ramblock
offset. So we need to add a check to make sure current ramblock is xen
ram memory.

Signed-off-by: Huang Rui <ray.huang@amd.com>
---
 softmmu/physmem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/softmmu/physmem.c b/softmmu/physmem.c
index 1b0bb35da9..e54561bace 100644
--- a/softmmu/physmem.c
+++ b/softmmu/physmem.c
@@ -2333,7 +2333,7 @@  static void *qemu_ram_ptr_length(RAMBlock *ram_block, ram_addr_t addr,
          * because we don't want to map the entire memory in QEMU.
          * In that case just map the requested area.
          */
-        if (block->offset == 0) {
+        if (block->offset == 0 || (!lock && xen_ram_block_check(block))) {
             return xen_map_cache(addr, *size, lock, lock);
         }