mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 15:23:53 -06:00
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
This commit is contained in:
parent
a7cf5391a4
commit
57d1f6d7ce
2 changed files with 11 additions and 0 deletions
|
@ -35,6 +35,10 @@ size_t qemu_fd_getpagesize(int fd)
|
|||
return fs.f_bsize;
|
||||
}
|
||||
}
|
||||
#ifdef __sparc__
|
||||
/* SPARC Linux needs greater alignment than the pagesize */
|
||||
return QEMU_VMALLOC_ALIGN;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return getpagesize();
|
||||
|
@ -60,6 +64,10 @@ size_t qemu_mempath_getpagesize(const char *mem_path)
|
|||
/* It's hugepage, return the huge page size */
|
||||
return fs.f_bsize;
|
||||
}
|
||||
#ifdef __sparc__
|
||||
/* SPARC Linux needs greater alignment than the pagesize */
|
||||
return QEMU_VMALLOC_ALIGN;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return getpagesize();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue