support remote system update on Intel Stratix10 SoC
Subsystems (3)
v2 cover support remote system update on Intel Stratix10 SoC
From: Richard Gong <[email protected]>
This is 2nd submission of Intel Remote System Update patches.
The Intel Remote System Update (RSU) provides a way for users to update the QSPI configuration bitstream of a Intel Stratix10 SoC device with significantly reduced risk of corrupting the bitstream storage and bricking the system.
The patchset adds RSU support which allows user to perform a complete set of RSU operations via provided console commands.
The patches have reviewed by other colleagues at Intel.
Richard Gong (4):
arm: socfpga: stratix10: add RSU mailbox support
drivers: firmware: add RSU support for Stratix10 SoC
dirvers: firmware: add console commands for RSU support
arm: socfpga: stratix10: add environment variables for RSU support
arch/arm/mach-socfpga/include/mach/mailbox_s10.h | 36 +- arch/arm/mach-socfpga/mailbox_s10.c | 79 ++ arch/arm/mach-socfpga/misc_s10.c | 9 + drivers/firmware/Kconfig | 11 + drivers/firmware/Makefile | 1 + drivers/firmware/rsu.c | 662 ++++++++++++++ drivers/firmware/rsu_ll_qspi.c | 1050 ++++++++++++++++++++++ drivers/firmware/rsu_misc.c | 817 +++++++++++++++++ drivers/firmware/rsu_s10.c | 874 ++++++++++++++++++ include/intel/rsu.h | 291 ++++++ include/intel/rsu_ll.h | 72 ++ include/intel/rsu_misc.h | 60 ++ include/intel/rsu_s10.h | 46 + 13 files changed, 3998 insertions(+), 10 deletions(-) create mode 100644 drivers/firmware/rsu.c create mode 100644 drivers/firmware/rsu_ll_qspi.c create mode 100644 drivers/firmware/rsu_misc.c create mode 100644 drivers/firmware/rsu_s10.c create mode 100644 include/intel/rsu.h create mode 100644 include/intel/rsu_ll.h create mode 100644 include/intel/rsu_misc.h create mode 100644 include/intel/rsu_s10.h
Signature · 1 line
2.7.4
PATCH v2 1/4 arm: socfpga: stratix10: add RSU mailbox support
From: Richard Gong <[email protected]>
Add Remote System Update (RSU) related mailbox support. This includes RSU_STATUS which reports status of bitstream loaded by Configuration Management Firmware (CMF), RSU_UPDATE which will invokes CMF to load new bitstream, GET_SUBPARTITION_TABLE which will query CMF on the start address of sub-partition table, HPS_STAGE_NOTIFY which notifies firmware the stage of HPS code execution and related functions to support Secure Monitor Call (SMC).
--- arch/arm/mach-socfpga/include/mach/mailbox_s10.h | 36 ++++++++--- arch/arm/mach-socfpga/mailbox_s10.c | 79 ++++++++++++++++++++++++ 2 files changed, 105 insertions(+), 10 deletions(-)
arch/arm/mach-socfpga/include/mach/mailbox_s10.h +26 -10
@@ -77,16 +77,20 @@ enum ALT_SDM_MBOX_RESP_CODE { };/* Mailbox command list */ -#define MBOX_RESTART 2 -#define MBOX_CONFIG_STATUS 4 -#define MBOX_RECONFIG 6 -#define MBOX_RECONFIG_MSEL 7 -#define MBOX_RECONFIG_DATA 8 -#define MBOX_RECONFIG_STATUS 9 -#define MBOX_QSPI_OPEN 50 -#define MBOX_QSPI_CLOSE 51 -#define MBOX_QSPI_DIRECT 59 -#define MBOX_REBOOT_HPS 71 +#define MBOX_RESTART 2 +#define MBOX_CONFIG_STATUS 4 +#define MBOX_RECONFIG 6 +#define MBOX_RECONFIG_MSEL 7 +#define MBOX_RECONFIG_DATA 8 +#define MBOX_RECONFIG_STATUS 9 +#define MBOX_QSPI_OPEN 50 +#define MBOX_QSPI_CLOSE 51 +#define MBOX_QSPI_DIRECT 59 +#define MBOX_REBOOT_HPS 71 +#define MBOX_GET_SUBPARTITION_TABLE 90 +#define MBOX_RSU_STATUS 91 +#define MBOX_RSU_UPDATE 92 +#define MBOX_HPS_STAGE_NOTIFY 93/* Mailbox registers */ #define MBOX_CIN 0/* command valid offset */
@@ -130,6 +134,11 @@ enum ALT_SDM_MBOX_RESP_CODE {#define RCF_SOFTFUNC_STATUS_SEU_ERROR BIT(3)#define RCF_PIN_STATUS_NSTATUS BIT(31) +/* Defines for HPS_STAGE_NOTIFY */ +#define HPS_EXECUTION_STATE_FSBL 0 +#define HPS_EXECUTION_STATE_SSBL 1 +#define HPS_EXECUTION_STATE_OS 2 +int mbox_send_cmd (u8 id,u32 cmd,u8 is_indirect,u32 len,u32 *arg,u8 urgent,u32 *resp_buf_len,u32 *resp_buf); int mbox_send_cmd_psci(u8 id, u32 cmd, u8 is_indirect, u32 len, u32 *arg,
@@ -146,6 +155,13 @@ int mbox_qspi_open(void);#endif int mbox_reset_cold (void ); +int mbox_rsu_get_spt_offset (u32 *resp_buf,u32 resp_buf_len); +int mbox_rsu_status (u32 *resp_buf,u32 resp_buf_len); +int mbox_rsu_status_psci (u32 *resp_buf,u32 resp_buf_len); +int mbox_rsu_update (u32 *flash_offset); +int mbox_rsu_update_psci (u32 *flash_offset); +int mbox_hps_stage_notify (u32 execution_stage); +int mbox_hps_stage_notify_psci (u32 execution_stage);int mbox_get_fpga_config_status (u32 cmd);int mbox_get_fpga_config_status_psci (u32 cmd);#endif /* _MAILBOX_S10_H_ */
arch/arm/mach-socfpga/mailbox_s10.c +79 -0
103 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v2 2/4 drivers: firmware: add RSU support for Stratix10 SoC
In reply to richard.gong at linux.intel.comFrom: Richard Gong <[email protected]>
The Intel Remote System Update (RSU) provides a way for users to update the QSPI configuration bitstream of an Intel Stratix 10 SoC device with significantly reduced risk of corrupting the bitstream storage and bricking the system.
This patch adds RSU support which allows user to perform a complete set of RSU operations:
1. Provides support for creating the initial flash images for a system to support RSU.
2. Allows several production images to be tried in a specific order until one of them is successful.
3. Loads a factory image if no production image is available, or all production images failed.
4. Provides users with the ability to add and remove production images.
5. Provides user with the ability to change the order in which production images are loaded.
6. Provides user with the ability to load a specific image from flash. The image is a production or factory image.
7. Provides user with information on which image is currently running, and what errors were encountered by RSU.
--- drivers/firmware/Kconfig | 11 + drivers/firmware/Makefile | 1 + drivers/firmware/rsu.c | 662 +++++++++++++++++++++++++ drivers/firmware/rsu_ll_qspi.c | 1050 ++++++++++++++++++++++++++++++++++++++++ drivers/firmware/rsu_misc.c | 817 +++++++++++++++++++++++++++++++ include/intel/rsu.h | 291 +++++++++++ include/intel/rsu_ll.h | 72 +++ include/intel/rsu_misc.h | 60 +++ 8 files changed, 2964 insertions(+) create mode 100644 drivers/firmware/rsu.c create mode 100644 drivers/firmware/rsu_ll_qspi.c create mode 100644 drivers/firmware/rsu_misc.c create mode 100644 include/intel/rsu.h create mode 100644 include/intel/rsu_ll.h create mode 100644 include/intel/rsu_misc.h
drivers/firmware/Kconfig +11 -0
@@ -26,3 +26,14 @@ config TI_SCI_PROTOCOL This protocol library is used by client drivers to use the features provided by the system controller. + +config INTEL_RSU + bool "Intel Stratix10/Agilex Remote System Update" + depends on TARGET_SOCFPGA_STRATIX10 + help + The Intel Remote System Update (RSU) provides a way for users + to update the QSPI configuration bitstream of an Intel Stratix10 + or Agilex SoC device with significantly reduced risk of + corrupting the bitstream storage and bricking the system. + + Say Y here if you want Intel RSU support.
drivers/firmware/Makefile +1 -0
@@ -2,3 +2,4 @@ obj-$(CONFIG_FIRMWARE) += firmware-uclass.o obj-$(CONFIG_$(SPL_)ARM_PSCI_FW) += psci.o obj-$(CONFIG_TI_SCI_PROTOCOL) += ti_sci.o obj-$(CONFIG_SANDBOX) += firmware-sandbox.o +obj-$(CONFIG_INTEL_RSU) += rsu.o rsu_ll_qspi.o rsu_misc.o
drivers/firmware/rsu.c new file +662 -0
662 lines not on this page · raw message
drivers/firmware/rsu_ll_qspi.c new file +1050 -0
1,050 lines not on this page · raw message
drivers/firmware/rsu_misc.c new file +817 -0
817 lines not on this page · raw message
include/intel/rsu.h new file +291 -0
291 lines not on this page · raw message
include/intel/rsu_ll.h new file +72 -0
72 lines not on this page · raw message
include/intel/rsu_misc.h new file +60 -0
60 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v2 3/4 dirvers: firmware: add console commands for RSU support
In reply to richard.gong at linux.intel.comFrom: Richard Gong <[email protected]>
The Intel Remote System Update (RSU) provides a way for users to update the QSPI configuration bitstream of a Intel Stratix 10 SoC device with significantly reduced risk of corrupting the bitstream storage and bricking the system.
This patch provides console commands to exercises the RSU APIs at Intel Stratix10 SoC. The commands use the term "slot" to refer to a sub-partition which is intended to contain a production image, and the term "priority" to refer to the fact that the images are loaded by firmware in the defined order.
The provided console commands are below, you can also refer to the header file rsu.h for the details of RSU APIs:
slot_count
slot_by_name
slot_get_info
slot_size
slot_priority
slot_erase
slot_program_buf
slot_program_buf_raw
slot_verify_buf
slot_verify_buf_raw
slot_enable
slot_disable
slot_load
slot_load_factory
slot_rename
status_log
list
dtb
update
notify
clear_error_status
reset_retry_counter
--- drivers/firmware/Makefile | 2 +- drivers/firmware/rsu_s10.c | 874 +++++++++++++++++++++++++++++++++++++++++++++ include/intel/rsu_s10.h | 46 +++ 3 files changed, 921 insertions(+), 1 deletion(-) create mode 100644 drivers/firmware/rsu_s10.c create mode 100644 include/intel/rsu_s10.h
drivers/firmware/Makefile +1 -1
@@ -2,4 +2,4 @@ obj-$(CONFIG_FIRMWARE) += firmware-uclass.o obj-$(CONFIG_$(SPL_)ARM_PSCI_FW) += psci.o obj-$(CONFIG_TI_SCI_PROTOCOL) += ti_sci.o obj-$(CONFIG_SANDBOX) += firmware-sandbox.o -obj-$(CONFIG_INTEL_RSU) += rsu.o rsu_ll_qspi.o rsu_misc.o +obj-$(CONFIG_INTEL_RSU) += rsu.o rsu_ll_qspi.o rsu_misc.o rsu_s10.o
drivers/firmware/rsu_s10.c new file +874 -0
874 lines not on this page · raw message
include/intel/rsu_s10.h new file +46 -0
46 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v2 4/4 arm: socfpga: stratix10: add environment variables for RSU support
In reply to richard.gong at linux.intel.comFrom: Richard Gong <[email protected]>
Add two RSU environment variables:
1. rsu_log_level
the variable is unsigned integer and its default value is RSU_DEBUG (7), which only show log with RSU_INFO,RSU_WARNING and RSU_ERR.
To enable all logs (RSU_ERR, RSU_WARNING, RSU_INFO and RSU_DEBUG), you need set log level to 8 or above via “setenv rsu_log_level 8”.
To disable all logs, you need set log level to 3 or below.
2. rsu_protected_slot
by default there is no protected RSU slot, you need run "setenv rsu_protected_slot <slot_num>” to set a slot protected, and “setenv rsu_protected_slot <a space>” to unset a protected slot.
--- arch/arm/mach-socfpga/misc_s10.c | 9 +++++++++ 1 file changed, 9 insertions(+)
arch/arm/mach-socfpga/misc_s10.c +9 -0
@@ -21,6 +21,8 @@#include <dt-bindings/reset/altr,rst-mgr-s10.h> +#define RSU_DEFAULT_LOG_LEVEL 7 +DECLARE_GLOBAL_DATA_PTR ; static struct socfpga_system_manager *sysmgr_regs =
@@ -136,10 +138,17 @@ int print_cpuinfo(void)int arch_misc_init (void ) {char qspi_string[13 ]; +char level[4 ]; + +snprintf (level,sizeof (level),"%u" ,RSU_DEFAULT_LOG_LEVEL );sprintf (qspi_string,"<0x%08x>" ,cm_get_qspi_controller_clk_hz ());env_set ("qspi_clock" , qspi_string); +/* setup for RSU */ +env_set ("rsu_protected_slot" ,"" ); +env_set ("rsu_log_level" , level); +socfpga_set_phymode ();return 0 ; }
Signature · 1 line
2.7.4
v2 cover support remote system update on Intel Stratix10 SoC
In reply to richard.gong at linux.intel.comAm 30.10.2019 um 21:34 schrieb richard.gong at linux.intel.com:
Quoted 3 lines
From: Richard Gong <[email protected]>
This is 2nd submission of Intel Remote System Update patches.
Ok, so what has changed since v1? You'd normally add a changelog (ideally to both this cover-letter and to each patch). Have a look at patman in tools/patman, that allows you to create those changelogs more easily.
Quoted 11 lines
The Intel Remote System Update (RSU) provides a way for users to update the QSPI configuration bitstream of a Intel Stratix10 SoC device with significantly reduced risk of corrupting the bitstream storage and bricking the system.
The patchset adds RSU support which allows user to perform a complete set of RSU operations via provided console commands.
The patches have reviewed by other colleagues at Intel.
Quoted 8 lines
Richard Gong (4):
arm: socfpga: stratix10: add RSU mailbox support
drivers: firmware: add RSU support for Stratix10 SoC
dirvers: firmware: add console commands for RSU support
arm: socfpga: stratix10: add environment variables for RSU supportarch/arm/mach-socfpga/include/mach/mailbox_s10.h | 36 +- arch/arm/mach-socfpga/mailbox_s10.c | 79 ++
Do you have plans to move this code to drivers/mailbox?
Quoted 7 lines
arch/arm/mach-socfpga/misc_s10.c | 9 + drivers/firmware/Kconfig | 11 + drivers/firmware/Makefile | 1 + drivers/firmware/rsu.c | 662 ++++++++++++++ drivers/firmware/rsu_ll_qspi.c | 1050 ++++++++++++++++++++++ drivers/firmware/rsu_misc.c | 817 +++++++++++++++++ drivers/firmware/rsu_s10.c | 874 ++++++++++++++++++
Ok, so you started to add this "RSU" as a driver, that's probably fine (sorry I did not find the time to review that, yet).
However, I think you'd need a more specific name, probably including 'intel' or something to make this more clear.
I'll hope to find the time to review the rest this week.
Regards,
Simon
Quoted 14 lines
include/intel/rsu.h | 291 ++++++ include/intel/rsu_ll.h | 72 ++ include/intel/rsu_misc.h | 60 ++ include/intel/rsu_s10.h | 46 + 13 files changed, 3998 insertions(+), 10 deletions(-)create mode 100644
drivers/firmware/rsu.ccreate mode 100644drivers/firmware/rsu_ll_qspi.ccreate mode 100644drivers/firmware/rsu_misc.ccreate mode 100644drivers/firmware/rsu_s10.ccreate mode 100644include/intel/rsu.hcreate mode 100644include/intel/rsu_ll.hcreate mode 100644include/intel/rsu_misc.hcreate mode 100644include/intel/rsu_s10.h
v2 cover support remote system update on Intel Stratix10 SoC
Hi Simon,
Thanks for your comments!
Quoted 27 lines · Simon Goldschmidt
Am 30.10.2019 um 21:34 schrieb richard.gong at linux.intel.com:
Quoted 3 lines
From: Richard Gong <[email protected]>
This is 2nd submission of Intel Remote System Update patches.
Ok, so what has changed since v1? You'd normally add a changelog (ideally to both this cover-letter and to each patch). Have a look at patman in
tools/patman, that allows you to create those changelogs more easily.
Sorry I missed that. I will add change details in the next submissions.Quoted 17 lines
The Intel Remote System Update (RSU) provides a way for users to update the QSPI configuration bitstream of a Intel Stratix10 SoC device with significantly reduced risk of corrupting the bitstream storage and bricking the system.
The patchset adds RSU support which allows user to perform a complete set of RSU operations via provided console commands.
The patches have reviewed by other colleagues at Intel.
Richard Gong (4):
arm: socfpga: stratix10: add RSU mailbox support
drivers: firmware: add RSU support for Stratix10 SoC
dirvers: firmware: add console commands for RSU support
arm: socfpga: stratix10: add environment variables for RSU support
Quoted 5 lines
Quoted 2 lines
arch/arm/mach-socfpga/include/mach/mailbox_s10.h| 36 +- arch/arm/mach-socfpga/mailbox_s10.c | 79 ++Do you have plans to move this code to
drivers/mailbox?
Yes, will do after RSU upstream.
Quoted 11 lines
Quoted 10 lines
arch/arm/mach-socfpga/misc_s10.c | 9 + drivers/firmware/Kconfig | 11 + drivers/firmware/Makefile | 1 + drivers/firmware/rsu.c | 662 ++++++++++++++ drivers/firmware/rsu_ll_qspi.c | 1050
++++++++++++++++++++++
drivers/firmware/rsu_misc.c | 817
+++++++++++++++++
drivers/firmware/rsu_s10.c | 874
++++++++++++++++++
Quoted 6 lines
Ok, so you started to add this "RSU" as a driver, that's probably fine (sorry I did not find the time to review that, yet).
However, I think you'd need a more specific name, probably including 'intel' or something to make this more clear.
How about intel_rsu.c, intel_rsu_misc.c, intel_rsu_ll_qspi.c and intel_rsu_s10.c?
Quoted 20 lines
I'll hope to find the time to review the rest this week.
Regards,
SimonQuoted 14 lines
include/intel/rsu.h | 291 ++++++ include/intel/rsu_ll.h | 72 ++ include/intel/rsu_misc.h | 60 ++ include/intel/rsu_s10.h | 46 +
13 files changed, 3998 insertions(+), 10 deletions(-)create mode 100644
drivers/firmware/rsu.ccreate mode 100644drivers/firmware/rsu_ll_qspi.ccreate mode 100644drivers/firmware/rsu_misc.ccreate mode 100644drivers/firmware/rsu_s10.ccreate mode 100644include/intel/rsu.hcreate mode 100644include/intel/rsu_ll.hcreate mode 100644include/intel/rsu_misc.hcreate mode 100644include/intel/rsu_s10.h