aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390
diff options
context:
space:
mode:
authorJens Freimann <jfrei@linux.vnet.ibm.com>2014-05-14 11:14:46 -0400
committerChristian Borntraeger <borntraeger@de.ibm.com>2014-05-30 03:39:37 -0400
commit22ff4a3366e6fed80205b427d8fb52020cd9020a (patch)
treee5a6084bbe035cc02835d1190dcf54c510c2c812 /arch/s390
parenta0465f9ae4758207264a1318bb8aed617c0ea959 (diff)
KVM: s390: clean up interrupt injection in sigp code
We have all the logic to inject interrupts available in kvm_s390_inject_vcpu(), so let's use it instead of injecting irqs manually to the list in sigp code. SIGP stop is special because we have to check the action_flags before injecting the interrupt. As the action_flags are not available in kvm_s390_inject_vcpu() we leave the code for the stop order code untouched for now. Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com> Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Diffstat (limited to 'arch/s390')
-rw-r--r--arch/s390/kvm/sigp.c56
1 files changed, 18 insertions, 38 deletions
diff --git a/arch/s390/kvm/sigp.c b/arch/s390/kvm/sigp.c
index d0341d2e54b1..43079a48cc98 100644
--- a/arch/s390/kvm/sigp.c
+++ b/arch/s390/kvm/sigp.c
@@ -54,33 +54,23 @@ static int __sigp_sense(struct kvm_vcpu *vcpu, u16 cpu_addr,
54 54
55static int __sigp_emergency(struct kvm_vcpu *vcpu, u16 cpu_addr) 55static int __sigp_emergency(struct kvm_vcpu *vcpu, u16 cpu_addr)
56{ 56{
57 struct kvm_s390_local_interrupt *li; 57 struct kvm_s390_interrupt s390int = {
58 struct kvm_s390_interrupt_info *inti; 58 .type = KVM_S390_INT_EMERGENCY,
59 .parm = vcpu->vcpu_id,
60 };
59 struct kvm_vcpu *dst_vcpu = NULL; 61 struct kvm_vcpu *dst_vcpu = NULL;
62 int rc = 0;
60 63
61 if (cpu_addr < KVM_MAX_VCPUS) 64 if (cpu_addr < KVM_MAX_VCPUS)
62 dst_vcpu = kvm_get_vcpu(vcpu->kvm, cpu_addr); 65 dst_vcpu = kvm_get_vcpu(vcpu->kvm, cpu_addr);
63 if (!dst_vcpu) 66 if (!dst_vcpu)
64 return SIGP_CC_NOT_OPERATIONAL; 67 return SIGP_CC_NOT_OPERATIONAL;
65 68
66 inti = kzalloc(sizeof(*inti), GFP_KERNEL); 69 rc = kvm_s390_inject_vcpu(dst_vcpu, &s390int);
67 if (!inti) 70 if (!rc)
68 return -ENOMEM; 71 VCPU_EVENT(vcpu, 4, "sent sigp emerg to cpu %x", cpu_addr);
69
70 inti->type = KVM_S390_INT_EMERGENCY;
71 inti->emerg.code = vcpu->vcpu_id;
72 72
73 li = &dst_vcpu->arch.local_int; 73 return rc ? rc : SIGP_CC_ORDER_CODE_ACCEPTED;
74 spin_lock_bh(&li->lock);
75 list_add_tail(&inti->list, &li->list);
76 atomic_set(&li->active, 1);
77 atomic_set_mask(CPUSTAT_EXT_INT, li->cpuflags);
78 if (waitqueue_active(li->wq))
79 wake_up_interruptible(li->wq);
80 spin_unlock_bh(&li->lock);
81 VCPU_EVENT(vcpu, 4, "sent sigp emerg to cpu %x", cpu_addr);
82
83 return SIGP_CC_ORDER_CODE_ACCEPTED;
84} 74}
85 75
86static int __sigp_conditional_emergency(struct kvm_vcpu *vcpu, u16 cpu_addr, 76static int __sigp_conditional_emergency(struct kvm_vcpu *vcpu, u16 cpu_addr,
@@ -116,33 +106,23 @@ static int __sigp_conditional_emergency(struct kvm_vcpu *vcpu, u16 cpu_addr,
116 106
117static int __sigp_external_call(struct kvm_vcpu *vcpu, u16 cpu_addr) 107static int __sigp_external_call(struct kvm_vcpu *vcpu, u16 cpu_addr)
118{ 108{
119 struct kvm_s390_local_interrupt *li; 109 struct kvm_s390_interrupt s390int = {
120 struct kvm_s390_interrupt_info *inti; 110 .type = KVM_S390_INT_EXTERNAL_CALL,
111 .parm = vcpu->vcpu_id,
112 };
121 struct kvm_vcpu *dst_vcpu = NULL; 113 struct kvm_vcpu *dst_vcpu = NULL;
114 int rc;
122 115
123 if (cpu_addr < KVM_MAX_VCPUS) 116 if (cpu_addr < KVM_MAX_VCPUS)
124 dst_vcpu = kvm_get_vcpu(vcpu->kvm, cpu_addr); 117 dst_vcpu = kvm_get_vcpu(vcpu->kvm, cpu_addr);
125 if (!dst_vcpu) 118 if (!dst_vcpu)
126 return SIGP_CC_NOT_OPERATIONAL; 119 return SIGP_CC_NOT_OPERATIONAL;
127 120
128 inti = kzalloc(sizeof(*inti), GFP_KERNEL); 121 rc = kvm_s390_inject_vcpu(dst_vcpu, &s390int);
129 if (!inti) 122 if (!rc)
130 return -ENOMEM; 123 VCPU_EVENT(vcpu, 4, "sent sigp ext call to cpu %x", cpu_addr);
131
132 inti->type = KVM_S390_INT_EXTERNAL_CALL;
133 inti->extcall.code = vcpu->vcpu_id;
134
135 li = &dst_vcpu->arch.local_int;
136 spin_lock_bh(&li->lock);
137 list_add_tail(&inti->list, &li->list);
138 atomic_set(&li->active, 1);
139 atomic_set_mask(CPUSTAT_EXT_INT, li->cpuflags);
140 if (waitqueue_active(li->wq))
141 wake_up_interruptible(li->wq);
142 spin_unlock_bh(&li->lock);
143 VCPU_EVENT(vcpu, 4, "sent sigp ext call to cpu %x", cpu_addr);
144 124
145 return SIGP_CC_ORDER_CODE_ACCEPTED; 125 return rc ? rc : SIGP_CC_ORDER_CODE_ACCEPTED;
146} 126}
147 127
148static int __inject_sigp_stop(struct kvm_s390_local_interrupt *li, int action) 128static int __inject_sigp_stop(struct kvm_s390_local_interrupt *li, int action)