LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH v3 0/4] powerpc/selftests: Add Power10 2nd DAWR selftests
From: Michael Ellerman @ 2021-04-29 14:01 UTC (permalink / raw)
  To: mpe, Ravi Bangoria; +Cc: linuxppc-dev, mikey, shuah, linux-kselftest, dja
In-Reply-To: <20210412112218.128183-1-ravi.bangoria@linux.ibm.com>

On Mon, 12 Apr 2021 16:52:14 +0530, Ravi Bangoria wrote:
> Power10 introduced 2nd watchpoint (DAWR). ISA 3.1, Book 3S, Ch 9 -
> 'Debug Facilities' covers the feature in detail. Kernel patches to
> enable the 2nd DAWR are already in[1], including kvm enablement[2].
> These patches adds selftests for 2nd DAWR.
> 
> [1]: https://git.kernel.org/torvalds/c/deb2bd9bcc8428d4b65b6ba640ba8b57c1b20b17
> [2]: https://git.kernel.org/torvalds/c/bd1de1a0e6eff4bde5ceae969673b85b8446fd6a
> 
> [...]

Applied to powerpc/next.

[1/4] powerpc/selftests/ptrace-hwbreak: Add testcases for 2nd DAWR
      https://git.kernel.org/powerpc/c/dae4ff8031b49af4721101d6298fc14cb9c16a4c
[2/4] powerpc/selftests/perf-hwbreak: Coalesce event creation code
      https://git.kernel.org/powerpc/c/c9cb0afb4eaa03801322f48dad4093979ff45e88
[3/4] powerpc/selftests/perf-hwbreak: Add testcases for 2nd DAWR
      https://git.kernel.org/powerpc/c/c65c64cc7bbd273121edf96a7a5a0269038ab454
[4/4] powerpc/selftests: Add selftest to test concurrent perf/ptrace events
      https://git.kernel.org/powerpc/c/290f7d8ce2b1eea5413bb120e0d9d610675b7fba

cheers

^ permalink raw reply

* Re: [PATCH] powerpc/papr_scm: Mark nvdimm as unarmed if needed during probe
From: Michael Ellerman @ 2021-04-29 14:01 UTC (permalink / raw)
  To: Vaibhav Jain, linux-nvdimm, linuxppc-dev
  Cc: Shivaprasad G Bhat, Aneesh Kumar K . V
In-Reply-To: <20210329113103.476760-1-vaibhav@linux.ibm.com>

On Mon, 29 Mar 2021 17:01:03 +0530, Vaibhav Jain wrote:
> In case an nvdimm is found to be unarmed during probe then set its
> NDD_UNARMED flag before nvdimm_create(). This would enforce a
> read-only access to the ndimm region. Presently even if an nvdimm is
> unarmed its not marked as read-only on ppc64 guests.
> 
> The patch updates papr_scm_nvdimm_init() to force query of nvdimm
> health via __drc_pmem_query_health() and if nvdimm is found to be
> unarmed then set the nvdimm flag ND_UNARMED for nvdimm_create().

Applied to powerpc/next.

[1/1] powerpc/papr_scm: Mark nvdimm as unarmed if needed during probe
      https://git.kernel.org/powerpc/c/adb68c38d8d49a3d60805479c558649bb2182473

cheers

^ permalink raw reply

* Re: [PATCH] powerpc/64s: remove unneeded semicolon
From: Michael Ellerman @ 2021-04-29 14:01 UTC (permalink / raw)
  To: Yang Li, mpe; +Cc: paulus, linuxppc-dev, linux-kernel
In-Reply-To: <1612236877-104974-1-git-send-email-yang.lee@linux.alibaba.com>

On Tue, 2 Feb 2021 11:34:36 +0800, Yang Li wrote:
> Eliminate the following coccicheck warning:
> ./arch/powerpc/platforms/powernv/setup.c:160:2-3: Unneeded semicolon

Applied to powerpc/next.

[1/1] powerpc/64s: remove unneeded semicolon
      https://git.kernel.org/powerpc/c/caea7b833d866e0badf4b12dc41bf9fe6a7295f3

cheers

^ permalink raw reply

* Re: [PATCH] powerpc/eeh: remove unneeded semicolon
From: Michael Ellerman @ 2021-04-29 14:01 UTC (permalink / raw)
  To: Yang Li, ruscur; +Cc: oohall, linuxppc-dev, linux-kernel, paulus
In-Reply-To: <1612236096-91154-1-git-send-email-yang.lee@linux.alibaba.com>

On Tue, 2 Feb 2021 11:21:36 +0800, Yang Li wrote:
> Eliminate the following coccicheck warning:
> ./arch/powerpc/kernel/eeh.c:782:2-3: Unneeded semicolon

Applied to powerpc/next.

[1/1] powerpc/eeh: remove unneeded semicolon
      https://git.kernel.org/powerpc/c/f3d03fc748d4e48f4cd8dea1bfeb173cb3b0c19f

cheers

^ permalink raw reply

* Re: [PATCH] selftests/powerpc: remove unneeded semicolon
From: Michael Ellerman @ 2021-04-29 14:01 UTC (permalink / raw)
  To: Yang Li, shuah; +Cc: linux-kernel, paulus, linux-kselftest, linuxppc-dev
In-Reply-To: <1612780870-95890-1-git-send-email-yang.lee@linux.alibaba.com>

On Mon, 8 Feb 2021 18:41:10 +0800, Yang Li wrote:
> Eliminate the following coccicheck warning:
> ./tools/testing/selftests/powerpc/nx-gzip/gzfht_test.c:327:4-5: Unneeded
> semicolon

Applied to powerpc/next.

[1/1] selftests/powerpc: remove unneeded semicolon
      https://git.kernel.org/powerpc/c/0db11461677aa5105b9ebbd939aee0ceb77a988b

cheers

^ permalink raw reply

* Re: PPC32: Boot regression on Nintendo Wii, after create_branch rework in 5.8
From: Christophe Leroy @ 2021-04-29 14:26 UTC (permalink / raw)
  To: Jonathan Neuschäfer, Jordan Niethe
  Cc: Emmanuel Gil Peyrot, Alistair Popple, linuxppc-dev
In-Reply-To: <YIml+D0kB3t3BMXB@latitude>

Hi,

