/*
* Jailhouse, a Linux-based partitioning hypervisor
*
- * Copyright (c) Siemens AG, 2014
+ * Copyright (c) Siemens AG, 2014-2016
*
* This work is licensed under the terms of the GNU GPL, version 2. See
* the COPYING file in the top-level directory.
*
+ * Alternatively, you can use or redistribute this file under the following
+ * BSD license:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ *
* Configuration for ${product[0]} ${product[1]}
* created with '${argstr}'
*
#include <linux/types.h>
#include <jailhouse/cell-config.h>
-#define ARRAY_SIZE(a) sizeof(a) / sizeof(a[0])
+#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[1];
+ 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 = {
+ .signature = JAILHOUSE_SYSTEM_SIGNATURE,
.hypervisor_memory = {
.phys_start = ${hex(hvmem[0])},
.size = ${hex(hvmem[1])},
},
+ .debug_console = {
+ .phys_start = 0x3f8,
+ },
.platform_info.x86 = {
.mmconfig_base = ${hex(mmconfig.base)},
.mmconfig_end_bus = ${hex(mmconfig.end_bus)},
.pm_timer_address = ${hex(pm_timer_base)},
- % if dmar_units:
- .dmar_unit_base = {
- % for d in dmar_units:
- ${hex(d)},
+ % if iommu_units:
+ .iommu_units = {
+ % for unit in iommu_units:
+ {
+ .base = ${hex(unit.base_addr)},
+ .size = ${hex(unit.mmio_size)},
+ % if unit.is_amd_iommu:
+ .amd_bdf = ${hex(unit.amd_bdf)},
+ .amd_base_cap = ${hex(unit.amd_base_cap)},
+ .amd_msi_cap = ${hex(unit.amd_msi_cap)},
+ .amd_features = ${hex(unit.amd_features)},
+ % endif
+ },
% endfor
},
% endif
},
+ .interrupt_limit = 256,
.root_cell = {
.name = "RootCell",
.cpu_set_size = sizeof(config.cpus),
/* ${c} */
% endfor
{
- .phys_start = ${hex(r.start)},
- .virt_start = ${hex(r.start)},
- .size = ${hex(r.size())},
+ .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 = {
- /* IOAPIC */ {
- .address = 0xfec00000,
- .id = ${hex(ioapic_id)},
+ % 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] = 0, /* HACK: 8042, NMI status/control */
+ [ 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,
+ [ 0x78/8 ... 0x7f/8] = -1,
+ [ 0x80/8 ... 0x87/8] = 0xfe, /* Linux: native_io_delay() */
+ [ 0x88/8 ... 0x3af/8] = -1,
[ 0x3b0/8 ... 0x3df/8] = 0x00, /* VGA */
[ 0x3e0/8 ... 0xcff/8] = -1,
[ 0xd00/8 ... 0xffff/8] = 0, /* HACK: PCI bus */
/* ${str(d)} */
{
.type = ${d.type},
+ % if d.iommu is not None:
+ .iommu = ${d.iommu},
+ % endif
.domain = ${hex(d.domain)},
.bdf = ${hex(d.bdf())},
+ .bar_mask = {
+ ${'0x%08x' % d.bars.mask[0]}, ${'0x%08x' % d.bars.mask[1]}, ${'0x%08x' % d.bars.mask[2]},
+ ${'0x%08x' % d.bars.mask[3]}, ${'0x%08x' % d.bars.mask[4]}, ${'0x%08x' % d.bars.mask[5]},
+ },
.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
},
/* ${comment} */
% endfor
{
+ % if (c.id & 0x8000) != 0:
+ .id = ${hex(c.id & 0x7fff)} | JAILHOUSE_PCI_EXT_CAP,
+ % else:
.id = ${hex(c.id)},
+ % endif
.start = ${hex(c.start)},
.len = ${c.len},
.flags = ${c.flags},