aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ia64/kvm
diff options
context:
space:
mode:
authorXiantao Zhang <xiantao.zhang@intel.com>2008-08-27 21:34:08 -0400
committerAvi Kivity <avi@qumranet.com>2008-10-15 04:15:25 -0400
commit8c4b537da7eceab1246695df21beea10f180d460 (patch)
treebf4ed41aaa1c5920e681b16f04e0ac5ba4b5fda3 /arch/ia64/kvm
parentfb4616f43148c5b3f3e453a47657572d1bda39ee (diff)
KVM: ia64: Implement kvm_arch_vcpu_ioctl_{set,get}_mpstate
Two ioctl arch functions are added to set vcpu's smp state. Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'arch/ia64/kvm')
-rw-r--r--arch/ia64/kvm/kvm-ia64.c37
1 files changed, 35 insertions, 2 deletions
diff --git a/arch/ia64/kvm/kvm-ia64.c b/arch/ia64/kvm/kvm-ia64.c
index cd0d1a7284b7..7ad759e34295 100644
--- a/arch/ia64/kvm/kvm-ia64.c
+++ b/arch/ia64/kvm/kvm-ia64.c
@@ -179,6 +179,7 @@ int kvm_dev_ioctl_check_extension(long ext)
179 switch (ext) { 179 switch (ext) {
180 case KVM_CAP_IRQCHIP: 180 case KVM_CAP_IRQCHIP:
181 case KVM_CAP_USER_MEMORY: 181 case KVM_CAP_USER_MEMORY:
182 case KVM_CAP_MP_STATE:
182 183
183 r = 1; 184 r = 1;
184 break; 185 break;
@@ -1789,11 +1790,43 @@ int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu)
1789int kvm_arch_vcpu_ioctl_get_mpstate(struct kvm_vcpu *vcpu, 1790int kvm_arch_vcpu_ioctl_get_mpstate(struct kvm_vcpu *vcpu,
1790 struct kvm_mp_state *mp_state) 1791 struct kvm_mp_state *mp_state)
1791{ 1792{
1792 return -EINVAL; 1793 vcpu_load(vcpu);
1794 mp_state->mp_state = vcpu->arch.mp_state;
1795 vcpu_put(vcpu);
1796 return 0;
1797}
1798
1799static int vcpu_reset(struct kvm_vcpu *vcpu)
1800{
1801 int r;
1802 long psr;
1803 local_irq_save(psr);
1804 r = kvm_insert_vmm_mapping(vcpu);
1805 if (r)
1806 goto fail;
1807
1808 vcpu->arch.launched = 0;
1809 kvm_arch_vcpu_uninit(vcpu);
1810 r = kvm_arch_vcpu_init(vcpu);
1811 if (r)
1812 goto fail;
1813
1814 kvm_purge_vmm_mapping(vcpu);
1815 r = 0;
1816fail:
1817 local_irq_restore(psr);
1818 return r;
1793} 1819}
1794 1820
1795int kvm_arch_vcpu_ioctl_set_mpstate(struct kvm_vcpu *vcpu, 1821int kvm_arch_vcpu_ioctl_set_mpstate(struct kvm_vcpu *vcpu,
1796 struct kvm_mp_state *mp_state) 1822 struct kvm_mp_state *mp_state)
1797{ 1823{
1798 return -EINVAL; 1824 int r = 0;
1825
1826 vcpu_load(vcpu);
1827 vcpu->arch.mp_state = mp_state->mp_state;
1828 if (vcpu->arch.mp_state == KVM_MP_STATE_UNINITIALIZED)
1829 r = vcpu_reset(vcpu);
1830 vcpu_put(vcpu);
1831 return r;
1799} 1832}