New kernels

AmigaOne X5000 platform specific issues related to Linux only.
Post Reply
User avatar
xeno74
Posts: 9320
Joined: Fri Mar 23, 2012 7:58 am

New kernels

Post by xeno74 »

Hi All,

I will post the test kernels in this thread in the future.

The merge window for 5.16 has been started and here is the first alpha for testing.

New:
Download: linux-image-5.16-alpha1-X1000_X5000.tar.gz

Image

Please test the alpha1.

Thanks,
Christian
http://www.amigalinux.org
http://www.supertuxkart-amiga.de

Running Linux on AmigaONEs can require some tinkering.
User avatar
xeno74
Posts: 9320
Joined: Fri Mar 23, 2012 7:58 am

Re: New kernels

Post by xeno74 »

Hi All,

I released the second alpha of kernel 5.16 for the X1000 and X5000 today.

New:
Download: linux-image-5.16-alpha2-X1000_X5000.tar.gz

Image

FYI: Xorg doesn't start anymore in a virtual e5500 QEMU KVM HV machine with the VirtIO GPU.

Error messages on MintPPC:

Code: Select all

Debian GNU/Linux bullseye/sid debian ttyS0

debian login: BUG: Kernel NULL pointer dereference on read at 0x00000018
Faulting instruction address: 0xc00000000075055c
Oops: Kernel access of bad area, sig: 11 [#1]
BE PAGE_SIZE=4K SMP NR_CPUS=4 QEMU e500
Modules linked in:
CPU: 0 PID: 2418 Comm: Xorg Not tainted 5.16.0-a2_A-EON_X5000-07264-gff0700f03609-dirty #1
NIP:  c00000000075055c LR: c000000000750550 CTR: c000000000750548
REGS: c00000000ae737f0 TRAP: 0300   Not tainted  (5.16.0-a2_A-EON_X5000-07264-gff0700f03609-dirty)
MSR:  0000000090029002 <CE,EE,ME>  CR: 24022288  XER: 00000000
DEAR: 0000000000000018 ESR: 0000000000000000 IRQMASK: 0 
GPR00: c0000000001bd678 c00000000ae73a90 c000000001993600 c00000000a077000 
GPR04: c00000000ae73c10 0000000000000001 c00000000a098270 c00000000cafc400 
GPR08: c0000000017f2f88 0000000000000000 c0000000018e2418 018c3e5000413614 
GPR12: 0000000084082282 c000000001a68000 00000000ffaee5a4 0000000000ee613c 
GPR16: 0000000000efa53c 0000000000ca5040 000000000000000c 0000000000000000 
GPR20: c000000002892598 c00000000a077030 0000000000000000 000000000a077000 
GPR24: 000000000af9d300 c00000000af9d300 0000000000000000 c00000000a077000 
GPR28: c00000000a448280 c000000002892580 c00000000a098260 c00000000a5aa400 
NIP [c00000000075055c] .virtio_gpu_poll+0x14/0x134
LR [c000000000750550] .virtio_gpu_poll+0x8/0x134
Call Trace:
[c00000000ae73a90] [c00000000ae73b10] 0xc00000000ae73b10 (unreliable)
[c00000000ae73b20] [c0000000001bd678] .ep_item_poll+0x5c/0x80
[c00000000ae73ba0] [c0000000001beb5c] .do_epoll_ctl+0x604/0x878
[c00000000ae73ca0] [c0000000001bee14] .__se_sys_epoll_ctl+0x44/0x8c
[c00000000ae73d50] [c00000000000b0d4] .system_call_exception+0x11c/0x148
[c00000000ae73e10] [c0000000000001f8] system_call_common+0xf0/0x210
--- interrupt: c00 at 0x33c634
NIP:  000000000033c634 LR: 0000000000e11ea8 CTR: 0000000000000000
REGS: c00000000ae73e80 TRAP: 0c00   Not tainted  (5.16.0-a2_A-EON_X5000-07264-gff0700f03609-dirty)
MSR:  000000001002d002 <CE,EE,PR,ME>  CR: 46000224  XER: 00000000
IRQMASK: 0 
GPR00: 00000000000000ed 00000000ffaee3d0 00000000f7aa8340 0000000000000003 
GPR04: 0000000000000001 000000000000000c 00000000ffaee3e8 00000000018c3e48 
GPR08: 0000000000000011 0000000000000000 0000000000000000 0000000000000000 
GPR12: 0000000000000000 0000000000edfff4 00000000ffaee5a4 0000000000ee613c 
GPR16: 0000000000efa53c 0000000000ca5040 0000000000000000 0000000000c97330 
GPR20: 0000000000c9b800 00000000fffffffc 0000000000000003 0000000001641fb0 
GPR24: 000000000174f270 0000000000e0c800 0000000000000001 000000000000000c 
GPR28: 0000000001642220 00000000018c3e50 0000000000ee7628 0000000000000003 
NIP [000000000033c634] 0x33c634
LR [0000000000e11ea8] 0xe11ea8
--- interrupt: c00
Instruction dump:
48000ad9 60000000 7fe3fb78 4befb0f5 60000000 38210080 485fbc44 7c0802a6 
485fbbcd f821ff71 ebe300c0 e93f0088 <e9290018> 2fa90000 40de001c 4bef71fd 
---[ end trace 24595e2ea6e47c05 ]---
Error messages on Void PPC:

Code: Select all

=> Initialization complete, running stage 2...
- runit: leave stage: /etc/runit/1
- runit: enter stage: /etc/runit/2
runsvchdir: default: current.
urandom_read: 1 callbacks suppressed
random: dbus-daemon: uninitialized urandom read (12 bytes read)
udevd[2362]: starting version 3.2.10
udevd[2362]: starting eudev-3.2.10
elogind-daemon[2441]: New seat seat0.
elogind-daemon[2441]: Watching system buttons on /dev/input/event1 (QEMU Virtio Keyboard)
BUG: Kernel NULL pointer dereference on read at 0x00000018
Faulting instruction address: 0xc00000000075055c
Oops: Kernel access of bad area, sig: 11 [#1]
BE PAGE_SIZE=4K SMP NR_CPUS=4 QEMU e500
Modules linked in:
CPU: 0 PID: 2443 Comm: Xorg Not tainted 5.16.0-a2_A-EON_X5000-07264-gff0700f03609-dirty #1
NIP:  c00000000075055c LR: c000000000750550 CTR: c000000000750548
REGS: c00000000a7ab7f0 TRAP: 0300   Not tainted  (5.16.0-a2_A-EON_X5000-07264-gff0700f03609-dirty)
MSR:  0000000090029002 <CE,EE,ME>  CR: 24022288  XER: 00000000
DEAR: 0000000000000018 ESR: 0000000000000000 IRQMASK: 0
GPR00: c0000000001bd678 c00000000a7aba90 c000000001993600 c0000000028da400 
GPR04: c00000000a7abc10 0000000000000001 c000000009a55800 c0000000028c2900 
GPR08: c0000000017f2f88 0000000000000000 c0000000018e2418 00e8bdf0003205d4 
GPR12: 0000000084082282 c000000001a68000 0000000000a53230 0000000000000000 
GPR16: 0000000000000001 00000000009435d4 000000000000000b 0000000000000000 
GPR20: c00000000a98cc98 c0000000028da430 0000000000000000 00000000028da400 
GPR24: 000000000a036600 c00000000a036600 0000000000000000 c0000000028da400 
GPR28: c000000009a55800 c00000000a98cc80 c00000000a02a210 c000000009b0b200 
NIP [c00000000075055c] .virtio_gpu_poll+0x14/0x134
LR [c000000000750550] .virtio_gpu_poll+0x8/0x134
Call Trace:
[c00000000a7aba90] [c00000000a7abb10] 0xc00000000a7abb10 (unreliable)
[c00000000a7abb20] [c0000000001bd678] .ep_item_poll+0x5c/0x80
[c00000000a7abba0] [c0000000001beb5c] .do_epoll_ctl+0x604/0x878
[c00000000a7abca0] [c0000000001bee14] .__se_sys_epoll_ctl+0x44/0x8c
[c00000000a7abd50] [c00000000000b0d4] .system_call_exception+0x11c/0x148
[c00000000a7abe10] [c0000000000001f8] system_call_common+0xf0/0x210
-- interrupt: c00 at 0x24f008
NIP:  000000000024f008 LR: 000000000099e7d4 CTR: 0000000000000000
REGS: c00000000a7abe80 TRAP: 0c00   Not tainted  (5.16.0-a2_A-EON_X5000-07264-gff0700f03609-dirty)
MSR:  000000001002f002 <CE,EE,PR,FP,ME>  CR: 46004224  XER: 00000000
IRQMASK: 0 
GPR00: 00000000000000ed 00000000ffb83460 00000000f7a25f60 0000000000000003 
GPR04: 0000000000000001 000000000000000b 00000000ffb83478 000000000032061c 
GPR08: 0000000000e8bdf0 0000000000000000 0000000000000000 0000000000000000 
GPR12: 0000000000000000 0000000000a4fff4 0000000000a53230 0000000000000000 
GPR16: 0000000000000001 00000000009435d4 000000000094d848 000000000092ab90 
GPR20: 0000000000a883e8 00000000fffffffd 0000000000e5edd0 0000000000e8bc60 
GPR24: 0000000000904534 0000000000000001 000000000000000b 0000000000000002 
GPR28: 0000000000e5f200 0000000000e8bdf0 0000000000a57b74 0000000000000002 
NIP [000000000024f008] 0x24f008
LR [000000000099e7d4] 0x99e7d4
--- interrupt: c00
Instruction dump:
48000ad9 60000000 7fe3fb78 4befb0f5 60000000 38210080 485fbc44 7c0802a6 
485fbbcd f821ff71 ebe300c0 e93f0088 <e9290018> 2fa90000 40de001c 4bef71fd 
---[ end trace ece66d7be00861fa ]---
I reverted the VirtIO GPU changes in the latest DRM updates. After that, the VirtIO GPU works without any problems.

Download of the alpha2 of kernel 5.16 without the VirtIO GPU updates: uImage-virtiogpu

I reported this issue to the kernel developers today. Link:

[VirtIO GPU] Xorg doesn't start with the DRM updates 'drm-next-2021-11-03' in a virtual e5500 QEMU KVM-HV machine on a Freescale P5040 board

Please test the kernels.

Thanks,
Christian
http://www.amigalinux.org
http://www.supertuxkart-amiga.de

Running Linux on AmigaONEs can require some tinkering.
User avatar
xeno74
Posts: 9320
Joined: Fri Mar 23, 2012 7:58 am

Re: New kernels

Post by xeno74 »

Hi All,

Vivek Kasireddy has released a patch because of the VirtIO GPU issue. :-)
He wrote: [PATCH] drm/virtio: Fix NULL dereference error in virtio_gpu_poll

When virgl is not enabled, vfpriv pointer would not be allocated.
Therefore, check for a valid value before dereferencing.

Reported-by: Christian Zigotzky <chzigotzky@xenosoft.de>
Cc: Gurchetan Singh <gurchetansingh@chromium.org>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Vivek Kasireddy <vivek.kasireddy@intel.com>

Code: Select all

drivers/gpu/drm/virtio/virtgpu_drv.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.c b/drivers/gpu/drm/virtio/virtgpu_drv.c
index 749db18dcfa2..d86e1ad4a972 100644
--- a/drivers/gpu/drm/virtio/virtgpu_drv.c
+++ b/drivers/gpu/drm/virtio/virtgpu_drv.c
@@ -163,10 +163,11 @@ static __poll_t virtio_gpu_poll(struct file *filp,
   struct drm_file *drm_file = filp->private_data;
   struct virtio_gpu_fpriv *vfpriv = drm_file->driver_priv;
   struct drm_device *dev = drm_file->minor->dev;
+    struct virtio_gpu_device *vgdev = dev->dev_private;
   struct drm_pending_event *e = NULL;
   __poll_t mask = 0;

-    if (!vfpriv->ring_idx_mask)
+    if (!vgdev->has_virgl_3d || !vfpriv || !vfpriv->ring_idx_mask)
       return drm_poll(filp, wait);

   poll_wait(filp, &drm_file->event_wait, wait);
Cheers,
Christian
http://www.amigalinux.org
http://www.supertuxkart-amiga.de

Running Linux on AmigaONEs can require some tinkering.
User avatar
kilaueabart
Posts: 1070
Joined: Mon Mar 05, 2012 2:36 am

Re: New kernels

Post by kilaueabart »

16a2.png
"Dirty" though it may be, 5.16 alpha2 seems to work!

Am I just lucky I have no idea what VirtIO GPU is all about?
User avatar
xeno74
Posts: 9320
Joined: Fri Mar 23, 2012 7:58 am

Re: New kernels

Post by xeno74 »

kilaueabart wrote: Fri Nov 05, 2021 7:48 pm "Dirty" though it may be, 5.16 alpha2 seems to work!
Great! Thanks a lot for testing and many thanks for the screenshot! :-)
kilaueabart wrote: Fri Nov 05, 2021 7:48 pm Am I just lucky I have no idea what VirtIO GPU is all about?
This is a virtual GPU (graphics card) for virtual machines. It's only important for you if you use the X5000 Linux kernel in a virtual e5500 QEMU machine.
http://www.amigalinux.org
http://www.supertuxkart-amiga.de

Running Linux on AmigaONEs can require some tinkering.
User avatar
xeno74
Posts: 9320
Joined: Fri Mar 23, 2012 7:58 am

Re: New kernels

Post by xeno74 »

Hi All,

Here is the third alpha of kernel 5.16 for testing.

New:
Download: linux-image-5.16-alpha3-X1000_X5000.tar.gz

Image

Please test the kernels.

Thanks,
Christian
http://www.amigalinux.org
http://www.supertuxkart-amiga.de

Running Linux on AmigaONEs can require some tinkering.
User avatar
xeno74
Posts: 9320
Joined: Fri Mar 23, 2012 7:58 am

Re: New kernels

Post by xeno74 »

Hi All,

I released the stable longterm kernel 5.15.1 today.

New:
Download: linux-image-5.15.1-X1000_X5000.tar.gz

Image

Please test the kernels.

Thanks,
Christian
http://www.amigalinux.org
http://www.supertuxkart-amiga.de

Running Linux on AmigaONEs can require some tinkering.
User avatar
kilaueabart
Posts: 1070
Joined: Mon Mar 05, 2012 2:36 am

Re: New kernels

Post by kilaueabart »

Running Fienix with 5.16.0 alpha3 right now. About to download and replace 5.15.0 with 5.15.1.
User avatar
xeno74
Posts: 9320
Joined: Fri Mar 23, 2012 7:58 am

Re: New kernels

Post by xeno74 »

kilaueabart wrote: Sun Nov 07, 2021 10:01 pm Running Fienix with 5.16.0 alpha3 right now. About to download and replace 5.15.0 with 5.15.1.
Thank you for testing! :-)
http://www.amigalinux.org
http://www.supertuxkart-amiga.de

Running Linux on AmigaONEs can require some tinkering.
User avatar
xeno74
Posts: 9320
Joined: Fri Mar 23, 2012 7:58 am

Re: New kernels

Post by xeno74 »

Hi All,

I compiled the latest Git kernel (alpha4) with the new PowerPC updates 5.16-1 today. Unfortunately this kernel doesn't boot on the X5000. The X1000 and the virtual e5500 QEMU KVM-HV machine boots with this kernel.

I was able to revert the new PowerPC updates 5.16-1 with the following command.

Code: Select all

git revert 5c0b0c676ac2d84f69568715af91e45b610fe17a -m 1
After a new compiling, the kernel boots without any problems on my X5000.

I bisected today.

About bisecting:
Git bisect is like a little wizard that walks you through recent commits, asks you if they are good or bad, and narrows down the broken commit.
Git bisect starts with the midpoint commit. The midpoint commit is between the initial “good” commit and the initial “bad” commit.
If the midpoint commit was good, you know the commit that introduced the change is between your midpoint and the initial “bad” commit.
If the midpoint commit was bad, you know the commit that introduced the change is between your midpoint and the initial “good” commit.
After that git bisect selects a new midpoint in the area where the commit was bad. And this is repeated over and over again till the bad commit has been found.
  1. Code: Select all

    git bisect start
  2. Code: Select all

    git bisect good 8bb7eca972ad531c9b149c0a51ab43a417385813
    (Good: Linux 5.15)
  3. Code: Select all

    git bisect bad c80be257a4cd0f72c083e6056ff0ce2da871e9dc
    (Bad: i2c: xgene-slimpro: Fix wrong pointer passed to PTR_ERR() -- 2021-11-06 22:09:37 +0100)
    Output:

    Code: Select all

    [464fddbba1dfbc219f1e9145127a482d2159dee5] Merge tag 'pnp-5.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
  4. git bisect good
    Output:

    Code: Select all

    [2219b0ceefe835b92a8a74a73fe964aa052742a2] Merge tag 'soc-5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc
  5. git bisect good
    Output:

    Code: Select all

    [048ff8629e117d8411a787559417c781bcd78d7e] Merge tag 'usb-5.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
  6. git bisect good
    Output:

    Code: Select all

    [5c904c66ed4e86c31ac7c033b64274cebed04e0e] Merge tag 'char-misc-5.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
  7. git bisect good
    Output:

    Code: Select all

    [a51e4a1acb5fa4ce0b0f0bd3606463a09e6fa1b0] Merge tag 'microblaze-v5.16' of git://git.monstr.eu/linux-2.6-microblaze[
  8. git bisect bad
    Output:

    Code: Select all

    [abfecb39092029c42c79bacac3d1c96a133ff231] Merge tag 'tty-5.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty[
  9. git bisect good
    Output:

    Code: Select all

    [a3f36773802d44d1e50e7c4c09b3e17018581d11] Merge tag 'mips_5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux
  10. git bisect good
    Output:

    Code: Select all

    [e9efabc6e4c31517394be13c2f0c5abadd33f328] powerpc/5200: dts: add missing pci ranges
  11. git bisect bad
    Output:

    Code: Select all

    [02b182e67482d9167a13a0ff19b55037b70b21ad] powerpc/perf: Refactor the code definition of perf reg extended mask
  12. git bisect good
    Output:

    Code: Select all

    [7453f501d443c7febf48809ee1c530b64d625c59] powerpc/kexec_file: Add of_node_put() before goto
  13. git bisect good
    Output:

    Code: Select all

    [52bda69ae8b5102fe08c9db10f4a1514478e07d3] powerpc/fsl_booke: Tell map_mem_in_cams() if init is done
  14. git bisect bad
    Output:

    Code: Select all

    [3a75fd709c89cb45b8b1044b8ef0d15027a69f9b] powerpc/fsl_booke: Rename fsl_booke.c to fsl_book3e.c
  15. git bisect good
    Output:

    Code: Select all

    [a97dd9e2f760c6996a8f1385ddab0bfef325b364] powerpc/fsl_booke: Enable reloading of TLBCAM without switching to AS1
  16. git bisect good
    Output:

    Code: Select all

    52bda69ae8b5102fe08c9db10f4a1514478e07d3 is the first bad commit
    commit 52bda69ae8b5102fe08c9db10f4a1514478e07d3
    Author: Christophe Leroy <christophe.leroy@csgroup.eu>
    Date:   Fri Oct 15 12:02:46 2021 +0200
    
        powerpc/fsl_booke: Tell map_mem_in_cams() if init is done
        
        In order to be able to call map_mem_in_cams() once more
        after init for STRICT_KERNEL_RWX, add an argument.
        
        For now, map_mem_in_cams() is always called only during init.
        
        Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
        Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
        Link: https://lore.kernel.org/r/3b69a7e0b393b16984ade882a5eae5d727717459.1634292136.git.christophe.leroy@csgroup.eu
    
    :040000 040000 69b8a7cae22a3a39041496805966209b80fee142 bc4d2d8fa43e7495d1373e5fd792f529cd42265f M	arch
