diff mbox series

[2/2] powerpc: move sync_file_range2 compat definition

Message ID 20221012035335.866440-2-npiggin@gmail.com (mailing list archive)
State New
Headers show
Series [1/2] powerpc/32: fix syscall wrappers with 64-bit arguments of unaligned register-pairs | expand

Checks

Context Check Description
snowpatch_ozlabs/github-powerpc_selftests success Successfully ran 10 jobs.
snowpatch_ozlabs/github-powerpc_ppctests success Successfully ran 10 jobs.
snowpatch_ozlabs/github-powerpc_kernel_qemu success Successfully ran 23 jobs.
snowpatch_ozlabs/github-powerpc_clang success Successfully ran 6 jobs.
snowpatch_ozlabs/github-powerpc_sparse success Successfully ran 4 jobs.

Commit Message

Nicholas Piggin Oct. 12, 2022, 3:53 a.m. UTC
sync_file_range2 is not a special unaligned-odd-pair calling convention
syscall, it's just a regular one that does not have a generic compat
definition. Move it out of sys_ppc32.c and into syscalls.c.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
This one doesn't fix anything and is not required for the previous
fix, so it could be merged later. Now that we've repurposed sys_ppc32.c
for the difficult syscalls and compat syscalls live all over the kernel
now anyway, IMO it's makes things less confusing to move this.

Thanks,
Nick

 arch/powerpc/include/asm/syscalls.h | 23 ++++++++++++-----------
 arch/powerpc/kernel/sys_ppc32.c     | 11 -----------
 arch/powerpc/kernel/syscalls.c      | 11 +++++++++++
 3 files changed, 23 insertions(+), 22 deletions(-)

Comments

Arnd Bergmann Oct. 12, 2022, 10:21 a.m. UTC | #1
On Wed, Oct 12, 2022, at 5:53 AM, Nicholas Piggin wrote:
> sync_file_range2 is not a special unaligned-odd-pair calling convention
> syscall, it's just a regular one that does not have a generic compat
> definition. Move it out of sys_ppc32.c and into syscalls.c.
>
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> ---
> This one doesn't fix anything and is not required for the previous
> fix, so it could be merged later. Now that we've repurposed sys_ppc32.c
> for the difficult syscalls and compat syscalls live all over the kernel
> now anyway, IMO it's makes things less confusing to move this.

For this one, I would just move the implementation right next to
sync_file_range2() the same way we define compat_sys_sync_file_range(),
and share it with arm64.

      Arnd
diff mbox series

Patch

diff --git a/arch/powerpc/include/asm/syscalls.h b/arch/powerpc/include/asm/syscalls.h
index a1142496cd58..810ce45d670b 100644
--- a/arch/powerpc/include/asm/syscalls.h
+++ b/arch/powerpc/include/asm/syscalls.h
@@ -79,8 +79,20 @@  long compat_sys_old_getrlimit(unsigned int resource,
 			      struct compat_rlimit __user *rlim);
 long compat_sys_sigreturn(void);
 long compat_sys_rt_sigreturn(void);
+long compat_sys_ppc_sync_file_range2(int fd, unsigned int flags,
+				     unsigned int offset1,
+				     unsigned int offset2,
+				     unsigned int nbytes1,
+				     unsigned int nbytes2);
 #endif /* CONFIG_COMPAT */
 
+#if defined(CONFIG_PPC32) || defined(CONFIG_COMPAT)
+long sys_ppc_fadvise64_64(int fd, int advice,
+			  u32 offset_high, u32 offset_low,
+			  u32 len_high, u32 len_low);
+#endif
+
+
 /*
  * Architecture specific signatures required by long long munging:
  * The 32 bit ABI passes long longs in an odd even register pair.
@@ -123,19 +135,8 @@  long compat_sys_ppc_ftruncate64(unsigned int fd, u32 reg4,
 				unsigned long len1, unsigned long len2);
 long compat_sys_ppc32_fadvise64(int fd, u32 unused, u32 offset1, u32 offset2,
 				size_t len, int advice);
-long compat_sys_ppc_sync_file_range2(int fd, unsigned int flags,
-				     unsigned int offset1,
-				     unsigned int offset2,
-				     unsigned int nbytes1,
-				     unsigned int nbytes2);
 #endif /* CONFIG_COMPAT */
 
-#if defined(CONFIG_PPC32) || defined(CONFIG_COMPAT)
-long sys_ppc_fadvise64_64(int fd, int advice,
-			  u32 offset_high, u32 offset_low,
-			  u32 len_high, u32 len_low);
-#endif
-
 #else
 
 #define __SYSCALL_WITH_COMPAT(nr, native, compat)	__SYSCALL(nr, native)
diff --git a/arch/powerpc/kernel/sys_ppc32.c b/arch/powerpc/kernel/sys_ppc32.c
index 6bdfe11a7689..53927abcda82 100644
--- a/arch/powerpc/kernel/sys_ppc32.c
+++ b/arch/powerpc/kernel/sys_ppc32.c
@@ -111,14 +111,3 @@  PPC32_SYSCALL_DEFINE6(ppc32_fadvise64,
 	return ksys_fadvise64_64(fd, merge_64(offset1, offset2), len,
 				 advice);
 }
-
-COMPAT_SYSCALL_DEFINE6(ppc_sync_file_range2,
-		       int, fd, unsigned int, flags,
-		       unsigned int, offset1, unsigned int, offset2,
-		       unsigned int, nbytes1, unsigned int, nbytes2)
-{
-	loff_t offset = merge_64(offset1, offset2);
-	loff_t nbytes = merge_64(nbytes1, nbytes2);
-
-	return ksys_sync_file_range(fd, offset, nbytes, flags);
-}
diff --git a/arch/powerpc/kernel/syscalls.c b/arch/powerpc/kernel/syscalls.c
index 68ebb23a5af4..8bdc41879045 100644
--- a/arch/powerpc/kernel/syscalls.c
+++ b/arch/powerpc/kernel/syscalls.c
@@ -97,6 +97,17 @@  COMPAT_SYSCALL_DEFINE1(ppc64_personality, unsigned long, personality)
 {
 	return do_ppc64_personality(personality);
 }
+
+COMPAT_SYSCALL_DEFINE6(ppc_sync_file_range2,
+		       int, fd, unsigned int, flags,
+		       unsigned int, offset1, unsigned int, offset2,
+		       unsigned int, nbytes1, unsigned int, nbytes2)
+{
+	loff_t offset = merge_64(offset1, offset2);
+	loff_t nbytes = merge_64(nbytes1, nbytes2);
+
+	return ksys_sync_file_range(fd, offset, nbytes, flags);
+}
 #endif /* CONFIG_COMPAT */
 #endif /* CONFIG_PPC64 */