public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jonathan.cameron@huawei.com>
To: Lorenzo Pieralisi <lpieralisi@kernel.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
	Len Brown <lenb@kernel.org>,
	Robert Moore <robert.moore@intel.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Hanjun Guo <guohanjun@huawei.com>,
	Sudeep Holla <sudeep.holla@arm.com>,
	Marc Zyngier <maz@kernel.org>,
	Bjorn Helgaas <bhelgaas@google.com>, <linux-acpi@vger.kernel.org>,
	<acpica-devel@lists.linux.dev>, <linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-pci@vger.kernel.org>
Subject: Re: [PATCH v2 7/7] irqchip/gic-v5: Add ACPI IWB probing
Date: Mon, 5 Jan 2026 15:35:21 +0000	[thread overview]
Message-ID: <20260105153521.00007e46@huawei.com> (raw)
In-Reply-To: <20251218-gicv5-host-acpi-v2-7-eec76cd1d40b@kernel.org>

On Thu, 18 Dec 2025 11:14:33 +0100
Lorenzo Pieralisi <lpieralisi@kernel.org> wrote:

> To probe an IWB in an ACPI based system it is required:
> 
> - to implement the IORT functions handling the IWB IORT node and create
>   functions to retrieve IWB firmware information
> - to augment the driver to match the DSDT ACPI "ARMH0003" device and
>   retrieve the IWB wire and trigger mask from the GSI interrupt descriptor
>   in the IWB msi_domain_ops.msi_translate() function
> 
> Make the required driver changes to enable IWB probing in ACPI systems.
> 
> The GICv5 GSI format requires special handling for IWB routed IRQs.
> 
> Add IWB GSI detection to the top level driver gic_v5_get_gsi_domain_id()
> function so that the correct IRQ domain for a GSI can be detected by
> parsing the GSI and check whether it is an IWB-backed IRQ or not.
> 
> Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Hanjun Guo <guohanjun@huawei.com>
> Cc: Sudeep Holla <sudeep.holla@arm.com>
> Cc: Marc Zyngier <maz@kernel.org>
A couple of trivial comments inline. Overall this series looks in a good
state to me.
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>

> ---
>  drivers/acpi/arm64/iort.c          | 95 ++++++++++++++++++++++++++++++++------
>  drivers/irqchip/irq-gic-v5-iwb.c   | 42 +++++++++++++----
>  drivers/irqchip/irq-gic-v5.c       |  4 ++
>  include/linux/acpi_iort.h          |  1 +
>  include/linux/irqchip/arm-gic-v5.h |  6 +++
>  5 files changed, 123 insertions(+), 25 deletions(-)
> 
> diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c
> index 17dbe66da804..4b0b753db738 100644
> --- a/drivers/acpi/arm64/iort.c
> +++ b/drivers/acpi/arm64/iort.c

> @@ -317,12 +325,28 @@ static acpi_status iort_match_node_callback(struct acpi_iort_node *node,
>  	return status;
>  }
>  
> +static acpi_status iort_match_iwb_callback(struct acpi_iort_node *node, void *context)
> +{
> +	acpi_status status = AE_NOT_FOUND;
> +	u32 *id = context;
> +
> +	if (node->type == ACPI_IORT_NODE_IWB) {
> +		struct acpi_iort_iwb *iwb;
> +
> +		iwb = (struct acpi_iort_iwb *)node->node_data;
> +		status = iwb->iwb_index == *id ? AE_OK : AE_NOT_FOUND;
> +	}
> +
> +	return status;
Simpler flow with a quick exclusion of wrong nodes.
	if (node->type != ACPI_IORT_NODE_IWB)
		return AE_NOT_FOUND;
	....
	iwb = ...
	
Also not sure I'd use a ternary here given it's only slightly more code
as more readable.
	if (iwb->iwb_index != *id)
		return AE_NOT_FOUND;

	return AE_OK;

> +}


