[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen master] x86/shadow: make iommu_snoop usage consistent with HAP's
commit c609108b2190d1ef43582c2b17b1b2e0beae0fb0 Author: Jan Beulich <jbeulich@xxxxxxxx> AuthorDate: Mon Feb 13 16:26:03 2023 +0100 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Mon Feb 13 16:26:03 2023 +0100 x86/shadow: make iommu_snoop usage consistent with HAP's First of all the variable is meaningful only when an IOMMU is in use for a guest. Qualify the check accordingly, like done elsewhere. Furthermore the controlling command line option is supposed to take effect on VT-d only. Since command line parsing happens before we know whether we're going to use VT-d, force the variable back to set when instead running with AMD IOMMU(s). Since it may end up misleading, also remove the clearing of the flag in iommu_setup() and vtd_setup()'s error path. The variable simply is meaningless with IOMMU(s) disabled, so there's no point touching it there. Finally also correct a relevant nearby comment. Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> Reviewed-by: Xenia Ragiadakou <burzalodowa@xxxxxxxxx> Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx> --- xen/arch/x86/mm/shadow/multi.c | 6 +++--- xen/drivers/passthrough/iommu.c | 3 --- xen/drivers/passthrough/vtd/iommu.c | 3 --- xen/drivers/passthrough/x86/iommu.c | 11 +++++++++++ 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/xen/arch/x86/mm/shadow/multi.c b/xen/arch/x86/mm/shadow/multi.c index cded39ef09..5f3e175bbe 100644 --- a/xen/arch/x86/mm/shadow/multi.c +++ b/xen/arch/x86/mm/shadow/multi.c @@ -556,8 +556,8 @@ _sh_propagate(struct vcpu *v, ASSERT(!(sflags & PAGE_CACHE_ATTRS)); - /* compute the PAT index for shadow page entry when VT-d is enabled - * and device assigned. + /* + * Compute the PAT index for shadow page entry when IOMMU is enabled. * 1) direct MMIO: compute the PAT index with gMTRR=UC and gPAT. * 2) if enables snoop control, compute the PAT index as WB. * 3) if disables snoop control, compute the PAT index with @@ -577,7 +577,7 @@ _sh_propagate(struct vcpu *v, gfn_to_paddr(target_gfn), mfn_to_maddr(target_mfn), X86_MT_UC); - else if ( iommu_snoop ) + else if ( is_iommu_enabled(d) && iommu_snoop ) sflags |= pat_type_2_pte_flags(X86_MT_WB); else sflags |= get_pat_flags(v, diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c index b4dfa95dfd..921b71e819 100644 --- a/xen/drivers/passthrough/iommu.c +++ b/xen/drivers/passthrough/iommu.c @@ -587,9 +587,6 @@ int __init iommu_setup(void) printk("I/O virtualisation %sabled\n", iommu_enabled ? "en" : "dis"); if ( !iommu_enabled ) { -#ifndef iommu_snoop - iommu_snoop = false; -#endif iommu_hwdom_passthrough = false; iommu_hwdom_strict = false; } diff --git a/xen/drivers/passthrough/vtd/iommu.c b/xen/drivers/passthrough/vtd/iommu.c index 62e143125d..a9f4f28ad6 100644 --- a/xen/drivers/passthrough/vtd/iommu.c +++ b/xen/drivers/passthrough/vtd/iommu.c @@ -2746,9 +2746,6 @@ static int __init cf_check vtd_setup(void) error: iommu_enabled = 0; -#ifndef iommu_snoop - iommu_snoop = false; -#endif iommu_hwdom_passthrough = false; iommu_qinval = 0; iommu_intremap = iommu_intremap_off; diff --git a/xen/drivers/passthrough/x86/iommu.c b/xen/drivers/passthrough/x86/iommu.c index f671b0f2bb..5a8b28a4ca 100644 --- a/xen/drivers/passthrough/x86/iommu.c +++ b/xen/drivers/passthrough/x86/iommu.c @@ -56,6 +56,17 @@ void __init acpi_iommu_init(void) if ( !acpi_disabled ) { ret = acpi_dmar_init(); + +#ifndef iommu_snoop + /* + * As long as there's no per-domain snoop control, and as long as on + * AMD we uniformly force coherent accesses, a possible command line + * override should affect VT-d only. + */ + if ( ret ) + iommu_snoop = true; +#endif + if ( ret == -ENODEV ) ret = acpi_ivrs_init(); } -- generated by git-patchbot for /home/xen/git/xen.git#master
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |