Pass Ethernet device to CAmkES ARM VM when using QEMU
Hi,
I am currently trying to pass a device for ethernet access through qemu to the vm. However there seems to be some issue since the device is not passed through correctly.
I have looked at some resources for guidance on how to solve it:
https://github.com/seL4/sel4webserver (webserver example)
https://lists.sel4.systems/hyperkitty/list/devel@sel4.systems/message/X34TX7... (old devel thread)
And the important parts for this to work seems to be untyped_mmios for the vm (in devices.camkes for qemu-arm-virt):
vm0.untyped_mmios = [
"0x8040000:12", // Interrupt Controller Virtual CPU interface (Virtual Machine view)
/* TODO: QEMU PCI addresses could change - ideally need to decode from pcie node */
"0x10040000:17", // QEMU PCI MMIO
"0x3eff0000:16", // QEMU PCI IO ports
"0x40000000:29", // Linux kernel memory regions
];
And passing the device to QEMU in the simulation script:
$ sudo ./simulate --extra-qemu-args="-netdev tap,id=mynet0,ifname=tap0,script=no,downscript=no -device virtio-net,netdev=mynet0,mac=52:55:00:d1:55:01"
However when listing the devices with "ip a" on the VM it does not show an eth0 device:
# ip a
1: lo:
Since I managed to figure it out I thought I should post my solution to the problem in case there are others with the same question (at least for the qemu-arm-virt device). Start qemu with the following command: sudo ./simulate --extra-qemu-args="-netdev tap,id=mynet0,ifname=tap0,script=no,downscript=no -device virtio-net,netdev=mynet0,mac=52:55:00:d1:55:01,disable-modern=on,disable-legacy=off" This thread that suggested adding ",disable-modern=on,disable-legacy=off" might be of interest when figuring out what previously went wrong: https://qemu-devel.nongnu.narkive.com/otcGnLuw/bug-virtio-net-linux-driver-f... When the VM has booted, add an ip to the "eth0" device that should now be visible. Do this by editing the /etc/network/interfaces file and adding: auto eth0 iface eth0 inet static address XXX.XXX.XXX.XXX (replace with the IP of your choice, this will be the guest IP) netmask 255.255.255.0 Then save the changes and run: ifup eth0 Then add an ip to the device that was added to the host when running the simulate script: sudo ip addr add YYY.YYY.YYY.YYY/24 dev tap0 (replace with the IP of your choice, this will be the host IP) sudo ip link set dev tap0 up It should now be possible to reach the VM from the host with IP XXX.XXX.XXX.XXX and reach the host from the VM with IP YYY.YYY.YYY.YYY. At least ping from host to vm and from vm to host worked for me. /Olof
participants (1)
-
Olof Holmberg