qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alexey Kardashevskiy <aik@ozlabs.ru>
To: qemu-devel@nongnu.org
Cc: Alexey Kardashevskiy <aik@ozlabs.ru>,
	qemu-ppc@nongnu.org, Alexander Graf <agraf@suse.de>
Subject: [Qemu-devel] [PATCH 2/6] xics: add find_server
Date: Wed,  7 May 2014 16:01:54 +1000	[thread overview]
Message-ID: <1399442518-26303-3-git-send-email-aik@ozlabs.ru> (raw)
In-Reply-To: <1399442518-26303-1-git-send-email-aik@ozlabs.ru>

PAPR allows having multiple interrupr servers.

This adds a server lookup function and makes use of it.

Since at the moment QEMU only supports a single server,
no change in behaviour is expected.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
---
 hw/intc/xics.c | 28 +++++++++++++++++++++++-----
 1 file changed, 23 insertions(+), 5 deletions(-)

diff --git a/hw/intc/xics.c b/hw/intc/xics.c
index 1f89a00..9314654 100644
--- a/hw/intc/xics.c
+++ b/hw/intc/xics.c
@@ -635,14 +635,30 @@ static const TypeInfo ics_info = {
 /*
  * Exported functions
  */
+static int xics_find_server(XICSState *icp, int irq)
+{
+    int server;
+
+    for (server = 0; server < icp->nr_servers; ++server) {
+        ICSState *ics = &icp->ics[server];
+        if (ics_valid_irq(ics, irq)) {
+            return server;
+        }
+    }
+
+    return -1;
+}
 
 qemu_irq xics_get_qirq(XICSState *icp, int irq)
 {
-    if (!ics_valid_irq(icp->ics, irq)) {
-        return NULL;
+    int server = xics_find_server(icp, irq);
+
+    if (server >= 0) {
+        ICSState *ics = &icp->ics[server];
+        return ics->qirqs[irq - ics->offset];
     }
 
-    return icp->ics->qirqs[irq - icp->ics->offset];
+    return NULL;
 }
 
 static void ics_set_irq_type(ICSState *ics, int srcno, bool lsi)
@@ -653,10 +669,12 @@ static void ics_set_irq_type(ICSState *ics, int srcno, bool lsi)
 
 void xics_set_irq_type(XICSState *icp, int irq, bool lsi)
 {
-    ICSState *ics = icp->ics;
+    int server = xics_find_server(icp, irq);
+    ICSState *ics;
 
-    assert(ics_valid_irq(ics, irq));
+    assert(server >= 0);
 
+    ics = &icp->ics[server];
     ics_set_irq_type(ics, irq - ics->offset, lsi);
 }
 
-- 
1.8.4.rc4

  parent reply	other threads:[~2014-05-07  6:02 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-07  6:01 [Qemu-devel] [PATCH 0/6] move interrupts from spapr to xics Alexey Kardashevskiy
2014-05-07  6:01 ` [Qemu-devel] [PATCH 1/6] xics: add flags for interrupts Alexey Kardashevskiy
2014-05-07 13:09   ` Mike Day
2014-05-09  3:12     ` Alexey Kardashevskiy
2014-05-09 12:20       ` Mike Day
2014-05-08 11:52   ` Alexander Graf
2014-05-08 12:08     ` [Qemu-devel] [Qemu-ppc] " Alexander Graf
2014-05-07  6:01 ` Alexey Kardashevskiy [this message]
2014-05-07 13:14   ` [Qemu-devel] [PATCH 2/6] xics: add find_server Mike Day
2014-05-07  6:01 ` [Qemu-devel] [PATCH 3/6] xics: disable flags reset on xics reset Alexey Kardashevskiy
2014-05-08 11:57   ` Alexander Graf
2014-05-07  6:01 ` [Qemu-devel] [PATCH 4/6] spapr: move interrupt allocator to xics Alexey Kardashevskiy
2014-05-07  6:01 ` [Qemu-devel] [PATCH 5/6] spapr: remove @next_irq Alexey Kardashevskiy
2014-05-07  6:01 ` [Qemu-devel] [PATCH 6/6] xics: implement xics_ics_free() Alexey Kardashevskiy
2014-05-08 12:07   ` Alexander Graf
2014-05-09  2:13     ` Alexey Kardashevskiy

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=1399442518-26303-3-git-send-email-aik@ozlabs.ru \
    --to=aik@ozlabs.ru \
    --cc=agraf@suse.de \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.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).