Subject: linux-next: manual merge of the xtensa tree with the sh tree

From: Stephen Rothwell <[email-masked]>
Date: Tue, 28 Jul 2020 10:23:30 +1000

Hi all,

Today's linux-next merge of the xtensa tree got a conflict in:

  tools/testing/selftests/seccomp/seccomp_bpf.c

between commit:

  469023465e79 ("sh: Add SECCOMP_FILTER")

from the sh tree and commit:

  deccfc9ce639 ("selftests/seccomp: add xtensa support")

from the xtensa tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc tools/testing/selftests/seccomp/seccomp_bpf.c
index 06d994a34997,1b445c2e7fbe..000000000000
--- a/tools/testing/selftests/seccomp/seccomp_bpf.c
+++ b/tools/testing/selftests/seccomp/seccomp_bpf.c
@@@ -124,8 -122,8 +124,10 @@@ struct seccomp_data 
  #  define __NR_seccomp 358
  # elif defined(__s390__)
  #  define __NR_seccomp 348
 +# elif defined(__sh__)
 +#  define __NR_seccomp 372
+ # elif defined(__xtensa__)
+ #  define __NR_seccomp 337
  # else
  #  warning "seccomp syscall number unknown for this architecture"
  #  define __NR_seccomp 0xffff
@@@ -1634,10 -1624,14 +1636,18 @@@ TEST_F(TRACE_poke, getpid_runs_normally
  # define SYSCALL_SYSCALL_NUM regs[4]
  # define SYSCALL_RET	regs[2]
  # define SYSCALL_NUM_RET_SHARE_REG
 +#elif defined(__sh__)
 +# define ARCH_REGS	struct pt_regs
 +# define SYSCALL_NUM	gpr[3]
 +# define SYSCALL_RET	gpr[0]
+ #elif defined(__xtensa__)
+ # define ARCH_REGS	struct user_pt_regs
+ # define SYSCALL_NUM	syscall
+ /*
+  * On xtensa syscall return value is in the register
+  * a2 of the current window which is not fixed.
+  */
+ #define SYSCALL_RET(reg) a[(reg).windowbase * 4 + 2]
  #else
  # error "Do not know how to find your architecture's registers and syscalls"
  #endif
@@@ -1710,7 -1704,7 +1720,7 @@@ void change_syscall(struct __test_metad
  
  #if defined(__x86_64__) || defined(__i386__) || defined(__powerpc__) || \
  	defined(__s390__) || defined(__hppa__) || defined(__riscv) || \
- 	defined(__csky__) || defined(__sh__)
 -	defined(__xtensa__)
++	defined(__csky__) || defined(__sh__) || defined(__xtensa__)
  	{
  		regs.SYSCALL_NUM = syscall;
  	}