Skip to contentSkip to conversation

powerpc + ps3 patches

PATCH In review Geoff Levand 4 participants 20 messages May 9, 2020 – Jun 9, 2020

Subsystems (7)
lore
Share & tools
lore

Geoff Levand

author maintainer
#0 lore raw

v2 cover powerpc + ps3 patches

Hi Michael,

This is a combined V2 of the two patch sets I sent out on March 27th, 'PS3 patches for v5.7' and 'powerpc: Minor updates to improve build debugging'.

I've dropped these two patches that were in my 'PS3 patches for v5.7' set:

powerpc/ps3: Add lv1_panic
powerpc/ps3: Add udbg_panic

and replaced them with a new patch:

powerpc/ps3: Fix kexec shutdown hang

There is new patch I've added in this set:

hvc_console: Allow backends to set I/O buffer size

which I've been using in my debugging. There is nothing using this feature in the upstream kernel, and I don't plan to submit anything that would use it, so use your discretion as to merge it.

-Geoff

The following changes since commit 0e698dfa282211e414076f9dc7e83c1c288314fd:

Linux 5.7-rc4 (2020-05-03 14:56:04 -0700)

are available in the Git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/geoff/ps3-linux.git for-merge-powerpc-v2

for you to fetch changes up to 6f6294df663a53f47bb28abcbb1ef756c6a59922:

hvc_console: Allow backends to set I/O buffer size (2020-05-09 11:24:42 -0700)

----------------------------------------------------------------
Emmanuel Nicolet (1):
ps3disk: use the default segment boundary

Geoff Levand (6):
powerpc/head_check: Automatic verbosity powerpc/wrapper: Output linker map file powerpc/head_check: Avoid broken pipe powerpc/ps3: Add check for otheros image size powerpc/ps3: Fix kexec shutdown hang
hvc_console: Allow backends to set I/O buffer size

Markus Elfring (2):
drivers/ps3: Remove duplicate error messages net/ps3_gelic_net: Remove duplicate error message

 arch/powerpc/boot/wrapper                    | 20 +++++++++++++++++---
 arch/powerpc/platforms/ps3/mm.c              | 22 ++++++++++++----------
 arch/powerpc/tools/head_check.sh             |  8 +++++---
 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/tty/hvc/hvc_console.c                | 19 +++++++++++--------
 8 files changed, 45 insertions(+), 30 deletions(-)
Signature · 1 line
2.20.1
author maintainer
#1 lore raw

PATCH v2 1/9 powerpc/head_check: Automatic verbosity

To aid debugging build problems turn on shell tracing for the head_check script when the build is verbose.

---
 arch/powerpc/tools/head_check.sh | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
arch/powerpc/tools/head_check.sh +4 -2
index ad9e57209aa4..37061fb9b58e 100644
@@ -31,8 +31,10 @@
 # level entry code (boot, interrupt vectors, etc) until r2 is set up. This
 # could cause the kernel to die in early boot.
 
-# Turn this on if you want more debug output:
-# set -x
+# Allow for verbose output
+if [ "$V" = "1" ]; then
+	set -x
+fi
 
 if [ $# -lt 2 ]; then
 	echo "$0 [path to nm] [path to vmlinux]" 1>&2
Signature · 1 line
2.20.1
author maintainer
#2 lore raw

PATCH v2 2/9 powerpc/wrapper: Output linker map file

In reply to Geoff Levand

To aid debugging wrapper troubles, output a linker map file 'wrapper.map' when the build is verbose.

---
 arch/powerpc/boot/wrapper | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/powerpc/boot/wrapper +2 -1
index ed6266367bc0..35ace40d9fc2 100755
@@ -29,6 +29,7 @@ set -e
 # Allow for verbose output
 if [ "$V" = 1 ]; then
     set -x
+    map="-Map wrapper.map"
 fi
 
 # defaults
@@ -500,7 +501,7 @@ if [ "$platform" != "miboot" ]; then
         text_start="-Ttext $link_address"
     fi
 #link everything
-    ${CROSS}ld -m $format -T $lds $text_start $pie $nodl -o "$ofile" \
+    ${CROSS}ld -m $format -T $lds $text_start $pie $nodl -o "$ofile" $map \
 	$platformo $tmp $object/wrapper.a
     rm $tmp
 fi
Signature · 1 line
2.20.1
author maintainer
#3 lore raw

PATCH v2 3/9 powerpc/head_check: Avoid broken pipe

In reply to Geoff Levand

Remove the '-m4' option to grep to allow grep to process all of nm's output. This avoids the nm warning:

nm terminated with signal 13 [Broken pipe]

---
 arch/powerpc/tools/head_check.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/tools/head_check.sh +1 -1
index 37061fb9b58e..e32d3162e5ed 100644
@@ -46,7 +46,7 @@ nm="$1"
 vmlinux="$2"
 
 # gcc-4.6-era toolchain make _stext an A (absolute) symbol rather than T
-$nm "$vmlinux" | grep -e " [TA] _stext$" -e " t start_first_256B$" -e " a text_start$" -e " t start_text$" -m4 > .tmp_symbols.txt
+$nm "$vmlinux" | grep -e " [TA] _stext$" -e " t start_first_256B$" -e " a text_start$" -e " t start_text$" > .tmp_symbols.txt
 
 
 vma=$(cat .tmp_symbols.txt | grep -e " [TA] _stext$" | cut -d' ' -f1)
Signature · 1 line
2.20.1
author maintainer
#4 lore raw

PATCH v2 4/9 drivers/ps3: Remove duplicate error messages

In reply to Geoff Levand

From: 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
index 83c45659bc9d..fcc346296e3a 100644
@@ -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
index ddaa5ea5801a..3b5878edc6c2 100644
@@ -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
author maintainer
#6 lore raw

PATCH v2 5/9 net/ps3_gelic_net: Remove duplicate error message

In reply to Geoff Levand

From: 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
index 070dd6fa9401..8522f3898e0d 100644
@@ -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
#7 lore raw

Re: [PATCH v2 5/9] net/ps3_gelic_net: Remove duplicate error message

Quoted 2 lines

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

Will another background information be relevant for the final commit message?

ps3_gelic_net: Delete an error message for a failed memory allocation in gelic_descr_prepare_rx()
https://lore.kernel.org/linuxppc-dev/[email protected]/
https://lore.kernel.org/patchwork/patch/869518/
https://lkml.org/lkml/2018/1/3/365

Regards,
Markus

author maintainer
#8 lore raw

PATCH v2 6/9 ps3disk: use the default segment boundary

In reply to Geoff Levand

From: 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
index c5c6487a19d5..7b55811c2a81 100644
@@ -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
author maintainer
#9 lore raw

PATCH v2 7/9 powerpc/ps3: Add check for otheros image size

In reply to 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'.

---
 arch/powerpc/boot/wrapper | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
arch/powerpc/boot/wrapper +15 -2
index 35ace40d9fc2..ab1e3ddc79f3 100755
@@ -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
#10 lore raw

Re: [PATCH v2 7/9] powerpc/ps3: Add check for otheros image size

Hi Geoff,

Quoted 21 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'.

---
 arch/powerpc/boot/wrapper | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)
arch/powerpc/boot/wrapper +2 -2
index 35ace40d9fc2..ab1e3ddc79f3 100755
@@ -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

arch/powerpc/boot/wrapper ps3) · line 585

Quoted 10 lines
arch/powerpc/boot/wrapper +10 -0
+    # 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

author maintainer
#11 lore raw

Re: [PATCH v2 7/9] powerpc/ps3: Add check for otheros image size

Hi Michael,

Quoted 1 line · Michael Ellerman

Geoff Levand <[email protected]> writes:

...

Quoted 12 lines

arch/powerpc/boot/wrapper ps3) · line 585

Quoted 11 lines
arch/powerpc/boot/wrapper +11 -0
+    # 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;" \
Quoted 2 lines

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.

Quoted 3 lines

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.

Quoted 3 lines

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.

Quoted 2 lines

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

#12 lore raw

Re: [PATCH v2 7/9] powerpc/ps3: Add check for otheros image size

Quoted 26 lines · Geoff Levand

Hi Michael,

Quoted 1 line · Michael Ellerman

Geoff Levand <[email protected]> writes:

...

Quoted 12 lines

arch/powerpc/boot/wrapper ps3) · line 585

Quoted 11 lines
arch/powerpc/boot/wrapper +11 -0
+    # 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;" \
Quoted 2 lines

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.

Quoted 3 lines

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.

Quoted 7 lines

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.

Quoted 7 lines
Quoted 3 lines

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.

Quoted 8 lines
Quoted 2 lines

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

author maintainer
#13 lore raw

PATCH v3 7/9 powerpc/ps3: Add check for otheros image size

In reply to 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'.

---
v2: Change from decimal to hex values. Output an INFO message to screen.
v3: Remove the INFO message.

 arch/powerpc/boot/wrapper | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)
arch/powerpc/boot/wrapper +13 -2
index 35ace40d9fc2..d0b5f202c49c 100755
@@ -571,7 +571,18 @@ 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"
+    fi
+    gzip -n --force -9 --stdout "$ofile.bin" > "$odir/$bld"
     ;;
 esac
Signature · 1 line
2.20.1
author maintainer
#15 lore raw

PATCH v2 8/9 powerpc/ps3: Fix kexec shutdown hang

In reply to Geoff Levand

