9front - general discussion about 9front
 help / color / mirror / Atom feed
* [9front] 9front on Raspberry Pi 400
@ 2021-01-20 17:23 Mack Wallace
  2021-01-23 16:11 ` cinap_lenrek
  0 siblings, 1 reply; 21+ messages in thread
From: Mack Wallace @ 2021-01-20 17:23 UTC (permalink / raw)
  To: 9front

I have been trying to get 9 on my recently purchased Raspberry Pi 400, but have been running into some roadblocks. For better or worse, I started with the 9fans group and have managed to get labs 9 working. However, that lacks the 9front tools that I need to do things like rcpu, etc. 

So while I have had a bit of history trying to make this work, I’ll give you the most recent iteration. 

I used balenaEtcher to write the most recent pi3 image to a micro SD card. Upon booting that, I get the following;


127 holes free
0x004f0000 0x3e600000 1041301504
1041301504 bytes free

Plan 9
cpu0: 1500 MHz ARM Cortex-A72 r0p3
4006M Memory: 998M kernel data, 3008M user, 15011M swap
pcienable PCI.0.0.0: pcr 0->7
pcienable PCI.1.0.0: pcr 0->2
bus dev type     vid  did  intl memory
0   0/0 06 04 00 14e4 2711   0  ioa:00000000-00001000 4096 nema:600000000-600100000 1048576 ->1
1   0/0 0c 03 30 1106 3483   0  0:600000007 4096
#l0: genet: 1000Mbps port 0xFFFFFFFFBD580000 irq 189 ea dca632e63357
usbxhci: 0x1106 0x3483: port 600000000 size 4096 irq 0
cpu3: 1500MHz ARM Cortex-A72 r0p3
cpu2: 1500MHz ARM Cortex-A72 r0p3
cpu1: 1500MHz ARM Cortex-A72 r0p3
#l0: phy1 id 600d84a2 oui 80361
sdhc: readerror intr 2008002 stat 1fff0000
	{repeats 15 times}
/dev/sdM0: BCM SD Host Controller 02 Version 10
sdhc: readerror intr 2008002 stat 1fff0000
	{repeats 40 or so times}
/dev/sdM0/data
bootargs is (tcp, tls, il, local!device)[]


In my many times trying different things, I have had a few other errors. However, what I am showing is what I am getting now consistently having done the following.
I’ve replaced the Pi firmware files with the latest at of today. I then added ‘enable_gic=1’ to the config.txt file with no change.

Consistent amongst the previous attempts were the same one or two errors repeated many times, and not keyboard or mouse response (not surprising as the newer Pis need to have their usb firmware uploaded in the kernel). 

In case there were newer updates to the source, I did a sysupdate on a laptop I have with 9 and then tried to cross-compile a new kernel. However, I get a much smaller kernel (only 2.9MB rather than the 4.4MB in the 9front Pi image. I don’t know if this is unexpected. When I try to boot that kernel. The console screen comes up. But after CPU detection, the kernel panics and stops booting. I presume this is a problem with my compilation, (or myself) so I won’t clutter things up here with that kmesg unless asked for it. 

Hope someone has some guidance.


Thanks in advance!

Mack

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

* Re: [9front] 9front on Raspberry Pi 400
  2021-01-20 17:23 [9front] 9front on Raspberry Pi 400 Mack Wallace
@ 2021-01-23 16:11 ` cinap_lenrek
  2021-01-23 21:08   ` Mack Wallace
  2021-01-23 21:13   ` Mack Wallace
  0 siblings, 2 replies; 21+ messages in thread
From: cinap_lenrek @ 2021-01-23 16:11 UTC (permalink / raw)
  To: 9front

> In my many times trying different things, I have had a few other errors.
> However, what I am showing is what I am getting now consistently having done the following.

There might be some differences in the sdhc controller driver.
I can take a look later today and see...

> I’ve replaced the Pi firmware files with the latest at of today.
> I then added ‘enable_gic=1’ to the config.txt file with no change.

The 9front pi4 kernel is for arm64 (armv8), where the GIC is required.
The firmware should have enabled the GIC when loading a 64-bit kernel.

Tho i had encountered some firmware bugs before where firmware disabled
the GIC (just masked interrupt routing to EL1) when the kernel image
file was not a multiple of 4 bytes. But i think they fixed that.
There are some mask registers in the GIC that we could check to
see if this is the case.

> Consistent amongst the previous attempts were the same one or two errors
> repeated many times, and not keyboard or mouse response
> (not surprising as the newer Pis need to have their usb firmware uploaded in the kernel).

I do not know what you mean by this. The kernel does the firmware mailbox
call to notify firmware that we did a reset of the pcie controller
to load the XHCI firmware. This was a problem with the 8GB models of the
raspberry pi4 and has been addressed.

This is done in /sys/src/9/bcm64/archbcm4.c:^archbcm4link() function:

void
archbcm4link(void)
{
	Pcidev *p;

	/*
	 * The firmware resets PCI before starting the host OS because
	 * without SDRAM the VL805 makes inbound requests to page-in firmware
	 * from SDRAM. If the OS has a different PCI mapping that would all break.
	 * There's no way to pause and move the mappings and it's not really desirable
	 * for the firmware to dictate the PCI configuration. Consequently, the mailbox
	 * is required so that the OS can reset the VLI after asserting PCI chip reset.
	 */
	if((p = pcimatch(nil, 0x1106, 0x3483)) != nil)
		xhcireset(BUSBNO(p->tbdf)<<20 | BUSDNO(p->tbdf)<<15 | BUSFNO(p->tbdf)<<12);

	// addclock0link(wdogfeed, HZ);
}

I do not know the pi400 architecture but could it be possible that they
connected the keyboard to the DesignWave usb 2.0 controller instead?
The pi4 kernel does not include the dwc controller driver like the pi3,
because on the pi4 it is not used. On the pi400 i do not know.

> In case there were newer updates to the source, I did a sysupdate on a laptop
> I have with 9 and then tried to cross-compile a new kernel.

> However, I get a much smaller kernel (only 2.9MB rather than the 4.4MB in the
> 9front Pi image. I don’t know if this is unexpected. When I try to boot that kernel.
> The console screen comes up. But after CPU detection, the kernel panics and stops booting.

The 9front kernel includes a small compressed ram filesystem with a
shell environment (you can enter it by typing !rc on bootargs prompt).
Before you build the kernel, you need to have all these userspace programs
compiled for the kernel's architecture (arm64 in this case).

I do not know how you compiled the pi4 kernel, but here is how it should
work on 9front:

1) Compile userspace

cd /sys/src
objtype=arm64 mk install

2) Compile the kernel

cd /sys/src/9/bcm64
mk 'CONF=pi4' install

now, you should'v got a /arm64/9pi4 and /arm64/s9pi4.

The 9pi4 file is a stripped raw flat image that can be loaded
by the pi's firmware.

The s9pi4 file is the same kernel with the native a.out
header and debug symbols, so it can be loaded in acid
and also used for /dev/reboot'ing into it from a running system.

Hope this helps...

--
cinap

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

* Re: [9front] 9front on Raspberry Pi 400
  2021-01-23 16:11 ` cinap_lenrek
@ 2021-01-23 21:08   ` Mack Wallace
  2021-01-23 21:13   ` Mack Wallace
  1 sibling, 0 replies; 21+ messages in thread
From: Mack Wallace @ 2021-01-23 21:08 UTC (permalink / raw)
  To: 9front

[-- Attachment #1: Type: text/plain, Size: 34335 bytes --]

Cinap, 

Thank you for the response. 

As for me building the kernel - I did not build the user space previously. I was thinking that I just wanted a kernel. Why build the whole user space? But I was wrong. I understand. So by building the user space, I got a stripped kernel that was much more akin to what was in the last 9front image, with the new kernel weighing in at 4.8MB. Unfortunately, the new kernel exhibits the same problems as before. Some minor changes in the bootup screen, but I don’t think anything that is newly notable. I will include a transcription of it again below.

I have tried to use different USB mice and external keyboard. None of these are responsive during the 9front boot. They do work in raspian or labs 9 on the pi400. The xhcireset(BUSBNO(p->tbdf)<<20 | BUSDNO(p->tbdf)<<15 | BUSFNO(p->tbdf)<<12); was mentioned when addressing this in the labs version - so maybe the sdhc errors is preventing usb detection? Looking for the labs boot, none of the usb devices start to work until after I see "usb/hub... usb/kb... usb/kb... usb/kb... usb/kb... time…” come up in the startup, just after the detection of the additional cores. Is there any similar message I should be seeing in 9front?

I’m providing the raspian dmesg. I don’t know if it is of any use, but maybe you can glean what is hooked to which USB hub. When I booted this I had the lenovo mouse in the USB 2.0 port and the keyboard and Raspberry Pi (Pixart) mouse in USB 3.0 ports. 

Certainly if there’s any other information I need or can provide - just ask. 

Thanks again,

Mack 


Latest 9front console ‘kmesg’ on boot:

127 holes free
0x00550000 0x3e600000 1040908288
1040908288 bytes free

Plan 9
cpu0: 1800 MHz ARM Cortex-A72 r0p3
4006M Memory: 998M kernel data, 3008M user, 15011M swap
pcienable PCI.0.0.0: pcr 0->7
pcienable PCI.1.0.0: pcr 0->2
bus dev type     vid  did  intl memory
0   0/0 06 04 00 14e4 2711   0  ioa:00000000-00001000 4096 mema:600000000-600100000 1048576 ->1
1   0/0 0c 03 30 1106 3483   0  0:600000004 4096
#l0: genet: 1000Mbps port 0xFFFFFFFFBD580000 irq 189 ea dca632e63357
usbxhci: 0x1106 0x3483: port 600000000 size 4096 irq 0
cpu3: 1800MHz ARM Cortex-A72 r0p3
cpu2: 1800MHz ARM Cortex-A72 r0p3
cpu1: 1800MHz ARM Cortex-A72 r0p3
#l0: phy1 id 600d84a2 oui 80361
sdhc: readerror intr 2008002 stat 1fff0000
	{repeats over 20 times}
/dev/sdM0: BCM SD Host Controller 02 Version 10
sdhc: readerror intr 2008002 stat 1fff0000
	{repeats 40 or so times}
/dev/sdM0/data
bootargs is (tcp, tls, il, local!device)[]



Raspian Dmesg:
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 5.4.51-v7l+ (dom@buildbot) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1333 SMP Mon Aug 10 16:51:40 BST 2020
[    0.000000] CPU: ARMv7 Processor [410fd083] revision 3 (ARMv7), cr=30c5383d
[    0.000000] CPU: div instructions available: patching division code
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, PIPT instruction cache
[    0.000000] OF: fdt: Machine model: Raspberry Pi 400 Rev 1.0
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] Reserved memory: created CMA memory pool at 0x000000001ec00000, size 256 MiB
[    0.000000] OF: reserved mem: initialized node linux,cma, compatible id shared-dma-pool
[    0.000000] On node 0 totalpages: 1012736
[    0.000000]   DMA zone: 2304 pages used for memmap
[    0.000000]   DMA zone: 0 pages reserved
[    0.000000]   DMA zone: 196608 pages, LIFO batch:63
[    0.000000]   HighMem zone: 816128 pages, LIFO batch:63
[    0.000000] percpu: Embedded 20 pages/cpu s49856 r8192 d23872 u81920
[    0.000000] pcpu-alloc: s49856 r8192 d23872 u81920 alloc=20*4096
[    0.000000] pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3 
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 1010432
[    0.000000] Kernel command line: coherent_pool=1M 8250.nr_uarts=0 snd_bcm2835.enable_compat_alsa=0 snd_bcm2835.enable_hdmi=1 snd_bcm2835.enable_headphones=1 video=HDMI-A-1:1920x1080M@60,margin_left=48,margin_right=48,margin_top=48,margin_bottom=48 smsc95xx.macaddr=DC:A6:32:E6:33:57 vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000  console=ttyS0,115200 console=tty1 root=PARTUUID=b42855bb-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles
[    0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes, linear)
[    0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes, linear)
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] software IO TLB: mapped [mem 0x17cc0000-0x1bcc0000] (64MB)
[    0.000000] Memory: 3655616K/4050944K available (10240K kernel code, 725K rwdata, 2740K rodata, 2048K init, 853K bss, 133184K reserved, 262144K cma-reserved, 3264512K highmem)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] ftrace: allocating 30051 entries in 59 pages
[    0.000000] rcu: Hierarchical RCU implementation.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000000] GIC: Using split EOI/Deactivate mode
[    0.000000] random: get_random_bytes called from start_kernel+0x340/0x518 with crng_init=0
[    0.000008] sched_clock: 32 bits at 1000kHz, resolution 1000ns, wraps every 2147483647500ns
[    0.000025] clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1911260446275 ns
[    0.000104] bcm2835: system timer (irq = 17)
[    0.000778] arch_timer: cp15 timer(s) running at 54.00MHz (phys).
[    0.000795] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0xc743ce346, max_idle_ns: 440795203123 ns
[    0.000812] sched_clock: 56 bits at 54MHz, resolution 18ns, wraps every 4398046511102ns
[    0.000824] Switching to timer-based delay loop, resolution 18ns
[    0.001078] Console: colour dummy device 80x30
[    0.001111] printk: console [tty1] enabled
[    0.001161] Calibrating delay loop (skipped), value calculated using timer frequency.. 108.00 BogoMIPS (lpj=540000)
[    0.001182] pid_max: default: 32768 minimum: 301
[    0.001505] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes, linear)
[    0.001527] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes, linear)
[    0.002760] Disabling memory control group subsystem
[    0.002866] CPU: Testing write buffer coherency: ok
[    0.003367] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[    0.004222] Setting up static identity map for 0x200000 - 0x20003c
[    0.004411] rcu: Hierarchical SRCU implementation.
[    0.005061] smp: Bringing up secondary CPUs ...
[    0.006277] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
[    0.007604] CPU2: thread -1, cpu 2, socket 0, mpidr 80000002
[    0.008875] CPU3: thread -1, cpu 3, socket 0, mpidr 80000003
[    0.009021] smp: Brought up 1 node, 4 CPUs
[    0.009036] SMP: Total of 4 processors activated (432.00 BogoMIPS).
[    0.009049] CPU: All CPU(s) started in HYP mode.
[    0.009060] CPU: Virtualization extensions available.
[    0.009859] devtmpfs: initialized
[    0.023252] VFP support v0.3: implementor 41 architecture 3 part 40 variant 8 rev 0
[    0.023506] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.023533] futex hash table entries: 1024 (order: 4, 65536 bytes, linear)
[    0.031458] pinctrl core: initialized pinctrl subsystem
[    0.032544] NET: Registered protocol family 16
[    0.036446] DMA: preallocated 1024 KiB pool for atomic coherent allocations
[    0.038188] hw-breakpoint: found 5 (+1 reserved) breakpoint and 4 watchpoint registers.
[    0.038201] hw-breakpoint: maximum watchpoint size is 8 bytes.
[    0.038557] Serial: AMBA PL011 UART driver
[    0.042162] bcm2835-mbox fe00b880.mailbox: mailbox enabled
[    0.060844] raspberrypi-firmware soc:firmware: Attached to firmware from 2020-08-19 17:38, variant start
[    0.070860] raspberrypi-firmware soc:firmware: Firmware hash is e90cba19a98a0d1f2ef086b9cafcbca00778f094
[    0.124768] bcm2835-dma fe007000.dma: DMA legacy API manager, dmachans=0x1
[    0.129263] vgaarb: loaded
[    0.129752] SCSI subsystem initialized
[    0.129968] usbcore: registered new interface driver usbfs
[    0.130036] usbcore: registered new interface driver hub
[    0.130168] usbcore: registered new device driver usb
[    0.131863] clocksource: Switched to clocksource arch_sys_counter
[    0.883170] VFS: Disk quotas dquot_6.6.0
[    0.883272] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[    0.883466] FS-Cache: Loaded
[    0.883668] CacheFiles: Loaded
[    0.884602] simple-framebuffer 3e4e0000.framebuffer: framebuffer at 0x3e4e0000, 0x6e7000 bytes, mapped to 0x(ptrval)
[    0.884620] simple-framebuffer 3e4e0000.framebuffer: format=a8r8g8b8, mode=1824x984x32, linelength=7296
[    0.885117] Console: switching to colour frame buffer device 228x61
[    0.894361] simple-framebuffer 3e4e0000.framebuffer: fb0: simplefb registered!
[    0.904042] thermal_sys: Registered thermal governor 'step_wise'
[    0.904408] NET: Registered protocol family 2
[    0.905155] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 6144 bytes, linear)
[    0.905185] TCP established hash table entries: 8192 (order: 3, 32768 bytes, linear)
[    0.905261] TCP bind hash table entries: 8192 (order: 4, 65536 bytes, linear)
[    0.905339] TCP: Hash tables configured (established 8192 bind 8192)
[    0.905493] UDP hash table entries: 512 (order: 2, 16384 bytes, linear)
[    0.905526] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes, linear)
[    0.905787] NET: Registered protocol family 1
[    0.906528] RPC: Registered named UNIX socket transport module.
[    0.906541] RPC: Registered udp transport module.
[    0.906553] RPC: Registered tcp transport module.
[    0.906565] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.906585] PCI: CLS 0 bytes, default 64
[    0.908498] hw perfevents: enabled with armv7_cortex_a15 PMU driver, 7 counters available
[    0.910656] Initialise system trusted keyrings
[    0.910892] workingset: timestamp_bits=14 max_order=20 bucket_order=6
[    0.921685] FS-Cache: Netfs 'nfs' registered for caching
[    0.922460] NFS: Registering the id_resolver key type
[    0.922517] Key type id_resolver registered
[    0.922529] Key type id_legacy registered
[    0.922552] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[    0.923686] Key type asymmetric registered
[    0.923700] Asymmetric key parser 'x509' registered
[    0.923864] bounce: pool size: 64 pages
[    0.923924] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 249)
[    0.924143] io scheduler mq-deadline registered
[    0.924157] io scheduler kyber registered
[    0.927974] brcm-pcie fd500000.pcie: host bridge /scb/pcie@7d500000 ranges:
[    0.927998] brcm-pcie fd500000.pcie:   No bus range found for /scb/pcie@7d500000, using [bus 00-ff]
[    0.928062] brcm-pcie fd500000.pcie:      MEM 0x0600000000..0x0603ffffff -> 0x00f8000000
[    0.928126] brcm-pcie fd500000.pcie:   IB MEM 0x0000000000..0x00ffffffff -> 0x0100000000
[    1.013977] brcm-pcie fd500000.pcie: link up, 5 GT/s x1 (SSC)
[    1.014280] brcm-pcie fd500000.pcie: PCI host bridge to bus 0000:00
[    1.014297] pci_bus 0000:00: root bus resource [bus 00-ff]
[    1.014318] pci_bus 0000:00: root bus resource [mem 0x600000000-0x603ffffff] (bus address [0xf8000000-0xfbffffff])
[    1.014376] pci 0000:00:00.0: [14e4:2711] type 01 class 0x060400
[    1.014620] pci 0000:00:00.0: PME# supported from D0 D3hot
[    1.018052] PCI: bus0: Fast back to back transfers disabled
[    1.018073] pci 0000:00:00.0: bridge configuration invalid ([bus 00-00]), reconfiguring
[    1.018336] pci 0000:01:00.0: [1106:3483] type 00 class 0x0c0330
[    1.018480] pci 0000:01:00.0: reg 0x10: [mem 0x00000000-0x00000fff 64bit]
[    1.018899] pci 0000:01:00.0: PME# supported from D0 D3hot
[    1.022302] PCI: bus1: Fast back to back transfers disabled
[    1.022321] pci_bus 0000:01: busn_res: [bus 01-ff] end is updated to 01
[    1.022362] pci 0000:00:00.0: BAR 8: assigned [mem 0x600000000-0x6000fffff]
[    1.022385] pci 0000:01:00.0: BAR 0: assigned [mem 0x600000000-0x600000fff 64bit]
[    1.022464] pci 0000:00:00.0: PCI bridge to [bus 01]
[    1.022487] pci 0000:00:00.0:   bridge window [mem 0x600000000-0x6000fffff]
[    1.022793] pcieport 0000:00:00.0: enabling device (0140 -> 0142)
[    1.023039] pcieport 0000:00:00.0: PME: Signaling with IRQ 55
[    1.023418] pcieport 0000:00:00.0: AER: enabled with IRQ 55
[    1.023765] pci 0000:01:00.0: enabling device (0140 -> 0142)
[    1.082284] pci 0000:01:00.0: quirk_usb_early_handoff+0x0/0x7b8 took 57164 usecs
[    1.089486] iproc-rng200 fe104000.rng: hwrng registered
[    1.089798] vc-mem: phys_addr:0x00000000 mem_base=0x3ec00000 mem_size:0x40000000(1024 MiB)
[    1.090453] vc-sm: Videocore shared memory driver
[    1.090981] gpiomem-bcm2835 fe200000.gpiomem: Initialised: Registers at 0xfe200000
[    1.103040] brd: module loaded
[    1.115388] loop: module loaded
[    1.116787] Loading iSCSI transport class v2.0-870.
[    1.118806] libphy: Fixed MDIO Bus: probed
[    1.119389] bcmgenet fd580000.ethernet: failed to get enet clock
[    1.119407] bcmgenet fd580000.ethernet: GENET 5.0 EPHY: 0x0000
[    1.119429] bcmgenet fd580000.ethernet: failed to get enet-wol clock
[    1.119448] bcmgenet fd580000.ethernet: failed to get enet-eee clock
[    1.119474] bcmgenet: Skipping UMAC reset
[    1.131903] libphy: bcmgenet MII bus: probed
[    1.221963] unimac-mdio unimac-mdio.-19: Broadcom UniMAC MDIO bus
[    1.223025] usbcore: registered new interface driver r8152
[    1.223089] usbcore: registered new interface driver lan78xx
[    1.223146] usbcore: registered new interface driver smsc95xx
[    1.223563] xhci_hcd 0000:01:00.0: xHCI Host Controller
[    1.223598] xhci_hcd 0000:01:00.0: new USB bus registered, assigned bus number 1
[    1.225790] xhci_hcd 0000:01:00.0: hcc params 0x002841eb hci version 0x100 quirks 0x0000001000000890
[    1.227024] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.04
[    1.227041] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    1.227056] usb usb1: Product: xHCI Host Controller
[    1.227070] usb usb1: Manufacturer: Linux 5.4.51-v7l+ xhci-hcd
[    1.227084] usb usb1: SerialNumber: 0000:01:00.0
[    1.227668] hub 1-0:1.0: USB hub found
[    1.227769] hub 1-0:1.0: 1 port detected
[    1.228300] xhci_hcd 0000:01:00.0: xHCI Host Controller
[    1.228325] xhci_hcd 0000:01:00.0: new USB bus registered, assigned bus number 2
[    1.228347] xhci_hcd 0000:01:00.0: Host supports USB 3.0 SuperSpeed
[    1.228801] usb usb2: New USB device found, idVendor=1d6b, idProduct=0003, bcdDevice= 5.04
[    1.228817] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    1.228832] usb usb2: Product: xHCI Host Controller
[    1.228846] usb usb2: Manufacturer: Linux 5.4.51-v7l+ xhci-hcd
[    1.228860] usb usb2: SerialNumber: 0000:01:00.0
[    1.229446] hub 2-0:1.0: USB hub found
[    1.229510] hub 2-0:1.0: 4 ports detected
[    1.230897] dwc_otg: version 3.00a 10-AUG-2012 (platform bus)
[    1.231171] dwc_otg: FIQ enabled
[    1.231182] dwc_otg: NAK holdoff enabled
[    1.231193] dwc_otg: FIQ split-transaction FSM enabled
[    1.231208] Module dwc_common_port init
[    1.231676] usbcore: registered new interface driver uas
[    1.231783] usbcore: registered new interface driver usb-storage
[    1.232027] mousedev: PS/2 mouse device common for all mice
[    1.235758] bcm2835-wdt bcm2835-wdt: Broadcom BCM2835 watchdog timer
[    1.238387] sdhci: Secure Digital Host Controller Interface driver
[    1.238399] sdhci: Copyright(c) Pierre Ossman
[    1.238996] mmc-bcm2835 fe300000.mmcnr: could not get clk, deferring probe
[    1.239559] sdhci-pltfm: SDHCI platform and OF driver helper
[    1.243252] ledtrig-cpu: registered to indicate activity on CPUs
[    1.243573] hidraw: raw HID events driver (C) Jiri Kosina
[    1.243764] usbcore: registered new interface driver usbhid
[    1.243776] usbhid: USB HID core driver
[    1.244812] vchiq: vchiq_init_state: slot_zero = (ptrval)
[    1.246857] [vc_sm_connected_init]: start
[    1.256926] [vc_sm_connected_init]: end - returning 0
[    1.258997] Initializing XFRM netlink socket
[    1.259034] NET: Registered protocol family 17
[    1.259139] Key type dns_resolver registered
[    1.259605] Registering SWP/SWPB emulation handler
[    1.259927] registered taskstats version 1
[    1.259944] Loading compiled-in X.509 certificates
[    1.260420] Key type ._fscrypt registered
[    1.260432] Key type .fscrypt registered
[    1.270555] uart-pl011 fe201000.serial: cts_event_workaround enabled
[    1.270638] fe201000.serial: ttyAMA0 at MMIO 0xfe201000 (irq = 29, base_baud = 0) is a PL011 rev2
[    1.276602] bcm2835-power bcm2835-power: Broadcom BCM2835 power domains driver
[    1.277502] mmc-bcm2835 fe300000.mmcnr: mmc_debug:0 mmc_debug2:0
[    1.277516] mmc-bcm2835 fe300000.mmcnr: DMA channel allocated
[    1.326935] mmc1: queuing unknown CIS tuple 0x80 (2 bytes)
[    1.328571] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
[    1.330264] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
[    1.333320] mmc1: queuing unknown CIS tuple 0x80 (7 bytes)
[    1.334977] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
[    1.342460] mmc0: SDHCI controller on fe340000.emmc2 [fe340000.emmc2] using ADMA
[    1.345434] of_cfs_init
[    1.345552] of_cfs_init: OK
[    1.346816] Waiting for root device PARTUUID=b42855bb-02...
[    1.385018] random: fast init done
[    1.416442] mmc1: new high speed SDIO card at address 0001
[    1.451250] mmc0: new ultra high speed DDR50 SDHC card at address aaaa
[    1.452308] mmcblk0: mmc0:aaaa SC16G 14.8 GiB
[    1.455491]  mmcblk0: p1 p2
[    1.470266] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[    1.470339] VFS: Mounted root (ext4 filesystem) readonly on device 179:2.
[    1.475441] devtmpfs: mounted
[    1.483570] Freeing unused kernel memory: 2048K
[    1.512218] Run /sbin/init as init process
[    1.591921] usb 1-1: new high-speed USB device number 2 using xhci_hcd
[    1.774560] usb 1-1: New USB device found, idVendor=2109, idProduct=3431, bcdDevice= 4.21
[    1.774580] usb 1-1: New USB device strings: Mfr=0, Product=1, SerialNumber=0
[    1.774617] usb 1-1: Product: USB2.0 Hub
[    1.776738] hub 1-1:1.0: USB hub found
[    1.777084] hub 1-1:1.0: 4 ports detected
[    1.889123] systemd[1]: System time before build time, advancing clock.
[    1.998096] NET: Registered protocol family 10
[    1.999415] Segment Routing with IPv6
[    2.038526] systemd[1]: systemd 241 running in system mode. (+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN -PCRE2 default-hierarchy=hybrid)
[    2.039277] systemd[1]: Detected architecture arm.
[    2.111927] usb 1-1.1: new low-speed USB device number 3 using xhci_hcd
[    2.118239] systemd[1]: Set hostname to <raspberrypi>.
[    2.250259] usb 1-1.1: New USB device found, idVendor=093a, idProduct=2510, bcdDevice= 1.00
[    2.250279] usb 1-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[    2.250295] usb 1-1.1: Product: USB Optical Mouse
[    2.250310] usb 1-1.1: Manufacturer: PixArt
[    2.260638] input: PixArt USB Optical Mouse as /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.1/1-1.1:1.0/0003:093A:2510.0001/input/input0
[    2.261037] hid-generic 0003:093A:2510.0001: input,hidraw0: USB HID v1.11 Mouse [PixArt USB Optical Mouse] on usb-0000:01:00.0-1.1/input0
[    2.361956] usb 1-1.2: new low-speed USB device number 4 using xhci_hcd
[    2.502541] usb 1-1.2: New USB device found, idVendor=17ef, idProduct=6099, bcdDevice= 1.14
[    2.502561] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[    2.502578] usb 1-1.2: Product: Lenovo Traditional USB Keyboard
[    2.502592] usb 1-1.2: Manufacturer: LiteOn
[    2.514900] input: LiteOn Lenovo Traditional USB Keyboard as /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.2/1-1.2:1.0/0003:17EF:6099.0002/input/input1
[    2.582631] hid-generic 0003:17EF:6099.0002: input,hidraw1: USB HID v1.11 Keyboard [LiteOn Lenovo Traditional USB Keyboard] on usb-0000:01:00.0-1.2/input0
[    2.590582] input: LiteOn Lenovo Traditional USB Keyboard System Control as /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.2/1-1.2:1.1/0003:17EF:6099.0003/input/input2
[    2.652170] input: LiteOn Lenovo Traditional USB Keyboard Consumer Control as /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.2/1-1.2:1.1/0003:17EF:6099.0003/input/input3
[    2.652887] hid-generic 0003:17EF:6099.0003: input,hidraw2: USB HID v1.11 Device [LiteOn Lenovo Traditional USB Keyboard] on usb-0000:01:00.0-1.2/input1
[    2.751957] usb 1-1.3: new low-speed USB device number 5 using xhci_hcd
[    2.796541] random: systemd: uninitialized urandom read (16 bytes read)
[    2.809084] random: systemd: uninitialized urandom read (16 bytes read)
[    2.809177] systemd[1]: Reached target Swap.
[    2.809664] random: systemd: uninitialized urandom read (16 bytes read)
[    2.811662] systemd[1]: Created slice User and Session Slice.
[    2.811825] systemd[1]: Reached target Slices.
[    2.813171] systemd[1]: Set up automount Arbitrary Executable File Formats File System Automount Point.
[    2.814065] systemd[1]: Listening on Journal Socket.
[    2.820236] systemd[1]: Mounting RPC Pipe File System...
[    2.829435] systemd[1]: Starting Set the console keyboard layout...
[    2.891097] usb 1-1.3: New USB device found, idVendor=17ef, idProduct=608d, bcdDevice= 1.00
[    2.891112] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[    2.891127] usb 1-1.3: Product: Lenovo USB Optical Mouse
[    2.891139] usb 1-1.3: Manufacturer: PixArt
[    2.904709] input: PixArt Lenovo USB Optical Mouse as /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.3/1-1.3:1.0/0003:17EF:608D.0004/input/input4
[    2.905185] hid-generic 0003:17EF:608D.0004: input,hidraw3: USB HID v1.11 Mouse [PixArt Lenovo USB Optical Mouse] on usb-0000:01:00.0-1.3/input0
[    2.925452] i2c /dev entries driver
[    3.004201] usb 1-1.4: new low-speed USB device number 6 using xhci_hcd
[    3.193393] usb 1-1.4: New USB device found, idVendor=04d9, idProduct=0007, bcdDevice= 1.61
[    3.193413] usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[    3.193430] usb 1-1.4: Product: Raspberry Pi Internal Keyboard
[    3.193446] usb 1-1.4: Manufacturer:  
[    3.223668] input:   Raspberry Pi Internal Keyboard as /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.4/1-1.4:1.0/0003:04D9:0007.0005/input/input5
[    3.292794] hid-generic 0003:04D9:0007.0005: input,hidraw4: USB HID v1.11 Keyboard [  Raspberry Pi Internal Keyboard] on usb-0000:01:00.0-1.4/input0
[    3.316136] input:   Raspberry Pi Internal Keyboard as /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.4/1-1.4:1.1/0003:04D9:0007.0006/input/input6
[    3.382252] hid-generic 0003:04D9:0007.0006: input,hidraw5: USB HID v1.11 Device [  Raspberry Pi Internal Keyboard] on usb-0000:01:00.0-1.4/input1
[    3.507880] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[    3.621676] systemd-journald[120]: Received request to flush runtime journal from PID 1
[    4.261488] mc: Linux media interface: v0.10
[    4.284741] vc_sm_cma: module is from the staging directory, the quality is unknown, you have been warned.
[    4.287158] bcm2835_vc_sm_cma_probe: Videocore shared memory driver
[    4.287183] [vc_sm_connected_init]: start
[    4.297740] videodev: Linux video capture interface: v2.00
[    4.305438] [vc_sm_connected_init]: installed successfully
[    4.344623] bcm2835_mmal_vchiq: module is from the staging directory, the quality is unknown, you have been warned.
[    4.346513] bcm2835_mmal_vchiq: module is from the staging directory, the quality is unknown, you have been warned.
[    4.346728] bcm2835_mmal_vchiq: module is from the staging directory, the quality is unknown, you have been warned.
[    4.353213] bcm2835_codec: module is from the staging directory, the quality is unknown, you have been warned.
[    4.359095] bcm2835_v4l2: module is from the staging directory, the quality is unknown, you have been warned.
[    4.360069] snd_bcm2835: module is from the staging directory, the quality is unknown, you have been warned.
[    4.372829] bcm2835-codec bcm2835-codec: Device registered as /dev/video10
[    4.372891] bcm2835-codec bcm2835-codec: Loaded V4L2 decode
[    4.383213] bcm2835-codec bcm2835-codec: Device registered as /dev/video11
[    4.383257] bcm2835-codec bcm2835-codec: Loaded V4L2 encode
[    4.392053] bcm2835-codec bcm2835-codec: Device registered as /dev/video12
[    4.392099] bcm2835-codec bcm2835-codec: Loaded V4L2 isp
[    4.404213] bcm2835_audio bcm2835_audio: card created with 4 channels
[    4.408652] bcm2835_isp: module is from the staging directory, the quality is unknown, you have been warned.
[    4.439423] bcm2835_audio bcm2835_audio: card created with 4 channels
[    4.530659] bcm2835-isp bcm2835-isp: Device node output[0] registered as /dev/video13
[    4.531148] bcm2835-isp bcm2835-isp: Device node capture[0] registered as /dev/video14
[    4.532335] bcm2835-isp bcm2835-isp: Device node capture[1] registered as /dev/video15
[    4.532710] bcm2835-isp bcm2835-isp: Device node stats[2] registered as /dev/video16
[    4.532738] bcm2835-isp bcm2835-isp: Register output node 0 with media controller
[    4.532758] bcm2835-isp bcm2835-isp: Register capture node 1 with media controller
[    4.532777] bcm2835-isp bcm2835-isp: Register capture node 2 with media controller
[    4.532796] bcm2835-isp bcm2835-isp: Register capture node 3 with media controller
[    4.534140] bcm2835-isp bcm2835-isp: Loaded V4L2 bcm2835-isp
[    4.852889] [drm] Initialized v3d 1.0.0 20180419 for fec00000.v3d on minor 0
[    4.866417] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[    5.000941] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[    5.031296] vc4-drm gpu: bound fe600000.firmwarekms (ops vc4_fkms_ops [vc4])
[    5.031319] checking generic (3e4e0000 6e7000) vs hw (0 ffffffffffffffff)
[    5.031334] fb0: switching to vc4drmfb from simple
[    5.046025] Console: switching to colour dummy device 80x30
[    5.046271] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[    5.046284] [drm] No driver support for vblank timestamp query.
[    5.046296] [drm] Setting vblank_disable_immediate to false because get_vblank_timestamp == NULL
[    5.046860] [drm] Initialized vc4 0.0.0 20140616 for gpu on minor 1
[    5.061081] brcmfmac: F1 signature read @0x18000000=0x15294345
[    5.074320] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43456-sdio for chip BCM4345/9
[    5.075270] usbcore: registered new interface driver brcmfmac
[    5.090662] brcmfmac mmc1:0001:1: Direct firmware load for brcm/brcmfmac43456-sdio.raspberrypi,4-model-b.txt failed with error -2
[    5.095557] Console: switching to colour frame buffer device 240x67
[    5.095606] vc4-drm gpu: fb0: vc4drmfb frame buffer device
[    5.146858] rpivid-mem feb00000.hevc-decoder: rpivid-hevcmem initialised: Registers at 0xfeb00000 length 0x00010000
[    5.149774] rpivid-mem feb10000.rpivid-local-intc: rpivid-intcmem initialised: Registers at 0xfeb10000 length 0x00001000
[    5.150171] rpivid-mem feb20000.h264-decoder: rpivid-h264mem initialised: Registers at 0xfeb20000 length 0x00010000
[    5.150536] rpivid-mem feb30000.vp9-decoder: rpivid-vp9mem initialised: Registers at 0xfeb30000 length 0x00010000
[    5.287637] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43456-sdio for chip BCM4345/9
[    5.301494] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM4345/9 wl0: May 14 2020 17:26:08 version 7.84.17.1 (r871554) FWID 01-3d9e1d87
[    7.153732] random: crng init done
[    7.153750] random: 7 urandom warning(s) missed due to ratelimiting
[    7.317243] uart-pl011 fe201000.serial: no DMA platform data
[    7.342799] 8021q: 802.1Q VLAN Support v1.8
[    7.583395] Adding 102396k swap on /var/swap.  Priority:-2 extents:1 across:102396k SSFS
[    8.113336] bcmgenet: Skipping UMAC reset
[    8.115855] bcmgenet fd580000.ethernet: configuring instance for external RGMII
[    8.116236] bcmgenet fd580000.ethernet eth0: Link is Down
[    9.589868] broken atomic modeset userspace detected, disabling atomic
[   12.224661] fuse: init (API version 7.31)
[   13.231417] Bluetooth: Core ver 2.22
[   13.231469] NET: Registered protocol family 31
[   13.231473] Bluetooth: HCI device and connection manager initialized
[   13.231485] Bluetooth: HCI socket layer initialized
[   13.231493] Bluetooth: L2CAP socket layer initialized
[   13.231506] Bluetooth: SCO socket layer initialized
[   13.241356] Bluetooth: HCI UART driver ver 2.3
[   13.241365] Bluetooth: HCI UART protocol H4 registered
[   13.241429] Bluetooth: HCI UART protocol Three-wire (H5) registered
[   13.244097] Bluetooth: HCI UART protocol Broadcom registered
[   13.351980] bcmgenet fd580000.ethernet eth0: Link is Up - 1Gbps/Full - flow control rx/tx
[   13.352008] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[   13.438259] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[   13.438267] Bluetooth: BNEP filters: protocol multicast
[   13.438292] Bluetooth: BNEP socket layer initialized
[   13.484424] Bluetooth: RFCOMM TTY layer initialized
[   13.484442] Bluetooth: RFCOMM socket layer initialized
[   13.484459] Bluetooth: RFCOMM ver 1.11

 


> On Jan 23, 2021, at 11:11 AM, cinap_lenrek@felloff.net wrote:
> 
>> In my many times trying different things, I have had a few other errors.
>> However, what I am showing is what I am getting now consistently having done the following.
> 
> There might be some differences in the sdhc controller driver.
> I can take a look later today and see...
> 
>> I’ve replaced the Pi firmware files with the latest at of today.
>> I then added ‘enable_gic=1’ to the config.txt file with no change.
> 
> The 9front pi4 kernel is for arm64 (armv8), where the GIC is required.
> The firmware should have enabled the GIC when loading a 64-bit kernel.
> 
> Tho i had encountered some firmware bugs before where firmware disabled
> the GIC (just masked interrupt routing to EL1) when the kernel image
> file was not a multiple of 4 bytes. But i think they fixed that.
> There are some mask registers in the GIC that we could check to
> see if this is the case.
> 
>> Consistent amongst the previous attempts were the same one or two errors
>> repeated many times, and not keyboard or mouse response
>> (not surprising as the newer Pis need to have their usb firmware uploaded in the kernel).
> 
> I do not know what you mean by this. The kernel does the firmware mailbox
> call to notify firmware that we did a reset of the pcie controller
> to load the XHCI firmware. This was a problem with the 8GB models of the
> raspberry pi4 and has been addressed.
> 
> This is done in /sys/src/9/bcm64/archbcm4.c:^archbcm4link() function:
> 
> void
> archbcm4link(void)
> {
> 	Pcidev *p;
> 
> 	/*
> 	 * The firmware resets PCI before starting the host OS because
> 	 * without SDRAM the VL805 makes inbound requests to page-in firmware
> 	 * from SDRAM. If the OS has a different PCI mapping that would all break.
> 	 * There's no way to pause and move the mappings and it's not really desirable
> 	 * for the firmware to dictate the PCI configuration. Consequently, the mailbox
> 	 * is required so that the OS can reset the VLI after asserting PCI chip reset.
> 	 */
> 	if((p = pcimatch(nil, 0x1106, 0x3483)) != nil)
> 		xhcireset(BUSBNO(p->tbdf)<<20 | BUSDNO(p->tbdf)<<15 | BUSFNO(p->tbdf)<<12);
> 
> 	// addclock0link(wdogfeed, HZ);
> }
> 
> I do not know the pi400 architecture but could it be possible that they
> connected the keyboard to the DesignWave usb 2.0 controller instead?
> The pi4 kernel does not include the dwc controller driver like the pi3,
> because on the pi4 it is not used. On the pi400 i do not know.
> 
>> In case there were newer updates to the source, I did a sysupdate on a laptop
>> I have with 9 and then tried to cross-compile a new kernel.
> 
>> However, I get a much smaller kernel (only 2.9MB rather than the 4.4MB in the
>> 9front Pi image. I don’t know if this is unexpected. When I try to boot that kernel.
>> The console screen comes up. But after CPU detection, the kernel panics and stops booting.
> 
> The 9front kernel includes a small compressed ram filesystem with a
> shell environment (you can enter it by typing !rc on bootargs prompt).
> Before you build the kernel, you need to have all these userspace programs
> compiled for the kernel's architecture (arm64 in this case).
> 
> I do not know how you compiled the pi4 kernel, but here is how it should
> work on 9front:
> 
> 1) Compile userspace
> 
> cd /sys/src
> objtype=arm64 mk install
> 
> 2) Compile the kernel
> 
> cd /sys/src/9/bcm64
> mk 'CONF=pi4' install
> 
> now, you should'v got a /arm64/9pi4 and /arm64/s9pi4.
> 
> The 9pi4 file is a stripped raw flat image that can be loaded
> by the pi's firmware.
> 
> The s9pi4 file is the same kernel with the native a.out
> header and debug symbols, so it can be loaded in acid
> and also used for /dev/reboot'ing into it from a running system.
> 
> Hope this helps...
> 
> --
> cinap
> 


[-- Attachment #2: Type: text/html, Size: 50987 bytes --]

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

* Re: [9front] 9front on Raspberry Pi 400
  2021-01-23 16:11 ` cinap_lenrek
  2021-01-23 21:08   ` Mack Wallace
@ 2021-01-23 21:13   ` Mack Wallace
  2021-01-23 23:42     ` cinap_lenrek
  1 sibling, 1 reply; 21+ messages in thread
From: Mack Wallace @ 2021-01-23 21:13 UTC (permalink / raw)
  To: 9front

{realized I did not convert to plain text before sending - hope I don’t send two}

Cinap, 

Thank you for the response. 

As for me building the kernel - I did not build the user space previously. I was thinking that I just wanted a kernel. Why build the whole user space? But I was wrong. I understand. So by building the user space, I got a stripped kernel that was much more akin to what was in the last 9front image, with the new kernel weighing in at 4.8MB. Unfortunately, the new kernel exhibits the same problems as before. Some minor changes in the bootup screen, but I don’t think anything that is newly notable. I will include a transcription of it again below.

I have tried to use different USB mice and external keyboard. None of these are responsive during the 9front boot. They do work in raspian or labs 9 on the pi400. The xhcireset(BUSBNO(p->tbdf)<<20 | BUSDNO(p->tbdf)<<15 | BUSFNO(p->tbdf)<<12); was mentioned when addressing this in the labs version - so maybe the sdhc errors is preventing usb detection? Looking for the labs boot, none of the usb devices start to work until after I see "usb/hub... usb/kb... usb/kb... usb/kb... usb/kb... time…” come up in the startup, just after the detection of the additional cores. Is there any similar message I should be seeing in 9front?

I’m providing the raspian dmesg. I don’t know if it is of any use, but maybe you can glean what is hooked to which USB hub. When I booted this I had the lenovo mouse in the USB 2.0 port and the keyboard and Raspberry Pi (Pixart) mouse in USB 3.0 ports. 

Certainly if there’s any other information I need or can provide - just ask. 

Thanks again,

Mack 


Latest 9front console ‘kmesg’ on boot:

127 holes free
0x00550000 0x3e600000 1040908288
1040908288 bytes free

Plan 9
cpu0: 1800 MHz ARM Cortex-A72 r0p3
4006M Memory: 998M kernel data, 3008M user, 15011M swap
pcienable PCI.0.0.0: pcr 0->7
pcienable PCI.1.0.0: pcr 0->2
bus dev type     vid  did  intl memory
0   0/0 06 04 00 14e4 2711   0  ioa:00000000-00001000 4096 mema:600000000-600100000 1048576 ->1
1   0/0 0c 03 30 1106 3483   0  0:600000004 4096
#l0: genet: 1000Mbps port 0xFFFFFFFFBD580000 irq 189 ea dca632e63357
usbxhci: 0x1106 0x3483: port 600000000 size 4096 irq 0
cpu3: 1800MHz ARM Cortex-A72 r0p3
cpu2: 1800MHz ARM Cortex-A72 r0p3
cpu1: 1800MHz ARM Cortex-A72 r0p3
#l0: phy1 id 600d84a2 oui 80361
sdhc: readerror intr 2008002 stat 1fff0000
	{repeats over 20 times}
/dev/sdM0: BCM SD Host Controller 02 Version 10
sdhc: readerror intr 2008002 stat 1fff0000
	{repeats 40 or so times}
/dev/sdM0/data
bootargs is (tcp, tls, il, local!device)[]



Raspian Dmesg:
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 5.4.51-v7l+ (dom@buildbot) (gcc version 4.9.3 (crosstool-NG crosstool-ng-1.22.0-88-g8460611)) #1333 SMP Mon Aug 10 16:51:40 BST 2020
[    0.000000] CPU: ARMv7 Processor [410fd083] revision 3 (ARMv7), cr=30c5383d
[    0.000000] CPU: div instructions available: patching division code
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, PIPT instruction cache
[    0.000000] OF: fdt: Machine model: Raspberry Pi 400 Rev 1.0
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] Reserved memory: created CMA memory pool at 0x000000001ec00000, size 256 MiB
[    0.000000] OF: reserved mem: initialized node linux,cma, compatible id shared-dma-pool
[    0.000000] On node 0 totalpages: 1012736
[    0.000000]   DMA zone: 2304 pages used for memmap
[    0.000000]   DMA zone: 0 pages reserved
[    0.000000]   DMA zone: 196608 pages, LIFO batch:63
[    0.000000]   HighMem zone: 816128 pages, LIFO batch:63
[    0.000000] percpu: Embedded 20 pages/cpu s49856 r8192 d23872 u81920
[    0.000000] pcpu-alloc: s49856 r8192 d23872 u81920 alloc=20*4096
[    0.000000] pcpu-alloc: [0] 0 [0] 1 [0] 2 [0] 3 
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 1010432
[    0.000000] Kernel command line: coherent_pool=1M 8250.nr_uarts=0 snd_bcm2835.enable_compat_alsa=0 snd_bcm2835.enable_hdmi=1 snd_bcm2835.enable_headphones=1 video=HDMI-A-1:1920x1080M@60,margin_left=48,margin_right=48,margin_top=48,margin_bottom=48 smsc95xx.macaddr=DC:A6:32:E6:33:57 vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000  console=ttyS0,115200 console=tty1 root=PARTUUID=b42855bb-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait quiet splash plymouth.ignore-serial-consoles
[    0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes, linear)
[    0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes, linear)
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] software IO TLB: mapped [mem 0x17cc0000-0x1bcc0000] (64MB)
[    0.000000] Memory: 3655616K/4050944K available (10240K kernel code, 725K rwdata, 2740K rodata, 2048K init, 853K bss, 133184K reserved, 262144K cma-reserved, 3264512K highmem)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] ftrace: allocating 30051 entries in 59 pages
[    0.000000] rcu: Hierarchical RCU implementation.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 10 jiffies.
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000000] GIC: Using split EOI/Deactivate mode
[    0.000000] random: get_random_bytes called from start_kernel+0x340/0x518 with crng_init=0
[    0.000008] sched_clock: 32 bits at 1000kHz, resolution 1000ns, wraps every 2147483647500ns
[    0.000025] clocksource: timer: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 1911260446275 ns
[    0.000104] bcm2835: system timer (irq = 17)
[    0.000778] arch_timer: cp15 timer(s) running at 54.00MHz (phys).
[    0.000795] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0xc743ce346, max_idle_ns: 440795203123 ns
[    0.000812] sched_clock: 56 bits at 54MHz, resolution 18ns, wraps every 4398046511102ns
[    0.000824] Switching to timer-based delay loop, resolution 18ns
[    0.001078] Console: colour dummy device 80x30
[    0.001111] printk: console [tty1] enabled
[    0.001161] Calibrating delay loop (skipped), value calculated using timer frequency.. 108.00 BogoMIPS (lpj=540000)
[    0.001182] pid_max: default: 32768 minimum: 301
[    0.001505] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes, linear)
[    0.001527] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes, linear)
[    0.002760] Disabling memory control group subsystem
[    0.002866] CPU: Testing write buffer coherency: ok
[    0.003367] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[    0.004222] Setting up static identity map for 0x200000 - 0x20003c
[    0.004411] rcu: Hierarchical SRCU implementation.
[    0.005061] smp: Bringing up secondary CPUs ...
[    0.006277] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
[    0.007604] CPU2: thread -1, cpu 2, socket 0, mpidr 80000002
[    0.008875] CPU3: thread -1, cpu 3, socket 0, mpidr 80000003
[    0.009021] smp: Brought up 1 node, 4 CPUs
[    0.009036] SMP: Total of 4 processors activated (432.00 BogoMIPS).
[    0.009049] CPU: All CPU(s) started in HYP mode.
[    0.009060] CPU: Virtualization extensions available.
[    0.009859] devtmpfs: initialized
[    0.023252] VFP support v0.3: implementor 41 architecture 3 part 40 variant 8 rev 0
[    0.023506] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.023533] futex hash table entries: 1024 (order: 4, 65536 bytes, linear)
[    0.031458] pinctrl core: initialized pinctrl subsystem
[    0.032544] NET: Registered protocol family 16
[    0.036446] DMA: preallocated 1024 KiB pool for atomic coherent allocations
[    0.038188] hw-breakpoint: found 5 (+1 reserved) breakpoint and 4 watchpoint registers.
[    0.038201] hw-breakpoint: maximum watchpoint size is 8 bytes.
[    0.038557] Serial: AMBA PL011 UART driver
[    0.042162] bcm2835-mbox fe00b880.mailbox: mailbox enabled
[    0.060844] raspberrypi-firmware soc:firmware: Attached to firmware from 2020-08-19 17:38, variant start
[    0.070860] raspberrypi-firmware soc:firmware: Firmware hash is e90cba19a98a0d1f2ef086b9cafcbca00778f094
[    0.124768] bcm2835-dma fe007000.dma: DMA legacy API manager, dmachans=0x1
[    0.129263] vgaarb: loaded
[    0.129752] SCSI subsystem initialized
[    0.129968] usbcore: registered new interface driver usbfs
[    0.130036] usbcore: registered new interface driver hub
[    0.130168] usbcore: registered new device driver usb
[    0.131863] clocksource: Switched to clocksource arch_sys_counter
[    0.883170] VFS: Disk quotas dquot_6.6.0
[    0.883272] VFS: Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[    0.883466] FS-Cache: Loaded
[    0.883668] CacheFiles: Loaded
[    0.884602] simple-framebuffer 3e4e0000.framebuffer: framebuffer at 0x3e4e0000, 0x6e7000 bytes, mapped to 0x(ptrval)
[    0.884620] simple-framebuffer 3e4e0000.framebuffer: format=a8r8g8b8, mode=1824x984x32, linelength=7296
[    0.885117] Console: switching to colour frame buffer device 228x61
[    0.894361] simple-framebuffer 3e4e0000.framebuffer: fb0: simplefb registered!
[    0.904042] thermal_sys: Registered thermal governor 'step_wise'
[    0.904408] NET: Registered protocol family 2
[    0.905155] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 6144 bytes, linear)
[    0.905185] TCP established hash table entries: 8192 (order: 3, 32768 bytes, linear)
[    0.905261] TCP bind hash table entries: 8192 (order: 4, 65536 bytes, linear)
[    0.905339] TCP: Hash tables configured (established 8192 bind 8192)
[    0.905493] UDP hash table entries: 512 (order: 2, 16384 bytes, linear)
[    0.905526] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes, linear)
[    0.905787] NET: Registered protocol family 1
[    0.906528] RPC: Registered named UNIX socket transport module.
[    0.906541] RPC: Registered udp transport module.
[    0.906553] RPC: Registered tcp transport module.
[    0.906565] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.906585] PCI: CLS 0 bytes, default 64
[    0.908498] hw perfevents: enabled with armv7_cortex_a15 PMU driver, 7 counters available
[    0.910656] Initialise system trusted keyrings
[    0.910892] workingset: timestamp_bits=14 max_order=20 bucket_order=6
[    0.921685] FS-Cache: Netfs 'nfs' registered for caching
[    0.922460] NFS: Registering the id_resolver key type
[    0.922517] Key type id_resolver registered
[    0.922529] Key type id_legacy registered
[    0.922552] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[    0.923686] Key type asymmetric registered
[    0.923700] Asymmetric key parser 'x509' registered
[    0.923864] bounce: pool size: 64 pages
[    0.923924] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 249)
[    0.924143] io scheduler mq-deadline registered
[    0.924157] io scheduler kyber registered
[    0.927974] brcm-pcie fd500000.pcie: host bridge /scb/pcie@7d500000 ranges:
[    0.927998] brcm-pcie fd500000.pcie:   No bus range found for /scb/pcie@7d500000, using [bus 00-ff]
[    0.928062] brcm-pcie fd500000.pcie:      MEM 0x0600000000..0x0603ffffff -> 0x00f8000000
[    0.928126] brcm-pcie fd500000.pcie:   IB MEM 0x0000000000..0x00ffffffff -> 0x0100000000
[    1.013977] brcm-pcie fd500000.pcie: link up, 5 GT/s x1 (SSC)
[    1.014280] brcm-pcie fd500000.pcie: PCI host bridge to bus 0000:00
[    1.014297] pci_bus 0000:00: root bus resource [bus 00-ff]
[    1.014318] pci_bus 0000:00: root bus resource [mem 0x600000000-0x603ffffff] (bus address [0xf8000000-0xfbffffff])
[    1.014376] pci 0000:00:00.0: [14e4:2711] type 01 class 0x060400
[    1.014620] pci 0000:00:00.0: PME# supported from D0 D3hot
[    1.018052] PCI: bus0: Fast back to back transfers disabled
[    1.018073] pci 0000:00:00.0: bridge configuration invalid ([bus 00-00]), reconfiguring
[    1.018336] pci 0000:01:00.0: [1106:3483] type 00 class 0x0c0330
[    1.018480] pci 0000:01:00.0: reg 0x10: [mem 0x00000000-0x00000fff 64bit]
[    1.018899] pci 0000:01:00.0: PME# supported from D0 D3hot
[    1.022302] PCI: bus1: Fast back to back transfers disabled
[    1.022321] pci_bus 0000:01: busn_res: [bus 01-ff] end is updated to 01
[    1.022362] pci 0000:00:00.0: BAR 8: assigned [mem 0x600000000-0x6000fffff]
[    1.022385] pci 0000:01:00.0: BAR 0: assigned [mem 0x600000000-0x600000fff 64bit]
[    1.022464] pci 0000:00:00.0: PCI bridge to [bus 01]
[    1.022487] pci 0000:00:00.0:   bridge window [mem 0x600000000-0x6000fffff]
[    1.022793] pcieport 0000:00:00.0: enabling device (0140 -> 0142)
[    1.023039] pcieport 0000:00:00.0: PME: Signaling with IRQ 55
[    1.023418] pcieport 0000:00:00.0: AER: enabled with IRQ 55
[    1.023765] pci 0000:01:00.0: enabling device (0140 -> 0142)
[    1.082284] pci 0000:01:00.0: quirk_usb_early_handoff+0x0/0x7b8 took 57164 usecs
[    1.089486] iproc-rng200 fe104000.rng: hwrng registered
[    1.089798] vc-mem: phys_addr:0x00000000 mem_base=0x3ec00000 mem_size:0x40000000(1024 MiB)
[    1.090453] vc-sm: Videocore shared memory driver
[    1.090981] gpiomem-bcm2835 fe200000.gpiomem: Initialised: Registers at 0xfe200000
[    1.103040] brd: module loaded
[    1.115388] loop: module loaded
[    1.116787] Loading iSCSI transport class v2.0-870.
[    1.118806] libphy: Fixed MDIO Bus: probed
[    1.119389] bcmgenet fd580000.ethernet: failed to get enet clock
[    1.119407] bcmgenet fd580000.ethernet: GENET 5.0 EPHY: 0x0000
[    1.119429] bcmgenet fd580000.ethernet: failed to get enet-wol clock
[    1.119448] bcmgenet fd580000.ethernet: failed to get enet-eee clock
[    1.119474] bcmgenet: Skipping UMAC reset
[    1.131903] libphy: bcmgenet MII bus: probed
[    1.221963] unimac-mdio unimac-mdio.-19: Broadcom UniMAC MDIO bus
[    1.223025] usbcore: registered new interface driver r8152
[    1.223089] usbcore: registered new interface driver lan78xx
[    1.223146] usbcore: registered new interface driver smsc95xx
[    1.223563] xhci_hcd 0000:01:00.0: xHCI Host Controller
[    1.223598] xhci_hcd 0000:01:00.0: new USB bus registered, assigned bus number 1
[    1.225790] xhci_hcd 0000:01:00.0: hcc params 0x002841eb hci version 0x100 quirks 0x0000001000000890
[    1.227024] usb usb1: New USB device found, idVendor=1d6b, idProduct=0002, bcdDevice= 5.04
[    1.227041] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    1.227056] usb usb1: Product: xHCI Host Controller
[    1.227070] usb usb1: Manufacturer: Linux 5.4.51-v7l+ xhci-hcd
[    1.227084] usb usb1: SerialNumber: 0000:01:00.0
[    1.227668] hub 1-0:1.0: USB hub found
[    1.227769] hub 1-0:1.0: 1 port detected
[    1.228300] xhci_hcd 0000:01:00.0: xHCI Host Controller
[    1.228325] xhci_hcd 0000:01:00.0: new USB bus registered, assigned bus number 2
[    1.228347] xhci_hcd 0000:01:00.0: Host supports USB 3.0 SuperSpeed
[    1.228801] usb usb2: New USB device found, idVendor=1d6b, idProduct=0003, bcdDevice= 5.04
[    1.228817] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[    1.228832] usb usb2: Product: xHCI Host Controller
[    1.228846] usb usb2: Manufacturer: Linux 5.4.51-v7l+ xhci-hcd
[    1.228860] usb usb2: SerialNumber: 0000:01:00.0
[    1.229446] hub 2-0:1.0: USB hub found
[    1.229510] hub 2-0:1.0: 4 ports detected
[    1.230897] dwc_otg: version 3.00a 10-AUG-2012 (platform bus)
[    1.231171] dwc_otg: FIQ enabled
[    1.231182] dwc_otg: NAK holdoff enabled
[    1.231193] dwc_otg: FIQ split-transaction FSM enabled
[    1.231208] Module dwc_common_port init
[    1.231676] usbcore: registered new interface driver uas
[    1.231783] usbcore: registered new interface driver usb-storage
[    1.232027] mousedev: PS/2 mouse device common for all mice
[    1.235758] bcm2835-wdt bcm2835-wdt: Broadcom BCM2835 watchdog timer
[    1.238387] sdhci: Secure Digital Host Controller Interface driver
[    1.238399] sdhci: Copyright(c) Pierre Ossman
[    1.238996] mmc-bcm2835 fe300000.mmcnr: could not get clk, deferring probe
[    1.239559] sdhci-pltfm: SDHCI platform and OF driver helper
[    1.243252] ledtrig-cpu: registered to indicate activity on CPUs
[    1.243573] hidraw: raw HID events driver (C) Jiri Kosina
[    1.243764] usbcore: registered new interface driver usbhid
[    1.243776] usbhid: USB HID core driver
[    1.244812] vchiq: vchiq_init_state: slot_zero = (ptrval)
[    1.246857] [vc_sm_connected_init]: start
[    1.256926] [vc_sm_connected_init]: end - returning 0
[    1.258997] Initializing XFRM netlink socket
[    1.259034] NET: Registered protocol family 17
[    1.259139] Key type dns_resolver registered
[    1.259605] Registering SWP/SWPB emulation handler
[    1.259927] registered taskstats version 1
[    1.259944] Loading compiled-in X.509 certificates
[    1.260420] Key type ._fscrypt registered
[    1.260432] Key type .fscrypt registered
[    1.270555] uart-pl011 fe201000.serial: cts_event_workaround enabled
[    1.270638] fe201000.serial: ttyAMA0 at MMIO 0xfe201000 (irq = 29, base_baud = 0) is a PL011 rev2
[    1.276602] bcm2835-power bcm2835-power: Broadcom BCM2835 power domains driver
[    1.277502] mmc-bcm2835 fe300000.mmcnr: mmc_debug:0 mmc_debug2:0
[    1.277516] mmc-bcm2835 fe300000.mmcnr: DMA channel allocated
[    1.326935] mmc1: queuing unknown CIS tuple 0x80 (2 bytes)
[    1.328571] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
[    1.330264] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
[    1.333320] mmc1: queuing unknown CIS tuple 0x80 (7 bytes)
[    1.334977] mmc1: queuing unknown CIS tuple 0x80 (3 bytes)
[    1.342460] mmc0: SDHCI controller on fe340000.emmc2 [fe340000.emmc2] using ADMA
[    1.345434] of_cfs_init
[    1.345552] of_cfs_init: OK
[    1.346816] Waiting for root device PARTUUID=b42855bb-02...
[    1.385018] random: fast init done
[    1.416442] mmc1: new high speed SDIO card at address 0001
[    1.451250] mmc0: new ultra high speed DDR50 SDHC card at address aaaa
[    1.452308] mmcblk0: mmc0:aaaa SC16G 14.8 GiB
[    1.455491]  mmcblk0: p1 p2
[    1.470266] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[    1.470339] VFS: Mounted root (ext4 filesystem) readonly on device 179:2.
[    1.475441] devtmpfs: mounted
[    1.483570] Freeing unused kernel memory: 2048K
[    1.512218] Run /sbin/init as init process
[    1.591921] usb 1-1: new high-speed USB device number 2 using xhci_hcd
[    1.774560] usb 1-1: New USB device found, idVendor=2109, idProduct=3431, bcdDevice= 4.21
[    1.774580] usb 1-1: New USB device strings: Mfr=0, Product=1, SerialNumber=0
[    1.774617] usb 1-1: Product: USB2.0 Hub
[    1.776738] hub 1-1:1.0: USB hub found
[    1.777084] hub 1-1:1.0: 4 ports detected
[    1.889123] systemd[1]: System time before build time, advancing clock.
[    1.998096] NET: Registered protocol family 10
[    1.999415] Segment Routing with IPv6
[    2.038526] systemd[1]: systemd 241 running in system mode. (+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN -PCRE2 default-hierarchy=hybrid)
[    2.039277] systemd[1]: Detected architecture arm.
[    2.111927] usb 1-1.1: new low-speed USB device number 3 using xhci_hcd
[    2.118239] systemd[1]: Set hostname to <raspberrypi>.
[    2.250259] usb 1-1.1: New USB device found, idVendor=093a, idProduct=2510, bcdDevice= 1.00
[    2.250279] usb 1-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[    2.250295] usb 1-1.1: Product: USB Optical Mouse
[    2.250310] usb 1-1.1: Manufacturer: PixArt
[    2.260638] input: PixArt USB Optical Mouse as /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.1/1-1.1:1.0/0003:093A:2510.0001/input/input0
[    2.261037] hid-generic 0003:093A:2510.0001: input,hidraw0: USB HID v1.11 Mouse [PixArt USB Optical Mouse] on usb-0000:01:00.0-1.1/input0
[    2.361956] usb 1-1.2: new low-speed USB device number 4 using xhci_hcd
[    2.502541] usb 1-1.2: New USB device found, idVendor=17ef, idProduct=6099, bcdDevice= 1.14
[    2.502561] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[    2.502578] usb 1-1.2: Product: Lenovo Traditional USB Keyboard
[    2.502592] usb 1-1.2: Manufacturer: LiteOn
[    2.514900] input: LiteOn Lenovo Traditional USB Keyboard as /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.2/1-1.2:1.0/0003:17EF:6099.0002/input/input1
[    2.582631] hid-generic 0003:17EF:6099.0002: input,hidraw1: USB HID v1.11 Keyboard [LiteOn Lenovo Traditional USB Keyboard] on usb-0000:01:00.0-1.2/input0
[    2.590582] input: LiteOn Lenovo Traditional USB Keyboard System Control as /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.2/1-1.2:1.1/0003:17EF:6099.0003/input/input2
[    2.652170] input: LiteOn Lenovo Traditional USB Keyboard Consumer Control as /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.2/1-1.2:1.1/0003:17EF:6099.0003/input/input3
[    2.652887] hid-generic 0003:17EF:6099.0003: input,hidraw2: USB HID v1.11 Device [LiteOn Lenovo Traditional USB Keyboard] on usb-0000:01:00.0-1.2/input1
[    2.751957] usb 1-1.3: new low-speed USB device number 5 using xhci_hcd
[    2.796541] random: systemd: uninitialized urandom read (16 bytes read)
[    2.809084] random: systemd: uninitialized urandom read (16 bytes read)
[    2.809177] systemd[1]: Reached target Swap.
[    2.809664] random: systemd: uninitialized urandom read (16 bytes read)
[    2.811662] systemd[1]: Created slice User and Session Slice.
[    2.811825] systemd[1]: Reached target Slices.
[    2.813171] systemd[1]: Set up automount Arbitrary Executable File Formats File System Automount Point.
[    2.814065] systemd[1]: Listening on Journal Socket.
[    2.820236] systemd[1]: Mounting RPC Pipe File System...
[    2.829435] systemd[1]: Starting Set the console keyboard layout...
[    2.891097] usb 1-1.3: New USB device found, idVendor=17ef, idProduct=608d, bcdDevice= 1.00
[    2.891112] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[    2.891127] usb 1-1.3: Product: Lenovo USB Optical Mouse
[    2.891139] usb 1-1.3: Manufacturer: PixArt
[    2.904709] input: PixArt Lenovo USB Optical Mouse as /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.3/1-1.3:1.0/0003:17EF:608D.0004/input/input4
[    2.905185] hid-generic 0003:17EF:608D.0004: input,hidraw3: USB HID v1.11 Mouse [PixArt Lenovo USB Optical Mouse] on usb-0000:01:00.0-1.3/input0
[    2.925452] i2c /dev entries driver
[    3.004201] usb 1-1.4: new low-speed USB device number 6 using xhci_hcd
[    3.193393] usb 1-1.4: New USB device found, idVendor=04d9, idProduct=0007, bcdDevice= 1.61
[    3.193413] usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[    3.193430] usb 1-1.4: Product: Raspberry Pi Internal Keyboard
[    3.193446] usb 1-1.4: Manufacturer:  
[    3.223668] input:   Raspberry Pi Internal Keyboard as /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.4/1-1.4:1.0/0003:04D9:0007.0005/input/input5
[    3.292794] hid-generic 0003:04D9:0007.0005: input,hidraw4: USB HID v1.11 Keyboard [  Raspberry Pi Internal Keyboard] on usb-0000:01:00.0-1.4/input0
[    3.316136] input:   Raspberry Pi Internal Keyboard as /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.4/1-1.4:1.1/0003:04D9:0007.0006/input/input6
[    3.382252] hid-generic 0003:04D9:0007.0006: input,hidraw5: USB HID v1.11 Device [  Raspberry Pi Internal Keyboard] on usb-0000:01:00.0-1.4/input1
[    3.507880] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[    3.621676] systemd-journald[120]: Received request to flush runtime journal from PID 1
[    4.261488] mc: Linux media interface: v0.10
[    4.284741] vc_sm_cma: module is from the staging directory, the quality is unknown, you have been warned.
[    4.287158] bcm2835_vc_sm_cma_probe: Videocore shared memory driver
[    4.287183] [vc_sm_connected_init]: start
[    4.297740] videodev: Linux video capture interface: v2.00
[    4.305438] [vc_sm_connected_init]: installed successfully
[    4.344623] bcm2835_mmal_vchiq: module is from the staging directory, the quality is unknown, you have been warned.
[    4.346513] bcm2835_mmal_vchiq: module is from the staging directory, the quality is unknown, you have been warned.
[    4.346728] bcm2835_mmal_vchiq: module is from the staging directory, the quality is unknown, you have been warned.
[    4.353213] bcm2835_codec: module is from the staging directory, the quality is unknown, you have been warned.
[    4.359095] bcm2835_v4l2: module is from the staging directory, the quality is unknown, you have been warned.
[    4.360069] snd_bcm2835: module is from the staging directory, the quality is unknown, you have been warned.
[    4.372829] bcm2835-codec bcm2835-codec: Device registered as /dev/video10
[    4.372891] bcm2835-codec bcm2835-codec: Loaded V4L2 decode
[    4.383213] bcm2835-codec bcm2835-codec: Device registered as /dev/video11
[    4.383257] bcm2835-codec bcm2835-codec: Loaded V4L2 encode
[    4.392053] bcm2835-codec bcm2835-codec: Device registered as /dev/video12
[    4.392099] bcm2835-codec bcm2835-codec: Loaded V4L2 isp
[    4.404213] bcm2835_audio bcm2835_audio: card created with 4 channels
[    4.408652] bcm2835_isp: module is from the staging directory, the quality is unknown, you have been warned.
[    4.439423] bcm2835_audio bcm2835_audio: card created with 4 channels
[    4.530659] bcm2835-isp bcm2835-isp: Device node output[0] registered as /dev/video13
[    4.531148] bcm2835-isp bcm2835-isp: Device node capture[0] registered as /dev/video14
[    4.532335] bcm2835-isp bcm2835-isp: Device node capture[1] registered as /dev/video15
[    4.532710] bcm2835-isp bcm2835-isp: Device node stats[2] registered as /dev/video16
[    4.532738] bcm2835-isp bcm2835-isp: Register output node 0 with media controller
[    4.532758] bcm2835-isp bcm2835-isp: Register capture node 1 with media controller
[    4.532777] bcm2835-isp bcm2835-isp: Register capture node 2 with media controller
[    4.532796] bcm2835-isp bcm2835-isp: Register capture node 3 with media controller
[    4.534140] bcm2835-isp bcm2835-isp: Loaded V4L2 bcm2835-isp
[    4.852889] [drm] Initialized v3d 1.0.0 20180419 for fec00000.v3d on minor 0
[    4.866417] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[    5.000941] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[    5.031296] vc4-drm gpu: bound fe600000.firmwarekms (ops vc4_fkms_ops [vc4])
[    5.031319] checking generic (3e4e0000 6e7000) vs hw (0 ffffffffffffffff)
[    5.031334] fb0: switching to vc4drmfb from simple
[    5.046025] Console: switching to colour dummy device 80x30
[    5.046271] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[    5.046284] [drm] No driver support for vblank timestamp query.
[    5.046296] [drm] Setting vblank_disable_immediate to false because get_vblank_timestamp == NULL
[    5.046860] [drm] Initialized vc4 0.0.0 20140616 for gpu on minor 1
[    5.061081] brcmfmac: F1 signature read @0x18000000=0x15294345
[    5.074320] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43456-sdio for chip BCM4345/9
[    5.075270] usbcore: registered new interface driver brcmfmac
[    5.090662] brcmfmac mmc1:0001:1: Direct firmware load for brcm/brcmfmac43456-sdio.raspberrypi,4-model-b.txt failed with error -2
[    5.095557] Console: switching to colour frame buffer device 240x67
[    5.095606] vc4-drm gpu: fb0: vc4drmfb frame buffer device
[    5.146858] rpivid-mem feb00000.hevc-decoder: rpivid-hevcmem initialised: Registers at 0xfeb00000 length 0x00010000
[    5.149774] rpivid-mem feb10000.rpivid-local-intc: rpivid-intcmem initialised: Registers at 0xfeb10000 length 0x00001000
[    5.150171] rpivid-mem feb20000.h264-decoder: rpivid-h264mem initialised: Registers at 0xfeb20000 length 0x00010000
[    5.150536] rpivid-mem feb30000.vp9-decoder: rpivid-vp9mem initialised: Registers at 0xfeb30000 length 0x00010000
[    5.287637] brcmfmac: brcmf_fw_alloc_request: using brcm/brcmfmac43456-sdio for chip BCM4345/9
[    5.301494] brcmfmac: brcmf_c_preinit_dcmds: Firmware: BCM4345/9 wl0: May 14 2020 17:26:08 version 7.84.17.1 (r871554) FWID 01-3d9e1d87
[    7.153732] random: crng init done
[    7.153750] random: 7 urandom warning(s) missed due to ratelimiting
[    7.317243] uart-pl011 fe201000.serial: no DMA platform data
[    7.342799] 8021q: 802.1Q VLAN Support v1.8
[    7.583395] Adding 102396k swap on /var/swap.  Priority:-2 extents:1 across:102396k SSFS
[    8.113336] bcmgenet: Skipping UMAC reset
[    8.115855] bcmgenet fd580000.ethernet: configuring instance for external RGMII
[    8.116236] bcmgenet fd580000.ethernet eth0: Link is Down
[    9.589868] broken atomic modeset userspace detected, disabling atomic
[   12.224661] fuse: init (API version 7.31)
[   13.231417] Bluetooth: Core ver 2.22
[   13.231469] NET: Registered protocol family 31
[   13.231473] Bluetooth: HCI device and connection manager initialized
[   13.231485] Bluetooth: HCI socket layer initialized
[   13.231493] Bluetooth: L2CAP socket layer initialized
[   13.231506] Bluetooth: SCO socket layer initialized
[   13.241356] Bluetooth: HCI UART driver ver 2.3
[   13.241365] Bluetooth: HCI UART protocol H4 registered
[   13.241429] Bluetooth: HCI UART protocol Three-wire (H5) registered
[   13.244097] Bluetooth: HCI UART protocol Broadcom registered
[   13.351980] bcmgenet fd580000.ethernet eth0: Link is Up - 1Gbps/Full - flow control rx/tx
[   13.352008] IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
[   13.438259] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[   13.438267] Bluetooth: BNEP filters: protocol multicast
[   13.438292] Bluetooth: BNEP socket layer initialized
[   13.484424] Bluetooth: RFCOMM TTY layer initialized
[   13.484442] Bluetooth: RFCOMM socket layer initialized
[   13.484459] Bluetooth: RFCOMM ver 1.11

> On Jan 23, 2021, at 11:11 AM, cinap_lenrek@felloff.net wrote:
> 
>> In my many times trying different things, I have had a few other errors.
>> However, what I am showing is what I am getting now consistently having done the following.
> 
> There might be some differences in the sdhc controller driver.
> I can take a look later today and see...
> 
>> I’ve replaced the Pi firmware files with the latest at of today.
>> I then added ‘enable_gic=1’ to the config.txt file with no change.
> 
> The 9front pi4 kernel is for arm64 (armv8), where the GIC is required.
> The firmware should have enabled the GIC when loading a 64-bit kernel.
> 
> Tho i had encountered some firmware bugs before where firmware disabled
> the GIC (just masked interrupt routing to EL1) when the kernel image
> file was not a multiple of 4 bytes. But i think they fixed that.
> There are some mask registers in the GIC that we could check to
> see if this is the case.
> 
>> Consistent amongst the previous attempts were the same one or two errors
>> repeated many times, and not keyboard or mouse response
>> (not surprising as the newer Pis need to have their usb firmware uploaded in the kernel).
> 
> I do not know what you mean by this. The kernel does the firmware mailbox
> call to notify firmware that we did a reset of the pcie controller
> to load the XHCI firmware. This was a problem with the 8GB models of the
> raspberry pi4 and has been addressed.
> 
> This is done in /sys/src/9/bcm64/archbcm4.c:^archbcm4link() function:
> 
> void
> archbcm4link(void)
> {
> 	Pcidev *p;
> 
> 	/*
> 	 * The firmware resets PCI before starting the host OS because
> 	 * without SDRAM the VL805 makes inbound requests to page-in firmware
> 	 * from SDRAM. If the OS has a different PCI mapping that would all break.
> 	 * There's no way to pause and move the mappings and it's not really desirable
> 	 * for the firmware to dictate the PCI configuration. Consequently, the mailbox
> 	 * is required so that the OS can reset the VLI after asserting PCI chip reset.
> 	 */
> 	if((p = pcimatch(nil, 0x1106, 0x3483)) != nil)
> 		xhcireset(BUSBNO(p->tbdf)<<20 | BUSDNO(p->tbdf)<<15 | BUSFNO(p->tbdf)<<12);
> 
> 	// addclock0link(wdogfeed, HZ);
> }
> 
> I do not know the pi400 architecture but could it be possible that they
> connected the keyboard to the DesignWave usb 2.0 controller instead?
> The pi4 kernel does not include the dwc controller driver like the pi3,
> because on the pi4 it is not used. On the pi400 i do not know.
> 
>> In case there were newer updates to the source, I did a sysupdate on a laptop
>> I have with 9 and then tried to cross-compile a new kernel.
> 
>> However, I get a much smaller kernel (only 2.9MB rather than the 4.4MB in the
>> 9front Pi image. I don’t know if this is unexpected. When I try to boot that kernel.
>> The console screen comes up. But after CPU detection, the kernel panics and stops booting.
> 
> The 9front kernel includes a small compressed ram filesystem with a
> shell environment (you can enter it by typing !rc on bootargs prompt).
> Before you build the kernel, you need to have all these userspace programs
> compiled for the kernel's architecture (arm64 in this case).
> 
> I do not know how you compiled the pi4 kernel, but here is how it should
> work on 9front:
> 
> 1) Compile userspace
> 
> cd /sys/src
> objtype=arm64 mk install
> 
> 2) Compile the kernel
> 
> cd /sys/src/9/bcm64
> mk 'CONF=pi4' install
> 
> now, you should'v got a /arm64/9pi4 and /arm64/s9pi4.
> 
> The 9pi4 file is a stripped raw flat image that can be loaded
> by the pi's firmware.
> 
> The s9pi4 file is the same kernel with the native a.out
> header and debug symbols, so it can be loaded in acid
> and also used for /dev/reboot'ing into it from a running system.
> 
> Hope this helps...
> 
> --
> cinap
> 


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

* Re: [9front] 9front on Raspberry Pi 400
  2021-01-23 21:13   ` Mack Wallace
