[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xen-cvs
Subject:    [Xen-changelog] [xen staging] AMD/IOMMU: correct handling when XT's prereq features are unavailable
From:       patchbot () xen ! org
Date:       2020-02-28 15:33:14
Message-ID: E1j7hda-0003zO-J9 () xenbits ! xenproject ! org
[Download RAW message or body]

commit 9649cef3b3a7eaca1347154ea7f274586d48bc29
Author:     Jan Beulich <jbeulich@suse.com>
AuthorDate: Fri Feb 28 16:25:43 2020 +0100
Commit:     Jan Beulich <jbeulich@suse.com>
CommitDate: Fri Feb 28 16:25:43 2020 +0100

    AMD/IOMMU: correct handling when XT's prereq features are unavailable
    
    We should neither cause IOMMU initialization as a whole to fail in this
    case (we should still be able to bring up the system in non-x2APIC or
    x2APIC physical mode), nor should the remainder of the function be
    skipped (as the main part of it won't get entered a 2nd time) in such an
    event. It is merely necessary for the function to indicate to the caller
    (iov_supports_xt()) that setup failed as far as x2APIC is concerned.
    
    Signed-off-by: Jan Beulich <jbeulich@suse.com>
    Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
    Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
---
 xen/drivers/passthrough/amd/iommu_init.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/xen/drivers/passthrough/amd/iommu_init.c b/xen/drivers/passthrough/amd/iommu_init.c
index d9a4b0f802..147ce8ca87 100644
--- a/xen/drivers/passthrough/amd/iommu_init.c
+++ b/xen/drivers/passthrough/amd/iommu_init.c
@@ -1364,6 +1364,7 @@ static int __init amd_iommu_prepare_one(struct amd_iommu *iommu)
 int __init amd_iommu_prepare(bool xt)
 {
     struct amd_iommu *iommu;
+    bool has_xt = true;
     int rc = -ENODEV;
 
     BUG_ON( !iommu_found() );
@@ -1400,17 +1401,16 @@ int __init amd_iommu_prepare(bool xt)
         if ( rc )
             goto error_out;
 
-        rc = -ENODEV;
-        if ( xt && (!iommu->features.flds.ga_sup || !iommu->features.flds.xt_sup) )
-            goto error_out;
+        if ( !iommu->features.flds.ga_sup || !iommu->features.flds.xt_sup )
+            has_xt = false;
     }
 
     for_each_amd_iommu ( iommu )
     {
         /* NB: There's no need to actually write these out right here. */
-        iommu->ctrl.ga_en |= xt;
-        iommu->ctrl.xt_en = xt;
-        iommu->ctrl.int_cap_xt_en = xt;
+        iommu->ctrl.ga_en |= xt && has_xt;
+        iommu->ctrl.xt_en = xt && has_xt;
+        iommu->ctrl.int_cap_xt_en = xt && has_xt;
     }
 
     rc = amd_iommu_update_ivrs_mapping_acpi();
@@ -1422,7 +1422,7 @@ int __init amd_iommu_prepare(bool xt)
         ivhd_type = 0;
     }
 
-    return rc;
+    return rc ?: xt && !has_xt ? -ENODEV : 0;
 }
 
 int __init amd_iommu_init(bool xt)
--
generated by git-patchbot for /home/xen/git/xen.git#staging


[Attachment #3 (text/plain)]

_______________________________________________
Xen-changelog mailing list
Xen-changelog@lists.xenproject.org
https://lists.xenproject.org/xen-changelog

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic