> Date: Fri, 3 Jul 2020 22:59:21 +0100
> From: Stuart Henderson <[email protected]>
> Cc: Mark Kettenis <[email protected]>, [email protected]
> Content-Type: text/plain; charset=us-ascii
> Content-Disposition: inline
>
> On 2020/07/03 22:34, Paul de Weerd wrote:
> > Hi Mark,
> >
> > On Fri, Jul 03, 2020 at 02:14:32PM +0200, Mark Kettenis wrote:
> > | > Date: Fri, 3 Jul 2020 13:37:19 +0200
> > | > From: Paul de Weerd <[email protected]>
> > | >
> > | > [ CC:'ing Mark ]
> > | >
> > | > My first guess hit the spot: after reverting Mark's commit, my RPi3
> > | > boots again, please find the dmesg below.
> > |
> > | These bits from you old dmesg worry me:
> > |
> > | > | | cpu1 at mainbus0 mpidr 1: failed to spin up
> > | > | | cpu2 at mainbus0 mpidr 2: failed to spin up
> > | > | | cpu3 at mainbus0 mpidr 3: failed to spin up
> > |
> > | What does a -current GENERIC.MP do?
> >
> > Well, that previous dmesg was with bsd.mp which I was experimenting
> > with at the time. I noticed those three lines, no processes were
> > scheduled on these cores (given those dmesg lines, that seemed
> > logical). But also, the machine would not reboot cleanly.
> >
> > Here's a dmesg from bsd.mp with the same tree that I built the
> > previous (sp) kernel from and that one diff backed out, it still has
> > the 'failed to spin up' lines, still doesn't schedule anything on
> > cpu{1,2,3} and it still doesn't go down cleanly (it keeps pinging
> > forever).
> >
> > Note that on bsd.sp, shutdown is trouble free.
> >
> > Cheers,
> >
> > Paul
> >
> > OpenBSD 6.7-current (GENERIC.MP) #0: Fri Jul 3 15:33:56 CEST 2020
> > [email protected]:/usr/src/sys/arch/arm64/compile/GENERIC.MP
> > real mem = 953458688 (909MB)
> > avail mem = 891850752 (850MB)
> > random: good seed from bootblocks
> > mainbus0 at root: Raspberry Pi 3 Model B Rev 1.2
> > cpu0 at mainbus0 mpidr 0: ARM Cortex-A53 r0p4
> > cpu0: 32KB 64b/line 2-way L1 VIPT I-cache, 32KB 64b/line 4-way L1 D-cache
> > cpu0: 512KB 64b/line 16-way L2 cache
> > efi0 at mainbus0: UEFI 2.0.5
> > efi0: Das U-boot rev 0x0
> > apm0 at mainbus0
> > simplefb0 at mainbus0: 656x416, 32bpp
> > wsdisplay0 at simplefb0 mux 1
> > wsdisplay0: screen 0-5 added (std, vt100 emulation)
> > "system" at mainbus0 not configured
> > "axi" at mainbus0 not configured
> > simplebus0 at mainbus0: "soc"
> > bcmdmac0 at simplebus0: DMA2 DMA4 DMA5 DMA8 DMA9 DMA10
> > bcmintc0 at simplebus0
> > bcmmbox0 at simplebus0
> > bcmgpio0 at simplebus0
> > syscon0 at simplebus0: "syscon"
> > bcmdog0 at simplebus0
> > bcmrng0 at simplebus0
> > pluart0 at simplebus0
> > bcmsdhost0 at simplebus0: 250 MHz base clock
> > sdmmc0 at bcmsdhost0: 4-bit, sd high-speed, mmc high-speed, dma
> > com0 at simplebus0: ns16550, no working fifo
> > com0: console
> > "mmc" at simplebus0 not configured
> > dwctwo0 at simplebus0
> > "firmware" at simplebus0 not configured
> > "power" at simplebus0 not configured
> > "leds" at simplebus0 not configured
> > "fb" at simplebus0 not configured
> > "vchiq" at simplebus0 not configured
> > "thermal" at simplebus0 not configured
> > "local_intc" at simplebus0 not configured
> > "arm-pmu" at simplebus0 not configured
> > "gpiomem" at simplebus0 not configured
> > agtimer0 at simplebus0: tick rate 19200 KHz
> > "virtgpio" at simplebus0 not configured
> > simplebus1 at mainbus0: "clocks"
> > "clock" at simplebus1 not configured
> > "clock" at simplebus1 not configured
> > "clock" at simplebus1 not configured
> > "clock" at simplebus1 not configured
> > "clock" at simplebus1 not configured
> > "clock" at simplebus1 not configured
> > "clock" at simplebus1 not configured
> > cpu1 at mainbus0 mpidr 1: failed to spin up
> > cpu2 at mainbus0 mpidr 2: failed to spin up
> > cpu3 at mainbus0 mpidr 3: failed to spin up
> > usb0 at dwctwo0: USB revision 2.0
> > sdmmc0: can't enable card
> > uhub0 at usb0 configuration 1 interface 0 "Broadcom DWC2 root hub" rev
> > 2.00/1.00 addr 1
> > uhub1 at uhub0 port 1 configuration 1 interface 0 "Standard Microsystems
> > product 0x9514" rev 2.00/2.00 addr 2
> > smsc0 at uhub1 port 1 configuration 1 interface 0 "Standard Microsystems
> > SMSC9512/14" rev 2.00/2.00 addr 3
> > smsc0: address b8:27:eb:93:42:d5
> > ukphy0 at smsc0 phy 1: Generic IEEE 802.3u media interface, rev. 3: OUI
> > 0x0001f0, model 0x000c
> > urtwn0 at uhub1 port 2 configuration 1 interface 0 "Realtek 802.11n NIC"
> > rev 2.00/0.00 addr 4
> > urtwn0: MAC/BB RTL8188EU, RF 6052 1T1R, address ec:08:6b:07:c2:1c
> > umass0 at uhub1 port 4 configuration 1 interface 0 "SanDisk Ultra Fit" rev
> > 2.10/1.00 addr 5
> > umass0: using SCSI over Bulk-Only
> > scsibus0 at umass0: 2 targets, initiator 0
> > sd0 at scsibus0 targ 1 lun 0: <SanDisk, Ultra Fit, 1.00> removable
> > serial.07815583320220107303
> > sd0: 29327MB, 512 bytes/sector, 60062500 sectors
> > vscsi0 at root
> > scsibus1 at vscsi0: 256 targets
> > softraid0 at root
> > scsibus2 at softraid0: 256 targets
> > bootfile: sd0a:/bsd
> > boot device: sd0
> > root on sd0a (59de83c8e783b811.a) swap on sd0b dump on sd0b
> > WARNING: CHECK AND RESET THE DATE!
> > gpio0 at bcmgpio0: 54 pins
> >
> >
> > --
> > >++++++++[<++++++++++>-]<+++++++.>+++[<------>-]<.>+++[<+
> > +++++++++++>-]<.>++[<------------>-]<+.--------------.[-]
> > http://www.weirdnet.nl/
> >
>
> By the way I don't see the "failed to spin up" on my pi3 (either old
> kernel, or new kernel with the commit reverted) - and processes do
> indeed get scheduled on all cores.
That probably means Paul is using somewhat broken firmware.
Anyway, I think the problem is that OF_finddevice() returns -1 if the
node can't be found. Does the following diff help?
Index: arch/arm64/dev/mainbus.c
===================================================================
RCS file: /cvs/src/sys/arch/arm64/dev/mainbus.c,v
retrieving revision 1.17
diff -u -p -r1.17 mainbus.c
--- arch/arm64/dev/mainbus.c 17 Jun 2020 08:00:22 -0000 1.17
+++ arch/arm64/dev/mainbus.c 3 Jul 2020 22:16:43 -0000
@@ -316,7 +316,7 @@ mainbus_attach_cpus(struct device *self,
int acells, scells;
char buf[32];
- if (node == 0)
+ if (node == -1)
return;
acells = sc->sc_acells;
@@ -369,7 +369,7 @@ mainbus_attach_psci(struct device *self)
struct mainbus_softc *sc = (struct mainbus_softc *)self;
int node = OF_finddevice("/psci");
- if (node == 0)
+ if (node == -1)
return;
sc->sc_early = 1;
@@ -384,7 +384,8 @@ mainbus_attach_efi(struct device *self)
struct fdt_attach_args fa;
int node = OF_finddevice("/chosen");
- if (node == 0 || OF_getproplen(node, "openbsd,uefi-system-table") <= 0)
+ if (node == -1 ||
+ OF_getproplen(node, "openbsd,uefi-system-table") <= 0)
return;
memset(&fa, 0, sizeof(fa));