+++ /dev/null
-From 96f1b00138cb8f04c742c82d0a7c460b2202e887 Mon Sep 17 00:00:00 2001
-From: Vineet Gupta <vgupta@synopsys.com>
-Date: Tue, 8 Jun 2021 19:39:25 -0700
-Subject: ARCv2: save ABI registers across signal handling
-
-From: Vineet Gupta <vgupta@synopsys.com>
-
-commit 96f1b00138cb8f04c742c82d0a7c460b2202e887 upstream.
-
-ARCv2 has some configuration dependent registers (r30, r58, r59) which
-could be targetted by the compiler. To keep the ABI stable, these were
-unconditionally part of the glibc ABI
-(sysdeps/unix/sysv/linux/arc/sys/ucontext.h:mcontext_t) however we
-missed populating them (by saving/restoring them across signal
-handling).
-
-This patch fixes the issue by
- - adding arcv2 ABI regs to kernel struct sigcontext
- - populating them during signal handling
-
-Change to struct sigcontext might seem like a glibc ABI change (although
-it primarily uses ucontext_t:mcontext_t) but the fact is
- - it has only been extended (existing fields are not touched)
- - the old sigcontext was ABI incomplete to begin with anyways
-
-Fixes: https://github.com/foss-for-synopsys-dwc-arc-processors/linux/issues/53
-Cc: <stable@vger.kernel.org>
-Tested-by: kernel test robot <lkp@intel.com>
-Reported-by: Vladimir Isaev <isaev@synopsys.com>
-Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
----
- arch/arc/include/uapi/asm/sigcontext.h | 1
- arch/arc/kernel/signal.c | 43 +++++++++++++++++++++++++++++++++
- 2 files changed, 44 insertions(+)
-
---- a/arch/arc/include/uapi/asm/sigcontext.h
-+++ b/arch/arc/include/uapi/asm/sigcontext.h
-@@ -17,6 +17,7 @@
- */
- struct sigcontext {
- struct user_regs_struct regs;
-+ struct user_regs_arcv2 v2abi;
- };
-
- #endif /* _ASM_ARC_SIGCONTEXT_H */
---- a/arch/arc/kernel/signal.c
-+++ b/arch/arc/kernel/signal.c
-@@ -62,6 +62,41 @@ struct rt_sigframe {
- unsigned int sigret_magic;
- };
-
-+static int save_arcv2_regs(struct sigcontext *mctx, struct pt_regs *regs)
-+{
-+ int err = 0;
-+#ifndef CONFIG_ISA_ARCOMPACT
-+ struct user_regs_arcv2 v2abi;
-+
-+ v2abi.r30 = regs->r30;
-+#ifdef CONFIG_ARC_HAS_ACCL_REGS
-+ v2abi.r58 = regs->r58;
-+ v2abi.r59 = regs->r59;
-+#else
-+ v2abi.r58 = v2abi.r59 = 0;
-+#endif
-+ err = __copy_to_user(&mctx->v2abi, &v2abi, sizeof(v2abi));
-+#endif
-+ return err;
-+}
-+
-+static int restore_arcv2_regs(struct sigcontext *mctx, struct pt_regs *regs)
-+{
-+ int err = 0;
-+#ifndef CONFIG_ISA_ARCOMPACT
-+ struct user_regs_arcv2 v2abi;
-+
-+ err = __copy_from_user(&v2abi, &mctx->v2abi, sizeof(v2abi));
-+
-+ regs->r30 = v2abi.r30;
-+#ifdef CONFIG_ARC_HAS_ACCL_REGS
-+ regs->r58 = v2abi.r58;
-+ regs->r59 = v2abi.r59;
-+#endif
-+#endif
-+ return err;
-+}
-+
- static int
- stash_usr_regs(struct rt_sigframe __user *sf, struct pt_regs *regs,
- sigset_t *set)
-@@ -95,6 +130,10 @@ stash_usr_regs(struct rt_sigframe __user
-
- err = __copy_to_user(&(sf->uc.uc_mcontext.regs.scratch), &uregs.scratch,
- sizeof(sf->uc.uc_mcontext.regs.scratch));
-+
-+ if (is_isa_arcv2())
-+ err |= save_arcv2_regs(&(sf->uc.uc_mcontext), regs);
-+
- err |= __copy_to_user(&sf->uc.uc_sigmask, set, sizeof(sigset_t));
-
- return err ? -EFAULT : 0;
-@@ -110,6 +149,10 @@ static int restore_usr_regs(struct pt_re
- err |= __copy_from_user(&uregs.scratch,
- &(sf->uc.uc_mcontext.regs.scratch),
- sizeof(sf->uc.uc_mcontext.regs.scratch));
-+
-+ if (is_isa_arcv2())
-+ err |= restore_arcv2_regs(&(sf->uc.uc_mcontext), regs);
-+
- if (err)
- return -EFAULT;
-
tracing-do-no-increment-trace_clock_global-by-one.patch
pci-mark-ti-c667x-to-avoid-bus-reset.patch
pci-mark-some-nvidia-gpus-to-avoid-bus-reset.patch
-arcv2-save-abi-registers-across-signal-handling.patch
dmaengine-pl330-fix-wrong-usage-of-spinlock-flags-in-dma_cyclc.patch
net-fec_ptp-add-clock-rate-zero-check.patch
can-bcm-raw-isotp-use-per-module-netdevice-notifier.patch
+++ /dev/null
-From 96f1b00138cb8f04c742c82d0a7c460b2202e887 Mon Sep 17 00:00:00 2001
-From: Vineet Gupta <vgupta@synopsys.com>
-Date: Tue, 8 Jun 2021 19:39:25 -0700
-Subject: ARCv2: save ABI registers across signal handling
-
-From: Vineet Gupta <vgupta@synopsys.com>
-
-commit 96f1b00138cb8f04c742c82d0a7c460b2202e887 upstream.
-
-ARCv2 has some configuration dependent registers (r30, r58, r59) which
-could be targetted by the compiler. To keep the ABI stable, these were
-unconditionally part of the glibc ABI
-(sysdeps/unix/sysv/linux/arc/sys/ucontext.h:mcontext_t) however we
-missed populating them (by saving/restoring them across signal
-handling).
-
-This patch fixes the issue by
- - adding arcv2 ABI regs to kernel struct sigcontext
- - populating them during signal handling
-
-Change to struct sigcontext might seem like a glibc ABI change (although
-it primarily uses ucontext_t:mcontext_t) but the fact is
- - it has only been extended (existing fields are not touched)
- - the old sigcontext was ABI incomplete to begin with anyways
-
-Fixes: https://github.com/foss-for-synopsys-dwc-arc-processors/linux/issues/53
-Cc: <stable@vger.kernel.org>
-Tested-by: kernel test robot <lkp@intel.com>
-Reported-by: Vladimir Isaev <isaev@synopsys.com>
-Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
-Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
----
- arch/arc/include/uapi/asm/sigcontext.h | 1
- arch/arc/kernel/signal.c | 43 +++++++++++++++++++++++++++++++++
- 2 files changed, 44 insertions(+)
-
---- a/arch/arc/include/uapi/asm/sigcontext.h
-+++ b/arch/arc/include/uapi/asm/sigcontext.h
-@@ -17,6 +17,7 @@
- */
- struct sigcontext {
- struct user_regs_struct regs;
-+ struct user_regs_arcv2 v2abi;
- };
-
- #endif /* _ASM_ARC_SIGCONTEXT_H */
---- a/arch/arc/kernel/signal.c
-+++ b/arch/arc/kernel/signal.c
-@@ -62,6 +62,41 @@ struct rt_sigframe {
- unsigned int sigret_magic;
- };
-
-+static int save_arcv2_regs(struct sigcontext *mctx, struct pt_regs *regs)
-+{
-+ int err = 0;
-+#ifndef CONFIG_ISA_ARCOMPACT
-+ struct user_regs_arcv2 v2abi;
-+
-+ v2abi.r30 = regs->r30;
-+#ifdef CONFIG_ARC_HAS_ACCL_REGS
-+ v2abi.r58 = regs->r58;
-+ v2abi.r59 = regs->r59;
-+#else
-+ v2abi.r58 = v2abi.r59 = 0;
-+#endif
-+ err = __copy_to_user(&mctx->v2abi, &v2abi, sizeof(v2abi));
-+#endif
-+ return err;
-+}
-+
-+static int restore_arcv2_regs(struct sigcontext *mctx, struct pt_regs *regs)
-+{
-+ int err = 0;
-+#ifndef CONFIG_ISA_ARCOMPACT
-+ struct user_regs_arcv2 v2abi;
-+
-+ err = __copy_from_user(&v2abi, &mctx->v2abi, sizeof(v2abi));
-+
-+ regs->r30 = v2abi.r30;
-+#ifdef CONFIG_ARC_HAS_ACCL_REGS
-+ regs->r58 = v2abi.r58;
-+ regs->r59 = v2abi.r59;
-+#endif
-+#endif
-+ return err;
-+}
-+
- static int
- stash_usr_regs(struct rt_sigframe __user *sf, struct pt_regs *regs,
- sigset_t *set)
-@@ -95,6 +130,10 @@ stash_usr_regs(struct rt_sigframe __user
-
- err = __copy_to_user(&(sf->uc.uc_mcontext.regs.scratch), &uregs.scratch,
- sizeof(sf->uc.uc_mcontext.regs.scratch));
-+
-+ if (is_isa_arcv2())
-+ err |= save_arcv2_regs(&(sf->uc.uc_mcontext), regs);
-+
- err |= __copy_to_user(&sf->uc.uc_sigmask, set, sizeof(sigset_t));
-
- return err ? -EFAULT : 0;
-@@ -110,6 +149,10 @@ static int restore_usr_regs(struct pt_re
- err |= __copy_from_user(&uregs.scratch,
- &(sf->uc.uc_mcontext.regs.scratch),
- sizeof(sf->uc.uc_mcontext.regs.scratch));
-+
-+ if (is_isa_arcv2())
-+ err |= restore_arcv2_regs(&(sf->uc.uc_mcontext), regs);
-+
- if (err)
- return -EFAULT;
-
tracing-do-no-increment-trace_clock_global-by-one.patch
pci-mark-ti-c667x-to-avoid-bus-reset.patch
pci-mark-some-nvidia-gpus-to-avoid-bus-reset.patch
-arcv2-save-abi-registers-across-signal-handling.patch
dmaengine-pl330-fix-wrong-usage-of-spinlock-flags-in-dma_cyclc.patch
net-fec_ptp-add-clock-rate-zero-check.patch
can-bcm-raw-isotp-use-per-module-netdevice-notifier.patch