LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/22] crypto: add check for xts input length equal to zero
From: Andrei Botila @ 2020-08-07 16:19 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller
  Cc: linux-s390, Andrei Botila, x86, linux-kernel, linux-arm-kernel,
	linux-crypto, linuxppc-dev, linux-arm-kernel

From: Andrei Botila <andrei.botila@nxp.com>

This patch set is a follow-up on the previous RFC discussion which can be found
here: https://lore.kernel.org/r/4145904.A5P2xsN9yQ@tauon.chronox.de

This series converts all XTS implementations to return 0 when the input length
is equal to 0. This change is necessary in order to standardize the way
skcipher algorithms handle this corner case. This check is made for other
algorithms such as CBC, ARC4, CFB, OFB, SALSA20, CTR, ECB and PCBC, XTS being
the outlier here.

Although some drivers do not explicitly check for requests with zero input
length, their implementations might be able to deal with this case.
Since we don't have the HW to test which ones are able and which ones are not
we rely on the maintainers of these drivers to verify and comment if the changes
are necessary in their driver or not.

One important thing to keep in mind is that in some implementations we make
this check only for XTS algorithms although probably all skcipher algorithms
should return 0 in case of zero input length.

This fix has been tested only on ARMv8 CE, the rest of the patches have
been build tested *only*, and should be tested on actual hardware before
being merged.

Andrei Botila (22):
  crypto: arm/aes-ce - add check for xts input length equal to zero
  crypto: arm/aes-neonbs - add check for xts input length equal to zero
  crypto: arm64/aes - add check for xts input length equal to zero
  crypto: arm64/aes-neonbs - add check for xts input length equal to
    zero
  crypto: powerpc/aes-spe - add check for xts input length equal to zero
  crypto: s390/aes - add check for xts input length equal to zero
  crypto: s390/paes - add check for xts input length equal to zero
  crypto: x86/glue_helper - add check for xts input length equal to zero
  crypto: xts - add check for block length equal to zero
  crypto: atmel-aes - add check for xts input length equal to zero
  crypto: artpec6 - add check for xts input length equal to zero
  crypto: bcm - add check for xts input length equal to zero
  crypto: cavium/cpt - add check for xts input length equal to zero
  crypto: cavium/nitrox - add check for xts input length equal to zero
  crypto: ccp - add check for xts input length equal to zero
  crypto: ccree - add check for xts input length equal to zero
  crypto: chelsio - add check for xts input length equal to zero
  crypto: hisilicon/sec - add check for xts input length equal to zero
  crypto: inside-secure - add check for xts input length equal to zero
  crypto: octeontx - add check for xts input length equal to zero
  crypto: qce - add check for xts input length equal to zero
  crypto: vmx - add check for xts input length equal to zero

 arch/arm/crypto/aes-ce-glue.c                    |  6 ++++++
 arch/arm/crypto/aes-neonbs-glue.c                |  3 +++
 arch/arm64/crypto/aes-glue.c                     |  6 ++++++
 arch/arm64/crypto/aes-neonbs-glue.c              |  3 +++
 arch/powerpc/crypto/aes-spe-glue.c               |  6 ++++++
 arch/s390/crypto/aes_s390.c                      |  3 +++
 arch/s390/crypto/paes_s390.c                     |  3 +++
 arch/x86/crypto/glue_helper.c                    |  3 +++
 crypto/xts.c                                     |  6 ++++++
 drivers/crypto/atmel-aes.c                       |  4 ++++
 drivers/crypto/axis/artpec6_crypto.c             |  6 ++++++
 drivers/crypto/bcm/cipher.c                      |  3 +++
 drivers/crypto/cavium/cpt/cptvf_algs.c           |  4 ++++
 drivers/crypto/cavium/nitrox/nitrox_skcipher.c   |  6 ++++++
 drivers/crypto/ccp/ccp-crypto-aes-xts.c          |  3 +++
 drivers/crypto/ccree/cc_cipher.c                 | 11 ++++++-----
 drivers/crypto/chelsio/chcr_algo.c               |  4 ++++
 drivers/crypto/hisilicon/sec/sec_algs.c          |  4 ++++
 drivers/crypto/inside-secure/safexcel_cipher.c   |  6 ++++++
 drivers/crypto/marvell/octeontx/otx_cptvf_algs.c |  5 +++++
 drivers/crypto/qce/skcipher.c                    |  3 +++
 drivers/crypto/vmx/aes_xts.c                     |  3 +++
 22 files changed, 96 insertions(+), 5 deletions(-)

-- 
2.17.1


^ permalink raw reply

* Re: [RFC PATCH 1/2] powerpc/numa: Introduce logical numa id
From: Nathan Lynch @ 2020-08-07 20:45 UTC (permalink / raw)
  To: Aneesh Kumar K.V; +Cc: linuxppc-dev, Srikar Dronamraju
In-Reply-To: <324611f7-fdaf-f83c-7159-977488aa7ce7@linux.ibm.com>

"Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com> writes:
> On 8/7/20 9:54 AM, Nathan Lynch wrote:
>> "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com> writes:
>>> diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
>>> index e437a9ac4956..6c659aada55b 100644
>>> --- a/arch/powerpc/mm/numa.c
>>> +++ b/arch/powerpc/mm/numa.c
>>> @@ -221,25 +221,51 @@ static void initialize_distance_lookup_table(int nid,
>>>   	}
>>>   }
>>>   
>>> +static u32 nid_map[MAX_NUMNODES] = {[0 ... MAX_NUMNODES - 1] =  NUMA_NO_NODE};
>> 
>> It's odd to me to use MAX_NUMNODES for this array when it's going to be
>> indexed not by Linux's logical node IDs but by the platform-provided
>> domain number, which has no relation to MAX_NUMNODES.
>
>
> I didn't want to dynamically allocate this. We could fetch 
> "ibm,max-associativity-domains" to find the size for that. The current 
> code do assume  firmware group id to not exceed MAX_NUMNODES. Hence kept 
> the array size to be MAX_NUMNODEs. I do agree that it is confusing. May 
> be we can do #define MAX_AFFINITY_DOMAIN MAX_NUMNODES?

Well, consider:

- ibm,max-associativity-domains can change at runtime with LPM. This
  doesn't happen in practice yet, but we should probably start thinking
  about how to support that.
- The domain numbering isn't clearly specified to have any particular
  properties such as beginning at zero or a contiguous range.

While the current code likely contains assumptions contrary to these
points, a change such as this is an opportunity to think about whether
those assumptions can be reduced or removed. In particular I think it
would be good to gracefully degrade when the number of NUMA affinity
domains can exceed MAX_NUMNODES. Using the platform-supplied domain
numbers to directly index Linux data structures will make that
impossible.

So, maybe genradix or even xarray wouldn't actually be overengineering
here.

^ permalink raw reply

* Re: [Latest Git kernel/Linux-next kernel] Xorg doesn't start after the seccomp updates v5.9-rc1
From: Christian Zigotzky @ 2020-08-07 19:12 UTC (permalink / raw)
  To: Kees Cook
  Cc: mad skateman, Darren Stevens, linuxppc-dev,
	Linux Kernel Mailing List, R.T.Dickinson
In-Reply-To: <202008071043.2EABB8D24B@keescook>

Hi Kees,

Thanks a lot for your patch! I think your patch works because I can patch the Git source code but the kernel doesn’t boot. In my point of view your modifications aren’t responsible for this second issue. The kernel can’t initialize the graphics card anymore. I think the latest DRM updates are responsible for the second issue. Because of this second issue I can’t test your patch.

Please test the latest Git kernel.

Thanks,
Christian

> On 7. Aug 2020, at 19:45, Kees Cook <keescook@chromium.org> wrote:
> 
> On Fri, Aug 07, 2020 at 04:45:14PM +0200, Christian Zigotzky wrote:
>> But Xorg works on Ubuntu 10.04.4 (PowerPC 32-bit), openSUSE Tumbleweed
>> 20190722 PPC64 and on Fedora 27 PPC64 with the latest Git kernel.
>> 
>> I bisected today [4].
>> 
>> Result: net/scm: Regularize compat handling of scm_detach_fds()
>> (c0029de50982c1fb215330a5f9d433cec0cfd8cc) [5] is the first bad commit.
>> 
>> This commit has been merged with the seccomp updates v5.9-rc1 on 2020-08-04
>> 14:11:08 -0700 [1]. Since these updates, Xorg doesn't start anymore on some
>> Linux distributions.
> 
> Hi! Thanks for bisecting; yes, sorry for the trouble (I'm still trying
> to understand why my compat tests _passed_...). Regardless, can you try
> this patch:
> 
> https://lore.kernel.org/lkml/20200807173609.GJ4402@mussarela/
> 
> -- 
> Kees Cook

^ permalink raw reply

* Re: [PATCH 10/22] crypto: atmel-aes - add check for xts input length equal to zero
From: kernel test robot @ 2020-08-07 18:06 UTC (permalink / raw)
  To: Andrei Botila, Herbert Xu, David S. Miller
  Cc: linux-s390, kbuild-all, netdev, x86, linux-kernel,
	linux-arm-kernel, linux-crypto, linuxppc-dev, linux-arm-kernel
In-Reply-To: <20200807162010.18979-11-andrei.botila@oss.nxp.com>

[-- Attachment #1: Type: text/plain, Size: 3238 bytes --]

Hi Andrei,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on cryptodev/master]
[also build test WARNING on crypto/master next-20200807]
[cannot apply to powerpc/next sparc-next/master v5.8]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Andrei-Botila/crypto-add-check-for-xts-input-length-equal-to-zero/20200808-002648
base:   https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git master
config: arm-defconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All warnings (new ones prefixed by >>):

   drivers/crypto/atmel-aes.c: In function 'atmel_aes_crypt':
>> drivers/crypto/atmel-aes.c:1111:6: warning: this statement may fall through [-Wimplicit-fallthrough=]
    1111 |   if (!req->cryptlen)
         |      ^
   drivers/crypto/atmel-aes.c:1114:2: note: here
    1114 |  default:
         |  ^~~~~~~

vim +1111 drivers/crypto/atmel-aes.c

  1085	
  1086	static int atmel_aes_crypt(struct skcipher_request *req, unsigned long mode)
  1087	{
  1088		struct crypto_skcipher *skcipher = crypto_skcipher_reqtfm(req);
  1089		struct atmel_aes_base_ctx *ctx = crypto_skcipher_ctx(skcipher);
  1090		struct atmel_aes_reqctx *rctx;
  1091		struct atmel_aes_dev *dd;
  1092	
  1093		switch (mode & AES_FLAGS_OPMODE_MASK) {
  1094		case AES_FLAGS_CFB8:
  1095			ctx->block_size = CFB8_BLOCK_SIZE;
  1096			break;
  1097	
  1098		case AES_FLAGS_CFB16:
  1099			ctx->block_size = CFB16_BLOCK_SIZE;
  1100			break;
  1101	
  1102		case AES_FLAGS_CFB32:
  1103			ctx->block_size = CFB32_BLOCK_SIZE;
  1104			break;
  1105	
  1106		case AES_FLAGS_CFB64:
  1107			ctx->block_size = CFB64_BLOCK_SIZE;
  1108			break;
  1109	
  1110		case AES_FLAGS_XTS:
> 1111			if (!req->cryptlen)
  1112				return 0;
  1113	
  1114		default:
  1115			ctx->block_size = AES_BLOCK_SIZE;
  1116			break;
  1117		}
  1118		ctx->is_aead = false;
  1119	
  1120		dd = atmel_aes_find_dev(ctx);
  1121		if (!dd)
  1122			return -ENODEV;
  1123	
  1124		rctx = skcipher_request_ctx(req);
  1125		rctx->mode = mode;
  1126	
  1127		if ((mode & AES_FLAGS_OPMODE_MASK) != AES_FLAGS_ECB &&
  1128		    !(mode & AES_FLAGS_ENCRYPT) && req->src == req->dst) {
  1129			unsigned int ivsize = crypto_skcipher_ivsize(skcipher);
  1130	
  1131			if (req->cryptlen >= ivsize)
  1132				scatterwalk_map_and_copy(rctx->lastc, req->src,
  1133							 req->cryptlen - ivsize,
  1134							 ivsize, 0);
  1135		}
  1136	
  1137		return atmel_aes_handle_queue(dd, &req->base);
  1138	}
  1139	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 52679 bytes --]

^ permalink raw reply

* Re: [Latest Git kernel/Linux-next kernel] Xorg doesn't start after the seccomp updates v5.9-rc1
From: Kees Cook @ 2020-08-07 17:45 UTC (permalink / raw)
  To: Christian Zigotzky
  Cc: mad skateman, Darren Stevens, linuxppc-dev,
	Linux Kernel Mailing List, R.T.Dickinson
In-Reply-To: <67cd9693-10bc-5aa5-0898-ff2ac1f9c725@xenosoft.de>

On Fri, Aug 07, 2020 at 04:45:14PM +0200, Christian Zigotzky wrote:
> But Xorg works on Ubuntu 10.04.4 (PowerPC 32-bit), openSUSE Tumbleweed
> 20190722 PPC64 and on Fedora 27 PPC64 with the latest Git kernel.
> 
> I bisected today [4].
> 
> Result: net/scm: Regularize compat handling of scm_detach_fds()
> (c0029de50982c1fb215330a5f9d433cec0cfd8cc) [5] is the first bad commit.
> 
> This commit has been merged with the seccomp updates v5.9-rc1 on 2020-08-04
> 14:11:08 -0700 [1]. Since these updates, Xorg doesn't start anymore on some
> Linux distributions.

Hi! Thanks for bisecting; yes, sorry for the trouble (I'm still trying
to understand why my compat tests _passed_...). Regardless, can you try
this patch:

https://lore.kernel.org/lkml/20200807173609.GJ4402@mussarela/

-- 
Kees Cook

^ permalink raw reply

* [RFC PATCH v1] power: don't manage floating point regs when no FPU
From: Christophe Leroy @ 2020-08-07 16:13 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman
  Cc: linuxppc-dev, linux-kernel

There is no point in copying floating point regs when there
is no FPU and MATH_EMULATION is not selected.

Create a new CONFIG_PPC_FPU_REGS bool that is selected by
CONFIG_MATH_EMULATION and CONFIG_PPC_FPU, and use it to
opt out everything related to fp_state in thread_struct.

The following app runs in approx 10.50 seconds on an 8xx without
the patch, and in 9.45 seconds with the patch.

	void sigusr1(int sig) { }

	int main(int argc, char **argv)
	{
		int i = 100000;

		signal(SIGUSR1, sigusr1);
		for (;i--;)
			raise(SIGUSR1);
		exit(0);
	}

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
 arch/powerpc/Kconfig                      |  1 +
 arch/powerpc/include/asm/processor.h      |  2 ++
 arch/powerpc/kernel/asm-offsets.c         |  2 ++
 arch/powerpc/kernel/process.c             |  4 ++++
 arch/powerpc/kernel/ptrace/ptrace-novsx.c |  8 ++++++++
 arch/powerpc/kernel/ptrace/ptrace.c       |  4 ++++
 arch/powerpc/kernel/signal.c              | 12 +++++++++++-
 arch/powerpc/kernel/signal_32.c           |  4 ++++
 arch/powerpc/kernel/traps.c               |  4 ++++
 arch/powerpc/platforms/Kconfig.cputype    |  4 ++++
 10 files changed, 44 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 1f48bbfb3ce9..a2611880b904 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -416,6 +416,7 @@ config HUGETLB_PAGE_SIZE_VARIABLE
 config MATH_EMULATION
 	bool "Math emulation"
 	depends on 4xx || PPC_8xx || PPC_MPC832x || BOOKE
+	select PPC_FPU_REGS
 	help
 	  Some PowerPC chips designed for embedded applications do not have
 	  a floating-point unit and therefore do not implement the
diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h
index ed0d633ab5aa..e20b0c5abe62 100644
--- a/arch/powerpc/include/asm/processor.h
+++ b/arch/powerpc/include/asm/processor.h
@@ -175,8 +175,10 @@ struct thread_struct {
 #endif
 	/* Debug Registers */
 	struct debug_reg debug;
+#ifdef CONFIG_PPC_FPU_REGS
 	struct thread_fp_state	fp_state;
 	struct thread_fp_state	*fp_save_area;
+#endif
 	int		fpexc_mode;	/* floating-point exception mode */
 	unsigned int	align_ctl;	/* alignment handling control */
 #ifdef CONFIG_HAVE_HW_BREAKPOINT
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index 8711c2164b45..6cb36c341c70 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -110,9 +110,11 @@ int main(void)
 #ifdef CONFIG_BOOKE
 	OFFSET(THREAD_NORMSAVES, thread_struct, normsave[0]);
 #endif
+#ifdef CONFIG_PPC_FPU
 	OFFSET(THREAD_FPEXC_MODE, thread_struct, fpexc_mode);
 	OFFSET(THREAD_FPSTATE, thread_struct, fp_state.fpr);
 	OFFSET(THREAD_FPSAVEAREA, thread_struct, fp_save_area);
+#endif
 	OFFSET(FPSTATE_FPSCR, thread_fp_state, fpscr);
 	OFFSET(THREAD_LOAD_FP, thread_struct, load_fp);
 #ifdef CONFIG_ALTIVEC
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 016bd831908e..7e0082ac0a39 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -1694,7 +1694,9 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
 		p->thread.ptrace_bps[i] = NULL;
 #endif
 
+#ifdef CONFIG_PPC_FPU_REGS
 	p->thread.fp_save_area = NULL;
+#endif
 #ifdef CONFIG_ALTIVEC
 	p->thread.vr_save_area = NULL;
 #endif
@@ -1821,8 +1823,10 @@ void start_thread(struct pt_regs *regs, unsigned long start, unsigned long sp)
 #endif
 	current->thread.load_slb = 0;
 	current->thread.load_fp = 0;
+#ifdef CONFIG_PPC_FPU_REGS
 	memset(&current->thread.fp_state, 0, sizeof(current->thread.fp_state));
 	current->thread.fp_save_area = NULL;
+#endif
 #ifdef CONFIG_ALTIVEC
 	memset(&current->thread.vr_state, 0, sizeof(current->thread.vr_state));
 	current->thread.vr_state.vscr.u[3] = 0x00010000; /* Java mode disabled */
diff --git a/arch/powerpc/kernel/ptrace/ptrace-novsx.c b/arch/powerpc/kernel/ptrace/ptrace-novsx.c
index b2dc4e92d11a..8f87a11f3f8c 100644
--- a/arch/powerpc/kernel/ptrace/ptrace-novsx.c
+++ b/arch/powerpc/kernel/ptrace/ptrace-novsx.c
@@ -21,6 +21,7 @@
 int fpr_get(struct task_struct *target, const struct user_regset *regset,
 	    unsigned int pos, unsigned int count, void *kbuf, void __user *ubuf)
 {
+#ifdef CONFIG_PPC_FPU_REGS
 	BUILD_BUG_ON(offsetof(struct thread_fp_state, fpscr) !=
 		     offsetof(struct thread_fp_state, fpr[32]));
 
@@ -28,6 +29,9 @@ int fpr_get(struct task_struct *target, const struct user_regset *regset,
 
 	return user_regset_copyout(&pos, &count, &kbuf, &ubuf,
 				   &target->thread.fp_state, 0, -1);
+#else
+	return 0;
+#endif
 }
 
 /*
@@ -47,6 +51,7 @@ int fpr_set(struct task_struct *target, const struct user_regset *regset,
 	    unsigned int pos, unsigned int count,
 	    const void *kbuf, const void __user *ubuf)
 {
+#ifdef CONFIG_PPC_FPU_REGS
 	BUILD_BUG_ON(offsetof(struct thread_fp_state, fpscr) !=
 		     offsetof(struct thread_fp_state, fpr[32]));
 
@@ -54,4 +59,7 @@ int fpr_set(struct task_struct *target, const struct user_regset *regset,
 
 	return user_regset_copyin(&pos, &count, &kbuf, &ubuf,
 				  &target->thread.fp_state, 0, -1);
+#else
+	return 0;
+#endif
 }
diff --git a/arch/powerpc/kernel/ptrace/ptrace.c b/arch/powerpc/kernel/ptrace/ptrace.c
index f6e51be47c6e..f162bfec0d3f 100644
--- a/arch/powerpc/kernel/ptrace/ptrace.c
+++ b/arch/powerpc/kernel/ptrace/ptrace.c
@@ -70,6 +70,7 @@ long arch_ptrace(struct task_struct *child, long request,
 			ret = ptrace_get_reg(child, (int) index, &tmp);
 			if (ret)
 				break;
+#ifdef CONFIG_PPC_FPU_REGS
 		} else {
 			unsigned int fpidx = index - PT_FPR0;
 
@@ -79,6 +80,7 @@ long arch_ptrace(struct task_struct *child, long request,
 				       sizeof(long));
 			else
 				tmp = child->thread.fp_state.fpscr;
+#endif
 		}
 		ret = put_user(tmp, datalp);
 		break;
@@ -103,6 +105,7 @@ long arch_ptrace(struct task_struct *child, long request,
 		CHECK_FULL_REGS(child->thread.regs);
 		if (index < PT_FPR0) {
 			ret = ptrace_put_reg(child, index, data);
+#ifdef CONFIG_PPC_FPU_REGS
 		} else {
 			unsigned int fpidx = index - PT_FPR0;
 
@@ -113,6 +116,7 @@ long arch_ptrace(struct task_struct *child, long request,
 			else
 				child->thread.fp_state.fpscr = data;
 			ret = 0;
+#endif
 		}
 		break;
 	}
diff --git a/arch/powerpc/kernel/signal.c b/arch/powerpc/kernel/signal.c
index d15a98c758b8..18dcbf538f8f 100644
--- a/arch/powerpc/kernel/signal.c
+++ b/arch/powerpc/kernel/signal.c
@@ -133,7 +133,7 @@ unsigned long copy_ckvsx_from_user(struct task_struct *task,
 	return 0;
 }
 #endif /* CONFIG_PPC_TRANSACTIONAL_MEM */
-#else
+#elif defined(CONFIG_PPC_FPU_REGS)
 inline unsigned long copy_fpr_to_user(void __user *to,
 				      struct task_struct *task)
 {
@@ -163,6 +163,16 @@ inline unsigned long copy_ckfpr_from_user(struct task_struct *task,
 				ELF_NFPREG * sizeof(double));
 }
 #endif /* CONFIG_PPC_TRANSACTIONAL_MEM */
+#else
+inline unsigned long copy_fpr_to_user(void __user *to, struct task_struct *task)
+{
+	return 0;
+}
+
+inline unsigned long copy_fpr_from_user(struct task_struct *task, void __user *from)
+{
+	return 0;
+}
 #endif
 
 /* Log an error when sending an unhandled signal to a process. Controlled
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c
index 96950f189b5a..7b291707eb31 100644
--- a/arch/powerpc/kernel/signal_32.c
+++ b/arch/powerpc/kernel/signal_32.c
@@ -814,7 +814,9 @@ int handle_rt_signal32(struct ksignal *ksig, sigset_t *oldset,
 	}
 	regs->link = tramp;
 
+#ifdef CONFIG_PPC_FPU_REGS
 	tsk->thread.fp_state.fpscr = 0;	/* turn off all fp exceptions */
+#endif
 
 	/* create a stack frame for the caller of the handler */
 	newsp = ((unsigned long)rt_sf) - (__SIGNAL_FRAMESIZE + 16);
@@ -1271,7 +1273,9 @@ int handle_signal32(struct ksignal *ksig, sigset_t *oldset,
 
 	regs->link = tramp;
 
+#ifdef CONFIG_PPC_FPU_REGS
 	tsk->thread.fp_state.fpscr = 0;	/* turn off all fp exceptions */
+#endif
 
 	/* create a stack frame for the caller of the handler */
 	newsp = ((unsigned long)frame) - __SIGNAL_FRAMESIZE;
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index d1ebe152f210..ee9ec61e75b7 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -1188,6 +1188,7 @@ static inline int __parse_fpscr(unsigned long fpscr)
 	return ret;
 }
 
+#ifdef CONFIG_PPC_FPU
 static void parse_fpe(struct pt_regs *regs)
 {
 	int code = 0;
@@ -1198,6 +1199,7 @@ static void parse_fpe(struct pt_regs *regs)
 
 	_exception(SIGFPE, regs, code, regs->nip);
 }
+#endif
 
 /*
  * Illegal instruction emulation support.  Originally written to
@@ -1477,11 +1479,13 @@ void program_check_exception(struct pt_regs *regs)
 	/* We can now get here via a FP Unavailable exception if the core
 	 * has no FPU, in that case the reason flags will be 0 */
 
+#ifdef CONFIG_PPC_FPU
 	if (reason & REASON_FP) {
 		/* IEEE FP exception */
 		parse_fpe(regs);
 		goto bail;
 	}
+#endif
 	if (reason & REASON_TRAP) {
 		unsigned long bugaddr;
 		/* Debugger is first in line to stop recursive faults in
diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
index 87737ec86d39..40ffcdba42b8 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -225,9 +225,13 @@ config PPC_E500MC
 	  such as e5500/e6500), and must be disabled for running on
 	  e500v1 or e500v2.
 
+config PPC_FPU_REGS
+	bool
+
 config PPC_FPU
 	bool
 	default y if PPC64
+	select PPC_FPU_REGS
 
 config FSL_EMB_PERFMON
 	bool "Freescale Embedded Perfmon"
-- 
2.25.0


^ permalink raw reply related

* Re: [PATCH] powerpc:entry_32: correct the path and function name in the comment
From: Christophe Leroy @ 2020-08-07 14:31 UTC (permalink / raw)
  To: chenzefeng, mpe, benh, paulus, christophe.leroy, tglx, bigeasy,
	npiggin
  Cc: linuxppc-dev, linux-kernel, zengweilin
In-Reply-To: <20200807101956.67454-1-chenzefeng2@huawei.com>



Le 07/08/2020 à 12:19, chenzefeng a écrit :
> Update the comment for file's directory and function name changed.
> 
> Fixes: facd04a904ff ("powerpc: convert to copy_thread_tls")
> Fixes: 14cf11af6cf6 ("powerpc: Merge enough to start building in arch/powerpc.")
> 
> Signed-off-by: chenzefeng <chenzefeng2@huawei.com>
> ---
>   arch/powerpc/kernel/entry_32.S | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
> index 8420abd4ea1c..9937593d3a33 100644
> --- a/arch/powerpc/kernel/entry_32.S
> +++ b/arch/powerpc/kernel/entry_32.S
> @@ -696,8 +696,8 @@ handle_dabr_fault:
>    * to the "_switch" path.  If you change this , you'll have to
>    * change the fork code also.
>    *
> - * The code which creates the new task context is in 'copy_thread'
> - * in arch/ppc/kernel/process.c
> + * The code which creates the new task context is in 'copy_thread_tls'
> + * in arch/powerpc/kernel/process.c

Does it matters at all where the function is ? I'm sure people can find 
it themselves.

Christophe

>    */
>   _GLOBAL(_switch)
>   	stwu	r1,-INT_FRAME_SIZE(r1)
> 

^ permalink raw reply

* [Latest Git kernel/Linux-next kernel] Xorg doesn't start after the seccomp updates v5.9-rc1
From: Christian Zigotzky @ 2020-08-07 14:45 UTC (permalink / raw)
  To: linuxppc-dev, keescook, Linux Kernel Mailing List, R.T.Dickinson,
	Darren Stevens, mad skateman

Hello,

Xorg doesn't start with the latest Git kernel anymore on some Linux 
distributions after the seccomp updates v5.9-rc1 [1]. For example on 
Fienix (Debian Sid PowerPC 32-bit) and on ubuntu MATE 16.04.6 (PowerPC 
32-bit). I tested these distributions on the A-EON AmigaOne X1000 [2], 
A-EON AmigaOne X5000 [3], and in a virtual e5500 QEMU machine with a 
virtio_gpu.

Error messages:

systemd-journald[2238]: Failed to send WATCHDOG-1 notification message: 
Connection refused
systemd-journald[2238]: Failed to send WATCHDOG-1 notification message: 
Transport endpoint is not connected
systemd-journald[2238]: Failed to send WATCHDOG-1 notification message: 
Transport endpoint is not connected
systemd-journald[2238]: Failed to send WATCHDOG-1 notification message: 
Transport endpoint is not connected
systemd-journald[2238]: Failed to send WATCHDOG-1 notification message: 
Transport endpoint is not connected
systemd-journald[2238]: Failed to send WATCHDOG-1 notification message: 
Transport endpoint is not connected

---

But Xorg works on Ubuntu 10.04.4 (PowerPC 32-bit), openSUSE Tumbleweed 
20190722 PPC64 and on Fedora 27 PPC64 with the latest Git kernel.

I bisected today [4].

Result: net/scm: Regularize compat handling of scm_detach_fds() 
(c0029de50982c1fb215330a5f9d433cec0cfd8cc) [5] is the first bad commit.

This commit has been merged with the seccomp updates v5.9-rc1 on 
2020-08-04 14:11:08 -0700 [1]. Since these updates, Xorg doesn't start 
anymore on some Linux distributions.

Unfortunately I wasn't able to revert the first bad commit. The first 
bad commit depends on many other commits, which unfortunately I don't 
know. I tried to remove the modifications of the files from the first 
bad commit but without any success. There are just too many dependencies.

Additionally I compiled a linux-next kernel because of the issue with 
the lastest Git kernel. Unfortunately this kernel doesn't boot. It can't 
initialize the graphics card.

Could you please test Xorg with the latest Git kernel on some Linux 
distributions?

Thanks,
Christian


[1] 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=9ecc6ea491f0c0531ad81ef9466284df260b2227
[2] https://en.wikipedia.org/wiki/AmigaOne_X1000
[3] http://wiki.amiga.org/index.php?title=X5000
[4] https://forum.hyperion-entertainment.com/viewtopic.php?p=51317#p51317
[5] 
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c0029de50982c1fb215330a5f9d433cec0cfd8cc



^ permalink raw reply

* [PATCH] powerpc:entry_32: correct the path and function name in the comment
From: chenzefeng @ 2020-08-07 10:19 UTC (permalink / raw)
  To: mpe, benh, paulus, christophe.leroy, tglx, chenzefeng2, bigeasy,
	npiggin
  Cc: linuxppc-dev, linux-kernel, zengweilin

Update the comment for file's directory and function name changed.

Fixes: facd04a904ff ("powerpc: convert to copy_thread_tls")
Fixes: 14cf11af6cf6 ("powerpc: Merge enough to start building in arch/powerpc.")

Signed-off-by: chenzefeng <chenzefeng2@huawei.com>
---
 arch/powerpc/kernel/entry_32.S | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/kernel/entry_32.S b/arch/powerpc/kernel/entry_32.S
index 8420abd4ea1c..9937593d3a33 100644
--- a/arch/powerpc/kernel/entry_32.S
+++ b/arch/powerpc/kernel/entry_32.S
@@ -696,8 +696,8 @@ handle_dabr_fault:
  * to the "_switch" path.  If you change this , you'll have to
  * change the fork code also.
  *
- * The code which creates the new task context is in 'copy_thread'
- * in arch/ppc/kernel/process.c
+ * The code which creates the new task context is in 'copy_thread_tls'
+ * in arch/powerpc/kernel/process.c
  */
 _GLOBAL(_switch)
 	stwu	r1,-INT_FRAME_SIZE(r1)
-- 
2.12.3


^ permalink raw reply related

* [GIT PULL] Please pull powerpc/linux.git powerpc-5.9-1 tag
From: Michael Ellerman @ 2020-08-07 13:13 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: cascardo, desnesn, srikar, ego, aik, jniethe5, bin.meng, psampat,
	bala24, msuchanek, sathnaga, oohall, fthain, hch, linux-kernel,
	equinox, leobras.c, santosh, maddy, aneesh.kumar, nayna,
	yuehaibing, mahesh, peterz, anju, geert, weiyongjun1, alastair,
	harish, longman, naveen.n.rao, dyoung, vdronov, nathanl, miltonm,
	palmerdabbelt, ajd, arnd, lirongqing, sandipan, kjain, muriloo,
	npiggin, natechancellor, joe, chris.packham, vaibhav, felix,
	hbathini, christophe.leroy, atrajeev, wenxiong, sbobroff, rdunlap,
	gustavoars, sourabhjain, bharata, tj, miaoqinglang, jk,
	grandmaster, fbarrat, huntbag, kaloz, linuxppc-dev, ravi.bangoria,
	morbo

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Hi Linus,

Please pull powerpc updates for 5.9.

Just one minor conflict, in a comment in drivers/misc/ocxl/config.c.

Notable out of area changes:
  arch/m68k/include/asm/adb_iop.h	# c66da95a39ec macintosh/adb-iop: Implement SRQ autopolling
  drivers/md/dm-writecache.c		# 3e79f082ebfc libnvdimm/nvdimm/flush: Allow architecture to override the flush barrier
  drivers/nvdimm/region_devs.c
  include/asm-generic/barrier.h
  drivers/nvdimm/of_pmem.c		# 8c26ab72663b powerpc/pmem: Initialize pmem device on newer hardware
  include/asm-generic/qspinlock.h	# 20c0e8269e9d powerpc/pseries: Implement paravirt qspinlocks for SPLPAR
  include/linux/cpuhotplug.h		# 1a8f0886a600 powerpc/perf/hv-24x7: Add cpu hotplug support
  include/linux/kexec.h			# f891f19736bd kexec_file: Allow archs to handle special regions while locating memory hole
  kernel/kexec_file.c
  include/trace/events/mmflags.h	# 5c9fa16e8abd powerpc/64s: Remove PROT_SAO support
  include/linux/mm.h
  mm/ksm.c

cheers


The following changes since commit 48778464bb7d346b47157d21ffde2af6b2d39110:

  Linux 5.8-rc2 (2020-06-21 15:45:29 -0700)

are available in the git repository at:

  https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git tags/powerpc-5.9-1

for you to fetch changes up to a7aaa2f26bfd932a654706b19859e7adf802bee2:

  selftests/powerpc: Fix pkey syscall redefinitions (2020-08-05 10:14:03 +1000)


- ------------------------------------------------------------------
powerpc updates for 5.9

 - Add support for (optionally) using queued spinlocks & rwlocks.

 - Support for a new faster system call ABI using the scv instruction on Power9
   or later.

 - Drop support for the PROT_SAO mmap/mprotect flag as it will be unsupported on
   Power10 and future processors, leaving us with no way to implement the
   functionality it requests. This risks breaking userspace, though we believe
   it is unused in practice.

 - A bug fix for, and then the removal of, our custom stack expansion checking.
   We now allow stack expansion up to the rlimit, like other architectures.

 - Remove the remnants of our (previously disabled) topology update code, which
   tried to react to NUMA layout changes on virtualised systems, but was prone
   to crashes and other problems.

 - Add PMU support for Power10 CPUs.

 - A change to our signal trampoline so that we don't unbalance the link stack
   (branch return predictor) in the signal delivery path.

 - Lots of other cleanups, refactorings, smaller features and so on as usual.

Thanks to:
  Abhishek Goel, Alastair D'Silva, Alexander A. Klimov, Alexey Kardashevskiy,
  Alistair Popple, Andrew Donnellan, Aneesh Kumar K.V, Anju T Sudhakar, Anton
  Blanchard, Arnd Bergmann, Athira Rajeev, Balamuruhan S, Bharata B Rao, Bill
  Wendling, Bin Meng, Cédric Le Goater, Chris Packham, Christophe Leroy,
  Christoph Hellwig, Daniel Axtens, Dan Williams, David Lamparter, Desnes A.
  Nunes do Rosario, Erhard F., Finn Thain, Frederic Barrat, Ganesh Goudar,
  Gautham R. Shenoy, Geoff Levand, Greg Kurz, Gustavo A. R. Silva, Hari Bathini,
  Harish, Imre Kaloz, Joel Stanley, Joe Perches, John Crispin, Jordan Niethe,
  Kajol Jain, Kamalesh Babulal, Kees Cook, Laurent Dufour, Leonardo Bras, Li
  RongQing, Madhavan Srinivasan, Mahesh Salgaonkar, Mark Cave-Ayland, Michal
  Suchanek, Milton Miller, Mimi Zohar, Murilo Opsfelder Araujo, Nathan
  Chancellor, Nathan Lynch, Naveen N. Rao, Nayna Jain, Nicholas Piggin, Oliver
  O'Halloran, Palmer Dabbelt, Pedro Miraglia Franco de Carvalho, Philippe
  Bergheaud, Pingfan Liu, Pratik Rajesh Sampat, Qian Cai, Qinglang Miao, Randy
  Dunlap, Ravi Bangoria, Sachin Sant, Sam Bobroff, Sandipan Das, Santosh
  Sivaraj, Satheesh Rajendran, Shirisha Ganta, Sourabh Jain, Srikar Dronamraju,
  Stan Johnson, Stephen Rothwell, Thadeu Lima de Souza Cascardo, Thiago Jung
  Bauermann, Tom Lane, Vaibhav Jain, Vladis Dronov, Wei Yongjun, Wen Xiong,
  YueHaibing.

- ------------------------------------------------------------------
Abhishek Goel (1):
      cpuidle/powernv : Remove dead code block

Alastair D'Silva (2):
      ocxl: Remove unnecessary externs
      ocxl: Address kernel doc errors & warnings

Alexander A. Klimov (5):
      ocxl: Replace HTTP links with HTTPS ones
      powerpc/Kconfig: Replace HTTP links with HTTPS ones
      powerpc: Replace HTTP links with HTTPS ones
      macintosh/adb: Replace HTTP links with HTTPS ones
      macintosh/therm_adt746x: Replace HTTP links with HTTPS ones

Alexey Kardashevskiy (2):
      powerpc/xive: Ignore kmemleak false positives
      powerpc/powernv/ioda: Return correct error if TCE level allocation failed

Aneesh Kumar K.V (37):
      powerpc/mm/book3s64: Skip 16G page reservation with radix
      powerpc/pmem: Restrict papr_scm to P8 and above.
      powerpc/pmem: Add new instructions for persistent storage and sync
      powerpc/pmem: Add flush routines using new pmem store and sync instruction
      libnvdimm/nvdimm/flush: Allow architecture to override the flush barrier
      powerpc/pmem: Update ppc64 to use the new barrier instruction.
      powerpc/pmem: Avoid the barrier in flush routines
      powerpc/pmem: Initialize pmem device on newer hardware
      powerpc/mm/radix: Fix PTE/PMD fragment count for early page table mappings
      powerpc/mm/radix: Create separate mappings for hot-plugged memory
      powerpc/book3s64/pkeys: Use PVR check instead of cpu feature
      powerpc/book3s64/pkeys: Fixup bit numbering
      powerpc/book3s64/pkeys: pkeys are supported only on hash on book3s.
      powerpc/book3s64/pkeys: Move pkey related bits in the linux page table
      powerpc/book3s64/pkeys: Explain key 1 reservation details
      powerpc/book3s64/pkeys: Simplify the key initialization
      powerpc/book3s64/pkeys: Prevent key 1 modification from userspace.
      powerpc/book3s64/pkeys: kill cpu feature key CPU_FTR_PKEY
      powerpc/book3s64/pkeys: Simplify pkey disable branch
      powerpc/book3s64/pkeys: Convert pkey_total to num_pkey
      powerpc/book3s64/pkeys: Make initial_allocation_mask static
      powerpc/book3s64/pkeys: Mark all the pkeys above max pkey as reserved
      powerpc/book3s64/pkeys: Add MMU_FTR_PKEY
      powerpc/book3s64/kuep: Add MMU_FTR_KUEP
      powerpc/book3s64/pkeys: Use pkey_execute_disable_supported
      powerpc/book3s64/pkeys: Use MMU_FTR_PKEY instead of pkey_disabled static key
      powerpc/book3s64/keys: Print information during boot.
      powerpc/book3s64/keys/kuap: Reset AMR/IAMR values on kexec
      powerpc/book3s64/kuap: Move UAMOR setup to key init function
      selftests/powerpc: ptrace-pkey: Rename variables to make it easier to follow code
      selftests/powerpc: ptrace-pkey: Update the test to mark an invalid pkey correctly
      selftests/powerpc: ptrace-pkey: Don't update expected UAMOR value
      powerpc/book3s64/pkeys: Remove is_pkey_enabled()
      powerpc/book3s64/pkey: Disable pkey on POWER6 and before
      powerpc/hugetlb/cma: Allocate gigantic hugetlb pages using CMA
      powerpc/kvm/cma: Improve kernel log during boot
      powerpc/book3s64/radix: Add kernel command line option to disable radix GTSE

Anju T Sudhakar (1):
      powerpc/perf: Add kernel support for new MSR[HV PR] bits in trace-imc

Anton Blanchard (4):
      powerpc/xmon: Reset RCU and soft lockup watchdogs
      powerpc: Add cputime_to_nsecs()
      pseries: Fix 64 bit logical memory block panic
      powerpc/configs: Add BLK_DEV_NVME to pseries_defconfig

Arnd Bergmann (1):
      powerpc/spufs: add CONFIG_COREDUMP dependency

Athira Rajeev (10):
      powerpc/perf: Update cpu_hw_event to use `struct` for storing MMCR registers
      KVM: PPC: Book3S HV: Cleanup updates for kvm vcpu MMCR
      powerpc/perf: Update Power PMU cache_events to u64 type
      KVM: PPC: Book3S HV: Save/restore new PMU registers
      powerpc/perf: power10 Performance Monitoring support
      powerpc/perf: Ignore the BHRB kernel address filtering for P10
      powerpc/perf: Add Power10 BHRB filter support for PERF_SAMPLE_BRANCH_IND_CALL/COND
      powerpc/perf: BHRB control to disable BHRB logic when not used
      powerpc/perf: Initialize power10 PMU registers in cpu setup routine
      powerpc/perf: Fix MMCRA_BHRB_DISABLE define for binutils < 2.28

Balamuruhan S (14):
      powerpc/ppc-opcode: Introduce PPC_RAW_* macros for base instruction encoding
      powerpc/ppc-opcode: Move ppc instruction encoding from test_emulate_step
      powerpc/bpf_jit: Reuse instruction macros from ppc-opcode.h
      powerpc/ppc-opcode: Consolidate powerpc instructions from bpf_jit.h
      powerpc/ppc-opcode: Reuse raw instruction macros to stringify
      powerpc/ppc-opcode: Fold PPC_INST_* macros into PPC_RAW_* macros
      powerpc/test_emulate_step: Enhancement to test negative scenarios
      powerpc/test_emulate_step: Add negative tests for prefixed addi
      powerpc/sstep: Introduce macros to retrieve Prefix instruction operands
      powerpc/test_emulate_step: Move extern declaration to sstep.h
      powerpc/xmon: Use `dcbf` inplace of `dcbi` instruction for 64bit Book3S
      powerpc/ppc-opcode: Add divde and divdeu opcodes
      powerpc/sstep: Add support for divde[.] and divdeu[.] instructions
      powerpc/test_emulate_step: Add testcases for divde[.] and divdeu[.] instructions

Bharata B Rao (5):
      powerpc/mm: Enable radix GTSE only if supported.
      powerpc/pseries: H_REGISTER_PROC_TBL should ask for GTSE only if enabled
      powerpc/mm/radix: Free PUD table when freeing pagetable
      powerpc/mm/radix: Remove split_kernel_mapping()
      powerpc/mm: Limit resize_hpt_for_hotplug() call to hash guests only

Bill Wendling (1):
      powerpc/64s: allow for clang's objdump differences

Bin Meng (1):
      powerpc: Drop CONFIG_MTD_M25P80 in 85xx-hw.config

Chris Packham (2):
      powerpc: Remove inaccessible CMDLINE default
      powerpc/configs: Remove CMDLINE_BOOL

Christoph Hellwig (1):
      powerpc/spufs: Fix the type of ret in spufs_arch_write_note

Christophe Leroy (18):
      powerpc/ptdump: Fix build failure in hashpagetable.c
      powerpc/fixmap: Fix FIX_EARLY_DEBUG_BASE when page size is 256k
      powerpc/8xx: Modify ptep_get()
      docs: powerpc: Clarify book3s/32 MMU families
      Revert "powerpc/kasan: Fix shadow pages allocation failure"
      powerpc/kasan: Fix shadow pages allocation failure
      powerpc/signal_32: Remove !FULL_REGS() special handling in PPC64 save_general_regs()
      powerpc/signal_32: Simplify loop in PPC64 save_general_regs()
      powerpc/signal64: Don't opencode page prefaulting
      powerpc/vdso64: Switch from __get_datapage() to get_datapage inline macro
      powerpc/lib: Prepare code-patching for modules allocated outside vmalloc space
      powerpc: Use MODULES_VADDR if defined
      powerpc/32s: Only leave NX unset on segments used for modules
      powerpc/32: Set user/kernel boundary at TASK_SIZE instead of PAGE_OFFSET
      powerpc/32s: Kernel space starts at TASK_SIZE
      powerpc/32s: Use dedicated segment for modules with STRICT_KERNEL_RWX
      powerpc/ptdump: Refactor update of st->last_pa
      powerpc/ptdump: Refactor update of pg_state

David Lamparter (1):
      powerpc/fsl/dts: add missing P4080DS I2C devices

Desnes A. Nunes do Rosario (1):
      selftests/powerpc: Purge extra count_pmc() calls of ebb selftests

Finn Thain (17):
      macintosh/adb-iop: Remove dead and redundant code
      macintosh/adb-iop: Correct comment text
      macintosh/adb-iop: Adopt bus reset algorithm from via-macii driver
      macintosh/adb-iop: Access current_req and adb_iop_state when inside lock
      macintosh/adb-iop: Resolve static checker warnings
      macintosh/adb-iop: Implement idle -> sending state transition
      macintosh/adb-iop: Implement sending -> idle state transition
      macintosh/adb-iop: Implement SRQ autopolling
      macintosh/via-macii: Access autopoll_devs when inside lock
      macintosh/via-macii: Poll the device most likely to respond
      macintosh/via-macii: Handle /CTLR_IRQ signal correctly
      macintosh/via-macii: Remove read_done state
      macintosh/via-macii: Handle poll replies correctly
      macintosh/via-macii: Use bool type for reading_reply variable
      macintosh/via-macii: Use unsigned type for autopoll_devs variable
      macintosh/via-macii: Use the stack for reset request storage
      macintosh/via-macii: Clarify definition of macii_init()

Gautham R. Shenoy (3):
      cpuidle: pseries: Set the latency-hint before entering CEDE
      cpuidle: pseries: Add function to parse extended CEDE records
      cpuidle: pseries: Fixup exit latency for CEDE(0)

Gustavo A. R. Silva (1):
      powerpc: Use fallthrough pseudo-keyword

Hari Bathini (11):
      kexec_file: Allow archs to handle special regions while locating memory hole
      powerpc/kexec_file: Mark PPC64 specific code
      powerpc/kexec_file: Add helper functions for getting memory ranges
      powerpc/kexec_file: Avoid stomping memory used by special regions
      powerpc/drmem: Make LMB walk a bit more flexible
      powerpc/kexec_file: Restrict memory usage of kdump kernel
      powerpc/kexec_file: Setup backup region for kdump kernel
      powerpc/kexec_file: Prepare elfcore header for crashing kernel
      powerpc/kexec_file: Add appropriate regions for memory reserve map
      powerpc/kexec_file: Fix kexec load failure with lack of memory hole
      powerpc/kexec_file: Enable early kernel OPAL calls

Harish (1):
      selftests/powerpc: Fix CPU affinity for child process

Imre Kaloz (1):
      powerpc/4xx: ppc4xx compile flag optimizations

Joe Perches (1):
      powerpc/mm: Fix typo in IS_ENABLED()

Jordan Niethe (9):
      selftests/powerpc: Allow choice of CI memory location in alignment_handler test
      selftests/powerpc: Add prefixed loads/stores to alignment_handler test
      powerpc/sstep: Add tests for prefixed integer load/stores
      powerpc/sstep: Add tests for prefixed floating-point load/stores
      powerpc/sstep: Set NIP in instruction emulation tests
      powerpc/sstep: Let compute tests specify a required cpu feature
      powerpc/sstep: Add tests for Prefixed Add Immediate
      powerpc: Add a ppc_inst_as_str() helper
      powerpc/xmon: Improve dumping prefixed instructions

Kajol Jain (2):
      powerpc/perf/hv-24x7: Add cpu hotplug support
      powerpc/hv-24x7: Add sysfs files inside hv-24x7 device to show cpumask

Leonardo Bras (1):
      KVM: PPC: Fix typo on H_DISABLE_AND_GET hcall

Li RongQing (1):
      powerpc/lib: remove memcpy_flushcache redundant return

Madhavan Srinivasan (4):
      powerpc/perf: Fix missing is_sier_aviable() during build
      powerpc/perf: Add support for ISA3.1 PMU SPRs
      powerpc/xmon: Add PowerISA v3.1 PMU SPRs
      powerpc/perf: Add Power10 PMU feature to DT CPU features

Mahesh Salgaonkar (1):
      powerpc/64s: Move HMI IRQ stat from percpu variable to paca.

Michael Ellerman (26):
      powerpc/boot/dts: Fix dtc "pciex" warnings
      Merge branch 'fixes' into next
      selftests/powerpc: Run per_event_excludes test on Power8 or later
      powerpc/spufs: Rework fcheck() usage
      selftests/powerpc: Add test of memcmp at end of page
      Merge branch 'scv' support into next
      powerpc/test_emulate_sstep: Fix build error
      powerpc/sstep: Fix incorrect CONFIG symbol in scv handling
      powerpc/fadump: Fix build error with CONFIG_PRESERVE_FA_DUMP=y
      selftests/powerpc: Add test of stack expansion logic
      powerpc: Allow 4224 bytes of stack expansion for the signal frame
      selftests/powerpc: Update the stack expansion test
      powerpc/mm: Remove custom stack expansion checking
      selftests/powerpc: Remove powerpc special cases from stack expansion test
      powerpc/configs: Drop old symbols from ppc6xx_defconfig
      powerpc/configs: Remove dead symbols
      powerpc/52xx: Fix comment about CONFIG_BDI*
      powerpc/64e: Drop dead BOOK3E_MMU_TLB_STATS code
      powerpc/32s: Fix CONFIG_BOOK3S_601 uses
      powerpc/32s: Remove TAUException wart in traps.c
      powerpc/boot: Fix CONFIG_PPC_MPC52XX references
      powerpc/kvm: Use correct CONFIG symbol in comment
      powerpc: Drop old comment about CONFIG_POWER
      powerpc/40x: Fix assembler warning about r0
      selftests/powerpc: Skip vmx/vsx/tar/etc tests on older CPUs
      powerpc: Fix circular dependency between percpu.h and mmu.h

Michal Suchanek (1):
      powerpc/perf: Consolidate perf_callchain_user_[64|32]()

Milton Miller (1):
      powerpc/vdso: Fix vdso cpu truncation

Murilo Opsfelder Araujo (3):
      powerpc/dt_cpu_ftrs: Remove unused macro ISA_V2_07B
      powerpc/dt_cpu_ftrs: Make use of macro ISA_V3_0B
      powerpc/dt_cpu_ftrs: Make use of macro ISA_V3_1

Nathan Chancellor (1):
      powerpc/boot: Use address-of operator on section symbols

Nathan Lynch (25):
      powerpc/pseries: remove cede offline state for CPUs
      powerpc/rtas: don't online CPUs for partition suspend
      powerpc/numa: remove ability to enable topology updates
      powerpc/numa: remove unreachable topology update code
      powerpc/numa: make vphn_enabled, prrn_enabled flags const
      powerpc/numa: remove unreachable topology timer code
      powerpc/numa: remove unreachable topology workqueue code
      powerpc/numa: remove vphn_enabled and prrn_enabled internal flags
      powerpc/numa: stub out numa_update_cpu_topology()
      powerpc/numa: remove timed_topology_update()
      powerpc/numa: remove start/stop_topology_update()
      powerpc/rtasd: simplify handle_rtas_event(), emit message on events
      powerpc/numa: remove prrn_is_enabled()
      powerpc/numa: remove arch_update_cpu_topology
      powerpc/pseries: remove prrn special case from DT update path
      powerpc/pseries: remove memory "re-add" implementation
      powerpc/pseries: remove dlpar_cpu_readd()
      powerpc/pseries: remove obsolete memory hotplug DT notifier code
      powerpc/cacheinfo: Set pr_fmt()
      powerpc/cacheinfo: Use name@unit instead of full DT path in debug messages
      powerpc/cacheinfo: Improve diagnostics about malformed cache lists
      powerpc/cacheinfo: Warn if cache object chain becomes unordered
      powerpc/pseries/mobility: Set pr_fmt()
      powerpc/pseries/mobility: Add pr_debug() for device tree changes
      powerpc/pseries/hotplug-cpu: Remove double free in error path

Nayna Jain (1):
      powerpc/pseries: Detect secure and trusted boot state of the system.

Nicholas Piggin (31):
      powerpc/64: indirect function call use bctrl rather than blrl in ret_from_kernel_thread
      powerpc/64/signal: Balance return predictor stack in signal trampoline
      selftests/powerpc: Add FPU denormal test
      powerpc/mm/book3s64/radix: Off-load TLB invalidations to host when !GTSE
      powerpc/64s: restore_math remove TM test
      powerpc/64s: Fix restore_math unnecessarily changing MSR
      powerpc: re-initialise lazy FPU/VEC counters on every fault
      powerpc/security: re-name count cache flush to branch cache flush
      powerpc/security: change link stack flush state to the flush type enum
      powerpc/security: make display of branch cache flush more consistent
      powerpc/security: split branch cache flush toggle from code patching
      powerpc/64s: Move branch cache flushing bcctr variant to ppc-ops.h
      powerpc/security: Allow for processors that flush the link stack using the special bcctr
      powerpc/prom: Enable Radix GTSE in cpu pa-features
      powerpc: Remove stale calc_vm_prot_bits() comment
      powerpc/64s: Remove PROT_SAO support
      powerpc/64s/hash: Disable subpage_prot syscall by default
      powerpc/64s/exception: treat NIA below __end_interrupts as soft-masked
      powerpc/64s: system call support for scv/rfscv instructions
      powerpc: Select ARCH_HAS_MEMBARRIER_SYNC_CORE
      powerpc/powernv: Machine check handler for POWER10
      powerpc/pseries: Move some PAPR paravirt functions to their own file
      powerpc: Move spinlock implementation to simple_spinlock
      powerpc/64s: Implement queued spinlocks and rwlocks
      powerpc/pseries: Implement paravirt qspinlocks for SPLPAR
      powerpc/qspinlock: Optimised atomic_try_cmpxchg_lock() that adds the lock hint
      powerpc: Implement smp_cond_load_relaxed()
      powerpc: Inline doorbell sending functions
      powerpc/pseries: Use doorbells even if XIVE is available
      powerpc/pseries: Add KVM guest doorbell restrictions
      powerpc/build: vdso linker warning for orphan sections

Oliver O'Halloran (34):
      powerpc/powernv: Make pnv_pci_sriov_enable() and friends static
      powerpc/powernv: Move pnv_ioda_setup_bus_dma under CONFIG_IOMMU_API
      powerpc/eeh: Remove eeh_dev_phb_init_dynamic()
      powerpc/eeh: Remove eeh_dev.c
      powerpc/eeh: Move vf_index out of pci_dn and into eeh_dev
      powerpc/pseries: Stop using pdn->pe_number
      powerpc/eeh: Kill off eeh_ops->get_pe_addr()
      powerpc/eeh: Remove VF config space restoration
      powerpc/eeh: Pass eeh_dev to eeh_ops->restore_config()
      powerpc/eeh: Pass eeh_dev to eeh_ops->resume_notify()
      powerpc/eeh: Pass eeh_dev to eeh_ops->{read|write}_config()
      powerpc/eeh: Remove spurious use of pci_dn in eeh_dump_dev_log
      powerpc/eeh: Remove class code field from edev
      powerpc/eeh: Rename eeh_{add_to|remove_from}_parent_pe()
      powerpc/eeh: Drop pdn use in eeh_pe_tree_insert()
      powerpc/eeh: Move PE tree setup into the platform
      powerpc/powernv/pci: Add pci_bus_to_pnvhb() helper
      powerpc/powernv/pci: Always tear down DMA windows on PE release
      powerpc/powernv/pci: Add explicit tracking of the DMA setup state
      powerpc/powernv/pci: Initialise M64 for IODA1 as a 1-1 window
      powerpc/powernv/sriov: Move SR-IOV into a separate file
      powerpc/powernv/sriov: Explain how SR-IOV works on PowerNV
      powerpc/powernv/sriov: Rename truncate_iov
      powerpc/powernv/sriov: Simplify used window tracking
      powerpc/powernv/sriov: Factor out M64 BAR setup
      powerpc/powernv/pci: Refactor pnv_ioda_alloc_pe()
      powerpc/powernv/sriov: Drop iov->pe_num_map[]
      powerpc/powernv/sriov: De-indent setup and teardown
      powerpc/powernv/sriov: Move M64 BAR allocation into a helper
      powerpc/powernv/sriov: Refactor M64 BAR setup
      powerpc/powernv/sriov: Make single PE mode a per-BAR setting
      powerpc/powernv/sriov: Remove vfs_expanded
      selftests/powerpc: Squash spurious errors due to device removal
      powerpc/powernv/sriov: Fix use of uninitialised variable

Palmer Dabbelt (1):
      powerpc/64: Fix an out of date comment about MMIO ordering

Philippe Bergheaud (1):
      ocxl: control via sysfs whether the FPGA is reloaded on a link reset

Pratik Rajesh Sampat (3):
      powerpc/powernv/idle: Replace CPU feature check with PVR check
      powerpc/powernv/idle: Rename pnv_first_spr_loss_level variable
      powerpc/powernv/idle: Exclude mfspr on HID1, 4, 5 on P9 and above

Qinglang Miao (1):
      powerpc: use for_each_child_of_node() macro

Randy Dunlap (9):
      powerpc/book3s/mmu-hash.h: delete duplicated word
      powerpc/book3s/radix-4k.h: delete duplicated word
      powerpc/cputime.h: delete duplicated word
      powerpc/epapr_hcalls.h: delete duplicated words
      powerpc/hw_breakpoint.h: delete duplicated word
      powerpc/ppc_asm.h: delete duplicated word
      powerpc/reg.h: delete duplicated word
      powerpc/smu.h: delete duplicated word
      powerpc/powernv/pci.h: delete duplicated word

Ravi Bangoria (10):
      powerpc/watchpoint: Fix 512 byte boundary limit
      powerpc/watchpoint: Fix DAWR exception constraint
      powerpc/watchpoint: Fix DAWR exception for CACHEOP
      powerpc/watchpoint: Enable watchpoint functionality on power10 guest
      powerpc/dt_cpu_ftrs: Add feature for 2nd DAWR
      powerpc/watchpoint: Set CPU_FTR_DAWR1 based on pa-features bit
      powerpc/watchpoint: Rename current H_SET_MODE DAWR macro
      powerpc/watchpoint: Guest support for 2nd DAWR hcall
      powerpc/watchpoint: Return available watchpoints dynamically
      powerpc/watchpoint: Remove 512 byte boundary

Sam Bobroff (1):
      MAINTAINERS: Remove self from powerpc EEH

Sandipan Das (11):
      selftests/powerpc: Fix pkey access right updates
      selftests/powerpc: Move Hash MMU check to utilities
      selftests/powerpc: Add test for execute-disabled pkeys
      selftests/powerpc: Move pkey helpers to headers
      selftests/powerpc: Add pkey helpers for rights
      selftests/powerpc: Harden test for execute-disabled pkeys
      selftests/powerpc: Add helper to exit on failure
      selftests/powerpc: Add wrapper for gettid
      selftests/powerpc: Add test for pkey siginfo verification
      selftests/powerpc: Fix online CPU selection
      selftests/powerpc: Fix pkey syscall redefinitions

Santosh Sivaraj (3):
      powerpc/mce: Add MCE notification chain
      powerpc/papr/scm: Add bad memory ranges to nvdimm bad ranges
      powerpc/mm/hash64: Remove comment that is no longer valid

Satheesh Rajendran (1):
      powerpc/pseries/svm: Drop unused align argument in alloc_shared_lppaca() function

Sourabh Jain (1):
      powerpc/fadump: fix race between pstore write and fadump crash trigger

Srikar Dronamraju (4):
      powerpc/cacheinfo: Use cpumap_print to print cpumap
      powerpc/cacheinfo: Make cpumap_show code reusable
      powerpc/cacheinfo: Add per cpu per index shared_cpu_list
      powerpc/numa: Limit possible nodes to within num_possible_nodes

Thadeu Lima de Souza Cascardo (1):
      selftests/powerpc: Return skip code for spectre_v2

Vaibhav Jain (2):
      powerpc/papr_scm: Fetch nvdimm performance stats from PHYP
      powerpc/papr_scm: Add support for fetching nvdimm 'fuel-gauge' metric

Vladis Dronov (1):
      powerpc: fix function annotations to avoid section mismatch warnings with gcc-10

Wei Yongjun (3):
      cpuidle/pseries: Make symbol 'pseries_idle_driver' static
      powerpc/papr_scm: Make some symbols static
      powerpc/powernv/sriov: Remove unused but set variable 'phb'

Wen Xiong (1):
      powerpc/pseries: PCIE PHB reset

YueHaibing (2):
      powerpc/xive: Remove unused inline function xive_kexec_teardown_cpu()
      powerpc: Remove unneeded inline functions


 Documentation/ABI/testing/sysfs-bus-event_source-devices-hv_24x7    |    7 +
 Documentation/ABI/testing/sysfs-bus-papr-pmem                       |   27 +
 Documentation/ABI/testing/sysfs-class-ocxl                          |   11 +
 Documentation/admin-guide/kernel-parameters.txt                     |    4 +
 Documentation/core-api/cpu_hotplug.rst                              |    7 -
 Documentation/features/sched/membarrier-sync-core/arch-support.txt  |    4 +-
 Documentation/memory-barriers.txt                                   |   14 +
 Documentation/powerpc/cpu_families.rst                              |   10 +-
 Documentation/powerpc/mpc52xx.rst                                   |    2 +-
 Documentation/powerpc/syscall64-abi.rst                             |   42 +-
 Documentation/virt/kvm/api.rst                                      |    3 +
 MAINTAINERS                                                         |    1 -
 arch/m68k/include/asm/adb_iop.h                                     |    1 +
 arch/powerpc/Kconfig                                                |   30 +-
 arch/powerpc/Makefile                                               |    3 +-
 arch/powerpc/boot/Makefile                                          |    8 +-
 arch/powerpc/boot/dts/akebono.dts                                   |    8 +-
 arch/powerpc/boot/dts/bluestone.dts                                 |    2 +-
 arch/powerpc/boot/dts/canyonlands.dts                               |    4 +-
 arch/powerpc/boot/dts/currituck.dts                                 |    6 +-
 arch/powerpc/boot/dts/fsl/p4080ds.dts                               |   43 +-
 arch/powerpc/boot/dts/glacier.dts                                   |    4 +-
 arch/powerpc/boot/dts/haleakala.dts                                 |    2 +-
 arch/powerpc/boot/dts/icon.dts                                      |    4 +-
 arch/powerpc/boot/dts/katmai.dts                                    |    6 +-
 arch/powerpc/boot/dts/kilauea.dts                                   |    4 +-
 arch/powerpc/boot/dts/makalu.dts                                    |    4 +-
 arch/powerpc/boot/dts/redwood.dts                                   |    6 +-
 arch/powerpc/boot/main.c                                            |    4 +-
 arch/powerpc/boot/ps3.c                                             |    2 +-
 arch/powerpc/boot/serial.c                                          |    2 +-
 arch/powerpc/configs/44x/akebono_defconfig                          |    3 -
 arch/powerpc/configs/44x/arches_defconfig                           |    2 -
 arch/powerpc/configs/44x/bamboo_defconfig                           |    2 -
 arch/powerpc/configs/44x/bluestone_defconfig                        |    2 -
 arch/powerpc/configs/44x/canyonlands_defconfig                      |    2 -
 arch/powerpc/configs/44x/currituck_defconfig                        |    2 -
 arch/powerpc/configs/44x/eiger_defconfig                            |    2 -
 arch/powerpc/configs/44x/fsp2_defconfig                             |    1 -
 arch/powerpc/configs/44x/icon_defconfig                             |    2 -
 arch/powerpc/configs/44x/iss476-smp_defconfig                       |    1 -
 arch/powerpc/configs/44x/katmai_defconfig                           |    2 -
 arch/powerpc/configs/44x/rainier_defconfig                          |    2 -
 arch/powerpc/configs/44x/redwood_defconfig                          |    2 -
 arch/powerpc/configs/44x/sam440ep_defconfig                         |    2 -
 arch/powerpc/configs/44x/sequoia_defconfig                          |    2 -
 arch/powerpc/configs/44x/taishan_defconfig                          |    2 -
 arch/powerpc/configs/44x/warp_defconfig                             |    1 -
 arch/powerpc/configs/85xx-hw.config                                 |    1 -
 arch/powerpc/configs/85xx/xes_mpc85xx_defconfig                     |    3 -
 arch/powerpc/configs/86xx-hw.config                                 |    2 -
 arch/powerpc/configs/fsl-emb-nonhw.config                           |    1 -
 arch/powerpc/configs/g5_defconfig                                   |    1 -
 arch/powerpc/configs/holly_defconfig                                |    1 -
 arch/powerpc/configs/linkstation_defconfig                          |    1 -
 arch/powerpc/configs/mpc512x_defconfig                              |    1 -
 arch/powerpc/configs/mpc83xx_defconfig                              |    1 -
 arch/powerpc/configs/mvme5100_defconfig                             |    4 +-
 arch/powerpc/configs/pasemi_defconfig                               |    1 -
 arch/powerpc/configs/pmac32_defconfig                               |    8 -
 arch/powerpc/configs/powernv_defconfig                              |    2 -
 arch/powerpc/configs/ppc40x_defconfig                               |    3 -
 arch/powerpc/configs/ppc64_defconfig                                |    1 -
 arch/powerpc/configs/ppc6xx_defconfig                               |   39 -
 arch/powerpc/configs/ps3_defconfig                                  |    2 -
 arch/powerpc/configs/pseries_defconfig                              |    3 +-
 arch/powerpc/configs/skiroot_defconfig                              |    1 -
 arch/powerpc/configs/storcenter_defconfig                           |    1 -
 arch/powerpc/crypto/crc32-vpmsum_core.S                             |    2 +-
 arch/powerpc/include/asm/Kbuild                                     |    1 +
 arch/powerpc/include/asm/asm-prototypes.h                           |    6 +-
 arch/powerpc/include/asm/atomic.h                                   |   28 +
 arch/powerpc/include/asm/barrier.h                                  |   29 +
 arch/powerpc/include/asm/book3s/32/pgtable.h                        |   15 +-
 arch/powerpc/include/asm/book3s/64/hash-4k.h                        |   21 +-
 arch/powerpc/include/asm/book3s/64/hash-64k.h                       |   12 +-
 arch/powerpc/include/asm/book3s/64/hash-pkey.h                      |   32 +
 arch/powerpc/include/asm/book3s/64/kexec.h                          |   23 +
 arch/powerpc/include/asm/book3s/64/mmu-hash.h                       |   10 +-
 arch/powerpc/include/asm/book3s/64/mmu.h                            |   11 +
 arch/powerpc/include/asm/book3s/64/pgalloc.h                        |   16 +-
 arch/powerpc/include/asm/book3s/64/pgtable.h                        |   25 +-
 arch/powerpc/include/asm/book3s/64/pkeys.h                          |   27 +
 arch/powerpc/include/asm/book3s/64/radix-4k.h                       |    2 +-
 arch/powerpc/include/asm/book3s/64/tlbflush-radix.h                 |   15 +
 arch/powerpc/include/asm/cacheflush.h                               |    1 +
 arch/powerpc/include/asm/cputable.h                                 |   30 +-
 arch/powerpc/include/asm/cputime.h                                  |    4 +-
 arch/powerpc/include/asm/crashdump-ppc64.h                          |   19 +
 arch/powerpc/include/asm/dbell.h                                    |   64 +-
 arch/powerpc/include/asm/device.h                                   |    3 +
 arch/powerpc/include/asm/drmem.h                                    |    9 +-
 arch/powerpc/include/asm/eeh.h                                      |   26 +-
 arch/powerpc/include/asm/epapr_hcalls.h                             |    4 +-
 arch/powerpc/include/asm/exception-64e.h                            |   59 +-
 arch/powerpc/include/asm/exception-64s.h                            |   14 +
 arch/powerpc/include/asm/firmware.h                                 |   10 +-
 arch/powerpc/include/asm/fixmap.h                                   |    2 +-
 arch/powerpc/include/asm/hardirq.h                                  |    1 -
 arch/powerpc/include/asm/head-64.h                                  |    2 +-
 arch/powerpc/include/asm/hugetlb.h                                  |    7 +
 arch/powerpc/include/asm/hvcall.h                                   |   39 +-
 arch/powerpc/include/asm/hw_breakpoint.h                            |    6 +-
 arch/powerpc/include/asm/hydra.h                                    |    2 +-
 arch/powerpc/include/asm/imc-pmu.h                                  |    5 +
 arch/powerpc/include/asm/inst.h                                     |   19 +
 arch/powerpc/include/asm/kasan.h                                    |    2 +
 arch/powerpc/include/asm/kexec.h                                    |   41 +-
 arch/powerpc/include/asm/kexec_ranges.h                             |   25 +
 arch/powerpc/include/asm/kvm_book3s_asm.h                           |    2 +-
 arch/powerpc/include/asm/kvm_booke.h                                |    2 +
 arch/powerpc/include/asm/kvm_host.h                                 |    6 +-
 arch/powerpc/include/asm/kvm_para.h                                 |   26 +-
 arch/powerpc/include/asm/machdep.h                                  |    2 +-
 arch/powerpc/include/asm/mce.h                                      |    3 +
 arch/powerpc/include/asm/mman.h                                     |   30 +-
 arch/powerpc/include/asm/mmu.h                                      |   23 +
 arch/powerpc/include/asm/mmu_context.h                              |    2 -
 arch/powerpc/include/asm/nohash/32/pgtable.h                        |   22 +-
 arch/powerpc/include/asm/nohash/64/pgtable.h                        |    2 -
 arch/powerpc/include/asm/paca.h                                     |    1 +
 arch/powerpc/include/asm/page.h                                     |    4 +-
 arch/powerpc/include/asm/paravirt.h                                 |   87 ++
 arch/powerpc/include/asm/pci-bridge.h                               |    1 -
 arch/powerpc/include/asm/percpu.h                                   |    4 +-
 arch/powerpc/include/asm/perf_event.h                               |    2 +
 arch/powerpc/include/asm/perf_event_server.h                        |   14 +-
 arch/powerpc/include/asm/pkeys.h                                    |   65 +-
 arch/powerpc/include/asm/plpar_wrappers.h                           |   59 +-
 arch/powerpc/include/asm/pnv-ocxl.h                                 |   40 +-
 arch/powerpc/include/asm/ppc-opcode.h                               |  571 +++++-----
 arch/powerpc/include/asm/ppc_asm.h                                  |    4 +-
 arch/powerpc/include/asm/processor.h                                |    5 +-
 arch/powerpc/include/asm/ptrace.h                                   |    9 +-
 arch/powerpc/include/asm/qspinlock.h                                |   91 ++
 arch/powerpc/include/asm/qspinlock_paravirt.h                       |    7 +
 arch/powerpc/include/asm/reg.h                                      |   10 +-
 arch/powerpc/include/asm/rtas.h                                     |    3 -
 arch/powerpc/include/asm/security_features.h                        |    2 +
 arch/powerpc/include/asm/setup.h                                    |    4 +-
 arch/powerpc/include/asm/simple_spinlock.h                          |  288 +++++
 arch/powerpc/include/asm/simple_spinlock_types.h                    |   21 +
 arch/powerpc/include/asm/smu.h                                      |    2 +-
 arch/powerpc/include/asm/sparsemem.h                                |    6 -
 arch/powerpc/include/asm/spinlock.h                                 |  308 +-----
 arch/powerpc/include/asm/spinlock_types.h                           |   17 +-
 arch/powerpc/include/asm/sstep.h                                    |    7 +
 arch/powerpc/include/asm/string.h                                   |    2 +-
 arch/powerpc/include/asm/time.h                                     |    1 -
 arch/powerpc/include/asm/timex.h                                    |    2 +-
 arch/powerpc/include/asm/topology.h                                 |   27 -
 arch/powerpc/include/asm/xive.h                                     |    1 -
 arch/powerpc/include/uapi/asm/kvm.h                                 |    5 +
 arch/powerpc/include/uapi/asm/mman.h                                |    2 +-
 arch/powerpc/include/uapi/asm/papr_pdsm.h                           |    9 +
 arch/powerpc/kernel/Makefile                                        |    7 +-
 arch/powerpc/kernel/align.c                                         |    8 +-
 arch/powerpc/kernel/asm-offsets.c                                   |    5 +
 arch/powerpc/kernel/cacheinfo.c                                     |   62 +-
 arch/powerpc/kernel/cpu_setup_power.S                               |   29 +-
 arch/powerpc/kernel/cputable.c                                      |    3 +-
 arch/powerpc/kernel/dawr.c                                          |    2 +-
 arch/powerpc/kernel/dbell.c                                         |   55 -
 arch/powerpc/kernel/dt_cpu_ftrs.c                                   |   52 +-
 arch/powerpc/kernel/eeh.c                                           |  106 +-
 arch/powerpc/kernel/eeh_dev.c                                       |   67 --
 arch/powerpc/kernel/eeh_driver.c                                    |   12 +-
 arch/powerpc/kernel/eeh_pe.c                                        |  141 +--
 arch/powerpc/kernel/eeh_sysfs.c                                     |    2 +-
 arch/powerpc/kernel/entry_32.S                                      |    6 +
 arch/powerpc/kernel/entry_64.S                                      |  190 +++-
 arch/powerpc/kernel/exceptions-64s.S                                |  150 ++-
 arch/powerpc/kernel/fadump.c                                        |   26 +
 arch/powerpc/kernel/firmware.c                                      |   19 +
 arch/powerpc/kernel/fpu.S                                           |    4 +-
 arch/powerpc/kernel/head_32.S                                       |   16 +-
 arch/powerpc/kernel/head_40x.S                                      |    2 +-
 arch/powerpc/kernel/hw_breakpoint.c                                 |   98 +-
 arch/powerpc/kernel/irq.c                                           |    9 +-
 arch/powerpc/kernel/kprobes.c                                       |    2 +-
 arch/powerpc/kernel/mce.c                                           |   18 +-
 arch/powerpc/kernel/mce_power.c                                     |   84 ++
 arch/powerpc/kernel/misc_64.S                                       |   14 -
 arch/powerpc/kernel/module.c                                        |   11 +
 arch/powerpc/kernel/of_platform.c                                   |    4 +-
 arch/powerpc/kernel/paca.c                                          |   13 +-
 arch/powerpc/kernel/pci_dn.c                                        |   29 +-
 arch/powerpc/kernel/process.c                                       |  111 +-
 arch/powerpc/kernel/prom.c                                          |   22 +-
 arch/powerpc/kernel/prom_init.c                                     |   30 +-
 arch/powerpc/kernel/ptrace/ptrace-view.c                            |   27 +-
 arch/powerpc/kernel/rtas.c                                          |  122 +--
 arch/powerpc/kernel/rtasd.c                                         |   28 +-
 arch/powerpc/kernel/secure_boot.c                                   |   18 +-
 arch/powerpc/kernel/security.c                                      |  139 +--
 arch/powerpc/kernel/setup-common.c                                  |    3 +
 arch/powerpc/kernel/setup_64.c                                      |    5 +-
 arch/powerpc/kernel/signal.c                                        |   19 +-
 arch/powerpc/kernel/signal_32.c                                     |   20 +-
 arch/powerpc/kernel/signal_64.c                                     |   29 +-
 arch/powerpc/kernel/smp.c                                           |    1 +
 arch/powerpc/kernel/syscall_64.c                                    |   40 +-
 arch/powerpc/kernel/sysfs.c                                         |    8 +
 arch/powerpc/kernel/trace/ftrace.c                                  |   26 +-
 arch/powerpc/kernel/traps.c                                         |    8 -
 arch/powerpc/kernel/vdso.c                                          |    2 +-
 arch/powerpc/kernel/vdso32/Makefile                                 |    2 +-
 arch/powerpc/kernel/vdso32/vdso32.lds.S                             |    1 +
 arch/powerpc/kernel/vdso64/Makefile                                 |    2 +-
 arch/powerpc/kernel/vdso64/cacheflush.S                             |    9 +-
 arch/powerpc/kernel/vdso64/datapage.S                               |   28 +-
 arch/powerpc/kernel/vdso64/gettimeofday.S                           |    9 +-
 arch/powerpc/kernel/vdso64/sigtramp.S                               |   13 +-
 arch/powerpc/kernel/vdso64/vdso64.lds.S                             |    3 +-
 arch/powerpc/kernel/vector.S                                        |    4 +-
 arch/powerpc/kexec/Makefile                                         |    2 +-
 arch/powerpc/kexec/core_64.c                                        |    2 +
 arch/powerpc/kexec/elf_64.c                                         |   36 +-
 arch/powerpc/kexec/file_load.c                                      |   62 +-
 arch/powerpc/kexec/file_load_64.c                                   | 1119 ++++++++++++++++++++
 arch/powerpc/kexec/ranges.c                                         |  412 +++++++
 arch/powerpc/kvm/book3s_hv.c                                        |   46 +-
 arch/powerpc/kvm/book3s_hv_builtin.c                                |    2 +-
 arch/powerpc/kvm/book3s_hv_interrupts.S                             |    8 +
 arch/powerpc/kvm/book3s_hv_ras.c                                    |    2 +-
 arch/powerpc/kvm/book3s_hv_rmhandlers.S                             |   36 +-
 arch/powerpc/kvm/book3s_interrupts.S                                |    2 +-
 arch/powerpc/kvm/trace_hv.h                                         |    2 +-
 arch/powerpc/lib/Makefile                                           |    3 +
 arch/powerpc/lib/code-patching.c                                    |    2 +-
 arch/powerpc/lib/locks.c                                            |   12 +-
 arch/powerpc/lib/pmem.c                                             |   48 +-
 arch/powerpc/lib/sstep.c                                            |   41 +-
 arch/powerpc/lib/test_emulate_step.c                                |  697 ++++++++++--
 arch/powerpc/lib/test_emulate_step_exec_instr.S                     |    2 +
 arch/powerpc/mm/book3s32/hash_low.S                                 |    2 +-
 arch/powerpc/mm/book3s32/mmu.c                                      |   17 +-
 arch/powerpc/mm/book3s64/hash_utils.c                               |   25 +-
 arch/powerpc/mm/book3s64/pgtable.c                                  |    8 +-
 arch/powerpc/mm/book3s64/pkeys.c                                    |  300 +++---
 arch/powerpc/mm/book3s64/radix_pgtable.c                            |  219 ++--
 arch/powerpc/mm/book3s64/radix_tlb.c                                |   82 +-
 arch/powerpc/mm/drmem.c                                             |   87 +-
 arch/powerpc/mm/fault.c                                             |  106 +-
 arch/powerpc/mm/hugetlbpage.c                                       |   18 +
 arch/powerpc/mm/init_32.c                                           |    2 +
 arch/powerpc/mm/init_64.c                                           |    6 +-
 arch/powerpc/mm/kasan/kasan_init_32.c                               |   35 +-
 arch/powerpc/mm/mem.c                                               |    5 -
 arch/powerpc/mm/nohash/tlb_low_64e.S                                |   47 +-
 arch/powerpc/mm/numa.c                                              |  506 +--------
 arch/powerpc/mm/pgtable-frag.c                                      |    3 +
 arch/powerpc/mm/ptdump/hashpagetable.c                              |    2 +-
 arch/powerpc/mm/ptdump/ptdump.c                                     |   55 +-
 arch/powerpc/net/bpf_jit.h                                          |  184 +---
 arch/powerpc/net/bpf_jit32.h                                        |   34 +-
 arch/powerpc/net/bpf_jit64.h                                        |   16 +-
 arch/powerpc/net/bpf_jit_comp.c                                     |  134 +--
 arch/powerpc/net/bpf_jit_comp64.c                                   |  298 +++---
 arch/powerpc/perf/Makefile                                          |    2 +-
 arch/powerpc/perf/callchain.h                                       |   25 +-
 arch/powerpc/perf/callchain_32.c                                    |   21 +-
 arch/powerpc/perf/callchain_64.c                                    |   13 +-
 arch/powerpc/perf/core-book3s.c                                     |  108 +-
 arch/powerpc/perf/generic-compat-pmu.c                              |    2 +-
 arch/powerpc/perf/hv-24x7.c                                         |   54 +
 arch/powerpc/perf/imc-pmu.c                                         |   29 +-
 arch/powerpc/perf/internal.h                                        |    1 +
 arch/powerpc/perf/isa207-common.c                                   |   91 +-
 arch/powerpc/perf/isa207-common.h                                   |   37 +-
 arch/powerpc/perf/mpc7450-pmu.c                                     |   23 +-
 arch/powerpc/perf/power10-events-list.h                             |   70 ++
 arch/powerpc/perf/power10-pmu.c                                     |  419 ++++++++
 arch/powerpc/perf/power5+-pmu.c                                     |   19 +-
 arch/powerpc/perf/power5-pmu.c                                      |   19 +-
 arch/powerpc/perf/power6-pmu.c                                      |   18 +-
 arch/powerpc/perf/power7-pmu.c                                      |   19 +-
 arch/powerpc/perf/power8-pmu.c                                      |    2 +-
 arch/powerpc/perf/power9-pmu.c                                      |    2 +-
 arch/powerpc/perf/ppc970-pmu.c                                      |   26 +-
 arch/powerpc/platforms/52xx/lite5200_sleep.S                        |    2 +-
 arch/powerpc/platforms/85xx/Kconfig                                 |    2 +-
 arch/powerpc/platforms/cell/Kconfig                                 |    1 +
 arch/powerpc/platforms/cell/spufs/coredump.c                        |   21 +-
 arch/powerpc/platforms/pasemi/misc.c                                |    3 +-
 arch/powerpc/platforms/powermac/feature.c                           |    2 +-
 arch/powerpc/platforms/powermac/low_i2c.c                           |    6 +-
 arch/powerpc/platforms/powermac/pfunc_base.c                        |    4 +-
 arch/powerpc/platforms/powermac/udbg_scc.c                          |    2 +-
 arch/powerpc/platforms/powernv/Makefile                             |    1 +
 arch/powerpc/platforms/powernv/eeh-powernv.c                        |  114 +-
 arch/powerpc/platforms/powernv/idle.c                               |   48 +-
 arch/powerpc/platforms/powernv/opal-async.c                         |    2 +-
 arch/powerpc/platforms/powernv/pci-ioda-tce.c                       |    2 +-
 arch/powerpc/platforms/powernv/pci-ioda.c                           |  923 +++-------------
 arch/powerpc/platforms/powernv/pci-sriov.c                          |  766 ++++++++++++++
 arch/powerpc/platforms/powernv/pci.c                                |   14 +-
 arch/powerpc/platforms/powernv/pci.h                                |  103 +-
 arch/powerpc/platforms/powernv/setup.c                              |   10 +-
 arch/powerpc/platforms/pseries/Kconfig                              |    9 +-
 arch/powerpc/platforms/pseries/eeh_pseries.c                        |  382 ++++---
 arch/powerpc/platforms/pseries/firmware.c                           |    1 +
 arch/powerpc/platforms/pseries/hotplug-cpu.c                        |  190 +---
 arch/powerpc/platforms/pseries/hotplug-memory.c                     |  109 +-
 arch/powerpc/platforms/pseries/hvcserver.c                          |    2 +-
 arch/powerpc/platforms/pseries/lpar.c                               |    8 +-
 arch/powerpc/platforms/pseries/mobility.c                           |   43 +-
 arch/powerpc/platforms/pseries/offline_states.h                     |   38 -
 arch/powerpc/platforms/pseries/papr_scm.c                           |  296 +++++-
 arch/powerpc/platforms/pseries/pci_dlpar.c                          |    2 +-
 arch/powerpc/platforms/pseries/pmem.c                               |    7 +-
 arch/powerpc/platforms/pseries/setup.c                              |   24 +-
 arch/powerpc/platforms/pseries/smp.c                                |   90 +-
 arch/powerpc/platforms/pseries/suspend.c                            |   27 +-
 arch/powerpc/purgatory/Makefile                                     |    4 +-
 arch/powerpc/purgatory/{trampoline.S => trampoline_64.S}            |   54 +-
 arch/powerpc/sysdev/xive/native.c                                   |    2 +
 arch/powerpc/sysdev/xive/spapr.c                                    |    2 +-
 arch/powerpc/tools/unrel_branch_check.sh                            |    5 +-
 arch/powerpc/xmon/xmon.c                                            |   40 +-
 drivers/cpuidle/cpuidle-powernv.c                                   |   14 -
 drivers/cpuidle/cpuidle-pseries.c                                   |  187 +++-
 drivers/crypto/vmx/aesp8-ppc.pl                                     |    2 +-
 drivers/crypto/vmx/ghashp8-ppc.pl                                   |    2 +-
 drivers/macintosh/adb-iop.c                                         |  186 ++--
 drivers/macintosh/adb.c                                             |    2 +-
 drivers/macintosh/therm_adt746x.c                                   |    4 +-
 drivers/macintosh/via-macii.c                                       |  324 +++---
 drivers/md/dm-writecache.c                                          |    2 +-
 drivers/misc/ocxl/Kconfig                                           |    2 +-
 drivers/misc/ocxl/config.c                                          |   91 +-
 drivers/misc/ocxl/ocxl_internal.h                                   |   15 +-
 drivers/misc/ocxl/sysfs.c                                           |   35 +
 drivers/nvdimm/of_pmem.c                                            |    1 +
 drivers/nvdimm/region_devs.c                                        |    8 +-
 include/asm-generic/barrier.h                                       |   10 +
 include/asm-generic/qspinlock.h                                     |    4 +
 include/linux/cpuhotplug.h                                          |    1 +
 include/linux/kexec.h                                               |   29 +-
 include/linux/mm.h                                                  |    2 -
 include/misc/ocxl-config.h                                          |    1 +
 include/misc/ocxl.h                                                 |  102 +-
 include/trace/events/mmflags.h                                      |    2 -
 kernel/kexec_file.c                                                 |   16 +-
 mm/ksm.c                                                            |    4 -
 tools/arch/powerpc/include/uapi/asm/kvm.h                           |    5 +
 tools/perf/arch/powerpc/util/book3s_hcalls.h                        |    2 +-
 tools/testing/selftests/powerpc/alignment/alignment_handler.c       |  150 ++-
 tools/testing/selftests/powerpc/benchmarks/context_switch.c         |   21 +-
 tools/testing/selftests/powerpc/eeh/eeh-functions.sh                |   11 +-
 tools/testing/selftests/powerpc/include/instructions.h              |   77 ++
 tools/testing/selftests/powerpc/include/pkeys.h                     |  136 +++
 tools/testing/selftests/powerpc/include/reg.h                       |    6 +
 tools/testing/selftests/powerpc/include/utils.h                     |   29 +
 tools/testing/selftests/powerpc/math/.gitignore                     |    1 +
 tools/testing/selftests/powerpc/math/Makefile                       |   10 +-
 tools/testing/selftests/powerpc/math/fpu_denormal.c                 |   38 +
 tools/testing/selftests/powerpc/math/vmx_preempt.c                  |    3 +
 tools/testing/selftests/powerpc/math/vmx_signal.c                   |    3 +
 tools/testing/selftests/powerpc/math/vmx_syscall.c                  |    7 +-
 tools/testing/selftests/powerpc/math/vsx_preempt.c                  |    2 +
 tools/testing/selftests/powerpc/mm/.gitignore                       |    5 +-
 tools/testing/selftests/powerpc/mm/Makefile                         |   18 +-
 tools/testing/selftests/powerpc/mm/bad_accesses.c                   |   28 -
 tools/testing/selftests/powerpc/mm/pkey_exec_prot.c                 |  294 +++++
 tools/testing/selftests/powerpc/mm/pkey_siginfo.c                   |  333 ++++++
 tools/testing/selftests/powerpc/mm/prot_sao.c                       |   42 -
 tools/testing/selftests/powerpc/mm/stack_expansion_ldst.c           |  202 ++++
 tools/testing/selftests/powerpc/mm/stack_expansion_signal.c         |  118 +++
 tools/testing/selftests/powerpc/pmu/count_stcx_fail.c               |    4 +
 tools/testing/selftests/powerpc/pmu/ebb/back_to_back_ebbs_test.c    |    2 -
 tools/testing/selftests/powerpc/pmu/ebb/cycles_test.c               |    2 -
 tools/testing/selftests/powerpc/pmu/ebb/cycles_with_freeze_test.c   |    2 -
 tools/testing/selftests/powerpc/pmu/ebb/cycles_with_mmcr2_test.c    |    2 -
 tools/testing/selftests/powerpc/pmu/ebb/ebb.c                       |    2 -
 tools/testing/selftests/powerpc/pmu/ebb/ebb_on_willing_child_test.c |    2 -
 tools/testing/selftests/powerpc/pmu/ebb/lost_exception_test.c       |    1 -
 tools/testing/selftests/powerpc/pmu/ebb/multi_counter_test.c        |    7 -
 tools/testing/selftests/powerpc/pmu/ebb/multi_ebb_procs_test.c      |    2 -
 tools/testing/selftests/powerpc/pmu/ebb/pmae_handling_test.c        |    2 -
 tools/testing/selftests/powerpc/pmu/ebb/pmc56_overflow_test.c       |    2 -
 tools/testing/selftests/powerpc/pmu/lib.h                           |    1 +
 tools/testing/selftests/powerpc/pmu/per_event_excludes.c            |    7 +-
 tools/testing/selftests/powerpc/ptrace/core-pkey.c                  |    2 +-
 tools/testing/selftests/powerpc/ptrace/ptrace-pkey.c                |   57 +-
 tools/testing/selftests/powerpc/ptrace/ptrace-tar.c                 |    3 +
 tools/testing/selftests/powerpc/ptrace/ptrace-vsx.c                 |    2 +
 tools/testing/selftests/powerpc/security/spectre_v2.c               |   10 +
 tools/testing/selftests/powerpc/stringloops/Makefile                |    2 +-
 tools/testing/selftests/powerpc/stringloops/memcmp.c                |   46 +-
 tools/testing/selftests/powerpc/utils.c                             |   65 +-
 391 files changed, 11054 insertions(+), 5675 deletions(-)
 create mode 100644 arch/powerpc/include/asm/book3s/64/hash-pkey.h
 create mode 100644 arch/powerpc/include/asm/book3s/64/kexec.h
 create mode 100644 arch/powerpc/include/asm/book3s/64/pkeys.h
 create mode 100644 arch/powerpc/include/asm/crashdump-ppc64.h
 create mode 100644 arch/powerpc/include/asm/kexec_ranges.h
 create mode 100644 arch/powerpc/include/asm/paravirt.h
 create mode 100644 arch/powerpc/include/asm/qspinlock.h
 create mode 100644 arch/powerpc/include/asm/qspinlock_paravirt.h
 create mode 100644 arch/powerpc/include/asm/simple_spinlock.h
 create mode 100644 arch/powerpc/include/asm/simple_spinlock_types.h
 delete mode 100644 arch/powerpc/kernel/eeh_dev.c
 create mode 100644 arch/powerpc/kexec/file_load_64.c
 create mode 100644 arch/powerpc/kexec/ranges.c
 create mode 100644 arch/powerpc/perf/power10-events-list.h
 create mode 100644 arch/powerpc/perf/power10-pmu.c
 create mode 100644 arch/powerpc/platforms/powernv/pci-sriov.c
 delete mode 100644 arch/powerpc/platforms/pseries/offline_states.h
 rename arch/powerpc/purgatory/{trampoline.S => trampoline_64.S} (70%)
 create mode 100644 tools/testing/selftests/powerpc/include/pkeys.h
 create mode 100644 tools/testing/selftests/powerpc/math/fpu_denormal.c
 create mode 100644 tools/testing/selftests/powerpc/mm/pkey_exec_prot.c
 create mode 100644 tools/testing/selftests/powerpc/mm/pkey_siginfo.c
 delete mode 100644 tools/testing/selftests/powerpc/mm/prot_sao.c
 create mode 100644 tools/testing/selftests/powerpc/mm/stack_expansion_ldst.c
 create mode 100644 tools/testing/selftests/powerpc/mm/stack_expansion_signal.c
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEJFGtCPCthwEv2Y/bUevqPMjhpYAFAl8tUvYACgkQUevqPMjh
pYCR+w/+I+iljkTY6YUrUFak8u5fYUteiqA2qLcnaW8V8su6LHvf0RqDBYTyrter
verUU8yqcCtGsgfJwBTR9AzRbUtw3Ap/1yx3bw10gb0tfsphmfzrpdsxCB0b0Vf7
Umd8ZLnJzWRiJrz3SVUUqEovF1I1XJT7I0HEjdUWr+FsHeyq2IDoK+DJeSj3Ci0r
rSxnYX6SJp0IPExgVSbJ+EXdVCMP2Tgj2w4lGXLVDNumi7INl5BK+BxB/PWVp2/3
6InHi0eA/1T94SMRE1T5EfTEqNJUW6ws2pFw1xINcuWeZ0Exx/JcO8n0weQdj1tZ
rRtVOooN2TqLhZIttJWgiYDFkj9uxQBzXGGJec8eG8v3r7X+xqo/RcQmQV0lvEIm
9QmnUlwjcr9IPSQgBxoDlBrqpkClafBpcs8jn9k7/66iTRpmYXoNa8WTPGoEV9co
7npVym8va/M0aslJYPan3HjaG5v/hMduneQrgTi3/7/zYB0MhyGIweOEtpG0Nia4
YHLKYi5UWDFmk6VdbZnG8Qv+mQZ1MBH5dIDUlKOAz/0jRhgSqgI/Df4Kv14GTTOT
gJIc+77ZR3Shb/arJqExvGF/QamOrgZhR8CVcoXREpIL0xnESf0RVWugVLReedcG
ohP3q9ExQ73/j+Zyeei+q96exZTWimhgawYDzz1N0hEBbExRfAE=
=z9TY
-----END PGP SIGNATURE-----

^ permalink raw reply

* [PATCH] powerpc/papr_scm: Make access mode of 'perf_stats' attribute file to '0400'
From: Vaibhav Jain @ 2020-08-07 12:31 UTC (permalink / raw)
  To: linuxppc-dev, linux-nvdimm
  Cc: Santosh Sivaraj, Oliver O'Halloran, Aneesh Kumar K . V,
	Vaibhav Jain, Dan Williams, Ira Weiny

The newly introduced 'perf_stats' attribute uses the default access
mode of 0444 letting non-root users access performance stats of an
nvdimm and potentially force the kernel into issuing large number of
expensive HCALLs. Since the information exposed by this attribute
cannot be cached hence its better to ward of access to this attribute
from non-root users.

Hence this patch updates the access-mode of 'perf_stats' sysfs
attribute file to 0400 to make it only readable to root-users.

Reported-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com>
---
 arch/powerpc/platforms/pseries/papr_scm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/pseries/papr_scm.c b/arch/powerpc/platforms/pseries/papr_scm.c
index f439f0dfea7d1..31864d167a2ce 100644
--- a/arch/powerpc/platforms/pseries/papr_scm.c
+++ b/arch/powerpc/platforms/pseries/papr_scm.c
@@ -822,7 +822,7 @@ static ssize_t perf_stats_show(struct device *dev,
 	kfree(stats);
 	return rc ? rc : seq_buf_used(&s);
 }
-DEVICE_ATTR_RO(perf_stats);
+DEVICE_ATTR(perf_stats, 0400, perf_stats_show, NULL);
 
 static ssize_t flags_show(struct device *dev,
 			  struct device_attribute *attr, char *buf)
-- 
2.26.2


^ permalink raw reply related

* Re: [PATCH V6 0/2] tools/perf: Add extended regs support for powerpc
From: Arnaldo Carvalho de Melo @ 2020-08-07 12:24 UTC (permalink / raw)
  To: Athira Rajeev; +Cc: ravi.bangoria, mikey, maddy, jolsa, kjain, linuxppc-dev
In-Reply-To: <1596795079-23601-1-git-send-email-atrajeev@linux.vnet.ibm.com>

Em Fri, Aug 07, 2020 at 06:11:17AM -0400, Athira Rajeev escreveu:
> Patch set to add perf tools support for perf extended register capability
> in powerpc. 
> 
> Patch 1/2 adds extended regs for power9 ( mmcr0, mmcr1 and mmcr2 )
> to sample_reg_mask in the tool side to use with `-I?`.
> Patch 2/2 adds extended regs for power10 ( mmcr3, sier2, sier3)
> to sample_reg_mask in the tool side.
> 
> Ravi bangoria found an issue with `perf record -I` while testing the
> changes. The same issue is currently being worked on here:
> https://lkml.org/lkml/2020/7/19/413 and will be resolved once fix
> from Jin Yao is merged.
> 
> This includes the perf tools side changes to support extended regs.
> kernel side changes are sent as separate patchset.

Thanks, applied.

- Arnaldo

^ permalink raw reply

* Re: [PATCH 1/2] lockdep: improve current->(hard|soft)irqs_enabled synchronisation with actual irq state
From: peterz @ 2020-08-07 11:11 UTC (permalink / raw)
  To: Nicholas Piggin
  Cc: linux-arch, Alexey Kardashevskiy, linuxppc-dev, linux-kernel,
	Ingo Molnar, Will Deacon
In-Reply-To: <20200723105615.1268126-1-npiggin@gmail.com>


What's wrong with something like this?

AFAICT there's no reason to actually try and add IRQ tracing here, it's
just a hand full of instructions at the most.

---

diff --git a/arch/powerpc/include/asm/hw_irq.h b/arch/powerpc/include/asm/hw_irq.h
index 3a0db7b0b46e..6be22c1838e2 100644
--- a/arch/powerpc/include/asm/hw_irq.h
+++ b/arch/powerpc/include/asm/hw_irq.h
@@ -196,33 +196,6 @@ static inline bool arch_irqs_disabled(void)
 		arch_local_irq_restore(flags);				\
 	} while(0)
 
-#ifdef CONFIG_TRACE_IRQFLAGS
-#define powerpc_local_irq_pmu_save(flags)			\
-	 do {							\
-		raw_local_irq_pmu_save(flags);			\
-		trace_hardirqs_off();				\
-	} while(0)
-#define powerpc_local_irq_pmu_restore(flags)			\
-	do {							\
-		if (raw_irqs_disabled_flags(flags)) {		\
-			raw_local_irq_pmu_restore(flags);	\
-			trace_hardirqs_off();			\
-		} else {					\
-			trace_hardirqs_on();			\
-			raw_local_irq_pmu_restore(flags);	\
-		}						\
-	} while(0)
-#else
-#define powerpc_local_irq_pmu_save(flags)			\
-	do {							\
-		raw_local_irq_pmu_save(flags);			\
-	} while(0)
-#define powerpc_local_irq_pmu_restore(flags)			\
-	do {							\
-		raw_local_irq_pmu_restore(flags);		\
-	} while (0)
-#endif  /* CONFIG_TRACE_IRQFLAGS */
-
 #endif /* CONFIG_PPC_BOOK3S */
 
 #ifdef CONFIG_PPC_BOOK3E
diff --git a/arch/powerpc/include/asm/local.h b/arch/powerpc/include/asm/local.h
index bc4bd19b7fc2..b357a35672b1 100644
--- a/arch/powerpc/include/asm/local.h
+++ b/arch/powerpc/include/asm/local.h
@@ -32,9 +32,9 @@ static __inline__ void local_##op(long i, local_t *l)			\
 {									\
 	unsigned long flags;						\
 									\
-	powerpc_local_irq_pmu_save(flags);				\
+	raw_powerpc_local_irq_pmu_save(flags);				\
 	l->v c_op i;						\
-	powerpc_local_irq_pmu_restore(flags);				\
+	raw_powerpc_local_irq_pmu_restore(flags);				\
 }
 
 #define LOCAL_OP_RETURN(op, c_op)					\
@@ -43,9 +43,9 @@ static __inline__ long local_##op##_return(long a, local_t *l)		\
 	long t;								\
 	unsigned long flags;						\
 									\
-	powerpc_local_irq_pmu_save(flags);				\
+	raw_powerpc_local_irq_pmu_save(flags);				\
 	t = (l->v c_op a);						\
-	powerpc_local_irq_pmu_restore(flags);				\
+	raw_powerpc_local_irq_pmu_restore(flags);				\
 									\
 	return t;							\
 }
@@ -81,11 +81,11 @@ static __inline__ long local_cmpxchg(local_t *l, long o, long n)
 	long t;
 	unsigned long flags;
 
-	powerpc_local_irq_pmu_save(flags);
+	raw_powerpc_local_irq_pmu_save(flags);
 	t = l->v;
 	if (t == o)
 		l->v = n;
-	powerpc_local_irq_pmu_restore(flags);
+	raw_powerpc_local_irq_pmu_restore(flags);
 
 	return t;
 }