Result: 52bda69ae8b5102fe08c9db10f4a1514478e07d3 is the first bad commit.

I was able to revert the first bad commit.

Code: Select all

git revert 52bda69ae8b5102fe08c9db10f4a1514478e07d3
Output:

Code: Select all

[master c86db5684d55] Revert "powerpc/fsl_booke: Tell map_mem_in_cams() if init is done"
 4 files changed, 10 insertions(+), 10 deletions(-)
Unfortunately it didn't compile.

Error messages:

Code: Select all

arch/powerpc/mm/nohash/fsl_book3e.c: In function ‘map_mem_in_cams_addr’:
arch/powerpc/mm/nohash/fsl_book3e.c:185:19: error: ‘init’ undeclared (first use in this function); did you mean ‘int’?
   pgprot_t prot = init ? PAGE_KERNEL_X : PAGE_KERNEL_ROX;
                   ^~~~
                   int
I had to revert the commit d5970045cf9e266d9a43941ac0866865fd22a36a additionally. I found this commit in the PowerPC Git tree.

Code: Select all

git revert d5970045cf9e266d9a43941ac0866865fd22a36a
Output:

Code: Select all

[master 053a1c6288f5] Revert "powerpc/fsl_booke: Update of TLBCAMs after init"
 2 files changed, 5 insertions(+), 29 deletions(-)
