From: Christian Borntraeger <borntraeger@de.ibm.com>
To: Marcelo Tossati <mtosatti@redhat.com>, Gleb Natapov <gleb@redhat.com>
Cc: Cornelia Huck <cornelia.huck@de.ibm.com>,
Heiko Carstens <heiko.carstens@de.ibm.com>,
Martin Schwidefsky <schwidefsky@de.ibm.com>,
KVM <kvm@vger.kernel.org>,
linux-s390 <linux-s390@vger.kernel.org>,
Christian Borntraeger <borntraeger@de.ibm.com>
Subject: [PATCH 7/8] s390/kvm: cleanup/fix handle_tpi()
Date: Tue, 5 Mar 2013 13:14:46 +0100 [thread overview]
Message-ID: <1362485687-2799-8-git-send-email-borntraeger@de.ibm.com> (raw)
In-Reply-To: <1362485687-2799-1-git-send-email-borntraeger@de.ibm.com>
From: Heiko Carstens <heiko.carstens@de.ibm.com>
- 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>
---
arch/s390/kvm/priv.c | 54 +++++++++++++++++++++++++++++-----------------------
1 file changed, 30 insertions(+), 24 deletions(-)
diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c
index cb07147..d64382c 100644
--- a/arch/s390/kvm/priv.c
+++ b/arch/s390/kvm/priv.c
@@ -14,6 +14,7 @@
#include <linux/kvm.h>
#include <linux/gfp.h>
#include <linux/errno.h>
+#include <asm/asm-offsets.h>
#include <asm/current.h>
#include <asm/debug.h>
#include <asm/ebcdic.h>
@@ -129,39 +130,44 @@ static int handle_skey(struct kvm_vcpu *vcpu)
static int handle_tpi(struct kvm_vcpu *vcpu)
{
- u64 addr;
struct kvm_s390_interrupt_info *inti;
+ u64 addr;
int cc;
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);
- if (inti) {
- if (addr) {
- /*
- * Store the two-word I/O interruption code into the
- * provided area.
- */
- put_guest(vcpu, inti->io.subchannel_id, (u16 *) addr);
- put_guest(vcpu, inti->io.subchannel_nr, (u16 *) (addr + 2));
- put_guest(vcpu, inti->io.io_int_parm, (u32 *) (addr + 4));
- } else {
- /*
- * Store the three-word I/O interruption code into
- * the appropriate lowcore area.
- */
- put_guest(vcpu, inti->io.subchannel_id, (u16 *) 184);
- put_guest(vcpu, inti->io.subchannel_nr, (u16 *) 186);
- put_guest(vcpu, inti->io.io_int_parm, (u32 *) 188);
- put_guest(vcpu, inti->io.io_int_word, (u32 *) 192);
- }
- cc = 1;
- } else
- cc = 0;
+ if (!inti)
+ goto no_interrupt;
+ cc = 1;
+ if (addr) {
+ /*
+ * Store the two-word I/O interruption code into the
+ * provided area.
+ */
+ put_guest(vcpu, inti->io.subchannel_id, (u16 *) addr);
+ put_guest(vcpu, inti->io.subchannel_nr, (u16 *) (addr + 2));
+ put_guest(vcpu, inti->io.io_int_parm, (u32 *) (addr + 4));
+ } else {
+ /*
+ * Store the three-word I/O interruption code into
+ * the appropriate lowcore area.
+ */
+ put_guest(vcpu, inti->io.subchannel_id, (u16 *) __LC_SUBCHANNEL_ID);
+ put_guest(vcpu, inti->io.subchannel_nr, (u16 *) __LC_SUBCHANNEL_NR);
+ put_guest(vcpu, inti->io.io_int_parm, (u32 *) __LC_IO_INT_PARM);
+ put_guest(vcpu, inti->io.io_int_word, (u32 *) __LC_IO_INT_WORD);
+ }
kfree(inti);
+no_interrupt:
/* Set condition code and we're done. */
vcpu->arch.sie_block->gpsw.mask &= ~(3ul << 44);
vcpu->arch.sie_block->gpsw.mask |= (cc & 3ul) << 44;
+out:
return 0;
}
--
1.8.0.1
next prev parent reply other threads:[~2013-03-05 12:14 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-05 12:14 [PATCH 0/8] s390/kvm: memory mgmt related fixes/cleanups Christian Borntraeger
2013-03-05 12:14 ` [PATCH 1/8] s390/kvm,gaccess: fix guest access return code handling Christian Borntraeger
2013-03-05 12:14 ` [PATCH 2/8] s390/mm,gmap: implement gmap_translate() Christian Borntraeger
2013-03-05 12:14 ` [PATCH 3/8] s390/kvm,tprot: use new gmap_translate() function Christian Borntraeger
2013-03-05 12:14 ` [PATCH 4/8] s390/kvm: remove explicit -EFAULT return code checking on guest access Christian Borntraeger
2013-03-05 12:14 ` [PATCH 5/8] s390/kvm,gaccess: shorten put/get_guest code Christian Borntraeger
2013-03-05 12:14 ` [PATCH 6/8] s390/kvm,gaccess: shorten copy_to/from_guest code Christian Borntraeger
2013-03-05 12:14 ` Christian Borntraeger [this message]
2013-03-05 12:14 ` [PATCH 8/8] s390/kvm,gaccess: add address space annotations Christian Borntraeger
2013-03-07 19:21 ` [PATCH 0/8] s390/kvm: memory mgmt related fixes/cleanups Marcelo Tosatti
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1362485687-2799-8-git-send-email-borntraeger@de.ibm.com \
--to=borntraeger@de.ibm.com \
--cc=cornelia.huck@de.ibm.com \
--cc=gleb@redhat.com \
--cc=heiko.carstens@de.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=schwidefsky@de.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox