VT-d PI: disable VT-d PI when CPU-side PI isn't enabled
PATCH v4 1/1 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.
---
v4:
- Remove APICv stuff
- Remove a useless check of "acknowledge interrupt on exit"
v3:
- check relevant bit directly other than checking the apicv option
- add sample of 'xl dmesg'
v2:
- add missing S-o-b
- comments changes
- change bool_t to bool and move 'opt_apicv_enabled' declaration to vmcs.h
--- xen/arch/x86/hvm/vmx/vmcs.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
xen/arch/x86/hvm/vmx/vmcs.c +12 -4
@@ -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 )
Signature · 7 lines
1.8.3.1 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Quoted 40 lines
Quoted 1 line
Quoted 1 line · On 13.06.17 at 10:20, <[email protected]> wrote:
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_intpostonce 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 <[email protected]>---
v4:
- Remove APICv stuff
- Remove a useless check of "acknowledge interrupt on exit"v3:
- check relevant bit directly other than checking the apicv option
- add sample of 'xl dmesg'v2:
- add missing S-o-b
- comments changes
- changebool_tto bool and move 'opt_apicv_enabled' declaration tovmcs.h--- xen/arch/x86/hvm/vmx/vmcs.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)xen/arch/x86/hvm/vmx/vmcs.c +1
-1@@ -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
xen/arch/x86/hvm/vmx/vmcs.c static int vmx_init_vmcs_config(void) · line 355
Quoted 10 lines
xen/arch/x86/hvm/vmx/vmcs.c +6
-3+* 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 ) )
With the placement of the && here corrected (belongs on the earlier line), which can be done while committing of no other need for v5 arises,
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 7 lines
Quoted 7 lines
Quoted 2 lines · On 13.06.17 at 10:29, <[email protected]> wrote:
Quoted 1 line · On 13.06.17 at 10:20, <[email protected]> wrote:
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.
Quoted 6 lines
Quoted 6 lines
This patch clears
iommu_intpostonce 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 <[email protected]>
Kevin, Jun?
Quoted 42 lines
Quoted 28 lines
---
v4:
- Remove APICv stuff
- Remove a useless check of "acknowledge interrupt on exit"v3:
- check relevant bit directly other than checking the apicv option
- add sample of 'xl dmesg'v2:
- add missing S-o-b
- comments changes
- changebool_tto bool and move 'opt_apicv_enabled' declaration tovmcs.h--- xen/arch/x86/hvm/vmx/vmcs.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)xen/arch/x86/hvm/vmx/vmcs.c +1
-1@@ -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 xen/arch/x86/hvm/vmx/vmcs.c static int vmx_init_vmcs_config(void) · line 355
Quoted 10 lines
xen/arch/x86/hvm/vmx/vmcs.c +6
-3+* 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 ) )With the placement of the && here corrected (belongs on the earlier line), which can be done while committing of no other need for v5 arises,
Quoted 3 lines
Reviewed-by Jan Beulich <[email protected]>Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Tian, Kevin
Acked-byQuoted 12 lines
From: Jan Beulich [mailto:[email protected]]
Sent: Thursday, August 3, 2017 5:44 PMQuoted 8 lines
Quoted 8 lines
Quoted 2 lines · On 13.06.17 at 10:29, <[email protected]> wrote:
Quoted 1 line · On 13.06.17 at 10:20, <[email protected]> wrote:
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_intpostonce finding CPU-side PI won't beenabled.
Quoted 9 lines
Quoted 2 lines
Quoted 2 lines
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
Quoted 3 lines
Quoted 3 lines
exit", which is a minimal requirement which has been checked earlier.
Signed-off-by Chao Gao <[email protected]>Kevin, Jun?
thanks for remind.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel