diff options
author | Cornelia Huck <cornelia.huck@de.ibm.com> | 2013-02-07 07:20:52 -0500 |
---|---|---|
committer | Gleb Natapov <gleb@redhat.com> | 2013-02-11 03:49:55 -0500 |
commit | 79fd50c67f91136add9726fb7719b57a66c6f763 (patch) | |
tree | 447eae3cd59084024517a7d00f3a5902c67da6bb /arch/s390 | |
parent | 24db2734ad8123b6858ca98d690483ecdcceebb5 (diff) |
KVM: s390: Fix handling of iscs.
There are two ways to express an interruption subclass:
- As a bitmask, as used in cr6.
- As a number, as used in the I/O interruption word.
Unfortunately, we have treated the I/O interruption word as if it
contained the bitmask as well, which went unnoticed so far as
- (not-yet-released) qemu made the same mistake, and
- Linux guest kernels don't check the isc value in the I/O interruption
word for subchannel interrupts.
Make sure that we treat the I/O interruption word correctly.
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Gleb Natapov <gleb@redhat.com>
Diffstat (limited to 'arch/s390')
-rw-r--r-- | arch/s390/kvm/interrupt.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c index 9a128357fd15..2f6ccb065c4a 100644 --- a/arch/s390/kvm/interrupt.c +++ b/arch/s390/kvm/interrupt.c | |||
@@ -55,6 +55,13 @@ static int psw_interrupts_disabled(struct kvm_vcpu *vcpu) | |||
55 | return 1; | 55 | return 1; |
56 | } | 56 | } |
57 | 57 | ||
58 | static u64 int_word_to_isc_bits(u32 int_word) | ||
59 | { | ||
60 | u8 isc = (int_word & 0x38000000) >> 27; | ||
61 | |||
62 | return (0x80 >> isc) << 24; | ||
63 | } | ||
64 | |||
58 | static int __interrupt_is_deliverable(struct kvm_vcpu *vcpu, | 65 | static int __interrupt_is_deliverable(struct kvm_vcpu *vcpu, |
59 | struct kvm_s390_interrupt_info *inti) | 66 | struct kvm_s390_interrupt_info *inti) |
60 | { | 67 | { |
@@ -96,7 +103,8 @@ static int __interrupt_is_deliverable(struct kvm_vcpu *vcpu, | |||
96 | case KVM_S390_INT_IO_MIN...KVM_S390_INT_IO_MAX: | 103 | case KVM_S390_INT_IO_MIN...KVM_S390_INT_IO_MAX: |
97 | if (psw_ioint_disabled(vcpu)) | 104 | if (psw_ioint_disabled(vcpu)) |
98 | return 0; | 105 | return 0; |
99 | if (vcpu->arch.sie_block->gcr[6] & inti->io.io_int_word) | 106 | if (vcpu->arch.sie_block->gcr[6] & |
107 | int_word_to_isc_bits(inti->io.io_int_word)) | ||
100 | return 1; | 108 | return 1; |
101 | return 0; | 109 | return 0; |
102 | default: | 110 | default: |
@@ -724,7 +732,8 @@ struct kvm_s390_interrupt_info *kvm_s390_get_io_int(struct kvm *kvm, | |||
724 | list_for_each_entry(iter, &fi->list, list) { | 732 | list_for_each_entry(iter, &fi->list, list) { |
725 | if (!is_ioint(iter->type)) | 733 | if (!is_ioint(iter->type)) |
726 | continue; | 734 | continue; |
727 | if (cr6 && ((cr6 & iter->io.io_int_word) == 0)) | 735 | if (cr6 && |
736 | ((cr6 & int_word_to_isc_bits(iter->io.io_int_word)) == 0)) | ||
728 | continue; | 737 | continue; |
729 | if (schid) { | 738 | if (schid) { |
730 | if (((schid & 0x00000000ffff0000) >> 16) != | 739 | if (((schid & 0x00000000ffff0000) >> 16) != |
@@ -811,11 +820,14 @@ int kvm_s390_inject_vm(struct kvm *kvm, | |||
811 | if (!is_ioint(inti->type)) | 820 | if (!is_ioint(inti->type)) |
812 | list_add_tail(&inti->list, &fi->list); | 821 | list_add_tail(&inti->list, &fi->list); |
813 | else { | 822 | else { |
823 | u64 isc_bits = int_word_to_isc_bits(inti->io.io_int_word); | ||
824 | |||
814 | /* Keep I/O interrupts sorted in isc order. */ | 825 | /* Keep I/O interrupts sorted in isc order. */ |
815 | list_for_each_entry(iter, &fi->list, list) { | 826 | list_for_each_entry(iter, &fi->list, list) { |
816 | if (!is_ioint(iter->type)) | 827 | if (!is_ioint(iter->type)) |
817 | continue; | 828 | continue; |
818 | if (iter->io.io_int_word <= inti->io.io_int_word) | 829 | if (int_word_to_isc_bits(iter->io.io_int_word) |
830 | <= isc_bits) | ||
819 | continue; | 831 | continue; |
820 | break; | 832 | break; |
821 | } | 833 | } |