linux-mips.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: WANG Xuerui <i.kernel@xen0n.name>
To: Feiyang Chen <chris.chenfeiyang@gmail.com>,
	tsbogend@alpha.franken.de, tglx@linutronix.de,
	peterz@infradead.org, luto@kernel.org, arnd@arndb.de
Cc: Feiyang Chen <chenfeiyang@loongson.cn>,
	linux-mips@vger.kernel.org, linux-arch@vger.kernel.org,
	chenhuacai@kernel.org, jiaxun.yang@flygoat.com,
	zhouyu@wanyeetech.com, hns@goldelico.com,
	Yanteng Si <siyanteng@loongson.cn>
Subject: Re: [PATCH v3 1/2] MIPS: convert syscall to generic entry
Date: Thu, 14 Oct 2021 16:36:59 +0800	[thread overview]
Message-ID: <ddfbb616-9df1-9a92-3171-d534bddbd3d1@xen0n.name> (raw)
In-Reply-To: <31a97087b56c703606b8d871ac35d2192928fe6b.1634177547.git.chenfeiyang@loongson.cn>

Hi Feiyang,

On 2021/10/14 16:32, Feiyang Chen wrote:
> Convert MIPS syscall to use the generic entry infrastructure from
> kernel/entry/*.
>
> There are a few special things on MIPS:
>
> - There is one type of syscall on MIPS32 (scall32-o32) and three types
> of syscalls on MIPS64 (scall64-o32, scall64-n32 and scall64-n64). Now
> convert to C code to handle different types of syscalls.
>
> - For some special syscalls (e.g. fork, clone, clone3 and sysmips),
> save_static_function() wrapper is used to save static registers. Now
> SAVE_STATIC is used in handle_sys before calling do_syscall(), so the
> save_static_function() wrapper can be removed.
>
> - For sigreturn/rt_sigreturn and sysmips, inline assembly is used to
> jump to syscall_exit directly for skipping setting the error flag and
> restoring all registers. Now use regs->regs[27] to mark whether to
> handle the error flag and restore all registers in handle_sys, so these
> functions can return normally as other architecture.
>
> Signed-off-by: Feiyang Chen <chenfeiyang@loongson.cn>
> Signed-off-by: Yanteng Si <siyanteng@loongson.cn>
> Reviewed-by: Huacai Chen <chenhuacai@kernel.org>
> ---
>  arch/mips/Kconfig                         |   1 +
>  arch/mips/include/asm/entry-common.h      |  13 ++
>  arch/mips/include/asm/ptrace.h            |   8 +-
>  arch/mips/include/asm/sim.h               |  70 -------
>  arch/mips/include/asm/syscall.h           |   5 +
>  arch/mips/include/asm/thread_info.h       |  17 +-
>  arch/mips/include/uapi/asm/ptrace.h       |   7 +-
>  arch/mips/kernel/Makefile                 |  14 +-
>  arch/mips/kernel/entry.S                  |  75 ++------
>  arch/mips/kernel/linux32.c                |   1 -
>  arch/mips/kernel/ptrace.c                 |  78 --------
>  arch/mips/kernel/scall.S                  | 137 +++++++++++++
>  arch/mips/kernel/scall32-o32.S            | 223 ----------------------
>  arch/mips/kernel/scall64-n32.S            | 107 -----------
>  arch/mips/kernel/scall64-n64.S            | 116 -----------
>  arch/mips/kernel/scall64-o32.S            | 221 ---------------------
>  arch/mips/kernel/signal.c                 |  37 ++--
>  arch/mips/kernel/signal_n32.c             |  16 +-
>  arch/mips/kernel/signal_o32.c             |  31 +--
>  arch/mips/kernel/syscall.c                | 148 +++++++++++---
>  arch/mips/kernel/syscalls/syscall_n32.tbl |   8 +-
>  arch/mips/kernel/syscalls/syscall_n64.tbl |   8 +-
>  arch/mips/kernel/syscalls/syscall_o32.tbl |   8 +-
>  23 files changed, 354 insertions(+), 995 deletions(-)
>  create mode 100644 arch/mips/include/asm/entry-common.h
>  delete mode 100644 arch/mips/include/asm/sim.h
>  create mode 100644 arch/mips/kernel/scall.S
>  delete mode 100644 arch/mips/kernel/scall32-o32.S
>  delete mode 100644 arch/mips/kernel/scall64-n32.S
>  delete mode 100644 arch/mips/kernel/scall64-n64.S
>  delete mode 100644 arch/mips/kernel/scall64-o32.S
>
> diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
> index 1291774a2fa5..debd125100ad 100644
> --- a/arch/mips/Kconfig
> +++ b/arch/mips/Kconfig
> @@ -32,6 +32,7 @@ config MIPS
>  	select GENERIC_ATOMIC64 if !64BIT
>  	select GENERIC_CMOS_UPDATE
>  	select GENERIC_CPU_AUTOPROBE
> +	select GENERIC_ENTRY
>  	select GENERIC_GETTIMEOFDAY
>  	select GENERIC_IOMAP
>  	select GENERIC_IRQ_PROBE
> diff --git a/arch/mips/include/asm/entry-common.h b/arch/mips/include/asm/entry-common.h
> new file mode 100644
> index 000000000000..0fe2a098ded9
> --- /dev/null
> +++ b/arch/mips/include/asm/entry-common.h
> @@ -0,0 +1,13 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +#ifndef ARCH_LOONGARCH_ENTRY_COMMON_H
> +#define ARCH_LOONGARCH_ENTRY_COMMON_H
Do you intend to say "MIPS"? ;-)
> +
> +#include <linux/sched.h>
> +#include <linux/processor.h>
> +
> +static inline bool on_thread_stack(void)
> +{
> +	return !(((unsigned long)(current->stack) ^ current_stack_pointer) & ~(THREAD_SIZE - 1));
> +}
> +
> +#endif

  reply	other threads:[~2021-10-14  8:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-14  8:32 [PATCH v3 0/2] MIPS: convert to generic entry Feiyang Chen
2021-10-14  8:32 ` [PATCH v3 1/2] MIPS: convert syscall " Feiyang Chen
2021-10-14  8:36   ` WANG Xuerui [this message]
2021-10-14  8:56     ` Feiyang Chen
2021-10-14  8:38   ` YunQiang Su
2021-10-14  8:32 ` [PATCH v3 2/2] MIPS: convert irq " Feiyang Chen

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=ddfbb616-9df1-9a92-3171-d534bddbd3d1@xen0n.name \
    --to=i.kernel@xen0n.name \
    --cc=arnd@arndb.de \
    --cc=chenfeiyang@loongson.cn \
    --cc=chenhuacai@kernel.org \
    --cc=chris.chenfeiyang@gmail.com \
    --cc=hns@goldelico.com \
    --cc=jiaxun.yang@flygoat.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-mips@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=peterz@infradead.org \
    --cc=siyanteng@loongson.cn \
    --cc=tglx@linutronix.de \
    --cc=tsbogend@alpha.franken.de \
    --cc=zhouyu@wanyeetech.com \
    /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).