After a new compiling, the kernel boots without any problems.

I created a patch for reverting the bad commit.

Code: Select all

diff -rupN a b > fsl_booke.patch

fsl_booke.patch:

Code: Select all

diff -rupN a/arch/powerpc/mm/mmu_decl.h b/arch/powerpc/mm/mmu_decl.h
--- a/arch/powerpc/mm/mmu_decl.h	2021-11-08 14:46:04.841131156 +0100
+++ b/arch/powerpc/mm/mmu_decl.h	2021-11-08 14:45:12.441244455 +0100
@@ -126,7 +126,7 @@ unsigned long mmu_mapin_ram(unsigned lon
 
 #ifdef CONFIG_PPC_FSL_BOOK3E
 extern unsigned long map_mem_in_cams(unsigned long ram, int max_cam_idx,
-				     bool dryrun, bool init);
+				     bool dryrun);
 extern unsigned long calc_cam_sz(unsigned long ram, unsigned long virt,
 				 phys_addr_t phys);
 #ifdef CONFIG_PPC32
@@ -168,7 +168,7 @@ static inline phys_addr_t v_block_mapped
 static inline unsigned long p_block_mapped(phys_addr_t pa) { return 0; }
 #endif
 
-#if defined(CONFIG_PPC_BOOK3S_32) || defined(CONFIG_PPC_8xx) || defined(CONFIG_PPC_FSL_BOOK3E)
+#if defined(CONFIG_PPC_BOOK3S_32) || defined(CONFIG_PPC_8xx)
 void mmu_mark_initmem_nx(void);
 void mmu_mark_rodata_ro(void);
 #else
diff -rupN a/arch/powerpc/mm/nohash/fsl_book3e.c b/arch/powerpc/mm/nohash/fsl_book3e.c
--- a/arch/powerpc/mm/nohash/fsl_book3e.c	2021-11-08 14:46:04.841131156 +0100
+++ b/arch/powerpc/mm/nohash/fsl_book3e.c	2021-11-08 14:45:12.441244455 +0100
@@ -168,7 +168,7 @@ unsigned long calc_cam_sz(unsigned long
 
 static unsigned long map_mem_in_cams_addr(phys_addr_t phys, unsigned long virt,
 					unsigned long ram, int max_cam_idx,
-					bool dryrun, bool init)
+					bool dryrun)
 {
 	int i;
 	unsigned long amount_mapped = 0;
@@ -182,7 +182,7 @@ static unsigned long map_mem_in_cams_add
 	/* Calculate CAM values */
 	for (i = 0; boundary && i < max_cam_idx; i++) {
 		unsigned long cam_sz;
-		pgprot_t prot = init ? PAGE_KERNEL_X : PAGE_KERNEL_ROX;
+		pgprot_t prot = PAGE_KERNEL_X;
 
 		cam_sz = calc_cam_sz(boundary, virt, phys);
 		if (!dryrun)
@@ -195,7 +195,7 @@ static unsigned long map_mem_in_cams_add
 	}
 	for (ram -= amount_mapped; ram && i < max_cam_idx; i++) {
 		unsigned long cam_sz;
-		pgprot_t prot = init ? PAGE_KERNEL_X : PAGE_KERNEL;
+		pgprot_t prot = PAGE_KERNEL_X;
 
 		cam_sz = calc_cam_sz(ram, virt, phys);
 		if (!dryrun)
@@ -210,13 +210,8 @@ static unsigned long map_mem_in_cams_add
 	if (dryrun)
 		return amount_mapped;
 
-	if (init) {
-		loadcam_multi(0, i, max_cam_idx);
-		tlbcam_index = i;
-	} else {
-		loadcam_multi(0, i, 0);
-		WARN_ON(i > tlbcam_index);
-	}
+	loadcam_multi(0, i, max_cam_idx);
+	tlbcam_index = i;
 
 #ifdef CONFIG_PPC64
 	get_paca()->tcd.esel_next = i;
@@ -227,12 +222,12 @@ static unsigned long map_mem_in_cams_add
 	return amount_mapped;
 }
 
-unsigned long map_mem_in_cams(unsigned long ram, int max_cam_idx, bool dryrun, bool init)
+unsigned long map_mem_in_cams(unsigned long ram, int max_cam_idx, bool dryrun)
 {
 	unsigned long virt = PAGE_OFFSET;
 	phys_addr_t phys = memstart_addr;
 
-	return map_mem_in_cams_addr(phys, virt, ram, max_cam_idx, dryrun, init);
+	return map_mem_in_cams_addr(phys, virt, ram, max_cam_idx, dryrun);
 }
 
 #ifdef CONFIG_PPC32
@@ -273,7 +268,7 @@ void __init adjust_total_lowmem(void)
 	ram = min((phys_addr_t)__max_low_memory, (phys_addr_t)total_lowmem);
 
 	i = switch_to_as1();
-	__max_low_memory = map_mem_in_cams(ram, CONFIG_LOWMEM_CAM_NUM, false, true);
+	__max_low_memory = map_mem_in_cams(ram, CONFIG_LOWMEM_CAM_NUM, false);
 	restore_to_as0(i, 0, 0, 1);
 
 	pr_info("Memory CAM mapping: ");
@@ -285,25 +280,6 @@ void __init adjust_total_lowmem(void)
 	memblock_set_current_limit(memstart_addr + __max_low_memory);
 }
 
