x86/iommu: fix PVH dom0 settings
authorPaul Durrant <paul.durrant@citrix.com>
Fri, 27 Sep 2019 12:07:42 +0000 (14:07 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 27 Sep 2019 12:07:42 +0000 (14:07 +0200)
commiteb8ce7d5ca38565953faebb728179eebb00012bf
tree286aa65482f0def1b02e5fc77591d41f3167ddf8
parent0aeacaa0c95beddbc054ef5a70845e3e4cf4f385
x86/iommu: fix PVH dom0 settings

PVH dom0 must operate with the iommu settings in 'strict' mode i.e. only the
domain's own pages will be mapped in the IOMMU. The check_hwdom_reqs() is
supposed to ensure this. Unfortunately the test for a PVH dom0 is made
using paging_mode_translate() and, when commit f89f5558 "remove late
(on-demand) construction of IOMMU page tables" moved the call of
check_hwdom_reqs() from iommu_hwdom_init() to iommu_domain_init(), that
test became ineffective (because iommu_domain_init() is called before
paging_enable()).

This patch replaces the test of paging_mode_translate() with a test of
hap_enabled(), and also verifies 'strict' mode is turned on in
arch_iommu_check_autotranslated_hwdom().

Reported-by: Roger Pau Monne <roger.pau@citrix.com>
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Release-acked-by: Juergen Gross <jgross@suse.com>
xen/drivers/passthrough/iommu.c
xen/drivers/passthrough/x86/iommu.c