[Bug 1996285] Re: [SRU] riscv64 images fail to boot with libvirt and u-boot-qemu in 22.10

Heinrich Schuchardt 1996285 at bugs.launchpad.net
Fri Nov 25 21:35:06 UTC 2022


** Description changed:

- 1) The release of Ubuntu you are using, via 'lsb_release -rd' or System
- -> About Ubuntu
+ [ Impact ]
  
- $ lsb_release -rd
- Description:    Ubuntu 22.10
- Release:        22.10
+ U-Boot provides a driver for virtio PCIe devices. Due to a bug
+ introduced in upstream U-Boot 2022.07 the enumeration of PCIe bars does
+ not work correctly. This has lead to crashes when executing U-Boot's
+ 'virtio scan' command.
  
- 2) The version of the package you are using, via 'apt-cache policy
- pkgname' or by checking in Software Center
+ An upstream patch fixing the issue is available. This patch only changes
+ the virtio- PCIe driver.
  
- $ apt-cache policy libvirt0
- libvirt0:
-   Installed: 8.6.0-0ubuntu3
-   Candidate: 8.6.0-0ubuntu3
-   Version table:
-  *** 8.6.0-0ubuntu3 500
-         500 http://archive.ubuntu.com/ubuntu kinetic/main amd64 Packages
-         100 /var/lib/dpkg/status
+ [ Test Plan ]
  
- $ apt-cache policy u-boot-qemu
- u-boot-qemu:
-   Installed: 2022.07+dfsg-1ubuntu4
-   Candidate: 2022.07+dfsg-1ubuntu4
-   Version table:
-  *** 2022.07+dfsg-1ubuntu4 500
-         500 http://archive.ubuntu.com/ubuntu kinetic/main i386 Packages
-         500 http://archive.ubuntu.com/ubuntu kinetic/main amd64 Packages
-         100 /var/lib/dpkg/status
+ 1. Download the RISC-V server install image for 22.10:
+ https://cdimage.ubuntu.com/releases/22.10/release/ubuntu-22.10-live-
+ server-riscv64.img.gz
  
- 3) What you expected to happen
+ 2. Decompress the file and save it to
+ /var/lib/libvirt/images/ubuntu-22.10-live-server-riscv64.img
  
- A riscv64-based image should start without any issues using the u-boot
- binary from the u-boot-qemu package (/usr/lib/u-boot/qemu-
- riscv64_smode/uboot.elf).
+ 3. Create a VM in libvirt with the following XML:
  
- This works without issue on 22.04, and when calling qemu-system-riscv64
- manually without libvirt (which is why I'm filing the bug here).
+ cat << EOF > riscv-guest.xml
+ <?xml version="1.0"?>
+ <domain type="qemu">
+   <name>ubuntu22.10-riscv64</name>
+   <os>
+     <type arch="riscv64" machine="virt">hvm</type>
+     <kernel>/usr/lib/u-boot/qemu-riscv64_smode/uboot.elf</kernel>
+   </os>
+   <memory unit="GiB">2</memory>
+   <vcpu placement="static">4</vcpu>
+   <devices>
+     <emulator>usr/bin/qemu-system-riscv64</emulator>
+     <disk type="file" device="disk" cache="none">
+       <driver name="qemu" type="raw"/>
+       <source file="/var/lib/libvirt/images/ubuntu-22.10-live-server-riscv64.img"/>
+       <target dev="sda" bus="scsi"/>
+     </disk>
+     <controller type="scsi" model="virtio-scsi"/>
+     <interface type="network">
+       <source network="default"/>
+       <target dev="vnet0"/>
+     </interface>
+     <console type="pty">
+       <target type="serial" port="0"/>
+     </console>
+   </devices>
+ </domain>
+ EOF
  
- 4) What happened instead
+ 4. Define the VM with "virsh define riscv-guest.xml"
  
- The VM fails to boot with the following output:
+ 5. Start the VM with "virsh start ubuntu22.10-riscv64"
  
- OpenSBI v1.0
-    ____                    _____ ____ _____
-   / __ \                  / ____|  _ \_   _|
-  | |  | |_ __   ___ _ __ | (___ | |_) || |
-  | |  | | '_ \ / _ \ '_ \ \___ \|  _ < | |
-  | |__| | |_) |  __/ | | |____) | |_) || |_
-   \____/| .__/ \___|_| |_|_____/|____/_____|
-         | |
-         |_|
+ 6. Open the console with "virsh console ubuntu22.10-riscv64"
  
- Platform Name             : riscv-virtio,qemu
- Platform Features         : medeleg
- Platform HART Count       : 8
- Platform IPI Device       : aclint-mswi
- Platform Timer Device     : aclint-mtimer @ 10000000Hz
- Platform Console Device   : uart8250
- Platform HSM Device       : ---
- Platform Reboot Device    : sifive_test
- Platform Shutdown Device  : sifive_test
- Firmware Base             : 0x80000000
- Firmware Size             : 308 KB
- Runtime SBI Version       : 0.3
+ 7. Check if the image can be booted.
  
