public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] firmware: stratix10-svc: Fix probe failure with old ATF
@ 2026-04-16  7:22 Muhammad Amirul Asyraf Mohamad Jamian
  2026-04-16  7:22 ` [PATCH 1/2] firmware: stratix10-svc: Return -EOPNOTSUPP when ATF async unsupported Muhammad Amirul Asyraf Mohamad Jamian
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Muhammad Amirul Asyraf Mohamad Jamian @ 2026-04-16  7:22 UTC (permalink / raw)
  To: Dinh Nguyen
  Cc: Mahesh Rao, Matthew Gerlach, Anders Hedlund, linux-kernel, stable

Since commit bcb9f4f07061 ("firmware: stratix10-svc: Add support for
async communication"), the SVC driver fails to probe entirely when
running with ATF versions older than 3.0 (e.g. ATF 2.5) that do not
support SIP SVC v3 asynchronous operations.

stratix10_svc_async_init() returns -EINVAL for old ATF, and the probe
function treats any non-zero return as fatal, causing:

  stratix10-svc firmware:svc: probe with driver stratix10-svc failed \
    with error -22

This prevents all dependent client drivers (hwmon, RSU, FCS) from
probing even though they can operate correctly via the synchronous V1
SMC path.

This series fixes the issue in two steps:
  1. Return -EOPNOTSUPP (instead of -EINVAL) when ATF async is
     unsupported, so callers can distinguish "not supported" from
     "bad argument / programming error".
  2. Treat -EOPNOTSUPP as non-fatal in probe, allowing the SVC driver
     to load in sync-only mode so all client drivers can probe normally.

Both patches fix bcb9f4f07061 and are tagged for stable.

Muhammad Amirul Asyraf Mohamad Jamian (2):
  firmware: stratix10-svc: Return -EOPNOTSUPP when ATF async unsupported
  firmware: stratix10-svc: Don't fail probe when async ops unsupported

 drivers/firmware/stratix10-svc.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

-- 
2.43.7

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] firmware: stratix10-svc: Return -EOPNOTSUPP when ATF async unsupported
  2026-04-16  7:22 [PATCH 0/2] firmware: stratix10-svc: Fix probe failure with old ATF Muhammad Amirul Asyraf Mohamad Jamian
@ 2026-04-16  7:22 ` Muhammad Amirul Asyraf Mohamad Jamian
  2026-04-16  7:22 ` [PATCH 2/2] firmware: stratix10-svc: Don't fail probe when async ops unsupported Muhammad Amirul Asyraf Mohamad Jamian
  2026-05-05 12:14 ` [PATCH 0/2] firmware: stratix10-svc: Fix probe failure with old ATF Dinh Nguyen
  2 siblings, 0 replies; 4+ messages in thread
From: Muhammad Amirul Asyraf Mohamad Jamian @ 2026-04-16  7:22 UTC (permalink / raw)
  To: Dinh Nguyen
  Cc: Mahesh Rao, Matthew Gerlach, Anders Hedlund, linux-kernel, stable

Add a 'supported' flag to struct stratix10_async_ctrl to indicate
whether the secure firmware supports SIP SVC v3 asynchronous
communication. When the ATF version check in stratix10_svc_async_init()
fails, set supported=false and return -EOPNOTSUPP instead of -EINVAL.

This allows callers to distinguish between "async not supported by this
ATF version" (-EOPNOTSUPP) and "programming error / bad argument"
(-EINVAL), and take appropriate action (e.g. fall back to synchronous
V1 SMC path) rather than treating both as fatal.

Also update stratix10_svc_add_async_client() to return -EOPNOTSUPP
immediately when async is not supported, rather than -EINVAL from the
!actrl->initialized check, so client drivers receive a consistent and
meaningful error code.

This patch is a prerequisite for the following fix and must be applied
together with it to correctly restore functionality on old ATF versions.

Fixes: bcb9f4f07061 ("firmware: stratix10-svc: Add support for async communication")
Cc: stable@vger.kernel.org
Suggested-by: Anders Hedlund <anders.hedlund@windriver.com>
Signed-off-by: Mahesh Rao <mahesh.rao@altera.com>
Signed-off-by: Muhammad Amirul Asyraf Mohamad Jamian <muhammad.amirul.asyraf.mohamad.jamian@altera.com>
---
 drivers/firmware/stratix10-svc.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/firmware/stratix10-svc.c b/drivers/firmware/stratix10-svc.c
