* [PATCH 0/2] KVM clock - userspace part
@ 2008-01-11 13:11 Glauber de Oliveira Costa
[not found] ` <12000571143111-git-send-email-gcosta-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 7+ messages in thread
From: Glauber de Oliveira Costa @ 2008-01-11 13:11 UTC (permalink / raw)
To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
Cc: jeremy-TSDbQ3PG+2Y, avi-atKUWr5tajBWk0Htik3J/w
These are pretty straightforward. Just probe the host, and advertise the guest
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/2] include kvm_para.h
[not found] ` <12000571143111-git-send-email-gcosta-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2008-01-11 13:11 ` Glauber de Oliveira Costa
[not found] ` <12000571224066-git-send-email-gcosta-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 7+ messages in thread
From: Glauber de Oliveira Costa @ 2008-01-11 13:11 UTC (permalink / raw)
To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
Cc: jeremy-TSDbQ3PG+2Y, avi-atKUWr5tajBWk0Htik3J/w,
Glauber de Oliveira Costa
have qemu-kvm to include kvm_para, allowing access to paravirt definitions
Signed-off-by: Glauber de Oliveira Costa <gcosta-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
qemu/qemu-kvm-x86.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/qemu/qemu-kvm-x86.c b/qemu/qemu-kvm-x86.c
index c79ca36..21ec112 100644
--- a/qemu/qemu-kvm-x86.c
+++ b/qemu/qemu-kvm-x86.c
@@ -14,6 +14,7 @@ extern int kvm_irqchip;
#include <libkvm.h>
#include <pthread.h>
#include <sys/utsname.h>
+#include <linux/kvm_para.h>
#define MSR_IA32_TSC 0x10
--
1.5.0.6
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/2] fill cpuid with clocksource information
[not found] ` <12000571224066-git-send-email-gcosta-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2008-01-11 13:11 ` Glauber de Oliveira Costa
2008-01-12 20:59 ` [PATCH 1/2] include kvm_para.h Avi Kivity
1 sibling, 0 replies; 7+ messages in thread
From: Glauber de Oliveira Costa @ 2008-01-11 13:11 UTC (permalink / raw)
To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
Cc: jeremy-TSDbQ3PG+2Y, avi-atKUWr5tajBWk0Htik3J/w,
Glauber de Oliveira Costa
In this patch, we probe the host checking for clocksource capabilities.
In case it is found, it is advertised to the guest through the appropriate
cpuid mechanism
Signed-off-by: Glauber de Oliveira Costa <gcosta-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
qemu/qemu-kvm-x86.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/qemu/qemu-kvm-x86.c b/qemu/qemu-kvm-x86.c
index 21ec112..c008cb7 100644
--- a/qemu/qemu-kvm-x86.c
+++ b/qemu/qemu-kvm-x86.c
@@ -517,6 +517,10 @@ int kvm_arch_qemu_init_env(CPUState *cenv)
int cpuid_nent = 0;
CPUState copy;
uint32_t i, limit;
+ int has_clocksource = 0;
+#ifdef KVM_CAP_CLOCKSOURCE
+ has_clocksource = kvm_check_extension(kvm_context, KVM_CAP_CLOCKSOURCE);
+#endif
copy = *cenv;
@@ -534,7 +538,7 @@ int kvm_arch_qemu_init_env(CPUState *cenv)
pv_ent = &cpuid_ent[cpuid_nent++];
memset(pv_ent, 0, sizeof(*pv_ent));
pv_ent->function = KVM_CPUID_FEATURES;
- pv_ent->eax = 0;
+ pv_ent->eax = (has_clocksource << KVM_FEATURE_CLOCKSOURCE);
#endif
copy.regs[R_EAX] = 0;
--
1.5.0.6
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] include kvm_para.h
[not found] ` <12000571224066-git-send-email-gcosta-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2008-01-11 13:11 ` [PATCH 2/2] fill cpuid with clocksource information Glauber de Oliveira Costa
@ 2008-01-12 20:59 ` Avi Kivity
[not found] ` <47892A4A.4000607-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
1 sibling, 1 reply; 7+ messages in thread
From: Avi Kivity @ 2008-01-12 20:59 UTC (permalink / raw)
To: Glauber de Oliveira Costa
Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, jeremy-TSDbQ3PG+2Y
Glauber de Oliveira Costa wrote:
> have qemu-kvm to include kvm_para, allowing access to paravirt definitions
>
> Signed-off-by: Glauber de Oliveira Costa <gcosta-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> ---
> qemu/qemu-kvm-x86.c | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/qemu/qemu-kvm-x86.c b/qemu/qemu-kvm-x86.c
> index c79ca36..21ec112 100644
> --- a/qemu/qemu-kvm-x86.c
> +++ b/qemu/qemu-kvm-x86.c
> @@ -14,6 +14,7 @@ extern int kvm_irqchip;
> #include <libkvm.h>
> #include <pthread.h>
> #include <sys/utsname.h>
> +#include <linux/kvm_para.h>
>
IIRC, early versions of kvm_para.h were userspace unfriendly, so we need
a version code check (or better, a KVM_CAP_ check) around this.
--
Any sufficiently difficult bug is indistinguishable from a feature.
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/2] include kvm_para.h
[not found] ` <47892A4A.4000607-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
@ 2008-01-14 21:17 ` Glauber de Oliveira Costa
0 siblings, 0 replies; 7+ messages in thread
From: Glauber de Oliveira Costa @ 2008-01-14 21:17 UTC (permalink / raw)
To: Avi Kivity; +Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, jeremy-TSDbQ3PG+2Y
Avi Kivity wrote:
> Glauber de Oliveira Costa wrote:
>> have qemu-kvm to include kvm_para, allowing access to paravirt
>> definitions
>>
>> Signed-off-by: Glauber de Oliveira Costa <gcosta-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
>> ---
>> qemu/qemu-kvm-x86.c | 1 +
>> 1 files changed, 1 insertions(+), 0 deletions(-)
>>
>> diff --git a/qemu/qemu-kvm-x86.c b/qemu/qemu-kvm-x86.c
>> index c79ca36..21ec112 100644
>> --- a/qemu/qemu-kvm-x86.c
>> +++ b/qemu/qemu-kvm-x86.c
>> @@ -14,6 +14,7 @@ extern int kvm_irqchip;
>> #include <libkvm.h>
>> #include <pthread.h>
>> #include <sys/utsname.h>
>> +#include <linux/kvm_para.h>
>>
>
> IIRC, early versions of kvm_para.h were userspace unfriendly, so we need
> a version code check (or better, a KVM_CAP_ check) around this.
>
No need. including kvm_para.h in userspace unfriendly tools won't break
anything. Code that handles it userspace is already enclosed in the
KVM_CAP_ check.
(well, in reality, I forgot to enclose one line with it. But it's a bug,
and will be fixed in the series I'm about to shoot out.
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 2/2] fill cpuid with clocksource information
[not found] ` <12004098602108-git-send-email-gcosta-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2008-01-15 15:10 ` Glauber de Oliveira Costa
[not found] ` <1200409866869-git-send-email-gcosta-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 7+ messages in thread
From: Glauber de Oliveira Costa @ 2008-01-15 15:10 UTC (permalink / raw)
To: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
Cc: jeremy-TSDbQ3PG+2Y, avi-atKUWr5tajBWk0Htik3J/w,
Glauber de Oliveira Costa
In this patch, we probe the host checking for clocksource capabilities.
In case it is found, it is advertised to the guest through the appropriate
cpuid mechanism
Signed-off-by: Glauber de Oliveira Costa <gcosta-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
qemu/qemu-kvm-x86.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/qemu/qemu-kvm-x86.c b/qemu/qemu-kvm-x86.c
index 21ec112..6b11f02 100644
--- a/qemu/qemu-kvm-x86.c
+++ b/qemu/qemu-kvm-x86.c
@@ -517,6 +517,11 @@ int kvm_arch_qemu_init_env(CPUState *cenv)
int cpuid_nent = 0;
CPUState copy;
uint32_t i, limit;
+ int clocksource_feature = 0;
+#ifdef KVM_CAP_CLOCKSOURCE
+ clocksource_feature = kvm_check_extension(kvm_context, KVM_CAP_CLOCKSOURCE);
+ clocksource_feature <<= KVM_FEATURE_CLOCKSOURCE;
+#endif
copy = *cenv;
@@ -534,7 +539,7 @@ int kvm_arch_qemu_init_env(CPUState *cenv)
pv_ent = &cpuid_ent[cpuid_nent++];
memset(pv_ent, 0, sizeof(*pv_ent));
pv_ent->function = KVM_CPUID_FEATURES;
- pv_ent->eax = 0;
+ pv_ent->eax = clocksource_feature;
#endif
copy.regs[R_EAX] = 0;
--
1.5.0.6
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 2/2] fill cpuid with clocksource information
[not found] ` <1200409866869-git-send-email-gcosta-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2008-01-20 15:41 ` Avi Kivity
0 siblings, 0 replies; 7+ messages in thread
From: Avi Kivity @ 2008-01-20 15:41 UTC (permalink / raw)
To: Glauber de Oliveira Costa
Cc: kvm-devel-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f, jeremy-TSDbQ3PG+2Y
Glauber de Oliveira Costa wrote:
> In this patch, we probe the host checking for clocksource capabilities.
> In case it is found, it is advertised to the guest through the appropriate
> cpuid mechanism
>
> Signed-off-by: Glauber de Oliveira Costa <gcosta-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> ---
> qemu/qemu-kvm-x86.c | 7 ++++++-
> 1 files changed, 6 insertions(+), 1 deletions(-)
>
> diff --git a/qemu/qemu-kvm-x86.c b/qemu/qemu-kvm-x86.c
> index 21ec112..6b11f02 100644
> --- a/qemu/qemu-kvm-x86.c
> +++ b/qemu/qemu-kvm-x86.c
> @@ -517,6 +517,11 @@ int kvm_arch_qemu_init_env(CPUState *cenv)
> int cpuid_nent = 0;
> CPUState copy;
> uint32_t i, limit;
> + int clocksource_feature = 0;
> +#ifdef KVM_CAP_CLOCKSOURCE
> + clocksource_feature = kvm_check_extension(kvm_context, KVM_CAP_CLOCKSOURCE);
> + clocksource_feature <<= KVM_FEATURE_CLOCKSOURCE;
> +#endif
>
There is no reason to be tricky here.
--
error compiling committee.c: too many arguments to function
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2008-01-20 15:41 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-11 13:11 [PATCH 0/2] KVM clock - userspace part Glauber de Oliveira Costa
[not found] ` <12000571143111-git-send-email-gcosta-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2008-01-11 13:11 ` [PATCH 1/2] include kvm_para.h Glauber de Oliveira Costa
[not found] ` <12000571224066-git-send-email-gcosta-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2008-01-11 13:11 ` [PATCH 2/2] fill cpuid with clocksource information Glauber de Oliveira Costa
2008-01-12 20:59 ` [PATCH 1/2] include kvm_para.h Avi Kivity
[not found] ` <47892A4A.4000607-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
2008-01-14 21:17 ` Glauber de Oliveira Costa
-- strict thread matches above, loose matches on Subject: below --
2008-01-15 15:10 [PATCH 0/2] kvm clock - userspace with patches Glauber de Oliveira Costa
2008-01-15 15:10 ` [PATCH 1/2] include kvm_para.h Glauber de Oliveira Costa
[not found] ` <12004098602108-git-send-email-gcosta-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2008-01-15 15:10 ` [PATCH 2/2] fill cpuid with clocksource information Glauber de Oliveira Costa
[not found] ` <1200409866869-git-send-email-gcosta-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2008-01-20 15:41 ` Avi Kivity
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox