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>,
	"Andreas Färber" <afaerber@suse.de>
Subject: [Qemu-devel] [PATCH 3/8] xics: add find_server
Date: Fri, 14 Mar 2014 15:18:04 +1100	[thread overview]
Message-ID: <1394770689-29039-4-git-send-email-aik@ozlabs.ru> (raw)
In-Reply-To: <1394770689-29039-1-git-send-email-aik@ozlabs.ru>

PAPR allows having multiple interrupr servers. However now we
only support one.

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

At the moment no change is expected.

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

diff --git a/hw/intc/xics.c b/hw/intc/xics.c
index 7eac85a..88ef9ef 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 irq, bool lsi)
@@ -653,9 +669,10 @@ static void ics_set_irq_type(ICSState *ics, int irq, bool lsi)
 
 void xics_set_irq_type(XICSState *icp, int irq, bool lsi)
 {
-    assert(ics_valid_irq(icp->ics, irq));
+    int server = xics_find_server(icp, irq);
 
-    ics_set_irq_type(icp->ics, irq, lsi);
+    assert(server >= 0);
+    ics_set_irq_type(&icp->ics[server], irq, lsi);
 }
 
 /*
-- 
1.8.4.rc4

  parent reply	other threads:[~2014-03-14  4:18 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-14  4:18 [Qemu-devel] [PATCH 0/8] spapr: fix IOMMU and XICS/IRQs migration Alexey Kardashevskiy
2014-03-14  4:18 ` [Qemu-devel] [PATCH 1/8] spapr-iommu: add a bus for spapr-iommu devices Alexey Kardashevskiy
2014-04-10 12:40   ` Alexander Graf
2014-04-10 14:40     ` Alexey Kardashevskiy
2014-04-10 14:52       ` Andreas Färber
2014-04-10 15:18         ` Alexey Kardashevskiy
2014-03-14  4:18 ` [Qemu-devel] [PATCH 2/8] xics: add flags for interrupts Alexey Kardashevskiy
2014-04-10 12:43   ` Alexander Graf
2014-03-14  4:18 ` Alexey Kardashevskiy [this message]
2014-03-14  4:18 ` [Qemu-devel] [PATCH 4/8] xics: add pre_load() hook to ICSStateClass Alexey Kardashevskiy
2014-03-14  4:18 ` [Qemu-devel] [PATCH 5/8] xics: disable flags reset on xics reset Alexey Kardashevskiy
2014-03-14  4:18 ` [Qemu-devel] [PATCH 6/8] spapr: move interrupt allocator to xics Alexey Kardashevskiy
2014-04-10 12:51   ` Alexander Graf
2014-04-10 13:24     ` Alexey Kardashevskiy
2014-04-10 13:26       ` Alexander Graf
2014-04-10 14:43         ` Alexey Kardashevskiy
2014-04-11  9:24           ` Alexander Graf
2014-04-11 12:38             ` Alexey Kardashevskiy
2014-04-11 13:58               ` Alexander Graf
2014-04-11 14:50                 ` Alexey Kardashevskiy
2014-04-11 14:58                   ` Alexander Graf
2014-04-11 15:27                     ` Alexey Kardashevskiy
2014-04-11 15:38                       ` Alexander Graf
2014-04-11 16:01                         ` Alexey Kardashevskiy
2014-04-11 16:15                           ` Alexander Graf
2014-04-11 16:30                             ` Alexey Kardashevskiy
2014-03-14  4:18 ` [Qemu-devel] [PATCH 7/8] spapr: remove @next_irq Alexey Kardashevskiy
2014-03-14  7:19   ` Thomas Huth
2014-03-14  4:18 ` [Qemu-devel] [PATCH 8/8] xics: enable interrupt configuration reset on migration Alexey Kardashevskiy
2014-04-10 12:55   ` Alexander Graf
2014-03-20  1:25 ` [Qemu-devel] [PATCH 0/8] spapr: fix IOMMU and XICS/IRQs migration Andreas Färber
2014-04-04  5:53 ` Alexey Kardashevskiy
2014-05-04 13:56 ` Alexey Kardashevskiy
2014-05-04 21:52   ` Paolo Bonzini
2014-05-04 23:48     ` 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=1394770689-29039-4-git-send-email-aik@ozlabs.ru \
    --to=aik@ozlabs.ru \
    --cc=afaerber@suse.de \
    --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).