[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 12/14] pnv/xive: Update PIPR when updating CPPR
From: |
Michael Kowal |
Subject: |
[PATCH v4 12/14] pnv/xive: Update PIPR when updating CPPR |
Date: |
Fri, 13 Sep 2024 11:16:57 -0500 |
From: Glenn Miles <milesg@linux.ibm.com>
Current code was updating the PIPR inside the xive_tctx_accept() function
instead of the xive_tctx_set_cppr function, which is where the HW would
have it updated.
Moved the update to the xive_tctx_set_cppr function which required
additional support for pool interrupts.
Fixes: cdd4de68edb6 ("ppc/xive: notify the CPU when the interrupt priority is
more privileged")
Signed-off-by: Glenn Miles <milesg@linux.vnet.ibm.com>
Signed-off-by: Michael Kowal <kowal@linux.ibm.com>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
---
hw/intc/xive.c | 34 ++++++++++++++++++++++++++++++++--
1 file changed, 32 insertions(+), 2 deletions(-)
diff --git a/hw/intc/xive.c b/hw/intc/xive.c
index 5c5c3a2dd6..738eaf624d 100644
--- a/hw/intc/xive.c
+++ b/hw/intc/xive.c
@@ -89,7 +89,6 @@ static uint64_t xive_tctx_accept(XiveTCTX *tctx, uint8_t ring)
/* Reset the pending buffer bit */
alt_regs[TM_IPB] &= ~xive_priority_to_ipb(cppr);
- regs[TM_PIPR] = ipb_to_pipr(alt_regs[TM_IPB]);
/* Drop Exception bit */
regs[TM_NSR] &= ~mask;
@@ -143,6 +142,8 @@ void xive_tctx_reset_signal(XiveTCTX *tctx, uint8_t ring)
static void xive_tctx_set_cppr(XiveTCTX *tctx, uint8_t ring, uint8_t cppr)
{
uint8_t *regs = &tctx->regs[ring];
+ uint8_t pipr_min;
+ uint8_t ring_min;
trace_xive_tctx_set_cppr(tctx->cs->cpu_index, ring,
regs[TM_IPB], regs[TM_PIPR],
@@ -154,8 +155,37 @@ static void xive_tctx_set_cppr(XiveTCTX *tctx, uint8_t
ring, uint8_t cppr)
tctx->regs[ring + TM_CPPR] = cppr;
+ /*
+ * Recompute the PIPR based on local pending interrupts. The PHYS
+ * ring must take the minimum of both the PHYS and POOL PIPR values.
+ */
+ pipr_min = ipb_to_pipr(regs[TM_IPB]);
+ ring_min = ring;
+
+ /* PHYS updates also depend on POOL values */
+ if (ring == TM_QW3_HV_PHYS) {
+ uint8_t *pool_regs = &tctx->regs[TM_QW2_HV_POOL];
+
+ /* POOL values only matter if POOL ctx is valid */
+ if (pool_regs[TM_WORD2] & 0x80) {
+
+ uint8_t pool_pipr = ipb_to_pipr(pool_regs[TM_IPB]);
+
+ /*
+ * Determine highest priority interrupt and
+ * remember which ring has it.
+ */
+ if (pool_pipr < pipr_min) {
+ pipr_min = pool_pipr;
+ ring_min = TM_QW2_HV_POOL;
+ }
+ }
+ }
+
+ regs[TM_PIPR] = pipr_min;
+
/* CPPR has changed, check if we need to raise a pending exception */
- xive_tctx_notify(tctx, ring);
+ xive_tctx_notify(tctx, ring_min);
}
void xive_tctx_ipb_update(XiveTCTX *tctx, uint8_t ring, uint8_t ipb)
--
2.43.0
- [PATCH v4 03/14] ppc/xive2: Support TIMA "Pull OS Context to Odd Thread Reporting Line", (continued)
- [PATCH v4 03/14] ppc/xive2: Support TIMA "Pull OS Context to Odd Thread Reporting Line", Michael Kowal, 2024/09/13
- [PATCH v4 04/14] pnv/xive2: Support for "OS LGS Push" TIMA operation, Michael Kowal, 2024/09/13
- [PATCH v4 05/14] ppc/xive2: Dump more NVP state with 'info pic', Michael Kowal, 2024/09/13
- [PATCH v4 02/14] pnv/xive2: Define OGEN field in the TIMA, Michael Kowal, 2024/09/13
- [PATCH v4 07/14] ppc/xive2: Allow 1-byte write of Target field in TIMA, Michael Kowal, 2024/09/13
- [PATCH v4 06/14] ppc/xive2: Dump the VP-group and crowd tables with 'info pic', Michael Kowal, 2024/09/13
- [PATCH v4 09/14] ppc/xive2: Change context/ring specific functions to be generic, Michael Kowal, 2024/09/13
- [PATCH v4 08/14] ppc/xive2: Support "Pull Thread Context to Register" operation, Michael Kowal, 2024/09/13
- [PATCH v4 11/14] pnv/xive: Add special handling for pool targets, Michael Kowal, 2024/09/13
- [PATCH v4 12/14] pnv/xive: Update PIPR when updating CPPR,
Michael Kowal <=
- [PATCH v4 14/14] pnv/xive2: TIMA CI ops using alternative offsets or byte lengths, Michael Kowal, 2024/09/13
- [PATCH v4 13/14] pnv/xive2: TIMA support for 8-byte OS context push for PHYP, Michael Kowal, 2024/09/13
- [PATCH v4 10/14] ppc/xive2: Support "Pull Thread Context to Odd Thread Reporting Line", Michael Kowal, 2024/09/13
- Re: [PATCH v4 00/14] XIVE2 changes for TIMA operations, Cédric Le Goater, 2024/09/16