Hi Travis,
For networking to work on the qemu-arm-virt platform, the networking device has to be passthrough'd to the Linux guest.
We have an example of this in the sel4webserver project [1] which uses a Linux guest VM to run a web server that serves static pages.
This file [2], describes the list of memory allocated and passthrough'd to the Linux guest. The entire PCIe memory block is passed through to the Linux guest and is where the networking device should reside.
Additionally, [3] describes the flags that should be passed to QEMU.
Regards,
Damon
[1] https://github.com/SEL4PROJ/sel4webserver
[2] https://github.com/SEL4PROJ/sel4webserver/blob/master/qemu-arm-virt/devices....
[3] https://github.com/SEL4PROJ/sel4webserver/blob/master/settings.cmake#L48
________________________________
From: Devel on behalf of Travis Wheatley
Sent: Wednesday, 29 April 2020 7:02 AM
To: devel@sel4.systems
Subject: [seL4] Trouble accessing linux guest through tun/tap
Greetings,
I am working with the camkes-arm-vm qemu-arm-virt configuration. I started with the vm_minimal configuration and have added a tun/tap interface by creating the tap on my host thusly:
# ip tuntap add tap0 mode tap
# ip addr add 10.0.120.100/24 dev tap0
# ip link set dev tap0 up
I have added support for what I beleive to be the appropriate interrupts by modifying my devices.camkes file thusly:
vm0.untyped_mmios = [
"0x8040000:12", // Interrupt Controller Virtual CPU interface (Virtual Machine view)
"0x10040000:17", // QEMU PCI MMIO
"0x3eff0000:16", // QEMU PCI IO ports
"0x40000000:29", // Linux kernel memory regions
];
vm0.dtb_irqs = [35, 36, 37, 38];
Additionally, I have modified the settings.camkes thusly:
if(${PLATFORM} STREQUAL "qemu-arm-virt")
# force cpu
set(QEMU_MEMORY "2048")
set(KernelArmCPU cortex-a53 CACHE STRING "" FORCE)
set(VmInitRdFile ON CACHE BOOL "" FORCE)
set(VmPCISupport ON CACHE BOOL "" FORCE)
set(VmVirtioNetArping OFF CACHE BOOL "" FORCE)
set(VmVirtioNetVirtqueue ON CACHE BOOL "" FORCE)
# set(qemu_sim_extra_args "-netdev tap,id=mynet0,ifname=tap0,script=no,downscript=no -device virtio-net,netdev=mynet0,mac=52:55:00:d1:55:01")
set(qemu_sim_extra_args "-net nic,model=e1000 -netdev tap,id=mynet0,script=no,ifname=tap0 -device virtio-net,netdev=mynet0,mac=52:55:00:d1:55:01")
set(KernelArmExportPCNTUser ON CACHE BOOL "" FORCE)
set(KernelArmExportPTMRUser ON CACHE BOOL "" FORCE)
endif()
This results in a tunl0 interface showing up on my linux guest. However, that interface does not have a mac address associated with it. I can use ifconfig to assign an IP address on the same subnet as the corresponding tap interface on the host. However, I can’t ping between the two. I thought this might be because I have VmVitruoNetArping set to OFF. However, I get compile time errors when I turn it on. Because the tunl0 inteface does not have the mac address specied in the qemu_sim_extra_args I am unsure of how to set up an arp table entry.
Exctly what do I need to do to enable network communications between my linux guest and the host?
_______________________________________________
Devel mailing list
Devel@sel4.systems
https://sel4.systems/lists/listinfo/devel