LinuxPPC-Dev Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 1/9] powerpc/ps3: Remove duplicate error messages
  2020-03-27 20:26 [PATCH 0/9] PS3 patches for v5.7 Geoff Levand
                   ` (5 preceding siblings ...)
  2020-03-27 20:26 ` [PATCH 4/9] powerpc/ps3: remove an unneeded NULL check Geoff Levand
@ 2020-03-27 20:26 ` Geoff Levand
  2020-03-28 17:09   ` Markus Elfring
  2020-04-06 13:05   ` Michael Ellerman
  2020-03-27 20:26 ` [PATCH 3/9] net/ps3_gelic_net: Remove duplicate error message Geoff Levand
  2020-03-27 20:26 ` [PATCH 2/9] drivers/ps3: Remove duplicate error messages Geoff Levand
  8 siblings, 2 replies; 21+ messages in thread
From: Geoff Levand @ 2020-03-27 20:26 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: linuxppc-dev, Geert Uytterhoeven, Markus Elfring, Dan Carpenter,
	Emmanuel Nicolet

From: Markus Elfring <elfring@users.sourceforge.net>

Remove duplicate memory allocation failure error messages.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Geoff Levand <geoff@infradead.org>
---
 arch/powerpc/platforms/ps3/os-area.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/powerpc/platforms/ps3/os-area.c b/arch/powerpc/platforms/ps3/os-area.c
index cbddd63caf2d..e8530371aed6 100644
--- a/arch/powerpc/platforms/ps3/os-area.c
+++ b/arch/powerpc/platforms/ps3/os-area.c
@@ -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) {
-- 
2.20.1



^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 7/9] powerpc/ps3: Add check for otheros image size
  2020-03-27 20:26 [PATCH 0/9] PS3 patches for v5.7 Geoff Levand
                   ` (3 preceding siblings ...)
  2020-03-27 20:26 ` [PATCH 8/9] powerpc/ps3: Add lv1_panic Geoff Levand
@ 2020-03-27 20:26 ` Geoff Levand
  2020-03-29 14:00   ` Geert Uytterhoeven
  2020-03-30  3:11   ` [PATCH V2 " Geoff Levand
  2020-03-27 20:26 ` [PATCH 4/9] powerpc/ps3: remove an unneeded NULL check Geoff Levand
                   ` (3 subsequent siblings)
  8 siblings, 2 replies; 21+ messages in thread
From: Geoff Levand @ 2020-03-27 20:26 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: linuxppc-dev, Geert Uytterhoeven, Markus Elfring, Dan Carpenter,
	Emmanuel Nicolet

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 <geoff@infradead.org>
---
 arch/powerpc/boot/wrapper | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper
index ed6266367bc0..1dfd9fd929c8 100755
--- a/arch/powerpc/boot/wrapper
+++ b/arch/powerpc/boot/wrapper
@@ -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
-- 
2.20.1



^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 4/9] powerpc/ps3: remove an unneeded NULL check
  2020-03-27 20:26 [PATCH 0/9] PS3 patches for v5.7 Geoff Levand
                   ` (4 preceding siblings ...)
  2020-03-27 20:26 ` [PATCH 7/9] powerpc/ps3: Add check for otheros image size Geoff Levand
@ 2020-03-27 20:26 ` Geoff Levand
  2020-04-06 13:05   ` Michael Ellerman
  2020-03-27 20:26 ` [PATCH 1/9] powerpc/ps3: Remove duplicate error messages Geoff Levand
                   ` (2 subsequent siblings)
  8 siblings, 1 reply; 21+ messages in thread
From: Geoff Levand @ 2020-03-27 20:26 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: linuxppc-dev, Geert Uytterhoeven, Markus Elfring, Dan Carpenter,
	Emmanuel Nicolet

From: Dan Carpenter <dan.carpenter@oracle.com>

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 <dan.carpenter@oracle.com>
Signed-off-by: Geoff Levand <geoff@infradead.org>
---
 drivers/ps3/sys-manager-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ps3/sys-manager-core.c b/drivers/ps3/sys-manager-core.c
