Skip to contentSkip to conversation

KVM: VMX: Remove the secondary execute control depends on irqchip

PATCH Applied Sheng Yang 2 participants 2 messages Nov 21, 2007 – Nov 22, 2007 1 message not in the archive KVM

lore
Share & tools
lore

Sheng Yang

author
#0 lore raw

PATCH 1/1 KVM: VMX: Remove the secondary execute control depends on irqchip

From 140114fbd60afaf08fde429d05c280d88205051b Mon Sep 17 00:00:00 2001
From: Sheng Yang <[email protected]>
Date: Wed, 21 Nov 2007 14:33:25 +0800
Subject: [PATCH] KVM: VMX: Remove the secondary execute control depends on irqchip

The state of SECONDARY_VM_EXEC_CONTROL shouldn't depend on in-kernel IRQ chip, this patch fix this.

---
 drivers/kvm/vmx.c |   17 +++++++----------
 1 files changed, 7 insertions(+), 10 deletions(-)
drivers/kvm/vmx.c +7 -10
index 4ad60c9..aad31ec 100644
@@ -186,11 +186,6 @@ static inline int cpu_has_secondary_exec_ctrls(void)
 		CPU_BASED_ACTIVATE_SECONDARY_CONTROLS);
 }
 
-static inline int vm_need_secondary_exec_ctrls(struct kvm *kvm)
-{
-	return ((cpu_has_secondary_exec_ctrls()) && (irqchip_in_kernel(kvm)));
-}
-
 static inline int cpu_has_vmx_virtualize_apic_accesses(void)
 {
 	return (vmcs_config.cpu_based_2nd_exec_ctrl &
@@ -1516,13 +1511,15 @@ static int vmx_vcpu_setup(struct vcpu_vmx *vmx)
 				CPU_BASED_CR8_LOAD_EXITING;
 #endif
 	}
-	if (!vm_need_secondary_exec_ctrls(vmx->vcpu.kvm))
-		exec_control &= ~CPU_BASED_ACTIVATE_SECONDARY_CONTROLS;
 	vmcs_write32(CPU_BASED_VM_EXEC_CONTROL, exec_control);
 
-	if (vm_need_secondary_exec_ctrls(vmx->vcpu.kvm))
-		vmcs_write32(SECONDARY_VM_EXEC_CONTROL,
-			     vmcs_config.cpu_based_2nd_exec_ctrl);
+	if (cpu_has_secondary_exec_ctrls()) {
+		exec_control = vmcs_config.cpu_based_2nd_exec_ctrl;
+		if (!vm_need_virtualize_apic_accesses(vmx->vcpu.kvm))
+			exec_control &=
+				~SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES;
+		vmcs_write32(SECONDARY_VM_EXEC_CONTROL, exec_control);
+	}
 
 	vmcs_write32(PAGE_FAULT_ERROR_CODE_MASK, !!bypass_guest_pf);
 	vmcs_write32(PAGE_FAULT_ERROR_CODE_MATCH, !!bypass_guest_pf);
Signature · 1 line
1.5.3.4

From 140114fbd60afaf08fde429d05c280d88205051b Mon Sep 17 00:00:00 2001
From: Sheng Yang <[email protected]>
Date: Wed, 21 Nov 2007 14:33:25 +0800
Subject: [PATCH] KVM: VMX: Remove the secondary execute control depends on irqchip

The state of SECONDARY_VM_EXEC_CONTROL shouldn't depend on in-kernel IRQ chip, this patch fix this.

---
 drivers/kvm/vmx.c |   17 +++++++----------
 1 files changed, 7 insertions(+), 10 deletions(-)
drivers/kvm/vmx.c +7 -10
index 4ad60c9..aad31ec 100644
@@ -186,11 +186,6 @@ static inline int cpu_has_secondary_exec_ctrls(void)
 		CPU_BASED_ACTIVATE_SECONDARY_CONTROLS);
 }
 
-static inline int vm_need_secondary_exec_ctrls(struct kvm *kvm)
-{
-	return ((cpu_has_secondary_exec_ctrls()) && (irqchip_in_kernel(kvm)));
-}
-
 static inline int cpu_has_vmx_virtualize_apic_accesses(void)
 {
 	return (vmcs_config.cpu_based_2nd_exec_ctrl &
@@ -1516,13 +1511,15 @@ static int vmx_vcpu_setup(struct vcpu_vmx *vmx)
 				CPU_BASED_CR8_LOAD_EXITING;
 #endif
 	}
-	if (!vm_need_secondary_exec_ctrls(vmx->vcpu.kvm))
-		exec_control &= ~CPU_BASED_ACTIVATE_SECONDARY_CONTROLS;
 	vmcs_write32(CPU_BASED_VM_EXEC_CONTROL, exec_control);
 
-	if (vm_need_secondary_exec_ctrls(vmx->vcpu.kvm))
-		vmcs_write32(SECONDARY_VM_EXEC_CONTROL,
-			     vmcs_config.cpu_based_2nd_exec_ctrl);
+	if (cpu_has_secondary_exec_ctrls()) {
+		exec_control = vmcs_config.cpu_based_2nd_exec_ctrl;
+		if (!vm_need_virtualize_apic_accesses(vmx->vcpu.kvm))
+			exec_control &=
+				~SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES;
+		vmcs_write32(SECONDARY_VM_EXEC_CONTROL, exec_control);
+	}
 
 	vmcs_write32(PAGE_FAULT_ERROR_CODE_MASK, !!bypass_guest_pf);
 	vmcs_write32(PAGE_FAULT_ERROR_CODE_MATCH, !!bypass_guest_pf);
Signature · 1 line
1.5.3.4

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

_______________________________________________
kvm-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-devel

A message that is not in the archive (sent off-list or not yet received): 200711211539.09494.sheng.yang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org

Applied
#2 lore raw
Quoted 10 lines · Sheng Yang

From 140114fbd60afaf08fde429d05c280d88205051b Mon Sep 17 00:00:00 2001
From: Sheng Yang <[email protected]>
Date: Wed, 21 Nov 2007 14:33:25 +0800
Subject: [PATCH] KVM: VMX: Remove the secondary execute control depends on irqchip

The state of SECONDARY_VM_EXEC_CONTROL shouldn't depend on in-kernel IRQ chip, this patch fix this.

Applied, thanks.

Signature · 7 lines
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/