kvm-s390.c (241e3ec0faf5ab1a0d9b1f6c43eefa919fb9c112) | kvm-s390.c (2f8311c912ab67084ce3657096df601c87f49a58) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2/* 3 * hosting IBM Z kernel virtual machines (s390x) 4 * 5 * Copyright IBM Corp. 2008, 2017 6 * 7 * Author(s): Carsten Otte <cotte@de.ibm.com> 8 * Christian Borntraeger <borntraeger@de.ibm.com> --- 1070 unchanged lines hidden (view full) --- 1079 mutex_unlock(&kvm->lock); 1080 return ret; 1081} 1082 1083static int kvm_s390_set_processor_feat(struct kvm *kvm, 1084 struct kvm_device_attr *attr) 1085{ 1086 struct kvm_s390_vm_cpu_feat data; | 1// SPDX-License-Identifier: GPL-2.0 2/* 3 * hosting IBM Z kernel virtual machines (s390x) 4 * 5 * Copyright IBM Corp. 2008, 2017 6 * 7 * Author(s): Carsten Otte <cotte@de.ibm.com> 8 * Christian Borntraeger <borntraeger@de.ibm.com> --- 1070 unchanged lines hidden (view full) --- 1079 mutex_unlock(&kvm->lock); 1080 return ret; 1081} 1082 1083static int kvm_s390_set_processor_feat(struct kvm *kvm, 1084 struct kvm_device_attr *attr) 1085{ 1086 struct kvm_s390_vm_cpu_feat data; |
1087 int ret = -EBUSY; | |
1088 1089 if (copy_from_user(&data, (void __user *)attr->addr, sizeof(data))) 1090 return -EFAULT; 1091 if (!bitmap_subset((unsigned long *) data.feat, 1092 kvm_s390_available_cpu_feat, 1093 KVM_S390_VM_CPU_FEAT_NR_BITS)) 1094 return -EINVAL; 1095 1096 mutex_lock(&kvm->lock); | 1087 1088 if (copy_from_user(&data, (void __user *)attr->addr, sizeof(data))) 1089 return -EFAULT; 1090 if (!bitmap_subset((unsigned long *) data.feat, 1091 kvm_s390_available_cpu_feat, 1092 KVM_S390_VM_CPU_FEAT_NR_BITS)) 1093 return -EINVAL; 1094 1095 mutex_lock(&kvm->lock); |
1097 if (!kvm->created_vcpus) { 1098 bitmap_copy(kvm->arch.cpu_feat, (unsigned long *) data.feat, 1099 KVM_S390_VM_CPU_FEAT_NR_BITS); 1100 ret = 0; | 1096 if (kvm->created_vcpus) { 1097 mutex_unlock(&kvm->lock); 1098 return -EBUSY; |
1101 } | 1099 } |
1100 bitmap_copy(kvm->arch.cpu_feat, (unsigned long *) data.feat, 1101 KVM_S390_VM_CPU_FEAT_NR_BITS); |
|
1102 mutex_unlock(&kvm->lock); | 1102 mutex_unlock(&kvm->lock); |
1103 return ret; | 1103 VM_EVENT(kvm, 3, "SET: guest feat: 0x%16.16llx.0x%16.16llx.0x%16.16llx", 1104 data.feat[0], 1105 data.feat[1], 1106 data.feat[2]); 1107 return 0; |
1104} 1105 1106static int kvm_s390_set_processor_subfunc(struct kvm *kvm, 1107 struct kvm_device_attr *attr) 1108{ 1109 /* 1110 * Once supported by kernel + hw, we have to store the subfunctions 1111 * in kvm->arch and remember that user space configured them. --- 85 unchanged lines hidden (view full) --- 1197 struct kvm_device_attr *attr) 1198{ 1199 struct kvm_s390_vm_cpu_feat data; 1200 1201 bitmap_copy((unsigned long *) data.feat, kvm->arch.cpu_feat, 1202 KVM_S390_VM_CPU_FEAT_NR_BITS); 1203 if (copy_to_user((void __user *)attr->addr, &data, sizeof(data))) 1204 return -EFAULT; | 1108} 1109 1110static int kvm_s390_set_processor_subfunc(struct kvm *kvm, 1111 struct kvm_device_attr *attr) 1112{ 1113 /* 1114 * Once supported by kernel + hw, we have to store the subfunctions 1115 * in kvm->arch and remember that user space configured them. --- 85 unchanged lines hidden (view full) --- 1201 struct kvm_device_attr *attr) 1202{ 1203 struct kvm_s390_vm_cpu_feat data; 1204 1205 bitmap_copy((unsigned long *) data.feat, kvm->arch.cpu_feat, 1206 KVM_S390_VM_CPU_FEAT_NR_BITS); 1207 if (copy_to_user((void __user *)attr->addr, &data, sizeof(data))) 1208 return -EFAULT; |
1209 VM_EVENT(kvm, 3, "GET: guest feat: 0x%16.16llx.0x%16.16llx.0x%16.16llx", 1210 data.feat[0], 1211 data.feat[1], 1212 data.feat[2]); |
|
1205 return 0; 1206} 1207 1208static int kvm_s390_get_machine_feat(struct kvm *kvm, 1209 struct kvm_device_attr *attr) 1210{ 1211 struct kvm_s390_vm_cpu_feat data; 1212 1213 bitmap_copy((unsigned long *) data.feat, 1214 kvm_s390_available_cpu_feat, 1215 KVM_S390_VM_CPU_FEAT_NR_BITS); 1216 if (copy_to_user((void __user *)attr->addr, &data, sizeof(data))) 1217 return -EFAULT; | 1213 return 0; 1214} 1215 1216static int kvm_s390_get_machine_feat(struct kvm *kvm, 1217 struct kvm_device_attr *attr) 1218{ 1219 struct kvm_s390_vm_cpu_feat data; 1220 1221 bitmap_copy((unsigned long *) data.feat, 1222 kvm_s390_available_cpu_feat, 1223 KVM_S390_VM_CPU_FEAT_NR_BITS); 1224 if (copy_to_user((void __user *)attr->addr, &data, sizeof(data))) 1225 return -EFAULT; |
1226 VM_EVENT(kvm, 3, "GET: host feat: 0x%16.16llx.0x%16.16llx.0x%16.16llx", 1227 data.feat[0], 1228 data.feat[1], 1229 data.feat[2]); |
|
1218 return 0; 1219} 1220 1221static int kvm_s390_get_processor_subfunc(struct kvm *kvm, 1222 struct kvm_device_attr *attr) 1223{ 1224 /* 1225 * Once we can actually configure subfunctions (kernel + hw support), --- 2722 unchanged lines hidden --- | 1230 return 0; 1231} 1232 1233static int kvm_s390_get_processor_subfunc(struct kvm *kvm, 1234 struct kvm_device_attr *attr) 1235{ 1236 /* 1237 * Once we can actually configure subfunctions (kernel + hw support), --- 2722 unchanged lines hidden --- |