virtio-drivers icon indicating copy to clipboard operation
virtio-drivers copied to clipboard

QEMU Virtio device id is zero

Open BDUG opened this issue 5 months ago • 0 comments

Hi all,

I am trying to access virtio devices in my SeL4 operating system instance, but the devices provide a deviceid of zero.

QEMU call:

qemu-system-aarch64 \ -machine virt,virtualization=on,acpi=on \ -cpu cortex-a57 \ -smp 4 \ -m 2048 \ -nographic \ -append "console=ttyAMA0" \ -drive file=./disk.img,if=none,format=raw,id=blk-device-0 \ -device virtio-blk-device,drive=blk-device-0,scsi=off \ -gdb tcp::3333 \ -S \ -kernel $(image)

I checked it in parallel via volatile reads:

let magic_value = ptr::read_volatile((mapped_address + 0x008) as *const u32);

The "magic" and "version" are given but the device id is zero.

May could it make sense to allow to set the "device id" from external while doing the following calls?

let header = NonNull::new(mapped_address as *mut VirtIOHeader).unwrap(); let transport = unsafe { MmioTransport::new(header) };

If so I am happy to do the PR

BDUG avatar Sep 16 '24 18:09 BDUG