Discuss SCMI firmware, SCMI drivers in Linux, U-boot, OP-TEE
 help / color / mirror / Atom feed
From: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
To: Sudeep Holla <sudeep.holla@kernel.org>
Cc: arm-scmi@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	kernel-team@meta.com, Cristian Marussi <cristian.marussi@arm.com>,
	Breno Leitao <leitao@debian.org>
Subject: Re: [PATCH v3 3/9] firmware: arm_scmi: Convert OF-only paths to generic fwnode in SCMI core
Date: Mon, 24 Aug 2026 10:39:29 -0700	[thread overview]
Message-ID: <20260824103929.00004912@oss.qualcomm.com> (raw)
In-Reply-To: <20260813-acpi_scmi_pcc-v3-3-cb6b88b4ebb3@kernel.org>

On Thu, 13 Aug 2026 12:32:58 +0100
Sudeep Holla <sudeep.holla@kernel.org> wrote:

> Switch SCMI core plumbing from struct device_node * to struct
> fwnode_handle * so the core can describe SCMI instances and protocols using
> firmware nodes rather than OF nodes directly.
> 
> This change:
>   - Replaces core OF property lookups with fwnode_property_*() helpers.
>   - Switches child enumeration to
>     fwnode_for_each_available_child_node_scoped().

Why the scoped version? See inline for more on this.  Probably just needs
a comment here (or use the non _scoped variant)

>   - Plumbs fwnode through the SCMI device creation and channel setup paths.
>   - Updates transport ->chan_available() callbacks to take a fwnode.
>   - Stores per-protocol child fwnodes in info->active_protocols so the core
>     can later locate the descriptor for a given protocol ID.
>   - Updates mailbox/optee/smc/virtio transports to accept fwnodes and map
>     back to OF nodes where their existing parsing remains DT-specific.
> 
> DT-only transports such as mailbox, OP-TEE and SMC still parse DT
> properties by mapping the fwnode back to an OF node. On non-DT systems
> these transports report no channel available.
> 
> This is a mechanical step towards firmware-node neutrality and prepares the
> SCMI core for non-DT transports, such as an ACPI/PCC transport. DT users
> continue to work unchanged; no non-DT transport is enabled by this patch.
> 
> Signed-off-by: Sudeep Holla <sudeep.holla@kernel.org>

A few minor things - with those cleaned up.  Only the cleanup.h one really
matters.

Reviewed-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>

> diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c
> index ef29fd223287..9014723e0f7f 100644
> --- a/drivers/firmware/arm_scmi/driver.c
> +++ b/drivers/firmware/arm_scmi/driver.c

...

> @@ -3352,10 +3354,10 @@ static int scmi_probe(struct platform_device *pdev)
>  
>  	scmi_enable_matching_quirks(info);
>  
> -	for_each_available_child_of_node(np, child) {
> +	fwnode_for_each_available_child_node_scoped(dev_fwnode(dev), child) {

There are no early exits yet and I can't see any added later in the series.
So the scoped bit is irrelevant.  I don't mind the change on basis of
hardening or similar but it needs a comment in the patch description to 
justify that.

>  		u32 prot_id;
>  
> -		if (of_property_read_u32(child, "reg", &prot_id))
> +		if (fwnode_property_read_u32(child, "reg", &prot_id))
>  			continue;
>  
>  		if (!FIELD_FIT(MSG_PROTOCOL_ID_MASK, prot_id)) {
> @@ -3370,8 +3372,8 @@ static int scmi_probe(struct platform_device *pdev)
>  		}
>  
>  		/*
> -		 * Save this valid DT protocol descriptor amongst
> -		 * @active_protocols for this SCMI instance/
> +		 * Save this valid fwnode protocol descriptor amongst
> +		 * @active_protocols for this SCMI instance.
>  		 */
>  		ret = idr_alloc(&info->active_protocols, child,
>  				prot_id, prot_id + 1, GFP_KERNEL);
> @@ -3381,7 +3383,7 @@ static int scmi_probe(struct platform_device *pdev)
>  			continue;
>  		}
>  
> -		of_node_get(child);
> +		fwnode_handle_get(child);
>  		scmi_create_protocol_devices(child, info, prot_id, NULL);

Give this is handing over ownership I'd make that explicit and do

		scmi_create_protcol_devices(fwnode_handle_get(child), info,
					    prot_id, NULL);
but that is a slightly unrelated change - so I don't mind if you don't change
this one.

>  	}
>  
...



> diff --git a/drivers/firmware/arm_scmi/transports/smc.c b/drivers/firmware/arm_scmi/transports/smc.c
> index 1fce3ccdeb7f..1079cd01190b 100644
> --- a/drivers/firmware/arm_scmi/transports/smc.c
> +++ b/drivers/firmware/arm_scmi/transports/smc.c
> @@ -84,10 +84,15 @@ static irqreturn_t smc_msg_done_isr(int irq, void *data)
>  	return IRQ_HANDLED;
>  }
>  
> -static bool smc_chan_available(struct device_node *of_node, int idx)
> +static bool smc_chan_available(struct fwnode_handle *fwnode, int idx)
>  {
> -	struct device_node *np __free(device_node) =
> -					of_parse_phandle(of_node, "shmem", 0);
> +	struct device_node *of_node = to_of_node(fwnode);
> +	struct device_node *np __free(device_node) = NULL;

See guidance in cleanup.h.  Basically says constructor and destructor
must be together (that was after some grumpy replies from Linus to early
cleanup.h users!)

> +
> +	if (!of_node)
> +		return false;
> +
> +	np = of_parse_phandle(of_node, "shmem", 0);
	struct device_node *np __free(device_node) =
		of_parse_phandle(of_node, "shmem", 0);

And don't worry about the inline declaration - this case is specifically
allowed.

>  	if (!np)
>  		return false;


  reply	other threads:[~2026-08-24 17:39 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-13 11:32 [PATCH v3 0/9] firmware: arm_scmi: Refactoring and enablement of ACPI PCC transport Sudeep Holla
2026-08-13 11:32 ` [PATCH v3 1/9] firmware: arm_scmi: Set fwnode for the generated SCMI platform device Sudeep Holla
2026-08-24 16:51   ` Jonathan Cameron
2026-09-02  7:51     ` Sudeep Holla
2026-09-02 23:26       ` Jonathan Cameron
2026-09-03  9:16         ` Bartosz Golaszewski
2026-08-13 11:32 ` [PATCH v3 2/9] firmware: arm_scmi: Extend transport driver macro to support ACPI Sudeep Holla
2026-08-24 17:04   ` Jonathan Cameron
2026-09-02  7:53     ` Sudeep Holla
2026-08-13 11:32 ` [PATCH v3 3/9] firmware: arm_scmi: Convert OF-only paths to generic fwnode in SCMI core Sudeep Holla
2026-08-24 17:39   ` Jonathan Cameron [this message]
2026-09-02 13:39     ` Sudeep Holla
2026-09-02 23:29       ` Jonathan Cameron
2026-09-03  6:36         ` Sudeep Holla
2026-08-13 11:32 ` [PATCH v3 4/9] firmware: arm_scmi: Fall back to ACPI HID when "compatible" is absent Sudeep Holla
2026-08-24 17:43   ` Jonathan Cameron
2026-09-02  8:03     ` Sudeep Holla
2026-09-02  8:09       ` Sudeep Holla
2026-08-13 11:33 ` [PATCH v3 5/9] firmware: arm_scmi: Pass protocol ID to chan_available() transport callback Sudeep Holla
2026-08-24 17:45   ` Jonathan Cameron
2026-08-13 11:33 ` [PATCH v3 6/9] firmware: arm_scmi: Refactor protocol device creation logic Sudeep Holla
2026-08-24 17:49   ` Jonathan Cameron
2026-09-02 13:52     ` Sudeep Holla
2026-08-13 11:33 ` [PATCH v3 7/9] firmware: arm_scmi: Add ACPI PCC transport Sudeep Holla
2026-08-24 20:17   ` Jonathan Cameron
2026-09-03 13:43     ` Sudeep Holla
2026-08-13 11:33 ` [PATCH v3 8/9] firmware: arm_scmi: Initialise known ACPI protocol devices and channels Sudeep Holla
2026-08-24 20:21   ` Jonathan Cameron
2026-08-13 11:33 ` [PATCH v3 9/9] firmware: arm_scmi: Validate PCC shared memory signature Sudeep Holla
2026-08-24 20:24   ` Jonathan Cameron
2026-09-02  8:25     ` Sudeep Holla
2026-09-02 23:31       ` Jonathan Cameron
2026-09-03  6:39         ` Sudeep Holla

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=20260824103929.00004912@oss.qualcomm.com \
    --to=jonathan.cameron@oss.qualcomm.com \
    --cc=arm-scmi@vger.kernel.org \
    --cc=cristian.marussi@arm.com \
    --cc=kernel-team@meta.com \
    --cc=leitao@debian.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=sudeep.holla@kernel.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