@@ -95,10 +95,10 @@ static __inline__ long local_xchg(local_t *l, long n)
 	long t;
 	unsigned long flags;
 
-	powerpc_local_irq_pmu_save(flags);
+	raw_powerpc_local_irq_pmu_save(flags);
 	t = l->v;
 	l->v = n;
-	powerpc_local_irq_pmu_restore(flags);
+	raw_powerpc_local_irq_pmu_restore(flags);
 
 	return t;
 }
@@ -117,12 +117,12 @@ static __inline__ int local_add_unless(local_t *l, long a, long u)
 	unsigned long flags;
 	int ret = 0;
 
-	powerpc_local_irq_pmu_save(flags);
+	raw_powerpc_local_irq_pmu_save(flags);
 	if (l->v != u) {
 		l->v += a;
 		ret = 1;
 	}
-	powerpc_local_irq_pmu_restore(flags);
+	raw_powerpc_local_irq_pmu_restore(flags);
 
 	return ret;
 }

^ permalink raw reply related

* [PATCH v2] powerpc/pci: unmap legacy INTx interrupts when a PHB is removed
From: Cédric Le Goater @ 2020-08-07 10:18 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: Alexey Kardashevskiy, Oliver O'Halloran, linuxppc-dev,
	Cédric Le Goater

