Commit 7c959e82 authored by Heiko Carstens's avatar Heiko Carstens Committed by Marcelo Tosatti

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: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
Reviewed-by: default avatarCornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
Signed-off-by: default avatarChristian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: default avatarMarcelo Tosatti <mtosatti@redhat.com>
parent f9dc72e8
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include <linux/kvm.h> #include <linux/kvm.h>
#include <linux/gfp.h> #include <linux/gfp.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <asm/asm-offsets.h>
#include <asm/current.h> #include <asm/current.h>
#include <asm/debug.h> #include <asm/debug.h>
#include <asm/ebcdic.h> #include <asm/ebcdic.h>
...@@ -129,39 +130,44 @@ static int handle_skey(struct kvm_vcpu *vcpu) ...@@ -129,39 +130,44 @@ static int handle_skey(struct kvm_vcpu *vcpu)
static int handle_tpi(struct kvm_vcpu *vcpu) static int handle_tpi(struct kvm_vcpu *vcpu)
{ {
u64 addr;
struct kvm_s390_interrupt_info *inti; struct kvm_s390_interrupt_info *inti;
u64 addr;
int cc; int cc;
addr = kvm_s390_get_base_disp_s(vcpu); addr = kvm_s390_get_base_disp_s(vcpu);
if (addr & 3) {
kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
goto out;
}
cc = 0;
inti = kvm_s390_get_io_int(vcpu->kvm, vcpu->run->s.regs.crs[6], 0); inti = kvm_s390_get_io_int(vcpu->kvm, vcpu->run->s.regs.crs[6], 0);
if (inti) { if (!inti)
if (addr) { goto no_interrupt;
/* cc = 1;
* Store the two-word I/O interruption code into the if (addr) {
* provided area. /*
*/ * Store the two-word I/O interruption code into the
put_guest(vcpu, inti->io.subchannel_id, (u16 *) addr); * provided area.
put_guest(vcpu, inti->io.subchannel_nr, (u16 *) (addr + 2)); */
put_guest(vcpu, inti->io.io_int_parm, (u32 *) (addr + 4)); put_guest(vcpu, inti->io.subchannel_id, (u16 *) addr);
} else { put_guest(vcpu, inti->io.subchannel_nr, (u16 *) (addr + 2));
/* put_guest(vcpu, inti->io.io_int_parm, (u32 *) (addr + 4));
* Store the three-word I/O interruption code into } else {
* the appropriate lowcore area. /*
*/ * Store the three-word I/O interruption code into
put_guest(vcpu, inti->io.subchannel_id, (u16 *) 184); * the appropriate lowcore area.
put_guest(vcpu, inti->io.subchannel_nr, (u16 *) 186); */
put_guest(vcpu, inti->io.io_int_parm, (u32 *) 188); put_guest(vcpu, inti->io.subchannel_id, (u16 *) __LC_SUBCHANNEL_ID);
put_guest(vcpu, inti->io.io_int_word, (u32 *) 192); put_guest(vcpu, inti->io.subchannel_nr, (u16 *) __LC_SUBCHANNEL_NR);
} put_guest(vcpu, inti->io.io_int_parm, (u32 *) __LC_IO_INT_PARM);
cc = 1; put_guest(vcpu, inti->io.io_int_word, (u32 *) __LC_IO_INT_WORD);
} else }
cc = 0;
kfree(inti); kfree(inti);
no_interrupt:
/* Set condition code and we're done. */ /* Set condition code and we're done. */
vcpu->arch.sie_block->gpsw.mask &= ~(3ul << 44); vcpu->arch.sie_block->gpsw.mask &= ~(3ul << 44);
vcpu->arch.sie_block->gpsw.mask |= (cc & 3ul) << 44; vcpu->arch.sie_block->gpsw.mask |= (cc & 3ul) << 44;
out:
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment