hw/vfio/common: Get target page size using runtime helpers

Prefer runtime helpers to get target page size.

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
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 <clg@redhat.com>
This commit is contained in:
Philippe Mathieu-Daudé 2025-03-11 09:57:39 +01:00 committed by Cédric Le Goater
parent 514c296787
commit 80ce7bb5cf

View File

@ -30,6 +30,7 @@
#include "exec/address-spaces.h" #include "exec/address-spaces.h"
#include "exec/memory.h" #include "exec/memory.h"
#include "exec/ram_addr.h" #include "exec/ram_addr.h"
#include "exec/target_page.h"
#include "hw/hw.h" #include "hw/hw.h"
#include "qemu/error-report.h" #include "qemu/error-report.h"
#include "qemu/main-loop.h" #include "qemu/main-loop.h"
@ -393,13 +394,14 @@ static void vfio_register_ram_discard_listener(VFIOContainerBase *bcontainer,
MemoryRegionSection *section) MemoryRegionSection *section)
{ {
RamDiscardManager *rdm = memory_region_get_ram_discard_manager(section->mr); RamDiscardManager *rdm = memory_region_get_ram_discard_manager(section->mr);
int target_page_size = qemu_target_page_size();
VFIORamDiscardListener *vrdl; VFIORamDiscardListener *vrdl;
/* Ignore some corner cases not relevant in practice. */ /* 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, g_assert(QEMU_IS_ALIGNED(section->offset_within_address_space,
TARGET_PAGE_SIZE)); target_page_size));
g_assert(QEMU_IS_ALIGNED(int128_get64(section->size), TARGET_PAGE_SIZE)); g_assert(QEMU_IS_ALIGNED(int128_get64(section->size), target_page_size));
vrdl = g_new0(VFIORamDiscardListener, 1); vrdl = g_new0(VFIORamDiscardListener, 1);
vrdl->bcontainer = bcontainer; vrdl->bcontainer = bcontainer;