[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 13/43] hw/xen/hvm: Propagate page_mask to a pair of functions
From: |
Philippe Mathieu-Daudé |
Subject: |
[PULL 13/43] hw/xen/hvm: Propagate page_mask to a pair of functions |
Date: |
Sat, 9 Mar 2024 20:21:40 +0100 |
We are going to replace TARGET_PAGE_MASK by a
runtime variable. In order to reduce code duplication,
propagate TARGET_PAGE_MASK to get_physmapping() and
xen_phys_offset_to_gaddr().
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
Message-Id: <20231114163123.74888-3-philmd@linaro.org>
---
hw/i386/xen/xen-hvm.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c
index 8235782ef7..844b11ae08 100644
--- a/hw/i386/xen/xen-hvm.c
+++ b/hw/i386/xen/xen-hvm.c
@@ -174,11 +174,12 @@ static void xen_ram_init(PCMachineState *pcms,
}
}
-static XenPhysmap *get_physmapping(hwaddr start_addr, ram_addr_t size)
+static XenPhysmap *get_physmapping(hwaddr start_addr, ram_addr_t size,
+ int page_mask)
{
XenPhysmap *physmap = NULL;
- start_addr &= TARGET_PAGE_MASK;
+ start_addr &= page_mask;
QLIST_FOREACH(physmap, &xen_physmap, list) {
if (range_covers_byte(physmap->start_addr, physmap->size, start_addr))
{
@@ -188,9 +189,10 @@ static XenPhysmap *get_physmapping(hwaddr start_addr,
ram_addr_t size)
return NULL;
}
-static hwaddr xen_phys_offset_to_gaddr(hwaddr phys_offset, ram_addr_t size)
+static hwaddr xen_phys_offset_to_gaddr(hwaddr phys_offset, ram_addr_t size,
+ int page_mask)
{
- hwaddr addr = phys_offset & TARGET_PAGE_MASK;
+ hwaddr addr = phys_offset & page_mask;
XenPhysmap *physmap = NULL;
QLIST_FOREACH(physmap, &xen_physmap, list) {
@@ -252,7 +254,7 @@ static int xen_add_to_physmap(XenIOState *state,
hwaddr phys_offset = memory_region_get_ram_addr(mr);
const char *mr_name;
- if (get_physmapping(start_addr, size)) {
+ if (get_physmapping(start_addr, size, TARGET_PAGE_MASK)) {
return 0;
}
if (size <= 0) {
@@ -325,7 +327,7 @@ static int xen_remove_from_physmap(XenIOState *state,
XenPhysmap *physmap = NULL;
hwaddr phys_offset = 0;
- physmap = get_physmapping(start_addr, size);
+ physmap = get_physmapping(start_addr, size, TARGET_PAGE_MASK);
if (physmap == NULL) {
return -1;
}
@@ -373,7 +375,7 @@ static void xen_sync_dirty_bitmap(XenIOState *state,
int rc, i, j;
const XenPhysmap *physmap = NULL;
- physmap = get_physmapping(start_addr, size);
+ physmap = get_physmapping(start_addr, size, TARGET_PAGE_MASK);
if (physmap == NULL) {
/* not handled */
return;
@@ -633,7 +635,7 @@ void xen_hvm_modified_memory(ram_addr_t start, ram_addr_t
length)
int rc;
ram_addr_t start_pfn, nb_pages;
- start = xen_phys_offset_to_gaddr(start, length);
+ start = xen_phys_offset_to_gaddr(start, length, TARGET_PAGE_MASK);
if (length == 0) {
length = TARGET_PAGE_SIZE;
--
2.41.0
- [PULL 03/43] sysemu/xen-mapcache: Check Xen availability with CONFIG_XEN_IS_POSSIBLE, (continued)
- [PULL 03/43] sysemu/xen-mapcache: Check Xen availability with CONFIG_XEN_IS_POSSIBLE, Philippe Mathieu-Daudé, 2024/03/09
- [PULL 04/43] system/physmem: Do not include 'hw/xen/xen.h' but 'sysemu/xen.h', Philippe Mathieu-Daudé, 2024/03/09
- [PULL 05/43] hw/pci/msi: Restrict xen_is_pirq_msi() call to Xen, Philippe Mathieu-Daudé, 2024/03/09
- [PULL 06/43] hw/xen: Remove unnecessary xen_hvm_inject_msi() stub, Philippe Mathieu-Daudé, 2024/03/09
- [PULL 07/43] hw/xen: Rename 'ram_memory' global variable as 'xen_memory', Philippe Mathieu-Daudé, 2024/03/09
- [PULL 08/43] hw/xen: Use target-agnostic qemu_target_page_bits(), Philippe Mathieu-Daudé, 2024/03/09
- [PULL 09/43] hw/xen/xen_pt: Add missing license, Philippe Mathieu-Daudé, 2024/03/09
- [PULL 10/43] hw/xen: Extract 'xen_igd.h' from 'xen_pt.h', Philippe Mathieu-Daudé, 2024/03/09
- [PULL 11/43] hw/i386/xen: Compile 'xen-hvm.c' with Xen CPPFLAGS, Philippe Mathieu-Daudé, 2024/03/09
- [PULL 12/43] hw/xen/hvm: Inline TARGET_PAGE_ALIGN() macro, Philippe Mathieu-Daudé, 2024/03/09
- [PULL 13/43] hw/xen/hvm: Propagate page_mask to a pair of functions,
Philippe Mathieu-Daudé <=
- [PULL 14/43] hw/xen/hvm: Get target page size at runtime, Philippe Mathieu-Daudé, 2024/03/09
- [PULL 15/43] hw/char/xen_console: Fix missing ERRP_GUARD() for error_prepend(), Philippe Mathieu-Daudé, 2024/03/09
- [PULL 16/43] hw/net/xen_nic: Fix missing ERRP_GUARD() for error_prepend(), Philippe Mathieu-Daudé, 2024/03/09
- [PULL 17/43] hw/remote/remote-obj: hw/misc/ivshmem: Fix missing ERRP_GUARD() for error_prepend(), Philippe Mathieu-Daudé, 2024/03/09
- [PULL 19/43] hw/i386/pc: Remove pc_compat_1_4..1.7[] left over declarations, Philippe Mathieu-Daudé, 2024/03/09
- [PULL 18/43] target/i386/sev: Fix missing ERRP_GUARD() for error_prepend(), Philippe Mathieu-Daudé, 2024/03/09
- [PULL 20/43] hw/i386/pc: Use generated NotifyVmexitOption_str(), Philippe Mathieu-Daudé, 2024/03/09
- [PULL 21/43] hw/i386/pc: Remove 'host_type' argument from pc_init1(), Philippe Mathieu-Daudé, 2024/03/09
- [PULL 22/43] hw/i386/pc: Have pc_init_isa() pass a NULL pci_type argument, Philippe Mathieu-Daudé, 2024/03/09
- [PULL 23/43] hw/intc/apic: fix memory leak, Philippe Mathieu-Daudé, 2024/03/09