/* * Jailhouse, a Linux-based partitioning hypervisor * * Copyright (c) Siemens AG, 2014 * * This work is licensed under the terms of the GNU GPL, version 2. See * the COPYING file in the top-level directory. * * Configuration for ${product[0]} ${product[1]} * created with '${argstr}' * * NOTE: This config expects the following to be appended to your kernel cmdline * "memmap=${hex(ourmem[1])}$${hex(ourmem[0])}" */ #include #include #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) struct { struct jailhouse_system header; __u64 cpus[${int((cpucount + 63) / 64)}]; struct jailhouse_memory mem_regions[${len(regions)}]; struct jailhouse_irqchip irqchips[${len(irqchips)}]; __u8 pio_bitmap[0x2000]; struct jailhouse_pci_device pci_devices[${len(pcidevices)}]; struct jailhouse_pci_capability pci_caps[${len(pcicaps)}]; } __attribute__((packed)) config = { .header = { .hypervisor_memory = { .phys_start = ${hex(hvmem[0])}, .size = ${hex(hvmem[1])}, }, .platform_info.x86 = { .mmconfig_base = ${hex(mmconfig.base)}, .mmconfig_end_bus = ${hex(mmconfig.end_bus)}, .pm_timer_address = ${hex(pm_timer_base)}, % if iommu_units: .iommu_base = { % for d in iommu_units: ${hex(d)}, % endfor }, % endif }, .device_limit = 128, .interrupt_limit = 256, .root_cell = { .name = "RootCell", .cpu_set_size = sizeof(config.cpus), .num_memory_regions = ARRAY_SIZE(config.mem_regions), .num_irqchips = ARRAY_SIZE(config.irqchips), .pio_bitmap_size = ARRAY_SIZE(config.pio_bitmap), .num_pci_devices = ARRAY_SIZE(config.pci_devices), .num_pci_caps = ARRAY_SIZE(config.pci_caps), }, }, .cpus = { % for n in range(int(cpucount / 64)): 0xffffffffffffffff, % endfor % if (cpucount % 64): ${'0x%016x,' % ((1 << (cpucount % 64)) - 1)} % endif }, .mem_regions = { % for r in regions: /* ${str(r)} */ % for c in r.comments: /* ${c} */ % endfor { .phys_start = ${hex(r.start).strip('L')}, .virt_start = ${hex(r.start).strip('L')}, .size = ${hex(r.size()).strip('L')}, .flags = ${r.flagstr('\t\t')}, }, % endfor }, .irqchips = { % for i in irqchips: /* ${str(i)} */ { .address = ${hex(i.address)}, .id = ${hex(i.irqchip_id())}, .pin_bitmap = 0xffffff, }, % endfor }, .pio_bitmap = { [ 0/8 ... 0x3f/8] = -1, [ 0x40/8 ... 0x47/8] = 0xf0, /* PIT */ [ 0x48/8 ... 0x5f/8] = -1, [ 0x60/8 ... 0x67/8] = 0xec, /* HACK: NMI status/control */ [ 0x68/8 ... 0x6f/8] = -1, [ 0x70/8 ... 0x77/8] = 0xfc, /* RTC */ [ 0x78/8 ... 0x3af/8] = -1, [ 0x3b0/8 ... 0x3df/8] = 0x00, /* VGA */ [ 0x3e0/8 ... 0xcff/8] = -1, [ 0xd00/8 ... 0xffff/8] = 0, /* HACK: PCI bus */ }, .pci_devices = { % for d in pcidevices: /* ${str(d)} */ { .type = ${d.type}, % if d.iommu is not None: .iommu = ${d.iommu}, % endif .domain = ${hex(d.domain)}, .bdf = ${hex(d.bdf())}, .caps_start = ${d.caps_start}, .num_caps = ${d.num_caps}, .num_msi_vectors = ${d.num_msi_vectors}, .msi_64bits = ${d.msi_64bits}, .num_msix_vectors = ${d.num_msix_vectors}, .msix_region_size = ${hex(d.msix_region_size)}, .msix_address = ${hex(d.msix_address).strip('L')}, }, % endfor }, .pci_caps = { % for c in pcicaps: % for comment in c.comments: /* ${comment} */ % endfor { .id = ${hex(c.id)}, .start = ${hex(c.start)}, .len = ${c.len}, .flags = ${c.flags}, }, % endfor }, };