- Domain0 Name              : root
- Domain0 Boot HART         : 0
- Domain0 HARTs             : 0*,1*,2*,3*,4*,5*,6*,7*
- Domain0 Region00          : 0x0000000002000000-0x000000000200ffff (I)
- Domain0 Region01          : 0x0000000080000000-0x000000008007ffff ()
- Domain0 Region02          : 0x0000000000000000-0xffffffffffffffff (R,W,X)
- Domain0 Next Address      : 0x0000000080200000
- Domain0 Next Arg1         : 0x00000000bf000000
- Domain0 Next Mode         : S-mode
- Domain0 SysReset          : yes
+ [ Where problems could occur ]
  
- Boot HART ID              : 0
- Boot HART Domain          : root
- Boot HART ISA             : rv64imafdcsuh
- Boot HART Features        : scounteren,mcounteren,time
- Boot HART PMP Count       : 16
- Boot HART PMP Granularity : 4
- Boot HART PMP Address Bits: 54
- Boot HART MHPM Count      : 0
- Boot HART MIDELEG         : 0x0000000000001666
- Boot HART MEDELEG         : 0x0000000000f0b509
+ Only the virtio-pci driver is changed.
+ The impact is limited to the u-boot-qemu package.
  
+ In the worst case virtual machines using this driver would not boot.
  
- U-Boot 2022.07+dfsg-1ubuntu4 (Oct 13 2022 - 10:12:03 +0000)
- 
- CPU:   rv64imafdcsuh
- Model: riscv-virtio,qemu
- DRAM:  8 GiB
- Core:  31 devices, 13 uclasses, devicetree: board
- Flash: 32 MiB
- Loading Environment from nowhere... OK
- In:    uart at 10000000
- Out:   uart at 10000000
- Err:   uart at 10000000
- Net:   No ethernet found.
- Hit any key to stop autoboot:  0 
- Unhandled exception: Load access fault
- EPC: 00000000fff789e6 RA: 00000000fff789e4 TVAL: 0000000040100014
- EPC: 00000000802249e6 RA: 00000000802249e4 reloc adjusted
- 
- Code: 8082 1141 e022 e406 842e 40ef fe1f 611c (c783 0147)
- 
- 
- resetting ...
+ [ Other Info ]
+  
+ n/a

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to u-boot in Ubuntu.
https://bugs.launchpad.net/bugs/1996285

Title:
  [SRU] riscv64 images fail to boot with libvirt and u-boot-qemu in
  22.10

Status in libvirt package in Ubuntu:
  Invalid
Status in u-boot package in Ubuntu:
  Fix Released

Bug description:
  [ Impact ]

  U-Boot provides a driver for virtio PCIe devices. Due to a bug
  introduced in upstream U-Boot 2022.07 the enumeration of PCIe bars
  does not work correctly. This has lead to crashes when executing
  U-Boot's 'virtio scan' command.

  An upstream patch fixing the issue is available. This patch only
  changes the virtio- PCIe driver.

  [ Test Plan ]

  1. Download the RISC-V server install image for 22.10:
  https://cdimage.ubuntu.com/releases/22.10/release/ubuntu-22.10-live-
  server-riscv64.img.gz

  2. Decompress the file and save it to
  /var/lib/libvirt/images/ubuntu-22.10-live-server-riscv64.img

  3. Create a VM in libvirt with the following XML:

  cat << EOF > riscv-guest.xml
  <?xml version="1.0"?>
  <domain type="qemu">
    <name>ubuntu22.10-riscv64</name>
    <os>
      <type arch="riscv64" machine="virt">hvm</type>
      <kernel>/usr/lib/u-boot/qemu-riscv64_smode/uboot.elf</kernel>
    </os>
    <memory unit="GiB">2</memory>
    <vcpu placement="static">4</vcpu>
    <devices>
      <emulator>usr/bin/qemu-system-riscv64</emulator>
      <disk type="file" device="disk" cache="none">
        <driver name="qemu" type="raw"/>
        <source file="/var/lib/libvirt/images/ubuntu-22.10-live-server-riscv64.img"/>
        <target dev="sda" bus="scsi"/>
      </disk>
      <controller type="scsi" model="virtio-scsi"/>
      <interface type="network">
        <source network="default"/>
        <target dev="vnet0"/>
      </interface>
      <console type="pty">
        <target type="serial" port="0"/>
      </console>
    </devices>
  </domain>
  EOF

  4. Define the VM with "virsh define riscv-guest.xml"

  5. Start the VM with "virsh start ubuntu22.10-riscv64"

  6. Open the console with "virsh console ubuntu22.10-riscv64"

  7. Check if the image can be booted.

  [ Where problems could occur ]

  Only the virtio-pci driver is changed.
  The impact is limited to the u-boot-qemu package.

  In the worst case virtual machines using this driver would not boot.

  [ Other Info ]
   
  n/a

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/libvirt/+bug/1996285/+subscriptions




More information about the foundations-bugs mailing list