mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lorenzo Pieralisi <lpieralisi@kernel.org>
To: Ashok Raj <ashok.raj@oss.qualcomm.com>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Marc Zyngier <maz@kernel.org>,
	Daniel Lezcano <daniel.lezcano@kernel.org>,
	Thomas Gleixner <tglx@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Danilo Krummrich <dakr@kernel.org>,
	Hanjun Guo <guohanjun@huawei.com>,
	Sudeep Holla <sudeep.holla@kernel.org>,
	Wim Van Sebroeck <wim@linux-watchdog.org>,
	Guenter Roeck <linux@roeck-us.net>,
	Robin Murphy <robin.murphy@arm.com>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	Bartosz Golaszewski <brgl@kernel.org>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	driver-core@lists.linux.dev, linux-watchdog@vger.kernel.org
Subject: Re: [PATCH RFC 02/11] ACPI: Introduce irq_get() for static fwnodes
Date: Tue, 29 Sep 2026 10:40:59 +0200	[thread overview]
Message-ID: <art5m5QPXAOAvkvW@red-moon> (raw)
In-Reply-To: <arr3IhF0bwN4uzUP@hu-ashoraj-lv.qualcomm.com>

On Mon, Sep 28, 2026 at 04:24:18PM -0700, Ashok Raj wrote:
> 
> On Fri, Sep 25, 2026 at 09:48:01AM +0200, Lorenzo Pieralisi wrote:
> > To describe and map GSIs for firmware nodes created out of ACPI static
> > table entries in a uniform way it is required to define some standard
> > properties and attach them to ACPI static fwnode as secondary nodes.
> > 
> > Define properties names to describe GSIs and their trigger-mode/polarity,
> > and implement an irq_get() callback for static fwnodes so that core code
> > can retrieve and map IRQs for ACPI static fwnodes in standard manner.
> > 
> > An empty stub for property_read_string_array() is also added, so that
> > the fwnode_irq_get_byname() interface falls back (through
> > fwnode_property_read_string_array()) to the secondary
> > fwnode to grab the "interrupt-names" property.
> > 
> > Signed-off-by: Lorenzo Pieralisi <lpieralisi@kernel.org>
> > Cc: Bartosz Golaszewski <brgl@kernel.org>
> > Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > Cc: "Rafael J. Wysocki" <rafael@kernel.org>
> > ---
> >  drivers/acpi/property.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++++-
> >  include/linux/acpi.h    |  4 +++
> >  2 files changed, 72 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/acpi/property.c b/drivers/acpi/property.c
> > index 8ee5a1f0eb48..c609100c08db 100644
> > --- a/drivers/acpi/property.c
> > +++ b/drivers/acpi/property.c
> > @@ -1766,7 +1766,74 @@ static int acpi_fwnode_irq_get(const struct fwnode_handle *fwnode,
> >  
> >  DECLARE_ACPI_FWNODE_OPS(acpi_device_fwnode_ops);
> >  DECLARE_ACPI_FWNODE_OPS(acpi_data_fwnode_ops);
> > -const struct fwnode_operations acpi_static_fwnode_ops;
> > +
> > +static int acpi_static_fwnode_read_u32_prop_index(const struct fwnode_handle *fwnode,
> > +						  const char *propname,
> > +						  unsigned int index, u32 *value)
> > +{
> > +	u32 *values;
> > +	int ret, count;
> > +
> > +	count = fwnode_property_count_u32(fwnode, propname);
> > +	if (count < 0)
> > +		return count;
> > +
> > +	if (index >= count)
> > +		return -ENOENT;
> > +
> > +	values = kcalloc(count, sizeof(*values), GFP_KERNEL);
> > +	if (!values)
> > +		return -ENOMEM;
> > +
> > +	ret = fwnode_property_read_u32_array(fwnode, propname, values, count);
> > +	if (!ret)
> > +		*value = values[index];
> > +
> 
> You lookup with a propname, and then qualify with and index? is it
> possible to have the different index but same propname? 

What is the question :) ? It is to retrieve a property value at a specific
index.

> Alternately you can send the list to caller and they can use the ones
> they need?
> 
> 
> > +	kfree(values);
> > +	return ret;
> > +}
> > +
> > +static int acpi_static_fwnode_read_string_array(const struct fwnode_handle *fwnode,
> > +						const char *propname,
> > +						const char **val, size_t nval)
> > +{
> > +	/* Route string handling to secondary software nodes */
> > +	return -EINVAL;
> > +}
> > +
> > +static int acpi_static_fwnode_irq_get(const struct fwnode_handle *fwnode,
> > +				      unsigned int index)
> > +{
> > +	u32 gsi, trigger, polarity;
> > +	int ret;
> > +
> > +	if (!fwnode->secondary)
> > +		return -ENODEV;
> > +
> > +	fwnode = fwnode->secondary;
> > +
> > +	ret = acpi_static_fwnode_read_u32_prop_index(fwnode, ACPI_IRQ_PROP_GSI,
> > +						index, &gsi);
> > +	if (ret)
> > +		return ret == -ENOENT ? -ENXIO : ret;
> > +
> > +	ret = acpi_static_fwnode_read_u32_prop_index(fwnode, ACPI_IRQ_PROP_GSI_TRIGGER,
> > +						index, &trigger);
> > +	if (ret)
> > +		return ret == -ENOENT ? -ENXIO : ret;
> > +
> > +	ret = acpi_static_fwnode_read_u32_prop_index(fwnode, ACPI_IRQ_PROP_GSI_POLARITY,
> > +						index, &polarity);
> > +	if (ret)
> > +		return ret == -ENOENT ? -ENXIO : ret;
> 
> Consolidate return to one place? 

Yes it can (and trigger and polarity can be just one property "flags", FWIW),
if we agree that's what will do, which I doubt.

Thanks,
Lorenzo

  reply	other threads:[~2026-09-29  8:41 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-25  7:47 [PATCH RFC 00/11] ACPI: ARM64: Implement IRQ mapping probe deferral for static table devices Lorenzo Pieralisi
2026-09-25  7:48 ` [PATCH RFC 01/11] ACPI: irq: Return -EPROBE_DEFER on missing IRQ domain Lorenzo Pieralisi
2026-09-25  9:45   ` Andy Shevchenko
2026-09-25  7:48 ` [PATCH RFC 02/11] ACPI: Introduce irq_get() for static fwnodes Lorenzo Pieralisi
2026-09-25  9:49   ` Andy Shevchenko
2026-09-25 10:30     ` Lorenzo Pieralisi
2026-09-25 10:54       ` Andy Shevchenko
2026-09-25 11:32         ` Lorenzo Pieralisi
2026-09-28 16:15         ` Lorenzo Pieralisi
2026-09-28 23:24   ` Ashok Raj
2026-09-29  8:40     ` Lorenzo Pieralisi [this message]
2026-09-25  7:48 ` [PATCH RFC 03/11] driver core: platform: Add static ACPI nodes IRQ retrieval/mapping code Lorenzo Pieralisi
2026-09-25  9:54   ` Andy Shevchenko
2026-09-25 10:16     ` Lorenzo Pieralisi
2026-09-25  7:48 ` [PATCH RFC 04/11] clocksource/drivers/arm_arch_timer_mmio: Dispose IRQ mappings on probe failure Lorenzo Pieralisi
2026-09-25  9:52   ` Andy Shevchenko
2026-09-25  7:48 ` [PATCH RFC 05/11] clocksource/drivers/arm_arch_timer_mmio: Implement arch mem timer deferred probe Lorenzo Pieralisi
2026-09-25  7:48 ` [PATCH RFC 06/11] ACPI: GTDT: Convert SBSA watchdog to IRQ properties Lorenzo Pieralisi
2026-09-25  9:56   ` Andy Shevchenko
2026-09-25  7:48 ` [PATCH RFC 07/11] ACPI/IORT: Convert IORT devices to IRQs software-node properties Lorenzo Pieralisi
2026-09-25  7:48 ` [PATCH RFC 08/11] watchdog: sbsa: Handle IRQ probe deferral Lorenzo Pieralisi
2026-09-25  7:48 ` [PATCH RFC 09/11] iommu/arm-smmu: Add arm-smmu IRQ mapping -EPROBE_DEFER handling Lorenzo Pieralisi
2026-09-25  7:48 ` [PATCH RFC 10/11] iommu/arm-smmu-v3: Add " Lorenzo Pieralisi
2026-09-28 22:41   ` Ashok Raj
2026-09-29  8:43     ` Lorenzo Pieralisi
2026-09-25  7:48 ` [PATCH RFC 11/11] perf/arm-smmu-v3-pmu: " 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=art5m5QPXAOAvkvW@red-moon \
    --to=lpieralisi@kernel.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=ashok.raj@oss.qualcomm.com \
    --cc=brgl@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=dakr@kernel.org \
    --cc=daniel.lezcano@kernel.org \
    --cc=driver-core@lists.linux.dev \
    --cc=gregkh@linuxfoundation.org \
    --cc=guohanjun@huawei.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=mark.rutland@arm.com \
    --cc=maz@kernel.org \
    --cc=rafael@kernel.org \
    --cc=robin.murphy@arm.com \
    --cc=sudeep.holla@kernel.org \
    --cc=tglx@kernel.org \
    --cc=will@kernel.org \
    --cc=wim@linux-watchdog.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

all inboxes | Powered by JetHome®