Le 28/04/2021 à 20:14, Jonathan Neuschäfer a écrit :
> Hi,
> 
> On Wed, Apr 28, 2021 at 11:33:24AM +1000, Jordan Niethe wrote:
>> On Mon, Apr 26, 2021 at 1:40 AM Jonathan Neuschäfer
>> <j.neuschaefer@gmx.net> wrote:
>>>
>>> Hi,
>>>
>>> I recently booted my Wii again, and I noticed a regression at boot time.
>>> Output stops after the "Finalizing device tree... flat tree at 0xXXXXXX"
>>> message. I bisected it to this commit in the 5.8 development cycle:
>>>
>>> commit 7c95d8893fb55869882c9f68f4c94840dc43f18f
>>> Author: Jordan Niethe <jniethe5@gmail.com>
>>> Date:   Wed May 6 13:40:25 2020 +1000
>>>
>>>      powerpc: Change calling convention for create_branch() et. al.
> [...]
>>> Do you have any hints on how to debug and/or fix this issue?
>> Thanks for bisecting and reporting.
>> The "Finalizing device tree... flat tree at 0xXXXXXX" message comes
>> from the bootwrapper so if that is the last output it must be crashing
>> pretty early.
>> Commit 7c95d8893fb5 ("powerpc: Change calling convention for
>> create_branch() et. al.") made a change to machine_init() in
>> setup_32.c which seems like it might be a likely culprit for causing
>> early crashing.
>> The branch that is created and patched is just for optimization, so to
>> see if that is in fact the problem it might be worth trying to boot
>> with a patch like below
>>
>> diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
>> --- a/arch/powerpc/kernel/setup_32.c
>> +++ b/arch/powerpc/kernel/setup_32.c
>> @@ -87,9 +87,6 @@ notrace void __init machine_init(u64 dt_ptr)
>>
>>          patch_instruction_site(&patch__memcpy_nocache, ppc_inst(PPC_INST_NOP));
>>
>> -       create_cond_branch(&insn, addr, branch_target(addr), 0x820000);
>> -       patch_instruction(addr, insn);  /* replace b by bne cr0 */
>> -
>>          /* Do some early initialization based on the flat device tree */
>>          early_init_devtree(__va(dt_ptr));
> 
> This brings no improvement, unfortunately. The output is still:
> 
> top of MEM2 @ 13F00000
> 
> zImage starting: loaded at 0x00b00000 (sp: 0x01145f90)
> Allocating 0xae3970 bytes for kernel...
> Decompressing (0x00000000 <- 0x00b11000:0x01143576)...
> Done! Decompressed 0xa65fdc bytes
> 
> Linux/PowerPC load: root=/dev/mmcblk0p2 rootwait console=usbgecko1
> Finalizing device tree... flat tree at 0x11467a0
> 
> 
> I'll probably dig deeper next weekend.
> 

I think the problem is when calling apply_feature_fixups() from early_init().

At that time, code is not relocated yet and 'current' is not set up yet.

You probably have CONFIG_STACKPROTECTOR=y

Before this patch, do_feature_fixups() was a simple fonction that was not using the stack for 
storing data. But that patch changed it because it addresses the 'instr' by reference so it can't go 
in a general reg anymore, it goes into the stack.

So GCC sets up a stack guard:

00000000 <do_feature_fixups>:
    0:	7c 04 28 40 	cmplw   r4,r5
    4:	94 21 ff b0 	stwu    r1,-80(r1)
    8:	81 22 02 28 	lwz     r9,552(r2)      <= r2 is not set up yet
    c:	91 21 00 1c 	stw     r9,28(r1)
...
  180:	81 21 00 1c 	lwz     r9,28(r1)
  184:	81 42 02 28 	lwz     r10,552(r2)
  188:	7d 29 52 79 	xor.    r9,r9,r10
  18c:	39 40 00 00 	li      r10,0
  190:	40 82 00 84 	bne     214 <do_feature_fixups+0x214>
  194:	38 21 00 50 	addi    r1,r1,80
  198:	4e 80 00 20 	blr
...
  214:	7c 08 02 a6 	mflr    r0
  218:	90 01 00 54 	stw     r0,84(r1)
  21c:	92 e1 00 2c 	stw     r23,44(r1)
  220:	93 01 00 30 	stw     r24,48(r1)
  224:	93 21 00 34 	stw     r25,52(r1)
  228:	93 41 00 38 	stw     r26,56(r1)
  22c:	93 61 00 3c 	stw     r27,60(r1)
  230:	93 81 00 40 	stw     r28,64(r1)
  234:	93 a1 00 44 	stw     r29,68(r1)
  238:	93 c1 00 48 	stw     r30,72(r1)
  23c:	93 e1 00 4c 	stw     r31,76(r1)
  240:	48 00 00 01 	bl      240 <do_feature_fixups+0x240>
			240: R_PPC_REL24	__stack_chk_fail

So all feature fixup and code patching stuff it uses needs to be protected against the stack protector.

By the way, I also see some printk in do_feature_fixups(). That won't work either because of the 
relocation, the string won't be found. But that's not the problem you have at the moment.

Christophe

^ permalink raw reply

* [powerpc:next-test 263/291] arch/powerpc/platforms/powernv/opal-fadump.c:683:60: sparse: sparse: incorrect type in argument 2 (different base types)
From: kernel test robot @ 2021-04-29 15:31 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev, kbuild-all

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

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next-test
head:   5256426247837feb8703625bda7fcfc824af04cf
commit: d936f8182e1bd18f5e9e6c5e8d8b69261200ca96 [263/291] powerpc/powernv: Fix type of opal_mpipl_query_tag() addr argument
config: powerpc64-randconfig-s031-20210429 (attached as .config)
compiler: powerpc64le-linux-gcc (GCC) 9.3.0
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # apt-get install sparse
        # sparse version: v0.6.3-341-g8af24329-dirty
        # https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/commit/?id=d936f8182e1bd18f5e9e6c5e8d8b69261200ca96
        git remote add powerpc https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git
        git fetch --no-tags powerpc next-test
        git checkout d936f8182e1bd18f5e9e6c5e8d8b69261200ca96
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' W=1 ARCH=powerpc64 

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


sparse warnings: (new ones prefixed by >>)
   arch/powerpc/platforms/powernv/opal-fadump.c:104:41: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned long long [usertype] boot_mem_dest_addr @@     got restricted __be64 const [usertype] dest @@
   arch/powerpc/platforms/powernv/opal-fadump.c:104:41: sparse:     expected unsigned long long [usertype] boot_mem_dest_addr
   arch/powerpc/platforms/powernv/opal-fadump.c:104:41: sparse:     got restricted __be64 const [usertype] dest
   arch/powerpc/platforms/powernv/opal-fadump.c:130:22: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned long base @@     got restricted __be64 const [usertype] src @@
   arch/powerpc/platforms/powernv/opal-fadump.c:130:22: sparse:     expected unsigned long base
   arch/powerpc/platforms/powernv/opal-fadump.c:130:22: sparse:     got restricted __be64 const [usertype] src
   arch/powerpc/platforms/powernv/opal-fadump.c:131:22: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned long size @@     got restricted __be64 const [usertype] size @@
   arch/powerpc/platforms/powernv/opal-fadump.c:131:22: sparse:     expected unsigned long size
   arch/powerpc/platforms/powernv/opal-fadump.c:131:22: sparse:     got restricted __be64 const [usertype] size
   arch/powerpc/platforms/powernv/opal-fadump.c:146:46: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned long reserve_dump_area_start @@     got restricted __be64 const [usertype] dest @@
   arch/powerpc/platforms/powernv/opal-fadump.c:146:46: sparse:     expected unsigned long reserve_dump_area_start
   arch/powerpc/platforms/powernv/opal-fadump.c:146:46: sparse:     got restricted __be64 const [usertype] dest
   arch/powerpc/platforms/powernv/opal-fadump.c:196:41: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __be64 [usertype] src @@     got unsigned long long @@
   arch/powerpc/platforms/powernv/opal-fadump.c:196:41: sparse:     expected restricted __be64 [usertype] src
   arch/powerpc/platforms/powernv/opal-fadump.c:196:41: sparse:     got unsigned long long
   arch/powerpc/platforms/powernv/opal-fadump.c:197:41: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __be64 [usertype] dest @@     got unsigned long long [usertype] addr @@
   arch/powerpc/platforms/powernv/opal-fadump.c:197:41: sparse:     expected restricted __be64 [usertype] dest
   arch/powerpc/platforms/powernv/opal-fadump.c:197:41: sparse:     got unsigned long long [usertype] addr
   arch/powerpc/platforms/powernv/opal-fadump.c:198:41: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __be64 [usertype] size @@     got unsigned long long @@
   arch/powerpc/platforms/powernv/opal-fadump.c:198:41: sparse:     expected restricted __be64 [usertype] size
   arch/powerpc/platforms/powernv/opal-fadump.c:198:41: sparse:     got unsigned long long
   arch/powerpc/platforms/powernv/opal-fadump.c:208:53: sparse: sparse: restricted __be64 degrades to integer
   arch/powerpc/platforms/powernv/opal-fadump.c:276:56: sparse: sparse: incorrect type in argument 2 (different base types) @@     expected unsigned long long [usertype] src @@     got restricted __be64 [usertype] src @@
   arch/powerpc/platforms/powernv/opal-fadump.c:276:56: sparse:     expected unsigned long long [usertype] src
   arch/powerpc/platforms/powernv/opal-fadump.c:276:56: sparse:     got restricted __be64 [usertype] src
   arch/powerpc/platforms/powernv/opal-fadump.c:277:56: sparse: sparse: incorrect type in argument 3 (different base types) @@     expected unsigned long long [usertype] dest @@     got restricted __be64 [usertype] dest @@
   arch/powerpc/platforms/powernv/opal-fadump.c:277:56: sparse:     expected unsigned long long [usertype] dest
   arch/powerpc/platforms/powernv/opal-fadump.c:277:56: sparse:     got restricted __be64 [usertype] dest
   arch/powerpc/platforms/powernv/opal-fadump.c:278:56: sparse: sparse: incorrect type in argument 4 (different base types) @@     expected unsigned long long [usertype] size @@     got restricted __be64 [usertype] size @@
   arch/powerpc/platforms/powernv/opal-fadump.c:278:56: sparse:     expected unsigned long long [usertype] size
   arch/powerpc/platforms/powernv/opal-fadump.c:278:56: sparse:     got restricted __be64 [usertype] size
   arch/powerpc/platforms/powernv/opal-fadump.c:573:38: sparse: sparse: incorrect type in assignment (different base types) @@     expected unsigned long long [usertype] dumped_bytes @@     got restricted __be64 const [usertype] size @@
   arch/powerpc/platforms/powernv/opal-fadump.c:573:38: sparse:     expected unsigned long long [usertype] dumped_bytes
   arch/powerpc/platforms/powernv/opal-fadump.c:573:38: sparse:     got restricted __be64 const [usertype] size
>> arch/powerpc/platforms/powernv/opal-fadump.c:683:60: sparse: sparse: incorrect type in argument 2 (different base types) @@     expected restricted __be64 [usertype] *addr @@     got unsigned long long * @@
   arch/powerpc/platforms/powernv/opal-fadump.c:683:60: sparse:     expected restricted __be64 [usertype] *addr
   arch/powerpc/platforms/powernv/opal-fadump.c:683:60: sparse:     got unsigned long long *
   arch/powerpc/platforms/powernv/opal-fadump.c:689:16: sparse: sparse: cast to restricted __be64
   arch/powerpc/platforms/powernv/opal-fadump.c:689:16: sparse: sparse: cast to restricted __be64
   arch/powerpc/platforms/powernv/opal-fadump.c:689:16: sparse: sparse: cast to restricted __be64
   arch/powerpc/platforms/powernv/opal-fadump.c:689:16: sparse: sparse: cast to restricted __be64
   arch/powerpc/platforms/powernv/opal-fadump.c:689:16: sparse: sparse: cast to restricted __be64
   arch/powerpc/platforms/powernv/opal-fadump.c:689:16: sparse: sparse: cast to restricted __be64
   arch/powerpc/platforms/powernv/opal-fadump.c:689:16: sparse: sparse: cast to restricted __be64
   arch/powerpc/platforms/powernv/opal-fadump.c:689:16: sparse: sparse: cast to restricted __be64
   arch/powerpc/platforms/powernv/opal-fadump.c:689:16: sparse: sparse: cast to restricted __be64
   arch/powerpc/platforms/powernv/opal-fadump.c:689:16: sparse: sparse: cast to restricted __be64
   arch/powerpc/platforms/powernv/opal-fadump.c:705:57: sparse: sparse: incorrect type in argument 2 (different base types) @@     expected restricted __be64 [usertype] *addr @@     got unsigned long long * @@
   arch/powerpc/platforms/powernv/opal-fadump.c:705:57: sparse:     expected restricted __be64 [usertype] *addr
   arch/powerpc/platforms/powernv/opal-fadump.c:705:57: sparse:     got unsigned long long *
   arch/powerpc/platforms/powernv/opal-fadump.c:707:24: sparse: sparse: cast to restricted __be64
   arch/powerpc/platforms/powernv/opal-fadump.c:707:24: sparse: sparse: cast to restricted __be64
   arch/powerpc/platforms/powernv/opal-fadump.c:707:24: sparse: sparse: cast to restricted __be64
   arch/powerpc/platforms/powernv/opal-fadump.c:707:24: sparse: sparse: cast to restricted __be64
   arch/powerpc/platforms/powernv/opal-fadump.c:707:24: sparse: sparse: cast to restricted __be64
   arch/powerpc/platforms/powernv/opal-fadump.c:707:24: sparse: sparse: cast to restricted __be64
   arch/powerpc/platforms/powernv/opal-fadump.c:707:24: sparse: sparse: cast to restricted __be64
   arch/powerpc/platforms/powernv/opal-fadump.c:707:24: sparse: sparse: cast to restricted __be64
   arch/powerpc/platforms/powernv/opal-fadump.c:707:24: sparse: sparse: cast to restricted __be64
   arch/powerpc/platforms/powernv/opal-fadump.c:707:24: sparse: sparse: cast to restricted __be64
   arch/powerpc/platforms/powernv/opal-fadump.c: note: in included file:
   arch/powerpc/platforms/powernv/opal-fadump.h:138:33: sparse: sparse: restricted __be64 degrades to integer

vim +683 arch/powerpc/platforms/powernv/opal-fadump.c

41df5928721ff4 Hari Bathini     2019-09-11  622  
41df5928721ff4 Hari Bathini     2019-09-11  623  void __init opal_fadump_dt_scan(struct fw_dump *fadump_conf, u64 node)
41df5928721ff4 Hari Bathini     2019-09-11  624  {
2a1b06dd3a17ac Hari Bathini     2019-09-11  625  	const __be32 *prop;
41df5928721ff4 Hari Bathini     2019-09-11  626  	unsigned long dn;
2a1b06dd3a17ac Hari Bathini     2019-09-11  627  	u64 addr = 0;
7b1b3b48250acb Hari Bathini     2019-09-11  628  	int i, len;
2a1b06dd3a17ac Hari Bathini     2019-09-11  629  	s64 ret;
2a1b06dd3a17ac Hari Bathini     2019-09-11  630  
41df5928721ff4 Hari Bathini     2019-09-11  631  	/*
41df5928721ff4 Hari Bathini     2019-09-11  632  	 * Check if Firmware-Assisted Dump is supported. if yes, check
41df5928721ff4 Hari Bathini     2019-09-11  633  	 * if dump has been initiated on last reboot.
41df5928721ff4 Hari Bathini     2019-09-11  634  	 */
41df5928721ff4 Hari Bathini     2019-09-11  635  	dn = of_get_flat_dt_subnode_by_name(node, "dump");
41df5928721ff4 Hari Bathini     2019-09-11  636  	if (dn == -FDT_ERR_NOTFOUND) {
41df5928721ff4 Hari Bathini     2019-09-11  637  		pr_debug("FADump support is missing!\n");
41df5928721ff4 Hari Bathini     2019-09-11  638  		return;
41df5928721ff4 Hari Bathini     2019-09-11  639  	}
41df5928721ff4 Hari Bathini     2019-09-11  640  
41df5928721ff4 Hari Bathini     2019-09-11  641  	if (!of_flat_dt_is_compatible(dn, "ibm,opal-dump")) {
41df5928721ff4 Hari Bathini     2019-09-11  642  		pr_err("Support missing for this f/w version!\n");
41df5928721ff4 Hari Bathini     2019-09-11  643  		return;
41df5928721ff4 Hari Bathini     2019-09-11  644  	}
41df5928721ff4 Hari Bathini     2019-09-11  645  
7b1b3b48250acb Hari Bathini     2019-09-11  646  	prop = of_get_flat_dt_prop(dn, "fw-load-area", &len);
7b1b3b48250acb Hari Bathini     2019-09-11  647  	if (prop) {
7b1b3b48250acb Hari Bathini     2019-09-11  648  		/*
7b1b3b48250acb Hari Bathini     2019-09-11  649  		 * Each f/w load area is an (address,size) pair,
7b1b3b48250acb Hari Bathini     2019-09-11  650  		 * 2 cells each, totalling 4 cells per range.
7b1b3b48250acb Hari Bathini     2019-09-11  651  		 */
7b1b3b48250acb Hari Bathini     2019-09-11  652  		for (i = 0; i < len / (sizeof(*prop) * 4); i++) {
7b1b3b48250acb Hari Bathini     2019-09-11  653  			u64 base, end;
7b1b3b48250acb Hari Bathini     2019-09-11  654  
7b1b3b48250acb Hari Bathini     2019-09-11  655  			base = of_read_number(prop + (i * 4) + 0, 2);
7b1b3b48250acb Hari Bathini     2019-09-11  656  			end = base;
7b1b3b48250acb Hari Bathini     2019-09-11  657  			end += of_read_number(prop + (i * 4) + 2, 2);
7b1b3b48250acb Hari Bathini     2019-09-11  658  			if (end > OPAL_FADUMP_MIN_BOOT_MEM) {
7b1b3b48250acb Hari Bathini     2019-09-11  659  				pr_err("F/W load area: 0x%llx-0x%llx\n",
7b1b3b48250acb Hari Bathini     2019-09-11  660  				       base, end);
7b1b3b48250acb Hari Bathini     2019-09-11  661  				pr_err("F/W version not supported!\n");
7b1b3b48250acb Hari Bathini     2019-09-11  662  				return;
7b1b3b48250acb Hari Bathini     2019-09-11  663  			}
7b1b3b48250acb Hari Bathini     2019-09-11  664  		}
7b1b3b48250acb Hari Bathini     2019-09-11  665  	}
7b1b3b48250acb Hari Bathini     2019-09-11  666  
41df5928721ff4 Hari Bathini     2019-09-11  667  	fadump_conf->ops		= &opal_fadump_ops;
41df5928721ff4 Hari Bathini     2019-09-11  668  	fadump_conf->fadump_supported	= 1;
2a1b06dd3a17ac Hari Bathini     2019-09-11  669  
7dee93a9a8808b Hari Bathini     2019-09-11  670  	/*
7dee93a9a8808b Hari Bathini     2019-09-11  671  	 * Firmware supports 32-bit field for size. Align it to PAGE_SIZE
7dee93a9a8808b Hari Bathini     2019-09-11  672  	 * and request firmware to copy multiple kernel boot memory regions.
7dee93a9a8808b Hari Bathini     2019-09-11  673  	 */
e96d904ede6756 Christophe Leroy 2020-04-20  674  	fadump_conf->max_copy_size = ALIGN_DOWN(U32_MAX, PAGE_SIZE);
7dee93a9a8808b Hari Bathini     2019-09-11  675  
2a1b06dd3a17ac Hari Bathini     2019-09-11  676  	/*
2a1b06dd3a17ac Hari Bathini     2019-09-11  677  	 * Check if dump has been initiated on last reboot.
2a1b06dd3a17ac Hari Bathini     2019-09-11  678  	 */
2a1b06dd3a17ac Hari Bathini     2019-09-11  679  	prop = of_get_flat_dt_prop(dn, "mpipl-boot", NULL);
2a1b06dd3a17ac Hari Bathini     2019-09-11  680  	if (!prop)
2a1b06dd3a17ac Hari Bathini     2019-09-11  681  		return;
2a1b06dd3a17ac Hari Bathini     2019-09-11  682  
2a1b06dd3a17ac Hari Bathini     2019-09-11 @683  	ret = opal_mpipl_query_tag(OPAL_MPIPL_TAG_KERNEL, &addr);

:::::: The code at line 683 was first introduced by commit
:::::: 2a1b06dd3a17ac278494da3c15cac84684346d22 powerpc/fadump: process the crashdump by exporting it as /proc/vmcore

:::::: TO: Hari Bathini <hbathini@linux.ibm.com>
:::::: CC: Michael Ellerman <mpe@ellerman.id.au>

---
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: 36696 bytes --]

^ permalink raw reply

* [PATCH] powerpc/32: Fix boot failure with CONFIG_STACKPROTECTOR
From: Christophe Leroy @ 2021-04-29 16:52 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	j.neuschaefer, jniethe5
  Cc: linuxppc-dev, linux-kernel

Commit 7c95d8893fb5 ("powerpc: Change calling convention for
create_branch() et. al.") complexified the frame of function
do_feature_fixups(), leading to GCC setting up a stack
guard when CONFIG_STACKPROTECTOR is selected.

The problem is that do_feature_fixups() is called very early
while 'current' in r2 is not set up yet and the code is still
not at the final address used at link time.

So, like other instrumentation, stack protection needs to be
deactivated for feature-fixups.c and code-patching.c

Reported-by: Jonathan Neuschaefer <j.neuschaefer@gmx.net>
Fixes: 7c95d8893fb5 ("powerpc: Change calling convention for create_branch() et. al.")
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
 arch/powerpc/lib/Makefile | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile
index f2c690ee75d1..cc1a8a0f311e 100644
--- a/arch/powerpc/lib/Makefile
+++ b/arch/powerpc/lib/Makefile
@@ -5,6 +5,9 @@
 
 ccflags-$(CONFIG_PPC64)	:= $(NO_MINIMAL_TOC)
 
+CFLAGS_code-patching.o += -fno-stack-protector
+CFLAGS_feature-fixups.o += -fno-stack-protector
+
 CFLAGS_REMOVE_code-patching.o = $(CC_FLAGS_FTRACE)
 CFLAGS_REMOVE_feature-fixups.o = $(CC_FLAGS_FTRACE)
 
-- 
2.25.0


^ permalink raw reply related

* [PATCH v5] pseries: prevent free CPU ids to be reused on another node
From: Laurent Dufour @ 2021-04-29 17:49 UTC (permalink / raw)
  To: mpe, benh, paulus; +Cc: nathanl, linuxppc-dev, linux-kernel

When a CPU is hot added, the CPU ids are taken from the available mask from
the lower possible set. If that set of values was previously used for CPU
attached to a different node, this seems to application like if these CPUs
have migrated from a node to another one which is not expected in real
life.

To prevent this, it is needed to record the CPU ids used for each node and
to not reuse them on another node. However, to prevent CPU hot plug to
fail, in the case the CPU ids is starved on a node, the capability to reuse
other nodes’ free CPU ids is kept. A warning is displayed in such a case
to warn the user.

A new CPU bit mask (node_recorded_ids_map) is introduced for each possible
node. It is populated with the CPU onlined at boot time, and then when a
CPU is hot plug to a node. The bits in that mask remain when the CPU is hot
unplugged, to remind this CPU ids have been used for this node.

If no id set was found, a retry is made without removing the ids used on
the other nodes to try reusing them. This is the way ids have been
allocated prior to this patch.

The effect of this patch can be seen by removing and adding CPUs using the
Qemu monitor. In the following case, the first CPU from the node 2 is
removed, then the first one from the node 1 is removed too. Later, the
first CPU of the node 2 is added back. Without that patch, the kernel will
numbered these CPUs using the first CPU ids available which are the ones
freed when removing the second CPU of the node 0. This leads to the CPU ids
16-23 to move from the node 1 to the node 2. With the patch applied, the
CPU ids 32-39 are used since they are the lowest free ones which have not
been used on another node.

At boot time:
[root@vm40 ~]# numactl -H | grep cpus
node 0 cpus: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
node 1 cpus: 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
node 2 cpus: 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47

Vanilla kernel, after the CPU hot unplug/plug operations:
[root@vm40 ~]# numactl -H | grep cpus
node 0 cpus: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
node 1 cpus: 24 25 26 27 28 29 30 31
node 2 cpus: 16 17 18 19 20 21 22 23 40 41 42 43 44 45 46 47

Patched kernel, after the CPU hot unplug/plug operations:
[root@vm40 ~]# numactl -H | grep cpus
node 0 cpus: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
node 1 cpus: 24 25 26 27 28 29 30 31
node 2 cpus: 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47

Signed-off-by: Laurent Dufour <ldufour@linux.ibm.com>
---
V5:
 - Rework code structure
 - Reintroduce the capability to reuse other node's ids.
V4: addressing Nathan's comment
 - Rename the local variable named 'nid' into 'assigned_node'
V3: addressing Nathan's comments
 - Remove the retry feature
 - Reduce the number of local variables (removing 'i')
 - Add comment about the cpu_add_remove_lock protecting the added CPU mask.
 V2: (no functional changes)
 - update the test's output in the commit's description
 - node_recorded_ids_map should be static
---
 arch/powerpc/platforms/pseries/hotplug-cpu.c | 171 ++++++++++++++-----
 1 file changed, 132 insertions(+), 39 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c
index 7e970f81d8ff..e1f224320102 100644
--- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
+++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
@@ -39,6 +39,12 @@
 /* This version can't take the spinlock, because it never returns */
 static int rtas_stop_self_token = RTAS_UNKNOWN_SERVICE;
 
+/*
+ * Record the CPU ids used on each nodes.
+ * Protected by cpu_add_remove_lock.
+ */
+static cpumask_var_t node_recorded_ids_map[MAX_NUMNODES];
+
 static void rtas_stop_self(void)
 {
 	static struct rtas_args args;
@@ -139,72 +145,148 @@ static void pseries_cpu_die(unsigned int cpu)
 	paca_ptrs[cpu]->cpu_start = 0;
 }
 
+/**
+ * find_cpu_id_range - found a linear ranger of @nthreads free CPU ids.
+ * @nthreads : the number of threads (cpu ids)
+ * @assigned_node : the node it belongs to or NUMA_NO_NODE if free ids from any
+ *                  node can be peek.
+ * @cpu_mask: the returned CPU mask.
+ *
+ * Returns 0 on success.
+ */
+static int find_cpu_id_range(unsigned int nthreads, int assigned_node,
+			     cpumask_var_t *cpu_mask)
+{
+	cpumask_var_t candidate_mask;
+	unsigned int cpu, node;
+	int rc = -ENOSPC;
+
+	if (!zalloc_cpumask_var(&candidate_mask, GFP_KERNEL))
+		return -ENOMEM;
+
+	cpumask_clear(*cpu_mask);
+	for (cpu = 0; cpu < nthreads; cpu++)
+		cpumask_set_cpu(cpu, *cpu_mask);
+
+	BUG_ON(!cpumask_subset(cpu_present_mask, cpu_possible_mask));
+
+	/* Get a bitmap of unoccupied slots. */
+	cpumask_xor(candidate_mask, cpu_possible_mask, cpu_present_mask);
+
+	if (assigned_node != NUMA_NO_NODE) {
+		/*
+		 * Remove free ids previously assigned on the other nodes. We
+		 * can walk only online nodes because once a node became online
+		 * it is not turned offlined back.
+		 */
+		for_each_online_node(node) {
+			if (node == assigned_node)
+				continue;
+			cpumask_andnot(candidate_mask, candidate_mask,
+				       node_recorded_ids_map[node]);
+		}
+	}
+
+	if (cpumask_empty(candidate_mask))
+		goto out;
+
+	while (!cpumask_empty(*cpu_mask)) {
+		if (cpumask_subset(*cpu_mask, candidate_mask))
+			/* Found a range where we can insert the new cpu(s) */
+			break;
+		cpumask_shift_left(*cpu_mask, *cpu_mask, nthreads);
+	}
+
+	if (!cpumask_empty(*cpu_mask))
+		rc = 0;
+
+out:
+	free_cpumask_var(candidate_mask);
+	return rc;
+}
+
 /*
  * Update cpu_present_mask and paca(s) for a new cpu node.  The wrinkle
- * here is that a cpu device node may represent up to two logical cpus
+ * here is that a cpu device node may represent multiple logical cpus
  * in the SMT case.  We must honor the assumption in other code that
  * the logical ids for sibling SMT threads x and y are adjacent, such
  * that x^1 == y and y^1 == x.
  */
 static int pseries_add_processor(struct device_node *np)
 {
-	unsigned int cpu;
-	cpumask_var_t candidate_mask, tmp;
-	int err = -ENOSPC, len, nthreads, i;
+	int len, nthreads, node, cpu, assigned_node;
+	int rc = 0;
+	cpumask_var_t cpu_mask;
 	const __be32 *intserv;
 
 	intserv = of_get_property(np, "ibm,ppc-interrupt-server#s", &len);
 	if (!intserv)
 		return 0;
 
-	zalloc_cpumask_var(&candidate_mask, GFP_KERNEL);
-	zalloc_cpumask_var(&tmp, GFP_KERNEL);
-
 	nthreads = len / sizeof(u32);
-	for (i = 0; i < nthreads; i++)
-		cpumask_set_cpu(i, tmp);
 
-	cpu_maps_update_begin();
+	if (!alloc_cpumask_var(&cpu_mask, GFP_KERNEL))
+		return -ENOMEM;
 
-	BUG_ON(!cpumask_subset(cpu_present_mask, cpu_possible_mask));
+	/*
+	 * Fetch from the DT nodes read by dlpar_configure_connector() the NUMA
+	 * node id the added CPU belongs to.
+	 */
+	node = of_node_to_nid(np);
+	if (node < 0 || !node_possible(node))
+		node = first_online_node;
 
-	/* Get a bitmap of unoccupied slots. */
-	cpumask_xor(candidate_mask, cpu_possible_mask, cpu_present_mask);
-	if (cpumask_empty(candidate_mask)) {
-		/* If we get here, it most likely means that NR_CPUS is
-		 * less than the partition's max processors setting.
+	BUG_ON(node == NUMA_NO_NODE);
+	assigned_node = node;
+
+	cpu_maps_update_begin();
+
+	rc = find_cpu_id_range(nthreads, node, &cpu_mask);
+	if (rc && nr_node_ids > 1) {
+		/*
+		 * Try again, considering the free CPU ids from the other node.
 		 */
-		printk(KERN_ERR "Cannot add cpu %pOF; this system configuration"
-		       " supports %d logical cpus.\n", np,
-		       num_possible_cpus());
-		goto out_unlock;
+		node = NUMA_NO_NODE;
+		rc = find_cpu_id_range(nthreads, NUMA_NO_NODE, &cpu_mask);
 	}
 
-	while (!cpumask_empty(tmp))
-		if (cpumask_subset(tmp, candidate_mask))
-			/* Found a range where we can insert the new cpu(s) */
-			break;
-		else
-			cpumask_shift_left(tmp, tmp, nthreads);
-
-	if (cpumask_empty(tmp)) {
-		printk(KERN_ERR "Unable to find space in cpu_present_mask for"
-		       " processor %pOFn with %d thread(s)\n", np,
-		       nthreads);
-		goto out_unlock;
+	if (rc) {
+		pr_err("Cannot add cpu %pOF; this system configuration"
+		       " supports %d logical cpus.\n", np, num_possible_cpus());
+		goto out;
 	}
 
-	for_each_cpu(cpu, tmp) {
+	for_each_cpu(cpu, cpu_mask) {
 		BUG_ON(cpu_present(cpu));
 		set_cpu_present(cpu, true);
 		set_hard_smp_processor_id(cpu, be32_to_cpu(*intserv++));
 	}
-	err = 0;
-out_unlock:
+
+	/* Record the newly used CPU ids for the associate node. */
+	cpumask_or(node_recorded_ids_map[assigned_node],
+		   node_recorded_ids_map[assigned_node], cpu_mask);
+
+	/*
+	 * If node is set to NUMA_NO_NODE, CPU ids have be reused from
+	 * another node, remove them from its mask.
+	 */
+	if (node == NUMA_NO_NODE) {
+		cpu = cpumask_first(cpu_mask);
+		pr_warn("Reusing free CPU ids %d-%d from another node\n",
+			cpu, cpu + nthreads - 1);
+		for_each_online_node(node) {
+			if (node == assigned_node)
+				continue;
+			cpumask_andnot(node_recorded_ids_map[node],
+				       node_recorded_ids_map[node],
+				       cpu_mask);
+		}
+	}
+
+out:
 	cpu_maps_update_done();
-	free_cpumask_var(candidate_mask);
-	free_cpumask_var(tmp);
-	return err;
+	free_cpumask_var(cpu_mask);
+	return rc;
 }
 
 /*
@@ -908,6 +990,7 @@ static struct notifier_block pseries_smp_nb = {
 static int __init pseries_cpu_hotplug_init(void)
 {
 	int qcss_tok;
+	unsigned int node;
 
 #ifdef CONFIG_ARCH_CPU_PROBE_RELEASE
 	ppc_md.cpu_probe = dlpar_cpu_probe;
@@ -929,8 +1012,18 @@ static int __init pseries_cpu_hotplug_init(void)
 	smp_ops->cpu_die = pseries_cpu_die;
 
 	/* Processors can be added/removed only on LPAR */
-	if (firmware_has_feature(FW_FEATURE_LPAR))
+	if (firmware_has_feature(FW_FEATURE_LPAR)) {
+		for_each_node(node) {
+			alloc_bootmem_cpumask_var(&node_recorded_ids_map[node]);
+
+			/* Record ids of CPU added at boot time */
+			cpumask_or(node_recorded_ids_map[node],
+				   node_recorded_ids_map[node],
+				   node_to_cpumask_map[node]);
+		}
+
 		of_reconfig_notifier_register(&pseries_smp_nb);
+	}
 
 	return 0;
 }
-- 
2.31.1


^ permalink raw reply related

* Re: [PATCH] powerpc/32: Fix boot failure with CONFIG_STACKPROTECTOR
From: Jonathan Neuschäfer @ 2021-04-29 17:49 UTC (permalink / raw)
  To: Christophe Leroy
  Cc: j.neuschaefer, linux-kernel, Paul Mackerras, jniethe5,
	linuxppc-dev
In-Reply-To: <b688fe82927b330349d9e44553363fa451ea4d95.1619715114.git.christophe.leroy@csgroup.eu>

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

On Thu, Apr 29, 2021 at 04:52:09PM +0000, Christophe Leroy wrote:
> Commit 7c95d8893fb5 ("powerpc: Change calling convention for
> create_branch() et. al.") complexified the frame of function
> do_feature_fixups(), leading to GCC setting up a stack
> guard when CONFIG_STACKPROTECTOR is selected.
> 
> The problem is that do_feature_fixups() is called very early
> while 'current' in r2 is not set up yet and the code is still
> not at the final address used at link time.
> 
> So, like other instrumentation, stack protection needs to be
> deactivated for feature-fixups.c and code-patching.c
> 
> Reported-by: Jonathan Neuschaefer <j.neuschaefer@gmx.net>
> Fixes: 7c95d8893fb5 ("powerpc: Change calling convention for create_branch() et. al.")
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> ---

Thank you for looking into this issue. This patch does indeed fix my
issue.

Tested-by: Jonathan Neuschaefer <j.neuschaefer@gmx.net>


Thanks again,
Jonathan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply

* [PATCH] ppc64/numa: consider the max numa node for migratable LPAR
From: Laurent Dufour @ 2021-04-29 18:19 UTC (permalink / raw)
  To: mpe, benh, paulus; +Cc: nathanl, linuxppc-dev, linux-kernel, Srikar Dronamraju

When a LPAR is migratable, we should consider the maximum possible NUMA
node instead the number of NUMA node from the actual system.

The DT property 'ibm,current-associativity-domains' is defining the maximum
number of nodes the LPAR can see when running on that box. But if the LPAR
is being migrated on another box, it may seen up to the nodes defined by
'ibm,max-associativity-domains'. So if a LPAR is migratable, that value
should be used.

Unfortunately, there is no easy way to know if a LPAR is migratable or
not. The hypervisor is exporting the property 'ibm,migratable-partition' in
the case it set to migrate partition, but that would not mean that the
current partition is migratable.

Without that patch, when a LPAR is started on a 2 nodes box and then
migrated to a 3 nodes box, the hypervisor may spread the LPAR's CPUs on the
3rd node. In that case if a CPU from that 3rd node is added to the LPAR, it
will be wrongly assigned to the node because the kernel has been set to use
up to 2 nodes (the configuration of the departure node). With that patch
applies, the CPU is correctly added to the 3rd node.

Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Signed-off-by: Laurent Dufour <ldufour@linux.ibm.com>
---
 arch/powerpc/mm/numa.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index f2bf98bdcea2..673fa6e47850 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -893,7 +893,7 @@ static void __init setup_node_data(int nid, u64 start_pfn, u64 end_pfn)
 static void __init find_possible_nodes(void)
 {
 	struct device_node *rtas;
-	const __be32 *domains;
+	const __be32 *domains = NULL;
 	int prop_length, max_nodes;
 	u32 i;
 
@@ -909,9 +909,14 @@ static void __init find_possible_nodes(void)
 	 * it doesn't exist, then fallback on ibm,max-associativity-domains.
 	 * Current denotes what the platform can support compared to max
 	 * which denotes what the Hypervisor can support.
+	 *
+	 * If the LPAR is migratable, new nodes might be activated after a LPM,
+	 * so we should consider the max number in that case.
 	 */
-	domains = of_get_property(rtas, "ibm,current-associativity-domains",
-					&prop_length);
+	if (!of_get_property(of_root, "ibm,migratable-partition", NULL))
+		domains = of_get_property(rtas,
+					  "ibm,current-associativity-domains",
+					  &prop_length);
 	if (!domains) {
 		domains = of_get_property(rtas, "ibm,max-associativity-domains",
 					&prop_length);
@@ -920,6 +925,9 @@ static void __init find_possible_nodes(void)
 	}
 
 	max_nodes = of_read_number(&domains[min_common_depth], 1);
+	printk(KERN_INFO "Partition configured for %d NUMA nodes.\n",
+	       max_nodes);
+
 	for (i = 0; i < max_nodes; i++) {
 		if (!node_possible(i))
 			node_set(i, node_possible_map);
-- 
2.31.1


^ permalink raw reply related

* Re: [PATCH v3] pseries/drmem: update LMBs after LPM
From: Tyrel Datwyler @ 2021-04-29 19:12 UTC (permalink / raw)
  To: Aneesh Kumar K.V, Laurent Dufour, mpe, benh, paulus
  Cc: nathanl, linuxppc-dev, linux-kernel
In-Reply-To: <87fsz95qso.fsf@linux.ibm.com>

On 4/29/21 3:27 AM, Aneesh Kumar K.V wrote:
> Laurent Dufour <ldufour@linux.ibm.com> writes:
> 
>> After a LPM, the device tree node ibm,dynamic-reconfiguration-memory may be
>> updated by the hypervisor in the case the NUMA topology of the LPAR's
>> memory is updated.
>>
>> This is caught by the kernel, but the memory's node is updated because
>> there is no way to move a memory block between nodes.
>>
>> If later a memory block is added or removed, drmem_update_dt() is called
>> and it is overwriting the DT node to match the added or removed LMB. But
>> the LMB's associativity node has not been updated after the DT node update
>> and thus the node is overwritten by the Linux's topology instead of the
>> hypervisor one.
>>
>> Introduce a hook called when the ibm,dynamic-reconfiguration-memory node is
>> updated to force an update of the LMB's associativity.
>>
>> Cc: Tyrel Datwyler <tyreld@linux.ibm.com>
>> Signed-off-by: Laurent Dufour <ldufour@linux.ibm.com>
>> ---
>>
>> V3:
>>  - Check rd->dn->name instead of rd->dn->full_name
>> V2:
>>  - Take Tyrel's idea to rely on OF_RECONFIG_UPDATE_PROPERTY instead of
>>  introducing a new hook mechanism.
>> ---
>>  arch/powerpc/include/asm/drmem.h              |  1 +
>>  arch/powerpc/mm/drmem.c                       | 35 +++++++++++++++++++
>>  .../platforms/pseries/hotplug-memory.c        |  4 +++
>>  3 files changed, 40 insertions(+)
>>
>> diff --git a/arch/powerpc/include/asm/drmem.h b/arch/powerpc/include/asm/drmem.h
>> index bf2402fed3e0..4265d5e95c2c 100644
>> --- a/arch/powerpc/include/asm/drmem.h
>> +++ b/arch/powerpc/include/asm/drmem.h
>> @@ -111,6 +111,7 @@ int drmem_update_dt(void);
>>  int __init
>>  walk_drmem_lmbs_early(unsigned long node, void *data,
>>  		      int (*func)(struct drmem_lmb *, const __be32 **, void *));
>> +void drmem_update_lmbs(struct property *prop);
>>  #endif
>>  
>>  static inline void invalidate_lmb_associativity_index(struct drmem_lmb *lmb)
>> diff --git a/arch/powerpc/mm/drmem.c b/arch/powerpc/mm/drmem.c
>> index 9af3832c9d8d..f0a6633132af 100644
>> --- a/arch/powerpc/mm/drmem.c
>> +++ b/arch/powerpc/mm/drmem.c
>> @@ -307,6 +307,41 @@ int __init walk_drmem_lmbs_early(unsigned long node, void *data,
>>  	return ret;
>>  }
>>  
>> +/*
>> + * Update the LMB associativity index.
>> + */
>> +static int update_lmb(struct drmem_lmb *updated_lmb,
>> +		      __maybe_unused const __be32 **usm,
>> +		      __maybe_unused void *data)
>> +{
>> +	struct drmem_lmb *lmb;
>> +
>> +	/*
>> +	 * Brut force there may be better way to fetch the LMB
>> +	 */
>> +	for_each_drmem_lmb(lmb) {
>> +		if (lmb->drc_index != updated_lmb->drc_index)
>> +			continue;
>> +
>> +		lmb->aa_index = updated_lmb->aa_index;
>> +		break;
>> +	}
>> +	return 0;
>> +}
>> +
>> +/*
>> + * Update the LMB associativity index.
>> + *
>> + * This needs to be called when the hypervisor is updating the
>> + * dynamic-reconfiguration-memory node property.
>> + */
>> +void drmem_update_lmbs(struct property *prop)
>> +{
>> +	if (!strcmp(prop->name, "ibm,dynamic-memory"))
>> +		__walk_drmem_v1_lmbs(prop->value, NULL, NULL, update_lmb);
>> +	else if (!strcmp(prop->name, "ibm,dynamic-memory-v2"))
>> +		__walk_drmem_v2_lmbs(prop->value, NULL, NULL, update_lmb);
>> +}
>>  #endif
>>  
>>  static int init_drmem_lmb_size(struct device_node *dn)
>> diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c
>> index 8377f1f7c78e..672ffbee2e78 100644
>> --- a/arch/powerpc/platforms/pseries/hotplug-memory.c
>> +++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
>> @@ -949,6 +949,10 @@ static int pseries_memory_notifier(struct notifier_block *nb,
>>  	case OF_RECONFIG_DETACH_NODE:
>>  		err = pseries_remove_mem_node(rd->dn);
>>  		break;
>> +	case OF_RECONFIG_UPDATE_PROPERTY:
>> +		if (!strcmp(rd->dn->name,
>> +			    "ibm,dynamic-reconfiguration-memory"))
>> +			drmem_update_lmbs(rd->prop);
>>  	}
>>  	return notifier_from_errno(err);
> 
> How will this interact with DLPAR memory? When we dlpar memory,
> ibm,configure-connector is used to fetch the new associativity details
> and set drmem_lmb->aa_index correctly there. Once that is done kernel
> then call drmem_update_dt() which will result in the above notifier
> callback? 
> 
> IIUC, the call back then will update drmem_lmb->aa_index again?

After digging through some of this code I'm a bit concerned about all the kernel
device tree manipulation around memory DLPAR both with the assoc-lookup-array
prop update and post dynamic-memory prop updating. We build a drmem_info array
of the LMBs from the device-tree at boot. I don't really understand why we are
manipulating the device tree property every time we add/remove an LMB. Not sure
the reasoning was to write back in particular the aa_index and flags for each
LMB into the device tree when we already have them in the drmem_info array. On
the other hand the assoc-lookup-array I suppose would need to have an in kernel
representation to avoid updating the device tree property every time.

Changes to the device tree should be things reported to the system from the
hypervisor through the proper interfaces, and as a result any code that cares
can register an of_reconfig_notifier to respond to device tree updates. The
memory dlpar code seems to be needlessly manipulating the device-tree which
leads to the problem here where a notifier callback is now duplicating work.

Just my two cents FWIW.

-Tyrel

> 
> -aneesh
> 


^ permalink raw reply

* Re: [PATCH] ppc64/numa: consider the max numa node for migratable LPAR
From: Tyrel Datwyler @ 2021-04-29 19:29 UTC (permalink / raw)
  To: Laurent Dufour, mpe, benh, paulus
  Cc: nathanl, linuxppc-dev, linux-kernel, Srikar Dronamraju
In-Reply-To: <20210429181901.17674-1-ldufour@linux.ibm.com>

On 4/29/21 11:19 AM, Laurent Dufour wrote:
> When a LPAR is migratable, we should consider the maximum possible NUMA
> node instead the number of NUMA node from the actual system.
> 
> The DT property 'ibm,current-associativity-domains' is defining the maximum
> number of nodes the LPAR can see when running on that box. But if the LPAR
> is being migrated on another box, it may seen up to the nodes defined by
> 'ibm,max-associativity-domains'. So if a LPAR is migratable, that value
> should be used.
> 
> Unfortunately, there is no easy way to know if a LPAR is migratable or
> not. The hypervisor is exporting the property 'ibm,migratable-partition' in
> the case it set to migrate partition, but that would not mean that the
> current partition is migratable.

Wording is a little hard to follow for me here. From PAPR the
'ibm,migratable-partition' property presence indicates that the platform
supports the potential migration of the partition. I guess maybe the point is
that all migratable partitions define 'ibm,migratable-partition', but all
partitions that define 'ibm,migratable-partition' are not necessarily migratable.

-Tyrel

> 
> Without that patch, when a LPAR is started on a 2 nodes box and then
> migrated to a 3 nodes box, the hypervisor may spread the LPAR's CPUs on the
> 3rd node. In that case if a CPU from that 3rd node is added to the LPAR, it
> will be wrongly assigned to the node because the kernel has been set to use
> up to 2 nodes (the configuration of the departure node). With that patch
> applies, the CPU is correctly added to the 3rd node.
> 
> Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
> Signed-off-by: Laurent Dufour <ldufour@linux.ibm.com>
> ---
>  arch/powerpc/mm/numa.c | 14 +++++++++++---
>  1 file changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
> index f2bf98bdcea2..673fa6e47850 100644
> --- a/arch/powerpc/mm/numa.c
> +++ b/arch/powerpc/mm/numa.c
> @@ -893,7 +893,7 @@ static void __init setup_node_data(int nid, u64 start_pfn, u64 end_pfn)
>  static void __init find_possible_nodes(void)
>  {
>  	struct device_node *rtas;
> -	const __be32 *domains;
> +	const __be32 *domains = NULL;
>  	int prop_length, max_nodes;
>  	u32 i;
> 
> @@ -909,9 +909,14 @@ static void __init find_possible_nodes(void)
>  	 * it doesn't exist, then fallback on ibm,max-associativity-domains.
>  	 * Current denotes what the platform can support compared to max
>  	 * which denotes what the Hypervisor can support.
> +	 *
> +	 * If the LPAR is migratable, new nodes might be activated after a LPM,
> +	 * so we should consider the max number in that case.
>  	 */
> -	domains = of_get_property(rtas, "ibm,current-associativity-domains",
> -					&prop_length);
> +	if (!of_get_property(of_root, "ibm,migratable-partition", NULL))
> +		domains = of_get_property(rtas,
> +					  "ibm,current-associativity-domains",
> +					  &prop_length);
>  	if (!domains) {
>  		domains = of_get_property(rtas, "ibm,max-associativity-domains",
>  					&prop_length);
> @@ -920,6 +925,9 @@ static void __init find_possible_nodes(void)
>  	}
> 
>  	max_nodes = of_read_number(&domains[min_common_depth], 1);
> +	printk(KERN_INFO "Partition configured for %d NUMA nodes.\n",
> +	       max_nodes);
> +
>  	for (i = 0; i < max_nodes; i++) {
>  		if (!node_possible(i))
>  			node_set(i, node_possible_map);
> 


^ permalink raw reply

* Re: [RFC PATCH v1 2/4] mm/hugetlb: Change parameters of arch_make_huge_pte()
From: Mike Kravetz @ 2021-04-29 17:50 UTC (permalink / raw)
  To: Christophe Leroy, Andrew Morton, Nicholas Piggin, Mike Rapoport
  Cc: linux-arch, linux-kernel, linux-mm, sparclinux, linuxppc-dev,
	linux-arm-kernel
In-Reply-To: <e111d0d90231ae63e4b89da8efa87cde31daeeee.1619628001.git.christophe.leroy@csgroup.eu>

On 4/28/21 9:46 AM, Christophe Leroy wrote:
> At the time being, arch_make_huge_pte() has the following prototype:
> 
> 	pte_t arch_make_huge_pte(pte_t entry, struct vm_area_struct *vma,
> 				 struct page *page, int writable);
> 
> vma is used to get the pages shift or size.
> vma is also used on Sparc to get vm_flags.
> page is not used.
> writable is not used.
> 
> In order to use this function without a vma, and replace vma by shift
> and flags. Also remove the used parameters.
> 
> Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
> ---
>  arch/arm64/include/asm/hugetlb.h                 | 3 +--
>  arch/arm64/mm/hugetlbpage.c                      | 5 ++---
>  arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h | 5 ++---
>  arch/sparc/include/asm/pgtable_64.h              | 3 +--
>  arch/sparc/mm/hugetlbpage.c                      | 6 ++----
>  include/linux/hugetlb.h                          | 4 ++--
>  mm/hugetlb.c                                     | 6 ++++--
>  mm/migrate.c                                     | 4 +++-
>  8 files changed, 17 insertions(+), 19 deletions(-)

Hi Christophe,

Sorry, no suggestion for how to make a beautiful generic implementation.

This patch is straight forward.
Acked-by: Mike Kravetz <mike.kravetz@oracle.com>
-- 
Mike Kravetz

^ permalink raw reply

* [PATCH v2] kbuild: replace LANG=C with LC_ALL=C
From: Masahiro Yamada @ 2021-04-30  1:56 UTC (permalink / raw)
  To: linux-kbuild
  Cc: linuxppc-dev, Masahiro Yamada, Mat Martineau, Matthias Maennich,
	linux-kernel, mptcp, Jakub Kicinski, netdev, Paul Mackerras,
	linux-kselftest, Matthieu Baerts, Shuah Khan, David S. Miller

LANG gives a weak default to each LC_* in case it is not explicitly
defined. LC_ALL, if set, overrides all other LC_* variables.

  LANG  <  LC_CTYPE, LC_COLLATE, LC_MONETARY, LC_NUMERIC, ...  <  LC_ALL

This is why documentation such as [1] suggests to set LC_ALL in build
scripts to get the deterministic result.

LANG=C is not strong enough to override LC_* that may be set by end
users.

[1]: https://reproducible-builds.org/docs/locales/

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)
Reviewed-by: Matthias Maennich <maennich@google.com>
Acked-by: Matthieu Baerts <matthieu.baerts@tessares.net> (mptcp)
---

Changes in v2:
 - rebase

 arch/powerpc/boot/wrapper                          | 2 +-
 scripts/nsdeps                                     | 2 +-
 scripts/recordmcount.pl                            | 2 +-
 scripts/setlocalversion                            | 2 +-
 scripts/tags.sh                                    | 2 +-
 tools/testing/selftests/net/mptcp/mptcp_connect.sh | 2 +-
 usr/gen_initramfs.sh                               | 2 +-
 7 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper
index 41fa0a8715e3..cdb796b76e2e 100755
--- a/arch/powerpc/boot/wrapper
+++ b/arch/powerpc/boot/wrapper
@@ -191,7 +191,7 @@ if [ -z "$kernel" ]; then
     kernel=vmlinux
 fi
 
-LANG=C elfformat="`${CROSS}objdump -p "$kernel" | grep 'file format' | awk '{print $4}'`"
+LC_ALL=C elfformat="`${CROSS}objdump -p "$kernel" | grep 'file format' | awk '{print $4}'`"
 case "$elfformat" in
     elf64-powerpcle)	format=elf64lppc	;;
     elf64-powerpc)	format=elf32ppc	;;
diff --git a/scripts/nsdeps b/scripts/nsdeps
index e8ce2a4d704a..04c4b96e95ec 100644
--- a/scripts/nsdeps
+++ b/scripts/nsdeps
@@ -44,7 +44,7 @@ generate_deps() {
 		for source_file in $mod_source_files; do
 			sed '/MODULE_IMPORT_NS/Q' $source_file > ${source_file}.tmp
 			offset=$(wc -l ${source_file}.tmp | awk '{print $1;}')
-			cat $source_file | grep MODULE_IMPORT_NS | LANG=C sort -u >> ${source_file}.tmp
+			cat $source_file | grep MODULE_IMPORT_NS | LC_ALL=C sort -u >> ${source_file}.tmp
 			tail -n +$((offset +1)) ${source_file} | grep -v MODULE_IMPORT_NS >> ${source_file}.tmp
 			if ! diff -q ${source_file} ${source_file}.tmp; then
 				mv ${source_file}.tmp ${source_file}
diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl
index 867860ea57da..0a7fc9507d6f 100755
--- a/scripts/recordmcount.pl
+++ b/scripts/recordmcount.pl
@@ -497,7 +497,7 @@ sub update_funcs
 #
 # Step 2: find the sections and mcount call sites
 #
-open(IN, "LANG=C $objdump -hdr $inputfile|") || die "error running $objdump";
+open(IN, "LC_ALL=C $objdump -hdr $inputfile|") || die "error running $objdump";
 
 my $text;
 
diff --git a/scripts/setlocalversion b/scripts/setlocalversion
index bb709eda96cd..db941f6d9591 100755
--- a/scripts/setlocalversion
+++ b/scripts/setlocalversion
@@ -126,7 +126,7 @@ scm_version()
 	fi
 
 	# Check for svn and a svn repo.
-	if rev=$(LANG= LC_ALL= LC_MESSAGES=C svn info 2>/dev/null | grep '^Last Changed Rev'); then
+	if rev=$(LC_ALL=C svn info 2>/dev/null | grep '^Last Changed Rev'); then
 		rev=$(echo $rev | awk '{print $NF}')
 		printf -- '-svn%s' "$rev"
 
diff --git a/scripts/tags.sh b/scripts/tags.sh
index fd96734deff1..db8ba411860a 100755
--- a/scripts/tags.sh
+++ b/scripts/tags.sh
@@ -326,5 +326,5 @@ esac
 
 # Remove structure forward declarations.
 if [ -n "$remove_structs" ]; then
-    LANG=C sed -i -e '/^\([a-zA-Z_][a-zA-Z0-9_]*\)\t.*\t\/\^struct \1;.*\$\/;"\tx$/d' $1
+    LC_ALL=C sed -i -e '/^\([a-zA-Z_][a-zA-Z0-9_]*\)\t.*\t\/\^struct \1;.*\$\/;"\tx$/d' $1
 fi
diff --git a/tools/testing/selftests/net/mptcp/mptcp_connect.sh b/tools/testing/selftests/net/mptcp/mptcp_connect.sh
index 9236609731b1..3c4cb72ed8a4 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_connect.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_connect.sh
@@ -274,7 +274,7 @@ check_mptcp_disabled()
 	ip netns exec ${disabled_ns} sysctl -q net.mptcp.enabled=0
 
 	local err=0
-	LANG=C ip netns exec ${disabled_ns} ./mptcp_connect -p 10000 -s MPTCP 127.0.0.1 < "$cin" 2>&1 | \
+	LC_ALL=C ip netns exec ${disabled_ns} ./mptcp_connect -p 10000 -s MPTCP 127.0.0.1 < "$cin" 2>&1 | \
 		grep -q "^socket: Protocol not available$" && err=1
 	ip netns delete ${disabled_ns}
 
diff --git a/usr/gen_initramfs.sh b/usr/gen_initramfs.sh
index 8ae831657e5d..63476bb70b41 100755
--- a/usr/gen_initramfs.sh
+++ b/usr/gen_initramfs.sh
@@ -147,7 +147,7 @@ dir_filelist() {
 	header "$1"
 
 	srcdir=$(echo "$1" | sed -e 's://*:/:g')
-	dirlist=$(find "${srcdir}" -printf "%p %m %U %G\n" | LANG=C sort)
+	dirlist=$(find "${srcdir}" -printf "%p %m %U %G\n" | LC_ALL=C sort)
 
 	# If $dirlist is only one line, then the directory is empty
 	if [  "$(echo "${dirlist}" | wc -l)" -gt 1 ]; then
-- 
2.27.0


^ permalink raw reply related

* [powerpc:merge] BUILD SUCCESS e3a9b9d6a03f5fbf99b540e863b001d46ba1735c
From: kernel test robot @ 2021-04-30  2:42 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev

tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git merge
branch HEAD: e3a9b9d6a03f5fbf99b540e863b001d46ba1735c  powerpc/ci: Add W=1 build

elapsed time: 815m

configs tested: 144
configs skipped: 2

The following configs have been built successfully.
More configs may be tested in the coming days.

gcc tested configs:
arm                                 defconfig
arm64                            allyesconfig
arm64                               defconfig
arm                              allyesconfig
arm                              allmodconfig
x86_64                           allyesconfig
riscv                            allmodconfig
i386                             allyesconfig
riscv                            allyesconfig
powerpc                 mpc836x_rdk_defconfig
powerpc                    sam440ep_defconfig
arm                       aspeed_g5_defconfig
arm                        multi_v5_defconfig
xtensa                              defconfig
mips                      maltasmvp_defconfig
nios2                               defconfig
nios2                            allyesconfig
arm                           omap1_defconfig
arm                        mvebu_v7_defconfig
arm                         mv78xx0_defconfig
arc                        nsimosci_defconfig
sh                          landisk_defconfig
powerpc                      arches_defconfig
powerpc                   lite5200b_defconfig
ia64                         bigsur_defconfig
sh                           se7721_defconfig
arm                          imote2_defconfig
arm                         socfpga_defconfig
mips                         db1xxx_defconfig
sh                         microdev_defconfig
m68k                       bvme6000_defconfig
arm                           tegra_defconfig
powerpc                        icon_defconfig
mips                           ip28_defconfig
powerpc                    ge_imp3a_defconfig
sh                               alldefconfig
arm                        realview_defconfig
m68k                       m5275evb_defconfig
arm                      integrator_defconfig
um                                allnoconfig
ia64                                defconfig
arm                             mxs_defconfig
arm                      pxa255-idp_defconfig
sh                        edosk7705_defconfig
arm                    vt8500_v6_v7_defconfig
powerpc                     tqm8541_defconfig
mips                  maltasmvp_eva_defconfig
powerpc                     mpc83xx_defconfig
arm                  colibri_pxa300_defconfig
arm                      tct_hammer_defconfig
powerpc                     tqm5200_defconfig
arm                           h3600_defconfig
powerpc64                           defconfig
powerpc                     mpc512x_defconfig
arm                            zeus_defconfig
powerpc                     pq2fads_defconfig
powerpc                    socrates_defconfig
sh                            hp6xx_defconfig
arm                          pxa910_defconfig
powerpc                  mpc885_ads_defconfig
openrisc                         alldefconfig
arc                     haps_hs_smp_defconfig
arm                         at91_dt_defconfig
arm                        vexpress_defconfig
m68k                            q40_defconfig
arc                              alldefconfig
m68k                        m5272c3_defconfig
openrisc                 simple_smp_defconfig
powerpc                     ppa8548_defconfig
arc                          axs103_defconfig
mips                           gcw0_defconfig
sh                          kfr2r09_defconfig
arm                          pxa168_defconfig
sh                   rts7751r2dplus_defconfig
powerpc                 mpc8272_ads_defconfig
sh                        edosk7760_defconfig
sh                   sh7770_generic_defconfig
arm                          lpd270_defconfig
openrisc                    or1ksim_defconfig
ia64                             allmodconfig
ia64                             allyesconfig
m68k                             allmodconfig
m68k                                defconfig
m68k                             allyesconfig
arc                              allyesconfig
nds32                             allnoconfig
nds32                               defconfig
csky                                defconfig
alpha                               defconfig
alpha                            allyesconfig
xtensa                           allyesconfig
h8300                            allyesconfig
arc                                 defconfig
sh                               allmodconfig
parisc                              defconfig
s390                             allyesconfig
s390                             allmodconfig
parisc                           allyesconfig
s390                                defconfig
sparc                            allyesconfig
sparc                               defconfig
i386                                defconfig
mips                             allyesconfig
mips                             allmodconfig
powerpc                          allyesconfig
powerpc                          allmodconfig
powerpc                           allnoconfig
x86_64               randconfig-a002-20210429
x86_64               randconfig-a001-20210429
x86_64               randconfig-a003-20210429
x86_64               randconfig-a004-20210429
x86_64               randconfig-a005-20210429
x86_64               randconfig-a006-20210429
i386                 randconfig-a005-20210429
i386                 randconfig-a002-20210429
i386                 randconfig-a001-20210429
i386                 randconfig-a006-20210429
i386                 randconfig-a003-20210429
i386                 randconfig-a004-20210429
i386                 randconfig-a012-20210429
i386                 randconfig-a014-20210429
i386                 randconfig-a013-20210429
i386                 randconfig-a011-20210429
i386                 randconfig-a015-20210429
i386                 randconfig-a016-20210429
riscv                    nommu_k210_defconfig
riscv                    nommu_virt_defconfig
riscv                             allnoconfig
riscv                               defconfig
riscv                          rv32_defconfig
um                               allmodconfig
um                               allyesconfig
um                                  defconfig
x86_64                    rhel-8.3-kselftests
x86_64                              defconfig
x86_64                               rhel-8.3
x86_64                      rhel-8.3-kbuiltin
x86_64                                  kexec

clang tested configs:
x86_64               randconfig-a015-20210429
x86_64               randconfig-a016-20210429
x86_64               randconfig-a011-20210429
x86_64               randconfig-a014-20210429
x86_64               randconfig-a013-20210429
x86_64               randconfig-a012-20210429

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

^ permalink raw reply

* [powerpc:next] BUILD SUCCESS 5256426247837feb8703625bda7fcfc824af04cf
From: kernel test robot @ 2021-04-30  2:49 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev

tree/branch: https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git next
branch HEAD: 5256426247837feb8703625bda7fcfc824af04cf  powerpc/signal32: Fix erroneous SIGSEGV on RT signal return

elapsed time: 820m

configs tested: 177
configs skipped: 2

The following configs have been built successfully.
More configs may be tested in the coming days.

gcc tested configs:
arm                                 defconfig
arm64                            allyesconfig
arm64                               defconfig
arm                              allyesconfig
arm                              allmodconfig
x86_64                           allyesconfig
riscv                            allmodconfig
i386                             allyesconfig
riscv                            allyesconfig
nios2                               defconfig
nios2                            allyesconfig
arm                           omap1_defconfig
arm                        mvebu_v7_defconfig
arm                         mv78xx0_defconfig
arc                        nsimosci_defconfig
nds32                             allnoconfig
arm                           h3600_defconfig
mips                         db1xxx_defconfig
arm                      integrator_defconfig
sh                          landisk_defconfig
powerpc                      arches_defconfig
powerpc                   lite5200b_defconfig
ia64                         bigsur_defconfig
sh                           se7721_defconfig
arm                          imote2_defconfig
xtensa                         virt_defconfig
arm                           corgi_defconfig
m68k                          sun3x_defconfig
arm                         socfpga_defconfig
sh                         microdev_defconfig
m68k                       bvme6000_defconfig
arm                           tegra_defconfig
powerpc                        icon_defconfig
arm                          moxart_defconfig
arm                     eseries_pxa_defconfig
arm                       aspeed_g5_defconfig
mips                       capcella_defconfig
um                               allyesconfig
i386                             alldefconfig
csky                                defconfig
arm                          simpad_defconfig
um                                allnoconfig
ia64                                defconfig
arm                             mxs_defconfig
arm                      pxa255-idp_defconfig
sh                        edosk7705_defconfig
arm                         s3c6400_defconfig
arm                        multi_v5_defconfig
powerpc                     stx_gp3_defconfig
parisc                           allyesconfig
um                            kunit_defconfig
powerpc                         ps3_defconfig
m68k                        m5307c3_defconfig
arm                           sunxi_defconfig
sh                          rsk7201_defconfig
parisc                generic-64bit_defconfig
powerpc                       ppc64_defconfig
sh                        sh7785lcr_defconfig
powerpc                     kilauea_defconfig
powerpc                 mpc85xx_cds_defconfig
arm                  colibri_pxa300_defconfig
arm                      tct_hammer_defconfig
powerpc                     tqm5200_defconfig
powerpc64                           defconfig
powerpc                     mpc512x_defconfig
parisc                              defconfig
powerpc                      ppc64e_defconfig
mips                             allmodconfig
mips                malta_kvm_guest_defconfig
mips                         rt305x_defconfig
powerpc                   motionpro_defconfig
sh                           se7619_defconfig
arm                          collie_defconfig
powerpc                     tqm8541_defconfig
riscv                            alldefconfig
powerpc                      katmai_defconfig
sh                        apsh4ad0a_defconfig
mips                        bcm47xx_defconfig
powerpc                     ppa8548_defconfig
sh                        sh7763rdp_defconfig
arm                        neponset_defconfig
powerpc                  mpc885_ads_defconfig
openrisc                         alldefconfig
arc                     haps_hs_smp_defconfig
arm                         at91_dt_defconfig
arm                        vexpress_defconfig
powerpc                      obs600_defconfig
powerpc                         wii_defconfig
mips                          rb532_defconfig
mips                       bmips_be_defconfig
sparc                       sparc32_defconfig
powerpc                      mgcoge_defconfig
powerpc                        warp_defconfig
powerpc                   currituck_defconfig
mips                           ip22_defconfig
arc                    vdk_hs38_smp_defconfig
x86_64                           alldefconfig
sh                             shx3_defconfig
mips                        vocore2_defconfig
m68k                            q40_defconfig
arc                              alldefconfig
m68k                        m5272c3_defconfig
openrisc                 simple_smp_defconfig
arc                          axs103_defconfig
mips                           gcw0_defconfig
sh                          kfr2r09_defconfig
arm                          pxa168_defconfig
sh                   rts7751r2dplus_defconfig
ia64                             allyesconfig
powerpc                 mpc8272_ads_defconfig
sh                        edosk7760_defconfig
sh                   sh7770_generic_defconfig
sh                            hp6xx_defconfig
arm                          lpd270_defconfig
openrisc                    or1ksim_defconfig
sh                           se7724_defconfig
mips                           rs90_defconfig
powerpc                      acadia_defconfig
powerpc                      ppc44x_defconfig
ia64                             allmodconfig
m68k                             allmodconfig
m68k                                defconfig
m68k                             allyesconfig
arc                              allyesconfig
nds32                               defconfig
alpha                               defconfig
alpha                            allyesconfig
xtensa                           allyesconfig
h8300                            allyesconfig
arc                                 defconfig
sh                               allmodconfig
s390                             allyesconfig
s390                             allmodconfig
s390                                defconfig
sparc                            allyesconfig
sparc                               defconfig
i386                                defconfig
mips                             allyesconfig
powerpc                          allyesconfig
powerpc                          allmodconfig
powerpc                           allnoconfig
x86_64               randconfig-a005-20210429
x86_64               randconfig-a006-20210429
x86_64               randconfig-a004-20210429
x86_64               randconfig-a002-20210429
x86_64               randconfig-a001-20210429
x86_64               randconfig-a003-20210429
i386                 randconfig-a005-20210429
i386                 randconfig-a002-20210429
i386                 randconfig-a001-20210429
i386                 randconfig-a006-20210429
i386                 randconfig-a003-20210429
i386                 randconfig-a004-20210429
i386                 randconfig-a012-20210429
i386                 randconfig-a014-20210429
i386                 randconfig-a013-20210429
i386                 randconfig-a011-20210429
i386                 randconfig-a015-20210429
i386                 randconfig-a016-20210429
riscv                    nommu_k210_defconfig
riscv                    nommu_virt_defconfig
riscv                             allnoconfig
riscv                               defconfig
riscv                          rv32_defconfig
um                               allmodconfig
um                                  defconfig
x86_64                    rhel-8.3-kselftests
x86_64                              defconfig
x86_64                               rhel-8.3
x86_64                      rhel-8.3-kbuiltin
x86_64                                  kexec

clang tested configs:
x86_64               randconfig-a015-20210429
x86_64               randconfig-a016-20210429
x86_64               randconfig-a011-20210429
x86_64               randconfig-a014-20210429
x86_64               randconfig-a013-20210429
x86_64               randconfig-a012-20210429

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

^ permalink raw reply

* [GIT PULL] Please pull powerpc/linux.git powerpc-5.13-1 tag
From: Michael Ellerman @ 2021-04-30  4:02 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: cascardo, tony.ambardar, srikar, sbhat, tyreld, aik, jniethe5,
	bigeasy, cmr, avagin, sandipan, lee.jones, jiapeng.chong, dave,
	unixbhaskar, lkp, dima, aneesh.kumar, masahiroy, danielhb413,
	haren, mahesh, dingsenjie, ganeshgr, geert, naveen.n.rao, yukuai3,
	nathanl, ravi.bangoria, elver, ajd, leobras.c, chenhuang5,
	efremov, nathan, maddy, cuibixuan, clg, pulehui, vaibhav, ldufour,
	heying24, dja, christophe.leroy, atrajeev, sxwjean, rdunlap,
	npiggin, linux-kernel, lihuafei1, wsa, zhang.yunkai, yang.lee,
	fbarrat, colin.king, linuxppc-dev

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

Hi Linus,

Please pull powerpc updates for 5.13.

No conflicts that I'm aware of.

Notable out of area changes:

  51c66ad849a7 powerpc/bpf: Implement extended BPF on PPC32
    Documentation/admin-guide/sysctl/net.rst

  808094fcbf41 lib/vdso: Add vdso_data pointer as input to __arch_get_timens_vdso_data()
    arch/arm64/include/asm/vdso/compat_gettimeofday.h
    arch/arm64/include/asm/vdso/gettimeofday.h
    arch/s390/include/asm/vdso/gettimeofday.h
    arch/x86/include/asm/vdso/gettimeofday.h
    lib/vdso/gettimeofday.c

  fb05121fd6a2 signal: Add unsafe_get_compat_sigset()
    include/linux/compat.h
    include/linux/uaccess.h

cheers


The following changes since commit 1e28eed17697bcf343c6743f0028cc3b5dd88bf0:

  Linux 5.12-rc3 (2021-03-14 14:41:02 -0700)

are available in the git repository at:

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

for you to fetch changes up to 5256426247837feb8703625bda7fcfc824af04cf:

  powerpc/signal32: Fix erroneous SIGSEGV on RT signal return (2021-04-28 23:35:11 +1000)

- ------------------------------------------------------------------
powerpc updates for 5.13

 - Enable KFENCE for 32-bit.

 - Implement EBPF for 32-bit.

 - Convert 32-bit to do interrupt entry/exit in C.

 - Convert 64-bit BookE to do interrupt entry/exit in C.

 - Changes to our signal handling code to use user_access_begin/end() more extensively.

 - Add support for time namespaces (CONFIG_TIME_NS)

 - A series of fixes that allow us to reenable STRICT_KERNEL_RWX.

 - Other smaller features, fixes & cleanups.

Thanks to: Alexey Kardashevskiy, Andreas Schwab, Andrew Donnellan, Aneesh Kumar K.V,
  Athira Rajeev, Bhaskar Chowdhury, Bixuan Cui, Cédric Le Goater, Chen Huang, Chris
  Packham, Christophe Leroy, Christopher M. Riedl, Colin Ian King, Dan Carpenter, Daniel
  Axtens, Daniel Henrique Barboza, David Gibson, Davidlohr Bueso, Denis Efremov,
  dingsenjie, Dmitry Safonov, Dominic DeMarco, Fabiano Rosas, Ganesh Goudar, Geert
  Uytterhoeven, Geetika Moolchandani, Greg Kurz, Guenter Roeck, Haren Myneni, He Ying,
  Jiapeng Chong, Jordan Niethe, Laurent Dufour, Lee Jones, Leonardo Bras, Li Huafei,
  Madhavan Srinivasan, Mahesh Salgaonkar, Masahiro Yamada, Nathan Chancellor, Nathan
  Lynch, Nicholas Piggin, Oliver O'Halloran, Paul Menzel, Pu Lehui, Randy Dunlap, Ravi
  Bangoria, Rosen Penev, Russell Currey, Santosh Sivaraj, Sebastian Andrzej Siewior,
  Segher Boessenkool, Shivaprasad G Bhat, Srikar Dronamraju, Stephen Rothwell, Thadeu Lima
  de Souza Cascardo, Thomas Gleixner, Tony Ambardar, Tyrel Datwyler, Vaibhav Jain,
  Vincenzo Frascino, Xiongwei Song, Yang Li, Yu Kuai, Zhang Yunkai.

- ------------------------------------------------------------------
Alexey Kardashevskiy (3):
      powerpc/iommu: Allocate it_map by vmalloc
      powerpc/iommu: Do not immediately panic when failed IOMMU table allocation
      powerpc/iommu: Annotate nested lock for lockdep

Aneesh Kumar K.V (2):
      powerpc/book3s64/kuap: Move Kconfig varriables to BOOK3S_64
      powerpc/mm: Revert "powerpc/mm: Remove DEBUG_VM_PGTABLE support on powerpc"

Athira Rajeev (4):
      powerpc/perf: Fix PMU constraint check for EBB events
      powerpc/perf: Expose processor pipeline stage cycles using PERF_SAMPLE_WEIGHT_STRUCT
      powerpc/perf: Fix sampled instruction type for larx/stcx
      powerpc/perf: Fix the threshold event selection for memory events in power10

Bhaskar Chowdhury (6):
      powerpc: Fix spelling of "droping" to "dropping" in traps.c
      powerpc/64e: Trivial spelling fixes throughout head_fsl_booke.S
      powerpc/mm/book3s64: Fix a typo in mmu_context.c
      powerpc/kernel: Trivial typo fix in kgdb.c
      cxl: Fix couple of spellings
      powerpc: Spelling/typo fixes

Bixuan Cui (5):
      powerpc/pseries: Make symbol '__pcpu_scope_hcall_stats' static
      powerpc/pseries/pmem: Make symbol 'drc_pmem_match' static
      powerpc/perf: Make symbol 'isa207_pmu_format_attr' static
      powerpc/perf/hv-24x7: Make some symbols static
      powerpc/powernv: make symbol 'mpipl_kobj' static

Chen Huang (1):
      powerpc: Fix HAVE_HARDLOCKUP_DETECTOR_ARCH build configuration

Christophe Leroy (130):
      powerpc: Enable KFENCE for PPC32
      powerpc/uaccess: Also perform 64 bits copies in unsafe_copy_to_user() on ppc32
      powerpc/uaccess: Swap clear_user() and __clear_user()
      powerpc/uaccess: Move copy_mc_xxx() functions down
      powerpc/syscalls: Use sys_old_select() in ppc_select()
      powerpc/lib: Don't use __put_user_asm_goto() outside of uaccess.h
      powerpc/net: Switch csum_and_copy_{to/from}_user to user_access block
      powerpc/futex: Switch to user_access block
      powerpc/ptrace: Convert gpr32_set_common() to user access block
      powerpc/traps: Declare unrecoverable_exception() as __noreturn
      powerpc/40x: Don't use SPRN_SPRG_SCRATCH0/1 in TLB miss handlers
      powerpc/40x: Change CRITICAL_EXCEPTION_PROLOG macro to a gas macro
      powerpc/40x: Save SRR0/SRR1 and r10/r11 earlier in critical exception
      powerpc/40x: Reorder a few instructions in critical exception prolog
      powerpc/40x: Prepare for enabling MMU in critical exception prolog
      powerpc/40x: Prepare normal exception handler for enabling MMU early
      powerpc/32: Reconcile interrupts in C
      powerpc/32: Entry cpu time accounting in C
      powerpc/32: Handle bookE debugging in C in exception entry
      powerpc/32: Use fast instruction to set MSR RI in exception prolog on 8xx
      powerpc/32: Remove ksp_limit
      powerpc/32: Always enable data translation in exception prolog
      powerpc/32: Tag DAR in EXCEPTION_PROLOG_2 for the 8xx
      powerpc/32: Enable instruction translation at the same time as data translation
      powerpc/32: Statically initialise first emergency context
      powerpc/32: Add vmap_stack_overflow label inside the macro
      powerpc/32: Use START_EXCEPTION() as much as possible
      powerpc/32: Move exception prolog code into .text once MMU is back on
      powerpc/32: Provide a name to exception prolog continuation in virtual mode
      powerpc/32: Refactor booke critical registers saving
      powerpc/32: Perform normal function call in exception entry
      powerpc/32: Always save non volatile registers on exception entry
      powerpc/32: Replace ASM exception exit by C exception exit from ppc64
      powerpc/32: Don't save thread.regs on interrupt entry
      powerpc/32: Set regs parameter in r3 in transfer_to_handler
      powerpc/32: Call bad_page_fault() from do_page_fault()
      powerpc/32: Save trap number on stack in exception prolog
      powerpc/32: Add a prepare_transfer_to_handler macro for exception prologs
      powerpc/32: Only restore non volatile registers when required
      powerpc/32: Dismantle EXC_XFER_STD/LITE/TEMPLATE
      powerpc/32: Remove the xfer parameter in EXCEPTION() macro
      powerpc/32: Refactor saving of volatile registers in exception prologs
      powerpc/32: Save remaining registers in exception prolog
      powerpc/32: Return directly from power_save_ppc32_restore()
      powerpc/32: Only use prepare_transfer_to_handler function on book3s/32 and e500
      powerpc/32s: Move KUEP locking/unlocking in C
      powerpc/64s: Make kuap_check_amr() and kuap_get_and_check_amr() generic
      powerpc/32s: Create C version of kuap save/restore/check helpers
      powerpc/8xx: Create C version of kuap save/restore/check helpers
      powerpc/32: Manage KUAP in C
      powerpc/Makefile: Remove workaround for gcc versions below 4.9
      powerpc/math: Fix missing __user qualifier for get_user() and other sparse warnings
      powerpc/asm-offsets: GPR14 is not needed either
      powerpc/mm: Remove unneeded #ifdef CONFIG_PPC_MEM_KEYS
      powerpc: Activate HAVE_RELIABLE_STACKTRACE for all
      powerpc: Rename 'tsk' parameter into 'task'
      powerpc: Convert stacktrace to generic ARCH_STACKWALK
      powerpc: Fix arch_stack_walk() to have running function as first entry
      powerpc/embedded6xx: Remove CONFIG_MV64X60
      powerpc/irq: Inline call_do_irq() and call_do_softirq()
      powerpc/uaccess: Remove __get_user_allowed() and unsafe_op_wrap()
      powerpc/uaccess: Define ___get_user_instr() for ppc32
      powerpc/align: Convert emulate_spe() to user_access_begin
      powerpc/uaccess: Remove __get/put_user_inatomic()
      powerpc/uaccess: Move get_user_instr helpers in asm/inst.h
      powerpc/align: Don't use __get_user_instr() on kernel addresses
      powerpc/uaccess: Call might_fault() inconditionaly
      powerpc/uaccess: Remove __unsafe_put_user_goto()
      powerpc/uaccess: Remove __chk_user_ptr() in __get/put_user
      powerpc/uaccess: Remove calls to __get_user_bad() and __put_user_bad()
      powerpc/uaccess: Split out __get_user_nocheck()
      powerpc/uaccess: Rename __get/put_user_check/nocheck
      powerpc/uaccess: Refactor get/put_user() and __get/put_user()
      powerpc/uaccess: Introduce __get_user_size_goto()
      powerpc/uaccess: Use asm goto for get_user when compiler supports it
      signal: Add unsafe_get_compat_sigset()
      powerpc/uaccess: Also perform 64 bits copies in unsafe_copy_from_user() on ppc32
      powerpc/signal: Add unsafe_copy_ck{fpr/vsx}_from_user
      powerpc/signal32: Rename save_user_regs_unsafe() and save_general_regs_unsafe()
      powerpc/signal32: Remove ifdefery in middle of if/else in sigreturn()
      powerpc/signal32: Perform access_ok() inside restore_user_regs()
      powerpc/signal32: Reorder user reads in restore_tm_user_regs()
      powerpc/signal32: Convert restore_[tm]_user_regs() to user access block
      powerpc/signal32: Convert do_setcontext[_tm]() to user access block
      powerpc/signal32: Simplify logging in sigreturn()
      powerpc/bpf: Remove classical BPF support for PPC32
      powerpc/bpf: Change register numbering for bpf_set/is_seen_register()
      powerpc/bpf: Move common helpers into bpf_jit.h
      powerpc/bpf: Move common functions into bpf_jit_comp.c
      powerpc/bpf: Change values of SEEN_ flags
      powerpc/asm: Add some opcodes in asm/ppc-opcode.h for PPC32 eBPF
      powerpc/bpf: Implement extended BPF on PPC32
      powerpc/bpf: Reallocate BPF registers to volatile registers when possible on PPC32
      powerpc: Switch to relative jump labels
      powerpc/32: Remove powerpc specific definition of 'ptrdiff_t'
      powerpc/signal32: Fix build failure with CONFIG_SPE
      powerpc/modules: Load modules closer to kernel text
      powerpc/8xx: Define a MODULE area below kernel text
      powerpc/32s: Define a MODULE area below kernel text all the time
      powerpc/mem: Move cache flushing functions into mm/cacheflush.c
      powerpc/mem: Declare __flush_dcache_icache() static
      powerpc/mem: Remove address argument to flush_coherent_icache()
      powerpc/mem: Call flush_coherent_icache() at higher level
      powerpc/mem: Optimise flush_dcache_icache_hugepage()
      powerpc/mem: flush_dcache_icache_phys() is for HIGHMEM pages only
      powerpc/mem: Help GCC realise __flush_dcache_icache() flushes single pages
      powerpc/mem: Inline flush_dcache_page()
      powerpc/mem: Use kmap_local_page() in flushing functions
      lib/vdso: Mark do_hres_timens() and do_coarse_timens() __always_inline()
      lib/vdso: Add vdso_data pointer as input to __arch_get_timens_vdso_data()
      powerpc/vdso: Add support for time namespaces
      powerpc/8xx: Enhance readability of trap types
      powerpc/32s: Enhance readability of trap types
      powerpc/irq: Enhance readability of trap types
      powerpc/inst: ppc_inst_as_u64() becomes ppc_inst_as_ulong()
      powerpc: Enable OPTPROBES on PPC32
      selftests/timens: Fix gettime_perf to work on powerpc
      powerpc/32: Use r2 in wrtspr() instead of r0
      powerpc/ebpf32: Fix comment on BPF_ALU{64} | BPF_LSH | BPF_K
      powerpc/ebpf32: Rework 64 bits shifts to avoid tests and branches
      powerpc/ebpf32: Use standard function call for functions within 32M distance
      powerpc: Remove probe_user_read_inst()
      powerpc: Make probe_kernel_read_inst() common to PPC32 and PPC64
      powerpc: Rename probe_kernel_read_inst()
      powerpc: Move copy_inst_from_kernel_nofault()
      powerpc/64: Fix the definition of the fixmap area
      powerpc/legacy_serial: Use early_ioremap()
      powerpc/52xx: Fix an invalid ASM expression ('addi' used instead of 'add')
      powerpc/kasan: Fix shadow start address with modules
      powerpc/signal32: Fix erroneous SIGSEGV on RT signal return

Christopher M. Riedl (8):
      powerpc/uaccess: Add unsafe_copy_from_user()
      powerpc/signal: Add unsafe_copy_{vsx, fpr}_from_user()
      powerpc/signal64: Remove non-inline calls from setup_sigcontext()
      powerpc: Reference parameter in MSR_TM_ACTIVE() macro
      powerpc/signal64: Remove TM ifdefery in middle of if/else block
      powerpc/signal64: Replace setup_sigcontext() w/ unsafe_setup_sigcontext()
      powerpc/signal64: Replace restore_sigcontext() w/ unsafe_restore_sigcontext()
      powerpc/signal: Use __get_user() to copy sigset_t

Colin Ian King (1):
      powerpc/44x: fix spelling mistake in Kconfig "varients" -> "variants"

Cédric Le Goater (9):
      powerpc/xive: Introduce an IPI interrupt domain
      powerpc/xive: Remove useless check on XIVE_IPI_HW_IRQ
      powerpc/xive: Simplify xive_core_debug_show()
      powerpc/xive: Drop check on irq_data in xive_core_debug_show()
      powerpc/xive: Simplify the dump of XIVE interrupts under xmon
      powerpc/xive: Fix xmon command "dxi"
      powerpc/xive: Map one IPI interrupt per node
      powerpc/xive: Modernize XIVE-IPI domain with an 'alloc' handler
      powerpc/xive: Use the "ibm, chip-id" property only under PowerNV

Daniel Axtens (2):
      powerpc/signal64: Rewrite handle_rt_signal64() to minimise uaccess switches
      powerpc/signal64: Rewrite rt_sigreturn() to minimise uaccess switches

Daniel Henrique Barboza (3):
      powerpc/pseries/hotplug-cpu: Show 'last online CPU' error in dlpar_cpu_offline()
      powerpc/pseries: Introduce dlpar_unisolate_drc()
      powerpc/pseries: Set UNISOLATE on dlpar_cpu_remove() failure

Davidlohr Bueso (3):
      powerpc/spinlock: Define smp_mb__after_spinlock only once
      powerpc/spinlock: Unserialize spin_is_locked
      powerpc/qspinlock: Use generic smp_cond_load_relaxed

Denis Efremov (1):
      powerpc/ptrace: Remove duplicate check from pt_regs_check()

Dmitry Safonov (1):
      powerpc/vdso: Separate vvar vma from vdso

Ganesh Goudar (2):
      powerpc/pseries/mce: Fix a typo in error type assignment
      powerpc/mce: save ignore_event flag unconditionally for UE

Geert Uytterhoeven (1):
      powerpc/chrp: Make hydra_init() static

Haren Myneni (1):
      Documentation/powerpc: Add proper links for manual and tests

He Ying (1):
      powerpc/setup_64: Fix sparse warnings

Jiapeng Chong (2):
      powerpc: remove unneeded semicolon
      powerpc/pci: fix warning comparing pointer to 0

Jordan Niethe (4):
      powerpc/64s: Fix pte update for kernel memory on radix
      selftests/powerpc: Test for spurious kernel memory faults on radix
      powerpc/powernv/memtrace: Allow mmaping trace buffers
      selftests/powerpc: Suggest memtrace instead of /dev/mem for ci memory

Laurent Dufour (2):
      powerpc/pseries: export LPAR security flavor in lparcfg
      cxl: don't manipulate the mm.mm_users field directly

Lee Jones (1):
      powerpc/pseries: Move hvc_vio_init_early() prototype to shared location

Leonardo Bras (4):
      powerpc/iommu: Enable remaining IOMMU Pagesizes present in LoPAR
      powerpc/pseries/iommu: Fix window size for direct mapping with pmem
      powerpc/kernel/iommu: Align size for IOMMU_PAGE_SIZE() to save TCEs
      powerpc/kernel/iommu: Use largepool as a last resort when !largealloc

Li Huafei (2):
      powerpc/security: Make symbol 'stf_barrier' static
      powerpc/mce: Make symbol 'mce_ue_event_work' static

Madhavan Srinivasan (2):
      powerpc/perf: Infrastructure to support checking of attr.config*
      powerpc/perf: Add platform specific check_attr_config

Mahesh Salgaonkar (1):
      powerpc/eeh: Fix EEH handling for hugepages in ioremap space.

Masahiro Yamada (2):
      powerpc/syscalls: switch to generic syscalltbl.sh
      powerpc/syscalls: switch to generic syscallhdr.sh

Michael Ellerman (27):
      powerpc/eeh: Fix build failure with CONFIG_PROC_FS=n
      powerpc/64s: Fold update_current_thread_[i]amr() into their only callers
      powerpc: Fix section mismatch warning in smp_setup_pacas()
      powerpc/fsl-pci: Fix section mismatch warning
      powerpc/pseries: Only register vio drivers if vio bus exists
      powerpc/mm/64s: Add _PAGE_KERNEL_ROX
      powerpc/pseries: Add key to flags in pSeries_lpar_hpte_updateboltedpp()
      powerpc/64s: Use htab_convert_pte_flags() in hash__mark_rodata_ro()
      powerpc/mm/64s/hash: Factor out change_memory_range()
      powerpc/mm/64s/hash: Add real-mode change_memory_range() for hash LPAR
      powerpc/mm/64s: Allow STRICT_KERNEL_RWX again
      powerpc/64: Move security code into security.c
      powerpc/kexec: Don't use .machine ppc64 in trampoline_64.S
      powerpc/mm/radix: Make radix__change_memory_range() static
      powerpc/configs: Add PAPR_SCM to pseries_defconfig
      powerpc/papr_scm: Fix build error due to wrong printf specifier
      macintosh/via-pmu: Fix build warning
      Merge branch 'topic/ppc-kvm' into next
      powerpc/fadump: Fix compile error since trap type change
      powerpc: Only define _TASK_CPU for 32-bit
      powerpc/pseries: Stop calling printk in rtas_stop_self()
      powerpc/kvm: Fix PR KVM with KUAP/MEM_KEYS enabled
      powerpc/fadump: Fix sparse warnings
      powerpc/powernv: Fix type of opal_mpipl_query_tag() addr argument
      powerpc/64s: Add FA_DUMP to defconfig
      powerpc/configs: Add IBMVNIC to some 64-bit configs
      powerpc/kvm: Fix build error when PPC_MEM_KEYS/PPC_PSERIES=n

Nathan Chancellor (3):
      powerpc/fadump: Mark fadump_calculate_reserve_size as __init
      powerpc/prom: Mark identical_pvr_fixup as __init
      powerpc: Avoid clang uninitialized warning in __get_user_size_allowed

Nathan Lynch (5):
      powerpc/rtas: improve ppc_rtas_rmo_buf_show documentation
      powerpc/rtas-proc: remove unused RMO_READ_BUF_MAX
      powerpc/rtas: remove ibm_suspend_me_token
      powerpc/rtas: move syscall filter setup into separate function
      powerpc/rtas: rename RTAS_RMOBUF_MAX to RTAS_USER_REGION_SIZE

Nicholas Piggin (27):
      powerpc/64s: Fix hash fault to use TRAP accessor
      powerpc/64s: power4 nap fixup in C
      KVM: PPC: Book3S HV P9: Restore host CTRL SPR after guest exit
      KVM: PPC: Book3S HV: Nested move LPCR sanitising to sanitise_hv_regs
      KVM: PPC: Book3S HV: Add a function to filter guest LPCR bits
      KVM: PPC: Book3S HV: Disallow LPCR[AIL] to be set to 1 or 2
      KVM: PPC: Book3S HV: Prevent radix guests setting LPCR[TC]
      KVM: PPC: Book3S HV: Remove redundant mtspr PSPB
      KVM: PPC: Book3S HV: remove unused kvmppc_h_protect argument
      KVM: PPC: Book3S HV: Fix CONFIG_SPAPR_TCE_IOMMU=n default hcalls
      powerpc/64s: Remove KVM handler support from CBE_RAS interrupts
      powerpc/64s: remove KVM SKIP test from instruction breakpoint handler
      KVM: PPC: Book3S HV: Ensure MSR[ME] is always set in guest MSR
      KVM: PPC: Book3S HV: Ensure MSR[HV] is always clear in guest MSR
      powerpc/syscall: switch user_exit_irqoff and trace_hardirqs_off order
      powerpc/64e/interrupt: always save nvgprs on interrupt
      powerpc/interrupt: update common interrupt code for
      powerpc/64e/interrupt: use new interrupt return
      powerpc/64e/interrupt: NMI save irq soft-mask state in C
      powerpc/64e/interrupt: reconcile irq soft-mask state in C
      powerpc/64e/interrupt: Use new interrupt context tracking scheme
      powerpc/64e/interrupt: handle bad_page_fault in C
      powerpc: clean up do_page_fault
      powerpc: remove partial register save logic
      powerpc: move norestart trap flag to bit 0
      powerpc/powernv: Enable HAIL (HV AIL) for ISA v3.1 processors
      powerpc/64s: Fix mm_cpumask memory ordering comment

Pu Lehui (2):
      powerpc/xmon: Make symbol 'spu_inst_dump' static
      powerpc/fadump: make symbol 'rtas_fadump_set_regval' static

Randy Dunlap (3):
      selftests/powerpc: unmark non-kernel-doc comments
      powerpc: iommu: fix build when neither PCI or IBMVIO is set
      powerpc: make ALTIVEC select PPC_FPU

Ravi Bangoria (5):
      powerpc/uprobes: Validation for prefixed instruction
      powerpc/selftests/ptrace-hwbreak: Add testcases for 2nd DAWR
      powerpc/selftests/perf-hwbreak: Coalesce event creation code
      powerpc/selftests/perf-hwbreak: Add testcases for 2nd DAWR
      powerpc/selftests: Add selftest to test concurrent perf/ptrace events

Russell Currey (1):
      selftests/powerpc: Fix L1D flushing tests for Power10

Sebastian Andrzej Siewior (1):
      powerpc/mm: Move the linear_mapping_mutex to the ifdef where it is used

Shivaprasad G Bhat (1):
      powerpc/papr_scm: Implement support for H_SCM_FLUSH hcall

Srikar Dronamraju (4):
      powerpc/smp: Reintroduce cpu_core_mask
      Revert "powerpc/topology: Update topology_core_cpumask"
      powerpc/smp: Cache CPU to chip lookup
      powerpc/smp: Set numa node before updating mask

Thadeu Lima de Souza Cascardo (1):
      selftests/powerpc: Add uaccess flush test

Tony Ambardar (1):
      powerpc: fix EDEADLOCK redefinition error in uapi/asm/errno.h

Tyrel Datwyler (2):
      powerpc/pseries: extract host bridge from pci_bus prior to bus removal
      powerpc/pseries: Add shutdown() to vio_driver and vio_bus

Vaibhav Jain (2):
      powerpc/mm: Add cond_resched() while removing hpte mappings
      powerpc/papr_scm: Mark nvdimm as unarmed if needed during probe

Xiongwei Song (1):
      powerpc/traps: Enhance readability for trap types

Yang Li (5):
      powerpc/xive: use true and false for bool variable
      powerpc/pseries: remove unneeded semicolon
      powerpc/eeh: remove unneeded semicolon
      powerpc/64s: remove unneeded semicolon
      selftests/powerpc: remove unneeded semicolon

Yu Kuai (4):
      macintosh/windfarm: Make symbol 'pm121_sys_state' static
      windfarm: make symbol 'wf_thread' static
      macintosh/via-pmu: Make some symbols static
      powerpc/smp: Make some symbols static

Zhang Yunkai (2):
      powerpc: Remove duplicate includes
      powerpc: Fix misspellings in tlbflush.h

dingsenjie (1):
      powerpc/powernv: Remove unneeded variable: "rc"

kernel test robot (1):
      powerpc/iommu/debug: fix ifnullfree.cocci warnings


 Documentation/admin-guide/sysctl/net.rst                       |    2 +-
 Documentation/features/debug/debug-vm-pgtable/arch-support.txt |    2 +-
 Documentation/powerpc/papr_hcalls.rst                          |   14 +
 Documentation/powerpc/vas-api.rst                              |    4 +-
 arch/arm64/include/asm/vdso/compat_gettimeofday.h              |    3 +-
 arch/arm64/include/asm/vdso/gettimeofday.h                     |    2 +-
 arch/powerpc/Kconfig                                           |   32 +-
 arch/powerpc/Kconfig.debug                                     |    1 +
 arch/powerpc/Makefile                                          |   11 +-
 arch/powerpc/configs/ppc64_defconfig                           |    2 +
 arch/powerpc/configs/pseries_defconfig                         |    2 +
 arch/powerpc/include/asm/Kbuild                                |    1 -
 arch/powerpc/include/asm/asm-prototypes.h                      |    2 -
 arch/powerpc/include/asm/barrier.h                             |   16 -
 arch/powerpc/include/asm/book3s/32/kup.h                       |  126 +--
 arch/powerpc/include/asm/book3s/32/pgtable.h                   |    2 -
 arch/powerpc/include/asm/book3s/32/tlbflush.h                  |    2 +-
 arch/powerpc/include/asm/book3s/64/kup.h                       |   24 +-
 arch/powerpc/include/asm/book3s/64/mmu-hash.h                  |    1 -
 arch/powerpc/include/asm/book3s/64/pgtable.h                   |    5 +-
 arch/powerpc/include/asm/book3s/64/radix.h                     |    6 +-
 arch/powerpc/include/asm/bug.h                                 |    5 +-
 arch/powerpc/include/asm/cacheflush.h                          |   15 +-
 arch/powerpc/include/asm/cpm2.h                                |    2 +-
 arch/powerpc/include/asm/fixmap.h                              |    9 +
 arch/powerpc/include/asm/futex.h                               |   12 +-
 arch/powerpc/include/asm/hvcall.h                              |    4 +-
 arch/powerpc/include/asm/hvconsole.h                           |    3 +
 arch/powerpc/include/asm/hydra.h                               |    2 -
 arch/powerpc/include/asm/inst.h                                |   55 +-
 arch/powerpc/include/asm/interrupt.h                           |  173 ++-
 arch/powerpc/include/asm/irq.h                                 |    2 -
 arch/powerpc/include/asm/jump_label.h                          |   21 +-
 arch/powerpc/include/asm/kasan.h                               |    2 +-
 arch/powerpc/include/asm/kfence.h                              |   33 +
 arch/powerpc/include/asm/kup.h                                 |   27 +-
 arch/powerpc/include/asm/kvm_book3s.h                          |    2 +
 arch/powerpc/include/asm/kvm_ppc.h                             |    3 +-
 arch/powerpc/include/asm/mmu_context.h                         |    2 +-
 arch/powerpc/include/asm/nohash/32/kup-8xx.h                   |   56 +-
 arch/powerpc/include/asm/nohash/32/mmu-8xx.h                   |    3 +
 arch/powerpc/include/asm/nohash/64/pgtable.h                   |    5 +-
 arch/powerpc/include/asm/opal.h                                |    2 +-
 arch/powerpc/include/asm/perf_event_server.h                   |    8 +-
 arch/powerpc/include/asm/pgtable.h                             |    2 -
 arch/powerpc/include/asm/ppc-opcode.h                          |   13 +
 arch/powerpc/include/asm/ppc_asm.h                             |   30 -
 arch/powerpc/include/asm/processor.h                           |    9 +-
 arch/powerpc/include/asm/ptrace.h                              |   45 +-
 arch/powerpc/include/asm/qspinlock.h                           |   21 +-
 arch/powerpc/include/asm/reg.h                                 |    6 +-
 arch/powerpc/include/asm/rtas.h                                |    6 +-
 arch/powerpc/include/asm/simple_spinlock.h                     |    6 +-
 arch/powerpc/include/asm/smp.h                                 |    6 +
 arch/powerpc/include/asm/spinlock.h                            |    3 +
 arch/powerpc/include/asm/thread_info.h                         |    7 +-
 arch/powerpc/include/asm/topology.h                            |    2 +-
 arch/powerpc/include/asm/uaccess.h                             |  389 +++----
 arch/powerpc/include/asm/unistd.h                              |    1 +
 arch/powerpc/include/asm/vdso/gettimeofday.h                   |   10 +
 arch/powerpc/include/asm/vdso_datapage.h                       |    2 -
 arch/powerpc/include/asm/vio.h                                 |    1 +
 arch/powerpc/include/asm/xive.h                                |    1 +
 arch/powerpc/include/uapi/asm/errno.h                          |    1 +
 arch/powerpc/include/uapi/asm/posix_types.h                    |    5 -
 arch/powerpc/kernel/align.c                                    |   72 +-
 arch/powerpc/kernel/asm-offsets.c                              |   17 -
 arch/powerpc/kernel/eeh.c                                      |   15 +-
 arch/powerpc/kernel/entry_32.S                                 |  796 +++-----------
 arch/powerpc/kernel/entry_64.S                                 |   40 +-
 arch/powerpc/kernel/exceptions-64e.S                           |  425 +-------
 arch/powerpc/kernel/exceptions-64s.S                           |   60 +-
 arch/powerpc/kernel/fadump.c                                   |   18 +-
 arch/powerpc/kernel/fpu.S                                      |    2 -
 arch/powerpc/kernel/head_32.h                                  |  198 ++--
 arch/powerpc/kernel/head_40x.S                                 |  271 ++---
 arch/powerpc/kernel/head_44x.S                                 |   10 +-
 arch/powerpc/kernel/head_8xx.S                                 |  156 ++-
 arch/powerpc/kernel/head_book3s_32.S                           |  242 ++---
 arch/powerpc/kernel/head_booke.h                               |  203 ++--
 arch/powerpc/kernel/head_fsl_booke.S                           |   70 +-
 arch/powerpc/kernel/hw_breakpoint_constraints.c                |    2 +-
 arch/powerpc/kernel/idle_6xx.S                                 |   14 +-
 arch/powerpc/kernel/idle_book3s.S                              |    4 +
 arch/powerpc/kernel/idle_e500.S                                |   14 +-
 arch/powerpc/kernel/interrupt.c                                |   67 +-
 arch/powerpc/kernel/iommu.c                                    |   46 +-
 arch/powerpc/kernel/irq.c                                      |  132 +--
 arch/powerpc/kernel/jump_label.c                               |    4 +-
 arch/powerpc/kernel/kgdb.c                                     |    2 +-
 arch/powerpc/kernel/legacy_serial.c                            |   33 +-
 arch/powerpc/kernel/mce.c                                      |    5 +-
 arch/powerpc/kernel/misc_32.S                                  |   39 -
 arch/powerpc/kernel/misc_64.S                                  |   22 -
 arch/powerpc/kernel/module.c                                   |   23 +-
 arch/powerpc/kernel/optprobes.c                                |   24 +-
 arch/powerpc/kernel/optprobes_head.S                           |   65 +-
 arch/powerpc/kernel/process.c                                  |   25 +-
 arch/powerpc/kernel/prom.c                                     |   21 +-
 arch/powerpc/kernel/prom_init.c                                |    2 +-
 arch/powerpc/kernel/ptrace/ptrace-view.c                       |   51 +-
 arch/powerpc/kernel/ptrace/ptrace.c                            |    4 -
 arch/powerpc/kernel/ptrace/ptrace32.c                          |    4 -
 arch/powerpc/kernel/rtas-proc.c                                |   15 +-
 arch/powerpc/kernel/rtas.c                                     |   34 +-
 arch/powerpc/kernel/security.c                                 |  263 ++++-
 arch/powerpc/kernel/setup-common.c                             |    3 +-
 arch/powerpc/kernel/setup_32.c                                 |    2 +-
 arch/powerpc/kernel/setup_64.c                                 |  282 +----
 arch/powerpc/kernel/signal.h                                   |   55 +
 arch/powerpc/kernel/signal_32.c                                |  254 +++--
 arch/powerpc/kernel/signal_64.c                                |  319 +++---
 arch/powerpc/kernel/smp.c                                      |   68 +-
 arch/powerpc/kernel/stacktrace.c                               |  108 +-
 arch/powerpc/kernel/syscalls.c                                 |   12 +-
 arch/powerpc/kernel/syscalls/Makefile                          |   33 +-
 arch/powerpc/kernel/syscalls/syscallhdr.sh                     |   36 -
 arch/powerpc/kernel/syscalls/syscalltbl.sh                     |   36 -
 arch/powerpc/kernel/systbl.S                                   |    5 +-
 arch/powerpc/kernel/trace/ftrace.c                             |   22 +-
 arch/powerpc/kernel/traps.c                                    |   40 +-
 arch/powerpc/kernel/uprobes.c                                  |    7 +
 arch/powerpc/kernel/vdso.c                                     |  138 ++-
 arch/powerpc/kernel/vdso32/vdso32.lds.S                        |    2 +-
 arch/powerpc/kernel/vdso64/vdso64.lds.S                        |    2 +-
 arch/powerpc/kernel/vector.S                                   |    2 -
 arch/powerpc/kexec/crash.c                                     |    3 +-
 arch/powerpc/kvm/book3s_64_mmu_host.c                          |    2 +
 arch/powerpc/kvm/book3s_hv.c                                   |   85 +-
 arch/powerpc/kvm/book3s_hv_builtin.c                           |    3 +
 arch/powerpc/kvm/book3s_hv_nested.c                            |   37 +-
 arch/powerpc/kvm/book3s_hv_rm_mmu.c                            |    3 +-
 arch/powerpc/lib/Makefile                                      |    2 +-
 arch/powerpc/lib/checksum_wrappers.c                           |   15 +-
 arch/powerpc/lib/code-patching.c                               |   13 +-
 arch/powerpc/lib/inst.c                                        |   73 --
 arch/powerpc/lib/sstep.c                                       |   13 -
 arch/powerpc/math-emu/math.c                                   |    4 +-
 arch/powerpc/mm/Makefile                                       |    3 +-
 arch/powerpc/mm/book3s32/Makefile                              |    1 +
 arch/powerpc/mm/book3s32/hash_low.S                            |   14 -
 arch/powerpc/mm/book3s32/kuep.c                                |   40 +
 arch/powerpc/mm/book3s32/mmu.c                                 |    9 +-
 arch/powerpc/mm/book3s64/hash_pgtable.c                        |  130 ++-
 arch/powerpc/mm/book3s64/hash_utils.c                          |   35 +-
 arch/powerpc/mm/book3s64/mmu_context.c                         |    2 +-
 arch/powerpc/mm/book3s64/pkeys.c                               |   20 +-
 arch/powerpc/mm/book3s64/radix_pgtable.c                       |   10 +-
 arch/powerpc/mm/cacheflush.c                                   |  234 +++++
 arch/powerpc/mm/fault.c                                        |   60 +-
 arch/powerpc/mm/init_32.c                                      |    3 +
 arch/powerpc/mm/maccess.c                                      |   21 +
 arch/powerpc/mm/mem.c                                          |  283 +----
 arch/powerpc/mm/mmu_context.c                                  |   24 +-
 arch/powerpc/mm/mmu_decl.h                                     |    5 +
 arch/powerpc/mm/nohash/8xx.c                                   |    4 +-
 arch/powerpc/net/Makefile                                      |    6 +-
 arch/powerpc/net/bpf_jit.h                                     |   64 ++
 arch/powerpc/net/bpf_jit32.h                                   |  139 ---
 arch/powerpc/net/bpf_jit64.h                                   |   21 +-
 arch/powerpc/net/bpf_jit_asm.S                                 |  226 ----
 arch/powerpc/net/bpf_jit_comp.c                                |  782 ++++----------
 arch/powerpc/net/bpf_jit_comp32.c                              | 1100 ++++++++++++++++++++
 arch/powerpc/net/bpf_jit_comp64.c                              |  295 +-----
 arch/powerpc/perf/core-book3s.c                                |   20 +-
 arch/powerpc/perf/hv-24x7.c                                    |   10 +-
 arch/powerpc/perf/isa207-common.c                              |  115 +-
 arch/powerpc/perf/isa207-common.h                              |    9 +-
 arch/powerpc/perf/power10-events-list.h                        |    4 +-
 arch/powerpc/perf/power10-pmu.c                                |   13 +
 arch/powerpc/perf/power9-pmu.c                                 |   13 +
 arch/powerpc/platforms/44x/Kconfig                             |    2 +-
 arch/powerpc/platforms/52xx/lite5200_sleep.S                   |    2 +-
 arch/powerpc/platforms/Kconfig.cputype                         |    5 +-
 arch/powerpc/platforms/cell/iommu.c                            |    3 +-
 arch/powerpc/platforms/cell/spu_callbacks.c                    |    2 +-
 arch/powerpc/platforms/chrp/pci.c                              |    3 +-
 arch/powerpc/platforms/embedded6xx/Kconfig                     |    5 -
 arch/powerpc/platforms/maple/pci.c                             |    2 +-
 arch/powerpc/platforms/pasemi/iommu.c                          |    4 +-
 arch/powerpc/platforms/powernv/memtrace.c                      |   18 +-
 arch/powerpc/platforms/powernv/opal-core.c                     |    2 +-
 arch/powerpc/platforms/powernv/opal-prd.c                      |    5 +-
 arch/powerpc/platforms/powernv/pci-ioda.c                      |   15 +-
 arch/powerpc/platforms/powernv/setup.c                         |    2 +-
 arch/powerpc/platforms/pseries/dlpar.c                         |   14 +
 arch/powerpc/platforms/pseries/hotplug-cpu.c                   |   27 +-
 arch/powerpc/platforms/pseries/hvCall_inst.c                   |    2 +-
 arch/powerpc/platforms/pseries/iommu.c                         |   49 +-
 arch/powerpc/platforms/pseries/lpar.c                          |    6 +-
 arch/powerpc/platforms/pseries/lparcfg.c                       |    2 +
 arch/powerpc/platforms/pseries/papr_scm.c                      |   48 +
 arch/powerpc/platforms/pseries/pci_dlpar.c                     |    4 +-
 arch/powerpc/platforms/pseries/pmem.c                          |    2 +-
 arch/powerpc/platforms/pseries/pseries.h                       |    5 +-
 arch/powerpc/platforms/pseries/ras.c                           |    2 +-
 arch/powerpc/platforms/pseries/rtas-fadump.c                   |    2 +-
 arch/powerpc/platforms/pseries/setup.c                         |    8 +
 arch/powerpc/platforms/pseries/vio.c                           |   20 +
 arch/powerpc/purgatory/trampoline_64.S                         |    1 -
 arch/powerpc/sysdev/dart_iommu.c                               |    3 +-
 arch/powerpc/sysdev/fsl_pci.c                                  |    2 +-
 arch/powerpc/sysdev/xive/common.c                              |  213 ++--
 arch/powerpc/sysdev/xive/native.c                              |    6 +
 arch/powerpc/sysdev/xive/spapr.c                               |    2 +-
 arch/powerpc/sysdev/xive/xive-internal.h                       |    3 +-
 arch/powerpc/xmon/xmon.c                                       |   76 +-
 arch/s390/include/asm/vdso/gettimeofday.h                      |    3 +-
 arch/x86/include/asm/vdso/gettimeofday.h                       |    3 +-
 drivers/i2c/busses/Kconfig                                     |    2 +-
 drivers/macintosh/via-pmu.c                                    |    4 +-
 drivers/macintosh/windfarm_core.c                              |    2 +-
 drivers/macintosh/windfarm_pm121.c                             |    2 +-
 drivers/macintosh/windfarm_smu_controls.c                      |    2 +-
 include/linux/compat.h                                         |   35 +
 include/linux/uaccess.h                                        |    1 +
 lib/vdso/gettimeofday.c                                        |   31 +-
 tools/testing/selftests/powerpc/alignment/alignment_handler.c  |   11 +-
 tools/testing/selftests/powerpc/mm/Makefile                    |    1 +
 tools/testing/selftests/powerpc/mm/stress_code_patching.sh     |   49 +
 tools/testing/selftests/powerpc/nx-gzip/gzfht_test.c           |    2 +-
 tools/testing/selftests/powerpc/ptrace/.gitignore              |    1 +
 tools/testing/selftests/powerpc/ptrace/Makefile                |    2 +-
 tools/testing/selftests/powerpc/ptrace/perf-hwbreak.c          |  635 ++++++++++-
 tools/testing/selftests/powerpc/ptrace/ptrace-hwbreak.c        |   79 ++
 tools/testing/selftests/powerpc/ptrace/ptrace-perf-hwbreak.c   |  659 ++++++++++++
 tools/testing/selftests/powerpc/security/Makefile              |    3 +-
 tools/testing/selftests/powerpc/security/entry_flush.c         |    2 +-
 tools/testing/selftests/powerpc/security/flush_utils.c         |   13 +
 tools/testing/selftests/powerpc/security/flush_utils.h         |    7 +
 tools/testing/selftests/powerpc/security/rfi_flush.c           |    2 +-
 tools/testing/selftests/powerpc/security/uaccess_flush.c       |  158 +++
 tools/testing/selftests/powerpc/tm/tm-trap.c                   |    4 +-
 tools/testing/selftests/timens/gettime_perf.c                  |    8 +
 234 files changed, 6868 insertions(+), 5596 deletions(-)
 create mode 100644 arch/powerpc/include/asm/kfence.h
 delete mode 100644 arch/powerpc/kernel/syscalls/syscallhdr.sh
 delete mode 100644 arch/powerpc/kernel/syscalls/syscalltbl.sh
 delete mode 100644 arch/powerpc/lib/inst.c
 create mode 100644 arch/powerpc/mm/book3s32/kuep.c
 create mode 100644 arch/powerpc/mm/cacheflush.c
 delete mode 100644 arch/powerpc/net/bpf_jit32.h
 delete mode 100644 arch/powerpc/net/bpf_jit_asm.S
 create mode 100644 arch/powerpc/net/bpf_jit_comp32.c
 create mode 100755 tools/testing/selftests/powerpc/mm/stress_code_patching.sh
 create mode 100644 tools/testing/selftests/powerpc/ptrace/ptrace-perf-hwbreak.c
 create mode 100644 tools/testing/selftests/powerpc/security/uaccess_flush.c
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEJFGtCPCthwEv2Y/bUevqPMjhpYAFAmCLgQUACgkQUevqPMjh
pYBLWQ//QybD2ID0PI2AU5aFnV4mA1Jt5jBsp//iyEInqnUe7/RUhKFGE++KCcIN
ylZcNGNDrmMHqvdONbad6bYK76dw7xy98CAOPfvT5jW5J3XhTdLrc6QxN1Nkrdj8
trSsH1O1DxF7zXD0a0BcjuY7FzPWlIKcE85EH4jMevs+Xo+HAguReswUlMQk6QGl
aZuD22sDsRbxHF27/SZBrxcsAPW8jVbG0PXb49knPJBeQ0mN4HkTpOvD6GKPE3d5
ajXfHZ/qtRiD8Lo5J75o+QAiHW0OPE2MXROhnwouZJEz/cpYBRTefkbzsLk3rESl
0TL6d14A6F+t1w6MKHdiNilhV4uO4H5D9pjy4Hms4mN5A9PO78adsNGvAJW+WcDT
m4IckH2E7KE+2NsSTcRvGdongtV2VjoVHad6gm76PDcJtwLoX+Dsi9bNgHIu5bWr
oWlSUi5kiWqAYWQMOQbmOJ4EQsvwpBSCKIUq7xaI/HEcgopI/DPn3FawVjmtAall
2VjsIaF60rODigUOCPeK6hVQs5JhBnHsjBHi0wGpqRM8pp7kNROlR0BT5ame94Lu
oOnpQxG/OlRTGF4kAc82uQiwSf3sZGrlgVRveH7Qt8G39t+dJ/o0wVNDivJCwLvM
7QMt5+RRmIlD0/mqTnlrT7/x7H4ssTG7E/I0qaekZczJM2L4Yzs=
=c6XH
-----END PGP SIGNATURE-----

^ permalink raw reply

* [PATCH 2/3] powerpc: prom_init: switch to early string functions
From: Daniel Walker @ 2021-04-30  4:22 UTC (permalink / raw)
  To: linuxppc-dev, x86, Andrew Morton
  Cc: xe-linux-external, linux-kernel, Paul Mackerras
In-Reply-To: <20210430042217.1198052-1-danielwa@cisco.com>

This converts the prom_init string users to the early string function
which don't suffer from KASAN or any other debugging enabled.

Cc: xe-linux-external@cisco.com
Signed-off-by: Daniel Walker <danielwa@cisco.com>
---
 arch/powerpc/kernel/prom_init.c        | 185 ++++++-------------------
 arch/powerpc/kernel/prom_init_check.sh |   9 +-
 2 files changed, 51 insertions(+), 143 deletions(-)

diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index ccf77b985c8f..4d4343da1280 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -225,105 +225,6 @@ static bool  __prombss rtas_has_query_cpu_stopped;
 #define PHANDLE_VALID(p)	((p) != 0 && (p) != PROM_ERROR)
 #define IHANDLE_VALID(i)	((i) != 0 && (i) != PROM_ERROR)
 
-/* Copied from lib/string.c and lib/kstrtox.c */
-
-static int __init prom_strcmp(const char *cs, const char *ct)
-{
-	unsigned char c1, c2;
-
-	while (1) {
-		c1 = *cs++;
-		c2 = *ct++;
-		if (c1 != c2)
-			return c1 < c2 ? -1 : 1;
-		if (!c1)
-			break;
-	}
-	return 0;
-}
-
-static char __init *prom_strcpy(char *dest, const char *src)
-{
-	char *tmp = dest;
-
-	while ((*dest++ = *src++) != '\0')
-		/* nothing */;
-	return tmp;
-}
-
-static int __init prom_strncmp(const char *cs, const char *ct, size_t count)
-{
-	unsigned char c1, c2;
-
-	while (count) {
-		c1 = *cs++;
-		c2 = *ct++;
-		if (c1 != c2)
-			return c1 < c2 ? -1 : 1;
-		if (!c1)
-			break;
-		count--;
-	}
-	return 0;
-}
-
-static size_t __init prom_strlen(const char *s)
-{
-	const char *sc;
-
-	for (sc = s; *sc != '\0'; ++sc)
-		/* nothing */;
-	return sc - s;
-}
-
-static int __init prom_memcmp(const void *cs, const void *ct, size_t count)
-{
-	const unsigned char *su1, *su2;
-	int res = 0;
-
-	for (su1 = cs, su2 = ct; 0 < count; ++su1, ++su2, count--)
-		if ((res = *su1 - *su2) != 0)
-			break;
-	return res;
-}
-
-static char __init *prom_strstr(const char *s1, const char *s2)
-{
-	size_t l1, l2;
-
-	l2 = prom_strlen(s2);
-	if (!l2)
-		return (char *)s1;
-	l1 = prom_strlen(s1);
-	while (l1 >= l2) {
-		l1--;
-		if (!prom_memcmp(s1, s2, l2))
-			return (char *)s1;
-		s1++;
-	}
-	return NULL;
-}
-
-static size_t __init prom_strlcat(char *dest, const char *src, size_t count)
-{
-	size_t dsize = prom_strlen(dest);
-	size_t len = prom_strlen(src);
-	size_t res = dsize + len;
-
-	/* This would be a bug */
-	if (dsize >= count)
-		return count;
-
-	dest += dsize;
-	count -= dsize;
-	if (len >= count)
-		len = count-1;
-	memcpy(dest, src, len);
-	dest[len] = 0;
-	return res;
-
-}
-
 #ifdef CONFIG_PPC_PSERIES
 static int __init prom_strtobool(const char *s, bool *res)
 {
@@ -694,7 +595,7 @@ static int __init prom_setprop(phandle node, const char *nodename,
 	add_string(&p, tohex((u32)(unsigned long) value));
 	add_string(&p, tohex(valuelen));
 	add_string(&p, tohex(ADDR(pname)));
-	add_string(&p, tohex(prom_strlen(pname)));
+	add_string(&p, tohex(early_strlen(pname)));
 	add_string(&p, "property");
 	*p = 0;
 	return call_prom("interpret", 1, 1, (u32)(unsigned long) cmd);
@@ -779,25 +680,25 @@ static void __init early_cmdline_parse(void)
 		l = prom_getprop(prom.chosen, "bootargs", p, COMMAND_LINE_SIZE-1);
 
 	if (IS_ENABLED(CONFIG_CMDLINE_EXTEND) || l <= 0 || p[0] == '\0')
-		prom_strlcat(prom_cmd_line, " " CONFIG_CMDLINE,
+		early_strlcat(prom_cmd_line, " " CONFIG_CMDLINE,
 			     sizeof(prom_cmd_line));
 
 	prom_printf("command line: %s\n", prom_cmd_line);
 
 #ifdef CONFIG_PPC64
-	opt = prom_strstr(prom_cmd_line, "iommu=");
+	opt = early_strstr(prom_cmd_line, "iommu=");
 	if (opt) {
 		prom_printf("iommu opt is: %s\n", opt);
 		opt += 6;
 		while (*opt && *opt == ' ')
 			opt++;
-		if (!prom_strncmp(opt, "off", 3))
+		if (!early_strncmp(opt, "off", 3))
 			prom_iommu_off = 1;
-		else if (!prom_strncmp(opt, "force", 5))
+		else if (!early_strncmp(opt, "force", 5))
 			prom_iommu_force_on = 1;
 	}
 #endif
-	opt = prom_strstr(prom_cmd_line, "mem=");
+	opt = early_strstr(prom_cmd_line, "mem=");
 	if (opt) {
 		opt += 4;
 		prom_memory_limit = prom_memparse(opt, (const char **)&opt);
@@ -809,7 +710,7 @@ static void __init early_cmdline_parse(void)
 
 #ifdef CONFIG_PPC_PSERIES
 	prom_radix_disable = !IS_ENABLED(CONFIG_PPC_RADIX_MMU_DEFAULT);
-	opt = prom_strstr(prom_cmd_line, "disable_radix");
+	opt = early_strstr(prom_cmd_line, "disable_radix");
 	if (opt) {
 		opt += 13;
 		if (*opt && *opt == '=') {
@@ -825,13 +726,13 @@ static void __init early_cmdline_parse(void)
 	if (prom_radix_disable)
 		prom_debug("Radix disabled from cmdline\n");
 
-	opt = prom_strstr(prom_cmd_line, "radix_hcall_invalidate=on");
+	opt = early_strstr(prom_cmd_line, "radix_hcall_invalidate=on");
 	if (opt) {
 		prom_radix_gtse_disable = true;
 		prom_debug("Radix GTSE disabled from cmdline\n");
 	}
 
-	opt = prom_strstr(prom_cmd_line, "xive=off");
+	opt = early_strstr(prom_cmd_line, "xive=off");
 	if (opt) {
 		prom_xive_disable = true;
 		prom_debug("XIVE disabled from cmdline\n");
@@ -839,7 +740,7 @@ static void __init early_cmdline_parse(void)
 #endif /* CONFIG_PPC_PSERIES */
 
 #ifdef CONFIG_PPC_SVM
-	opt = prom_strstr(prom_cmd_line, "svm=");
+	opt = early_strstr(prom_cmd_line, "svm=");
 	if (opt) {
 		bool val;
 
@@ -1199,7 +1100,7 @@ static int __init prom_count_smt_threads(void)
 		type[0] = 0;
 		prom_getprop(node, "device_type", type, sizeof(type));
 
-		if (prom_strcmp(type, "cpu"))
+		if (early_strcmp(type, "cpu"))
 			continue;
 		/*
 		 * There is an entry for each smt thread, each entry being
@@ -1650,7 +1551,7 @@ static void __init prom_init_mem(void)
 			 */
 			prom_getprop(node, "name", type, sizeof(type));
 		}
-		if (prom_strcmp(type, "memory"))
+		if (early_strcmp(type, "memory"))
 			continue;
 
 		plen = prom_getprop(node, "reg", regbuf, sizeof(regbuf));
@@ -1972,19 +1873,19 @@ static void __init prom_initialize_tce_table(void)
 		prom_getprop(node, "device_type", type, sizeof(type));
 		prom_getprop(node, "model", model, sizeof(model));
 
-		if ((type[0] == 0) || (prom_strstr(type, "pci") == NULL))
+		if ((type[0] == 0) || (early_strstr(type, "pci") == NULL))
 			continue;
 
 		/* Keep the old logic intact to avoid regression. */
 		if (compatible[0] != 0) {
-			if ((prom_strstr(compatible, "python") == NULL) &&
-			    (prom_strstr(compatible, "Speedwagon") == NULL) &&
-			    (prom_strstr(compatible, "Winnipeg") == NULL))
+			if ((early_strstr(compatible, "python") == NULL) &&
+			    (early_strstr(compatible, "Speedwagon") == NULL) &&
+			    (early_strstr(compatible, "Winnipeg") == NULL))
 				continue;
 		} else if (model[0] != 0) {
-			if ((prom_strstr(model, "ython") == NULL) &&
-			    (prom_strstr(model, "peedwagon") == NULL) &&
-			    (prom_strstr(model, "innipeg") == NULL))
+			if ((early_strstr(model, "ython") == NULL) &&
+			    (early_strstr(model, "peedwagon") == NULL) &&
+			    (early_strstr(model, "innipeg") == NULL))
 				continue;
 		}
 
@@ -2133,12 +2034,12 @@ static void __init prom_hold_cpus(void)
 
 		type[0] = 0;
 		prom_getprop(node, "device_type", type, sizeof(type));
-		if (prom_strcmp(type, "cpu") != 0)
+		if (early_strcmp(type, "cpu") != 0)
 			continue;
 
 		/* Skip non-configured cpus. */
 		if (prom_getprop(node, "status", type, sizeof(type)) > 0)
-			if (prom_strcmp(type, "okay") != 0)
+			if (early_strcmp(type, "okay") != 0)
 				continue;
 
 		reg = cpu_to_be32(-1); /* make sparse happy */
@@ -2214,9 +2115,9 @@ static void __init prom_find_mmu(void)
 		return;
 	version[sizeof(version) - 1] = 0;
 	/* XXX might need to add other versions here */
-	if (prom_strcmp(version, "Open Firmware, 1.0.5") == 0)
+	if (early_strcmp(version, "Open Firmware, 1.0.5") == 0)
 		of_workarounds = OF_WA_CLAIM;
-	else if (prom_strncmp(version, "FirmWorks,3.", 12) == 0) {
+	else if (early_strncmp(version, "FirmWorks,3.", 12) == 0) {
 		of_workarounds = OF_WA_CLAIM | OF_WA_LONGTRAIL;
 		call_prom("interpret", 1, 1, "dev /memory 0 to allow-reclaim");
 	} else
@@ -2249,7 +2150,7 @@ static void __init prom_init_stdout(void)
 	call_prom("instance-to-path", 3, 1, prom.stdout, path, 255);
 	prom_printf("OF stdout device is: %s\n", of_stdout_device);
 	prom_setprop(prom.chosen, "/chosen", "linux,stdout-path",
-		     path, prom_strlen(path) + 1);
+		     path, early_strlen(path) + 1);
 
 	/* instance-to-package fails on PA-Semi */
 	stdout_node = call_prom("instance-to-package", 1, 1, prom.stdout);
@@ -2259,7 +2160,7 @@ static void __init prom_init_stdout(void)
 		/* If it's a display, note it */
 		memset(type, 0, sizeof(type));
 		prom_getprop(stdout_node, "device_type", type, sizeof(type));
-		if (prom_strcmp(type, "display") == 0)
+		if (early_strcmp(type, "display") == 0)
 			prom_setprop(stdout_node, path, "linux,boot-display", NULL, 0);
 	}
 }
@@ -2280,19 +2181,19 @@ static int __init prom_find_machine_type(void)
 		compat[len] = 0;
 		while (i < len) {
 			char *p = &compat[i];
-			int sl = prom_strlen(p);
+			int sl = early_strlen(p);
 			if (sl == 0)
 				break;
-			if (prom_strstr(p, "Power Macintosh") ||
-			    prom_strstr(p, "MacRISC"))
+			if (early_strstr(p, "Power Macintosh") ||
+			    early_strstr(p, "MacRISC"))
 				return PLATFORM_POWERMAC;
 #ifdef CONFIG_PPC64
 			/* We must make sure we don't detect the IBM Cell
 			 * blades as pSeries due to some firmware issues,
 			 * so we do it here.
 			 */
-			if (prom_strstr(p, "IBM,CBEA") ||
-			    prom_strstr(p, "IBM,CPBW-1.0"))
+			if (early_strstr(p, "IBM,CBEA") ||
+			    early_strstr(p, "IBM,CPBW-1.0"))
 				return PLATFORM_GENERIC;
 #endif /* CONFIG_PPC64 */
 			i += sl + 1;
@@ -2309,7 +2210,7 @@ static int __init prom_find_machine_type(void)
 			   compat, sizeof(compat)-1);
 	if (len <= 0)
 		return PLATFORM_GENERIC;
-	if (prom_strcmp(compat, "chrp"))
+	if (early_strcmp(compat, "chrp"))
 		return PLATFORM_GENERIC;
 
 	/* Default to pSeries. We need to know if we are running LPAR */
@@ -2371,7 +2272,7 @@ static void __init prom_check_displays(void)
 	for (node = 0; prom_next_node(&node); ) {
 		memset(type, 0, sizeof(type));
 		prom_getprop(node, "device_type", type, sizeof(type));
-		if (prom_strcmp(type, "display") != 0)
+		if (early_strcmp(type, "display") != 0)
 			continue;
 
 		/* It seems OF doesn't null-terminate the path :-( */
@@ -2485,9 +2386,9 @@ static unsigned long __init dt_find_string(char *str)
 	s = os = (char *)dt_string_start;
 	s += 4;
 	while (s <  (char *)dt_string_end) {
-		if (prom_strcmp(s, str) == 0)
+		if (early_strcmp(s, str) == 0)
 			return s - os;
-		s += prom_strlen(s) + 1;
+		s += early_strlen(s) + 1;
 	}
 	return 0;
 }
@@ -2520,7 +2421,7 @@ static void __init scan_dt_build_strings(phandle node,
 		}
 
  		/* skip "name" */
-		if (prom_strcmp(namep, "name") == 0) {
+		if (early_strcmp(namep, "name") == 0) {
  			*mem_start = (unsigned long)namep;
  			prev_name = "name";
  			continue;
@@ -2532,7 +2433,7 @@ static void __init scan_dt_build_strings(phandle node,
 			namep = sstart + soff;
 		} else {
 			/* Trim off some if we can */
-			*mem_start = (unsigned long)namep + prom_strlen(namep) + 1;
+			*mem_start = (unsigned long)namep + early_strlen(namep) + 1;
 			dt_string_end = *mem_start;
 		}
 		prev_name = namep;
@@ -2601,7 +2502,7 @@ static void __init scan_dt_build_struct(phandle node, unsigned long *mem_start,
 			break;
 
  		/* skip "name" */
-		if (prom_strcmp(pname, "name") == 0) {
+		if (early_strcmp(pname, "name") == 0) {
  			prev_name = "name";
  			continue;
  		}
@@ -2632,7 +2533,7 @@ static void __init scan_dt_build_struct(phandle node, unsigned long *mem_start,
 		call_prom("getprop", 4, 1, node, pname, valp, l);
 		*mem_start = ALIGN(*mem_start, 4);
 
-		if (!prom_strcmp(pname, "phandle"))
+		if (!early_strcmp(pname, "phandle"))
 			has_phandle = 1;
 	}
 
@@ -2702,8 +2603,8 @@ static void __init flatten_device_tree(void)
 
 	/* Add "phandle" in there, we'll need it */
 	namep = make_room(&mem_start, &mem_end, 16, 1);
-	prom_strcpy(namep, "phandle");
-	mem_start = (unsigned long)namep + prom_strlen(namep) + 1;
+	early_strcpy(namep, "phandle");
+	mem_start = (unsigned long)namep + early_strlen(namep) + 1;
 
 	/* Build string array */
 	prom_printf("Building dt strings...\n"); 
@@ -3025,7 +2926,7 @@ static void __init fixup_device_tree_efika(void)
 	rv = prom_getprop(node, "model", prop, sizeof(prop));
 	if (rv == PROM_ERROR)
 		return;
-	if (prom_strcmp(prop, "EFIKA5K2"))
+	if (early_strcmp(prop, "EFIKA5K2"))
 		return;
 
 	prom_printf("Applying EFIKA device tree fixups\n");
@@ -3033,13 +2934,13 @@ static void __init fixup_device_tree_efika(void)
 	/* Claiming to be 'chrp' is death */
 	node = call_prom("finddevice", 1, 1, ADDR("/"));
 	rv = prom_getprop(node, "device_type", prop, sizeof(prop));
-	if (rv != PROM_ERROR && (prom_strcmp(prop, "chrp") == 0))
+	if (rv != PROM_ERROR && (early_strcmp(prop, "chrp") == 0))
 		prom_setprop(node, "/", "device_type", "efika", sizeof("efika"));
 
 	/* CODEGEN,description is exposed in /proc/cpuinfo so
 	   fix that too */
 	rv = prom_getprop(node, "CODEGEN,description", prop, sizeof(prop));
-	if (rv != PROM_ERROR && (prom_strstr(prop, "CHRP")))
+	if (rv != PROM_ERROR && (early_strstr(prop, "CHRP")))
 		prom_setprop(node, "/", "CODEGEN,description",
 			     "Efika 5200B PowerPC System",
 			     sizeof("Efika 5200B PowerPC System"));
diff --git a/arch/powerpc/kernel/prom_init_check.sh b/arch/powerpc/kernel/prom_init_check.sh
index b183ab9c5107..bbdeba750d52 100644
--- a/arch/powerpc/kernel/prom_init_check.sh
+++ b/arch/powerpc/kernel/prom_init_check.sh
@@ -27,7 +27,14 @@ __secondary_hold_acknowledge __secondary_hold_spinloop __start
 logo_linux_clut224 btext_prepare_BAT
 reloc_got2 kernstart_addr memstart_addr linux_banner _stext
 __prom_init_toc_start __prom_init_toc_end btext_setup_display TOC.
-relocate"
+relocate
+early_strcmp
+early_strcpy
+early_strlcat
+early_strlen
+early_strncmp
+early_strstr
+"
 
 NM="$1"
 OBJ="$2"
-- 
2.25.1


^ permalink raw reply related

* [PATCH 3/3] x86: switch amd mem encrypt to early string functions
From: Daniel Walker @ 2021-04-30  4:22 UTC (permalink / raw)
  To: linuxppc-dev, x86, Andrew Morton, Dave Hansen, Andy Lutomirski,
	Peter Zijlstra
  Cc: xe-linux-external, linux-kernel, Ingo Molnar, Borislav Petkov,
	H. Peter Anvin, Thomas Gleixner
In-Reply-To: <20210430042217.1198052-1-danielwa@cisco.com>

This switched x86 early string users to use the early string variants
and re-enabled KASAN on general string functions use thru out the rest
of the system.

Cc: xe-linux-external@cisco.com
Signed-off-by: Daniel Walker <danielwa@cisco.com>
---
 arch/x86/mm/mem_encrypt_identity.c | 4 ++--
 lib/Makefile                       | 7 -------
 2 files changed, 2 insertions(+), 9 deletions(-)

diff --git a/arch/x86/mm/mem_encrypt_identity.c b/arch/x86/mm/mem_encrypt_identity.c
index 6c5eb6f3f14f..212fe90cf5e2 100644
--- a/arch/x86/mm/mem_encrypt_identity.c
+++ b/arch/x86/mm/mem_encrypt_identity.c
@@ -575,9 +575,9 @@ void __init sme_enable(struct boot_params *bp)
 
 	cmdline_find_option(cmdline_ptr, cmdline_arg, buffer, sizeof(buffer));
 
-	if (!strncmp(buffer, cmdline_on, sizeof(buffer)))
+	if (!early_strncmp(buffer, cmdline_on, sizeof(buffer)))
 		sme_me_mask = me_mask;
-	else if (!strncmp(buffer, cmdline_off, sizeof(buffer)))
+	else if (!early_strncmp(buffer, cmdline_off, sizeof(buffer)))
 		sme_me_mask = 0;
 	else
 		sme_me_mask = active_by_default ? me_mask : 0;
diff --git a/lib/Makefile b/lib/Makefile
index 25cc664f027e..314db12c0e98 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -28,13 +28,6 @@ KASAN_SANITIZE_early_string.nosan.o := n
 
 CFLAGS_early_string.nosan.o += -fno-stack-protector
 
-# Early boot use of cmdline, don't instrument it
-ifdef CONFIG_AMD_MEM_ENCRYPT
-KASAN_SANITIZE_string.o := n
-
-CFLAGS_string.o += -fno-stack-protector
-endif
-
 $(obj)/early_string.nosan.o: $(src)/early_string.c $(recordmcount_source) $(objtool_dep) FORCE
 	$(call if_changed_rule,cc_o_c)
 	$(call cmd,force_checksrc)
-- 
2.25.1


^ permalink raw reply related

* [PATCH 1/3] lib: early_string: allow early usage of some string functions
From: Daniel Walker @ 2021-04-30  4:22 UTC (permalink / raw)
  To: linuxppc-dev, x86, Andrew Morton; +Cc: linux-kernel, xe-linux-external

This systems allows some string functions to be moved into
lib/early_string.c and they will be prepended with "early_" and compiled
without debugging like KASAN.

This is already done on x86 for,
"AMD Secure Memory Encryption (SME) support"

and on powerpc prom_init.c , and EFI's libstub.

The AMD memory feature disabled KASAN for all string functions, and
prom_init.c and efi libstub implement their own versions of the
functions.

This implementation allows sharing of the string functions without
removing the debugging features for the whole system.

Cc: xe-linux-external@cisco.com
Signed-off-by: Daniel Walker <danielwa@cisco.com>
---
 include/linux/string.h |   6 ++
 lib/Makefile           |  23 +++++-
 lib/early_string.c     | 172 +++++++++++++++++++++++++++++++++++++++++
 lib/string.c           | 154 ------------------------------------
 4 files changed, 200 insertions(+), 155 deletions(-)
 create mode 100644 lib/early_string.c

diff --git a/include/linux/string.h b/include/linux/string.h
index 9521d8cab18e..c0d45b92ba9e 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -20,6 +20,7 @@ extern void *memdup_user_nul(const void __user *, size_t);
  */
 #include <asm/string.h>
 
+extern char * early_strcpy(char *,const char *);
 #ifndef __HAVE_ARCH_STRCPY
 extern char * strcpy(char *,const char *);
 #endif
@@ -42,12 +43,15 @@ extern char * strcat(char *, const char *);
 #ifndef __HAVE_ARCH_STRNCAT
 extern char * strncat(char *, const char *, __kernel_size_t);
 #endif
+extern size_t early_strlcat(char *, const char *, __kernel_size_t);
 #ifndef __HAVE_ARCH_STRLCAT
 extern size_t strlcat(char *, const char *, __kernel_size_t);
 #endif
+extern int early_strcmp(const char *,const char *);
 #ifndef __HAVE_ARCH_STRCMP
 extern int strcmp(const char *,const char *);
 #endif
+extern int early_strncmp(const char *,const char *,__kernel_size_t);
 #ifndef __HAVE_ARCH_STRNCMP
 extern int strncmp(const char *,const char *,__kernel_size_t);
 #endif
@@ -79,12 +83,14 @@ static inline __must_check char *strstrip(char *str)
 	return strim(str);
 }
 
+extern char * early_strstr(const char *, const char *);
 #ifndef __HAVE_ARCH_STRSTR
 extern char * strstr(const char *, const char *);
 #endif
 #ifndef __HAVE_ARCH_STRNSTR
 extern char * strnstr(const char *, const char *, size_t);
 #endif
+extern __kernel_size_t early_strlen(const char *);
 #ifndef __HAVE_ARCH_STRLEN
 extern __kernel_size_t strlen(const char *);
 #endif
diff --git a/lib/Makefile b/lib/Makefile
index b5307d3eec1a..25cc664f027e 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -9,6 +9,8 @@ ccflags-remove-$(CONFIG_FUNCTION_TRACER) += $(CC_FLAGS_FTRACE)
 # flaky coverage that is not a function of syscall inputs. For example,
 # rbtree can be global and individual rotations don't correlate with inputs.
 KCOV_INSTRUMENT_string.o := n
+KCOV_INSTRUMENT_early_string.o := n
+KCOV_INSTRUMENT_early_string.nosan.o := n
 KCOV_INSTRUMENT_rbtree.o := n
 KCOV_INSTRUMENT_list_debug.o := n
 KCOV_INSTRUMENT_debugobjects.o := n
@@ -19,6 +21,12 @@ KCOV_INSTRUMENT_fault-inject.o := n
 # Use -ffreestanding to ensure that the compiler does not try to "optimize"
 # them into calls to themselves.
 CFLAGS_string.o := -ffreestanding
+CFLAGS_early_string.o := -ffreestanding
+CFLAGS_early_string.nosan.o := -ffreestanding -D__EARLY_STRING_ENABLED
+
+KASAN_SANITIZE_early_string.nosan.o := n
+
+CFLAGS_early_string.nosan.o += -fno-stack-protector
 
 # Early boot use of cmdline, don't instrument it
 ifdef CONFIG_AMD_MEM_ENCRYPT
@@ -27,7 +35,20 @@ KASAN_SANITIZE_string.o := n
 CFLAGS_string.o += -fno-stack-protector
 endif
 
-lib-y := ctype.o string.o vsprintf.o cmdline.o \
+$(obj)/early_string.nosan.o: $(src)/early_string.c $(recordmcount_source) $(objtool_dep) FORCE
+	$(call if_changed_rule,cc_o_c)
+	$(call cmd,force_checksrc)
+	$(Q)$(OBJCOPY) \
+		--rename-section .text=.init.text \
+		--redefine-sym strcmp=early_strcmp \
+		--redefine-sym strncmp=early_strncmp \
+		--redefine-sym strcpy=early_strcpy \
+		--redefine-sym strlcat=early_strlcat \
+		--redefine-sym strlen=early_strlen \
+		--redefine-sym strstr=early_strstr \
+		--redefine-sym memcmp=early_memcmp $@
+
+lib-y := ctype.o string.o early_string.o early_string.nosan.o vsprintf.o cmdline.o \
 	 rbtree.o radix-tree.o timerqueue.o xarray.o \
 	 idr.o extable.o sha1.o irq_regs.o argv_split.o \
 	 flex_proportions.o ratelimit.o show_mem.o \
diff --git a/lib/early_string.c b/lib/early_string.c
new file mode 100644
index 000000000000..21004e82159c
--- /dev/null
+++ b/lib/early_string.c
@@ -0,0 +1,172 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ *  linux/lib/string.c
+ *
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ */
+
+#include <linux/types.h>
+#include <linux/export.h>
+#include <linux/bug.h>
+
+#ifdef __EARLY_STRING_ENABLED
+#undef EXPORT_SYMBOL
+#define EXPORT_SYMBOL(x)
+#endif
+
+#include <linux/string.h>
+
+#if !defined(__HAVE_ARCH_MEMCMP) || defined(__EARLY_STRING_ENABLED)
+/**
+ * memcmp - Compare two areas of memory
+ * @cs: One area of memory
+ * @ct: Another area of memory
+ * @count: The size of the area.
+ */
+#undef memcmp
+__visible int memcmp(const void *cs, const void *ct, size_t count)
+{
+	const unsigned char *su1, *su2;
+	int res = 0;
+
+	for (su1 = cs, su2 = ct; 0 < count; ++su1, ++su2, count--)
+		if ((res = *su1 - *su2) != 0)
+			break;
+	return res;
+}
+EXPORT_SYMBOL(memcmp);
+#endif
+
+#if !defined(HAVE_ARCH_STRCMP) || defined(__EARLY_STRING_ENABLED)
+/**
+ * strcmp - Compare two strings
+ * @cs: One string
+ * @ct: Another string
+ */
+int strcmp(const char *cs, const char *ct)
+{
+	unsigned char c1, c2;
+
+	while (1) {
+		c1 = *cs++;
+		c2 = *ct++;
+		if (c1 != c2)
+			return c1 < c2 ? -1 : 1;
+		if (!c1)
+			break;
+	}
+	return 0;
+}
+EXPORT_SYMBOL(strcmp);
+#endif
+
+#if !defined(__HAVE_ARCH_STRCPY) || defined(__EARLY_STRING_ENABLED)
+/**
+ * strcpy - Copy a %NUL terminated string
+ * @dest: Where to copy the string to
+ * @src: Where to copy the string from
+ */
+char *strcpy(char *dest, const char *src)
+{
+	char *tmp = dest;
+
+	while ((*dest++ = *src++) != '\0')
+		/* nothing */;
+	return tmp;
+}
+EXPORT_SYMBOL(strcpy);
+#endif
+
+#if !defined(__HAVE_ARCH_STRLCAT) || defined(__EARLY_STRING_ENABLED)
+/**
+ * strlcat - Append a length-limited, C-string to another
+ * @dest: The string to be appended to
+ * @src: The string to append to it
+ * @count: The size of the destination buffer.
+ */
+size_t strlcat(char *dest, const char *src, size_t count)
+{
+	size_t dsize = strlen(dest);
+	size_t len = strlen(src);
+	size_t res = dsize + len;
+
+	/* This would be a bug */
+	BUG_ON(dsize >= count);
+
+	dest += dsize;
+	count -= dsize;
+	if (len >= count)
+		len = count-1;
+	memcpy(dest, src, len);
+	dest[len] = 0;
+	return res;
+}
+EXPORT_SYMBOL(strlcat);
+#endif
+
+#if !defined(__HAVE_ARCH_STRLEN) || defined(__EARLY_STRING_ENABLED)
+/**
+ * strlen - Find the length of a string
+ * @s: The string to be sized
+ */
+size_t strlen(const char *s)
+{
+	const char *sc;
+
+	for (sc = s; *sc != '\0'; ++sc)
+		/* nothing */;
+	return sc - s;
+}
+EXPORT_SYMBOL(strlen);
+#endif
+
+#if !defined(__HAVE_ARCH_STRNCMP) || defined(__EARLY_STRING_ENABLED)
+/**
+ * strncmp - Compare two length-limited strings
+ * @cs: One string
+ * @ct: Another string
+ * @count: The maximum number of bytes to compare
+ */
+int strncmp(const char *cs, const char *ct, size_t count)
+{
+	unsigned char c1, c2;
+
+	while (count) {
+		c1 = *cs++;
+		c2 = *ct++;
+		if (c1 != c2)
+			return c1 < c2 ? -1 : 1;
+		if (!c1)
+			break;
+		count--;
+	}
+	return 0;
+}
+EXPORT_SYMBOL(strncmp);
+#endif
+
+#if !defined(__HAVE_ARCH_STRSTR) || defined(__EARLY_STRING_ENABLED)
+/**
+ * strstr - Find the first substring in a %NUL terminated string
+ * @s1: The string to be searched
+ * @s2: The string to search for
+ */
+char *strstr(const char *s1, const char *s2)
+{
+	size_t l1, l2;
+
+	l2 = strlen(s2);
+	if (!l2)
+		return (char *)s1;
+	l1 = strlen(s1);
+	while (l1 >= l2) {
+		l1--;
+		if (!memcmp(s1, s2, l2))
+			return (char *)s1;
+		s1++;
+	}
+	return NULL;
+}
+EXPORT_SYMBOL(strstr);
+#endif
+
diff --git a/lib/string.c b/lib/string.c
index 7548eb715ddb..328649ccb34d 100644
--- a/lib/string.c
+++ b/lib/string.c
@@ -79,23 +79,6 @@ int strcasecmp(const char *s1, const char *s2)
 EXPORT_SYMBOL(strcasecmp);
 #endif
 
-#ifndef __HAVE_ARCH_STRCPY
-/**
- * strcpy - Copy a %NUL terminated string
- * @dest: Where to copy the string to
- * @src: Where to copy the string from
- */
-char *strcpy(char *dest, const char *src)
-{
-	char *tmp = dest;
-
-	while ((*dest++ = *src++) != '\0')
-		/* nothing */;
-	return tmp;
-}
-EXPORT_SYMBOL(strcpy);
-#endif
-
 #ifndef __HAVE_ARCH_STRNCPY
 /**
  * strncpy - Copy a length-limited, C-string
@@ -343,81 +326,6 @@ char *strncat(char *dest, const char *src, size_t count)
 EXPORT_SYMBOL(strncat);
 #endif
 
-#ifndef __HAVE_ARCH_STRLCAT
-/**
- * strlcat - Append a length-limited, C-string to another
- * @dest: The string to be appended to
- * @src: The string to append to it
- * @count: The size of the destination buffer.
- */
-size_t strlcat(char *dest, const char *src, size_t count)
-{
-	size_t dsize = strlen(dest);
-	size_t len = strlen(src);
-	size_t res = dsize + len;
-
-	/* This would be a bug */
-	BUG_ON(dsize >= count);
-
-	dest += dsize;
-	count -= dsize;
-	if (len >= count)
-		len = count-1;
-	memcpy(dest, src, len);
-	dest[len] = 0;
-	return res;
-}
-EXPORT_SYMBOL(strlcat);
-#endif
-
-#ifndef __HAVE_ARCH_STRCMP
-/**
- * strcmp - Compare two strings
- * @cs: One string
- * @ct: Another string
- */
-int strcmp(const char *cs, const char *ct)
-{
-	unsigned char c1, c2;
-
-	while (1) {
-		c1 = *cs++;
-		c2 = *ct++;
-		if (c1 != c2)
-			return c1 < c2 ? -1 : 1;
-		if (!c1)
-			break;
-	}
-	return 0;
-}
-EXPORT_SYMBOL(strcmp);
-#endif
-
-#ifndef __HAVE_ARCH_STRNCMP
-/**
- * strncmp - Compare two length-limited strings
- * @cs: One string
- * @ct: Another string
- * @count: The maximum number of bytes to compare
- */
-int strncmp(const char *cs, const char *ct, size_t count)
-{
-	unsigned char c1, c2;
-
-	while (count) {
-		c1 = *cs++;
-		c2 = *ct++;
-		if (c1 != c2)
-			return c1 < c2 ? -1 : 1;
-		if (!c1)
-			break;
-		count--;
-	}
-	return 0;
-}
-EXPORT_SYMBOL(strncmp);
-#endif
-
 #ifndef __HAVE_ARCH_STRCHR
 /**
  * strchr - Find the first occurrence of a character in a string
@@ -553,22 +461,6 @@ char *strim(char *s)
 }
 EXPORT_SYMBOL(strim);
 
-#ifndef __HAVE_ARCH_STRLEN
-/**
- * strlen - Find the length of a string
- * @s: The string to be sized
- */
-size_t strlen(const char *s)
-{
-	const char *sc;
-
-	for (sc = s; *sc != '\0'; ++sc)
-		/* nothing */;
-	return sc - s;
-}
-EXPORT_SYMBOL(strlen);
-#endif
-
 #ifndef __HAVE_ARCH_STRNLEN
 /**
  * strnlen - Find the length of a length-limited string
@@ -922,27 +814,6 @@ void *memmove(void *dest, const void *src, size_t count)
 EXPORT_SYMBOL(memmove);
 #endif
 
-#ifndef __HAVE_ARCH_MEMCMP
-/**
- * memcmp - Compare two areas of memory
- * @cs: One area of memory
- * @ct: Another area of memory
- * @count: The size of the area.
- */
-#undef memcmp
-__visible int memcmp(const void *cs, const void *ct, size_t count)
-{
-	const unsigned char *su1, *su2;
-	int res = 0;
-
-	for (su1 = cs, su2 = ct; 0 < count; ++su1, ++su2, count--)
-		if ((res = *su1 - *su2) != 0)
-			break;
-	return res;
-}
-EXPORT_SYMBOL(memcmp);
-#endif
-
 #ifndef __HAVE_ARCH_BCMP
 /**
  * bcmp - returns 0 if and only if the buffers have identical contents.
@@ -987,31 +858,6 @@ void *memscan(void *addr, int c, size_t size)
 EXPORT_SYMBOL(memscan);
 #endif
 
-#ifndef __HAVE_ARCH_STRSTR
-/**
- * strstr - Find the first substring in a %NUL terminated string
- * @s1: The string to be searched
- * @s2: The string to search for
- */
-char *strstr(const char *s1, const char *s2)
-{
-	size_t l1, l2;
-
-	l2 = strlen(s2);
-	if (!l2)
-		return (char *)s1;
-	l1 = strlen(s1);
-	while (l1 >= l2) {
-		l1--;
-		if (!memcmp(s1, s2, l2))
-			return (char *)s1;
-		s1++;
-	}
-	return NULL;
-}
-EXPORT_SYMBOL(strstr);
-#endif
-
 #ifndef __HAVE_ARCH_STRNSTR
 /**
  * strnstr - Find the first substring in a length-limited string
-- 
2.25.1


^ permalink raw reply related

* Re: [PATCH v2] kbuild: replace LANG=C with LC_ALL=C
From: Greg KH @ 2021-04-30  6:02 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: linuxppc-dev, linux-kbuild, Mat Martineau, Matthias Maennich,
	linux-kernel, mptcp, Jakub Kicinski, netdev, Paul Mackerras,
	linux-kselftest, Matthieu Baerts, Shuah Khan, David S. Miller
In-Reply-To: <20210430015627.65738-1-masahiroy@kernel.org>

On Fri, Apr 30, 2021 at 10:56:27AM +0900, Masahiro Yamada wrote:
> LANG gives a weak default to each LC_* in case it is not explicitly
> defined. LC_ALL, if set, overrides all other LC_* variables.
> 
>   LANG  <  LC_CTYPE, LC_COLLATE, LC_MONETARY, LC_NUMERIC, ...  <  LC_ALL
> 
> This is why documentation such as [1] suggests to set LC_ALL in build
> scripts to get the deterministic result.
> 
> LANG=C is not strong enough to override LC_* that may be set by end
> users.
> 
> [1]: https://reproducible-builds.org/docs/locales/
> 
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> Acked-by: Michael Ellerman <mpe@ellerman.id.au> (powerpc)
> Reviewed-by: Matthias Maennich <maennich@google.com>
> Acked-by: Matthieu Baerts <matthieu.baerts@tessares.net> (mptcp)

Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>


^ permalink raw reply

* [PATCH] powerpc/powernv/memtrace: Fix dcache flushing
From: Sandipan Das @ 2021-04-30  7:55 UTC (permalink / raw)
  To: mpe; +Cc: aneesh.kumar, rashmica.g, david, linuxppc-dev, jniethe5

Trace memory is cleared and the corresponding dcache lines
are flushed after allocation. However, this should not be
done using the PFN. This adds the missing __va() conversion.

Fixes: 2ac02e5ecec0 ("powerpc/mm: Remove dcache flush from memory remove.")
Signed-off-by: Sandipan Das <sandipan@linux.ibm.com>
---
 arch/powerpc/platforms/powernv/memtrace.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/platforms/powernv/memtrace.c b/arch/powerpc/platforms/powernv/memtrace.c
index 71c1262589fe..a31f13814f2e 100644
--- a/arch/powerpc/platforms/powernv/memtrace.c
+++ b/arch/powerpc/platforms/powernv/memtrace.c
@@ -104,8 +104,8 @@ static void memtrace_clear_range(unsigned long start_pfn,
 	 * Before we go ahead and use this range as cache inhibited range
 	 * flush the cache.
 	 */
-	flush_dcache_range_chunked(PFN_PHYS(start_pfn),
-				   PFN_PHYS(start_pfn + nr_pages),
+	flush_dcache_range_chunked((unsigned long)__va(PFN_PHYS(start_pfn)),
+				   (unsigned long)__va(PFN_PHYS(start_pfn + nr_pages)),
 				   FLUSH_CHUNK_SIZE);
 }
 
-- 
2.25.1


^ permalink raw reply related

* Re: [PATCH] powerpc/powernv/memtrace: Fix dcache flushing
From: Aneesh Kumar K.V @ 2021-04-30  8:03 UTC (permalink / raw)
  To: Sandipan Das, mpe; +Cc: jniethe5, rashmica.g, linuxppc-dev, david
In-Reply-To: <20210430075557.893819-1-sandipan@linux.ibm.com>

Sandipan Das <sandipan@linux.ibm.com> writes:

> Trace memory is cleared and the corresponding dcache lines
> are flushed after allocation. However, this should not be
> done using the PFN. This adds the missing __va() conversion.

Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com>

>
> Fixes: 2ac02e5ecec0 ("powerpc/mm: Remove dcache flush from memory remove.")
> Signed-off-by: Sandipan Das <sandipan@linux.ibm.com>
> ---
>  arch/powerpc/platforms/powernv/memtrace.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/powerpc/platforms/powernv/memtrace.c b/arch/powerpc/platforms/powernv/memtrace.c
> index 71c1262589fe..a31f13814f2e 100644
> --- a/arch/powerpc/platforms/powernv/memtrace.c
> +++ b/arch/powerpc/platforms/powernv/memtrace.c
> @@ -104,8 +104,8 @@ static void memtrace_clear_range(unsigned long start_pfn,
>  	 * Before we go ahead and use this range as cache inhibited range
>  	 * flush the cache.
>  	 */
> -	flush_dcache_range_chunked(PFN_PHYS(start_pfn),
> -				   PFN_PHYS(start_pfn + nr_pages),
> +	flush_dcache_range_chunked((unsigned long)__va(PFN_PHYS(start_pfn)),
> +				   (unsigned long)__va(PFN_PHYS(start_pfn + nr_pages)),
>  				   FLUSH_CHUNK_SIZE);
>  }
>  
> -- 
> 2.25.1

^ permalink raw reply

* [PATCH 06/31] powerpc/xive: Drop unmask of MSIs at startup
From: Cédric Le Goater @ 2021-04-30  8:03 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Cédric Le Goater
In-Reply-To: <20210430080407.4030767-1-clg@kaod.org>

That was a workaround in the XIVE domain because of the lack of MSI
domain. This is now handled.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
 arch/powerpc/sysdev/xive/common.c | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/arch/powerpc/sysdev/xive/common.c b/arch/powerpc/sysdev/xive/common.c
index 9cb7ae728b46..96737938e8e3 100644
--- a/arch/powerpc/sysdev/xive/common.c
+++ b/arch/powerpc/sysdev/xive/common.c
@@ -616,16 +616,6 @@ static unsigned int xive_irq_startup(struct irq_data *d)
 	pr_devel("xive_irq_startup: irq %d [0x%x] data @%p\n",
 		 d->irq, hw_irq, d);
 
-#ifdef CONFIG_PCI_MSI
-	/*
-	 * The generic MSI code returns with the interrupt disabled on the
-	 * card, using the MSI mask bits. Firmware doesn't appear to unmask
-	 * at that level, so we do it here by hand.
-	 */
-	if (irq_data_get_msi_desc(d))
-		pci_msi_unmask_irq(d);
-#endif
-
 	/* Pick a target */
 	target = xive_pick_irq_target(d, irq_data_get_affinity_mask(d));
 	if (target == XIVE_INVALID_TARGET) {
-- 
2.26.3


^ 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