From patchwork Mon Mar 11 15:34:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 779490 Received: from mail-lj1-f181.google.com (mail-lj1-f181.google.com [209.85.208.181]) (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 8C01C45C04 for ; Mon, 11 Mar 2024 15:34:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710171249; cv=none; b=PruULdcf7KUhm/8r1XWjZQFUYmX3Qzkm0zIknn1XWQ0Y81VERjm6jNzuNao2piIScM6AGajmqQjlrNxid3RJIDouwLtR451FZedhklnGIjuk4Hg/JMHu818LbdxKVU7NbjiI/z+K1qNZOfBJs9LuWOTR6Z6lnfY3oVFfJwvpFVE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710171249; c=relaxed/simple; bh=Yvr55imNsVDZtCUiDXnycqIHGG7y4xl4lh0mVlDLWII=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=fglrCCVsbVTwXp5tNjcIaTeU5XwocjecLnUtz6DFvwZo28wud0ZYPMRPinb0fNqSSYyshqjNlaY0hUz02UxRhjh9zymqcyhAZuigK/iDq6GORmmiuRrfh7bFtiTLdKSiV5+HFh/D7rzle9HzJ9AQ4rQsQuoLMPBRb02FmWL3NTs= 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=BNMlqI64; arc=none smtp.client-ip=209.85.208.181 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="BNMlqI64" Received: by mail-lj1-f181.google.com with SMTP id 38308e7fff4ca-2d24a727f78so64512521fa.0 for ; Mon, 11 Mar 2024 08:34:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710171246; x=1710776046; 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=BDtCv3rciFHV66pbjS4lehN/siYq37duyWooEjJyENA=; b=BNMlqI64/evGEoq15lUDEcMmSTKnfG7zNnk9BYfdhRWaHfcuB1Q/f7KR4SctRycjeD Vz2ryqATwhUzK5+pMpcCjmCD2y4Q5zdkjz/rIQbp/RbCk1m93AjwOlBy9rurC03QHGiH LPwIBKL6jpqLCgP2JVnFuz5EmEu4I/lSBlLjSe3NeTkSGkObz4hPMcBQjs5YStdTHYKh iehPbRZhoaSwPR5NNBxS2CWvWZK5yzjuL0nTOgJUCRjWhisrG1kry082WRzOi1lQOztR sLcZyk8OqWsSn16llrkt7i3Y5KSsYtfaJnCeMRTHrz6G0N9M9BCzFYTaD31aEmFeE61v T6YQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710171246; x=1710776046; 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=BDtCv3rciFHV66pbjS4lehN/siYq37duyWooEjJyENA=; b=WIOHacs4n+7AQloXLNKoObGs40z1bqLHHEjWOqj14Kp+sSe5eseu8/4/shJ9lK72GQ WH8SkzzejNhjDCc2UtWR3dXQZQ/RM3YGqv/eeTzxxdTeShXmCPv+vQNzLSMXc+3anGuH aU9cmyFh9HFoIMN9pqd2tOr/gt02KZUSN7NQrDfLAz1s3cr32qA2tFgZnzAH5gKn55mZ kAtuvJXBdwbNV/y4dkAWxSG2yOo4cvXQB2KCWmbhZS8q2UfeYHJxvdAS+S8OrApTGgtQ hIMEfjqOZeflkhk5pCAHP9Cbj8xJYo4zTcCHZ7Dlc4Q4CsImgFkql8EjpPXJKn71+dXi chlg== X-Gm-Message-State: AOJu0YwxueWU8b4eqCJDQF1HLgI6cLAEW6TI7sd2Z//MZ9VaYjw7OIsw mzKIEp7u1RMzhrSwJJ/Mkjf3xvSm/AjPpX/QzFXn4oNne2mLyoxz67CJAECSO2o= X-Google-Smtp-Source: AGHT+IF800B5kgOhgBUwkuVg8PxS6GjxrhdHn89LtgKe+MZ2BTmV3t1KFcDFa5tO4Nyynevb86AY5A== X-Received: by 2002:a05:651c:2122:b0:2d2:d9b2:b2fc with SMTP id a34-20020a05651c212200b002d2d9b2b2fcmr735537ljq.11.1710171245809; Mon, 11 Mar 2024 08:34:05 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id q19-20020a2e9153000000b002d449f736ddsm119294ljg.0.2024.03.11.08.34.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 08:34:05 -0700 (PDT) From: Dmitry Baryshkov Date: Mon, 11 Mar 2024 17:34:01 +0200 Subject: [PATCH v4 1/7] soc: qcom: pdr: protect locator_addr with the main mutex Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240311-qcom-pd-mapper-v4-1-24679cca5c24@linaro.org> References: <20240311-qcom-pd-mapper-v4-0-24679cca5c24@linaro.org> In-Reply-To: <20240311-qcom-pd-mapper-v4-0-24679cca5c24@linaro.org> To: Bjorn Andersson , Konrad Dybcio , Mathieu Poirier Cc: linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org, Johan Hovold X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1963; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=Yvr55imNsVDZtCUiDXnycqIHGG7y4xl4lh0mVlDLWII=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBl7yRr1/mDodIBknlWWj89C3m9SkLJxUu7trE/Q mSfhxmz84yJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZe8kawAKCRCLPIo+Aiko 1aIACACIrbNw5GJDHmTU66rg83e/ykrH001awbmBCzgy86JYe7DVZrFhyBzzKnchoQ0ic/9VGq9 OU9T+S2Dx8hIf5053vlXBztDvo1lD9p6yWRDbDs9Vp5H9uF2K2Rq4Ag7+5iVpbr3+OVuWuFyPdQ s7EyAPbRJOuLl28Ztkvn5u8z0ri35dzomhyGfmLGrdM68jlaBUNhurgMJn6S2VuxOeA1kkGyl0z IdIwgLimdh4aE+hHzZ4vTvQoN6WmT1cmj6bQLSh5SzGyJru2PYahPC1drzpb5+lR4sTQkyjvUTR TptW+GQw1hZGZwvBwwREaXMkAf7ibdfxr/wtxaZmkM1gwZZS X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A If the service locator server is restarted fast enough, the PDR can rewrite locator_addr fields concurrently. Protect them by placing modification of those fields under the main pdr->lock. Fixes: fbe639b44a82 ("soc: qcom: Introduce Protection Domain Restart helpers") Signed-off-by: Dmitry Baryshkov --- drivers/soc/qcom/pdr_interface.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/soc/qcom/pdr_interface.c b/drivers/soc/qcom/pdr_interface.c index a1b6a4081dea..7b5fdf9fd3d7 100644 --- a/drivers/soc/qcom/pdr_interface.c +++ b/drivers/soc/qcom/pdr_interface.c @@ -76,12 +76,12 @@ static int pdr_locator_new_server(struct qmi_handle *qmi, locator_hdl); struct pdr_service *pds; + mutex_lock(&pdr->lock); /* Create a local client port for QMI communication */ pdr->locator_addr.sq_family = AF_QIPCRTR; pdr->locator_addr.sq_node = svc->node; pdr->locator_addr.sq_port = svc->port; - mutex_lock(&pdr->lock); pdr->locator_init_complete = true; mutex_unlock(&pdr->lock); @@ -104,10 +104,10 @@ static void pdr_locator_del_server(struct qmi_handle *qmi, mutex_lock(&pdr->lock); pdr->locator_init_complete = false; - mutex_unlock(&pdr->lock); pdr->locator_addr.sq_node = 0; pdr->locator_addr.sq_port = 0; + mutex_unlock(&pdr->lock); } static const struct qmi_ops pdr_locator_ops = { @@ -133,11 +133,13 @@ static int pdr_register_listener(struct pdr_handle *pdr, req.enable = enable; strscpy(req.service_path, pds->service_path, sizeof(req.service_path)); + mutex_lock(&pdr->lock); ret = qmi_send_request(&pdr->notifier_hdl, &pds->addr, &txn, SERVREG_REGISTER_LISTENER_REQ, SERVREG_REGISTER_LISTENER_REQ_LEN, servreg_register_listener_req_ei, &req); + mutex_unlock(&pdr->lock); if (ret < 0) { qmi_txn_cancel(&txn); return ret; From patchwork Mon Mar 11 15:34:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 779489 Received: from mail-lj1-f179.google.com (mail-lj1-f179.google.com [209.85.208.179]) (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 86AD645C0B for ; Mon, 11 Mar 2024 15:34:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710171250; cv=none; b=X6/bJeWUsFdhdPAdMRWhnTFnd9uhmgE029Cl6DPpYkdlUrhQLL3cdE9Bt817bKq70Lz0HPSsjpqwpLXCWE9T2g1D0ycCNQFIIfOkePrwTJz1WmibH5tiby3uVk2dQzood/GYtPSueMHUltrqyMAz3SZbPgVgZE0XcLH1n7iiDZY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710171250; c=relaxed/simple; bh=csXLAeosHLzaDT1emhK9UjK0flIW3eHZEn7ZeKWaD8Y=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=S6jRV+fd4tfQNPH0snvZ7tloLvG/7WxSTRCAB2B63MEQAKANdwxWU9krckpOlqzxIqYGqXFXvwe/E0OVy8+mALx+irVvChG4jmph/RcAjxL3faOgzC/nVbp1ejrn2ggR62j54+riR9UUv3ETGT757mqxYueb/n17hJwOnaRsauc= 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=gipoMze8; arc=none smtp.client-ip=209.85.208.179 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="gipoMze8" Received: by mail-lj1-f179.google.com with SMTP id 38308e7fff4ca-2d109e82bd0so61796981fa.3 for ; Mon, 11 Mar 2024 08:34:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710171247; x=1710776047; 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=wqmPdjghu8YQzANGIWFKy+g9UopAwMWqD3Z+KAznsUw=; b=gipoMze8CtMAft2+u71gcJUXZiJBqVKrFvnIaQDyJTx+lYqQBJWtW7MkQiH+NpDSJv 53tyM/JN6x5TMeQYTZVWI7KApwROT8kGyMP7kKaWo64FDE5pkjSA869TDH0wf5bjckV1 /7YPvV8C1BnGzjzjQc9DFUCtyGsvsc99w15WlujxufBGKGz6H3hSxYdaQWjLoqukQviO 6k5WIxDPm4acwHPEioDM3656tp3M9IZCmxuyh0fVluwlt0AXausjjP1hOdhFQSBJWxu2 O4RvC9//RJKQhkjziuIbJrL2R7XHFzBcK1BbMuuZdnwlIppE4wJAHEzH45gVVcn7FUYi M/6A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710171247; x=1710776047; 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=wqmPdjghu8YQzANGIWFKy+g9UopAwMWqD3Z+KAznsUw=; b=auxAIgKy4xqMdHoDvyxSDRisKoZl6DG4MwmvCUEug9F9vC1zTo54Rl2+EGuZnUTGnk oKGZhnuEAk6808XeR9dIMxtXzsQd8/wbdJSC9UX5N5Nm11vn2S0UecK+y/bECIfEu+wo 0nLGvlXHOaABaWJJpVk/btum7MArSBF8LdooNDgi4ll2fsTKWT1JlB4Fr8JnfPdZfh2w icUCetcD3JRyaFqZqTbxSht2pPRq7Y1ToKpv4EGNDKnAsUo6dga36Bh5DJu0rTdQWJzc fQLB70qPzW8OdLaTEUu7LwaGJEiaf8qcZSVhN1lLl5GFyCJ/8qZXUpm82sEvsXcBrZ// c+DQ== X-Gm-Message-State: AOJu0YwvbzWX2/RKNxtdleEreLQj+38uQ7SAvIlXRBb+UoCvF8RQ0/R2 TWePMCgeBjHKPBws1jUkTYBX2PKHkGqhFjZqExJGq7w/4mfquoYktUFvJJfkvCQ= X-Google-Smtp-Source: AGHT+IHLen5haH/KIDqXSBnm6njMDNQd6Suv70/wZOBLhQ1RXfBDBeyRpILDckTG4uROvoPSav0/6A== X-Received: by 2002:a2e:8509:0:b0:2d2:cb43:bc86 with SMTP id j9-20020a2e8509000000b002d2cb43bc86mr3844123lji.45.1710171246715; Mon, 11 Mar 2024 08:34:06 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id q19-20020a2e9153000000b002d449f736ddsm119294ljg.0.2024.03.11.08.34.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 08:34:06 -0700 (PDT) From: Dmitry Baryshkov Date: Mon, 11 Mar 2024 17:34:02 +0200 Subject: [PATCH v4 2/7] soc: qcom: qmi: add a way to remove running service Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240311-qcom-pd-mapper-v4-2-24679cca5c24@linaro.org> References: <20240311-qcom-pd-mapper-v4-0-24679cca5c24@linaro.org> In-Reply-To: <20240311-qcom-pd-mapper-v4-0-24679cca5c24@linaro.org> To: Bjorn Andersson , Konrad Dybcio , Mathieu Poirier Cc: linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org, Johan Hovold X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3503; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=csXLAeosHLzaDT1emhK9UjK0flIW3eHZEn7ZeKWaD8Y=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBl7yRrL2prbFbuK79vS0F2a8GlhPfZVbWN/E6Xq duLqVwXa2+JATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZe8kawAKCRCLPIo+Aiko 1S5aCACkUyHCPrxn6erHvTNwfIoJijqSsCqC/Prmkilc3akRz38BugzlciQCplu3XeWeJbLUaza tDOiStmcgGIcWJ9QHsDArodLBUH3KpeL8UNIzQ+/o0POQ1qV8U+O+XjyH9MTiuF9e/2dIvsP2ZY cScmZLGdodIoXBP+BDPHh6orDFXci6uiZc1gztQb3dAbaB1K8b7tj1NNtz9lx5ijJIsHhZyjiqX jchwmM1nsB2obc9LCrQ40p+FGPIQA516usn/oxuBkw9hMLaMayyEa/4jlTp1ypBlPFbA8NWhghd cPtk0/KlgsgxiXBsgHhltaWNzWx+Tksu+1rX6Q1pxGjCdYrp X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A Add qmi_del_server(), a pair to qmi_add_server(), a way to remove running server from the QMI socket. This is e.g. necessary for pd-mapper, which needs to readd a server each time the DSP is started or stopped. Signed-off-by: Dmitry Baryshkov --- drivers/soc/qcom/qmi_interface.c | 67 ++++++++++++++++++++++++++++++++++++++++ include/linux/soc/qcom/qmi.h | 2 ++ 2 files changed, 69 insertions(+) diff --git a/drivers/soc/qcom/qmi_interface.c b/drivers/soc/qcom/qmi_interface.c index bb98b06e87f8..18ff2015c682 100644 --- a/drivers/soc/qcom/qmi_interface.c +++ b/drivers/soc/qcom/qmi_interface.c @@ -289,6 +289,73 @@ int qmi_add_server(struct qmi_handle *qmi, unsigned int service, } EXPORT_SYMBOL_GPL(qmi_add_server); +static void qmi_send_del_server(struct qmi_handle *qmi, struct qmi_service *svc) +{ + struct qrtr_ctrl_pkt pkt; + struct sockaddr_qrtr sq; + struct msghdr msg = { }; + struct kvec iv = { &pkt, sizeof(pkt) }; + int ret; + + memset(&pkt, 0, sizeof(pkt)); + pkt.cmd = cpu_to_le32(QRTR_TYPE_DEL_SERVER); + pkt.server.service = cpu_to_le32(svc->service); + pkt.server.instance = cpu_to_le32(svc->version | svc->instance << 8); + pkt.server.node = cpu_to_le32(qmi->sq.sq_node); + pkt.server.port = cpu_to_le32(qmi->sq.sq_port); + + sq.sq_family = qmi->sq.sq_family; + sq.sq_node = qmi->sq.sq_node; + sq.sq_port = QRTR_PORT_CTRL; + + msg.msg_name = &sq; + msg.msg_namelen = sizeof(sq); + + mutex_lock(&qmi->sock_lock); + if (qmi->sock) { + ret = kernel_sendmsg(qmi->sock, &msg, &iv, 1, sizeof(pkt)); + if (ret < 0) + pr_err("send service deregistration failed: %d\n", ret); + } + mutex_unlock(&qmi->sock_lock); +} + +/** + * qmi_del_server() - register a service with the name service + * @qmi: qmi handle + * @service: type of the service + * @instance: instance of the service + * @version: version of the service + * + * Remove registration of the service with the name service. This notifies + * clients that they should no longer send messages to the client associated + * with @qmi. + * + * Return: 0 on success, negative errno on failure. + */ +int qmi_del_server(struct qmi_handle *qmi, unsigned int service, + unsigned int version, unsigned int instance) +{ + struct qmi_service *svc; + struct qmi_service *tmp; + + list_for_each_entry_safe(svc, tmp, &qmi->services, list_node) { + if (svc->service != service || + svc->version != version || + svc->instance != instance) + continue; + + qmi_send_del_server(qmi, svc); + list_del(&svc->list_node); + kfree(svc); + + return 0; + } + + return -EINVAL; +} +EXPORT_SYMBOL_GPL(qmi_del_server); + /** * qmi_txn_init() - allocate transaction id within the given QMI handle * @qmi: QMI handle diff --git a/include/linux/soc/qcom/qmi.h b/include/linux/soc/qcom/qmi.h index 469e02d2aa0d..5039c30e4bdc 100644 --- a/include/linux/soc/qcom/qmi.h +++ b/include/linux/soc/qcom/qmi.h @@ -241,6 +241,8 @@ int qmi_add_lookup(struct qmi_handle *qmi, unsigned int service, unsigned int version, unsigned int instance); int qmi_add_server(struct qmi_handle *qmi, unsigned int service, unsigned int version, unsigned int instance); +int qmi_del_server(struct qmi_handle *qmi, unsigned int service, + unsigned int version, unsigned int instance); int qmi_handle_init(struct qmi_handle *qmi, size_t max_msg_len, const struct qmi_ops *ops, From patchwork Mon Mar 11 15:34:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 779817 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 A379A46439 for ; Mon, 11 Mar 2024 15:34:09 +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=1710171252; cv=none; b=bEvg+dX8cfUVLKd45G8VFpyXFaFrEapCbDxKfOhuTe4+nB4VIBplj1q716282EiSwx6NLvL6RIrOP8P/RBWLZZfdOiyAo9Xcl+R6TooCH6WaXFDZuCxv7ijoXfKLmGikaJ5ecLWoEi0FuCcUYAliA2pAFtJJA0RTQU88MkKeKE0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710171252; c=relaxed/simple; bh=yyW8nWc0CqXyntSJEUTYso3W/Uz8Y2nnwho22yOj1fI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Xl62nLQ28WTHLntWfedgjkvGcBTd4oUsZnm+cCuLR7+achkBPm1td5TkVKE8eLAZqwX+9s59yn2iS+3jvSlwcoZ/WiOvVEie18/iCDnSOQGaD9gy2M/LsheVDC1/yYC3DcQDnte9BsasU8uXWjx+D6dFv12Q7CYotYNYmm0E+jo= 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=OX1lTgFP; 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="OX1lTgFP" Received: by mail-lj1-f170.google.com with SMTP id 38308e7fff4ca-2d21cdbc85bso71645711fa.2 for ; Mon, 11 Mar 2024 08:34:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710171248; x=1710776048; 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=6QZmyTFq5jIzLcbbwPheYuIv0cb8usEsmtAcFUaJNPs=; b=OX1lTgFPG3hiu4jWJKBnP2x4c4Jobf5Rh8d9d/4eBxKi2bUcBLZHw0qT2ms66HFGZT ym/8Jri6a4IQJmQ8md4Jd5Ao3OPjSiwzvtlPMSuid9gW3bo3rTTpRVinMlL20ZcgbnIe WlvuKB9LgwvxAJvLXjCcwRiMCpsfY2UafnDG1JJLXHmZnN2OofYfRzazqxLHkR/8Iey2 Dc8a4DqLAnwZIf48SwTTcz0tVFgwQhtMhTG9HwaEMb4vNo+YoWBa8EsBYgPW1mRgveec D/0Om9t6CXoEX3qRBjcnPzDYpNb8QCV/ldm7JuZxNoBqMMACW6HB4Then6GawGtmHhtA HS1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710171248; x=1710776048; 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=6QZmyTFq5jIzLcbbwPheYuIv0cb8usEsmtAcFUaJNPs=; b=JPsMpRNZ1SST/CKVQViCqufTQmC/bUqczoAjTL7/IDAWX0vchRtcH4wEdxpLVwab0i Kp7pqGIs00ZVxZTut63GaG/jZrbKwzJjfHuyTLg34wSUEsWgloFIyo1aLNaXHdatsAag IZ03tRRd1IQXdHsSoUTo5eYI6IEgYU1PKVp4TFC6ADMLqjBktZfqjsdPOGq/sqr5Gh3f lN/deMEIdIgq1uOFm+0E7f5MWRPIgFdQ7+UMMOYa/4ROmQ98+LpZu8ye2ONtnY4jCjct 3x8gNKjVtAtgrGnMkKuenGdasNkkWY1UZswCCvTbH6NZxwnWbJnOy3V/WGRjNl3VBwZh XZZA== X-Gm-Message-State: AOJu0YwGpfaVRsGHSxKWtlwkaU5N75qN4zbSeRNYirMGjqLIlEDHORWa 5Gga/upCDPF0kdG9oVFPYuCVrPdtwJmWAXm8eCPuKwNSA5VOTF8LIUuPcca1pOQ= X-Google-Smtp-Source: AGHT+IHLkihUjEohD/R1alpeQbUHZgSZCiwb/nvQJV+OvYsmFxnsJ9pkjW5j7OvkhjnMXDDhLbs++g== X-Received: by 2002:a2e:99c5:0:b0:2d2:7fa9:cbd6 with SMTP id l5-20020a2e99c5000000b002d27fa9cbd6mr3936983ljj.49.1710171247777; Mon, 11 Mar 2024 08:34:07 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id q19-20020a2e9153000000b002d449f736ddsm119294ljg.0.2024.03.11.08.34.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 08:34:07 -0700 (PDT) From: Dmitry Baryshkov Date: Mon, 11 Mar 2024 17:34:03 +0200 Subject: [PATCH v4 3/7] 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: <20240311-qcom-pd-mapper-v4-3-24679cca5c24@linaro.org> References: <20240311-qcom-pd-mapper-v4-0-24679cca5c24@linaro.org> In-Reply-To: <20240311-qcom-pd-mapper-v4-0-24679cca5c24@linaro.org> To: Bjorn Andersson , Konrad Dybcio , Mathieu Poirier Cc: linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org, Johan Hovold X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=19359; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=yyW8nWc0CqXyntSJEUTYso3W/Uz8Y2nnwho22yOj1fI=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBl7yRrFrLlmSGd7sNfA6XJmZUHt/4DLSn/L1hl/ NNv1Qs33IiJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZe8kawAKCRCLPIo+Aiko 1SA6B/9eS6V6rV8V+sd9WI+ff3bM4ASK/wuNgNJjbXJxe9ZmpfMkLEdEoD/x2PWtsmMuMjS6S3N y5SmL6ES0PWC/JNynKWM8OHITmdLCxh1tMf1ND075LDHD+MP7kMr75H2o2y4sOHq0juct6Rj15W Yll++3wwdaf4k46Lbs2H01xMVET9URzy4Jhc7kMP+xnPioj1bMT6FnmHF05ycymwvwKUYYA7nvk fKK83a78rO30Qc/oOZBJz0RwxrU4XXqIkdN1qiAtHxKPBpvos0fu8IJv8BNYUMZddboZ1ijBqzr zpn61+N4/gKF+jMhArtboK2g9pHSAbfsObvg7KlEfJziWog3 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 | 346 +++++++++++++++++++++++++++++++++++++ drivers/soc/qcom/qcom_pdm_msg.c | 188 ++++++++++++++++++++ drivers/soc/qcom/qcom_pdm_msg.h | 66 +++++++ include/linux/soc/qcom/pd_mapper.h | 39 +++++ 6 files changed, 651 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..9d14b18b8590 --- /dev/null +++ b/drivers/soc/qcom/qcom_pdm.c @@ -0,0 +1,346 @@ +// 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; +} + +static int qcom_pdm_add_domain_locked(const struct qcom_pdm_domain_data *data) +{ + int ret; + int i; + + ret = qcom_pdm_add_service_domain_locked(TMS_SERVREG_SERVICE, + data->domain, + data->instance_id); + if (ret) + return ret; + + 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; + } + + 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); + + return ret; +} + +static void qcom_pdm_del_domain_locked(const struct qcom_pdm_domain_data *data) +{ + int i; + + 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); +} + +int qcom_pdm_add_domains(const struct qcom_pdm_domain_data * const *data, size_t num_data) +{ + int ret; + int i; + + mutex_lock(&qcom_pdm_mutex); + + if (qcom_pdm_server_added) { + ret = qmi_del_server(&qcom_pdm_handle, SERVREG_QMI_SERVICE, + SERVREG_QMI_VERSION, SERVREG_QMI_INSTANCE); + if (ret) + goto err_out; + } + + for (i = 0; i < num_data; i++) { + ret = qcom_pdm_add_domain_locked(data[i]); + if (ret) + goto err; + } + + ret = qmi_add_server(&qcom_pdm_handle, SERVREG_QMI_SERVICE, + SERVREG_QMI_VERSION, SERVREG_QMI_INSTANCE); + if (ret) { + pr_err("PDM: error adding server %d\n", ret); + goto err; + } + + qcom_pdm_server_added = true; + + mutex_unlock(&qcom_pdm_mutex); + + return 0; + +err: + while (--i >= 0) + qcom_pdm_del_domain_locked(data[i]); + + qmi_add_server(&qcom_pdm_handle, SERVREG_QMI_SERVICE, + SERVREG_QMI_VERSION, SERVREG_QMI_INSTANCE); + +err_out: + mutex_unlock(&qcom_pdm_mutex); + + return ret; +} +EXPORT_SYMBOL_GPL(qcom_pdm_add_domains); + +void qcom_pdm_del_domains(const struct qcom_pdm_domain_data * const *data, size_t num_data) +{ + int i; + + mutex_lock(&qcom_pdm_mutex); + + if (qcom_pdm_server_added) { + qmi_del_server(&qcom_pdm_handle, SERVREG_QMI_SERVICE, + SERVREG_QMI_VERSION, SERVREG_QMI_INSTANCE); + } + + for (i = 0; i < num_data; i++) + qcom_pdm_del_domain_locked(data[i]); + + qmi_add_server(&qcom_pdm_handle, SERVREG_QMI_SERVICE, + SERVREG_QMI_VERSION, SERVREG_QMI_INSTANCE); + qcom_pdm_server_added = true; + + mutex_unlock(&qcom_pdm_mutex); +} +EXPORT_SYMBOL_GPL(qcom_pdm_del_domains); + +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; + + 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_debug("PDM: found %s / %d\n", domain->name, + domain->instance_id); + } + } + + } + + mutex_unlock(&qcom_pdm_mutex); + + pr_debug("PDM: service '%s' offset %d returning %d domains (of %d)\n", req->name, + req->offset_valid ? req->offset : -1, 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..86438b7ca6fe --- /dev/null +++ b/include/linux/soc/qcom/pd_mapper.h @@ -0,0 +1,39 @@ +/* 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_domains(const struct qcom_pdm_domain_data * const *data, + size_t num_data); +void qcom_pdm_del_domains(const struct qcom_pdm_domain_data * const *data, + size_t num_data); + +#else + +static inline int qcom_pdm_add_domains(const struct qcom_pdm_domain_data * const *data, + size_t num_data) +{ + return 0; +} + +static inline void qcom_pdm_del_domains(const struct qcom_pdm_domain_data * const *data, + size_t num_data) +{ +} + +#endif + +#endif From patchwork Mon Mar 11 15:34:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 779488 Received: from mail-lj1-f174.google.com (mail-lj1-f174.google.com [209.85.208.174]) (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 4C89546447 for ; Mon, 11 Mar 2024 15:34:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710171252; cv=none; b=JZW1t44/+3mkXKZZQcUoF7MqkWANQ3/cNvtay3LU7Cj4mFV+BgzE5CMj3IIRML4jMStwfBdlwsPkkmN3vV+hykr0JoEghihClNap7uQVjzmwizjFmzkdkaZdoLHEt+gB0ZAiZAT5MOpSiblG80K7SiYpaEJrKAqtnxhvBDNB9MY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710171252; c=relaxed/simple; bh=/rRox2SCMp2aPtxhw0s9fG7CibeCKgCzG+KHihK7+cQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=d475Tt/LRp5MHkgoaAuioAu/4bjFP+1045Ph5zKr06nHoyxdvGDWAS/sb9mHVc2qqkxgLV2IuoN8AFsiVlB6z1LE7+fwNjVIO9XSDDcj59QE420IkJccmXzU2AEHT7Nv6pPfN6UeWtshh4wepmoKBarF6yJIF10uXj2B2fwZ+3s= 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=qSHpmVzO; arc=none smtp.client-ip=209.85.208.174 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="qSHpmVzO" Received: by mail-lj1-f174.google.com with SMTP id 38308e7fff4ca-2d2505352e6so67371651fa.3 for ; Mon, 11 Mar 2024 08:34:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710171248; x=1710776048; 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=v9pNS053BRSrQf0GTpDy4CzUV8zEU4LHHAl3/IMUQ5g=; b=qSHpmVzOPKnPkq9m7Fx/yDI9Y8BemxD0NFUvzPKEPg7Yw5p2aFkIO9Tvgdl3GDl7zp 9y1jWk8q2lKm1KjPGXRrkh1yYVWKGutjzt/5XfoK31yALhwAJSSwbf45V3O1ox3W/zIl JeTMfwTCI3a/mzr7PY0A29R4nbegAWo/5UCyUB2wNTXi+jeqtn+2Sxp53j6VBCKDIeQl dkv3D/ZTaFmjfVndQT2LlxuFcVNK1AoD/DYpR7VkE4l7gLX3dyNAwqup8wh2eDcQzYAA CDuHl6fQ6w50xx44NAgZFoXp6hZS4tiPUX4WYdjN9rMwCA+SOR5ljb8r4vuhJVigA5rv BP/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710171248; x=1710776048; 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=v9pNS053BRSrQf0GTpDy4CzUV8zEU4LHHAl3/IMUQ5g=; b=ht3BZcJhlnXaKYHVmRp7x98WcC/myJ3POfGRmEpRBF9e+CYlDLKc46BpdUXnGC1On0 wmLsFqE5o+K3djH5ii/vnx2bCv1LnxQKdhCM7L45us8+tvNhU1s9Dlpfnq2SLw9WKAOl TRHltXc4TTufUR0YZEcQRBqlQmWjtDCUjxP9vRnDF6kTMGajqQ+NuOfs8Q92A9VdTIzN vd6DZbtsdkzC3qff9soD4XFql9br+vaup+K+9wnlwAX2QvnWxWVqaYE+pb1RppDrUhr2 aJ+iv0iZOLvPnDdGOeMVHZjeXCr8oL5T0xxaxDyBKaiwxtgos+WS/9ItRlBWEr46elGe RKYw== X-Gm-Message-State: AOJu0Yww/b9T4Qsy7YMq5WSO3OIq9GZc6T2VqeIXpPngrphZrCyPLU+7 +S4NMThA50G2W6fSd+KALhSpfZDn4PpjTeB/MV/SkYyGrz31sU5Mjf/xCWgnVfg= X-Google-Smtp-Source: AGHT+IGHrr/40zH6l6XcVU6ripxwLJlGeA1jdobwtPgb87/UbiBVpjR2tKXNGtH9WVT+k2K0SUtqZg== X-Received: by 2002:a2e:7a0d:0:b0:2d2:e44e:a5cc with SMTP id v13-20020a2e7a0d000000b002d2e44ea5ccmr3952716ljc.46.1710171248533; Mon, 11 Mar 2024 08:34:08 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id q19-20020a2e9153000000b002d449f736ddsm119294ljg.0.2024.03.11.08.34.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 08:34:08 -0700 (PDT) From: Dmitry Baryshkov Date: Mon, 11 Mar 2024 17:34:04 +0200 Subject: [PATCH v4 4/7] 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: <20240311-qcom-pd-mapper-v4-4-24679cca5c24@linaro.org> References: <20240311-qcom-pd-mapper-v4-0-24679cca5c24@linaro.org> In-Reply-To: <20240311-qcom-pd-mapper-v4-0-24679cca5c24@linaro.org> To: Bjorn Andersson , Konrad Dybcio , Mathieu Poirier Cc: linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org, Johan Hovold X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=4313; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=/rRox2SCMp2aPtxhw0s9fG7CibeCKgCzG+KHihK7+cQ=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBl7yRr9pHLjHae9zAu0qKs64ChMHNWt4YnJ11xz +F9j5HYDYaJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZe8kawAKCRCLPIo+Aiko 1Zo+CACZp8M/mhg2oF2BTzPGLm8EAWhyAwUGCNLIhyET4QAAxo4W99wudk6F5b6PHdoVbjAfZEm e5X1HQ9MaVnjLJx6Ri0rlwN32GUxcyz8z30Cf6UB0CWjMc8ABEFKIkTDeIw8i8jCYZcyWf/iftC 7IW4CuOeuBxCDY56FNwicovNyTD4ZpLFkHkhF4al8eIMDL8eMBawGF38AL4+iRtqLCiV52nFZtg Znxp1l52sfytQWGg9vQVrPAYKTOcSeC55wFHc2P5hPRifL/jt5TJmZ19E/XQtYlA4+ixpDDPyQY TpP4ke+nGdyJ1dpjeqz0PaitItyxUawAKsJgR4JWvYLRi8Sf 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. Reviewed-by: Konrad Dybcio Signed-off-by: Dmitry Baryshkov --- drivers/remoteproc/qcom_q6v5_pas.c | 124 ++++++++++++++++++------------------- 1 file changed, 62 insertions(+), 62 deletions(-) diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q6v5_pas.c index d0b1f0f38347..3235249d703d 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 = { @@ -906,17 +906,17 @@ static const struct adsp_data sm8350_adsp_resource = { }; 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 +1063,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 Mon Mar 11 15:34:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 779816 Received: from mail-lj1-f174.google.com (mail-lj1-f174.google.com [209.85.208.174]) (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 20A0E47768 for ; Mon, 11 Mar 2024 15:34:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710171253; cv=none; b=NFN5boUWU3l26NhlGhZA0ILg96kTtMGFa4gkCOHiBG8/FO9pVGbZbEJttcYr6Iz2nwTY9KfXRlYFKF0DwWBRVik7ZrZ8eG8XGtOd+mhysUzVVdKINuT4OiDAAoJc3EafYD3mhNgXFPtPxdpUSwmPN3URAPowjwnMkAClQYw4H1o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710171253; c=relaxed/simple; bh=H+7tUoihHYqF5r5UVf1/wYRNC8Tr92OKX0+0qwurl4w=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Hxk2EvWLxsOpI0dAM/iBItaTcYpam2L9oVJ11f9VNJHB0VSQHTshboz1HHqYU0u0V4EG4exjNjbqLsdQKPbhLX7uovtEdPPtwlmIGDF7E43EC2XYc3MLdIwhUFb57E54ghEJCxaFJMtxkRzWmmOIxjQEymyMgYpr/DjyysmZyBo= 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=x/YiTwQT; arc=none smtp.client-ip=209.85.208.174 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="x/YiTwQT" Received: by mail-lj1-f174.google.com with SMTP id 38308e7fff4ca-2d3b93e992aso37445131fa.1 for ; Mon, 11 Mar 2024 08:34:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710171249; x=1710776049; 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=n5ilYydEiqSLSrOwKis6ciNK0Pj1JGODeYLFp0wqCzM=; b=x/YiTwQTybAYlo27rdIH8zxgFQvRbwT4ZdBbJ3/o9gTMBjW3zLyACSNX3kcVYY1D12 vCXcA9Br6qEUoFGz3pNRn3VmG9zIHgd67z9g1AKX2DnnOgv8TPI/Ma4fKfe2w6rJfcZQ rGQIo7LWSis8MZBasujHbS+GizNNHd6lp3yXCkf8pEvuL1t8vy72X6/B1gNChVs/18KH z9HV6yAKW4H/RQGjtUxpqAfpL3P0HK6Nfafm7GBfaxqdRsIuAqEPAv8k5NfpnZ92fLXR G7Jus+w6K+0jGcTVoy88SpDIPbCh9dnfkTucV4XLdhUV/RZL2qcJ0VI4bYHZ5wtXMCgJ yRiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710171249; x=1710776049; 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=n5ilYydEiqSLSrOwKis6ciNK0Pj1JGODeYLFp0wqCzM=; b=ko891ROdqjtMZW3TRP9smflAD6SIWPWC92MhhsFTwimfv7ZMY5iPK0PLuSD/nhRy0l PVaFHtiI2n6CgXcR6pv6w8/2RkwhG52TKYeBgqZBvg1M8xg2g07XIUNC1ytfAqLICYez ueLnVGwtGgio0KeBw8rh4W/DtSl4Y2y0t+JuoTGCIcKU/1gd+rVI1Ltx6tyx9FOgpUNv RygKRjJpU2WyB7g0W4TMJQEaoqjRVQbPvB9vTVI+XI0S3pX3IyJ/iKJ7mw+nhbooBwmV 9BddTrfooOT0+nm52gL4QVQW9O3daeLVYaWCxH77joOC0NICXtziLqDQwB5UU08Q+qB3 f4Yw== X-Gm-Message-State: AOJu0Yy8HXJid8IRdSxJaf7+7dpPM6WNEZWk0WtNgYYeUdaPO/TXu9zn JlIgHtF3PbV7/CEefO7jHsxxEzqNZT9Fkr4BCBebPelHEVaQyzXpCTfQ5O3cakIAAGiET9bwGQ+ W X-Google-Smtp-Source: AGHT+IHL6VWjwnd+j76MCgGB5r0cTsHDs5y81dIMXiS7lUCztljwktPllr+GgO/fGlTAqL9TnFBNBw== X-Received: by 2002:a2e:88d4:0:b0:2d2:ed31:9fb7 with SMTP id a20-20020a2e88d4000000b002d2ed319fb7mr5517481ljk.4.1710171249458; Mon, 11 Mar 2024 08:34:09 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id q19-20020a2e9153000000b002d449f736ddsm119294ljg.0.2024.03.11.08.34.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 08:34:08 -0700 (PDT) From: Dmitry Baryshkov Date: Mon, 11 Mar 2024 17:34:05 +0200 Subject: [PATCH v4 5/7] 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: <20240311-qcom-pd-mapper-v4-5-24679cca5c24@linaro.org> References: <20240311-qcom-pd-mapper-v4-0-24679cca5c24@linaro.org> In-Reply-To: <20240311-qcom-pd-mapper-v4-0-24679cca5c24@linaro.org> To: Bjorn Andersson , Konrad Dybcio , Mathieu Poirier Cc: linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org, Johan Hovold X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=6168; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=H+7tUoihHYqF5r5UVf1/wYRNC8Tr92OKX0+0qwurl4w=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBl7yRrRIE66O/Kw69GLj5yNndJTnZNdbXXE5VS7 c2hRCfYrp6JATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZe8kawAKCRCLPIo+Aiko 1XqyB/9r2ccjRrPPhOYJUOkK5ego1W5aXAhZJVzdcdTc5n6DIjJviJoq0Uy34A8OYfszAO3U0Ne owLRMRY1aAh6KDi5zhBATf5bPSbvhaqxAp8pyNoZYP+CbvCnDa4SJEMC1jwxzW959DQtPr71Kt9 HW7m06cHw/BdXJ1J2WQ+VEYr8wRKFvhQ5Y5yiJHWKj0ZisIZQcd5vKzfR2hDoh1iT0N3BfwzP1e GXxk/KGc6vnBwqiXFh4gdzWdWeW0IFCXqNbm13rpDX/UcOjYA61DzV6VeBLd16E95h+eoQgibLL KwiLWZUUWYs/1FcKP4YkgzIlr6bPntVHcMd11JyXR/qcqGZZ 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 | 82 ++++++++++++++++++++++++++++++++++--- 2 files changed, 78 insertions(+), 5 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..ea74ca730a50 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, @@ -375,10 +382,14 @@ static int adsp_start(struct rproc *rproc) int ret; unsigned int val; - ret = qcom_q6v5_prepare(&adsp->q6v5); + ret = qcom_pdm_add_domains(adsp->domains, adsp->num_domains); if (ret) return ret; + ret = qcom_q6v5_prepare(&adsp->q6v5); + if (ret) + goto del_domains; + ret = adsp_map_carveout(rproc); if (ret) { dev_err(adsp->dev, "ADSP smmu mapping failed\n"); @@ -446,6 +457,8 @@ static int adsp_start(struct rproc *rproc) adsp_unmap_carveout(rproc); disable_irqs: qcom_q6v5_unprepare(&adsp->q6v5); +del_domains: + qcom_pdm_del_domains(adsp->domains, adsp->num_domains); return ret; } @@ -478,6 +491,8 @@ static int adsp_stop(struct rproc *rproc) if (handover) qcom_adsp_pil_handover(&adsp->q6v5); + qcom_pdm_del_domains(adsp->domains, adsp->num_domains); + return ret; } @@ -690,6 +705,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 +781,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 +845,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 +862,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", @@ -811,6 +881,8 @@ static const struct adsp_pil_data cdsp_resource_init = { .num_clks = 7, .pd_names = (const char*[]) { "cx" }, .num_pds = 1, + .domains = qcs404_cdsp_domains, + .num_domains = ARRAY_SIZE(qcs404_cdsp_domains), }; static const struct adsp_pil_data wpss_resource_init = { @@ -831,10 +903,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); From patchwork Mon Mar 11 15:34:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 779487 Received: from mail-lj1-f181.google.com (mail-lj1-f181.google.com [209.85.208.181]) (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 DB4A34776A for ; Mon, 11 Mar 2024 15:34:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710171253; cv=none; b=preLoIddBWKbnXVsAcFtbTLHbAcj9y50XEUYtokmmupWK+WGRh8sfITwIOc3uIcrFXH7smk23F85LBB8MSqSpWJQZeQ8Qh25xJGl6Imo9F0OBL7KJEpV2LgTqw0tRjnH94tC8g9Awl0nGrv8LVzCORt7pWORHudFt9Oaux/ZhKU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710171253; c=relaxed/simple; bh=HezEmRJ2gh2lp9Ogvu/1P0/j8r2F0Fge3IiGQ4ToCc8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=g17ycuvVXtX4iA8YMCVUJGnvC2PgXGgy+OQKQSFoCLOXrxQ6/u+LNONiCXJhcs+taLPEXikICB6QKrUoL3ayWR6zwPLMHLb/qkLal2wOSJ8q8nGDRDN2895idbFXEFOFFBhtwZqtO74jVJB5F816FirpNCunVxQltUIcd27Mp1E= 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=sLN8FHOH; arc=none smtp.client-ip=209.85.208.181 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="sLN8FHOH" Received: by mail-lj1-f181.google.com with SMTP id 38308e7fff4ca-2d23114b19dso61379391fa.3 for ; Mon, 11 Mar 2024 08:34:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710171250; x=1710776050; 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=6XjcOkTFMVp9cyWMILHcQ5nIdsorgS8uraxiKcFmnJk=; b=sLN8FHOHNEQtWZz4a9oRf7NlvYTvev51huJIqf/D2yq3aWbcnlCLYoEzVzC9tj+PTp Y2G6TPcK1xGrlaM2xY+ieFBKGWXuqxIo9DuAUvGyKVk8Y0kRuqr5To9hxyotgIXLLfmi 8D409xed1gDD7PVO4E6JCTUlIwuYG1FZ68cNMdEb/HBpSkgLnhaRPusgtS03K38Q+C2S q5w8T+qKDspeXYYMIfOWD1jAvl+owrIETF3lMe3IL01pnrIDOP45XE2dlA3rat78YSNq NaFwTJrua4K8+Prd3t2u71cyGY6QoqcFKmvxCE2ouirbDJALxOPw1wqs5f8t4khtdtAx ioMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710171250; x=1710776050; 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=6XjcOkTFMVp9cyWMILHcQ5nIdsorgS8uraxiKcFmnJk=; b=hDGzbWYGf7sgMF5AhViQfHJsNpny2rJRRJDgkO/YH04jhnF/b41BI1HbH9t/oETCvR G3AxOr19YSqFdFp+luG8CozTnBxFJJO7zcXUBqUNZJIYkqenmfJnVYsZpXhMlfGhwmnA wp0fh61QELsEEP4BqZcZIW2trce1NNSb1FXm9EymM+WldIX4kESTgVP69XiAcf/THWm1 LdtOPOiJJbueNRUGdarfSoZ6b3hirXG3e+Xd5bd2W2b44+AygG5Nf0utgqOhf0kpLugq tMCZz3ttZu2GXzI/rNBlioV5X0drrIHEvhhIJeikBi1/jHtAbNJHHlE/A7N4W9Japb68 u0aQ== X-Gm-Message-State: AOJu0YwpK076qxTD8zy1xYnTI5QtJN+qORKLNrYj0/s1xItzVwCfh9Xv NHCl8iKL5c2Ievo7ClQWFU9J30y8EHQj9D/GNuaJvJlnz1S5yoEC8fNoYrKxhkL3Kot1V8sLPyO 8 X-Google-Smtp-Source: AGHT+IEJHDV9+YJcF3r9STr5+V5UzaPIbdJ7xsukEQC5f5EWnizGDDpGPguTdUPVqV6ej7kaF4S8aA== X-Received: by 2002:a2e:b8ce:0:b0:2d2:2ce1:1196 with SMTP id s14-20020a2eb8ce000000b002d22ce11196mr778022ljp.53.1710171250210; Mon, 11 Mar 2024 08:34:10 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id q19-20020a2e9153000000b002d449f736ddsm119294ljg.0.2024.03.11.08.34.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 08:34:09 -0700 (PDT) From: Dmitry Baryshkov Date: Mon, 11 Mar 2024 17:34:06 +0200 Subject: [PATCH v4 6/7] 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: <20240311-qcom-pd-mapper-v4-6-24679cca5c24@linaro.org> References: <20240311-qcom-pd-mapper-v4-0-24679cca5c24@linaro.org> In-Reply-To: <20240311-qcom-pd-mapper-v4-0-24679cca5c24@linaro.org> To: Bjorn Andersson , Konrad Dybcio , Mathieu Poirier Cc: linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org, Johan Hovold X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=5957; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=HezEmRJ2gh2lp9Ogvu/1P0/j8r2F0Fge3IiGQ4ToCc8=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBl7yRsr9KbdD0/8v6A38SRkevh8oemNsz8pdh0u IRWQbLZRRaJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZe8kbAAKCRCLPIo+Aiko 1QnvCACyMVpglQEo/y+Q6OcY62UpYO3+Qq0UDflPRu5hrYvAkXxNdPk8t6hTU1TwMJJU+LqgAwX ZT1VXbO5MimOzNgORmcUxtsfm+V5RKmFdImzfuzr6dI3SQjKLgjq21O7YCaS0mggX3Cat88agpd Tuf4+3UokY2KAU2Wa7b6ffWL+l1kicn7m26GWANEfH8vYILAXMpRgcA+p95ApdnjD/b2EvvECgW W1o6EA5IT2R7UwPvUSDDzHk9HgIWJlrAjP+dmPCrp8KPJIVojtUwTXQmuBLQyj/SexZzDLFNzWJ trEzx+m64UwxhykXM69EPBtl2zPnkm3uxqIy0D91tw+0o8Zi 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 | 80 +++++++++++++++++++++++++++++++++++++- 2 files changed, 80 insertions(+), 1 deletion(-) 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..d9ef874c3722 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 { @@ -1581,10 +1588,14 @@ static int q6v5_start(struct rproc *rproc) int xfermemop_ret; int ret; - ret = q6v5_mba_load(qproc); + ret = qcom_pdm_add_domains(qproc->domains, qproc->num_domains); if (ret) return ret; + ret = q6v5_mba_load(qproc); + if (ret) + goto del_domains; + dev_info(qproc->dev, "MBA booted with%s debug policy, loading mpss\n", qproc->dp_size ? "" : "out"); @@ -1614,6 +1625,9 @@ static int q6v5_start(struct rproc *rproc) q6v5_mba_reclaim(qproc); q6v5_dump_mba_logs(qproc); +del_domains: + qcom_pdm_del_domains(qproc->domains, qproc->num_domains); + return ret; } @@ -1628,6 +1642,8 @@ static int q6v5_stop(struct rproc *rproc) q6v5_mba_reclaim(qproc); + qcom_pdm_del_domains(qproc->domains, qproc->num_domains); + return 0; } @@ -2013,6 +2029,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 +2172,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 +2251,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 +2280,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 +2313,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 +2350,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 +2383,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 +2423,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 Mon Mar 11 15:34:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 779815 Received: from mail-lj1-f182.google.com (mail-lj1-f182.google.com [209.85.208.182]) (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 D9B1B47A76 for ; Mon, 11 Mar 2024 15:34:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710171255; cv=none; b=RTdCHSWbBNNWdZbUmmSxZZxKH7J8zadMZIzpBdsgrg2BH8bjGkvabP2CQ94RtGW3jbk4Bcfb8zvBiav8loSUmj7kyL1YZ2GAtSnP1zvhJL8my1/0JPkSa4wJQ5nKmQO2Zx7pNa9LczRSr7qN2Fva2pp0jFkleZHbVOcVfBX5eBo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710171255; c=relaxed/simple; bh=Pd5HxDxl3geke343h9KbZXy6UOUknIP4GOVz9j+JjA0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=A75H1kqnA4IYNoXNvpaVsuVHiLsh+zfE8NhAlQGGZY9Ei5IpN1z+gq/KjKEEMCM0KmhVYzjk6/v8ezkOGJPqC3qg/5ZQRkbcFH/eoNysX3itsMGdF8cXPqxoEfwYLtK7N9NoiQEXdQ8y66BJNQCyVBny0vZ/7OAYiYygHPbszWw= 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=kBXjLKXn; arc=none smtp.client-ip=209.85.208.182 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="kBXjLKXn" Received: by mail-lj1-f182.google.com with SMTP id 38308e7fff4ca-2d2991e8c12so42865841fa.0 for ; Mon, 11 Mar 2024 08:34:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1710171251; x=1710776051; 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=zlamnlsVA0iVCi4Vh7IzzVDyJZViPgeNcL9+iin29e4=; b=kBXjLKXnPWxQTPqMfUCNr1kru/KgyB9FSbLtaPCuFiCB5QKwgguvymd+GagtNKc/cA RsYYz1a4yH7/sIQbr38+c6K+/YKVxbz0mpmwoasYqxhH5uuBNQPPrevxPUxVzEAbND3X mqU9TYvVZyqvguLRsuu6S+qQ2SFyoLGcmqfx0tGpa+BmUYW3zlB2oUpq6sIKLmojgpxd TmUoS8jLpWFUgos77hWaNB/XcsvlXOo8PdveU4IFV45wWN8o6jxCmZ0LNzFnJYdZvOgg XdBITbmOm07hOxLCos1cRPIdxeLmQ7IDDWsXhMOKScj2xtIAPStwJh+AIl8efRBa4V0Y 6jAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710171251; x=1710776051; 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=zlamnlsVA0iVCi4Vh7IzzVDyJZViPgeNcL9+iin29e4=; b=lNe5/TrM5jqrDmRmk5R0q4jzdXVvCb5tOHhCKqTXo1FcWbf8vhc7YKcqSvMuWHwfHY uLTexxAHDgRe2jYu0GNohQ2rAyhJmtjNBWVgjZmclrRGAy+8sp35Ge9VypdATDUStvgl LfBP5UuIGYuKz6gHEGeuVYOwtY3h5o6o5qdHUKf5ottgvEc1kyX0JfZCExk54ZouJSzN af9mN1sblNQ8NWHlSiGGPJ76ZJv522m+6ySFg0VaotjQ45F2tcu4OCdUccWRU7HGGmLx jvryF1UF46dfOge8rfVCus2AqSpygH7ERbXDp5QVfH2pSSCqXl1RLZEZjKAx3e4uHtCL 2bHw== X-Gm-Message-State: AOJu0YyNbgH4rNBiLACJTrRIrkUghx+gd2+qZQhEnIYxklw8i8Zyoxm2 IjNTniS2e7/JKptaWo4vZ9IzylXfYuTQAUJJBbOtTIl7vYtE7VrUp1eg/wWLjHI= X-Google-Smtp-Source: AGHT+IHjXejVF42d/WzWwSOsygPmEQ94GYnz58jHgRGnva8MYbSxThsPodaRtvcsmSnmkb4ZMNAN/Q== X-Received: by 2002:a2e:a98c:0:b0:2d4:3b87:8b88 with SMTP id x12-20020a2ea98c000000b002d43b878b88mr1561717ljq.14.1710171251002; Mon, 11 Mar 2024 08:34:11 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id q19-20020a2e9153000000b002d449f736ddsm119294ljg.0.2024.03.11.08.34.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Mar 2024 08:34:10 -0700 (PDT) From: Dmitry Baryshkov Date: Mon, 11 Mar 2024 17:34:07 +0200 Subject: [PATCH v4 7/7] 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: <20240311-qcom-pd-mapper-v4-7-24679cca5c24@linaro.org> References: <20240311-qcom-pd-mapper-v4-0-24679cca5c24@linaro.org> In-Reply-To: <20240311-qcom-pd-mapper-v4-0-24679cca5c24@linaro.org> To: Bjorn Andersson , Konrad Dybcio , Mathieu Poirier Cc: linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org, Johan Hovold X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=22975; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=Pd5HxDxl3geke343h9KbZXy6UOUknIP4GOVz9j+JjA0=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBl7yRs5KcapInXDkg+qmguNmy22Xyb1gZvWBaoT Vr78RXragKJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZe8kbAAKCRCLPIo+Aiko 1UnuB/90VGsMGAuiI4VY4WsE9ClTUOzGq5Jt3IaSCjdmnB7jtuODKCtzPZKLzdfyl5AnPL5IOwY LIdTqoLxOfgUm4Q6WtcrktDLM55gSCCwUZ82YflUXELOSDtKAFViXtoR/a5USwZ9RUbYMgiCed2 EC/G5yhFsktH+e4bUo7xDAFEwiNAmfQNF5gG5t8BNnwGVZmFs3+37MVSyROMqiDxbcPELcCGZIf 82kjCy0QqvbjeqvsRYmWrn0nm7cZ8NH9URfVOrK8+Jc7Ylh7svYW7KMFPjnLsS9XyJY/rrDb/QJ WzmKl+anG32/YX5QjJAhWWDGtrBKWG1yjjZ3DCVbUX28EyE3 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 | 370 +++++++++++++++++++++++++++++++++++-- 2 files changed, 354 insertions(+), 17 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 3235249d703d..ba53df7ea30e 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, @@ -256,10 +263,14 @@ static int adsp_start(struct rproc *rproc) struct qcom_adsp *adsp = rproc->priv; int ret; - ret = qcom_q6v5_prepare(&adsp->q6v5); + ret = qcom_pdm_add_domains(adsp->domains, adsp->num_domains); if (ret) return ret; + ret = qcom_q6v5_prepare(&adsp->q6v5); + if (ret) + goto del_domains; + ret = adsp_pds_enable(adsp, adsp->proxy_pds, adsp->proxy_pd_count); if (ret < 0) goto disable_irqs; @@ -348,6 +359,9 @@ static int adsp_start(struct rproc *rproc) disable_irqs: qcom_q6v5_unprepare(&adsp->q6v5); +del_domains: + qcom_pdm_del_domains(adsp->domains, adsp->num_domains); + /* Remove pointer to the loaded firmware, only valid in adsp_load() & adsp_start() */ adsp->firmware = NULL; @@ -394,6 +408,8 @@ static int adsp_stop(struct rproc *rproc) if (handover) qcom_pas_handover(&adsp->q6v5); + qcom_pdm_del_domains(adsp->domains, adsp->num_domains); + return ret; } @@ -730,6 +746,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 +826,172 @@ 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 *sc7180_adsp_domains[] = { + &adsp_audio_pd, + &adsp_root_pd_pdr, + &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_root_pd_gps_pdr = { + .domain = "msm/modem/root_pd", + .instance_id = 180, + .services = { + "gps/gps_service", + "tms/pdr_enabled", + 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 *sc7180_mpss_domains[] = { + &mpss_root_pd_gps_pdr, + &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 +1000,55 @@ 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 = { + .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 sc7180_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 = sc7180_adsp_domains, + .num_domains = ARRAY_SIZE(sc7180_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 +1060,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 = { + .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 +1090,8 @@ static const struct adsp_data sm6350_adsp_resource = { .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 sm6375_mpss_resource = { @@ -856,6 +1107,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 +1123,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 +1141,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,6 +1159,8 @@ static const struct adsp_data sm8350_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 msm8996_adsp_resource = { @@ -917,9 +1175,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 = { .crash_reason_smem = 601, .firmware_name = "cdsp.mdt", .pas_id = 18, @@ -927,6 +1187,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 = { @@ -938,6 +1200,8 @@ 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 sm6350_cdsp_resource = { @@ -954,6 +1218,8 @@ static const struct adsp_data sm6350_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 sm8150_cdsp_resource = { @@ -969,6 +1235,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 = { @@ -984,6 +1252,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 = { @@ -998,6 +1268,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 = { @@ -1012,6 +1284,7 @@ static const struct adsp_data sc8280xp_nsp1_resource = { .ssr_name = "cdsp1", .sysmon_name = "cdsp1", .ssctl_id = 0x20, + // TODO: domains }; static const struct adsp_data sm8350_cdsp_resource = { @@ -1028,9 +1301,11 @@ 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 = { +static const struct adsp_data sc7180_mpss_resource = { .crash_reason_smem = 421, .firmware_name = "modem.mdt", .pas_id = 4, @@ -1045,6 +1320,27 @@ static const struct adsp_data mpss_resource_init = { .ssr_name = "mpss", .sysmon_name = "modem", .ssctl_id = 0x12, + .domains = sc7180_mpss_domains, + .num_domains = ARRAY_SIZE(sc7180_mpss_domains), +}; + +static const struct adsp_data sc7280_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 = sm8350_mpss_domains, + .num_domains = ARRAY_SIZE(sm8350_mpss_domains), }; static const struct adsp_data sc8180x_mpss_resource = { @@ -1060,6 +1356,27 @@ 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 msm8996_slpi_resource_init = { @@ -1074,6 +1391,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 = { @@ -1090,9 +1408,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 = { .crash_reason_smem = 421, .firmware_name = "wcnss.mdt", .pas_id = 6, @@ -1100,6 +1420,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 = { @@ -1115,6 +1437,7 @@ static const struct adsp_data sdx55_mpss_resource = { .ssr_name = "mpss", .sysmon_name = "modem", .ssctl_id = 0x22, + // TODO: domains }; static const struct adsp_data sm8450_mpss_resource = { @@ -1133,6 +1456,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 = { @@ -1152,6 +1477,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 = { @@ -1172,6 +1499,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 = { @@ -1195,6 +1524,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 = { @@ -1235,6 +1566,8 @@ static const struct adsp_data sm8650_cdsp_resource = { .region_assign_count = 1, .region_assign_shared = true, .region_assign_vmid = QCOM_SCM_VMID_CDSP, + .domains = sdm845_cdsp_domains, + .num_domains = ARRAY_SIZE(sdm845_cdsp_domains), }; static const struct adsp_data sm8650_mpss_resource = { @@ -1258,29 +1591,32 @@ static const struct adsp_data sm8650_mpss_resource = { .region_assign_idx = 2, .region_assign_count = 3, .region_assign_vmid = QCOM_SCM_VMID_MSS_MSA, + .domains = sm8350_mpss_domains, + .num_domains = ARRAY_SIZE(sm8350_mpss_domains), }; 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,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,qcs404-adsp-pas", .data = &qcs404_adsp_resource }, + { .compatible = "qcom,qcs404-cdsp-pas", .data = &qcs404_cdsp_resource }, + { .compatible = "qcom,qcs404-wcss-pas", .data = &qcs404_wcss_resource }, + { .compatible = "qcom,sc7180-adsp-pas", .data = &sc7180_adsp_resource}, + { .compatible = "qcom,sc7180-mpss-pas", .data = &sc7180_mpss_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}, { .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}, @@ -1288,18 +1624,18 @@ 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}, + { .compatible = "qcom,sm6115-cdsp-pas", .data = &qcs404_cdsp_resource}, { .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}, - { .compatible = "qcom,sm6350-mpss-pas", .data = &mpss_resource_init}, + { .compatible = "qcom,sm6350-mpss-pas", .data = &sm8150_mpss_resource}, { .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}, @@ -1307,7 +1643,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 = &sc7280_mpss_resource}, { .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},