When a passthrough IO adapter is removed from a pseries machine using
hash MMU and the XIVE interrupt mode, the POWER hypervisor expects the
guest OS to clear all page table entries related to the adapter. If
some are still present, the RTAS call which isolates the PCI slot
returns error 9001 "valid outstanding translations" and the removal of
the IO adapter fails. This is because when the PHBs are scanned, Linux
maps automatically the INTx interrupts in the Linux interrupt number
space but these are never removed.

To solve this problem, we introduce a PPC platform specific
pcibios_remove_bus() routine which clears all interrupt mappings when
the bus is removed. This also clears the associated page table entries
of the ESB pages when using XIVE.

For this purpose, we record the logical interrupt numbers of the
mapped interrupt under the PHB structure and let pcibios_remove_bus()
do the clean up.

Since some PCI adapters, like GPUs, use the "interrupt-map" property
to describe interrupt mappings other than the legacy INTx interrupts,
we can not restrict the size of the mapping array to PCI_NUM_INTX. The
number of interrupt mappings is computed from the "interrupt-map"
property and the mapping array is allocated accordingly.

Cc: "Oliver O'Halloran" <oohall@gmail.com>
Cc: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---

 Changes since v2:

 - merged 2 patches.
 
 arch/powerpc/include/asm/pci-bridge.h |   6 ++
 arch/powerpc/kernel/pci-common.c      | 114 ++++++++++++++++++++++++++
 2 files changed, 120 insertions(+)

diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h
index b92e81b256e5..ca75cf264ddf 100644
--- a/arch/powerpc/include/asm/pci-bridge.h
+++ b/arch/powerpc/include/asm/pci-bridge.h
@@ -48,6 +48,9 @@ struct pci_controller_ops {
 
 /*
  * Structure of a PCI controller (host bridge)
+ *
+ * @irq_count: number of interrupt mappings
+ * @irq_map: interrupt mappings
  */
 struct pci_controller {
 	struct pci_bus *bus;
@@ -127,6 +130,9 @@ struct pci_controller {
 
 	void *private_data;
 	struct npu *npu;
+
+	unsigned int irq_count;
+	unsigned int *irq_map;
 };
 
 /* These are used for config access before all the PCI probing
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index be108616a721..deb831f0ae13 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -353,6 +353,115 @@ struct pci_controller *pci_find_controller_for_domain(int domain_nr)
 	return NULL;
 }
 
+/*
+ * Assumption is made on the interrupt parent. All interrupt-map
+ * entries are considered to have the same parent.
+ */
+static int pcibios_irq_map_count(struct pci_controller *phb)
+{
+	const __be32 *imap;
+	int imaplen;
+	struct device_node *parent;
+	u32 intsize, addrsize, parintsize, paraddrsize;
+
+	if (of_property_read_u32(phb->dn, "#interrupt-cells", &intsize))
+		return 0;
+	if (of_property_read_u32(phb->dn, "#address-cells", &addrsize))
+		return 0;
+
+	imap = of_get_property(phb->dn, "interrupt-map", &imaplen);
+	if (!imap) {
+		pr_debug("%pOF : no interrupt-map\n", phb->dn);
+		return 0;
+	}
+	imaplen /= sizeof(u32);
+	pr_debug("%pOF : imaplen=%d\n", phb->dn, imaplen);
+
+	if (imaplen < (addrsize + intsize + 1))
+		return 0;
+
+	imap += intsize + addrsize;
+	parent = of_find_node_by_phandle(be32_to_cpup(imap));
+	if (!parent) {
+		pr_debug("%pOF : no imap parent found !\n", phb->dn);
+		return 0;
+	}
+
+	if (of_property_read_u32(parent, "#interrupt-cells", &parintsize)) {
+		pr_debug("%pOF : parent lacks #interrupt-cells!\n", phb->dn);
+		return 0;
+	}
+
+	if (of_property_read_u32(parent, "#address-cells", &paraddrsize))
+		paraddrsize = 0;
+
+	return imaplen / (addrsize + intsize + 1 + paraddrsize + parintsize);
+}
+
+static void pcibios_irq_map_init(struct pci_controller *phb)
+{
+	phb->irq_count = pcibios_irq_map_count(phb);
+	if (phb->irq_count < PCI_NUM_INTX)
+		phb->irq_count = PCI_NUM_INTX;
+
+	pr_debug("%pOF : interrupt map #%d\n", phb->dn, phb->irq_count);
+
+	phb->irq_map = kcalloc(phb->irq_count, sizeof(unsigned int),
+			       GFP_KERNEL);
+}
+
+static void pci_irq_map_register(struct pci_dev *pdev, unsigned int virq)
+{
+	struct pci_controller *phb = pci_bus_to_host(pdev->bus);
+	int i;
+
+	if (!phb->irq_map)
+		return;
+
+	for (i = 0; i < phb->irq_count; i++) {
+		/*
+		 * Look for an empty or an equivalent slot, as INTx
+		 * interrupts can be shared between adapters.
+		 */
+		if (phb->irq_map[i] == virq || !phb->irq_map[i]) {
+			phb->irq_map[i] = virq;
+			break;
+		}
+	}
+
+	if (i == phb->irq_count)
+		pr_err("PCI:%s all platform interrupts mapped\n",
+		       pci_name(pdev));
+}
+
+/*
+ * Clearing the mapped interrupts will also clear the underlying
+ * mappings of the ESB pages of the interrupts when under XIVE. It is
+ * a requirement of PowerVM to clear all memory mappings before
+ * removing a PHB.
+ */
+static void pci_irq_map_dispose(struct pci_bus *bus)
+{
+	struct pci_controller *phb = pci_bus_to_host(bus);
+	int i;
+
+	if (!phb->irq_map)
+		return;
+
+	pr_debug("PCI: Clearing interrupt mappings for PHB %04x:%02x...\n",
+		 pci_domain_nr(bus), bus->number);
+	for (i = 0; i < phb->irq_count; i++)
+		irq_dispose_mapping(phb->irq_map[i]);
+
+	kfree(phb->irq_map);
+}
+
+void pcibios_remove_bus(struct pci_bus *bus)
+{
+	pci_irq_map_dispose(bus);
+}
+EXPORT_SYMBOL_GPL(pcibios_remove_bus);
+
 /*
  * Reads the interrupt pin to determine if interrupt is use by card.
  * If the interrupt is used, then gets the interrupt line from the
@@ -401,6 +510,8 @@ static int pci_read_irq_line(struct pci_dev *pci_dev)
 
 	pci_dev->irq = virq;
 
+	/* Record all interrut mappings for later removal of a PHB */
+	pci_irq_map_register(pci_dev, virq);
 	return 0;
 }
 
@@ -1554,6 +1665,9 @@ void pcibios_scan_phb(struct pci_controller *hose)
 
 	pr_debug("PCI: Scanning PHB %pOF\n", node);
 
+	/* Allocate interrupt mappings array */
+	pcibios_irq_map_init(hose);
+
 	/* Get some IO space for the new PHB */
 	pcibios_setup_phb_io_space(hose);
 
-- 
2.25.4


^ permalink raw reply related

* [PATCH V6 2/2] tools/perf: Add perf tools support for extended regs in power10
From: Athira Rajeev @ 2020-08-07 10:11 UTC (permalink / raw)
  To: mpe, acme, jolsa; +Cc: ravi.bangoria, mikey, maddy, linuxppc-dev, kjain
In-Reply-To: <1596795079-23601-1-git-send-email-atrajeev@linux.vnet.ibm.com>

Added support for supported regs which are new in power10
( MMCR3, SIER2, SIER3 ) to sample_reg_mask in the tool side
to use with `-I?` option. Also added PVR check to send extended
mask for power10 at kernel while capturing extended regs in
each sample.

Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Reviewed-by: Kajol Jain <kjain@linux.ibm.com>
Reviewed-and-tested-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
---
 tools/arch/powerpc/include/uapi/asm/perf_regs.h | 6 ++++++
 tools/perf/arch/powerpc/include/perf_regs.h     | 3 +++
 tools/perf/arch/powerpc/util/perf_regs.c        | 6 ++++++
 3 files changed, 15 insertions(+)

diff --git a/tools/arch/powerpc/include/uapi/asm/perf_regs.h b/tools/arch/powerpc/include/uapi/asm/perf_regs.h
index 225c64c..bdf5f10 100644
--- a/tools/arch/powerpc/include/uapi/asm/perf_regs.h
+++ b/tools/arch/powerpc/include/uapi/asm/perf_regs.h
@@ -52,6 +52,9 @@ enum perf_event_powerpc_regs {
 	PERF_REG_POWERPC_MMCR0,
 	PERF_REG_POWERPC_MMCR1,
 	PERF_REG_POWERPC_MMCR2,
+	PERF_REG_POWERPC_MMCR3,
+	PERF_REG_POWERPC_SIER2,
+	PERF_REG_POWERPC_SIER3,
 	/* Max regs without the extended regs */
 	PERF_REG_POWERPC_MAX = PERF_REG_POWERPC_MMCRA + 1,
 };
@@ -60,6 +63,9 @@ enum perf_event_powerpc_regs {
 
 /* PERF_REG_EXTENDED_MASK value for CPU_FTR_ARCH_300 */
 #define PERF_REG_PMU_MASK_300   (((1ULL << (PERF_REG_POWERPC_MMCR2 + 1)) - 1) - PERF_REG_PMU_MASK)
+/* PERF_REG_EXTENDED_MASK value for CPU_FTR_ARCH_31 */
+#define PERF_REG_PMU_MASK_31   (((1ULL << (PERF_REG_POWERPC_SIER3 + 1)) - 1) - PERF_REG_PMU_MASK)
 
 #define PERF_REG_MAX_ISA_300   (PERF_REG_POWERPC_MMCR2 + 1)
+#define PERF_REG_MAX_ISA_31    (PERF_REG_POWERPC_SIER3 + 1)
 #endif /* _UAPI_ASM_POWERPC_PERF_REGS_H */
diff --git a/tools/perf/arch/powerpc/include/perf_regs.h b/tools/perf/arch/powerpc/include/perf_regs.h
index 46ed00d..63f3ac9 100644
--- a/tools/perf/arch/powerpc/include/perf_regs.h
+++ b/tools/perf/arch/powerpc/include/perf_regs.h
@@ -68,6 +68,9 @@
 	[PERF_REG_POWERPC_MMCR0] = "mmcr0",
 	[PERF_REG_POWERPC_MMCR1] = "mmcr1",
 	[PERF_REG_POWERPC_MMCR2] = "mmcr2",
+	[PERF_REG_POWERPC_MMCR3] = "mmcr3",
+	[PERF_REG_POWERPC_SIER2] = "sier2",
+	[PERF_REG_POWERPC_SIER3] = "sier3",
 };
 
 static inline const char *perf_reg_name(int id)
diff --git a/tools/perf/arch/powerpc/util/perf_regs.c b/tools/perf/arch/powerpc/util/perf_regs.c
index d64ba0c..2b6d470 100644
--- a/tools/perf/arch/powerpc/util/perf_regs.c
+++ b/tools/perf/arch/powerpc/util/perf_regs.c
@@ -14,6 +14,7 @@
 #include <linux/kernel.h>
 
 #define PVR_POWER9		0x004E
+#define PVR_POWER10		0x0080
 
 const struct sample_reg sample_reg_masks[] = {
 	SMPL_REG(r0, PERF_REG_POWERPC_R0),
@@ -64,6 +65,9 @@
 	SMPL_REG(mmcr0, PERF_REG_POWERPC_MMCR0),
 	SMPL_REG(mmcr1, PERF_REG_POWERPC_MMCR1),
 	SMPL_REG(mmcr2, PERF_REG_POWERPC_MMCR2),
+	SMPL_REG(mmcr3, PERF_REG_POWERPC_MMCR3),
+	SMPL_REG(sier2, PERF_REG_POWERPC_SIER2),
+	SMPL_REG(sier3, PERF_REG_POWERPC_SIER3),
 	SMPL_REG_END
 };
 
@@ -194,6 +198,8 @@ uint64_t arch__intr_reg_mask(void)
 	version = (((mfspr(SPRN_PVR)) >>  16) & 0xFFFF);
 	if (version == PVR_POWER9)
 		extended_mask = PERF_REG_PMU_MASK_300;
+	else if (version == PVR_POWER10)
+		extended_mask = PERF_REG_PMU_MASK_31;
 	else
 		return mask;
 
-- 
1.8.3.1


^ permalink raw reply related

* [PATCH V6 1/2] tools/perf: Add perf tools support for extended register capability in powerpc
From: Athira Rajeev @ 2020-08-07 10:11 UTC (permalink / raw)
  To: mpe, acme, jolsa; +Cc: ravi.bangoria, mikey, maddy, linuxppc-dev, kjain
In-Reply-To: <1596795079-23601-1-git-send-email-atrajeev@linux.vnet.ibm.com>

From: Anju T Sudhakar <anju@linux.vnet.ibm.com>

Add extended regs to sample_reg_mask in the tool side to use
with `-I?` option. Perf tools side uses extended mask to display
the platform supported register names (with -I? option) to the user
and also send this mask to the kernel to capture the extended registers
in each sample. Hence decide the mask value based on the processor
version.

Currently definitions for `mfspr`, `SPRN_PVR` are part of
`arch/powerpc/util/header.c`. Move this to a header file so that
these definitions can be re-used in other source files as well.

Signed-off-by: Anju T Sudhakar <anju@linux.vnet.ibm.com>
[Decide extended mask at run time based on platform]
Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Reviewed-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
Reviewed-by: Kajol Jain <kjain@linux.ibm.com>
Reviewed-and-tested-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
---
 tools/arch/powerpc/include/uapi/asm/perf_regs.h | 14 ++++++-
 tools/perf/arch/powerpc/include/perf_regs.h     |  5 ++-
 tools/perf/arch/powerpc/util/header.c           |  9 +----
 tools/perf/arch/powerpc/util/perf_regs.c        | 49 +++++++++++++++++++++++++
 tools/perf/arch/powerpc/util/utils_header.h     | 15 ++++++++
 5 files changed, 82 insertions(+), 10 deletions(-)
 create mode 100644 tools/perf/arch/powerpc/util/utils_header.h

diff --git a/tools/arch/powerpc/include/uapi/asm/perf_regs.h b/tools/arch/powerpc/include/uapi/asm/perf_regs.h
index f599064..225c64c 100644
--- a/tools/arch/powerpc/include/uapi/asm/perf_regs.h
+++ b/tools/arch/powerpc/include/uapi/asm/perf_regs.h
@@ -48,6 +48,18 @@ enum perf_event_powerpc_regs {
 	PERF_REG_POWERPC_DSISR,
 	PERF_REG_POWERPC_SIER,
 	PERF_REG_POWERPC_MMCRA,
-	PERF_REG_POWERPC_MAX,
+	/* Extended registers */
+	PERF_REG_POWERPC_MMCR0,
+	PERF_REG_POWERPC_MMCR1,
+	PERF_REG_POWERPC_MMCR2,
+	/* Max regs without the extended regs */
+	PERF_REG_POWERPC_MAX = PERF_REG_POWERPC_MMCRA + 1,
 };
+
+#define PERF_REG_PMU_MASK	((1ULL << PERF_REG_POWERPC_MAX) - 1)
+
+/* PERF_REG_EXTENDED_MASK value for CPU_FTR_ARCH_300 */
+#define PERF_REG_PMU_MASK_300   (((1ULL << (PERF_REG_POWERPC_MMCR2 + 1)) - 1) - PERF_REG_PMU_MASK)
+
+#define PERF_REG_MAX_ISA_300   (PERF_REG_POWERPC_MMCR2 + 1)
 #endif /* _UAPI_ASM_POWERPC_PERF_REGS_H */
diff --git a/tools/perf/arch/powerpc/include/perf_regs.h b/tools/perf/arch/powerpc/include/perf_regs.h
index e18a355..46ed00d 100644
--- a/tools/perf/arch/powerpc/include/perf_regs.h
+++ b/tools/perf/arch/powerpc/include/perf_regs.h
@@ -64,7 +64,10 @@
 	[PERF_REG_POWERPC_DAR] = "dar",
 	[PERF_REG_POWERPC_DSISR] = "dsisr",
 	[PERF_REG_POWERPC_SIER] = "sier",
-	[PERF_REG_POWERPC_MMCRA] = "mmcra"
+	[PERF_REG_POWERPC_MMCRA] = "mmcra",
+	[PERF_REG_POWERPC_MMCR0] = "mmcr0",
+	[PERF_REG_POWERPC_MMCR1] = "mmcr1",
+	[PERF_REG_POWERPC_MMCR2] = "mmcr2",
 };
 
 static inline const char *perf_reg_name(int id)
