[xen stable-4.9] VT-d PI: disable VT-d PI when CPU-side PI isn't enabled

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[xen stable-4.9] VT-d PI: disable VT-d PI when CPU-side PI isn't enabled

patchbot
commit 6fd84b3e2b11e9148b9c636bb7c90ca6efbf87da
Author:     Chao Gao <[hidden email]>
AuthorDate: Mon Aug 28 11:38:25 2017 +0200
Commit:     Jan Beulich <[hidden email]>
CommitDate: Mon Aug 28 11:38:25 2017 +0200

    VT-d PI: disable VT-d PI when CPU-side PI isn't enabled
   
    From the context calling pi_desc_init(), we can conclude the current
    implementation of VT-d PI depends on CPU-side PI. If we enable VT-d PI
    and disable CPU-side PI by disabling APICv explicitly in xen boot
    command line, we would get an assertion failure.
   
    This patch clears iommu_intpost once finding CPU-side PI won't be enabled.
    It is safe for this is done before this flag starts taking effect. Also
    take this chance to remove the useless check of "acknowledge interrupt on
    exit", which is a minimal requirement which has been checked earlier.
   
    Signed-off-by: Chao Gao <[hidden email]>
    Reviewed-by: Jan Beulich <[hidden email]>
    Acked-by: Kevin Tian <[hidden email]>
    master commit: e489eb6138e7efe4214a7e9ba0d21f54fc5b7d35
    master date: 2017-08-10 12:32:16 +0200
---
 xen/arch/x86/hvm/vmx/vmcs.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/hvm/vmx/vmcs.c b/xen/arch/x86/hvm/vmx/vmcs.c
index 8103b20..2648f78 100644
--- a/xen/arch/x86/hvm/vmx/vmcs.c
+++ b/xen/arch/x86/hvm/vmx/vmcs.c
@@ -345,11 +345,19 @@ static int vmx_init_vmcs_config(void)
 
     /*
      * "Process posted interrupt" can be set only when "virtual-interrupt
-     * delivery" and "acknowledge interrupt on exit" is set
+     * delivery" and "acknowledge interrupt on exit" is set. For the latter
+     * is a minimal requirement, only check the former, which is optional.
      */
-    if ( !(_vmx_secondary_exec_control & SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY)
-          || !(_vmx_vmexit_control & VM_EXIT_ACK_INTR_ON_EXIT) )
-        _vmx_pin_based_exec_control  &= ~ PIN_BASED_POSTED_INTERRUPT;
+    if ( !(_vmx_secondary_exec_control & SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY) )
+        _vmx_pin_based_exec_control &= ~PIN_BASED_POSTED_INTERRUPT;
+
+    if ( iommu_intpost &&
+         !(_vmx_pin_based_exec_control & PIN_BASED_POSTED_INTERRUPT) )
+    {
+        printk("Intel VT-d Posted Interrupt is disabled for CPU-side Posted "
+               "Interrupt is not enabled\n");
+        iommu_intpost = 0;
+    }
 
     /* The IA32_VMX_VMFUNC MSR exists only when VMFUNC is available */
     if ( _vmx_secondary_exec_control & SECONDARY_EXEC_ENABLE_VM_FUNCTIONS )
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.9

_______________________________________________
Xen-changelog mailing list
[hidden email]
https://lists.xenproject.org/xen-changelog