Skip to contentSkip to conversation

KVM: Assorted minor fixes

PATCH In review Avi Kivity 2 participants 8 messages Nov 20, 2006 1 message not in the archive KVM

lore
Share & tools
lore

Avi Kivity

author
#0 lore raw

cover KVM: Assorted minor fixes

The following patchset fixes some minor kvm issues, mostly found while adding AMD support.

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


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

A message that is not in the archive (sent off-list or not yet received): 45617A00.5040303-atKUWr5tajBWk0Htik3J/[email protected]

#2 lore raw

PATCH 1/3 KVM: Handle rdmsr(MSR_EFER)

From: Yaniv Kamay <yaniv-atKUWr5tajBWk0Htik3J/[email protected]>

Allow guests to read the EFER msr.

drivers/kvm/kvm_main.c +3 -0
Index: linux-2.6/drivers/kvm/kvm_main.c
===================================================================
@@ -2323,6 +2323,9 @@ static int get_msr(struct kvm_vcpu *vcpu
 	case MSR_GS_BASE:
 		data = vmcs_readl(GUEST_GS_BASE);
 		break;
+	case MSR_EFER:
+		data = vcpu->shadow_efer;
+		break;
 #endif
 	case MSR_IA32_TIME_STAMP_COUNTER:
 		data = guest_read_tsc();

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

#3 lore raw

PATCH 2/3 KVM: Pass fs, gs segment bases to x86 emulator

In reply to a message not in the archive

From: Yaniv Kamay <yaniv-atKUWr5tajBWk0Htik3J/[email protected]>

The x86-64 respects segment bases for fs and gs.

drivers/kvm/kvm_main.c +3 -4
Index: linux-2.6/drivers/kvm/kvm_main.c
===================================================================
@@ -1907,17 +1907,16 @@ static int emulate_instruction(struct kv
 		emulate_ctxt.ds_base = 0;
 		emulate_ctxt.es_base = 0;
 		emulate_ctxt.ss_base = 0;
-		emulate_ctxt.gs_base = 0;
-		emulate_ctxt.fs_base = 0;
 	} else {
 		emulate_ctxt.cs_base = vmcs_readl(GUEST_CS_BASE);
 		emulate_ctxt.ds_base = vmcs_readl(GUEST_DS_BASE);
 		emulate_ctxt.es_base = vmcs_readl(GUEST_ES_BASE);
 		emulate_ctxt.ss_base = vmcs_readl(GUEST_SS_BASE);
-		emulate_ctxt.gs_base = vmcs_readl(GUEST_GS_BASE);
-		emulate_ctxt.fs_base = vmcs_readl(GUEST_FS_BASE);
 	}
 
+	emulate_ctxt.gs_base = vmcs_readl(GUEST_GS_BASE);
+	emulate_ctxt.fs_base = vmcs_readl(GUEST_FS_BASE);
+
 	vcpu->mmio_is_write = 0;
 	r = x86_emulate_memop(&emulate_ctxt, &emulate_ops);
 

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

#4 lore raw

PATCH 3/3 KVM: Fix mmu reset locking when setting cr0

In reply to a message not in the archive

From: Yaniv Kamay <yaniv-atKUWr5tajBWk0Htik3J/[email protected]>

An mmu reset needs to be called with the kvm lock held.

drivers/kvm/kvm_main.c +2 -0
Index: linux-2.6/drivers/kvm/kvm_main.c
===================================================================
@@ -1045,7 +1045,9 @@ static void set_cr0(struct kvm_vcpu *vcp
 	}
 
 	__set_cr0(vcpu, cr0);
+	spin_lock(&vcpu->kvm->lock);
 	kvm_mmu_reset_context(vcpu);
+	spin_unlock(&vcpu->kvm->lock);
 	return;
 }
 

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

author
#5 lore raw
In reply to Avi Kivity
Quoted 3 lines · Avi Kivity

The following patchset fixes some minor kvm issues, mostly found while adding AMD support.

Forgot to cc lkml with the actual patches. Will resend. Please ignore any duplicates.

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


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
author
#6 lore raw

PATCH 1/3 KVM: Handle rdmsr(MSR_EFER)

In reply to Avi Kivity

From: Yaniv Kamay <yaniv-atKUWr5tajBWk0Htik3J/[email protected]>

Allow guests to read the EFER msr.

drivers/kvm/kvm_main.c +3 -0
Index: linux-2.6/drivers/kvm/kvm_main.c
===================================================================
@@ -2323,6 +2323,9 @@ static int get_msr(struct kvm_vcpu *vcpu
 	case MSR_GS_BASE:
 		data = vmcs_readl(GUEST_GS_BASE);
 		break;
+	case MSR_EFER:
+		data = vcpu->shadow_efer;
+		break;
 #endif
 	case MSR_IA32_TIME_STAMP_COUNTER:
 		data = guest_read_tsc();

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

author
#7 lore raw

PATCH 2/3 KVM: Pass fs, gs segment bases to x86 emulator

In reply to Avi Kivity

From: Yaniv Kamay <yaniv-atKUWr5tajBWk0Htik3J/[email protected]>

The x86-64 respects segment bases for fs and gs.

drivers/kvm/kvm_main.c +3 -4
Index: linux-2.6/drivers/kvm/kvm_main.c
===================================================================
@@ -1907,17 +1907,16 @@ static int emulate_instruction(struct kv
 		emulate_ctxt.ds_base = 0;
 		emulate_ctxt.es_base = 0;
 		emulate_ctxt.ss_base = 0;
-		emulate_ctxt.gs_base = 0;
-		emulate_ctxt.fs_base = 0;
 	} else {
 		emulate_ctxt.cs_base = vmcs_readl(GUEST_CS_BASE);
 		emulate_ctxt.ds_base = vmcs_readl(GUEST_DS_BASE);
 		emulate_ctxt.es_base = vmcs_readl(GUEST_ES_BASE);
 		emulate_ctxt.ss_base = vmcs_readl(GUEST_SS_BASE);
-		emulate_ctxt.gs_base = vmcs_readl(GUEST_GS_BASE);
-		emulate_ctxt.fs_base = vmcs_readl(GUEST_FS_BASE);
 	}
 
+	emulate_ctxt.gs_base = vmcs_readl(GUEST_GS_BASE);
+	emulate_ctxt.fs_base = vmcs_readl(GUEST_FS_BASE);
+
 	vcpu->mmio_is_write = 0;
 	r = x86_emulate_memop(&emulate_ctxt, &emulate_ops);
 

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

author
#8 lore raw

PATCH 3/3 KVM: Fix mmu reset locking when setting cr0

In reply to Avi Kivity

From: Yaniv Kamay <yaniv-atKUWr5tajBWk0Htik3J/[email protected]>

An mmu reset needs to be called with the kvm lock held.

drivers/kvm/kvm_main.c +2 -0
Index: linux-2.6/drivers/kvm/kvm_main.c
===================================================================
@@ -1045,7 +1045,9 @@ static void set_cr0(struct kvm_vcpu *vcp
 	}
 
 	__set_cr0(vcpu, cr0);
+	spin_lock(&vcpu->kvm->lock);
 	kvm_mmu_reset_context(vcpu);
+	spin_unlock(&vcpu->kvm->lock);
 	return;
 }
 

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV