summaryrefslogtreecommitdiffstats
path: root/include/qemu/osdep.h
diff options
context:
space:
mode:
authorPeter Maydell2017-12-08 17:57:28 +0100
committerPeter Maydell2017-12-15 16:26:24 +0100
commit57d1f6d7ce23e79a8ebe4a57bd2363b269b4664b (patch)
tree5a74de3c4f6909c2ebc69e725f6629732a18f071 /include/qemu/osdep.h
parentMerge remote-tracking branch 'remotes/cohuck/tags/s390x-20171215-v2' into sta... (diff)
downloadqemu-57d1f6d7ce23e79a8ebe4a57bd2363b269b4664b.tar.gz
qemu-57d1f6d7ce23e79a8ebe4a57bd2363b269b4664b.tar.xz
qemu-57d1f6d7ce23e79a8ebe4a57bd2363b269b4664b.zip
sparc: Make sure we mmap at SHMLBA alignment
SPARC Linux has an oddity that it insists that mmap() of MAP_FIXED memory must be at an alignment defined by SHMLBA, which is more aligned than the page size (typically, SHMLBA alignment is to 16K, and pages are 8K). This is a relic of ancient hardware that had cache aliasing constraints, but even on modern hardware the kernel still insists on the alignment. To ensure that we get mmap() alignment sufficient to make the kernel happy, change QEMU_VMALLOC_ALIGN, qemu_fd_getpagesize() and qemu_mempath_getpagesize() to use the maximum of getpagesize() and SHMLBA. In particular, this allows 'make check' to pass on Sparc: we were previously failing the ivshmem tests. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 1512752248-17857-1-git-send-email-peter.maydell@linaro.org
Diffstat (limited to 'include/qemu/osdep.h')
-rw-r--r--include/qemu/osdep.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
index e8568a0a54..adb3758275 100644
--- a/include/qemu/osdep.h
+++ b/include/qemu/osdep.h
@@ -365,6 +365,9 @@ void qemu_anon_ram_free(void *ptr, size_t size);
#elif defined(__linux__) && defined(__s390x__)
/* Use 1 MiB (segment size) alignment so gmap can be used by KVM. */
# define QEMU_VMALLOC_ALIGN (256 * 4096)
+#elif defined(__linux__) && defined(__sparc__)
+#include <sys/shm.h>
+# define QEMU_VMALLOC_ALIGN MAX(getpagesize(), SHMLBA)
#else
# define QEMU_VMALLOC_ALIGN getpagesize()
#endif