* [PATCH v2 05/14] powerpc: Use generic fallocate compatibility syscall
@ 2022-07-25 6:26 Rohan McLure
2022-08-08 4:31 ` Andrew Donnellan
0 siblings, 1 reply; 3+ messages in thread
From: Rohan McLure @ 2022-07-25 6:26 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Rohan McLure, arnd, npiggin
The powerpc fallocate compat syscall handler is identical to the
generic implementation provided by commit 59c10c52f573f ("riscv:
compat: syscall: Add compat_sys_call_table implementation"), and as
such can be removed in favour of the generic implementation.
A future patch series will replace more architecture-defined syscall
handlers with generic implementations, dependent on introducing generic
implementations that are compatible with powerpc and arm's parameter
reorderings.
Reported-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Rohan McLure <rmclure@linux.ibm.com>
---
V1 -> V2: Remove arch-specific fallocate handler.
---
arch/powerpc/include/asm/compat.h | 5 +++++
arch/powerpc/include/asm/unistd.h | 1 +
arch/powerpc/kernel/asm-offsets.c | 1 +
arch/powerpc/kernel/sys_ppc32.c | 8 --------
arch/powerpc/kernel/syscalls/syscall.tbl | 2 +-
5 files changed, 8 insertions(+), 9 deletions(-)
diff --git a/arch/powerpc/include/asm/compat.h b/arch/powerpc/include/asm/compat.h
index dda4091fd012..f20caae3f019 100644
--- a/arch/powerpc/include/asm/compat.h
+++ b/arch/powerpc/include/asm/compat.h
@@ -16,6 +16,11 @@ typedef u16 compat_ipc_pid_t;
#include <asm-generic/compat.h>
#ifdef __BIG_ENDIAN__
+#define compat_arg_u64(name) u32 name##_hi, u32 name##_lo
+#define compat_arg_u64_dual(name) u32, name##_hi, u32, name##_lo
+#define compat_arg_u64_glue(name) (((u64)name##_lo & 0xffffffffUL) | \
+ ((u64)name##_hi << 32))
+
#define COMPAT_UTS_MACHINE "ppc\0\0"
#else
#define COMPAT_UTS_MACHINE "ppcle\0\0"
diff --git a/arch/powerpc/include/asm/unistd.h b/arch/powerpc/include/asm/unistd.h
index b1129b4ef57d..659a996c75aa 100644
--- a/arch/powerpc/include/asm/unistd.h
+++ b/arch/powerpc/include/asm/unistd.h
@@ -45,6 +45,7 @@
#define __ARCH_WANT_SYS_UTIME
#define __ARCH_WANT_SYS_NEWFSTATAT
#define __ARCH_WANT_COMPAT_STAT
+#define __ARCH_WANT_COMPAT_FALLOCATE
#define __ARCH_WANT_COMPAT_SYS_SENDFILE
#endif
#define __ARCH_WANT_SYS_FORK
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index 8c10f536e478..c669f1d1ee77 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -9,6 +9,7 @@
* #defines from the assembly-language output.
*/
+#include <asm/compat.h>
#include <linux/compat.h>
#include <linux/signal.h>
#include <linux/sched.h>
diff --git a/arch/powerpc/kernel/sys_ppc32.c b/arch/powerpc/kernel/sys_ppc32.c
index 89e8c478fd6a..bd00b7dab7cd 100644
--- a/arch/powerpc/kernel/sys_ppc32.c
+++ b/arch/powerpc/kernel/sys_ppc32.c
@@ -89,14 +89,6 @@ COMPAT_SYSCALL_DEFINE4(ppc_truncate64,
return ksys_truncate(path, merge_64(len1, len2));
}
-COMPAT_SYSCALL_DEFINE6(ppc_fallocate,
- int, fd, int, mode, u32, offset1, u32, offset2,
- u32, len1, u32, len2)
-{
- return ksys_fallocate(fd, mode, ((loff_t)offset1 << 32) | offset2,
- merge_64(len1, len2));
-}
-
COMPAT_SYSCALL_DEFINE4(ppc_ftruncate64,
unsigned int, fd, u32, reg4, unsigned long, len1,
unsigned long, len2)
diff --git a/arch/powerpc/kernel/syscalls/syscall.tbl b/arch/powerpc/kernel/syscalls/syscall.tbl
index c6cfcdf52c57..b4c970c9c6b1 100644
--- a/arch/powerpc/kernel/syscalls/syscall.tbl
+++ b/arch/powerpc/kernel/syscalls/syscall.tbl
@@ -391,7 +391,7 @@
306 common timerfd_create sys_timerfd_create
307 common eventfd sys_eventfd
308 common sync_file_range2 sys_sync_file_range2 compat_sys_ppc_sync_file_range2
-309 nospu fallocate sys_fallocate compat_sys_ppc_fallocate
+309 nospu fallocate sys_fallocate compat_sys_fallocate
310 nospu subpage_prot sys_subpage_prot
311 32 timerfd_settime sys_timerfd_settime32
311 64 timerfd_settime sys_timerfd_settime
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2 05/14] powerpc: Use generic fallocate compatibility syscall
2022-07-25 6:26 [PATCH v2 05/14] powerpc: Use generic fallocate compatibility syscall Rohan McLure
@ 2022-08-08 4:31 ` Andrew Donnellan
2022-08-08 6:41 ` Rohan McLure
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Donnellan @ 2022-08-08 4:31 UTC (permalink / raw)
To: Rohan McLure, linuxppc-dev; +Cc: npiggin, arnd
On Mon, 2022-07-25 at 16:26 +1000, Rohan McLure wrote:
> The powerpc fallocate compat syscall handler is identical to the
> generic implementation provided by commit 59c10c52f573f ("riscv:
> compat: syscall: Add compat_sys_call_table implementation"), and as
> such can be removed in favour of the generic implementation.
>
> A future patch series will replace more architecture-defined syscall
> handlers with generic implementations, dependent on introducing
> generic
> implementations that are compatible with powerpc and arm's parameter
> reorderings.
>
> Reported-by: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Rohan McLure <rmclure@linux.ibm.com>
> ---
> V1 -> V2: Remove arch-specific fallocate handler.
> ---
> arch/powerpc/include/asm/compat.h | 5 +++++
> arch/powerpc/include/asm/unistd.h | 1 +
> arch/powerpc/kernel/asm-offsets.c | 1 +
> arch/powerpc/kernel/sys_ppc32.c | 8 --------
> arch/powerpc/kernel/syscalls/syscall.tbl | 2 +-
> 5 files changed, 8 insertions(+), 9 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/compat.h
> b/arch/powerpc/include/asm/compat.h
> index dda4091fd012..f20caae3f019 100644
> --- a/arch/powerpc/include/asm/compat.h
> +++ b/arch/powerpc/include/asm/compat.h
> @@ -16,6 +16,11 @@ typedef u16 compat_ipc_pid_t;
> #include <asm-generic/compat.h>
>
> #ifdef __BIG_ENDIAN__
> +#define compat_arg_u64(name) u32 name##_hi, u32
> name##_lo
> +#define compat_arg_u64_dual(name) u32, name##_hi, u32,
> name##_lo
> +#define compat_arg_u64_glue(name) (((u64)name##_lo &
> 0xffffffffUL) | \
> + ((u64)name##_hi << 32))
> +
Is there any reason this can't go into include/asm-generic/compat.h?
> #define COMPAT_UTS_MACHINE "ppc\0\0"
> #else
> #define COMPAT_UTS_MACHINE "ppcle\0\0"
> diff --git a/arch/powerpc/include/asm/unistd.h
> b/arch/powerpc/include/asm/unistd.h
> index b1129b4ef57d..659a996c75aa 100644
> --- a/arch/powerpc/include/asm/unistd.h
> +++ b/arch/powerpc/include/asm/unistd.h
> @@ -45,6 +45,7 @@
> #define __ARCH_WANT_SYS_UTIME
> #define __ARCH_WANT_SYS_NEWFSTATAT
> #define __ARCH_WANT_COMPAT_STAT
> +#define __ARCH_WANT_COMPAT_FALLOCATE
> #define __ARCH_WANT_COMPAT_SYS_SENDFILE
> #endif
> #define __ARCH_WANT_SYS_FORK
> diff --git a/arch/powerpc/kernel/asm-offsets.c
> b/arch/powerpc/kernel/asm-offsets.c
> index 8c10f536e478..c669f1d1ee77 100644
> --- a/arch/powerpc/kernel/asm-offsets.c
> +++ b/arch/powerpc/kernel/asm-offsets.c
> @@ -9,6 +9,7 @@
> * #defines from the assembly-language output.
> */
>
> +#include <asm/compat.h>
What's this for?
> #include <linux/compat.h>
> #include <linux/signal.h>
> #include <linux/sched.h>
> diff --git a/arch/powerpc/kernel/sys_ppc32.c
> b/arch/powerpc/kernel/sys_ppc32.c
> index 89e8c478fd6a..bd00b7dab7cd 100644
> --- a/arch/powerpc/kernel/sys_ppc32.c
> +++ b/arch/powerpc/kernel/sys_ppc32.c
> @@ -89,14 +89,6 @@ COMPAT_SYSCALL_DEFINE4(ppc_truncate64,
> return ksys_truncate(path, merge_64(len1, len2));
> }
>
> -COMPAT_SYSCALL_DEFINE6(ppc_fallocate,
> - int, fd, int, mode, u32, offset1, u32,
> offset2,
> - u32, len1, u32, len2)
> -{
> - return ksys_fallocate(fd, mode, ((loff_t)offset1 << 32) |
> offset2,
> - merge_64(len1, len2));
> -}
> -
> COMPAT_SYSCALL_DEFINE4(ppc_ftruncate64,
> unsigned int, fd, u32, reg4, unsigned long,
> len1,
> unsigned long, len2)
> diff --git a/arch/powerpc/kernel/syscalls/syscall.tbl
> b/arch/powerpc/kernel/syscalls/syscall.tbl
> index c6cfcdf52c57..b4c970c9c6b1 100644
> --- a/arch/powerpc/kernel/syscalls/syscall.tbl
> +++ b/arch/powerpc/kernel/syscalls/syscall.tbl
> @@ -391,7 +391,7 @@
> 306 common timerfd_create sys_timerfd_create
> 307 common eventfd sys_eventfd
> 308 common sync_file_range2 sys_sync_file_range2
> compat_sys_ppc_sync_file_range2
> -
> 309 nospu fallocate sys_fallocate
> compat_sys_ppc_fallocate
> +309 nospu fallocate sys_fallocate
> compat_sys_fallocate
> 310 nospu subpage_prot sys_subpage_prot
> 311 32 timerfd_settime sys_timerfd_settime32
> 311 64 timerfd_settime sys_timerfd_settime
--
Andrew Donnellan OzLabs, ADL Canberra
ajd@linux.ibm.com IBM Australia Limited
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2 05/14] powerpc: Use generic fallocate compatibility syscall
2022-08-08 4:31 ` Andrew Donnellan
@ 2022-08-08 6:41 ` Rohan McLure
0 siblings, 0 replies; 3+ messages in thread
From: Rohan McLure @ 2022-08-08 6:41 UTC (permalink / raw)
To: Andrew Donnellan; +Cc: linuxppc-dev
>> --- a/arch/powerpc/kernel/asm-offsets.c
>> +++ b/arch/powerpc/kernel/asm-offsets.c
>> @@ -9,6 +9,7 @@
>> * #defines from the assembly-language output.
>> */
>>
>> +#include <asm/compat.h>
>
> What's this for?
Good spot.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-08-08 6:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-25 6:26 [PATCH v2 05/14] powerpc: Use generic fallocate compatibility syscall Rohan McLure
2022-08-08 4:31 ` Andrew Donnellan
2022-08-08 6:41 ` Rohan McLure
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).