[PATCH v2 01/17] firmware: arm_scmi: Define a common SCMI_MAX_PROTOCOLS value

Cristian Marussi posted 17 patches 3 weeks, 5 days ago
[PATCH v2 01/17] firmware: arm_scmi: Define a common SCMI_MAX_PROTOCOLS value
Posted by Cristian Marussi 3 weeks, 5 days ago
Add a common definition of SCMI_MAX_PROTOCOLS and use it all over the
SCMI stack.

Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
---
 drivers/firmware/arm_scmi/notify.c | 4 +---
 include/linux/scmi_protocol.h      | 3 +++
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/firmware/arm_scmi/notify.c b/drivers/firmware/arm_scmi/notify.c
index dee9f238f6fd..78e9e27dc9ec 100644
--- a/drivers/firmware/arm_scmi/notify.c
+++ b/drivers/firmware/arm_scmi/notify.c
@@ -94,8 +94,6 @@
 #include "common.h"
 #include "notify.h"
 
-#define SCMI_MAX_PROTO		256
-
 #define PROTO_ID_MASK		GENMASK(31, 24)
 #define EVT_ID_MASK		GENMASK(23, 16)
 #define SRC_ID_MASK		GENMASK(15, 0)
@@ -1673,7 +1671,7 @@ int scmi_notification_init(struct scmi_handle *handle)
 	ni->gid = gid;
 	ni->handle = handle;
 
-	ni->registered_protocols = devm_kcalloc(handle->dev, SCMI_MAX_PROTO,
+	ni->registered_protocols = devm_kcalloc(handle->dev, SCMI_MAX_PROTOCOLS,
 						sizeof(char *), GFP_KERNEL);
 	if (!ni->registered_protocols)
 		goto err;
diff --git a/include/linux/scmi_protocol.h b/include/linux/scmi_protocol.h
index aafaac1496b0..c6efe4f371ac 100644
--- a/include/linux/scmi_protocol.h
+++ b/include/linux/scmi_protocol.h
@@ -926,8 +926,11 @@ enum scmi_std_protocol {
 	SCMI_PROTOCOL_VOLTAGE = 0x17,
 	SCMI_PROTOCOL_POWERCAP = 0x18,
 	SCMI_PROTOCOL_PINCTRL = 0x19,
+	SCMI_PROTOCOL_LAST = 0x7f,
 };
 
+#define SCMI_MAX_PROTOCOLS	256
+
 enum scmi_system_events {
 	SCMI_SYSTEM_SHUTDOWN,
 	SCMI_SYSTEM_COLDRESET,
-- 
2.52.0
Re: [PATCH v2 01/17] firmware: arm_scmi: Define a common SCMI_MAX_PROTOCOLS value
Posted by Jonathan Cameron 3 weeks ago
On Wed, 14 Jan 2026 11:46:05 +0000
Cristian Marussi <cristian.marussi@arm.com> wrote:

> Add a common definition of SCMI_MAX_PROTOCOLS and use it all over the
> SCMI stack.
> 
> Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
Hi Cristian,

Mention the introduction of SCMI_PROTOCOL_LAST in the patch description
and probably say why it takes that value (which is much less than
the SCMI_MAX_PROTOCOLS value).

Jonathan

> ---
>  drivers/firmware/arm_scmi/notify.c | 4 +---
>  include/linux/scmi_protocol.h      | 3 +++
>  2 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/firmware/arm_scmi/notify.c b/drivers/firmware/arm_scmi/notify.c
> index dee9f238f6fd..78e9e27dc9ec 100644
> --- a/drivers/firmware/arm_scmi/notify.c
> +++ b/drivers/firmware/arm_scmi/notify.c
> @@ -94,8 +94,6 @@
>  #include "common.h"
>  #include "notify.h"
>  
> -#define SCMI_MAX_PROTO		256
> -
>  #define PROTO_ID_MASK		GENMASK(31, 24)
>  #define EVT_ID_MASK		GENMASK(23, 16)
>  #define SRC_ID_MASK		GENMASK(15, 0)
> @@ -1673,7 +1671,7 @@ int scmi_notification_init(struct scmi_handle *handle)
>  	ni->gid = gid;
>  	ni->handle = handle;
>  
> -	ni->registered_protocols = devm_kcalloc(handle->dev, SCMI_MAX_PROTO,
> +	ni->registered_protocols = devm_kcalloc(handle->dev, SCMI_MAX_PROTOCOLS,
>  						sizeof(char *), GFP_KERNEL);
>  	if (!ni->registered_protocols)
>  		goto err;
> diff --git a/include/linux/scmi_protocol.h b/include/linux/scmi_protocol.h
> index aafaac1496b0..c6efe4f371ac 100644
> --- a/include/linux/scmi_protocol.h
> +++ b/include/linux/scmi_protocol.h
> @@ -926,8 +926,11 @@ enum scmi_std_protocol {
>  	SCMI_PROTOCOL_VOLTAGE = 0x17,
>  	SCMI_PROTOCOL_POWERCAP = 0x18,
>  	SCMI_PROTOCOL_PINCTRL = 0x19,
> +	SCMI_PROTOCOL_LAST = 0x7f,
>  };
>  
> +#define SCMI_MAX_PROTOCOLS	256
> +
>  enum scmi_system_events {
>  	SCMI_SYSTEM_SHUTDOWN,
>  	SCMI_SYSTEM_COLDRESET,
Re: [PATCH v2 01/17] firmware: arm_scmi: Define a common SCMI_MAX_PROTOCOLS value
Posted by Dhruva Gole 2 weeks, 6 days ago
On Jan 19, 2026 at 11:18:27 +0000, Jonathan Cameron wrote:
> On Wed, 14 Jan 2026 11:46:05 +0000
> Cristian Marussi <cristian.marussi@arm.com> wrote:
> 
> > Add a common definition of SCMI_MAX_PROTOCOLS and use it all over the
> > SCMI stack.
> > 
> > Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
> Hi Cristian,
> 
> Mention the introduction of SCMI_PROTOCOL_LAST in the patch description
> and probably say why it takes that value (which is much less than
> the SCMI_MAX_PROTOCOLS value).

Rather I wonder why even add it? Is it just like a documentation/ marker
or is some other usage even planned for it?

> 
> Jonathan
> 
> > ---
> >  drivers/firmware/arm_scmi/notify.c | 4 +---
> >  include/linux/scmi_protocol.h      | 3 +++
> >  2 files changed, 4 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/firmware/arm_scmi/notify.c b/drivers/firmware/arm_scmi/notify.c
> > index dee9f238f6fd..78e9e27dc9ec 100644
> > --- a/drivers/firmware/arm_scmi/notify.c
> > +++ b/drivers/firmware/arm_scmi/notify.c
> > @@ -94,8 +94,6 @@
> >  #include "common.h"
> >  #include "notify.h"
> >  
> > -#define SCMI_MAX_PROTO		256
> > -
> >  #define PROTO_ID_MASK		GENMASK(31, 24)
> >  #define EVT_ID_MASK		GENMASK(23, 16)
> >  #define SRC_ID_MASK		GENMASK(15, 0)
> > @@ -1673,7 +1671,7 @@ int scmi_notification_init(struct scmi_handle *handle)
> >  	ni->gid = gid;
> >  	ni->handle = handle;
> >  
> > -	ni->registered_protocols = devm_kcalloc(handle->dev, SCMI_MAX_PROTO,
> > +	ni->registered_protocols = devm_kcalloc(handle->dev, SCMI_MAX_PROTOCOLS,
> >  						sizeof(char *), GFP_KERNEL);
> >  	if (!ni->registered_protocols)
> >  		goto err;
> > diff --git a/include/linux/scmi_protocol.h b/include/linux/scmi_protocol.h
> > index aafaac1496b0..c6efe4f371ac 100644
> > --- a/include/linux/scmi_protocol.h
> > +++ b/include/linux/scmi_protocol.h
> > @@ -926,8 +926,11 @@ enum scmi_std_protocol {
> >  	SCMI_PROTOCOL_VOLTAGE = 0x17,
> >  	SCMI_PROTOCOL_POWERCAP = 0x18,
> >  	SCMI_PROTOCOL_PINCTRL = 0x19,
> > +	SCMI_PROTOCOL_LAST = 0x7f,
> >  };
> >  
> > +#define SCMI_MAX_PROTOCOLS	256
> > +
> >  enum scmi_system_events {
> >  	SCMI_SYSTEM_SHUTDOWN,
> >  	SCMI_SYSTEM_COLDRESET,
> 

-- 
Best regards,
Dhruva Gole
Texas Instruments Incorporated
Re: [PATCH v2 01/17] firmware: arm_scmi: Define a common SCMI_MAX_PROTOCOLS value
Posted by Cristian Marussi 2 weeks, 6 days ago
On Tue, Jan 20, 2026 at 12:14:19PM +0530, Dhruva Gole wrote:
> On Jan 19, 2026 at 11:18:27 +0000, Jonathan Cameron wrote:
> > On Wed, 14 Jan 2026 11:46:05 +0000
> > Cristian Marussi <cristian.marussi@arm.com> wrote:
> > 
> > > Add a common definition of SCMI_MAX_PROTOCOLS and use it all over the
> > > SCMI stack.
> > > 
> > > Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
> > Hi Cristian,
> > 
> > Mention the introduction of SCMI_PROTOCOL_LAST in the patch description
> > and probably say why it takes that value (which is much less than
> > the SCMI_MAX_PROTOCOLS value).
> 
> Rather I wonder why even add it? Is it just like a documentation/ marker
> or is some other usage even planned for it?

It was a cleanup related to some changes that I then dropped from this
public series...I kept it since it seemed fine, but I will definitely drop
it in V3 since it is no more related or needed by anything in this
series.

Thanks,
Cristian
Re: [PATCH v2 01/17] firmware: arm_scmi: Define a common SCMI_MAX_PROTOCOLS value
Posted by Cristian Marussi 3 weeks ago
On Mon, Jan 19, 2026 at 11:18:27AM +0000, Jonathan Cameron wrote:
> On Wed, 14 Jan 2026 11:46:05 +0000
> Cristian Marussi <cristian.marussi@arm.com> wrote:
> 
> > Add a common definition of SCMI_MAX_PROTOCOLS and use it all over the
> > SCMI stack.
> > 
> > Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
> Hi Cristian,
> 
> Mention the introduction of SCMI_PROTOCOL_LAST in the patch description
> and probably say why it takes that value (which is much less than
> the SCMI_MAX_PROTOCOLS value).

I'll do.

Thanks,
Cristian