ethernet pass-through using CAmkES VM on x86
hi I am new to camkes VM on x86. I want to connect the guest to the host via the ethernet network. and I used this ( https://docs.sel4.systems/projects/camkes-vm/) tutorial to create pass-through in minimal example x86. run in qemu on ubuntu 17.10. but the guest os doesn't create an ethernet interface. I also tested zmq example this is qemu options: qemu-system-x86_64 -machine q35,accel=kvm,kernel-irqchip=split -cpu Nehalem,+vme,+pdpe1gb,-xsave,-xsaveopt,-xsavec,-fsgsbase,-invpcid,enforce,+vmx -nographic -serial mon:stdio -m size=2G -enable-kvm -net nic,model=e1000 -net tap,script=no,ifname=tap0 -kernel images/kernel-ia32-pc99 -initrd images/capdl-loader-image-ia32-pc99 and minimal.camkes configs: configuration { VM_CONFIGURATION_DEF() VM_PER_VM_CONFIG_DEF(0) vm0.simple_untyped23_pool = 20; vm0.heap_size = 0x2000000; vm0.guest_ram_mb = 128; vm0.kernel_cmdline = VM_GUEST_CMDLINE; vm0.kernel_image = "bzimage"; vm0.kernel_relocs = "bzimage"; vm0.initrd_image = "rootfs.cpio"; vm0.iospace_domain = 0x0f; vm0_config.pci_devices_iospace = 1; vm0_config.ioports = [ {"start":0x4080, "end":0x4090, "pci_device":0x1f, "name":"SATA"}, {"start":0x4090, "end":0x40a0, "pci_device":0x1f, "name":"SATA"}, {"start":0x40b0, "end":0x40b8, "pci_device":0x1f, "name":"SATA"}, {"start":0x40b8, "end":0x40c0, "pci_device":0x1f, "name":"SATA"}, {"start":0x40c8, "end":0x40cc, "pci_device":0x1f, "name":"SATA"}, {"start":0x40cc, "end":0x40d0, "pci_device":0x1f, "name":"SATA"}, {"start":0x3000, "end":0x3020, "pci_device":0, "name":"Ethernet5"}, ]; vm0_config.pci_devices = [ { "name":"SATA", "bus":0, "dev":0x1f, "fun":2, "irq":"SATA", "memory":[], }, { "name":"Ethernet5", "bus":5, "dev":0, "fun":0, "irq":"Ethernet5", "memory":[ {"paddr":0xc0500000, "size":0x20000, "page_bits":12}, {"paddr":0xc0520000, "size":0x4000, "page_bits":12}, ], }, ]; vm0_config.irqs = [ {"name":"SATA", "source":19, "level_trig":1, "active_low":1, "dest":11}, {"name":"Ethernet5", "source":0x11, "level_trig":1, "active_low":1, "dest":10}, ]; } thanks
On Mon, Jun 21, 2021 at 8:33 AM meshkat os
hi
I am new to camkes VM on x86. I want to connect the guest to the host via the ethernet network. and I used this ( https://docs.sel4.systems/projects/camkes-vm/) tutorial to create pass-through in minimal example x86. run in qemu on ubuntu 17.10. but the guest os doesn't create an ethernet interface. I also tested zmq example
Unfortunately setting up passthrough devices on x86 for camkes-vm apps is pretty painful. There isn't any tool that will automatically detect which config values are needed to describe the PCI and IRQ passthrough information. Currently what you would need to do is run the qemu-system-x86_64 command (with the same arguments as for seL4) but giving qemu a linux kernel binary and initrd. If your host is x86_64 you can usually use the vmlinuz and initrd binaries from your host's /boot directory. You need to also add some linux configuration to the qemu command line: "-append 'acpi=off pci=nomsi'". Then when linux starts into the initramfs you can dump the pci parameters. cat /proc/bus/pci/devices for the PCI mappings and interrupt number. Or cat /proc/interrupts after calling ifconfig <devname> up to start the device. On my machine, a qemu passthrough ethernet device has IRQ number 11 and MMIO values of 0xfebc0000 and 0xfeb8000 but it could be different for your qemu version. You will also need to update the bus-dev-func address of the device in camkes too. For me this was 00:02.0. Plugging that all into the camkes spec and then reloading your vm may allow ethernet to work once you bring up the interface using ifconfig.
this is qemu options: qemu-system-x86_64 -machine q35,accel=kvm,kernel-irqchip=split -cpu Nehalem,+vme,+pdpe1gb,-xsave,-xsaveopt,-xsavec,-fsgsbase,-invpcid,enforce,+vmx -nographic -serial mon:stdio -m size=2G -enable-kvm -net nic,model=e1000 -net tap,script=no,ifname=tap0 -kernel images/kernel-ia32-pc99 -initrd images/capdl-loader-image-ia32-pc99
and minimal.camkes configs:
configuration {
VM_CONFIGURATION_DEF() VM_PER_VM_CONFIG_DEF(0)
vm0.simple_untyped23_pool = 20; vm0.heap_size = 0x2000000; vm0.guest_ram_mb = 128; vm0.kernel_cmdline = VM_GUEST_CMDLINE; vm0.kernel_image = "bzimage"; vm0.kernel_relocs = "bzimage"; vm0.initrd_image = "rootfs.cpio"; vm0.iospace_domain = 0x0f;
vm0_config.pci_devices_iospace = 1;
vm0_config.ioports = [ {"start":0x4080, "end":0x4090, "pci_device":0x1f, "name":"SATA"}, {"start":0x4090, "end":0x40a0, "pci_device":0x1f, "name":"SATA"}, {"start":0x40b0, "end":0x40b8, "pci_device":0x1f, "name":"SATA"}, {"start":0x40b8, "end":0x40c0, "pci_device":0x1f, "name":"SATA"}, {"start":0x40c8, "end":0x40cc, "pci_device":0x1f, "name":"SATA"}, {"start":0x40cc, "end":0x40d0, "pci_device":0x1f, "name":"SATA"}, {"start":0x3000, "end":0x3020, "pci_device":0, "name":"Ethernet5"}, ];
vm0_config.pci_devices = [ { "name":"SATA", "bus":0, "dev":0x1f, "fun":2, "irq":"SATA", "memory":[], },
{ "name":"Ethernet5", "bus":5, "dev":0, "fun":0, "irq":"Ethernet5", "memory":[ {"paddr":0xc0500000, "size":0x20000, "page_bits":12}, {"paddr":0xc0520000, "size":0x4000, "page_bits":12}, ], }, ];
vm0_config.irqs = [ {"name":"SATA", "source":19, "level_trig":1, "active_low":1, "dest":11}, {"name":"Ethernet5", "source":0x11, "level_trig":1, "active_low":1, "dest":10}, ]; }
thanks _______________________________________________ Devel mailing list -- devel@sel4.systems To unsubscribe send an email to devel-leave@sel4.systems
On Wed, 29 Sept 2021 at 18:10, erickaoakes--- via Devel
Hi Kent,
Unfortunately setting up passthrough devices on x86 for camkes-vm apps is pretty painful.
It appears that your answer is specific to QEMU x64? Is setting up passthrough devices on x64 bare metal similarly painful?
That sounds about as painful as parsing the ACPI MCFG table from scratch. Has anyone done this on seL4? -- William Leslie Q: What is your boss's password? A: "Authentication", clearly Notice: Likely much of this email is, by the nature of copyright, covered under copyright law. You absolutely MAY reproduce any part of it in accordance with the copyright law of the nation you are reading this in. Any attempt to DENY YOU THOSE RIGHTS would be illegal without prior contractual agreement.
On Wed, Sep 29, 2021 at 6:23 PM William ML Leslie
On Wed, 29 Sept 2021 at 18:10, erickaoakes--- via Devel
wrote: Hi Kent,
Unfortunately setting up passthrough devices on x86 for camkes-vm apps is pretty painful.
It appears that your answer is specific to QEMU x64? Is setting up passthrough devices on x64 bare metal similarly painful?
Yea, essentially CAMKES is missing a plugin for calculating the hardware resources that a particular PCI device would need. There is a plugin for doing this with Arm and RISCV using flattened device trees, but it would be more complicated for x86 because the device hierarchy is dynamically calculated at startup so a plugin would need to be able to either run a program on the platform and dump this information in a format that the camkes tooling could then turn into seL4 hardware caps or some other way of precalculating what hardware resources a device will end up with. Because there's no plugin for doing this, it currently must be done manually as I described above.
That sounds about as painful as parsing the ACPI MCFG table from scratch. Has anyone done this on seL4?
It'd be pretty useful if we had a program that could be run on a target platform during build time or as a one-off for a platform with a fixed hardware layout that could generate an FDT spec that could be fed back into camkes when producing a system image. As far as I'm aware this isn't roadmapped currently.
-- William Leslie
Q: What is your boss's password? A: "Authentication", clearly
Notice: Likely much of this email is, by the nature of copyright, covered under copyright law. You absolutely MAY reproduce any part of it in accordance with the copyright law of the nation you are reading this in. Any attempt to DENY YOU THOSE RIGHTS would be illegal without prior contractual agreement. _______________________________________________ Devel mailing list -- devel@sel4.systems To unsubscribe send an email to devel-leave@sel4.systems
participants (4)
-
erickaoakes@protonmail.com
-
Kent Mcleod
-
meshkat os
-
William ML Leslie