From: David Gibson <david@gibson.dropbear.id.au>
To: "Cédric Le Goater" <clg@kaod.org>
Cc: qemu-ppc@nongnu.org, Greg Kurz <groug@kaod.org>, qemu-devel@nongnu.org
Subject: Re: [PATCH 6/8] ppc/xive: Export priority_to_ipb() helper
Date: Thu, 2 Sep 2021 11:38:06 +1000 [thread overview]
Message-ID: <YTAq/j6BR+uxboBJ@yekko> (raw)
In-Reply-To: <20210901094153.227671-7-clg@kaod.org>
[-- Attachment #1: Type: text/plain, Size: 3844 bytes --]
On Wed, Sep 01, 2021 at 11:41:51AM +0200, Cédric Le Goater wrote:
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
Applied to ppc-for-6.2.
> ---
> include/hw/ppc/xive.h | 11 +++++++++++
> hw/intc/xive.c | 21 ++++++---------------
> 2 files changed, 17 insertions(+), 15 deletions(-)
>
> diff --git a/include/hw/ppc/xive.h b/include/hw/ppc/xive.h
> index db7641165484..29b130eaea59 100644
> --- a/include/hw/ppc/xive.h
> +++ b/include/hw/ppc/xive.h
> @@ -458,6 +458,17 @@ struct XiveENDSource {
> */
> #define XIVE_PRIORITY_MAX 7
>
> +/*
> + * Convert a priority number to an Interrupt Pending Buffer (IPB)
> + * register, which indicates a pending interrupt at the priority
> + * corresponding to the bit number
> + */
> +static inline uint8_t xive_priority_to_ipb(uint8_t priority)
> +{
> + return priority > XIVE_PRIORITY_MAX ?
> + 0 : 1 << (XIVE_PRIORITY_MAX - priority);
> +}
> +
> /*
> * XIVE Thread Interrupt Management Aera (TIMA)
> *
> diff --git a/hw/intc/xive.c b/hw/intc/xive.c
> index b817ee8e3704..b0c4f76b1d4b 100644
> --- a/hw/intc/xive.c
> +++ b/hw/intc/xive.c
> @@ -27,17 +27,6 @@
> * XIVE Thread Interrupt Management context
> */
>
> -/*
> - * Convert a priority number to an Interrupt Pending Buffer (IPB)
> - * register, which indicates a pending interrupt at the priority
> - * corresponding to the bit number
> - */
> -static uint8_t priority_to_ipb(uint8_t priority)
> -{
> - return priority > XIVE_PRIORITY_MAX ?
> - 0 : 1 << (XIVE_PRIORITY_MAX - priority);
> -}
> -
> /*
> * Convert an Interrupt Pending Buffer (IPB) register to a Pending
> * Interrupt Priority Register (PIPR), which contains the priority of
> @@ -89,7 +78,7 @@ static uint64_t xive_tctx_accept(XiveTCTX *tctx, uint8_t ring)
> regs[TM_CPPR] = cppr;
>
> /* Reset the pending buffer bit */
> - regs[TM_IPB] &= ~priority_to_ipb(cppr);
> + regs[TM_IPB] &= ~xive_priority_to_ipb(cppr);
> regs[TM_PIPR] = ipb_to_pipr(regs[TM_IPB]);
>
> /* Drop Exception bit */
> @@ -353,7 +342,7 @@ static void xive_tm_set_os_cppr(XivePresenter *xptr, XiveTCTX *tctx,
> static void xive_tm_set_os_pending(XivePresenter *xptr, XiveTCTX *tctx,
> hwaddr offset, uint64_t value, unsigned size)
> {
> - xive_tctx_ipb_update(tctx, TM_QW1_OS, priority_to_ipb(value & 0xff));
> + xive_tctx_ipb_update(tctx, TM_QW1_OS, xive_priority_to_ipb(value & 0xff));
> }
>
> static void xive_os_cam_decode(uint32_t cam, uint8_t *nvt_blk,
> @@ -1535,7 +1524,8 @@ bool xive_presenter_notify(XiveFabric *xfb, uint8_t format,
> /* handle CPU exception delivery */
> if (count) {
> trace_xive_presenter_notify(nvt_blk, nvt_idx, match.ring);
> - xive_tctx_ipb_update(match.tctx, match.ring, priority_to_ipb(priority));
> + xive_tctx_ipb_update(match.tctx, match.ring,
> + xive_priority_to_ipb(priority));
> }
>
> return !!count;
> @@ -1682,7 +1672,8 @@ static void xive_router_end_notify(XiveRouter *xrtr, uint8_t end_blk,
> * use. The presenter will resend the interrupt when the vCPU
> * is dispatched again on a HW thread.
> */
> - ipb = xive_get_field32(NVT_W4_IPB, nvt.w4) | priority_to_ipb(priority);
> + ipb = xive_get_field32(NVT_W4_IPB, nvt.w4) |
> + xive_priority_to_ipb(priority);
> nvt.w4 = xive_set_field32(NVT_W4_IPB, nvt.w4, ipb);
> xive_router_write_nvt(xrtr, nvt_blk, nvt_idx, &nvt, 4);
>
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2021-09-02 3:33 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-01 9:41 [PATCH 0/8] ppc: cleanups Cédric Le Goater
2021-09-01 9:41 ` [PATCH 1/8] docs/system: ppc: Update the URL for OpenPOWER firmware images Cédric Le Goater
2021-09-01 10:10 ` Greg Kurz
2021-09-01 11:25 ` Cédric Le Goater
2021-09-01 9:41 ` [PATCH 2/8] ppc/spapr: Add a POWER10 DD2 CPU Cédric Le Goater
2021-09-01 10:11 ` Greg Kurz
2021-09-02 1:34 ` David Gibson
2021-09-01 9:41 ` [PATCH 3/8] ppc/pnv: Add a comment on the "primary-topology-index" property Cédric Le Goater
2021-09-02 1:36 ` David Gibson
2021-09-01 9:41 ` [PATCH 4/8] ppc/pnv: Remove useless variable Cédric Le Goater
2021-09-02 1:36 ` David Gibson
2021-09-01 9:41 ` [PATCH 5/8] ppc/pnv: Add an assert when calculating the RAM distribution on chips Cédric Le Goater
2021-09-02 1:37 ` David Gibson
2021-09-02 6:28 ` Cédric Le Goater
2021-09-02 6:33 ` David Gibson
2021-09-01 9:41 ` [PATCH 6/8] ppc/xive: Export priority_to_ipb() helper Cédric Le Goater
2021-09-02 1:38 ` David Gibson [this message]
2021-09-01 9:41 ` [PATCH 7/8] ppc/xive: Export xive_tctx_word2() helper Cédric Le Goater
2021-09-02 1:38 ` David Gibson
2021-09-01 9:41 ` [PATCH 8/8] ppc/pnv: Rename "id" to "quad-id" in PnvQuad Cédric Le Goater
2021-09-02 1:39 ` David Gibson
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=YTAq/j6BR+uxboBJ@yekko \
--to=david@gibson.dropbear.id.au \
--cc=clg@kaod.org \
--cc=groug@kaod.org \
--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).