> diff --git a/drivers/irqchip/irq-gic-v5-iwb.c b/drivers/irqchip/irq-gic-v5-iwb.c
> index ad9fdc14d1c6..c7d5fd34d053 100644
> --- a/drivers/irqchip/irq-gic-v5-iwb.c
> +++ b/drivers/irqchip/irq-gic-v5-iwb.c
> @@ -4,6 +4,7 @@
>   */
>  #define pr_fmt(fmt)	"GICv5 IWB: " fmt
>  
> +#include <linux/acpi.h>
>  #include <linux/init.h>
>  #include <linux/kernel.h>
>  #include <linux/msi.h>
> @@ -136,18 +137,31 @@ static int gicv5_iwb_irq_domain_translate(struct irq_domain *d, struct irq_fwspe
>  					  irq_hw_number_t *hwirq,
>  					  unsigned int *type)
>  {
> -	if (!is_of_node(fwspec->fwnode))
> -		return -EINVAL;
> +	if (is_of_node(fwspec->fwnode)) {
>  
> -	if (fwspec->param_count < 2)
> -		return -EINVAL;
> +		if (fwspec->param_count < 2)
> +			return -EINVAL;
>  
> -	/*
> -	 * param[0] is be the wire
> -	 * param[1] is the interrupt type
> -	 */
> -	*hwirq = fwspec->param[0];
> -	*type = fwspec->param[1] & IRQ_TYPE_SENSE_MASK;
> +		/*
> +		 * param[0] is be the wire
> +		 * param[1] is the interrupt type
> +		 */
> +		*hwirq = fwspec->param[0];
> +		*type = fwspec->param[1] & IRQ_TYPE_SENSE_MASK;

As below, FIELD_GET() would improve reviewability a little.


> +	}
> +
> +	if (is_acpi_device_node(fwspec->fwnode)) {
> +
> +		if (fwspec->param_count < 2)
> +			return -EINVAL;
> +
> +		/*
> +		 * Extract the wire from param[0]
> +		 * param[1] is the interrupt type
> +		 */
> +		*hwirq = FIELD_GET(GICV5_GSI_IWB_WIRE, fwspec->param[0]);
> +		*type = fwspec->param[1] & IRQ_TYPE_SENSE_MASK;

I'd prefer this FIELD_GET() for this as well so there is no need to
go sanity check that it is the lowest bits.

> +	}
>  
>  	return 0;

  reply	other threads:[~2026-01-05 15:35 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-18 10:14 [PATCH v2 0/7] irqchip/gic-v5: Code first ACPI boot support Lorenzo Pieralisi
2025-12-18 10:14 ` [PATCH v2 1/7] ACPICA: Add GICv5 MADT structures Lorenzo Pieralisi
2025-12-18 10:14 ` [PATCH v2 2/7] ACPICA: Add Arm IORT IWB node definitions Lorenzo Pieralisi
2025-12-18 10:14 ` [PATCH v2 3/7] irqdomain: Add parent field to struct irqchip_fwid Lorenzo Pieralisi
2026-01-05 12:01   ` Jonathan Cameron
2026-01-07  8:58     ` Lorenzo Pieralisi
2026-01-07 10:04       ` Jonathan Cameron
2026-01-07 17:31         ` Lorenzo Pieralisi
2026-01-13  9:37           ` Thomas Gleixner
2026-01-13 11:04         ` Lorenzo Pieralisi
2025-12-18 10:14 ` [PATCH v2 4/7] PCI/MSI: Make the pci_msi_map_rid_ctlr_node() interface firmware agnostic Lorenzo Pieralisi
2026-01-05 12:21   ` Jonathan Cameron
2026-01-07  9:23     ` Lorenzo Pieralisi
2026-01-05 17:35   ` Bjorn Helgaas
2025-12-18 10:14 ` [PATCH v2 5/7] irqchip/gic-v5: Add ACPI IRS probing Lorenzo Pieralisi
2026-01-05 13:24   ` Jonathan Cameron
2026-01-08 16:22     ` Lorenzo Pieralisi
2025-12-18 10:14 ` [PATCH v2 6/7] irqchip/gic-v5: Add ACPI ITS probing Lorenzo Pieralisi
2026-01-05 13:55   ` Jonathan Cameron
2026-01-08 16:13     ` Lorenzo Pieralisi
2025-12-18 10:14 ` [PATCH v2 7/7] irqchip/gic-v5: Add ACPI IWB probing Lorenzo Pieralisi
2026-01-05 15:35   ` Jonathan Cameron [this message]
2026-01-08 16:12     ` Lorenzo Pieralisi
2026-01-14 15:56 ` [PATCH v2 0/7] irqchip/gic-v5: Code first ACPI boot support Rafael J. Wysocki
2026-01-14 17:03   ` Lorenzo Pieralisi

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=20260105153521.00007e46@huawei.com \
    --to=jonathan.cameron@huawei.com \
    --cc=acpica-devel@lists.linux.dev \
    --cc=bhelgaas@google.com \
    --cc=guohanjun@huawei.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=maz@kernel.org \
    --cc=rafael@kernel.org \
    --cc=robert.moore@intel.com \
    --cc=sudeep.holla@arm.com \
    --cc=tglx@linutronix.de \
    /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