zynqmp: Add support for sending pmufw config object overlay
cover zynqmp: Add support for sending pmufw config object overlay
Hi,
this small series is extending firmware interface for sending pmufw configuration overlay with asking for access to certain device. This infrastructure can be used via command or via power domain driver.
Thanks,
Michal
Michal Simek (4):
xilinx: firmware: Introduce zynqmp_pmufw_node() for loading PMU
fragments
firmware: zynqmp: Move loading message to debug
firmware: zynqmp: Do not report error if node is already configured
arm64: zynqmp: Add command for disabling loading other overlays
board/xilinx/zynqmp/cmds.c | 16 ++++++++ drivers/firmware/firmware-zynqmp.c | 60 +++++++++++++++++++++++++++++- include/zynqmp_firmware.h | 2 + 3 files changed, 77 insertions(+), 1 deletion(-)
Signature · 1 line
2.34.1
PATCH 1/4 xilinx: firmware: Introduce zynqmp_pmufw_node() for loading PMU fragments
Introduce zynqmp_pmufw_node() for loading PMU configuration fragment for enabling IPs. Firmware driver has small overlay where NODE id is added and config fragment is sent to PMUFW. There is a need to build PMUFW with fragment support.
---
drivers/firmware/firmware-zynqmp.c | 32 ++++++++++++++++++++++++++++++ include/zynqmp_firmware.h | 1 + 2 files changed, 33 insertions(+)
drivers/firmware/firmware-zynqmp.c +32 -0
@@ -27,6 +27,38 @@ struct zynqmp_power {struct mbox_chan rx_chan; } zynqmp_power; +#define NODE_ID_LOCATION 5 + +static unsigned int xpm_configobject[] = { +/**********************************************************************/ +/* HEADER */ +2 ,/* Number of remaining words in the header */ +1 ,/* Number of sections included in config object */ +PM_CONFIG_OBJECT_TYPE_OVERLAY ,/* Type of Config object as overlay */ +/**********************************************************************/ +/* SLAVE SECTION */ + +PM_CONFIG_SLAVE_SECTION_ID ,/* Section ID */ +1 ,/* Number of slaves */ + +0 ,/* Node ID which will be changed below */ +PM_SLAVE_FLAG_IS_SHAREABLE , +PM_CONFIG_IPI_PSU_CORTEXA53_0_MASK | +PM_CONFIG_IPI_PSU_CORTEXR5_0_MASK | +PM_CONFIG_IPI_PSU_CORTEXR5_1_MASK ,/* IPI Mask */ +}; + +int zynqmp_pmufw_node (u32 id) +{ +/* Record power domain id */ + xpm_configobject[NODE_ID_LOCATION ] = id; + +zynqmp_pmufw_load_config_object (xpm_configobject, +sizeof (xpm_configobject)); + +return 0 ; +} +static int ipi_req (const u32 *req,size_t req_len,u32 *res,size_t res_maxlen) {struct zynqmp_ipi_msg msg;
include/zynqmp_firmware.h +1 -0
@@ -367,6 +367,7 @@ enum pm_ioctl_id {#define PAYLOAD_ARG_CNT 5Uunsigned int zynqmp_firmware_version (void ); +int zynqmp_pmufw_node (u32 id);void zynqmp_pmufw_load_config_object (const void *cfg_obj,size_t size);int xilinx_pm_request (u32 api_id,u32 arg0,u32 arg1,u32 arg2,u32 arg3,u32 *ret_payload);
Signature · 1 line
2.34.1
PATCH 2/4 firmware: zynqmp: Move loading message to debug
In reply to Michal SimekPower domain driver is using this function for every IP which is PD listed. This can end up with a lot of messages which end up in boot log. That's why show it only in EL3 as was used in past.
---
drivers/firmware/firmware-zynqmp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/firmware/firmware-zynqmp.c +2 -1
@@ -131,7 +131,8 @@ void zynqmp_pmufw_load_config_object(const void *cfg_obj, size_t size)int err;u32 ret_payload[PAYLOAD_ARG_CNT ]; -printf ("Loading new PMUFW cfg obj (%ld bytes)\n" , size); +if (IS_ENABLED (CONFIG_SPL_BUILD )) +printf ("Loading new PMUFW cfg obj (%ld bytes)\n" , size);flush_dcache_range ((ulong )cfg_obj, (ulong)(cfg_obj + size));
Signature · 1 line
2.34.1
PATCH 3/4 firmware: zynqmp: Do not report error if node is already configured
In reply to Michal SimekPower domain driver sends PM fragment to PMUFW. It is sent for every node which is listed in DT. But some nodes could be already enabled but driver is not capable to find it out. That's why it blinly sents request for every listed IP. When PMUFW response by XST_PM_ALREADY_CONFIGURED error code there is no need to show any error message because node is already enabled. That's why cover this case with message when DEBUG is enabled.
---
drivers/firmware/firmware-zynqmp.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/firmware/firmware-zynqmp.c +6 -0
@@ -21,6 +21,7 @@#define PMUFW_PAYLOAD_ARG_CNT 8#define XST_PM_NO_ACCESS 2002L +#define XST_PM_ALREADY_CONFIGURED 2009Lstruct zynqmp_power {struct mbox_chan tx_chan;
@@ -143,6 +144,11 @@ void zynqmp_pmufw_load_config_object(const void *cfg_obj, size_t size)return ; } +if (err ==XST_PM_ALREADY_CONFIGURED ) { +debug ("PMUFW Node is already configured\n" ); +return ; + } +if (err)printf ("Cannot load PMUFW configuration object (%d)\n" , err);
Signature · 1 line
2.34.1
PATCH 4/4 arm64: zynqmp: Add command for disabling loading other overlays
In reply to Michal SimekAdd command "zynqmp pmufw node close" to disable permission to load additional pmufw config overlays. This command will make sure that any other sw will ask for changing permission.
---
board/xilinx/zynqmp/cmds.c | 16 ++++++++++++++++ drivers/firmware/firmware-zynqmp.c | 19 +++++++++++++++++++ include/zynqmp_firmware.h | 1 + 3 files changed, 36 insertions(+)
board/xilinx/zynqmp/cmds.c +16 -0
@@ -209,6 +209,19 @@ static int do_zynqmp_pmufw(struct cmd_tbl *cmdtp, int flag, int argc,if (argc != cmdtp->maxargs)return CMD_RET_USAGE ; +if (!strncmp (argv[2 ],"node" ,4 )) { +u32 id; + +if (!strncmp (argv[3 ],"close" ,5 )) +return zynqmp_pmufw_config_close (); + + id =dectoul (argv[3 ],NULL ); + +printf ("Enable permission for node ID %d\n" , id); + +return zynqmp_pmufw_node (id); + } + addr =hextoul (argv[2 ],NULL ); size =hextoul (argv[3 ],NULL );
@@ -416,6 +429,9 @@ static char zynqmp_help_text[] = " lock(0)/split(1)\n"#endif "zynqmp pmufw address size - load PMU FW configuration object\n" +"zynqmp pmufw node <id> - load PMU FW configuration object\n" +"zynqmp pmufw node close - disable config object loading\n" +" node: keyword, id: NODE_ID in decimal format\n" "zynqmp rsa srcaddr srclen mod exp rsaop -\n" " Performs RSA encryption and RSA decryption on blob of data\n" " at srcaddr and puts it back in srcaddr using modulus and\n"
drivers/firmware/firmware-zynqmp.c +19 -0
@@ -49,6 +49,25 @@ static unsigned int xpm_configobject[] = { PM_CONFIG_IPI_PSU_CORTEXR5_1_MASK, /* IPI Mask */ }; +static unsigned int xpm_configobject_close[] = { +/**********************************************************************/ +/* HEADER */ +2 ,/* Number of remaining words in the header */ +1 ,/* Number of sections included in config object */ +PM_CONFIG_OBJECT_TYPE_OVERLAY ,/* Type of Config object as overlay */ +/**********************************************************************/ +/* SET CONFIG SECTION */ +PM_CONFIG_SET_CONFIG_SECTION_ID , +0U ,/* Loading permission to Overlay config object */ +}; + +int zynqmp_pmufw_config_close (void ) +{ +zynqmp_pmufw_load_config_object (xpm_configobject_close, +sizeof (xpm_configobject_close)); +return 0 ; +} +int zynqmp_pmufw_node (u32 id) {/* Record power domain id */
include/zynqmp_firmware.h +1 -0
@@ -368,6 +368,7 @@ enum pm_ioctl_id {unsigned int zynqmp_firmware_version (void );int zynqmp_pmufw_node (u32 id); +int zynqmp_pmufw_config_close (void );void zynqmp_pmufw_load_config_object (const void *cfg_obj,size_t size);int xilinx_pm_request (u32 api_id,u32 arg0,u32 arg1,u32 arg2,u32 arg3,u32 *ret_payload);
Signature · 1 line
2.34.1
Michal Simek
Appliedpá 14. 1. 2022 v 13:25 odesílatel Michal Simek <[email protected]> napsal:
Quoted 19 lines
Hi,
this small series is extending firmware interface for sending pmufw configuration overlay with asking for access to certain device. This infrastructure can be used via command or via power domain driver.
Thanks,
MichalMichal Simek (4):
xilinx: firmware: Introducezynqmp_pmufw_node()for loading PMU
fragments
firmware: zynqmp: Move loading message to debug
firmware: zynqmp: Do not report error if node is already configured
arm64: zynqmp: Add command for disabling loading other overlays
Quoted 8 lines
board/xilinx/zynqmp/cmds.c | 16 ++++++++ drivers/firmware/firmware-zynqmp.c | 60 +++++++++++++++++++++++++++++- include/zynqmp_firmware.h | 2 + 3 files changed, 77 insertions(+), 1 deletion(-)--
2.34.1
Applied.
M
Signature · 5 lines
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