Introduce Protection Domain Restart (PDR) Helpers
Subsystems (4)
v7 cover Introduce Protection Domain Restart (PDR) Helpers
Qualcomm SoCs (starting with MSM8998) allow for multiple protection domains (PDs) to run on the same Q6 sub-system. This allows for services like AVS AUDIO to have their own separate address space and crash/recover without disrupting the other PDs running on the same Q6 ADSP. This patch series introduces pdr helper library and adds PD tracking functionality for "avs/audio" allowing apr services to register themselves asynchronously once the dependent PDs are up.
Userspace Links:
pd-mapper: https://github.com/andersson/pd-mapper/tree/json
diag-router: https://github.com/andersson/diag
Testing PDR with APR on SDM845 SoCs:
pd-mapper adspua.jsn &
diag-router &send_data 75 37 03 144 00
V7:
* Address Bjorn's comments on exiting early in pdr_locator_work
* SERVREG_LOCATOR_UNKNOWN_SERVICE is no longer propagated to clients allowing for lookups to recover on restarting pd-mapper with the proper database.
* Non-recoverable SERVREG_LOCATOR_ERR errors are still communicated to the clients.
V6:
* Fix minor compilation error introduced in V5
* Pick up Rob's R-b
V5:
* Pick up Bjorn's R-b
* Service all pending lookup, notifier_register and notifier_remove requests.
* Propagate error from pdr_register_listener
* Remove notifier_init_complete flag workaround with the introduction of in-kernel ns.
* Remove depends-on in Kconfig and add module license.
V4:
* Drop handling db_rev_count error handling since it remains unused in upstream/downstream pd-mapper
* Fixup dt bindings and examples. [Rob]
* Dropping r-b from Bjorn/Srini for the dt bindings.
* Privatize pdr_service/pdr_handle. [Srini/Bjorn]
* Introduce notifier_init_complete to deal with cases where qmi_handle_net_reset is not enough to reset the port. This is to deal with cases where qrtr-ns starts after the adsp.
* Introduce per addr per pds to deal with multiple service_paths per pdr_handle.
* Uniformly rename servreg -> notifier, servloc -> locator. [Narendra]
* Drop pdr_servreg_link_create tracking the service_path tracks all pds associated with it. [Bjorn]
* Remove safe traversal for all cases where list is left unmodified. [Bjorn]
* Address review comments in the apr driver and add comments. [Bjorn]
* Other misc fixes. [Narendra/Bjorn]
V3:
* patches 2 and 3 remain unchanged.
* reset servloc_addr/servreg_addr.
* fixup the helpers to handle servloc_work/servreg_work asynchronously.
* fixup useage of list_lock across traversals, insertions and deletions.
* fixup the helpers to use a single lookup list.
* skip waiting for response on ind_ack send.
* introduce pdr_servreg_link_create to re-use existing qmi connection to servreg instances. This helps tracking PDs running on the same remote processor.
* have a per node curr_state in pdr_list_node to preserve all state updates during indack_cb.
* introduce additional servreg_service_state values to help the client distinguish between a fatal and non-fatal pdr_lookup errors.
* re-order pdr_handle_release sequence.
* fixup "!ind_msg->service_path returns true always" warning.
* fixup comments.
V2:
* fixup pd_status callback to return void.
* return 0 from pdr_get_domain_list on success.
* introduce status_lock to linearize the pd_status reported back to the clients.
* use the correct service name length across various string operations performed.
* service locator will now schedule the pending lookups registered when it comes up.
* other minor cleanups that Bjorn suggested.
* use pr_warn to indicate that the wait for service locator timed out.
* add Bjorn/Srini's "Reviewed-by" for the dt-bindings.
Sibi Sankar (3):
soc: qcom: Introduce Protection Domain Restart helpers
dt-bindings: soc: qcom: apr: Add protection domain bindings
soc: qcom: apr: Add avs/audio tracking functionality
.../devicetree/bindings/soc/qcom/qcom,apr.txt | 50 ++ drivers/soc/qcom/Kconfig | 5 + drivers/soc/qcom/Makefile | 1 + drivers/soc/qcom/apr.c | 123 ++- drivers/soc/qcom/pdr_interface.c | 757 ++++++++++++++++++ drivers/soc/qcom/pdr_internal.h | 379 +++++++++ include/linux/soc/qcom/apr.h | 1 + include/linux/soc/qcom/pdr.h | 29 + include/linux/soc/qcom/qmi.h | 1 + 9 files changed, 1337 insertions(+), 9 deletions(-) create mode 100644 drivers/soc/qcom/pdr_interface.c create mode 100644 drivers/soc/qcom/pdr_internal.h create mode 100644 include/linux/soc/qcom/pdr.h
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH v7 1/3 soc: qcom: Introduce Protection Domain Restart helpers
Qualcomm SoCs (starting with MSM8998) allow for multiple protection domains to run on the same Q6 sub-system. This allows for services like ATH10K WLAN FW to have their own separate address space and crash/recover without disrupting the modem and other PDs running on the same sub-system. The PDR helpers introduces an abstraction that allows for tracking/controlling the life cycle of protection domains running on various Q6 sub-systems.
---
V7:
* Address Bjorn's comments on exiting early in pdr_locator_work
* SERVREG_LOCATOR_UNKNOWN_SERVICE is no longer propagated to clients allowing for lookups to recover on restarting pd-mapper with the proper database.
* Non-recoverable SERVREG_LOCATOR_ERR errors are still communicated to the clients.
V6:
* Fix minor compilation error introduceed in v5 while propagating error from pdr_register_listener
drivers/soc/qcom/Kconfig | 4 + drivers/soc/qcom/Makefile | 1 + drivers/soc/qcom/pdr_interface.c | 757 +++++++++++++++++++++++++++++++ drivers/soc/qcom/pdr_internal.h | 379 ++++++++++++++++ include/linux/soc/qcom/pdr.h | 29 ++ include/linux/soc/qcom/qmi.h | 1 + 6 files changed, 1171 insertions(+) create mode 100644 drivers/soc/qcom/pdr_interface.c create mode 100644 drivers/soc/qcom/pdr_internal.h create mode 100644 include/linux/soc/qcom/pdr.h
drivers/soc/qcom/Kconfig +4 -0
@@ -76,6 +76,10 @@ config QCOM_OCMEM requirements. This is typically used by the GPU, camera/video, and audio components on some Snapdragon SoCs. +config QCOM_PDR_HELPERS + tristate + select QCOM_QMI_HELPERS + config QCOM_PM bool "Qualcomm Power Management" depends on ARCH_QCOM && !ARM64
drivers/soc/qcom/Makefile +1 -0
@@ -7,6 +7,7 @@ obj-$(CONFIG_QCOM_GLINK_SSR) += glink_ssr.o obj-$(CONFIG_QCOM_GSBI) += qcom_gsbi.o obj-$(CONFIG_QCOM_MDT_LOADER) += mdt_loader.o obj-$(CONFIG_QCOM_OCMEM) += ocmem.o +obj-$(CONFIG_QCOM_PDR_HELPERS) += pdr_interface.o obj-$(CONFIG_QCOM_PM) += spm.o obj-$(CONFIG_QCOM_QMI_HELPERS) += qmi_helpers.o qmi_helpers-y += qmi_encdec.o qmi_interface.o
drivers/soc/qcom/pdr_interface.c new file +757 -0
757 lines not on this page · raw message
drivers/soc/qcom/pdr_internal.h new file +379 -0
379 lines not on this page · raw message
include/linux/soc/qcom/pdr.h new file +29 -0
@@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __QCOM_PDR_HELPER__ +#define __QCOM_PDR_HELPER__ + +#include <linux/soc/qcom/qmi.h> + +#define SERVREG_NAME_LENGTH 64 + +struct pdr_service ; +struct pdr_handle ; + +enum servreg_service_state { +SERVREG_LOCATOR_ERR =0x1 , +SERVREG_SERVICE_STATE_DOWN =0x0FFFFFFF , +SERVREG_SERVICE_STATE_UP =0x1FFFFFFF , +SERVREG_SERVICE_STATE_EARLY_DOWN =0x2FFFFFFF , +SERVREG_SERVICE_STATE_UNINIT =0x7FFFFFFF , +}; + +struct pdr_handle *pdr_handle_alloc (void (*status)(int state, +char *service_path, +void *priv),void *priv); +struct pdr_service *pdr_add_lookup (struct pdr_handle *pdr, +const char *service_name, +const char *service_path); +int pdr_restart_pd (struct pdr_handle *pdr,struct pdr_service *pds); +void pdr_handle_release (struct pdr_handle *pdr); + +#endif
include/linux/soc/qcom/qmi.h +1 -0
@@ -88,6 +88,7 @@ struct qmi_elem_info {#define QMI_ERR_CLIENT_IDS_EXHAUSTED_V01 5#define QMI_ERR_INVALID_ID_V01 41#define QMI_ERR_ENCODING_V01 58 +#define QMI_ERR_DISABLED_V01 69#define QMI_ERR_INCOMPATIBLE_STATE_V01 90#define QMI_ERR_NOT_SUPPORTED_V01 94
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH v7 2/3 dt-bindings: soc: qcom: apr: Add protection domain bindings
In reply to Sibi SankarQualcomm SoCs (starting with MSM8998) allow for multiple protection domains (PDs) to run on the same Q6 sub-system. This allows for services like AVS AUDIO to have their own separate address space and crash/recover without disrupting the other PDs running on the same Q6 ADSP. Add "qcom,protection-domain" bindings to capture the dependencies between the APR service and the PD on which the apr service runs.
---
V7:
* No change
V6:
* Picked up Rob's R-b
.../devicetree/bindings/soc/qcom/qcom,apr.txt | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+)
Documentation/devicetree/bindings/soc/qcom/qcom,apr.txt +50 -0
@@ -45,6 +45,18 @@ by the individual bindings for the specific service 12 - Ultrasound stream manager. 13 - Listen stream manager. +- qcom,protection-domain + Usage: optional + Value type: <stringlist> + Definition: Must list the protection domain service name and path + that the particular apr service has a dependency on. + Possible values are : + "avs/audio", "msm/adsp/audio_pd". + "kernel/elf_loader", "msm/modem/wlan_pd". + "tms/servreg", "msm/adsp/audio_pd". + "tms/servreg", "msm/modem/wlan_pd". + "tms/servreg", "msm/slpi/sensor_pd". + = EXAMPLE The following example represents a QDSP based sound card on a MSM8996 device which uses apr as communication between Apps and QDSP.
@@ -82,3 +94,41 @@ which uses apr as communication between Apps and QDSP. ... }; }; + += EXAMPLE 2 +The following example represents a QDSP based sound card with protection domain +dependencies specified. Here some of the apr services are dependent on services +running on protection domain hosted on ADSP/SLPI remote processors while others +have no such dependency. + + apr { + compatible = "qcom,apr-v2"; + qcom,glink-channels = "apr_audio_svc"; + qcom,apr-domain = <APR_DOMAIN_ADSP>; + + q6core { + compatible = "qcom,q6core"; + reg = <APR_SVC_ADSP_CORE>; + }; + + q6afe: q6afe { + compatible = "qcom,q6afe"; + reg = <APR_SVC_AFE>; + qcom,protection-domain = "avs/audio", "msm/adsp/audio_pd"; + ... + }; + + q6asm: q6asm { + compatible = "qcom,q6asm"; + reg = <APR_SVC_ASM>; + qcom,protection-domain = "tms/servreg", "msm/slpi/sensor_pd"; + ... + }; + + q6adm: q6adm { + compatible = "qcom,q6adm"; + reg = <APR_SVC_ADM>; + qcom,protection-domain = "avs/audio", "msm/adsp/audio_pd"; + ... + }; + };
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
PATCH v7 3/3 soc: qcom: apr: Add avs/audio tracking functionality
In reply to Sibi SankarUse PDR helper functions to track the protection domains that the apr services are dependent upon on SDM845 SoC, specifically the "avs/audio" service running on ADSP Q6.
---
V7:
* No change
drivers/soc/qcom/Kconfig | 1 + drivers/soc/qcom/apr.c | 123 ++++++++++++++++++++++++++++++++--- include/linux/soc/qcom/apr.h | 1 + 3 files changed, 116 insertions(+), 9 deletions(-)
drivers/soc/qcom/Kconfig +1 -0
@@ -200,6 +200,7 @@ config QCOM_APR tristate "Qualcomm APR Bus (Asynchronous Packet Router)" depends on ARCH_QCOM || COMPILE_TEST depends on RPMSG + select QCOM_PDR_HELPERS help Enable APR IPC protocol support between application processor and QDSP6. APR is
drivers/soc/qcom/apr.c +114 -9
180 lines not on this page · raw message
include/linux/soc/qcom/apr.h +1 -0
@@ -85,6 +85,7 @@ struct apr_device {uint16_t domain_id;uint32_t version;char name[APR_NAME_SIZE ]; +const char *service_path;spinlock_t lock;struct list_head node; };
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
This series was applied to andersson/remoteproc.git (refs/heads/for-next).
Hello:
This series was applied to andersson/remoteproc.git (refs/heads/for-next).
Quoted 9 lines · On Thu, 12 Mar 2020 17:38:39 +0530 you wrote:
Qualcomm SoCs (starting with MSM8998) allow for multiple protection domains (PDs) to run on the same Q6 sub-system. This allows for services like AVS AUDIO to have their own separate address space and crash/recover without disrupting the other PDs running on the same Q6 ADSP. This patch series introduces pdr helper library and adds PD tracking functionality for "avs/audio" allowing apr services to register themselves asynchronously once the dependent PDs are up.
[...]
Here is a summary with links:
- [v7,1/3] soc: qcom: Introduce Protection Domain Restart helpers
https://git.kernel.org/andersson/remoteproc/c/fbe639b44a82755d639df1c5d147c93f02ac5a0f - [v7,2/3] dt-bindings: soc: qcom: apr: Add protection domain bindings https://git.kernel.org/andersson/remoteproc/c/a03a5b6313c210565605a5dbf5d3e463c1fd5d30 - [v7,3/3] soc: qcom: apr: Add avs/audio tracking functionality https://git.kernel.org/andersson/remoteproc/c/83473566260288c560e5443ea4cc40a458aa9e6a
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.wiki.kernel.org/userdoc/pwbot