[OpenBIOS] [PATCH 0/2] Add legacy virtio-blk driver to OpenBIOS

Mark Cave-Ayland mark.cave-ayland at ilande.co.uk
Mon Aug 1 22:39:37 CEST 2016


On 01/08/16 16:06, Artyom Tarasenko wrote:

> Good job, Mark!
> So, now it's possible to boot the PPC and SPARC64 systems from virtio
> drives, right?
> 
> Artyom

That's correct, with one caveat - it seems that the drivers in some of
the test Debian 9.0 images don't like QEMU advertising both modern and
legacy modes:

./qemu-system-sparc64 -drive
file=/home/build/src/qemu/image/sparc64/debian-9.0-sparc64-NETINST-1.iso,if=virtio,media=cdrom,index=0
-nographic -bios
/home/build/src/openbios/openbios.git/openbios/obj-sparc64/openbios-builtin.elf.nostrip
-m 256

OpenBIOS for Sparc64
open isn't unique.
close isn't unique.
Configuration device id QEMU version 1 machine id 0
kernel cmdline
CPUs: 1 x SUNW,UltraSPARC-IIi
UUID: 00000000-0000-0000-0000-000000000000
Welcome to OpenBIOS v1.1 built on Aug 1 2016 18:06
  Type 'help' for detailed information
Trying disk:a...
No valid state has been set by load or init-program

0 > boot virtio0:d

(cut)

[   22.223263] ffe2f1d0: ttyS0 at MMIO 0x1fe020043f8 (irq = 5, base_baud
= 115387) is a 16550A
[   22.223905] Console: ttyS0 (SU)
[   22.277730] console [ttyS0] enabled
[   22.297898] mousedev: PS/2 mouse device common for all mice
[   22.321023] rtc-m48t59 rtc-m48t59.0: rtc core: registered m48t59 as rtc0
[   22.323433] ledtrig-cpu: registered to indicate activity on CPUs
[   22.332493] NET: Registered protocol family 10
[   22.356833] mip6: Mobile IPv6
[   22.357582] NET: Registered protocol family 17
[   22.358693] mpls_gso: MPLS GSO support
[   22.364318] registered taskstats version 1
[   22.367031] zswap: loaded using pool lzo/zbud
[   22.378680] rtc-m48t59 rtc-m48t59.0: setting system clock to
2016-08-01 20:14:14 UTC (1470082454)
[   23.527600] random: systemd-udevd urandom read with 0 bits of entropy
available
[   26.788885] ne2k-pci.c:v1.03 9/22/2003 D. Becker/P. Gortmaker
[   26.901425] ne2k-pci 0000:00:04.0 eth0: RealTek RTL-8029 found at
0x1fe02008000, IRQ 6, 52:54:00:12:34:56.
[   48.346114] NMI watchdog: BUG: soft lockup - CPU#0 stuck for 23s!
[systemd-udevd:57]
[   48.347490] Modules linked in: virtio_pci(+) virtio_ring ne2k_pci(+)
virtio 8390
[   48.349833] CPU: 0 PID: 57 Comm: systemd-udevd Not tainted
4.3.0-1-sparc64 #1 Debian 4.3.3-2
[   48.351288] task: fffff8000f4275e0 ti: fffff8000f55c000 task.ti:
fffff8000f55c000
[   48.352552] TSTATE: 0000009911001600 TPC: 0000000010024274 TNPC:
0000000010024278 Y: 00000000    Not tainted
[   48.355228] TPC: <vp_reset+0x14/0x40 [virtio_pci]>
[   48.356043] g0: 0000000000b04400 g1: 000001ff04800014 g2:
fffffffffffb0000 g3: 0000000000000000
[   48.357446] g4: fffff8000f4275e0 g5: 0000000000332ed0 g6:
fffff8000f55c000 g7: 0000000000000001
[   48.358836] o0: 0000000000000000 o1: 000000001000ad08 o2:
fffff8000f55f380 o3: fffff8000f41a880
[   48.360203] o4: fffff8000f41a888 o5: fffff8000f5ad2c0 sp:
fffff8000f55ea41 ret_pc: 0000000000764384
[   48.361666] RPC: <dev_set_name+0x24/0x40>
[   48.362418] l0: 0000000080000000 l1: 0000001111001607 l2:
0000000010025168 l3: 0000000000000400
[   48.363788] l4: 0000000000000000 l5: 0000000000000001 l6:
0000000000000000 l7: 0000000000000008
[   48.365198] i0: fffff8000f516c00 i1: 000000001000ad08 i2:
0000000000000000 i3: 00000000000000d0
[   48.366586] i4: 0000000000000000 i5: 0000000000000000 i6:
fffff8000f55eaf1 i7: 000000001000a4e4
[   48.368098] I7: <register_virtio_device+0x64/0x100 [virtio]>
[   48.369130] Call Trace:
[   48.369740]  [000000001000a4e4] register_virtio_device+0x64/0x100
[virtio]
[   48.370915]  [0000000010025820] virtio_pci_probe+0xa0/0x160 [virtio_pci]
[   48.371983]  [00000000006eaf40] pci_device_probe+0x80/0x100
[   48.372879]  [000000000076928c] driver_probe_device+0x16c/0x480
[   48.373829]  [0000000000769628] __driver_attach+0x88/0xa0
[   48.374683]  [0000000000766fdc] bus_for_each_dev+0x5c/0xa0
[   48.375554]  [0000000000768c1c] driver_attach+0x1c/0x40
[   48.376408]  [0000000000768710] bus_add_driver+0x1f0/0x2a0
[   48.377281]  [000000000076a114] driver_register+0x74/0x120
[   48.378162]  [00000000006e9894] __pci_register_driver+0x34/0x60
[   48.379186]  [000000001002a018] virtio_pci_driver_init+0x18/0x28
[virtio_pci]
[   48.380328]  [0000000000426c58] do_one_initcall+0xb8/0x200
[   48.381226]  [0000000000525200] do_init_module+0x50/0x1f0
[   48.382091]  [00000000004c2514] load_module+0x1c54/0x23c0
[   48.382953]  [00000000004c2e74] SyS_finit_module+0x94/0xe0
[   48.383843]  [00000000004060f4] linux_sparc_syscall+0x34/0x44


