Virtio: zero sized buffers are not allowed,cdrom kernel diff
Posted: Sun Jan 31, 2021 9:00 pm
Hi all,
I'm trying to add virtio drivers (just block device at the moment) to my OS, however, I'm running into this issue. Once I set everything up and write 0xF (ACK | DRIVER | FEATURES_OK | DRIVERS_OK) to the status register, I get "qemu-system-x86_64: virtio: zero sized buffers are not allowed" in the terminal. If I don't set the virtual queue, I don't get this error, so I got it pinpointed there.
For the virtqueue setup, the device needs a 256 element queue, and I have the descriptors at 0x7000, available queue at 0x8000 (0x7000 + 256 * 16) and used queue at 0x9000 (aligned to 4096) and I write 0x7 to queue 0's address. All the memory here is zero initialized. I'm using the legacy interface since BAR0 for this device is an IO port.
Could someone assist me with this? Resources on virtio is much thinner than I expected. I checked out the examples at dumais.io and the managarm source, however I didn't notice anything.
Update: when I run the same kernel with `-kernel`, everything works. Running it with `-cdrom` causes this problem on linux and macos, but works on Windows.
I'm trying to add virtio drivers (just block device at the moment) to my OS, however, I'm running into this issue. Once I set everything up and write 0xF (ACK | DRIVER | FEATURES_OK | DRIVERS_OK) to the status register, I get "qemu-system-x86_64: virtio: zero sized buffers are not allowed" in the terminal. If I don't set the virtual queue, I don't get this error, so I got it pinpointed there.
For the virtqueue setup, the device needs a 256 element queue, and I have the descriptors at 0x7000, available queue at 0x8000 (0x7000 + 256 * 16) and used queue at 0x9000 (aligned to 4096) and I write 0x7 to queue 0's address. All the memory here is zero initialized. I'm using the legacy interface since BAR0 for this device is an IO port.
Could someone assist me with this? Resources on virtio is much thinner than I expected. I checked out the examples at dumais.io and the managarm source, however I didn't notice anything.
Update: when I run the same kernel with `-kernel`, everything works. Running it with `-cdrom` causes this problem on linux and macos, but works on Windows.