From patchwork Thu Feb 29 23:00:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 777156 Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) (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 40B9355E76 for ; Thu, 29 Feb 2024 23:00:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709247638; cv=none; b=H5UjVq49gUgLD5oVAOf+uigIAIm2Iqc4tuGjob0Y7qzZUCH9kJqVfK3kFKd2+gbcRHSpjjMaCv+p66tIjF1zxY7lADRBZz0Fo5DNbtbuAc8iqyjdaGWxH9zd/yoCtvQTFZ10HG1AFRweLQcRGHr7KY6tzCHlxQrbG6nuZwKc6e0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709247638; c=relaxed/simple; bh=K9GqjLgfHTc/8Gz1gmevD5qMTp6Gdlgrodn4O4bzT2M=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=nqECtRZnLrQr3VY3GUItJHZ5ui6Y/KPzHp7sQYKpNiHvhYe024coBhPQF0lu/mo33Mk/X5A5u6LFecQgnhQVw9etyU0Vwb7IMwWsYM5tb87U4UwPQQfOK80ZRNOYn/d5l6YFAdmGFBUtushUQCbo653MxjnO7i8TgLJ3lQEalL0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=wvCHKGA3; arc=none smtp.client-ip=209.85.167.51 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="wvCHKGA3" Received: by mail-lf1-f51.google.com with SMTP id 2adb3069b0e04-5132010e5d1so1614176e87.0 for ; Thu, 29 Feb 2024 15:00:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709247633; x=1709852433; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=OLlLOWtKYCQ8vFCgCtt04gVg5nVyM6OXeIhWsb/9Kd8=; b=wvCHKGA3FDGDvZ0fGNm6uHluwlOdtqG7MPWludIBUvrX5NJdXVs3MDET3OufWKZdsM sqKVs+bp454a2vBqvUhtTGbuPdlmi7vW7JLCR05HM8NgPsAvRi4M+MgzpJg8DSVeglQ1 xSQ22n9LaW9NZJRDsROrKYBIcMmiSeJlTXWXTdnnE89fndZgjROHCiSg7XQcAArvnrxd 4P0g/poyHXM48mcXJWLw3cMl5ViDf3dcx5UJtkmmeadOhVePCo39fXofXdUdIVBmZPtk Re5TxzNl1o2XZI4TdRZK0c3NJWiZEnZNusvQloNYPI1ZoDGTIqvpcTAj4HDboQlGk/G0 N7rA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709247633; x=1709852433; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OLlLOWtKYCQ8vFCgCtt04gVg5nVyM6OXeIhWsb/9Kd8=; b=svAjc1Q6Xkbv0DmeAy0gDJ7PyOIa0KDR9O8KIwxIzp6Y0WcKfZCb/3ljkXbtYkOrSj a9wmSr5KBu0uHWJI6AF/G4QsBIAnveEeN4fT0x0e/bj7YF1egaEpXPmRaDFoVvhDsNVy xBSRUvf84yCzuV+fPfHWFDASOG++Yzn4wMbxsyHG7MrdvP3Lf5L2DFp7f1Egp3CY8d6N GSqJ/WuneoLu3zt9DJfxCPSVvAfVTF1LR8XtaV0sw2fhOe7s8GgkvQwJscUAgK0cpY85 K3bUeTSevDNClMd5RneMw0vln2FGFvjryMaJW12R+T+Lk7S+1AMozWOLfrriG3vgAMJ8 Se1Q== X-Gm-Message-State: AOJu0Yzf8EpXsHjaO3Bl8M17IgW8G8vaAuafjmcwzZ2PIHydd2kFmmDm cjVUcbs8paydkDzutcJRMihDeNzkLlOixx04e8Og3jROXxESITyMPOD3wLmaLAU9uOSKDNH494j Go/c= X-Google-Smtp-Source: AGHT+IFFZqwnAbXWxgkC3HNTWGD+k9a1uuPOBlm/JlAi58dcEcDQRlnFJKceG6Jq1dbZc/qf3jHsNw== X-Received: by 2002:a05:6512:716:b0:513:1385:c943 with SMTP id b22-20020a056512071600b005131385c943mr8178lfs.40.1709247633018; Thu, 29 Feb 2024 15:00:33 -0800 (PST) Received: from umbar.lan (dzyjmhybhls-s--zn36gy-3.rev.dnainternet.fi. [2001:14ba:a00e:a300:264b:feff:fe8b:be8a]) by smtp.gmail.com with ESMTPSA id s26-20020a19771a000000b00512ed2cf297sm408455lfc.151.2024.02.29.15.00.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 15:00:32 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 01 Mar 2024 01:00:27 +0200 Subject: [PATCH RFC v2 1/5] soc: qcom: add pd-mapper implementation Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240301-qcom-pd-mapper-v2-1-5d12a081d9d1@linaro.org> References: <20240301-qcom-pd-mapper-v2-0-5d12a081d9d1@linaro.org> In-Reply-To: <20240301-qcom-pd-mapper-v2-0-5d12a081d9d1@linaro.org> To: Bjorn Andersson , Konrad Dybcio , Mathieu Poirier Cc: linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=18092; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=K9GqjLgfHTc/8Gz1gmevD5qMTp6Gdlgrodn4O4bzT2M=; b=owGbwMvMwMXYbdNlx6SpcZXxtFoSQ+pDnj7vefUG/74vE8+ZEdgZa3LOKqH1i9A1pk7RRTF+m /WZKl07GY1ZGBi5GGTFFFl8ClqmxmxKDvuwY2o9zCBWJpApDFycAjCRthr2f6Zs1gc7v/I7/ndT CFk+j7/3zyz5+O6NNlmXviyt4bBLSq3bVsb+8P0f68tbtrHLKcs9FLhb39g6uVnIyOBWZqF8Q8/ SSDZRnubX26140h6J/Kkyzq9QSmxTF3sqvWB5TGVRfNKbeuf2mdzvZbe4vRQ6w1mZIcQuseJygU O/wxO2hKiydM8JG7hmqx+fJqHa7VM9z1T6ScqvKe9Dbv//3MOt1vlllSuDaJSZS4NqdcapFTI1z sZbZu56U9t0fYXpBYbbt+acWnHKZnV8HP+O0oQ/W7genV5qX3lW4pbr3P9yJfdv3+9zOmgbqSL+ Mu60uPVcz4408+lSLz8u7p3hO1O49VQyz2LG1P0PjkoDAA== X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A Existing userspace protection domain mapper implementation has several issue. It doesn't play well with CONFIG_EXTRA_FIRMWARE, it doesn't reread JSON files if firmware location is changed (or if 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 | 300 +++++++++++++++++++++++++++++++++++++ drivers/soc/qcom/qcom_pdm_msg.c | 188 +++++++++++++++++++++++ drivers/soc/qcom/qcom_pdm_msg.h | 66 ++++++++ include/linux/soc/qcom/pd_mapper.h | 35 +++++ 6 files changed, 601 insertions(+) diff --git a/drivers/soc/qcom/Kconfig b/drivers/soc/qcom/Kconfig index 5af33b0e3470..f236ce376c1b 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 ca0bece0dfff..65e33b5a2231 100644 --- a/drivers/soc/qcom/Makefile +++ b/drivers/soc/qcom/Makefile @@ -7,6 +7,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..93c625364a1e --- /dev/null +++ b/drivers/soc/qcom/qcom_pdm.c @@ -0,0 +1,300 @@ +// 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 bool qcom_pdm_server_added; +static struct qmi_handle qcom_pdm_handle; + +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_tail(&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; + } + + /* + * Notify only after registering first domain. + */ + if (!qcom_pdm_server_added) { + ret = qmi_add_server(&qcom_pdm_handle, SERVREG_QMI_SERVICE, + SERVREG_QMI_VERSION, SERVREG_QMI_INSTANCE); + if (ret) + goto err; + + qcom_pdm_server_added = true; + } + + mutex_unlock(&qcom_pdm_mutex); + + return ret; + +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 = true; + 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 = true; + 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++; + + strscpy(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 int qcom_pdm_init(void) +{ + return qmi_handle_init(&qcom_pdm_handle, 1024, + NULL, qcom_pdm_msg_handlers); +} + +static void qcom_pdm_exit(void) +{ + qmi_handle_release(&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..6f858df8f3dc --- /dev/null +++ b/drivers/soc/qcom/qcom_pdm_msg.c @@ -0,0 +1,188 @@ +// 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 Thu Feb 29 23:00:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 776912 Received: from mail-lj1-f170.google.com (mail-lj1-f170.google.com [209.85.208.170]) (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 988E65B1E4 for ; Thu, 29 Feb 2024 23:00:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709247638; cv=none; b=jUZm8xGRFsP9hxJ071FrNd/O00PdaO81w8j/Jnq2dRX3FooermifBymvlSjxySUF1cP/OWVWHjUcll6qNBmuUSLMGAfL/i7WWTE7NR/crDhWVxBJamtwcf542mucFr0bsaeNTl0yFa6679pnySdgbEzC/CMgWrRYEGEiG2zFOBs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709247638; c=relaxed/simple; bh=XYGX+zF3BNyZlfkUIRLibz5N2K9RVk8uHgn6Fgxn7YA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=gdC5N6ra5lAwGHlaySdpt5ZeciXKvjpue5TNS2N3ZonM/dVj6FUiYW+ccbLEQTRjf+61ZwCu/vIF2DYYyCyNkBDsAtA3DEFmsT+SK6lWPJi6CdVegkfQO23cZnnotvcIPANj7ayQgy0bGz4TKcfp9tYcs8KyPPOM+5Y/bO9No4c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=OEX1iX/O; arc=none smtp.client-ip=209.85.208.170 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="OEX1iX/O" Received: by mail-lj1-f170.google.com with SMTP id 38308e7fff4ca-2d109e82bd0so16411001fa.3 for ; Thu, 29 Feb 2024 15:00:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709247634; x=1709852434; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=4FHv5TL8WSnGkR0H4zIeY6ZYWrWfrxNh0+ekkxXEzqk=; b=OEX1iX/Ou3OgpmvMLeMCXs/1DqXoHH0qkRDFUFPVzGa9b+b0oIDkHgDoQRBj+6jM8F vDK15J1J/1YyHVLzy8ilGoU0F9bP7YPelpBu+Ghi5IU5CFZr1yOJSDkzk93yCUu9nasN TcTIOO45Pz2LRSuhi2rUCvFhn3Z8HsBZE+uvrV3FvutwqOxAsuOHB1QsrUz96ohudHbs DySI7BMC9nraci4ro4O5RMaTKxbKM6ZPEIp+rTj98MrsUbvKVpubah6vW9O6EQ/HYPfL QYt5S3G69VVo/eh7EuWCM83uwq+MGkMRtwDCN6A5MB9q6o7Bb4b1sS6sT9ohiNGUO2tC RZBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709247634; x=1709852434; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4FHv5TL8WSnGkR0H4zIeY6ZYWrWfrxNh0+ekkxXEzqk=; b=bBAeR8bXA9uvQCVyKNt6iJIrXuJUj5miKwuE15lIIDZbkb7yHfoYed+5BsBZw4eFRe /zYMwG/Ub9Y1b/KRwSJgzh7c8dcj/FkXlXxiMCPNK402yZ8tkHt+arRkblA9zjefvpJz tjrzW+UJAaEsB7EfLKKa/sTzk1XbQJrExHx+avzGDM2gDKG4vfknK7mFCXW1+tzQIO85 PL3GpiMOT0IsHIdUVDlzXVoasG/gS6rSJjCwOiHc/a7KbUG1EK6oLW8SxT9myrtd0JY1 gujR5u6YOPz6IXHCCtWCXdcPGCc4Fj0YwhaHyK7ahGGIgTYLikfJcfdxl1SwZuKh+Psj QEsQ== X-Gm-Message-State: AOJu0Yzl6u+aOmqXg2FFkmiBV0iV9PfsvxGRCBu1ffwk47KQVvk8PCQZ a4gkcRs+U3Tw1UnabQoF4jACwQGGsuLYW7edQ/O8VeG/CIE3czDvEyC8tcQY0xY= X-Google-Smtp-Source: AGHT+IFwgM3uP4QjuvyiZZus3LfbyhwT03NnwQtcVjUP3Ho2AlAIHvTfLGrJFPArxjKlgNPpGqw5xQ== X-Received: by 2002:a19:5f19:0:b0:513:2999:5ef3 with SMTP id t25-20020a195f19000000b0051329995ef3mr14852lfb.7.1709247633894; Thu, 29 Feb 2024 15:00:33 -0800 (PST) Received: from umbar.lan (dzyjmhybhls-s--zn36gy-3.rev.dnainternet.fi. [2001:14ba:a00e:a300:264b:feff:fe8b:be8a]) by smtp.gmail.com with ESMTPSA id s26-20020a19771a000000b00512ed2cf297sm408455lfc.151.2024.02.29.15.00.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 15:00:33 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 01 Mar 2024 01:00:28 +0200 Subject: [PATCH RFC v2 2/5] remoteproc: qcom: pas: correct data indentation Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240301-qcom-pd-mapper-v2-2-5d12a081d9d1@linaro.org> References: <20240301-qcom-pd-mapper-v2-0-5d12a081d9d1@linaro.org> In-Reply-To: <20240301-qcom-pd-mapper-v2-0-5d12a081d9d1@linaro.org> To: Bjorn Andersson , Konrad Dybcio , Mathieu Poirier Cc: linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=4415; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=XYGX+zF3BNyZlfkUIRLibz5N2K9RVk8uHgn6Fgxn7YA=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBl4QyOLW/aCpp6W6/Plm3+/Hv0SVOwd03ztXN0a mhtvXFSBAeJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZeEMjgAKCRCLPIo+Aiko 1aPOCACUt763i6HGMFyRy2V7JylBhRBSrRrsa7DRBdm77IW7+h3NQg54u7KV90hFmlsLU/uh574 7yyXAdkysQR7K/PQPjHEBsqVyh2qG4KqnZVCfHpEDEmaw8a9sE5AfnoTw5IA8q/8eYUsg3HF/95 kJjs/1MNncTdQWgCf7NY9LOUI9ImUZ/mjEpTdMszM18L4d+NwJcyntOrM2e9MhrB1XVGP0ZrqK9 AKj3lt0+7QHkqFS+ilFHjjhMZMe7ujt4S9SA6sVJLpXrrcqfM2ACCXUubJXMX3Hb+Ts9qoD6sf5 uJHbQ1M5QOHI+MssprPH1FCgqR26GHjzAfgMTLaEdcNXhKau X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A 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 d0b1f0f38347..3e34b9ff38ae 100644 --- a/drivers/remoteproc/qcom_q6v5_pas.c +++ b/drivers/remoteproc/qcom_q6v5_pas.c @@ -807,24 +807,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 = { @@ -859,18 +859,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 = { @@ -903,20 +903,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 = { @@ -1063,33 +1065,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 Thu Feb 29 23:00:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 777155 Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com [209.85.167.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 762157D062 for ; Thu, 29 Feb 2024 23:00:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709247638; cv=none; b=H5w9I3oWxiRZ0/nKfTIO2JLoyNCIX3+cEGOzISrkFL1lu4yAONfk21eN/3JzQdgsdHfJbXtFoJf65N29ZeC5nlPcVRw7weuXuzVxnmL0tB8ojcHM+g8IABD0Uoj+J+43IZ6FC9zIQY0zvE42Llja3cXxjBNpbGGbTsyy/GgJaak= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709247638; c=relaxed/simple; bh=VnOQriAw1Coa17S6UV6rmzyCaY+V1h+WcK+1P24ob6M=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=W4QZy0+Y/XxgSncge/tgf5xIdKiIUbMXSwZHg4Dr98ZvKL376lE3NoK8BmmaX3MNIf66K1qgG2yFWbeFuPgAudMZflb5PMPCzbxjcBJPc79HYXCzdoK0Vo9lwqQR6pgF2QAfw5wTGmIwW6p6is+UK4nL6Lj5HpKNCxMaj0OYKxA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=sBg5RXHy; arc=none smtp.client-ip=209.85.167.41 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="sBg5RXHy" Received: by mail-lf1-f41.google.com with SMTP id 2adb3069b0e04-51320ca689aso1709353e87.2 for ; Thu, 29 Feb 2024 15:00:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709247634; x=1709852434; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=yPcglPDpZKXCiMnjfqODdkc+dlLyv+wBuIOF4S4IqvQ=; b=sBg5RXHy8tw6sIBxFy6Gx11gnvdRGhhW/UY9zp61RWchjLi5TM5zUxTAeC6BndfA6n gOSAh5M0sc0xAofPZBl5IAT9jK7fhVyDkwT+5jXD9QjvB4cBU+SZ0xGbfZgivontXw0S w9qRK/+bTpql4Pc9YBt5U2TQM2JEqPW2ibKGGXQatcgZNaYy4m8Tark+tb9WPFCAs/Or 1hJc6TQ4JFj1gQcJsxWum+LZKuESLVjyUIt5RwQ6pzxomN5JW5a9jdNTOOFKgUdqd/Kt V+Z8vsgppgDBlKdBGCgT4Rj2rMv4O/gUKoxUSj/TWDbCvRRBViteJbDYGmkVnWN9otbW pyJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709247634; x=1709852434; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=yPcglPDpZKXCiMnjfqODdkc+dlLyv+wBuIOF4S4IqvQ=; b=NmSenIJVLJEc8eJvb4CuY6FHZbOOe4/Z/qc54G1lZ6Rly2DG+QyoywVu4cJU0Vi5Jr oaPzOlesU4SAA4ytlLQafvF4vkGarvN3KO1RIll0nejXu4RvWqD2OPmortv/QgR9HB/L WGXR69zInEkK6agbIKAxITOAGKYgGB2KjKuqNgpWsq3CgqHjxI1HvxLoLmuCNNFwVASj Uu7xrAcRczCA9iOpO28xS7MTNL9/U3mZ4BXnRj2OErTGqWH7eIHRLEx24HnabfXGH4/U BD6uovx+6XAg4MSqPxELCsYqPTWivymYyQeIqaA470CG4+RtFx/o30BggEZhz9spG7Ru 3Z2g== X-Gm-Message-State: AOJu0YwJL95jGTZSVYNujdizgGSxIHDMGc3T/sqI9S0F3J5lI8LmTMXJ mAM2PRFozUuiavoeMyvE4u16hVb6kJfYxw3nc4PR2G5skrk1Yr4GMd/cnPCt9oLK0kDvI6zpS2w NsO8= X-Google-Smtp-Source: AGHT+IGfPE3/Fweuarn55mKHjbvWF3M8lWjKqoI2isLfB5oU4ZXd1f3xR4iuLvkijI2P4eQEqAF+xw== X-Received: by 2002:a19:e016:0:b0:513:17ea:e490 with SMTP id x22-20020a19e016000000b0051317eae490mr2456450lfg.61.1709247634708; Thu, 29 Feb 2024 15:00:34 -0800 (PST) Received: from umbar.lan (dzyjmhybhls-s--zn36gy-3.rev.dnainternet.fi. [2001:14ba:a00e:a300:264b:feff:fe8b:be8a]) by smtp.gmail.com with ESMTPSA id s26-20020a19771a000000b00512ed2cf297sm408455lfc.151.2024.02.29.15.00.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 15:00:34 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 01 Mar 2024 01:00:29 +0200 Subject: [PATCH RFC v2 3/5] remoteproc: qcom: adsp: add configuration for in-kernel pdm Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240301-qcom-pd-mapper-v2-3-5d12a081d9d1@linaro.org> References: <20240301-qcom-pd-mapper-v2-0-5d12a081d9d1@linaro.org> In-Reply-To: <20240301-qcom-pd-mapper-v2-0-5d12a081d9d1@linaro.org> To: Bjorn Andersson , Konrad Dybcio , Mathieu Poirier Cc: linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=6236; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=VnOQriAw1Coa17S6UV6rmzyCaY+V1h+WcK+1P24ob6M=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBl4QyOSMUnoXjUTlQdp7XK8lQoK7qX2APAGW7o+ dW37Ra3W7iJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZeEMjgAKCRCLPIo+Aiko 1YecCACwxfTwPg58SmDNo9AXjzhY7cv6NnspwkBhGKBLKCUepA8Qk1eeOcQECcTN20Arkq0UDYN PVUIvy/3U90Z5G8QX8UGwnBUVoV4I3I8t0TL26RFbBVPhmjBjaJ3U5fndcayD+wo/dMCNiuaFQW 8T0VMx2XZ6ikEvBniyUobSH8rvX9ovxB75W4GoRwIqkvCU00hpeMU939dfRWd/E+DPx40EG9E+t wGe2ywYbhQNSiPsFSjqJR8t1dJiK0O4ZODT5N9NDuxTFNXPQBvrtbWm8SWdnHFnvTMmb3YjIeUP nMlutAbZlNBIcx4j+UxzkeiCS030lrEGVRxG7rFoKouPZMWY X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A 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 | 87 +++++++++++++++++++++++++++++++++++-- 2 files changed, 84 insertions(+), 4 deletions(-) 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 93f9a1537ec6..5751bcb0c285 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 @@ -75,6 +76,9 @@ struct adsp_pil_data { const char **pd_names; unsigned int num_pds; const char *load_state; + + const struct qcom_pdm_domain_data * const *domains; + size_t num_domains; }; struct qcom_adsp { @@ -116,6 +120,9 @@ struct qcom_adsp { struct qcom_sysmon *sysmon; int (*shutdown)(struct qcom_adsp *adsp); + + const struct qcom_pdm_domain_data * const *domains; + size_t num_domains; }; static int qcom_rproc_pds_attach(struct qcom_adsp *adsp, const char **pd_names, @@ -374,6 +381,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) @@ -434,8 +442,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: @@ -463,6 +481,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) @@ -690,6 +712,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->domains = desc->domains; + adsp->num_domains = desc->num_domains; platform_set_drvdata(pdev, adsp); @@ -764,7 +788,56 @@ static void adsp_remove(struct platform_device *pdev) rproc_free(adsp->rproc); } -static const struct adsp_pil_data adsp_resource_init = { +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 cdsp_root_pd = { + .domain = "msm/cdsp/root_pd", + .instance_id = 76, + .services = { NULL }, +}; + +static const struct qcom_pdm_domain_data *qcs404_cdsp_domains[] = { + &cdsp_root_pd, +}; + +static const struct qcom_pdm_domain_data *sdm845_adsp_domains[] = { + &adsp_audio_pd, + &adsp_root_pd, +}; + +static const struct adsp_pil_data adsp_sdm845_resource_init = { .crash_reason_smem = 423, .firmware_name = "adsp.mdt", .ssr_name = "lpass", @@ -779,6 +852,8 @@ static const struct adsp_pil_data adsp_resource_init = { .num_clks = 7, .pd_names = (const char*[]) { "cx" }, .num_pds = 1, + .domains = sdm845_adsp_domains, + .num_domains = ARRAY_SIZE(sdm845_adsp_domains), }; static const struct adsp_pil_data adsp_sc7280_resource_init = { @@ -794,9 +869,11 @@ static const struct adsp_pil_data adsp_sc7280_resource_init = { "gcc_cfg_noc_lpass", NULL }, .num_clks = 1, + .domains = sc7280_adsp_domains, + .num_domains = ARRAY_SIZE(sc7280_adsp_domains), }; -static const struct adsp_pil_data cdsp_resource_init = { +static const struct adsp_pil_data cdsp_qcs404_resource_init = { .crash_reason_smem = 601, .firmware_name = "cdsp.mdt", .ssr_name = "cdsp", @@ -831,10 +908,10 @@ static const struct adsp_pil_data wpss_resource_init = { }; static const struct of_device_id adsp_of_match[] = { - { .compatible = "qcom,qcs404-cdsp-pil", .data = &cdsp_resource_init }, + { .compatible = "qcom,qcs404-cdsp-pil", .data = &cdsp_qcs404_resource_init }, { .compatible = "qcom,sc7280-adsp-pil", .data = &adsp_sc7280_resource_init }, { .compatible = "qcom,sc7280-wpss-pil", .data = &wpss_resource_init }, - { .compatible = "qcom,sdm845-adsp-pil", .data = &adsp_resource_init }, + { .compatible = "qcom,sdm845-adsp-pil", .data = &adsp_sdm845_resource_init }, { }, }; MODULE_DEVICE_TABLE(of, adsp_of_match); @@ -846,6 +923,8 @@ static struct platform_driver adsp_pil_driver = { .name = "qcom_q6v5_adsp", .of_match_table = adsp_of_match, }, + .domains = qcs404_cdsp_domains, + .num_domains = ARRAY_SIZE(qcs404_cdsp_domains), }; module_platform_driver(adsp_pil_driver); From patchwork Thu Feb 29 23:00:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 776911 Received: from mail-lj1-f172.google.com (mail-lj1-f172.google.com [209.85.208.172]) (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 707456D52F for ; Thu, 29 Feb 2024 23:00:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709247639; cv=none; b=iitcBc0RvtjmfWc4thKA0hVJrcEBrSzaqSS3MhrspWCPJkZKNTLUSesQglo6LUGMNN+HBPZLI99ywX+Lppo9GX7YzrBf0zg4f8mLqM96Dlp/RY1xGYFw8Se2yVRVRgGxIJbxFeWMQMFDpkj1V4Prv1erp5h3bEj5+tBQkOsmViw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709247639; c=relaxed/simple; bh=VeLpJ9RrhWEftUKiV6RI08P0z1Tg8bxvxEPvqRhZQyY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=t/CNkKzwAJc3gEoYCHZBw7CD+JXkzUjsxVIIkyV9m7p4sLyXbR/4tfVxIjyeqTgeldJnk8cIHWXEIQ6Pz1oTXJhY2YFi44i4ji0aPn+RgwT/DAZPlcBhjAOSsTH42WTRmtl9Hc+ap9AyWU8lt7gFVHiI8VcuN5CzMskF3OThmXk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=h7M4okG0; arc=none smtp.client-ip=209.85.208.172 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="h7M4okG0" Received: by mail-lj1-f172.google.com with SMTP id 38308e7fff4ca-2d29aad15a5so17125591fa.3 for ; Thu, 29 Feb 2024 15:00:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709247636; x=1709852436; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=fKqBIp/MWEwYzRv6P9pfPz/DehwPilnWQZXqYwd2+DQ=; b=h7M4okG0612JZSCMmAMJIGRGXtbRbMTUETgJyNi9oDzAA6A5dpR3rYu2XSAPS9LHl6 FOGjfIgeHCN3dNkGh7lP1qxiG688/17cc6YPRgmwCDDxKSuidSK9Oxl3BOvJ2ek5jJjz cybkSP3c2n4dqqMO/6oqcLKYDj/vOePmNDrzuS8hPS0LMat9uHvZyyhRBT2sonM1sFc1 c+0xQky0Rqni+bDayjPQKAOhBf9Ra6Yx90WBD3AS4i486rMJCVqQNeBkZgFdD36cBeNb RUlt3mskgymhWYB4IXnvrAomvXhWBrW3npCDQnydkGqM/IyGo6R9tZoXS8qL4N/yi4MT Bxog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709247636; x=1709852436; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fKqBIp/MWEwYzRv6P9pfPz/DehwPilnWQZXqYwd2+DQ=; b=csTN3RIQGqq3BfnhzIvKtMPiMHVnq0sX0u/6x/jWW9vZ8JTa5Ju2f51pQAUmCsn1gb 74bOytai7y5HxsZa5DR7cUVe7uzzb7pifcrAbUBAsjDfa3rBMsItx2E80PXdR8TlKsg6 kseptOIaisZqpq1yng9jp7w39Y8bwxyu5HKGwTkml1vPCbuUblafY+py+PRwqqqRuluc spDSgdnAeH3hKmcGZjHD8wPwGPd83vPURj0AEzgOzav9DRW2yr9nVP8gkmZhecbK2cFH 2uBCMDQLmLerVOAmsvDBQ2f8rfOXRY1JYdO2BTJLXRSfiKjpGdX+jZDJBpYFwau9Caly QzSw== X-Gm-Message-State: AOJu0YxiOA1rUz/x3uKApLpRwBnnngNIO/zHmirRFeRZSGPDZiZ77dC0 w0tVoZmUY3X7d6fmg5vQ0KwFWnMopBgUaIhW7mKOOogxSXc8QdFRp08hpL+D74Q= X-Google-Smtp-Source: AGHT+IFzzj6cyJ0hZ/om5SsSGumfj69130Y5fXKwW4vA9Wsy/VHT9XvaTKP52bEXDRDdFDJdlO70vQ== X-Received: by 2002:a05:6512:1255:b0:513:2c6c:4cc8 with SMTP id fb21-20020a056512125500b005132c6c4cc8mr1184366lfb.63.1709247635656; Thu, 29 Feb 2024 15:00:35 -0800 (PST) Received: from umbar.lan (dzyjmhybhls-s--zn36gy-3.rev.dnainternet.fi. [2001:14ba:a00e:a300:264b:feff:fe8b:be8a]) by smtp.gmail.com with ESMTPSA id s26-20020a19771a000000b00512ed2cf297sm408455lfc.151.2024.02.29.15.00.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 15:00:34 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 01 Mar 2024 01:00:30 +0200 Subject: [PATCH RFC v2 4/5] remoteproc: qcom: mss: add configuration for in-kernel pdm Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240301-qcom-pd-mapper-v2-4-5d12a081d9d1@linaro.org> References: <20240301-qcom-pd-mapper-v2-0-5d12a081d9d1@linaro.org> In-Reply-To: <20240301-qcom-pd-mapper-v2-0-5d12a081d9d1@linaro.org> To: Bjorn Andersson , Konrad Dybcio , Mathieu Poirier Cc: linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=6069; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=VeLpJ9RrhWEftUKiV6RI08P0z1Tg8bxvxEPvqRhZQyY=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBl4QyOBdFeTuNE2+P/IID4dkT/MAylCEaFhHolk Tn1vYJWl4qJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZeEMjgAKCRCLPIo+Aiko 1eBUB/9U2hLVam1lTtMZXqZETnfQEBr36SruItBKiLhqAs5fH5c9fHATQAUpxw7XvGc4Fwn+OpH cRtvJl2lFDg3Kb9KSsZi9JAPoJLBzRAI62LgtBIVJBufgQmzkbqEOhNzLLXRD0tUfHh+9smzjOe z6jHn72EhAU65PXi0mqJoDXhLZxoW5kB/etVzh8E6DENieSQiX69fh+EREvYD4Mxwd+IHh7/DoG A0sU2Wf3nL4OUetoDS4tuXj+RWubN6/4Fd7DlYBgI+RGwaPD4HfZ9N+/MNscrenK6APG7Shh+BK PUXiZGPad+NGhndlw8Woqcp6Y5Y/wCLQ/qvO6aYPJZkfsUav X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A 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..8a7fca1e0b9a 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; + + const struct qcom_pdm_domain_data * const *domains; + size_t num_domains; }; struct q6v5 { @@ -242,6 +246,9 @@ struct q6v5 { u64 mba_perm; const char *hexagon_mdt_image; int version; + + const struct qcom_pdm_domain_data * const *domains; + size_t num_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->domains = desc->domains; + qproc->num_domains = desc->num_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, + .domains = sm8350_mpss_domains, + .num_domains = ARRAY_SIZE(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, + .domains = sdm660_mpss_domains, + .num_domains = ARRAY_SIZE(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, + .domains = sdm845_mpss_domains, + .num_domains = ARRAY_SIZE(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, + .domains = sdm845_mpss_domains, + .num_domains = ARRAY_SIZE(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, + .domains = msm8996_mpss_domains, + .num_domains = ARRAY_SIZE(msm8996_mpss_domains), }; static const struct rproc_hexagon_res msm8909_mss = { From patchwork Thu Feb 29 23:00:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 777154 Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47]) (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 660964F1F8 for ; Thu, 29 Feb 2024 23:00:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709247641; cv=none; b=DVQDo81ahZTb7SeOKGWjsPZGKN5+0KRBkuf11jr6AstM0ojThEr8oT/4p5W1BNnP49+IDl99woRp5OiFd2sjeRrUzUverU5Rwiyp0eu0NQ0QNnv7CTeWhFY+mOPRFVPQdXxkhYUY5Tpdv9xlz8FaK0AHgyUVVJ5IKDHY8NnBgqQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709247641; c=relaxed/simple; bh=D7GISN2u24vq//gqQkwKCj6VvgKSulhJ3sNBx5O0DQk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Ml19mYoUEfRaK87NKAQ/aUzEa3RMvFI8vj86ws7izbO7nOo3zWGRf2OX5QXn/KelKAyt0AnPiEKo8EFhyp+ErAUYilwsN4/AwBJL3VzWQslO8DxuMgzHgJfQ024pHHdbS1P4WKuzeozJMY+UNbhiIow5/KZ0gc86ZTo2J8/fOZ0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=I9G3azVH; arc=none smtp.client-ip=209.85.167.47 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="I9G3azVH" Received: by mail-lf1-f47.google.com with SMTP id 2adb3069b0e04-51326436876so1286344e87.1 for ; Thu, 29 Feb 2024 15:00:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709247637; x=1709852437; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=sjR5/P3XTORvWdrJTjKKntV7v0Kfuhm+Qw2uqQr3JtQ=; b=I9G3azVHf3w8+ix0IOMupdXPaV/UsYfRjt/yu9Fa31ZxAiz0rQfmybZLvDCebiZrci 1dcahk/THgn22UsQV6RlD8Mko5YqJq4sYTnVWYZe9VhBSt2RCVigoT5AnismKkyXCb9E ZzDb3UEC+bxC6L9ESFHJqoIP4qrhCa7qBcvDhtwb6eIfkuYnRlfVg+3e1nt42jSlMyKn IfTZH26KJl3LRi7oqDTnK6TUGt+gmdELWrkvRBcldyk40yWrnflIQk4Vf7Q65yadCpJ1 L9MfMNZvur7hDfqIKjfeMSRkI0xuniQxuUevW26T2jR57GF5wbBQEN/BM/MmCEImpdKP HlGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709247637; x=1709852437; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=sjR5/P3XTORvWdrJTjKKntV7v0Kfuhm+Qw2uqQr3JtQ=; b=VZnQlFmp8804UYaeqAoEm1qxYlZKwXQCqNpfSmadOEtnKqHKRl8R6kd1UWQPvEpasT wRr5BAFaTPyUfmAcCRQXjJIg5UI8uGGXRWOb3oZnchNnG8JmaBRHCMZfhip+xX9afx+P 9LRKxtudUAy4bc+XHFD3tU/IccLU/yi2NiLOP80RD+kLrj3XUU+pXpFnqZHperpinoOj heBxvW7RET9AlrogMMujRjgZiiNEGs4bUd/Aze4oLOWsFMKhNY7bqzT0f2rUJAvULzDK oOVOkbSeaiMMdltYeaqfrlIGec7xzO9Aoeicc7rJTszKW3NmgEjS1ENxduw+MA6ikoan 5zzw== X-Gm-Message-State: AOJu0YyYjJl9Q0tY/nV2+peseuD2niJrRdhwjJ1KnU5qRtm52NoQSpb3 mKSUe6kdEcf15OpSrpEdv/kk6pm9T7SweVTZmnwNFlrvXD1FleJjkbUOnp0e3xQ= X-Google-Smtp-Source: AGHT+IG/Rww5D3n7iwPYiVh0kBmLT4Zl5RMnq83sR796iMWq6Y3eW8JKpIZgnfL4nShRD8E5X4hBoQ== X-Received: by 2002:a05:6512:31ca:b0:513:d2:ad11 with SMTP id j10-20020a05651231ca00b0051300d2ad11mr765lfe.53.1709247636695; Thu, 29 Feb 2024 15:00:36 -0800 (PST) Received: from umbar.lan (dzyjmhybhls-s--zn36gy-3.rev.dnainternet.fi. [2001:14ba:a00e:a300:264b:feff:fe8b:be8a]) by smtp.gmail.com with ESMTPSA id s26-20020a19771a000000b00512ed2cf297sm408455lfc.151.2024.02.29.15.00.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Feb 2024 15:00:35 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 01 Mar 2024 01:00:31 +0200 Subject: [PATCH RFC v2 5/5] remoteproc: qcom: pas: add configuration for in-kernel pdm Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240301-qcom-pd-mapper-v2-5-5d12a081d9d1@linaro.org> References: <20240301-qcom-pd-mapper-v2-0-5d12a081d9d1@linaro.org> In-Reply-To: <20240301-qcom-pd-mapper-v2-0-5d12a081d9d1@linaro.org> To: Bjorn Andersson , Konrad Dybcio , Mathieu Poirier Cc: linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=21347; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=D7GISN2u24vq//gqQkwKCj6VvgKSulhJ3sNBx5O0DQk=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBl4QyOGGAJ5AiLjS3eZP1V/wk+wi5zlU9BuVFGL NKk0ALakr2JATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZeEMjgAKCRCLPIo+Aiko 1aJVB/9py42jdfnyq6eQASACtNbW1cHC3/2klfWqryF3p7oz74w9rbYPt6lV4d9UaBo/VqrdkPD eou6AjwmVjPkL8ZmjophR2s7/g4ijH/dAO5ydF1Arj6MovVzPzaEgLgpoVHWpZWhtNYBwBme9cW DV5w7woMxWgTCRZAdyhh/Ncq8dDD/xtgwafnoALM4fFvCK6p4N5kK02Hl3qEXkO7z+kz7Ke4FOZ ISxWMVn9fJ64p4N/8md0anW+0zfnQk+IV+25f9i5DHi5qkJRHO/hI4dTMAu2xyEEj98HloOKNSi BAxnQFCcM6vgTh2VUz6PTZACWphTAMzaiL6zuY2Wf5ndgJa1 X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A 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 | 351 +++++++++++++++++++++++++++++++++++-- 2 files changed, 339 insertions(+), 13 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 3e34b9ff38ae..6c88a913ca28 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 @@ -56,6 +57,9 @@ struct adsp_data { int region_assign_count; bool region_assign_shared; int region_assign_vmid; + + const struct qcom_pdm_domain_data * const *domains; + size_t num_domains; }; struct qcom_adsp { @@ -112,6 +116,9 @@ struct qcom_adsp { struct qcom_scm_pas_metadata pas_metadata; struct qcom_scm_pas_metadata dtb_pas_metadata; + + const struct qcom_pdm_domain_data * const *domains; + size_t num_domains; }; static void adsp_segment_dump(struct rproc *rproc, struct rproc_dump_segment *segment, @@ -255,6 +262,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) @@ -327,8 +335,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) @@ -372,6 +390,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) @@ -730,6 +752,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); @@ -806,6 +832,151 @@ 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_root_pd_pdr = { + .domain = "msm/adsp/root_pd", + .instance_id = 74, + .services = { + "tms/pdr_enabled", + 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 *qcs404_adsp_domains[] = { + &adsp_audio_pd, + &adsp_root_pd, + &adsp_sensor_pd +}; + +static const struct qcom_pdm_domain_data *sc7280_adsp_domains[] = { + &adsp_audio_pd, + &adsp_root_pd_pdr, + &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_pdr, + &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 mpss_root_pd = { + .domain = "msm/modem/root_pd", + .instance_id = 180, + .services = { + NULL, + }, +}; + +static const struct qcom_pdm_domain_data mpss_root_pd_gps = { + .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 *qcs404_mpss_domains[] = { + &mpss_root_pd, + &mpss_wlan_pd, +}; + +static const struct qcom_pdm_domain_data *sm8150_mpss_domains[] = { + &mpss_root_pd_gps, + &mpss_wlan_pd, +}; + +static const struct qcom_pdm_domain_data *sm8350_mpss_domains[] = { + &mpss_root_pd_gps, +}; + static const struct adsp_data adsp_resource_init = { .crash_reason_smem = 423, .firmware_name = "adsp.mdt", @@ -814,6 +985,37 @@ static const struct adsp_data adsp_resource_init = { .ssr_name = "lpass", .sysmon_name = "adsp", .ssctl_id = 0x14, + /* no domains */ +}; + +static const struct adsp_data qcs404_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, + .domains = qcs404_adsp_domains, + .num_domains = ARRAY_SIZE(qcs404_adsp_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, + .domains = sc7280_adsp_domains, + .num_domains = ARRAY_SIZE(sc7280_adsp_domains), }; static const struct adsp_data sdm845_adsp_resource_init = { @@ -825,6 +1027,20 @@ static const struct adsp_data sdm845_adsp_resource_init = { .ssr_name = "lpass", .sysmon_name = "adsp", .ssctl_id = 0x14, + .domains = sdm845_adsp_domains, + .num_domains = ARRAY_SIZE(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, + .domains = sdm845_adsp_domains, + .num_domains = ARRAY_SIZE(sdm845_adsp_domains), }; static const struct adsp_data sm6350_adsp_resource = { @@ -841,6 +1057,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 = { @@ -856,6 +1073,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 = { @@ -871,6 +1089,8 @@ static const struct adsp_data sm8150_adsp_resource = { .ssr_name = "lpass", .sysmon_name = "adsp", .ssctl_id = 0x14, + .domains = sdm845_adsp_domains, + .num_domains = ARRAY_SIZE(sdm845_adsp_domains), }; static const struct adsp_data sm8250_adsp_resource = { @@ -887,6 +1107,8 @@ static const struct adsp_data sm8250_adsp_resource = { .ssr_name = "lpass", .sysmon_name = "adsp", .ssctl_id = 0x14, + .domains = sdm845_adsp_domains, + .num_domains = ARRAY_SIZE(sdm845_adsp_domains), }; static const struct adsp_data sm8350_adsp_resource = { @@ -903,8 +1125,8 @@ 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, + .num_domains = ARRAY_SIZE(sm8350_adsp_domains), }; static const struct adsp_data msm8996_adsp_resource = { @@ -919,9 +1141,11 @@ static const struct adsp_data msm8996_adsp_resource = { .ssr_name = "lpass", .sysmon_name = "adsp", .ssctl_id = 0x14, + .domains = msm8996_adsp_domains, + .num_domains = ARRAY_SIZE(msm8996_adsp_domains), }; -static const struct adsp_data cdsp_resource_init = { +static const struct adsp_data qcs404_cdsp_resource_init = { .crash_reason_smem = 601, .firmware_name = "cdsp.mdt", .pas_id = 18, @@ -929,6 +1153,8 @@ static const struct adsp_data cdsp_resource_init = { .ssr_name = "cdsp", .sysmon_name = "cdsp", .ssctl_id = 0x17, + .domains = sdm845_cdsp_domains, + .num_domains = ARRAY_SIZE(sdm845_cdsp_domains), }; static const struct adsp_data sdm845_cdsp_resource_init = { @@ -940,6 +1166,20 @@ static const struct adsp_data sdm845_cdsp_resource_init = { .ssr_name = "cdsp", .sysmon_name = "cdsp", .ssctl_id = 0x17, + .domains = sdm845_cdsp_domains, + .num_domains = ARRAY_SIZE(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, + .domains = sdm845_cdsp_domains, + .num_domains = ARRAY_SIZE(sdm845_cdsp_domains), }; static const struct adsp_data sm6350_cdsp_resource = { @@ -971,6 +1211,8 @@ static const struct adsp_data sm8150_cdsp_resource = { .ssr_name = "cdsp", .sysmon_name = "cdsp", .ssctl_id = 0x17, + .domains = sdm845_cdsp_domains, + .num_domains = ARRAY_SIZE(sdm845_cdsp_domains), }; static const struct adsp_data sm8250_cdsp_resource = { @@ -986,6 +1228,8 @@ static const struct adsp_data sm8250_cdsp_resource = { .ssr_name = "cdsp", .sysmon_name = "cdsp", .ssctl_id = 0x17, + .domains = sdm845_cdsp_domains, + .num_domains = ARRAY_SIZE(sdm845_cdsp_domains), }; static const struct adsp_data sc8280xp_nsp0_resource = { @@ -1000,6 +1244,8 @@ static const struct adsp_data sc8280xp_nsp0_resource = { .ssr_name = "cdsp0", .sysmon_name = "cdsp", .ssctl_id = 0x17, + .domains = sdm845_cdsp_domains, + .num_domains = ARRAY_SIZE(sdm845_cdsp_domains), }; static const struct adsp_data sc8280xp_nsp1_resource = { @@ -1030,6 +1276,8 @@ static const struct adsp_data sm8350_cdsp_resource = { .ssr_name = "cdsp", .sysmon_name = "cdsp", .ssctl_id = 0x17, + .domains = sdm845_cdsp_domains, + .num_domains = ARRAY_SIZE(sdm845_cdsp_domains), }; static const struct adsp_data mpss_resource_init = { @@ -1047,6 +1295,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, + .domains = sm8350_mpss_domains, + .num_domains = ARRAY_SIZE(sm8350_mpss_domains), }; static const struct adsp_data sc8180x_mpss_resource = { @@ -1062,6 +1330,46 @@ static const struct adsp_data sc8180x_mpss_resource = { .ssr_name = "mpss", .sysmon_name = "modem", .ssctl_id = 0x12, + .domains = sm8150_mpss_domains, + .num_domains = ARRAY_SIZE(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, + .domains = sm8150_mpss_domains, + .num_domains = ARRAY_SIZE(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, + .domains = sm8350_mpss_domains, + .num_domains = ARRAY_SIZE(sm8350_mpss_domains), }; static const struct adsp_data msm8996_slpi_resource_init = { @@ -1076,6 +1384,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 = { @@ -1092,9 +1401,11 @@ static const struct adsp_data sdm845_slpi_resource_init = { .ssr_name = "dsps", .sysmon_name = "slpi", .ssctl_id = 0x16, + .domains = sdm845_slpi_domains, + .num_domains = ARRAY_SIZE(sdm845_slpi_domains), }; -static const struct adsp_data wcss_resource_init = { +static const struct adsp_data qcs404_wcss_resource_init = { .crash_reason_smem = 421, .firmware_name = "wcnss.mdt", .pas_id = 6, @@ -1102,6 +1413,8 @@ static const struct adsp_data wcss_resource_init = { .ssr_name = "mpss", .sysmon_name = "wcnss", .ssctl_id = 0x12, + .domains = qcs404_mpss_domains, + .num_domains = ARRAY_SIZE(qcs404_mpss_domains), }; static const struct adsp_data sdx55_mpss_resource = { @@ -1135,6 +1448,8 @@ static const struct adsp_data sm8450_mpss_resource = { .ssr_name = "mpss", .sysmon_name = "modem", .ssctl_id = 0x12, + .domains = sm8350_mpss_domains, + .num_domains = ARRAY_SIZE(sm8350_mpss_domains), }; static const struct adsp_data sm8550_adsp_resource = { @@ -1154,6 +1469,8 @@ static const struct adsp_data sm8550_adsp_resource = { .ssr_name = "lpass", .sysmon_name = "adsp", .ssctl_id = 0x14, + .domains = sm8350_adsp_domains, + .num_domains = ARRAY_SIZE(sm8350_adsp_domains), }; static const struct adsp_data sm8550_cdsp_resource = { @@ -1174,6 +1491,8 @@ static const struct adsp_data sm8550_cdsp_resource = { .ssr_name = "cdsp", .sysmon_name = "cdsp", .ssctl_id = 0x17, + .domains = sdm845_cdsp_domains, + .num_domains = ARRAY_SIZE(sdm845_cdsp_domains), }; static const struct adsp_data sm8550_mpss_resource = { @@ -1197,6 +1516,8 @@ static const struct adsp_data sm8550_mpss_resource = { .region_assign_idx = 2, .region_assign_count = 1, .region_assign_vmid = QCOM_SCM_VMID_MSS_MSA, + .domains = sm8350_mpss_domains, + .num_domains = ARRAY_SIZE(sm8350_mpss_domains), }; static const struct adsp_data sc7280_wpss_resource = { @@ -1264,25 +1585,28 @@ static const struct adsp_data sm8650_mpss_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}, { .compatible = "qcom,msm8996-slpi-pil", .data = &msm8996_slpi_resource_init}, { .compatible = "qcom,msm8998-adsp-pas", .data = &msm8996_adsp_resource}, { .compatible = "qcom,msm8998-slpi-pas", .data = &msm8996_slpi_resource_init}, - { .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 }, + { .compatible = "qcom,qcs404-adsp-pas", .data = &qcs404_adsp_resource_init }, + { .compatible = "qcom,qcs404-cdsp-pas", .data = &qcs404_cdsp_resource_init }, + { .compatible = "qcom,qcs404-wcss-pas", .data = &qcs404_wcss_resource_init }, + // FIXME: is adsp audio domain applicable to sc7180 ? { .compatible = "qcom,sc7180-adsp-pas", .data = &sm8250_adsp_resource}, + // FIXME: no domains? { .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}, { .compatible = "qcom,sc8180x-mpss-pas", .data = &sc8180x_mpss_resource}, - { .compatible = "qcom,sc8280xp-adsp-pas", .data = &sm8250_adsp_resource}, + { .compatible = "qcom,sc8280xp-adsp-pas", .data = &sm8350_adsp_resource}, { .compatible = "qcom,sc8280xp-nsp0-pas", .data = &sc8280xp_nsp0_resource}, { .compatible = "qcom,sc8280xp-nsp1-pas", .data = &sc8280xp_nsp1_resource}, { .compatible = "qcom,sdm660-adsp-pas", .data = &adsp_resource_init}, @@ -1290,18 +1614,19 @@ 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}, + // FIXME: no domains? { .compatible = "qcom,sm6350-mpss-pas", .data = &mpss_resource_init}, { .compatible = "qcom,sm6375-adsp-pas", .data = &sm6350_adsp_resource}, { .compatible = "qcom,sm6375-cdsp-pas", .data = &sm8150_cdsp_resource}, { .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}, @@ -1309,7 +1634,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},