qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Mike Kowal <kowal@linux.ibm.com>
To: "Cédric Le Goater" <clg@kaod.org>, qemu-devel@nongnu.org
Cc: qemu-ppc@nongnu.org, fbarrat@linux.ibm.com, npiggin@gmail.com,
	milesg@linux.ibm.com
Subject: Re: [PATCH 11/13] pnv/xive: Update PIPR when updating CPPR
Date: Thu, 29 Aug 2024 15:35:26 -0500	[thread overview]
Message-ID: <16bbfc74-e7c0-41b6-a91f-c2d121296986@linux.ibm.com> (raw)
In-Reply-To: <5dad962a-0815-40b8-b62a-d0c67612fa5f@kaod.org>


On 8/29/2024 7:29 AM, Cédric Le Goater wrote:
> On 8/1/24 22:30, Michael Kowal wrote:
>> From: Glenn Miles <milesg@linux.vnet.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.
>
> Did you confirm with the HW designer ?
>
> AFAIR, the PIPR is constructed from the IPB and the later is it updated
> the better. However, if now, both PIPR (HW and Pool) are required to
> identify the ctx to notify, I agree set_cppr() needs a change but what
> about xive_tctx_ipb_update() which is called when an interrupt
> needs a resend ?


This was fix to a bug and matches what  is specified in the XIVE2 
architecture document CPPR flows (MMIO CPPR xxx processing).


>
>
> Thanks,
>
> C.
>
>
>
>> Moved the update to the xive_tctx_set_cppr function which required
>> additional support for pool interrupts.
>>
>> Signed-off-by: Glenn Miles <milesg@linux.vnet.ibm.com>
>> Signed-off-by: Michael Kowal <kowal@linux.ibm.com>
>> ---
>>   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 5c4ca7f6e0..d951aac3a0 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 */
>>           aregs[TM_IPB] &= ~xive_priority_to_ipb(cppr);
>> -        regs[TM_PIPR] = ipb_to_pipr(aregs[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 *pregs = &tctx->regs[TM_QW2_HV_POOL];
>> +
>> +        /* POOL values only matter if POOL ctx is valid */
>> +        if (pregs[TM_WORD2] & 0x80) {
>> +
>> +            uint8_t pool_pipr = ipb_to_pipr(pregs[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)
>


  reply	other threads:[~2024-08-29 20:36 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-01 20:29 [PATCH 00/13] XIVE2 changes for TIMA operations Michael Kowal
2024-08-01 20:29 ` [PATCH 01/13] pnv/xive: TIMA patch sets pre-req alignment and formatting changes Michael Kowal
2024-08-26 10:14   ` Cédric Le Goater
2024-08-01 20:29 ` [PATCH 02/13] pnv/xive2: Define OGEN field in the TIMA Michael Kowal
2024-08-26 10:14   ` Cédric Le Goater
2024-08-01 20:29 ` [PATCH 03/13] ppc/xive2: Support TIMA "Pull OS Context to Odd Thread Reporting Line" Michael Kowal
2024-08-29  8:34   ` Cédric Le Goater
2024-08-01 20:29 ` [PATCH 04/13] pnv/xive2: Support for "OS LGS Push" TIMA operation Michael Kowal
2024-08-26 11:30   ` Cédric Le Goater
2024-08-01 20:30 ` [PATCH 05/13] ppc/xive2: Dump more NVP state with 'info pic' Michael Kowal
2024-08-26 11:39   ` Cédric Le Goater
2024-08-01 20:30 ` [PATCH 06/13] ppc/xive2: Dump the VP-group and crowd tables " Michael Kowal
2024-08-29  8:54   ` Cédric Le Goater
2024-08-01 20:30 ` [PATCH 07/13] ppc/xive2: Allow 1-byte write of Target field in TIMA Michael Kowal
2024-08-26 11:43   ` Cédric Le Goater
2024-08-01 20:30 ` [PATCH 08/13] ppc/xive2: Support "Pull Thread Context to Register" operation Michael Kowal
2024-08-26 11:46   ` Cédric Le Goater
2024-08-01 20:30 ` [PATCH 09/13] ppc/xive2: Support "Pull Thread Context to Odd Thread Reporting Line" Michael Kowal
2024-08-29 12:08   ` Cédric Le Goater
2024-08-29 20:13     ` Mike Kowal
2024-08-01 20:30 ` [PATCH 10/13] pnv/xive: Add special handling for pool targets Michael Kowal
2024-08-29 12:14   ` Cédric Le Goater
2024-08-29 20:27     ` Mike Kowal
2024-08-30  8:21       ` Cédric Le Goater
2024-08-01 20:30 ` [PATCH 11/13] pnv/xive: Update PIPR when updating CPPR Michael Kowal
2024-08-29 12:29   ` Cédric Le Goater
2024-08-29 20:35     ` Mike Kowal [this message]
2024-08-30  8:25       ` Cédric Le Goater
2024-08-30 17:06         ` Mike Kowal
2024-09-02  6:07           ` Cédric Le Goater
2024-08-29 12:58   ` Cédric Le Goater
2024-08-01 20:30 ` [PATCH 12/13] pnv/xive2: TIMA support for 8-byte OS context push for PHYP Michael Kowal
2024-08-28 11:51   ` Cédric Le Goater
2024-08-01 20:30 ` [PATCH 13/13] pnv/xive2: TIMA CI ops using alternative offsets or byte lengths Michael Kowal
2024-08-28 11:49   ` Cédric Le Goater

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=16bbfc74-e7c0-41b6-a91f-c2d121296986@linux.ibm.com \
    --to=kowal@linux.ibm.com \
    --cc=clg@kaod.org \
    --cc=fbarrat@linux.ibm.com \
    --cc=milesg@linux.ibm.com \
    --cc=npiggin@gmail.com \
    --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).