@@ -14,9 +14,7 @@ config ARM
select FUNCTION_ALIGNMENT_4B
select HAS_ALTERNATIVE if HAS_VMAP
select HAS_DEVICE_TREE
- select HAS_PASSTHROUGH
select HAS_UBSAN
- select IOMMU_FORCE_PT_SHARE if MMU
config ARCH_DEFCONFIG
string
@@ -77,8 +75,10 @@ choice
config MMU
bool "MMU"
select HAS_PAGING_MEMPOOL
+ select HAS_PASSTHROUGH
select HAS_PMAP
select HAS_VMAP
+ select IOMMU_FORCE_PT_SHARE
help
Select it if you plan to run Xen on A-profile Armv7+
@@ -279,6 +279,7 @@ int handle_device(struct domain *d, struct dt_device_node *dev, p2m_type_t p2mt,
dt_dprintk("%s passthrough = %d naddr = %u\n",
dt_node_full_name(dev), own_device, naddr);
+#ifdef CONFIG_HAS_PASSTHROUGH
if ( own_device )
{
dt_dprintk("Check if %s is behind the IOMMU and add it\n",
@@ -304,6 +305,7 @@ int handle_device(struct domain *d, struct dt_device_node *dev, p2m_type_t p2mt,
}
}
}
+#endif
res = map_device_irqs_to_domain(d, dev, own_device, irq_ranges);
if ( res < 0 )
@@ -368,15 +368,21 @@ static int __init handle_passthrough_prop(struct kernel_info *kinfo,
if ( res < 0 )
return res;
+#ifdef CONFIG_HAS_PASSTHROUGH
res = iommu_add_dt_device(node);
if ( res < 0 )
return res;
+#endif
/* If xen_force, we allow assignment of devices without IOMMU protection. */
if ( xen_force && !dt_device_is_protected(node) )
return 0;
+#ifdef CONFIG_HAS_PASSTHROUGH
return iommu_assign_dt_device(kinfo->d, node);
+#else
+ return res;
+#endif
}
static int __init handle_prop_pfdt(struct kernel_info *kinfo,
@@ -710,9 +710,11 @@ int arch_domain_create(struct domain *d,
ioreq_domain_init(d);
#endif
+#ifdef CONFIG_HAS_PASSTHROUGH
/* p2m_init relies on some value initialized by the IOMMU subsystem */
if ( (rc = iommu_domain_init(d, config->iommu_opts)) != 0 )
goto fail;
+#endif
if ( (rc = p2m_init(d)) != 0 )
goto fail;
@@ -841,7 +843,9 @@ void arch_domain_destroy(struct domain *d)
/* IOMMU page table is shared with P2M, always call
* iommu_domain_destroy() before p2m_final_teardown().
*/
+#ifdef CONFIG_HAS_PASSTHROUGH
iommu_domain_destroy(d);
+#endif
p2m_final_teardown(d);
domain_vgic_free(d);
domain_vuart_free(d);
@@ -1059,9 +1063,11 @@ int domain_relinquish_resources(struct domain *d)
switch ( d->arch.rel_priv )
{
case 0:
+#ifdef CONFIG_HAS_PASSTHROUGH
ret = iommu_release_dt_devices(d);
if ( ret )
return ret;
+#endif
/*
* Release the resources allocated for vpl011 which were
@@ -2137,7 +2137,9 @@ static int __init construct_dom0(struct domain *d)
dom0_mem = MB(512);
}
+#ifdef CONFIG_HAS_PASSTHROUGH
iommu_hwdom_init(d);
+#endif
d->max_pages = dom0_mem >> PAGE_SHIFT;
@@ -434,6 +434,7 @@ void p2m_set_way_flush(struct vcpu *v, struct cpu_user_regs *regs,
/* This function can only work with the current vCPU. */
ASSERT(v == current);
+#ifdef CONFIG_HAS_PASSTHROUGH
if ( iommu_use_hap_pt(current->domain) )
{
gprintk(XENLOG_ERR,
@@ -441,6 +442,7 @@ void p2m_set_way_flush(struct vcpu *v, struct cpu_user_regs *regs,
inject_undef_exception(regs, hsr);
return;
}
+#endif
if ( !(v->arch.hcr_el2 & HCR_TVM) )
{
@@ -419,6 +419,7 @@ void asmlinkage __init start_xen(unsigned long fdt_paddr)
/* This should be done in a vpmu driver but we do not have one yet. */
vpmu_is_available = cpu_has_pmu;
+#ifdef CONFIG_HAS_PASSTHROUGH
/*
* The IOMMU subsystem must be initialized before P2M as we need
* to gather requirements regarding the maximum IPA bits supported by
@@ -427,6 +428,7 @@ void asmlinkage __init start_xen(unsigned long fdt_paddr)
rc = iommu_setup();
if ( !iommu_enabled && rc != -ENODEV )
panic("Couldn't configure correctly all the IOMMUs.\n");
+#endif
setup_virt_paging();
As CONFIG_HAS_PASSTHROUGH is enabled only for MMU, thus any common code accessing iommu needs to be enclosed within CONFIG_HAS_PASSTHROUGH. Signed-off-by: Ayan Kumar Halder <ayan.kumar.halder@amd.com> --- xen/arch/arm/Kconfig | 4 ++-- xen/arch/arm/device.c | 2 ++ xen/arch/arm/dom0less-build.c | 6 ++++++ xen/arch/arm/domain.c | 6 ++++++ xen/arch/arm/domain_build.c | 2 ++ xen/arch/arm/p2m.c | 2 ++ xen/arch/arm/setup.c | 2 ++ 7 files changed, 22 insertions(+), 2 deletions(-)