The ps3_mm_region_destroy() and ps3_mm_vas_destroy() routines are called very late in the shutdown via kexec's mmu_cleanup_all routine. By the time mmu_cleanup_all runs it is too late to use udbg_printf, and calling it will cause PS3 systems to hang.

Remove all debugging statements from ps3_mm_region_destroy() and ps3_mm_vas_destroy() and replace any error reporting with calls to lv1_panic.

With this change builds with 'DEBUG' defined will not cause kexec reboots to hang, and builds with 'DEBUG' defined or not will end in lv1_panic if an error is encountered.

---
 arch/powerpc/platforms/ps3/mm.c | 22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)
arch/powerpc/platforms/ps3/mm.c +12 -10
index 423be34f0f5f..f42fe4e86ce5 100644
@@ -200,13 +200,14 @@ void ps3_mm_vas_destroy(void)
 {
 	int result;
 
-	DBG("%s:%d: map.vas_id    = %llu\n", __func__, __LINE__, map.vas_id);
-
 	if (map.vas_id) {
 		result = lv1_select_virtual_address_space(0);
-		BUG_ON(result);
-		result = lv1_destruct_virtual_address_space(map.vas_id);
-		BUG_ON(result);
+		result += lv1_destruct_virtual_address_space(map.vas_id);
+
+		if (result) {
+			lv1_panic(0);
+		}
+
 		map.vas_id = 0;
 	}
 }
@@ -304,19 +305,20 @@ static void ps3_mm_region_destroy(struct mem_region *r)
 	int result;
 
 	if (!r->destroy) {
-		pr_info("%s:%d: Not destroying high region: %llxh %llxh\n",
-			__func__, __LINE__, r->base, r->size);
 		return;
 	}
 
-	DBG("%s:%d: r->base = %llxh\n", __func__, __LINE__, r->base);
-
 	if (r->base) {
 		result = lv1_release_memory(r->base);
-		BUG_ON(result);
+
+		if (result) {
+			lv1_panic(0);
+		}
+
 		r->size = r->base = r->offset = 0;
 		map.total = map.rm.size;
 	}
+
 	ps3_mm_set_repository_highmem(NULL);
 }
 
Signature · 1 line
2.20.1
author maintainer
#16 lore raw

PATCH v2 9/9 hvc_console: Allow backends to set I/O buffer size

In reply to Geoff Levand

To allow HVC backends to set the I/O buffer sizes to values that are most efficient for the backend, change the macro definitions where the buffer sizes are set to be conditional on whether or not the macros are already defined. Also, rename the macros from N_OUTBUF to HVC_N_OUBUF and from N_INBUF to HVC_N_INBUF.

Typical usage in the backend source file would be:

---
 drivers/tty/hvc/hvc_console.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)
drivers/tty/hvc/hvc_console.c +11 -8
index 436cc51c92c3..2928bad057fc 100644
@@ -42,12 +42,15 @@
 #define HVC_CLOSE_WAIT (HZ/100) /* 1/10 of a second */
 
 /*
- * These sizes are most efficient for vio, because they are the
- * native transfer size. We could make them selectable in the
- * future to better deal with backends that want other buffer sizes.
+ * These default sizes are most efficient for vio, because they are
+ * the native transfer size.
  */
-#define N_OUTBUF	16
-#define N_INBUF		16
+#if !defined(HVC_N_OUTBUF)
+# define HVC_N_OUTBUF	16
+#endif
+#if !defined(HVC_N_INBUF)
+# define HVC_N_INBUF	16
+#endif
 
 #define __ALIGNED__ __attribute__((__aligned__(sizeof(long))))
 
@@ -151,7 +154,7 @@ static uint32_t vtermnos[MAX_NR_HVC_CONSOLES] =
 static void hvc_console_print(struct console *co, const char *b,
 			      unsigned count)
 {
-	char c[N_OUTBUF] __ALIGNED__;
+	char c[HVC_N_OUTBUF] __ALIGNED__;
 	unsigned i = 0, n = 0;
 	int r, donecr = 0, index = co->index;
 
@@ -640,7 +643,7 @@ static int __hvc_poll(struct hvc_struct *hp, bool may_sleep)
 {
 	struct tty_struct *tty;
 	int i, n, count, poll_mask = 0;
-	char buf[N_INBUF] __ALIGNED__;
+	char buf[HVC_N_INBUF] __ALIGNED__;
 	unsigned long flags;
 	int read_total = 0;
 	int written_total = 0;
@@ -681,7 +684,7 @@ static int __hvc_poll(struct hvc_struct *hp, bool may_sleep)
 
  read_again:
 	/* Read data if any */
-	count = tty_buffer_request_room(&hp->port, N_INBUF);
+	count = tty_buffer_request_room(&hp->port, HVC_N_INBUF);
 
 	/* If flip is full, just reschedule a later read */
 	if (count == 0) {
Signature · 1 line
2.20.1
#17 lore raw

Re: [PATCH v2 9/9] hvc_console: Allow backends to set I/O buffer size

Quoted 1 line

Typical usage in the backend source file would be:

Is there any information missing in this change description accidentally?

Regards,
Markus

author maintainer
#18 lore raw

Re: [PATCH v3 9/9] hvc_console: Allow backends to set I/O buffer size

In reply to Geoff Levand

To allow HVC backends to set the I/O buffer sizes to values that are most efficient for the backend, change the macro definitions where the buffer sizes are set to be conditional on whether or not the macros are already defined. Also, rename the macros from N_OUTBUF to HVC_N_OUBUF and from N_INBUF to HVC_N_INBUF.

Typical usage in the backend source file would be:

#define HVC_N_OUTBUF 32
#define HVC_N_INBUF 32
#include "hvc_console.h"

---
 drivers/tty/hvc/hvc_console.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)
drivers/tty/hvc/hvc_console.c +11 -8
index 436cc51c92c3..2928bad057fc 100644
@@ -42,12 +42,15 @@
 #define HVC_CLOSE_WAIT (HZ/100) /* 1/10 of a second */
 
 /*
- * These sizes are most efficient for vio, because they are the
- * native transfer size. We could make them selectable in the
- * future to better deal with backends that want other buffer sizes.
+ * These default sizes are most efficient for vio, because they are
+ * the native transfer size.
  */
-#define N_OUTBUF	16
-#define N_INBUF		16
+#if !defined(HVC_N_OUTBUF)
+# define HVC_N_OUTBUF	16
+#endif
+#if !defined(HVC_N_INBUF)
+# define HVC_N_INBUF	16
+#endif
 
 #define __ALIGNED__ __attribute__((__aligned__(sizeof(long))))
 
@@ -151,7 +154,7 @@ static uint32_t vtermnos[MAX_NR_HVC_CONSOLES] =
 static void hvc_console_print(struct console *co, const char *b,
 			      unsigned count)
 {
-	char c[N_OUTBUF] __ALIGNED__;
+	char c[HVC_N_OUTBUF] __ALIGNED__;
 	unsigned i = 0, n = 0;
 	int r, donecr = 0, index = co->index;
 
@@ -640,7 +643,7 @@ static int __hvc_poll(struct hvc_struct *hp, bool may_sleep)
 {
 	struct tty_struct *tty;
 	int i, n, count, poll_mask = 0;
-	char buf[N_INBUF] __ALIGNED__;
+	char buf[HVC_N_INBUF] __ALIGNED__;
 	unsigned long flags;
 	int read_total = 0;
 	int written_total = 0;
@@ -681,7 +684,7 @@ static int __hvc_poll(struct hvc_struct *hp, bool may_sleep)
 
  read_again:
 	/* Read data if any */
-	count = tty_buffer_request_room(&hp->port, N_INBUF);
+	count = tty_buffer_request_room(&hp->port, HVC_N_INBUF);
 
 	/* If flip is full, just reschedule a later read */
 	if (count == 0) {
Signature · 1 line
2.20.1
#19 lore raw
In reply to Geoff Levand
Quoted 9 lines · Geoff Levand

This is a combined V2 of the two patch sets I sent out on March 27th, 'PS3 patches for v5.7' and 'powerpc: Minor updates to improve build debugging'.

I've dropped these two patches that were in my 'PS3 patches for v5.7' set:

powerpc/ps3: Add lv1_panic
powerpc/ps3: Add udbg_panic

[...]

Patches 1-6 and 8 applied to powerpc/next.

[1/9] powerpc/head_check: Automatic verbosity

      https://git.kernel.org/powerpc/c/4c592a34391ea4987d29c1718f931b50416ca015
[2/9] powerpc/wrapper: Output linker map file
      https://git.kernel.org/powerpc/c/f61200d3e3386e78d49677dfb3911c9d7c0dfe4b
[3/9] powerpc/head_check: Avoid broken pipe
      https://git.kernel.org/powerpc/c/331aa46aaf51325d8532a4948f5127b2edc441a5
[4/9] drivers/ps3: Remove duplicate error messages
      https://git.kernel.org/powerpc/c/6a8aa782cece2330322c33452a767f53f8ba38c9
[5/9] net/ps3_gelic_net: Remove duplicate error message
      https://git.kernel.org/powerpc/c/7b27b95a894d6a85c076f8d1f00e35316739bf51
[6/9] ps3disk: use the default segment boundary
      https://git.kernel.org/powerpc/c/720bc316690bd27dea9d71510b50f0cd698ffc32
[8/9] powerpc/ps3: Fix kexec shutdown hang
      https://git.kernel.org/powerpc/c/126554465d93b10662742128918a5fc338cda4aa

cheers