qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: agraf@suse.de
Cc: qemu-ppc@nongnu.org, qemu-devel@nongnu.org,
	David Gibson <david@gibson.dropbear.id.au>
Subject: [Qemu-devel] [PATCH 13/13] pseries: Fix semantics of RTAS int-on, int-off and set-xive functions
Date: Thu, 13 Sep 2012 12:57:21 +1000	[thread overview]
Message-ID: <1347505041-27411-14-git-send-email-david@gibson.dropbear.id.au> (raw)
In-Reply-To: <1347505041-27411-1-git-send-email-david@gibson.dropbear.id.au>

Currently the ibm,int-on and ibm,int-off RTAS functions are implemented as
no-ops.  This is because when implemented as specified in PAPR they caused
Linux (which calls both int-on/off and set-xive) to end up with interrupts
masked when they should not be.  Since Linux's set-xive calls make the
int-on/off calls redundant, making them nops worked around the problem.

In fact, the problem was caused because there was a subtle bug in set-xive,
PAPR specifies that as well as updating the current priority, it also needs
to update the saved priority used by int-on/off.  With this bug fixed the
problem goes away.  This patch implements this more correct fix.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
 hw/xics.c |   25 ++++++++-----------------
 1 file changed, 8 insertions(+), 17 deletions(-)

diff --git a/hw/xics.c b/hw/xics.c
index 75c8cca..ce88aa7 100644
--- a/hw/xics.c
+++ b/hw/xics.c
@@ -270,13 +270,14 @@ static void write_xive_lsi(struct ics_state *ics, int srcno)
 }
 
 static void ics_write_xive(struct ics_state *ics, int nr, int server,
-                           uint8_t priority)
+                           uint8_t priority, uint8_t saved_priority)
 {
     int srcno = nr - ics->offset;
     struct ics_irq_state *irq = ics->irqs + srcno;
 
     irq->server = server;
     irq->priority = priority;
+    irq->saved_priority = saved_priority;
 
     if (irq->lsi) {
         write_xive_lsi(ics, srcno);
@@ -405,7 +406,7 @@ static void rtas_set_xive(sPAPREnvironment *spapr, uint32_t token,
         return;
     }
 
-    ics_write_xive(ics, nr, server, priority);
+    ics_write_xive(ics, nr, server, priority, priority);
 
     rtas_st(rets, 0, 0); /* Success */
 }
@@ -453,14 +454,8 @@ static void rtas_int_off(sPAPREnvironment *spapr, uint32_t token,
         return;
     }
 
-    /* This is a NOP for now, since the described PAPR semantics don't
-     * seem to gel with what Linux does */
-#if 0
-    struct ics_irq_state *irq = xics->irqs + (nr - xics->offset);
-
-    irq->saved_priority = irq->priority;
-    ics_write_xive_msi(xics, nr, irq->server, 0xff);
-#endif
+    ics_write_xive(ics, nr, ics->irqs[nr - ics->offset].server, 0xff,
+                   ics->irqs[nr - ics->offset].priority);
 
     rtas_st(rets, 0, 0); /* Success */
 }
@@ -484,13 +479,9 @@ static void rtas_int_on(sPAPREnvironment *spapr, uint32_t token,
         return;
     }
 
-    /* This is a NOP for now, since the described PAPR semantics don't
-     * seem to gel with what Linux does */
-#if 0
-    struct ics_irq_state *irq = xics->irqs + (nr - xics->offset);
-
-    ics_write_xive_msi(xics, nr, irq->server, irq->saved_priority);
-#endif
+    ics_write_xive(ics, nr, ics->irqs[nr - ics->offset].server,
+                   ics->irqs[nr - ics->offset].saved_priority,
+                   ics->irqs[nr - ics->offset].saved_priority);
 
     rtas_st(rets, 0, 0); /* Success */
 }
-- 
1.7.10.4

  parent reply	other threads:[~2012-09-13  2:57 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-13  2:57 [Qemu-devel] [0/13] pseries patch queue David Gibson
2012-09-13  2:57 ` [Qemu-devel] [PATCH 01/13] ppc: Make kvm_arch_put_registers() put *all* the registers David Gibson
2012-09-13  2:57 ` [Qemu-devel] [PATCH 02/13] pseries: Fix and cleanup CPU initialization and reset David Gibson
2012-09-13 14:10   ` Andreas Färber
2012-09-13  2:57 ` [Qemu-devel] [PATCH 03/13] pseries: Use new method to correct reset sequence David Gibson
2012-09-13 14:08   ` Andreas Färber
2012-09-13  2:57 ` [Qemu-devel] [PATCH 04/13] pseries: Add support for new KVM hash table control call David Gibson
2012-09-13  2:57 ` [Qemu-devel] [PATCH 05/13] pseries: Clear TCE and signal state when resetting PAPR VIO devices David Gibson
2012-09-13  2:57 ` [Qemu-devel] [PATCH 06/13] pseries: Reset emulated PCI TCE tables on system reset David Gibson
2012-09-13  2:57 ` [Qemu-devel] [PATCH 07/13] pseries: Fix XICS reset David Gibson
2012-09-13  2:57 ` [Qemu-devel] [PATCH 08/13] pseries: Small cleanup to H_CEDE implementation David Gibson
2012-09-13  2:57 ` [Qemu-devel] [PATCH 09/13] pseries: Remove C bitfields from xics code David Gibson
2012-09-13  2:57 ` [Qemu-devel] [PATCH 10/13] pseries: Remove XICS irq type enum type David Gibson
2012-09-13  2:57 ` [Qemu-devel] [PATCH 11/13] pseries: Remove never used flags field from spapr vio devices David Gibson
2012-09-13  2:57 ` [Qemu-devel] [PATCH 12/13] pseries: Rework implementation of TCE bypass David Gibson
2012-09-13  2:57 ` David Gibson [this message]
2012-09-19 12:12 ` [Qemu-devel] [0/13] pseries patch queue 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=1347505041-27411-14-git-send-email-david@gibson.dropbear.id.au \
    --to=david@gibson.dropbear.id.au \
    --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).