On Mon, Jun 21, 2021 at 8:33 AM meshkat os <[email protected]> wrote:
>
> 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 -- [email protected]
> To unsubscribe send an email to [email protected]
_______________________________________________
Devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to