keystone-enclave / keystone

Keystone Enclave (QEMU + HiFive Unleashed)
Other
460 stars 131 forks source link

Ethernet fails to launch (Keystone v1.0 on HiFive Unleashed board) #244

Open 0drai opened 3 years ago

0drai commented 3 years ago

Describe the bug Ethernet fails to launch. Maybe related to https://github.com/keystone-enclave/keystone/issues/147

Screenshots or Error Log

SiFive FSBL:       2021-05-20-767b856
Using FSBL DTB
HiFive-U serial #: 000002aa
Loading boot payload................................

OpenSBI v0.8
   ____                    _____ ____ _____
  / __ \                  / ____|  _ \_   _|
 | |  | |_ __   ___ _ __ | (___ | |_) || |
 | |  | | '_ \ / _ \ '_ \ \___ \|  _ < | |
 | |__| | |_) |  __/ | | |____) | |_) || |_
  \____/| .__/ \___|_| |_|_____/|____/_____|
        | |
        |_|

Platform Name             : sifive,hifive-unleashed-a00
Platform Features         : timer,mfdeleg
Platform HART Count       : 5
Firmware Base             : 0x80000000
Firmware Size             : 236 KB
Runtime SBI Version       : 0.2

Domain0 Name              : root
Domain0 Boot HART         : 3
Domain0 HARTs             : 0*,1*,2*,3*,4*
Domain0 Region00          : 0x0000000080000000-0x000000008003ffff ()
Domain0 Region01          : 0x0000000000000000-0xffffffffffffffff (R,W,X)
Domain0 Next Address      : 0x0000000080200000
Domain0 Next Arg1         : 0x0000000082200000
Domain0 Next Mode         : S-mode
Domain0 SysReset          : yes

[SM] Initializing ... hart [3]
[SM] Keystone security monitor has been initialized!
Boot HART ID              : 3
Boot HART Domain          : root
Boot HART ISA             : rv64imafdcsu
Boot HART Features        : scounteren,mcounteren
Boot HART PMP Count       : 16
Boot HART PMP Granularity : 4
Boot HART PMP Address Bits: 36
Boot HART MHPM Count      : 0
Boot HART MHPM Count      : 0
Boot HART MIDELEG         : 0x0000000000000222
Boot HART MEDELEG         : 0x000000000000b109
[    0.000000] OF: fdt: Ignoring memory range 0x80000000 - 0x80200000
[    0.000000] Linux version 5.7.0-dirty (user@risc-v-keystone-2) (gcc version 10.2.0 (GCC), GNU ld (GNU Binutils) 2.35) #5 SMP Thu May 20 20:00:21 UTC 2021
[    0.000000] earlycon: sbi0 at I/O port 0x0 (options '')
[    0.000000] printk: bootconsole [sbi0] enabled
[    0.000000] initrd not found or empty - disabling initrd
[    0.000000] Zone ranges:
[    0.000000]   DMA32    [mem 0x0000000080200000-0x00000000ffffffff]
[    0.000000]   Normal   empty
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000080200000-0x00000000ffffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000080200000-0x00000000ffffffff]
[    0.000000] cma: Reserved 1024 MiB at 0x00000000be000000
[    0.000000] software IO TLB: mapped [mem 0xba000000-0xbe000000] (64MB)
[    0.000000] SBI specification v0.2 detected
[    0.000000] SBI implementation ID=0x1 Version=0x8
[    0.000000] SBI v0.2 TIME extension detected
[    0.000000] SBI v0.2 IPI extension detected
[    0.000000] SBI v0.2 RFENCE extension detected
[    0.000000] SBI v0.2 HSM extension detected
[    0.000000] CPU with hartid=0 is not available
[    0.000000] CPU with hartid=0 is not available
[    0.000000] riscv: ISA extensions acdfim
[    0.000000] riscv: ELF capabilities acdfim
[    0.000000] percpu: Embedded 17 pages/cpu s31976 r8192 d29464 u69632
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 516615
[    0.000000] Kernel command line: console=hvc earlycon=sbi cma=1024M@0-4G
[    0.000000] Dentry cache hash table entries: 262144 (order: 9, 2097152 bytes, linear)
[    0.000000] Inode-cache hash table entries: 131072 (order: 8, 1048576 bytes, linear)
[    0.000000] Sorting __ex_table...
[    0.000000] mem auto-init: stack:off, heap alloc:off, heap free:off
[    0.000000] Memory: 925228K/2095104K available (6538K kernel code, 4135K rwdata, 4096K rodata, 7259K init, 318K bss, 121300K reserved, 1048576K cma-reserved)
[    0.000000] Virtual kernel memory layout:
[    0.000000]       fixmap : 0xffffffcefee00000 - 0xffffffceff000000   (2048 kB)
[    0.000000]       pci io : 0xffffffceff000000 - 0xffffffcf00000000   (  16 MB)
[    0.000000]      vmemmap : 0xffffffcf00000000 - 0xffffffcfffffffff   (4095 MB)
[    0.000000]      vmalloc : 0xffffffd000000000 - 0xffffffdfffffffff   (65535 MB)
[    0.000000]       lowmem : 0xffffffe000000000 - 0xffffffe07fe00000   (2046 MB)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=4, Nodes=1
[    0.000000] rcu: Hierarchical RCU implementation.
[    0.000000] rcu:     RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=4.
[    0.000000] rcu:     RCU debug extended QS entry/exit.
[    0.000000] rcu: RCU calculated value of scheduler-enlistment delay is 25 jiffies.
[    0.000000] rcu: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=4
[    0.000000] NR_IRQS: 0, nr_irqs: 0, preallocated irqs: 0
[    0.000000] plic: mapped 53 interrupts with 4 handlers for 9 contexts.
[    0.000000] riscv_timer_init_dt: Registering clocksource cpuid [0] hartid [3]
[    0.000000] clocksource: riscv_clocksource: mask: 0xffffffffffffffff max_cycles: 0x1d854df40, max_idle_ns: 3526361616960 ns
[    0.000007] sched_clock: 64 bits at 1000kHz, resolution 1000ns, wraps every 2199023255500ns
[    0.008565] Console: colour dummy device 80x25
[    0.012968] printk: console [hvc0] enabled
[    0.012968] printk: console [hvc0] enabled
[    0.021279] printk: bootconsole [sbi0] disabled
[    0.021279] printk: bootconsole [sbi0] disabled
[    0.030506] Calibrating delay loop (skipped), value calculated using timer frequency.. 2.00 BogoMIPS (lpj=4000)
[    0.040642] pid_max: default: 32768 minimum: 301
[    0.045597] Mount-cache hash table entries: 4096 (order: 3, 32768 bytes, linear)
[    0.052887] Mountpoint-cache hash table entries: 4096 (order: 3, 32768 bytes, linear)
[    0.062609] rcu: Hierarchical SRCU implementation.
[    0.067366] smp: Bringing up secondary CPUs ...
[SM] Keystone security monitor has been initialized!
[SM] Keystone security monitor has been initialized!
[SM] Keystone security monitor has been initialized!
[    0.085478] smp: Brought up 1 node, 4 CPUs
[    0.090381] devtmpfs: initialized
[    0.095596] random: get_random_u32 called from bucket_table_alloc.isra.0+0x4e/0x154 with crng_init=0
[    0.095909] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 7645041785100000 ns
[    0.114175] futex hash table entries: 1024 (order: 4, 65536 bytes, linear)
[    0.182379] NET: Registered protocol family 16
[    0.205060] vgaarb: loaded
[    0.207450] SCSI subsystem initialized
[    0.211302] usbcore: registered new interface driver usbfs
[    0.216583] usbcore: registered new interface driver hub
[    0.221921] usbcore: registered new device driver usb
[    0.227792] clocksource: Switched to clocksource riscv_clocksource
[    0.240449] NET: Registered protocol family 2
[    0.244728] tcp_listen_portaddr_hash hash table entries: 1024 (order: 3, 40960 bytes, linear)
[    0.252881] TCP established hash table entries: 16384 (order: 5, 131072 bytes, linear)
[    0.261220] TCP bind hash table entries: 16384 (order: 7, 524288 bytes, linear)
[    0.269867] TCP: Hash tables configured (established 16384 bind 16384)
[    0.276182] UDP hash table entries: 1024 (order: 4, 98304 bytes, linear)
[    0.282835] UDP-Lite hash table entries: 1024 (order: 4, 98304 bytes, linear)
[    0.290246] NET: Registered protocol family 1
[    0.294707] RPC: Registered named UNIX socket transport module.
[    0.300130] RPC: Registered udp transport module.
[    0.304899] RPC: Registered tcp transport module.
[    0.309659] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.316173] PCI: CLS 0 bytes, default 64
[    0.389658] workingset: timestamp_bits=62 max_order=19 bucket_order=0
[    0.404573] NFS: Registering the id_resolver key type
[    0.408985] Key type id_resolver registered
[    0.413254] Key type id_legacy registered
[    0.417290] nfs4filelayout_init: NFSv4 File Layout Driver Registering...
[    0.424202] 9p: Installing v9fs 9p2000 file system support
[    0.430007] NET: Registered protocol family 38
[    0.434163] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)
[    0.441591] io scheduler mq-deadline registered
[    0.446186] io scheduler kyber registered
[    0.504263] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[    0.511465] [drm] radeon kernel modesetting enabled.
[    0.529833] loop: module loaded
[    0.533042] sifive_spi 10040000.spi: mapped; irq=39, cs=1
[    0.538373] sifive_spi 10041000.spi: mapped; irq=40, cs=4
[    0.543615] sifive_spi 10050000.spi: mapped; irq=41, cs=1
[    0.549671] libphy: Fixed MDIO Bus: probed
[    0.553909] macb 10090000.ethernet: failed to get macb_clk (-517)
[    0.559506] e1000e: Intel(R) PRO/1000 Network Driver - 3.2.6-k
[    0.565223] e1000e: Copyright(c) 1999 - 2015 Intel Corporation.
[    0.571317] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    0.577816] ehci-pci: EHCI PCI platform driver
[    0.582358] ehci-platform: EHCI generic platform driver
[    0.587746] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    0.593888] ohci-pci: OHCI PCI platform driver
[    0.598432] ohci-platform: OHCI generic platform driver
[    0.604289] usbcore: registered new interface driver uas
[    0.609127] usbcore: registered new interface driver usb-storage
[    0.615293] mousedev: PS/2 mouse device common for all mice
[    0.654106] mmc_spi spi2.0: SD/MMC host mmc0, no DMA, no WP, no poweroff, cd polling
[    0.661370] usbcore: registered new interface driver usbhid
[    0.666816] usbhid: USB HID core driver
[    0.671571] NET: Registered protocol family 10
[    0.676409] Segment Routing with IPv6
[    0.679460] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[    0.685983] NET: Registered protocol family 17
[    0.690145] 9pnet: Installing 9P2000 support
[    0.694300] Key type dns_resolver registered
[    0.699305] macb 10090000.ethernet: failed to get macb_clk (-517)
[    0.704928] macb 10090000.ethernet: failed to get macb_clk (-517)
[    0.731976] Freeing unused kernel memory: 7256K
[    0.735983] Run /init as init process
Starting syslogd: OK
Starting klogd: OK
Running sysctl: OK
Saving random seed: [    0.841816] random: dd: uninitialized urandom read (512 bytes read)
OK
[    0.850269] mmc0: host does not support reading read-only switch, assuming write-enable
[    0.857617] mmc0: new SDHC card on SPI
Starting netwo[k   0.862623] mmcblk0: mmc0:0000 SS08G 7.40 GiB
Waiting for interface eth0 to appear.....[    6.327627]  mmcblk0: p1 p2 p3
[    6.331486] macb 10090000.ethernet: failed to get macb_clk (-517)
.......... timeout!
run-parts: /etc/network/if-pre-up.d/wait_iface: exit status 1
FAIL
Starting dropbear sshd: OK

...

Additional context

I use the HiFive Unleashed board and the Keystone FSBL.

My build:

$ git clone  https://github.com/keystone-enclave/keystone keystone
$ cd keystone
$ ./fast-setup.sh
$ mkdir build && cd build
$ cmake .. -DLINUX_SIFIVE=y
$ make && make image

Afterwards, I built the FSBL and flashed the SD card as described here http://docs.keystone-enclave.org/en/latest/Getting-Started/Running-Keystone-on-Hardware.html. Except that I replaced bbl.bin with fw_payload.bin.

If this issue has been resolved in the v1.0.0 release, as mentioned in https://github.com/keystone-enclave/keystone/issues/147#issuecomment-789264567 , please provide me feedback on how to solve this issue.

Kind regards

dayeol commented 3 years ago

i am not sure why this is recurring, I will try to reproduce the issue. Maybe our fsbl has some problem.

0xWilliamWang commented 3 years ago

I had the same problem, even if i use opensbi v0.9

➜  keystone git:(master) ✗ git submodule status
 9624a001f9d4314f8bcc9219df717d4c41fb5373 buildroot (2020.11)
 3d77e6a8804abcc0504c904bd6e5cdf3a5cf8162 linux (v5.7)
 0a1597bc6215f00b8c39ff44565df541d74ac782 linux-keystone-driver (v1.0.0)
 fdd76fecdde1ad444ff4deb7f1c4f7e4a1ef97d6 qemu (v5.0.0)
 407cdc0ceb0f6d760342ac6cf1b890378f5a81bd riscv-gnu-toolchain
 24a5ed369ac0606aac486382a0855a459d9362ed sdk (v1.0.0)
 843d3509b8a514d43729d779a0cf6bdb1d0c94e0 sm (v1.0)
➜  keystone git:(master) ✗ git log -1 --oneline
a1842a1 (HEAD -> master, tag: v1.0.0, origin/master, origin/HEAD, keystone-dev) Merge pull request #216 from keystone-enclave/dev
➜  keystone git:(master) ✗ cd sm/
➜  sm git:(843d350) ✗ git submodule status
+234ed8e427f4d92903123199f6590d144e0d9351 opensbi (v0.9)