@samitouri / QOSamiQemu / commits / 916acc2532

monitor: hmp_gva2gpa: Don't page-align cpu_get_phys_addr_debug() arg and return

In hmp_gva2gpa() we currently have a workaround for not all implementations of get_phys_addr_debug handling non-page-aligned addresses: we round the input address from the user down to the target page boundary before the call and then add the page offset back to the returned value. Now that we guarantee that all implementations will return the correct exact physaddr for a virtual address, we can drop this handling. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Acked-by: Dr. David Alan Gilbert <dave@treblig.org> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-id: 20260417173105.1648172-13-peter.maydell@linaro.org Message-ID: <20260430093810.2762539-14-peter.maydell@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Peter Maydell committed Apr 30, 2026 at 10:37 UTC 916acc253262cdf376c05478b65639f2ab5f8e2d
1 file changed +2 -3
monitor/hmp-cmds.c
+2 -3
@@ -771,12 +771,11 @@ void hmp_gva2gpa(Monitor *mon, const QDict *qdict)
771 return;
772 }
773
774 - gpa = cpu_get_phys_addr_debug(cs, addr & TARGET_PAGE_MASK);
774 + gpa = cpu_get_phys_addr_debug(cs, addr);
775 if (gpa == -1) {
776 monitor_printf(mon, "Unmapped\n");
777 } else {
778 - monitor_printf(mon, "gpa: 0x%" HWADDR_PRIx "\n",
779 - gpa + (addr & ~TARGET_PAGE_MASK));
778 + monitor_printf(mon, "gpa: 0x%" HWADDR_PRIx "\n", gpa);
779 }
780 }
781