NetBSD Problem Report #58284

From tsutsui@ceres.dti.ne.jp  Sat May 25 21:37:47 2024
Return-Path: <tsutsui@ceres.dti.ne.jp>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 7F5971A923A
	for <gnats-bugs@gnats.NetBSD.org>; Sat, 25 May 2024 21:37:47 +0000 (UTC)
Message-Id: <202405252137.44PLbgRX028989@ceres.dti.ne.jp>
Date: Sun, 26 May 2024 06:37:42 +0900 (JST)
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
Reply-To: tsutsui@ceres.dti.ne.jp
To: gnats-bugs@NetBSD.org
Cc: tsutsui@ceres.dti.ne.jp
Subject: NetBSD/macppc 10.0 ofwboot fails to load GENERIC kernel
X-Send-Pr-Version: 3.95

>Number:         58284
>Category:       port-macppc
>Synopsis:       NetBSD/macppc 10.0 ofwboot fails to load GENERIC kernel
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    port-macppc-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat May 25 21:40:00 +0000 2024
>Last-Modified:  Mon May 27 16:00:02 +0000 2024
>Originator:     Izumi Tsutsui
>Release:        NetBSD 10.0
>Organization:
>Environment:
System: NetBSD lancer 10.0 NetBSD 10.0 (GENERIC) #0: mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/macppc/compile/GENERIC macppc
Architecture: powerpc
Machine: macppc
>Description:
After NetBSD/macppc 10.0 upgrade from 9.1, the secondary /ofwboot
fails to load 10.0 GENERIC kernel.

ofwboot from 9.1 can load the same 10.0 GENERIC kernel.
 https://mail-index.netbsd.org/netbsd-bugs/2024/05/25/msg083200.html

>How-To-Repeat:
---
Open Firmware, 2.0
To continue booting the MacOS type:
BYE<return>
To continue booting from the default boot device type:
BOOT<return>
 ok
0 > boot 
OF_open bootpath=ata/ATA-Disk@0
read stage 2 blocks: 01234. done!
starting stage 2...

