linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Paul Mackerras <paulus@samba.org>
To: linuxppc-dev@ozlabs.org, kvm@vger.kernel.org, kvm-ppc@vger.kernel.org
Subject: [PATCH v2 04/12] kvm/powerpc: Deliver program interrupts right away instead of queueing them
Date: Tue, 31 May 2011 20:16:22 +1000	[thread overview]
Message-ID: <20110531101622.GB2505@brick.ozlabs.ibm.com> (raw)
In-Reply-To: <20110531064028.GA2533@brick.ozlabs.ibm.com>

Doing so means that we don't have to save the flags anywhere and gets
rid of the last reference to to_book3s(vcpu) in arch/powerpc/kvm/book3s.c.

Doing so is OK because a program interrupt won't be generated at the
same time as any other synchronous interrupt.  If a program interrupt
and an asynchronous interrupt (external or decrementer) are generated
at the same time, the program interrupt will be delivered, which is
correct because it has a higher priority, and then the asynchronous
interrupt will be masked.

We don't ever generate system reset or machine check interrupts to the
guest, but if we did, then we would need to make sure they got delivered
rather than the program interrupt.  The current code would be wrong in
this situation anyway since it would deliver the program interrupt as
well as the reset/machine check interrupt.

Signed-off-by: Paul Mackerras <paulus@samba.org>
---
 arch/powerpc/kvm/book3s.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c
index af63de3..096c711 100644
--- a/arch/powerpc/kvm/book3s.c
+++ b/arch/powerpc/kvm/book3s.c
@@ -128,8 +128,8 @@ void kvmppc_book3s_queue_irqprio(struct kvm_vcpu *vcpu, unsigned int vec)
 
 void kvmppc_core_queue_program(struct kvm_vcpu *vcpu, ulong flags)
 {
-	to_book3s(vcpu)->prog_flags = flags;
-	kvmppc_book3s_queue_irqprio(vcpu, BOOK3S_INTERRUPT_PROGRAM);
+	/* might as well deliver this straight away */
+	kvmppc_inject_interrupt(vcpu, BOOK3S_INTERRUPT_PROGRAM, flags);
 }
 
 void kvmppc_core_queue_dec(struct kvm_vcpu *vcpu)
@@ -169,7 +169,6 @@ int kvmppc_book3s_irqprio_deliver(struct kvm_vcpu *vcpu, unsigned int priority)
 {
 	int deliver = 1;
 	int vec = 0;
-	ulong flags = 0ULL;
 	bool crit = kvmppc_critical_section(vcpu);
 
 	switch (priority) {
@@ -205,7 +204,6 @@ int kvmppc_book3s_irqprio_deliver(struct kvm_vcpu *vcpu, unsigned int priority)
 		break;
 	case BOOK3S_IRQPRIO_PROGRAM:
 		vec = BOOK3S_INTERRUPT_PROGRAM;
-		flags = to_book3s(vcpu)->prog_flags;
 		break;
 	case BOOK3S_IRQPRIO_VSX:
 		vec = BOOK3S_INTERRUPT_VSX;
@@ -236,7 +234,7 @@ int kvmppc_book3s_irqprio_deliver(struct kvm_vcpu *vcpu, unsigned int priority)
 #endif
 
 	if (deliver)
-		kvmppc_inject_interrupt(vcpu, vec, flags);
+		kvmppc_inject_interrupt(vcpu, vec, 0);
 
 	return deliver;
 }
-- 
1.7.5.3

  parent reply	other threads:[~2011-05-31 10:16 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-31  6:40 [PATCH v2 0/12] Hypervisor-mode KVM on POWER7 Paul Mackerras
2011-05-31  6:42 ` [PATCH v2 01/12] kvm/powerpc: Move fields between struct kvm_vcpu_arch and kvmppc_vcpu_book3s Paul Mackerras
2011-05-31  6:46 ` [PATCH v2 02/12] kvm/powerpc: Split out code from book3s.c into book3s_pr.c Paul Mackerras
2011-05-31 10:15 ` [PATCH v2 03/12] powerpc, kvm: Rework KVM checks in first-level interrupt handlers Paul Mackerras
2011-05-31 10:16 ` Paul Mackerras [this message]
2011-05-31 10:16 ` [PATCH v2 05/12] kvm/powerpc: Pass init/destroy vm and prepare/commit memory region ops down Paul Mackerras
2011-05-31 10:17 ` [PATCH v2 06/12] kvm/powerpc: Move guest enter/exit down into subarch-specific code Paul Mackerras
2011-05-31 10:17 ` [PATCH v2 07/12] powerpc: Set up LPCR for running guest partitions Paul Mackerras
2011-05-31 10:18 ` [PATCH v2 08/12] kvm/powerpc: Split host-state fields out of kvmppc_book3s_shadow_vcpu Paul Mackerras
2011-05-31 10:19 ` [PATCH v2 09/12] kvm/powerpc: Add support for Book3S processors in hypervisor mode Paul Mackerras
2011-05-31 10:19 ` [PATCH v2 10/12] kvm/powerpc: Handle some PAPR hcalls in the kernel Paul Mackerras
2011-05-31 10:20 ` [PATCH v2 11/12] kvm/powerpc: Accelerate H_PUT_TCE by implementing it in real mode Paul Mackerras
2011-05-31 10:21 ` [PATCH v2 12/12] kvm/powerpc: Allow book3s_hv guests to use SMT processor modes Paul Mackerras
2011-05-31 10:40 ` [PATCH v2 0/12] Hypervisor-mode KVM on POWER7 Alexander Graf
2011-05-31 12:35   ` Paul Mackerras
2011-05-31 12:50     ` Alexander Graf
2011-05-31 19:59       ` Jimi Xenidis
2011-06-01  5:20       ` Paul Mackerras
2011-06-01  5:31     ` Olof Johansson

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=20110531101622.GB2505@brick.ozlabs.ibm.com \
    --to=paulus@samba.org \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.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;
as well as URLs for NNTP newsgroup(s).