Kernel KVM-PPC virtualization development
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: kvm-ppc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: KVM list <kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	linuxppc-dev
	<linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org>,
	Liu Yu <B13201-KZfg59tc24xl57MIdRCFDg@public.gmane.org>,
	Segher Boessenkool
	<segher-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
Subject: [PATCH 10/27] KVM: PPC: Tell guest about pending interrupts
Date: Thu, 29 Jul 2010 12:47:51 +0000	[thread overview]
Message-ID: <1280407688-9815-11-git-send-email-agraf@suse.de> (raw)
In-Reply-To: <1280407688-9815-1-git-send-email-agraf-l3A5Bk7waGM@public.gmane.org>

When the guest turns on interrupts again, it needs to know if we have an
interrupt pending for it. Because if so, it should rather get out of guest
context and get the interrupt.

So we introduce a new field in the shared page that we use to tell the guest
that there's a pending interrupt lying around.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 arch/powerpc/include/asm/kvm_para.h |    1 +
 arch/powerpc/kvm/book3s.c           |    7 +++++++
 arch/powerpc/kvm/booke.c            |    7 +++++++
 3 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/include/asm/kvm_para.h b/arch/powerpc/include/asm/kvm_para.h
index 5be00c9..0653b0d 100644
--- a/arch/powerpc/include/asm/kvm_para.h
+++ b/arch/powerpc/include/asm/kvm_para.h
@@ -37,6 +37,7 @@ struct kvm_vcpu_arch_shared {
 	__u64 dar;
 	__u64 msr;
 	__u32 dsisr;
+	__u32 int_pending;	/* Tells the guest if we have an interrupt */
 };
 
 #define KVM_SC_MAGIC_R0		0x4b564d21 /* "KVM!" */
diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c
index d6227ff..06229fe 100644
--- a/arch/powerpc/kvm/book3s.c
+++ b/arch/powerpc/kvm/book3s.c
@@ -337,6 +337,7 @@ int kvmppc_book3s_irqprio_deliver(struct kvm_vcpu *vcpu, unsigned int priority)
 void kvmppc_core_deliver_interrupts(struct kvm_vcpu *vcpu)
 {
 	unsigned long *pending = &vcpu->arch.pending_exceptions;
+	unsigned long old_pending = vcpu->arch.pending_exceptions;
 	unsigned int priority;
 
 #ifdef EXIT_DEBUG
@@ -356,6 +357,12 @@ void kvmppc_core_deliver_interrupts(struct kvm_vcpu *vcpu)
 					 BITS_PER_BYTE * sizeof(*pending),
 					 priority + 1);
 	}
+
+	/* Tell the guest about our interrupt status */
+	if (*pending)
+		vcpu->arch.shared->int_pending = 1;
+	else if (old_pending)
+		vcpu->arch.shared->int_pending = 0;
 }
 
 void kvmppc_set_pvr(struct kvm_vcpu *vcpu, u32 pvr)
diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index 104d0ee..c604277 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -224,6 +224,7 @@ static int kvmppc_booke_irqprio_deliver(struct kvm_vcpu *vcpu,
 void kvmppc_core_deliver_interrupts(struct kvm_vcpu *vcpu)
 {
 	unsigned long *pending = &vcpu->arch.pending_exceptions;
+	unsigned long old_pending = vcpu->arch.pending_exceptions;
 	unsigned int priority;
 
 	priority = __ffs(*pending);
@@ -235,6 +236,12 @@ void kvmppc_core_deliver_interrupts(struct kvm_vcpu *vcpu)
 		                         BITS_PER_BYTE * sizeof(*pending),
 		                         priority + 1);
 	}
