diff mbox series

[1/4] firmware: arm_ffa: Allow FF-A initialisation even when notification fails

Message ID 20231024-ffa-notification-fixes-v1-1-d552c0ec260d@arm.com (mailing list archive)
State New, archived
Headers show
Series firmware: arm_ffa: Few fixes for FF-A notification support | expand

Commit Message

Sudeep Holla Oct. 24, 2023, 10:56 a.m. UTC
FF-A notifications are optional feature in the specification. Currently
we allow to continue if the firmware reports no support for the
notifications. However, we fail to continue and complete the FF-A
driver initialisation if the notification setup fails for any reason.

Let us allow the FF-A driver to complete the initialisation even if the
notification fails to setup. We will just flag the error and continue
to provide other features in the driver.

Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
---
 drivers/firmware/arm_ffa/driver.c | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

Comments

Jens Wiklander Oct. 25, 2023, 7:10 a.m. UTC | #1
On Tue, Oct 24, 2023 at 12:56 PM Sudeep Holla <sudeep.holla@arm.com> wrote:
>
> FF-A notifications are optional feature in the specification. Currently
> we allow to continue if the firmware reports no support for the
> notifications. However, we fail to continue and complete the FF-A
> driver initialisation if the notification setup fails for any reason.
>
> Let us allow the FF-A driver to complete the initialisation even if the
> notification fails to setup. We will just flag the error and continue
> to provide other features in the driver.
>
> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
> ---
>  drivers/firmware/arm_ffa/driver.c | 21 +++++++++------------
>  1 file changed, 9 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c
> index 07b72c679247..b4ba52d674e5 100644
> --- a/drivers/firmware/arm_ffa/driver.c
> +++ b/drivers/firmware/arm_ffa/driver.c
> @@ -1390,20 +1390,20 @@ static void ffa_notifications_cleanup(void)
>         }
>  }
>
> -static int ffa_notifications_setup(void)
> +static void ffa_notifications_setup(void)
>  {
>         int ret, irq;
>
>         ret = ffa_features(FFA_NOTIFICATION_BITMAP_CREATE, 0, NULL, NULL);
>         if (ret) {
> -               pr_err("Notifications not supported, continuing with it ..\n");
> -               return 0;
> +               pr_info("Notifications not supported, continuing with it ..\n");
> +               return;
>         }
>
>         ret = ffa_notification_bitmap_create();
>         if (ret) {
> -               pr_err("notification_bitmap_create error %d\n", ret);
> -               return ret;
> +               pr_info("Notification bitmap create error %d\n", ret);
> +               return;
>         }
>         drv_info->bitmap_created = true;
>
> @@ -1426,10 +1426,11 @@ static int ffa_notifications_setup(void)
>         ret = ffa_sched_recv_cb_update(drv_info->vm_id, ffa_self_notif_handle,
>                                        drv_info, true);
>         if (!ret)
> -               return ret;
> +               return;
>  cleanup:
> +       pr_info("Notification setup failed %d, not enabled\n", ret);
>         ffa_notifications_cleanup();
> -       return ret;
> +       return;

This return is redundant.

Thanks,
Jens

>  }
>
>  static int __init ffa_init(void)
> @@ -1487,13 +1488,9 @@ static int __init ffa_init(void)
>
>         ffa_set_up_mem_ops_native_flag();
>
> -       ret = ffa_notifications_setup();
> -       if (ret)
> -               goto partitions_cleanup;
> +       ffa_notifications_setup();
>
>         return 0;
> -partitions_cleanup:
> -       ffa_partitions_cleanup();
>  free_pages:
>         if (drv_info->tx_buffer)
>                 free_pages_exact(drv_info->tx_buffer, RXTX_BUFFER_SIZE);
>
> --
> 2.42.0
>
Sudeep Holla Oct. 25, 2023, 9:50 a.m. UTC | #2
On Wed, Oct 25, 2023 at 09:10:11AM +0200, Jens Wiklander wrote:
> On Tue, Oct 24, 2023 at 12:56 PM Sudeep Holla <sudeep.holla@arm.com> wrote:
> >
> > FF-A notifications are optional feature in the specification. Currently
> > we allow to continue if the firmware reports no support for the
> > notifications. However, we fail to continue and complete the FF-A
> > driver initialisation if the notification setup fails for any reason.
> >
> > Let us allow the FF-A driver to complete the initialisation even if the
> > notification fails to setup. We will just flag the error and continue
> > to provide other features in the driver.
> >
> > Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
> > ---
> >  drivers/firmware/arm_ffa/driver.c | 21 +++++++++------------
> >  1 file changed, 9 insertions(+), 12 deletions(-)
> >
> > diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c
> > index 07b72c679247..b4ba52d674e5 100644
> > --- a/drivers/firmware/arm_ffa/driver.c
> > +++ b/drivers/firmware/arm_ffa/driver.c
[..]
> > @@ -1426,10 +1426,11 @@ static int ffa_notifications_setup(void)
> >         ret = ffa_sched_recv_cb_update(drv_info->vm_id, ffa_self_notif_handle,
> >                                        drv_info, true);
> >         if (!ret)
> > -               return ret;
> > +               return;
> >  cleanup:
> > +       pr_info("Notification setup failed %d, not enabled\n", ret);
> >         ffa_notifications_cleanup();
> > -       return ret;
> > +       return;
>
> This return is redundant.
>

Thanks, will fix it.

--
Regards,
Sudeep
diff mbox series

Patch

diff --git a/drivers/firmware/arm_ffa/driver.c b/drivers/firmware/arm_ffa/driver.c
index 07b72c679247..b4ba52d674e5 100644
--- a/drivers/firmware/arm_ffa/driver.c
+++ b/drivers/firmware/arm_ffa/driver.c
@@ -1390,20 +1390,20 @@  static void ffa_notifications_cleanup(void)
 	}
 }
 
-static int ffa_notifications_setup(void)
+static void ffa_notifications_setup(void)
 {
 	int ret, irq;
 
 	ret = ffa_features(FFA_NOTIFICATION_BITMAP_CREATE, 0, NULL, NULL);
 	if (ret) {
-		pr_err("Notifications not supported, continuing with it ..\n");
-		return 0;
+		pr_info("Notifications not supported, continuing with it ..\n");
+		return;
 	}
 
 	ret = ffa_notification_bitmap_create();
 	if (ret) {
-		pr_err("notification_bitmap_create error %d\n", ret);
-		return ret;
+		pr_info("Notification bitmap create error %d\n", ret);
+		return;
 	}
 	drv_info->bitmap_created = true;
 
@@ -1426,10 +1426,11 @@  static int ffa_notifications_setup(void)
 	ret = ffa_sched_recv_cb_update(drv_info->vm_id, ffa_self_notif_handle,
 				       drv_info, true);
 	if (!ret)
-		return ret;
+		return;
 cleanup:
+	pr_info("Notification setup failed %d, not enabled\n", ret);
 	ffa_notifications_cleanup();
-	return ret;
+	return;
 }
 
 static int __init ffa_init(void)
@@ -1487,13 +1488,9 @@  static int __init ffa_init(void)
 
 	ffa_set_up_mem_ops_native_flag();
 
-	ret = ffa_notifications_setup();
-	if (ret)
-		goto partitions_cleanup;
+	ffa_notifications_setup();
 
 	return 0;
-partitions_cleanup:
-	ffa_partitions_cleanup();
 free_pages:
 	if (drv_info->tx_buffer)
 		free_pages_exact(drv_info->tx_buffer, RXTX_BUFFER_SIZE);