Skip to content

Commit 67cf68b

Browse files
efarmanborntraeger
authored andcommitted
KVM: s390: Add a routine for setting userspace CPU state
This capability exists, but we don't record anything when userspace enables it. Let's refactor that code so that a note can be made in the debug logs that it was enabled. Signed-off-by: Eric Farman <[email protected]> Reviewed-by: Thomas Huth <[email protected]> Reviewed-by: Claudio Imbrenda <[email protected]> Reviewed-by: David Hildenbrand <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Christian Borntraeger <[email protected]>
1 parent 8eeba19 commit 67cf68b

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

arch/s390/kvm/kvm-s390.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2487,8 +2487,8 @@ long kvm_arch_vm_ioctl(struct file *filp,
24872487
case KVM_S390_PV_COMMAND: {
24882488
struct kvm_pv_cmd args;
24892489

2490-
/* protvirt means user sigp */
2491-
kvm->arch.user_cpu_state_ctrl = 1;
2490+
/* protvirt means user cpu state */
2491+
kvm_s390_set_user_cpu_state_ctrl(kvm);
24922492
r = 0;
24932493
if (!is_prot_virt_host()) {
24942494
r = -EINVAL;
@@ -3802,7 +3802,7 @@ int kvm_arch_vcpu_ioctl_set_mpstate(struct kvm_vcpu *vcpu,
38023802
vcpu_load(vcpu);
38033803

38043804
/* user space knows about this interface - let it control the state */
3805-
vcpu->kvm->arch.user_cpu_state_ctrl = 1;
3805+
kvm_s390_set_user_cpu_state_ctrl(vcpu->kvm);
38063806

38073807
switch (mp_state->mp_state) {
38083808
case KVM_MP_STATE_STOPPED:

arch/s390/kvm/kvm-s390.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,15 @@ static inline int kvm_s390_user_cpu_state_ctrl(struct kvm *kvm)
208208
return kvm->arch.user_cpu_state_ctrl != 0;
209209
}
210210

211+
static inline void kvm_s390_set_user_cpu_state_ctrl(struct kvm *kvm)
212+
{
213+
if (kvm->arch.user_cpu_state_ctrl)
214+
return;
215+
216+
VM_EVENT(kvm, 3, "%s", "ENABLE: Userspace CPU state control");
217+
kvm->arch.user_cpu_state_ctrl = 1;
218+
}
219+
211220
/* implemented in pv.c */
212221
int kvm_s390_pv_destroy_cpu(struct kvm_vcpu *vcpu, u16 *rc, u16 *rrc);
213222
int kvm_s390_pv_create_cpu(struct kvm_vcpu *vcpu, u16 *rc, u16 *rrc);

0 commit comments

Comments
 (0)