From: Gustavo Romero <gromero@linux.vnet.ibm.com>
To: Greg Kurz <groug@kaod.org>, David Gibson <david@gibson.dropbear.id.au>
Cc: qemu-ppc@nongnu.org, "Cédric Le Goater" <clg@kaod.org>,
qemu-devel@nongnu.org
Subject: Re: [PATCH] spapr/xive: Use xive_source_esb_len()
Date: Thu, 13 Aug 2020 17:38:59 -0300 [thread overview]
Message-ID: <b5cfd02b-abf7-8d03-7ae2-1f483bf7b0bc@linux.vnet.ibm.com> (raw)
In-Reply-To: <159733969034.320580.6571451425779179477.stgit@bahia.lan>
Hi Greg,
On 8/13/20 2:28 PM, Greg Kurz wrote:
> static inline size_t xive_source_esb_len(XiveSource *xsrc)
> {
> return (1ull << xsrc->esb_shift) * xsrc->nr_irqs;
> }
>
> Signed-off-by: Greg Kurz <groug@kaod.org>
> ---
> Follow-up on "ppc/xive: Rework setup of XiveSource::esb_mmio"
> http://patchwork.ozlabs.org/project/qemu-devel/patch/159679992680.876294.7520540158586170894.stgit@bahia.lan/
> ---
> hw/intc/spapr_xive.c | 2 +-
> hw/intc/spapr_xive_kvm.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/hw/intc/spapr_xive.c b/hw/intc/spapr_xive.c
> index 3c84f64dc464..4bd0d606ba17 100644
> --- a/hw/intc/spapr_xive.c
> +++ b/hw/intc/spapr_xive.c
> @@ -336,7 +336,7 @@ static void spapr_xive_realize(DeviceState *dev, Error **errp)
> sysbus_init_mmio(SYS_BUS_DEVICE(xive), &end_xsrc->esb_mmio);
>
> /* Set the mapping address of the END ESB pages after the source ESBs */
> - xive->end_base = xive->vc_base + (1ull << xsrc->esb_shift) * xsrc->nr_irqs;
> + xive->end_base = xive->vc_base + xive_source_esb_len(xsrc);
>
> /*
> * Allocate the routing tables
> diff --git a/hw/intc/spapr_xive_kvm.c b/hw/intc/spapr_xive_kvm.c
> index 82a6f99f022d..3263b982239a 100644
> --- a/hw/intc/spapr_xive_kvm.c
> +++ b/hw/intc/spapr_xive_kvm.c
> @@ -831,7 +831,7 @@ void kvmppc_xive_disconnect(SpaprInterruptController *intc)
>
> /* Clear the KVM mapping */
> xsrc = &xive->source;
> - esb_len = (1ull << xsrc->esb_shift) * xsrc->nr_irqs;
> + esb_len = xive_source_esb_len(xsrc);
hrm I'd like to not add another level of indirection here.
In this specific case I think it's more clear to read just
1ull << xsrc->esb_shift) * xsrc->nr_irqs
and get the idea of one IRQ per ESB page (or pair of pages,
for trigger and management), than one having to look at
what is inside "a box" called xive_source_esb_len().
Wrapping it under another function doesn't help more when
reading the code, XIVE is already tricky enough :)
Cheers,
Gustavo
PS: It seems something messed up with the commit message. It
can be that the ML did that tho...
next prev parent reply other threads:[~2020-08-13 20:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-13 17:28 [PATCH] spapr/xive: Use xive_source_esb_len() Greg Kurz
2020-08-13 20:38 ` Gustavo Romero [this message]
2020-08-13 22:00 ` Greg Kurz
2020-08-13 23:01 ` Gustavo Romero
2020-08-14 17:00 ` Cédric Le Goater
2020-08-14 3:36 ` 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=b5cfd02b-abf7-8d03-7ae2-1f483bf7b0bc@linux.vnet.ibm.com \
--to=gromero@linux.vnet.ibm.com \
--cc=clg@kaod.org \
--cc=david@gibson.dropbear.id.au \
--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).