index 5a76cf3fc83a..739642923ac6 100644
--- a/drivers/firmware/stratix10-svc.c
+++ b/drivers/firmware/stratix10-svc.c
@@ -212,6 +212,7 @@ struct stratix10_async_chan {
 /**
  * struct stratix10_async_ctrl - Control structure for Stratix10
  *                               asynchronous operations
+ * @supported: Flag indicating whether the system supports async operations
  * @initialized: Flag indicating whether the control structure has
  *               been initialized
  * @invoke_fn: Function pointer for invoking Stratix10 service calls
@@ -228,6 +229,7 @@ struct stratix10_async_chan {
  */
 
 struct stratix10_async_ctrl {
+	bool supported;
 	bool initialized;
 	void (*invoke_fn)(struct stratix10_async_ctrl *actrl,
 			  const struct arm_smccc_1_2_regs *args,
@@ -1103,6 +1105,7 @@ EXPORT_SYMBOL_GPL(stratix10_svc_request_channel_byname);
  * Return: 0 on success, or a negative error code on failure:
  *         -EINVAL if the channel is NULL or the async controller is
  *         not initialized.
+ *         -EOPNOTSUPP if async operations are not supported.
  *         -EALREADY if the async channel is already allocated.
  *         -ENOMEM if memory allocation fails.
  *         Other negative values if ID allocation fails.
@@ -1121,6 +1124,9 @@ int stratix10_svc_add_async_client(struct stratix10_svc_chan *chan,
 	ctrl = chan->ctrl;
 	actrl = &ctrl->actrl;
 
+	if (!actrl->supported)
+		return -EOPNOTSUPP;
+
 	if (!actrl->initialized) {
 		dev_err(ctrl->dev, "Async controller not initialized\n");
 		return -EINVAL;
@@ -1562,6 +1568,7 @@ static inline void stratix10_smc_1_2(struct stratix10_async_ctrl *actrl,
  *         initialized, -ENOMEM if memory allocation fails,
  *         -EADDRINUSE if the client ID is already reserved, or other
  *         negative error codes on failure.
+ *         -EOPNOTSUPP if system doesn't support async operations.
  */
 static int stratix10_svc_async_init(struct stratix10_svc_controller *controller)
 {
@@ -1585,10 +1592,12 @@ static int stratix10_svc_async_init(struct stratix10_svc_controller *controller)
 	    !(res.a1 > ASYNC_ATF_MINIMUM_MAJOR_VERSION ||
 	      (res.a1 == ASYNC_ATF_MINIMUM_MAJOR_VERSION &&
 	       res.a2 >= ASYNC_ATF_MINIMUM_MINOR_VERSION))) {
-		dev_err(dev,
-			"Intel Service Layer Driver: ATF version is not compatible for async operation\n");
-		return -EINVAL;
+		dev_info(dev,
+			 "Intel Service Layer Driver: ATF version is not compatible for async operation\n");
+		actrl->supported = false;
+		return -EOPNOTSUPP;
 	}
+	actrl->supported = true;
 
 	actrl->invoke_fn = stratix10_smc_1_2;
 
-- 
2.43.7


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] firmware: stratix10-svc: Don't fail probe when async ops unsupported
  2026-04-16  7:22 [PATCH 0/2] firmware: stratix10-svc: Fix probe failure with old ATF Muhammad Amirul Asyraf Mohamad Jamian
  2026-04-16  7:22 ` [PATCH 1/2] firmware: stratix10-svc: Return -EOPNOTSUPP when ATF async unsupported Muhammad Amirul Asyraf Mohamad Jamian
@ 2026-04-16  7:22 ` Muhammad Amirul Asyraf Mohamad Jamian
  2026-05-05 12:14 ` [PATCH 0/2] firmware: stratix10-svc: Fix probe failure with old ATF Dinh Nguyen
  2 siblings, 0 replies; 4+ messages in thread
From: Muhammad Amirul Asyraf Mohamad Jamian @ 2026-04-16  7:22 UTC (permalink / raw)
  To: Dinh Nguyen
  Cc: Mahesh Rao, Matthew Gerlach, Anders Hedlund, linux-kernel, stable

When the ATF version is too old to support SIP SVC v3 asynchronous
operations (e.g. ATF 2.5), stratix10_svc_async_init() returns
-EOPNOTSUPP. The probe function currently treats any non-zero return
as fatal and aborts, logging:

  stratix10-svc firmware:svc: Intel Service Layer Driver: ATF version \
    is not compatible for async operation
  stratix10-svc firmware:svc: probe with driver stratix10-svc failed \
    with error -95

This prevents the SVC driver from loading entirely, causing all
dependent client drivers (hwmon, RSU, FCS) to also fail to probe even
though they can operate correctly via the synchronous V1 SMC path.

Fix this by treating -EOPNOTSUPP from stratix10_svc_async_init() as a
non-fatal degraded condition. The driver loads in sync-only mode and
logs:

  stratix10-svc firmware:svc: Intel Service Layer Driver Initialized \
    (sync-only mode)

Fixes: bcb9f4f07061 ("firmware: stratix10-svc: Add support for async communication")
Cc: stable@vger.kernel.org
Signed-off-by: Muhammad Amirul Asyraf Mohamad Jamian <muhammad.amirul.asyraf.mohamad.jamian@altera.com>
---
 drivers/firmware/stratix10-svc.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/firmware/stratix10-svc.c b/drivers/firmware/stratix10-svc.c
index 739642923ac6..4924f6402d00 100644
--- a/drivers/firmware/stratix10-svc.c
+++ b/drivers/firmware/stratix10-svc.c
@@ -1953,10 +1953,14 @@ static int stratix10_svc_drv_probe(struct platform_device *pdev)
 	init_completion(&controller->complete_status);
 
 	ret = stratix10_svc_async_init(controller);
-	if (ret) {
+	if (ret == -EOPNOTSUPP) {
+		dev_info(dev, "Intel Service Layer Driver Initialized (sync-only mode)\n");
+	} else if (ret) {
 		dev_dbg(dev, "Intel Service Layer Driver: Error on stratix10_svc_async_init %d\n",
 			ret);
 		goto err_destroy_pool;
+	} else {
+		dev_info(dev, "Intel Service Layer Driver Initialized\n");
 	}
 
 	fifo_size = sizeof(struct stratix10_svc_data) * SVC_NUM_DATA_IN_FIFO;
-- 
2.43.7


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] firmware: stratix10-svc: Fix probe failure with old ATF
  2026-04-16  7:22 [PATCH 0/2] firmware: stratix10-svc: Fix probe failure with old ATF Muhammad Amirul Asyraf Mohamad Jamian
  2026-04-16  7:22 ` [PATCH 1/2] firmware: stratix10-svc: Return -EOPNOTSUPP when ATF async unsupported Muhammad Amirul Asyraf Mohamad Jamian
  2026-04-16  7:22 ` [PATCH 2/2] firmware: stratix10-svc: Don't fail probe when async ops unsupported Muhammad Amirul Asyraf Mohamad Jamian
@ 2026-05-05 12:14 ` Dinh Nguyen
  2 siblings, 0 replies; 4+ messages in thread
From: Dinh Nguyen @ 2026-05-05 12:14 UTC (permalink / raw)
  To: Muhammad Amirul Asyraf Mohamad Jamian
  Cc: Mahesh Rao, Matthew Gerlach, Anders Hedlund, linux-kernel, stable



On 4/16/26 02:22, Muhammad Amirul Asyraf Mohamad Jamian wrote:
> Since commit bcb9f4f07061 ("firmware: stratix10-svc: Add support for
> async communication"), the SVC driver fails to probe entirely when
> running with ATF versions older than 3.0 (e.g. ATF 2.5) that do not
> support SIP SVC v3 asynchronous operations.
> 
> stratix10_svc_async_init() returns -EINVAL for old ATF, and the probe
> function treats any non-zero return as fatal, causing:
> 
>    stratix10-svc firmware:svc: probe with driver stratix10-svc failed \
>      with error -22
> 
> This prevents all dependent client drivers (hwmon, RSU, FCS) from
> probing even though they can operate correctly via the synchronous V1
> SMC path.
> 
> This series fixes the issue in two steps:
>    1. Return -EOPNOTSUPP (instead of -EINVAL) when ATF async is
>       unsupported, so callers can distinguish "not supported" from
>       "bad argument / programming error".
>    2. Treat -EOPNOTSUPP as non-fatal in probe, allowing the SVC driver
>       to load in sync-only mode so all client drivers can probe normally.
> 
> Both patches fix bcb9f4f07061 and are tagged for stable.
> 
>
I think it makes more sense to squash these 2 patches together. Patch 1 
adds the -EOPNOTSUPP, but does not make use of it. Patch 2 actually 
makes use of the -EOPNOTSUPP. So I was a bit confused on how the change 
is getting used.

Dinh

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-05-05 12:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-16  7:22 [PATCH 0/2] firmware: stratix10-svc: Fix probe failure with old ATF Muhammad Amirul Asyraf Mohamad Jamian
2026-04-16  7:22 ` [PATCH 1/2] firmware: stratix10-svc: Return -EOPNOTSUPP when ATF async unsupported Muhammad Amirul Asyraf Mohamad Jamian
2026-04-16  7:22 ` [PATCH 2/2] firmware: stratix10-svc: Don't fail probe when async ops unsupported Muhammad Amirul Asyraf Mohamad Jamian
2026-05-05 12:14 ` [PATCH 0/2] firmware: stratix10-svc: Fix probe failure with old ATF Dinh Nguyen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox