@@ -14,6 +14,7 @@
#include <linux/vfio.h>
#include <sys/eventfd.h>
#include <sys/ioctl.h>
+#include "exec/target_page.h"
#include "hw/virtio/vhost.h"
#include "hw/virtio/vhost-backend.h"
#include "hw/virtio/virtio-net.h"
@@ -23,7 +24,6 @@
#include "migration/blocker.h"
#include "qemu/cutils.h"
#include "qemu/main-loop.h"
-#include "cpu.h"
#include "trace.h"
#include "qapi/error.h"
@@ -35,7 +35,7 @@ static Int128 vhost_vdpa_section_end(const MemoryRegionSection *section)
{
Int128 llend = int128_make64(section->offset_within_address_space);
llend = int128_add(llend, section->size);
- llend = int128_and(llend, int128_exts64(TARGET_PAGE_MASK));
+ llend = int128_and(llend, int128_exts64(qemu_target_page_mask()));
return llend;
}
@@ -321,13 +321,13 @@ static void vhost_vdpa_listener_region_add(MemoryListener *listener,
return;
}
- if (unlikely((section->offset_within_address_space & ~TARGET_PAGE_MASK) !=
- (section->offset_within_region & ~TARGET_PAGE_MASK))) {
+ if (unlikely((section->offset_within_address_space & ~qemu_target_page_mask()) !=
+ (section->offset_within_region & ~qemu_target_page_mask()))) {
error_report("%s received unaligned region", __func__);
return;
}
- iova = TARGET_PAGE_ALIGN(section->offset_within_address_space);
+ iova = qemu_target_page_align(section->offset_within_address_space);
llend = vhost_vdpa_section_end(section);
if (int128_ge(int128_make64(iova), llend)) {
return;
@@ -403,13 +403,13 @@ static void vhost_vdpa_listener_region_del(MemoryListener *listener,
vhost_vdpa_iommu_region_del(listener, section);
}
- if (unlikely((section->offset_within_address_space & ~TARGET_PAGE_MASK) !=
- (section->offset_within_region & ~TARGET_PAGE_MASK))) {
+ if (unlikely((section->offset_within_address_space & ~qemu_target_page_mask()) !=
+ (section->offset_within_region & ~qemu_target_page_mask()))) {
error_report("%s received unaligned region", __func__);
return;
}
- iova = TARGET_PAGE_ALIGN(section->offset_within_address_space);
+ iova = qemu_target_page_align(section->offset_within_address_space);
llend = vhost_vdpa_section_end(section);
trace_vhost_vdpa_listener_region_del(v, iova,
@@ -18,7 +18,8 @@ if have_vhost
specific_virtio_ss.add(files('vhost-user.c'))
endif
if have_vhost_vdpa
- specific_virtio_ss.add(files('vhost-vdpa.c', 'vhost-shadow-virtqueue.c'))
+ softmmu_virtio_ss.add(files('vhost-vdpa.c'))
+ specific_virtio_ss.add(files('vhost-shadow-virtqueue.c'))
endif
else
softmmu_virtio_ss.add(files('vhost-stub.c'))
Replace TARGET_PAGE_MASK -> qemu_target_page_mask() and TARGET_PAGE_ALIGN() -> qemu_target_page_align() so we don't need the target-specific "cpu.h" header. These macros are used in the MemoryListener add/del handlers (vhost_vdpa_listener_skipped_section is only called by vhost_vdpa_listener_region_add) which are not hot-path. Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- hw/virtio/vhost-vdpa.c | 16 ++++++++-------- hw/virtio/meson.build | 3 ++- 2 files changed, 10 insertions(+), 9 deletions(-)