Re: [PATCH 2/4] kvm-s390: KVM_GET/SET_ONEREG for s390

2012-06-05 Thread Alexander Graf

On 15.05.2012, at 14:15, Christian Borntraeger wrote:

 From: Carsten Otte co...@de.ibm.com
 
 This patch enables KVM_CAP_ONE_REG for s390 and implements stubs
 for KVM_GET/SET_ONE_REG. This is based on the ppc implementation.
 
 Signed-off-by: Carsten Otte co...@de.ibm.com
 Signed-off-by: Christian Borntraeger borntrae...@de.ibm.com

One day we should make this be a true generic interface and not let arch 
specific code handle it all on their own. But for now, it's good as it is :).

Acked-by: Alexander Graf ag...@suse.de


Alex

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/4] kvm-s390: KVM_GET/SET_ONEREG for s390

2012-05-15 Thread Christian Borntraeger
From: Carsten Otte co...@de.ibm.com

This patch enables KVM_CAP_ONE_REG for s390 and implements stubs
for KVM_GET/SET_ONE_REG. This is based on the ppc implementation.

Signed-off-by: Carsten Otte co...@de.ibm.com
Signed-off-by: Christian Borntraeger borntrae...@de.ibm.com
---
 arch/s390/kvm/kvm-s390.c |   38 ++
 1 file changed, 38 insertions(+)

diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index 5c761bf..894b3e4 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -135,6 +135,7 @@ int kvm_dev_ioctl_check_extension(long ext)
case KVM_CAP_S390_UCONTROL:
 #endif
case KVM_CAP_SYNC_REGS:
+   case KVM_CAP_ONE_REG:
r = 1;
break;
case KVM_CAP_NR_VCPUS:
@@ -439,6 +440,31 @@ int kvm_arch_vcpu_should_kick(struct kvm_vcpu *vcpu)
return 0;
 }
 
+static int kvm_arch_vcpu_ioctl_get_one_reg(struct kvm_vcpu *vcpu,
+  struct kvm_one_reg *reg)
+{
+   int r = -EINVAL;
+
+   switch (reg-id) {
+   default:
+   break;
+   }
+
+   return r;
+}
+
+static int kvm_arch_vcpu_ioctl_set_one_reg(struct kvm_vcpu *vcpu,
+  struct kvm_one_reg *reg)
+{
+   int r = -EINVAL;
+
+   switch (reg-id) {
+   default:
+   break;
+   }
+
+   return r;
+}
 
 static int kvm_arch_vcpu_ioctl_initial_reset(struct kvm_vcpu *vcpu)
 {
@@ -770,6 +796,18 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
case KVM_S390_INITIAL_RESET:
r = kvm_arch_vcpu_ioctl_initial_reset(vcpu);
break;
+   case KVM_SET_ONE_REG:
+   case KVM_GET_ONE_REG: {
+   struct kvm_one_reg reg;
+   r = -EFAULT;
+   if (copy_from_user(reg, argp, sizeof(reg)))
+   break;
+   if (ioctl == KVM_SET_ONE_REG)
+   r = kvm_arch_vcpu_ioctl_set_one_reg(vcpu, reg);
+   else
+   r = kvm_arch_vcpu_ioctl_get_one_reg(vcpu, reg);
+   break;
+   }
 #ifdef CONFIG_KVM_S390_UCONTROL
case KVM_S390_UCAS_MAP: {
struct kvm_s390_ucas_mapping ucasmap;
-- 
1.7.10.2

--
To unsubscribe from this list: send the line unsubscribe kvm in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html