Subject: Re: linux-next: manual merge of the risc-v tree with the powerpc tree

From: Michael Ellerman <[email-masked]>
Date: Tue, 07 May 2024 13:55:41 +1000

Stephen Rothwell <[email-masked]> writes:
> Hi all,
>
> Today's linux-next merge of the risc-v tree got conflicts in:
>
>   include/uapi/linux/prctl.h
>   kernel/sys.c
>
> between commit:
>
>   628d701f2de5 ("powerpc/dexcr: Add DEXCR prctl interface")
>
> from the powerpc tree and commit:
>
>   6b9391b581fd ("riscv: Include riscv_set_icache_flush_ctx prctl")
>
> from the risc-v 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.

Thanks.

As you would have seen, I accounted for 71 being taken by
PR_RISCV_SET_ICACHE_FLUSH_CTX in my tree, so this is just a textual
conflict.

So should be nothing to do other than mention it to Linus.

cheers

> diff --cc include/uapi/linux/prctl.h
> index 713d28788df7,524d546d697b..000000000000
> --- a/include/uapi/linux/prctl.h
> +++ b/include/uapi/linux/prctl.h
> @@@ -306,20 -306,10 +306,26 @@@ struct prctl_mm_map 
>   # define PR_RISCV_V_VSTATE_CTRL_NEXT_MASK	0xc
>   # define PR_RISCV_V_VSTATE_CTRL_MASK		0x1f
>   
> + #define PR_RISCV_SET_ICACHE_FLUSH_CTX	71
> + # define PR_RISCV_CTX_SW_FENCEI_ON	0
> + # define PR_RISCV_CTX_SW_FENCEI_OFF	1
> + # define PR_RISCV_SCOPE_PER_PROCESS	0
> + # define PR_RISCV_SCOPE_PER_THREAD	1
> + 
>  +/* PowerPC Dynamic Execution Control Register (DEXCR) controls */
>  +#define PR_PPC_GET_DEXCR		72
>  +#define PR_PPC_SET_DEXCR		73
>  +/* DEXCR aspect to act on */
>  +# define PR_PPC_DEXCR_SBHE		0 /* Speculative branch hint enable */
>  +# define PR_PPC_DEXCR_IBRTPD		1 /* Indirect branch recurrent target prediction disable */
>  +# define PR_PPC_DEXCR_SRAPD		2 /* Subroutine return address prediction disable */
>  +# define PR_PPC_DEXCR_NPHIE		3 /* Non-privileged hash instruction enable */
>  +/* Action to apply / return */
>  +# define PR_PPC_DEXCR_CTRL_EDITABLE	 0x1 /* Aspect can be modified with PR_PPC_SET_DEXCR */
>  +# define PR_PPC_DEXCR_CTRL_SET		 0x2 /* Set the aspect for this process */
>  +# define PR_PPC_DEXCR_CTRL_CLEAR	 0x4 /* Clear the aspect for this process */
>  +# define PR_PPC_DEXCR_CTRL_SET_ONEXEC	 0x8 /* Set the aspect on exec */
>  +# define PR_PPC_DEXCR_CTRL_CLEAR_ONEXEC	0x10 /* Clear the aspect on exec */
>  +# define PR_PPC_DEXCR_CTRL_MASK		0x1f
>  +
>   #endif /* _LINUX_PRCTL_H */
> diff --cc kernel/sys.c
> index f9c95410278c,1b7bda0722ca..000000000000
> --- a/kernel/sys.c
> +++ b/kernel/sys.c
> @@@ -146,12 -146,9 +146,15 @@@
>   #ifndef RISCV_V_GET_CONTROL
>   # define RISCV_V_GET_CONTROL()		(-EINVAL)
>   #endif
> + #ifndef RISCV_SET_ICACHE_FLUSH_CTX
> + # define RISCV_SET_ICACHE_FLUSH_CTX(a, b)	(-EINVAL)
> + #endif
>  +#ifndef PPC_GET_DEXCR_ASPECT
>  +# define PPC_GET_DEXCR_ASPECT(a, b)	(-EINVAL)
>  +#endif
>  +#ifndef PPC_SET_DEXCR_ASPECT
>  +# define PPC_SET_DEXCR_ASPECT(a, b, c)	(-EINVAL)
>  +#endif
>   
>   /*
>    * this is where the system-wide overflow UID and GID are defined, for