All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] SVM: enable LBRV virtualization if available
@ 2007-03-30 12:21 Joerg Roedel
       [not found] ` <20070330122153.GO6644-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Joerg Roedel @ 2007-03-30 12:21 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

[-- Attachment #1: Type: text/plain, Size: 411 bytes --]

From: Joerg Roedel <joerg.roedel-5C7GfCeVMHo@public.gmane.org>

This patch enables the virtualization of the last branch record MSRs on
SVM if this feature is available in hardware. It also introduces a small
and simple check feature for specific SVM extensions.

Signed-off-by: Joerg Roedel <joerg.roedel-5C7GfCeVMHo@public.gmane.org>

-- 
Joerg Roedel
Operating System Research Center
AMD Saxony LLC & Co. KG

[-- Attachment #2: kvm-svm-lbrv-virtualization.patch --]
[-- Type: text/plain, Size: 1221 bytes --]

diff --git a/drivers/kvm/svm.c b/drivers/kvm/svm.c
index ddc0505..421eeb8 100644
--- a/drivers/kvm/svm.c
+++ b/drivers/kvm/svm.c
@@ -44,6 +44,12 @@ MODULE_LICENSE("GPL");
 #define KVM_EFER_LMA (1 << 10)
 #define KVM_EFER_LME (1 << 8)
 
+#define SVM_FEATURE_NPT  (1 << 0)
+#define SVM_FEATURE_LBRV (1 << 1)
+#define SVM_DEATURE_SVML (1 << 2)
+
+#define svm_has(feat) (svm_features & (feat))
+
 unsigned long iopm_base;
 unsigned long msrpm_base;
 
@@ -68,6 +74,7 @@ struct svm_cpu_data {
 };
 
 static DEFINE_PER_CPU(struct svm_cpu_data *, svm_data);
+static uint32_t svm_features;
 
 struct svm_init_data {
 	int cpu;
@@ -309,6 +316,7 @@ static void svm_hardware_enable(void *garbage)
 	svm_data->asid_generation = 1;
 	svm_data->max_asid = cpuid_ebx(SVM_CPUID_FUNC) - 1;
 	svm_data->next_asid = svm_data->max_asid + 1;
+	svm_features = cpuid_edx(SVM_CPUID_FUNC);
 
 	asm volatile ( "sgdt %0" : "=m"(gdt_descr) );
 	gdt = (struct desc_struct *)gdt_descr.address;
@@ -518,6 +526,8 @@ static void init_vmcb(struct vmcb *vmcb)
 	rdtscll(tsc);
 	control->tsc_offset = -tsc;
 	control->int_ctl = V_INTR_MASKING_MASK;
+	if (svm_has(SVM_FEATURE_LBRV))
+		control->lbr_ctl = 1ULL;
 
 	init_seg(&save->es);
 	init_seg(&save->ss);

[-- Attachment #3: Type: text/plain, Size: 345 bytes --]

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

[-- Attachment #4: Type: text/plain, Size: 186 bytes --]

_______________________________________________
kvm-devel mailing list
kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/kvm-devel

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

* Re: [PATCH] SVM: enable LBRV virtualization if available
       [not found] ` <20070330122153.GO6644-5C7GfCeVMHo@public.gmane.org>
@ 2007-03-30 14:04   ` Avi Kivity
       [not found]     ` <460D18ED.909-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Avi Kivity @ 2007-03-30 14:04 UTC (permalink / raw)
  To: Joerg Roedel; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Joerg Roedel wrote:
> From: Joerg Roedel <joerg.roedel-5C7GfCeVMHo@public.gmane.org>
>
> This patch enables the virtualization of the last branch record MSRs on
> SVM if this feature is available in hardware. It also introduces a small
> and simple check feature for specific SVM extensions.
>   

> +#define SVM_DEATURE_SVML (1 << 2)
>   

FEATURE? DENTURE?

> +
> +#define svm_has(feat) (svm_features & (feat))
> +
>   

I prefer a static inline instead of a function-like macro.

>  unsigned long iopm_base;
>  unsigned long msrpm_base;
>  
> @@ -68,6 +74,7 @@ struct svm_cpu_data {
>  };
>  
>  static DEFINE_PER_CPU(struct svm_cpu_data *, svm_data);
> +static uint32_t svm_features;
>   

u32 outside userspace headers.

Anyway I fixed these up and applied.

-- 
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] 6+ messages in thread

* Re: [PATCH] SVM: enable LBRV virtualization if available
       [not found]     ` <460D18ED.909-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
@ 2007-04-02  9:32       ` Joerg Roedel
       [not found]         ` <20070402093256.GQ6644-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Joerg Roedel @ 2007-04-02  9:32 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On Fri, Mar 30, 2007 at 05:04:29PM +0300, Avi Kivity wrote:
> Joerg Roedel wrote:
> >From: Joerg Roedel <joerg.roedel-5C7GfCeVMHo@public.gmane.org>
> >
> >This patch enables the virtualization of the last branch record MSRs on
> >SVM if this feature is available in hardware. It also introduces a small
> >and simple check feature for specific SVM extensions.
> >  
> 
> >+#define SVM_DEATURE_SVML (1 << 2)
> >  
> 
> FEATURE? DENTURE?

Uh, a typo went in the patch. This must be SVM_FEATURE_SVML.

> >+
> >+#define svm_has(feat) (svm_features & (feat))
> >+
> >  
> 
> I prefer a static inline instead of a function-like macro.

Ok, will remember that in the next patches.

> > unsigned long iopm_base;
> > unsigned long msrpm_base;
> > @@ -68,6 +74,7 @@ struct svm_cpu_data {
> > };
> >  static DEFINE_PER_CPU(struct svm_cpu_data *, svm_data);
> >+static uint32_t svm_features;
> >  
> 
> u32 outside userspace headers.

Is struct svm_cpu_data a userspace data structure. I ask because in a
previous version of the patch the svm_features variable was part of that
struct. Thats why I used this type.

> Anyway I fixed these up and applied.

Thanks,
Joerg

-- 
Joerg Roedel
Operating System Research Center
AMD Saxony LLC & Co. KG



-------------------------------------------------------------------------
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] 6+ messages in thread

* Re: [PATCH] SVM: enable LBRV virtualization if available
       [not found]         ` <20070402093256.GQ6644-5C7GfCeVMHo@public.gmane.org>
@ 2007-04-02  9:39           ` Avi Kivity
       [not found]             ` <4610CF62.6040204-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Avi Kivity @ 2007-04-02  9:39 UTC (permalink / raw)
  To: Joerg Roedel; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Joerg Roedel wrote:
> Is struct svm_cpu_data a userspace data structure. I ask because in a
> previous version of the patch the svm_features variable was part of that
> struct. Thats why I used this type.
>   

No, all userspace stuff is in include/linux/kvm*.h (which uses __u32; 
uint32_t is for libkvm and qemu).


-- 
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] 6+ messages in thread

* Re: [PATCH] SVM: enable LBRV virtualization if available
       [not found]             ` <4610CF62.6040204-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
@ 2007-04-02 10:01               ` Joerg Roedel
       [not found]                 ` <20070402100113.GR6644-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Joerg Roedel @ 2007-04-02 10:01 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

On Mon, Apr 02, 2007 at 12:39:46PM +0300, Avi Kivity wrote:
> Joerg Roedel wrote:
> >Is struct svm_cpu_data a userspace data structure. I ask because in a
> >previous version of the patch the svm_features variable was part of that
> >struct. Thats why I used this type.
> >  
> 
> No, all userspace stuff is in include/linux/kvm*.h (which uses __u32; uint32_t is for libkvm 
> and qemu).

Ok, then the types in that structure should also be fixed :)

Joerg

-- 
Joerg Roedel
Operating System Research Center
AMD Saxony LLC & Co. KG



-------------------------------------------------------------------------
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] 6+ messages in thread

* Re: [PATCH] SVM: enable LBRV virtualization if available
       [not found]                 ` <20070402100113.GR6644-5C7GfCeVMHo@public.gmane.org>
@ 2007-04-02 10:06                   ` Avi Kivity
  0 siblings, 0 replies; 6+ messages in thread
From: Avi Kivity @ 2007-04-02 10:06 UTC (permalink / raw)
  To: Joerg Roedel; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f

Joerg Roedel wrote:
>>> Is struct svm_cpu_data a userspace data structure. I ask because in a
>>> previous version of the patch the svm_features variable was part of that
>>> struct. Thats why I used this type.
>>>  
>>>       
>> No, all userspace stuff is in include/linux/kvm*.h (which uses __u32; uint32_t is for libkvm 
>> and qemu).
>>     
>
> Ok, then the types in that structure should also be fixed :)
>   

Right, done :)


-- 
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] 6+ messages in thread

end of thread, other threads:[~2007-04-02 10:06 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-30 12:21 [PATCH] SVM: enable LBRV virtualization if available Joerg Roedel
     [not found] ` <20070330122153.GO6644-5C7GfCeVMHo@public.gmane.org>
2007-03-30 14:04   ` Avi Kivity
     [not found]     ` <460D18ED.909-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-04-02  9:32       ` Joerg Roedel
     [not found]         ` <20070402093256.GQ6644-5C7GfCeVMHo@public.gmane.org>
2007-04-02  9:39           ` Avi Kivity
     [not found]             ` <4610CF62.6040204-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2007-04-02 10:01               ` Joerg Roedel
     [not found]                 ` <20070402100113.GR6644-5C7GfCeVMHo@public.gmane.org>
2007-04-02 10:06                   ` Avi Kivity

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.