Fortunately it is possible to force legacy mode with a bit of QEMU
command-line fu in order to get the desired behaviour:

./qemu-system-sparc64 -drive
file=/home/build/src/qemu/image/sparc64/debian-9.0-sparc64-NETINST-1.iso,if=none,media=cdrom,id=cd,index=0
-device virtio-blk-pci,disable-modern=on,drive=cd -nographic -bios
/home/build/src/openbios/openbios.git/openbios/obj-sparc64/openbios-builtin.elf.nostrip
-m 256

OpenBIOS for Sparc64
open isn't unique.
close isn't unique.
Configuration device id QEMU version 1 machine id 0
kernel cmdline
CPUs: 1 x SUNW,UltraSPARC-IIi
UUID: 00000000-0000-0000-0000-000000000000
Welcome to OpenBIOS v1.1 built on Aug 1 2016 18:06
  Type 'help' for detailed information
Trying disk:a...
No valid state has been set by load or init-program

0 > boot virtio0:d

(cut)

[   21.749180] ffe2f1d0: ttyS0 at MMIO 0x1fe020043f8 (irq = 5, base_baud
= 115387) is a 16550A
[   21.749779] Console: ttyS0 (SU)
[   21.803436] console [ttyS0] enabled
[   21.824159] mousedev: PS/2 mouse device common for all mice
[   21.842179] rtc-m48t59 rtc-m48t59.0: rtc core: registered m48t59 as rtc0
[   21.844768] ledtrig-cpu: registered to indicate activity on CPUs
[   21.858976] NET: Registered protocol family 10
[   21.884821] mip6: Mobile IPv6
[   21.885565] NET: Registered protocol family 17
[   21.886398] mpls_gso: MPLS GSO support
[   21.892226] registered taskstats version 1
[   21.894600] zswap: loaded using pool lzo/zbud
[   21.905840] rtc-m48t59 rtc-m48t59.0: setting system clock to
2016-08-01 20:36:46 UTC (1470083806)
[   23.025258] random: systemd-udevd urandom read with 0 bits of entropy
available
[   26.240261] ne2k-pci.c:v1.03 9/22/2003 D. Becker/P. Gortmaker
[   26.364453] ne2k-pci 0000:00:04.0 eth0: RealTek RTL-8029 found at
0x1fe02008000, IRQ 6, 52:54:00:12:34:56.
[   26.386623] virtio-pci 0000:00:06.0: virtio_pci: leaving for legacy
driver
[   29.109407] ne2k-pci 0000:00:04.0 enp0s4: renamed from eth0
[   29.118803]  vda: vda1 vda2 vda3 vda4 vda5 vda6 vda7 vda8
Starting system log daemon: syslogd, klogd.

Given that transitional/legacy support is complicated enough, I'm quite
tempted to rework this to a proper 1.0 driver before commit so the
default behaviour "just works" for users.


ATB,

Mark.




More information about the OpenBIOS mailing list