From: Daniel Henrique Barboza <danielhb413@gmail.com>
To: "Cédric Le Goater" <clg@kaod.org>,
qemu-ppc@nongnu.org, qemu-devel@nongnu.org
Cc: Alexey Kardashevskiy <aik@ozlabs.ru>,
Frederic Barrat <fbarrat@linux.ibm.com>,
Greg Kurz <groug@kaod.org>,
David Gibson <david@gibson.dropbear.id.au>
Subject: Re: [PATCH v3 12/18] ppc/pnv: Add support for PHB5 "Address-based trigger" mode
Date: Fri, 25 Feb 2022 13:11:56 -0300 [thread overview]
Message-ID: <f29e09cb-6903-44f8-99fe-019a615ce3b5@gmail.com> (raw)
In-Reply-To: <20211126115349.2737605-13-clg@kaod.org>
On 11/26/21 08:53, Cédric Le Goater wrote:
> When the Address-Based Interrupt Trigger mode is activated, the PHB
> maps the interrupt source number into the interrupt command address.
> The PHB directly triggers the IC ESB page of the interrupt number and
> not the notify page of the IC anymore.
>
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> ---
> include/hw/pci-host/pnv_phb4_regs.h | 2 +
> hw/pci-host/pnv_phb4.c | 73 ++++++++++++++++++++++++++---
> hw/pci-host/trace-events | 2 +
> 3 files changed, 71 insertions(+), 6 deletions(-)
>
> diff --git a/include/hw/pci-host/pnv_phb4_regs.h b/include/hw/pci-host/pnv_phb4_regs.h
> index 64f326b7158e..4a0d3b28efb3 100644
> --- a/include/hw/pci-host/pnv_phb4_regs.h
> +++ b/include/hw/pci-host/pnv_phb4_regs.h
> @@ -220,12 +220,14 @@
> #define PHB_PAPR_ERR_INJ_MASK_MMIO PPC_BITMASK(16, 63)
> #define PHB_ETU_ERR_SUMMARY 0x2c8
> #define PHB_INT_NOTIFY_ADDR 0x300
> +#define PHB_INT_NOTIFY_ADDR_64K PPC_BIT(1) /* P10 */
> #define PHB_INT_NOTIFY_INDEX 0x308
>
> /* Fundamental register set B */
> #define PHB_VERSION 0x800
> #define PHB_CTRLR 0x810
> #define PHB_CTRLR_IRQ_PQ_DISABLE PPC_BIT(9) /* P10 */
> +#define PHB_CTRLR_IRQ_ABT_MODE PPC_BIT(10) /* P10 */
> #define PHB_CTRLR_IRQ_PGSZ_64K PPC_BIT(11)
> #define PHB_CTRLR_IRQ_STORE_EOI PPC_BIT(12)
> #define PHB_CTRLR_MMIO_RD_STRICT PPC_BIT(13)
> diff --git a/hw/pci-host/pnv_phb4.c b/hw/pci-host/pnv_phb4.c
> index cf506d1623c3..353ce6617743 100644
> --- a/hw/pci-host/pnv_phb4.c
> +++ b/hw/pci-host/pnv_phb4.c
> @@ -1259,10 +1259,54 @@ static const char *pnv_phb4_root_bus_path(PCIHostState *host_bridge,
> return phb->bus_path;
> }
>
> -static void pnv_phb4_xive_notify(XiveNotifier *xf, uint32_t srcno,
> - bool pq_checked)
> +/*
> + * Address base trigger mode (POWER10)
> + *
> + * Trigger directly the IC ESB page
> + */
> +static void pnv_phb4_xive_notify_abt(PnvPHB4 *phb, uint32_t srcno,
> + bool pq_checked)
> +{
> + uint64_t notif_port = phb->regs[PHB_INT_NOTIFY_ADDR >> 3];
> + uint64_t data = 0; /* trigger data : don't care */
> + hwaddr addr;
> + MemTxResult result;
> + int esb_shift;
> +
> + if (notif_port & PHB_INT_NOTIFY_ADDR_64K) {
> + esb_shift = 16;
> + } else {
> + esb_shift = 12;
> + }
I would be nice to have macros for these 12/16 values.
The rest LGTM
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
> +
> + /* Compute the address of the IC ESB management page */
> + addr = (notif_port & ~PHB_INT_NOTIFY_ADDR_64K);
> + addr |= (1ull << (esb_shift + 1)) * srcno;
> + addr |= (1ull << esb_shift);
> +
> + /*
> + * When the PQ state bits are checked on the PHB, the associated
> + * PQ state bits on the IC should be ignored. Use the unconditional
> + * trigger offset to inject a trigger on the IC. This is always
> + * the case for LSIs
> + */
> + if (pq_checked) {
> + addr |= XIVE_ESB_INJECT;
> + }
> +
> + trace_pnv_phb4_xive_notify_ic(addr, data);
> +
> + address_space_stq_be(&address_space_memory, addr, data,
> + MEMTXATTRS_UNSPECIFIED, &result);
> + if (result != MEMTX_OK) {
> + phb_error(phb, "trigger failed @%"HWADDR_PRIx "\n", addr);
> + return;
> + }
> +}
> +
> +static void pnv_phb4_xive_notify_ic(PnvPHB4 *phb, uint32_t srcno,
> + bool pq_checked)
> {
> - PnvPHB4 *phb = PNV_PHB4(xf);
> uint64_t notif_port = phb->regs[PHB_INT_NOTIFY_ADDR >> 3];
> uint32_t offset = phb->regs[PHB_INT_NOTIFY_INDEX >> 3];
> uint64_t data = offset | srcno;
> @@ -1272,7 +1316,7 @@ static void pnv_phb4_xive_notify(XiveNotifier *xf, uint32_t srcno,
> data |= XIVE_TRIGGER_PQ;
> }
>
> - trace_pnv_phb4_xive_notify(notif_port, data);
> + trace_pnv_phb4_xive_notify_ic(notif_port, data);
>
> address_space_stq_be(&address_space_memory, notif_port, data,
> MEMTXATTRS_UNSPECIFIED, &result);
> @@ -1282,6 +1326,18 @@ static void pnv_phb4_xive_notify(XiveNotifier *xf, uint32_t srcno,
> }
> }
>
> +static void pnv_phb4_xive_notify(XiveNotifier *xf, uint32_t srcno,
> + bool pq_checked)
> +{
> + PnvPHB4 *phb = PNV_PHB4(xf);
> +
> + if (phb->regs[PHB_CTRLR >> 3] & PHB_CTRLR_IRQ_ABT_MODE) {
> + pnv_phb4_xive_notify_abt(phb, srcno, pq_checked);
> + } else {
> + pnv_phb4_xive_notify_ic(phb, srcno, pq_checked);
> + }
> +}
> +
> static Property pnv_phb4_properties[] = {
> DEFINE_PROP_UINT32("index", PnvPHB4, phb_id, 0),
> DEFINE_PROP_UINT32("chip-id", PnvPHB4, chip_id, 0),
> @@ -1442,10 +1498,15 @@ void pnv_phb4_update_regions(PnvPhb4PecStack *stack)
>
> void pnv_phb4_pic_print_info(PnvPHB4 *phb, Monitor *mon)
> {
> + uint64_t notif_port =
> + phb->regs[PHB_INT_NOTIFY_ADDR >> 3] & ~PHB_INT_NOTIFY_ADDR_64K;
> uint32_t offset = phb->regs[PHB_INT_NOTIFY_INDEX >> 3];
> + bool abt = !!(phb->regs[PHB_CTRLR >> 3] & PHB_CTRLR_IRQ_ABT_MODE);
>
> - monitor_printf(mon, "PHB4[%x:%x] Source %08x .. %08x\n",
> + monitor_printf(mon, "PHB4[%x:%x] Source %08x .. %08x %s @%"HWADDR_PRIx"\n",
> phb->chip_id, phb->phb_id,
> - offset, offset + phb->xsrc.nr_irqs - 1);
> + offset, offset + phb->xsrc.nr_irqs - 1,
> + abt ? "ABT" : "",
> + notif_port);
> xive_source_pic_print_info(&phb->xsrc, 0, mon);
> }
> diff --git a/hw/pci-host/trace-events b/hw/pci-host/trace-events
> index 630e9fcc5e77..6e5d8d335525 100644
> --- a/hw/pci-host/trace-events
> +++ b/hw/pci-host/trace-events
> @@ -32,3 +32,5 @@ unin_read(uint64_t addr, uint64_t value) "addr=0x%" PRIx64 " val=0x%"PRIx64
>
> # pnv_phb4.c
> pnv_phb4_xive_notify(uint64_t notif_port, uint64_t data) "notif=@0x%"PRIx64" data=0x%"PRIx64
> +pnv_phb4_xive_notify_ic(uint64_t addr, uint64_t data) "addr=@0x%"PRIx64" data=0x%"PRIx64
> +pnv_phb4_xive_notify_abt(uint64_t notif_port, uint64_t data) "notif=@0x%"PRIx64" data=0x%"PRIx64
next prev parent reply other threads:[~2022-02-25 16:20 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-26 11:53 [PATCH v3 00/18] ppc/pnv: Extend the powernv10 machine Cédric Le Goater
2021-11-26 11:53 ` [PATCH v3 01/18] ppc/xive2: Introduce a XIVE2 core framework Cédric Le Goater
2022-02-25 13:44 ` Daniel Henrique Barboza
2021-11-26 11:53 ` [PATCH v3 02/18] ppc/xive2: Introduce a presenter matching routine Cédric Le Goater
2022-02-25 13:44 ` Daniel Henrique Barboza
2021-11-26 11:53 ` [PATCH v3 03/18] ppc/pnv: Add a XIVE2 controller to the POWER10 chip Cédric Le Goater
2022-02-25 14:01 ` Daniel Henrique Barboza
2021-11-26 11:53 ` [PATCH v3 04/18] ppc/pnv: Add a OCC model for POWER10 Cédric Le Goater
2021-11-26 11:53 ` [PATCH v3 05/18] ppc/pnv: Add POWER10 quads Cédric Le Goater
2021-11-26 11:53 ` [PATCH v3 06/18] ppc/pnv: Add model for POWER10 PHB5 PCIe Host bridge Cédric Le Goater
2022-02-25 14:09 ` Daniel Henrique Barboza
2021-11-26 11:53 ` [PATCH v3 07/18] ppc/pnv: Add a HOMER model to POWER10 Cédric Le Goater
2021-11-26 11:53 ` [PATCH v3 08/18] ppc/psi: Add support for StoreEOI and 64k ESB pages (POWER10) Cédric Le Goater
2022-02-25 14:11 ` Daniel Henrique Barboza
2021-11-26 11:53 ` [PATCH v3 09/18] ppc/xive2: Add support for notification injection on ESB pages Cédric Le Goater
2022-02-25 14:18 ` Daniel Henrique Barboza
2021-11-26 11:53 ` [PATCH v3 10/18] ppc/xive: Add support for PQ state bits offload Cédric Le Goater
2022-02-25 16:00 ` Daniel Henrique Barboza
2021-11-26 11:53 ` [PATCH v3 11/18] ppc/pnv: Add support for PQ offload on PHB5 Cédric Le Goater
2022-02-25 16:06 ` Daniel Henrique Barboza
2021-11-26 11:53 ` [PATCH v3 12/18] ppc/pnv: Add support for PHB5 "Address-based trigger" mode Cédric Le Goater
2022-02-25 16:11 ` Daniel Henrique Barboza [this message]
2021-11-26 11:53 ` [PATCH v3 13/18] pnv/xive2: Introduce new capability bits Cédric Le Goater
2022-02-25 16:13 ` Daniel Henrique Barboza
2021-11-26 11:53 ` [PATCH v3 14/18] ppc/pnv: add XIVE Gen2 TIMA support Cédric Le Goater
2022-02-25 16:26 ` Daniel Henrique Barboza
2021-11-26 11:53 ` [PATCH v3 15/18] pnv/xive2: Add support XIVE2 P9-compat mode (or Gen1) Cédric Le Goater
2022-02-25 16:28 ` Daniel Henrique Barboza
2021-11-26 11:53 ` [PATCH v3 16/18] xive2: Add a get_config() handler for the router configuration Cédric Le Goater
2022-02-25 16:29 ` Daniel Henrique Barboza
2021-11-26 11:53 ` [PATCH v3 17/18] pnv/xive2: Add support for automatic save&restore Cédric Le Goater
2022-02-25 16:33 ` Daniel Henrique Barboza
2021-11-26 11:53 ` [PATCH v3 18/18] pnv/xive2: Add support for 8bits thread id Cédric Le Goater
2022-02-25 16:33 ` Daniel Henrique Barboza
2022-01-11 13:34 ` [PATCH v3 00/18] ppc/pnv: Extend the powernv10 machine Daniel Henrique Barboza
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=f29e09cb-6903-44f8-99fe-019a615ce3b5@gmail.com \
--to=danielhb413@gmail.com \
--cc=aik@ozlabs.ru \
--cc=clg@kaod.org \
--cc=david@gibson.dropbear.id.au \
--cc=fbarrat@linux.ibm.com \
--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).