public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: kvm-ppc@vger.kernel.org
Cc: kvm@vger.kernel.org, hollis@penguinppc.org
Subject: [PATCH 1/3] Move vector to irqprio resolving to separate function
Date: Mon, 21 Dec 2009 15:22:51 +0100	[thread overview]
Message-ID: <1261405373-8008-2-git-send-email-agraf@suse.de> (raw)
In-Reply-To: <1261405373-8008-1-git-send-email-agraf@suse.de>

We're using a switch table to find the irqprio that belongs to a specific
interrupt vector. This table is part of the interrupt inject logic.

Since we'll add a new function to stop interrupts, let's move this table
out of the injection logic into a separate function.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 arch/powerpc/kvm/book3s.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c
index 3e294bd..241795b 100644
--- a/arch/powerpc/kvm/book3s.c
+++ b/arch/powerpc/kvm/book3s.c
@@ -125,11 +125,10 @@ void kvmppc_inject_interrupt(struct kvm_vcpu *vcpu, int vec, u64 flags)
 	vcpu->arch.mmu.reset_msr(vcpu);
 }
 
-void kvmppc_book3s_queue_irqprio(struct kvm_vcpu *vcpu, unsigned int vec)
+static int kvmppc_book3s_vec2irqprio(unsigned int vec)
 {
 	unsigned int prio;
 
-	vcpu->stat.queue_intr++;
 	switch (vec) {
 	case 0x100: prio = BOOK3S_IRQPRIO_SYSTEM_RESET;		break;
 	case 0x200: prio = BOOK3S_IRQPRIO_MACHINE_CHECK;	break;
@@ -149,7 +148,15 @@ void kvmppc_book3s_queue_irqprio(struct kvm_vcpu *vcpu, unsigned int vec)
 	default:    prio = BOOK3S_IRQPRIO_MAX;			break;
 	}
 
-	set_bit(prio, &vcpu->arch.pending_exceptions);
+	return prio;
+}
+
+void kvmppc_book3s_queue_irqprio(struct kvm_vcpu *vcpu, unsigned int vec)
+{
+	vcpu->stat.queue_intr++;
+
+	set_bit(kvmppc_book3s_vec2irqprio(vec),
+		&vcpu->arch.pending_exceptions);
 #ifdef EXIT_DEBUG
 	printk(KERN_INFO "Queueing interrupt %x\n", vec);
 #endif
-- 
1.6.0.2


  reply	other threads:[~2009-12-21 14:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-21 14:22 [PATCH 0/3] Improve Decrementor Implementation Alexander Graf
2009-12-21 14:22 ` Alexander Graf [this message]
2009-12-21 14:22 ` [PATCH 2/3] Improve DEC handling Alexander Graf
2009-12-21 14:22 ` [PATCH 3/3] Remove AGGRESSIVE_DEC Alexander Graf
     [not found] ` <1261405373-8008-3-git-send-email-agraf@suse.de>
     [not found]   ` <1261405373-8008-3-git-send-email-agraf-l3A5Bk7waGM@public.gmane.org>
2009-12-21 18:13     ` [PATCH 2/3] Improve DEC handling Hollis Blanchard
     [not found]       ` <fb412d760912211013w265d3d30i99498ab136a15e00-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-12-21 18:17         ` Hollis Blanchard
     [not found]           ` <fb412d760912211017i3f47fce2oc3b67c9c5c645b6-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-12-21 18:20             ` Alexander Graf
     [not found]               ` <4B2FBC74.3080705-l3A5Bk7waGM@public.gmane.org>
2009-12-21 19:04                 ` Hollis Blanchard
2009-12-21 18:19         ` Alexander Graf
  -- strict thread matches above, loose matches on Subject: below --
2009-12-21 19:21 [PATCH 0/3] Improve Decrementor Implementation v2 Alexander Graf
     [not found] ` <1261423285-12715-1-git-send-email-agraf-l3A5Bk7waGM@public.gmane.org>
2009-12-21 19:21   ` [PATCH 1/3] Move vector to irqprio resolving to separate function 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=1261405373-8008-2-git-send-email-agraf@suse.de \
    --to=agraf@suse.de \
    --cc=hollis@penguinppc.org \
    --cc=kvm-ppc@vger.kernel.org \
    --cc=kvm@vger.kernel.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