From patchwork Tue Dec 26 00:34:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 758395 Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com [209.85.208.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D100AA29 for ; Tue, 26 Dec 2023 00:34:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="nS/faNcl" Received: by mail-lj1-f169.google.com with SMTP id 38308e7fff4ca-2ccbded5aa4so10657991fa.1 for ; Mon, 25 Dec 2023 16:34:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1703550889; x=1704155689; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9sZH8qAvN7fUHwzV8tFEQL3PlFU9ZY4f992rQeokEr0=; b=nS/faNclVrlgjpmk/mxsTP47tY39Bnc3pLWvMi1yWvpr8h7N7o0GNoQaYxI/WOG0H2 ywnYrGJahoZr/Y/plNtzZMs+94PoOUuq0EvKVkVz82FFkCSLonxrkAxkSgY7ToAs2EeO OMHjwAVxxWEhiGiP8Cg9wKapI2mkb5r5saoi6VwzX6baQn5UjM1pu2dR8Vmbi5kmYMDE Z5tAB4W/0mQIyjiEnPyyUEpmY9N9LKiAXL2RSQ8kLavhSN3cRS029zuo9dZbNxgkmJVX rrW/6vPIF9L1MSe31fm7sXOo+ZzpDnM1pbqIwBJWCTkrji+FeuMNS5je9UaVpfsLKhyP hm1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703550889; x=1704155689; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9sZH8qAvN7fUHwzV8tFEQL3PlFU9ZY4f992rQeokEr0=; b=uCAXG2HNVAkaUA4TYlRUIigWXBXjDUlim2fU6O2oOQrMGsGF1P9OjrFvEDOrnh9bll j1wTWu7oRUAgtsTQzyCLkqHcp11PVEKMm6moGIUB/s3thSWIPi4c6r/fnJ+HHWC2D0Vw sVZ/DGJGCT1BQWrqCM/GOKsXCMA05rKN6ConXu+kMMFrrepDfVXhJldU/FeMaGuyT8Za aqdVVT5EEGASuVOlOd4l9W5TCQJoJrd0ccpez80VF09G6ORXCZYRRbjPr7x0q59oXeJ1 1rVp3PehoKsD4pQnA6ImOn4N2kRMbuEWFGyTWvPtbMs8JhmzUizGD1TkqlHUJcvIa6Pq Zxuw== X-Gm-Message-State: AOJu0YxNia5kPfPxiWelPzGx+ooXqCzJGX6cRjjbJufaSkUOUnm2Svcx y3rV5b/bBPbmKxumSrAKJV2d/VbLnYIY/g== X-Google-Smtp-Source: AGHT+IEYQNyL9NJUALswrOwE1Jr/L4WJSko78MY5GpN1pyBJm74ukPTZ589lDVg4YGvrmzvkO0pC7g== X-Received: by 2002:a2e:9915:0:b0:2cc:5ab2:7f49 with SMTP id v21-20020a2e9915000000b002cc5ab27f49mr2585035lji.34.1703550888916; Mon, 25 Dec 2023 16:34:48 -0800 (PST) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id d1-20020a05651c088100b002ccb1301d53sm1368810ljq.48.2023.12.25.16.34.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Dec 2023 16:34:48 -0800 (PST) From: Dmitry Baryshkov To: Bjorn Andersson , Konrad Dybcio , Mathieu Poirier Cc: linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org Subject: [RFC PATCH 1/5] soc: qcom: add pd-mapper implementation Date: Tue, 26 Dec 2023 02:34:43 +0200 Message-Id: <20231226003447.3044365-2-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231226003447.3044365-1-dmitry.baryshkov@linaro.org> References: <20231226003447.3044365-1-dmitry.baryshkov@linaro.org> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The existing userspace protection domain mapper implementation has several issue. It doesn't play well with CONFIG_EXTRA_FIRMWARE, it doesn't reread the JSON files if the firmware location is changed (or if the firmware was not available at the time pd-mapper was started but the corresponding directory is mounted later), etc. Provide in-kernel service implementing protection domain mapping required to work with several services, which are provided by the DSP firmware. Signed-off-by: Dmitry Baryshkov --- drivers/soc/qcom/Kconfig | 10 + drivers/soc/qcom/Makefile | 2 + drivers/soc/qcom/qcom_pdm.c | 302 +++++++++++++++++++++++++++++ drivers/soc/qcom/qcom_pdm_msg.c | 189 ++++++++++++++++++ drivers/soc/qcom/qcom_pdm_msg.h | 66 +++++++ include/linux/soc/qcom/pd_mapper.h | 35 ++++ 6 files changed, 604 insertions(+) create mode 100644 drivers/soc/qcom/qcom_pdm.c create mode 100644 drivers/soc/qcom/qcom_pdm_msg.c create mode 100644 drivers/soc/qcom/qcom_pdm_msg.h create mode 100644 include/linux/soc/qcom/pd_mapper.h diff --git a/drivers/soc/qcom/Kconfig b/drivers/soc/qcom/Kconfig index c6ca4de42586..baaf355004ab 100644 --- a/drivers/soc/qcom/Kconfig +++ b/drivers/soc/qcom/Kconfig @@ -72,6 +72,16 @@ config QCOM_OCMEM requirements. This is typically used by the GPU, camera/video, and audio components on some Snapdragon SoCs. +config QCOM_PD_MAPPER + tristate "Qualcomm Protection Domain Mapper" + select QCOM_QMI_HELPERS + depends on NET && QRTR + help + The Protection Domain Mapper maps registered services to the domains + and instances handled by the remote DSPs. This is a kernel-space + implementation of the service. It is a simpler alternative to the + userspace daemon. + config QCOM_PDR_HELPERS tristate select QCOM_QMI_HELPERS diff --git a/drivers/soc/qcom/Makefile b/drivers/soc/qcom/Makefile index 05b3d54e8dc9..47303d7f826d 100644 --- a/drivers/soc/qcom/Makefile +++ b/drivers/soc/qcom/Makefile @@ -6,6 +6,8 @@ obj-$(CONFIG_QCOM_COMMAND_DB) += cmd-db.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_PD_MAPPER) += qcom_pd_mapper.o +qcom_pd_mapper-y += qcom_pdm.o qcom_pdm_msg.o obj-$(CONFIG_QCOM_PDR_HELPERS) += pdr_interface.o obj-$(CONFIG_QCOM_PMIC_GLINK) += pmic_glink.o obj-$(CONFIG_QCOM_PMIC_GLINK) += pmic_glink_altmode.o diff --git a/drivers/soc/qcom/qcom_pdm.c b/drivers/soc/qcom/qcom_pdm.c new file mode 100644 index 000000000000..6dd1c2bed6d7 --- /dev/null +++ b/drivers/soc/qcom/qcom_pdm.c @@ -0,0 +1,302 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Qualcomm Protection Domain mapper + * + * Copyright (c) 2023 Linaro Ltd. + */ + +#include +#include +#include +#include + +#include "qcom_pdm_msg.h" + +#define TMS_SERVREG_SERVICE "tms/servreg" + +struct qcom_pdm_domain { + struct list_head list; + const char *name; + u32 instance_id; +}; + +struct qcom_pdm_service { + struct list_head list; + struct list_head domains; + const char *name; +}; + +static LIST_HEAD(qcom_pdm_services); +static DEFINE_MUTEX(qcom_pdm_mutex); + +static struct qcom_pdm_service *qcom_pdm_find_locked(const char *name) +{ + struct qcom_pdm_service *service; + + list_for_each_entry(service, &qcom_pdm_services, list) { + if (!strcmp(service->name, name)) + return service; + } + + return NULL; +} + +static void qcom_pdm_del_service_domain_locked(const char *service_name, const char *domain_name) +{ + struct qcom_pdm_service *service; + struct qcom_pdm_domain *domain, *temp; + + service = qcom_pdm_find_locked(service_name); + if (WARN_ON(!service)) + return; + + list_for_each_entry_safe(domain, temp, &service->domains, list) { + if (!strcmp(domain->name, domain_name)) { + list_del(&domain->list); + kfree(domain); + + if (list_empty(&service->domains)) { + list_del(&service->list); + kfree(service->name); + kfree(service); + } + + return; + } + } + + WARN(1, "domain not found"); +} + +static int qcom_pdm_add_service_domain_locked(const char *service_name, + const char *domain_name, + u32 instance_id) +{ + struct qcom_pdm_service *service; + struct qcom_pdm_domain *domain; + + service = qcom_pdm_find_locked(service_name); + if (service) { + list_for_each_entry(domain, &service->domains, list) { + if (!strcmp(domain->name, domain_name)) + return -EBUSY; + } + } else { + service = kzalloc(sizeof(*service), GFP_KERNEL); + if (!service) + return -ENOMEM; + + INIT_LIST_HEAD(&service->domains); + service->name = kstrdup(service_name, GFP_KERNEL); + + list_add_tail(&service->list, &qcom_pdm_services); + } + + domain = kzalloc(sizeof(*domain), GFP_KERNEL); + if (!domain) { + if (list_empty(&service->domains)) { + list_del(&service->list); + kfree(service->name); + kfree(service); + } + + return -ENOMEM; + } + + /* + * service name can outlive calling module and so it should be strdup'ed. + * domain name can not outlive the module, so there is no need to strdup it. + */ + domain->name = domain_name; + domain->instance_id = instance_id; + list_add(&domain->list, &service->domains); + + return 0; +} + +int qcom_pdm_add_domain(const struct qcom_pdm_domain_data *data) +{ + int ret; + int i; + + mutex_lock(&qcom_pdm_mutex); + + ret = qcom_pdm_add_service_domain_locked(TMS_SERVREG_SERVICE, + data->domain, + data->instance_id); + + for (i = 0; data->services[i]; i++) { + ret = qcom_pdm_add_service_domain_locked(data->services[i], + data->domain, + data->instance_id); + if (ret) + goto err; + } + + mutex_unlock(&qcom_pdm_mutex); + + return 0; + +err: + while (--i >= 0) + qcom_pdm_del_service_domain_locked(data->services[i], data->domain); + + qcom_pdm_del_service_domain_locked(TMS_SERVREG_SERVICE, data->domain); + + mutex_unlock(&qcom_pdm_mutex); + + return ret; +} +EXPORT_SYMBOL_GPL(qcom_pdm_add_domain); + +void qcom_pdm_del_domain(const struct qcom_pdm_domain_data *data) +{ + int i; + + mutex_lock(&qcom_pdm_mutex); + + for (i = 0; data->services[i]; i++) + qcom_pdm_del_service_domain_locked(data->services[i], data->domain); + + qcom_pdm_del_service_domain_locked(TMS_SERVREG_SERVICE, data->domain); + + mutex_unlock(&qcom_pdm_mutex); +} +EXPORT_SYMBOL_GPL(qcom_pdm_del_domain); + +static void qcom_pdm_get_domain_list(struct qmi_handle *qmi, + struct sockaddr_qrtr *sq, + struct qmi_txn *txn, + const void *decoded) +{ + const struct servreg_loc_get_domain_list_req *req = decoded; + struct servreg_loc_get_domain_list_resp *rsp = kzalloc(sizeof(*rsp), GFP_KERNEL); + struct qcom_pdm_service *service; + u32 offset; + int ret; + + pr_info("PDM: service '%s' offset %d\n", req->name, req->offset_valid ? req->offset : -1); + + offset = req->offset_valid ? req->offset : 0; + + rsp->rsp.result = QMI_RESULT_SUCCESS_V01; + rsp->rsp.error = QMI_ERR_NONE_V01; + + rsp->db_revision_valid = true; + rsp->db_revision = 1; + + rsp->total_domains_valid = 1; + rsp->total_domains = 0; + + mutex_lock(&qcom_pdm_mutex); + + service = qcom_pdm_find_locked(req->name); + if (service) { + struct qcom_pdm_domain *domain; + + rsp->domain_list_valid = 1; + rsp->domain_list_len = 0; + + list_for_each_entry(domain, &service->domains, list) { + u32 i = rsp->total_domains++; + + if (i >= offset && i < SERVREG_LOC_MAX_DOMAINS) { + u32 j = rsp->domain_list_len++; + + strlcpy(rsp->domain_list[j].name, domain->name, + sizeof(rsp->domain_list[i].name)); + rsp->domain_list[j].instance_id = domain->instance_id; + + pr_info("PDM: returning %s / %d\n", domain->name, + domain->instance_id); + } + } + + } + + mutex_unlock(&qcom_pdm_mutex); + + pr_info("PDM: service '%s' %d domains (of %d)\n", req->name, rsp->domain_list_len, rsp->total_domains); + + ret = qmi_send_response(qmi, sq, txn, SERVREG_LOC_GET_DOMAIN_LIST, + 2658, + servreg_loc_get_domain_list_resp_ei, rsp); + if (ret) + pr_err("Error sending servreg response: %d\n", ret); + + kfree(rsp); +} + +static void qcom_pdm_pfr(struct qmi_handle *qmi, + struct sockaddr_qrtr *sq, + struct qmi_txn *txn, + const void *decoded) +{ + const struct servreg_loc_pfr_req *req = decoded; + struct servreg_loc_pfr_resp rsp = {}; + int ret; + + pr_warn_ratelimited("PDM: service '%s' crash: '%s'\n", req->service, req->reason); + + rsp.rsp.result = QMI_RESULT_SUCCESS_V01; + rsp.rsp.error = QMI_ERR_NONE_V01; + + ret = qmi_send_response(qmi, sq, txn, SERVREG_LOC_PFR, + SERVREG_LOC_PFR_RESP_MSG_SIZE, + servreg_loc_pfr_resp_ei, &rsp); + if (ret) + pr_err("Error sending servreg response: %d\n", ret); +} + +static const struct qmi_msg_handler qcom_pdm_msg_handlers[] = { + { + .type = QMI_REQUEST, + .msg_id = SERVREG_LOC_GET_DOMAIN_LIST, + .ei = servreg_loc_get_domain_list_req_ei, + .decoded_size = sizeof(struct servreg_loc_get_domain_list_req), + .fn = qcom_pdm_get_domain_list, + }, + { + .type = QMI_REQUEST, + .msg_id = SERVREG_LOC_PFR, + .ei = servreg_loc_pfr_req_ei, + .decoded_size = sizeof(struct servreg_loc_pfr_req), + .fn = qcom_pdm_pfr, + }, + { }, +}; + +static struct qmi_handle qcom_pdm_handle; + +static int qcom_pdm_init(void) +{ + int ret; + + ret = qmi_handle_init(&qcom_pdm_handle, 1024, + NULL, qcom_pdm_msg_handlers); + if (ret) + return ret; + + ret = qmi_add_server(&qcom_pdm_handle, SERVREG_QMI_SERVICE, + SERVREG_QMI_VERSION, SERVREG_QMI_INSTANCE); + if (ret) { + qmi_handle_release(&qcom_pdm_handle); + memset(&qcom_pdm_handle, 0, sizeof(qcom_pdm_handle)); + } + + return ret; +} + +static void qcom_pdm_exit(void) +{ + qmi_handle_release(&qcom_pdm_handle); + memset(&qcom_pdm_handle, 0, sizeof(qcom_pdm_handle)); + + WARN_ON(!list_empty(&qcom_pdm_services)); +} + +module_init(qcom_pdm_init); +module_exit(qcom_pdm_exit); + +MODULE_DESCRIPTION("Qualcomm Protection Domain Mapper"); +MODULE_LICENSE("GPL"); diff --git a/drivers/soc/qcom/qcom_pdm_msg.c b/drivers/soc/qcom/qcom_pdm_msg.c new file mode 100644 index 000000000000..ba660f68a629 --- /dev/null +++ b/drivers/soc/qcom/qcom_pdm_msg.c @@ -0,0 +1,189 @@ +// SPDX-License-Identifier: BSD-3-Clause +/* + * Copyright (c) 2018, Linaro Ltd. + * Copyright (c) 2016, Bjorn Andersson + */ + +#include "qcom_pdm_msg.h" + +struct qmi_elem_info servreg_loc_domain_list_entry_ei[] = { + { + .data_type = QMI_STRING, + .elem_len = 65, + .elem_size = sizeof(char), + .offset = offsetof(struct servreg_loc_domain_list_entry, name) + }, + { + .data_type = QMI_UNSIGNED_4_BYTE, + .elem_len = 1, + .elem_size = sizeof(u32), + .offset = offsetof(struct servreg_loc_domain_list_entry, instance_id), + }, + { + .data_type = QMI_UNSIGNED_1_BYTE, + .elem_len = 1, + .elem_size = sizeof(uint8_t), + .offset = offsetof(struct servreg_loc_domain_list_entry, service_data_valid), + }, + { + .data_type = QMI_UNSIGNED_4_BYTE, + .elem_len = 1, + .elem_size = sizeof(u32), + .offset = offsetof(struct servreg_loc_domain_list_entry, service_data), + }, + {} +}; + +struct qmi_elem_info servreg_loc_get_domain_list_req_ei[] = { + { + .data_type = QMI_STRING, + .elem_len = 65, + .elem_size = sizeof(char), + .array_type = VAR_LEN_ARRAY, + .tlv_type = 1, + .offset = offsetof(struct servreg_loc_get_domain_list_req, name) + }, + { + .data_type = QMI_OPT_FLAG, + .elem_len = 1, + .elem_size = sizeof(u8), + .tlv_type = 16, + .offset = offsetof(struct servreg_loc_get_domain_list_req, offset_valid), + }, + { + .data_type = QMI_UNSIGNED_4_BYTE, + .elem_len = 1, + .elem_size = sizeof(u32), + .tlv_type = 16, + .offset = offsetof(struct servreg_loc_get_domain_list_req, offset), + }, + { + .data_type = QMI_EOTI, + .elem_len = 0, + .elem_size = 0, + .array_type = NO_ARRAY, + .tlv_type = QMI_COMMON_TLV_TYPE, + .offset = 0, + .ei_array = NULL, + } +}; + +struct qmi_elem_info servreg_loc_get_domain_list_resp_ei[] = { + { + .data_type = QMI_STRUCT, + .elem_len = 1, + .elem_size = sizeof_field(struct servreg_loc_get_domain_list_resp, rsp), + .tlv_type = 2, + .offset = offsetof(struct servreg_loc_get_domain_list_resp, rsp), + .ei_array = qmi_response_type_v01_ei, + }, + { + .data_type = QMI_OPT_FLAG, + .elem_len = 1, + .elem_size = sizeof(u8), + .tlv_type = 16, + .offset = offsetof(struct servreg_loc_get_domain_list_resp, total_domains_valid), + }, + { + .data_type = QMI_UNSIGNED_2_BYTE, + .elem_len = 1, + .elem_size = sizeof(u16), + .tlv_type = 16, + .offset = offsetof(struct servreg_loc_get_domain_list_resp, total_domains), + }, + { + .data_type = QMI_OPT_FLAG, + .elem_len = 1, + .elem_size = sizeof(u8), + .tlv_type = 17, + .offset = offsetof(struct servreg_loc_get_domain_list_resp, db_revision_valid), + }, + { + .data_type = QMI_UNSIGNED_2_BYTE, + .elem_len = 1, + .elem_size = sizeof(u16), + .tlv_type = 17, + .offset = offsetof(struct servreg_loc_get_domain_list_resp, db_revision), + }, + { + .data_type = QMI_OPT_FLAG, + .elem_len = 1, + .elem_size = sizeof(u8), + .tlv_type = 18, + .offset = offsetof(struct servreg_loc_get_domain_list_resp, domain_list_valid), + }, + { + .data_type = QMI_DATA_LEN, + .elem_len = 1, + .elem_size = sizeof(uint8_t), + .tlv_type = 18, + .offset = offsetof(struct servreg_loc_get_domain_list_resp, domain_list_len), + }, + { + .data_type = QMI_STRUCT, + .elem_len = 32, + .elem_size = sizeof(struct servreg_loc_domain_list_entry), + .array_type = VAR_LEN_ARRAY, + .tlv_type = 18, + .offset = offsetof(struct servreg_loc_get_domain_list_resp, domain_list), + .ei_array = servreg_loc_domain_list_entry_ei, + }, + { + .data_type = QMI_EOTI, + .elem_len = 0, + .elem_size = 0, + .array_type = NO_ARRAY, + .tlv_type = QMI_COMMON_TLV_TYPE, + .offset = 0, + .ei_array = NULL, + } +}; + +struct qmi_elem_info servreg_loc_pfr_req_ei[] = { + { + .data_type = QMI_STRING, + .elem_len = 65, + .elem_size = sizeof(char), + .array_type = VAR_LEN_ARRAY, + .tlv_type = 1, + .offset = offsetof(struct servreg_loc_pfr_req, service) + }, + { + .data_type = QMI_STRING, + .elem_len = 65, + .elem_size = sizeof(char), + .array_type = VAR_LEN_ARRAY, + .tlv_type = 2, + .offset = offsetof(struct servreg_loc_pfr_req, reason) + }, + { + .data_type = QMI_EOTI, + .elem_len = 0, + .elem_size = 0, + .array_type = NO_ARRAY, + .tlv_type = QMI_COMMON_TLV_TYPE, + .offset = 0, + .ei_array = NULL, + } +}; + +struct qmi_elem_info servreg_loc_pfr_resp_ei[] = { + { + .data_type = QMI_STRUCT, + .elem_len = 1, + .elem_size = sizeof_field(struct servreg_loc_pfr_resp, rsp), + .tlv_type = 2, + .offset = offsetof(struct servreg_loc_pfr_resp, rsp), + .ei_array = qmi_response_type_v01_ei, + }, + { + .data_type = QMI_EOTI, + .elem_len = 0, + .elem_size = 0, + .array_type = NO_ARRAY, + .tlv_type = QMI_COMMON_TLV_TYPE, + .offset = 0, + .ei_array = NULL, + } +}; + diff --git a/drivers/soc/qcom/qcom_pdm_msg.h b/drivers/soc/qcom/qcom_pdm_msg.h new file mode 100644 index 000000000000..e576b87c67c0 --- /dev/null +++ b/drivers/soc/qcom/qcom_pdm_msg.h @@ -0,0 +1,66 @@ +// SPDX-License-Identifier: BSD-3-Clause +/* + * Copyright (c) 2018, Linaro Ltd. + * Copyright (c) 2016, Bjorn Andersson + */ + +#ifndef __QMI_SERVREG_LOC_H__ +#define __QMI_SERVREG_LOC_H__ + +#include +#include + +#define SERVREG_QMI_SERVICE 64 +#define SERVREG_QMI_VERSION 257 +#define SERVREG_QMI_INSTANCE 0 +#define QMI_RESULT_SUCCESS 0 +#define QMI_RESULT_FAILURE 1 +#define QMI_ERR_NONE 0 +#define QMI_ERR_INTERNAL 1 +#define QMI_ERR_MALFORMED_MSG 2 +#define SERVREG_LOC_GET_DOMAIN_LIST 33 +#define SERVREG_LOC_PFR 36 + +struct servreg_loc_domain_list_entry { + char name[65]; + u32 instance_id; + u8 service_data_valid; + u32 service_data; +}; + +struct servreg_loc_get_domain_list_req { + char name[65]; + u8 offset_valid; + u32 offset; +}; + +#define SERVREG_LOC_MAX_DOMAINS 32 + +struct servreg_loc_get_domain_list_resp { + struct qmi_response_type_v01 rsp; + u8 total_domains_valid; + u16 total_domains; + u8 db_revision_valid; + u16 db_revision; + u8 domain_list_valid; + u32 domain_list_len; + struct servreg_loc_domain_list_entry domain_list[SERVREG_LOC_MAX_DOMAINS]; +}; + +struct servreg_loc_pfr_req { + char service[65]; + char reason[257]; +}; + +struct servreg_loc_pfr_resp { + struct qmi_response_type_v01 rsp; +}; + +#define SERVREG_LOC_PFR_RESP_MSG_SIZE 10 + +extern struct qmi_elem_info servreg_loc_get_domain_list_req_ei[]; +extern struct qmi_elem_info servreg_loc_get_domain_list_resp_ei[]; +extern struct qmi_elem_info servreg_loc_pfr_req_ei[]; +extern struct qmi_elem_info servreg_loc_pfr_resp_ei[]; + +#endif diff --git a/include/linux/soc/qcom/pd_mapper.h b/include/linux/soc/qcom/pd_mapper.h new file mode 100644 index 000000000000..9b50a7643d8f --- /dev/null +++ b/include/linux/soc/qcom/pd_mapper.h @@ -0,0 +1,35 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Qualcomm Protection Domain mapper + * + * Copyright (c) 2023 Linaro Ltd. + */ +#ifndef __QCOM_PD_MAPPER__ +#define __QCOM_PD_MAPPER__ + +struct qcom_pdm_domain_data { + const char *domain; + u32 instance_id; + /* NULL-terminated array */ + const char * services[]; +}; + +#if IS_ENABLED(CONFIG_QCOM_PD_MAPPER) + +int qcom_pdm_add_domain(const struct qcom_pdm_domain_data *data); +void qcom_pdm_del_domain(const struct qcom_pdm_domain_data *data); + +#else + +static inline int qcom_pdm_add_domain(const struct qcom_pdm_domain_data *data) +{ + return 0; +} + +static inline void qcom_pdm_del_domain(const struct qcom_pdm_domain_data *data) +{ +} + +#endif + +#endif From patchwork Tue Dec 26 00:34:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 759145 Received: from mail-ed1-f50.google.com (mail-ed1-f50.google.com [209.85.208.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AAFCFA47 for ; Tue, 26 Dec 2023 00:34:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ChBocOp3" Received: by mail-ed1-f50.google.com with SMTP id 4fb4d7f45d1cf-554fe147ddeso635381a12.3 for ; Mon, 25 Dec 2023 16:34:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1703550890; x=1704155690; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=D2BpmMOrsZQoLsyIn7ndsCgpL3U+77hQN1G7jreKo3E=; b=ChBocOp3OGUXrCV64bDn2YIp4jBvc43JAf4q4fq+8ZZc9MXmWWWtCJhLynBu8s+545 QiqZP/d1owOXIvE4wuTlWT0YMQwWRmb5J9nBU+RlrEWHIKwiJe1a8rYLZ/qhNLEkmKlX lX5kYgpvJ+Vc32Ru/8F+EBDXMCfgaLnH+XfjOt2XtsKFbRgqxR7kF8ll20vSH+O8atAH cJFwbSmxPwGGXsXV2jDkFQFekTH3t7BsAqb0v3K2avfZXWow+ZhMatV51UYuwUctHd11 984UwQht7HHon5UaDyOudUVUOKS0klqqYK+M2hccT0Fi8hoR/MFu61YxJ5bkbv8bH7DS 0OOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703550890; x=1704155690; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=D2BpmMOrsZQoLsyIn7ndsCgpL3U+77hQN1G7jreKo3E=; b=VsuOIK2cnvkuT+Wywbzk8EdtcN2dk4Gqv0tHlXFtAKlvWvwpK2petVurewgr7eWeG8 fs40WcDP0kT3dHZGELVlVj+Mq9kqOXu39lCYVUmaQO+5liW4iN4BupqhOnbfNSHesr8f tMtIUx48s3lYGLI2uugAtViX6I4ivSD/9T59fkf0jeHSpWGPghfxAFHK6fg0oHBi6VmR aekJlF75l6+uuZRyHLwA3Q1p8iGNcyVAqgMGkonTV3+MEYBuzzHuH2ZJq8Kc3jZXNo6g PLc56wtFl3gMaFDQfDuqgUAvLbMGl71byAXGvksvd3XzWIH66N/o54BT1hupsK4vYcHU 3tvw== X-Gm-Message-State: AOJu0Yyh9jHqySeayd9ALSoZK/mXJerXuNnKEW0a3EHMaTqD0+kaCZpi 2PVhAhp6Wyv0303Z0RIFun57N2HRweq0yw== X-Google-Smtp-Source: AGHT+IFakMVP6FnIu3+AsY7f+Xq0bPOEDOxTfMnL4Ax79OVoKytsJlo8356fg01IBG9bBt+Xf3TOMA== X-Received: by 2002:aa7:d818:0:b0:553:d6f0:1e54 with SMTP id v24-20020aa7d818000000b00553d6f01e54mr2698601edq.123.1703550889865; Mon, 25 Dec 2023 16:34:49 -0800 (PST) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id d1-20020a05651c088100b002ccb1301d53sm1368810ljq.48.2023.12.25.16.34.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Dec 2023 16:34:49 -0800 (PST) From: Dmitry Baryshkov To: Bjorn Andersson , Konrad Dybcio , Mathieu Poirier Cc: linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org Subject: [RFC PATCH 2/5] remoteproc: qcom: pas: correct data indentation Date: Tue, 26 Dec 2023 02:34:44 +0200 Message-Id: <20231226003447.3044365-3-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231226003447.3044365-1-dmitry.baryshkov@linaro.org> References: <20231226003447.3044365-1-dmitry.baryshkov@linaro.org> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Correct indentation of several struct adsp_data instances to always use a single TAB character instead of two. Signed-off-by: Dmitry Baryshkov --- drivers/remoteproc/qcom_q6v5_pas.c | 126 +++++++++++++++-------------- 1 file changed, 64 insertions(+), 62 deletions(-) diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q6v5_pas.c index a9dd58608052..c1f7c5ff8d93 100644 --- a/drivers/remoteproc/qcom_q6v5_pas.c +++ b/drivers/remoteproc/qcom_q6v5_pas.c @@ -777,24 +777,24 @@ static void adsp_remove(struct platform_device *pdev) } static const struct adsp_data adsp_resource_init = { - .crash_reason_smem = 423, - .firmware_name = "adsp.mdt", - .pas_id = 1, - .auto_boot = true, - .ssr_name = "lpass", - .sysmon_name = "adsp", - .ssctl_id = 0x14, + .crash_reason_smem = 423, + .firmware_name = "adsp.mdt", + .pas_id = 1, + .auto_boot = true, + .ssr_name = "lpass", + .sysmon_name = "adsp", + .ssctl_id = 0x14, }; static const struct adsp_data sdm845_adsp_resource_init = { - .crash_reason_smem = 423, - .firmware_name = "adsp.mdt", - .pas_id = 1, - .auto_boot = true, - .load_state = "adsp", - .ssr_name = "lpass", - .sysmon_name = "adsp", - .ssctl_id = 0x14, + .crash_reason_smem = 423, + .firmware_name = "adsp.mdt", + .pas_id = 1, + .auto_boot = true, + .load_state = "adsp", + .ssr_name = "lpass", + .sysmon_name = "adsp", + .ssctl_id = 0x14, }; static const struct adsp_data sm6350_adsp_resource = { @@ -829,18 +829,18 @@ static const struct adsp_data sm6375_mpss_resource = { }; static const struct adsp_data sm8150_adsp_resource = { - .crash_reason_smem = 423, - .firmware_name = "adsp.mdt", - .pas_id = 1, - .auto_boot = true, - .proxy_pd_names = (char*[]){ - "cx", - NULL - }, - .load_state = "adsp", - .ssr_name = "lpass", - .sysmon_name = "adsp", - .ssctl_id = 0x14, + .crash_reason_smem = 423, + .firmware_name = "adsp.mdt", + .pas_id = 1, + .auto_boot = true, + .proxy_pd_names = (char*[]){ + "cx", + NULL + }, + .load_state = "adsp", + .ssr_name = "lpass", + .sysmon_name = "adsp", + .ssctl_id = 0x14, }; static const struct adsp_data sm8250_adsp_resource = { @@ -873,20 +873,22 @@ static const struct adsp_data sm8350_adsp_resource = { .ssr_name = "lpass", .sysmon_name = "adsp", .ssctl_id = 0x14, + .num_domains = ARRAY_SIZE(sm8350_adsp_domains), + .domains = sm8350_adsp_domains, }; static const struct adsp_data msm8996_adsp_resource = { - .crash_reason_smem = 423, - .firmware_name = "adsp.mdt", - .pas_id = 1, - .auto_boot = true, - .proxy_pd_names = (char*[]){ - "cx", - NULL - }, - .ssr_name = "lpass", - .sysmon_name = "adsp", - .ssctl_id = 0x14, + .crash_reason_smem = 423, + .firmware_name = "adsp.mdt", + .pas_id = 1, + .auto_boot = true, + .proxy_pd_names = (char*[]){ + "cx", + NULL + }, + .ssr_name = "lpass", + .sysmon_name = "adsp", + .ssctl_id = 0x14, }; static const struct adsp_data cdsp_resource_init = { @@ -1033,33 +1035,33 @@ static const struct adsp_data sc8180x_mpss_resource = { }; static const struct adsp_data msm8996_slpi_resource_init = { - .crash_reason_smem = 424, - .firmware_name = "slpi.mdt", - .pas_id = 12, - .auto_boot = true, - .proxy_pd_names = (char*[]){ - "ssc_cx", - NULL - }, - .ssr_name = "dsps", - .sysmon_name = "slpi", - .ssctl_id = 0x16, + .crash_reason_smem = 424, + .firmware_name = "slpi.mdt", + .pas_id = 12, + .auto_boot = true, + .proxy_pd_names = (char*[]){ + "ssc_cx", + NULL + }, + .ssr_name = "dsps", + .sysmon_name = "slpi", + .ssctl_id = 0x16, }; static const struct adsp_data sdm845_slpi_resource_init = { - .crash_reason_smem = 424, - .firmware_name = "slpi.mdt", - .pas_id = 12, - .auto_boot = true, - .proxy_pd_names = (char*[]){ - "lcx", - "lmx", - NULL - }, - .load_state = "slpi", - .ssr_name = "dsps", - .sysmon_name = "slpi", - .ssctl_id = 0x16, + .crash_reason_smem = 424, + .firmware_name = "slpi.mdt", + .pas_id = 12, + .auto_boot = true, + .proxy_pd_names = (char*[]){ + "lcx", + "lmx", + NULL + }, + .load_state = "slpi", + .ssr_name = "dsps", + .sysmon_name = "slpi", + .ssctl_id = 0x16, }; static const struct adsp_data wcss_resource_init = { From patchwork Tue Dec 26 00:34:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 759144 Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com [209.85.208.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 22D24EDB for ; Tue, 26 Dec 2023 00:34:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ZfA9hGMA" Received: by mail-lj1-f180.google.com with SMTP id 38308e7fff4ca-2ccb78da44fso17111261fa.0 for ; Mon, 25 Dec 2023 16:34:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1703550891; x=1704155691; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Mk7JCm6FVAskN3xKnyN6uBzsSfBNTuACoWqqIWubEIg=; b=ZfA9hGMAP4a7nqqIi6ExRR5kaMrCxwgX8Z0OBIwVNYKYywxnGUrR1IRKeJZjxRPIgj nkqWV6JYG5Git+FsX+GWVpVmDwtpWsKoSGcHhMSRE98+N8EenHU9s7YrElapHVLScCGM vBI+ZazbLpVRTJRnU+cJur3ey8VV/CGncRPstFVtywmRSF7037L7cfYbUgZxNEfRW+TL 8ZEgaGdIze0Kt4kpXI4Ecy2Uz2mUrnocQj2I++a/PqE9IKJ/3aVTnE2f8kgX2jShNve/ JaKrlh+Wxj3oONXf9LWCI9b8W7N0V30RHWtKaTlHHdwK6Y84Gu3jpX/ysQFVA9P1lIbq NPlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703550891; x=1704155691; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Mk7JCm6FVAskN3xKnyN6uBzsSfBNTuACoWqqIWubEIg=; b=A3LEa8TgVUA/oSXsdbS1SUFUeAat1xCtaIBY17qVPEt5b0wVAm/V3zPohRRTtYtD65 SM9S65+H0Rjwu5VSRnMHIi/6P/WpKeDTh10TXzHs39v1+tSO/IpTT6Z5ULRl8Q8sC4oP IGeUTrfWA8iMop87PCsngMLEhWi1ty/nfTpB8ho0ZLxXn4FiH89iQCAeRaB5YDomBRDK YATz4qppAjyVbPsM44gauHNoVEJ86QaMsWycZst4HbyPKkgsHgDMkS498UJlnWeMZPpe 9DuA4DbJyjDVGDd5AoyeogutROy+PWAyB95oWf7chwWeL05Z/7tfBI4+tyDhK9Heldap A5Hg== X-Gm-Message-State: AOJu0YxEvaMHX/0k23FkYrwBmn+21irdlyDRDDr5cJu6ayqqIAFsCHLD TVdsxUu2CjPoBq93EHAywR0GD5M/2dfGDA== X-Google-Smtp-Source: AGHT+IGHVeh4SgVzGyS0ZHJrO8LTdPx7kjHJxyEK76C8mFD3RD40zwemuw9kaSFdKQ9no8xSneKRrw== X-Received: by 2002:a2e:a499:0:b0:2cc:9320:bccb with SMTP id h25-20020a2ea499000000b002cc9320bccbmr3184266lji.2.1703550890742; Mon, 25 Dec 2023 16:34:50 -0800 (PST) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id d1-20020a05651c088100b002ccb1301d53sm1368810ljq.48.2023.12.25.16.34.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Dec 2023 16:34:50 -0800 (PST) From: Dmitry Baryshkov To: Bjorn Andersson , Konrad Dybcio , Mathieu Poirier Cc: linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org Subject: [RFC PATCH 3/5] remoteproc: qcom: adsp: add configuration for in-kernel pdm Date: Tue, 26 Dec 2023 02:34:45 +0200 Message-Id: <20231226003447.3044365-4-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231226003447.3044365-1-dmitry.baryshkov@linaro.org> References: <20231226003447.3044365-1-dmitry.baryshkov@linaro.org> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add domain / service configuration for the in-kernel protection domain mapper service. Signed-off-by: Dmitry Baryshkov --- drivers/remoteproc/Kconfig | 1 + drivers/remoteproc/qcom_q6v5_adsp.c | 67 +++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) diff --git a/drivers/remoteproc/Kconfig b/drivers/remoteproc/Kconfig index 48845dc8fa85..f1698d4c302e 100644 --- a/drivers/remoteproc/Kconfig +++ b/drivers/remoteproc/Kconfig @@ -181,6 +181,7 @@ config QCOM_Q6V5_ADSP depends on QCOM_SYSMON || QCOM_SYSMON=n depends on RPMSG_QCOM_GLINK || RPMSG_QCOM_GLINK=n depends on QCOM_AOSS_QMP || QCOM_AOSS_QMP=n + depends on QCOM_PD_MAPPER || QCOM_PD_MAPPER=n select MFD_SYSCON select QCOM_PIL_INFO select QCOM_MDT_LOADER diff --git a/drivers/remoteproc/qcom_q6v5_adsp.c b/drivers/remoteproc/qcom_q6v5_adsp.c index 6c67514cc493..71106ec94840 100644 --- a/drivers/remoteproc/qcom_q6v5_adsp.c +++ b/drivers/remoteproc/qcom_q6v5_adsp.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -76,6 +77,9 @@ struct adsp_pil_data { int num_clks; const char **proxy_pd_names; const char *load_state; + + size_t num_domains; + const struct qcom_pdm_domain_data * const *domains; }; struct qcom_adsp { @@ -118,6 +122,9 @@ struct qcom_adsp { struct qcom_sysmon *sysmon; int (*shutdown)(struct qcom_adsp *adsp); + + size_t num_domains; + const struct qcom_pdm_domain_data * const *domains; }; static int qcom_rproc_pds_attach(struct device *dev, struct qcom_adsp *adsp, @@ -382,6 +389,7 @@ static int adsp_start(struct rproc *rproc) struct qcom_adsp *adsp = rproc->priv; int ret; unsigned int val; + int i; ret = qcom_q6v5_prepare(&adsp->q6v5); if (ret) @@ -443,8 +451,18 @@ static int adsp_start(struct rproc *rproc) goto disable_adsp_clks; } + for (i = 0; i < adsp->num_domains; i++) { + ret = qcom_pdm_add_domain(adsp->domains[i]); + if (ret) + goto err_domains; + } + return 0; +err_domains: + while (--i >= 0) + qcom_pdm_del_domain(adsp->domains[i]); + disable_adsp_clks: clk_bulk_disable_unprepare(adsp->num_clks, adsp->clks); disable_power_domain: @@ -472,6 +490,10 @@ static int adsp_stop(struct rproc *rproc) struct qcom_adsp *adsp = rproc->priv; int handover; int ret; + int i; + + for (i = 0; i < adsp->num_domains; i++) + qcom_pdm_del_domain(adsp->domains[i]); ret = qcom_q6v5_request_stop(&adsp->q6v5, adsp->sysmon); if (ret == -ETIMEDOUT) @@ -699,6 +721,8 @@ static int adsp_probe(struct platform_device *pdev) adsp->rproc = rproc; adsp->info_name = desc->sysmon_name; adsp->has_iommu = desc->has_iommu; + adsp->num_domains = desc->num_domains; + adsp->domains = desc->domains; platform_set_drvdata(pdev, adsp); @@ -775,6 +799,45 @@ static void adsp_remove(struct platform_device *pdev) rproc_free(adsp->rproc); } +static const struct qcom_pdm_domain_data adsp_audio_pd = { + .domain = "msm/adsp/audio_pd", + .instance_id = 74, + .services = { + "avs/audio", + NULL, + }, +}; + +static const struct qcom_pdm_domain_data adsp_charger_pd = { + .domain = "msm/adsp/charger_pd", + .instance_id = 74, + .services = { NULL }, +}; + +static const struct qcom_pdm_domain_data adsp_root_pd = { + .domain = "msm/adsp/root_pd", + .instance_id = 74, + .services = { NULL }, +}; + +static const struct qcom_pdm_domain_data adsp_sensor_pd = { + .domain = "msm/adsp/sensor_pd", + .instance_id = 74, + .services = { NULL }, +}; + +static const struct qcom_pdm_domain_data *sc7280_adsp_domains[] = { + &adsp_audio_pd, + &adsp_root_pd, + &adsp_charger_pd, + &adsp_sensor_pd +}; + +static const struct qcom_pdm_domain_data *sdm845_adsp_domains[] = { + &adsp_audio_pd, + &adsp_root_pd, +}; + static const struct adsp_pil_data adsp_resource_init = { .crash_reason_smem = 423, .firmware_name = "adsp.mdt", @@ -791,6 +854,8 @@ static const struct adsp_pil_data adsp_resource_init = { .proxy_pd_names = (const char*[]) { "cx", NULL }, + .num_domains = ARRAY_SIZE(sdm845_adsp_domains), + .domains = sdm845_adsp_domains, }; static const struct adsp_pil_data adsp_sc7280_resource_init = { @@ -806,6 +871,8 @@ static const struct adsp_pil_data adsp_sc7280_resource_init = { "gcc_cfg_noc_lpass", NULL }, .num_clks = 1, + .num_domains = ARRAY_SIZE(sc7280_adsp_domains), + .domains = sc7280_adsp_domains, }; static const struct adsp_pil_data cdsp_resource_init = { From patchwork Tue Dec 26 00:34:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 758393 Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com [209.85.208.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 46ADD1104 for ; Tue, 26 Dec 2023 00:34:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ZsVYEKfI" Received: by mail-lj1-f169.google.com with SMTP id 38308e7fff4ca-2ccb78da44fso17111281fa.0 for ; Mon, 25 Dec 2023 16:34:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1703550891; x=1704155691; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jX3eO3feWUJNZX6BIAEYE8glaW4JPeslJan+d7r4XsQ=; b=ZsVYEKfIA5STcUMbHqGV3E201urnmbHD4cMKYMxnyD57oW01WV11E5hU/JKPkrOC7K 1oGGjQqXQM/c4hXrYhxwEF0JoKSjoUORKkuqKcd1KC+3Z/LZ/NORjJ6BynQQIpeRJI5q 8aC83TE4VJrp4vKGp5OghEeQTS3ouvu8WuIH3Dg6elomZhGzS19DLGMUwFGbxnR1ktn6 Z2PAdt9O5gErCafhkK+PxyOWUnNB8LMOWVdm7RwPkSiRjvOLHob8c6dKTY/RQuR03Sfm B67XDM7A0xKfjcSdON/Hj4TNVIhtvdo1qE+Cxa4CPnzIE+xn/Mi89pjepWK+6PyHcPq7 OZtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703550891; x=1704155691; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jX3eO3feWUJNZX6BIAEYE8glaW4JPeslJan+d7r4XsQ=; b=thMiupi/u847APd3Zo43sTOfrekU1pPqxvy2P4A7cH2dEen9dXL0BtTWkuLFN9s3DJ ews3kT3ncRLBZk8xeOQAPreOO9OpFrFQLp1Bxp3ZarvUcOGd0cYitESqutqHFEmQjwn9 CAsAUD/laeO7jwOTECg9RWcGhzuMs7FTP3qJ9eelaLiwDr2jPBIlVAe2PP4e2cOfzoTe f0Olm+TBq2Bh3WNuBB5ivFv3XmJDF2cxT5WlNdyUTFJ0kiNKoW1NQWHrU2PbNXWDPbcB YME0kcrmqwzPbPiqfjkX6xN/rlm5lPb7hz3zSTdIdw7aL8g3LUeZNUjOWwUlL7OCHwgj 1oDg== X-Gm-Message-State: AOJu0YxB4RbMbZzJInKryP6AKT2llOxN/4rBcgs33J1qhXGMsJ+Wj1Dx bqOqL78TYaWV0woio/+1kuVPAmAj3VZ9VQ== X-Google-Smtp-Source: AGHT+IHMFYdVkJAYdgHHQ5xefSmh7kREbueJsCdLz2upBsQSqy4L2BiuQV+qOq7SaAGoF8c3fhpbng== X-Received: by 2002:a2e:86d9:0:b0:2cb:28d1:c22 with SMTP id n25-20020a2e86d9000000b002cb28d10c22mr2702960ljj.26.1703550891431; Mon, 25 Dec 2023 16:34:51 -0800 (PST) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id d1-20020a05651c088100b002ccb1301d53sm1368810ljq.48.2023.12.25.16.34.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Dec 2023 16:34:50 -0800 (PST) From: Dmitry Baryshkov To: Bjorn Andersson , Konrad Dybcio , Mathieu Poirier Cc: linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org Subject: [RFC PATCH 4/5] remoteproc: qcom: mss: add configuration for in-kernel pdm Date: Tue, 26 Dec 2023 02:34:46 +0200 Message-Id: <20231226003447.3044365-5-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231226003447.3044365-1-dmitry.baryshkov@linaro.org> References: <20231226003447.3044365-1-dmitry.baryshkov@linaro.org> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add domain / service configuration for the in-kernel protection domain mapper service. Signed-off-by: Dmitry Baryshkov --- drivers/remoteproc/Kconfig | 1 + drivers/remoteproc/qcom_q6v5_mss.c | 84 ++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+) diff --git a/drivers/remoteproc/Kconfig b/drivers/remoteproc/Kconfig index f1698d4c302e..8152e845f7a3 100644 --- a/drivers/remoteproc/Kconfig +++ b/drivers/remoteproc/Kconfig @@ -202,6 +202,7 @@ config QCOM_Q6V5_MSS depends on QCOM_SYSMON || QCOM_SYSMON=n depends on RPMSG_QCOM_GLINK || RPMSG_QCOM_GLINK=n depends on QCOM_AOSS_QMP || QCOM_AOSS_QMP=n + depends on QCOM_PD_MAPPER || QCOM_PD_MAPPER=n select MFD_SYSCON select QCOM_MDT_LOADER select QCOM_PIL_INFO diff --git a/drivers/remoteproc/qcom_q6v5_mss.c b/drivers/remoteproc/qcom_q6v5_mss.c index 394b2c1cb5e2..0bc611165657 100644 --- a/drivers/remoteproc/qcom_q6v5_mss.c +++ b/drivers/remoteproc/qcom_q6v5_mss.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -163,6 +164,9 @@ struct rproc_hexagon_res { bool has_qaccept_regs; bool has_ext_cntl_regs; bool has_vq6; + + size_t num_domains; + const struct qcom_pdm_domain_data * const *domains; }; struct q6v5 { @@ -242,6 +246,9 @@ struct q6v5 { u64 mba_perm; const char *hexagon_mdt_image; int version; + + size_t num_domains; + const struct qcom_pdm_domain_data * const *domains; }; enum { @@ -1580,6 +1587,7 @@ static int q6v5_start(struct rproc *rproc) struct q6v5 *qproc = rproc->priv; int xfermemop_ret; int ret; + int i; ret = q6v5_mba_load(qproc); if (ret) @@ -1608,8 +1616,18 @@ static int q6v5_start(struct rproc *rproc) /* Reset Dump Segment Mask */ qproc->current_dump_size = 0; + for (i = 0; i < qproc->num_domains; i++) { + ret = qcom_pdm_add_domain(qproc->domains[i]); + if (ret) + goto err_domains; + } + return 0; +err_domains: + while (--i >= 0) + qcom_pdm_del_domain(qproc->domains[i]); + reclaim_mpss: q6v5_mba_reclaim(qproc); q6v5_dump_mba_logs(qproc); @@ -1621,6 +1639,10 @@ static int q6v5_stop(struct rproc *rproc) { struct q6v5 *qproc = rproc->priv; int ret; + int i; + + for (i = 0; i < qproc->num_domains; i++) + qcom_pdm_del_domain(qproc->domains[i]); ret = qcom_q6v5_request_stop(&qproc->q6v5, qproc->sysmon); if (ret == -ETIMEDOUT) @@ -2013,6 +2035,9 @@ static int q6v5_probe(struct platform_device *pdev) platform_set_drvdata(pdev, qproc); + qproc->num_domains = desc->num_domains; + qproc->domains = desc->domains; + qproc->has_qaccept_regs = desc->has_qaccept_regs; qproc->has_ext_cntl_regs = desc->has_ext_cntl_regs; qproc->has_vq6 = desc->has_vq6; @@ -2153,6 +2178,54 @@ static void q6v5_remove(struct platform_device *pdev) rproc_free(rproc); } +static const struct qcom_pdm_domain_data mpss_root_pd = { + .domain = "msm/modem/root_pd", + .instance_id = 180, + .services = { NULL }, +}; + +static const struct qcom_pdm_domain_data msm8996_mpss_root_pd = { + .domain = "msm/modem/root_pd", + .instance_id = 100, + .services = { NULL }, +}; + +static const struct qcom_pdm_domain_data sm8150_mpss_root_pd = { + .domain = "msm/modem/root_pd", + .instance_id = 180, + .services = { + "gps/gps_service", + NULL, + }, +}; + +static const struct qcom_pdm_domain_data mpss_wlan_pd = { + .domain = "msm/modem/wlan_pd", + .instance_id = 180, + .services = { + "kernel/elf_loader", + "wlan/fw", + NULL, + }, +}; + +static const struct qcom_pdm_domain_data *msm8996_mpss_domains[] = { + &msm8996_mpss_root_pd, +}; + +static const struct qcom_pdm_domain_data *sdm660_mpss_domains[] = { + &mpss_wlan_pd, +}; + +static const struct qcom_pdm_domain_data *sdm845_mpss_domains[] = { + &mpss_root_pd, + &mpss_wlan_pd, +}; + +static const struct qcom_pdm_domain_data *sm8350_mpss_domains[] = { + &sm8150_mpss_root_pd, +}; + static const struct rproc_hexagon_res sc7180_mss = { .hexagon_mba_image = "mba.mbn", .proxy_clk_names = (char*[]){ @@ -2184,6 +2257,7 @@ static const struct rproc_hexagon_res sc7180_mss = { .has_ext_cntl_regs = false, .has_vq6 = false, .version = MSS_SC7180, + // FIXME: domains? }; static const struct rproc_hexagon_res sc7280_mss = { @@ -2212,6 +2286,8 @@ static const struct rproc_hexagon_res sc7280_mss = { .has_ext_cntl_regs = true, .has_vq6 = true, .version = MSS_SC7280, + .num_domains = ARRAY_SIZE(sm8350_mpss_domains), + .domains = sm8350_mpss_domains, }; static const struct rproc_hexagon_res sdm660_mss = { @@ -2243,6 +2319,8 @@ static const struct rproc_hexagon_res sdm660_mss = { .has_ext_cntl_regs = false, .has_vq6 = false, .version = MSS_SDM660, + .num_domains = ARRAY_SIZE(sdm660_mpss_domains), + .domains = sdm660_mpss_domains, }; static const struct rproc_hexagon_res sdm845_mss = { @@ -2278,6 +2356,8 @@ static const struct rproc_hexagon_res sdm845_mss = { .has_ext_cntl_regs = false, .has_vq6 = false, .version = MSS_SDM845, + .num_domains = ARRAY_SIZE(sdm845_mpss_domains), + .domains = sdm845_mpss_domains, }; static const struct rproc_hexagon_res msm8998_mss = { @@ -2309,6 +2389,8 @@ static const struct rproc_hexagon_res msm8998_mss = { .has_ext_cntl_regs = false, .has_vq6 = false, .version = MSS_MSM8998, + .num_domains = ARRAY_SIZE(sdm845_mpss_domains), + .domains = sdm845_mpss_domains, }; static const struct rproc_hexagon_res msm8996_mss = { @@ -2347,6 +2429,8 @@ static const struct rproc_hexagon_res msm8996_mss = { .has_ext_cntl_regs = false, .has_vq6 = false, .version = MSS_MSM8996, + .num_domains = ARRAY_SIZE(msm8996_mpss_domains), + .domains = msm8996_mpss_domains, }; static const struct rproc_hexagon_res msm8909_mss = { From patchwork Tue Dec 26 00:34:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 759143 Received: from mail-ed1-f41.google.com (mail-ed1-f41.google.com [209.85.208.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AC34A15A8 for ; Tue, 26 Dec 2023 00:34:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="yHDMz7b+" Received: by mail-ed1-f41.google.com with SMTP id 4fb4d7f45d1cf-555104e21faso424627a12.2 for ; Mon, 25 Dec 2023 16:34:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1703550892; x=1704155692; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=WZu6J97lhtg4OsgIXHw7256PW1uCOBxB+lYSwmckdnk=; b=yHDMz7b+4K6Mkj+CtCA7M2cVi0txmFAF0V/cWsoYq8KBq0DLEKtSPLDl3Vemg2LetG 941VP3/952gMaQ64K51v3WnfTyQilOdKUqc9P7yo5g6h03o0CJz669OzyYvESdO0v2MI AoEi1YrdSCMkXly6+YIxsvrcNnh1iZlLe6gJVPsCjtyaPwhtlca1aK8x6AvbFPbq03ue J55wcqYxK0NW7YOUvTQNFNM2IdGJvbEbSCvfkAUJiOtZvpqpZGRBID31yVVgL/Iq4yRY aEpQUWHfxjR/w1RF5GGU4tA2uhrWVhVwFVyNtJxHvNdfeWGOO7j6vKYfjBDYddF7sWN8 VARQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703550892; x=1704155692; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WZu6J97lhtg4OsgIXHw7256PW1uCOBxB+lYSwmckdnk=; b=o3Zu/nhYF57rkBZNrFSKltGBQm9wiLx+WBKgEAUCkGgsQV1mJ6Gzt0V3TfAsx8pblK TtGXpKlI4TCO6PnRBoZyGC6ZQa8KOAsh13g+2Rx7hfN05D3zub+Qzkr3jH8IElIoIr8f C/xvjgErgt076zdwmgYgbQEXSWdNpwfOBXxwTDBZ0n4/C3x1GTQhzzRzL4c2deqf5p/c u88P0uOZz+JpM5wbyzEkPRrnBa+JD8DRkXxVLlkykh3IIgPr7XfhwWWByDpkc6nz20MC /hRdPbJOwV91K7twIL5rdvVD0qgpS2W6GBk1MF6wOg755+3+Z+JQwxGq+g39Xj0YCq9O O14w== X-Gm-Message-State: AOJu0Yw8qTRWmj4XmvAGy0JXJlhhThM0QoCf4lWfftRoWLlm8XB6LbZq 4uc8tlcRk09r+tjbbS2E0bFdWlLQcvCnyQ== X-Google-Smtp-Source: AGHT+IEaf7erng6WHHASSYDAc++NKJWJyEXpkUSa3g/JoAV/QExg4RqdbHIbIdE+9tMs2UhESVYtWw== X-Received: by 2002:a50:8d15:0:b0:554:7470:2248 with SMTP id s21-20020a508d15000000b0055474702248mr3174542eds.41.1703550892082; Mon, 25 Dec 2023 16:34:52 -0800 (PST) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id d1-20020a05651c088100b002ccb1301d53sm1368810ljq.48.2023.12.25.16.34.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Dec 2023 16:34:51 -0800 (PST) From: Dmitry Baryshkov To: Bjorn Andersson , Konrad Dybcio , Mathieu Poirier Cc: linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org Subject: [RFC PATCH 5/5] remoteproc: qcom: pas: add configuration for in-kernel pdm Date: Tue, 26 Dec 2023 02:34:47 +0200 Message-Id: <20231226003447.3044365-6-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231226003447.3044365-1-dmitry.baryshkov@linaro.org> References: <20231226003447.3044365-1-dmitry.baryshkov@linaro.org> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add domain / service configuration for the in-kernel protection domain mapper service. Signed-off-by: Dmitry Baryshkov --- drivers/remoteproc/Kconfig | 1 + drivers/remoteproc/qcom_q6v5_pas.c | 292 ++++++++++++++++++++++++++++- 2 files changed, 287 insertions(+), 6 deletions(-) diff --git a/drivers/remoteproc/Kconfig b/drivers/remoteproc/Kconfig index 8152e845f7a3..7c6ec54c7b35 100644 --- a/drivers/remoteproc/Kconfig +++ b/drivers/remoteproc/Kconfig @@ -223,6 +223,7 @@ config QCOM_Q6V5_PAS depends on QCOM_SYSMON || QCOM_SYSMON=n depends on RPMSG_QCOM_GLINK || RPMSG_QCOM_GLINK=n depends on QCOM_AOSS_QMP || QCOM_AOSS_QMP=n + depends on QCOM_PD_MAPPER || QCOM_PD_MAPPER=n select MFD_SYSCON select QCOM_PIL_INFO select QCOM_MDT_LOADER diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q6v5_pas.c index c1f7c5ff8d93..caf2001eb532 100644 --- a/drivers/remoteproc/qcom_q6v5_pas.c +++ b/drivers/remoteproc/qcom_q6v5_pas.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -51,6 +52,9 @@ struct adsp_data { int ssctl_id; int region_assign_idx; + + size_t num_domains; + const struct qcom_pdm_domain_data * const *domains; }; struct qcom_adsp { @@ -104,6 +108,9 @@ struct qcom_adsp { struct qcom_scm_pas_metadata pas_metadata; struct qcom_scm_pas_metadata dtb_pas_metadata; + + size_t num_domains; + const struct qcom_pdm_domain_data * const *domains; }; static void adsp_segment_dump(struct rproc *rproc, struct rproc_dump_segment *segment, @@ -247,6 +254,7 @@ static int adsp_start(struct rproc *rproc) { struct qcom_adsp *adsp = rproc->priv; int ret; + int i; ret = qcom_q6v5_prepare(&adsp->q6v5); if (ret) @@ -319,8 +327,18 @@ static int adsp_start(struct rproc *rproc) /* Remove pointer to the loaded firmware, only valid in adsp_load() & adsp_start() */ adsp->firmware = NULL; + for (i = 0; i < adsp->num_domains; i++) { + ret = qcom_pdm_add_domain(adsp->domains[i]); + if (ret) + goto err_domains; + } + return 0; +err_domains: + while (--i >= 0) + qcom_pdm_del_domain(adsp->domains[i]); + release_pas_metadata: qcom_scm_pas_metadata_release(&adsp->pas_metadata); if (adsp->dtb_pas_id) @@ -364,6 +382,10 @@ static int adsp_stop(struct rproc *rproc) struct qcom_adsp *adsp = rproc->priv; int handover; int ret; + int i; + + for (i = 0; i < adsp->num_domains; i++) + qcom_pdm_del_domain(adsp->domains[i]); ret = qcom_q6v5_request_stop(&adsp->q6v5, adsp->sysmon); if (ret == -ETIMEDOUT) @@ -700,6 +722,10 @@ static int adsp_probe(struct platform_device *pdev) adsp->dtb_firmware_name = dtb_fw_name; adsp->dtb_pas_id = desc->dtb_pas_id; } + + adsp->domains = desc->domains; + adsp->num_domains = desc->num_domains; + platform_set_drvdata(pdev, adsp); ret = device_init_wakeup(adsp->dev, true); @@ -776,6 +802,123 @@ static void adsp_remove(struct platform_device *pdev) rproc_free(adsp->rproc); } +static const struct qcom_pdm_domain_data adsp_audio_pd = { + .domain = "msm/adsp/audio_pd", + .instance_id = 74, + .services = { + "avs/audio", + NULL, + }, +}; + +static const struct qcom_pdm_domain_data adsp_charger_pd = { + .domain = "msm/adsp/charger_pd", + .instance_id = 74, + .services = { NULL }, +}; + +static const struct qcom_pdm_domain_data adsp_root_pd = { + .domain = "msm/adsp/root_pd", + .instance_id = 74, + .services = { NULL }, +}; + +static const struct qcom_pdm_domain_data adsp_sensor_pd = { + .domain = "msm/adsp/sensor_pd", + .instance_id = 74, + .services = { NULL }, +}; + +static const struct qcom_pdm_domain_data msm8996_adsp_audio_pd = { + .domain = "msm/adsp/audio_pd", + .instance_id = 4, + .services = { NULL }, +}; + +static const struct qcom_pdm_domain_data msm8996_adsp_root_pd = { + .domain = "msm/adsp/root_pd", + .instance_id = 4, + .services = { NULL }, +}; + +static const struct qcom_pdm_domain_data *msm8996_adsp_domains[] = { + &msm8996_adsp_audio_pd, + &msm8996_adsp_root_pd, +}; + +static const struct qcom_pdm_domain_data *sc7280_adsp_domains[] = { + &adsp_audio_pd, + &adsp_root_pd, + &adsp_charger_pd, + &adsp_sensor_pd +}; + +static const struct qcom_pdm_domain_data *sdm845_adsp_domains[] = { + &adsp_audio_pd, + &adsp_root_pd, +}; + +static const struct qcom_pdm_domain_data *sm8350_adsp_domains[] = { + &adsp_audio_pd, + &adsp_root_pd, + &adsp_charger_pd, +}; + +static const struct qcom_pdm_domain_data cdsp_root_pd = { + .domain = "msm/cdsp/root_pd", + .instance_id = 76, + .services = { NULL }, +}; + +static const struct qcom_pdm_domain_data *sdm845_cdsp_domains[] = { + &cdsp_root_pd, +}; + +static const struct qcom_pdm_domain_data slpi_root_pd = { + .domain = "msm/slpi/root_pd", + .instance_id = 90, + .services = { NULL }, +}; + +static const struct qcom_pdm_domain_data slpi_sensor_pd = { + .domain = "msm/slpi/sensor_pd", + .instance_id = 90, + .services = { NULL }, +}; + +static const struct qcom_pdm_domain_data *sdm845_slpi_domains[] = { + &slpi_root_pd, + &slpi_sensor_pd, +}; + +static const struct qcom_pdm_domain_data sm8150_mpss_root_pd = { + .domain = "msm/modem/root_pd", + .instance_id = 180, + .services = { + "gps/gps_service", + NULL, + }, +}; + +static const struct qcom_pdm_domain_data mpss_wlan_pd = { + .domain = "msm/modem/wlan_pd", + .instance_id = 180, + .services = { + "kernel/elf_loader", + "wlan/fw", + NULL, + }, +}; + +static const struct qcom_pdm_domain_data *sm8150_mpss_domains[] = { + &sm8150_mpss_root_pd, + &mpss_wlan_pd, +}; + +static const struct qcom_pdm_domain_data *sm8350_mpss_domains[] = { + &sm8150_mpss_root_pd, +}; + static const struct adsp_data adsp_resource_init = { .crash_reason_smem = 423, .firmware_name = "adsp.mdt", @@ -784,6 +927,25 @@ static const struct adsp_data adsp_resource_init = { .ssr_name = "lpass", .sysmon_name = "adsp", .ssctl_id = 0x14, + /* no domains */ +}; + +static const struct adsp_data sc7280_adsp_resource = { + .crash_reason_smem = 423, + .firmware_name = "adsp.mdt", + .pas_id = 1, + .auto_boot = true, + .proxy_pd_names = (char*[]){ + "lcx", + "lmx", + NULL + }, + .load_state = "adsp", + .ssr_name = "lpass", + .sysmon_name = "adsp", + .ssctl_id = 0x14, + .num_domains = ARRAY_SIZE(sc7280_adsp_domains), + .domains = sc7280_adsp_domains, }; static const struct adsp_data sdm845_adsp_resource_init = { @@ -795,6 +957,20 @@ static const struct adsp_data sdm845_adsp_resource_init = { .ssr_name = "lpass", .sysmon_name = "adsp", .ssctl_id = 0x14, + .num_domains = ARRAY_SIZE(sdm845_adsp_domains), + .domains = sdm845_adsp_domains, +}; + +static const struct adsp_data sm6115_adsp_resource_init = { + .crash_reason_smem = 423, + .firmware_name = "adsp.mdt", + .pas_id = 1, + .auto_boot = true, + .ssr_name = "lpass", + .sysmon_name = "adsp", + .ssctl_id = 0x14, + .num_domains = ARRAY_SIZE(sdm845_adsp_domains), + .domains = sdm845_adsp_domains, }; static const struct adsp_data sm6350_adsp_resource = { @@ -811,6 +987,7 @@ static const struct adsp_data sm6350_adsp_resource = { .ssr_name = "lpass", .sysmon_name = "adsp", .ssctl_id = 0x14, + // TODO: domains }; static const struct adsp_data sm6375_mpss_resource = { @@ -826,6 +1003,7 @@ static const struct adsp_data sm6375_mpss_resource = { .ssr_name = "mpss", .sysmon_name = "modem", .ssctl_id = 0x12, + // TODO: domains }; static const struct adsp_data sm8150_adsp_resource = { @@ -841,6 +1019,8 @@ static const struct adsp_data sm8150_adsp_resource = { .ssr_name = "lpass", .sysmon_name = "adsp", .ssctl_id = 0x14, + .num_domains = ARRAY_SIZE(sdm845_adsp_domains), + .domains = sdm845_adsp_domains, }; static const struct adsp_data sm8250_adsp_resource = { @@ -857,6 +1037,8 @@ static const struct adsp_data sm8250_adsp_resource = { .ssr_name = "lpass", .sysmon_name = "adsp", .ssctl_id = 0x14, + .num_domains = ARRAY_SIZE(sdm845_adsp_domains), + .domains = sdm845_adsp_domains, }; static const struct adsp_data sm8350_adsp_resource = { @@ -889,6 +1071,8 @@ static const struct adsp_data msm8996_adsp_resource = { .ssr_name = "lpass", .sysmon_name = "adsp", .ssctl_id = 0x14, + .num_domains = ARRAY_SIZE(msm8996_adsp_domains), + .domains = msm8996_adsp_domains, }; static const struct adsp_data cdsp_resource_init = { @@ -899,6 +1083,7 @@ static const struct adsp_data cdsp_resource_init = { .ssr_name = "cdsp", .sysmon_name = "cdsp", .ssctl_id = 0x17, + /* no domains */ }; static const struct adsp_data sdm845_cdsp_resource_init = { @@ -910,6 +1095,20 @@ static const struct adsp_data sdm845_cdsp_resource_init = { .ssr_name = "cdsp", .sysmon_name = "cdsp", .ssctl_id = 0x17, + .num_domains = ARRAY_SIZE(sdm845_cdsp_domains), + .domains = sdm845_cdsp_domains, +}; + +static const struct adsp_data sm6115_cdsp_resource_init = { + .crash_reason_smem = 601, + .firmware_name = "cdsp.mdt", + .pas_id = 18, + .auto_boot = true, + .ssr_name = "cdsp", + .sysmon_name = "cdsp", + .ssctl_id = 0x17, + .num_domains = ARRAY_SIZE(sdm845_cdsp_domains), + .domains = sdm845_cdsp_domains, }; static const struct adsp_data sm6350_cdsp_resource = { @@ -941,6 +1140,8 @@ static const struct adsp_data sm8150_cdsp_resource = { .ssr_name = "cdsp", .sysmon_name = "cdsp", .ssctl_id = 0x17, + .num_domains = ARRAY_SIZE(sdm845_cdsp_domains), + .domains = sdm845_cdsp_domains, }; static const struct adsp_data sm8250_cdsp_resource = { @@ -956,6 +1157,8 @@ static const struct adsp_data sm8250_cdsp_resource = { .ssr_name = "cdsp", .sysmon_name = "cdsp", .ssctl_id = 0x17, + .num_domains = ARRAY_SIZE(sdm845_cdsp_domains), + .domains = sdm845_cdsp_domains, }; static const struct adsp_data sc8280xp_nsp0_resource = { @@ -970,6 +1173,8 @@ static const struct adsp_data sc8280xp_nsp0_resource = { .ssr_name = "cdsp0", .sysmon_name = "cdsp", .ssctl_id = 0x17, + .num_domains = ARRAY_SIZE(sdm845_cdsp_domains), + .domains = sdm845_cdsp_domains, }; static const struct adsp_data sc8280xp_nsp1_resource = { @@ -1000,6 +1205,8 @@ static const struct adsp_data sm8350_cdsp_resource = { .ssr_name = "cdsp", .sysmon_name = "cdsp", .ssctl_id = 0x17, + .num_domains = ARRAY_SIZE(sdm845_cdsp_domains), + .domains = sdm845_cdsp_domains, }; static const struct adsp_data mpss_resource_init = { @@ -1017,6 +1224,26 @@ static const struct adsp_data mpss_resource_init = { .ssr_name = "mpss", .sysmon_name = "modem", .ssctl_id = 0x12, + /* no domains */ +}; + +static const struct adsp_data sc7280_mpss_resource_init = { + .crash_reason_smem = 421, + .firmware_name = "modem.mdt", + .pas_id = 4, + .minidump_id = 3, + .auto_boot = false, + .proxy_pd_names = (char*[]){ + "cx", + "mss", + NULL + }, + .load_state = "modem", + .ssr_name = "mpss", + .sysmon_name = "modem", + .ssctl_id = 0x12, + .num_domains = ARRAY_SIZE(sm8350_mpss_domains), + .domains = sm8350_mpss_domains, }; static const struct adsp_data sc8180x_mpss_resource = { @@ -1032,6 +1259,46 @@ static const struct adsp_data sc8180x_mpss_resource = { .ssr_name = "mpss", .sysmon_name = "modem", .ssctl_id = 0x12, + .num_domains = ARRAY_SIZE(sm8150_mpss_domains), + .domains = sm8150_mpss_domains, +}; + +static const struct adsp_data sm8150_mpss_resource = { + .crash_reason_smem = 421, + .firmware_name = "modem.mdt", + .pas_id = 4, + .minidump_id = 3, + .auto_boot = false, + .proxy_pd_names = (char*[]){ + "cx", + "mss", + NULL + }, + .load_state = "modem", + .ssr_name = "mpss", + .sysmon_name = "modem", + .ssctl_id = 0x12, + .num_domains = ARRAY_SIZE(sm8150_mpss_domains), + .domains = sm8150_mpss_domains, +}; + +static const struct adsp_data sm8350_mpss_resource_init = { + .crash_reason_smem = 421, + .firmware_name = "modem.mdt", + .pas_id = 4, + .minidump_id = 3, + .auto_boot = false, + .proxy_pd_names = (char*[]){ + "cx", + "mss", + NULL + }, + .load_state = "modem", + .ssr_name = "mpss", + .sysmon_name = "modem", + .ssctl_id = 0x12, + .num_domains = ARRAY_SIZE(sm8350_mpss_domains), + .domains = sm8350_mpss_domains, }; static const struct adsp_data msm8996_slpi_resource_init = { @@ -1046,6 +1313,7 @@ static const struct adsp_data msm8996_slpi_resource_init = { .ssr_name = "dsps", .sysmon_name = "slpi", .ssctl_id = 0x16, + /* no domains */ }; static const struct adsp_data sdm845_slpi_resource_init = { @@ -1062,6 +1330,8 @@ static const struct adsp_data sdm845_slpi_resource_init = { .ssr_name = "dsps", .sysmon_name = "slpi", .ssctl_id = 0x16, + .num_domains = ARRAY_SIZE(sdm845_slpi_domains), + .domains = sdm845_slpi_domains, }; static const struct adsp_data wcss_resource_init = { @@ -1105,6 +1375,8 @@ static const struct adsp_data sm8450_mpss_resource = { .ssr_name = "mpss", .sysmon_name = "modem", .ssctl_id = 0x12, + .num_domains = ARRAY_SIZE(sm8350_mpss_domains), + .domains = sm8350_mpss_domains, }; static const struct adsp_data sm8550_adsp_resource = { @@ -1124,6 +1396,8 @@ static const struct adsp_data sm8550_adsp_resource = { .ssr_name = "lpass", .sysmon_name = "adsp", .ssctl_id = 0x14, + .num_domains = ARRAY_SIZE(sm8350_adsp_domains), + .domains = sm8350_adsp_domains, }; static const struct adsp_data sm8550_cdsp_resource = { @@ -1144,6 +1418,8 @@ static const struct adsp_data sm8550_cdsp_resource = { .ssr_name = "cdsp", .sysmon_name = "cdsp", .ssctl_id = 0x17, + .num_domains = ARRAY_SIZE(sdm845_cdsp_domains), + .domains = sdm845_cdsp_domains, }; static const struct adsp_data sm8550_mpss_resource = { @@ -1165,6 +1441,8 @@ static const struct adsp_data sm8550_mpss_resource = { .sysmon_name = "modem", .ssctl_id = 0x12, .region_assign_idx = 2, + .num_domains = ARRAY_SIZE(sm8350_mpss_domains), + .domains = sm8350_mpss_domains, }; static const struct adsp_data sc7280_wpss_resource = { @@ -1185,6 +1463,7 @@ static const struct adsp_data sc7280_wpss_resource = { static const struct of_device_id adsp_of_match[] = { { .compatible = "qcom,msm8226-adsp-pil", .data = &adsp_resource_init}, + // FIXME: is msm8996 adsp audio domain applicable to msm8953 ? { .compatible = "qcom,msm8953-adsp-pil", .data = &msm8996_adsp_resource}, { .compatible = "qcom,msm8974-adsp-pil", .data = &adsp_resource_init}, { .compatible = "qcom,msm8996-adsp-pil", .data = &msm8996_adsp_resource}, @@ -1194,11 +1473,12 @@ static const struct of_device_id adsp_of_match[] = { { .compatible = "qcom,qcs404-adsp-pas", .data = &adsp_resource_init }, { .compatible = "qcom,qcs404-cdsp-pas", .data = &cdsp_resource_init }, { .compatible = "qcom,qcs404-wcss-pas", .data = &wcss_resource_init }, + // FIXME: is adsp audio domain applicable to sc7180 ? { .compatible = "qcom,sc7180-adsp-pas", .data = &sm8250_adsp_resource}, { .compatible = "qcom,sc7180-mpss-pas", .data = &mpss_resource_init}, - { .compatible = "qcom,sc7280-adsp-pas", .data = &sm8350_adsp_resource}, + { .compatible = "qcom,sc7280-adsp-pas", .data = &sc7280_adsp_resource}, { .compatible = "qcom,sc7280-cdsp-pas", .data = &sm6350_cdsp_resource}, - { .compatible = "qcom,sc7280-mpss-pas", .data = &mpss_resource_init}, + { .compatible = "qcom,sc7280-mpss-pas", .data = &sc7280_mpss_resource_init}, { .compatible = "qcom,sc7280-wpss-pas", .data = &sc7280_wpss_resource}, { .compatible = "qcom,sc8180x-adsp-pas", .data = &sm8150_adsp_resource}, { .compatible = "qcom,sc8180x-cdsp-pas", .data = &sm8150_cdsp_resource}, @@ -1211,8 +1491,8 @@ static const struct of_device_id adsp_of_match[] = { { .compatible = "qcom,sdm845-cdsp-pas", .data = &sdm845_cdsp_resource_init}, { .compatible = "qcom,sdm845-slpi-pas", .data = &sdm845_slpi_resource_init}, { .compatible = "qcom,sdx55-mpss-pas", .data = &sdx55_mpss_resource}, - { .compatible = "qcom,sm6115-adsp-pas", .data = &adsp_resource_init}, - { .compatible = "qcom,sm6115-cdsp-pas", .data = &cdsp_resource_init}, + { .compatible = "qcom,sm6115-adsp-pas", .data = &sm6115_adsp_resource_init}, + { .compatible = "qcom,sm6115-cdsp-pas", .data = &sm6115_cdsp_resource_init}, { .compatible = "qcom,sm6115-mpss-pas", .data = &sc8180x_mpss_resource}, { .compatible = "qcom,sm6350-adsp-pas", .data = &sm6350_adsp_resource}, { .compatible = "qcom,sm6350-cdsp-pas", .data = &sm6350_cdsp_resource}, @@ -1222,7 +1502,7 @@ static const struct of_device_id adsp_of_match[] = { { .compatible = "qcom,sm6375-mpss-pas", .data = &sm6375_mpss_resource}, { .compatible = "qcom,sm8150-adsp-pas", .data = &sm8150_adsp_resource}, { .compatible = "qcom,sm8150-cdsp-pas", .data = &sm8150_cdsp_resource}, - { .compatible = "qcom,sm8150-mpss-pas", .data = &mpss_resource_init}, + { .compatible = "qcom,sm8150-mpss-pas", .data = &sm8150_mpss_resource}, { .compatible = "qcom,sm8150-slpi-pas", .data = &sdm845_slpi_resource_init}, { .compatible = "qcom,sm8250-adsp-pas", .data = &sm8250_adsp_resource}, { .compatible = "qcom,sm8250-cdsp-pas", .data = &sm8250_cdsp_resource}, @@ -1230,7 +1510,7 @@ static const struct of_device_id adsp_of_match[] = { { .compatible = "qcom,sm8350-adsp-pas", .data = &sm8350_adsp_resource}, { .compatible = "qcom,sm8350-cdsp-pas", .data = &sm8350_cdsp_resource}, { .compatible = "qcom,sm8350-slpi-pas", .data = &sdm845_slpi_resource_init}, - { .compatible = "qcom,sm8350-mpss-pas", .data = &mpss_resource_init}, + { .compatible = "qcom,sm8350-mpss-pas", .data = &sm8350_mpss_resource_init}, { .compatible = "qcom,sm8450-adsp-pas", .data = &sm8350_adsp_resource}, { .compatible = "qcom,sm8450-cdsp-pas", .data = &sm8350_cdsp_resource}, { .compatible = "qcom,sm8450-slpi-pas", .data = &sdm845_slpi_resource_init},