Bug 12209 - qemuppc: Cannot manage 'undefined' PCI device type '<NULL>'
Summary: qemuppc: Cannot manage 'undefined' PCI device type '<NULL>'
Status: RESOLVED ReportedUpstream
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: virtual machines (show other bugs)
Version: 2.4
Hardware: x86 Multiple
: Medium+ normal
Target Milestone: 2.5 M1
Assignee: Jackie Huang
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2017-10-10 05:37 UTC by Jackie Huang
Modified: 2017-11-07 14:00 UTC (History)
2 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jackie Huang 2017-10-10 05:37:22 UTC
There is an annoying error message when runqemu to boot qemuppc:

>> Cannot manage 'undefined' PCI device type '<NULL>':
>>  1af4 1005 (0 ff 0)

But it doesn't block the boot.

Detail logs:
==================
$ runqemu qemuppc core-image-minimal nographic slirp
runqemu - INFO - Running MACHINE=qemuppc bitbake -e...
runqemu - INFO - Continuing with the following parameters:

KERNEL: [tmp/deploy/images/qemuppc/vmlinux]
MACHINE: [qemuppc]
FSTYPE: [ext4]
ROOTFS: [tmp/deploy/images/qemuppc/core-image-minimal-qemuppc.ext4]
CONFFILE: [/myproject/tmp/deploy/images/qemuppc/core-image-minimal-qemuppc.qemuboot.conf]

runqemu - INFO - Port forward: hostfwd=tcp::2222-:22 hostfwd=tcp::2323-:23
runqemu - INFO - Running tmp/work/x86_64-linux/qemu-helper-native/1.0-r1/recipe-sysroot-native/usr/bin//qemu-system-ppc -device virtio-net-pci,netdev=net0,mac=52:54:00:12:35:02 -netdev user,id=net0,hostfwd=tcp::2222-:22,hostfwd=tcp::2323-:23,tftp=tmp/deploy/images/qemuppc -drive file=tmp/deploy/images/qemuppc/core-image-minimal-qemuppc.ext4,if=virtio,format=raw -show-cursor -usb -device usb-tablet -device virtio-rng-pci  -nographic -machine mac99 -cpu G4 -m 256 -serial mon:stdio -serial null -kernel tmp/deploy/images/qemuppc/vmlinux -append 'root=/dev/vda rw highres=off  console=ttyS0 mem=256M ip=dhcp console=tty console=ttyS0 '

C>> annot manage 'undefined' PCI device type '<NULL>':
>>  1af4 1005 (0 ff 0)

>> =============================================================
>> OpenBIOS 1.1 [Jul 13 2017 18:28]
>> Configuration device id QEMU version 1 machine id 1
>> CPUs: 1
>> Memory: 256M
>> UUID: 00000000-0000-0000-0000-000000000000
>> CPU type PowerPC,G4
milliseconds isn't unique.
Welcome to OpenBIOS v1.1 built on Jul 13 2017 18:28
>> [ppc] Kernel already loaded (0x01000000 + 0x00c1368c) (initrd 0x00000000 + 0x00000000)
>> [ppc] Kernel command line: root=/dev/vda rw highres=off  console=ttyS0 mem=256M ip=dhcp console=tty console=ttyS0
----snip----


Additional info:
It seems to be caused by "-device virtio-rng-pci", the error will be gone if I remove this option when run qemu. And I checked that the option is supported by qemuppc:

$ tmp-glibc/work/x86_64-linux/qemu-helper-native/1.0-r1/recipe-sysroot-native/usr/bin/qemu-system-ppc -device help 2>&1 |grep virtio-rng-pci
name "virtio-rng-pci", bus PCI, alias "virtio-rng"

And I found the option was added by:

commit e890c05e66a21702e9e8ccce794b74cb7f5518ed
Author: Nathan Rossi <nathan@nathanrossi.com>
Date:   Thu Sep 22 23:53:00 2016 +1000

    runqemu: Move virtio RNG to machine configuration

    Not all QEMU machines (outside of those available in OE-Core) are
    capable of using the virtio-rng-pci device due to various machine models
    not having a pci/virtio bus. This makes it such that the use of the
    '-device virtio-rng-pci' flag to QEMU is machine specific.

    This patch removes the general addition of the flag to all runqemu
    targets and adds the flag into the QB_OPT_APPEND for all the qemu*
    machines in OE-Core that support its use (which is all of them).

    Signed-off-by: Nathan Rossi <nathan@nathanrossi.com>
    Signed-off-by: Ross Burton <ross.burton@intel.com>
Comment 1 Saul Wold 2017-10-17 22:35:29 UTC
After messing around with qemu source and enabling qemu tracing, I am convinced that the problem here is the openbios when it enumerates the PCI devices, it does find the VIRTIO_RNG device in it's tables.

Currently, the openbios code is not rebuilt, we purely use the upstream binary from the qemu tarball.  An entry would be needed in the pci_database.c code in the rom/openbios code for the Virtio_rng.

I did verify via the tracing, that while the openbios does not know how to handle the virtio-rng PCI entry, the kernel correctly identifies it and I see correct tracing output when the device is accessed.

I would suggest you report it upstream and then close this bug as reported upstream.
Comment 2 Jackie Huang 2017-11-07 02:40:06 UTC
The openbios issue tracker is not accessible:
https://tracker.coreboot.org/trac/openbios

So I report it in github:
https://github.com/openbios/openbios/issues/2

And send Email to the openbios mailing list:
openbios@openbios.org