* KVM/IA64: Implement kvm_arch_vcpu_ioctl_{set,get}_mpstate.
@ 2008-08-28 3:52 Zhang, Xiantao
2008-09-01 10:54 ` Avi Kivity
0 siblings, 1 reply; 2+ messages in thread
From: Zhang, Xiantao @ 2008-08-28 3:52 UTC (permalink / raw)
To: kvm-ia64, kvm-devel@lists.sourceforge.net; +Cc: Avi Kivity
[-- Attachment #1: Type: text/plain, Size: 1862 bytes --]
>From 74cc2bedddc4f97d8901a43d5ac65f938156e2df Mon Sep 17 00:00:00 2001
From: Xiantao Zhang <xiantao.zhang@intel.com>
Date: Thu, 28 Aug 2008 09:34:08 +0800
Subject: [PATCH] KVM/IA64: Implement
kvm_arch_vcpu_ioctl_{set,get}_mpstate.
Two ioctl arch functions are added to set/get vcpu's mpstate.
Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com>
---
arch/ia64/kvm/kvm-ia64.c | 37 +++++++++++++++++++++++++++++++++++--
1 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/arch/ia64/kvm/kvm-ia64.c b/arch/ia64/kvm/kvm-ia64.c
index 7a37d06..8a3b5fc 100644
--- a/arch/ia64/kvm/kvm-ia64.c
+++ b/arch/ia64/kvm/kvm-ia64.c
@@ -184,6 +184,7 @@ int kvm_dev_ioctl_check_extension(long ext)
switch (ext) {
case KVM_CAP_IRQCHIP:
case KVM_CAP_USER_MEMORY:
+ case KVM_CAP_MP_STATE:
r = 1;
break;
@@ -1794,11 +1795,43 @@ int kvm_arch_vcpu_runnable(struct kvm_vcpu
*vcpu)
int kvm_arch_vcpu_ioctl_get_mpstate(struct kvm_vcpu *vcpu,
struct kvm_mp_state *mp_state)
{
- return -EINVAL;
+ vcpu_load(vcpu);
+ mp_state->mp_state = vcpu->arch.mp_state;
+ vcpu_put(vcpu);
+ return 0;
+}
+
+static int vcpu_reset(struct kvm_vcpu *vcpu)
+{
+ int r;
+ long psr;
+ local_irq_save(psr);
+ r = kvm_insert_vmm_mapping(vcpu);
+ if (r)
+ goto fail;
+
+ vcpu->arch.launched = 0;
+ kvm_arch_vcpu_uninit(vcpu);
+ r = kvm_arch_vcpu_init(vcpu);
+ if (r)
+ goto fail;
+
+ kvm_purge_vmm_mapping(vcpu);
+ r = 0;
+fail:
+ local_irq_restore(psr);
+ return r;
}
int kvm_arch_vcpu_ioctl_set_mpstate(struct kvm_vcpu *vcpu,
struct kvm_mp_state *mp_state)
{
- return -EINVAL;
+ int r = 0;
+
+ vcpu_load(vcpu);
+ vcpu->arch.mp_state = mp_state->mp_state;
+ if (vcpu->arch.mp_state == KVM_MP_STATE_UNINITIALIZED)
+ r = vcpu_reset(vcpu);
+ vcpu_put(vcpu);
+ return r;
}
--
1.5.1
[-- Attachment #2: 0001-KVM-IA64-Implement-kvm_arch_vcpu_ioctl_-set-get-_mp.patch --]
[-- Type: application/octet-stream, Size: 1785 bytes --]
From 74cc2bedddc4f97d8901a43d5ac65f938156e2df Mon Sep 17 00:00:00 2001
From: Xiantao Zhang <xiantao.zhang@intel.com>
Date: Thu, 28 Aug 2008 09:34:08 +0800
Subject: [PATCH] KVM/IA64: Implement kvm_arch_vcpu_ioctl_{set,get}_mpstate.
Two ioctl arch functions are added to set vcpu's mpstate.
Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com>
---
arch/ia64/kvm/kvm-ia64.c | 37 +++++++++++++++++++++++++++++++++++--
1 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/arch/ia64/kvm/kvm-ia64.c b/arch/ia64/kvm/kvm-ia64.c
index 7a37d06..8a3b5fc 100644
--- a/arch/ia64/kvm/kvm-ia64.c
+++ b/arch/ia64/kvm/kvm-ia64.c
@@ -184,6 +184,7 @@ int kvm_dev_ioctl_check_extension(long ext)
switch (ext) {
case KVM_CAP_IRQCHIP:
case KVM_CAP_USER_MEMORY:
+ case KVM_CAP_MP_STATE:
r = 1;
break;
@@ -1794,11 +1795,43 @@ int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu)
int kvm_arch_vcpu_ioctl_get_mpstate(struct kvm_vcpu *vcpu,
struct kvm_mp_state *mp_state)
{
- return -EINVAL;
+ vcpu_load(vcpu);
+ mp_state->mp_state = vcpu->arch.mp_state;
+ vcpu_put(vcpu);
+ return 0;
+}
+
+static int vcpu_reset(struct kvm_vcpu *vcpu)
+{
+ int r;
+ long psr;
+ local_irq_save(psr);
+ r = kvm_insert_vmm_mapping(vcpu);
+ if (r)
+ goto fail;
+
+ vcpu->arch.launched = 0;
+ kvm_arch_vcpu_uninit(vcpu);
+ r = kvm_arch_vcpu_init(vcpu);
+ if (r)
+ goto fail;
+
+ kvm_purge_vmm_mapping(vcpu);
+ r = 0;
+fail:
+ local_irq_restore(psr);
+ return r;
}
int kvm_arch_vcpu_ioctl_set_mpstate(struct kvm_vcpu *vcpu,
struct kvm_mp_state *mp_state)
{
- return -EINVAL;
+ int r = 0;
+
+ vcpu_load(vcpu);
+ vcpu->arch.mp_state = mp_state->mp_state;
+ if (vcpu->arch.mp_state == KVM_MP_STATE_UNINITIALIZED)
+ r = vcpu_reset(vcpu);
+ vcpu_put(vcpu);
+ return r;
}
--
1.5.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: KVM/IA64: Implement kvm_arch_vcpu_ioctl_{set,get}_mpstate.
2008-08-28 3:52 KVM/IA64: Implement kvm_arch_vcpu_ioctl_{set,get}_mpstate Zhang, Xiantao
@ 2008-09-01 10:54 ` Avi Kivity
0 siblings, 0 replies; 2+ messages in thread
From: Avi Kivity @ 2008-09-01 10:54 UTC (permalink / raw)
To: Zhang, Xiantao; +Cc: kvm-ia64, kvm-devel@lists.sourceforge.net
Zhang, Xiantao wrote:
> From 74cc2bedddc4f97d8901a43d5ac65f938156e2df Mon Sep 17 00:00:00 2001
> From: Xiantao Zhang <xiantao.zhang@intel.com>
> Date: Thu, 28 Aug 2008 09:34:08 +0800
> Subject: [PATCH] KVM/IA64: Implement
> kvm_arch_vcpu_ioctl_{set,get}_mpstate.
>
> Two ioctl arch functions are added to set/get vcpu's mpstate.
>
Applied, thanks.
--
error compiling committee.c: too many arguments to function
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-09-01 10:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-28 3:52 KVM/IA64: Implement kvm_arch_vcpu_ioctl_{set,get}_mpstate Zhang, Xiantao
2008-09-01 10:54 ` Avi Kivity
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox