PS3 patches for v5.7
Subsystems (5)
Geoff Levand
maintainerPATCH 1/9 powerpc/ps3: Remove duplicate error messages
In reply to Geoff LevandFrom: Markus Elfring <[email protected]>
Remove duplicate memory allocation failure error messages.
--- arch/powerpc/platforms/ps3/os-area.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
arch/powerpc/platforms/ps3/os-area.c +1 -3
@@ -613,10 +613,8 @@ static int update_flash_db(void)/* Read in header and db from flash. */ header =kmalloc (buf_len,GFP_KERNEL ); -if (!header) { -pr_debug ("%s: kmalloc failed\n" , __func__); +if (!header)return -ENOMEM ; - } count =os_area_flash_read (header, buf_len,0 );if (count <0 ) {
Signature · 1 line
2.20.1
Geoff Levand
maintainerPATCH 7/9 powerpc/ps3: Add check for otheros image size
In reply to Geoff LevandThe ps3's otheros flash loader has a size limit of 16 MiB for the uncompressed image. If that limit will be reached output the flash image file as 'otheros-too-big.bld'.
--- arch/powerpc/boot/wrapper | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
arch/powerpc/boot/wrapper +11 -2
@@ -570,7 +570,16 @@ ps3) count=$overlay_size bs=1 odir="$(dirname "$ofile.bin")" - rm -f "$odir/otheros.bld" - gzip -n --force -9 --stdout "$ofile.bin" > "$odir/otheros.bld" + + # The ps3's flash loader has a size limit of 16 MiB for the uncompressed + # image. If a compressed image that exceeded this limit is written to + # flash the loader will decompress that image until the 16 MiB limit is + # reached, then enter the system reset vector of the partially decompressed + # image. No warning is issued. + rm -f "$odir"/{otheros,otheros-too-big}.bld + size=$(${CROSS}nm --no-sort --radix=d "$ofile" | egrep ' _end$' | cut -d' ' -f1) + bld="otheros.bld" + [ $size -le 16777216 ] || bld="otheros-too-big.bld" + gzip -n --force -9 --stdout "$ofile.bin" > "$odir/$bld" ;; esac
Signature · 1 line
2.20.1
Geoff Levand
maintainerPATCH 4/9 powerpc/ps3: remove an unneeded NULL check
In reply to Geoff LevandFrom: Dan Carpenter <[email protected]>
Static checkers don't like the inconsistent NULL checking on "ops". This function is only called once and "ops" isn't NULL so the check can be removed.
--- drivers/ps3/sys-manager-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ps3/sys-manager-core.c +1 -1
@@ -31,7 +31,7 @@ void ps3_sys_manager_register_ops(const struct ps3_sys_manager_ops *ops) {BUG_ON (!ops);BUG_ON (!ops->dev); - ps3_sys_manager_ops = ops ? *ops : ps3_sys_manager_ops; + ps3_sys_manager_ops = *ops; }EXPORT_SYMBOL_GPL (ps3_sys_manager_register_ops);
Signature · 1 line
2.20.1
Geoff Levand
maintainercover PS3 patches for v5.7
Hi Michael,
Here are a few PS3 specific patches. A few remove some reduntant messages, a few add some minor debugging support, and a few fix some problems during system boot.
Please consider for v5.7.
-Geoff
The following changes since commit 16fbf79b0f83bc752cee8589279f1ebfe57b3b6e:
Linux 5.6-rc7 (2020-03-22 18:31:56 -0700)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/geoff/ps3-linux.git for-merge-ps3
for you to fetch changes up to 1333a8985c4190763c9c0312bcefad8b1ea863c7:
powerpc/ps3: Add udbg_panic (2020-03-27 13:07:31 -0700)
----------------------------------------------------------------
Dan Carpenter (1):
powerpc/ps3: remove an unneeded NULL check
Emmanuel Nicolet (1):
ps3disk: use the default segment boundary
Geoff Levand (4):
powerpc/ps3: Set CONFIG_UEVENT_HELPER=y in ps3_defconfig powerpc/ps3: Add check for otheros image size powerpc/ps3: Add lv1_panic
powerpc/ps3: Add udbg_panic
Markus Elfring (3):
powerpc/ps3: Remove duplicate error messages drivers/ps3: Remove duplicate error messages net/ps3_gelic_net: Remove duplicate error message
arch/powerpc/boot/ppc_asm.h | 6 ++++++ arch/powerpc/boot/wrapper | 13 +++++++++++-- arch/powerpc/configs/ps3_defconfig | 2 ++ arch/powerpc/include/asm/ppc_asm.h | 6 ++++++ arch/powerpc/platforms/ps3/mm.c | 9 ++++++++- arch/powerpc/platforms/ps3/os-area.c | 4 +--- drivers/block/ps3disk.c | 1 - drivers/net/ethernet/toshiba/ps3_gelic_net.c | 2 -- drivers/ps3/ps3-lpm.c | 2 -- drivers/ps3/ps3-vuart.c | 1 - drivers/ps3/sys-manager-core.c | 2 +- 11 files changed, 35 insertions(+), 13 deletions(-)
Signature · 1 line
2.20.1
Geoff Levand
maintainerPATCH 8/9 powerpc/ps3: Add lv1_panic
lv1_panic takes a single parameter, 0=halt, 1=reboot, and it will never return.
--- arch/powerpc/boot/ppc_asm.h | 6 ++++++ arch/powerpc/include/asm/ppc_asm.h | 6 ++++++ 2 files changed, 12 insertions(+)
arch/powerpc/boot/ppc_asm.h +6 -0
@@ -8,6 +8,12 @@* Copyright (C) 1995-1999 Gary Thomas, Paul Mackerras, Cort Dougan. */ +.macro lv1_panic + li r3, 0 + li r11, 255 + .long 0x44000022 +.endm + /* Condition Register Bit Fields */ #define cr0 0
arch/powerpc/include/asm/ppc_asm.h +6 -0
@@ -13,6 +13,12 @@#ifdef __ASSEMBLY__ +.macro lv1_panic + li r3, 0 + li r11, 255 + .long 0x44000022 +.endm + #define SZL (BITS_PER_LONG/8)/*
Signature · 1 line
2.20.1
Geoff Levand
maintainerPATCH 3/9 net/ps3_gelic_net: Remove duplicate error message
In reply to Geoff LevandFrom: Markus Elfring <[email protected]>
Remove an extra message for a memory allocation failure in function gelic_descr_prepare_rx().
--- drivers/net/ethernet/toshiba/ps3_gelic_net.c | 2 -- 1 file changed, 2 deletions(-)
drivers/net/ethernet/toshiba/ps3_gelic_net.c +0 -2
@@ -382,8 +382,6 @@ static int gelic_descr_prepare_rx(struct gelic_card *card, descr->skb =dev_alloc_skb (bufsize +GELIC_NET_RXBUF_ALIGN -1 );if (!descr->skb) { descr->buf_addr =0 ;/* tell DMAC don't touch memory */ -dev_info (ctodev (card), -"%s:allocate skb failed !!\n" , __func__);return -ENOMEM ; } descr->buf_size =cpu_to_be32 (bufsize);
Signature · 1 line
2.20.1
Geoff Levand
maintainerPATCH 9/9 powerpc/ps3: Add udbg_panic
In reply to Geoff LevandBUG_ON() won't work in the early init code, so replace it with a new routine udbg_panic() that uses udbg_printf() and lv1_panic().
--- arch/powerpc/platforms/ps3/mm.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
arch/powerpc/platforms/ps3/mm.c +8 -1
@@ -26,6 +26,13 @@#define DBG pr_devel#endif +#define udbg_panic (_val, _msg) \ +if (_val) { \ + udbg_printf("%s:%d: " _msg ": %d\n", \ + __func__, __LINE__, (int)(_val)); \ + lv1_panic(0); \ +} +enum {#if defined(CONFIG_PS3_DYNAMIC_DMA )USE_DYNAMIC_DMA =1 ,
@@ -313,7 +320,7 @@ static void ps3_mm_region_destroy(struct mem_region *r)if (r->base) { result =lv1_release_memory (r->base); -BUG_ON (result); +udbg_panic (result,"lv1_release_memory failed" ); r->size = r->base = r->offset =0 ; map.total = map.rm.size; }
Signature · 1 line
2.20.1
Geoff Levand
maintainerPATCH 5/9 ps3disk: use the default segment boundary
In reply to Geoff LevandFrom: Emmanuel Nicolet <[email protected]>
Hi,
since commit dcebd755926b ("block: use bio_for_each_bvec() to compute multi-page bvec count"), the kernel will bug_on on the PS3 because bio_split() is called with sectors == 0:
kernel BUG at block/bio.c:1853!
Oops: Exception in kernel mode, sig: 5 [#1] BE PAGE_SIZE=4K MMU=Hash PREEMPT SMP NR_CPUS=8 NUMA PS3 Modules linked in: firewire_sbp2 rtc_ps3(+) soundcore ps3_gelic(+) \ ps3rom(+) firewire_core ps3vram(+) usb_common crc_itu_t CPU: 0 PID: 97 Comm: blkid Not tainted 5.3.0-rc4 #1 NIP: c00000000027d0d0 LR: c00000000027d0b0 CTR: 0000000000000000 REGS: c00000000135ae90 TRAP: 0700 Not tainted (5.3.0-rc4) MSR: 8000000000028032 <SF,EE,IR,DR,RI> CR: 44008240 XER: 20000000
IRQMASK: 0
GPR00: c000000000289368 c00000000135b120 c00000000084a500 c000000004ff8300
GPR04: 0000000000000c00 c000000004c905e0 c000000004c905e0 000000000000ffff
GPR08: 0000000000000000 0000000000000001 0000000000000000 000000000000ffff
GPR12: 0000000000000000 c0000000008ef000 000000000000003e 0000000000080001
GPR16: 0000000000000100 000000000000ffff 0000000000000000 0000000000000004
GPR20: c00000000062fd7e 0000000000000001 000000000000ffff 0000000000000080
GPR24: c000000000781788 c00000000135b350 0000000000000080 c000000004c905e0
GPR28: c00000000135b348 c000000004ff8300 0000000000000000 c000000004c90000 NIP [c00000000027d0d0] .bio_split+0x28/0xac
LR [c00000000027d0b0] .bio_split+0x8/0xac
Call Trace: [c00000000135b120] [c00000000027d130] .bio_split+0x88/0xac (unreliable) [c00000000135b1b0] [c000000000289368] .__blk_queue_split+0x11c/0x53c [c00000000135b2d0] [c00000000028f614] .blk_mq_make_request+0x80/0x7d4 [c00000000135b3d0] [c000000000283a8c] .generic_make_request+0x118/0x294 [c00000000135b4b0] [c000000000283d34] .submit_bio+0x12c/0x174 [c00000000135b580] [c000000000205a44] .mpage_bio_submit+0x3c/0x4c [c00000000135b600] [c000000000206184] .mpage_readpages+0xa4/0x184 [c00000000135b750] [c0000000001ff8fc] .blkdev_readpages+0x24/0x38 [c00000000135b7c0] [c0000000001589f0] .read_pages+0x6c/0x1a8 [c00000000135b8b0] [c000000000158c74] .__do_page_cache_readahead+0x118/0x184 [c00000000135b9b0] [c0000000001591a8] .force_page_cache_readahead+0xe4/0xe8 [c00000000135ba50] [c00000000014fc24] .generic_file_read_iter+0x1d8/0x830 [c00000000135bb50] [c0000000001ffadc] .blkdev_read_iter+0x40/0x5c [c00000000135bbc0] [c0000000001b9e00] .new_sync_read+0x144/0x1a0 [c00000000135bcd0] [c0000000001bc454] .vfs_read+0xa0/0x124 [c00000000135bd70] [c0000000001bc7a4] .ksys_read+0x70/0xd8 [c00000000135be20] [c00000000000a524] system_call+0x5c/0x70
Instruction dump:7fe3fb78 482e30dc 7c0802a6 482e3085 7c9e2378 f821ff71 7ca42b78 7d3e00d0 7c7d1b78 79290fe0 7cc53378 69290001 <0b090000> 81230028 7bca0020 7929ba62 [ end trace 313fec760f30aa1f ]---
The problem originates from setting the segment boundary of the request queue to -1UL. This makes get_max_segment_size() return zero when offset is zero, whatever the max segment size. The test with BLK_SEG_BOUNDARY_MASK fails and 'mask - (mask & offset) + 1' overflows to zero in the return statement.
Not setting the segment boundary and using the default value (BLK_SEG_BOUNDARY_MASK) fixes the problem.
Maybe BLK_SEG_BOUNDARY_MASK should be set to -1UL? It's currently set to only 0xFFFFFFFFUL. I don't know if that would break anything.
--- drivers/block/ps3disk.c | 1 - 1 file changed, 1 deletion(-)
drivers/block/ps3disk.c +0 -1
@@ -454,7 +454,6 @@ static int ps3disk_probe(struct ps3_system_bus_device *_dev) queue->queuedata = dev;blk_queue_max_hw_sectors (queue, dev->bounce_size >>9 ); -blk_queue_segment_boundary (queue,-1UL );blk_queue_dma_alignment (queue, dev->blk_size-1 );blk_queue_logical_block_size (queue, dev->blk_size);
Signature · 1 line
2.20.1
Geoff Levand
maintainerPATCH 2/9 drivers/ps3: Remove duplicate error messages
In reply to Geoff LevandFrom: Markus Elfring <[email protected]>
Remove duplicate memory allocation failure error messages.
--- drivers/ps3/ps3-lpm.c | 2 -- drivers/ps3/ps3-vuart.c | 1 - 2 files changed, 3 deletions(-)
drivers/ps3/ps3-lpm.c +0 -2
@@ -1111,8 +1111,6 @@ int ps3_lpm_open(enum ps3_lpm_tb_type tb_type, void *tb_cache, lpm_priv->tb_cache_internal =kzalloc ( lpm_priv->tb_cache_size +127 ,GFP_KERNEL );if (!lpm_priv->tb_cache_internal) { -dev_err (sbd_core (),"%s:%u: alloc internal tb_cache " -"failed\n" , __func__, __LINE__); result = -ENOMEM ; goto fail_malloc; }
drivers/ps3/ps3-vuart.c +0 -1
@@ -917,7 +917,6 @@ static int ps3_vuart_bus_interrupt_get(void) vuart_bus_priv.bmp =kzalloc (sizeof (struct ports_bmp ),GFP_KERNEL );if (!vuart_bus_priv.bmp) { -pr_debug ("%s:%d: kzalloc failed.\n" , __func__, __LINE__); result = -ENOMEM ; goto fail_bmp_malloc; }
Signature · 1 line
2.20.1
Geoff Levand
maintainerPATCH 6/9 powerpc/ps3: Set CONFIG_UEVENT_HELPER=y in ps3_defconfig
In reply to Geoff LevandSet CONFIG_UEVENT_HELPER=y in ps3_defconfig.
commit 1be01d4a57142ded23bdb9e0c8d9369e693b26cc (driver: base: Disable CONFIG_UEVENT_HELPER by default) disabled the CONFIG_UEVENT_HELPER option that is needed for hotplug and module loading by most older 32bit powerpc distributions that users typically install on the PS3.
--- arch/powerpc/configs/ps3_defconfig | 2 ++ 1 file changed, 2 insertions(+)
arch/powerpc/configs/ps3_defconfig +2 -0
@@ -60,6 +60,8 @@ CONFIG_CFG80211=m CONFIG_CFG80211_WEXT=y CONFIG_MAC80211=m # CONFIG_MAC80211_RC_MINSTREL is not set +CONFIG_UEVENT_HELPER=y +CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" CONFIG_BLK_DEV_LOOP=y CONFIG_BLK_DEV_RAM=y CONFIG_BLK_DEV_RAM_SIZE=65535
Signature · 1 line
2.20.1
Re: [PATCH 1/9] powerpc/ps3: Remove duplicate error messages
In reply to Geoff LevandQuoted 1 line
Remove duplicate memory allocation failure error messages.
A single message can be omitted here.
https://lkml.org/lkml/2017/10/17/870
https://lore.kernel.org/patchwork/patch/842101/
https://lore.kernel.org/linuxppc-dev/[email protected]/
Will this detail be reflected in the final commit message?
Regards,
Markus
Re: [PATCH 7/9] powerpc/ps3: Add check for otheros image size
In reply to Geoff LevandHi Geoff,
Quoted 5 lines · Geoff Levand
The ps3's otheros flash loader has a size limit of 16 MiB for the uncompressed image. If that limit will be reached output the flash image file as 'otheros-too-big.bld'.
Signed-off-by Geoff Levand <[email protected]>
Thanks for your patch!
Quoted 11 lines
arch/powerpc/boot/wrapper +3
-2@@ -570,7 +570,16 @@ ps3) count=$overlay_size bs=1 odir="$(dirname "$ofile.bin")" - rm -f "$odir/otheros.bld" - gzip -n --force -9 --stdout "$ofile.bin" > "$odir/otheros.bld" + + # The ps3's flash loader has a size limit of 16 MiB for the uncompressed + # image. If a compressed image that exceeded this limit is written to
arch/powerpc/boot/wrapper ps3) · line 585
Quoted 10 lines
arch/powerpc/boot/wrapper +8
-0+ # flash the loader will decompress that image until the 16 MiB limit is + # reached, then enter the system reset vector of the partially decompressed + # image. No warning is issued. + rm -f "$odir"/{otheros,otheros-too-big}.bld + size=$(${CROSS}nm --no-sort --radix=d "$ofile" | egrep ' _end$' | cut -d' ' -f1) + bld="otheros.bld" + [ $size -le 16777216 ] || bld="otheros-too-big.bld" + gzip -n --force -9 --stdout "$ofile.bin" > "$odir/$bld" ;; esac
Why not print an error message and exit 1 instead, like is done for other fatal errors?
Gr{oetje,eeting}s,
Geert
Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected] In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Geoff Levand
maintainerRe: [PATCH 7/9] powerpc/ps3: Add check for otheros image size
Hi Geert,
Quoted 14 lines · Geert Uytterhoeven
Quoted 14 lines
arch/powerpc/boot/wrapper +8
-2odir="$(dirname "$ofile.bin")" - rm -f "$odir/otheros.bld" - gzip -n --force -9 --stdout "$ofile.bin" > "$odir/otheros.bld" + + # The ps3's flash loader has a size limit of 16 MiB for the uncompressed + # image. If a compressed image that exceeded this limit is written to + # flash the loader will decompress that image until the 16 MiB limit is + # reached, then enter the system reset vector of the partially decompressed + # image. No warning is issued. + rm -f "$odir"/{otheros,otheros-too-big}.bld + size=$(${CROSS}nm --no-sort --radix=d "$ofile" | egrep ' _end$' | cut -d' ' -f1)
Quoted 8 lines
arch/powerpc/boot/wrapper ps3) · line 585
Quoted 5 lines
arch/powerpc/boot/wrapper +3
-0+ bld="otheros.bld" + [ $size -le 16777216 ] || bld="otheros-too-big.bld" + gzip -n --force -9 --stdout "$ofile.bin" > "$odir/$bld" ;; esacWhy not print an error message and exit 1 instead, like is done for other fatal errors?
This is not really a fatal error for the entire build. The default make target will build both a vmlinux file and a .bld file. The .bld file is the one that can be programmed to the OtherOS flash memory (bld = boot loader). Even if the .bld file is too big, a big vmlinux file from such a build would be completely fine for petitboot to load.
It may be good to print an 'info' message though. I'll post an updated patch.
-Geoff
Geoff Levand
maintainerPATCH v2 7/9 powerpc/ps3: Add check for otheros image size
In reply to Geoff LevandThe ps3's otheros flash loader has a size limit of 16 MiB for the uncompressed image. If that limit will be reached output the flash image file as 'otheros-too-big.bld'.
--- arch/powerpc/boot/wrapper | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
arch/powerpc/boot/wrapper +15 -2
@@ -571,7 +571,20 @@ ps3) count=$overlay_size bs=1 odir="$(dirname "$ofile.bin")" - rm -f "$odir/otheros.bld" - gzip -n --force -9 --stdout "$ofile.bin" > "$odir/otheros.bld" + + # The ps3's flash loader has a size limit of 16 MiB for the uncompressed + # image. If a compressed image that exceeded this limit is written to + # flash the loader will decompress that image until the 16 MiB limit is + # reached, then enter the system reset vector of the partially decompressed + # image. No warning is issued. + rm -f "$odir"/{otheros,otheros-too-big}.bld + size=$(${CROSS}nm --no-sort --radix=d "$ofile" | egrep ' _end$' | cut -d' ' -f1) + bld="otheros.bld" + if [ $size -gt $((0x1000000)) ]; then + bld="otheros-too-big.bld" + echo " INFO: Uncompressed kernel is too large to program into PS3 flash memory;" \ + "size=0x$(printf "%x\n" $size), limit=0x1000000." + fi + gzip -n --force -9 --stdout "$ofile.bin" > "$odir/$bld" ;; esac
Signature · 1 line
2.20.1
Michael Ellerman
AppliedRe: [PATCH 1/9] powerpc/ps3: Remove duplicate error messages
In reply to Geoff LevandQuoted 6 lines · Geoff Levand
From: Markus Elfring <[email protected]>
Remove duplicate memory allocation failure error messages.
Signed-off-by Markus Elfring <[email protected]>Signed-off-by Geoff Levand <[email protected]>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/7ee417497a29028502cf952f419ab2635f563d51
cheers
Michael Ellerman
AppliedRe: [PATCH 4/9] powerpc/ps3: remove an unneeded NULL check
In reply to Geoff LevandQuoted 8 lines · Geoff Levand
From: Dan Carpenter <[email protected]>
Static checkers don't like the inconsistent NULL checking on "ops". This function is only called once and "ops" isn't NULL so the check can be removed.
Signed-off-by Dan Carpenter <[email protected]>Signed-off-by Geoff Levand <[email protected]>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/96efbab92cccbe3434501e5a77cbaa01c5bc2767
cheers
Michael Ellerman
AppliedRe: [PATCH 6/9] powerpc/ps3: Set CONFIG_UEVENT_HELPER=y in ps3_defconfig
In reply to Geoff LevandQuoted 9 lines · Geoff Levand
Set
CONFIG_UEVENT_HELPER=yinps3_defconfig.commit
1be01d4a57142ded23bdb9e0c8d9369e693b26cc(driver: base: DisableCONFIG_UEVENT_HELPERby default) disabled theCONFIG_UEVENT_HELPERoption that is needed for hotplug and module loading by most older 32bit powerpc distributions that users typically install on the PS3.Cc Geert Uytterhoeven <[email protected]>Signed-off-by Geoff Levand <[email protected]>
Applied to powerpc next, thanks.
https://git.kernel.org/powerpc/c/d3883fa0784832bb65df019ae6a291a87d146fb1
cheers