All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] firmware: zynqmp: Change panic logic in zynqmp_pmufw_load_config_object()
@ 2020-05-12  6:25 Michal Simek
  2020-05-12  9:00 ` Luca Ceresoli
  2020-06-25  8:03 ` Michal Simek
  0 siblings, 2 replies; 3+ messages in thread
From: Michal Simek @ 2020-05-12  6:25 UTC (permalink / raw)
  To: u-boot

There is no need to panic all the time when pmufw config object loading
failed. The patch improves function logic to report permission deny case
and also panic only for SPL case.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

 drivers/firmware/firmware-zynqmp.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/drivers/firmware/firmware-zynqmp.c b/drivers/firmware/firmware-zynqmp.c
index c37642569dda..bef6fc05dc69 100644
--- a/drivers/firmware/firmware-zynqmp.c
+++ b/drivers/firmware/firmware-zynqmp.c
@@ -15,6 +15,8 @@
 
 #define PMUFW_PAYLOAD_ARG_CNT	8
 
+#define XST_PM_NO_ACCESS	2002L
+
 struct zynqmp_power {
 	struct mbox_chan tx_chan;
 	struct mbox_chan rx_chan;
@@ -96,16 +98,25 @@ void zynqmp_pmufw_load_config_object(const void *cfg_obj, size_t size)
 		PM_SET_CONFIGURATION,
 		(u32)((u64)cfg_obj)
 	};
-	u32 response;
+	u32 response = 0;
 	int err;
 
 	printf("Loading new PMUFW cfg obj (%ld bytes)\n", size);
 
 	err = send_req(request, ARRAY_SIZE(request), &response, 1);
+	if (err == XST_PM_NO_ACCESS) {
+		printf("PMUFW no permission to change config object\n");
+		return;
+	}
+
 	if (err)
-		panic("Cannot load PMUFW configuration object (%d)\n", err);
-	if (response != 0)
-		panic("PMUFW returned 0x%08x status!\n", response);
+		printf("Cannot load PMUFW configuration object (%d)\n", err);
+
+	if (response)
+		printf("PMUFW returned 0x%08x status!\n", response);
+
+	if ((err || response) && IS_ENABLED(CONFIG_SPL_BUILD))
+		panic("PMUFW config object loading failed in EL3\n");
 }
 
 static int zynqmp_power_probe(struct udevice *dev)
-- 
2.26.2

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

* [PATCH] firmware: zynqmp: Change panic logic in zynqmp_pmufw_load_config_object()
  2020-05-12  6:25 [PATCH] firmware: zynqmp: Change panic logic in zynqmp_pmufw_load_config_object() Michal Simek
@ 2020-05-12  9:00 ` Luca Ceresoli
  2020-06-25  8:03 ` Michal Simek
  1 sibling, 0 replies; 3+ messages in thread
From: Luca Ceresoli @ 2020-05-12  9:00 UTC (permalink / raw)
  To: u-boot

Hi Michal,

On 12/05/20 08:25, Michal Simek wrote:
> There is no need to panic all the time when pmufw config object loading
> failed. The patch improves function logic to report permission deny case
> and also panic only for SPL case.
> 
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>

Looks good to me.

Reviewed-by: Luca Ceresoli <luca@lucaceresoli.net>

-- 
Luca

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

* [PATCH] firmware: zynqmp: Change panic logic in zynqmp_pmufw_load_config_object()
  2020-05-12  6:25 [PATCH] firmware: zynqmp: Change panic logic in zynqmp_pmufw_load_config_object() Michal Simek
  2020-05-12  9:00 ` Luca Ceresoli
@ 2020-06-25  8:03 ` Michal Simek
  1 sibling, 0 replies; 3+ messages in thread
From: Michal Simek @ 2020-06-25  8:03 UTC (permalink / raw)
  To: u-boot

?t 12. 5. 2020 v 8:25 odes?latel Michal Simek <michal.simek@xilinx.com> napsal:
>
> There is no need to panic all the time when pmufw config object loading
> failed. The patch improves function logic to report permission deny case
> and also panic only for SPL case.
>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> ---
>
>  drivers/firmware/firmware-zynqmp.c | 19 +++++++++++++++----
>  1 file changed, 15 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/firmware/firmware-zynqmp.c b/drivers/firmware/firmware-zynqmp.c
> index c37642569dda..bef6fc05dc69 100644
> --- a/drivers/firmware/firmware-zynqmp.c
> +++ b/drivers/firmware/firmware-zynqmp.c
> @@ -15,6 +15,8 @@
>
>  #define PMUFW_PAYLOAD_ARG_CNT  8
>
> +#define XST_PM_NO_ACCESS       2002L
> +
>  struct zynqmp_power {
>         struct mbox_chan tx_chan;
>         struct mbox_chan rx_chan;
> @@ -96,16 +98,25 @@ void zynqmp_pmufw_load_config_object(const void *cfg_obj, size_t size)
>                 PM_SET_CONFIGURATION,
>                 (u32)((u64)cfg_obj)
>         };
> -       u32 response;
> +       u32 response = 0;
>         int err;
>
>         printf("Loading new PMUFW cfg obj (%ld bytes)\n", size);
>
>         err = send_req(request, ARRAY_SIZE(request), &response, 1);
> +       if (err == XST_PM_NO_ACCESS) {
> +               printf("PMUFW no permission to change config object\n");
> +               return;
> +       }
> +
>         if (err)
> -               panic("Cannot load PMUFW configuration object (%d)\n", err);
> -       if (response != 0)
> -               panic("PMUFW returned 0x%08x status!\n", response);
> +               printf("Cannot load PMUFW configuration object (%d)\n", err);
> +
> +       if (response)
> +               printf("PMUFW returned 0x%08x status!\n", response);
> +
> +       if ((err || response) && IS_ENABLED(CONFIG_SPL_BUILD))
> +               panic("PMUFW config object loading failed in EL3\n");
>  }
>
>  static int zynqmp_power_probe(struct udevice *dev)
> --
> 2.26.2
>

Applied.
M

-- 
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Xilinx Microblaze
Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs
U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP/Versal SoCs

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

end of thread, other threads:[~2020-06-25  8:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-12  6:25 [PATCH] firmware: zynqmp: Change panic logic in zynqmp_pmufw_load_config_object() Michal Simek
2020-05-12  9:00 ` Luca Ceresoli
2020-06-25  8:03 ` Michal Simek

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.