aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390
diff options
context:
space:
mode:
authorHeiko Carstens <heiko.carstens@de.ibm.com>2013-03-05 07:14:46 -0500
committerMarcelo Tosatti <mtosatti@redhat.com>2013-03-07 14:21:22 -0500
commit7c959e82ac331396d05e7118a48c7c1debbefdf8 (patch)
treed9e704195d9d3b5cb4c0cd2f03b5baed609bc199 /arch/s390
parentf9dc72e82d32cc9fe40d1dea7709d434bba2d4a9 (diff)
s390/kvm: cleanup/fix handle_tpi()
- add missing specification exception check - remove one level of indentation - use defines instead of magic numbers Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Diffstat (limited to 'arch/s390')
-rw-r--r--arch/s390/kvm/priv.c54
1 files changed, 30 insertions, 24 deletions
diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c
index cb07147cda73..d64382c1ed61 100644
--- a/arch/s390/kvm/priv.c
+++ b/arch/s390/kvm/priv.c
@@ -14,6 +14,7 @@
14#include <linux/kvm.h> 14#include <linux/kvm.h>
15#include <linux/gfp.h> 15#include <linux/gfp.h>
16#include <linux/errno.h> 16#include <linux/errno.h>
17#include <asm/asm-offsets.h>
17#include <asm/current.h> 18#include <asm/current.h>
18#include <asm/debug.h> 19#include <asm/debug.h>
19#include <asm/ebcdic.h> 20#include <asm/ebcdic.h>
@@ -129,39 +130,44 @@ static int handle_skey(struct kvm_vcpu *vcpu)
129 130
130static int handle_tpi(struct kvm_vcpu *vcpu) 131static int handle_tpi(struct kvm_vcpu *vcpu)
131{ 132{
132 u64 addr;
133 struct kvm_s390_interrupt_info *inti; 133 struct kvm_s390_interrupt_info *inti;
134 u64 addr;
134 int cc; 135 int cc;
135 136
136 addr = kvm_s390_get_base_disp_s(vcpu); 137 addr = kvm_s390_get_base_disp_s(vcpu);
137 138 if (addr & 3) {
139 kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
140 goto out;
141 }
142 cc = 0;
138 inti = kvm_s390_get_io_int(vcpu->kvm, vcpu->run->s.regs.crs[6], 0); 143 inti = kvm_s390_get_io_int(vcpu->kvm, vcpu->run->s.regs.crs[6], 0);
139 if (inti) { 144 if (!inti)
140 if (addr) { 145 goto no_interrupt;
141 /* 146 cc = 1;
142 * Store the two-word I/O interruption code into the 147 if (addr) {
143 * provided area. 148 /*
144 */ 149 * Store the two-word I/O interruption code into the
145 put_guest(vcpu, inti->io.subchannel_id, (u16 *) addr); 150 * provided area.
146 put_guest(vcpu, inti->io.subchannel_nr, (u16 *) (addr + 2)); 151 */
147 put_guest(vcpu, inti->io.io_int_parm, (u32 *) (addr + 4)); 152 put_guest(vcpu, inti->io.subchannel_id, (u16 *) addr);
148 } else { 153 put_guest(vcpu, inti->io.subchannel_nr, (u16 *) (addr + 2));
149 /* 154 put_guest(vcpu, inti->io.io_int_parm, (u32 *) (addr + 4));
150 * Store the three-word I/O interruption code into 155 } else {
151 * the appropriate lowcore area. 156 /*
152 */ 157 * Store the three-word I/O interruption code into
153 put_guest(vcpu, inti->io.subchannel_id, (u16 *) 184); 158 * the appropriate lowcore area.
154 put_guest(vcpu, inti->io.subchannel_nr, (u16 *) 186); 159 */
155 put_guest(vcpu, inti->io.io_int_parm, (u32 *) 188); 160 put_guest(vcpu, inti->io.subchannel_id, (u16 *) __LC_SUBCHANNEL_ID);
156 put_guest(vcpu, inti->io.io_int_word, (u32 *) 192); 161 put_guest(vcpu, inti->io.subchannel_nr, (u16 *) __LC_SUBCHANNEL_NR);
157 } 162 put_guest(vcpu, inti->io.io_int_parm, (u32 *) __LC_IO_INT_PARM);
158 cc = 1; 163 put_guest(vcpu, inti->io.io_int_word, (u32 *) __LC_IO_INT_WORD);
159 } else 164 }
160 cc = 0;
161 kfree(inti); 165 kfree(inti);
166no_interrupt:
162 /* Set condition code and we're done. */ 167 /* Set condition code and we're done. */
163 vcpu->arch.sie_block->gpsw.mask &= ~(3ul << 44); 168 vcpu->arch.sie_block->gpsw.mask &= ~(3ul << 44);
164 vcpu->arch.sie_block->gpsw.mask |= (cc & 3ul) << 44; 169 vcpu->arch.sie_block->gpsw.mask |= (cc & 3ul) << 44;
170out:
165 return 0; 171 return 0;
166} 172}
167 173