>> NetBSD/macppc OpenFirmware Boot, Revision 1.14 (Thu Mar 28 08:33:33 UTC 2024)
>> Open Firmware version 2.x
>> Open Firmware running in virtual-mode.
Cannot use bootpath
Using boot-device instead
11800060+167172 [463008CLAIM failed!!! FAILED TO CLAIM PHYS 0xc6b000 size 0x71000
read section
 start=0x0
DEFAULT CATCH!, code=FFF00300 at   %SRR0: 00E0E328   %SRR1: 00003070 
 ok
0 > 

---

>Fix:
No idea, but there is a large set of changes in ofwboot between
9.x and 10.0:
 https://github.com/NetBSD/src/commit/558e557bc9e320dfbe0fdb4678b99d607e32e270

>> - When starting the boot program, cache a bunch of OFW frequently used
>>   ihandles / phandles, rather than fetching them all the time.
>> - Change the signature of OF_call_method() to take an array of cells for
>>   the inputs and outputs, rather than using variadic arguments.  This
>>   makes it much easier to use OF_call_method() when the format of the
>>   arguments passed to a given method are determined at run-time
>>   (due to e.g. #address-cells).
>> - Properly inform OpenFirmware where the kernel is loaded by using
>>   "claim" on /chosen/memory and, if running in virtual-mode, using
>>   "claim" on /chosen/mmu to reserve the VA, and "map" on /chosen/mmu
>>   to enter the translation.  (The kernel is still always mapped VA==PA.)

The error message "FAILED TO CLAIM PHYS 0x%lx size 0x%lx\n" was added
in this commit. (out of VA space on /chosen/mmu ?)

---
Izumi Tsutsui

>Audit-Trail:
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
To: gnats-bugs@netbsd.org
Cc: tsutsui@ceres.dti.ne.jp
Subject: Re: port-macppc/58284: NetBSD/macppc 10.0 ofwboot fails to load GENERIC
	 kernel
Date: Tue, 28 May 2024 00:57:50 +0900

 > >> NetBSD/macppc OpenFirmware Boot, Revision 1.14 (Thu Mar 28 08:33:33 UTC 2024)
 > >> Open Firmware version 2.x
 > >> Open Firmware running in virtual-mode.
 > Cannot use bootpath
 > Using boot-device instead
 > 11800060+167172 [463008CLAIM failed!!! FAILED TO CLAIM PHYS 0xc6b000 size 0x71000
 > read section
 >  start=0x0
 > DEFAULT CATCH!, code=FFF00300 at   %SRR0: 00E0E328   %SRR1: 00003070 
 >  ok
 > 0 > 

 It turns out this happens if "real-base" environment variable
 is set as "F00000" per macppc FAQ:
  http://www.netbsd.org/ports/macppc/faq.html#ofw-real-base

 After changing it to the default -1 (FFFFFFFF) 10.0 ofwboot can load
 GENERIC kernel.
 (Note changing the value to -1 requires power cycle..)


 ---

 0 > printenv 

 little-endian?      false               false
 real-mode?          false               false
 auto-boot?          false               true
 diag-switch?        false               false
 fcode-debug?        false               false
 oem-banner?         false               false
 oem-logo?           false               false
 use-nvramrc?        false               false
 real-base           F00000              -1 
 real-size           100000              100000 
 virt-base           -1                  -1 
 virt-size           100000              100000 
 load-base           70000               4000 
 pci-probe-list      -1                  -1 
 screen-#columns     64                  64 
 screen-#rows        28                  28 
 selftest-#megs      0                   0 
 boot-device         ata/ATA-Disk@0:0    /AAPL,ROM
 boot-file                               
 diag-device         fd:diags            fd:diags
 diag-file                               
 input-device        ttya                ttya
 output-device       ttya                ttya
 oem-banner                              
 oem-logo                                
 nvramrc                                 
 boot-command                            boot
  ok
 0 > boot -s 
 OF_open bootpath=ata/ATA-Disk@0
 read stage 2 blocks: 01234. done!
 starting stage 2...

 >> NetBSD/macppc OpenFirmware Boot, Revision 1.14 (Thu Mar 28 08:33:33 UTC 2024)
 >> Open Firmware version 2.x
 >> Open Firmware running in virtual-mode.
 Cannot use bootpath
 Using boot-device instead
 11800508+167172 [485712CLAIM failed!!! FAILED TO CLAIM PHYS 0xc6b000 size 0x76000
 read section
  start=0x0
 DEFAULT CATCH!, code=FFF00300 at   %SRR0: 00E0E328   %SRR1: 00003070 
  ok
 0 > setenv real-base -1 $SETENV: invalid number
  ok
 0 > setenv real-base ffffffff  ok
 0 > printenv 

 little-endian?      false               false
 real-mode?          false               false
 auto-boot?          false               true
 diag-switch?        false               false
 fcode-debug?        false               false
 oem-banner?         false               false
 oem-logo?           false               false
 use-nvramrc?        false               false
 real-base           -1                  -1 
 real-size           100000              100000 
 virt-base           -1                  -1 
 virt-size           100000              100000 
 load-base           70000               4000 
 pci-probe-list      -1                  -1 
 screen-#columns     64                  64 
 screen-#rows        28                  28 
 selftest-#megs      0                   0 
 boot-device         ata/ATA-Disk@0:0    /AAPL,ROM
 boot-file                               
 diag-device         fd:diags            fd:diags
 diag-file                               
 input-device        ttya                ttya
 output-device       ttya                ttya
 oem-banner                              
 oem-logo                                
 nvramrc                                 
 boot-command                            boot
  ok
 0 > reset-all 
 Open Firmware, 2.0
 To continue booting the MacOS type:
 BYE<return>
 To continue booting from the default boot device type:
 BOOT<return>
  ok
 0 > 

 [power cycle is required here]

 Open Firmware, 2.0
 To continue booting the MacOS type:
 BYE<return>
 To continue booting from the default boot device type:
 BOOT<return>
  ok
 0 > printenv 

 little-endian?      false               false
 real-mode?          false               false
 auto-boot?          false               true
 diag-switch?        false               false
 fcode-debug?        false               false
 oem-banner?         false               false
 oem-logo?           false               false
 use-nvramrc?        false               false
 real-base           -1                  -1 
 real-size           100000              100000 
 virt-base           -1                  -1 
 virt-size           100000              100000 
 load-base           70000               4000 
 pci-probe-list      -1                  -1 
 screen-#columns     64                  64 
 screen-#rows        28                  28 
 selftest-#megs      0                   0 
 boot-device         ata/ATA-Disk@0:0    /AAPL,ROM
 boot-file                               
 diag-device         fd:diags            fd:diags
 diag-file                               
 input-device        ttya                ttya
 output-device       ttya                ttya
 oem-banner                              
 oem-logo                                
 nvramrc                                 
 boot-command                            boot
  ok
 0 > boot -s 
 RESETing to change Configuration!

 OF_open bootpath=ata/ATA-Disk@0
 read stage 2 blocks: 01234. done!
 starting stage 2...

 >> NetBSD/macppc OpenFirmware Boot, Revision 1.14 (Thu Mar 28 08:33:33 UTC 2024)
 >> Open Firmware version 2.x
 >> Open Firmware running in virtual-mode.
 Cannot use bootpath
 Using boot-device instead
 11800508+167172 [485712+462533]=0xc51a38
  start=0x100000
 [   1.0000000] Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003,
 [   1.0000000]     2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013,
 [   1.0000000]     2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023,
 [   1.0000000]     2024
 [   1.0000000]     The NetBSD Foundation, Inc.  All rights reserved.
 [   1.0000000] Copyright (c) 1982, 1986, 1989, 1991, 1993
 [   1.0000000]     The Regents of the University of California.  All rights reserved.

 [   1.0000000] NetBSD 10.0 (GENERIC) #0: Sun May 26 12:11:08 JST 2024
 [   1.0000000]  tsutsui@mirage:/s/netbsd-10/src/sys/arch/macppc/compile/GENERIC
 [   1.0000000] total memory = 144 MB
 [   1.0000000] avail memory = 125 MB

  :

 # reboot
 reboot: rebooted by root
 [ 610.3571337] syncing disks... done
 [ 610.3571337] unmounting file systems...
 [ 610.3971679] unmounting done
 [ 610.4071554] rebooting


 Open Firmware, 2.0
 To continue booting the MacOS type:
 BYE<return>
 To continue booting from the default boot device type:
 BOOT<return>
  ok
 0 > printenv 

 little-endian?      false               false
 real-mode?          false               false
 auto-boot?          false               true
 diag-switch?        false               false
 fcode-debug?        false               false
 oem-banner?         false               false
 oem-logo?           false               false
 use-nvramrc?        false               false
 real-base           8F00000             -1 
 real-size           100000              100000 
 virt-base           -1                  -1 
 virt-size           100000              100000 
 load-base           70000               4000 
 pci-probe-list      -1                  -1 
 screen-#columns     64                  64 
 screen-#rows        28                  28 
 selftest-#megs      0                   0 
 boot-device         ata/ATA-Disk@0:0    /AAPL,ROM
 boot-file                               
 diag-device         fd:diags            fd:diags
 diag-file                               
 input-device        ttya                ttya
 output-device       ttya                ttya
 oem-banner                              
 oem-logo                                
 nvramrc                                 
 boot-command                            boot
  ok


 ---

 Maybe we need to update FAQ and installation notes?

 ---
 Izumi Tsutsui

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2024 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.