public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] KVM: Assorted minor fixes
@ 2006-11-20  9:48 Avi Kivity
       [not found] ` <45617A00.5040303-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: Avi Kivity @ 2006-11-20  9:48 UTC (permalink / raw)
  To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: Andrew Morton, Yaniv Kamay, linux-kernel

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

-- 
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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/3] KVM: Handle rdmsr(MSR_EFER)
       [not found] ` <45617A00.5040303-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
@ 2006-11-20  9:50   ` Avi Kivity
  2006-11-20  9:51   ` [PATCH 2/3] KVM: Pass fs, gs segment bases to x86 emulator Avi Kivity
                     ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Avi Kivity @ 2006-11-20  9:50 UTC (permalink / raw)
  To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: akpm-3NddpPZAyC0, kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	yaniv.kamay-atKUWr5tajBWk0Htik3J/w

From: Yaniv Kamay <yaniv-atKUWr5tajBWk0Htik3J/w@public.gmane.org>

Allow guests to read the EFER msr.

Signed-off-by: Yaniv Kamay <yaniv-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
Signed-off-by: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>

Index: linux-2.6/drivers/kvm/kvm_main.c
===================================================================
--- linux-2.6.orig/drivers/kvm/kvm_main.c
+++ 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 2/3] KVM: Pass fs, gs segment bases to x86 emulator
       [not found] ` <45617A00.5040303-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
  2006-11-20  9:50   ` [PATCH 1/3] KVM: Handle rdmsr(MSR_EFER) Avi Kivity
@ 2006-11-20  9:51   ` Avi Kivity
  2006-11-20  9:52   ` [PATCH 3/3] KVM: Fix mmu reset locking when setting cr0 Avi Kivity
                     ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Avi Kivity @ 2006-11-20  9:51 UTC (permalink / raw)
  To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: akpm-3NddpPZAyC0, kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	yaniv.kamay-atKUWr5tajBWk0Htik3J/w

From: Yaniv Kamay <yaniv-atKUWr5tajBWk0Htik3J/w@public.gmane.org>

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

Signed-off-by: Yaniv Kamay <yaniv-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
Signed-off-by: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>

Index: linux-2.6/drivers/kvm/kvm_main.c
===================================================================
--- linux-2.6.orig/drivers/kvm/kvm_main.c
+++ 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 3/3] KVM: Fix mmu reset locking when setting cr0
       [not found] ` <45617A00.5040303-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
  2006-11-20  9:50   ` [PATCH 1/3] KVM: Handle rdmsr(MSR_EFER) Avi Kivity
  2006-11-20  9:51   ` [PATCH 2/3] KVM: Pass fs, gs segment bases to x86 emulator Avi Kivity
@ 2006-11-20  9:52   ` Avi Kivity
  2006-11-20 10:26   ` [PATCH 0/3] KVM: Assorted minor fixes Avi Kivity
                     ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Avi Kivity @ 2006-11-20  9:52 UTC (permalink / raw)
  To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: akpm-3NddpPZAyC0, kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	yaniv.kamay-atKUWr5tajBWk0Htik3J/w

From: Yaniv Kamay <yaniv-atKUWr5tajBWk0Htik3J/w@public.gmane.org>

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

Signed-off-by: Yaniv Kamay <yaniv-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
Signed-off-by: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>

Index: linux-2.6/drivers/kvm/kvm_main.c
===================================================================
--- linux-2.6.orig/drivers/kvm/kvm_main.c
+++ 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/3] KVM: Assorted minor fixes
       [not found] ` <45617A00.5040303-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
                     ` (2 preceding siblings ...)
  2006-11-20  9:52   ` [PATCH 3/3] KVM: Fix mmu reset locking when setting cr0 Avi Kivity
@ 2006-11-20 10:26   ` Avi Kivity
  2006-11-20 10:27   ` [PATCH 1/3] KVM: Handle rdmsr(MSR_EFER) Avi Kivity
                     ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: Avi Kivity @ 2006-11-20 10:26 UTC (permalink / raw)
  To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: Andrew Morton, Yaniv Kamay, linux-kernel

Avi Kivity wrote:
> 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.

-- 
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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/3] KVM: Handle rdmsr(MSR_EFER)
       [not found] ` <45617A00.5040303-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
                     ` (3 preceding siblings ...)
  2006-11-20 10:26   ` [PATCH 0/3] KVM: Assorted minor fixes Avi Kivity
@ 2006-11-20 10:27   ` Avi Kivity
  2006-11-20 10:28   ` [PATCH 2/3] KVM: Pass fs, gs segment bases to x86 emulator Avi Kivity
  2006-11-20 10:29   ` [PATCH 3/3] KVM: Fix mmu reset locking when setting cr0 Avi Kivity
  6 siblings, 0 replies; 8+ messages in thread
From: Avi Kivity @ 2006-11-20 10:27 UTC (permalink / raw)
  To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: akpm-3NddpPZAyC0, kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	yaniv.kamay-atKUWr5tajBWk0Htik3J/w,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

From: Yaniv Kamay <yaniv-atKUWr5tajBWk0Htik3J/w@public.gmane.org>

Allow guests to read the EFER msr.

Signed-off-by: Yaniv Kamay <yaniv-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
Signed-off-by: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>

Index: linux-2.6/drivers/kvm/kvm_main.c
===================================================================
--- linux-2.6.orig/drivers/kvm/kvm_main.c
+++ 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 2/3] KVM: Pass fs, gs segment bases to x86 emulator
       [not found] ` <45617A00.5040303-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
                     ` (4 preceding siblings ...)
  2006-11-20 10:27   ` [PATCH 1/3] KVM: Handle rdmsr(MSR_EFER) Avi Kivity
@ 2006-11-20 10:28   ` Avi Kivity
  2006-11-20 10:29   ` [PATCH 3/3] KVM: Fix mmu reset locking when setting cr0 Avi Kivity
  6 siblings, 0 replies; 8+ messages in thread
From: Avi Kivity @ 2006-11-20 10:28 UTC (permalink / raw)
  To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: akpm-3NddpPZAyC0, kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	yaniv.kamay-atKUWr5tajBWk0Htik3J/w,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

From: Yaniv Kamay <yaniv-atKUWr5tajBWk0Htik3J/w@public.gmane.org>

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

Signed-off-by: Yaniv Kamay <yaniv-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
Signed-off-by: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>

Index: linux-2.6/drivers/kvm/kvm_main.c
===================================================================
--- linux-2.6.orig/drivers/kvm/kvm_main.c
+++ 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 3/3] KVM: Fix mmu reset locking when setting cr0
       [not found] ` <45617A00.5040303-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
                     ` (5 preceding siblings ...)
  2006-11-20 10:28   ` [PATCH 2/3] KVM: Pass fs, gs segment bases to x86 emulator Avi Kivity
@ 2006-11-20 10:29   ` Avi Kivity
  6 siblings, 0 replies; 8+ messages in thread
From: Avi Kivity @ 2006-11-20 10:29 UTC (permalink / raw)
  To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
  Cc: akpm-3NddpPZAyC0, kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
	yaniv.kamay-atKUWr5tajBWk0Htik3J/w,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

From: Yaniv Kamay <yaniv-atKUWr5tajBWk0Htik3J/w@public.gmane.org>

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

Signed-off-by: Yaniv Kamay <yaniv-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
Signed-off-by: Avi Kivity <avi-atKUWr5tajBWk0Htik3J/w@public.gmane.org>

Index: linux-2.6/drivers/kvm/kvm_main.c
===================================================================
--- linux-2.6.orig/drivers/kvm/kvm_main.c
+++ 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2006-11-20 10:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-20  9:48 [PATCH 0/3] KVM: Assorted minor fixes Avi Kivity
     [not found] ` <45617A00.5040303-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2006-11-20  9:50   ` [PATCH 1/3] KVM: Handle rdmsr(MSR_EFER) Avi Kivity
2006-11-20  9:51   ` [PATCH 2/3] KVM: Pass fs, gs segment bases to x86 emulator Avi Kivity
2006-11-20  9:52   ` [PATCH 3/3] KVM: Fix mmu reset locking when setting cr0 Avi Kivity
2006-11-20 10:26   ` [PATCH 0/3] KVM: Assorted minor fixes Avi Kivity
2006-11-20 10:27   ` [PATCH 1/3] KVM: Handle rdmsr(MSR_EFER) Avi Kivity
2006-11-20 10:28   ` [PATCH 2/3] KVM: Pass fs, gs segment bases to x86 emulator Avi Kivity
2006-11-20 10:29   ` [PATCH 3/3] KVM: Fix mmu reset locking when setting cr0 Avi Kivity

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox