Re: [PATCH 2/8] device property: Add software-node IRQ affinity masks
From: Leo Yan
Date: Thu Nov 19 2026 - 11:54:26 EST
On Tue, Nov 17, 2026 at 09:50:25AM +0200, Andy Shevchenko wrote:
> On Mon, Nov 16, 2026 at 06:21:29PM +0000, Leo Yan wrote:
> > Devices created from firmware tables may need CPU affinity information
> > without a corresponding firmware node. Allow software nodes to supply
> > this information through the common firmware node IRQ affinity API.
> >
> > Add software_node_add_irq_affinity() to copy a CPU mask for an IRQ index,
> > and implement the software node irq_get_affinity callback. Keep each mask
> > until the node is released and reject replacement so borrowed masks remain
> > valid for the node's lifetime.
>
>
> This is definitely not a place where to put that. Are you stating that any
> software node might find the IRQ affinity information useful? I don't think
> so. With that in mind this approach looks like a layering violation.
My intent is to expose optional affinity information through the
common platform_get_irq_affinity() interface.
As an alternative, could we represent the masks in an "irq-affinity"
property, with one CPU mask per IRQ index? The swnode .irq_get_affinity
callback would read it, using the existing property storage.
Would interpreting this property in swnode still be a layering
violation? See the sample code below.
---8<---
+static const struct cpumask *
+software_node_irq_get_affinity(const struct fwnode_handle *fwnode,
+ unsigned int index)
+{
+ const struct property_entry *prop;
+ const void *masks;
+ size_t size = cpumask_size();
+
+ prop = property_entry_get(to_swnode(fwnode)->node->properties, "irq-affinity");
+ if (!prop || index >= prop->length / size)
+ return NULL;
+
+ masks = property_get_pointer(prop);
+ return masks ? masks + index * size : NULL;
+}
+
static const struct fwnode_operations software_node_ops = {
.get = software_node_get,
.put = software_node_put,
@@ -774,6 +796,7 @@ static const struct fwnode_operations software_node_ops = {
.graph_get_port_parent = software_node_graph_get_port_parent,
.graph_parse_endpoint = software_node_graph_parse_endpoint,
.add_links = software_node_add_links,
+ .irq_get_affinity = software_node_irq_get_affinity,
};
> ...
>
> And overall, the domain specific (IRQ, DMA, et cetera) topics feels a bit
> misplaced when one can find that in the generic properties. We also have
> that PHY thingy, which is complete alien to word 'generic'.
Since software nodes have no standard property specification of their
own, would this be an appropriate way to define "irq-affinity" as a
generic swnode property?
Thanks for the review!
Leo