diff --git a/tools/perf/arch/powerpc/util/header.c b/tools/perf/arch/powerpc/util/header.c
index d487007..1a95017 100644
--- a/tools/perf/arch/powerpc/util/header.c
+++ b/tools/perf/arch/powerpc/util/header.c
@@ -7,17 +7,10 @@
 #include <string.h>
 #include <linux/stringify.h>
 #include "header.h"
+#include "utils_header.h"
 #include "metricgroup.h"
 #include <api/fs/fs.h>
 
-#define mfspr(rn)       ({unsigned long rval; \
-			 asm volatile("mfspr %0," __stringify(rn) \
-				      : "=r" (rval)); rval; })
-
-#define SPRN_PVR        0x11F	/* Processor Version Register */
-#define PVR_VER(pvr)    (((pvr) >>  16) & 0xFFFF) /* Version field */
-#define PVR_REV(pvr)    (((pvr) >>   0) & 0xFFFF) /* Revison field */
-
 int
 get_cpuid(char *buffer, size_t sz)
 {
diff --git a/tools/perf/arch/powerpc/util/perf_regs.c b/tools/perf/arch/powerpc/util/perf_regs.c
index 0a52429..d64ba0c 100644
--- a/tools/perf/arch/powerpc/util/perf_regs.c
+++ b/tools/perf/arch/powerpc/util/perf_regs.c
@@ -6,9 +6,15 @@
 
 #include "../../../util/perf_regs.h"
 #include "../../../util/debug.h"
+#include "../../../util/event.h"
+#include "../../../util/header.h"
+#include "../../../perf-sys.h"
+#include "utils_header.h"
 
 #include <linux/kernel.h>
 
+#define PVR_POWER9		0x004E
+
 const struct sample_reg sample_reg_masks[] = {
 	SMPL_REG(r0, PERF_REG_POWERPC_R0),
 	SMPL_REG(r1, PERF_REG_POWERPC_R1),
@@ -55,6 +61,9 @@
 	SMPL_REG(dsisr, PERF_REG_POWERPC_DSISR),
 	SMPL_REG(sier, PERF_REG_POWERPC_SIER),
 	SMPL_REG(mmcra, PERF_REG_POWERPC_MMCRA),
+	SMPL_REG(mmcr0, PERF_REG_POWERPC_MMCR0),
+	SMPL_REG(mmcr1, PERF_REG_POWERPC_MMCR1),
+	SMPL_REG(mmcr2, PERF_REG_POWERPC_MMCR2),
 	SMPL_REG_END
 };
 
@@ -163,3 +172,43 @@ int arch_sdt_arg_parse_op(char *old_op, char **new_op)
 
 	return SDT_ARG_VALID;
 }
+
+uint64_t arch__intr_reg_mask(void)
+{
+	struct perf_event_attr attr = {
+		.type                   = PERF_TYPE_HARDWARE,
+		.config                 = PERF_COUNT_HW_CPU_CYCLES,
+		.sample_type            = PERF_SAMPLE_REGS_INTR,
+		.precise_ip             = 1,
+		.disabled               = 1,
+		.exclude_kernel         = 1,
+	};
+	int fd;
+	u32 version;
+	u64 extended_mask = 0, mask = PERF_REGS_MASK;
+
+	/*
+	 * Get the PVR value to set the extended
+	 * mask specific to platform.
+	 */
+	version = (((mfspr(SPRN_PVR)) >>  16) & 0xFFFF);
+	if (version == PVR_POWER9)
+		extended_mask = PERF_REG_PMU_MASK_300;
+	else
+		return mask;
+
+	attr.sample_regs_intr = extended_mask;
+	attr.sample_period = 1;
+	event_attr_init(&attr);
+
+	/*
+	 * check if the pmu supports perf extended regs, before
+	 * returning the register mask to sample.
+	 */
+	fd = sys_perf_event_open(&attr, 0, -1, -1, 0);
+	if (fd != -1) {
+		close(fd);
+		mask |= extended_mask;
+	}
+	return mask;
+}
diff --git a/tools/perf/arch/powerpc/util/utils_header.h b/tools/perf/arch/powerpc/util/utils_header.h
new file mode 100644
index 0000000..5788eb1
--- /dev/null
+++ b/tools/perf/arch/powerpc/util/utils_header.h
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __PERF_UTIL_HEADER_H
+#define __PERF_UTIL_HEADER_H
+
+#include <linux/stringify.h>
+
+#define mfspr(rn)       ({unsigned long rval; \
+			asm volatile("mfspr %0," __stringify(rn) \
+				: "=r" (rval)); rval; })
+
+#define SPRN_PVR        0x11F   /* Processor Version Register */
+#define PVR_VER(pvr)    (((pvr) >>  16) & 0xFFFF) /* Version field */
+#define PVR_REV(pvr)    (((pvr) >>   0) & 0xFFFF) /* Revison field */
+
+#endif /* __PERF_UTIL_HEADER_H */
-- 
1.8.3.1


^ permalink raw reply related

* [PATCH V6 0/2] tools/perf: Add extended regs support for powerpc
From: Athira Rajeev @ 2020-08-07 10:11 UTC (permalink / raw)
  To: mpe, acme, jolsa; +Cc: ravi.bangoria, mikey, maddy, linuxppc-dev, kjain

Patch set to add perf tools support for perf extended register capability
in powerpc. 

Patch 1/2 adds extended regs for power9 ( mmcr0, mmcr1 and mmcr2 )
to sample_reg_mask in the tool side to use with `-I?`.
Patch 2/2 adds extended regs for power10 ( mmcr3, sier2, sier3)
to sample_reg_mask in the tool side.

Ravi bangoria found an issue with `perf record -I` while testing the
changes. The same issue is currently being worked on here:
https://lkml.org/lkml/2020/7/19/413 and will be resolved once fix
from Jin Yao is merged.

This includes the perf tools side changes to support extended regs.
kernel side changes are sent as separate patchset.

Changelog:
Changes from v5 -> v6
- Split perf tools side changes to one patchset as suggested by
  Arnaldo
  Link to previous series:
  https://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=192624

Changes from v4 -> v5
- initialize `perf_reg_extended_max` to work on
  all platforms as suggested by Ravi Bangoria
- Added Reviewed-and-Tested-by from Ravi Bangoria

Changes from v3 -> v4
- Split the series and send extended regs as separate patch set here.
  Link to previous series :
  https://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=190462&state=*
  Other PMU patches are already merged in powerpc/next.

- Fixed kernel build issue when using config having
  CONFIG_PERF_EVENTS set and without CONFIG_PPC_PERF_CTRS
  reported by kernel build bot.
- Included Reviewed-by from Kajol Jain.
- Addressed review comments from Ravi Bangoria to initialize `perf_reg_extended_max`
  and define it in lowercase since it is local variable.

Anju T Sudhakar (1):
  tools/perf: Add perf tools support for extended register capability in
    powerpc

Athira Rajeev (1):
  tools/perf: Add perf tools support for extended regs in power10

 tools/arch/powerpc/include/uapi/asm/perf_regs.h | 20 ++++++++-
 tools/perf/arch/powerpc/include/perf_regs.h     |  8 +++-
 tools/perf/arch/powerpc/util/header.c           |  9 +---
 tools/perf/arch/powerpc/util/perf_regs.c        | 55 +++++++++++++++++++++++++
 tools/perf/arch/powerpc/util/utils_header.h     | 15 +++++++
 5 files changed, 97 insertions(+), 10 deletions(-)
 create mode 100644 tools/perf/arch/powerpc/util/utils_header.h

-- 
1.8.3.1


^ permalink raw reply

* [PATCH V6 1/2] powerpc/perf: Add support for outputting extended regs in perf intr_regs
From: Athira Rajeev @ 2020-08-07 10:05 UTC (permalink / raw)
  To: mpe; +Cc: ravi.bangoria, mikey, maddy, kjain, acme, jolsa, linuxppc-dev
In-Reply-To: <1596794701-23530-1-git-send-email-atrajeev@linux.vnet.ibm.com>

From: Anju T Sudhakar <anju@linux.vnet.ibm.com>

Add support for perf extended register capability in powerpc.
The capability flag PERF_PMU_CAP_EXTENDED_REGS, is used to indicate the
PMU which support extended registers. The generic code define the mask
of extended registers as 0 for non supported architectures.

Patch adds extended regs support for power9 platform by
exposing MMCR0, MMCR1 and MMCR2 registers.

REG_RESERVED mask needs update to include extended regs.
`PERF_REG_EXTENDED_MASK`, contains mask value of the supported registers,
is defined at runtime in the kernel based on platform since the supported
registers may differ from one processor version to another and hence the
MASK value.

with patch
----------

available registers: r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 r10 r11
r12 r13 r14 r15 r16 r17 r18 r19 r20 r21 r22 r23 r24 r25 r26
r27 r28 r29 r30 r31 nip msr orig_r3 ctr link xer ccr softe
trap dar dsisr sier mmcra mmcr0 mmcr1 mmcr2

PERF_RECORD_SAMPLE(IP, 0x1): 4784/4784: 0 period: 1 addr: 0
... intr regs: mask 0xffffffffffff ABI 64-bit
.... r0    0xc00000000012b77c
.... r1    0xc000003fe5e03930
.... r2    0xc000000001b0e000
.... r3    0xc000003fdcddf800
.... r4    0xc000003fc7880000
.... r5    0x9c422724be
.... r6    0xc000003fe5e03908
.... r7    0xffffff63bddc8706
.... r8    0x9e4
.... r9    0x0
.... r10   0x1
.... r11   0x0
.... r12   0xc0000000001299c0
.... r13   0xc000003ffffc4800
.... r14   0x0
.... r15   0x7fffdd8b8b00
.... r16   0x0
.... r17   0x7fffdd8be6b8
.... r18   0x7e7076607730
.... r19   0x2f
.... r20   0xc00000001fc26c68
.... r21   0xc0002041e4227e00
.... r22   0xc00000002018fb60
.... r23   0x1
.... r24   0xc000003ffec4d900
.... r25   0x80000000
.... r26   0x0
.... r27   0x1
.... r28   0x1
.... r29   0xc000000001be1260
.... r30   0x6008010
.... r31   0xc000003ffebb7218
.... nip   0xc00000000012b910
.... msr   0x9000000000009033
.... orig_r3 0xc00000000012b86c
.... ctr   0xc0000000001299c0
.... link  0xc00000000012b77c
.... xer   0x0
.... ccr   0x28002222
.... softe 0x1
.... trap  0xf00
.... dar   0x0
.... dsisr 0x80000000000
.... sier  0x0
.... mmcra 0x80000000000
.... mmcr0 0x82008090
.... mmcr1 0x1e000000
.... mmcr2 0x0
 ... thread: perf:4784

Signed-off-by: Anju T Sudhakar <anju@linux.vnet.ibm.com>
[Defined PERF_REG_EXTENDED_MASK at run time to add support for different platforms ]
Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
Reviewed-by: Madhavan Srinivasan <maddy@linux.vnet.ibm.com>
[Fix build issue using CONFIG_PERF_EVENTS without CONFIG_PPC_PERF_CTRS]
Reported-by: kernel test robot <lkp@intel.com>
Reviewed-by: Kajol Jain <kjain@linux.ibm.com>
Tested-by: Nageswara R Sastry <nasastry@in.ibm.com>
Reviewed-and-tested-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
---
 arch/powerpc/include/asm/perf_event.h        |  3 +++
 arch/powerpc/include/asm/perf_event_server.h |  5 ++++
 arch/powerpc/include/uapi/asm/perf_regs.h    | 14 +++++++++++-
 arch/powerpc/perf/core-book3s.c              |  1 +
 arch/powerpc/perf/perf_regs.c                | 34 +++++++++++++++++++++++++---
 arch/powerpc/perf/power9-pmu.c               |  6 +++++
 6 files changed, 59 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/include/asm/perf_event.h b/arch/powerpc/include/asm/perf_event.h
index 1e8b2e1..daec64d 100644
--- a/arch/powerpc/include/asm/perf_event.h
+++ b/arch/powerpc/include/asm/perf_event.h
@@ -40,4 +40,7 @@
 
 /* To support perf_regs sier update */
 extern bool is_sier_available(void);
+/* To define perf extended regs mask value */
+extern u64 PERF_REG_EXTENDED_MASK;
+#define PERF_REG_EXTENDED_MASK	PERF_REG_EXTENDED_MASK
 #endif
diff --git a/arch/powerpc/include/asm/perf_event_server.h b/arch/powerpc/include/asm/perf_event_server.h
index 86c9eb06..f6acabb 100644
--- a/arch/powerpc/include/asm/perf_event_server.h
+++ b/arch/powerpc/include/asm/perf_event_server.h
@@ -62,6 +62,11 @@ struct power_pmu {
 	int 		*blacklist_ev;
 	/* BHRB entries in the PMU */
 	int		bhrb_nr;
+	/*
+	 * set this flag with `PERF_PMU_CAP_EXTENDED_REGS` if
+	 * the pmu supports extended perf regs capability
+	 */
+	int		capabilities;
 };
 
 /*
diff --git a/arch/powerpc/include/uapi/asm/perf_regs.h b/arch/powerpc/include/uapi/asm/perf_regs.h
index f599064..225c64c 100644
--- a/arch/powerpc/include/uapi/asm/perf_regs.h
+++ b/arch/powerpc/include/uapi/asm/perf_regs.h
@@ -48,6 +48,18 @@ enum perf_event_powerpc_regs {
 	PERF_REG_POWERPC_DSISR,
 	PERF_REG_POWERPC_SIER,
 	PERF_REG_POWERPC_MMCRA,
-	PERF_REG_POWERPC_MAX,
+	/* Extended registers */
+	PERF_REG_POWERPC_MMCR0,
+	PERF_REG_POWERPC_MMCR1,
+	PERF_REG_POWERPC_MMCR2,
+	/* Max regs without the extended regs */
+	PERF_REG_POWERPC_MAX = PERF_REG_POWERPC_MMCRA + 1,
 };
+
+#define PERF_REG_PMU_MASK	((1ULL << PERF_REG_POWERPC_MAX) - 1)
+
+/* PERF_REG_EXTENDED_MASK value for CPU_FTR_ARCH_300 */
+#define PERF_REG_PMU_MASK_300   (((1ULL << (PERF_REG_POWERPC_MMCR2 + 1)) - 1) - PERF_REG_PMU_MASK)
+
+#define PERF_REG_MAX_ISA_300   (PERF_REG_POWERPC_MMCR2 + 1)
 #endif /* _UAPI_ASM_POWERPC_PERF_REGS_H */
diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c
index e29c846..65a0b76 100644
--- a/arch/powerpc/perf/core-book3s.c
+++ b/arch/powerpc/perf/core-book3s.c
@@ -2317,6 +2317,7 @@ int register_power_pmu(struct power_pmu *pmu)
 		pmu->name);
 
 	power_pmu.attr_groups = ppmu->attr_groups;
+	power_pmu.capabilities |= (ppmu->capabilities & PERF_PMU_CAP_EXTENDED_REGS);
 
 #ifdef MSR_HV
 	/*
diff --git a/arch/powerpc/perf/perf_regs.c b/arch/powerpc/perf/perf_regs.c
index a213a0a..9301e68 100644
--- a/arch/powerpc/perf/perf_regs.c
+++ b/arch/powerpc/perf/perf_regs.c
@@ -13,9 +13,11 @@
 #include <asm/ptrace.h>
 #include <asm/perf_regs.h>
 
+u64 PERF_REG_EXTENDED_MASK;
+
 #define PT_REGS_OFFSET(id, r) [id] = offsetof(struct pt_regs, r)
 
-#define REG_RESERVED (~((1ULL << PERF_REG_POWERPC_MAX) - 1))
+#define REG_RESERVED (~(PERF_REG_EXTENDED_MASK | PERF_REG_PMU_MASK))
 
 static unsigned int pt_regs_offset[PERF_REG_POWERPC_MAX] = {
 	PT_REGS_OFFSET(PERF_REG_POWERPC_R0,  gpr[0]),
@@ -69,10 +71,26 @@
 	PT_REGS_OFFSET(PERF_REG_POWERPC_MMCRA, dsisr),
 };
 
+/* Function to return the extended register values */
+static u64 get_ext_regs_value(int idx)
+{
+	switch (idx) {
+	case PERF_REG_POWERPC_MMCR0:
+		return mfspr(SPRN_MMCR0);
+	case PERF_REG_POWERPC_MMCR1:
+		return mfspr(SPRN_MMCR1);
+	case PERF_REG_POWERPC_MMCR2:
+		return mfspr(SPRN_MMCR2);
+	default: return 0;
+	}
+}
+
 u64 perf_reg_value(struct pt_regs *regs, int idx)
 {
-	if (WARN_ON_ONCE(idx >= PERF_REG_POWERPC_MAX))
-		return 0;
+	u64 perf_reg_extended_max = PERF_REG_POWERPC_MAX;
+
+	if (cpu_has_feature(CPU_FTR_ARCH_300))
+		perf_reg_extended_max = PERF_REG_MAX_ISA_300;
 
 	if (idx == PERF_REG_POWERPC_SIER &&
 	   (IS_ENABLED(CONFIG_FSL_EMB_PERF_EVENT) ||
@@ -85,6 +103,16 @@ u64 perf_reg_value(struct pt_regs *regs, int idx)
 	    IS_ENABLED(CONFIG_PPC32)))
 		return 0;
 
+	if (idx >= PERF_REG_POWERPC_MAX && idx < perf_reg_extended_max)
+		return get_ext_regs_value(idx);
+
+	/*
+	 * If the idx is referring to value beyond the
+	 * supported registers, return 0 with a warning
+	 */
+	if (WARN_ON_ONCE(idx >= perf_reg_extended_max))
+		return 0;
+
 	return regs_get_register(regs, pt_regs_offset[idx]);
 }
 
diff --git a/arch/powerpc/perf/power9-pmu.c b/arch/powerpc/perf/power9-pmu.c
index 05dae38..2a57e93 100644
--- a/arch/powerpc/perf/power9-pmu.c
+++ b/arch/powerpc/perf/power9-pmu.c
@@ -90,6 +90,8 @@ enum {
 #define POWER9_MMCRA_IFM3		0x00000000C0000000UL
 #define POWER9_MMCRA_BHRB_MASK		0x00000000C0000000UL
 
+extern u64 PERF_REG_EXTENDED_MASK;
+
 /* Nasty Power9 specific hack */
 #define PVR_POWER9_CUMULUS		0x00002000
 
@@ -434,6 +436,7 @@ static void power9_config_bhrb(u64 pmu_bhrb_filter)
 	.cache_events		= &power9_cache_events,
 	.attr_groups		= power9_pmu_attr_groups,
 	.bhrb_nr		= 32,
+	.capabilities           = PERF_PMU_CAP_EXTENDED_REGS,
 };
 
 int init_power9_pmu(void)
@@ -457,6 +460,9 @@ int init_power9_pmu(void)
 		}
 	}
 
+	/* Set the PERF_REG_EXTENDED_MASK here */
+	PERF_REG_EXTENDED_MASK = PERF_REG_PMU_MASK_300;
+
 	rc = register_power_pmu(&power9_pmu);
 	if (rc)
 		return rc;
-- 
1.8.3.1


^ permalink raw reply related

* [PATCH V6 2/2] powerpc/perf: Add extended regs support for power10 platform
From: Athira Rajeev @ 2020-08-07 10:05 UTC (permalink / raw)
  To: mpe; +Cc: ravi.bangoria, mikey, maddy, kjain, acme, jolsa, linuxppc-dev
In-Reply-To: <1596794701-23530-1-git-send-email-atrajeev@linux.vnet.ibm.com>

Include capability flag `PERF_PMU_CAP_EXTENDED_REGS` for power10
and expose MMCR3, SIER2, SIER3 registers as part of extended regs.
Also introduce `PERF_REG_PMU_MASK_31` to define extended mask
value at runtime for power10

Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
[Fix build failure on PPC32 platform]
Suggested-by: Ryan Grimm <grimm@linux.ibm.com>
Reported-by: kernel test robot <lkp@intel.com>
Reviewed-by: Kajol Jain <kjain@linux.ibm.com>
Tested-by: Nageswara R Sastry <nasastry@in.ibm.com>
Reviewed-and-tested-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
---
 arch/powerpc/include/uapi/asm/perf_regs.h |  6 ++++++
 arch/powerpc/perf/perf_regs.c             | 12 +++++++++++-
 arch/powerpc/perf/power10-pmu.c           |  6 ++++++
 3 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/include/uapi/asm/perf_regs.h b/arch/powerpc/include/uapi/asm/perf_regs.h
index 225c64c..bdf5f10 100644
--- a/arch/powerpc/include/uapi/asm/perf_regs.h
+++ b/arch/powerpc/include/uapi/asm/perf_regs.h
@@ -52,6 +52,9 @@ enum perf_event_powerpc_regs {
 	PERF_REG_POWERPC_MMCR0,
 	PERF_REG_POWERPC_MMCR1,
 	PERF_REG_POWERPC_MMCR2,
+	PERF_REG_POWERPC_MMCR3,
+	PERF_REG_POWERPC_SIER2,
+	PERF_REG_POWERPC_SIER3,
 	/* Max regs without the extended regs */
 	PERF_REG_POWERPC_MAX = PERF_REG_POWERPC_MMCRA + 1,
 };
@@ -60,6 +63,9 @@ enum perf_event_powerpc_regs {
 
 /* PERF_REG_EXTENDED_MASK value for CPU_FTR_ARCH_300 */
 #define PERF_REG_PMU_MASK_300   (((1ULL << (PERF_REG_POWERPC_MMCR2 + 1)) - 1) - PERF_REG_PMU_MASK)
+/* PERF_REG_EXTENDED_MASK value for CPU_FTR_ARCH_31 */
+#define PERF_REG_PMU_MASK_31   (((1ULL << (PERF_REG_POWERPC_SIER3 + 1)) - 1) - PERF_REG_PMU_MASK)
 
 #define PERF_REG_MAX_ISA_300   (PERF_REG_POWERPC_MMCR2 + 1)
+#define PERF_REG_MAX_ISA_31    (PERF_REG_POWERPC_SIER3 + 1)
 #endif /* _UAPI_ASM_POWERPC_PERF_REGS_H */
diff --git a/arch/powerpc/perf/perf_regs.c b/arch/powerpc/perf/perf_regs.c
index 9301e68..8e53f2f 100644
--- a/arch/powerpc/perf/perf_regs.c
+++ b/arch/powerpc/perf/perf_regs.c
@@ -81,6 +81,14 @@ static u64 get_ext_regs_value(int idx)
 		return mfspr(SPRN_MMCR1);
 	case PERF_REG_POWERPC_MMCR2:
 		return mfspr(SPRN_MMCR2);
+#ifdef CONFIG_PPC64
+	case PERF_REG_POWERPC_MMCR3:
+		return mfspr(SPRN_MMCR3);
+	case PERF_REG_POWERPC_SIER2:
+		return mfspr(SPRN_SIER2);
+	case PERF_REG_POWERPC_SIER3:
+		return mfspr(SPRN_SIER3);
+#endif
 	default: return 0;
 	}
 }
