Will be required for both IOMMU variants.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
#
BUILT_IN_OBJECTS := built-in-amd.o built-in-intel.o
-COMMON_OBJECTS := apic.o dbg-write.o entry.o setup.o control.o mmio.o \
+COMMON_OBJECTS := apic.o dbg-write.o entry.o setup.o control.o mmio.o iommu.o \
paging.o ../../pci.o pci.o ioapic.o i8042.o vcpu.o \
../../pci_ivshmem.o
#include <asm/cell.h>
#include <asm/percpu.h>
+unsigned int iommu_count_units(void);
+
int iommu_init(void);
int iommu_cell_init(struct cell *cell);
--- /dev/null
+/*
+ * Jailhouse, a Linux-based partitioning hypervisor
+ *
+ * Copyright (c) Siemens AG, 2014, 2015
+ *
+ * Authors:
+ * Jan Kiszka <jan.kiszka@siemens.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2. See
+ * the COPYING file in the top-level directory.
+ */
+
+#include <jailhouse/control.h>
+#include <asm/iommu.h>
+
+unsigned int iommu_count_units(void)
+{
+ unsigned int units = 0;
+
+ while (units < JAILHOUSE_MAX_IOMMU_UNITS &&
+ system_config->platform_info.x86.iommu_base[units])
+ units++;
+ return units;
+}
int iommu_init(void)
{
unsigned long version, caps, ecaps, ctrls, sllps_caps = ~0UL;
- unsigned int pt_levels, num_did, n;
- unsigned int units = 0;
+ unsigned int units, pt_levels, num_did, n;
void *reg_base;
u64 base_addr;
int err;
int_remap_table_size_log2 = n;
- while (units < JAILHOUSE_MAX_IOMMU_UNITS &&
- system_config->platform_info.x86.iommu_base[units])
- units++;
+ units = iommu_count_units();
if (units == 0)
return trace_error(-EINVAL);