From: Tianrui Zhao Date: Mon, 27 Mar 2023 11:23:13 +0000 (+0800) Subject: hw/loongarch/virt: Fix virt_to_phys_addr function X-Git-Tag: qemu-xen-4.18.0-rc5~236^2~1 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=51d54503e8049512bdbe55d4f87caf97cd99ca23;p=qemu-xen.git hw/loongarch/virt: Fix virt_to_phys_addr function The virt addr should mask TARGET_PHYS_ADDR_SPACE_BITS to get the phys addr, and this is used by loading kernel elf. Signed-off-by: Tianrui Zhao Acked-by: Richard Henderson Message-Id: <20230327112313.3042829-1-zhaotianrui@loongson.cn> Signed-off-by: Song Gao --- diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c index b702c3f51e..f4bf14c1c8 100644 --- a/hw/loongarch/virt.c +++ b/hw/loongarch/virt.c @@ -399,7 +399,7 @@ static struct _loaderparams { static uint64_t cpu_loongarch_virt_to_phys(void *opaque, uint64_t addr) { - return addr & 0x1fffffffll; + return addr & MAKE_64BIT_MASK(0, TARGET_PHYS_ADDR_SPACE_BITS); } static int64_t load_kernel_info(void)