diff mbox series

include: set vm hva aligned with huge pagesize on loongarch

Message ID 20220628030400.1291793-1-maobibo@loongson.cn (mailing list archive)
State New, archived
Headers show
Series include: set vm hva aligned with huge pagesize on loongarch | expand

Commit Message

bibo mao June 28, 2022, 3:04 a.m. UTC
On loongarch system, page size is 16K rather than 4K like general platforms,
and huge pagesize is 32M. This patch sets hva for vm aligned with huge pagesize
on loongarch host system.

Signed-off-by: Mao Bibo <maobibo@loongson.cn>
---
 include/qemu/osdep.h | 3 +++
 1 file changed, 3 insertions(+)
diff mbox series

Patch

diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
index b1c161c035..4f9aa53e35 100644
--- a/include/qemu/osdep.h
+++ b/include/qemu/osdep.h
@@ -451,6 +451,9 @@  extern int madvise(char *, size_t, int);
 #  define QEMU_VMALLOC_ALIGN (256 * 4096)
 #elif defined(__linux__) && defined(__sparc__)
 #  define QEMU_VMALLOC_ALIGN MAX(qemu_real_host_page_size(), SHMLBA)
+#elif defined(__linux__) && defined(__loongarch__)
+#  define QEMU_VMALLOC_ALIGN (qemu_real_host_page_size() * \
+                              qemu_real_host_page_size() / sizeof(long))
 #else
 #  define QEMU_VMALLOC_ALIGN qemu_real_host_page_size()
 #endif