Skip to content

Commit 80ce7bb

Browse files
philmdlegoater
authored andcommitted
hw/vfio/common: Get target page size using runtime helpers
Prefer runtime helpers to get target page size. Reviewed-by: Richard Henderson <[email protected]> Signed-off-by: Philippe Mathieu-Daudé <[email protected]> Message-Id: <[email protected]> Link: https://lore.kernel.org/qemu-devel/[email protected] Signed-off-by: Cédric Le Goater <[email protected]>
1 parent 514c296 commit 80ce7bb

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

hw/vfio/common.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#include "exec/address-spaces.h"
3131
#include "exec/memory.h"
3232
#include "exec/ram_addr.h"
33+
#include "exec/target_page.h"
3334
#include "hw/hw.h"
3435
#include "qemu/error-report.h"
3536
#include "qemu/main-loop.h"
@@ -393,13 +394,14 @@ static void vfio_register_ram_discard_listener(VFIOContainerBase *bcontainer,
393394
MemoryRegionSection *section)
394395
{
395396
RamDiscardManager *rdm = memory_region_get_ram_discard_manager(section->mr);
397+
int target_page_size = qemu_target_page_size();
396398
VFIORamDiscardListener *vrdl;
397399

398400
/* Ignore some corner cases not relevant in practice. */
399-
g_assert(QEMU_IS_ALIGNED(section->offset_within_region, TARGET_PAGE_SIZE));
401+
g_assert(QEMU_IS_ALIGNED(section->offset_within_region, target_page_size));
400402
g_assert(QEMU_IS_ALIGNED(section->offset_within_address_space,
401-
TARGET_PAGE_SIZE));
402-
g_assert(QEMU_IS_ALIGNED(int128_get64(section->size), TARGET_PAGE_SIZE));
403+
target_page_size));
404+
g_assert(QEMU_IS_ALIGNED(int128_get64(section->size), target_page_size));
403405

404406
vrdl = g_new0(VFIORamDiscardListener, 1);
405407
vrdl->bcontainer = bcontainer;

0 commit comments

Comments
 (0)