LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH 2/2] ASoC: dt-bindings: imx-akcodec: Add binding doc for akcodec machine driver
From: Shengjiu Wang @ 2021-05-08 11:14 UTC (permalink / raw)
  To: Rob Herring
  Cc: open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
	alsa-devel, Fabio Estevam, linux-kernel, Timur Tabi, Xiubo Li,
	linuxppc-dev, Shengjiu Wang, Takashi Iwai, Liam Girdwood,
	Nicolin Chen, Mark Brown, NXP Linux Team, Sascha Hauer, Shawn Guo,
	Sascha Hauer,
	moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE
In-Reply-To: <20210503170030.GA1987906@robh.at.kernel.org>

Hi

On Tue, May 4, 2021 at 1:01 AM Rob Herring <robh@kernel.org> wrote:
>
> On Fri, Apr 23, 2021 at 01:51:47PM +0800, Shengjiu Wang wrote:
> > Imx-akcodec is a new added machine driver for supporting
> > ak4458/ak5558/ak5552/ak4497 codec on i.MX platforms.
> >
> > Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
> > ---
> >  .../bindings/sound/imx-audio-akcodec.yaml     | 60 +++++++++++++++++++
> >  1 file changed, 60 insertions(+)
> >  create mode 100644 Documentation/devicetree/bindings/sound/imx-audio-akcodec.yaml
> >
> > diff --git a/Documentation/devicetree/bindings/sound/imx-audio-akcodec.yaml b/Documentation/devicetree/bindings/sound/imx-audio-akcodec.yaml
> > new file mode 100644
> > index 000000000000..7419bf7224e9
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/sound/imx-audio-akcodec.yaml
> > @@ -0,0 +1,60 @@
> > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/sound/imx-audio-akcodec.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: NXP i.MX audio complex with AK4458/AK5558/AK5552/AK4497 codec
>
> Looks like the existing fsl-asoc-card.txt? You should convert to schema
> and use that. Otherwise, my comments are based on this all being 'new'.

Ok, let's treat it as 'new'

>
> > +
> > +maintainers:
> > +  - Shengjiu Wang <shengjiu.wang@nxp.com>
> > +
> > +properties:
> > +  compatible:
> > +    enum:
> > +      - fsl,imx8mq-audio-ak4458
> > +      - fsl,imx8mq-audio-ak4497
> > +      - fsl,imx8mq-audio-ak5558
> > +      - fsl,imx-audio-ak4497
> > +      - fsl,imx-audio-ak4458
> > +      - fsl,imx-audio-ak5558
> > +      - fsl,imx-audio-ak5552
>
> I continue to not understand why audio bindings need the codec(s) in the
> compatible strings. Can't you look up the codec thru the audio-codec
> property?

I will try to remove the codecs type from the compatible string and check
the codec type in driver.

>
> > +
> > +  model:
> > +    $ref: /schemas/types.yaml#/definitions/string
> > +    description: User specified audio sound card name
> > +
> > +  audio-cpu:
> > +    $ref: /schemas/types.yaml#/definitions/phandle
> > +    description: The phandle of a CPU DAI controller
> > +
> > +  audio-codec:
> > +    description: The phandle of Codec DAI controllers, there are two
> > +                 controllers maximum.
>
> We have the common 'sound-dai' property. See the simple-card.yaml
> binding.

ok, will use sound-dai.

>
> > +
> > +  audio-asrc:
> > +    $ref: /schemas/types.yaml#/definitions/phandle
> > +    description: The phandle of ASRC. It can be absent if there's no
> > +                 need to add ASRC support via DPCM.
>
> Needs a vendor prefix.

ok,  can be removed in the next version.

>
> > +
> > +  fsl,tdm:
> > +    $ref: /schemas/types.yaml#/definitions/flag
> > +    description: |
> > +      This is a boolean property. If present, the TDM mode is enabled.
>
> But this one seems like something that could or should be common.

Ok, I will use the common one in the next version.

>
> > +
> > +required:
> > +  - compatible
> > +  - model
> > +  - audio-cpu
> > +  - audio-codec
> > +
> > +additionalProperties: false
> > +
> > +examples:
> > +  - |
> > +    sound-ak4458 {
> > +        compatible = "fsl,imx-audio-ak4458";
> > +        model = "ak4458-audio";
> > +        audio-cpu = <&sai1>;
> > +        audio-codec = <&ak4458_1>, <&ak4458_2>;
> > +    };
> > --
> > 2.17.1
> >

^ permalink raw reply

* Re: Radeon NI: GIT kernel with the nislands_smc commit doesn't boot on a Freescale P5040 board and P.A.Semi Nemo board
From: Christian Zigotzky @ 2021-05-08 11:33 UTC (permalink / raw)
  To: Gustavo A. R. Silva
  Cc: Darren Stevens, R.T.Dickinson, Michel Dänzer, gustavoars,
	Maling list - DRI developers, Olof Johansson, mad skateman,
	alexander.deucher, linuxppc-dev, Christian Zigotzky
In-Reply-To: <10D1983F-33EF-46C3-976E-463D1CB5A6E9@xenosoft.de>

Hi Gustavo,

Your patch works! Thanks a lot! I tested it with my Freescale P5040 
board and P.A.Semi Nemo board with a connected AMD Radeon HD6970 NI 
graphics cards (Cayman
XT) today.

Have a nice day,
Christian


On 07 May 2021 at 08:43am, Christian Zigotzky wrote:
> Hi Gustavo,
>
> Great! I will test it. Many thanks for your help.
>
> Cheers,
> Christian
>
>
>> On 7. May 2021, at 01:55, Gustavo A. R. Silva <gustavo@embeddedor.com> wrote:
>>
>> Hi Christian,
>>
>>> On 4/30/21 06:59, Christian Zigotzky wrote:
>>> Hello,
>>>
>>> The Nemo board (A-EON AmigaOne X1000) [1] and the FSL P5040 Cyrus+ board (A-EON AmigaOne X5000) [2] with installed AMD Radeon HD6970 NI graphics cards (Cayman
>>> XT) [3] don't boot with the latest git kernel anymore after the commit "drm/radeon/nislands_smc.h: Replace one-element array with flexible-array member in
>>> struct NISLANDS_SMC_SWSTATE branch" [4].  This git kernel boots in a virtual e5500 QEMU machine with a VirtIO-GPU [5].
>>>
>>> I bisected today [6].
>>>
>>> Result: drm/radeon/nislands_smc.h: Replace one-element array with flexible-array member in struct NISLANDS_SMC_SWSTATE branch
>>> (434fb1e7444a2efc3a4ebd950c7f771ebfcffa31) [4] is the first bad commit.
>> I have a fix ready for this bug:
>> https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git/commit/?h=testing/drm-nislands
>>
>> I wonder if you could help me to test it with your environment, please.
>> It should be applied on top of mainline.
>>
>> Thank you!
>> --
>> Gustavo
>>
>>> I was able to revert this commit [7] and after a new compiling, the kernel boots without any problems on my AmigaOnes.
>>>
>>> After that I created a patch for reverting this commit for new git test kernels. [3]
>>>
>>> The kernel compiles and boots with this patch on my AmigaOnes. Please find attached the kernel config files.
>>>
>>> Please check the first bad commit.
>>>
>>> Thanks,
>>> Christian
>>>
>>> [1] https://en.wikipedia.org/wiki/AmigaOne_X1000
>>> [2] http://wiki.amiga.org/index.php?title=X5000
>>> [3] https://forum.hyperion-entertainment.com/viewtopic.php?f=35&t=4377
>>> [4] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=434fb1e7444a2efc3a4ebd950c7f771ebfcffa31
>>> [5] qemu-system-ppc64 -M ppce500 -cpu e5500 -m 1024 -kernel uImage -drive format=raw,file=MintPPC32-X5000.img,index=0,if=virtio -netdev user,id=mynet0 -device
>>> virtio-net-pci,netdev=mynet0 -append "rw root=/dev/vda" -device virtio-vga -usb -device usb-ehci,id=ehci -device usb-tablet -device virtio-keyboard-pci -smp 4
>>> -vnc :1
>>> [6] https://forum.hyperion-entertainment.com/viewtopic.php?p=53074#p53074
>>> [7] git revert 434fb1e7444a2efc3a4ebd950c7f771ebfcffa3


^ permalink raw reply

* Re: Kernel crosscompilers
From: Arnd Bergmann @ 2021-05-08 12:21 UTC (permalink / raw)
  To: Christophe Leroy; +Cc: linuxppc-dev@ozlabs.org
In-Reply-To: <b6fad6f3-6390-54a3-f0c8-30b7476c686a@csgroup.eu>

On Sat, May 8, 2021 at 12:15 PM Christophe Leroy
<christophe.leroy@csgroup.eu> wrote:
> Le 08/05/2021 à 11:43, Arnd Bergmann a écrit :
> > On Sat, May 8, 2021 at 8:46 AM Christophe Leroy
> > <christophe.leroy@csgroup.eu> wrote:
> >>
> >> Something is going wrong with asm goto output. I implemented get_user() helpers with asm goto this
> >> cycle (commit 5cd29b1fd3e8). I tested it with CLANG before submitting, it was working.
> >
> > BTW, can you point me to those patches? I think it would be nice if we
> > could eventually
> > converge parts of get_user()/put_user() implementation on something
> > that works for all
> > architectures, we do seem to rewrite these way too often. Ideally we'd
> > have something
> > in asm-generic that provides all the wrappers, and just requires an
> > architecture to
> > implement the inline asm helpers for each of the sizes.
> >
>
> The series that is merged for 5.13 is here:
> https://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=233250&state=*
>
> And of course the result is just
> https://github.com/linuxppc/linux/blob/master/arch/powerpc/include/asm/uaccess.h
> and all its history at
> https://github.com/linuxppc/linux/commits/master/arch/powerpc/include/asm/uaccess.h

Ah, I should have looked there first ;-)

> The fix from today here:
> https://patchwork.ozlabs.org/project/linuxppc-dev/patch/cf0a050d124d4f426cdc7a74009d17b01d8d8969.1620465917.git.christophe.leroy@csgroup.eu/
>
> I made a try to use asm-generic/uaccess.h a few weeks ago, but it was not conclusive. I can't
> remember the details, but I can have a new look at it next week if you are interested with the details.

I hope you didn't waste too much time on that. The current asm-generic/uaccess.h
code is not helpful anywhere and needs to be rewritten before we can have
normal architectures using it.

        Arnd

^ permalink raw reply

* [GIT PULL] Please pull powerpc/linux.git powerpc-5.13-2 tag
From: Michael Ellerman @ 2021-05-08 13:51 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: gregkh, linux-kernel, npiggin, Paolo Bonzini, sourabhjain,
	linuxppc-dev, hch, sandipan

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

Hi Linus,

Please pull powerpc updates/fixes for 5.13.

A bit of a mixture of things, tying up some loose ends.

There's the removal of the nvlink code, which dependend on a commit in the vfio tree.
Then the enablement of huge vmalloc which was in next for a few weeks but got dropped due
to conflicts. And there's also a few fixes.

This does contain a back merge of master, which I know you generally dislike, but doing
that allowed me to get the list of selects under config PPC sorted alphabetically again.

Paolo has picked up the KVM fix, but I wasn't sure he'd send it before rc1, so I picked it
up as well. As of now there's no conflict between our trees, git works it out.

cheers


The following changes since commit 17ae69aba89dbfa2139b7f8024b757ab3cc42f59:

  Merge tag 'landlock_v34' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security (2021-05-01 18:50:44 -0700

are available in the git repository at:

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

for you to fetch changes up to f96271cefe6dfd1cb04195b76f4a33e185cd7f92:

  Merge branch 'master' into next (2021-05-08 21:12:55 +1000)

- ------------------------------------------------------------------
powerpc fixes for 5.13 #2

 - Remove the nvlink support now that it's only user has been removed.

 - Enable huge vmalloc mappings for Radix MMU (P9).

 - Fix KVM conversion to gfn-based MMU notifier callbacks.

 - Fix a kexec/kdump crash with hot plugged CPUs.

 - Fix boot failure on 32-bit with CONFIG_STACKPROTECTOR.

 - Restore alphabetic order of the selects under CONFIG_PPC.

Thanks to: Christophe Leroy, Christoph Hellwig, Nicholas Piggin, Sandipan Das, Sourabh Jain.

- ------------------------------------------------------------------
Christoph Hellwig (1):
      powerpc/powernv: remove the nvlink support

Christophe Leroy (2):
      powerpc/32: Fix boot failure with CONFIG_STACKPROTECTOR
      powerpc/kconfig: Restore alphabetic order of the selects under CONFIG_PPC

Michael Ellerman (1):
      Merge branch 'master' into next

Nicholas Piggin (2):
      powerpc/64s/radix: Enable huge vmalloc mappings
      KVM: PPC: Book3S HV: Fix conversion to gfn-based MMU notifier callbacks

Sandipan Das (1):
      powerpc/powernv/memtrace: Fix dcache flushing

Sourabh Jain (1):
      powerpc/kexec_file: Use current CPU info while setting up FDT


 Documentation/admin-guide/kernel-parameters.txt |   2 +
 arch/powerpc/Kconfig                            |  37 +-
 arch/powerpc/include/asm/kvm_book3s.h           |   2 +-
 arch/powerpc/include/asm/opal.h                 |   3 -
 arch/powerpc/include/asm/pci-bridge.h           |   1 -
 arch/powerpc/include/asm/pci.h                  |   7 -
 arch/powerpc/kernel/module.c                    |  18 +-
 arch/powerpc/kexec/file_load_64.c               |  92 +++
 arch/powerpc/kvm/book3s_64_mmu_hv.c             |  46 +-
 arch/powerpc/kvm/book3s_64_mmu_radix.c          |   5 +-
 arch/powerpc/lib/Makefile                       |   3 +
 arch/powerpc/platforms/powernv/Makefile         |   2 +-
 arch/powerpc/platforms/powernv/memtrace.c       |   4 +-
 arch/powerpc/platforms/powernv/npu-dma.c        | 705 --------------------
 arch/powerpc/platforms/powernv/opal-call.c      |   2 -
 arch/powerpc/platforms/powernv/pci-ioda.c       | 185 +----
 arch/powerpc/platforms/powernv/pci.c            |  11 -
 arch/powerpc/platforms/powernv/pci.h            |  17 +-
 arch/powerpc/platforms/pseries/pci.c            |  23 -
 19 files changed, 175 insertions(+), 990 deletions(-)
 delete mode 100644 arch/powerpc/platforms/powernv/npu-dma.c
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEJFGtCPCthwEv2Y/bUevqPMjhpYAFAmCWlpMACgkQUevqPMjh
pYAgChAAtssjqrHOYHHlc2QZ5qSczf2sE/Clq/p+HlZX6b5E5NACDjd5p6jU2GIK
krVZXK4sQaikXV/KeODujbSuGHa6js5LgHVQWCuCCIrwp+Bdb/we7O0Mvj4pM7RS
bXe1AK0xeTy2rg35cIXf9CfIUM+p5e+rm8vNPaSWza8npFZKsXaoQZAInxOx0MTa
rEFJDi2YCvgQV2L5eFGlcL8EOExJbB9b8Xk3DYwu/t0CnvusW6044VRxGutnGBwY
6+QQ8bt/bYzRdgPGp8D9sZ5ivnDRZymoO138s3aSD0/786nysL+F4dRlYGzrr02M
q5aYo7PCUctZJs/DivlBm2n0ttUs7Wp6XSNpVs5j/H28RjCq52u4VOsjyXMuzrqx
KwAzJNzCfvA/BVOwJqlriaAij8sT5kcvtpZAP3tYDrcY8ZivleZ4SCibBoIChHnc
jwRsv2wUfm3KmSfwy24tRWMQBeysm/OhbJTvC1Qc5bDO5v1r2qPnj2OAyuhWjHXw
NmNfuHv1zVoOJ+OOjnnoc3EoPYANMxeSFkQWtFUvx6HUFJlBMhaldjC3YMAHV5ZI
qkLFCDHKwnfJhnvnr0b0267XxAxXj5hjU+8T6rgnVNOyDKNuV0IGpMWaD3c4BkSO
LrXiPhMSGBWdHHQ4kE1UG5TfCVOHzGGO6l4EI/APxUshqUJ3N20=
=VXJA
-----END PGP SIGNATURE-----

^ permalink raw reply

* Re: [PATCH v3] powerpc/papr_scm: Reduce error severity if nvdimm stats inaccessible
From: Ira Weiny @ 2021-05-08 15:11 UTC (permalink / raw)
  To: Vaibhav Jain
  Cc: Santosh Sivaraj, linux-nvdimm, Aneesh Kumar K . V, Dan Williams,
	linuxppc-dev
In-Reply-To: <20210508043642.114076-1-vaibhav@linux.ibm.com>

On Sat, May 08, 2021 at 10:06:42AM +0530, Vaibhav Jain wrote:
> Currently drc_pmem_qeury_stats() generates a dev_err in case
> "Enable Performance Information Collection" feature is disabled from
> HMC or performance stats are not available for an nvdimm. The error is
> of the form below:
> 
> papr_scm ibm,persistent-memory:ibm,pmemory@44104001: Failed to query
> 	 performance stats, Err:-10
> 
> This error message confuses users as it implies a possible problem
> with the nvdimm even though its due to a disabled/unavailable
> feature. We fix this by explicitly handling the H_AUTHORITY and
> H_UNSUPPORTED errors from the H_SCM_PERFORMANCE_STATS hcall.
> 
> In case of H_AUTHORITY error an info message is logged instead of an
> error, saying that "Permission denied while accessing performance
> stats" and an EPERM error is returned back.
> 
> In case of H_UNSUPPORTED error we return a EOPNOTSUPP error back from
> drc_pmem_query_stats() indicating that performance stats-query
> operation is not supported on this nvdimm.
> 
> Fixes: 2d02bf835e57('powerpc/papr_scm: Fetch nvdimm performance stats from PHYP')
> Signed-off-by: Vaibhav Jain <vaibhav@linux.ibm.com>

Reviewed-by: Ira Weiny <ira.weiny@intel.com>

> ---
> Changelog
> 
> v3:
> * Return EOPNOTSUPP error in case of H_UNSUPPORTED [ Ira ]
> * Return EPERM in case of H_AUTHORITY [ Ira ]
> * Updated patch description
> 
> v2:
> * Updated the message logged in case of H_AUTHORITY error [ Ira ]
> * Switched from dev_warn to dev_info in case of H_AUTHORITY error.
> * Instead of -EPERM return -EACCESS for H_AUTHORITY error.
> * Added explicit handling of H_UNSUPPORTED error.
> ---
>  arch/powerpc/platforms/pseries/papr_scm.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/arch/powerpc/platforms/pseries/papr_scm.c b/arch/powerpc/platforms/pseries/papr_scm.c
> index ef26fe40efb0..e2b69cc3beaf 100644
> --- a/arch/powerpc/platforms/pseries/papr_scm.c
> +++ b/arch/powerpc/platforms/pseries/papr_scm.c
> @@ -310,6 +310,13 @@ static ssize_t drc_pmem_query_stats(struct papr_scm_priv *p,
>  		dev_err(&p->pdev->dev,
>  			"Unknown performance stats, Err:0x%016lX\n", ret[0]);
>  		return -ENOENT;
> +	} else if (rc == H_AUTHORITY) {
> +		dev_info(&p->pdev->dev,
> +			 "Permission denied while accessing performance stats");
> +		return -EPERM;
> +	} else if (rc == H_UNSUPPORTED) {
> +		dev_dbg(&p->pdev->dev, "Performance stats unsupported\n");
> +		return -EOPNOTSUPP;
>  	} else if (rc != H_SUCCESS) {
>  		dev_err(&p->pdev->dev,
>  			"Failed to query performance stats, Err:%lld\n", rc);
> -- 
> 2.31.1
> 

^ permalink raw reply

* Re: [GIT PULL] Please pull powerpc/linux.git powerpc-5.13-2 tag
From: pr-tracker-bot @ 2021-05-08 16:09 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: gregkh, linux-kernel, Linus Torvalds, npiggin, Paolo Bonzini,
	sourabhjain, linuxppc-dev, hch, sandipan
In-Reply-To: <87y2cpxrir.fsf@mpe.ellerman.id.au>

The pull request you sent on Sat, 08 May 2021 23:51:40 +1000:

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

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/ab159ac569fddf812c0a217d6dbffaa5d93ef88f

Thank you!

-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html

^ permalink raw reply

* Re: [FSL P50x0] Xorg always restarts again and again after the the PowerPC updates 5.13-1
From: Christian Zigotzky @ 2021-05-08 16:39 UTC (permalink / raw)
  To: Christophe Leroy
  Cc: Darren Stevens, R.T.Dickinson, mad skateman, linuxppc-dev,
	Christian Zigotzky
In-Reply-To: <0A8D70F6-CBD4-44FD-9DB1-69097AEB5FA3@xenosoft.de>

On 06 May 2021 at 03:58 pm, Christian Zigotzky wrote:
> I have started bisecting again.
>
> Link: 
> https://forum.hyperion-entertainment.com/viewtopic.php?p=53106#p53106 
> <https://forum.hyperion-entertainment.com/viewtopic.php?p=53106#p53106>
>
>
>> On 6. May 2021, at 10:09, Christophe Leroy 
>> <christophe.leroy@csgroup.eu> wrote:
>>
>>
>> - Can you check that 887f3ceb51cd with cherry-picked 525642624783 has 
>> Xorg working ?
git checkout 887f3ceb51cd
git cherry-pick 525642624783

Result: Xorg works.
>> - Can you bisect between 887f3ceb51cd[good] and 56bec2f9d4d0[bad] to 
>> identify first bad commit that stops after loading the dtb and uImage ?
>> - Once that first bad commit is identified, can you check whether the 
>> preceeding commit with cherry-picked 525642624783 has Xorg working or 
>> not ?
>>
>> Thanks
>> Christophe
git bisect start
git bisect good 887f3ceb51cd
git bisect bad 56bec2f9d4d0
git bisect good -- Xorg restarts again and again but we are looking for 
the first bad commit that stops the boot after loading the dtb and uImage.
git bisect good -- Xorg restarts again and again.
git bisect good -- Xorg restarts again and again.
git bisect good -- Xorg restarts again and again.

Result:

56bec2f9d4d05675cada96772a8a93010f4d82bf is the first bad commit
commit 56bec2f9d4d05675cada96772a8a93010f4d82bf
Author: Michael Ellerman <mpe@ellerman.id.au>
Date:   Wed Mar 31 11:38:40 2021 +1100

     powerpc/mm/64s: Add _PAGE_KERNEL_ROX

     In the past we had a fallback definition for _PAGE_KERNEL_ROX, but we
     removed that in commit d82fd29c5a8c ("powerpc/mm: Distribute platform
     specific PAGE and PMD flags and definitions") and added definitions
     for each MMU family.

     However we missed adding a definition for 64s, which was not really a
     bug because it's currently not used.

     But we'd like to use PAGE_KERNEL_ROX in a future patch so add a
     definition now.

     Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
     Link: 
https://lore.kernel.org/r/20210331003845.216246-1-mpe@ellerman.id.au

:040000 040000 ff8171830c08e4f99852947a5c3b62e784220a26 
85aff144e5219bce4eb6adb2ac32c6459cac22d0 M    arch

---

git cherry-pick 525642624783

Output:

powerpc/signal32: Fix erroneous SIGSEGV on RT signal return
  Author: Christophe Leroy <christophe.leroy@csgroup.eu>
  Date: Fri Apr 23 13:52:10 2021 +0000
  1 file changed, 2 insertions(+), 2 deletions(-)

---

Xorg works after compiling with the cherry-pick of 525642624783.

^ permalink raw reply

* [PATCH] arch: powerpc: kvm: remove unnecessary casting
From: Nour-eddine Taleb @ 2021-05-08 21:37 UTC (permalink / raw)
  To: paulus, mpe, benh; +Cc: noureddine, linuxppc-dev, linux-kernel, kvm-ppc

remove unnecessary castings, from "void *" to "struct kvmppc_xics *"

Signed-off-by: Nour-eddine Taleb <contact@noureddine.xyz>
---
  arch/powerpc/kvm/book3s_xics.c        | 2 +-
  arch/powerpc/kvm/book3s_xive.c        | 2 +-
  arch/powerpc/kvm/book3s_xive_native.c | 2 +-
  3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/kvm/book3s_xics.c b/arch/powerpc/kvm/book3s_xics.c
index 303e3cb096db..9ae74fa551a6 100644
--- a/arch/powerpc/kvm/book3s_xics.c
+++ b/arch/powerpc/kvm/book3s_xics.c
@@ -1440,7 +1440,7 @@ static int kvmppc_xics_create(struct kvm_device 
*dev, u32 type)

  static void kvmppc_xics_init(struct kvm_device *dev)
  {
-	struct kvmppc_xics *xics = (struct kvmppc_xics *)dev->private;
+	struct kvmppc_xics *xics = dev->private;

  	xics_debugfs_init(xics);
  }
diff --git a/arch/powerpc/kvm/book3s_xive.c b/arch/powerpc/kvm/book3s_xive.c
index e7219b6f5f9a..05bcaf81a90a 100644
--- a/arch/powerpc/kvm/book3s_xive.c
+++ b/arch/powerpc/kvm/book3s_xive.c
@@ -2242,7 +2242,7 @@ static void xive_debugfs_init(struct kvmppc_xive 
*xive)

  static void kvmppc_xive_init(struct kvm_device *dev)
  {
-	struct kvmppc_xive *xive = (struct kvmppc_xive *)dev->private;
+	struct kvmppc_xive *xive = dev->private;

  	/* Register some debug interfaces */
  	xive_debugfs_init(xive);
diff --git a/arch/powerpc/kvm/book3s_xive_native.c 
b/arch/powerpc/kvm/book3s_xive_native.c
index 76800c84f2a3..2703432cea78 100644
--- a/arch/powerpc/kvm/book3s_xive_native.c
+++ b/arch/powerpc/kvm/book3s_xive_native.c
@@ -1265,7 +1265,7 @@ static void xive_native_debugfs_init(struct 
kvmppc_xive *xive)

  static void kvmppc_xive_native_init(struct kvm_device *dev)
  {
-	struct kvmppc_xive *xive = (struct kvmppc_xive *)dev->private;
+	struct kvmppc_xive *xive = dev->private;

  	/* Register some debug interfaces */
  	xive_native_debugfs_init(xive);
-- 
2.30.2


^ permalink raw reply related

* [powerpc:next] BUILD SUCCESS f96271cefe6dfd1cb04195b76f4a33e185cd7f92
From: kernel test robot @ 2021-05-09  1:38 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: f96271cefe6dfd1cb04195b76f4a33e185cd7f92  Merge branch 'master' into next

elapsed time: 721m

configs tested: 173
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
riscv                            allyesconfig
i386                             allyesconfig
powerpc                    adder875_defconfig
powerpc                 linkstation_defconfig
powerpc                   lite5200b_defconfig
arm                         mv78xx0_defconfig
powerpc                     tqm8540_defconfig
arm                          simpad_defconfig
sh                        edosk7705_defconfig
m68k                       m5475evb_defconfig
powerpc                    mvme5100_defconfig
powerpc                     taishan_defconfig
arm                            hisi_defconfig
sh                   rts7751r2dplus_defconfig
arm                      jornada720_defconfig
powerpc                  mpc866_ads_defconfig
arm                            qcom_defconfig
mips                        qi_lb60_defconfig
arc                     haps_hs_smp_defconfig
m68k                        m5307c3_defconfig
arm                         s3c6400_defconfig
powerpc                 mpc8313_rdb_defconfig
sh                   secureedge5410_defconfig
powerpc                     stx_gp3_defconfig
sh                          rsk7203_defconfig
mips                           ip27_defconfig
mips                      pic32mzda_defconfig
powerpc                 mpc832x_mds_defconfig
sh                          urquell_defconfig
sh                   sh7724_generic_defconfig
powerpc                 mpc837x_mds_defconfig
openrisc                 simple_smp_defconfig
i386                             alldefconfig
powerpc                 xes_mpc85xx_defconfig
arm                           sama5_defconfig
powerpc                     ep8248e_defconfig
mips                         tb0226_defconfig
sh                          lboxre2_defconfig
arm                        mini2440_defconfig
s390                                defconfig
mips                      maltaaprp_defconfig
h8300                     edosk2674_defconfig
m68k                         apollo_defconfig
powerpc                mpc7448_hpc2_defconfig
mips                            e55_defconfig
powerpc                      pmac32_defconfig
arm                       imx_v6_v7_defconfig
mips                     cu1000-neo_defconfig
um                               allyesconfig
arc                     nsimosci_hs_defconfig
sh                           se7751_defconfig
nios2                            allyesconfig
powerpc                 mpc834x_mds_defconfig
arm                        spear3xx_defconfig
arm                         socfpga_defconfig
m68k                        mvme16x_defconfig
powerpc                      ppc6xx_defconfig
arm                       cns3420vb_defconfig
m68k                          sun3x_defconfig
ia64                      gensparse_defconfig
arm                              alldefconfig
mips                     cu1830-neo_defconfig
sh                             espt_defconfig
mips                          rb532_defconfig
arm                         nhk8815_defconfig
arc                            hsdk_defconfig
arc                           tb10x_defconfig
arm                        magician_defconfig
arm                            dove_defconfig
arc                          axs103_defconfig
s390                       zfcpdump_defconfig
powerpc                      ppc64e_defconfig
sparc                       sparc64_defconfig
ia64                             alldefconfig
mips                           ip22_defconfig
x86_64                            allnoconfig
ia64                             allmodconfig
ia64                                defconfig
ia64                             allyesconfig
m68k                             allmodconfig
m68k                                defconfig
m68k                             allyesconfig
nios2                               defconfig
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
sparc                            allyesconfig
sparc                               defconfig
i386                                defconfig
mips                             allyesconfig
mips                             allmodconfig
powerpc                          allyesconfig
powerpc                          allmodconfig
powerpc                           allnoconfig
i386                 randconfig-a003-20210508
i386                 randconfig-a006-20210508
i386                 randconfig-a001-20210508
i386                 randconfig-a005-20210508
i386                 randconfig-a004-20210508
i386                 randconfig-a002-20210508
i386                 randconfig-a003-20210509
i386                 randconfig-a006-20210509
i386                 randconfig-a001-20210509
i386                 randconfig-a005-20210509
i386                 randconfig-a004-20210509
i386                 randconfig-a002-20210509
x86_64               randconfig-a014-20210508
x86_64               randconfig-a015-20210508
x86_64               randconfig-a011-20210508
x86_64               randconfig-a013-20210508
x86_64               randconfig-a012-20210508
x86_64               randconfig-a016-20210508
i386                 randconfig-a013-20210508
i386                 randconfig-a015-20210508
i386                 randconfig-a014-20210508
i386                 randconfig-a016-20210508
i386                 randconfig-a011-20210508
i386                 randconfig-a012-20210508
i386                 randconfig-a013-20210509
i386                 randconfig-a015-20210509
i386                 randconfig-a014-20210509
i386                 randconfig-a016-20210509
i386                 randconfig-a011-20210509
i386                 randconfig-a012-20210509
x86_64               randconfig-a005-20210509
x86_64               randconfig-a003-20210509
x86_64               randconfig-a001-20210509
x86_64               randconfig-a002-20210509
x86_64               randconfig-a006-20210509
x86_64               randconfig-a004-20210509
riscv                    nommu_k210_defconfig
riscv                    nommu_virt_defconfig
riscv                             allnoconfig
riscv                               defconfig
riscv                          rv32_defconfig
um                               allmodconfig
um                                allnoconfig
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-a005-20210508
x86_64               randconfig-a003-20210508
x86_64               randconfig-a001-20210508
x86_64               randconfig-a002-20210508
x86_64               randconfig-a006-20210508
x86_64               randconfig-a004-20210508
x86_64               randconfig-a014-20210509
x86_64               randconfig-a015-20210509
x86_64               randconfig-a011-20210509
x86_64               randconfig-a013-20210509
x86_64               randconfig-a012-20210509
x86_64               randconfig-a016-20210509

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

^ permalink raw reply

* [powerpc:merge] BUILD SUCCESS fcc98c6d0289241dded10b74f8198fc4ecb22bd1
From: kernel test robot @ 2021-05-09  1:38 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: fcc98c6d0289241dded10b74f8198fc4ecb22bd1  Automatic merge of 'next' into merge (2021-05-08 21:19)

elapsed time: 721m

configs tested: 96
configs skipped: 2

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

gcc tested configs:
arm64                            allyesconfig
arm64                               defconfig
arm                              allyesconfig
arm                              allmodconfig
arm                                 defconfig
x86_64                           allyesconfig
riscv                            allmodconfig
i386                             allyesconfig
riscv                            allyesconfig
powerpc                     tqm8540_defconfig
arm                          simpad_defconfig
sh                        edosk7705_defconfig
powerpc                      mgcoge_defconfig
powerpc                     tqm5200_defconfig
mips                        maltaup_defconfig
sh                            migor_defconfig
sh                         ecovec24_defconfig
arm                         socfpga_defconfig
m68k                        mvme16x_defconfig
powerpc                      ppc6xx_defconfig
arm                      jornada720_defconfig
arc                            hsdk_defconfig
um                               allyesconfig
arc                           tb10x_defconfig
arm                        magician_defconfig
arm                            dove_defconfig
arc                          axs103_defconfig
x86_64                            allnoconfig
ia64                             allmodconfig
ia64                                defconfig
ia64                             allyesconfig
m68k                             allmodconfig
m68k                                defconfig
m68k                             allyesconfig
nds32                               defconfig
nios2                            allyesconfig
csky                                defconfig
alpha                               defconfig
alpha                            allyesconfig
xtensa                           allyesconfig
h8300                            allyesconfig
arc                                 defconfig
sh                               allmodconfig
nios2                               defconfig
arc                              allyesconfig
nds32                             allnoconfig
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
i386                 randconfig-a003-20210508
i386                 randconfig-a006-20210508
i386                 randconfig-a001-20210508
i386                 randconfig-a005-20210508
i386                 randconfig-a004-20210508
i386                 randconfig-a002-20210508
x86_64               randconfig-a014-20210508
x86_64               randconfig-a015-20210508
x86_64               randconfig-a011-20210508
x86_64               randconfig-a013-20210508
x86_64               randconfig-a012-20210508
x86_64               randconfig-a016-20210508
i386                 randconfig-a013-20210508
i386                 randconfig-a015-20210508
i386                 randconfig-a014-20210508
i386                 randconfig-a016-20210508
i386                 randconfig-a011-20210508
i386                 randconfig-a012-20210508
riscv                    nommu_k210_defconfig
riscv                    nommu_virt_defconfig
riscv                             allnoconfig
riscv                               defconfig
riscv                          rv32_defconfig
um                               allmodconfig
um                                allnoconfig
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-a005-20210508
x86_64               randconfig-a003-20210508
x86_64               randconfig-a001-20210508
x86_64               randconfig-a002-20210508
x86_64               randconfig-a006-20210508
x86_64               randconfig-a004-20210508

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

^ permalink raw reply

* Re: [PATCH 2/3] hotplug-memory.c: enhance dlpar_memory_remove* LMB checks
From: David Gibson @ 2021-05-09  8:43 UTC (permalink / raw)
  To: Daniel Henrique Barboza; +Cc: linuxppc-dev
In-Reply-To: <1491f5c1-593b-4a87-2645-6da76bb7e47a@gmail.com>

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

On Fri, May 07, 2021 at 01:36:06PM -0300, Daniel Henrique Barboza wrote:
> 
> 
> On 5/3/21 10:02 PM, David Gibson wrote:
> > On Fri, Apr 30, 2021 at 09:09:16AM -0300, Daniel Henrique Barboza wrote:
> > > dlpar_memory_remove_by_ic() validates the amount of LMBs to be removed
> > > by checking !DRCONF_MEM_RESERVED, and in the following loop before
> > > dlpar_remove_lmb() a check for DRCONF_MEM_ASSIGNED is made before
> > > removing it. This means that a LMB that is both !DRCONF_MEM_RESERVED and
> > > !DRCONF_MEM_ASSIGNED will be counted as valid, but then not being
> > > removed.  The function will end up not removing all 'lmbs_to_remove'
> > > LMBs while also not reporting any errors.
> > > 
> > > Comparing it to dlpar_memory_remove_by_count(), the validation is done
> > > via lmb_is_removable(), which checks for DRCONF_MEM_ASSIGNED and fadump
> > > constraints. No additional check is made afterwards, and
> > > DRCONF_MEM_RESERVED is never checked before dlpar_remove_lmb(). The
> > > function doesn't have the same 'check A for validation, then B for
> > > removal' issue as remove_by_ic(), but it's not checking if the LMB is
> > > reserved.
> > > 
> > > There is no reason for these functions to validate the same operation in
> > > two different manners.
> > 
> > Actually, I think there is: remove_by_ic() is handling a request to
> > remove a specific range of LMBs.  If any are reserved, they can't be
> > removed and so this needs to fail.  But if they are !ASSIGNED, that
> > essentially means they're *already* removed (or never added), so
> > "removing" them is, correctly, a no-op.
> 
> I guess that makes sense. Although I am not aware of any situation, at least
> thinking about how QEMU adds/removes LMBs, where some LMBs would be removed
> 'ad-hoc' in the middle of a LMB range that maps to a QEMU DIMM, I can't say
> that this wouldn't never happen either.

Right.  I believe a user could explicitly offline LMBs in the middle
of a DIMM. There's not much reason to do so, but it's possible.  There
might also be situations involving memory errors where individual LMBs
could get offlined.

> It is sensible to make remove_by_ic()
> resilient to this situation.
> 
> I'll re-send this patch just with the remove_by_count() change.
> 
> 
> Thanks,
> 
> 
> Daniel
> 
> > 
> > remove_by_count(), in contrast, is being asked to remove a fixed
> > number of LMBs from wherever they can be found, and for that it needs
> > to find LMBs that haven't already been removed.
> > 
> > Basically remove_by_ic() is an absolute request: "make this set of
> > LMBs be not-plugged", whereas remove_by_count() is a relative request
> > "make N less LMBs be plugged".
> > 
> > 
> > So I think remove_by_ic()s existing handling is correct.  I'm less
> > sure if remove_by_count() ignoring RESERVED is correct - I couldn't
> > quickly find under what circumstances RESERVED gets set.
> > 
> > 
> > > This patch addresses that by changing
> > > lmb_is_removable() to also check for DRCONF_MEM_RESERVED to tell if a
> > > lmb is removable, making dlpar_memory_remove_by_count() take the
> > > reservation state into account when counting the LMBs.
> > > lmb_is_removable() is then used in the validation step of
> > > dlpar_memory_remove_by_ic(), which is already checking for both states
> > > but in different stages, to avoid counting a LMB that is not assigned as
> > > eligible for removal. We can then skip the check before
> > > dlpar_remove_lmb() since we're validating all LMBs beforehand.
> > > 
> > > Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
> > > ---
> > >   arch/powerpc/platforms/pseries/hotplug-memory.c | 8 +++-----
> > >   1 file changed, 3 insertions(+), 5 deletions(-)
> > > 
> > > diff --git a/arch/powerpc/platforms/pseries/hotplug-memory.c b/arch/powerpc/platforms/pseries/hotplug-memory.c
> > > index bb98574a84a2..4e6d162c3f1a 100644
> > > --- a/arch/powerpc/platforms/pseries/hotplug-memory.c
> > > +++ b/arch/powerpc/platforms/pseries/hotplug-memory.c
> > > @@ -348,7 +348,8 @@ static int pseries_remove_mem_node(struct device_node *np)
> > >   static bool lmb_is_removable(struct drmem_lmb *lmb)
> > >   {
> > > -	if (!(lmb->flags & DRCONF_MEM_ASSIGNED))
> > > +	if ((lmb->flags & DRCONF_MEM_RESERVED) ||
> > > +		!(lmb->flags & DRCONF_MEM_ASSIGNED))
> > >   		return false;
> > >   #ifdef CONFIG_FA_DUMP
> > > @@ -523,7 +524,7 @@ static int dlpar_memory_remove_by_ic(u32 lmbs_to_remove, u32 drc_index)
> > >   	/* Validate that there are enough LMBs to satisfy the request */
> > >   	for_each_drmem_lmb_in_range(lmb, start_lmb, end_lmb) {
> > > -		if (lmb->flags & DRCONF_MEM_RESERVED)
> > > +		if (!lmb_is_removable(lmb))
> > >   			break;
> > >   		lmbs_available++;
> > > @@ -533,9 +534,6 @@ static int dlpar_memory_remove_by_ic(u32 lmbs_to_remove, u32 drc_index)
> > >   		return -EINVAL;
> > >   	for_each_drmem_lmb_in_range(lmb, start_lmb, end_lmb) {
> > > -		if (!(lmb->flags & DRCONF_MEM_ASSIGNED))
> > > -			continue;
> > > -
> > >   		rc = dlpar_remove_lmb(lmb);
> > >   		if (rc)
> > >   			break;
> > 
> 

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

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

^ permalink raw reply

* Re: [FSL P50x0] Xorg always restarts again and again after the the PowerPC updates 5.13-1
From: Christian Zigotzky @ 2021-05-09 12:27 UTC (permalink / raw)
  To: Christophe Leroy
  Cc: Darren Stevens, R.T.Dickinson, mad skateman, linuxppc-dev,
	Christian Zigotzky
In-Reply-To: <10d52780-34ca-2205-8d5c-544a1ff2f248@xenosoft.de>

On 08 May 2021 at 06:39pm, Christian Zigotzky wrote:
> On 06 May 2021 at 03:58 pm, Christian Zigotzky wrote:
>> I have started bisecting again.
>>
>> Link: 
>> https://forum.hyperion-entertainment.com/viewtopic.php?p=53106#p53106 
>> <https://forum.hyperion-entertainment.com/viewtopic.php?p=53106#p53106>
>>
>>
>>> On 6. May 2021, at 10:09, Christophe Leroy 
>>> <christophe.leroy@csgroup.eu> wrote:
>>>
>>>
>>> - Can you check that 887f3ceb51cd with cherry-picked 525642624783 
>>> has Xorg working ?
> git checkout 887f3ceb51cd
> git cherry-pick 525642624783
>
> Result: Xorg works.
>>> - Can you bisect between 887f3ceb51cd[good] and 56bec2f9d4d0[bad] to 
>>> identify first bad commit that stops after loading the dtb and uImage ?
>>> - Once that first bad commit is identified, can you check whether 
>>> the preceeding commit with cherry-picked 525642624783 has Xorg 
>>> working or not ?
>>>
>>> Thanks
>>> Christophe
> git bisect start
> git bisect good 887f3ceb51cd
> git bisect bad 56bec2f9d4d0
> git bisect good -- Xorg restarts again and again but we are looking 
> for the first bad commit that stops the boot after loading the dtb and 
> uImage.
> git bisect good -- Xorg restarts again and again.
> git bisect good -- Xorg restarts again and again.
> git bisect good -- Xorg restarts again and again.
>
> Result:
>
> 56bec2f9d4d05675cada96772a8a93010f4d82bf is the first bad commit
> commit 56bec2f9d4d05675cada96772a8a93010f4d82bf
> Author: Michael Ellerman <mpe@ellerman.id.au>
> Date:   Wed Mar 31 11:38:40 2021 +1100
>
>     powerpc/mm/64s: Add _PAGE_KERNEL_ROX
>
>     In the past we had a fallback definition for _PAGE_KERNEL_ROX, but we
>     removed that in commit d82fd29c5a8c ("powerpc/mm: Distribute platform
>     specific PAGE and PMD flags and definitions") and added definitions
>     for each MMU family.
>
>     However we missed adding a definition for 64s, which was not really a
>     bug because it's currently not used.
>
>     But we'd like to use PAGE_KERNEL_ROX in a future patch so add a
>     definition now.
>
>     Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
>     Link: 
> https://lore.kernel.org/r/20210331003845.216246-1-mpe@ellerman.id.au
>
> :040000 040000 ff8171830c08e4f99852947a5c3b62e784220a26 
> 85aff144e5219bce4eb6adb2ac32c6459cac22d0 M    arch
>
> ---
>
> git cherry-pick 525642624783
>
> Output:
>
> powerpc/signal32: Fix erroneous SIGSEGV on RT signal return
>  Author: Christophe Leroy <christophe.leroy@csgroup.eu>
>  Date: Fri Apr 23 13:52:10 2021 +0000
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> ---
>
> Xorg works after compiling with the cherry-pick of 525642624783.
Hi All,

I compiled and tested the latest git kernel with the new PowerPC updates 
5.13-2 today. Unfortunately the Xorg issue still exists.
If I revert the PowerPC updates 5.13-1 and 5.13-2 then Xorg works 
without any problems.

Please check the BookE changes in the PowerPC updates 5.13-1 because my 
Book3S machines aren't affected by this issue.

Thanks,
Christian

^ permalink raw reply

* Re: [FSL P50x0] Xorg always restarts again and again after the the PowerPC updates 5.13-1
From: Christophe Leroy @ 2021-05-09 17:36 UTC (permalink / raw)
  To: Christian Zigotzky
  Cc: Darren Stevens, R.T.Dickinson, mad skateman, linuxppc-dev,
	Christian Zigotzky
In-Reply-To: <10d52780-34ca-2205-8d5c-544a1ff2f248@xenosoft.de>

Thanks for testing

Le 08/05/2021 à 18:39, Christian Zigotzky a écrit :
> On 06 May 2021 at 03:58 pm, Christian Zigotzky wrote:
>> I have started bisecting again.
>>
>> Link: https://forum.hyperion-entertainment.com/viewtopic.php?p=53106#p53106 
>> <https://forum.hyperion-entertainment.com/viewtopic.php?p=53106#p53106>
>>
>>
>>> On 6. May 2021, at 10:09, Christophe Leroy <christophe.leroy@csgroup.eu> wrote:
>>>
>>>
>>> - Can you check that 887f3ceb51cd with cherry-picked 525642624783 has Xorg working ?
> git checkout 887f3ceb51cd
> git cherry-pick 525642624783

Good to know. So this confirms your problem is not related to the commit you bisected initially

> 
> Result: Xorg works.
>>> - Can you bisect between 887f3ceb51cd[good] and 56bec2f9d4d0[bad] to identify first bad commit 
>>> that stops after loading the dtb and uImage ?
>>> - Once that first bad commit is identified, can you check whether the preceeding commit with 
>>> cherry-picked 525642624783 has Xorg working or not ?
>>>
>>> Thanks
>>> Christophe
> git bisect start
> git bisect good 887f3ceb51cd
> git bisect bad 56bec2f9d4d0
> git bisect good -- Xorg restarts again and again but we are looking for the first bad commit that 
> stops the boot after loading the dtb and uImage.
> git bisect good -- Xorg restarts again and again.
> git bisect good -- Xorg restarts again and again.
> git bisect good -- Xorg restarts again and again.
> 
> Result:
> 
> 56bec2f9d4d05675cada96772a8a93010f4d82bf is the first bad commit
> commit 56bec2f9d4d05675cada96772a8a93010f4d82bf
> Author: Michael Ellerman <mpe@ellerman.id.au>
> Date:   Wed Mar 31 11:38:40 2021 +1100
> 
>      powerpc/mm/64s: Add _PAGE_KERNEL_ROX
> 

Here I'm a bit sceptique. This is a book3s related patch and it's only an additional define no I 
can't see how it can break the boot on book3e.

I see that's the top of the range I asked you to bisect on, so there is something wrong in the analysis.

Based on the information you gave in 
https://forum.hyperion-entertainment.com/viewtopic.php?p=53103&sid=c8fc65914bfcba65489240cd5eb7e836#p53103 
, I rerun your bisect and established the following log:

git bisect start '--' 'arch/powerpc'
# good: [627b72bee84d6652e0af26617e71ce2b3c18fcd5] powerpc/signal32: Convert 
restore_[tm]_user_regs() to user access block
git bisect good 627b72bee84d6652e0af26617e71ce2b3c18fcd5
# bad: [c70a4be130de333ea079c59da41cc959712bb01c] Merge tag 'powerpc-5.13-1' of 
git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux
git bisect bad c70a4be130de333ea079c59da41cc959712bb01c
# bad: [49c1d07fd04f54eb588c4a1dfcedc8d22c5ffd50] powerpc/powernv: Enable HAIL (HV AIL) for ISA v3.1 
processors
git bisect bad 49c1d07fd04f54eb588c4a1dfcedc8d22c5ffd50
# skip: [01c1b9984a12a379f332c39c4b1fd96e473b93b0] powerpc/rtas-proc: remove unused RMO_READ_BUF_MAX
git bisect skip 01c1b9984a12a379f332c39c4b1fd96e473b93b0
# skip: [107dadb046178173dea18e0a78ff8ea3cc27c213] powerpc/perf: Make symbol 
'isa207_pmu_format_attr' static
git bisect skip 107dadb046178173dea18e0a78ff8ea3cc27c213
# skip: [56bec2f9d4d05675cada96772a8a93010f4d82bf] powerpc/mm/64s: Add _PAGE_KERNEL_ROX
git bisect skip 56bec2f9d4d05675cada96772a8a93010f4d82bf
# skip: [2235dea17d56238642121a8085b71d68598534bb] powerpc/pseries/pmem: Make symbol 
'drc_pmem_match' static
git bisect skip 2235dea17d56238642121a8085b71d68598534bb
# skip: [2c02e656a29d5f64193eb93da92781bcf0517146] powerpc/64s: Use htab_convert_pte_flags() in 
hash__mark_rodata_ro()
git bisect skip 2c02e656a29d5f64193eb93da92781bcf0517146
# skip: [472724111f0f72042deb6a9dcee9578e5398a1a1] powerpc/iommu: Enable remaining IOMMU Pagesizes 
present in LoPAR
git bisect skip 472724111f0f72042deb6a9dcee9578e5398a1a1
# skip: [ceff77efa4f8d9f02d8442171b325d3b7068fe5e] powerpc/64e/interrupt: Use new interrupt context 
tracking scheme
git bisect skip ceff77efa4f8d9f02d8442171b325d3b7068fe5e
# skip: [7dcc37b3eff97379b194adb17eb9a8270512dd1d] powerpc/xive: Map one IPI interrupt per node
git bisect skip 7dcc37b3eff97379b194adb17eb9a8270512dd1d
# skip: [097157e16cf8bf91b9cf6fbda05d234d3599c01f] powerpc/64e/interrupt: reconcile irq soft-mask 
state in C
git bisect skip 097157e16cf8bf91b9cf6fbda05d234d3599c01f


Then I looked at the list of commits in the kernel, and identified all the ones marked with ZZ or 
ZZZ as the ones which are up to now identified as not booting. And 
56bec2f9d4d05675cada96772a8a93010f4d82bf is the first commit that you skipped.

Did I do an error in my analysis ?

BAD *   c70a4be130de Merge tag 'powerpc-5.13-1' of 
git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux
|\
| * 525642624783 powerpc/signal32: Fix erroneous SIGSEGV on RT signal return
| * f9cd5f91a897 powerpc: Avoid clang uninitialized warning in __get_user_size_allowed
| * adb68c38d8d4 powerpc/papr_scm: Mark nvdimm as unarmed if needed during probe
| * ee1bc694fbae powerpc/kvm: Fix build error when PPC_MEM_KEYS/PPC_PSERIES=n
| * 30c400886bad powerpc/kasan: Fix shadow start address with modules
| * fc5590fd56c9 powerpc/kernel/iommu: Use largepool as a last resort when !largealloc
| * 3c0468d4451e powerpc/kernel/iommu: Align size for IOMMU_PAGE_SIZE() to save TCEs
| * ee6b25fa7c03 powerpc/44x: fix spelling mistake in Kconfig "varients" -> "variants"
| * cc7130bf119a powerpc/iommu: Annotate nested lock for lockdep
| * 4be518d83880 powerpc/iommu: Do not immediately panic when failed IOMMU table allocation
| * 7f1fa82d7994 powerpc/iommu: Allocate it_map by vmalloc
| * 0db11461677a selftests/powerpc: remove unneeded semicolon
| * caea7b833d86 powerpc/64s: remove unneeded semicolon
| * f3d03fc748d4 powerpc/eeh: remove unneeded semicolon
| * 290f7d8ce2b1 powerpc/selftests: Add selftest to test concurrent perf/ptrace events
| * c65c64cc7bbd powerpc/selftests/perf-hwbreak: Add testcases for 2nd DAWR
| * c9cb0afb4eaa powerpc/selftests/perf-hwbreak: Coalesce event creation code
| * dae4ff8031b4 powerpc/selftests/ptrace-hwbreak: Add testcases for 2nd DAWR
| * 421a7483878c powerpc/configs: Add IBMVNIC to some 64-bit configs
| * da650ada1009 selftests/powerpc: Add uaccess flush test
| * 8a87a5077143 powerpc/52xx: Fix an invalid ASM expression ('addi' used instead of 'add')
| * 0f197ddce403 powerpc/64s: Fix mm_cpumask memory ordering comment
| * 66d9b7492887 powerpc/perf: Fix the threshold event selection for memory events in power10
| * b4ded42268ee powerpc/perf: Fix sampled instruction type for larx/stcx
| * 0bd3f9e953bd powerpc/legacy_serial: Use early_ioremap()
| * 9ccba66d4d2a powerpc/64: Fix the definition of the fixmap area
| * 389586333c02 powerpc: make ALTIVEC select PPC_FPU
| * 7d9462765707 powerpc/64s: Add FA_DUMP to defconfig
| * d936f8182e1b powerpc/powernv: Fix type of opal_mpipl_query_tag() addr argument
| * 2e341f56a16a powerpc/fadump: Fix sparse warnings
| * 39352430aaa0 powerpc: Move copy_inst_from_kernel_nofault()
| * 41d6cf68b5f6 powerpc: Rename probe_kernel_read_inst()
| * 6449078d5011 powerpc: Make probe_kernel_read_inst() common to PPC32 and PPC64
| * 6ac7897f08e0 powerpc: Remove probe_user_read_inst()
| * ee7c3ec3b4b1 powerpc/ebpf32: Use standard function call for functions within 32M distance
| * e7de0023e123 powerpc/ebpf32: Rework 64 bits shifts to avoid tests and branches
| * d228cc496966 powerpc/ebpf32: Fix comment on BPF_ALU{64} | BPF_LSH | BPF_K
| * 867e762480f4 powerpc/32: Use r2 in wrtspr() instead of r0
| * f56607e85ee3 selftests/timens: Fix gettime_perf to work on powerpc
| * 92d9d61be519 powerpc/mce: save ignore_event flag unconditionally for UE
| * eacf4c020265 powerpc: Enable OPTPROBES on PPC32
| * 693557ebf407 powerpc/inst: ppc_inst_as_u64() becomes ppc_inst_as_ulong()
| * e522331173ec powerpc/irq: Enhance readability of trap types
| * 7fab639729ce powerpc/32s: Enhance readability of trap types
| * 0f5eb28a6ce6 powerpc/8xx: Enhance readability of trap types
| * a9d2f9bb225f powerpc/pseries/iommu: Fix window size for direct mapping with pmem
| * e4e8bc1df691 powerpc/kvm: Fix PR KVM with KUAP/MEM_KEYS enabled
| * ed8029d7b472 powerpc/pseries: Stop calling printk in rtas_stop_self()
| * 3027a37c06be powerpc: Only define _TASK_CPU for 32-bit
| * 39d0099f9439 powerpc/pseries: Add shutdown() to vio_driver and vio_bus
| * af31fd0c9107 powerpc/perf: Expose processor pipeline stage cycles using PERF_SAMPLE_WEIGHT_STRUCT
| * 2886e2df10be Documentation/powerpc: Add proper links for manual and tests
| * 29c9a2699e71 powerpc/pseries: Set UNISOLATE on dlpar_cpu_remove() failure
| * 0e3b3ff83ce2 powerpc/pseries: Introduce dlpar_unisolate_drc()
| * 864ec4d40c83 powerpc/pseries/mce: Fix a typo in error type assignment
| * cbd3d5ba46b6 powerpc/fadump: Fix compile error since trap type change
| * d8a1d6c58986 powerpc/perf: Add platform specific check_attr_config
| *   a38cb4171928 Merge branch 'topic/ppc-kvm' into next
| |\
| | * 732f21a3053c KVM: PPC: Book3S HV: Ensure MSR[HV] is always clear in guest MSR
| | * 946cf44ac6ce KVM: PPC: Book3S HV: Ensure MSR[ME] is always set in guest MSR
| | * da487a5d1bee powerpc/64s: remove KVM SKIP test from instruction breakpoint handler
| | * 5eee8371828a powerpc/64s: Remove KVM handler support from CBE_RAS interrupts
| | * 0fd85cb83fbd KVM: PPC: Book3S HV: Fix CONFIG_SPAPR_TCE_IOMMU=n default hcalls
| | * 6c12c4376bbb KVM: PPC: Book3S HV: remove unused kvmppc_h_protect argument
| | * 4b5f0a0d49e6 KVM: PPC: Book3S HV: Remove redundant mtspr PSPB
| | * 72c15287210f KVM: PPC: Book3S HV: Prevent radix guests setting LPCR[TC]
| | * bcc92a0d6d6e KVM: PPC: Book3S HV: Disallow LPCR[AIL] to be set to 1 or 2
| | * 67145ef4960f KVM: PPC: Book3S HV: Add a function to filter guest LPCR bits
| | * a19b70abc69a KVM: PPC: Book3S HV: Nested move LPCR sanitising to sanitise_hv_regs
| | * 5088eb4092df KVM: PPC: Book3S HV P9: Restore host CTRL SPR after guest exit
BAD | * | 49c1d07fd04f powerpc/powernv: Enable HAIL (HV AIL) for ISA v3.1 processors
| * | 6980d13f0dd1 powerpc/smp: Set numa node before updating mask
| * | 7153d4bf0b37 powerpc/traps: Enhance readability for trap types
| * | 7de21e679e6a powerpc: fix EDEADLOCK redefinition error in uapi/asm/errno.h
| * | c1e53367dab1 powerpc/smp: Cache CPU to chip lookup
| * | 131c82b6a1d2 Revert "powerpc/topology: Update topology_core_cpumask"
| * | c47f892d7aa6 powerpc/smp: Reintroduce cpu_core_mask
| * | e9e16917bc38 powerpc/xive: Use the "ibm, chip-id" property only under PowerNV
| * | 38d0b1c9cec7 powerpc/pseries: extract host bridge from pci_bus prior to bus removal
| * | 0751fdf28041 macintosh/via-pmu: Fix build warning
| * | 7767d9ac89ce powerpc/papr_scm: Fix build error due to wrong printf specifier
| * | d6481a7195df powerpc/configs: Add PAPR_SCM to pseries_defconfig
| * | 7098f8f0cf03 powerpc/mm/radix: Make radix__change_memory_range() static
| * | 74205b3fc2ef powerpc/vdso: Add support for time namespaces
| * | 1c4bce675385 powerpc/vdso: Separate vvar vma from vdso
| * | 808094fcbf41 lib/vdso: Add vdso_data pointer as input to __arch_get_timens_vdso_data()
| * | 58efe9f696cf lib/vdso: Mark do_hres_timens() and do_coarse_timens() __always_inline()
| * | 8f6cc75a97d1 powerpc: move norestart trap flag to bit 0
| * | 8dc7f0229b78 powerpc: remove partial register save logic
| * | c45ba4f44f6b powerpc: clean up do_page_fault
| * | d738ee8d56de powerpc/64e/interrupt: handle bad_page_fault in C
ZZ | * | ceff77efa4f8 powerpc/64e/interrupt: Use new interrupt context tracking scheme
ZZ | * | 097157e16cf8 powerpc/64e/interrupt: reconcile irq soft-mask state in C
| * | 3db8aa10de9a powerpc/64e/interrupt: NMI save irq soft-mask state in C
ZZ | * | 0c2472de23ae powerpc/64e/interrupt: use new interrupt return
| * | dc6231821a14 powerpc/interrupt: update common interrupt code for
| * | 4228b2c3d20e powerpc/64e/interrupt: always save nvgprs on interrupt
| * | 5a5a893c4ad8 powerpc/syscall: switch user_exit_irqoff and trace_hardirqs_off order
ZZ | * | 2e2a441d2c0b powerpc/perf: Infrastructure to support checking of attr.config*
| * | 59fd366b9bef powerpc/fadump: make symbol 'rtas_fadump_set_regval' static
| * | 7e9ab144c128 powerpc/mem: Use kmap_local_page() in flushing functions
| * | 6c96020882b1 powerpc/mem: Inline flush_dcache_page()
| * | 67b8e6af191a powerpc/mem: Help GCC realise __flush_dcache_icache() flushes single pages
| * | 52d490437ffb powerpc/mem: flush_dcache_icache_phys() is for HIGHMEM pages only
| * | cd97d9e8b5aa powerpc/mem: Optimise flush_dcache_icache_hugepage()
| * | e618c7aea1f2 powerpc/mem: Call flush_coherent_icache() at higher level
| * | 131637a17dc9 powerpc/mem: Remove address argument to flush_coherent_icache()
| * | bf26e0bbd2f8 powerpc/mem: Declare __flush_dcache_icache() static
| * | b26e8f27253a powerpc/mem: Move cache flushing functions into mm/cacheflush.c
| * | ff0b4155ae99 powerpc/powernv: make symbol 'mpipl_kobj' static
| * | f234ad405a35 powerpc/xmon: Make symbol 'spu_inst_dump' static
| * | cc331eee03ea powerpc/perf/hv-24x7: Make some symbols static
ZZZ | * | 107dadb04617 powerpc/perf: Make symbol 'isa207_pmu_format_attr' static
ZZZ | * | 2235dea17d56 powerpc/pseries/pmem: Make symbol 'drc_pmem_match' static
| * | 193e4cd8ed9d powerpc/pseries: Make symbol '__pcpu_scope_hcall_stats' static
ZZ | * | 472724111f0f powerpc/iommu: Enable remaining IOMMU Pagesizes present in LoPAR
| * | 672bff581e19 powerpc/syscalls: switch to generic syscallhdr.sh
XX | * | 14b3c9d24a7a powerpc/syscalls: switch to generic syscalltbl.sh
ZZ | * | e5d56763525e powerpc/rtas: rename RTAS_RMOBUF_MAX to RTAS_USER_REGION_SIZE
ZZ | * | 0649cdc82379 powerpc/rtas: move syscall filter setup into separate function
| * | 0ab1c929ae38 powerpc/rtas: remove ibm_suspend_me_token
ZZZ | * | 01c1b9984a12 powerpc/rtas-proc: remove unused RMO_READ_BUF_MAX
ZZ | * | c13ff6f32513 powerpc/rtas: improve ppc_rtas_rmo_buf_show documentation
| * | 5ae5bc12d072 powerpc/eeh: Fix EEH handling for hugepages in ioremap space.
XX | * | fd6db2892eba powerpc/xive: Modernize XIVE-IPI domain with an 'alloc' handler
ZZ | * | 7dcc37b3eff9 powerpc/xive: Map one IPI interrupt per node
| * | 33e4bc594643 powerpc/xive: Fix xmon command "dxi"
| * | 6bf66eb8f404 powerpc/xive: Simplify the dump of XIVE interrupts under xmon
| * | a74ce5926b20 powerpc/xive: Drop check on irq_data in xive_core_debug_show()
| * | 5159d9872823 powerpc/xive: Simplify xive_core_debug_show()
| * | 1835e72942b5 powerpc/xive: Remove useless check on XIVE_IPI_HW_IRQ
| * | 7d348494136c powerpc/xive: Introduce an IPI interrupt domain
| * | 078277acbd7c powerpc/smp: Make some symbols static
| * | 95d143923379 macintosh/via-pmu: Make some symbols static
| * | 4204ecd598cb windfarm: make symbol 'wf_thread' static
| * | 13ddd0e3acf9 macintosh/windfarm: Make symbol 'pm121_sys_state' static
| * | f6f1f48e8b3b powerpc/mce: Make symbol 'mce_ue_event_work' static
| * | 7f262b4dcf7e powerpc/security: Make symbol 'stf_barrier' static
| * | 80edc68e0479 powerpc/32s: Define a MODULE area below kernel text all the time
| * | 9132a2e82adc powerpc/8xx: Define a MODULE area below kernel text
| * | 2ec13df16704 powerpc/modules: Load modules closer to kernel text
| * | a5d6a3e73acb powerpc/mm: Add cond_resched() while removing hpte mappings
| * | 75b7c05ebf90 powerpc/papr_scm: Implement support for H_SCM_FLUSH hcall
| * | af072b1a9d4d powerpc/signal32: Fix build failure with CONFIG_SPE
| * | c46bbf5d2def powerpc/32: Remove powerpc specific definition of 'ptrdiff_t'
| * | b27dadecdf91 powerpc: iommu: fix build when neither PCI or IBMVIO is set
| * | 01ed0510941a powerpc/pseries: remove unneeded semicolon
ZZ | * | 98db179a78dd powerpc/64s: power4 nap fixup in C
| * | 10f8f96179ec powerpc/perf: Fix PMU constraint check for EBB events
| * | 812aa68ef7d4 selftests/powerpc: Suggest memtrace instead of /dev/mem for ci memory
ZZ | * | 08a022ad3dfa powerpc/powernv/memtrace: Allow mmaping trace buffers
| * | acd4dfeb49c8 powerpc/kexec: Don't use .machine ppc64 in trampoline_64.S
| * | c6b4c9147f8b powerpc/64: Move security code into security.c
| * | bd573a81312f powerpc/mm/64s: Allow STRICT_KERNEL_RWX again
| * | 87e65ad7bd3a powerpc/mm/64s/hash: Add real-mode change_memory_range() for hash LPAR
| * | 6f223ebe9c3f powerpc/mm/64s/hash: Factor out change_memory_range()
ZZZ | * | 2c02e656a29d powerpc/64s: Use htab_convert_pte_flags() in hash__mark_rodata_ro()
| * | b56d55a5aa4a powerpc/pseries: Add key to flags in pSeries_lpar_hpte_updateboltedpp()
ZZZ | * | 56bec2f9d4d0 powerpc/mm/64s: Add _PAGE_KERNEL_ROX
| * | 29e3ea8cbd29 selftests/powerpc: Test for spurious kernel memory faults on radix
| * | b8b2f37cf632 powerpc/64s: Fix pte update for kernel memory on radix
| * | 4763d3782764 powerpc: Spelling/typo fixes
| * | b0b3b2c78ec0 powerpc: Switch to relative jump labels
| * | 40272035e1d0 powerpc/bpf: Reallocate BPF registers to volatile registers when possible on PPC32
| * | 51c66ad849a7 powerpc/bpf: Implement extended BPF on PPC32
| * | 355a8d26cd04 powerpc/asm: Add some opcodes in asm/ppc-opcode.h for PPC32 eBPF
| * | c426810fcf9f powerpc/bpf: Change values of SEEN_ flags
| * | 4ea76e90a97d powerpc/bpf: Move common functions into bpf_jit_comp.c
| * | f1b1583d5faa powerpc/bpf: Move common helpers into bpf_jit.h
| * | ed573b57e77a powerpc/bpf: Change register numbering for bpf_set/is_seen_register()
| * | 6944caad78fc powerpc/bpf: Remove classical BPF support for PPC32
| * | c7393a71eb1a powerpc/signal32: Simplify logging in sigreturn()
BAD? | * | 887f3ceb51cd powerpc/signal32: Convert do_setcontext[_tm]() to user access block
GOOD | * | 627b72bee84d powerpc/signal32: Convert restore_[tm]_user_regs() to user access block
| * | 036fc2cb1dc2 powerpc/signal32: Reorder user reads in restore_tm_user_regs()


Christophe

^ permalink raw reply

* Re: [FSL P50x0] Xorg always restarts again and again after the the PowerPC updates 5.13-1
From: Christophe Leroy @ 2021-05-09 17:43 UTC (permalink / raw)
  To: Christian Zigotzky
  Cc: Darren Stevens, R.T.Dickinson, mad skateman, linuxppc-dev,
	Christian Zigotzky
In-Reply-To: <806945b0-d4e9-3064-8447-e8265642c048@xenosoft.de>



Le 09/05/2021 à 14:27, Christian Zigotzky a écrit :
> On 08 May 2021 at 06:39pm, Christian Zigotzky wrote:
>> On 06 May 2021 at 03:58 pm, Christian Zigotzky wrote:
>>> I have started bisecting again.
>>>
>>> Link: https://forum.hyperion-entertainment.com/viewtopic.php?p=53106#p53106 
>>> <https://forum.hyperion-entertainment.com/viewtopic.php?p=53106#p53106>
>>>
>>>
>>>> On 6. May 2021, at 10:09, Christophe Leroy <christophe.leroy@csgroup.eu> wrote:
>>>>
>>>>
>>>> - Can you check that 887f3ceb51cd with cherry-picked 525642624783 has Xorg working ?
>> git checkout 887f3ceb51cd
>> git cherry-pick 525642624783
>>
>> Result: Xorg works.
>>>> - Can you bisect between 887f3ceb51cd[good] and 56bec2f9d4d0[bad] to identify first bad commit 
>>>> that stops after loading the dtb and uImage ?
>>>> - Once that first bad commit is identified, can you check whether the preceeding commit with 
>>>> cherry-picked 525642624783 has Xorg working or not ?
>>>>
>>>> Thanks
>>>> Christophe
>> git bisect start
>> git bisect good 887f3ceb51cd
>> git bisect bad 56bec2f9d4d0
>> git bisect good -- Xorg restarts again and again but we are looking for the first bad commit that 
>> stops the boot after loading the dtb and uImage.
>> git bisect good -- Xorg restarts again and again.
>> git bisect good -- Xorg restarts again and again.
>> git bisect good -- Xorg restarts again and again.
>>
>> Result:
>>
>> 56bec2f9d4d05675cada96772a8a93010f4d82bf is the first bad commit
>> commit 56bec2f9d4d05675cada96772a8a93010f4d82bf
>> Author: Michael Ellerman <mpe@ellerman.id.au>
>> Date:   Wed Mar 31 11:38:40 2021 +1100
>>
>>     powerpc/mm/64s: Add _PAGE_KERNEL_ROX
>>
>>     In the past we had a fallback definition for _PAGE_KERNEL_ROX, but we
>>     removed that in commit d82fd29c5a8c ("powerpc/mm: Distribute platform
>>     specific PAGE and PMD flags and definitions") and added definitions
>>     for each MMU family.
>>
>>     However we missed adding a definition for 64s, which was not really a
>>     bug because it's currently not used.
>>
>>     But we'd like to use PAGE_KERNEL_ROX in a future patch so add a
>>     definition now.
>>
>>     Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
>>     Link: https://lore.kernel.org/r/20210331003845.216246-1-mpe@ellerman.id.au
>>
>> :040000 040000 ff8171830c08e4f99852947a5c3b62e784220a26 85aff144e5219bce4eb6adb2ac32c6459cac22d0 
>> M    arch
>>
>> ---
>>
>> git cherry-pick 525642624783
>>
>> Output:
>>
>> powerpc/signal32: Fix erroneous SIGSEGV on RT signal return
>>  Author: Christophe Leroy <christophe.leroy@csgroup.eu>
>>  Date: Fri Apr 23 13:52:10 2021 +0000
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> ---
>>
>> Xorg works after compiling with the cherry-pick of 525642624783.
> Hi All,
> 
> I compiled and tested the latest git kernel with the new PowerPC updates 5.13-2 today. Unfortunately 
> the Xorg issue still exists.
> If I revert the PowerPC updates 5.13-1 and 5.13-2 then Xorg works without any problems.
> 
> Please check the BookE changes in the PowerPC updates 5.13-1 because my Book3S machines aren't 
> affected by this issue.
> 

On my side, book3e (corenet64_smp_defconfig) built with GCC 10.1 works well with QEMU 2.11.2

A kernel built with the configuration you provided doesn't boot on QEMU, no output at all, even with 
kernel v5.12.

What versions of GCC and QEMU are you using ?

Thanks
Christophe

^ permalink raw reply

* Re: [PATCH v2 1/3] dt-bindings: i2c: mpc: Add fsl, i2c-erratum-a004447 flag
From: Chris Packham @ 2021-05-09 21:08 UTC (permalink / raw)
  To: Rob Herring
  Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	wsa@kernel.org, andy.shevchenko@gmail.com,
	linux-i2c@vger.kernel.org, andriy.shevchenko@linux.intel.com,
	linuxppc-dev@lists.ozlabs.org
In-Reply-To: <20210507214936.GA2944698@robh.at.kernel.org>


On 8/05/21 9:49 am, Rob Herring wrote:
> On Fri, May 07, 2021 at 12:40:45PM +1200, Chris Packham wrote:
>> Document the fsl,i2c-erratum-a004447 flag which indicates the presence
>> of an i2c erratum on some QorIQ SoCs.
>>
>> Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
>> ---
>>   Documentation/devicetree/bindings/i2c/i2c-mpc.yaml | 7 +++++++
>>   1 file changed, 7 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/i2c/i2c-mpc.yaml b/Documentation/devicetree/bindings/i2c/i2c-mpc.yaml
>> index 7b553d559c83..98c6fcf7bf26 100644
>> --- a/Documentation/devicetree/bindings/i2c/i2c-mpc.yaml
>> +++ b/Documentation/devicetree/bindings/i2c/i2c-mpc.yaml
>> @@ -46,6 +46,13 @@ properties:
>>       description: |
>>         I2C bus timeout in microseconds
>>   
>> +  fsl,i2c-erratum-a004447:
>> +    $ref: /schemas/types.yaml#/definitions/flag
>> +    description: |
>> +      Indicates the presence of QorIQ erratum A-004447, which
>> +      says that the standard i2c recovery scheme mechanism does
>> +      not work and an alternate implementation is needed.
> The problem with adding a property for an errata is you have to update
> the dtb. If you use the compatible string, then only an OS update is
> needed. That assumes you have specific enough compatible strings.

I was following the style of the existing fsl,usb-erratum-a007792 or 
fsl,erratum-a008585 properties. But that's not really a compelling reason.

The existing compatible string is "fsl-i2c" and it's used by pretty much 
every powerpc QorIQ SoC. There are some specific compatible strings in 
the driver for some of the older mpc SoCs. A more specific compatible 
string will work although determining which ones are affected might be a 
bit troublesome. That we know of the P2041 and P1010 are affected but I 
suspect there may be more. One disadvantage of using the compatible 
string is that as affected SoCs are identified we'll have to update the 
driver to know that SoC is affected and update the dtb to use it. With 
the property we'd just have to update the dtb.

I'm not too fussed either way so if that's a hard NACK on the property I 
can send a version that uses compatible strings instead.

^ permalink raw reply

* Re: [PATCH v2 2/3] powerpc/fsl: set fsl, i2c-erratum-a004447 flag for P2041 i2c controllers
From: Chris Packham @ 2021-05-09 21:11 UTC (permalink / raw)
  To: Joakim Tjernlund, andy.shevchenko@gmail.com,
	andriy.shevchenko@linux.intel.com, mpe@ellerman.id.au,
	wsa@kernel.org, robh+dt@kernel.org
  Cc: devicetree@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	linux-kernel@vger.kernel.org, paulus@samba.org,
	linux-i2c@vger.kernel.org
In-Reply-To: <cc8d990216e159ee1dd463511d538baf9a6cad1b.camel@infinera.com>


On 7/05/21 8:24 pm, Joakim Tjernlund wrote:
> On Fri, 2021-05-07 at 10:04 +0200, Joakim Tjernlund wrote:
>> On Fri, 2021-05-07 at 12:40 +1200, Chris Packham wrote:
>>> The i2c controllers on the P2040/P2041 have an erratum where the
>>> documented scheme for i2c bus recovery will not work (A-004447). A
>>> different mechanism is needed which is documented in the P2040 Chip
>>> Errata Rev Q (latest available at the time of writing).
>>  From what I can tell this Erratum also applies to P1010
Will add for v3.
>>   Jocke
> Reference: https://media.digikey.com/pdf/PCNs/Freescale/P1010CE_RevL.pdf
>
> Also, I think this series should go to stable.
This series builds on changes that have been merged for v5.13. I haven't 
checked if it applies to stable, I think at least commit 65171b2df15e 
("i2c: mpc: Make use of i2c_recover_bus()") would need to come along 
with it.

^ permalink raw reply

* Re: [FSL P50x0] Xorg always restarts again and again after the the PowerPC updates 5.13-1
From: Christian Zigotzky @ 2021-05-09 21:46 UTC (permalink / raw)
  To: Christophe Leroy
  Cc: Darren Stevens, R.T.Dickinson, mad skateman, linuxppc-dev,
	Christian Zigotzky
In-Reply-To: <fa29dfac-012d-26c3-51b6-2c67af944ecc@csgroup.eu>

On 09 May 2021 at 07:43 pm, Christophe Leroy wrote:
>
> On my side, book3e (corenet64_smp_defconfig) built with GCC 10.1 works 
> well with QEMU 2.11.2
>
> A kernel built with the configuration you provided doesn't boot on 
> QEMU, no output at all, even with kernel v5.12.
>
> What versions of GCC and QEMU are you using ?
>
> Thanks
> Christophe
Hi Christophe,

I use the following QEMU versions (qemu-system-ppc64):

- QEMU 5.0.0 (Debian 1:5.0-5) ELF 32-bit PowerPC with or without KVM on 
Debian Sid 32-bit userland with some 64-bit kernels [1] [3] [11] [12] 
[13] [14] [15] [16] [17]
- QEMU 5.2.0 ELF 64-bit x86_64 on Ubuntu 18.04 64-bit [2]
- QEMU 5.2.0 Mach-O 64-bit on macOS Catalina 10.15.7
- QEMU 5.2.0 on Windows Server 2016 [4] [5] [6] [7] [8] [9] [10]

The kernels work really well with my kernel configuration in QEMU (see 
screenshots [1] - [17]). You can also see the kernel 5.12 in virtual 
QEMU machines in the screenshots.
I work very often with my kernels in e5500 QEMU machines on Linux, 
macOS, and Windows.

I build my kernels with the GCC 7.5.0. We are testing very intensive all 
kernel builds in our test threads [18] [19] [20] and the kernel 5.12 
works very well on our AmigaOnes and in virtual
e5500 QEMU machines.

Cheers,
Christian

[1] 
https://i.pinimg.com/originals/94/a1/56/94a156481ab469dd6cd0eba97bd88855.png
[2] 
https://i.pinimg.com/originals/93/5a/97/935a9792ca4b76b569eeb40857b2162f.png
[3] 
https://i.pinimg.com/originals/c5/0d/85/c50d85d7e8f20b4caa1a439faf751964.png
[4] 
https://i.pinimg.com/originals/cb/1d/12/cb1d12610c197a5e24f4a549c4dc56fe.png
[5] 
https://i.pinimg.com/originals/46/e0/1a/46e01a5ef174cc65420d760b074e2f23.png
[6] 
https://i.pinimg.com/originals/15/3c/9c/153c9cba276542528721d313812f232a.png
[7] 
https://i.pinimg.com/originals/b7/dc/c0/b7dcc0d04d8a7d8e771c888403aa9f6f.png
[8] 
https://i.pinimg.com/originals/1f/37/0e/1f370e80ec9805c93d3bd30c0c3a6926.png
[9] 
https://i.pinimg.com/originals/7c/4b/1a/7c4b1a602a0760865a1722ef1608cedf.png
[10] 
https://i.pinimg.com/originals/c3/89/19/c3891928d359500ab5e7484357b4ab01.png
[11] 
https://i.pinimg.com/originals/e4/53/00/e4530020d4292b36cd1dd22a20f2ba93.png
[12] 
https://i.pinimg.com/originals/fa/92/5b/fa925bbe132caf6d7f84bdc4090690c6.png
[13] 
https://i.pinimg.com/originals/4f/b0/14/4fb01476edd7abe6be1e1203a8e7e152.png
[14] 
https://i.pinimg.com/originals/f1/23/a4/f123a448743b8039b0b5fba320daee7c.png
[15] 
https://i.pinimg.com/originals/6e/3b/59/6e3b59fe10276c5644b15622a81f43f1.png
[16] 
https://i.pinimg.com/originals/f2/a5/e3/f2a5e34e2015381b0cb87cc51232a8bc.png
[17] 
https://i.pinimg.com/originals/57/d9/83/57d98324cd055b7ae00a87ad5a45a42f.png
[18] https://forum.hyperion-entertainment.com/viewtopic.php?f=58&t=4612
[19] https://forum.hyperion-entertainment.com/viewtopic.php?f=35&t=4611
[20] https://forum.hyperion-entertainment.com/viewtopic.php?f=58&t=4564

^ permalink raw reply

* [PATCH] arch: powerpc: kvm: remove unnecessary casting
From: Nour-eddine Taleb @ 2021-05-09 12:00 UTC (permalink / raw)
  To: paulus, mpe, benh; +Cc: linuxppc-dev, linux-kernel, kvm-ppc

remove unnecessary castings, from "void *" to "struct kvmppc_xics *"

Signed-off-by: Nour-eddine Taleb <1337.noureddine@gmail.com>
---
 arch/powerpc/kvm/book3s_xics.c        | 2 +-
 arch/powerpc/kvm/book3s_xive.c        | 2 +-
 arch/powerpc/kvm/book3s_xive_native.c | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/kvm/book3s_xics.c b/arch/powerpc/kvm/book3s_xics.c
index 303e3cb096db..9ae74fa551a6 100644
--- a/arch/powerpc/kvm/book3s_xics.c
+++ b/arch/powerpc/kvm/book3s_xics.c
@@ -1440,7 +1440,7 @@ static int kvmppc_xics_create(struct kvm_device
*dev, u32 type)

 static void kvmppc_xics_init(struct kvm_device *dev)
 {
-    struct kvmppc_xics *xics = (struct kvmppc_xics *)dev->private;
+    struct kvmppc_xics *xics = dev->private;

     xics_debugfs_init(xics);
 }
diff --git a/arch/powerpc/kvm/book3s_xive.c b/arch/powerpc/kvm/book3s_xive.c
index e7219b6f5f9a..05bcaf81a90a 100644
--- a/arch/powerpc/kvm/book3s_xive.c
+++ b/arch/powerpc/kvm/book3s_xive.c
@@ -2242,7 +2242,7 @@ static void xive_debugfs_init(struct kvmppc_xive *xive)

 static void kvmppc_xive_init(struct kvm_device *dev)
 {
-    struct kvmppc_xive *xive = (struct kvmppc_xive *)dev->private;
+    struct kvmppc_xive *xive = dev->private;

     /* Register some debug interfaces */
     xive_debugfs_init(xive);
diff --git a/arch/powerpc/kvm/book3s_xive_native.c
b/arch/powerpc/kvm/book3s_xive_native.c
index 76800c84f2a3..2703432cea78 100644
--- a/arch/powerpc/kvm/book3s_xive_native.c
+++ b/arch/powerpc/kvm/book3s_xive_native.c
@@ -1265,7 +1265,7 @@ static void xive_native_debugfs_init(struct
kvmppc_xive *xive)

 static void kvmppc_xive_native_init(struct kvm_device *dev)
 {
-    struct kvmppc_xive *xive = (struct kvmppc_xive *)dev->private;
+    struct kvmppc_xive *xive = dev->private;

     /* Register some debug interfaces */
     xive_native_debugfs_init(xive);
-- 
2.30.2

^ permalink raw reply related

* Re: Radeon NI: GIT kernel with the nislands_smc commit doesn't boot on a Freescale P5040 board and P.A.Semi Nemo board
From: Gustavo A. R. Silva @ 2021-05-09 23:04 UTC (permalink / raw)
  To: Christian Zigotzky
  Cc: Darren Stevens, R.T.Dickinson, Michel Dänzer, gustavoars,
	Maling list - DRI developers, Olof Johansson, mad skateman,
	alexander.deucher, linuxppc-dev, Christian Zigotzky
In-Reply-To: <9bb5fcbd-daf5-1669-b3e7-b8624b3c36f9@xenosoft.de>

Hi Christian,

On 5/8/21 06:33, Christian Zigotzky wrote:
> Hi Gustavo,
> 
> Your patch works! Thanks a lot! I tested it with my Freescale P5040 board and P.A.Semi Nemo board with a connected AMD Radeon HD6970 NI graphics cards (Cayman
> XT) today.

Awesome! :)

Thank you!
--
Gustavo

> 
> Have a nice day,
> Christian
> 
> 
> On 07 May 2021 at 08:43am, Christian Zigotzky wrote:
>> Hi Gustavo,
>>
>> Great! I will test it. Many thanks for your help.
>>
>> Cheers,
>> Christian
>>
>>
>>> On 7. May 2021, at 01:55, Gustavo A. R. Silva <gustavo@embeddedor.com> wrote:
>>>
>>> Hi Christian,
>>>
>>>> On 4/30/21 06:59, Christian Zigotzky wrote:
>>>> Hello,
>>>>
>>>> The Nemo board (A-EON AmigaOne X1000) [1] and the FSL P5040 Cyrus+ board (A-EON AmigaOne X5000) [2] with installed AMD Radeon HD6970 NI graphics cards (Cayman
>>>> XT) [3] don't boot with the latest git kernel anymore after the commit "drm/radeon/nislands_smc.h: Replace one-element array with flexible-array member in
>>>> struct NISLANDS_SMC_SWSTATE branch" [4].  This git kernel boots in a virtual e5500 QEMU machine with a VirtIO-GPU [5].
>>>>
>>>> I bisected today [6].
>>>>
>>>> Result: drm/radeon/nislands_smc.h: Replace one-element array with flexible-array member in struct NISLANDS_SMC_SWSTATE branch
>>>> (434fb1e7444a2efc3a4ebd950c7f771ebfcffa31) [4] is the first bad commit.
>>> I have a fix ready for this bug:
>>> https://git.kernel.org/pub/scm/linux/kernel/git/gustavoars/linux.git/commit/?h=testing/drm-nislands
>>>
>>> I wonder if you could help me to test it with your environment, please.
>>> It should be applied on top of mainline.
>>>
>>> Thank you!
>>> -- 
>>> Gustavo
>>>
>>>> I was able to revert this commit [7] and after a new compiling, the kernel boots without any problems on my AmigaOnes.
>>>>
>>>> After that I created a patch for reverting this commit for new git test kernels. [3]
>>>>
>>>> The kernel compiles and boots with this patch on my AmigaOnes. Please find attached the kernel config files.
>>>>
>>>> Please check the first bad commit.
>>>>
>>>> Thanks,
>>>> Christian
>>>>
>>>> [1] https://en.wikipedia.org/wiki/AmigaOne_X1000
>>>> [2] http://wiki.amiga.org/index.php?title=X5000
>>>> [3] https://forum.hyperion-entertainment.com/viewtopic.php?f=35&t=4377
>>>> [4] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=434fb1e7444a2efc3a4ebd950c7f771ebfcffa31
>>>> [5] qemu-system-ppc64 -M ppce500 -cpu e5500 -m 1024 -kernel uImage -drive format=raw,file=MintPPC32-X5000.img,index=0,if=virtio -netdev user,id=mynet0 -device
>>>> virtio-net-pci,netdev=mynet0 -append "rw root=/dev/vda" -device virtio-vga -usb -device usb-ehci,id=ehci -device usb-tablet -device virtio-keyboard-pci -smp 4
>>>> -vnc :1
>>>> [6] https://forum.hyperion-entertainment.com/viewtopic.php?p=53074#p53074
>>>> [7] git revert 434fb1e7444a2efc3a4ebd950c7f771ebfcffa3
> 

^ permalink raw reply

* Re: [PATCH v12 6/8] powerpc: Set ARCH_HAS_STRICT_MODULE_RWX
From: Jordan Niethe @ 2021-05-10  0:52 UTC (permalink / raw)
  To: Christophe Leroy
  Cc: ajd, Nicholas Piggin, cmr, Aneesh Kumar K.V, naveen.n.rao,
	linuxppc-dev, Daniel Axtens
In-Reply-To: <3a1eef8c-a982-5321-bb1a-7a4ebe73f1d2@csgroup.eu>

On Fri, May 7, 2021 at 3:35 PM Christophe Leroy
<christophe.leroy@csgroup.eu> wrote:
>
>
>
> Le 06/05/2021 à 04:34, Jordan Niethe a écrit :
> > From: Russell Currey <ruscur@russell.cc>
> >
> > To enable strict module RWX on powerpc, set:
> >
> >      CONFIG_STRICT_MODULE_RWX=y
> >
> > You should also have CONFIG_STRICT_KERNEL_RWX=y set to have any real
> > security benefit.
> >
> > ARCH_HAS_STRICT_MODULE_RWX is set to require ARCH_HAS_STRICT_KERNEL_RWX.
> > This is due to a quirk in arch/Kconfig and arch/powerpc/Kconfig that
> > makes STRICT_MODULE_RWX *on by default* in configurations where
> > STRICT_KERNEL_RWX is *unavailable*.
> >
> > Since this doesn't make much sense, and module RWX without kernel RWX
> > doesn't make much sense, having the same dependencies as kernel RWX
> > works around this problem.
> >
> > With STRICT_MODULE_RWX, now make module_alloc() allocate pages with
> > KERNEL_PAGE protection rather than KERNEL_PAGE_EXEC.
> >
> > Book32s/32 processors with a hash mmu (i.e. 604 core) can not set memory
> > protection on a page by page basis so do not enable.
> >
> > Signed-off-by: Russell Currey <ruscur@russell.cc>
> > [jpn: - predicate on !PPC_BOOK3S_604
> >        - make module_alloc() use PAGE_KERNEL protection]
> > Signed-off-by: Jordan Niethe <jniethe5@gmail.com>
> > ---
> > v10: - Predicate on !PPC_BOOK3S_604
> >       - Make module_alloc() use PAGE_KERNEL protection
> > v11: - Neaten up
> > ---
> >   arch/powerpc/Kconfig         | 1 +
> >   arch/powerpc/kernel/module.c | 4 +++-
> >   2 files changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> > index cce0a137b046..cb5d9d862c35 100644
> > --- a/arch/powerpc/Kconfig
> > +++ b/arch/powerpc/Kconfig
> > @@ -140,6 +140,7 @@ config PPC
> >       select ARCH_HAS_SCALED_CPUTIME          if VIRT_CPU_ACCOUNTING_NATIVE && PPC_BOOK3S_64
> >       select ARCH_HAS_SET_MEMORY
> >       select ARCH_HAS_STRICT_KERNEL_RWX       if ((PPC_BOOK3S_64 || PPC32) && !HIBERNATION)
> > +     select ARCH_HAS_STRICT_MODULE_RWX       if ARCH_HAS_STRICT_KERNEL_RWX && !PPC_BOOK3S_604
> >       select ARCH_HAS_TICK_BROADCAST          if GENERIC_CLOCKEVENTS_BROADCAST
> >       select ARCH_HAS_UACCESS_FLUSHCACHE
> >       select ARCH_HAS_COPY_MC                 if PPC64
> > diff --git a/arch/powerpc/kernel/module.c b/arch/powerpc/kernel/module.c
> > index 3f35c8d20be7..33e4011228b0 100644
> > --- a/arch/powerpc/kernel/module.c
> > +++ b/arch/powerpc/kernel/module.c
> > @@ -92,12 +92,14 @@ int module_finalize(const Elf_Ehdr *hdr,
> >   static __always_inline void *
> >   __module_alloc(unsigned long size, unsigned long start, unsigned long end)
> >   {
> > +     pgprot_t prot = IS_ENABLED(CONFIG_STRICT_MODULE_RWX) ? PAGE_KERNEL :
> > +                                                            PAGE_KERNEL_EXEC;
>
> I'm not sure this test is OK, because strict kernel/module rwx can be disabled at boottime.
> There is a global variable 'rodata_enabled' to reflect that.
>
> We have a helper in powerpc asm/mmu.h called strict_kernel_rwx_enabled() to check it.
Thanks, I will change to that.
>
>
> >       /*
> >        * Don't do huge page allocations for modules yet until more testing
> >        * is done. STRICT_MODULE_RWX may require extra work to support this
> >        * too.
> >        */
> > -     return __vmalloc_node_range(size, 1, start, end, GFP_KERNEL, PAGE_KERNEL_EXEC,
> > +     return __vmalloc_node_range(size, 1, start, end, GFP_KERNEL, prot,
> >                                   VM_FLUSH_RESET_PERMS | VM_NO_HUGE_VMAP,
> >                                   NUMA_NO_NODE, __builtin_return_address(0));
> >   }
> >

^ permalink raw reply

* [PATCH v13 0/8] powerpc: Further Strict RWX support
From: Jordan Niethe @ 2021-05-10  1:18 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: ajd, cmr, npiggin, aneesh.kumar, naveen.n.rao, Jordan Niethe, dja

Adding more Strict RWX support on powerpc, in particular Strict Module RWX.
Thanks for all of the feedback everyone.
It is now rebased on linux-next + powerpc/64s/radix: Enable huge vmalloc mappings
(https://lore.kernel.org/linuxppc-dev/20210503091755.613393-1-npiggin@gmail.com/)

For reference the previous revision is available here: 
https://lore.kernel.org/linuxppc-dev/20210506023449.3568630-1-jniethe5@gmail.com/

The changes in v13 for each patch:

Christophe Leroy (2):
  powerpc/mm: implement set_memory_attr()
  powerpc/32: use set_memory_attr()

Jordan Niethe (3):
  powerpc/lib/code-patching: Set up Strict RWX patching earlier
  powerpc/bpf: Remove bpf_jit_free()
  powerpc/bpf: Write protect JIT code

Russell Currey (3):
  powerpc/mm: Implement set_memory() routines
  powerpc/kprobes: Mark newly allocated probes as ROX
    - v13: Use strict_kernel_rwx_enabled()
  powerpc: Set ARCH_HAS_STRICT_MODULE_RWX
    - v13: Use strict_kernel_rwx_enabled()

 arch/powerpc/Kconfig                  |   2 +
 arch/powerpc/include/asm/set_memory.h |  34 +++++++
 arch/powerpc/kernel/kprobes.c         |  17 ++++
 arch/powerpc/kernel/module.c          |   4 +-
 arch/powerpc/lib/code-patching.c      |  12 +--
 arch/powerpc/mm/Makefile              |   2 +-
 arch/powerpc/mm/pageattr.c            | 133 ++++++++++++++++++++++++++
 arch/powerpc/mm/pgtable_32.c          |  60 ++----------
 arch/powerpc/net/bpf_jit_comp.c       |  13 +--
 9 files changed, 205 insertions(+), 72 deletions(-)
 create mode 100644 arch/powerpc/include/asm/set_memory.h
 create mode 100644 arch/powerpc/mm/pageattr.c

-- 
2.25.1


^ permalink raw reply

* [PATCH v13 1/8] powerpc/mm: Implement set_memory() routines
From: Jordan Niethe @ 2021-05-10  1:18 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: ajd, cmr, npiggin, aneesh.kumar, naveen.n.rao, Jordan Niethe, dja
In-Reply-To: <20210510011828.4006623-1-jniethe5@gmail.com>

From: Russell Currey <ruscur@russell.cc>

The set_memory_{ro/rw/nx/x}() functions are required for
STRICT_MODULE_RWX, and are generally useful primitives to have.  This
implementation is designed to be generic across powerpc's many MMUs.
It's possible that this could be optimised to be faster for specific
MMUs.

This implementation does not handle cases where the caller is attempting
to change the mapping of the page it is executing from, or if another
CPU is concurrently using the page being altered.  These cases likely
shouldn't happen, but a more complex implementation with MMU-specific code
could safely handle them.

On hash, the linear mapping is not kept in the linux pagetable, so this
will not change the protection if used on that range. Currently these
functions are not used on the linear map so just WARN for now.

apply_to_existing_page_range() does not work on huge pages so for now
disallow changing the protection of huge pages.

Reviewed-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Russell Currey <ruscur@russell.cc>
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
[jpn: - Allow set memory functions to be used without Strict RWX
      - Hash: Disallow certain regions
      - Have change_page_attr() take function pointers to manipulate ptes
      - Radix: Add ptesync after set_pte_at()]
Signed-off-by: Jordan Niethe <jniethe5@gmail.com>
---
v10: WARN if trying to change the hash linear map
v11: - Update copywrite dates
     - Allow set memory functions to be used without Strict RWX
     - Hash: Disallow certain regions and add comment explaining why
     - Have change_page_attr() take function pointers to manipulate ptes
     - Clarify change_page_attr()'s comment
     - Radix: Add ptesync after set_pte_at()
v12: - change_page_attr() back to taking an action value
     - disallow operating on huge pages
---
 arch/powerpc/Kconfig                  |   1 +
 arch/powerpc/include/asm/set_memory.h |  32 +++++++++
 arch/powerpc/mm/Makefile              |   2 +-
 arch/powerpc/mm/pageattr.c            | 100 ++++++++++++++++++++++++++
 4 files changed, 134 insertions(+), 1 deletion(-)
 create mode 100644 arch/powerpc/include/asm/set_memory.h
 create mode 100644 arch/powerpc/mm/pageattr.c

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 3f863dd21374..cce0a137b046 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -138,6 +138,7 @@ config PPC
 	select ARCH_HAS_MEMBARRIER_CALLBACKS
 	select ARCH_HAS_MEMBARRIER_SYNC_CORE
 	select ARCH_HAS_SCALED_CPUTIME		if VIRT_CPU_ACCOUNTING_NATIVE && PPC_BOOK3S_64
+	select ARCH_HAS_SET_MEMORY
 	select ARCH_HAS_STRICT_KERNEL_RWX	if ((PPC_BOOK3S_64 || PPC32) && !HIBERNATION)
 	select ARCH_HAS_TICK_BROADCAST		if GENERIC_CLOCKEVENTS_BROADCAST
 	select ARCH_HAS_UACCESS_FLUSHCACHE
diff --git a/arch/powerpc/include/asm/set_memory.h b/arch/powerpc/include/asm/set_memory.h
new file mode 100644
index 000000000000..64011ea444b4
--- /dev/null
+++ b/arch/powerpc/include/asm/set_memory.h
@@ -0,0 +1,32 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _ASM_POWERPC_SET_MEMORY_H
+#define _ASM_POWERPC_SET_MEMORY_H
+
+#define SET_MEMORY_RO	0
+#define SET_MEMORY_RW	1
+#define SET_MEMORY_NX	2
+#define SET_MEMORY_X	3
+
+int change_memory_attr(unsigned long addr, int numpages, long action);
+
+static inline int set_memory_ro(unsigned long addr, int numpages)
+{
+	return change_memory_attr(addr, numpages, SET_MEMORY_RO);
+}
+
+static inline int set_memory_rw(unsigned long addr, int numpages)
+{
+	return change_memory_attr(addr, numpages, SET_MEMORY_RW);
+}
+
+static inline int set_memory_nx(unsigned long addr, int numpages)
+{
+	return change_memory_attr(addr, numpages, SET_MEMORY_NX);
+}
+
+static inline int set_memory_x(unsigned long addr, int numpages)
+{
+	return change_memory_attr(addr, numpages, SET_MEMORY_X);
+}
+
+#endif
diff --git a/arch/powerpc/mm/Makefile b/arch/powerpc/mm/Makefile
index c3df3a8501d4..9142cf1fb0d5 100644
--- a/arch/powerpc/mm/Makefile
+++ b/arch/powerpc/mm/Makefile
@@ -5,7 +5,7 @@
 
 ccflags-$(CONFIG_PPC64)	:= $(NO_MINIMAL_TOC)
 
-obj-y				:= fault.o mem.o pgtable.o mmap.o maccess.o \
+obj-y				:= fault.o mem.o pgtable.o mmap.o maccess.o pageattr.o \
 				   init_$(BITS).o pgtable_$(BITS).o \
 				   pgtable-frag.o ioremap.o ioremap_$(BITS).o \
 				   init-common.o mmu_context.o drmem.o \
diff --git a/arch/powerpc/mm/pageattr.c b/arch/powerpc/mm/pageattr.c
new file mode 100644
index 000000000000..acfdde78e0fb
--- /dev/null
+++ b/arch/powerpc/mm/pageattr.c
@@ -0,0 +1,100 @@
+// SPDX-License-Identifier: GPL-2.0
+
+/*
+ * MMU-generic set_memory implementation for powerpc
+ *
+ * Copyright 2019-2021, IBM Corporation.
+ */
+
+#include <linux/mm.h>
+#include <linux/vmalloc.h>
+#include <linux/set_memory.h>
+
+#include <asm/mmu.h>
+#include <asm/page.h>
+#include <asm/pgtable.h>
+
+
+/*
+ * Updates the attributes of a page in three steps:
+ *
+ * 1. invalidate the page table entry
+ * 2. flush the TLB
+ * 3. install the new entry with the updated attributes
+ *
+ * Invalidating the pte means there are situations where this will not work
+ * when in theory it should.
+ * For example:
+ * - removing write from page whilst it is being executed
+ * - setting a page read-only whilst it is being read by another CPU
+ *
+ */
+static int change_page_attr(pte_t *ptep, unsigned long addr, void *data)
+{
+	long action = (long)data;
+	pte_t pte;
+
+	spin_lock(&init_mm.page_table_lock);
+
+	/* invalidate the PTE so it's safe to modify */
+	pte = ptep_get_and_clear(&init_mm, addr, ptep);
+	flush_tlb_kernel_range(addr, addr + PAGE_SIZE);
+
+	/* modify the PTE bits as desired, then apply */
+	switch (action) {
+	case SET_MEMORY_RO:
+		pte = pte_wrprotect(pte);
+		break;
+	case SET_MEMORY_RW:
+		pte = pte_mkwrite(pte_mkdirty(pte));
+		break;
+	case SET_MEMORY_NX:
+		pte = pte_exprotect(pte);
+		break;
+	case SET_MEMORY_X:
+		pte = pte_mkexec(pte);
+		break;
+	default:
+		WARN_ON_ONCE(1);
+		break;
+	}
+
+	set_pte_at(&init_mm, addr, ptep, pte);
+
+	/* See ptesync comment in radix__set_pte_at() */
+	if (radix_enabled())
+		asm volatile("ptesync": : :"memory");
+	spin_unlock(&init_mm.page_table_lock);
+
+	return 0;
+}
+
+int change_memory_attr(unsigned long addr, int numpages, long action)
+{
+	unsigned long start = ALIGN_DOWN(addr, PAGE_SIZE);
+	unsigned long size = numpages * PAGE_SIZE;
+
+	if (!numpages)
+		return 0;
+
+	if (WARN_ON_ONCE(is_vm_area_hugepages((void *)addr)))
+		return -EINVAL;
+
+#ifdef CONFIG_PPC_BOOK3S_64
+	/*
+	 * On hash, the linear mapping is not in the Linux page table so
+	 * apply_to_existing_page_range() will have no effect. If in the future
+	 * the set_memory_* functions are used on the linear map this will need
+	 * to be updated.
+	 */
+	if (!radix_enabled()) {
+		int region = get_region_id(addr);
+
+		if (WARN_ON_ONCE(region != VMALLOC_REGION_ID && region != IO_REGION_ID))
+			return -EINVAL;
+	}
+#endif
+
+	return apply_to_existing_page_range(&init_mm, start, size,
+					    change_page_attr, (void *)action);
+}
-- 
2.25.1


^ permalink raw reply related

* [PATCH v13 2/8] powerpc/lib/code-patching: Set up Strict RWX patching earlier
From: Jordan Niethe @ 2021-05-10  1:18 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: ajd, cmr, npiggin, aneesh.kumar, naveen.n.rao, Jordan Niethe, dja
In-Reply-To: <20210510011828.4006623-1-jniethe5@gmail.com>

setup_text_poke_area() is a late init call so it runs before
mark_rodata_ro() and after the init calls. This lets all the init code
patching simply write to their locations. In the future, kprobes is
going to allocate its instruction pages RO which means they will need
setup_text__poke_area() to have been already called for their code
patching. However, init_kprobes() (which allocates and patches some
instruction pages) is an early init call so it happens before
setup_text__poke_area().

start_kernel() calls poking_init() before any of the init calls. On
powerpc, poking_init() is currently a nop. setup_text_poke_area() relies
on kernel virtual memory, cpu hotplug and per_cpu_areas being setup.
setup_per_cpu_areas(), boot_cpu_hotplug_init() and mm_init() are called
before poking_init().

Turn setup_text_poke_area() into poking_init().

Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Reviewed-by: Russell Currey <ruscur@russell.cc>
Signed-off-by: Jordan Niethe <jniethe5@gmail.com>
---
v9: New to series
---
 arch/powerpc/lib/code-patching.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/arch/powerpc/lib/code-patching.c b/arch/powerpc/lib/code-patching.c
index 870b30d9be2f..15296207e1ba 100644
--- a/arch/powerpc/lib/code-patching.c
+++ b/arch/powerpc/lib/code-patching.c
@@ -70,14 +70,11 @@ static int text_area_cpu_down(unsigned int cpu)
 }
 
 /*
- * Run as a late init call. This allows all the boot time patching to be done
- * simply by patching the code, and then we're called here prior to
- * mark_rodata_ro(), which happens after all init calls are run. Although
- * BUG_ON() is rude, in this case it should only happen if ENOMEM, and we judge
- * it as being preferable to a kernel that will crash later when someone tries
- * to use patch_instruction().
+ * Although BUG_ON() is rude, in this case it should only happen if ENOMEM, and
+ * we judge it as being preferable to a kernel that will crash later when
+ * someone tries to use patch_instruction().
  */
-static int __init setup_text_poke_area(void)
+int __init poking_init(void)
 {
 	BUG_ON(!cpuhp_setup_state(CPUHP_AP_ONLINE_DYN,
 		"powerpc/text_poke:online", text_area_cpu_up,
@@ -85,7 +82,6 @@ static int __init setup_text_poke_area(void)
 
 	return 0;
 }
-late_initcall(setup_text_poke_area);
 
 /*
  * This can be called for kernel text or a module.
-- 
2.25.1


^ permalink raw reply related

* [PATCH v13 3/8] powerpc/kprobes: Mark newly allocated probes as ROX
From: Jordan Niethe @ 2021-05-10  1:18 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: ajd, cmr, npiggin, aneesh.kumar, naveen.n.rao, Jordan Niethe, dja
In-Reply-To: <20210510011828.4006623-1-jniethe5@gmail.com>

From: Russell Currey <ruscur@russell.cc>

Add the arch specific insn page allocator for powerpc. This allocates
ROX pages if STRICT_KERNEL_RWX is enabled. These pages are only written
to with patch_instruction() which is able to write RO pages.

Reviewed-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Russell Currey <ruscur@russell.cc>
Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
[jpn: Reword commit message, switch to __vmalloc_node_range()]
Signed-off-by: Jordan Niethe <jniethe5@gmail.com>
---
v9: - vmalloc_exec() no longer exists
    - Set the page to RW before freeing it
v10: - use __vmalloc_node_range()
v11: - Neaten up
v12: - Switch from __vmalloc_node_range() to module_alloc()
v13: Use strict_kernel_rwx_enabled()
---
 arch/powerpc/kernel/kprobes.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c
index 01ab2163659e..b517f3e6e7c5 100644
--- a/arch/powerpc/kernel/kprobes.c
+++ b/arch/powerpc/kernel/kprobes.c
@@ -19,11 +19,13 @@
 #include <linux/extable.h>
 #include <linux/kdebug.h>
 #include <linux/slab.h>
+#include <linux/moduleloader.h>
 #include <asm/code-patching.h>
 #include <asm/cacheflush.h>
 #include <asm/sstep.h>
 #include <asm/sections.h>
 #include <asm/inst.h>
+#include <asm/set_memory.h>
 #include <linux/uaccess.h>
 
 DEFINE_PER_CPU(struct kprobe *, current_kprobe) = NULL;
@@ -103,6 +105,21 @@ kprobe_opcode_t *kprobe_lookup_name(const char *name, unsigned int offset)
 	return addr;
 }
 
+void *alloc_insn_page(void)
+{
+	void *page;
+
+	page = module_alloc(PAGE_SIZE);
+	if (!page)
+		return NULL;
+
+	if (strict_kernel_rwx_enabled()) {
+		set_memory_ro((unsigned long)page, 1);
+		set_memory_x((unsigned long)page, 1);
+	}
+	return page;
+}
+
 int arch_prepare_kprobe(struct kprobe *p)
 {
 	int ret = 0;
-- 
2.25.1


^ permalink raw reply related

* [PATCH v13 4/8] powerpc/bpf: Remove bpf_jit_free()
From: Jordan Niethe @ 2021-05-10  1:18 UTC (permalink / raw)
  To: linuxppc-dev
  Cc: ajd, cmr, npiggin, aneesh.kumar, naveen.n.rao, Jordan Niethe, dja
In-Reply-To: <20210510011828.4006623-1-jniethe5@gmail.com>

Commit 74451e66d516 ("bpf: make jited programs visible in traces") added
a default bpf_jit_free() implementation. Powerpc did not use the default
bpf_jit_free() as powerpc did not set the images read-only. The default
bpf_jit_free() called bpf_jit_binary_unlock_ro() is why it could not be
used for powerpc.

Commit d53d2f78cead ("bpf: Use vmalloc special flag") moved keeping
track of read-only memory to vmalloc. This included removing
bpf_jit_binary_unlock_ro(). Therefore there is no reason powerpc needs
its own bpf_jit_free(). Remove it.

Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Jordan Niethe <jniethe5@gmail.com>
---
v11: New to series
---
 arch/powerpc/net/bpf_jit_comp.c | 12 ------------
 1 file changed, 12 deletions(-)

diff --git a/arch/powerpc/net/bpf_jit_comp.c b/arch/powerpc/net/bpf_jit_comp.c
index 798ac4350a82..6c8c268e4fe8 100644
--- a/arch/powerpc/net/bpf_jit_comp.c
+++ b/arch/powerpc/net/bpf_jit_comp.c
@@ -257,15 +257,3 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *fp)
 
 	return fp;
 }
-
-/* Overriding bpf_jit_free() as we don't set images read-only. */
-void bpf_jit_free(struct bpf_prog *fp)
-{
-	unsigned long addr = (unsigned long)fp->bpf_func & PAGE_MASK;
-	struct bpf_binary_header *bpf_hdr = (void *)addr;
-
-	if (fp->jited)
-		bpf_jit_binary_free(bpf_hdr);
-
-	bpf_prog_unlock_free(fp);
-}
-- 
2.25.1


^ 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