[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen stable-4.17] iommu/amd-vi: fix checking for Invalidate All support in amd_iommu_resume()



commit d5d76fe0ab00646a917c3007529fd4691795abf2
Author:     Roger Pau Monné <roger.pau@xxxxxxxxxx>
AuthorDate: Mon Jul 17 08:28:49 2023 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Mon Jul 17 08:28:49 2023 +0200

    iommu/amd-vi: fix checking for Invalidate All support in amd_iommu_resume()
    
    The iommu local variable does not point to to a valid amd_iommu element
    after the call to for_each_amd_iommu().  Instead check whether any IOMMU
    on the system doesn't support Invalidate All in order to perform the
    per-domain and per-device flushes.
    
    Fixes: 9c46139de889 ('amd iommu: Support INVALIDATE_IOMMU_ALL command.')
    Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
    master commit: 5ecbb779748a56495f2c892f0610d57dd623c7cd
    master date: 2023-06-13 14:41:32 +0200
---
 xen/drivers/passthrough/amd/iommu_init.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/xen/drivers/passthrough/amd/iommu_init.c 
b/xen/drivers/passthrough/amd/iommu_init.c
index 1f14aaf49e..166570648d 100644
--- a/xen/drivers/passthrough/amd/iommu_init.c
+++ b/xen/drivers/passthrough/amd/iommu_init.c
@@ -1578,6 +1578,7 @@ void cf_check amd_iommu_crash_shutdown(void)
 void cf_check amd_iommu_resume(void)
 {
     struct amd_iommu *iommu;
+    bool invalidate_all = true;
 
     for_each_amd_iommu ( iommu )
     {
@@ -1587,10 +1588,12 @@ void cf_check amd_iommu_resume(void)
         */
         disable_iommu(iommu);
         enable_iommu(iommu);
+        if ( !iommu->features.flds.ia_sup )
+            invalidate_all = false;
     }
 
     /* flush all cache entries after iommu re-enabled */
-    if ( !iommu->features.flds.ia_sup )
+    if ( !invalidate_all )
     {
         invalidate_all_devices();
         invalidate_all_domain_pages();
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.