physmem: Replace check for RAMBlock offset 0 with xen_mr_is_memory
authorEdgar E. Iglesias <edgar.iglesias@amd.com>
Fri, 3 May 2024 01:44:46 +0000 (03:44 +0200)
committerPhilippe Mathieu-Daudé <philmd@linaro.org>
Tue, 4 Jun 2024 09:53:41 +0000 (11:53 +0200)
For xen, when checking for the first RAM (xen_memory), use
xen_mr_is_memory() rather than checking for a RAMBlock with
offset 0.

All Xen machines create xen_memory first so this has no
functional change for existing machines.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@amd.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Reviewed-by: David Hildenbrand <david@redhat.com>
Message-ID: <20240529140739.1387692-6-edgar.iglesias@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
system/physmem.c

index 5e6257ef659b70f05fc7570d1ac78bcba4419c13..b7847db1a2c5e016b02db680d9daffdb4758d68a 100644 (file)
@@ -2229,7 +2229,7 @@ static void *qemu_ram_ptr_length(RAMBlock *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 (xen_mr_is_memory(block->mr)) {
             return xen_map_cache(block->mr, block->offset + addr,
                                  len, lock, lock,
                                  is_write);