aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/s390/include/asm/kvm_host.h59
-rw-r--r--arch/s390/kvm/interrupt.c25
-rw-r--r--arch/s390/kvm/kvm-s390.h3
3 files changed, 80 insertions, 7 deletions
diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h
index b61ac418b510..90905ca93725 100644
--- a/arch/s390/include/asm/kvm_host.h
+++ b/arch/s390/include/asm/kvm_host.h
@@ -186,13 +186,58 @@ struct kvm_vcpu_stat {
186 u32 diagnose_9c; 186 u32 diagnose_9c;
187}; 187};
188 188
189#define PGM_OPERATION 0x01 189#define PGM_OPERATION 0x01
190#define PGM_PRIVILEGED_OP 0x02 190#define PGM_PRIVILEGED_OP 0x02
191#define PGM_EXECUTE 0x03 191#define PGM_EXECUTE 0x03
192#define PGM_PROTECTION 0x04 192#define PGM_PROTECTION 0x04
193#define PGM_ADDRESSING 0x05 193#define PGM_ADDRESSING 0x05
194#define PGM_SPECIFICATION 0x06 194#define PGM_SPECIFICATION 0x06
195#define PGM_DATA 0x07 195#define PGM_DATA 0x07
196#define PGM_FIXED_POINT_OVERFLOW 0x08
197#define PGM_FIXED_POINT_DIVIDE 0x09
198#define PGM_DECIMAL_OVERFLOW 0x0a
199#define PGM_DECIMAL_DIVIDE 0x0b
200#define PGM_HFP_EXPONENT_OVERFLOW 0x0c
201#define PGM_HFP_EXPONENT_UNDERFLOW 0x0d
202#define PGM_HFP_SIGNIFICANCE 0x0e
203#define PGM_HFP_DIVIDE 0x0f
204#define PGM_SEGMENT_TRANSLATION 0x10
205#define PGM_PAGE_TRANSLATION 0x11
206#define PGM_TRANSLATION_SPEC 0x12
207#define PGM_SPECIAL_OPERATION 0x13
208#define PGM_OPERAND 0x15
209#define PGM_TRACE_TABEL 0x16
210#define PGM_SPACE_SWITCH 0x1c
211#define PGM_HFP_SQUARE_ROOT 0x1d
212#define PGM_PC_TRANSLATION_SPEC 0x1f
213#define PGM_AFX_TRANSLATION 0x20
214#define PGM_ASX_TRANSLATION 0x21
215#define PGM_LX_TRANSLATION 0x22
216#define PGM_EX_TRANSLATION 0x23
217#define PGM_PRIMARY_AUTHORITY 0x24
218#define PGM_SECONDARY_AUTHORITY 0x25
219#define PGM_LFX_TRANSLATION 0x26
220#define PGM_LSX_TRANSLATION 0x27
221#define PGM_ALET_SPECIFICATION 0x28
222#define PGM_ALEN_TRANSLATION 0x29
223#define PGM_ALE_SEQUENCE 0x2a
224#define PGM_ASTE_VALIDITY 0x2b
225#define PGM_ASTE_SEQUENCE 0x2c
226#define PGM_EXTENDED_AUTHORITY 0x2d
227#define PGM_LSTE_SEQUENCE 0x2e
228#define PGM_ASTE_INSTANCE 0x2f
229#define PGM_STACK_FULL 0x30
230#define PGM_STACK_EMPTY 0x31
231#define PGM_STACK_SPECIFICATION 0x32
232#define PGM_STACK_TYPE 0x33
233#define PGM_STACK_OPERATION 0x34
234#define PGM_ASCE_TYPE 0x38
235#define PGM_REGION_FIRST_TRANS 0x39
236#define PGM_REGION_SECOND_TRANS 0x3a
237#define PGM_REGION_THIRD_TRANS 0x3b
238#define PGM_MONITOR 0x40
239#define PGM_PER 0x80
240#define PGM_CRYPTO_OPERATION 0x119
196 241
197struct kvm_s390_interrupt_info { 242struct kvm_s390_interrupt_info {
198 struct list_head list; 243 struct list_head list;
diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c
index 200a8f9390b6..a44c68990cf4 100644
--- a/arch/s390/kvm/interrupt.c
+++ b/arch/s390/kvm/interrupt.c
@@ -660,6 +660,31 @@ int kvm_s390_inject_program_int(struct kvm_vcpu *vcpu, u16 code)
660 return 0; 660 return 0;
661} 661}
662 662
663int kvm_s390_inject_prog_irq(struct kvm_vcpu *vcpu,
664 struct kvm_s390_pgm_info *pgm_info)
665{
666 struct kvm_s390_local_interrupt *li = &vcpu->arch.local_int;
667 struct kvm_s390_interrupt_info *inti;
668
669 inti = kzalloc(sizeof(*inti), GFP_KERNEL);
670 if (!inti)
671 return -ENOMEM;
672
673 VCPU_EVENT(vcpu, 3, "inject: prog irq %d (from kernel)",
674 pgm_info->code);
675 trace_kvm_s390_inject_vcpu(vcpu->vcpu_id, KVM_S390_PROGRAM_INT,
676 pgm_info->code, 0, 1);
677
678 inti->type = KVM_S390_PROGRAM_INT;
679 memcpy(&inti->pgm, pgm_info, sizeof(inti->pgm));
680 spin_lock_bh(&li->lock);
681 list_add(&inti->list, &li->list);
682 atomic_set(&li->active, 1);
683 BUG_ON(waitqueue_active(li->wq));
684 spin_unlock_bh(&li->lock);
685 return 0;
686}
687
663struct kvm_s390_interrupt_info *kvm_s390_get_io_int(struct kvm *kvm, 688struct kvm_s390_interrupt_info *kvm_s390_get_io_int(struct kvm *kvm,
664 u64 cr6, u64 schid) 689 u64 cr6, u64 schid)
665{ 690{
diff --git a/arch/s390/kvm/kvm-s390.h b/arch/s390/kvm/kvm-s390.h
index 460ccd828bbb..25a8b8478918 100644
--- a/arch/s390/kvm/kvm-s390.h
+++ b/arch/s390/kvm/kvm-s390.h
@@ -165,6 +165,9 @@ bool kvm_s390_cmma_enabled(struct kvm *kvm);
165 165
166/* implemented in diag.c */ 166/* implemented in diag.c */
167int kvm_s390_handle_diag(struct kvm_vcpu *vcpu); 167int kvm_s390_handle_diag(struct kvm_vcpu *vcpu);
168/* implemented in interrupt.c */
169int kvm_s390_inject_prog_irq(struct kvm_vcpu *vcpu,
170 struct kvm_s390_pgm_info *pgm_info);
168 171
169/* implemented in interrupt.c */ 172/* implemented in interrupt.c */
170int kvm_cpu_has_interrupt(struct kvm_vcpu *vcpu); 173int kvm_cpu_has_interrupt(struct kvm_vcpu *vcpu);