linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michal Simek <michal.simek@xilinx.com>
To: Firoz Khan <firoz.khan@linaro.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Philippe Ombredanne <pombredanne@nexb.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Kate Stewart <kstewart@linuxfoundation.org>
Cc: linux-arch@vger.kernel.org, arnd@arndb.de,
	y2038@lists.linaro.org, linux-kernel@vger.kernel.org,
	marcin.juszkiewicz@linaro.org, deepa.kernel@gmail.com
Subject: Re: [PATCH 2/3] microblaze: Added system call table generation support
Date: Thu, 9 Aug 2018 09:05:10 +0200	[thread overview]
Message-ID: <80094eae-05b8-a96f-b631-cc3b81e0e425@xilinx.com> (raw)
In-Reply-To: <1533792466-4227-3-git-send-email-firoz.khan@linaro.org>

On 9.8.2018 07:27, Firoz Khan wrote:
> The system call tables are in different format in all
> architecture and it will be difficult to manually add or
> modify the system calls in the respective files. To make
> it easy by keeping a script and which'll generate the
> header file and syscall table file so this change will
> unify them across all architectures.
> 
> The system call table generation script is added in
> syscalls directory which contain the script to generate
> both uapi header file system call table generation file
> and syscall.tbl file which'll be the input for the scripts.
> 
> syscall.tbl contains the list of available system calls
> along with system call number and corresponding entry point.
> Add a new system call in this architecture will be possible
> by adding new entry in the syscall.tbl file.
> 
> Adding a new table entry consisting of:
>         - System call number.
>         - ABI.
>         - System call name.
>         - Entry point name.
> 
> syscallhdr.sh and syscalltbl.sh will generate uapi header-
> unistd.h and syscall_table.h files respectively. File
> syscall_table.h is included by syscall.S - the real system
> call table. Both .sh files will parse the content syscall.tbl
> to generate the header and table files.
> 
> ARM, s390 and x86 architecuture does have the similar support.
> I leverage their implementation to come up with a generic
> solution. And this is the ground work for y2038 issue. We need
> to change 52 system call implementation and this work will
> reduce the effort by simply modify 52 entries in syscall.tbl.
> 
> Signed-off-by: Firoz Khan <firoz.khan@linaro.org>
> ---
>  arch/microblaze/kernel/syscalls/Makefile      |  37 +++
>  arch/microblaze/kernel/syscalls/syscall.tbl   | 404 ++++++++++++++++++++++++++
>  arch/microblaze/kernel/syscalls/syscallhdr.sh |  33 +++
>  arch/microblaze/kernel/syscalls/syscalltbl.sh |  28 ++
>  4 files changed, 502 insertions(+)
>  create mode 100644 arch/microblaze/kernel/syscalls/Makefile
>  create mode 100644 arch/microblaze/kernel/syscalls/syscall.tbl
>  create mode 100644 arch/microblaze/kernel/syscalls/syscallhdr.sh

it is interesting that arm and x86 scripts and they are "almost" the
same. Is there any plan to put these script to generic location instead
of keeping the same copy in architecture?

fileguard name contains hardcoded macro prefix where in arm there is
uapi detection. The same should be done architecture and sholdn't matter
if you define macro with or without value.




>  create mode 100644 arch/microblaze/kernel/syscalls/syscalltbl.sh
> 
> diff --git a/arch/microblaze/kernel/syscalls/Makefile b/arch/microblaze/kernel/syscalls/Makefile
> new file mode 100644
> index 0000000..7624044
> --- /dev/null
> +++ b/arch/microblaze/kernel/syscalls/Makefile
> @@ -0,0 +1,37 @@
> +# SPDX-License-Identifier: GPL-2.0
> +out := arch/$(SRCARCH)/include/generated/asm
> +uapi := arch/$(SRCARCH)/include/generated/uapi/asm
> +
> +_dummy := $(shell [ -d '$(uapi)' ] || mkdir -p '$(uapi)') \
> +	  $(shell [ -d '$(out)' ] || mkdir -p '$(out)')
> +
> +syscall := $(srctree)/$(src)/syscall.tbl
> +
> +syshdr := $(srctree)/$(src)/syscallhdr.sh
> +systbl := $(srctree)/$(src)/syscalltbl.sh
> +
> +quiet_cmd_syshdr = SYSHDR  $@
> +      cmd_syshdr = $(CONFIG_SHELL) '$(syshdr)' '$<' '$@'  \
> +		   '$(syshdr_abi_$(basetarget))'          \
> +		   '$(syshdr_pfx_$(basetarget))'          \
> +		   '$(syshdr_offset_$(basetarget))'
> +
> +quiet_cmd_systbl = SYSTBL  $@
> +      cmd_systbl = $(CONFIG_SHELL) '$(systbl)' '$<' '$@'  \
> +		   '$(systbl_abi_$(basetarget))'
> +
> +$(uapi)/unistd_32.h: $(syscall) $(syshdr)
> +	$(call if_changed,syshdr)
> +
> +$(out)/syscall_table.h: $(syscall) $(systbl)
> +	$(call if_changed,systbl)
> +
> +uapisyshdr-y			+= unistd_32.h
> +syshdr-y			+= syscall_table.h
> +
> +targets	+= $(uapisyshdr-y) $(syshdr-y)
> +
> +PHONY += all
> +all: $(addprefix $(uapi)/,$(uapisyshdr-y))
> +all: $(addprefix $(out)/,$(syshdr-y))
> +	@:
> diff --git a/arch/microblaze/kernel/syscalls/syscall.tbl b/arch/microblaze/kernel/syscalls/syscall.tbl
> new file mode 100644
> index 0000000..219d940
> --- /dev/null
> +++ b/arch/microblaze/kernel/syscalls/syscall.tbl
> @@ -0,0 +1,404 @@
> +#
> +# Linux system call numbers and entry vectors
> +#
> +# The format is:
> +# <number> <abi> <name> <entry point>
> +#
> +# The abi is always common for this file.
> +#
> +0       common  restart_syscall                 sys_restart_syscall
> +1       common  exit                            sys_exit
> +2       common  fork                            sys_fork
> +3       common  read                            sys_read

Arm(and partially s390) are using tabs for indentation. Any reason not
to use it here too?

Thanks,
Michal
_______________________________________________
Y2038 mailing list
Y2038@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/y2038

WARNING: multiple messages have this Message-ID (diff)
From: Michal Simek <michal.simek@xilinx.com>
To: Firoz Khan <firoz.khan@linaro.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Philippe Ombredanne <pombredanne@nexb.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Kate Stewart <kstewart@linuxfoundation.org>
Cc: y2038@lists.linaro.org, linux-kernel@vger.kernel.org,
	linux-arch@vger.kernel.org, arnd@arndb.de,
	deepa.kernel@gmail.com, marcin.juszkiewicz@linaro.org
Subject: Re: [PATCH 2/3] microblaze: Added system call table generation support
Date: Thu, 9 Aug 2018 09:05:10 +0200	[thread overview]
Message-ID: <80094eae-05b8-a96f-b631-cc3b81e0e425@xilinx.com> (raw)
Message-ID: <20180809070510.VfVk9mpdyaX5v3See_yhSG5q-g4WS0C3omP3XO8_xm0@z> (raw)
In-Reply-To: <1533792466-4227-3-git-send-email-firoz.khan@linaro.org>

On 9.8.2018 07:27, Firoz Khan wrote:
> The system call tables are in different format in all
> architecture and it will be difficult to manually add or
> modify the system calls in the respective files. To make
> it easy by keeping a script and which'll generate the
> header file and syscall table file so this change will
> unify them across all architectures.
> 
> The system call table generation script is added in
> syscalls directory which contain the script to generate
> both uapi header file system call table generation file
> and syscall.tbl file which'll be the input for the scripts.
> 
> syscall.tbl contains the list of available system calls
> along with system call number and corresponding entry point.
> Add a new system call in this architecture will be possible
> by adding new entry in the syscall.tbl file.
> 
> Adding a new table entry consisting of:
>         - System call number.
>         - ABI.
>         - System call name.
>         - Entry point name.
> 
> syscallhdr.sh and syscalltbl.sh will generate uapi header-
> unistd.h and syscall_table.h files respectively. File
> syscall_table.h is included by syscall.S - the real system
> call table. Both .sh files will parse the content syscall.tbl
> to generate the header and table files.
> 
> ARM, s390 and x86 architecuture does have the similar support.
> I leverage their implementation to come up with a generic
> solution. And this is the ground work for y2038 issue. We need
> to change 52 system call implementation and this work will
> reduce the effort by simply modify 52 entries in syscall.tbl.
> 
> Signed-off-by: Firoz Khan <firoz.khan@linaro.org>
> ---
>  arch/microblaze/kernel/syscalls/Makefile      |  37 +++
>  arch/microblaze/kernel/syscalls/syscall.tbl   | 404 ++++++++++++++++++++++++++
>  arch/microblaze/kernel/syscalls/syscallhdr.sh |  33 +++
>  arch/microblaze/kernel/syscalls/syscalltbl.sh |  28 ++
>  4 files changed, 502 insertions(+)
>  create mode 100644 arch/microblaze/kernel/syscalls/Makefile
>  create mode 100644 arch/microblaze/kernel/syscalls/syscall.tbl
>  create mode 100644 arch/microblaze/kernel/syscalls/syscallhdr.sh

it is interesting that arm and x86 scripts and they are "almost" the
same. Is there any plan to put these script to generic location instead
of keeping the same copy in architecture?

fileguard name contains hardcoded macro prefix where in arm there is
uapi detection. The same should be done architecture and sholdn't matter
if you define macro with or without value.




>  create mode 100644 arch/microblaze/kernel/syscalls/syscalltbl.sh
> 
> diff --git a/arch/microblaze/kernel/syscalls/Makefile b/arch/microblaze/kernel/syscalls/Makefile
> new file mode 100644
> index 0000000..7624044
> --- /dev/null
> +++ b/arch/microblaze/kernel/syscalls/Makefile
> @@ -0,0 +1,37 @@
> +# SPDX-License-Identifier: GPL-2.0
> +out := arch/$(SRCARCH)/include/generated/asm
> +uapi := arch/$(SRCARCH)/include/generated/uapi/asm
> +
> +_dummy := $(shell [ -d '$(uapi)' ] || mkdir -p '$(uapi)') \
> +	  $(shell [ -d '$(out)' ] || mkdir -p '$(out)')
> +
> +syscall := $(srctree)/$(src)/syscall.tbl
> +
> +syshdr := $(srctree)/$(src)/syscallhdr.sh
> +systbl := $(srctree)/$(src)/syscalltbl.sh
> +
> +quiet_cmd_syshdr = SYSHDR  $@
> +      cmd_syshdr = $(CONFIG_SHELL) '$(syshdr)' '$<' '$@'  \
> +		   '$(syshdr_abi_$(basetarget))'          \
> +		   '$(syshdr_pfx_$(basetarget))'          \
> +		   '$(syshdr_offset_$(basetarget))'
> +
> +quiet_cmd_systbl = SYSTBL  $@
> +      cmd_systbl = $(CONFIG_SHELL) '$(systbl)' '$<' '$@'  \
> +		   '$(systbl_abi_$(basetarget))'
> +
> +$(uapi)/unistd_32.h: $(syscall) $(syshdr)
> +	$(call if_changed,syshdr)
> +
> +$(out)/syscall_table.h: $(syscall) $(systbl)
> +	$(call if_changed,systbl)
> +
> +uapisyshdr-y			+= unistd_32.h
> +syshdr-y			+= syscall_table.h
> +
> +targets	+= $(uapisyshdr-y) $(syshdr-y)
> +
> +PHONY += all
> +all: $(addprefix $(uapi)/,$(uapisyshdr-y))
> +all: $(addprefix $(out)/,$(syshdr-y))
> +	@:
> diff --git a/arch/microblaze/kernel/syscalls/syscall.tbl b/arch/microblaze/kernel/syscalls/syscall.tbl
> new file mode 100644
> index 0000000..219d940
> --- /dev/null
> +++ b/arch/microblaze/kernel/syscalls/syscall.tbl
> @@ -0,0 +1,404 @@
> +#
> +# Linux system call numbers and entry vectors
> +#
> +# The format is:
> +# <number> <abi> <name> <entry point>
> +#
> +# The abi is always common for this file.
> +#
> +0       common  restart_syscall                 sys_restart_syscall
> +1       common  exit                            sys_exit
> +2       common  fork                            sys_fork
> +3       common  read                            sys_read

Arm(and partially s390) are using tabs for indentation. Any reason not
to use it here too?

Thanks,
Michal

  parent reply	other threads:[~2018-08-09  7:05 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-09  5:27 [PATCH 0/3] System call table generation support Firoz Khan
2018-08-09  5:27 ` Firoz Khan
2018-08-09  5:27 ` [PATCH 1/3] microblaze: Replace NR_syscalls macro from asm/unistd.h Firoz Khan
2018-08-09  5:27   ` Firoz Khan
2018-08-09  6:48   ` Michal Simek
2018-08-09  6:48     ` Michal Simek
2018-09-18  6:37     ` Firoz Khan
2018-09-18  6:37       ` Firoz Khan
2018-10-02  7:07       ` Michal Simek
2018-10-02  7:07         ` Michal Simek
2018-10-03  5:09         ` Firoz Khan
2018-10-03  5:09           ` Firoz Khan
2018-08-09  5:27 ` [PATCH 2/3] microblaze: Added system call table generation support Firoz Khan
2018-08-09  5:27   ` Firoz Khan
2018-08-09  7:05   ` Michal Simek [this message]
2018-08-09  7:05     ` Michal Simek
2018-09-18  6:50     ` Firoz Khan
2018-09-18  6:50       ` Firoz Khan
2018-08-09  5:27 ` [PATCH 3/3] microblaze: uapi header and system call table file generation Firoz Khan
2018-08-09  5:27   ` Firoz Khan
2018-08-09  7:12   ` Michal Simek
2018-08-09  7:12     ` Michal Simek
2018-09-18  7:12     ` Firoz Khan
2018-09-18  7:12       ` Firoz Khan
2018-09-24 23:20       ` Arnd Bergmann
2018-09-24 23:20         ` Arnd Bergmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=80094eae-05b8-a96f-b631-cc3b81e0e425@xilinx.com \
    --to=michal.simek@xilinx.com \
    --cc=arnd@arndb.de \
    --cc=deepa.kernel@gmail.com \
    --cc=firoz.khan@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kstewart@linuxfoundation.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcin.juszkiewicz@linaro.org \
    --cc=pombredanne@nexb.com \
    --cc=tglx@linutronix.de \
    --cc=y2038@lists.linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).