英文:
Who will configure virtio,mmio device register in qemu?
问题
I understand your issue with configuring virtio_net
in QEMU. To address this problem, you may need to provide the necessary configuration data to the virtio-mmio device. In your case, the mmio region is located at 0x0A000000
.
To write the configuration data to this mmio region, you can use QEMU's -device
option with the virtio-net-pci
device type. Here's an example of how you can modify your QEMU command to specify the configuration data:
qemu-system-aarch64 -M virt-7.1,virtualization=on -cpu cortex-a72 -m 512 -smp 1 -display none -serial mon:stdio -device loader,addr=0x50004000,cpu-num=0,file=/tftp/sd.kdi -device loader,addr=0x50004020,cpu-num=0 -netdev tap,id=mynet0,ifname=tap0,script=no,downscript=no -device virtio-net-pci,netdev=mynet0,addr=0x0A000000,mac=52:55:00:d1:55:01
In this modified command, the -device virtio-net-pci
option is used to specify the virtio-net
device with the addr
parameter set to 0x0A000000
. This should help you configure virtio_net
properly within QEMU.
Please note that you might need to adjust other parameters based on your specific use case and requirements.
英文:
I want to enable virtio_net
on qemu, virtio_net driver should return an error if the device id is zero (read from https://docs.oasis-open.org/virtio/virtio/v1.1/virtio-v1.1.html).
In qemu, 0x0A000000
address is used for virtio,mmio region. when I print the memory dump of 0x0A000000
, I am getting only the magic number, vendor id, and mmio version which is set by qemu. But my driver expects device id and other values like device features, max queue size, etc.. but gets those values to zero.
So my question is who will write the config data in virtio,mmio device register(in my case mmio region is 0x0A000000
) if qemu then which command is used?
(I am using my custom kdi)
Qemu command:
qemu-system-aarch64 -M virt-7.1,virtualization=on -cpu cortex-a72 -m 512 -smp 1 -display none -serial mon:stdio -device loader,addr=0x50004000,cpu-num=0,file=/tftp/sd.kdi -device loader,addr=0x50004020,cpu-num=0 **-netdev tap,id=mynet0,ifname=tap0,script=no,downscript=no -device e1000,netdev=mynet0,mac=52:55:00:d1:55:01**
Memory dump of 0x0A000000:
(gdb) x/64x 0x0a000000
0xa000000: 0x74726976 0x00000001 0x00000000 0x554d4551
0xa000010: 0x00000000 0x00000000 0x00000000 0x00000000
0xa000020: 0x00000000 0x00000000 0x00000000 0x00000000
0xa000030: 0x00000000 0x00000000 0x00000000 0x00000000
0xa000040: 0x00000000 0x00000000 0x00000000 0x00000000
0xa000050: 0x00000000 0x00000000 0x00000000 0x00000000
0xa000060: 0x00000000 0x00000000 0x00000000 0x00000000
0xa000070: 0x00000000 0x00000000 0x00000000 0x00000000
0xa000080: 0x00000000 0x00000000 0x00000000 0x00000000
0xa000090: 0x00000000 0x00000000 0x00000000 0x00000000
0xa0000a0: 0x00000000 0x00000000 0x00000000 0x00000000
0xa0000b0: 0x00000000 0x00000000 0x00000000 0x00000000
0xa0000c0: 0x00000000 0x00000000 0x00000000 0x00000000
0xa0000d0: 0x00000000 0x00000000 0x00000000 0x00000000
0xa0000e0: 0x00000000 0x00000000 0x00000000 0x00000000
0xa0000f0: 0x00000000 0x00000000 0x00000000 0x00000000
I tried qemu command to configure virtio_net, but unable to install driver due to config data not available at virtio,mmio region.
答案1
得分: 0
virtio-mmio设备通常不建议使用。我们提供它们是为了兼容性,因为曾经virtio板只支持这种类型的virtio,但现在通常更好地使用PCI virtio设备:它们更灵活,您可以创建更多,而且它们经过更好的测试。尽管如此,以下是您看到的virtio-mmio行为的说明:
virtio板创建的virtio MMIO设备是“传输”,也就是说,默认情况下它们没有任何后端插入其中。除非您的命令行创建了virtio后端来插入传输,否则它们是无用的,而您的命令行并没有这样做。您看到的情况是您应该期望的“没有插入任何内容的传输”。
尝试在命令行上创建一个后端,例如使用“-device virtio-blk-device”、“-device virtio-net-device”等(这些可能需要额外的子选项来配置它们,例如连接virtio-blk-device到其驱动器)。
英文:
As an initial note, the virtio-mmio devices are generally not recommended for use. We provide them for compatibility because there was a time when that was the only kind of virtio the virt board supported, but these days it's generally better to use the PCI virtio devices: they're more flexible, you can create more of them, and they're better tested. That said, here's what's up with the virtio-mmio behaviour you're seeing:
The virtio MMIO devices created by the virt board are 'transports', which is to say they don't by default have any backends plugged into them. They're useless unless your command line creates virtio backends to plug into the transport, and your command line doesn't do that. What you see is what you should expect for "transport with nothing plugged into it".
Try creating a backend on the command line, eg -with -device virtio-blk-device
, -device virtio-net-device
, etc. (These likely need extra sub-options to configure them, eg connecting a virtio-blk-device to its drive.)
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论