-#ifdef CONFIG_STRICT_KERNEL_RWX
-void mmu_mark_rodata_ro(void)
-{
-	/* Everything is done in mmu_mark_initmem_nx() */
-}
-#endif
-
-void mmu_mark_initmem_nx(void)
-{
-	unsigned long remapped;
-
-	if (!strict_kernel_rwx_enabled())
-		return;
-
-	remapped = map_mem_in_cams(__max_low_memory, CONFIG_LOWMEM_CAM_NUM, false, false);
-
-	WARN_ON(__max_low_memory != remapped);
-}
-
 void setup_initial_memory_limit(phys_addr_t first_memblock_base,
 				phys_addr_t first_memblock_size)
 {
@@ -363,11 +339,11 @@ notrace void __init relocate_init(u64 dt
 		/* map a 64M area for the second relocation */
 		if (memstart_addr > start)
 			map_mem_in_cams(0x4000000, CONFIG_LOWMEM_CAM_NUM,
-					false, true);
+					false);
 		else
 			map_mem_in_cams_addr(start, PAGE_OFFSET + offset,
 					0x4000000, CONFIG_LOWMEM_CAM_NUM,
-					false, true);
+					false);
 		restore_to_as0(n, offset, __va(dt_ptr), 1);
 		/* We should never reach here */
 		panic("Relocation error");