index 24709c572c0c..e061b7d0632b 100644
--- a/drivers/ps3/sys-manager-core.c
+++ b/drivers/ps3/sys-manager-core.c
@@ -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);
 
-- 
2.20.1



^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 0/9] PS3 patches for v5.7
@ 2020-03-27 20:26 Geoff Levand
  2020-03-27 20:26 ` [PATCH 5/9] ps3disk: use the default segment boundary Geoff Levand
                   ` (8 more replies)
  0 siblings, 9 replies; 21+ messages in thread
From: Geoff Levand @ 2020-03-27 20:26 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: linuxppc-dev, Geert Uytterhoeven, Markus Elfring, Dan Carpenter,
	Emmanuel Nicolet

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(-)

-- 
2.20.1


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 8/9] powerpc/ps3: Add lv1_panic
  2020-03-27 20:26 [PATCH 0/9] PS3 patches for v5.7 Geoff Levand
                   ` (2 preceding siblings ...)
  2020-03-27 20:26 ` [PATCH 6/9] powerpc/ps3: Set CONFIG_UEVENT_HELPER=y in ps3_defconfig Geoff Levand
@ 2020-03-27 20:26 ` Geoff Levand
  2020-03-27 20:26 ` [PATCH 7/9] powerpc/ps3: Add check for otheros image size Geoff Levand
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 21+ messages in thread
From: Geoff Levand @ 2020-03-27 20:26 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: linuxppc-dev, Geert Uytterhoeven, Markus Elfring, Dan Carpenter,
	Emmanuel Nicolet

lv1_panic takes a single parameter, 0=halt, 1=reboot, and it will
never return.

Signed-off-by: Geoff Levand <geoff@infradead.org>
---
 arch/powerpc/boot/ppc_asm.h        | 6 ++++++
 arch/powerpc/include/asm/ppc_asm.h | 6 ++++++
 2 files changed, 12 insertions(+)

diff --git a/arch/powerpc/boot/ppc_asm.h b/arch/powerpc/boot/ppc_asm.h
index 192b97523b05..cf758bc63846 100644
--- a/arch/powerpc/boot/ppc_asm.h
+++ b/arch/powerpc/boot/ppc_asm.h
@@ -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
diff --git a/arch/powerpc/include/asm/ppc_asm.h b/arch/powerpc/include/asm/ppc_asm.h
index 6b03dff61a05..e76a6a4020ea 100644
--- a/arch/powerpc/include/asm/ppc_asm.h
+++ b/arch/powerpc/include/asm/ppc_asm.h
@@ -13,6 +13,12 @@
 
 #ifdef __ASSEMBLY__
 
+.macro lv1_panic
+	li	r3, 0
+	li	r11, 255
+	.long 0x44000022
+.endm
+
 #define SZL			(BITS_PER_LONG/8)
 
 /*
-- 
2.20.1



^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 3/9] net/ps3_gelic_net: Remove duplicate error message
  2020-03-27 20:26 [PATCH 0/9] PS3 patches for v5.7 Geoff Levand
                   ` (6 preceding siblings ...)
  2020-03-27 20:26 ` [PATCH 1/9] powerpc/ps3: Remove duplicate error messages Geoff Levand
@ 2020-03-27 20:26 ` Geoff Levand
  2020-03-27 20:26 ` [PATCH 2/9] drivers/ps3: Remove duplicate error messages Geoff Levand
  8 siblings, 0 replies; 21+ messages in thread
From: Geoff Levand @ 2020-03-27 20:26 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: linuxppc-dev, Geert Uytterhoeven, Markus Elfring, Dan Carpenter,
	Emmanuel Nicolet

From: Markus Elfring <elfring@users.sourceforge.net>

Remove an extra message for a memory allocation failure in
function gelic_descr_prepare_rx().

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Geoff Levand <geoff@infradead.org>
---
 drivers/net/ethernet/toshiba/ps3_gelic_net.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/ethernet/toshiba/ps3_gelic_net.c b/drivers/net/ethernet/toshiba/ps3_gelic_net.c
index 070dd6fa9401..8522f3898e0d 100644
--- a/drivers/net/ethernet/toshiba/ps3_gelic_net.c
+++ b/drivers/net/ethernet/toshiba/ps3_gelic_net.c
@@ -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);
-- 
2.20.1



^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 9/9] powerpc/ps3: Add udbg_panic
  2020-03-27 20:26 [PATCH 0/9] PS3 patches for v5.7 Geoff Levand
  2020-03-27 20:26 ` [PATCH 5/9] ps3disk: use the default segment boundary Geoff Levand
@ 2020-03-27 20:26 ` Geoff Levand
  2020-03-27 20:26 ` [PATCH 6/9] powerpc/ps3: Set CONFIG_UEVENT_HELPER=y in ps3_defconfig Geoff Levand
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 21+ messages in thread
From: Geoff Levand @ 2020-03-27 20:26 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: linuxppc-dev, Geert Uytterhoeven, Markus Elfring, Dan Carpenter,
	Emmanuel Nicolet

BUG_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().

Signed-off-by: Geoff Levand <geoff@infradead.org>
---
 arch/powerpc/platforms/ps3/mm.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/ps3/mm.c b/arch/powerpc/platforms/ps3/mm.c
index 423be34f0f5f..7c7c2f53eacb 100644
--- a/arch/powerpc/platforms/ps3/mm.c
+++ b/arch/powerpc/platforms/ps3/mm.c
@@ -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;
 	}
-- 
2.20.1


^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 5/9] ps3disk: use the default segment boundary
  2020-03-27 20:26 [PATCH 0/9] PS3 patches for v5.7 Geoff Levand
@ 2020-03-27 20:26 ` Geoff Levand
  2020-03-27 20:26 ` [PATCH 9/9] powerpc/ps3: Add udbg_panic Geoff Levand
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 21+ messages in thread
From: Geoff Levand @ 2020-03-27 20:26 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: linuxppc-dev, Geert Uytterhoeven, Markus Elfring, Dan Carpenter,
	Emmanuel Nicolet

From: Emmanuel Nicolet <emmanuel.nicolet@gmail.com>

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.

Signed-off-by: Emmanuel Nicolet <emmanuel.nicolet@gmail.com>
Signed-off-by: Geoff Levand <geoff@infradead.org>
---
 drivers/block/ps3disk.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/block/ps3disk.c b/drivers/block/ps3disk.c
index c5c6487a19d5..7b55811c2a81 100644
--- a/drivers/block/ps3disk.c
+++ b/drivers/block/ps3disk.c
@@ -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);
 
-- 
2.20.1



^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 2/9] drivers/ps3: Remove duplicate error messages
  2020-03-27 20:26 [PATCH 0/9] PS3 patches for v5.7 Geoff Levand
                   ` (7 preceding siblings ...)
  2020-03-27 20:26 ` [PATCH 3/9] net/ps3_gelic_net: Remove duplicate error message Geoff Levand
@ 2020-03-27 20:26 ` Geoff Levand
  8 siblings, 0 replies; 21+ messages in thread
From: Geoff Levand @ 2020-03-27 20:26 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: linuxppc-dev, Geert Uytterhoeven, Markus Elfring, Dan Carpenter,
	Emmanuel Nicolet

From: Markus Elfring <elfring@users.sourceforge.net>

Remove duplicate memory allocation failure error messages.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Geoff Levand <geoff@infradead.org>
---
 drivers/ps3/ps3-lpm.c   | 2 --
 drivers/ps3/ps3-vuart.c | 1 -
 2 files changed, 3 deletions(-)

diff --git a/drivers/ps3/ps3-lpm.c b/drivers/ps3/ps3-lpm.c
index 83c45659bc9d..fcc346296e3a 100644
--- a/drivers/ps3/ps3-lpm.c
+++ b/drivers/ps3/ps3-lpm.c
@@ -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;
 		}
diff --git a/drivers/ps3/ps3-vuart.c b/drivers/ps3/ps3-vuart.c
index ddaa5ea5801a..3b5878edc6c2 100644
--- a/drivers/ps3/ps3-vuart.c
+++ b/drivers/ps3/ps3-vuart.c
@@ -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;
 	}
-- 
2.20.1



^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 6/9] powerpc/ps3: Set CONFIG_UEVENT_HELPER=y in ps3_defconfig
  2020-03-27 20:26 [PATCH 0/9] PS3 patches for v5.7 Geoff Levand
  2020-03-27 20:26 ` [PATCH 5/9] ps3disk: use the default segment boundary Geoff Levand
  2020-03-27 20:26 ` [PATCH 9/9] powerpc/ps3: Add udbg_panic Geoff Levand
@ 2020-03-27 20:26 ` Geoff Levand
  2020-04-06 13:05   ` Michael Ellerman
  2020-03-27 20:26 ` [PATCH 8/9] powerpc/ps3: Add lv1_panic Geoff Levand
                   ` (5 subsequent siblings)
  8 siblings, 1 reply; 21+ messages in thread
From: Geoff Levand @ 2020-03-27 20:26 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: linuxppc-dev, Geert Uytterhoeven, Markus Elfring, Dan Carpenter,
	Emmanuel Nicolet

Set 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.

Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Geoff Levand <geoff@infradead.org>
---
 arch/powerpc/configs/ps3_defconfig | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/powerpc/configs/ps3_defconfig b/arch/powerpc/configs/ps3_defconfig
index 4db51719342a..81b55c880fc3 100644
--- a/arch/powerpc/configs/ps3_defconfig
+++ b/arch/powerpc/configs/ps3_defconfig
@@ -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
-- 
2.20.1



^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 1/9] powerpc/ps3: Remove duplicate error messages
  2020-03-27 20:26 ` [PATCH 1/9] powerpc/ps3: Remove duplicate error messages Geoff Levand
@ 2020-03-28 17:09   ` Markus Elfring
  2020-04-06 13:05   ` Michael Ellerman
  1 sibling, 0 replies; 21+ messages in thread
From: Markus Elfring @ 2020-03-28 17:09 UTC (permalink / raw)
  To: Geoff Levand, Michael Ellerman, linuxppc-dev
  Cc: Geert Uytterhoeven, Dan Carpenter, Emmanuel Nicolet

> 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/e16c8b7d-de3a-6c96-9af4-dd0551cca805@users.sourceforge.net/

Will this detail be reflected in the final commit message?

Regards,
Markus

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 7/9] powerpc/ps3: Add check for otheros image size
  2020-03-27 20:26 ` [PATCH 7/9] powerpc/ps3: Add check for otheros image size Geoff Levand
@ 2020-03-29 14:00   ` Geert Uytterhoeven
  2020-03-30  3:10     ` Geoff Levand
  2020-03-30  3:11   ` [PATCH V2 " Geoff Levand
  1 sibling, 1 reply; 21+ messages in thread
From: Geert Uytterhoeven @ 2020-03-29 14:00 UTC (permalink / raw)
  To: Geoff Levand
  Cc: linuxppc-dev, Markus Elfring, Dan Carpenter, Emmanuel Nicolet

Hi Geoff,

On Fri, Mar 27, 2020 at 9:26 PM Geoff Levand <geoff@infradead.org> wrote:
> 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 <geoff@infradead.org>

Thanks for your patch!

> --- a/arch/powerpc/boot/wrapper
> +++ b/arch/powerpc/boot/wrapper
> @@ -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

Why not print an error message and exit 1 instead, like is done for
other fatal errors?

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 7/9] powerpc/ps3: Add check for otheros image size
  2020-03-29 14:00   ` Geert Uytterhoeven
@ 2020-03-30  3:10     ` Geoff Levand
  0 siblings, 0 replies; 21+ messages in thread
From: Geoff Levand @ 2020-03-30  3:10 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: linuxppc-dev, Markus Elfring, Dan Carpenter, Emmanuel Nicolet

Hi Geert,

On 3/29/20 7:00 AM, Geert Uytterhoeven wrote:
>> --- a/arch/powerpc/boot/wrapper
>> +++ b/arch/powerpc/boot/wrapper
>>
>>      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
> 
> Why 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



^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH V2 7/9] powerpc/ps3: Add check for otheros image size
  2020-03-27 20:26 ` [PATCH 7/9] powerpc/ps3: Add check for otheros image size Geoff Levand
  2020-03-29 14:00   ` Geert Uytterhoeven
@ 2020-03-30  3:11   ` Geoff Levand
  1 sibling, 0 replies; 21+ messages in thread
From: Geoff Levand @ 2020-03-30  3:11 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: linuxppc-dev, Geert Uytterhoeven, Markus Elfring, Dan Carpenter,
	Emmanuel Nicolet

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 <geoff@infradead.org>
---
 arch/powerpc/boot/wrapper | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper
index 35ace40d9fc2..ab1e3ddc79f3 100755
--- a/arch/powerpc/boot/wrapper
+++ b/arch/powerpc/boot/wrapper
@@ -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
-- 
2.20.1


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 1/9] powerpc/ps3: Remove duplicate error messages
  2020-03-27 20:26 ` [PATCH 1/9] powerpc/ps3: Remove duplicate error messages Geoff Levand
  2020-03-28 17:09   ` Markus Elfring
@ 2020-04-06 13:05   ` Michael Ellerman
  1 sibling, 0 replies; 21+ messages in thread
From: Michael Ellerman @ 2020-04-06 13:05 UTC (permalink / raw)
  To: Geoff Levand
  Cc: Geert Uytterhoeven, linuxppc-dev, Markus Elfring, Dan Carpenter,
	Emmanuel Nicolet

On Fri, 2020-03-27 at 20:26:23 UTC, Geoff Levand wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> 
> Remove duplicate memory allocation failure error messages.
> 
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
> Signed-off-by: Geoff Levand <geoff@infradead.org>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/7ee417497a29028502cf952f419ab2635f563d51

cheers

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 4/9] powerpc/ps3: remove an unneeded NULL check
  2020-03-27 20:26 ` [PATCH 4/9] powerpc/ps3: remove an unneeded NULL check Geoff Levand
@ 2020-04-06 13:05   ` Michael Ellerman
  0 siblings, 0 replies; 21+ messages in thread
From: Michael Ellerman @ 2020-04-06 13:05 UTC (permalink / raw)
  To: Geoff Levand
  Cc: Geert Uytterhoeven, linuxppc-dev, Markus Elfring, Dan Carpenter,
	Emmanuel Nicolet

On Fri, 2020-03-27 at 20:26:23 UTC, Geoff Levand wrote:
> From: Dan Carpenter <dan.carpenter@oracle.com>
> 
> 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 <dan.carpenter@oracle.com>
> Signed-off-by: Geoff Levand <geoff@infradead.org>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/96efbab92cccbe3434501e5a77cbaa01c5bc2767

cheers

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 6/9] powerpc/ps3: Set CONFIG_UEVENT_HELPER=y in ps3_defconfig
  2020-03-27 20:26 ` [PATCH 6/9] powerpc/ps3: Set CONFIG_UEVENT_HELPER=y in ps3_defconfig Geoff Levand
@ 2020-04-06 13:05   ` Michael Ellerman
  0 siblings, 0 replies; 21+ messages in thread
From: Michael Ellerman @ 2020-04-06 13:05 UTC (permalink / raw)
  To: Geoff Levand
  Cc: Geert Uytterhoeven, linuxppc-dev, Markus Elfring, Dan Carpenter,
	Emmanuel Nicolet

On Fri, 2020-03-27 at 20:26:23 UTC, Geoff Levand wrote:
> Set 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.
> 
> Cc: Geert Uytterhoeven <geert@linux-m68k.org>
> Signed-off-by: Geoff Levand <geoff@infradead.org>

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/d3883fa0784832bb65df019ae6a291a87d146fb1

cheers

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 7/9] powerpc/ps3: Add check for otheros image size
  2020-05-16 16:03     ` Geoff Levand
@ 2020-05-18  6:31       ` Michael Ellerman
  0 siblings, 0 replies; 21+ messages in thread
From: Michael Ellerman @ 2020-05-18  6:31 UTC (permalink / raw)
  To: Geoff Levand
  Cc: linuxppc-dev, Geert Uytterhoeven, Markus Elfring, Emmanuel Nicolet

Geoff Levand <geoff@infradead.org> writes:
> Hi Michael,
>
> On 5/14/20 7:02 PM, Michael Ellerman wrote:
>> Geoff Levand <geoff@infradead.org> writes:
> ...
>>> +    # 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;" \
>> 
>> This now appears on all my ppc64_defconfig builds, which I don't really
>> like.
>
> No, neither do I.  I didn't think of that case.
>
>> That does highlight the fact that ppc64_defconfig including
>> CONFIG_PPC_PS3 is not really helpful for people actually wanting to run
>> the kernel on a PS3.
>
> No, this is just for the bootloader image (.bld) that can be
> programed into flash memory.  This is what is used to create,
> for example, a petitboot bootloader image.
>
> Normal usage is for the bootloader in flash to load a vmlinux
> image from disk or network, in which case running a ppc64_defconfig
> image would be fine.

Ah yep, that rings a bell.

>> So I wonder if we should drop CONFIG_PPC_PS3 from ppc64_defconfig, in
>> which case I'd be happy to keep the INFO message because it should only
>> appear on ps3 specific builds.
>
> I'd like to keep CONFIG_PPC_PS3 set in ppc64_defconfig.  I feel it
> useful to get some build testing of the PS3 platform code.
>
>> The other option would be to drop the message, or only print it when
>> we're doing a verbose build.
>
> Building a boatloader image to program into flash memory is
> something only very advanced users would be doing.  I don't
> think they would need this message.  They would see the file
> name and understand the situation.  I'll post a v3 patch that
> removes the message.

Great, thanks.

cheers

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 7/9] powerpc/ps3: Add check for otheros image size
  2020-05-15  2:02   ` Michael Ellerman
@ 2020-05-16 16:03     ` Geoff Levand
  2020-05-18  6:31       ` Michael Ellerman
  0 siblings, 1 reply; 21+ messages in thread
From: Geoff Levand @ 2020-05-16 16:03 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: linuxppc-dev, Geert Uytterhoeven, Markus Elfring, Emmanuel Nicolet

Hi Michael,

On 5/14/20 7:02 PM, Michael Ellerman wrote:
> Geoff Levand <geoff@infradead.org> writes:
...
>> +    # 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;" \
> 
> This now appears on all my ppc64_defconfig builds, which I don't really
> like.

No, neither do I.  I didn't think of that case.

> That does highlight the fact that ppc64_defconfig including
> CONFIG_PPC_PS3 is not really helpful for people actually wanting to run
> the kernel on a PS3.

No, this is just for the bootloader image (.bld) that can be
programed into flash memory.  This is what is used to create,
for example, a petitboot bootloader image.

Normal usage is for the bootloader in flash to load a vmlinux
image from disk or network, in which case running a ppc64_defconfig
image would be fine.

> So I wonder if we should drop CONFIG_PPC_PS3 from ppc64_defconfig, in
> which case I'd be happy to keep the INFO message because it should only
> appear on ps3 specific builds.

I'd like to keep CONFIG_PPC_PS3 set in ppc64_defconfig.  I feel it
useful to get some build testing of the PS3 platform code.

> The other option would be to drop the message, or only print it when
> we're doing a verbose build.

Building a boatloader image to program into flash memory is
something only very advanced users would be doing.  I don't
think they would need this message.  They would see the file
name and understand the situation.  I'll post a v3 patch that
removes the message.

-Geoff 

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH v2 7/9] powerpc/ps3: Add check for otheros image size
  2020-05-09 18:58 ` [PATCH v2 7/9] powerpc/ps3: Add check for otheros image size Geoff Levand
@ 2020-05-15  2:02   ` Michael Ellerman
  2020-05-16 16:03     ` Geoff Levand
  0 siblings, 1 reply; 21+ messages in thread
From: Michael Ellerman @ 2020-05-15  2:02 UTC (permalink / raw)
  To: Geoff Levand
  Cc: linuxppc-dev, Geert Uytterhoeven, Markus Elfring, Emmanuel Nicolet

Hi Geoff,

Geoff Levand <geoff@infradead.org> writes:
> 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 <geoff@infradead.org>
> ---
>  arch/powerpc/boot/wrapper | 17 +++++++++++++++--
>  1 file changed, 15 insertions(+), 2 deletions(-)
>
> diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper
> index 35ace40d9fc2..ab1e3ddc79f3 100755
> --- a/arch/powerpc/boot/wrapper
> +++ b/arch/powerpc/boot/wrapper
> @@ -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;" \

This now appears on all my ppc64_defconfig builds, which I don't really
like.

That does highlight the fact that ppc64_defconfig including
CONFIG_PPC_PS3 is not really helpful for people actually wanting to run
the kernel on a PS3.

So I wonder if we should drop CONFIG_PPC_PS3 from ppc64_defconfig, in
which case I'd be happy to keep the INFO message because it should only
appear on ps3 specific builds.

The other option would be to drop the message, or only print it when
we're doing a verbose build.

Thoughts?

cheers

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH v2 7/9] powerpc/ps3: Add check for otheros image size
  2020-05-09 18:58 [PATCH v2 0/9] powerpc + ps3 patches Geoff Levand
@ 2020-05-09 18:58 ` Geoff Levand
  2020-05-15  2:02   ` Michael Ellerman
  0 siblings, 1 reply; 21+ messages in thread
From: Geoff Levand @ 2020-05-09 18:58 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: linuxppc-dev, Geert Uytterhoeven, Markus Elfring, Emmanuel Nicolet

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 <geoff@infradead.org>
---
 arch/powerpc/boot/wrapper | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper
index 35ace40d9fc2..ab1e3ddc79f3 100755
--- a/arch/powerpc/boot/wrapper
+++ b/arch/powerpc/boot/wrapper
@@ -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
-- 
2.20.1



^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, back to index

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-27 20:26 [PATCH 0/9] PS3 patches for v5.7 Geoff Levand
2020-03-27 20:26 ` [PATCH 5/9] ps3disk: use the default segment boundary Geoff Levand
2020-03-27 20:26 ` [PATCH 9/9] powerpc/ps3: Add udbg_panic Geoff Levand
2020-03-27 20:26 ` [PATCH 6/9] powerpc/ps3: Set CONFIG_UEVENT_HELPER=y in ps3_defconfig Geoff Levand
2020-04-06 13:05   ` Michael Ellerman
2020-03-27 20:26 ` [PATCH 8/9] powerpc/ps3: Add lv1_panic Geoff Levand
2020-03-27 20:26 ` [PATCH 7/9] powerpc/ps3: Add check for otheros image size Geoff Levand
2020-03-29 14:00   ` Geert Uytterhoeven
2020-03-30  3:10     ` Geoff Levand
2020-03-30  3:11   ` [PATCH V2 " Geoff Levand
2020-03-27 20:26 ` [PATCH 4/9] powerpc/ps3: remove an unneeded NULL check Geoff Levand
2020-04-06 13:05   ` Michael Ellerman
2020-03-27 20:26 ` [PATCH 1/9] powerpc/ps3: Remove duplicate error messages Geoff Levand
2020-03-28 17:09   ` Markus Elfring
2020-04-06 13:05   ` Michael Ellerman
2020-03-27 20:26 ` [PATCH 3/9] net/ps3_gelic_net: Remove duplicate error message Geoff Levand
2020-03-27 20:26 ` [PATCH 2/9] drivers/ps3: Remove duplicate error messages Geoff Levand
2020-05-09 18:58 [PATCH v2 0/9] powerpc + ps3 patches Geoff Levand
2020-05-09 18:58 ` [PATCH v2 7/9] powerpc/ps3: Add check for otheros image size Geoff Levand
2020-05-15  2:02   ` Michael Ellerman
2020-05-16 16:03     ` Geoff Levand
2020-05-18  6:31       ` Michael Ellerman

LinuxPPC-Dev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linuxppc-dev/0 linuxppc-dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linuxppc-dev linuxppc-dev/ https://lore.kernel.org/linuxppc-dev \
		linuxppc-dev@lists.ozlabs.org linuxppc-dev@ozlabs.org
	public-inbox-index linuxppc-dev

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.ozlabs.lists.linuxppc-dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git