+
+	/* Tell the guest about our interrupt status */
+	if (*pending)
+		vcpu->arch.shared->int_pending = 1;
+	else if (old_pending)
+		vcpu->arch.shared->int_pending = 0;
 }
 
 /**
-- 
1.6.0.2


  parent reply	other threads:[~2010-07-29 12:47 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-29 12:47 [PATCH 00/27] KVM PPC PV framework v3 Alexander Graf
     [not found] ` <1280407688-9815-1-git-send-email-agraf-l3A5Bk7waGM@public.gmane.org>
2010-07-29 12:47   ` [PATCH 01/27] KVM: PPC: Introduce shared page Alexander Graf
     [not found]     ` <1280407688-9815-2-git-send-email-agraf-l3A5Bk7waGM@public.gmane.org>
2010-08-05 17:05       ` Hollis Blanchard
2010-07-29 12:47   ` [PATCH 02/27] KVM: PPC: Convert MSR to " Alexander Graf
2010-07-29 12:47   ` [PATCH 03/27] KVM: PPC: Convert DSISR " Alexander Graf
2010-07-29 12:47   ` [PATCH 06/27] KVM: PPC: Convert SPRG[0-4] " Alexander Graf
2010-07-29 12:47   ` [PATCH 08/27] KVM: PPC: Add PV guest critical sections Alexander Graf
2010-07-29 12:47   ` Alexander Graf [this message]
2010-07-29 12:47   ` [PATCH 14/27] KVM: PPC: Expose magic page support to guest Alexander Graf
2010-07-29 12:48   ` [PATCH 19/27] KVM: PPC: PV tlbsync to nop Alexander Graf
2010-07-29 12:48   ` [PATCH 20/27] KVM: PPC: Introduce kvm_tmp framework Alexander Graf
2010-07-29 12:48   ` [PATCH 21/27] KVM: PPC: Introduce branch patching helper Alexander Graf
2010-07-29 12:48   ` [PATCH 23/27] KVM: PPC: PV mtmsrd L=1 Alexander Graf
2010-07-29 12:48   ` [PATCH 25/27] KVM: PPC: PV wrteei Alexander Graf
2010-07-29 12:48   ` [PATCH 26/27] KVM: PPC: Add Documentation about PV interface Alexander Graf
2010-08-01 14:02   ` [PATCH 00/27] KVM PPC PV framework v3 Avi Kivity
     [not found]     ` <4C557E7A.3010606-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2010-08-01 20:21       ` Alexander Graf
2010-08-03 16:16         ` Scott Wood
     [not found]           ` <20100803111611.38ca87e6-1MYqz8GpK7RekFaExTCHk1jVikpgYyvb5NbjCUgZEJk@public.gmane.org>
2010-08-05  7:57             ` Avi Kivity
2010-08-05  8:01               ` Alexander Graf
2010-08-05  8:05                 ` Avi Kivity
2010-08-05  8:25   ` Avi Kivity
2010-08-06 16:28   ` Kumar Gala
     [not found]     ` <17DF4824-9EC7-44F4-9408-EA6241C33E70-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>
2010-08-16 13:11       ` Alexander Graf
2010-07-29 12:47 ` [PATCH 04/27] KVM: PPC: Convert DAR to shared page Alexander Graf
2010-07-29 12:47 ` [PATCH 05/27] KVM: PPC: Convert SRR0 and SRR1 " Alexander Graf
2010-07-29 12:47 ` [PATCH 07/27] KVM: PPC: Implement hypervisor interface Alexander Graf
2010-07-29 12:47 ` [PATCH 09/27] KVM: PPC: Add PV guest scratch registers Alexander Graf
2010-07-29 12:47 ` [PATCH 11/27] KVM: PPC: Make PAM a define Alexander Graf
2010-07-29 12:47 ` [PATCH 12/27] KVM: PPC: First magic page steps Alexander Graf
2010-07-29 12:47 ` [PATCH 13/27] KVM: PPC: Magic Page Book3s support Alexander Graf
2010-07-29 12:47 ` [PATCH 15/27] KVM: Move kvm_guest_init out of generic code Alexander Graf
2010-07-29 12:47 ` [PATCH 16/27] KVM: PPC: Generic KVM PV guest support Alexander Graf
2010-07-29 12:47 ` [PATCH 17/27] KVM: PPC: KVM PV guest stubs Alexander Graf
     [not found]   ` <1280407688-9815-18-git-send-email-agraf-l3A5Bk7waGM@public.gmane.org>
2010-08-05 17:16     ` Hollis Blanchard
2010-07-29 12:47 ` [PATCH 18/27] KVM: PPC: PV instructions to loads and stores Alexander Graf
2010-07-29 12:48 ` [PATCH 22/27] KVM: PPC: PV assembler helpers Alexander Graf
2010-07-29 12:48 ` [PATCH 24/27] KVM: PPC: PV mtmsrd L=0 and mtmsr Alexander Graf
2010-07-29 12:48 ` [PATCH 27/27] KVM: PPC: Add get_pvinfo interface to query hypercall instructions Alexander Graf
  -- strict thread matches above, loose matches on Subject: below --
2010-07-01 10:42 [PATCH 00/27] KVM PPC PV framework Alexander Graf
     [not found] ` <1277980982-12433-1-git-send-email-agraf-l3A5Bk7waGM@public.gmane.org>
2010-07-01 10:42   ` [PATCH 10/27] KVM: PPC: Tell guest about pending interrupts Alexander Graf

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=1280407688-9815-11-git-send-email-agraf@suse.de \
    --to=agraf@suse.de \
    --cc=B13201-KZfg59tc24xl57MIdRCFDg@public.gmane.org \
    --cc=kvm-ppc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
    --cc=segher-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org \
    /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