[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 15/16] qemu/osdep: Add huge page aligned support on LoongArch plat
From: |
Paolo Bonzini |
Subject: |
[PULL 15/16] qemu/osdep: Add huge page aligned support on LoongArch platform |
Date: |
Thu, 18 Jan 2024 13:24:15 +0100 |
From: Bibo Mao <maobibo@loongson.cn>
On LoongArch kvm mode if transparent huge page wants to be enabled, base
address and size of memslot from both HVA and GPA view. And LoongArch
supports both 4K and 16K page size with Linux kernel, so transparent huge
page size is calculated from real page size rather than hardcoded size.
Signed-off-by: Bibo Mao <maobibo@loongson.cn>
Message-ID: <20240115073244.174155-1-maobibo@loongson.cn>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
include/qemu/osdep.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
index 9a405bed893..c9692cc3142 100644
--- a/include/qemu/osdep.h
+++ b/include/qemu/osdep.h
@@ -547,6 +547,14 @@ 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__)
+ /*
+ * For transparent hugepage optimization, it has better be huge page
+ * aligned. LoongArch host system supports two kinds of pagesize: 4K
+ * and 16K, here calculate huge page size from host page size
+ */
+# 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
--
2.43.0
- [PULL 01/16] vga: use common endian swap macros, (continued)
- [PULL 01/16] vga: use common endian swap macros, Paolo Bonzini, 2024/01/18
- [PULL 02/16] vga: introduce VGADisplayParams, Paolo Bonzini, 2024/01/18
- [PULL 03/16] vga: mask addresses in non-VESA modes to 256k, Paolo Bonzini, 2024/01/18
- [PULL 06/16] vga: reindent memory access code, Paolo Bonzini, 2024/01/18
- [PULL 07/16] vga: use latches in odd/even mode too, Paolo Bonzini, 2024/01/18
- [PULL 05/16] vga: optimize horizontal pel panning in 256-color modes, Paolo Bonzini, 2024/01/18
- [PULL 09/16] Add class property to configure KVM device node to use, Paolo Bonzini, 2024/01/18
- [PULL 10/16] io_uring: move LuringState typedef to block/aio.h, Paolo Bonzini, 2024/01/18
- [PULL 13/16] target/i386: pcrel: store low bits of physical address in data[0], Paolo Bonzini, 2024/01/18
- [PULL 11/16] target/i386: Do not re-compute new pc with CF_PCREL, Paolo Bonzini, 2024/01/18
- [PULL 15/16] qemu/osdep: Add huge page aligned support on LoongArch platform,
Paolo Bonzini <=
- [PULL 16/16] tests/tcg: Don't #include <inttypes.h> in aarch64/system/vtimer.c, Paolo Bonzini, 2024/01/18
- [PULL 12/16] target/i386: fix incorrect EIP in PC-relative translation blocks, Paolo Bonzini, 2024/01/18
- [PULL 08/16] vga: sort-of implement word and double-word access modes, Paolo Bonzini, 2024/01/18
- [PULL 14/16] remove unnecessary casts from uintptr_t, Paolo Bonzini, 2024/01/18
- [PULL 04/16] vga: implement horizontal pel panning in graphics modes, Paolo Bonzini, 2024/01/18
- Re: [PULL 00/16] VGA, x86 TCG, misc changes for 2024-01-18, Peter Maydell, 2024/01/19