@ 2021-01-23 23:42     ` cinap_lenrek
  2021-01-24 15:01       ` cinap_lenrek
  0 siblings, 1 reply; 21+ messages in thread
From: cinap_lenrek @ 2021-01-23 23:42 UTC (permalink / raw)
  To: 9front

> Cinap, 

> Thank you for the response. 

> As for me building the kernel - I did not build the user space previously.
> I was thinking that I just wanted a kernel. Why build the whole user space?
> But I was wrong. I understand. So by building the user space, I got a stripped
> kernel that was much more akin to what was in the last 9front image,
> with the new kernel weighing in at 4.8MB. Unfortunately, the new kernel exhibits
> the same problems as before.

of course, we havnt changed anything.

> Some minor changes in the bootup screen, but I don’t think anything that is newly notable.

the kernel makes it to bootargs prompt.

if you had a serial console, you might even be able to type commands.

> I will include a transcription of it again below.

> I have tried to use different USB mice and external keyboard
> None of these are responsive during the 9front boot.

> They do work in raspian or labs 9 on the pi400.
> The xhcireset(BUSBNO(p->tbdf)<<20 | BUSDNO(p->tbdf)<<15 | BUSFNO(p->tbdf)<<12);
> was mentioned when addressing this in the labs version - so maybe the sdhc errors
> is preventing usb detection? Looking for the labs boot, none of the usb devices
> start to work until after I see "usb/hub... usb/kb... usb/kb... usb/kb... usb/kb... time…” 
> come up in the startup, just after the detection of the additional cores.
> Is there any similar message I should be seeing in 9front?

