drivers/qcom: add Command DB support
v8 cover drivers/qcom: add Command DB support
Changes since v7:
- Add reviewed-by tags
- Fix example
Changes since v6:
- Fix 'reg' property
- Add reviewed-by tags
Changes since v5:
- Remove indirection of command db start address
- Rebase on top of 4.16
Changes since v4:
- Address comments from Stephen and Bjorn
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
[v3]: https://lkml.org/lkml/2018/2/16/842
[v4]: https://patchwork.kernel.org/patch/10242935/
[v5]: https://lkml.org/lkml/2018/3/14/787
[v6]: https://lkml.org/lkml/2018/4/5/451
[v7]: https://lkml.org/lkml/2018/4/6/756
Lina Iyer (2):
drivers: qcom: add command DB driver
dt-bindings: introduce Command DB for QCOM SoCs
.../bindings/reserved-memory/qcom,cmd-db.txt | 37 +++ drivers/of/platform.c | 1 + drivers/soc/qcom/Kconfig | 9 + drivers/soc/qcom/Makefile | 1 + drivers/soc/qcom/cmd-db.c | 310 +++++++++++++++++++++ include/soc/qcom/cmd-db.h | 45 +++ 6 files changed, 403 insertions(+) create mode 100644 Documentation/devicetree/bindings/reserved-memory/qcom,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 v8 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.
---
Changes in v6:
- Remove indirection and use the actual command db memory in DT
Changes in v5:
- Use strncmp
- Add check in probe to ensure the location at dictionary address is same as the one specified in reserved-memory
- Whitespace fixes
- Comments updated
--- drivers/of/platform.c | 1 + drivers/soc/qcom/Kconfig | 9 ++ drivers/soc/qcom/Makefile | 1 + drivers/soc/qcom/cmd-db.c | 310 ++++++++++++++++++++++++++++++++++++++++++++++ include/soc/qcom/cmd-db.h | 45 +++++++ 5 files changed, 366 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 +310 -0
310 lines not on this page · raw message
include/soc/qcom/cmd-db.h new file +45 -0
45 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 v8 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.
---
Changes in v8:
- Fix node name
- Add no-map property
Changes in v7:
- Fix description of 'reg' property
Changes in v6:
- Move to bindings/reserved-memory
- Remove indirection address and use only the actual reserved memory
Changes in v4:
- Fix unwanted capitalization
- Add reg property
--- .../bindings/reserved-memory/qcom,cmd-db.txt | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 Documentation/devicetree/bindings/reserved-memory/qcom,cmd-db.txt
Documentation/devicetree/bindings/reserved-memory/qcom,cmd-db.txt new file +37 -0
@@ -0,0 +1,37 @@ +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 bindings for Command DB is specified in the reserved-memory section in +devicetree. The devicetree representation of the command DB driver should be: + +Properties: +- compatible: + Usage: required + Value type: <string> + Definition: Should be "qcom,cmd-db" + +- reg: + Usage: required + Value type: <prop encoded array> + Definition: The register address that points to the actual location of + the Command DB in memory. + +Example: + + reserved-memory { + [...] + reserved-memory@85fe0000 { + reg = <0x0 0x85fe0000 0x0 0x20000>; + compatible = "qcom,cmd-db"; + no-map; + }; + };
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
Hi Andy, David,
These patches have been reviewed by our peers and have recieved no further comments in the past few weeks. Would you consider merging this in your trees?
Thanks,
Lina
Quoted 56 lines · Lina Iyer
Changes since v7:
- Add reviewed-by tags
- Fix exampleChanges since v6:
- Fix 'reg' property
- Add reviewed-by tagsChanges since v5:
- Remove indirection of command db start address
- Rebase on top of 4.16Changes since v4:
- Address comments from Stephen and BjornThese 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
[v3]: https://lkml.org/lkml/2018/2/16/842
[v4]: https://patchwork.kernel.org/patch/10242935/
[v5]: https://lkml.org/lkml/2018/3/14/787
[v6]: https://lkml.org/lkml/2018/4/5/451
[v7]: https://lkml.org/lkml/2018/4/6/756Lina Iyer (2):
drivers: qcom: add command DB driver
dt-bindings: introduce Command DB for QCOM SoCs.../bindings/reserved-memory/qcom,cmd-db.txt | 37 +++ drivers/of/platform.c | 1 + drivers/soc/qcom/Kconfig | 9 + drivers/soc/qcom/Makefile | 1 + drivers/soc/qcom/cmd-db.c | 310 +++++++++++++++++++++ include/soc/qcom/cmd-db.h | 45 +++ 6 files changed, 403 insertions(+)create mode 100644
Documentation/devicetree/bindings/reserved-memory/qcom,cmd-db.txtcreate mode 100644drivers/soc/qcom/cmd-db.c
create mode 100644include/soc/qcom/cmd-db.h--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
Lina
Quoted 5 lines · Lina Iyer
Hi Andy, David,
These patches have been reviewed by our peers and have recieved no further comments in the past few weeks. Would you consider merging this in your trees?
When I look at:
https://git.kernel.org/pub/scm/linux/kernel/git/agross/linux.git/log/?h=for-next
I see both of your patches (plus Stephen Boyd's patch about making things endian-agnostic). ...so I think we're good. :-)
-Doug
Quoted 9 lines · Doug Anderson
Lina
Quoted 5 lines · Lina Iyer
Hi Andy, David,
These patches have been reviewed by our peers and have recieved no further comments in the past few weeks. Would you consider merging this in your trees?
Quoted 7 lines
When I look at:
https://git.kernel.org/pub/scm/linux/kernel/git/agross/linux.git/log/?h=for-next
I see both of your patches (plus Stephen Boyd's patch about making things endian-agnostic). ...so I think we're good. :-)
Excellent. Thank you.
-- Lina