From: Philippe Mathieu-Daudé Date: Tue, 11 Mar 2025 08:57:39 +0000 (+0100) Subject: hw/vfio/common: Get target page size using runtime helpers X-Git-Tag: v10.0.0-rc0~9^2~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=80ce7bb5cf0157fa835ecaabeaed90fc282830c9;p=thirdparty%2Fqemu.git hw/vfio/common: Get target page size using runtime helpers Prefer runtime helpers to get target page size. Reviewed-by: Richard Henderson Signed-off-by: Philippe Mathieu-Daudé Message-Id: <20250305153929.43687-3-philmd@linaro.org> Link: https://lore.kernel.org/qemu-devel/20250311085743.21724-5-philmd@linaro.org Signed-off-by: Cédric Le Goater --- diff --git a/hw/vfio/common.c b/hw/vfio/common.c index b1596b6bf6..1a0d9290f8 100644 --- a/hw/vfio/common.c +++ b/hw/vfio/common.c @@ -30,6 +30,7 @@ #include "exec/address-spaces.h" #include "exec/memory.h" #include "exec/ram_addr.h" +#include "exec/target_page.h" #include "hw/hw.h" #include "qemu/error-report.h" #include "qemu/main-loop.h" @@ -393,13 +394,14 @@ static void vfio_register_ram_discard_listener(VFIOContainerBase *bcontainer, MemoryRegionSection *section) { RamDiscardManager *rdm = memory_region_get_ram_discard_manager(section->mr); + int target_page_size = qemu_target_page_size(); VFIORamDiscardListener *vrdl; /* Ignore some corner cases not relevant in practice. */ - g_assert(QEMU_IS_ALIGNED(section->offset_within_region, TARGET_PAGE_SIZE)); + g_assert(QEMU_IS_ALIGNED(section->offset_within_region, target_page_size)); g_assert(QEMU_IS_ALIGNED(section->offset_within_address_space, - TARGET_PAGE_SIZE)); - g_assert(QEMU_IS_ALIGNED(int128_get64(section->size), TARGET_PAGE_SIZE)); + target_page_size)); + g_assert(QEMU_IS_ALIGNED(int128_get64(section->size), target_page_size)); vrdl = g_new0(VFIORamDiscardListener, 1); vrdl->bcontainer = bcontainer;