qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Cédric Le Goater" <clg@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Nicholas Piggin" <npiggin@gmail.com>,
	"Daniel Henrique Barboza" <danielhb413@gmail.com>,
	"Glenn Miles" <milesg@linux.ibm.com>,
	"Michael Kowal" <kowal@linux.ibm.com>,
	"Gautam Menghani" <gautam@linux.ibm.com>,
	"Cédric Le Goater" <clg@redhat.com>
Subject: [PULL 50/50] ppc/xive2: Enable lower level contexts on VP push
Date: Mon, 21 Jul 2025 18:22:33 +0200	[thread overview]
Message-ID: <20250721162233.686837-51-clg@redhat.com> (raw)
In-Reply-To: <20250721162233.686837-1-clg@redhat.com>

From: Nicholas Piggin <npiggin@gmail.com>

When pushing a context, the lower-level context becomes valid if it
had V=1, and so on. Iterate lower level contexts and send them
pending interrupts if they become enabled.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Reviewed-by: Glenn Miles <milesg@linux.ibm.com>
Reviewed-by: Michael Kowal <kowal@linux.ibm.com>
Tested-by: Gautam Menghani <gautam@linux.ibm.com>
Link: https://lore.kernel.org/qemu-devel/20250512031100.439842-51-npiggin@gmail.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
---
 hw/intc/xive2.c | 36 ++++++++++++++++++++++++++++--------
 1 file changed, 28 insertions(+), 8 deletions(-)

diff --git a/hw/intc/xive2.c b/hw/intc/xive2.c
index c3c6871e91b3..ee5fa2617849 100644
--- a/hw/intc/xive2.c
+++ b/hw/intc/xive2.c
@@ -995,6 +995,12 @@ static void xive2_tm_push_ctx(XivePresenter *xptr, XiveTCTX *tctx,
     bool v;
     bool do_restore;
 
+    if (xive_ring_valid(tctx, ring)) {
+        qemu_log_mask(LOG_GUEST_ERROR, "XIVE: Attempt to push VP to enabled"
+                                       " ring 0x%02x\n", ring);
+        return;
+    }
+
     /* First update the thead context */
     switch (size) {
     case 1:
@@ -1021,19 +1027,32 @@ static void xive2_tm_push_ctx(XivePresenter *xptr, XiveTCTX *tctx,
     /* Check the interrupt pending bits */
     if (v) {
         Xive2Router *xrtr = XIVE2_ROUTER(xptr);
-        uint8_t *sig_regs = xive_tctx_signal_regs(tctx, ring);
-        uint8_t nsr = sig_regs[TM_NSR];
+        uint8_t cur_ring;
 
         xive2_tctx_restore_nvp(xrtr, tctx, ring,
                                nvp_blk, nvp_idx, do_restore);
 
-        if (xive_nsr_indicates_group_exception(ring, nsr)) {
-            /* redistribute precluded active grp interrupt */
-            g_assert(ring == TM_QW2_HV_POOL); /* PHYS ring has the interrupt */
-            xive2_redistribute(xrtr, tctx, xive_nsr_exception_ring(ring, nsr));
+        for (cur_ring = TM_QW1_OS; cur_ring <= ring;
+             cur_ring += XIVE_TM_RING_SIZE) {
+            uint8_t *sig_regs = xive_tctx_signal_regs(tctx, cur_ring);
+            uint8_t nsr = sig_regs[TM_NSR];
+
+            if (!xive_ring_valid(tctx, cur_ring)) {
+                continue;
+            }
+
+            if (cur_ring == TM_QW2_HV_POOL) {
+                if (xive_nsr_indicates_exception(cur_ring, nsr)) {
+                    g_assert(xive_nsr_exception_ring(cur_ring, nsr) ==
+                                                               TM_QW3_HV_PHYS);
+                    xive2_redistribute(xrtr, tctx,
+                                       xive_nsr_exception_ring(ring, nsr));
+                }
+                xive2_tctx_process_pending(tctx, TM_QW3_HV_PHYS);
+                break;
+            }
+            xive2_tctx_process_pending(tctx, cur_ring);
         }
-        xive2_tctx_process_pending(tctx, ring == TM_QW2_HV_POOL ?
-                                                 TM_QW3_HV_PHYS : ring);
     }
 }
 
@@ -1159,6 +1178,7 @@ static void xive2_tctx_process_pending(XiveTCTX *tctx, uint8_t sig_ring)
     int rc;
 
     g_assert(sig_ring == TM_QW3_HV_PHYS || sig_ring == TM_QW1_OS);
+    g_assert(sig_regs[TM_WORD2] & 0x80);
     g_assert(!xive_nsr_indicates_group_exception(sig_ring, sig_regs[TM_NSR]));
 
     /*
-- 
2.50.1



  parent reply	other threads:[~2025-07-21 16:37 UTC|newest]

Thread overview: 67+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-21 16:21 [PULL 00/50] ppc queue Cédric Le Goater
2025-07-21 16:21 ` [PULL 01/50] ppc/xive: Fix xive trace event output Cédric Le Goater
2025-07-21 16:21 ` [PULL 02/50] ppc/xive: Report access size in XIVE TM operation error logs Cédric Le Goater
2025-07-21 16:21 ` [PULL 03/50] ppc/xive2: Fix calculation of END queue sizes Cédric Le Goater
2025-07-21 16:21 ` [PULL 04/50] ppc/xive2: Remote VSDs need to match on forwarding address Cédric Le Goater
2025-07-21 16:21 ` [PULL 05/50] ppc/xive2: fix context push calculation of IPB priority Cédric Le Goater
2025-07-21 16:21 ` [PULL 06/50] ppc/xive: Fix PHYS NSR ring matching Cédric Le Goater
2025-07-21 16:21 ` [PULL 07/50] ppc/xive2: Reset Generation Flipped bit on END Cache Watch Cédric Le Goater
2025-07-21 16:21 ` [PULL 08/50] ppc/xive2: Use fair irq target search algorithm Cédric Le Goater
2025-07-21 16:21 ` [PULL 09/50] ppc/xive2: Fix irq preempted by lower priority group irq Cédric Le Goater
2025-07-21 16:21 ` [PULL 10/50] ppc/xive2: Fix treatment of PIPR in CPPR update Cédric Le Goater
2025-07-21 16:21 ` [PULL 11/50] ppc/xive2: Do not present group interrupt on OS-push if precluded by CPPR Cédric Le Goater
2025-07-21 16:21 ` [PULL 12/50] ppc/xive2: Set CPPR delivery should account for group priority Cédric Le Goater
2025-07-21 16:21 ` [PULL 13/50] ppc/xive: tctx_notify should clear the precluded interrupt Cédric Le Goater
2025-07-21 16:21 ` [PULL 14/50] ppc/xive: Explicitly zero NSR after accepting Cédric Le Goater
2025-07-21 16:21 ` [PULL 15/50] ppc/xive: Move NSR decoding into helper functions Cédric Le Goater
2025-07-21 16:21 ` [PULL 16/50] ppc/xive: Fix pulling pool and phys contexts Cédric Le Goater
2025-07-21 16:22 ` [PULL 17/50] pnv/xive2: Support ESB Escalation Cédric Le Goater
2025-07-21 16:22 ` [PULL 18/50] pnv/xive2: Print value in invalid register write logging Cédric Le Goater
2025-07-21 16:22 ` [PULL 19/50] pnv/xive2: VC_ENDC_WATCH_SPEC regs should read back WATCH_FULL Cédric Le Goater
2025-07-21 16:22 ` [PULL 20/50] pnv/xive2: Permit valid writes to VC/PC Flush Control registers Cédric Le Goater
2025-07-21 16:22 ` [PULL 21/50] ppc/xive2: add interrupt priority configuration flags Cédric Le Goater
2025-07-21 16:22 ` [PULL 22/50] ppc/xive2: Support redistribution of group interrupts Cédric Le Goater
2025-07-21 16:22 ` [PULL 23/50] ppc/xive: Add more interrupt notification tracing Cédric Le Goater
2025-07-21 16:22 ` [PULL 24/50] ppc/xive2: Improve pool regs variable name Cédric Le Goater
2025-07-21 16:22 ` [PULL 25/50] ppc/xive2: Implement "Ack OS IRQ to even report line" TIMA op Cédric Le Goater
2025-07-21 16:22 ` [PULL 26/50] ppc/xive2: Redistribute group interrupt precluded by CPPR update Cédric Le Goater
2025-07-21 16:22 ` [PULL 27/50] ppc/xive2: redistribute irqs for pool and phys ctx pull Cédric Le Goater
2025-07-21 16:22 ` [PULL 28/50] ppc/xive: Change presenter .match_nvt to match not present Cédric Le Goater
2025-07-21 16:22 ` [PULL 29/50] ppc/xive2: Redistribute group interrupt preempted by higher priority interrupt Cédric Le Goater
2025-07-21 16:22 ` [PULL 30/50] ppc/xive: Add xive_tctx_pipr_present() to present new interrupt Cédric Le Goater
2025-07-21 16:22 ` [PULL 31/50] ppc/xive: Fix high prio group interrupt being preempted by low prio VP Cédric Le Goater
2025-07-21 16:22 ` [PULL 32/50] ppc/xive: Split xive recompute from IPB function Cédric Le Goater
2025-07-21 16:22 ` [PULL 33/50] ppc/xive: tctx signaling registers rework Cédric Le Goater
2025-07-21 16:22 ` [PULL 34/50] ppc/xive: tctx_accept only lower irq line if an interrupt was presented Cédric Le Goater
2025-07-21 16:22 ` [PULL 35/50] ppc/xive: Add xive_tctx_pipr_set() helper function Cédric Le Goater
2025-07-21 16:22 ` [PULL 36/50] ppc/xive2: split tctx presentation processing from set CPPR Cédric Le Goater
2025-07-21 16:22 ` [PULL 37/50] ppc/xive2: Consolidate presentation processing in context push Cédric Le Goater
2025-07-21 16:22 ` [PULL 38/50] ppc/xive2: Avoid needless interrupt re-check on CPPR set Cédric Le Goater
2025-07-21 16:22 ` [PULL 39/50] ppc/xive: Assert group interrupts were redistributed Cédric Le Goater
2025-07-21 16:22 ` [PULL 40/50] ppc/xive2: implement NVP context save restore for POOL ring Cédric Le Goater
2025-07-21 16:22 ` [PULL 41/50] ppc/xive2: Prevent pulling of pool context losing phys interrupt Cédric Le Goater
2025-07-21 16:22 ` [PULL 42/50] ppc/xive: Redistribute phys after pulling of pool context Cédric Le Goater
2025-07-21 16:22 ` [PULL 43/50] ppc/xive: Check TIMA operations validity Cédric Le Goater
2025-07-21 16:22 ` [PULL 44/50] ppc/xive2: Implement pool context push TIMA op Cédric Le Goater
2025-07-21 16:22 ` [PULL 45/50] ppc/xive2: redistribute group interrupts on context push Cédric Le Goater
2025-07-21 16:22 ` [PULL 46/50] ppc/xive2: Implement set_os_pending TIMA op Cédric Le Goater
2025-07-21 16:22 ` [PULL 47/50] ppc/xive2: Implement POOL LGS push " Cédric Le Goater
2025-07-21 16:22 ` [PULL 48/50] ppc/xive2: Implement PHYS ring VP " Cédric Le Goater
2025-07-21 16:22 ` [PULL 49/50] ppc/xive: Split need_resend into restore_nvp Cédric Le Goater
2025-07-21 16:22 ` Cédric Le Goater [this message]
2025-07-22 11:20 ` [PULL 00/50] ppc queue Stefan Hajnoczi
2025-07-22 11:44 ` Michael Tokarev
2025-07-22 13:37   ` Cédric Le Goater
2025-07-22 14:25     ` Michael Tokarev
2025-08-05 16:26       ` Miles Glenn
2025-08-05 16:33         ` Michael Tokarev
2025-08-05 20:17           ` Cédric Le Goater
2025-08-05 20:07         ` Cédric Le Goater
2025-08-06 20:46           ` Miles Glenn
2025-08-08  6:07             ` Michael Tokarev
2025-08-08  8:17               ` Cédric Le Goater
2025-08-08 16:37                 ` Miles Glenn
2025-08-12 20:38                 ` Mike Kowal
2025-08-19 12:56                 ` Gautam Menghani
2025-09-01  6:23                   ` Cédric Le Goater
2025-08-08 16:17               ` Miles Glenn

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=20250721162233.686837-51-clg@redhat.com \
    --to=clg@redhat.com \
    --cc=danielhb413@gmail.com \
    --cc=gautam@linux.ibm.com \
    --cc=kowal@linux.ibm.com \
    --cc=milesg@linux.ibm.com \
    --cc=npiggin@gmail.com \
    --cc=qemu-devel@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).