soc: qcom: cmd-db: Add optional support for device programmer flows
Subsystems (2)
PATCH 1/1 soc: qcom: cmd-db: Add optional support for device programmer flows
Add QCOM_COMMAND_DB_OPTIONAL Kconfig option to allow the Command DB driver to bind successfully even when CMD DB data is missing or has an invalid magic number.
This is required for device programmer flows where U-Boot runs without AOP (Always On Processor) being invoked. Since AOP is responsible for populating CMD DB data, device programmer scenarios lack valid CMD DB and would otherwise fail to boot.
Normal boot flows should keep this disabled as they require valid CMD DB data populated by AOP.
--- drivers/soc/qcom/Kconfig | 16 ++++++++++++++++ drivers/soc/qcom/cmd-db.c | 10 ++++++++++ 2 files changed, 26 insertions(+)
drivers/soc/qcom/Kconfig +16 -0
@@ -18,6 +18,22 @@ config QCOM_COMMAND_DB resource on a RPM-hardened platform must use this database to get SoC specific identifier and information for the shared resources. +config QCOM_COMMAND_DB_OPTIONAL + bool "Allow operation without Command DB data" + depends on QCOM_COMMAND_DB + help + Allow the Command DB driver to bind successfully even when CMD DB + data is not populated or has an invalid magic number. + + This is useful for platforms where CMD DB is not populated by + + When enabled, missing CMD DB will generate warnings but allow boot + to continue. Consumer drivers must handle cmd_db API failures + gracefully by checking return values. + + If unsure, say N. Most production Qualcomm platforms require + valid CMD DB data. + config QCOM_RPMH bool "Qualcomm RPMh support" depends on QCOM_COMMAND_DB
drivers/soc/qcom/cmd-db.c +10 -0
@@ -252,8 +252,18 @@ static int cmd_db_bind(struct udevice *dev) cmd_db_header = base;if (!cmd_db_magic_matches (cmd_db_header)) { +#ifdef CONFIG_QCOM_COMMAND_DB_OPTIONAL +log_warning ("%s: CMD DB magic not found (0x%02x%02x%02x%02x)\n" , + __func__, cmd_db_header->magic[0 ], cmd_db_header->magic[1 ], + cmd_db_header->magic[2 ], cmd_db_header->magic[3 ]); +log_warning ("%s: CMD DB data unavailable, resource queries will fail\n" , + __func__); + cmd_db_header =NULL ; +return 0 ; +#else log_err ("%s: Invalid Command DB Magic\n" , __func__);return -EINVAL ; +#endif }return 0 ;
---
base-commit: f0000b4a57e9edf8ff8454b9056d767466dff57f
change-id: 20260409-cmddb-394afa003818
Best regards,
Signature · 1 line
Balaji Selvanathan <[email protected]>
Quoted 11 lines · Balaji Selvanathan
Add
QCOM_COMMAND_DB_OPTIONALKconfigoption to allow the Command DB driver to bind successfully even when CMD DB data is missing or has an invalid magic number.This is required for device programmer flows where U-Boot runs without AOP (Always On Processor) being invoked. Since AOP is responsible for populating CMD DB data, device programmer scenarios lack valid CMD DB and would otherwise fail to boot.
Normal boot flows should keep this disabled as they require valid CMD DB data populated by AOP.
Presumably this is only used for development and isn't meant to be a supported setup right? In that case how about just using a normal macro rather than a whole kconfig option, then you can just build with make CCFLAGS=-DQCOM_CMD_DB_OPTIONAL=1 or something?
Kind regards,
Quoted 68 lines
Signed-off-by Balaji Selvanathan <[email protected]>--- drivers/soc/qcom/Kconfig | 16 ++++++++++++++++ drivers/soc/qcom/cmd-db.c | 10 ++++++++++ 2 files changed, 26 insertions(+)drivers/soc/qcom/Kconfig +16
-0@@ -18,6 +18,22 @@ config QCOM_COMMAND_DB resource on a RPM-hardened platform must use this database to get SoC specific identifier and information for the shared resources. +config QCOM_COMMAND_DB_OPTIONAL + bool "Allow operation without Command DB data" + depends on QCOM_COMMAND_DB + help + Allow the Command DB driver to bind successfully even when CMD DB + data is not populated or has an invalid magic number. + + This is useful for platforms where CMD DB is not populated by + + When enabled, missing CMD DB will generate warnings but allow boot + to continue. Consumer drivers must handle cmd_db API failures + gracefully by checking return values. + + If unsure, say N. Most production Qualcomm platforms require + valid CMD DB data. + config QCOM_RPMH bool "Qualcomm RPMh support" depends on QCOM_COMMAND_DBdrivers/soc/qcom/cmd-db.c +10
-1@@ -252,8 +252,18 @@ static int cmd_db_bind(struct udevice *dev) cmd_db_header = base;if (!cmd_db_magic_matches (cmd_db_header)) { +#ifdef CONFIG_QCOM_COMMAND_DB_OPTIONAL +log_warning ("%s: CMD DB magic not found (0x%02x%02x%02x%02x)\n" , + __func__, cmd_db_header->magic[0 ], cmd_db_header->magic[1 ], + cmd_db_header->magic[2 ], cmd_db_header->magic[3 ]); +log_warning ("%s: CMD DB data unavailable, resource queries will fail\n" , + __func__); + cmd_db_header =NULL ; +return 0 ; +#else log_err ("%s: Invalid Command DB Magic\n" , __func__);return -EINVAL ; +#endif }return 0 ; ---base-commit:
f0000b4a57e9edf8ff8454b9056d767466dff57f
change-id: 20260409-cmddb-394afa003818Best regards,
Signature · 1 line
Balaji Selvanathan <[email protected]>
Quoted 10 lines · Casey Connolly
Quoted 9 lines · Balaji Selvanathan
Add
QCOM_COMMAND_DB_OPTIONALKconfigoption to allow the Command DB driver to bind successfully even when CMD DB data is missing or has an invalid magic number.This is required for device programmer flows where U-Boot runs without AOP (Always On Processor) being invoked. Since AOP is responsible for populating CMD DB data, device programmer scenarios lack valid CMD DB and would otherwise fail to boot.
Quoted 6 lines
Quoted 2 lines
Normal boot flows should keep this disabled as they require valid CMD DB data populated by AOP.
Presumably this is only used for development and isn't meant to be a supported setup right? In that case how about just using a normal macro rather than a whole kconfig option, then you can just build with make CCFLAGS=-DQCOM_CMD_DB_OPTIONAL=1 or something?
Looks like the commit message lacks to describe the motivation here. This patch is a preparatory step to allow U-Boot to be used as a device flashing/provisioning tool. In that environment, there isn't TZ or HYP stage running and U-Boot is expected to be launched in EL3.
Quoted 43 lines
Kind regards,
Quoted 40 lines
Signed-off-by Balaji Selvanathan <[email protected]>--- drivers/soc/qcom/Kconfig | 16 ++++++++++++++++ drivers/soc/qcom/cmd-db.c | 10 ++++++++++ 2 files changed, 26 insertions(+)drivers/soc/qcom/Kconfig +16
-0@@ -18,6 +18,22 @@ config QCOM_COMMAND_DB resource on a RPM-hardened platform must use this database to get SoC specific identifier and information for the shared resources. +config QCOM_COMMAND_DB_OPTIONAL + bool "Allow operation without Command DB data" + depends on QCOM_COMMAND_DB + help + Allow the Command DB driver to bind successfully even when CMD DB + data is not populated or has an invalid magic number. + + This is useful for platforms where CMD DB is not populated by + + When enabled, missing CMD DB will generate warnings but allow boot + to continue. Consumer drivers must handle cmd_db API failures + gracefully by checking return values. + + If unsure, say N. Most production Qualcomm platforms require + valid CMD DB data. + config QCOM_RPMH bool "Qualcomm RPMh support" depends on QCOM_COMMAND_DBdrivers/soc/qcom/cmd-db.c +0
-0@@ -252,8 +252,18 @@ static int cmd_db_bind(struct udevice *dev)
Quoted 3 lines
drivers/soc/qcom/cmd-db.c static int cmd_db_bind(struct udevice *dev) · line 255
Quoted 3 lines
drivers/soc/qcom/cmd-db.c +1
-0cmd_db_header = base;if (!cmd_db_magic_matches (cmd_db_header)) { +#ifdef CONFIG_QCOM_COMMAND_DB_OPTIONAL
Switch to IS_ENABLED(QCOM_COMMAND_DB_OPTIONAL) check instead.
Quoted 5 lines
drivers/soc/qcom/cmd-db.c static int cmd_db_bind(struct udevice *dev) · line 260
Quoted 5 lines
drivers/soc/qcom/cmd-db.c +5
-0+log_warning ("%s: CMD DB magic not found (0x%02x%02x%02x%02x)\n" , + __func__, cmd_db_header->magic[0 ], cmd_db_header->magic[1 ], + cmd_db_header->magic[2 ], cmd_db_header->magic[3 ]); +log_warning ("%s: CMD DB data unavailable, resource queries will fail\n" , + __func__);
Convert these warning rather to log_debug() since this will be under special config check anyways.
-Sumit
Quoted 22 lines
Quoted 20 lines
drivers/soc/qcom/cmd-db.c +4
-1+ cmd_db_header =NULL ; +return 0 ; +#else log_err ("%s: Invalid Command DB Magic\n" , __func__);return -EINVAL ; +#endif }return 0 ; ---base-commit:
f0000b4a57e9edf8ff8454b9056d767466dff57f
change-id: 20260409-cmddb-394afa003818Best regards,
Signature · 1 line
Balaji Selvanathan <[email protected]>
Quoted 14 lines · Sumit Garg
Quoted 13 lines · Casey Connolly
Quoted 11 lines · Balaji Selvanathan
Add
QCOM_COMMAND_DB_OPTIONALKconfigoption to allow the Command DB driver to bind successfully even when CMD DB data is missing or has an invalid magic number.This is required for device programmer flows where U-Boot runs without AOP (Always On Processor) being invoked. Since AOP is responsible for populating CMD DB data, device programmer scenarios lack valid CMD DB and would otherwise fail to boot.
Normal boot flows should keep this disabled as they require valid CMD DB data populated by AOP.
Quoted 8 lines
Quoted 3 lines
Presumably this is only used for development and isn't meant to be a supported setup right? In that case how about just using a normal macro rather than a whole kconfig option, then you can just build with make CCFLAGS=-DQCOM_CMD_DB_OPTIONAL=1 or something?
Looks like the commit message lacks to describe the motivation here. This patch is a preparatory step to allow U-Boot to be used as a device flashing/provisioning tool. In that environment, there isn't TZ or HYP stage running and U-Boot is expected to be launched in EL3.
Hmm I see, so we just rely on BROM to set up the necessary regulators and deal with the error spam? How does the firehose loader handle this (is it equivalent?).
Maybe it would be best to send this along with the rest of the code necessary to enable that functionality, it would be good to get a better idea of the architecture here.
Kind regards,
Quoted 83 lines
Quoted 44 lines
Kind regards,
Quoted 40 lines
Signed-off-by Balaji Selvanathan <[email protected]>--- drivers/soc/qcom/Kconfig | 16 ++++++++++++++++ drivers/soc/qcom/cmd-db.c | 10 ++++++++++ 2 files changed, 26 insertions(+)drivers/soc/qcom/Kconfig +16
-0@@ -18,6 +18,22 @@ config QCOM_COMMAND_DB resource on a RPM-hardened platform must use this database to get SoC specific identifier and information for the shared resources. +config QCOM_COMMAND_DB_OPTIONAL + bool "Allow operation without Command DB data" + depends on QCOM_COMMAND_DB + help + Allow the Command DB driver to bind successfully even when CMD DB + data is not populated or has an invalid magic number. + + This is useful for platforms where CMD DB is not populated by + + When enabled, missing CMD DB will generate warnings but allow boot + to continue. Consumer drivers must handle cmd_db API failures + gracefully by checking return values. + + If unsure, say N. Most production Qualcomm platforms require + valid CMD DB data. + config QCOM_RPMH bool "Qualcomm RPMh support" depends on QCOM_COMMAND_DBdrivers/soc/qcom/cmd-db.c +0
-0@@ -252,8 +252,18 @@ static int cmd_db_bind(struct udevice *dev)Quoted 3 lines
drivers/soc/qcom/cmd-db.c static int cmd_db_bind(struct udevice *dev) · line 255
Quoted 3 lines
drivers/soc/qcom/cmd-db.c +1
-0cmd_db_header = base;if (!cmd_db_magic_matches (cmd_db_header)) { +#ifdef CONFIG_QCOM_COMMAND_DB_OPTIONAL Switch to
IS_ENABLED(QCOM_COMMAND_DB_OPTIONAL)check instead.Quoted 5 lines
drivers/soc/qcom/cmd-db.c static int cmd_db_bind(struct udevice *dev) · line 260
Quoted 5 lines
drivers/soc/qcom/cmd-db.c +5
-0+log_warning ("%s: CMD DB magic not found (0x%02x%02x%02x%02x)\n" , + __func__, cmd_db_header->magic[0 ], cmd_db_header->magic[1 ], + cmd_db_header->magic[2 ], cmd_db_header->magic[3 ]); +log_warning ("%s: CMD DB data unavailable, resource queries will fail\n" , + __func__);Convert these warning rather to
log_debug()since this will be under special config check anyways.-Sumit
Quoted 22 lines
Quoted 20 lines
drivers/soc/qcom/cmd-db.c +4
-1+ cmd_db_header =NULL ; +return 0 ; +#else log_err ("%s: Invalid Command DB Magic\n" , __func__);return -EINVAL ; +#endif }return 0 ; ---base-commit:
f0000b4a57e9edf8ff8454b9056d767466dff57f
change-id: 20260409-cmddb-394afa003818Best regards,
Signature · 1 line
Balaji Selvanathan <[email protected]>
Signature · 1 line
// Casey (she/her)