drivers/qcom: add Command DB support
v3 cover drivers/qcom: add Command DB support
Changes in v3:
- use min_t instead of MIN
- add cmd db memory to reserved memory region
- use devm_memremap
These patches add support for reading a shared memory database in the newer QCOM SoCs called Command DB. With the new architecture on SDM845, shared resources like clocks, regulators etc., have dynamic properties. These properties may change based on external components, board configurations or available feature set. A remote processor detects these parameters and fills up the database with the resource and available state information. Platform drivers that need these shared resources will need to query this database to get the address and properties and vote for the state.
The information in the database is static. The database is read-only memory location that is available for Linux. A pre-defined string is used as a key into an entry in the database. Generally, platform drivers query the database only at init to get the information they need.
[v1]: https://www.spinics.net/lists/linux-arm-msm/msg32462.html
[v2]: https://lkml.org/lkml/2018/2/8/588
Lina Iyer (2):
drivers: qcom: add command DB driver
dt-bindings: introduce Command DB for QCOM SoCs
.../devicetree/bindings/arm/msm/cmd-db.txt | 30 ++ drivers/of/platform.c | 1 + drivers/soc/qcom/Kconfig | 9 + drivers/soc/qcom/Makefile | 1 + drivers/soc/qcom/cmd-db.c | 319 +++++++++++++++++++++ include/soc/qcom/cmd-db.h | 50 ++++ 6 files changed, 410 insertions(+) create mode 100644 Documentation/devicetree/bindings/arm/msm/cmd-db.txt create mode 100644 drivers/soc/qcom/cmd-db.c create mode 100644 include/soc/qcom/cmd-db.h
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH v3 1/2 drivers: qcom: add command DB driver
From: Mahesh Sivasubramanian <[email protected]>
Command DB is a simple database in the shared memory of QCOM SoCs, that provides information regarding shared resources. Some shared resources in the SoC have properties that are probed dynamically at boot by the remote processor. The information pertaining to the SoC and the platform are made available in the shared memory. Drivers can query this information using predefined strings.
--- drivers/of/platform.c | 1 + drivers/soc/qcom/Kconfig | 9 ++ drivers/soc/qcom/Makefile | 1 + drivers/soc/qcom/cmd-db.c | 319 ++++++++++++++++++++++++++++++++++++++++++++++ include/soc/qcom/cmd-db.h | 50 ++++++++ 5 files changed, 380 insertions(+) create mode 100644 drivers/soc/qcom/cmd-db.c create mode 100644 include/soc/qcom/cmd-db.h
drivers/of/platform.c +1 -0
@@ -494,6 +494,7 @@ EXPORT_SYMBOL_GPL(of_platform_default_populate);#ifndef CONFIG_PPC static const struct of_device_id reserved_mem_matches[] = { { .compatible ="qcom,rmtfs-mem" }, + { .compatible ="qcom,cmd-db" }, { .compatible ="ramoops" }, {} };
drivers/soc/qcom/Kconfig +9 -0
@@ -3,6 +3,15 @@ # menu "Qualcomm SoC drivers" +config QCOM_COMMAND_DB + bool "Qualcomm Command DB" + depends on (ARCH_QCOM && OF) || COMPILE_TEST + help + Command DB queries shared memory by key string for shared system + resources. Platform drivers that require to set state of a shared + resource on a RPM-hardened platform must use this database to get + SoC specific identifier and information for the shared resources. + config QCOM_GLINK_SSR tristate "Qualcomm Glink SSR driver" depends on RPMSG
drivers/soc/qcom/Makefile +1 -0
@@ -1,4 +1,5 @@ # SPDX-License-Identifier: GPL-2.0 +obj-$(CONFIG_QCOM_COMMAND_DB) += cmd-db.o obj-$(CONFIG_QCOM_GLINK_SSR) += glink_ssr.o obj-$(CONFIG_QCOM_GSBI) += qcom_gsbi.o obj-$(CONFIG_QCOM_MDT_LOADER) += mdt_loader.o
drivers/soc/qcom/cmd-db.c new file +319 -0
319 lines not on this page · raw message
include/soc/qcom/cmd-db.h new file +50 -0
50 lines not on this page · raw message
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH v3 2/2 dt-bindings: introduce Command DB for QCOM SoCs
In reply to Lina IyerFrom: Mahesh Sivasubramanian <[email protected]>
Command DB provides information on shared resources like clocks, regulators etc., probed at boot by the remote subsytem and made available in shared memory.
--- .../devicetree/bindings/arm/msm/cmd-db.txt | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 Documentation/devicetree/bindings/arm/msm/cmd-db.txt
Documentation/devicetree/bindings/arm/msm/cmd-db.txt new file +30 -0
@@ -0,0 +1,30 @@ +Command DB +--------- + +Command DB is a database that provides a mapping between resource key and the +resource address for a system resource managed by a remote processor. The data +is stored in a shared memory region and is loaded by the remote processor. + +Some of the Qualcomm Technologies Inc SoC's have hardware accelerators for +controlling shared resources. Depending on the board configuration the shared +resource properties may change. These properties are dynamically probed by the +remote processor and made available in the shared memory. + +The devicetree representation of the command DB driver should be: + +PROPERTIES: +- compatible: + Usage: required + Value type: <string> + Definition: Should be "qcom,cmd-db" + +Example: + + reserved-memory { + [...] + qcom,cmd-db@c3f000c { + reg = <0x0 0xc3f000c 0x0 0x8>, + <0x0 0x85fe0000 0x0 0x20000>; + compatible = "qcom,cmd-db"; + }; + };
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
Rob Herring
maintainerRe: [PATCH v3 2/2] dt-bindings: introduce Command DB for QCOM SoCs
Quoted 23 lines · Lina Iyer
From: Mahesh Sivasubramanian <[email protected]>
Command DB provides information on shared resources like clocks, regulators etc., probed at boot by the remote subsytem and made available in shared memory.
Signed-off-by Mahesh Sivasubramanian <[email protected]>Signed-off-by Lina Iyer <[email protected]>--- .../devicetree/bindings/arm/msm/cmd-db.txt | 30 ++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 Documentation/devicetree/bindings/arm/msm/cmd-db.txtDocumentation/devicetree/bindings/arm/msm/cmd-db.txt new file +3
-0@@ -0,0 +1,30 @@ +Command DB +--------- +
Documentation/devicetree/bindings/arm/msm/cmd-db.txt line 13
Quoted 10 lines
Documentation/devicetree/bindings/arm/msm/cmd-db.txt new file +10
-0+Command DB is a database that provides a mapping between resource key and the +resource address for a system resource managed by a remote processor. The data +is stored in a shared memory region and is loaded by the remote processor. + +Some of the Qualcomm Technologies Inc SoC's have hardware accelerators for +controlling shared resources. Depending on the board configuration the shared +resource properties may change. These properties are dynamically probed by the +remote processor and made available in the shared memory. + +The devicetree representation of the command DB driver should be:
Need to state this is a child of /reserved-memory
Documentation/devicetree/bindings/arm/msm/cmd-db.txt line 15
Quoted 2 lines
Documentation/devicetree/bindings/arm/msm/cmd-db.txt new file +2
-0+ +PROPERTIES:
Why the yelling? :)
Documentation/devicetree/bindings/arm/msm/cmd-db.txt line 19
Quoted 4 lines
Documentation/devicetree/bindings/arm/msm/cmd-db.txt new file +4
-0+- compatible: + Usage: required + Value type: <string> + Definition: Should be "qcom,cmd-db"
reg?
Quoted 19 lines
Documentation/devicetree/bindings/arm/msm/cmd-db.txt new file +11
-0+ +Example: + + reserved-memory { + [...] + qcom,cmd-db@c3f000c { + reg = <0x0 0xc3f000c 0x0 0x8>, + <0x0 0x85fe0000 0x0 0x20000>; + compatible = "qcom,cmd-db"; + }; + };Signature · 7 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v3 2/2] dt-bindings: introduce Command DB for QCOM SoCs
Quoted 6 lines · Rob Herring
Quoted 3 lines · Lina Iyer
From: Mahesh Sivasubramanian <[email protected]>
+The devicetree representation of the command DB driver should be:
Need to state this is a child of /reserved-memory
Yes, ofcourse. Will fix.
Quoted 6 lines
Review
Quoted 3 lines
(quoted diff) +2
-0+ +PROPERTIES:Why the yelling? :)
Oops.
Quoted 7 lines
Documentation/devicetree/bindings/arm/msm/cmd-db.txt line 19
Quoted 4 lines
+- compatible:
Documentation/devicetree/bindings/arm/msm/cmd-db.txt new file +3
-0+ Usage: required + Value type: <string> + Definition: Should be "qcom,cmd-db"reg?
Yes.
Thanks Rob for the reveiw.
-- Lina