mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Robin Murphy <robin.murphy@arm.com>
To: Lorenzo Pieralisi <lpieralisi@kernel.org>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.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>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Will Deacon <will@kernel.org>,
	Bartosz Golaszewski <brgl@kernel.org>,
	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, 6 Oct 2026 17:19:23 +0100	[thread overview]
Message-ID: <d1720b63-65bf-4019-bc19-1852555f7993@arm.com> (raw)
In-Reply-To: <arqSqcoWAkhy-8do@red-moon>

On 28/09/2026 5:15 pm, Lorenzo Pieralisi wrote:
> On Fri, Sep 25, 2026 at 01:54:26PM +0300, Andy Shevchenko wrote:
>> On Fri, Sep 25, 2026 at 12:30:07PM +0200, Lorenzo Pieralisi wrote:
>>> On Fri, Sep 25, 2026 at 12:49:54PM +0300, Andy Shevchenko wrote:
>>>> On Fri, Sep 25, 2026 at 09:48:01AM +0200, Lorenzo Pieralisi wrote:
>>
>> ...
>>
>>>>> +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];
>>>>
>>>> Use standard pattern, id est
>>>>
>>>> 	if (ret)
>>>> 		...
>>>>
>>>>> +	kfree(values);
>>>>
>>>> You want to use __free()
>>>>
>>>>> +	return ret;
>>>>> +}
>>>>
>>>> I believe the whole approach is suboptimal, if you wish get indexed value (but why?)
>>>
>>> Why what (that's what the irq_get() interface requires ?) I agree it is
>>> suboptimal - the whole point of the series is an RFC on using properties
>>> to store GSI number/flags, then how to read them we will optimize it
I>>> when/if we agree that's the approach to be taken.
>>
>> Why to have indexed APIs. The callers usually do not want a single item from an
>> array, they want all of them or a big pile (exception is the array of strings,
>> but we have matching functions for that).
>>
>> As per approach, this patch is against device property and I don't think we are
>> going to agree on the approach taken in *this* patch.
> 
> Coming back to this, what is needed here is a way to stash the GSI number,
> flags and name in stardard storage (like OF nodes IRQ properties, ACPI objects
> _CRS, etc).
> 
> To give you some background, I thought about adding an array of:
> 
> GSI [number, flags, name]
> 
> to the ACPI static fwnode itself. Then basically the irq_get() API has got
> all the information it needs from the primary fwnode; while doing that I
> thought that this might have been a bit like reinventing software nodes
> (granted, software node properties are ways more general that what I suggest
> above and I don't expect any other property to be ever added to static fwnodes)
> that's why I put together the series as it is, precisely to understand what's
> best.
> 
> When you say "against device property", what do you mean precisely ?
> 
> I suppose you mean that this approach goes against software node properties
> usage guidelines ?
> 
> Anyway, again, it is just to provide some context, we are talking about
> a bunch of platform devices, it is nice to have a generic solution but
> it has to be simple enough too given its scope, I understand very well
> your concern with this approach as-is - it is there to find a way
> forward together and show what the problem is.

I guess software node properties look inviting in theory since they're a 
ready-made mechanism for effectively attaching arbitrary data to a 
fwnode, however looking at patches 6-7 and the amount of boilerplate 
involved in the reality, I'm inclined to think that a dedicated 
structure for static nodes is probably the best and most efficient 
compromise here. The redundancy argument rather falls apart once we end 
up creating copies of those contentiously-made-up property name strings 
for every node, especially given that any one of those alone is probably 
already more than the amount of actual data we need per node...

Perhaps the "purest" option might be to just store a function pointer in 
the fwnode wrapper for each static table type to provide its own 
internal irq_get() callback, so not stashing intermediate GSI data at 
all, but I suspect that might end up being more work overall.

Cheers,
Robin.

> 
> Thanks,
> Lorenzo
> 
>>>> it needs to be retrieved as that in the guts of ACPI. Allocating memory for the whole
>>>> array to retrieve a single element is simply wrong.
>>
>> ...
>>
>>>>> +#define ACPI_IRQ_PROP_GSI		"linux,acpi-gsi"
>>>>> +#define ACPI_IRQ_PROP_GSI_TRIGGER	"linux,acpi-gsi-trigger"
>>>>> +#define ACPI_IRQ_PROP_GSI_POLARITY	"linux,acpi-gsi-polarity"
>>>>
>>>> Oh... This sounds like a big ugly hack.
>>>
>>> That does not help much I am afraid.
>>>
>>> What's a ugly hack ? Property names ? Using properties for this purpose ?
>>
>> Yes, properties started with "linux," for some core functionality.
>> Yes, using properties for this also doesn't sound right. I think the problem
>> here is in the table specifications or somewhere that deep. That's why we
>> ended up in this series.
>>
>>> Again, it is an RFC for this specific reason and I mentioned that in the
>>> cover letter, thank you for your inputs.
>>
>> And here we have a discussion started :-)
>>
>> P.S. Looks like I was too quick to jump into this thread. I will wait for
>> others to share their view on all this.
>>
>> -- 
>> With Best Regards,
>> Andy Shevchenko
>>
>>


  parent reply	other threads:[~2026-10-06 16:19 UTC|newest]

Thread overview: 31+ 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-30 17:13           ` Jonathan Cameron
2026-10-06 16:19           ` Robin Murphy [this message]
2026-09-28 23:24   ` Ashok Raj
2026-09-29  8:40     ` Lorenzo Pieralisi
2026-09-30  0:38       ` Ashok Raj
2026-09-30  7:40         ` Andy Shevchenko
2026-09-30  7:56           ` Lorenzo Pieralisi
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=d1720b63-65bf-4019-bc19-1852555f7993@arm.com \
    --to=robin.murphy@arm.com \
    --cc=andriy.shevchenko@linux.intel.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=lpieralisi@kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=maz@kernel.org \
    --cc=rafael@kernel.org \
    --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®