@@ -89,7 +97,9 @@ u64 perf_reg_value(struct pt_regs *regs, int idx)
 {
 	u64 perf_reg_extended_max = PERF_REG_POWERPC_MAX;
 
-	if (cpu_has_feature(CPU_FTR_ARCH_300))
+	if (cpu_has_feature(CPU_FTR_ARCH_31))
+		perf_reg_extended_max = PERF_REG_MAX_ISA_31;
+	else if (cpu_has_feature(CPU_FTR_ARCH_300))
 		perf_reg_extended_max = PERF_REG_MAX_ISA_300;
 
 	if (idx == PERF_REG_POWERPC_SIER &&
diff --git a/arch/powerpc/perf/power10-pmu.c b/arch/powerpc/perf/power10-pmu.c
index f7cff7f..8314865 100644
--- a/arch/powerpc/perf/power10-pmu.c
+++ b/arch/powerpc/perf/power10-pmu.c
@@ -87,6 +87,8 @@
 #define POWER10_MMCRA_IFM3		0x00000000C0000000UL
 #define POWER10_MMCRA_BHRB_MASK		0x00000000C0000000UL
 
+extern u64 PERF_REG_EXTENDED_MASK;
+
 /* Table of alternatives, sorted by column 0 */
 static const unsigned int power10_event_alternatives[][MAX_ALT] = {
 	{ PM_RUN_CYC_ALT,		PM_RUN_CYC },
@@ -397,6 +399,7 @@ static void power10_config_bhrb(u64 pmu_bhrb_filter)
 	.cache_events		= &power10_cache_events,
 	.attr_groups		= power10_pmu_attr_groups,
 	.bhrb_nr		= 32,
+	.capabilities           = PERF_PMU_CAP_EXTENDED_REGS,
 };
 
 int init_power10_pmu(void)
@@ -408,6 +411,9 @@ int init_power10_pmu(void)
 	    strcmp(cur_cpu_spec->oprofile_cpu_type, "ppc64/power10"))
 		return -ENODEV;
 
+	/* Set the PERF_REG_EXTENDED_MASK here */
+	PERF_REG_EXTENDED_MASK = PERF_REG_PMU_MASK_31;
+
 	rc = register_power_pmu(&power10_pmu);
 	if (rc)
 		return rc;
-- 
1.8.3.1


^ permalink raw reply related

* [PATCH V6 0/2] powerpc/perf: Add support for perf extended regs in powerpc
From: Athira Rajeev @ 2020-08-07 10:04 UTC (permalink / raw)
  To: mpe; +Cc: ravi.bangoria, mikey, maddy, kjain, acme, jolsa, linuxppc-dev

Patch set to add support for perf extended register capability in
powerpc. The capability flag PERF_PMU_CAP_EXTENDED_REGS, is used to
indicate the PMU which support extended registers. The generic code
define the mask of extended registers as 0 for non supported architectures.

patch 1/2 defines the PERF_PMU_CAP_EXTENDED_REGS mask to output the
values of mmcr0,mmcr1,mmcr2 for POWER9. Defines `PERF_REG_EXTENDED_MASK`
at runtime which contains mask value of the supported registers under
extended regs.

patch 2/2 adds the extended regs support for power10 and exposes
MMCR3, SIER2, SIER3 registers as part of extended regs.

This patch series is based on powerpc/next and includes the kernel
side changes to support extended regs. perf tools side changes will
be sent as separate patchset.

Changelog:
Changes from v5 -> v6
- Split kernel changes to one patchset as suggested by
  Arnaldo
  Link to previous series:
  https://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=192624

Changes from v4 -> v5
- initialize `perf_reg_extended_max` to work on
  all platforms as suggested by Ravi Bangoria
- Added Reviewed-and-Tested-by from Ravi Bangoria

Changes from v3 -> v4
- Split the series and send extended regs as separate patch set here.
  Link to previous series :
  https://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=190462&state=*
  Other PMU patches are already merged in powerpc/next.

- Fixed kernel build issue when using config having
  CONFIG_PERF_EVENTS set and without CONFIG_PPC_PERF_CTRS
  reported by kernel build bot.
- Included Reviewed-by from Kajol Jain.
- Addressed review comments from Ravi Bangoria to initialize `perf_reg_extended_max`
  and define it in lowercase since it is local variable.

Anju T Sudhakar (1):
  powerpc/perf: Add support for outputting extended regs in perf
    intr_regs

Athira Rajeev (1):
  powerpc/perf: Add extended regs support for power10 platform

 arch/powerpc/include/asm/perf_event.h        |  3 ++
 arch/powerpc/include/asm/perf_event_server.h |  5 ++++
 arch/powerpc/include/uapi/asm/perf_regs.h    | 20 ++++++++++++-
 arch/powerpc/perf/core-book3s.c              |  1 +
 arch/powerpc/perf/perf_regs.c                | 44 ++++++++++++++++++++++++++--
 arch/powerpc/perf/power10-pmu.c              |  6 ++++
 arch/powerpc/perf/power9-pmu.c               |  6 ++++
 7 files changed, 81 insertions(+), 4 deletions(-)

-- 
1.8.3.1


^ permalink raw reply

* Re: [PATCH v5 3/3] mm/page_alloc: Keep memoryless cpuless node 0 offline
From: Michal Suchánek @ 2020-08-07 10:04 UTC (permalink / raw)
  To: David Hildenbrand
  Cc: Gautham R Shenoy, Andi Kleen, Srikar Dronamraju, Linus Torvalds,
	linux-kernel, Michal Hocko, linux-mm, Satheesh Rajendran,
	Mel Gorman, Kirill A. Shutemov, Andrew Morton, linuxppc-dev,
	Christopher Lameter, Vlastimil Babka
In-Reply-To: <5688b358-36bc-ccf0-d24b-a65375a9f3c3@redhat.com>

On Fri, Aug 07, 2020 at 08:58:09AM +0200, David Hildenbrand wrote:
> On 07.08.20 06:32, Andrew Morton wrote:
> > On Fri, 3 Jul 2020 18:28:23 +0530 Srikar Dronamraju <srikar@linux.vnet.ibm.com> wrote:
> > 
> >>> The memory hotplug changes that somehow because you can hotremove numa
> >>> nodes and therefore make the nodemask sparse but that is not a common
> >>> case. I am not sure what would happen if a completely new node was added
> >>> and its corresponding node was already used by the renumbered one
> >>> though. It would likely conflate the two I am afraid. But I am not sure
> >>> this is really possible with x86 and a lack of a bug report would
> >>> suggest that nobody is doing that at least.
> >>>
> >>
> >> JFYI,
> >> Satheesh copied in this mailchain had opened a bug a year on crash with vcpu
> >> hotplug on memoryless node. 
> >>
> >> https://bugzilla.kernel.org/show_bug.cgi?id=202187
> > 
> > So...  do we merge this patch or not?  Seems that the overall view is
> > "risky but nobody is likely to do anything better any time soon"?
> 
> I recall the issue Michal saw was "fix powerpc" vs. "break other
> architectures". @Michal how should we proceed? At least x86-64 won't be
> affected IIUC.
There is a patch to introduce the node remapping on ppc as well which
should eliminate the empty node 0.

https://patchwork.ozlabs.org/project/linuxppc-dev/patch/20200731111916.243569-1-aneesh.kumar@linux.ibm.com/

Thanks

Michal

^ permalink raw reply

* Re: [PATCH v2 2/2] powerpc/pci: unmap all interrupts when a PHB is removed
From: Cédric Le Goater @ 2020-08-07 10:02 UTC (permalink / raw)
  To: Alexey Kardashevskiy, Michael Ellerman
  Cc: Oliver O'Halloran, linuxppc-dev
In-Reply-To: <5d5e128d-ac5f-1003-0b3f-3017c612e1ea@ozlabs.ru>

On 8/7/20 8:01 AM, Alexey Kardashevskiy wrote:
> 
> 
> On 18/06/2020 02:29, Cédric Le Goater wrote:
>> Some PCI adapters, like GPUs, use the "interrupt-map" property to
>> describe interrupt mappings other than the legacy INTx interrupts.
>> There can be more than 4 mappings.
>>
>> To clear all interrupts when a PHB is removed, we need to increase the
>> 'irq_map' array in which mappings are recorded. Compute the number of
>> interrupt mappings from the "interrupt-map" property and allocate a
>> bigger 'irq_map' array.
>>
>> Signed-off-by: Cédric Le Goater <clg@kaod.org>
>> ---
>>  arch/powerpc/kernel/pci-common.c | 49 +++++++++++++++++++++++++++++++-
>>  1 file changed, 48 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
>> index 515480a4bac6..deb831f0ae13 100644
>> --- a/arch/powerpc/kernel/pci-common.c
>> +++ b/arch/powerpc/kernel/pci-common.c
>> @@ -353,9 +353,56 @@ struct pci_controller *pci_find_controller_for_domain(int domain_nr)
>>  	return NULL;
>>  }
>>  
>> +/*
>> + * Assumption is made on the interrupt parent. All interrupt-map
>> + * entries are considered to have the same parent.
>> + */
>> +static int pcibios_irq_map_count(struct pci_controller *phb)
> 
> I wonder if
> int of_irq_count(struct device_node *dev)
> could work here too. If it does not, then never mind.

I wished it would, but no.

> Other than that, the only other comment is - merge this one into 1/2 as
> 1/2 alone won't properly fix the problem but it may look like that it does:
> 
> for phyp, the test machine just happens to have 4 entries in the map but
> this is the phyp implementation detail;

yes
 
> for qemu, there are more but we only unregister 4 but kvm does not care
> in general so it is ok which is also implementation detail;
>
> and 2/2 just makes these details not matter. Thanks,

OK. It will ease backport. Sending a v2.

Thanks for the review Alexey !

C.
 
> 
> 
>> +{
>> +	const __be32 *imap;
>> +	int imaplen;
>> +	struct device_node *parent;
>> +	u32 intsize, addrsize, parintsize, paraddrsize;
>> +
>> +	if (of_property_read_u32(phb->dn, "#interrupt-cells", &intsize))
>> +		return 0;
>> +	if (of_property_read_u32(phb->dn, "#address-cells", &addrsize))
>> +		return 0;
>> +
>> +	imap = of_get_property(phb->dn, "interrupt-map", &imaplen);
>> +	if (!imap) {
>> +		pr_debug("%pOF : no interrupt-map\n", phb->dn);
>> +		return 0;
>> +	}
>> +	imaplen /= sizeof(u32);
>> +	pr_debug("%pOF : imaplen=%d\n", phb->dn, imaplen);
>> +
>> +	if (imaplen < (addrsize + intsize + 1))
>> +		return 0;
>> +
>> +	imap += intsize + addrsize;
>> +	parent = of_find_node_by_phandle(be32_to_cpup(imap));
>> +	if (!parent) {
>> +		pr_debug("%pOF : no imap parent found !\n", phb->dn);
>> +		return 0;
>> +	}
>> +
>> +	if (of_property_read_u32(parent, "#interrupt-cells", &parintsize)) {
>> +		pr_debug("%pOF : parent lacks #interrupt-cells!\n", phb->dn);
>> +		return 0;
>> +	}
>> +
>> +	if (of_property_read_u32(parent, "#address-cells", &paraddrsize))
>> +		paraddrsize = 0;
>> +
>> +	return imaplen / (addrsize + intsize + 1 + paraddrsize + parintsize);
>> +}
>> +
>>  static void pcibios_irq_map_init(struct pci_controller *phb)
>>  {
>> -	phb->irq_count = PCI_NUM_INTX;
>> +	phb->irq_count = pcibios_irq_map_count(phb);
>> +	if (phb->irq_count < PCI_NUM_INTX)
>> +		phb->irq_count = PCI_NUM_INTX;
>>  
>>  	pr_debug("%pOF : interrupt map #%d\n", phb->dn, phb->irq_count);
>>  
>>
> 


^ permalink raw reply

* [PATCH] ASoC: fsl_sai: Add -EPROBE_DEFER check for regmap init
From: Shengjiu Wang @ 2020-08-07  9:14 UTC (permalink / raw)
  To: timur, nicoleotsuka, Xiubo.Lee, festevam, lgirdwood, broonie,
	perex, tiwai, alsa-devel, linuxppc-dev, linux-kernel

Regmap initialization may return -EPROBE_DEFER for clock
may not be ready, so check -EPROBE_DEFER error type before
start another Regmap initialization.

Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
---
 sound/soc/fsl/fsl_sai.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c
index a22562f2df47..eb933fe9b6d1 100644
--- a/sound/soc/fsl/fsl_sai.c
+++ b/sound/soc/fsl/fsl_sai.c
@@ -927,7 +927,7 @@ static int fsl_sai_probe(struct platform_device *pdev)
 			"bus", base, &fsl_sai_regmap_config);
 
 	/* Compatible with old DTB cases */
-	if (IS_ERR(sai->regmap))
+	if (IS_ERR(sai->regmap) && PTR_ERR(sai->regmap) != -EPROBE_DEFER)
 		sai->regmap = devm_regmap_init_mmio_clk(&pdev->dev,
 				"sai", base, &fsl_sai_regmap_config);
 	if (IS_ERR(sai->regmap)) {
-- 
2.27.0


^ permalink raw reply related

* [PATCH v2 2/2] powerpc/topology: Override cpu_smt_mask
From: Srikar Dronamraju @ 2020-08-07  7:45 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: Gautham R Shenoy, Michael Neuling, Vincent Guittot,
	Srikar Dronamraju, Peter Zijlstra, Mel Gorman, LKML,
	Valentin Schneider, linuxppc-dev, Ingo Molnar, Dietmar Eggemann
In-Reply-To: <20200807074517.27957-1-srikar@linux.vnet.ibm.com>

On Power9, a pair of SMT4 cores can be presented by the firmware as a SMT8
core for backward compatibility reasons, with the fusion of two SMT4 cores.
Powerpc allows LPARs to be live migrated from Power8 to Power9.  Existing
software developed/configured for Power8, expects to see a SMT8 core.

In order to maintain userspace backward compatibility (with Power8 chips in
case of Power9) in enterprise Linux systems, the topology_sibling_cpumask
has to be set to SMT8 core.

cpu_smt_mask() should generally point to the cpu mask of the SMT4 core.
Hence override the default cpu_smt_mask() to be powerpc specific
allowing for better scheduling behaviour on Power.

schbench
(latency measured in usecs, so lesser is better)
Without patch                   With patch
Latency percentiles (usec)	Latency percentiles (usec)
	50.0000th: 34           	50.0000th: 38
	75.0000th: 47           	75.0000th: 52
	90.0000th: 54           	90.0000th: 60
	95.0000th: 57           	95.0000th: 64
	*99.0000th: 62          	*99.0000th: 72
	99.5000th: 65           	99.5000th: 75
	99.9000th: 76           	99.9000th: 3452
	min=0, max=9205         	min=0, max=9344

schbench (With Cede disabled)
Without patch                   With patch
Latency percentiles (usec) 	Latency percentiles (usec)
	50.0000th: 20           	50.0000th: 21
	75.0000th: 28           	75.0000th: 29
	90.0000th: 33           	90.0000th: 34
	95.0000th: 35           	95.0000th: 37
	*99.0000th: 40          	*99.0000th: 40
	99.5000th: 48           	99.5000th: 42
	99.9000th: 94           	99.9000th: 79
	min=0, max=791          	min=0, max=791

perf bench sched pipe
usec/ops : lesser is better
Without patch
  N           Min           Max        Median           Avg        Stddev
101      5.095113      5.595269      5.204842     5.2298776    0.10762713

5.10 - 5.15 : ##################################################   23% (24)
5.15 - 5.20 : #############################################        21% (22)
5.20 - 5.25 : ##################################################   23% (24)
5.25 - 5.30 : #########################                            11% (12)
5.30 - 5.35 : ##########                                            4% (5)
5.35 - 5.40 : ########                                              3% (4)
5.40 - 5.45 : ########                                              3% (4)
5.45 - 5.50 : ####                                                  1% (2)
5.50 - 5.55 : ##                                                    0% (1)
5.55 - 5.60 : ####                                                  1% (2)

With patch
  N           Min           Max        Median           Avg        Stddev
101      5.134675      8.524719      5.207658     5.2780985    0.34911969

5.1 - 5.5 : ##################################################   94% (95)
5.5 - 5.8 : ##                                                    3% (4)
5.8 - 6.2 :                                                       0% (1)
6.2 - 6.5 :
6.5 - 6.8 :
6.8 - 7.2 :
7.2 - 7.5 :
7.5 - 7.8 :
7.8 - 8.2 :
8.2 - 8.5 :

perf bench sched pipe (cede disabled)
usec/ops : lesser is better
Without patch
  N           Min           Max        Median           Avg        Stddev
101      7.884227     12.576538      7.956474     8.0170722    0.46159054

7.9 - 8.4 : ##################################################   99% (100)
8.4 - 8.8 :
8.8 - 9.3 :
9.3 - 9.8 :
9.8 - 10.2 :
10.2 - 10.7 :
10.7 - 11.2 :
11.2 - 11.6 :
11.6 - 12.1 :
12.1 - 12.6 :

With patch
  N           Min           Max        Median           Avg        Stddev
101      7.956021      8.217284      8.015615     8.0283866   0.049844967

7.96 - 7.98 : ######################                               12% (13)
7.98 - 8.01 : ##################################################   28% (29)
8.01 - 8.03 : ####################################                 20% (21)
8.03 - 8.06 : #########################                            14% (15)
8.06 - 8.09 : ######################                               12% (13)
8.09 - 8.11 : ######                                                3% (4)
8.11 - 8.14 : ###                                                   1% (2)
8.14 - 8.17 : ###                                                   1% (2)
8.17 - 8.19 :
8.19 - 8.22 : #                                                     0% (1)

Observations: With the patch, the initial run/iteration takes a slight
longer time. This can be attributed to the fact that now we pick a CPU
from a idle core which could be sleep mode. Once we remove the cede,
state the numbers improve in favour of the patch.

ebizzy:
transactions per second (higher is better)
without patch
  N           Min           Max        Median           Avg        Stddev
100       1018433       1304470       1193208     1182315.7     60018.733

1018433 - 1047037 : ######                                                3% (3)
1047037 - 1075640 : ########                                              4% (4)
1075640 - 1104244 : ########                                              4% (4)
1104244 - 1132848 : ###############                                       7% (7)
1132848 - 1161452 : ####################################                 17% (17)
1161452 - 1190055 : ##########################                           12% (12)
1190055 - 1218659 : #############################################        21% (21)
1218659 - 1247263 : ##################################################   23% (23)
1247263 - 1275866 : ########                                              4% (4)
1275866 - 1304470 : ########                                              4% (4)

with patch
  N           Min           Max        Median           Avg        Stddev
100        967014       1292938       1208819     1185281.8     69815.851

 967014 - 999606  : ##                                                    1% (1)
 999606 - 1032199 : ##                                                    1% (1)
1032199 - 1064791 : ############                                          6% (6)
1064791 - 1097384 : ##########                                            5% (5)
1097384 - 1129976 : ##################                                    9% (9)
1129976 - 1162568 : ####################                                 10% (10)
1162568 - 1195161 : ##########################                           13% (13)
1195161 - 1227753 : ############################################         22% (22)
1227753 - 1260346 : ##################################################   25% (25)
1260346 - 1292938 : ##############                                        7% (7)

Observations: Not much changes, ebizzy is not much impacted.

Cc: linuxppc-dev <linuxppc-dev@lists.ozlabs.org>
Cc: LKML <linux-kernel@vger.kernel.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Michael Neuling <mikey@neuling.org>
Cc: Gautham R Shenoy <ego@linux.vnet.ibm.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Valentin Schneider <valentin.schneider@arm.com>
Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Vincent Guittot <vincent.guittot@linaro.org>
Cc: Vaidyanathan Srinivasan <svaidy@linux.ibm.com>
Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
---
Changelog v1->v2:
	Modified commit msg as per mailing list discussion.
	Added performance numbers

 arch/powerpc/include/asm/cputhreads.h |  1 -
 arch/powerpc/include/asm/smp.h        | 13 +++++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/include/asm/cputhreads.h b/arch/powerpc/include/asm/cputhreads.h
index deb99fd6e060..98c8bd155bf9 100644
--- a/arch/powerpc/include/asm/cputhreads.h
+++ b/arch/powerpc/include/asm/cputhreads.h
@@ -23,7 +23,6 @@
 extern int threads_per_core;
 extern int threads_per_subcore;
 extern int threads_shift;
-extern bool has_big_cores;
 extern cpumask_t threads_core_mask;
 #else
 #define threads_per_core	1
diff --git a/arch/powerpc/include/asm/smp.h b/arch/powerpc/include/asm/smp.h
index 9cd0765633c5..bb06aa875131 100644
--- a/arch/powerpc/include/asm/smp.h
+++ b/arch/powerpc/include/asm/smp.h
@@ -131,6 +131,19 @@ static inline struct cpumask *cpu_smallcore_mask(int cpu)
 
 extern int cpu_to_core_id(int cpu);
 
+extern bool has_big_cores;
+
+#define cpu_smt_mask cpu_smt_mask
+#ifdef CONFIG_SCHED_SMT
+static inline const struct cpumask *cpu_smt_mask(int cpu)
+{
+	if (has_big_cores)
+		return per_cpu(cpu_smallcore_map, cpu);
+
+	return per_cpu(cpu_sibling_map, cpu);
+}
+#endif /* CONFIG_SCHED_SMT */
+
 /* Since OpenPIC has only 4 IPIs, we use slightly different message numbers.
  *
  * Make sure this matches openpic_request_IPIs in open_pic.c, or what shows up
-- 
2.18.2


^ permalink raw reply related

* [PATCH v2 1/2] sched/topology: Allow archs to override cpu_smt_mask
From: Srikar Dronamraju @ 2020-08-07  7:45 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: Gautham R Shenoy, Michael Neuling, Vincent Guittot,
	Srikar Dronamraju, Peter Zijlstra, Mel Gorman, LKML,
	Valentin Schneider, linuxppc-dev, Ingo Molnar, Dietmar Eggemann

cpu_smt_mask tracks topology_sibling_cpumask. This would be good for
most architectures. One of the users of cpu_smt_mask(), would be to
identify idle-cores. On Power9, a pair of SMT4 cores can be presented by
the firmware as a SMT8 core for backward compatibility reasons.

Powerpc allows LPARs to be live migrated from Power8 to Power9. Do note
Power8 had only SMT8 cores. Existing software which has been
developed/configured for Power8 would expect to see SMT8 core.
Maintaining the illusion of SMT8 core is a requirement to make that
work.

In order to maintain above userspace backward compatibility with
previous versions of processor, Power9 onwards there is option to the
firmware to advertise a pair of SMT4 cores as a fused cores aka SMT8
core. On Power9 this pair shares the L2 cache as well. However, from the
scheduler's point of view, a core should be determined by SMT4, since
its a completely independent unit of compute. Hence allow PowerPc
architecture to override the default cpu_smt_mask() to point to the SMT4
cores in a SMT8 mode.

This will ensure the scheduler is always given the right information.

Cc: linuxppc-dev <linuxppc-dev@lists.ozlabs.org>
Cc: LKML <linux-kernel@vger.kernel.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Michael Neuling <mikey@neuling.org>
Cc: Gautham R Shenoy <ego@linux.vnet.ibm.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Valentin Schneider <valentin.schneider@arm.com>
Cc: Dietmar Eggemann <dietmar.eggemann@arm.com>
Cc: Mel Gorman <mgorman@techsingularity.net>
Cc: Vincent Guittot <vincent.guittot@linaro.org>
Cc: Vaidyanathan Srinivasan <svaidy@linux.ibm.com>
Acked-by; Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
---
Changelog v1->v2:
	Update the commit msg based on the discussion in community esp
	with Peter Zijlstra and Michael Ellerman.

 include/linux/topology.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/topology.h b/include/linux/topology.h
index 608fa4aadf0e..ad03df1cc266 100644
--- a/include/linux/topology.h
+++ b/include/linux/topology.h
@@ -198,7 +198,7 @@ static inline int cpu_to_mem(int cpu)
 #define topology_die_cpumask(cpu)		cpumask_of(cpu)
 #endif
 
-#ifdef CONFIG_SCHED_SMT
+#if defined(CONFIG_SCHED_SMT) && !defined(cpu_smt_mask)
 static inline const struct cpumask *cpu_smt_mask(int cpu)
 {
 	return topology_sibling_cpumask(cpu);
-- 
2.18.2


^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox