* [PATCH 1/2] KVM: PPC: epapr: Add idle hcall support for host
@ 2011-12-31 6:16 ` Liu Yu
0 siblings, 0 replies; 24+ messages in thread
From: Liu Yu @ 2011-12-31 6:16 UTC (permalink / raw)
To: agraf; +Cc: kvm-ppc, kvm, Liu Yu
Add a new field opt_feature in struct kvm_ppc_pvinfo
to tell userspace whether it support hcall idle.
Signed-off-by: Liu Yu <yu.liu@freescale.com>
---
arch/powerpc/include/asm/kvm_para.h | 18 ++++++++++++++----
arch/powerpc/kvm/powerpc.c | 9 +++++++++
include/linux/kvm.h | 5 ++++-
3 files changed, 27 insertions(+), 5 deletions(-)
diff --git a/arch/powerpc/include/asm/kvm_para.h b/arch/powerpc/include/asm/kvm_para.h
index 50533f9..0686377 100644
--- a/arch/powerpc/include/asm/kvm_para.h
+++ b/arch/powerpc/include/asm/kvm_para.h
@@ -40,17 +40,27 @@ struct kvm_vcpu_arch_shared {
__u32 sr[16];
};
+#ifdef __KERNEL__
+
#define KVM_SC_MAGIC_R0 0x4b564d21 /* "KVM!" */
-#define HC_VENDOR_KVM (42 << 16)
+
+#include <asm/epapr_hcalls.h>
+
+/* ePAPR Hypercall Vendor ID */
+#define HC_VENDOR_EPAPR (EV_EPAPR_VENDOR_ID << 16)
+#define HC_VENDOR_KVM (EV_KVM_VENDOR_ID << 16)
+
+/* ePAPR Hypercall Token */
+#define HC_EV_IDLE EV_IDLE
+
+/* ePAPR Hypercall Return Codes */
#define HC_EV_SUCCESS 0
-#define HC_EV_UNIMPLEMENTED 12
+#define HC_EV_UNIMPLEMENTED EV_UNIMPLEMENTED
#define KVM_FEATURE_MAGIC_PAGE 1
#define KVM_MAGIC_FEAT_SR (1 << 0)
-#ifdef __KERNEL__
-
#ifdef CONFIG_KVM_GUEST
#include <linux/of.h>
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
index c33f6a7..786b34b 100644
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -81,6 +81,10 @@ int kvmppc_kvm_pv(struct kvm_vcpu *vcpu)
/* Second return value is in r4 */
break;
+ case HC_VENDOR_EPAPR | HC_EV_IDLE:
+ r = HC_EV_SUCCESS;
+ kvm_vcpu_block(vcpu);
+ break;
default:
r = HC_EV_UNIMPLEMENTED;
break;
@@ -772,6 +776,11 @@ static int kvm_vm_ioctl_get_pvinfo(struct kvm_ppc_pvinfo *pvinfo)
pvinfo->hcall[2] = inst_sc;
pvinfo->hcall[3] = inst_nop;
+ pvinfo->opt_features = 0;
+#ifdef CONFIG_BOOKE
+ pvinfo->opt_features |= KVM_PPC_PVINFO_HAS_EV_IDLE;
+#endif
+
return 0;
}
diff --git a/include/linux/kvm.h b/include/linux/kvm.h
index c107fae..5af21f3 100644
--- a/include/linux/kvm.h
+++ b/include/linux/kvm.h
@@ -426,9 +426,12 @@ struct kvm_ppc_pvinfo {
/* out */
__u32 flags;
__u32 hcall[4];
- __u8 pad[108];
+ __u32 opt_features;
+ __u8 pad[104];
};
+#define KVM_PPC_PVINFO_HAS_EV_IDLE (1<<0)
+
#define KVMIO 0xAE
/*
--
1.6.4
^ permalink raw reply related [flat|nested] 24+ messages in thread* [PATCH 2/2] KVM: PPC: epapr: Install ev_idle hcall for paravirt guest linux
2011-12-31 6:16 ` Liu Yu
@ 2011-12-31 6:16 ` Liu Yu
-1 siblings, 0 replies; 24+ messages in thread
From: Liu Yu @ 2011-12-31 6:16 UTC (permalink / raw)
To: agraf; +Cc: kvm-ppc, kvm, Liu Yu
If the guest hypervisor node contains "has-idle" property.
Signed-off-by: Liu Yu <yu.liu@freescale.com>
---
arch/powerpc/kernel/kvm.c | 29 +++++++++++++++++++++++++++++
1 files changed, 29 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/kernel/kvm.c b/arch/powerpc/kernel/kvm.c
index b06bdae..258f129 100644
--- a/arch/powerpc/kernel/kvm.c
+++ b/arch/powerpc/kernel/kvm.c
@@ -28,6 +28,7 @@
#include <asm/sections.h>
#include <asm/cacheflush.h>
#include <asm/disassemble.h>
+#include <asm/machdep.h>
#define KVM_MAGIC_PAGE (-4096L)
#define magic_var(x) KVM_MAGIC_PAGE + offsetof(struct kvm_vcpu_arch_shared, x)
@@ -571,6 +572,30 @@ static __init void kvm_free_tmp(void)
}
}
+static void kvm_hcall_ev_idle(void)
+{
+ ulong in[8];
+ ulong out[8];
+
+ current_thread_info()->local_flags |= _TLF_NAPPING;
+ local_irq_enable();
+ kvm_hypercall(in, out, HC_VENDOR_EPAPR | HC_EV_IDLE);
+}
+
+static int kvm_para_ev_has_idle(void)
+{
+ struct device_node *hyper_node;
+
+ hyper_node = of_find_node_by_path("/hypervisor");
+ if (!hyper_node)
+ return 0;
+
+ if (of_get_property(hyper_node, "has-idle", NULL))
+ return 1;
+
+ return 0;
+}
+
static int __init kvm_guest_init(void)
{
if (!kvm_para_available())
@@ -587,6 +612,10 @@ static int __init kvm_guest_init(void)
powersave_nap = 1;
#endif
+ /* Install hcall EV_IDLE based power_save for guest kernel */
+ if (kvm_para_ev_has_idle())
+ ppc_md.power_save = kvm_hcall_ev_idle;
+
free_tmp:
kvm_free_tmp();
--
1.6.4
^ permalink raw reply related [flat|nested] 24+ messages in thread* [PATCH 2/2] KVM: PPC: epapr: Install ev_idle hcall for paravirt guest linux
@ 2011-12-31 6:16 ` Liu Yu
0 siblings, 0 replies; 24+ messages in thread
From: Liu Yu @ 2011-12-31 6:16 UTC (permalink / raw)
To: agraf; +Cc: kvm-ppc, kvm, Liu Yu
If the guest hypervisor node contains "has-idle" property.
Signed-off-by: Liu Yu <yu.liu@freescale.com>
---
arch/powerpc/kernel/kvm.c | 29 +++++++++++++++++++++++++++++
1 files changed, 29 insertions(+), 0 deletions(-)
diff --git a/arch/powerpc/kernel/kvm.c b/arch/powerpc/kernel/kvm.c
index b06bdae..258f129 100644
--- a/arch/powerpc/kernel/kvm.c
+++ b/arch/powerpc/kernel/kvm.c
@@ -28,6 +28,7 @@
#include <asm/sections.h>
#include <asm/cacheflush.h>
#include <asm/disassemble.h>
+#include <asm/machdep.h>
#define KVM_MAGIC_PAGE (-4096L)
#define magic_var(x) KVM_MAGIC_PAGE + offsetof(struct kvm_vcpu_arch_shared, x)
@@ -571,6 +572,30 @@ static __init void kvm_free_tmp(void)
}
}
+static void kvm_hcall_ev_idle(void)
+{
+ ulong in[8];
+ ulong out[8];
+
+ current_thread_info()->local_flags |= _TLF_NAPPING;
+ local_irq_enable();
+ kvm_hypercall(in, out, HC_VENDOR_EPAPR | HC_EV_IDLE);
+}
+
+static int kvm_para_ev_has_idle(void)
+{
+ struct device_node *hyper_node;
+
+ hyper_node = of_find_node_by_path("/hypervisor");
+ if (!hyper_node)
+ return 0;
+
+ if (of_get_property(hyper_node, "has-idle", NULL))
+ return 1;
+
+ return 0;
+}
+
static int __init kvm_guest_init(void)
{
if (!kvm_para_available())
@@ -587,6 +612,10 @@ static int __init kvm_guest_init(void)
powersave_nap = 1;
#endif
+ /* Install hcall EV_IDLE based power_save for guest kernel */
+ if (kvm_para_ev_has_idle())
+ ppc_md.power_save = kvm_hcall_ev_idle;
+
free_tmp:
kvm_free_tmp();
--
1.6.4
^ permalink raw reply related [flat|nested] 24+ messages in thread* Re: [PATCH 2/2] KVM: PPC: epapr: Install ev_idle hcall for paravirt
2011-12-31 6:16 ` Liu Yu
@ 2012-01-02 18:23 ` Scott Wood
-1 siblings, 0 replies; 24+ messages in thread
From: Scott Wood @ 2012-01-02 18:23 UTC (permalink / raw)
To: Liu Yu; +Cc: agraf, kvm-ppc, kvm
On 12/31/2011 12:16 AM, Liu Yu wrote:
> If the guest hypervisor node contains "has-idle" property.
>
> Signed-off-by: Liu Yu <yu.liu@freescale.com>
> ---
> arch/powerpc/kernel/kvm.c | 29 +++++++++++++++++++++++++++++
> 1 files changed, 29 insertions(+), 0 deletions(-)
>
> diff --git a/arch/powerpc/kernel/kvm.c b/arch/powerpc/kernel/kvm.c
> index b06bdae..258f129 100644
> --- a/arch/powerpc/kernel/kvm.c
> +++ b/arch/powerpc/kernel/kvm.c
> @@ -28,6 +28,7 @@
> #include <asm/sections.h>
> #include <asm/cacheflush.h>
> #include <asm/disassemble.h>
> +#include <asm/machdep.h>
>
> #define KVM_MAGIC_PAGE (-4096L)
> #define magic_var(x) KVM_MAGIC_PAGE + offsetof(struct kvm_vcpu_arch_shared, x)
> @@ -571,6 +572,30 @@ static __init void kvm_free_tmp(void)
> }
> }
>
> +static void kvm_hcall_ev_idle(void)
> +{
> + ulong in[8];
> + ulong out[8];
> +
> + current_thread_info()->local_flags |= _TLF_NAPPING;
> + local_irq_enable();
> + kvm_hypercall(in, out, HC_VENDOR_EPAPR | HC_EV_IDLE);
> +}
I think this has to be done in assembly -- otherwise it's not safe for
the interrupt handler to return directly to LR.
> +static int kvm_para_ev_has_idle(void)
> +{
> + struct device_node *hyper_node;
> +
> + hyper_node = of_find_node_by_path("/hypervisor");
> + if (!hyper_node)
> + return 0;
> +
> + if (of_get_property(hyper_node, "has-idle", NULL))
> + return 1;
> +
> + return 0;
> +}
Since this is standardized in ePAPR, can we move it out of kvm.c an into
generic code to work with any hypervisor that sets has-idle? Likewise
with kvm_para_setup().
-Scott
^ permalink raw reply [flat|nested] 24+ messages in thread* Re: [PATCH 2/2] KVM: PPC: epapr: Install ev_idle hcall for paravirt guest linux
@ 2012-01-02 18:23 ` Scott Wood
0 siblings, 0 replies; 24+ messages in thread
From: Scott Wood @ 2012-01-02 18:23 UTC (permalink / raw)
To: Liu Yu; +Cc: agraf, kvm-ppc, kvm
On 12/31/2011 12:16 AM, Liu Yu wrote:
> If the guest hypervisor node contains "has-idle" property.
>
> Signed-off-by: Liu Yu <yu.liu@freescale.com>
> ---
> arch/powerpc/kernel/kvm.c | 29 +++++++++++++++++++++++++++++
> 1 files changed, 29 insertions(+), 0 deletions(-)
>
> diff --git a/arch/powerpc/kernel/kvm.c b/arch/powerpc/kernel/kvm.c
> index b06bdae..258f129 100644
> --- a/arch/powerpc/kernel/kvm.c
> +++ b/arch/powerpc/kernel/kvm.c
> @@ -28,6 +28,7 @@
> #include <asm/sections.h>
> #include <asm/cacheflush.h>
> #include <asm/disassemble.h>
> +#include <asm/machdep.h>
>
> #define KVM_MAGIC_PAGE (-4096L)
> #define magic_var(x) KVM_MAGIC_PAGE + offsetof(struct kvm_vcpu_arch_shared, x)
> @@ -571,6 +572,30 @@ static __init void kvm_free_tmp(void)
> }
> }
>
> +static void kvm_hcall_ev_idle(void)
> +{
> + ulong in[8];
> + ulong out[8];
> +
> + current_thread_info()->local_flags |= _TLF_NAPPING;
> + local_irq_enable();
> + kvm_hypercall(in, out, HC_VENDOR_EPAPR | HC_EV_IDLE);
> +}
I think this has to be done in assembly -- otherwise it's not safe for
the interrupt handler to return directly to LR.
> +static int kvm_para_ev_has_idle(void)
> +{
> + struct device_node *hyper_node;
> +
> + hyper_node = of_find_node_by_path("/hypervisor");
> + if (!hyper_node)
> + return 0;
> +
> + if (of_get_property(hyper_node, "has-idle", NULL))
> + return 1;
> +
> + return 0;
> +}
Since this is standardized in ePAPR, can we move it out of kvm.c an into
generic code to work with any hypervisor that sets has-idle? Likewise
with kvm_para_setup().
-Scott
^ permalink raw reply [flat|nested] 24+ messages in thread* RE: [PATCH 2/2] KVM: PPC: epapr: Install ev_idle hcall for paravirt
2012-01-02 18:23 ` [PATCH 2/2] KVM: PPC: epapr: Install ev_idle hcall for paravirt guest linux Scott Wood
@ 2012-01-04 9:23 ` Liu Yu-B13201
-1 siblings, 0 replies; 24+ messages in thread
From: Liu Yu-B13201 @ 2012-01-04 9:23 UTC (permalink / raw)
To: Wood Scott-B07421
Cc: agraf@suse.de, kvm-ppc@vger.kernel.org, kvm@vger.kernel.org
DQoNCj4gLS0tLS1PcmlnaW5hbCBNZXNzYWdlLS0tLS0NCj4gRnJvbTogV29vZCBTY290dC1CMDc0
MjENCj4gU2VudDogVHVlc2RheSwgSmFudWFyeSAwMywgMjAxMiAyOjIzIEFNDQo+IFRvOiBMaXUg
WXUtQjEzMjAxDQo+IENjOiBhZ3JhZkBzdXNlLmRlOyBrdm0tcHBjQHZnZXIua2VybmVsLm9yZzsg
a3ZtQHZnZXIua2VybmVsLm9yZw0KPiBTdWJqZWN0OiBSZTogW1BBVENIIDIvMl0gS1ZNOiBQUEM6
IGVwYXByOiBJbnN0YWxsIGV2X2lkbGUgaGNhbGwgZm9yDQo+IHBhcmF2aXJ0IGd1ZXN0IGxpbnV4
DQo+IA0KPiBPbiAxMi8zMS8yMDExIDEyOjE2IEFNLCBMaXUgWXUgd3JvdGU6DQo+ID4gSWYgdGhl
IGd1ZXN0IGh5cGVydmlzb3Igbm9kZSBjb250YWlucyAiaGFzLWlkbGUiIHByb3BlcnR5Lg0KPiA+
DQo+ID4gU2lnbmVkLW9mZi1ieTogTGl1IFl1IDx5dS5saXVAZnJlZXNjYWxlLmNvbT4NCj4gPiAt
LS0NCj4gPiAgYXJjaC9wb3dlcnBjL2tlcm5lbC9rdm0uYyB8ICAgMjkgKysrKysrKysrKysrKysr
KysrKysrKysrKysrKysNCj4gPiAgMSBmaWxlcyBjaGFuZ2VkLCAyOSBpbnNlcnRpb25zKCspLCAw
IGRlbGV0aW9ucygtKQ0KPiA+DQo+ID4gZGlmZiAtLWdpdCBhL2FyY2gvcG93ZXJwYy9rZXJuZWwv
a3ZtLmMgYi9hcmNoL3Bvd2VycGMva2VybmVsL2t2bS5jDQo+ID4gaW5kZXggYjA2YmRhZS4uMjU4
ZjEyOSAxMDA2NDQNCj4gPiAtLS0gYS9hcmNoL3Bvd2VycGMva2VybmVsL2t2bS5jDQo+ID4gKysr
IGIvYXJjaC9wb3dlcnBjL2tlcm5lbC9rdm0uYw0KPiA+IEBAIC0yOCw2ICsyOCw3IEBADQo+ID4g
ICNpbmNsdWRlIDxhc20vc2VjdGlvbnMuaD4NCj4gPiAgI2luY2x1ZGUgPGFzbS9jYWNoZWZsdXNo
Lmg+DQo+ID4gICNpbmNsdWRlIDxhc20vZGlzYXNzZW1ibGUuaD4NCj4gPiArI2luY2x1ZGUgPGFz
bS9tYWNoZGVwLmg+DQo+ID4NCj4gPiAgI2RlZmluZSBLVk1fTUFHSUNfUEFHRQkJKC00MDk2TCkN
Cj4gPiAgI2RlZmluZSBtYWdpY192YXIoeCkgS1ZNX01BR0lDX1BBR0UgKyBvZmZzZXRvZihzdHJ1
Y3QNCj4gPiBrdm1fdmNwdV9hcmNoX3NoYXJlZCwgeCkgQEAgLTU3MSw2ICs1NzIsMzAgQEAgc3Rh
dGljIF9faW5pdCB2b2lkDQo+IGt2bV9mcmVlX3RtcCh2b2lkKQ0KPiA+ICAJfQ0KPiA+ICB9DQo+
ID4NCj4gPiArc3RhdGljIHZvaWQga3ZtX2hjYWxsX2V2X2lkbGUodm9pZCkNCj4gPiArew0KPiA+
ICsJdWxvbmcgaW5bOF07DQo+ID4gKwl1bG9uZyBvdXRbOF07DQo+ID4gKw0KPiA+ICsJY3VycmVu
dF90aHJlYWRfaW5mbygpLT5sb2NhbF9mbGFncyB8PSBfVExGX05BUFBJTkc7DQo+ID4gKwlsb2Nh
bF9pcnFfZW5hYmxlKCk7DQo+ID4gKwlrdm1faHlwZXJjYWxsKGluLCBvdXQsIEhDX1ZFTkRPUl9F
UEFQUiB8IEhDX0VWX0lETEUpOyB9DQo+IA0KPiBJIHRoaW5rIHRoaXMgaGFzIHRvIGJlIGRvbmUg
aW4gYXNzZW1ibHkgLS0gb3RoZXJ3aXNlIGl0J3Mgbm90IHNhZmUgZm9yDQo+IHRoZSBpbnRlcnJ1
cHQgaGFuZGxlciB0byByZXR1cm4gZGlyZWN0bHkgdG8gTFIuDQo+IA0KPiA+ICtzdGF0aWMgaW50
IGt2bV9wYXJhX2V2X2hhc19pZGxlKHZvaWQpIHsNCj4gPiArCXN0cnVjdCBkZXZpY2Vfbm9kZSAq
aHlwZXJfbm9kZTsNCj4gPiArDQo+ID4gKwloeXBlcl9ub2RlID0gb2ZfZmluZF9ub2RlX2J5X3Bh
dGgoIi9oeXBlcnZpc29yIik7DQo+ID4gKwlpZiAoIWh5cGVyX25vZGUpDQo+ID4gKwkJcmV0dXJu
IDA7DQo+ID4gKw0KPiA+ICsJaWYgKG9mX2dldF9wcm9wZXJ0eShoeXBlcl9ub2RlLCAiaGFzLWlk
bGUiLCBOVUxMKSkNCj4gPiArCQlyZXR1cm4gMTsNCj4gPiArDQo+ID4gKwlyZXR1cm4gMDsNCj4g
PiArfQ0KPiANCj4gU2luY2UgdGhpcyBpcyBzdGFuZGFyZGl6ZWQgaW4gZVBBUFIsIGNhbiB3ZSBt
b3ZlIGl0IG91dCBvZiBrdm0uYyBhbiBpbnRvDQo+IGdlbmVyaWMgY29kZSB0byB3b3JrIHdpdGgg
YW55IGh5cGVydmlzb3IgdGhhdCBzZXRzIGhhcy1pZGxlPyAgTGlrZXdpc2UNCj4gd2l0aCBrdm1f
cGFyYV9zZXR1cCgpLg0KPiANCg0KRG8geW91IG1lYW4gd2Ugc2NhbiBhbmQgcGFyc2UgaHlwZXJ2
aXNvciBub2RlIGluIGVhcmx5X2luaXRfZGV2dHJlZSgpPw0KDQpUaGFua3MsDQpZdQ0KDQoNCg0K
^ permalink raw reply [flat|nested] 24+ messages in thread
* RE: [PATCH 2/2] KVM: PPC: epapr: Install ev_idle hcall for paravirt guest linux
@ 2012-01-04 9:23 ` Liu Yu-B13201
0 siblings, 0 replies; 24+ messages in thread
From: Liu Yu-B13201 @ 2012-01-04 9:23 UTC (permalink / raw)
To: Wood Scott-B07421
Cc: agraf@suse.de, kvm-ppc@vger.kernel.org, kvm@vger.kernel.org
> -----Original Message-----
> From: Wood Scott-B07421
> Sent: Tuesday, January 03, 2012 2:23 AM
> To: Liu Yu-B13201
> Cc: agraf@suse.de; kvm-ppc@vger.kernel.org; kvm@vger.kernel.org
> Subject: Re: [PATCH 2/2] KVM: PPC: epapr: Install ev_idle hcall for
> paravirt guest linux
>
> On 12/31/2011 12:16 AM, Liu Yu wrote:
> > If the guest hypervisor node contains "has-idle" property.
> >
> > Signed-off-by: Liu Yu <yu.liu@freescale.com>
> > ---
> > arch/powerpc/kernel/kvm.c | 29 +++++++++++++++++++++++++++++
> > 1 files changed, 29 insertions(+), 0 deletions(-)
> >
> > diff --git a/arch/powerpc/kernel/kvm.c b/arch/powerpc/kernel/kvm.c
> > index b06bdae..258f129 100644
> > --- a/arch/powerpc/kernel/kvm.c
> > +++ b/arch/powerpc/kernel/kvm.c
> > @@ -28,6 +28,7 @@
> > #include <asm/sections.h>
> > #include <asm/cacheflush.h>
> > #include <asm/disassemble.h>
> > +#include <asm/machdep.h>
> >
> > #define KVM_MAGIC_PAGE (-4096L)
> > #define magic_var(x) KVM_MAGIC_PAGE + offsetof(struct
> > kvm_vcpu_arch_shared, x) @@ -571,6 +572,30 @@ static __init void
> kvm_free_tmp(void)
> > }
> > }
> >
> > +static void kvm_hcall_ev_idle(void)
> > +{
> > + ulong in[8];
> > + ulong out[8];
> > +
> > + current_thread_info()->local_flags |= _TLF_NAPPING;
> > + local_irq_enable();
> > + kvm_hypercall(in, out, HC_VENDOR_EPAPR | HC_EV_IDLE); }
>
> I think this has to be done in assembly -- otherwise it's not safe for
> the interrupt handler to return directly to LR.
>
> > +static int kvm_para_ev_has_idle(void) {
> > + struct device_node *hyper_node;
> > +
> > + hyper_node = of_find_node_by_path("/hypervisor");
> > + if (!hyper_node)
> > + return 0;
> > +
> > + if (of_get_property(hyper_node, "has-idle", NULL))
> > + return 1;
> > +
> > + return 0;
> > +}
>
> Since this is standardized in ePAPR, can we move it out of kvm.c an into
> generic code to work with any hypervisor that sets has-idle? Likewise
> with kvm_para_setup().
>
Do you mean we scan and parse hypervisor node in early_init_devtree()?
Thanks,
Yu
^ permalink raw reply [flat|nested] 24+ messages in thread* Re: [PATCH 2/2] KVM: PPC: epapr: Install ev_idle hcall for paravirt
2012-01-04 9:23 ` [PATCH 2/2] KVM: PPC: epapr: Install ev_idle hcall for paravirt guest linux Liu Yu-B13201
@ 2012-01-04 19:21 ` Scott Wood
-1 siblings, 0 replies; 24+ messages in thread
From: Scott Wood @ 2012-01-04 19:21 UTC (permalink / raw)
To: Liu Yu-B13201
Cc: Wood Scott-B07421, agraf@suse.de, kvm-ppc@vger.kernel.org,
kvm@vger.kernel.org
On 01/04/2012 03:23 AM, Liu Yu-B13201 wrote:
>
>
>> -----Original Message-----
>> From: Wood Scott-B07421
>> Sent: Tuesday, January 03, 2012 2:23 AM
>> To: Liu Yu-B13201
>> Cc: agraf@suse.de; kvm-ppc@vger.kernel.org; kvm@vger.kernel.org
>> Subject: Re: [PATCH 2/2] KVM: PPC: epapr: Install ev_idle hcall for
>> paravirt guest linux
>>
>> Since this is standardized in ePAPR, can we move it out of kvm.c an into
>> generic code to work with any hypervisor that sets has-idle? Likewise
>> with kvm_para_setup().
>>
>
> Do you mean we scan and parse hypervisor node in early_init_devtree()?
No, just have a separate initcall for enabling ePAPR paravirt features.
-Scott
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 2/2] KVM: PPC: epapr: Install ev_idle hcall for paravirt guest linux
@ 2012-01-04 19:21 ` Scott Wood
0 siblings, 0 replies; 24+ messages in thread
From: Scott Wood @ 2012-01-04 19:21 UTC (permalink / raw)
To: Liu Yu-B13201
Cc: Wood Scott-B07421, agraf@suse.de, kvm-ppc@vger.kernel.org,
kvm@vger.kernel.org
On 01/04/2012 03:23 AM, Liu Yu-B13201 wrote:
>
>
>> -----Original Message-----
>> From: Wood Scott-B07421
>> Sent: Tuesday, January 03, 2012 2:23 AM
>> To: Liu Yu-B13201
>> Cc: agraf@suse.de; kvm-ppc@vger.kernel.org; kvm@vger.kernel.org
>> Subject: Re: [PATCH 2/2] KVM: PPC: epapr: Install ev_idle hcall for
>> paravirt guest linux
>>
>> Since this is standardized in ePAPR, can we move it out of kvm.c an into
>> generic code to work with any hypervisor that sets has-idle? Likewise
>> with kvm_para_setup().
>>
>
> Do you mean we scan and parse hypervisor node in early_init_devtree()?
No, just have a separate initcall for enabling ePAPR paravirt features.
-Scott
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 1/2] KVM: PPC: epapr: Add idle hcall support for host
2011-12-31 6:16 ` Liu Yu
@ 2012-01-02 18:17 ` Scott Wood
-1 siblings, 0 replies; 24+ messages in thread
From: Scott Wood @ 2012-01-02 18:17 UTC (permalink / raw)
To: Liu Yu; +Cc: agraf, kvm-ppc, kvm
On 12/31/2011 12:16 AM, Liu Yu wrote:
> Add a new field opt_feature in struct kvm_ppc_pvinfo
> to tell userspace whether it support hcall idle.
>
> Signed-off-by: Liu Yu <yu.liu@freescale.com>
> ---
> arch/powerpc/include/asm/kvm_para.h | 18 ++++++++++++++----
> arch/powerpc/kvm/powerpc.c | 9 +++++++++
> include/linux/kvm.h | 5 ++++-
> 3 files changed, 27 insertions(+), 5 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/kvm_para.h b/arch/powerpc/include/asm/kvm_para.h
> index 50533f9..0686377 100644
> --- a/arch/powerpc/include/asm/kvm_para.h
> +++ b/arch/powerpc/include/asm/kvm_para.h
> @@ -40,17 +40,27 @@ struct kvm_vcpu_arch_shared {
> __u32 sr[16];
> };
>
> +#ifdef __KERNEL__
> +
> #define KVM_SC_MAGIC_R0 0x4b564d21 /* "KVM!" */
> -#define HC_VENDOR_KVM (42 << 16)
> +
> +#include <asm/epapr_hcalls.h>
> +
> +/* ePAPR Hypercall Vendor ID */
> +#define HC_VENDOR_EPAPR (EV_EPAPR_VENDOR_ID << 16)
> +#define HC_VENDOR_KVM (EV_KVM_VENDOR_ID << 16)
> +
> +/* ePAPR Hypercall Token */
> +#define HC_EV_IDLE EV_IDLE
> +
> +/* ePAPR Hypercall Return Codes */
> #define HC_EV_SUCCESS 0
> -#define HC_EV_UNIMPLEMENTED 12
> +#define HC_EV_UNIMPLEMENTED EV_UNIMPLEMENTED
>
> #define KVM_FEATURE_MAGIC_PAGE 1
>
> #define KVM_MAGIC_FEAT_SR (1 << 0)
>
> -#ifdef __KERNEL__
> -
We don't want this stuff to be kernel-only.
> diff --git a/include/linux/kvm.h b/include/linux/kvm.h
> index c107fae..5af21f3 100644
> --- a/include/linux/kvm.h
> +++ b/include/linux/kvm.h
> @@ -426,9 +426,12 @@ struct kvm_ppc_pvinfo {
> /* out */
> __u32 flags;
> __u32 hcall[4];
> - __u8 pad[108];
> + __u32 opt_features;
> + __u8 pad[104];
> };
If the features weren't "opt"ional, there wouldn't be a bitmap of them. :-)
Just call it "features". Or maybe just use "flags"?
-Scott
^ permalink raw reply [flat|nested] 24+ messages in thread* Re: [PATCH 1/2] KVM: PPC: epapr: Add idle hcall support for host
@ 2012-01-02 18:17 ` Scott Wood
0 siblings, 0 replies; 24+ messages in thread
From: Scott Wood @ 2012-01-02 18:17 UTC (permalink / raw)
To: Liu Yu; +Cc: agraf, kvm-ppc, kvm
On 12/31/2011 12:16 AM, Liu Yu wrote:
> Add a new field opt_feature in struct kvm_ppc_pvinfo
> to tell userspace whether it support hcall idle.
>
> Signed-off-by: Liu Yu <yu.liu@freescale.com>
> ---
> arch/powerpc/include/asm/kvm_para.h | 18 ++++++++++++++----
> arch/powerpc/kvm/powerpc.c | 9 +++++++++
> include/linux/kvm.h | 5 ++++-
> 3 files changed, 27 insertions(+), 5 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/kvm_para.h b/arch/powerpc/include/asm/kvm_para.h
> index 50533f9..0686377 100644
> --- a/arch/powerpc/include/asm/kvm_para.h
> +++ b/arch/powerpc/include/asm/kvm_para.h
> @@ -40,17 +40,27 @@ struct kvm_vcpu_arch_shared {
> __u32 sr[16];
> };
>
> +#ifdef __KERNEL__
> +
> #define KVM_SC_MAGIC_R0 0x4b564d21 /* "KVM!" */
> -#define HC_VENDOR_KVM (42 << 16)
> +
> +#include <asm/epapr_hcalls.h>
> +
> +/* ePAPR Hypercall Vendor ID */
> +#define HC_VENDOR_EPAPR (EV_EPAPR_VENDOR_ID << 16)
> +#define HC_VENDOR_KVM (EV_KVM_VENDOR_ID << 16)
> +
> +/* ePAPR Hypercall Token */
> +#define HC_EV_IDLE EV_IDLE
> +
> +/* ePAPR Hypercall Return Codes */
> #define HC_EV_SUCCESS 0
> -#define HC_EV_UNIMPLEMENTED 12
> +#define HC_EV_UNIMPLEMENTED EV_UNIMPLEMENTED
>
> #define KVM_FEATURE_MAGIC_PAGE 1
>
> #define KVM_MAGIC_FEAT_SR (1 << 0)
>
> -#ifdef __KERNEL__
> -
We don't want this stuff to be kernel-only.
> diff --git a/include/linux/kvm.h b/include/linux/kvm.h
> index c107fae..5af21f3 100644
> --- a/include/linux/kvm.h
> +++ b/include/linux/kvm.h
> @@ -426,9 +426,12 @@ struct kvm_ppc_pvinfo {
> /* out */
> __u32 flags;
> __u32 hcall[4];
> - __u8 pad[108];
> + __u32 opt_features;
> + __u8 pad[104];
> };
If the features weren't "opt"ional, there wouldn't be a bitmap of them. :-)
Just call it "features". Or maybe just use "flags"?
-Scott
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 1/2] KVM: PPC: epapr: Add idle hcall support for host
2011-12-31 6:16 ` Liu Yu
@ 2012-01-03 14:01 ` Avi Kivity
-1 siblings, 0 replies; 24+ messages in thread
From: Avi Kivity @ 2012-01-03 14:01 UTC (permalink / raw)
To: Liu Yu; +Cc: agraf, kvm-ppc, kvm
On 12/31/2011 08:16 AM, Liu Yu wrote:
> Add a new field opt_feature in struct kvm_ppc_pvinfo
> to tell userspace whether it support hcall idle.
>
> diff --git a/include/linux/kvm.h b/include/linux/kvm.h
> index c107fae..5af21f3 100644
> --- a/include/linux/kvm.h
> +++ b/include/linux/kvm.h
> @@ -426,9 +426,12 @@ struct kvm_ppc_pvinfo {
> /* out */
> __u32 flags;
> __u32 hcall[4];
> - __u8 pad[108];
> + __u32 opt_features;
> + __u8 pad[104];
> };
>
> +#define KVM_PPC_PVINFO_HAS_EV_IDLE (1<<0)
> +
>
Needs to be documented, plus a KVM_CAP so userspace can discover that
this feature is available,
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 24+ messages in thread* Re: [PATCH 1/2] KVM: PPC: epapr: Add idle hcall support for host
@ 2012-01-03 14:01 ` Avi Kivity
0 siblings, 0 replies; 24+ messages in thread
From: Avi Kivity @ 2012-01-03 14:01 UTC (permalink / raw)
To: Liu Yu; +Cc: agraf, kvm-ppc, kvm
On 12/31/2011 08:16 AM, Liu Yu wrote:
> Add a new field opt_feature in struct kvm_ppc_pvinfo
> to tell userspace whether it support hcall idle.
>
> diff --git a/include/linux/kvm.h b/include/linux/kvm.h
> index c107fae..5af21f3 100644
> --- a/include/linux/kvm.h
> +++ b/include/linux/kvm.h
> @@ -426,9 +426,12 @@ struct kvm_ppc_pvinfo {
> /* out */
> __u32 flags;
> __u32 hcall[4];
> - __u8 pad[108];
> + __u32 opt_features;
> + __u8 pad[104];
> };
>
> +#define KVM_PPC_PVINFO_HAS_EV_IDLE (1<<0)
> +
>
Needs to be documented, plus a KVM_CAP so userspace can discover that
this feature is available,
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 24+ messages in thread* Re: [PATCH 1/2] KVM: PPC: epapr: Add idle hcall support for host
2012-01-03 14:01 ` Avi Kivity
@ 2012-01-03 14:13 ` Alexander Graf
-1 siblings, 0 replies; 24+ messages in thread
From: Alexander Graf @ 2012-01-03 14:13 UTC (permalink / raw)
To: Avi Kivity; +Cc: Liu Yu, kvm-ppc, kvm
On 03.01.2012, at 15:01, Avi Kivity wrote:
> On 12/31/2011 08:16 AM, Liu Yu wrote:
>> Add a new field opt_feature in struct kvm_ppc_pvinfo
>> to tell userspace whether it support hcall idle.
>>
>> diff --git a/include/linux/kvm.h b/include/linux/kvm.h
>> index c107fae..5af21f3 100644
>> --- a/include/linux/kvm.h
>> +++ b/include/linux/kvm.h
>> @@ -426,9 +426,12 @@ struct kvm_ppc_pvinfo {
>> /* out */
>> __u32 flags;
>> __u32 hcall[4];
>> - __u8 pad[108];
>> + __u32 opt_features;
>> + __u8 pad[104];
>> };
>>
>> +#define KVM_PPC_PVINFO_HAS_EV_IDLE (1<<0)
>> +
>>
>
> Needs to be documented, plus a KVM_CAP so userspace can discover that
> this feature is available,
Not if we put the bit into flags. Then user space can just check the flags bitmap and know that it's there regardless of capabilities, because older kernels will set the bit to 0.
Alex
^ permalink raw reply [flat|nested] 24+ messages in thread* Re: [PATCH 1/2] KVM: PPC: epapr: Add idle hcall support for host
@ 2012-01-03 14:13 ` Alexander Graf
0 siblings, 0 replies; 24+ messages in thread
From: Alexander Graf @ 2012-01-03 14:13 UTC (permalink / raw)
To: Avi Kivity; +Cc: Liu Yu, kvm-ppc, kvm
On 03.01.2012, at 15:01, Avi Kivity wrote:
> On 12/31/2011 08:16 AM, Liu Yu wrote:
>> Add a new field opt_feature in struct kvm_ppc_pvinfo
>> to tell userspace whether it support hcall idle.
>>
>> diff --git a/include/linux/kvm.h b/include/linux/kvm.h
>> index c107fae..5af21f3 100644
>> --- a/include/linux/kvm.h
>> +++ b/include/linux/kvm.h
>> @@ -426,9 +426,12 @@ struct kvm_ppc_pvinfo {
>> /* out */
>> __u32 flags;
>> __u32 hcall[4];
>> - __u8 pad[108];
>> + __u32 opt_features;
>> + __u8 pad[104];
>> };
>>
>> +#define KVM_PPC_PVINFO_HAS_EV_IDLE (1<<0)
>> +
>>
>
> Needs to be documented, plus a KVM_CAP so userspace can discover that
> this feature is available,
Not if we put the bit into flags. Then user space can just check the flags bitmap and know that it's there regardless of capabilities, because older kernels will set the bit to 0.
Alex
^ permalink raw reply [flat|nested] 24+ messages in thread* Re: [PATCH 1/2] KVM: PPC: epapr: Add idle hcall support for host
2012-01-03 14:13 ` Alexander Graf
@ 2012-01-04 10:33 ` Avi Kivity
-1 siblings, 0 replies; 24+ messages in thread
From: Avi Kivity @ 2012-01-04 10:33 UTC (permalink / raw)
To: Alexander Graf; +Cc: Liu Yu, kvm-ppc, kvm
On 01/03/2012 04:13 PM, Alexander Graf wrote:
> On 03.01.2012, at 15:01, Avi Kivity wrote:
>
> > On 12/31/2011 08:16 AM, Liu Yu wrote:
> >> Add a new field opt_feature in struct kvm_ppc_pvinfo
> >> to tell userspace whether it support hcall idle.
> >>
> >> diff --git a/include/linux/kvm.h b/include/linux/kvm.h
> >> index c107fae..5af21f3 100644
> >> --- a/include/linux/kvm.h
> >> +++ b/include/linux/kvm.h
> >> @@ -426,9 +426,12 @@ struct kvm_ppc_pvinfo {
> >> /* out */
> >> __u32 flags;
> >> __u32 hcall[4];
> >> - __u8 pad[108];
> >> + __u32 opt_features;
> >> + __u8 pad[104];
> >> };
> >>
> >> +#define KVM_PPC_PVINFO_HAS_EV_IDLE (1<<0)
> >> +
> >>
> >
> > Needs to be documented, plus a KVM_CAP so userspace can discover that
> > this feature is available,
>
> Not if we put the bit into flags. Then user space can just check the flags bitmap and know that it's there regardless of capabilities, because older kernels will set the bit to 0.
It needs to detect that opt_features is available during compile time
(qemu copies headers, but we don't want to force everyone to do that).
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 24+ messages in thread* Re: [PATCH 1/2] KVM: PPC: epapr: Add idle hcall support for host
@ 2012-01-04 10:33 ` Avi Kivity
0 siblings, 0 replies; 24+ messages in thread
From: Avi Kivity @ 2012-01-04 10:33 UTC (permalink / raw)
To: Alexander Graf; +Cc: Liu Yu, kvm-ppc, kvm
On 01/03/2012 04:13 PM, Alexander Graf wrote:
> On 03.01.2012, at 15:01, Avi Kivity wrote:
>
> > On 12/31/2011 08:16 AM, Liu Yu wrote:
> >> Add a new field opt_feature in struct kvm_ppc_pvinfo
> >> to tell userspace whether it support hcall idle.
> >>
> >> diff --git a/include/linux/kvm.h b/include/linux/kvm.h
> >> index c107fae..5af21f3 100644
> >> --- a/include/linux/kvm.h
> >> +++ b/include/linux/kvm.h
> >> @@ -426,9 +426,12 @@ struct kvm_ppc_pvinfo {
> >> /* out */
> >> __u32 flags;
> >> __u32 hcall[4];
> >> - __u8 pad[108];
> >> + __u32 opt_features;
> >> + __u8 pad[104];
> >> };
> >>
> >> +#define KVM_PPC_PVINFO_HAS_EV_IDLE (1<<0)
> >> +
> >>
> >
> > Needs to be documented, plus a KVM_CAP so userspace can discover that
> > this feature is available,
>
> Not if we put the bit into flags. Then user space can just check the flags bitmap and know that it's there regardless of capabilities, because older kernels will set the bit to 0.
It needs to detect that opt_features is available during compile time
(qemu copies headers, but we don't want to force everyone to do that).
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 24+ messages in thread* Re: [PATCH 1/2] KVM: PPC: epapr: Add idle hcall support for host
2012-01-04 10:33 ` Avi Kivity
@ 2012-01-04 12:04 ` Alexander Graf
-1 siblings, 0 replies; 24+ messages in thread
From: Alexander Graf @ 2012-01-04 12:04 UTC (permalink / raw)
To: Avi Kivity; +Cc: Liu Yu, kvm-ppc@vger.kernel.org, kvm@vger.kernel.org
On 04.01.2012, at 11:33, Avi Kivity <avi@redhat.com> wrote:
> On 01/03/2012 04:13 PM, Alexander Graf wrote:
>> On 03.01.2012, at 15:01, Avi Kivity wrote:
>>
>>> On 12/31/2011 08:16 AM, Liu Yu wrote:
>>>> Add a new field opt_feature in struct kvm_ppc_pvinfo
>>>> to tell userspace whether it support hcall idle.
>>>>
>>>> diff --git a/include/linux/kvm.h b/include/linux/kvm.h
>>>> index c107fae..5af21f3 100644
>>>> --- a/include/linux/kvm.h
>>>> +++ b/include/linux/kvm.h
>>>> @@ -426,9 +426,12 @@ struct kvm_ppc_pvinfo {
>>>> /* out */
>>>> __u32 flags;
>>>> __u32 hcall[4];
>>>> - __u8 pad[108];
>>>> + __u32 opt_features;
>>>> + __u8 pad[104];
>>>> };
>>>>
>>>> +#define KVM_PPC_PVINFO_HAS_EV_IDLE (1<<0)
>>>> +
>>>>
>>>
>>> Needs to be documented, plus a KVM_CAP so userspace can discover that
>>> this feature is available,
>>
>> Not if we put the bit into flags. Then user space can just check the flags bitmap and know that it's there regardless of capabilities, because older kernels will set the bit to 0.
>
> It needs to detect that opt_features is available during compile time
> (qemu copies headers, but we don't want to force everyone to do that).
The point is that we don't need opt_features. We already have a fearure bitmap in the struct.
Alex
^ permalink raw reply [flat|nested] 24+ messages in thread* Re: [PATCH 1/2] KVM: PPC: epapr: Add idle hcall support for host
@ 2012-01-04 12:04 ` Alexander Graf
0 siblings, 0 replies; 24+ messages in thread
From: Alexander Graf @ 2012-01-04 12:04 UTC (permalink / raw)
To: Avi Kivity; +Cc: Liu Yu, kvm-ppc@vger.kernel.org, kvm@vger.kernel.org
On 04.01.2012, at 11:33, Avi Kivity <avi@redhat.com> wrote:
> On 01/03/2012 04:13 PM, Alexander Graf wrote:
>> On 03.01.2012, at 15:01, Avi Kivity wrote:
>>
>>> On 12/31/2011 08:16 AM, Liu Yu wrote:
>>>> Add a new field opt_feature in struct kvm_ppc_pvinfo
>>>> to tell userspace whether it support hcall idle.
>>>>
>>>> diff --git a/include/linux/kvm.h b/include/linux/kvm.h
>>>> index c107fae..5af21f3 100644
>>>> --- a/include/linux/kvm.h
>>>> +++ b/include/linux/kvm.h
>>>> @@ -426,9 +426,12 @@ struct kvm_ppc_pvinfo {
>>>> /* out */
>>>> __u32 flags;
>>>> __u32 hcall[4];
>>>> - __u8 pad[108];
>>>> + __u32 opt_features;
>>>> + __u8 pad[104];
>>>> };
>>>>
>>>> +#define KVM_PPC_PVINFO_HAS_EV_IDLE (1<<0)
>>>> +
>>>>
>>>
>>> Needs to be documented, plus a KVM_CAP so userspace can discover that
>>> this feature is available,
>>
>> Not if we put the bit into flags. Then user space can just check the flags bitmap and know that it's there regardless of capabilities, because older kernels will set the bit to 0.
>
> It needs to detect that opt_features is available during compile time
> (qemu copies headers, but we don't want to force everyone to do that).
The point is that we don't need opt_features. We already have a fearure bitmap in the struct.
Alex
^ permalink raw reply [flat|nested] 24+ messages in thread* Re: [PATCH 1/2] KVM: PPC: epapr: Add idle hcall support for host
2012-01-04 12:04 ` Alexander Graf
@ 2012-01-04 12:11 ` Avi Kivity
-1 siblings, 0 replies; 24+ messages in thread
From: Avi Kivity @ 2012-01-04 12:11 UTC (permalink / raw)
To: Alexander Graf; +Cc: Liu Yu, kvm-ppc@vger.kernel.org, kvm@vger.kernel.org
On 01/04/2012 02:04 PM, Alexander Graf wrote:
> >> Not if we put the bit into flags. Then user space can just check the flags bitmap and know that it's there regardless of capabilities, because older kernels will set the bit to 0.
> >
> > It needs to detect that opt_features is available during compile time
> > (qemu copies headers, but we don't want to force everyone to do that).
>
> The point is that we don't need opt_features. We already have a fearure bitmap in the struct.
Ah! Okay then.
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 1/2] KVM: PPC: epapr: Add idle hcall support for host
@ 2012-01-04 12:11 ` Avi Kivity
0 siblings, 0 replies; 24+ messages in thread
From: Avi Kivity @ 2012-01-04 12:11 UTC (permalink / raw)
To: Alexander Graf; +Cc: Liu Yu, kvm-ppc@vger.kernel.org, kvm@vger.kernel.org
On 01/04/2012 02:04 PM, Alexander Graf wrote:
> >> Not if we put the bit into flags. Then user space can just check the flags bitmap and know that it's there regardless of capabilities, because older kernels will set the bit to 0.
> >
> > It needs to detect that opt_features is available during compile time
> > (qemu copies headers, but we don't want to force everyone to do that).
>
> The point is that we don't need opt_features. We already have a fearure bitmap in the struct.
Ah! Okay then.
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH 1/2] KVM: PPC: epapr: Add idle hcall support for host
2012-01-04 12:04 ` Alexander Graf
@ 2012-01-04 19:25 ` Scott Wood
-1 siblings, 0 replies; 24+ messages in thread
From: Scott Wood @ 2012-01-04 19:25 UTC (permalink / raw)
To: Alexander Graf
Cc: Avi Kivity, Liu Yu, kvm-ppc@vger.kernel.org, kvm@vger.kernel.org
On 01/04/2012 06:04 AM, Alexander Graf wrote:
>
>
> On 04.01.2012, at 11:33, Avi Kivity <avi@redhat.com> wrote:
>
>> On 01/03/2012 04:13 PM, Alexander Graf wrote:
>>> On 03.01.2012, at 15:01, Avi Kivity wrote:
>>>
>>>> On 12/31/2011 08:16 AM, Liu Yu wrote:
>>>>> Add a new field opt_feature in struct kvm_ppc_pvinfo
>>>>> to tell userspace whether it support hcall idle.
>>>>>
>>>>> diff --git a/include/linux/kvm.h b/include/linux/kvm.h
>>>>> index c107fae..5af21f3 100644
>>>>> --- a/include/linux/kvm.h
>>>>> +++ b/include/linux/kvm.h
>>>>> @@ -426,9 +426,12 @@ struct kvm_ppc_pvinfo {
>>>>> /* out */
>>>>> __u32 flags;
>>>>> __u32 hcall[4];
>>>>> - __u8 pad[108];
>>>>> + __u32 opt_features;
>>>>> + __u8 pad[104];
>>>>> };
>>>>>
>>>>> +#define KVM_PPC_PVINFO_HAS_EV_IDLE (1<<0)
>>>>> +
>>>>>
>>>>
>>>> Needs to be documented, plus a KVM_CAP so userspace can discover that
>>>> this feature is available,
>>>
>>> Not if we put the bit into flags. Then user space can just check the flags bitmap and know that it's there regardless of capabilities, because older kernels will set the bit to 0.
>>
>> It needs to detect that opt_features is available during compile time
>> (qemu copies headers, but we don't want to force everyone to do that).
>
> The point is that we don't need opt_features. We already have a fearure bitmap in the struct.
Even if we did for whatever reason want a new field, the entire struct
is zeroed currently, so we only need a flag if we need to distinguish
"field is zero" from "field is not valid".
-Scott
^ permalink raw reply [flat|nested] 24+ messages in thread* Re: [PATCH 1/2] KVM: PPC: epapr: Add idle hcall support for host
@ 2012-01-04 19:25 ` Scott Wood
0 siblings, 0 replies; 24+ messages in thread
From: Scott Wood @ 2012-01-04 19:25 UTC (permalink / raw)
To: Alexander Graf
Cc: Avi Kivity, Liu Yu, kvm-ppc@vger.kernel.org, kvm@vger.kernel.org
On 01/04/2012 06:04 AM, Alexander Graf wrote:
>
>
> On 04.01.2012, at 11:33, Avi Kivity <avi@redhat.com> wrote:
>
>> On 01/03/2012 04:13 PM, Alexander Graf wrote:
>>> On 03.01.2012, at 15:01, Avi Kivity wrote:
>>>
>>>> On 12/31/2011 08:16 AM, Liu Yu wrote:
>>>>> Add a new field opt_feature in struct kvm_ppc_pvinfo
>>>>> to tell userspace whether it support hcall idle.
>>>>>
>>>>> diff --git a/include/linux/kvm.h b/include/linux/kvm.h
>>>>> index c107fae..5af21f3 100644
>>>>> --- a/include/linux/kvm.h
>>>>> +++ b/include/linux/kvm.h
>>>>> @@ -426,9 +426,12 @@ struct kvm_ppc_pvinfo {
>>>>> /* out */
>>>>> __u32 flags;
>>>>> __u32 hcall[4];
>>>>> - __u8 pad[108];
>>>>> + __u32 opt_features;
>>>>> + __u8 pad[104];
>>>>> };
>>>>>
>>>>> +#define KVM_PPC_PVINFO_HAS_EV_IDLE (1<<0)
>>>>> +
>>>>>
>>>>
>>>> Needs to be documented, plus a KVM_CAP so userspace can discover that
>>>> this feature is available,
>>>
>>> Not if we put the bit into flags. Then user space can just check the flags bitmap and know that it's there regardless of capabilities, because older kernels will set the bit to 0.
>>
>> It needs to detect that opt_features is available during compile time
>> (qemu copies headers, but we don't want to force everyone to do that).
>
> The point is that we don't need opt_features. We already have a fearure bitmap in the struct.
Even if we did for whatever reason want a new field, the entire struct
is zeroed currently, so we only need a flag if we need to distinguish
"field is zero" from "field is not valid".
-Scott
^ permalink raw reply [flat|nested] 24+ messages in thread