mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 19:08:57 +09:00
selftests/powerpc: Skip the subpage_prot tests if the syscall is unavailable
[ Upstream commitcd4a6f3ab4] The subpage_prot syscall is only functional when the system is using the Hash MMU. Since commit5b2b807147("powerpc/mm: Invalidate subpage_prot() system call on radix platforms") it returns ENOENT when the Radix MMU is active. Currently this just makes the test fail. Additionally the syscall is not available if the kernel is built with 4K pages, or if CONFIG_PPC_SUBPAGE_PROT=n, in which case it returns ENOSYS because the syscall is missing entirely. So check explicitly for ENOENT and ENOSYS and skip if we see either of those. Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Signed-off-by: Sasha Levin <alexander.levin@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
b672f4bf9d
commit
be00ce5848
@@ -135,6 +135,16 @@ static int run_test(void *addr, unsigned long size)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int syscall_available(void)
|
||||
{
|
||||
int rc;
|
||||
|
||||
errno = 0;
|
||||
rc = syscall(__NR_subpage_prot, 0, 0, 0);
|
||||
|
||||
return rc == 0 || (errno != ENOENT && errno != ENOSYS);
|
||||
}
|
||||
|
||||
int test_anon(void)
|
||||
{
|
||||
unsigned long align;
|
||||
@@ -145,6 +155,8 @@ int test_anon(void)
|
||||
void *mallocblock;
|
||||
unsigned long mallocsize;
|
||||
|
||||
SKIP_IF(!syscall_available());
|
||||
|
||||
if (getpagesize() != 0x10000) {
|
||||
fprintf(stderr, "Kernel page size must be 64K!\n");
|
||||
return 1;
|
||||
@@ -180,6 +192,8 @@ int test_file(void)
|
||||
off_t filesize;
|
||||
int fd;
|
||||
|
||||
SKIP_IF(!syscall_available());
|
||||
|
||||
fd = open(file_name, O_RDWR);
|
||||
if (fd == -1) {
|
||||
perror("failed to open file");
|
||||
|
||||
Reference in New Issue
Block a user