no. there are no such messages expected.

this is all done in the following shell script, which gets
built into the kernel: /sys/src/9/boot/nusbrc

if you want, you could modify that script and add a -d flag to nusb/usbd
invocation.

> I’m providing the raspian dmesg. I don’t know if it is of any use, but maybe you
> can glean what is hooked to which USB hub. When I booted this I had the lenovo
> mouse in the USB 2.0 port and the keyboard and Raspberry Pi (Pixart) mouse in USB 3.0 ports.

thanks! that was helpfull...

ok, none of the devices seem to appear on the dwc controller, which is good.

> Certainly if there’s any other information I need or can provide - just ask. 

is it possible to connect to the uart? i do not know how accessible
it is, but it makes troubleshooting much easier. if you have a plan9
machine that can act as a fileserver, we can even netboot new kernels
from the bootargs line without having to swap sdcards.

i made you a kernel image that you can try that checks if any of the gic
interrupts have been locked down by firmware:

http://felloff.net/usr/cinap_lenrek/9pi4	(kernel to copy on sdcard)
http://felloff.net/usr/cinap_lenrek/s9pi4	(kernel with debug symbols, for acid)
http://felloff.net/usr/cinap_lenrek/gic.c	(the changed file)

diff -r ab3f119403ba sys/src/9/bcm64/gic.c
--- a/sys/src/9/bcm64/gic.c	Sat Jan 23 18:42:46 2021 +0100
+++ b/sys/src/9/bcm64/gic.c	Sun Jan 24 00:36:33 2021 +0100
@@ -126,6 +126,7 @@
 intrsoff(void)
 {
 	int i, n;
+	u32int mask;
 
 	intrcpushutdown();
 
@@ -138,8 +139,17 @@
 	for(i = 0; i < n; i += 32){
 		dregs[GICD_ISENABLER0 + (i/32)] = -1;
 		coherence();
+		mask = ~dregs[GICD_ISENABLER0 + (i/32)];
+		if(mask)
+			print("intrsoff: GIC intids [%d-%d]: %.8ux are locked in disable state\n",
+				i, i+31, mask);
+		coherence();
 		dregs[GICD_ICENABLER0 + (i/32)] = -1;
 		coherence();
+		mask = dregs[GICD_ISENABLER0 + (i/32)];
+		if(mask)
+			print("intrsoff: GIC intids [%d-%d]: %.8ux are locked in enable state\n",
+				i, i+31, mask);
 	}
 	for(i = 0; i < n; i += 4){
 		dregs[GICD_IPRIORITYR0 + (i/4)] = 0;
@@ -202,10 +212,10 @@
 }
 
 void
-intrenable(int irq, void (*f)(Ureg*, void*), void *a, int tbdf, char*)
+intrenable(int irq, void (*f)(Ureg*, void*), void *a, int tbdf, char *name)
 {
 	Vctl *v;
-	u32int intid;
+	u32int intid, mask;
 	int cpu, prio;
 
 	if(BUSTYPE(tbdf) == BusPCI){
@@ -231,7 +241,7 @@
 	case IRQmbox2:
 	case IRQmbox3:
 	case IRQlocaltmr:
-		print("irqenable: missing documentation for local irq %d\n", irq);
+		print("irqenable: missing documentation for local irq %d, %s\n", irq, name);
 		return;
 
 	default:
@@ -252,7 +262,7 @@
 	v->f = f;
 	v->a = a;
 
-	lock(&vctllock);
+	ilock(&vctllock);
 	if(irq == IRQfiq){
 		vfiq = v;
 		prio = 0;
@@ -280,10 +290,14 @@
 	coherence();
 
 	/* turn on */
-	dregs[GICD_ISENABLER0 + (intid/32)] = 1 << (intid%32);
+	mask = 1 << (intid%32);
+	dregs[GICD_ISENABLER0 + (intid/32)] = mask;
 	coherence();
+	mask &= dregs[GICD_ISENABLER0 + (intid/32)];
+	iunlock(&vctllock);
 
-	unlock(&vctllock);
+	if(mask == 0)
+		print("intrenable: GIC intid %ud did not enable irq %d, %s\n", intid, irq, name);
 }
 
 void

This is how a normal boot on the pi4 8GB model with the change looks like
(yes, usb works, i have usb keyboard attached):

127 holes free
0x008a0000 0x3e600000 1037434880
1037434880 bytes free
can't initialise 0x0x16 framebuffer 

Plan 9
intrsoff: GIC intids [0-31]: 01ff0000 are locked in disable state
intrsoff: GIC intids [0-31]: 0000ffff are locked in enable state
cpu0: 1500MHz ARM Cortex-A72 r0p3
8102M memory: 998M kernel data, 7104M user, 31384M swap
pcienable PCI.0.0.0: pcr 0->7
pcienable PCI.1.0.0: pcr 0->2
bus dev type     vid  did  intl memory
0   0/0 06 04 00 14e4 2711   0  ioa:00000000-00001000 4096 mema:600000000-600100000 1048576 ->1
1   0/0 0c 03 30 1106 3483   0  0:600000004 4096 
#l0: genet: 1000Mbps port 0xFFFFFFFFBD580000 irq 189 ea dca632b1adfe
usbxhci: cpu2: 1500MHz ARM Cortex-A72 r0p3
cpu3: 1500MHz ARM Cortex-A72 r0p3
cpu1: 1500MHz ARM Cortex-A72 r0p3
0x1106 0x3483: port 600000000 size 4096 irq 0
#l0: phy1 id 600d84a2 oui 80361

/dev/sdM0: BCM SD Host Controller 02 Version 10
/dev/sdM0/data	
/dev/sdM0/dos	 dos
/dev/sdM0/fs	 hjfs
/dev/sdM0/nvram
/dev/sdM0/plan9
bootargs is (tcp, tls, il, local!device)[tls] 

> Thanks again,

> Mack 

--
cinap

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

* Re: [9front] 9front on Raspberry Pi 400
  2021-01-23 23:42     ` cinap_lenrek
@ 2021-01-24 15:01       ` cinap_lenrek
  2021-01-26  3:33         ` Mack Wallace
  2021-01-26  3:35         ` Mack Wallace
  0 siblings, 2 replies; 21+ messages in thread
From: cinap_lenrek @ 2021-01-24 15:01 UTC (permalink / raw)
  To: 9front

Ok, i also added a bunch of debug prints into the
xhci driver (in addition to the GIC debug prints)
and updated the pi9 kernels in these url locations:

http://felloff.net/usr/cinap_lenrek/9pi4			(kernel for sdcard)
http://felloff.net/usr/cinap_lenrek/s9pi4			(a.out for debug symbols)
http://felloff.net/usr/cinap_lenrek/usbxhci.c		(changed file)

sha1 checksums:

0ddfe8a7c00164dc8a07c71219b3ab5eba48da6e	9pi4
2f7bc6b6f6ae514b977c6411f27d548eb183d5b1	s9pi4

and the diff:

diff -r 5c327eddc496 sys/src/9/port/usbxhci.c
--- a/sys/src/9/port/usbxhci.c	Sat Jan 23 20:36:09 2021 -0800
+++ b/sys/src/9/port/usbxhci.c	Sun Jan 24 15:53:30 2021 +0100
@@ -397,18 +397,32 @@
 	return nil;
 }
 
+static int
+pollwait(u32int *reg, u32int mask, u32int val, int timeout)
+{
+	while((*reg & mask) != val) {
+		if(timeout <= 0)
+			return -1;
+		timeout -= 10;
+		if(up != nil && islo())
+			tsleep(&up->sleep, return0, nil, 10);
+		else
+			delay(10);
+	}
+	return 0;
+}
+
 static void
 handoff(Ctlr *ctlr)
 {
 	u32int *r;
-	int i;
 
 	if((r = xecp(ctlr, 1, nil)) == nil)
 		return;
 	if(getconf("*noxhcihandoff") == nil){
 		r[0] |= 1<<24;		/* request ownership */
-		for(i = 0; (r[0] & (1<<16)) != 0 && i<100; i++)
-			tsleep(&up->sleep, return0, nil, 10);
+		if(pollwait(&r[0], 1<<16, 0, 1000) < 0)
+			print("xhci %llux: handoff timeout\n", ctlr->base);
 	}
 	/* disable SMI interrupts */
 	r[1] &= 7<<1 | 255<<5 | 7<<17 | 7<<29;
@@ -421,11 +435,9 @@
 shutdown(Hci *hp)
 {
 	Ctlr *ctlr = hp->aux;
-	int i;
 
 	ctlr->opr[USBCMD] = 0;
-	for(i=0; (ctlr->opr[USBSTS] & HCH) == 0 && i < 10; i++)
-		delay(10);
+	pollwait(&ctlr->opr[USBSTS], HCH, HCH, 100);
 	intrdisable(ctlr->pcidev->intl, hp->interrupt, hp, ctlr->pcidev->tbdf, hp->type);
 	pcidisable(ctlr->pcidev);
 }
@@ -477,13 +489,16 @@
 	ctlr->hccparams = ctlr->mmio[HCCPARAMS];
 	handoff(ctlr);
 
-	for(i=0; (ctlr->opr[USBSTS] & CNR) != 0 && i<100; i++)
-		tsleep(&up->sleep, return0, nil, 10);
+	if(pollwait(&ctlr->opr[USBSTS], CNR, 0, 1000) < 0)
+		print("xhci %llux: controller not ready before reset: %.8ux\n",
+			ctlr->base, ctlr->opr[USBSTS]);
 
 	ctlr->opr[USBCMD] = HCRST;
 	delay(1);
-	for(i=0; (ctlr->opr[USBSTS] & (CNR|HCH)) != HCH && i<100; i++)
-		tsleep(&up->sleep, return0, nil, 10);
+
+	if(pollwait(&ctlr->opr[USBSTS], CNR|HCH, HCH, 1000) < 0)
+		print("xhci %llux: controller not halted after reset: %.8ux\n",
+			ctlr->base, ctlr->opr[USBSTS]);
 
 	pcisetbme(ctlr->pcidev);
 	intrenable(ctlr->pcidev->intl, hp->interrupt, hp, ctlr->pcidev->tbdf, hp->type);
@@ -593,8 +608,10 @@
 	coherence();
 
 	ctlr->opr[USBCMD] = RUNSTOP|INTE|HSEE|EWE;
-	for(i=0; (ctlr->opr[USBSTS] & (CNR|HCH)) != 0 && i<100; i++)
-		tsleep(&up->sleep, return0, nil, 10);
+
+	if(pollwait(&ctlr->opr[USBSTS], CNR|HCH, 0, 1000) < 0)
+		print("xhci %llux: controller not ready after run: %.8ux\n",
+			ctlr->base, ctlr->opr[USBSTS]);
 
 	kproc("xhcirecover", recover, hp);
 }

--
cinap

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

* Re: [9front] 9front on Raspberry Pi 400
  2021-01-24 15:01       ` cinap_lenrek
@ 2021-01-26  3:33         ` Mack Wallace
  2021-01-26  3:35         ` Mack Wallace
  1 sibling, 0 replies; 21+ messages in thread
From: Mack Wallace @ 2021-01-26  3:33 UTC (permalink / raw)
  To: 9front

I tried the kernel this. evening, 

After detection of CPU 1, 2, and 3 (not necessarily in that order), I get the following lines

xhci 600000000: controller not ready before reset: 00000815
xhci 600000000: controller not halted after reset: 00000815
xhci 600000000: controller not ready after run: 0000080d
#l0: phy1 id 600d84a2 oui 80361
xhci 600000000: controller not ready before reset: 0000080d
sdhc: read error intr 2008002 stat 1fff0000
			...
sdhc: read error intr 2008002 stat 1fff0000
emmc: cmd 123a0033 arg 0 error intr 2008003 stat 1fff0000
sdhc: read error intr 2008002 stat 1fff0000
			...
sdhc: read error intr 2008002 stat 1fff0000
bootargs is (tcp, tls, il, local!device)[]xhci 600000000: controller not halted after reset: 00000811
xhci 600000000: controller not ready after run: 0000080d
xhci 600000000: controller not ready before reset: 0000080d
xhci 600000000: controller not halted after reset: 00000811
xhci 600000000: controller not ready after run: 0000080d
xhci 600000000: controller not ready before reset: 0000080d
xhci 600000000: controller not halted after reset: 00000811
… {repeats}

I unfortunately forgot my jumper wires at home, so I wasn’t able to set up the serial port. Will try tomorrow.

Thanks,

Mack

> On Jan 24, 2021, at 10:01 AM, cinap_lenrek@felloff.net wrote:
> 
> Ok, i also added a bunch of debug prints into the
> xhci driver (in addition to the GIC debug prints)
> and updated the pi9 kernels in these url locations:
> 
> http://felloff.net/usr/cinap_lenrek/9pi4			(kernel for sdcard)
> http://felloff.net/usr/cinap_lenrek/s9pi4			(a.out for debug symbols)
> http://felloff.net/usr/cinap_lenrek/usbxhci.c		(changed file)
> 
> sha1 checksums:
> 
> 0ddfe8a7c00164dc8a07c71219b3ab5eba48da6e	9pi4
> 2f7bc6b6f6ae514b977c6411f27d548eb183d5b1	s9pi4
> 
> and the diff:
> 
> diff -r 5c327eddc496 sys/src/9/port/usbxhci.c
> --- a/sys/src/9/port/usbxhci.c	Sat Jan 23 20:36:09 2021 -0800
> +++ b/sys/src/9/port/usbxhci.c	Sun Jan 24 15:53:30 2021 +0100
> @@ -397,18 +397,32 @@
> 	return nil;
> }
> 
> +static int
> +pollwait(u32int *reg, u32int mask, u32int val, int timeout)
> +{
> +	while((*reg & mask) != val) {
> +		if(timeout <= 0)
> +			return -1;
> +		timeout -= 10;
> +		if(up != nil && islo())
> +			tsleep(&up->sleep, return0, nil, 10);
> +		else
> +			delay(10);
> +	}
> +	return 0;
> +}
> +
> static void
> handoff(Ctlr *ctlr)
> {
> 	u32int *r;
> -	int i;
> 
> 	if((r = xecp(ctlr, 1, nil)) == nil)
> 		return;
> 	if(getconf("*noxhcihandoff") == nil){
> 		r[0] |= 1<<24;		/* request ownership */
> -		for(i = 0; (r[0] & (1<<16)) != 0 && i<100; i++)
> -			tsleep(&up->sleep, return0, nil, 10);
> +		if(pollwait(&r[0], 1<<16, 0, 1000) < 0)
> +			print("xhci %llux: handoff timeout\n", ctlr->base);
> 	}
> 	/* disable SMI interrupts */
> 	r[1] &= 7<<1 | 255<<5 | 7<<17 | 7<<29;
> @@ -421,11 +435,9 @@
> shutdown(Hci *hp)
> {
> 	Ctlr *ctlr = hp->aux;
> -	int i;
> 
> 	ctlr->opr[USBCMD] = 0;
> -	for(i=0; (ctlr->opr[USBSTS] & HCH) == 0 && i < 10; i++)
> -		delay(10);
> +	pollwait(&ctlr->opr[USBSTS], HCH, HCH, 100);
> 	intrdisable(ctlr->pcidev->intl, hp->interrupt, hp, ctlr->pcidev->tbdf, hp->type);
> 	pcidisable(ctlr->pcidev);
> }
> @@ -477,13 +489,16 @@
> 	ctlr->hccparams = ctlr->mmio[HCCPARAMS];
> 	handoff(ctlr);
> 
> -	for(i=0; (ctlr->opr[USBSTS] & CNR) != 0 && i<100; i++)
> -		tsleep(&up->sleep, return0, nil, 10);
> +	if(pollwait(&ctlr->opr[USBSTS], CNR, 0, 1000) < 0)
> +		print("xhci %llux: controller not ready before reset: %.8ux\n",
> +			ctlr->base, ctlr->opr[USBSTS]);
> 
> 	ctlr->opr[USBCMD] = HCRST;
> 	delay(1);
> -	for(i=0; (ctlr->opr[USBSTS] & (CNR|HCH)) != HCH && i<100; i++)
> -		tsleep(&up->sleep, return0, nil, 10);
> +
> +	if(pollwait(&ctlr->opr[USBSTS], CNR|HCH, HCH, 1000) < 0)
> +		print("xhci %llux: controller not halted after reset: %.8ux\n",
> +			ctlr->base, ctlr->opr[USBSTS]);
> 
> 	pcisetbme(ctlr->pcidev);
> 	intrenable(ctlr->pcidev->intl, hp->interrupt, hp, ctlr->pcidev->tbdf, hp->type);
> @@ -593,8 +608,10 @@
> 	coherence();
> 
> 	ctlr->opr[USBCMD] = RUNSTOP|INTE|HSEE|EWE;
> -	for(i=0; (ctlr->opr[USBSTS] & (CNR|HCH)) != 0 && i<100; i++)
> -		tsleep(&up->sleep, return0, nil, 10);
> +
> +	if(pollwait(&ctlr->opr[USBSTS], CNR|HCH, 0, 1000) < 0)
> +		print("xhci %llux: controller not ready after run: %.8ux\n",
> +			ctlr->base, ctlr->opr[USBSTS]);
> 
> 	kproc("xhcirecover", recover, hp);
> }
> 
> --
> cinap
> 


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

* Re: [9front] 9front on Raspberry Pi 400
  2021-01-24 15:01       ` cinap_lenrek
  2021-01-26  3:33         ` Mack Wallace
@ 2021-01-26  3:35         ` Mack Wallace
  2021-01-26 11:21           ` cinap_lenrek
  2021-01-26 12:09           ` cinap_lenrek
  1 sibling, 2 replies; 21+ messages in thread
From: Mack Wallace @ 2021-01-26  3:35 UTC (permalink / raw)
  To: 9front

I tried the kernel this. evening, 

After detection of CPU 1, 2, and 3 (not necessarily in that order), I get the following lines

xhci 600000000: controller not ready before reset: 00000815
xhci 600000000: controller not halted after reset: 00000815
xhci 600000000: controller not ready after run: 0000080d
#l0: phy1 id 600d84a2 oui 80361
xhci 600000000: controller not ready before reset: 0000080d
sdhc: read error intr 2008002 stat 1fff0000
			...
sdhc: read error intr 2008002 stat 1fff0000
emmc: cmd 123a0033 arg 0 error intr 2008003 stat 1fff0000
sdhc: read error intr 2008002 stat 1fff0000
			...
sdhc: read error intr 2008002 stat 1fff0000
bootargs is (tcp, tls, il, local!device)[]xhci 600000000: controller not halted after reset: 00000811
xhci 600000000: controller not ready after run: 0000080d
xhci 600000000: controller not ready before reset: 0000080d
xhci 600000000: controller not halted after reset: 00000811
xhci 600000000: controller not ready after run: 0000080d
xhci 600000000: controller not ready before reset: 0000080d
xhci 600000000: controller not halted after reset: 00000811
… {repeats}

I unfortunately forgot my jumper wires at home, so I wasn’t able to set up the serial port. Will try tomorrow.

Thanks,

Mack

> On Jan 24, 2021, at 10:01 AM, cinap_lenrek@felloff.net wrote:
> 
> Ok, i also added a bunch of debug prints into the
> xhci driver (in addition to the GIC debug prints)
> and updated the pi9 kernels in these url locations:
> 
> http://felloff.net/usr/cinap_lenrek/9pi4			(kernel for sdcard)
> http://felloff.net/usr/cinap_lenrek/s9pi4			(a.out for debug symbols)
> http://felloff.net/usr/cinap_lenrek/usbxhci.c		(changed file)
> 
> sha1 checksums:
> 
> 0ddfe8a7c00164dc8a07c71219b3ab5eba48da6e	9pi4
> 2f7bc6b6f6ae514b977c6411f27d548eb183d5b1	s9pi4
> 
> and the diff:
> 
> diff -r 5c327eddc496 sys/src/9/port/usbxhci.c
> --- a/sys/src/9/port/usbxhci.c	Sat Jan 23 20:36:09 2021 -0800
> +++ b/sys/src/9/port/usbxhci.c	Sun Jan 24 15:53:30 2021 +0100
> @@ -397,18 +397,32 @@
> 	return nil;
> }
> 
> +static int
> +pollwait(u32int *reg, u32int mask, u32int val, int timeout)
> +{
> +	while((*reg & mask) != val) {
> +		if(timeout <= 0)
> +			return -1;
> +		timeout -= 10;
> +		if(up != nil && islo())
> +			tsleep(&up->sleep, return0, nil, 10);
> +		else
> +			delay(10);
> +	}
> +	return 0;
> +}
> +
> static void
> handoff(Ctlr *ctlr)
> {
> 	u32int *r;
> -	int i;
> 
> 	if((r = xecp(ctlr, 1, nil)) == nil)
> 		return;
> 	if(getconf("*noxhcihandoff") == nil){
> 		r[0] |= 1<<24;		/* request ownership */
> -		for(i = 0; (r[0] & (1<<16)) != 0 && i<100; i++)
> -			tsleep(&up->sleep, return0, nil, 10);
> +		if(pollwait(&r[0], 1<<16, 0, 1000) < 0)
> +			print("xhci %llux: handoff timeout\n", ctlr->base);
> 	}
> 	/* disable SMI interrupts */
> 	r[1] &= 7<<1 | 255<<5 | 7<<17 | 7<<29;
> @@ -421,11 +435,9 @@
> shutdown(Hci *hp)
> {
> 	Ctlr *ctlr = hp->aux;
> -	int i;
> 
> 	ctlr->opr[USBCMD] = 0;
> -	for(i=0; (ctlr->opr[USBSTS] & HCH) == 0 && i < 10; i++)
> -		delay(10);
> +	pollwait(&ctlr->opr[USBSTS], HCH, HCH, 100);
> 	intrdisable(ctlr->pcidev->intl, hp->interrupt, hp, ctlr->pcidev->tbdf, hp->type);
> 	pcidisable(ctlr->pcidev);
> }
> @@ -477,13 +489,16 @@
> 	ctlr->hccparams = ctlr->mmio[HCCPARAMS];
> 	handoff(ctlr);
> 
> -	for(i=0; (ctlr->opr[USBSTS] & CNR) != 0 && i<100; i++)
> -		tsleep(&up->sleep, return0, nil, 10);
> +	if(pollwait(&ctlr->opr[USBSTS], CNR, 0, 1000) < 0)
> +		print("xhci %llux: controller not ready before reset: %.8ux\n",
> +			ctlr->base, ctlr->opr[USBSTS]);
> 
> 	ctlr->opr[USBCMD] = HCRST;
> 	delay(1);
> -	for(i=0; (ctlr->opr[USBSTS] & (CNR|HCH)) != HCH && i<100; i++)
> -		tsleep(&up->sleep, return0, nil, 10);
> +
> +	if(pollwait(&ctlr->opr[USBSTS], CNR|HCH, HCH, 1000) < 0)
> +		print("xhci %llux: controller not halted after reset: %.8ux\n",
> +			ctlr->base, ctlr->opr[USBSTS]);
> 
> 	pcisetbme(ctlr->pcidev);
> 	intrenable(ctlr->pcidev->intl, hp->interrupt, hp, ctlr->pcidev->tbdf, hp->type);
> @@ -593,8 +608,10 @@
> 	coherence();
> 
> 	ctlr->opr[USBCMD] = RUNSTOP|INTE|HSEE|EWE;
> -	for(i=0; (ctlr->opr[USBSTS] & (CNR|HCH)) != 0 && i<100; i++)
> -		tsleep(&up->sleep, return0, nil, 10);
> +
> +	if(pollwait(&ctlr->opr[USBSTS], CNR|HCH, 0, 1000) < 0)
> +		print("xhci %llux: controller not ready after run: %.8ux\n",
> +			ctlr->base, ctlr->opr[USBSTS]);
> 
> 	kproc("xhcirecover", recover, hp);
> }
> 
> --
> cinap
> 


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

* Re: [9front] 9front on Raspberry Pi 400
  2021-01-26  3:35         ` Mack Wallace
@ 2021-01-26 11:21           ` cinap_lenrek
  2021-01-26 12:09           ` cinap_lenrek
  1 sibling, 0 replies; 21+ messages in thread
From: cinap_lenrek @ 2021-01-26 11:21 UTC (permalink / raw)
  To: 9front

> xhci 600000000: controller not ready before reset: 00000815
> xhci 600000000: controller not halted after reset: 00000815
> xhci 600000000: controller not ready after run: 0000080d

ok, this means the controller never clears the "Host Controller Halted"
and "Host Controller Not Ready" bits in the status register.

so it is possible the xhcireset() firmware command is not having
the desired effect on the pi400?

the mailbox command xhcireset() is run right after our pcie controller
reset, after we enumerated the pci bus, but before we attempt to
reset the xhci controller.

see in autogenerated pi4.c:

void links(void){
	bootlinks();

	gisblink();
	pcibcmlink();	<- pcie controller reset and enumeration
	archbcm4link();	<- here we do the xhcireset call to firmware
	usbxhcilink();	<- registers the xhci driver, will attempt to reset later
	ethergenetlink();
	ethermediumlink();
	loopbackmediumlink();
}

i know that richard put the xhcireset() call directly in the xhci
driver init function.

the reason i did not do that was because my xhci driver is portable
and shared with the pc and pc64 kernels and i do not want to clutter
it with work arounds for raspberry pi.

the effects that these differences might have is that we do
not enable the pci device before the xhcireset() call, and that we
do not do the xhci handoff. well... and timing differences...

so the simplest thing to try first would be to put a pcienable()
call before the xhcireset() like:

diff -r 5c327eddc496 sys/src/9/bcm64/archbcm4.c
--- a/sys/src/9/bcm64/archbcm4.c	Sat Jan 23 20:36:09 2021 -0800
+++ b/sys/src/9/bcm64/archbcm4.c	Tue Jan 26 12:01:03 2021 +0100
@@ -183,8 +183,10 @@
 	 * for the firmware to dictate the PCI configuration. Consequently, the mailbox
 	 * is required so that the OS can reset the VLI after asserting PCI chip reset.
 	 */
-	if((p = pcimatch(nil, 0x1106, 0x3483)) != nil)
+	if((p = pcimatch(nil, 0x1106, 0x3483)) != nil){
+		pcienable(p);
 		xhcireset(BUSBNO(p->tbdf)<<20 | BUSDNO(p->tbdf)<<15 | BUSFNO(p->tbdf)<<12);
+	}
 
 	// addclock0link(wdogfeed, HZ);
 }

it is unclear to me why the code works fine on the pi4 8GB model tho.

another possibility is you have the wrong firmware files for
the pi400 in the image.

if that also fails, i can put in a hook in the xhci driver and we
execute the xhcireset magic function in the exact same place as
with richards driver next.

the other difference we have is that our kernel is 64 bit one,
and firmware loader takes different codepaths for these kernel
types, so might leave the machine in a different state when
handing control to the kernel.

anyway, can you also provide me with the GIC debug prints i put?

--
cinap

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

* Re: [9front] 9front on Raspberry Pi 400
  2021-01-26  3:35         ` Mack Wallace
  2021-01-26 11:21           ` cinap_lenrek
@ 2021-01-26 12:09           ` cinap_lenrek
  2021-01-27  2:32             ` Mack Wallace
  1 sibling, 1 reply; 21+ messages in thread
From: cinap_lenrek @ 2021-01-26 12:09 UTC (permalink / raw)
  To: 9front

> I tried the kernel this. evening, 

ok, because these roundtrips take alot of time.

i proactively made you two kernel images:

http://felloff.net/usr/cinap_lenrek/9pi4-pcienable
http://felloff.net/usr/cinap_lenrek/9pi4-xhcihook

sha1sums:

2ca5e6d696aef196585723da33790eadf85e0f68	9pi4-pcienable
8c3543c4ccdcfea1efb0575f49823b3f3e0b47db	9pi4-xhcihook

the 9pi4-pcienable adds the pcienable() call before the
xhcireset() firmware call as shown in the patch of the
previous mail.

the 9pi4-xhcihook adds a hook in the xhci driver to place
the firmware call just hafter the xhci handoff, which
then should be exactly the same place as with richards
version.

both files are flat kernel images to be put on the sdcard,
but renamed as 9pi4 (or you edit the config.txt file to
change the kernel name).

--
cinap

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

* Re: [9front] 9front on Raspberry Pi 400
  2021-01-26 12:09           ` cinap_lenrek
@ 2021-01-27  2:32             ` Mack Wallace
  2021-01-27 14:30               ` cinap_lenrek
                                 ` (3 more replies)
  0 siblings, 4 replies; 21+ messages in thread
From: Mack Wallace @ 2021-01-27  2:32 UTC (permalink / raw)
  To: 9front

So I tried the two kernels you sent. No revelations there.

The pci enable kernel leave me with about the same thing. The only difference this time is the emmc: error went away and the line for the BCM Host Controller. So we get this:

xhci 600000000: controller not ready before reset: 00000815
xhci 600000000: controller not halted after reset: 00000815
xhci 600000000: controller not ready after run: 0000080d
#l0: phy1 id 600d84a2 oui 80361
xhci 600000000: controller not ready before reset: 0000080d
sdhc: read error intr 2008002 stat 1fff0000
			...
sdhc: read error intr 2008002 stat 1fff0000
/dev/sdM0: BCM SD Host Controller 02 Version 10x
sdhc: read error intr 2008002 stat 1fff0000
			...
sdhc: read error intr 2008002 stat 1fff0000
bootargs is (tcp, tls, il, local!device)[]xhci 600000000: controller not halted after reset: 00000811
xhci 600000000: controller not ready after run: 0000080d
xhci 600000000: controller not ready before reset: 0000080d
xhci 600000000: controller not halted after reset: 00000811
xhci 600000000: controller not ready after run: 0000080d
xhci 600000000: controller not ready before reset: 0000080d
xhci 600000000: controller not halted after reset: 00000811
… {repeats}


The xhcihookm, rather than repeating the messages after the bootargs prompt, terminates with a core dump:

...
bootargs is (tcp, tls, il, local!device)[]xhci 600000000: controller not halted after reset: 00000811
xhci 600000000: controller not ready after run: 0000080d
cpu1: dumpregs ureg 0xffffffffc134be08 process 154: xhcirecover
R0 0000000000000000  R1 0000000000000000  R2 00000000000003d4
R3 0000000000000000  R4 0000000000000000  R5 0000000000000000
R6 ffffffffc0080000  R7 ffffffffc14a0acb  R8 0000000000000000
R9 00000000000003de  R10 ffffffffc09b8cb8  R11 ffffffffc09bb8cb8
R12 000000000000001e  R13 0000000000000001  R14 0000000000002000
R15 00000001fefeff98  R16 63c809a18a03a022  R17 0000000040000000
R18 b68c2c109411ce00  R19 de8a818f00000000  R20 95c174970c010000
R21 ad5ea04b40cb4cb8  R22 84c8bff000000000  R23 2c1e994900000000
R24 b0d56acc02000000. R25 c2e3d27b00000000  R26 ffffffffc008905c
R27 00000000c04c90890  R28 ffffffffc00ab60c  R29 ffffffffc00888cc
PC 0xffffffffc014792c  SP 0xffffffffc134bf28  LR 0xffffffffc00ab5d8  PSR a0000005  TYPE bf000002
panic: SError interrupt
ktrace /kernel/path 0xffffffffc00855ac 0xffffffffc134bc70 0xffffffffc134bda # pc, sp, link
0xc134bx70=0xc00853e8 0xc134bc78=0xc0084358 0xc134bcc8=0xc013bf28 0xc134bcd8=0xc008374c
0xc134bcf8=0xc00dce78 0xc134bd08=0xc00834fc 0xc134bd28=0xc00f9efc 0xc134bd38=0xc00f8ffc
0xc134bd48=0xc008433c 0xc134bd68=0xc0084350 0xc134bd78=0xc014792c 0xc134bd88=0xc00ab5d8
0xc134bda0=0xc00888cc 0xc134bdb8=0xc0080308 0xc134bdc8=0xc00ee7c0 0xc134bdd8=0xc00fd0e4
0xc134bdf8=0xc008374c 0xc134bed8=0xc0080308 0xc134bee8=0xc00ab60c 0xc134bef0=0xc00888cc
0xc134bef8=0xc00ab5d8 0xc134bf08=0xc014792c 0xc134bf28=0xc00ab948 0xc134bf38=0xc01066f8
0xf134bf58=0xc00ac448 0xc134bf88=0xc00ac3d4 0xc134bfa8=0xc00ac2a4 0xc134bfb8=0xc00fb1e4
0xc134bfc8=0xc00f14a8 0xc134bfd8=0xc00f1560 0xc134bfe8=0xc00fb1e4 0xc134c018=0xc00fb1d0
0xc134c038=0xc0085238

I did bring in my wires and connect the serial adapter to the GPIO of the PI 400. However, I am not sure what the syntax is to put the console to the serial port for a Pi in the config.txt. If it is the same at 9 on a intel machine, or if there is a specific port number or address number that needs to be entered. My cursory search did not turn up anything. (And of course I’d love to have a serial console as it would same me from having to transcribe things like that dump.

I’m also thinking of setting up a VMs for an Auth Server to boot the Pi off of, to as you recommended a place to build kernels and net boot, and see the results all in one place.

Thank you very very much. I know this takes time and ‘cycles.’

Mack



> On Jan 26, 2021, at 7:09 AM, cinap_lenrek@felloff.net wrote:
> 
>> I tried the kernel this. evening, 
> 
> ok, because these roundtrips take alot of time.
> 
> i proactively made you two kernel images:
> 
> http://felloff.net/usr/cinap_lenrek/9pi4-pcienable
> http://felloff.net/usr/cinap_lenrek/9pi4-xhcihook
> 
> sha1sums:
> 
> 2ca5e6d696aef196585723da33790eadf85e0f68	9pi4-pcienable
> 8c3543c4ccdcfea1efb0575f49823b3f3e0b47db	9pi4-xhcihook
> 
> the 9pi4-pcienable adds the pcienable() call before the
> xhcireset() firmware call as shown in the patch of the
> previous mail.
> 
> the 9pi4-xhcihook adds a hook in the xhci driver to place
> the firmware call just hafter the xhci handoff, which
> then should be exactly the same place as with richards
> version.
> 
> both files are flat kernel images to be put on the sdcard,
> but renamed as 9pi4 (or you edit the config.txt file to
> change the kernel name).
> 
> --
> cinap
> 


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

* Re: [9front] 9front on Raspberry Pi 400
  2021-01-27  2:32             ` Mack Wallace
@ 2021-01-27 14:30               ` cinap_lenrek
  2021-01-27 17:04               ` cinap_lenrek
                                 ` (2 subsequent siblings)
  3 siblings, 0 replies; 21+ messages in thread
From: cinap_lenrek @ 2021-01-27 14:30 UTC (permalink / raw)
  To: 9front

> However, I am not sure what the syntax is to put the console to the serial port for a Pi in the config.txt.
> If it is the same at 9 on a intel machine, or if there is a specific port number or address number that
> needs to be entered.

no, all you need is a line in cmdline.txt like:

console=0

if you use the 9front image, it is already there.

> My cursory search did not turn up anything. (And of course I’d love to have a serial console as it
> would same me from having to transcribe things like that dump.

the dump isnt that interesting. this is a machine check basically, which is asynchronous.
its not the program on the cpu that crashes here, but hardware signaling theres a unrecoverable
system error by raising a nmi interrupt. maybe caused by the xhci doing a invalid memory
transaction on the pcie bus...

if i had actual documentation on the pcie controller, we might be able to handle that
error SError interrupt by reading some status registers on the pcie controller block.

the problem is the VL805 xhci controller is a complete backbox. there isnt even a
datasheet available. and nobody knows what the firmware does exactly in the xhcireset mailbox
command and what the requirements are exactly when to issue it.

the best cause of action now i think is to simplify the test case and remove other components
from the equation like removing the sdhc driver from the kernel.

and once we have that, we check the exact versions of the firmware files and config.txt
settings and file a ticket for the raspberry pi firmware team.

also, i asked before, what about the GIC debug prints i put? the reason i want to know
is because it could indicate if the kernel is entered in that strange misconfigured
state that i'v seen before. that would be a clear indication that somehting is amiss
in the firmware. i'll show the patch again in case the mail got lost:

diff -r 5c327eddc496 sys/src/9/bcm64/gic.c
--- a/sys/src/9/bcm64/gic.c	Sat Jan 23 20:36:09 2021 -0800
+++ b/sys/src/9/bcm64/gic.c	Wed Jan 27 15:25:44 2021 +0100
@@ -126,6 +126,7 @@
 intrsoff(void)
 {
 	int i, n;
+	u32int mask;
 
 	intrcpushutdown();
 
@@ -138,8 +139,17 @@
 	for(i = 0; i < n; i += 32){
 		dregs[GICD_ISENABLER0 + (i/32)] = -1;
 		coherence();
+		mask = ~dregs[GICD_ISENABLER0 + (i/32)];
+		if(mask)
+			print("intrsoff: GIC intids [%d-%d]: %.8ux are locked in disable state\n",
+				i, i+31, mask);
+		coherence();
 		dregs[GICD_ICENABLER0 + (i/32)] = -1;
 		coherence();
+		mask = dregs[GICD_ISENABLER0 + (i/32)];
+		if(mask)
+			print("intrsoff: GIC intids [%d-%d]: %.8ux are locked in enable state\n",
+				i, i+31, mask);
 	}
 	for(i = 0; i < n; i += 4){
 		dregs[GICD_IPRIORITYR0 + (i/4)] = 0;
@@ -202,10 +212,10 @@
 }
 
 void
-intrenable(int irq, void (*f)(Ureg*, void*), void *a, int tbdf, char*)
+intrenable(int irq, void (*f)(Ureg*, void*), void *a, int tbdf, char *name)
 {
 	Vctl *v;
-	u32int intid;
+	u32int intid, mask;
 	int cpu, prio;
 
 	if(BUSTYPE(tbdf) == BusPCI){
@@ -231,7 +241,7 @@
 	case IRQmbox2:
 	case IRQmbox3:
 	case IRQlocaltmr:
-		print("irqenable: missing documentation for local irq %d\n", irq);
+		print("irqenable: missing documentation for local irq %d, %s\n", irq, name);
 		return;
 
 	default:
@@ -252,7 +262,7 @@
 	v->f = f;
 	v->a = a;
 
-	lock(&vctllock);
+	ilock(&vctllock);
 	if(irq == IRQfiq){
 		vfiq = v;
 		prio = 0;
@@ -280,10 +290,14 @@
 	coherence();
 
 	/* turn on */
-	dregs[GICD_ISENABLER0 + (intid/32)] = 1 << (intid%32);
+	mask = 1 << (intid%32);
+	dregs[GICD_ISENABLER0 + (intid/32)] = mask;
 	coherence();
+	mask &= dregs[GICD_ISENABLER0 + (intid/32)];
+	iunlock(&vctllock);
 
-	unlock(&vctllock);
+	if(mask == 0)
+		print("intrenable: GIC intid %ud did not enable irq %d, %s\n", intid, irq, name);
 }
 
 void


--
cinap

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

* Re: [9front] 9front on Raspberry Pi 400
  2021-01-27  2:32             ` Mack Wallace
  2021-01-27 14:30               ` cinap_lenrek
@ 2021-01-27 17:04               ` cinap_lenrek
  2021-01-27 17:57               ` cinap_lenrek
  2021-01-29 14:58               ` cinap_lenrek
  3 siblings, 0 replies; 21+ messages in thread
From: cinap_lenrek @ 2021-01-27 17:04 UTC (permalink / raw)
  To: 9front

i did some search on the raspberry pi firmware github issue page
and found this, which seems to be relevant:

https://github.com/raspberrypi/firmware/issues/1518

--
cinap

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

* Re: [9front] 9front on Raspberry Pi 400
  2021-01-27  2:32             ` Mack Wallace
  2021-01-27 14:30               ` cinap_lenrek
  2021-01-27 17:04               ` cinap_lenrek
@ 2021-01-27 17:57               ` cinap_lenrek
  2021-01-29 14:58               ` cinap_lenrek
  3 siblings, 0 replies; 21+ messages in thread
From: cinap_lenrek @ 2021-01-27 17:57 UTC (permalink / raw)
  To: 9front

ok, so it seems on the CM4 and PI400 with newer firmware, they changed
the pcie inbound window address space. which is the range of addresses
as seen from a pci device perspecive doing busmaster dma towards memory
on the host system.

this also means we need to configure the inbound windows differently
in the pcie controller and also that drivers offset physical memory
addresses by that window base when passing them to pci devices for dma.

this is done by the PCIWADDR() macro, which currently just translates
to physical address and then adds PCIWINDOW constant, which in the
previous address scheme was 0 (no translation).

so the problem is likely that the xhcireset firmware call places the
firmware image somewhere in memory, and then the xhci controller is
not able to reach it because we assume a "no translation" regime in the
pcie controller. also the window we program is currently limited to
1GB so not all dma memory can be targeted, but this was not a problem
as we only do dma to kernel memory and the kernel memory pool fits in
that range.

to top it off, all this garbage is communicated thru devicetree blobs,
which we only partially support at this point. (mainly just to get
the sdram memory sizes and boot arguments).

i can work on this and might have something for you to test in a
couple of days.

--
cinap

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

* Re: [9front] 9front on Raspberry Pi 400
  2021-01-27  2:32             ` Mack Wallace
                                 ` (2 preceding siblings ...)
  2021-01-27 17:57               ` cinap_lenrek
@ 2021-01-29 14:58               ` cinap_lenrek
  2021-01-30  2:43                 ` Mack Wallace
  3 siblings, 1 reply; 21+ messages in thread
From: cinap_lenrek @ 2021-01-29 14:58 UTC (permalink / raw)
  To: 9front

ok, here we go.

i wrote some code to extract the dma-rangles property from
the device tree and apply it to the pci express code.

this adds new kernel variables *pciwin and *pcidmawin,
that reflect the setting. they get filled in by the
device tree setting when booted from firmware,
but can be overridden in cmdline.txt or when we /dev/reboot.

new kernel images to try:

http://felloff.net/usr/cinap_lenrek/9pi4-pciwin		(image for sdcard)
http://felloff.net/usr/cinap_lenrek/s9pi4-pciwin	(kernel with debug symbols)

sha1sums:

9b8775e9b9b9daebbd72cde308c2b7117d2d065b	9pi4
0a01ed1555e99f847ba9eab8e8693364d4839f2c	s9pi4

what follows is a example bootmessage from my pi4 8GB.
note that in your case, the *pcidmawin print below should be different.
please report back what you get as output there.

Plan 9
intrsoff: GIC intids [0-31]: 01ff0000 are locked in disable state
intrsoff: GIC intids [0-31]: 0000ffff are locked in enable state
cpu0: 1500MHz ARM Cortex-A72 r0p3
8102M memory: 998M kernel data, 7104M user, 31395M swap
*pciwin: 0x600000000 0x604000000
*pcidmawin: 0x0 0xc0000000
pcienable PCI.0.0.0: pcr 0->7
pcienable PCI.1.0.0: pcr 0->2
bus dev type     vid  did  intl memory
0   0/0 06 04 00 14e4 2711   0  ioa:00000000-00001000 4096 mema:600000000-600100000 1048576 ->1
1   0/0 0c 03 30 1106 3483   0  0:600000004 4096 
#l0: genet: 1000Mbps port 0xFFFFFFFFBD580000 irq 189 ea dca632b1adfe
usbxhci: cpu2: 1500MHz ARM Cortex-A72 r0p3
cpu3: 1500MHz ARM Cortex-A72 r0p3
cpu1: 1500MHz ARM Cortex-A72 r0p3
0x1106 0x3483: port 600000000 size 4096 irq 0
#l0: phy1 id 600d84a2 oui 80361

patch:

diff -r 5c327eddc496 sys/src/9/bcm/bootargs.c
--- a/sys/src/9/bcm/bootargs.c	Sat Jan 23 20:36:09 2021 -0800
+++ b/sys/src/9/bcm/bootargs.c	Fri Jan 29 15:45:16 2021 +0100
@@ -12,6 +12,7 @@
 static char *confval[MAXCONF];
 static int nconf;
 static char maxmem[256];
+static char pciwin[38], pcidmawin[38];
 
 static int
 findconf(char *k)
@@ -89,23 +90,23 @@
 static void
 devtreeprop(char *path, char *key, void *val, int len)
 {
+	uvlong addr, size;
+	uchar *p = val;
+	char *s;
+
 	if((strcmp(path, "/memory") == 0 || strcmp(path, "/memory@0") == 0)
 	&& strcmp(key, "reg") == 0){
 		if(findconf("*maxmem") < 0 && len > 0 && (len % (3*4)) == 0){
-			uvlong top;
-			uchar *p = val;
-			char *s;
-
-			top = (uvlong)beget4(p)<<32 | beget4(p+4);
-			top += beget4(p+8);
-			s = seprint(maxmem, &maxmem[sizeof(maxmem)], "%#llux", top);
+			addr = (uvlong)beget4(p)<<32 | beget4(p+4);
+			addr += beget4(p+8);
+			s = seprint(maxmem, &maxmem[sizeof(maxmem)], "%#llux", addr);
 			p += 3*4;
 			len -= 3*4;
 			while(len > 0){
-				top = (uvlong)beget4(p)<<32 | beget4(p+4);
-				s = seprint(s, &maxmem[sizeof(maxmem)], " %#llux", top);
-				top += beget4(p+8);
-				s = seprint(s, &maxmem[sizeof(maxmem)], " %#llux", top);
+				addr = (uvlong)beget4(p)<<32 | beget4(p+4);
+				s = seprint(s, &maxmem[sizeof(maxmem)], " %#llux", addr);
+				addr += beget4(p+8);
+				s = seprint(s, &maxmem[sizeof(maxmem)], " %#llux", addr);
 				p += 3*4;
 				len -= 3*4;
 			}
@@ -113,6 +114,20 @@
 		}
 		return;
 	}
+	if(strncmp(path, "/scb/pcie@", 10) == 0 && len == (3*4 + 4*4)){
+		p += 3*4;
+		addr = (uvlong)beget4(p)<<32 | beget4(p+4);
+		p += 2*4;
+		size = (uvlong)beget4(p)<<32 | beget4(p+4);
+		if(strcmp(key, "ranges") == 0 && findconf("*pciwin") < 0){
+			snprint(pciwin, sizeof(pciwin), "%#llux %#llux", addr, addr+size);
+			addconf("*pciwin", pciwin);
+		} else if(strcmp(key, "dma-ranges") == 0 && findconf("*pcidmawin") < 0){
+			snprint(pcidmawin, sizeof(pcidmawin), "%#llux %#llux", addr, addr+size);
+			addconf("*pcidmawin", pcidmawin);
+		}
+		return;
+	}
 	if(strcmp(path, "/chosen") == 0 && strcmp(key, "bootargs") == 0){
 		if(len > BOOTARGSLEN)
 			len = BOOTARGSLEN;
diff -r 5c327eddc496 sys/src/9/bcm64/dat.h
--- a/sys/src/9/bcm64/dat.h	Sat Jan 23 20:36:09 2021 -0800
+++ b/sys/src/9/bcm64/dat.h	Fri Jan 29 15:44:26 2021 +0100
@@ -249,7 +249,8 @@
 	uintptr	physio;
 	uintptr	virtio;
 	uintptr	armlocal;
-	uintptr	pciwin;
+	uintptr	pciwin;		/* PCI outbound window CPU->PCI */
+	uintptr	pcidmawin;	/* PCI inbound window PCI->DRAM */
 	int	oscfreq;
 };
 extern Soc soc;
diff -r 5c327eddc496 sys/src/9/bcm64/io.h
--- a/sys/src/9/bcm64/io.h	Sat Jan 23 20:36:09 2021 -0800
+++ b/sys/src/9/bcm64/io.h	Fri Jan 29 15:43:55 2021 +0100
@@ -6,5 +6,5 @@
 	IRQether	= IRQgic + 29,
 };
 
-#define PCIWINDOW	0
+#define PCIWINDOW	soc.pcidmawin
 #define PCIWADDR(va)	(PADDR(va)+PCIWINDOW)
diff -r 5c327eddc496 sys/src/9/bcm64/pcibcm.c
--- a/sys/src/9/bcm64/pcibcm.c	Sat Jan 23 20:36:09 2021 -0800
+++ b/sys/src/9/bcm64/pcibcm.c	Fri Jan 29 15:43:55 2021 +0100
@@ -244,6 +244,16 @@
 pcibcmlink(void)
 {
 	int log2dmasize = 30;	// 1GB
+	char *s;
+
+	if((s = getconf("*pciwin")) != nil){
+		print("*pciwin: %s\n", s);
+		soc.pciwin = (uintptr)strtoll(s, nil, 16);
+	}
+	if((s = getconf("*pcidmawin")) != nil){
+		print("*pcidmawin: %s\n", s);
+		soc.pcidmawin = (uintptr)strtoll(s, nil, 16);
+	}
 
 	regs[RGR1_SW_INIT_1] |= 3;
 	delay(200);
@@ -266,8 +276,8 @@
 	// SCB_ACCESS_EN, CFG_READ_UR_MODE, MAX_BURST_SIZE_128, SCB0SIZE
 	regs[MISC_MISC_CTRL] = 1<<12 | 1<<13 | 0<<20 | (log2dmasize-15)<<27;
 
-	regs[MISC_RC_BAR2_CONFIG_LO] = (log2dmasize-15);
-	regs[MISC_RC_BAR2_CONFIG_HI] = 0;
+	regs[MISC_RC_BAR2_CONFIG_LO] = ((u32int)soc.pcidmawin & ~0x1F) | (log2dmasize-15);
+	regs[MISC_RC_BAR2_CONFIG_HI] = soc.pcidmawin >> 32;
 
 	regs[MISC_RC_BAR1_CONFIG_LO] = 0;
 	regs[MISC_RC_BAR3_CONFIG_LO] = 0;

--
cinap

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

* Re: [9front] 9front on Raspberry Pi 400
  2021-01-29 14:58               ` cinap_lenrek
@ 2021-01-30  2:43                 ` Mack Wallace
  2021-01-30  5:54                   ` cinap_lenrek
  0 siblings, 1 reply; 21+ messages in thread
From: Mack Wallace @ 2021-01-30  2:43 UTC (permalink / raw)
  To: 9front

Unfortunately, no luck on that… Output of the Pi 400 below.

At least now I have the serial console, much easier to cut and paste - although I shortened the repeated errors.

Wondering if I should set up a cpu/auth - setup remote access, and let you work that way - although the serial adapter I got to work is USB to TTL serial. I couldn’t get my RS-232 to TTL adapter to work - I presume that’s because the Pi doesn’t have enough amperage to drive it / or the USB to serial I have doesn’t wont supply enough current the other way. So I wonder whether the Adafruit USB to TTL serial adapter can be seen by 9. 

Mack


127 holes free
0x00500000 0x3e600000 1041235968
1041235968 bytes free

Plan 9
intrsoff: GIC intids [0-31]: 01ff0000 are locked in disable state
intrsoff: GIC intids [0-31]: 0000ffff are locked in enable state
cpu0: 1800MHz ARM Cortex-A72 r0p3
4006M memory: 998M kernel data, 3008M user, 15011M swap
*pciwin: 0x600000000 0x640000000
*pcidmawin: 0x0 0x100000000
pcienable PCI.0.0.0: pcr 0->7
pcienable PCI.1.0.0: pcr 0->2
bus dev type     vid  did  intl memory
0   0/0 06 04 00 14e4 2711   0  ioa:00000000-00001000 4096 mema:600000000-600100000 1048576 ->1
1   0/0 0c 03 30 1106 3483   0  0:600000004 4096
#l0: genet: 1000Mbps port 0xFFFFFFFFBD580000 irq 189 ea dca632e63357
usbxhci: cpu3: 1800MHz ARM Cortex-A72 r0p3
cpu1: 1800MHz ARM Cortex-A72 r0p3
cpu2: 1800MHz ARM Cortex-A72 r0p3
0x1106 0x3483: port 600000000 size 4096 irq 0
xhci 600000000: controller not ready before reset: 00000815
xhci 600000000: controller not halted after reset: 00000815
xhci 600000000: controller not ready after run: 0000080d
#l0: phy1 id 600d84a2 oui 80361
xhci 600000000: controller not ready before reset: 0000080d
sdhc: read error intr 2008002 stat 1fff0000

...

sdhc: read error intr 2008002 stat 1fff0000

/dev/sdM0: BCM SD Host Controller 02 Version 10
sdhc: read error intr 2008002 stat 1fff0000

...

sdhc: read error intr 2008002 stat 1fff0000
/dev/sdM0/data
bootargs is (tcp, tls, il, local!device)[] xhci 600000000: controller not halted after reset: 00000811
xhci 600000000: controller not ready after run: 0000080d
xhci 600000000: controller not ready before reset: 0000080d
xhci 600000000: controller not halted after reset: 00000811
xhci 600000000: controller not ready after run: 0000080d

...

xhci 600000000: controller not halted after reset: 00000811
xhci 600000000: controller not ready after run: 0000080d
xhci 600000000: controller not ready before reset: 0000080d

...

[SERIAL/DIRECT] DISCONNECT

> On Jan 29, 2021, at 9:58 AM, cinap_lenrek@felloff.net wrote:
> 
> ok, here we go.
> 
> i wrote some code to extract the dma-rangles property from
> the device tree and apply it to the pci express code.
> 
> this adds new kernel variables *pciwin and *pcidmawin,
> that reflect the setting. they get filled in by the
> device tree setting when booted from firmware,
> but can be overridden in cmdline.txt or when we /dev/reboot.
> 
> new kernel images to try:
> 
> http://felloff.net/usr/cinap_lenrek/9pi4-pciwin		(image for sdcard)
> http://felloff.net/usr/cinap_lenrek/s9pi4-pciwin	(kernel with debug symbols)
> 
> sha1sums:
> 
> 9b8775e9b9b9daebbd72cde308c2b7117d2d065b	9pi4
> 0a01ed1555e99f847ba9eab8e8693364d4839f2c	s9pi4
> 
> what follows is a example bootmessage from my pi4 8GB.
> note that in your case, the *pcidmawin print below should be different.
> please report back what you get as output there.
> 
> Plan 9
> intrsoff: GIC intids [0-31]: 01ff0000 are locked in disable state
> intrsoff: GIC intids [0-31]: 0000ffff are locked in enable state
> cpu0: 1500MHz ARM Cortex-A72 r0p3
> 8102M memory: 998M kernel data, 7104M user, 31395M swap
> *pciwin: 0x600000000 0x604000000
> *pcidmawin: 0x0 0xc0000000
> pcienable PCI.0.0.0: pcr 0->7
> pcienable PCI.1.0.0: pcr 0->2
> bus dev type     vid  did  intl memory
> 0   0/0 06 04 00 14e4 2711   0  ioa:00000000-00001000 4096 mema:600000000-600100000 1048576 ->1
> 1   0/0 0c 03 30 1106 3483   0  0:600000004 4096 
> #l0: genet: 1000Mbps port 0xFFFFFFFFBD580000 irq 189 ea dca632b1adfe
> usbxhci: cpu2: 1500MHz ARM Cortex-A72 r0p3
> cpu3: 1500MHz ARM Cortex-A72 r0p3
> cpu1: 1500MHz ARM Cortex-A72 r0p3
> 0x1106 0x3483: port 600000000 size 4096 irq 0
> #l0: phy1 id 600d84a2 oui 80361
> 
> patch:
> 
> diff -r 5c327eddc496 sys/src/9/bcm/bootargs.c
> --- a/sys/src/9/bcm/bootargs.c	Sat Jan 23 20:36:09 2021 -0800
> +++ b/sys/src/9/bcm/bootargs.c	Fri Jan 29 15:45:16 2021 +0100
> @@ -12,6 +12,7 @@
> static char *confval[MAXCONF];
> static int nconf;
> static char maxmem[256];
> +static char pciwin[38], pcidmawin[38];
> 
> static int
> findconf(char *k)
> @@ -89,23 +90,23 @@
> static void
> devtreeprop(char *path, char *key, void *val, int len)
> {
> +	uvlong addr, size;
> +	uchar *p = val;
> +	char *s;
> +
> 	if((strcmp(path, "/memory") == 0 || strcmp(path, "/memory@0") == 0)
> 	&& strcmp(key, "reg") == 0){
> 		if(findconf("*maxmem") < 0 && len > 0 && (len % (3*4)) == 0){
> -			uvlong top;
> -			uchar *p = val;
> -			char *s;
> -
> -			top = (uvlong)beget4(p)<<32 | beget4(p+4);
> -			top += beget4(p+8);
> -			s = seprint(maxmem, &maxmem[sizeof(maxmem)], "%#llux", top);
> +			addr = (uvlong)beget4(p)<<32 | beget4(p+4);
> +			addr += beget4(p+8);
> +			s = seprint(maxmem, &maxmem[sizeof(maxmem)], "%#llux", addr);
> 			p += 3*4;
> 			len -= 3*4;
> 			while(len > 0){
> -				top = (uvlong)beget4(p)<<32 | beget4(p+4);
> -				s = seprint(s, &maxmem[sizeof(maxmem)], " %#llux", top);
> -				top += beget4(p+8);
> -				s = seprint(s, &maxmem[sizeof(maxmem)], " %#llux", top);
> +				addr = (uvlong)beget4(p)<<32 | beget4(p+4);
> +				s = seprint(s, &maxmem[sizeof(maxmem)], " %#llux", addr);
> +				addr += beget4(p+8);
> +				s = seprint(s, &maxmem[sizeof(maxmem)], " %#llux", addr);
> 				p += 3*4;
> 				len -= 3*4;
> 			}
> @@ -113,6 +114,20 @@
> 		}
> 		return;
> 	}
> +	if(strncmp(path, "/scb/pcie@", 10) == 0 && len == (3*4 + 4*4)){
> +		p += 3*4;
> +		addr = (uvlong)beget4(p)<<32 | beget4(p+4);
> +		p += 2*4;
> +		size = (uvlong)beget4(p)<<32 | beget4(p+4);
> +		if(strcmp(key, "ranges") == 0 && findconf("*pciwin") < 0){
> +			snprint(pciwin, sizeof(pciwin), "%#llux %#llux", addr, addr+size);
> +			addconf("*pciwin", pciwin);
> +		} else if(strcmp(key, "dma-ranges") == 0 && findconf("*pcidmawin") < 0){
> +			snprint(pcidmawin, sizeof(pcidmawin), "%#llux %#llux", addr, addr+size);
> +			addconf("*pcidmawin", pcidmawin);
> +		}
> +		return;
> +	}
> 	if(strcmp(path, "/chosen") == 0 && strcmp(key, "bootargs") == 0){
> 		if(len > BOOTARGSLEN)
> 			len = BOOTARGSLEN;
> diff -r 5c327eddc496 sys/src/9/bcm64/dat.h
> --- a/sys/src/9/bcm64/dat.h	Sat Jan 23 20:36:09 2021 -0800
> +++ b/sys/src/9/bcm64/dat.h	Fri Jan 29 15:44:26 2021 +0100
> @@ -249,7 +249,8 @@
> 	uintptr	physio;
> 	uintptr	virtio;
> 	uintptr	armlocal;
> -	uintptr	pciwin;
> +	uintptr	pciwin;		/* PCI outbound window CPU->PCI */
> +	uintptr	pcidmawin;	/* PCI inbound window PCI->DRAM */
> 	int	oscfreq;
> };
> extern Soc soc;
> diff -r 5c327eddc496 sys/src/9/bcm64/io.h
> --- a/sys/src/9/bcm64/io.h	Sat Jan 23 20:36:09 2021 -0800
> +++ b/sys/src/9/bcm64/io.h	Fri Jan 29 15:43:55 2021 +0100
> @@ -6,5 +6,5 @@
> 	IRQether	= IRQgic + 29,
> };
> 
> -#define PCIWINDOW	0
> +#define PCIWINDOW	soc.pcidmawin
> #define PCIWADDR(va)	(PADDR(va)+PCIWINDOW)
> diff -r 5c327eddc496 sys/src/9/bcm64/pcibcm.c
> --- a/sys/src/9/bcm64/pcibcm.c	Sat Jan 23 20:36:09 2021 -0800
> +++ b/sys/src/9/bcm64/pcibcm.c	Fri Jan 29 15:43:55 2021 +0100
> @@ -244,6 +244,16 @@
> pcibcmlink(void)
> {
> 	int log2dmasize = 30;	// 1GB
> +	char *s;
> +
> +	if((s = getconf("*pciwin")) != nil){
> +		print("*pciwin: %s\n", s);
> +		soc.pciwin = (uintptr)strtoll(s, nil, 16);
> +	}
> +	if((s = getconf("*pcidmawin")) != nil){
> +		print("*pcidmawin: %s\n", s);
> +		soc.pcidmawin = (uintptr)strtoll(s, nil, 16);
> +	}
> 
> 	regs[RGR1_SW_INIT_1] |= 3;
> 	delay(200);
> @@ -266,8 +276,8 @@
> 	// SCB_ACCESS_EN, CFG_READ_UR_MODE, MAX_BURST_SIZE_128, SCB0SIZE
> 	regs[MISC_MISC_CTRL] = 1<<12 | 1<<13 | 0<<20 | (log2dmasize-15)<<27;
> 
> -	regs[MISC_RC_BAR2_CONFIG_LO] = (log2dmasize-15);
> -	regs[MISC_RC_BAR2_CONFIG_HI] = 0;
> +	regs[MISC_RC_BAR2_CONFIG_LO] = ((u32int)soc.pcidmawin & ~0x1F) | (log2dmasize-15);
> +	regs[MISC_RC_BAR2_CONFIG_HI] = soc.pcidmawin >> 32;
> 
> 	regs[MISC_RC_BAR1_CONFIG_LO] = 0;
> 	regs[MISC_RC_BAR3_CONFIG_LO] = 0;
> 
> --
> cinap
> 


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

* Re: [9front] 9front on Raspberry Pi 400
  2021-01-30  2:43                 ` Mack Wallace
@ 2021-01-30  5:54                   ` cinap_lenrek
  2021-01-30 19:23                     ` Mack Wallace
  0 siblings, 1 reply; 21+ messages in thread
From: cinap_lenrek @ 2021-01-30  5:54 UTC (permalink / raw)
  To: 9front

> I wonder whether the Adafruit USB to TTL serial adapter can be seen by 9.

if not, it should be quite easy to add support. the problem with the rasperry
pi uart is that it uses 3.3V, so is not really TTL. you have to be carefull.

for the previous test, i think i made a mistake in the device tree parsing.

i took the parent bus address instead of the child bus address
in the dma-ranges case.

that might be the reason why *pcidmawin had a zero offset in your case.

the offset should appear in the child bus address field and *pcidmawin should
actually be the difference between them for the translation.

i didnt notice in my case as with the pi4 8GB, there is no translation and
both fields addresses are zero.

http://felloff.net/usr/cinap_lenrek/9pi4-pciwin2
http://felloff.net/usr/cinap_lenrek/s9pi4-pciwin2

12f215453abe5bf601cb49861f33b187bfbe8898	9pi4
0c405178ce7d4cc667d5a12176749682ff5a24cb	s9pi4

never give up!

--
cinap

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

* Re: [9front] 9front on Raspberry Pi 400
  2021-01-30  5:54                   ` cinap_lenrek
@ 2021-01-30 19:23                     ` Mack Wallace
  2021-01-30 19:41                       ` cinap_lenrek
  2021-01-30 19:46                       ` cinap_lenrek
  0 siblings, 2 replies; 21+ messages in thread
From: Mack Wallace @ 2021-01-30 19:23 UTC (permalink / raw)
  To: 9front

No luck with that kernel - never made it to the console screen. The Pi 400 displays a color map on startup, and it got stuck there.

Mack

> On Jan 30, 2021, at 12:54 AM, cinap_lenrek@felloff.net wrote:
> 
>> I wonder whether the Adafruit USB to TTL serial adapter can be seen by 9.
> 
> if not, it should be quite easy to add support. the problem with the rasperry
> pi uart is that it uses 3.3V, so is not really TTL. you have to be carefull.
> 
> for the previous test, i think i made a mistake in the device tree parsing.
> 
> i took the parent bus address instead of the child bus address
> in the dma-ranges case.
> 
> that might be the reason why *pcidmawin had a zero offset in your case.
> 
> the offset should appear in the child bus address field and *pcidmawin should
> actually be the difference between them for the translation.
> 
> i didnt notice in my case as with the pi4 8GB, there is no translation and
> both fields addresses are zero.
> 
> http://felloff.net/usr/cinap_lenrek/9pi4-pciwin2
> http://felloff.net/usr/cinap_lenrek/s9pi4-pciwin2
> 
> 12f215453abe5bf601cb49861f33b187bfbe8898	9pi4
> 0c405178ce7d4cc667d5a12176749682ff5a24cb	s9pi4
> 
> never give up!
> 
> --
> cinap
> 


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

* Re: [9front] 9front on Raspberry Pi 400
  2021-01-30 19:23                     ` Mack Wallace
@ 2021-01-30 19:41                       ` cinap_lenrek
  2021-01-30 19:46                       ` cinap_lenrek
  1 sibling, 0 replies; 21+ messages in thread
From: cinap_lenrek @ 2021-01-30 19:41 UTC (permalink / raw)
  To: 9front

that is very unusual. even if i'd messed up the early devicetree code, it
should still make it at least to the framebuffer.

and i'v tested that image on my pi4 8GB.

maybe you copied the s9pi-pciwin2 file to the sdcard instead of the 9pi4-pciwin2
file?

--
cinap

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

* Re: [9front] 9front on Raspberry Pi 400
  2021-01-30 19:23                     ` Mack Wallace
  2021-01-30 19:41                       ` cinap_lenrek
@ 2021-01-30 19:46                       ` cinap_lenrek
  2021-02-01  1:16                         ` Mack Wallace
  1 sibling, 1 reply; 21+ messages in thread
From: cinap_lenrek @ 2021-01-30 19:46 UTC (permalink / raw)
  To: 9front

ok, sorry.... it was my mistake! the sha1sum now matches.

--
cinap

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

* Re: [9front] 9front on Raspberry Pi 400
  2021-01-30 19:46                       ` cinap_lenrek
@ 2021-02-01  1:16                         ` Mack Wallace
  0 siblings, 0 replies; 21+ messages in thread
From: Mack Wallace @ 2021-02-01  1:16 UTC (permalink / raw)
  To: 9front

Ok, cool, we have progress. Keyboard and mouse work now. However, still those pesky sdhc errors. 

I tried typing in local!/dev/sdM0/data, it then prompted me for the user account, which I accepted the default, glenda. Upon entering, I get even more sdhc errors, along with an unknown file system.

Also just noticed. We seem to be missing a CPU during detection. Running another time, I see cpu1 and cpu2 detected, but not 3. - After that, I’m consistently detecting cpus 1, 2, and 3. 

Mack


127 holes free
0x00500000 0x3e600000 1041235968
1041235968 bytes free

Plan 9
intrsoff: GIC intids [0-31]: 01ff0000 are locked in disable state
intrsoff: GIC intids [0-31]: 0000ffff are locked in enable state
cpu0: 1800MHz ARM Cortex-A72 r0p3
4006M memory: 998M kernel data, 3008M user, 15011M swap
*pciwin: 0x600000000 0x640000000
*pcidmawin: 0x400000000 0x500000000
pcienable PCI.0.0.0: pcr 0->7
pcienable PCI.1.0.0: pcr 0->2
bus dev type     vid  did  intl memory
0   0/0 06 04 00 14e4 2711   0  ioa:00000000-00001000 4096 mema:600000000-600100000 1048576 ->1
1   0/0 0c 03 30 1106 3483   0  0:600000004 4096
#l0: genet: 1000Mbps port 0xFFFFFFFFBD580000 irq 189 ea dca632e63357
usbxhci: cpu2: 1800MHz ARM Cortex-A72 r0p3
cpu1: 1800MHz ARM Cortex-A72 r0p3
cpu3: 1800MHz ARM Cortex-A72 r0p3
0x1106 0x3483: port 600000000 size 4096 irq 0
#l0: phy1 id 600d84a2 oui 80361
sdhc: read error intr 2008002 stat 1fff0000
sdhc: read error intr 2008002 stat 1fff0000
...
sdhc: read error intr 2008002 stat 1fff0000

/dev/sdM0: BCM SD Host Controller 02 Version 10
sdhc: read error intr 2008002 stat 1fff0000
...
sdhc: read error intr 2008002 stat 1fff0000
/dev/sdM0/data
bootargs is (tcp, tls, il, local!device)[]   local!/dev/sdM0/data    
user[glenda:

sdhc: read error intr 2008002 stat 1fff0000
...
sdhc: read error intr 2008002 stat 1fff0000
unknown fstype /dev/sdM0/data

/dev/sdM0: BCM SD Host Controller 02 Version 10
sdhc: read error intr 2008002 stat 1fff0000
...
sdhc: read error intr 2008002 stat 1fff0000 


> On Jan 30, 2021, at 2:46 PM, cinap_lenrek@felloff.net wrote:
> 
> ok, sorry.... it was my mistake! the sha1sum now matches.
> 
> --
> cinap
> 


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

end of thread, other threads:[~2021-02-01  2:21 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-20 17:23 [9front] 9front on Raspberry Pi 400 Mack Wallace
2021-01-23 16:11 ` cinap_lenrek
2021-01-23 21:08   ` Mack Wallace
2021-01-23 21:13   ` Mack Wallace
2021-01-23 23:42     ` cinap_lenrek
2021-01-24 15:01       ` cinap_lenrek
2021-01-26  3:33         ` Mack Wallace
2021-01-26  3:35         ` Mack Wallace
2021-01-26 11:21           ` cinap_lenrek
2021-01-26 12:09           ` cinap_lenrek
2021-01-27  2:32             ` Mack Wallace
2021-01-27 14:30               ` cinap_lenrek
2021-01-27 17:04               ` cinap_lenrek
2021-01-27 17:57               ` cinap_lenrek
2021-01-29 14:58               ` cinap_lenrek
2021-01-30  2:43                 ` Mack Wallace
2021-01-30  5:54                   ` cinap_lenrek
2021-01-30 19:23                     ` Mack Wallace
2021-01-30 19:41                       ` cinap_lenrek
2021-01-30 19:46                       ` cinap_lenrek
2021-02-01  1:16                         ` Mack Wallace

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).