diff -rupN a/arch/powerpc/mm/nohash/kaslr_booke.c b/arch/powerpc/mm/nohash/kaslr_booke.c
--- a/arch/powerpc/mm/nohash/kaslr_booke.c	2021-11-08 14:46:04.841131156 +0100
+++ b/arch/powerpc/mm/nohash/kaslr_booke.c	2021-11-08 14:44:41.801312036 +0100
@@ -314,7 +314,7 @@ static unsigned long __init kaslr_choose
 		pr_warn("KASLR: No safe seed for randomizing the kernel base.\n");
 
 	ram = min_t(phys_addr_t, __max_low_memory, size);
-	ram = map_mem_in_cams(ram, CONFIG_LOWMEM_CAM_NUM, true, false);
+	ram = map_mem_in_cams(ram, CONFIG_LOWMEM_CAM_NUM, true);
 	linear_sz = min_t(unsigned long, ram, SZ_512M);
 
 	/* If the linear size is smaller than 64M, do not randmize */
diff -rupN a/arch/powerpc/mm/nohash/tlb.c b/arch/powerpc/mm/nohash/tlb.c
--- a/arch/powerpc/mm/nohash/tlb.c	2021-11-08 14:46:04.841131156 +0100
+++ b/arch/powerpc/mm/nohash/tlb.c	2021-11-08 14:44:42.149311263 +0100
@@ -645,7 +645,7 @@ static void early_init_this_mmu(void)
 
 		if (map)
 			linear_map_top = map_mem_in_cams(linear_map_top,
-							 num_cams, true, true);
+							 num_cams, false);
 	}
 #endif
 
@@ -766,7 +766,7 @@ void setup_initial_memory_limit(phys_add
 		num_cams = (mfspr(SPRN_TLB1CFG) & TLBnCFG_N_ENTRY) / 4;
 
 		linear_sz = map_mem_in_cams(first_memblock_size, num_cams,
-					    false, true);
+					    true);
 
 		ppc64_rma_size = min_t(u64, linear_sz, 0x40000000);
 	} else
I compiled the kernel with this patch. After that it boots without any problems.

I reported this issue to the Linuxppc-dev mailing list today.

Link: [FSL P50x0] Cyrus+ board doesn't boot with the PowerPC updates 5.16-1

Cheers,
Christian
Last edited by xeno74 on Mon Nov 08, 2021 3:55 pm, edited 19 times in total.
http://www.amigalinux.org
http://www.supertuxkart-amiga.de

Running Linux on AmigaONEs can require some tinkering.
Post Reply