iommu: avoid triggering ASSERT_UNREACHABLE() on ARM...
authorPaul Durrant <paul.durrant@citrix.com>
Thu, 26 Sep 2019 10:03:08 +0000 (11:03 +0100)
committerJulien Grall <julien.grall@arm.com>
Thu, 26 Sep 2019 13:30:32 +0000 (14:30 +0100)
commit52633db2c5ed2df352004f97e2272edc90af3cb4
tree3064bd69cd73dc9c3758649c8194d836c124cc9b
parent8f7824289910db2fc3260c2c02f3dda27ae11ec9
iommu: avoid triggering ASSERT_UNREACHABLE() on ARM...

...when the IOMMU is not enabled.

80ff3d338dc9 "iommu: tidy up iommu_use_hap_pt() and need_iommu_pt_sync()
macros" introduced CONFIG_IOMMU_FORCE_PT_SHARE, which causes the global
'iommu_hap_pt_share' option to be replaced with a #define-d value of true.
In this configuration, calling clear_iommu_hap_pt_share() will result
trigger the aforementioned ASSERT.

CONFIG_IOMMU_FORCE_PT_SHARE is always selected for ARM builds and,
because clear_iommu_hap_pt_share() is called by the common iommu_setup()
function if the IOMMU is not enabled, it is no longer safe to disable the
IOMMU on ARM systems.

However, running with the IOMMU disabled is a valid configuration for ARM
systems, so this patch rectifies the problem by removing the call to
clear_iommu_hap_pt_share() from common code. As a side effect of this,
however, it becomes possible on x86 systems for iommu_enabled to be false
but iommu_hap_pt_share to be true. Thus the code in sysctl.c
needs to be changed to make sure that XEN_SYSCTL_PHYSCAP_iommu_hap_pt_share
is not erroneously advertised when the IOMMU has been disabled.

Reported-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Acked-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/common/sysctl.c
xen/drivers/passthrough/iommu.c