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>
This commit is contained in:
Paul Durrant authored and Jan Beulich committed 2019-09-27 14:07:42 +02:00
1 parent 0aeacaa0c9
commit eb8ce7d5ca
2 files changed
+6 -3

No files matched your search

+3 -3
View File
@@ -154,13 +154,13 @@ custom_param("dom0-iommu", parse_dom0_iommu_param);
static void __hwdom_init check_hwdom_reqs(struct domain *d)
{
if ( iommu_hwdom_none || !paging_mode_translate(d) )
if ( iommu_hwdom_none || !hap_enabled(d) )
return;
arch_iommu_check_autotranslated_hwdom(d);
iommu_hwdom_passthrough = false;
iommu_hwdom_strict = true;
arch_iommu_check_autotranslated_hwdom(d);
}
int iommu_domain_init(struct domain *d, unsigned int opts)
+3
View File
@@ -85,6 +85,9 @@ void __hwdom_init arch_iommu_check_autotranslated_hwdom(struct domain *d)
{
if ( !is_iommu_enabled(d) )
panic("Presently, iommu must be enabled for PVH hardware domain\n");
if ( !iommu_hwdom_strict )
panic("PVH hardware domain iommu must be set in 'strict' mode\n");
}
int arch_iommu_domain_init(struct domain *d)
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.