From patchwork Fri Jan 28 02:55:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 12727823 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 99C4DC433FE for ; Fri, 28 Jan 2022 02:54:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345573AbiA1Cyu (ORCPT ); Thu, 27 Jan 2022 21:54:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241273AbiA1Cyt (ORCPT ); Thu, 27 Jan 2022 21:54:49 -0500 Received: from mail-oo1-xc2e.google.com (mail-oo1-xc2e.google.com [IPv6:2607:f8b0:4864:20::c2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7DA93C061714 for ; Thu, 27 Jan 2022 18:54:49 -0800 (PST) Received: by mail-oo1-xc2e.google.com with SMTP id c7-20020a4ad207000000b002e7ab4185d2so1141064oos.6 for ; Thu, 27 Jan 2022 18:54:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mMvqDo4o/ZptH9wsrReKbkSFrVe904arvpn9YDSHQs8=; b=LTAcL3dphdPohty6dcW1pBBA6UgY+g81dyLs2HLenLgXJayqlKy7WO1COIUBzWXOtQ 98oWM4bOqAysEorM08qNVUgIzGOI0Vlu94tmLKAoCZH3W4ZnQbwO4K3Jn+9yCbp1ivln tw0e9jCzJ0QhNtzndEvs1SD0avNEVG1I3jCqyFWHtvAW/xkLDONabluja3R3UuUTwisJ Dh73kigIxm3Vyg/7oIz2nwec1QWjLtvnMUh0I4p120Vmg4QFd7SKcBGqjFsE/lCYOgZy QeoO8WhvFxjag+MSJkwxreeNQ3gWife8g3nwTbb5lkPdqcioczloFXJehb7tjIPM1Klx pnAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mMvqDo4o/ZptH9wsrReKbkSFrVe904arvpn9YDSHQs8=; b=ryE65lajhfudPlLiJ2CnN+/r35aFqFgpjUd0i2RD4rxf7YtLpySfxAJQZTGYrJOO2M KPFJMCNl0ooymo3akvIz06KNFFt3Z3+rZVoQV0qzSjfmszCAow3Zn6BPnZ6veM2jr8sU A2nvhmBoNxwgixtxMv6XuL7ldDO2eed8CJ2l8rcpGgVAAZZFB9HLV+RGIyics3Q6GF94 pdgeHlSB8qhtRMolaw35WyZNPllqESjmLdlnMlPbCYKDulOV1k66oGhXfKehRS2tEOzD gip9o6d/0m9v6787R4dnb3neyxprQmu52L6NzS12qSqnDUwbz67MIunWGSOp+ds4Mqpi zJbw== X-Gm-Message-State: AOAM532WsC86mccAhKfw4agYeaCSs8UQu8MRkuC44brN9o5cKR6XfN7k O2gCZV64wBiKg30GWTs8GYaGdA== X-Google-Smtp-Source: ABdhPJwflWrHDGkphNOlxMYMDPSlfL6ZbyV+qs8klHHcrp/Gvzy2bO2LC5KDEaY+nyrZkhEUyf/60g== X-Received: by 2002:a05:6820:610:: with SMTP id e16mr3342746oow.69.1643338488823; Thu, 27 Jan 2022 18:54:48 -0800 (PST) Received: from ripper.. ([2600:1700:a0:3dc8:205:1bff:fec0:b9b3]) by smtp.gmail.com with ESMTPSA id k6sm5677352oop.28.2022.01.27.18.54.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 18:54:48 -0800 (PST) From: Bjorn Andersson To: Bjorn Andersson , Mathieu Poirier Cc: Rob Herring , linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 01/13] firmware: qcom: scm: Introduce pas_metadata context Date: Thu, 27 Jan 2022 18:55:01 -0800 Message-Id: <20220128025513.97188-2-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220128025513.97188-1-bjorn.andersson@linaro.org> References: <20220128025513.97188-1-bjorn.andersson@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org Starting with Qualcomm SM8450, some new security enhancements has been done in the secure world, which results in the requirement to keep the metadata segment accessible by the secure world from init_image() until auth_and_reset(). Introduce a "PAS metadata context" object that can be passed to init_image() for tracking the mapped memory and a related release function for client drivers to release the mapping once either auth_and_reset() has been invoked or in error handling paths on the way there. Signed-off-by: Bjorn Andersson --- drivers/firmware/qcom_scm.c | 39 ++++++++++++++++++++++++++++++----- drivers/soc/qcom/mdt_loader.c | 2 +- include/linux/qcom_scm.h | 10 ++++++++- 3 files changed, 44 insertions(+), 7 deletions(-) diff --git a/drivers/firmware/qcom_scm.c b/drivers/firmware/qcom_scm.c index 7db8066b19fd..3218d13cbf83 100644 --- a/drivers/firmware/qcom_scm.c +++ b/drivers/firmware/qcom_scm.c @@ -435,10 +435,16 @@ static void qcom_scm_set_download_mode(bool enable) * and optional blob of data used for authenticating the metadata * and the rest of the firmware * @size: size of the metadata + * @ctx: optional metadata context * - * Returns 0 on success. + * Return: 0 on success. + * + * Upon successful return, the PAS metadata context (@ctx) will be used to + * track the metadata allocation, this needs to be released by invoking + * qcom_scm_pas_metadata_release() by the caller. */ -int qcom_scm_pas_init_image(u32 peripheral, const void *metadata, size_t size) +int qcom_scm_pas_init_image(u32 peripheral, const void *metadata, size_t size, + struct qcom_scm_pas_metadata *ctx) { dma_addr_t mdata_phys; void *mdata_buf; @@ -467,7 +473,7 @@ int qcom_scm_pas_init_image(u32 peripheral, const void *metadata, size_t size) ret = qcom_scm_clk_enable(); if (ret) - goto free_metadata; + goto out; desc.args[1] = mdata_phys; @@ -475,13 +481,36 @@ int qcom_scm_pas_init_image(u32 peripheral, const void *metadata, size_t size) qcom_scm_clk_disable(); -free_metadata: - dma_free_coherent(__scm->dev, size, mdata_buf, mdata_phys); +out: + if (ret < 0 || !ctx) { + dma_free_coherent(__scm->dev, size, mdata_buf, mdata_phys); + } else if (ctx) { + ctx->ptr = mdata_buf; + ctx->phys = mdata_phys; + ctx->size = size; + } return ret ? : res.result[0]; } EXPORT_SYMBOL(qcom_scm_pas_init_image); +/** + * qcom_scm_pas_metadata_release() - release metadata context + * @ctx: metadata context + */ +void qcom_scm_pas_metadata_release(struct qcom_scm_pas_metadata *ctx) +{ + if (!ctx->ptr) + return; + + dma_free_coherent(__scm->dev, ctx->size, ctx->ptr, ctx->phys); + + ctx->ptr = NULL; + ctx->phys = 0; + ctx->size = 0; +} +EXPORT_SYMBOL(qcom_scm_pas_metadata_release); + /** * qcom_scm_pas_mem_setup() - Prepare the memory related to a given peripheral * for firmware loading diff --git a/drivers/soc/qcom/mdt_loader.c b/drivers/soc/qcom/mdt_loader.c index 72fc2b539213..b00586db5391 100644 --- a/drivers/soc/qcom/mdt_loader.c +++ b/drivers/soc/qcom/mdt_loader.c @@ -171,7 +171,7 @@ static int __qcom_mdt_load(struct device *dev, const struct firmware *fw, goto out; } - ret = qcom_scm_pas_init_image(pas_id, metadata, metadata_len); + ret = qcom_scm_pas_init_image(pas_id, metadata, metadata_len, NULL); kfree(metadata); if (ret) { diff --git a/include/linux/qcom_scm.h b/include/linux/qcom_scm.h index 81cad9e1e412..4d8371410b05 100644 --- a/include/linux/qcom_scm.h +++ b/include/linux/qcom_scm.h @@ -68,8 +68,16 @@ extern int qcom_scm_set_warm_boot_addr(void *entry, const cpumask_t *cpus); extern void qcom_scm_cpu_power_down(u32 flags); extern int qcom_scm_set_remote_state(u32 state, u32 id); +struct qcom_scm_pas_metadata { + void *ptr; + dma_addr_t phys; + ssize_t size; +}; + extern int qcom_scm_pas_init_image(u32 peripheral, const void *metadata, - size_t size); + size_t size, + struct qcom_scm_pas_metadata *ctx); +void qcom_scm_pas_metadata_release(struct qcom_scm_pas_metadata *ctx); extern int qcom_scm_pas_mem_setup(u32 peripheral, phys_addr_t addr, phys_addr_t size); extern int qcom_scm_pas_auth_and_reset(u32 peripheral); From patchwork Fri Jan 28 02:55:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 12727824 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 16F92C4167E for ; Fri, 28 Jan 2022 02:54:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345577AbiA1Cyv (ORCPT ); Thu, 27 Jan 2022 21:54:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345576AbiA1Cyu (ORCPT ); Thu, 27 Jan 2022 21:54:50 -0500 Received: from mail-oi1-x22a.google.com (mail-oi1-x22a.google.com [IPv6:2607:f8b0:4864:20::22a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4E043C061714 for ; Thu, 27 Jan 2022 18:54:50 -0800 (PST) Received: by mail-oi1-x22a.google.com with SMTP id v67so9774608oie.9 for ; Thu, 27 Jan 2022 18:54:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LcpZYrTZZbyun9fAq1Z6HAHR568TtSyO3q30sHVzyrg=; b=aYSSUv4UrsBBLlwEVb1eeQr+5jS54ssOzcW8avbJ5FO94VoNFTqfnrYEvomA4zBPrq 100BfiCNYfaFRZ5cQl3LjONgOLbPzRBSJt1P4/FU5IbiEEw0/7KkfqKxatcUymT7Sl2k InsKwRHGmIJazeR5DDO854gM9otPSqWbD6kxWw4YZi8NCoKdtIeLQpi811LKRUpnPFZw 5iceGaHP47f7IfSDz4zjd3zQAUVY7BtuIO/mdIIAZFWbKe8zsEncemfLdC/CUQm5X9Z2 r5AWYdLc866bNtEMwh0q6dl4eqKEpDQG+fmsGtZJ5UXXfP0/s9MeC3vdUwCGIfZ6G1h7 UvEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LcpZYrTZZbyun9fAq1Z6HAHR568TtSyO3q30sHVzyrg=; b=TKXLuTbNtQYmha4KJPvMz72Fey26NutJ9AONqYVJsDb5LMKNre7pasNnWN9myoOUyY Bzrxd+Nkc99YmSiTCgR9nmtvHZiX9UrKEK9QLDPb375hgGS8ja/eHXkws8m1r81jzprC P4MP7ub0qqJrzFgScWcDKqR3/h1H2PCt5Wg9vPTDeXsjR/6fH3X1FNYiCyr9YSQgU2ks jIC/VPMIbvZrq6cogW/i+UgZJThno35u1WEoQjBcQcQ9LsRcOSHEL/2STi5mEfP9XqAC OAchqBcsuqDbFudjsRZ+kqbVMFWOYm2Bf4v8mbODihjVxx6ciHSE3qzrsFigKB2shX92 OnZQ== X-Gm-Message-State: AOAM5317oiUKrHtRDK0QeeqS26OcpVCsAXODAQPZS0maAdVJjOgCddto wV2mAfXW1kI7qgz4tLMcEyT2Gw== X-Google-Smtp-Source: ABdhPJxXwAaYsLOeIwMHxNTMOEbWkKRk+eRrG+gSkgetkIek43FJ1geKBCagLXAC030j4XbR5JzpZg== X-Received: by 2002:a05:6808:14c9:: with SMTP id f9mr2977531oiw.251.1643338489702; Thu, 27 Jan 2022 18:54:49 -0800 (PST) Received: from ripper.. ([2600:1700:a0:3dc8:205:1bff:fec0:b9b3]) by smtp.gmail.com with ESMTPSA id k6sm5677352oop.28.2022.01.27.18.54.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 18:54:49 -0800 (PST) From: Bjorn Andersson To: Bjorn Andersson , Mathieu Poirier Cc: Rob Herring , linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 02/13] soc: qcom: mdt_loader: Split out split-file-loader Date: Thu, 27 Jan 2022 18:55:02 -0800 Message-Id: <20220128025513.97188-3-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220128025513.97188-1-bjorn.andersson@linaro.org> References: <20220128025513.97188-1-bjorn.andersson@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org Spotted in a SM8450 device, the hash metadata segment is split out in a separate .bNN file which means that the logic for loading split out segmenents needs to be duplicated in qcom_mdt_read_metadata(). Split out the existing logic to a helper function that can be used in both code paths. Signed-off-by: Bjorn Andersson --- drivers/soc/qcom/mdt_loader.c | 72 ++++++++++++++++++++--------------- 1 file changed, 41 insertions(+), 31 deletions(-) diff --git a/drivers/soc/qcom/mdt_loader.c b/drivers/soc/qcom/mdt_loader.c index b00586db5391..c9e5bdfac371 100644 --- a/drivers/soc/qcom/mdt_loader.c +++ b/drivers/soc/qcom/mdt_loader.c @@ -31,6 +31,44 @@ static bool mdt_phdr_valid(const struct elf32_phdr *phdr) return true; } +static ssize_t mdt_load_split_segment(void *ptr, const struct elf32_phdr *phdrs, + unsigned int segment, const char *fw_name, + struct device *dev) +{ + const struct elf32_phdr *phdr = &phdrs[segment]; + const struct firmware *seg_fw; + char *seg_name; + ssize_t ret; + + if (strlen(fw_name) < 4) + return -EINVAL; + + seg_name = kstrdup(fw_name, GFP_KERNEL); + if (!seg_name) + return -ENOMEM; + + sprintf(seg_name + strlen(fw_name) - 3, "b%02d", segment); + ret = request_firmware_into_buf(&seg_fw, seg_name, dev, + ptr, phdr->p_filesz); + if (ret) { + dev_err(dev, "error %zd loading %s\n", ret, seg_name); + kfree(seg_name); + return ret; + } + + if (seg_fw->size != phdr->p_filesz) { + dev_err(dev, + "failed to load segment %d from truncated file %s\n", + segment, seg_name); + ret = -EINVAL; + } + + release_firmware(seg_fw); + kfree(seg_name); + + return ret; +} + /** * qcom_mdt_get_size() - acquire size of the memory region needed to load mdt * @fw: firmware object for the mdt file @@ -127,22 +165,19 @@ void *qcom_mdt_read_metadata(const struct firmware *fw, size_t *data_len) EXPORT_SYMBOL_GPL(qcom_mdt_read_metadata); static int __qcom_mdt_load(struct device *dev, const struct firmware *fw, - const char *firmware, int pas_id, void *mem_region, + const char *fw_name, int pas_id, void *mem_region, phys_addr_t mem_phys, size_t mem_size, phys_addr_t *reloc_base, bool pas_init) { const struct elf32_phdr *phdrs; const struct elf32_phdr *phdr; const struct elf32_hdr *ehdr; - const struct firmware *seg_fw; phys_addr_t mem_reloc; phys_addr_t min_addr = PHYS_ADDR_MAX; phys_addr_t max_addr = 0; size_t metadata_len; - size_t fw_name_len; ssize_t offset; void *metadata; - char *fw_name; bool relocate = false; void *ptr; int ret = 0; @@ -154,14 +189,6 @@ static int __qcom_mdt_load(struct device *dev, const struct firmware *fw, ehdr = (struct elf32_hdr *)fw->data; phdrs = (struct elf32_phdr *)(ehdr + 1); - fw_name_len = strlen(firmware); - if (fw_name_len <= 4) - return -EINVAL; - - fw_name = kstrdup(firmware, GFP_KERNEL); - if (!fw_name) - return -ENOMEM; - if (pas_init) { metadata = qcom_mdt_read_metadata(fw, &metadata_len); if (IS_ERR(metadata)) { @@ -258,25 +285,9 @@ static int __qcom_mdt_load(struct device *dev, const struct firmware *fw, memcpy(ptr, fw->data + phdr->p_offset, phdr->p_filesz); } else if (phdr->p_filesz) { /* Firmware not large enough, load split-out segments */ - sprintf(fw_name + fw_name_len - 3, "b%02d", i); - ret = request_firmware_into_buf(&seg_fw, fw_name, dev, - ptr, phdr->p_filesz); - if (ret) { - dev_err(dev, "error %d loading %s\n", - ret, fw_name); + ret = mdt_load_split_segment(ptr, phdrs, i, fw_name, dev); + if (ret) break; - } - - if (seg_fw->size != phdr->p_filesz) { - dev_err(dev, - "failed to load segment %d from truncated file %s\n", - i, fw_name); - release_firmware(seg_fw); - ret = -EINVAL; - break; - } - - release_firmware(seg_fw); } if (phdr->p_memsz > phdr->p_filesz) @@ -287,7 +298,6 @@ static int __qcom_mdt_load(struct device *dev, const struct firmware *fw, *reloc_base = mem_reloc; out: - kfree(fw_name); return ret; } From patchwork Fri Jan 28 02:55:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 12727825 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81C87C41535 for ; Fri, 28 Jan 2022 02:54:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345591AbiA1Cyv (ORCPT ); Thu, 27 Jan 2022 21:54:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345585AbiA1Cyv (ORCPT ); Thu, 27 Jan 2022 21:54:51 -0500 Received: from mail-oi1-x236.google.com (mail-oi1-x236.google.com [IPv6:2607:f8b0:4864:20::236]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4FF7AC061747 for ; Thu, 27 Jan 2022 18:54:51 -0800 (PST) Received: by mail-oi1-x236.google.com with SMTP id s185so9827547oie.3 for ; Thu, 27 Jan 2022 18:54:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=vOanCSySDZmTUn1LqqVwq/prLxQXPGe2dFE2HwY+tRc=; b=Bq+ONCJneuMbBHf9kxpPG8WmOD0Eb1dgbQOsFxyeZVMHyHoT+uYByqwCu0VdaMoiR0 qMlL9UJ6lBs6YeNlQFj59L9cyvI826WQHIslfarIm7TSropMPQL5GN2vLkXpk4v7HS6X zqdJ1pCMJvgTkG7zFFfH6LEW0X+mbA+FB22pxTH7mtd0rRwsRyAtHoOfcnKMjwt5gHuN nXtY3uGJFRM1iowAUg4mOIKY+YX/XxQbUwZ2qn+q0bLAeMbkQcL0o72vlUd8jtjoVlxT PYEtMr7SkvHGF/2vtsyY0qXHml4TfeGhniBVngKFWon2pDM/P5TmSBjOZf1Lndklsr1M 2y3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=vOanCSySDZmTUn1LqqVwq/prLxQXPGe2dFE2HwY+tRc=; b=iU3bXuF8B+Xrdnlpvs6E5BMHNj3Y2zzdNryQ6dr3wQyQvCOQL2OthH6mtdDK7tOGy1 mT3yZ7PH2TUY18+jkzJToUS411HAg5cKHQz1wMirFZPbSbuGQb7ntZYXmO2ZqSc4VAjR 1SL4MBSj9imizqGZcxaooDMosyfNK7A+GfXHARBHZtQvKsHwR+pewc4oQ3vsFARC7638 +phFeBc6CCGJSKNAIQMnoF8S3G4LfChj4D+R6UKAyn0Aa/v92c/hRv5+4dbMifYh01gC 5jIBBTRlok+JImvxAW1Uu3TiQ6ZCk/UWoRX9sgEz9iuo8YzS09qV1SXq5G3kMr6GF164 3ovw== X-Gm-Message-State: AOAM532VfCUKq+vrOObpcX9fq6rs3Jl7SEdOfdaMqxD0zN6qVWyTnlV+ mspJNQKCpYDawhg0FH/pZO7Wtw== X-Google-Smtp-Source: ABdhPJwQw+JC6FRgLIV2UEMFwTOJiyKWKfSvMfln22ofFJ5qYzvyNpIpNppTEJbt0Fu5RqnXuVgk7g== X-Received: by 2002:a05:6808:201d:: with SMTP id q29mr9195342oiw.247.1643338490629; Thu, 27 Jan 2022 18:54:50 -0800 (PST) Received: from ripper.. ([2600:1700:a0:3dc8:205:1bff:fec0:b9b3]) by smtp.gmail.com with ESMTPSA id k6sm5677352oop.28.2022.01.27.18.54.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 18:54:50 -0800 (PST) From: Bjorn Andersson To: Bjorn Andersson , Mathieu Poirier Cc: Rob Herring , linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 03/13] soc: qcom: mdt_loader: Allow hash segment to be split out Date: Thu, 27 Jan 2022 18:55:03 -0800 Message-Id: <20220128025513.97188-4-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220128025513.97188-1-bjorn.andersson@linaro.org> References: <20220128025513.97188-1-bjorn.andersson@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org It's been observed that some firmware found in a Qualcomm SM8450 device has the hash table in a separate .bNN file. Use the newly extracted helper function to load this segment from the separate file, if it's determined that the hashes are not part of the already loaded firmware. In order to do this, the function needs access to the firmware basename and to provide more useful error messages a struct device to associate the errors with. Signed-off-by: Bjorn Andersson --- drivers/remoteproc/qcom_q6v5_mss.c | 7 ++++--- drivers/soc/qcom/mdt_loader.c | 29 +++++++++++++++++++++-------- include/linux/soc/qcom/mdt_loader.h | 6 ++++-- 3 files changed, 29 insertions(+), 13 deletions(-) diff --git a/drivers/remoteproc/qcom_q6v5_mss.c b/drivers/remoteproc/qcom_q6v5_mss.c index 43ea8455546c..a2c231a17b2b 100644 --- a/drivers/remoteproc/qcom_q6v5_mss.c +++ b/drivers/remoteproc/qcom_q6v5_mss.c @@ -928,7 +928,8 @@ static void q6v5proc_halt_axi_port(struct q6v5 *qproc, regmap_write(halt_map, offset + AXI_HALTREQ_REG, 0); } -static int q6v5_mpss_init_image(struct q6v5 *qproc, const struct firmware *fw) +static int q6v5_mpss_init_image(struct q6v5 *qproc, const struct firmware *fw, + const char *fw_name) { unsigned long dma_attrs = DMA_ATTR_FORCE_CONTIGUOUS; dma_addr_t phys; @@ -939,7 +940,7 @@ static int q6v5_mpss_init_image(struct q6v5 *qproc, const struct firmware *fw) void *ptr; int ret; - metadata = qcom_mdt_read_metadata(fw, &size); + metadata = qcom_mdt_read_metadata(fw, &size, fw_name, qproc->dev); if (IS_ERR(metadata)) return PTR_ERR(metadata); @@ -1289,7 +1290,7 @@ static int q6v5_mpss_load(struct q6v5 *qproc) /* Initialize the RMB validator */ writel(0, qproc->rmb_base + RMB_PMI_CODE_LENGTH_REG); - ret = q6v5_mpss_init_image(qproc, fw); + ret = q6v5_mpss_init_image(qproc, fw, qproc->hexagon_mdt_image); if (ret) goto release_firmware; diff --git a/drivers/soc/qcom/mdt_loader.c b/drivers/soc/qcom/mdt_loader.c index c9e5bdfac371..4372d8e38b29 100644 --- a/drivers/soc/qcom/mdt_loader.c +++ b/drivers/soc/qcom/mdt_loader.c @@ -121,13 +121,15 @@ EXPORT_SYMBOL_GPL(qcom_mdt_get_size); * * Return: pointer to data, or ERR_PTR() */ -void *qcom_mdt_read_metadata(const struct firmware *fw, size_t *data_len) +void *qcom_mdt_read_metadata(const struct firmware *fw, size_t *data_len, + const char *fw_name, struct device *dev) { const struct elf32_phdr *phdrs; const struct elf32_hdr *ehdr; size_t hash_offset; size_t hash_size; size_t ehdr_size; + ssize_t ret; void *data; ehdr = (struct elf32_hdr *)fw->data; @@ -149,14 +151,25 @@ void *qcom_mdt_read_metadata(const struct firmware *fw, size_t *data_len) if (!data) return ERR_PTR(-ENOMEM); - /* Is the header and hash already packed */ - if (ehdr_size + hash_size == fw->size) + /* Copy ELF header */ + memcpy(data, fw->data, ehdr_size); + + if (ehdr_size + hash_size == fw->size) { + /* Firmware is split and hash is packed following the ELF header */ hash_offset = phdrs[0].p_filesz; - else + memcpy(data + ehdr_size, fw->data + hash_offset, hash_size); + } else if (phdrs[1].p_offset + hash_size <= fw->size) { + /* Hash is in its own segment, but within the loaded file */ hash_offset = phdrs[1].p_offset; - - memcpy(data, fw->data, ehdr_size); - memcpy(data + ehdr_size, fw->data + hash_offset, hash_size); + memcpy(data + ehdr_size, fw->data + hash_offset, hash_size); + } else { + /* Hash is in its own segment, beyond the loaded file */ + ret = mdt_load_split_segment(data + ehdr_size, phdrs, 1, fw_name, dev); + if (ret) { + kfree(data); + return ERR_PTR(ret); + } + } *data_len = ehdr_size + hash_size; @@ -190,7 +203,7 @@ static int __qcom_mdt_load(struct device *dev, const struct firmware *fw, phdrs = (struct elf32_phdr *)(ehdr + 1); if (pas_init) { - metadata = qcom_mdt_read_metadata(fw, &metadata_len); + metadata = qcom_mdt_read_metadata(fw, &metadata_len, fw_name, dev); if (IS_ERR(metadata)) { ret = PTR_ERR(metadata); dev_err(dev, "error %d reading firmware %s metadata\n", diff --git a/include/linux/soc/qcom/mdt_loader.h b/include/linux/soc/qcom/mdt_loader.h index afd47217996b..46bdb7bace9a 100644 --- a/include/linux/soc/qcom/mdt_loader.h +++ b/include/linux/soc/qcom/mdt_loader.h @@ -23,7 +23,8 @@ int qcom_mdt_load_no_init(struct device *dev, const struct firmware *fw, const char *fw_name, int pas_id, void *mem_region, phys_addr_t mem_phys, size_t mem_size, phys_addr_t *reloc_base); -void *qcom_mdt_read_metadata(const struct firmware *fw, size_t *data_len); +void *qcom_mdt_read_metadata(const struct firmware *fw, size_t *data_len, + const char *fw_name, struct device *dev); #else /* !IS_ENABLED(CONFIG_QCOM_MDT_LOADER) */ @@ -51,7 +52,8 @@ static inline int qcom_mdt_load_no_init(struct device *dev, } static inline void *qcom_mdt_read_metadata(const struct firmware *fw, - size_t *data_len) + size_t *data_len, const char *fw_name, + struct device *dev) { return ERR_PTR(-ENODEV); } From patchwork Fri Jan 28 02:55:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 12727834 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2EA22C433EF for ; Fri, 28 Jan 2022 02:55:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345600AbiA1Cy4 (ORCPT ); Thu, 27 Jan 2022 21:54:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345597AbiA1Cyw (ORCPT ); Thu, 27 Jan 2022 21:54:52 -0500 Received: from mail-oo1-xc32.google.com (mail-oo1-xc32.google.com [IPv6:2607:f8b0:4864:20::c32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50EA6C061748 for ; Thu, 27 Jan 2022 18:54:52 -0800 (PST) Received: by mail-oo1-xc32.google.com with SMTP id u25-20020a4ad0d9000000b002e8d4370689so1136835oor.12 for ; Thu, 27 Jan 2022 18:54:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=txGDW+vVDj2W2Xqet7NzzdhFqerLTb4wuJyYtxok9TY=; b=WDTfn9Zdplh3vUbCWq7QDaOYswhbPZgLrDU7Idca2brCkDbrecG6l4IeehgwIaFpt7 0CWq4H876ocpEEu36uMfPuGrycu09gbKHZc2m/xMWaRHGBH1yRPl58Ncp7rb6GURuodJ UHj4emBzLOcSh12f2cYMyYGJG9aW1ftJP9OMM5/CEtTR5yV+SeWVmlX7wz8lzv5RFT+N 4MqCCtAJZ1V1gTSwWVuEV7Kgs95lfwAPSC7vbcPRiiFk5kAp6r5NAPLXvZP4Al6I1xz6 PkpIypAUsV3IF8wmxCLbQ/inezaedO5w/fvrvSzIFjGVGeTiV6V3QVbT0CFlMNTqKqL0 Dhbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=txGDW+vVDj2W2Xqet7NzzdhFqerLTb4wuJyYtxok9TY=; b=ltlp7qt4y1FsW7GDk0DBKGUpCMOyLoVIE3Z80FRRQunlp0u/ieomsSwtAcWjkvAivR gDT8nf8hFBSYwc254r1kYIxD097qKrr2W9alL8t2dZs2vW3/KfCVfh2vNreQmYHn7JYw kdMLZwjqnS8p/gNglmGoKZ8sVyE+P2LTHVqagvLj34dLGI4t612CBNNHVCs5DxMYFB5y uaIZ5T5eNkWq9MUQFTmYkLd3vVoqN0U3uUFxCpf8NlSgL/E+SsNtvwVDLe3wQaJoKZtZ 3jwjjytjhGXcJZ2wk3NlanrHEK3fo9MfkU23cvGZ84j3KsH/rx6KkB+yXkPQnlfdje/x blWA== X-Gm-Message-State: AOAM532T0k4remD5/U6M5iCbJZX4VNAWgUd3YI5OZFdkCB9X8jSidVr7 ufAj8DtRUkeD6gv+MLHw6t6rrg== X-Google-Smtp-Source: ABdhPJxSqTgv+YNq5SqLs4mVaSzwlS8QjMEf+bBoB/28CcmiVtXKTVpIEyxianfityAoGqI7U5hZdA== X-Received: by 2002:a4a:3f46:: with SMTP id x6mr3387000ooe.78.1643338491586; Thu, 27 Jan 2022 18:54:51 -0800 (PST) Received: from ripper.. ([2600:1700:a0:3dc8:205:1bff:fec0:b9b3]) by smtp.gmail.com with ESMTPSA id k6sm5677352oop.28.2022.01.27.18.54.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 18:54:51 -0800 (PST) From: Bjorn Andersson To: Bjorn Andersson , Mathieu Poirier Cc: Rob Herring , linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 04/13] soc: qcom: mdt_loader: Allow hash to reside in any segment Date: Thu, 27 Jan 2022 18:55:04 -0800 Message-Id: <20220128025513.97188-5-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220128025513.97188-1-bjorn.andersson@linaro.org> References: <20220128025513.97188-1-bjorn.andersson@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org It's been observed that some firmware found on Qualcomm SM8450 devices carries the hash segment as the last segment in the ELF. Extend the support to allow picking the hash from any segment in the MDT/MBN. Signed-off-by: Bjorn Andersson --- drivers/soc/qcom/mdt_loader.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/drivers/soc/qcom/mdt_loader.c b/drivers/soc/qcom/mdt_loader.c index 4372d8e38b29..c5bd13b05c1a 100644 --- a/drivers/soc/qcom/mdt_loader.c +++ b/drivers/soc/qcom/mdt_loader.c @@ -126,9 +126,11 @@ void *qcom_mdt_read_metadata(const struct firmware *fw, size_t *data_len, { const struct elf32_phdr *phdrs; const struct elf32_hdr *ehdr; + unsigned int hash_segment = 0; size_t hash_offset; size_t hash_size; size_t ehdr_size; + unsigned int i; ssize_t ret; void *data; @@ -141,11 +143,20 @@ void *qcom_mdt_read_metadata(const struct firmware *fw, size_t *data_len, if (phdrs[0].p_type == PT_LOAD) return ERR_PTR(-EINVAL); - if ((phdrs[1].p_flags & QCOM_MDT_TYPE_MASK) != QCOM_MDT_TYPE_HASH) + for (i = 1; i < ehdr->e_phnum; i++) { + if ((phdrs[i].p_flags & QCOM_MDT_TYPE_MASK) == QCOM_MDT_TYPE_HASH) { + hash_segment = i; + break; + } + } + + if (!hash_segment) { + dev_err(dev, "no hash segment found in %s\n", fw_name); return ERR_PTR(-EINVAL); + } ehdr_size = phdrs[0].p_filesz; - hash_size = phdrs[1].p_filesz; + hash_size = phdrs[hash_segment].p_filesz; data = kmalloc(ehdr_size + hash_size, GFP_KERNEL); if (!data) @@ -158,13 +169,13 @@ void *qcom_mdt_read_metadata(const struct firmware *fw, size_t *data_len, /* Firmware is split and hash is packed following the ELF header */ hash_offset = phdrs[0].p_filesz; memcpy(data + ehdr_size, fw->data + hash_offset, hash_size); - } else if (phdrs[1].p_offset + hash_size <= fw->size) { + } else if (phdrs[hash_segment].p_offset + hash_size <= fw->size) { /* Hash is in its own segment, but within the loaded file */ - hash_offset = phdrs[1].p_offset; + hash_offset = phdrs[hash_segment].p_offset; memcpy(data + ehdr_size, fw->data + hash_offset, hash_size); } else { /* Hash is in its own segment, beyond the loaded file */ - ret = mdt_load_split_segment(data + ehdr_size, phdrs, 1, fw_name, dev); + ret = mdt_load_split_segment(data + ehdr_size, phdrs, hash_segment, fw_name, dev); if (ret) { kfree(data); return ERR_PTR(ret); From patchwork Fri Jan 28 02:55:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 12727835 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4E4ECC433FE for ; Fri, 28 Jan 2022 02:55:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345644AbiA1CzR (ORCPT ); Thu, 27 Jan 2022 21:55:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52642 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345630AbiA1Cy4 (ORCPT ); Thu, 27 Jan 2022 21:54:56 -0500 Received: from mail-oi1-x233.google.com (mail-oi1-x233.google.com [IPv6:2607:f8b0:4864:20::233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 34A3CC061755 for ; Thu, 27 Jan 2022 18:54:53 -0800 (PST) Received: by mail-oi1-x233.google.com with SMTP id v67so9774732oie.9 for ; Thu, 27 Jan 2022 18:54:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=IX/6o0DNz8KpbzZNUAXJ5OCF6o57UhTURqBBpR2QBLU=; b=UCSlOJZdiIT64LV6o4on6GMRKl/xaVOIO1jgQzgLv9dWajLqdoO4xH19JdCZhyHtZm 88IuFHRgM/Zf1EX8Nb4SfwY8jz176aQiu+uKkJKpfsx93Yyr/WIo8E1EU05tNmBzQuMh D8KHrMLA+1WEXZhV/ofE1xMrVymkFy8v/YTc11V3c61Egyu+JhyMrq7Rvr/+6H9ORtR5 1ySr62wm3IC9+fVWWSKtJEu8F2bMzd/9z+lSkF7gZGaYLiUtU6ftk7evqtN27vCjct3W Ad8wSf/IvRk0KtAyxDGSYljSk+BEWh18yCG1/8Pfiz0Pbi4myJAsln/AsqGwyX346kY/ /aag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=IX/6o0DNz8KpbzZNUAXJ5OCF6o57UhTURqBBpR2QBLU=; b=JKASB9njtTUStzudZAjHX+13BOWQwYcQNcGyyFmtNjAsPQ1PAzJXumHmStAR7OKbgB 8ELIG3bypwPAHvWjDT5+8haEPO3rJWFGNLG4hq9aNOyBXARzs3V3zBY7kOhnEccK+L0U 4wBYzn6iPf0hwqfnGj34MTQ5FCXd4dh/BlnIAA81pcN9Wx1TEeMt33f29f533oRgrtgO q46M+XZc1aD40XGbK7TewmifSgDmjBm5b5Qs/tlnpP3ALtljBy5WJP7iUJWTxckZQhCL S1rnp6gzcvXWGv0XTvkQBGNHV0FBvMArNbgvsZvBWq9ktQja+HWLfBeGx8lN8KgtQxrl MApA== X-Gm-Message-State: AOAM5313OGbTDas2kvDPEa8t5MTr/OAIpu++ZGpnPdtggbkCb1uGr0vA 4w6LZt0wQyl1pGOtgKRc7DKr3A== X-Google-Smtp-Source: ABdhPJxyhXlzOWWv7hGC76FfpQaXeONf5obcU8ghwyGUPLsHBSFHTTvy/aaNanP1yvViTrrmiJ+Xvw== X-Received: by 2002:a05:6808:118a:: with SMTP id j10mr4651836oil.85.1643338492495; Thu, 27 Jan 2022 18:54:52 -0800 (PST) Received: from ripper.. ([2600:1700:a0:3dc8:205:1bff:fec0:b9b3]) by smtp.gmail.com with ESMTPSA id k6sm5677352oop.28.2022.01.27.18.54.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 18:54:52 -0800 (PST) From: Bjorn Andersson To: Bjorn Andersson , Mathieu Poirier Cc: Rob Herring , linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 05/13] soc: qcom: mdt_loader: Extend check for split firmware Date: Thu, 27 Jan 2022 18:55:05 -0800 Message-Id: <20220128025513.97188-6-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220128025513.97188-1-bjorn.andersson@linaro.org> References: <20220128025513.97188-1-bjorn.andersson@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org Some of the Qualcomm SM8450 firmware files are padded such that the start of the first segment falls within the .mdt file but the segment to be loaded is stored as a separate .bNN file. Extend the condition to only attempt to read a segment inline if the entire segment would be available. Signed-off-by: Bjorn Andersson --- drivers/soc/qcom/mdt_loader.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/soc/qcom/mdt_loader.c b/drivers/soc/qcom/mdt_loader.c index c5bd13b05c1a..37e2e734bc5d 100644 --- a/drivers/soc/qcom/mdt_loader.c +++ b/drivers/soc/qcom/mdt_loader.c @@ -297,7 +297,8 @@ static int __qcom_mdt_load(struct device *dev, const struct firmware *fw, ptr = mem_region + offset; - if (phdr->p_filesz && phdr->p_offset < fw->size) { + if (phdr->p_filesz && phdr->p_offset < fw->size && + phdr->p_offset + phdr->p_filesz < fw->size) { /* Firmware is large enough to be non-split */ if (phdr->p_offset + phdr->p_filesz > fw->size) { dev_err(dev, "file %s segment %d would be truncated\n", From patchwork Fri Jan 28 02:55:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 12727830 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4F21DC35268 for ; Fri, 28 Jan 2022 02:55:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345622AbiA1CzE (ORCPT ); Thu, 27 Jan 2022 21:55:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345632AbiA1Cy4 (ORCPT ); Thu, 27 Jan 2022 21:54:56 -0500 Received: from mail-oo1-xc34.google.com (mail-oo1-xc34.google.com [IPv6:2607:f8b0:4864:20::c34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 061D9C061757 for ; Thu, 27 Jan 2022 18:54:54 -0800 (PST) Received: by mail-oo1-xc34.google.com with SMTP id u25-20020a4ad0d9000000b002e8d4370689so1136845oor.12 for ; Thu, 27 Jan 2022 18:54:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=RTwg5KvKYjsTu6x08Cr32D16DOEKvzcD7sbsXNJ+uXY=; b=K8V/09ysiH0Fouxf5Tc2rZDy8N8WIUIQDQ8VPe4/cUpLFW9HQpJZ7Uj3Wbjyw5gPE2 QIz6xbpoCcfcX5fKtHAkx6bcEapm3uxtJveoRK5Z8y0IruuB+u1j1MolkvZBVLXqrM2R dBYhHr9gPLSBM5qeG1W+NV5c/ZgJs+7DnCRFcn2V8ItQRlwUzkt1gke2xJLrd6DziEOl Emri/hIyeKIcunM9XtWYzUWazakwo5reUPYMPjEIQyKKywOt+HmHIXrihIQcyySpn5HL QKIk1B4WtMmJR7abmuQYk0IfKlRdr64gW4oDwMglZHwWzBQv/RmIfkiU2hRP+RM78wod A/1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RTwg5KvKYjsTu6x08Cr32D16DOEKvzcD7sbsXNJ+uXY=; b=zy/nlnWyf3hvfshucdC85iwkWtLAQRZFkZmPlrlBE99PMurNbDxUu6qAIhwUZi1qk4 G7q1lT0DwykKM43VJ9yJOqwxne2e4RWNdu/bJPBvZ2uxNdHGeGhkZH4Gw6iAFDITu+zz 5pAD4yUaatY7ojP0UWMgF4ODfxzEdy06DKpJCLsdDvn1X7CP2SXX/lWvSGjdaiRrop4C /dqZE0P0gPGYHJyjIAMi3lBUD2gozm9kTMmaXqSmEY+3TkF4Fqzp0lgAWvlVQk+TYLuf W1ek6rZ69cL3PzAOh+D6+V/qclLtHohOCE4j57WBh0e7VfhdgacGTCcIHQGvZbRCipRD nStg== X-Gm-Message-State: AOAM5327R45XMVYp7qosbqt0aaNdzOKNuJO3aJX/U7baZJlxTX3rcngD N5CYC5mHCvNqcaG09YFkitZhsQ== X-Google-Smtp-Source: ABdhPJxuOarBgKU/g5GByZEi1kS52yQcDBSu+8HKDr3z0ak7bPikqPYdBhTJzL7n/TKmQdGTusvNXQ== X-Received: by 2002:a4a:aa0e:: with SMTP id x14mr3373194oom.98.1643338493375; Thu, 27 Jan 2022 18:54:53 -0800 (PST) Received: from ripper.. ([2600:1700:a0:3dc8:205:1bff:fec0:b9b3]) by smtp.gmail.com with ESMTPSA id k6sm5677352oop.28.2022.01.27.18.54.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 18:54:52 -0800 (PST) From: Bjorn Andersson To: Bjorn Andersson , Mathieu Poirier Cc: Rob Herring , linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 06/13] soc: qcom: mdt_loader: Reorder parts of __qcom_mdt_load() Date: Thu, 27 Jan 2022 18:55:06 -0800 Message-Id: <20220128025513.97188-7-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220128025513.97188-1-bjorn.andersson@linaro.org> References: <20220128025513.97188-1-bjorn.andersson@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org Move the traversal of the program headers to the start of the function, to make sure that min_ and max_addr are in scope as the call to qcom_scm_pas_mem_setup() is moved in the next commit. Signed-off-by: Bjorn Andersson --- drivers/soc/qcom/mdt_loader.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/drivers/soc/qcom/mdt_loader.c b/drivers/soc/qcom/mdt_loader.c index 37e2e734bc5d..ee991784a738 100644 --- a/drivers/soc/qcom/mdt_loader.c +++ b/drivers/soc/qcom/mdt_loader.c @@ -213,6 +213,22 @@ static int __qcom_mdt_load(struct device *dev, const struct firmware *fw, ehdr = (struct elf32_hdr *)fw->data; phdrs = (struct elf32_phdr *)(ehdr + 1); + for (i = 0; i < ehdr->e_phnum; i++) { + phdr = &phdrs[i]; + + if (!mdt_phdr_valid(phdr)) + continue; + + if (phdr->p_flags & QCOM_MDT_RELOCATABLE) + relocate = true; + + if (phdr->p_paddr < min_addr) + min_addr = phdr->p_paddr; + + if (phdr->p_paddr + phdr->p_memsz > max_addr) + max_addr = ALIGN(phdr->p_paddr + phdr->p_memsz, SZ_4K); + } + if (pas_init) { metadata = qcom_mdt_read_metadata(fw, &metadata_len, fw_name, dev); if (IS_ERR(metadata)) { @@ -233,22 +249,6 @@ static int __qcom_mdt_load(struct device *dev, const struct firmware *fw, } } - for (i = 0; i < ehdr->e_phnum; i++) { - phdr = &phdrs[i]; - - if (!mdt_phdr_valid(phdr)) - continue; - - if (phdr->p_flags & QCOM_MDT_RELOCATABLE) - relocate = true; - - if (phdr->p_paddr < min_addr) - min_addr = phdr->p_paddr; - - if (phdr->p_paddr + phdr->p_memsz > max_addr) - max_addr = ALIGN(phdr->p_paddr + phdr->p_memsz, SZ_4K); - } - if (relocate) { if (pas_init) { ret = qcom_scm_pas_mem_setup(pas_id, mem_phys, From patchwork Fri Jan 28 02:55:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 12727826 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A3A9AC433F5 for ; Fri, 28 Jan 2022 02:55:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345676AbiA1Cy6 (ORCPT ); Thu, 27 Jan 2022 21:54:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52646 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345651AbiA1Cy5 (ORCPT ); Thu, 27 Jan 2022 21:54:57 -0500 Received: from mail-oi1-x22b.google.com (mail-oi1-x22b.google.com [IPv6:2607:f8b0:4864:20::22b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E20AC061769 for ; Thu, 27 Jan 2022 18:54:55 -0800 (PST) Received: by mail-oi1-x22b.google.com with SMTP id p203so9762296oih.10 for ; Thu, 27 Jan 2022 18:54:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=E00ULksfCHrGjrIytZEDeV+x815pqBoESRwaY/ogtLg=; b=wdTBQQBrqiQKJNtAtbRq68Uh+cRvdVAW/wsJWvsUwS2e+kIkwskuq2k8Ik2LdxSp/Y xoT+QagdT6TU3oJwuaNo9reTKhE1vwHtGz1rLkVpamMFTNmLFtoeUOXFvseU2nEmtwaO 8gv4EX3CysuJvHA/ElSw1Xhk18LqHwJdlz6Izn804Z5yPa4wpP05Q43z3yscn5Xka7PS RO/AdiL4QXP5WpagSi3H3unH8GRLf1EtmIQJy9YygCKTzsw94JI/W43rMN1gHHeEtRVa huzr/CES8ln1Y3a+BatWOrnrbyTzYpY9V15sgSwlWKL6lWh7mJIIVvuSW6MLYivoAQZX JSZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=E00ULksfCHrGjrIytZEDeV+x815pqBoESRwaY/ogtLg=; b=mPUG00mqX45FjItyYj0irgqdIdgpzh7sio7hobj8Frd2tfcTGP7vXBOSm/pQyt/xSD lu6zqQJzBteuYTEPPErhWK9nvylV/wkZjqU6kpKhRxeJTIV9nDuzTdfwdeOmjeAcek1A kKKr1B/y/R1lKupZiKZJDadrOsXcdIZGb7xuWPBjqm6yLZBWQyL8gtbgSB90/Cuxire9 qsTYJAXJXDmy2pFJUS3si1p/h7unvc6/8Y0TlLuzsFobJmoSxN8aP5JNqlENhEQzT1PS zBv/KnBi+q12bzpVwbCp4dHP80Ke8L3fFkTscUjpsu/JX2ksdRJqrs41XwxyqgrGxUe2 HIGw== X-Gm-Message-State: AOAM533JjT/OX+8eeNbfCqGEI4j5ze4/7zozsTxn2zSyflHJmmHxIvZg cEc+eGQADreQ3RPRPpNjxw1zzB6u0NoDUw== X-Google-Smtp-Source: ABdhPJxmRmu9TMZZNqXzAwWye2txzFpM75FYBZzDv6Y+J2J3L/GAcgal6SYihv6Za/Kxs1qpPLXjKg== X-Received: by 2002:a05:6808:120a:: with SMTP id a10mr9546519oil.218.1643338494212; Thu, 27 Jan 2022 18:54:54 -0800 (PST) Received: from ripper.. ([2600:1700:a0:3dc8:205:1bff:fec0:b9b3]) by smtp.gmail.com with ESMTPSA id k6sm5677352oop.28.2022.01.27.18.54.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 18:54:53 -0800 (PST) From: Bjorn Andersson To: Bjorn Andersson , Mathieu Poirier Cc: Rob Herring , linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 07/13] soc: qcom: mdt_loader: Always invoke PAS mem_setup Date: Thu, 27 Jan 2022 18:55:07 -0800 Message-Id: <20220128025513.97188-8-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220128025513.97188-1-bjorn.andersson@linaro.org> References: <20220128025513.97188-1-bjorn.andersson@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org After spelunking various old kernel trees no finds has been found indicating that the PAS mem_setup call should actually be made conditional on the image being relocatable. Group the two PAS operations together, to facilitate splitting them out in a following patch. Signed-off-by: Bjorn Andersson --- drivers/soc/qcom/mdt_loader.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/drivers/soc/qcom/mdt_loader.c b/drivers/soc/qcom/mdt_loader.c index ee991784a738..c8d43dc50cff 100644 --- a/drivers/soc/qcom/mdt_loader.c +++ b/drivers/soc/qcom/mdt_loader.c @@ -247,20 +247,17 @@ static int __qcom_mdt_load(struct device *dev, const struct firmware *fw, ret, fw_name); goto out; } - } - if (relocate) { - if (pas_init) { - ret = qcom_scm_pas_mem_setup(pas_id, mem_phys, - max_addr - min_addr); - if (ret) { - /* Unable to set up relocation */ - dev_err(dev, "error %d setting up firmware %s\n", - ret, fw_name); - goto out; - } + ret = qcom_scm_pas_mem_setup(pas_id, mem_phys, max_addr - min_addr); + if (ret) { + /* Unable to set up relocation */ + dev_err(dev, "error %d setting up firmware %s\n", + ret, fw_name); + goto out; } + } + if (relocate) { /* * The image is relocatable, so offset each segment based on * the lowest segment address. From patchwork Fri Jan 28 02:55:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 12727829 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9074AC4167D for ; Fri, 28 Jan 2022 02:55:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345705AbiA1CzC (ORCPT ); Thu, 27 Jan 2022 21:55:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345660AbiA1Cy5 (ORCPT ); Thu, 27 Jan 2022 21:54:57 -0500 Received: from mail-ot1-x334.google.com (mail-ot1-x334.google.com [IPv6:2607:f8b0:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C6C0CC061770 for ; Thu, 27 Jan 2022 18:54:55 -0800 (PST) Received: by mail-ot1-x334.google.com with SMTP id q19-20020a056830441300b0059a54d66106so4532844otv.0 for ; Thu, 27 Jan 2022 18:54:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=N98X4yF1OPRtC844t3xgEHOdot9+r2TcGrVSAV2KyjY=; b=sfwDdb/YePJO3FjZRa5T1tABRtU/lHlCPq8ICb0lBzhdusEWU8be3yLrwDDj/IzwKQ 2kOQpO0HtQCvw1zIhPJfcH2ar5+PKIYBe2g+TcXjtXf83+jeVKVtoFyzDKPUFBNOWu6p 9aMYvhgDdA3EY47VfFDO5SE7ibNeZg/iZOCSEH+v/S2nl0nw5c1lvXd8wkucaWQUfalB +D2Rk2STqRIddWfZCqAs00w38MRsK3r2B0RAwfd/ctdLCcMBoYqHfX9wB8X8YcsSdD/9 l5mrn5rsDN7JN3krlmSmLL99IleT8yJS95ROv6cl63PZUyfj7sxr4EMxqIdUWaK3CUJt mV4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=N98X4yF1OPRtC844t3xgEHOdot9+r2TcGrVSAV2KyjY=; b=nSdAJKLMGplXY6NEn1XlqazdNmSTdTKp4qGceAEwttqG3jigGdCSOOVubhGdmpQohf p52apQisHMfhbkdLHAboKJnfB214m41Lb9Ob+fi16RxWb686ZyAnMaDDqSBaEioVdV97 s4YtAuCIsq9c/YglW0vDj4PVlAmz4hzTYS1P7Y5PHqg2dF3xDHc2uNKNk7n4ajpb6wnS 3aqvWS6nUV91Z2lpLiN9S6Keef6aSkNYVA7YxjOMioIYhkVqUtTP9HiJ6T6j98m4Mez8 ihA5xBb3ZWqe6gLBHEYE17RIYUIg9o4S/KYtXObJXdMICa4HllH9Nt1F3MoOHzXvZnX6 TTcw== X-Gm-Message-State: AOAM530a1XNEnZmdxaGWOhZOz8zVlYMk39PJ50t2Hy1zEv7GFnCFtKOL 2pF2Hh4/KaLL+zTLTEMMGIFGHQ== X-Google-Smtp-Source: ABdhPJw5EVycDW6hSeepuqT1+LSeBsYTa6Havz77lHUZ008U48f/Sr34mTfY4lGrgeebQohPk4O7Mg== X-Received: by 2002:a05:6830:3143:: with SMTP id c3mr3387607ots.28.1643338495091; Thu, 27 Jan 2022 18:54:55 -0800 (PST) Received: from ripper.. ([2600:1700:a0:3dc8:205:1bff:fec0:b9b3]) by smtp.gmail.com with ESMTPSA id k6sm5677352oop.28.2022.01.27.18.54.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 18:54:54 -0800 (PST) From: Bjorn Andersson To: Bjorn Andersson , Mathieu Poirier Cc: Rob Herring , linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 08/13] soc: qcom: mdt_loader: Extract PAS operations Date: Thu, 27 Jan 2022 18:55:08 -0800 Message-Id: <20220128025513.97188-9-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220128025513.97188-1-bjorn.andersson@linaro.org> References: <20220128025513.97188-1-bjorn.andersson@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org Rather than passing a boolean to indicate if the PAS operations should be performed from within __mdt_load(), extract them to their own helper function. This will allow clients to invoke this directly, with some qcom_scm_pas_metadata context that they later needs to release, without further having to complicate the prototype of qcom_mdt_load(). Signed-off-by: Bjorn Andersson --- drivers/soc/qcom/mdt_loader.c | 110 +++++++++++++++++++--------- include/linux/soc/qcom/mdt_loader.h | 11 +++ 2 files changed, 85 insertions(+), 36 deletions(-) diff --git a/drivers/soc/qcom/mdt_loader.c b/drivers/soc/qcom/mdt_loader.c index c8d43dc50cff..f0b1d969567c 100644 --- a/drivers/soc/qcom/mdt_loader.c +++ b/drivers/soc/qcom/mdt_loader.c @@ -188,6 +188,74 @@ void *qcom_mdt_read_metadata(const struct firmware *fw, size_t *data_len, } EXPORT_SYMBOL_GPL(qcom_mdt_read_metadata); +/** + * qcom_mdt_pas_init() - initialize PAS region for firmware loading + * @dev: device handle to associate resources with + * @fw: firmware object for the mdt file + * @firmware: name of the firmware, for construction of segment file names + * @pas_id: PAS identifier + * @mem_phys: physical address of allocated memory region + * @ctx: PAS metadata context, to be released by caller + * + * Returns 0 on success, negative errno otherwise. + */ +int qcom_mdt_pas_init(struct device *dev, const struct firmware *fw, + const char *fw_name, int pas_id, phys_addr_t mem_phys, + struct qcom_scm_pas_metadata *ctx) +{ + const struct elf32_phdr *phdrs; + const struct elf32_phdr *phdr; + const struct elf32_hdr *ehdr; + phys_addr_t min_addr = PHYS_ADDR_MAX; + phys_addr_t max_addr = 0; + size_t metadata_len; + void *metadata; + int ret; + int i; + + ehdr = (struct elf32_hdr *)fw->data; + phdrs = (struct elf32_phdr *)(ehdr + 1); + + for (i = 0; i < ehdr->e_phnum; i++) { + phdr = &phdrs[i]; + + if (!mdt_phdr_valid(phdr)) + continue; + + if (phdr->p_paddr < min_addr) + min_addr = phdr->p_paddr; + + if (phdr->p_paddr + phdr->p_memsz > max_addr) + max_addr = ALIGN(phdr->p_paddr + phdr->p_memsz, SZ_4K); + } + + metadata = qcom_mdt_read_metadata(fw, &metadata_len, fw_name, dev); + if (IS_ERR(metadata)) { + ret = PTR_ERR(metadata); + dev_err(dev, "error %d reading firmware %s metadata\n", ret, fw_name); + goto out; + } + + ret = qcom_scm_pas_init_image(pas_id, metadata, metadata_len, ctx); + kfree(metadata); + if (ret) { + /* Invalid firmware metadata */ + dev_err(dev, "error %d initializing firmware %s\n", ret, fw_name); + goto out; + } + + ret = qcom_scm_pas_mem_setup(pas_id, mem_phys, max_addr - min_addr); + if (ret) { + /* Unable to set up relocation */ + dev_err(dev, "error %d setting up firmware %s\n", ret, fw_name); + goto out; + } + +out: + return ret; +} +EXPORT_SYMBOL_GPL(qcom_mdt_pas_init); + static int __qcom_mdt_load(struct device *dev, const struct firmware *fw, const char *fw_name, int pas_id, void *mem_region, phys_addr_t mem_phys, size_t mem_size, @@ -198,10 +266,7 @@ static int __qcom_mdt_load(struct device *dev, const struct firmware *fw, const struct elf32_hdr *ehdr; phys_addr_t mem_reloc; phys_addr_t min_addr = PHYS_ADDR_MAX; - phys_addr_t max_addr = 0; - size_t metadata_len; ssize_t offset; - void *metadata; bool relocate = false; void *ptr; int ret = 0; @@ -224,37 +289,6 @@ static int __qcom_mdt_load(struct device *dev, const struct firmware *fw, if (phdr->p_paddr < min_addr) min_addr = phdr->p_paddr; - - if (phdr->p_paddr + phdr->p_memsz > max_addr) - max_addr = ALIGN(phdr->p_paddr + phdr->p_memsz, SZ_4K); - } - - if (pas_init) { - metadata = qcom_mdt_read_metadata(fw, &metadata_len, fw_name, dev); - if (IS_ERR(metadata)) { - ret = PTR_ERR(metadata); - dev_err(dev, "error %d reading firmware %s metadata\n", - ret, fw_name); - goto out; - } - - ret = qcom_scm_pas_init_image(pas_id, metadata, metadata_len, NULL); - - kfree(metadata); - if (ret) { - /* Invalid firmware metadata */ - dev_err(dev, "error %d initializing firmware %s\n", - ret, fw_name); - goto out; - } - - ret = qcom_scm_pas_mem_setup(pas_id, mem_phys, max_addr - min_addr); - if (ret) { - /* Unable to set up relocation */ - dev_err(dev, "error %d setting up firmware %s\n", - ret, fw_name); - goto out; - } } if (relocate) { @@ -319,8 +353,6 @@ static int __qcom_mdt_load(struct device *dev, const struct firmware *fw, if (reloc_base) *reloc_base = mem_reloc; -out: - return ret; } @@ -342,6 +374,12 @@ int qcom_mdt_load(struct device *dev, const struct firmware *fw, phys_addr_t mem_phys, size_t mem_size, phys_addr_t *reloc_base) { + int ret; + + ret = qcom_mdt_pas_init(dev, fw, firmware, pas_id, mem_phys, NULL); + if (ret) + return ret; + return __qcom_mdt_load(dev, fw, firmware, pas_id, mem_region, mem_phys, mem_size, reloc_base, true); } diff --git a/include/linux/soc/qcom/mdt_loader.h b/include/linux/soc/qcom/mdt_loader.h index 46bdb7bace9a..ef8a6278264d 100644 --- a/include/linux/soc/qcom/mdt_loader.h +++ b/include/linux/soc/qcom/mdt_loader.h @@ -10,10 +10,14 @@ struct device; struct firmware; +struct qcom_scm_pas_metadata; #if IS_ENABLED(CONFIG_QCOM_MDT_LOADER) ssize_t qcom_mdt_get_size(const struct firmware *fw); +int qcom_mdt_pas_init(struct device *dev, const struct firmware *fw, + const char *fw_name, int pas_id, phys_addr_t mem_phys, + struct qcom_scm_pas_metadata *pas_metadata_ctx); int qcom_mdt_load(struct device *dev, const struct firmware *fw, const char *fw_name, int pas_id, void *mem_region, phys_addr_t mem_phys, size_t mem_size, @@ -33,6 +37,13 @@ static inline ssize_t qcom_mdt_get_size(const struct firmware *fw) return -ENODEV; } +static int qcom_mdt_pas_init(struct device *dev, const struct firmware *fw, + const char *fw_name, int pas_id, phys_addr_t mem_phys, + struct qcom_scm_pas_metadata *pas_metadata_ctx) +{ + return -ENODEV; +} + static inline int qcom_mdt_load(struct device *dev, const struct firmware *fw, const char *fw_name, int pas_id, void *mem_region, phys_addr_t mem_phys, From patchwork Fri Jan 28 02:55:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 12727828 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6D88AC4321E for ; Fri, 28 Jan 2022 02:55:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345696AbiA1CzB (ORCPT ); Thu, 27 Jan 2022 21:55:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345625AbiA1Cy5 (ORCPT ); Thu, 27 Jan 2022 21:54:57 -0500 Received: from mail-oi1-x22c.google.com (mail-oi1-x22c.google.com [IPv6:2607:f8b0:4864:20::22c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8617C06173B for ; Thu, 27 Jan 2022 18:54:56 -0800 (PST) Received: by mail-oi1-x22c.google.com with SMTP id m9so9745688oia.12 for ; Thu, 27 Jan 2022 18:54:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xBiCWtsGgqefLb9AuztIhrA4yfjIwqY0U6EiuLZrZUU=; b=TGLtGJupeZIo9t/IRGxXa/frN+pcYKpu6BHt4TovO2Hkuu41iR1o29KXFlofv+TO21 kRGrjAY8PzQIwRZBbDH3cy1Qhj4bJeGy95HO8G2Fg8R3c281/BtxOM6u3tkWZ8D1iq0g vSsQ3GSrM+RTlcvbbiE8HZR+31wevHcrSBEcpWBn+dBz6azifXJxnnosV/hM71/forXo IcpKJrX2EyhO4b8NFPzu+osqW9C86JfF+srihK9xBEWqls53QOt/22T7OVCz0eIXoOXT WTIzTVA/yt61J8Jg0K5FTyNCmYQT6a5FPGTWR2ZgDvOKHcseiX2rZk8JOIPHgvDZikJy lMKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xBiCWtsGgqefLb9AuztIhrA4yfjIwqY0U6EiuLZrZUU=; b=8Q5czWXB5Pnm+TVfZiNE5ioA7FR9y8hRa1OiA7m8SpnR/pHoHwX7m3z5KCvmJHpVFv 8pJv+ZUG4Nk9c7YGRB9UWJBEiFJupxrf7Wg/rSdp10FhxPf5SKkk5wVHxBXI/GvuFO1R mMXbocwRAbHnZ4cZ9P7XTekFQG9MkJgUmP79hIB+R+eBcejuu9Bw8jML1vbugAUMINOz dplx6jtUvsWkHzuhd+ogQqWBbeWQnbg+PEAdx/7C1nD5jqezCyrZ/R1eMQZQ75UleLfI 036ZWYW3DA+0Ee3gjnyt5YeAXSWu5g2/iqEiZwF9Zs3appzxCu2x5fIYO4MAK+ta1SRm YSLw== X-Gm-Message-State: AOAM530iU2/zE78DFwWZ4Te8caTcdrwrlQN6qn+sFFmSXbm1lozSs7zp vfKFbeAQnZ4SGqY7FBSkabFU6g== X-Google-Smtp-Source: ABdhPJySP4qIRSGen71caCN9W7UC+4NwBwu8H6BxLgMre7n36tSfnYblNaA8coJdnP3ysOrU5ee5Yw== X-Received: by 2002:a05:6808:2382:: with SMTP id bp2mr727360oib.171.1643338496038; Thu, 27 Jan 2022 18:54:56 -0800 (PST) Received: from ripper.. ([2600:1700:a0:3dc8:205:1bff:fec0:b9b3]) by smtp.gmail.com with ESMTPSA id k6sm5677352oop.28.2022.01.27.18.54.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 18:54:55 -0800 (PST) From: Bjorn Andersson To: Bjorn Andersson , Mathieu Poirier Cc: Rob Herring , linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 09/13] remoteproc: qcom: pas: Carry PAS metadata context Date: Thu, 27 Jan 2022 18:55:09 -0800 Message-Id: <20220128025513.97188-10-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220128025513.97188-1-bjorn.andersson@linaro.org> References: <20220128025513.97188-1-bjorn.andersson@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org Starting with Qualcomm SM8450 the metadata object shared with the secure world during authentication and booting of a remoteproc needs to be alive from init_image() until auth_and_reset(). Use the newly introduced "PAS metadata context" object to track this context from load until the firmware has been booted. In the even that load is performed but the process for some reason doesn't reach auth_and_reset the unprepare callback is used to clean up the allocated memory. Signed-off-by: Bjorn Andersson --- drivers/remoteproc/qcom_q6v5_pas.c | 32 +++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q6v5_pas.c index 184bb7cdf95a..5e806f657fec 100644 --- a/drivers/remoteproc/qcom_q6v5_pas.c +++ b/drivers/remoteproc/qcom_q6v5_pas.c @@ -79,6 +79,8 @@ struct qcom_adsp { struct qcom_rproc_subdev smd_subdev; struct qcom_rproc_ssr ssr_subdev; struct qcom_sysmon *sysmon; + + struct qcom_scm_pas_metadata pas_metadata; }; static void adsp_minidump(struct rproc *rproc) @@ -126,14 +128,34 @@ static void adsp_pds_disable(struct qcom_adsp *adsp, struct device **pds, } } +static int adsp_unprepare(struct rproc *rproc) +{ + struct qcom_adsp *adsp = (struct qcom_adsp *)rproc->priv; + + /* + * adsp_load() did pass pas_metadata to the SCM driver for storing + * metadata context. It might have been released already if + * auth_and_reset() was successful, but in other cases clean it up + * here. + */ + qcom_scm_pas_metadata_release(&adsp->pas_metadata); + + return 0; +} + static int adsp_load(struct rproc *rproc, const struct firmware *fw) { struct qcom_adsp *adsp = (struct qcom_adsp *)rproc->priv; int ret; - ret = qcom_mdt_load(adsp->dev, fw, rproc->firmware, adsp->pas_id, - adsp->mem_region, adsp->mem_phys, adsp->mem_size, - &adsp->mem_reloc); + ret = qcom_mdt_pas_init(adsp->dev, fw, rproc->firmware, adsp->pas_id, + adsp->mem_phys, &adsp->pas_metadata); + if (ret) + return ret; + + ret = qcom_mdt_load_no_init(adsp->dev, fw, rproc->firmware, adsp->pas_id, + adsp->mem_region, adsp->mem_phys, adsp->mem_size, + &adsp->mem_reloc); if (ret) return ret; @@ -185,6 +207,8 @@ static int adsp_start(struct rproc *rproc) goto disable_px_supply; } + qcom_scm_pas_metadata_release(&adsp->pas_metadata); + return 0; disable_px_supply: @@ -255,6 +279,7 @@ static unsigned long adsp_panic(struct rproc *rproc) } static const struct rproc_ops adsp_ops = { + .unprepare = adsp_unprepare, .start = adsp_start, .stop = adsp_stop, .da_to_va = adsp_da_to_va, @@ -264,6 +289,7 @@ static const struct rproc_ops adsp_ops = { }; static const struct rproc_ops adsp_minidump_ops = { + .unprepare = adsp_unprepare, .start = adsp_start, .stop = adsp_stop, .da_to_va = adsp_da_to_va, From patchwork Fri Jan 28 02:55:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 12727827 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E1BD0C433FE for ; Fri, 28 Jan 2022 02:55:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345654AbiA1CzB (ORCPT ); Thu, 27 Jan 2022 21:55:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345666AbiA1Cy5 (ORCPT ); Thu, 27 Jan 2022 21:54:57 -0500 Received: from mail-ot1-x32b.google.com (mail-ot1-x32b.google.com [IPv6:2607:f8b0:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 982CAC06174E for ; Thu, 27 Jan 2022 18:54:57 -0800 (PST) Received: by mail-ot1-x32b.google.com with SMTP id q19-20020a056830441300b0059a54d66106so4532890otv.0 for ; Thu, 27 Jan 2022 18:54:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jvyAlPuQLjDdZLcj7p6QFtf0FjfXtzi+Y0Us9VRKiM0=; b=E7k21iuYkvwNY9EgUiHtX8hLoKuZBLbuTQJdspNG99+2J0EkHYnMWxFamULmvuQdCL Wl/jfr3c8lPWT86Ux3cd7yQva7DFh2Am08BieDC8g2kWRB8+wm86k2z9ARAEBZARM7xG hCqy4/eyTVDn0nyKLL0S089IqKLRXDILnhvWiGgZ6vBwUS2Mi42E7cAEqMh+klGPEaDv pEYik4Kj5Wn2GMXTDto1pZy8uopicYEUcvb6vjbhX4Fx/oXww+ssPFGLRKm9/o3u3dhy 6ujaMCzAQbq7yboZaZ1q2Hs3dDynKFukq91/lUZtOC9wo5Y9vEunb5sPEdINfx0XrYFM gkEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jvyAlPuQLjDdZLcj7p6QFtf0FjfXtzi+Y0Us9VRKiM0=; b=KlnUfwDHAXnWSkPGZSGeLWBgHqT1/6RaWwTRI1zwRUPGvWRlVlZDHFu0cmo5ImRARS qbCikIuhldI6tD4cwoQpLR1MdstGhEBl0i/zqBhIUnE+f2mdAB7xy3Ej3XBMVp6yEI0B ifRqRkHGcGjryP6iaFDwjZ6TRTi4YF9+Rxa4pmkyl3chKTGoXKrXcfKmjrF/8l2C8hAI V7OIhPzv5TY/aZMc6KXBUFGLD/nxHL7yim3wPN1qDSWEipuzywDrOjK8K+lUe6/QcRY/ 6UE6RCBD7iZh5cqXD2BvyLLgLsmiKzHGZnCbJwGdnKLaK0UxmKfUncCwxldGFGa2f8+J Br1w== X-Gm-Message-State: AOAM531mkwX5Ac6pd5nfozIayLKrjVxKHR9fU3pp/3p6hIPHubdbe1No /3lprauMOFCmSA7A+F97PbhF9w== X-Google-Smtp-Source: ABdhPJyPI/sgFBgVQ4LTtliO4KXFpFCDhwFTY34TGsGwJtWLuDhbmqUDE0PoIINV5ajao+APWk8Ctw== X-Received: by 2002:a05:6830:30ba:: with SMTP id g26mr3762705ots.231.1643338496987; Thu, 27 Jan 2022 18:54:56 -0800 (PST) Received: from ripper.. ([2600:1700:a0:3dc8:205:1bff:fec0:b9b3]) by smtp.gmail.com with ESMTPSA id k6sm5677352oop.28.2022.01.27.18.54.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 18:54:56 -0800 (PST) From: Bjorn Andersson To: Bjorn Andersson , Mathieu Poirier Cc: Rob Herring , linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 10/13] dt-bindings: remoteproc: qcom: pas: Add SM8450 PAS compatibles Date: Thu, 27 Jan 2022 18:55:10 -0800 Message-Id: <20220128025513.97188-11-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220128025513.97188-1-bjorn.andersson@linaro.org> References: <20220128025513.97188-1-bjorn.andersson@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org The Qualcomm SM8450 has the usual audio, compute, sensor and modem remoteprocs, add compatibles to the documentation for these. Signed-off-by: Bjorn Andersson --- .../bindings/remoteproc/qcom,adsp.yaml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Documentation/devicetree/bindings/remoteproc/qcom,adsp.yaml b/Documentation/devicetree/bindings/remoteproc/qcom,adsp.yaml index c635c181d2c2..64c182428e94 100644 --- a/Documentation/devicetree/bindings/remoteproc/qcom,adsp.yaml +++ b/Documentation/devicetree/bindings/remoteproc/qcom,adsp.yaml @@ -47,6 +47,10 @@ properties: - qcom,sm8350-cdsp-pas - qcom,sm8350-slpi-pas - qcom,sm8350-mpss-pas + - qcom,sm8450-adsp-pas + - qcom,sm8450-cdsp-pas + - qcom,sm8450-mpss-pas + - qcom,sm8450-slpi-pas reg: maxItems: 1 @@ -175,6 +179,10 @@ allOf: - qcom,sm8350-cdsp-pas - qcom,sm8350-slpi-pas - qcom,sm8350-mpss-pas + - qcom,sm8450-adsp-pas + - qcom,sm8450-cdsp-pas + - qcom,sm8450-slpi-pas + - qcom,sm8450-mpss-pas then: properties: clocks: @@ -283,6 +291,9 @@ allOf: - qcom,sm8350-adsp-pas - qcom,sm8350-cdsp-pas - qcom,sm8350-slpi-pas + - qcom,sm8450-adsp-pas + - qcom,sm8450-cdsp-pas + - qcom,sm8450-slpi-pas then: properties: interrupts: @@ -312,6 +323,7 @@ allOf: - qcom,sm6350-mpss-pas - qcom,sm8150-mpss-pas - qcom,sm8350-mpss-pas + - qcom,sm8450-mpss-pas then: properties: interrupts: @@ -434,6 +446,7 @@ allOf: - qcom,sm6350-mpss-pas - qcom,sm8150-mpss-pas - qcom,sm8350-mpss-pas + - qcom,sm8450-mpss-pas then: properties: power-domains: @@ -458,6 +471,8 @@ allOf: - qcom,sm8250-slpi-pas - qcom,sm8350-adsp-pas - qcom,sm8350-slpi-pas + - qcom,sm8450-adsp-pas + - qcom,sm8450-slpi-pas then: properties: power-domains: @@ -475,6 +490,7 @@ allOf: contains: enum: - qcom,sm8350-cdsp-pas + - qcom,sm8450-cdsp-pas then: properties: power-domains: From patchwork Fri Jan 28 02:55:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 12727831 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 688BDC4332F for ; Fri, 28 Jan 2022 02:55:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345730AbiA1CzF (ORCPT ); Thu, 27 Jan 2022 21:55:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52674 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345679AbiA1Cy7 (ORCPT ); Thu, 27 Jan 2022 21:54:59 -0500 Received: from mail-oi1-x235.google.com (mail-oi1-x235.google.com [IPv6:2607:f8b0:4864:20::235]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A2ED9C061714 for ; Thu, 27 Jan 2022 18:54:58 -0800 (PST) Received: by mail-oi1-x235.google.com with SMTP id y23so9721420oia.13 for ; Thu, 27 Jan 2022 18:54:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=eFxeqpfH1BWJVw2UYgQA/9Fqc+JOe8vXCmcuFnQMGhM=; b=efgdGpdfspgWmt6dxtwpRqPwAVLI5lue+xF4g1NOuuslvB0RHbJ0tOh8gBq0Q+NsOw Vi7pa6o7hgil3Tf+xZuf1CRXftk9ouQ1GIgVvunO3yfaJ56kP88wqTYlXcYWBmi7nc6l ucnBhqP6hInmFP92RtqXsIgfGdfjHn1euaQDJX0pbxZ/vzzSO8Fw2xKiVcPxH3PUcB0p +FUtvBfYv+/Da+oyxn78mwIrTGwGzjxGyD12d8Fiao86dFPv/RSvoZE/qZO6qDBclmdK mlfgiMa5mqbqOBpH9V2CtxAcGmSw1mZjWLhEh+WYMeBU75tQ9yzcJgGC+KIx0Q9WxjNw 1ZMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=eFxeqpfH1BWJVw2UYgQA/9Fqc+JOe8vXCmcuFnQMGhM=; b=UFcnx7apgRa5nYYMdrDntavZLe3vM92iDxwrev/Hj+tLsEtlUL5PbOYm3hTt0P1RMu 7x4dwG/vzgHtj6OKiOJn6wTAt3Pg2PQc3bUE4iutGSrUpx8N+EfhKQEC1RYJ4tzRMW99 aP0AMtJ/bjMAdAFwIJzD+tJeGKlfyaytz/JizyYGNE/2l1Kq50RumF5A0RilxGDwCXkj Hl18hF8bGV1oh+YjkEiMHBWM4HHpOaulPpnduhyZ7paS0sOYlz+bKElaMuNY8Eis1Lu5 Tc4l7xl1FSZTvqmag/OuA+YO+ZfmAr+DOn3dA0QZOpmshA4hYdnVi2hxE5HL7TcHsYvz 9/kQ== X-Gm-Message-State: AOAM530J1HidUlBO1lO0RRGm/NvJJnyMZmWZpw1fhAm4xyFfF0ksAlmG HsuJUhcE8t+fIZzk3dTMitUtcQ== X-Google-Smtp-Source: ABdhPJxbsRwIcg9eWkRkCBNVNWI7QPmFZ13+TpBg06dtViUS2MlnPIw0CvwHXgJdAU1jdpHh5y9lIg== X-Received: by 2002:a05:6808:3012:: with SMTP id ay18mr9650588oib.5.1643338497912; Thu, 27 Jan 2022 18:54:57 -0800 (PST) Received: from ripper.. ([2600:1700:a0:3dc8:205:1bff:fec0:b9b3]) by smtp.gmail.com with ESMTPSA id k6sm5677352oop.28.2022.01.27.18.54.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 18:54:57 -0800 (PST) From: Bjorn Andersson To: Bjorn Andersson , Mathieu Poirier Cc: Rob Herring , linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 11/13] remoteproc: qcom: pas: Add SM8450 remoteproc support Date: Thu, 27 Jan 2022 18:55:11 -0800 Message-Id: <20220128025513.97188-12-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220128025513.97188-1-bjorn.andersson@linaro.org> References: <20220128025513.97188-1-bjorn.andersson@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org Add audio, compute, sensor and modem remoteproc compatibles to the PAS remoteproc driver. The resources needed for each one matches those of SM8350, so its descs are reused. Signed-off-by: Bjorn Andersson --- drivers/remoteproc/qcom_q6v5_pas.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/remoteproc/qcom_q6v5_pas.c b/drivers/remoteproc/qcom_q6v5_pas.c index 5e806f657fec..1ae47cc153e5 100644 --- a/drivers/remoteproc/qcom_q6v5_pas.c +++ b/drivers/remoteproc/qcom_q6v5_pas.c @@ -879,6 +879,10 @@ static const struct of_device_id adsp_of_match[] = { { .compatible = "qcom,sm8350-cdsp-pas", .data = &sm8350_cdsp_resource}, { .compatible = "qcom,sm8350-slpi-pas", .data = &sm8350_slpi_resource}, { .compatible = "qcom,sm8350-mpss-pas", .data = &mpss_resource_init}, + { .compatible = "qcom,sm8450-adsp-pas", .data = &sm8350_adsp_resource}, + { .compatible = "qcom,sm8450-cdsp-pas", .data = &sm8350_cdsp_resource}, + { .compatible = "qcom,sm8450-slpi-pas", .data = &sm8350_slpi_resource}, + { .compatible = "qcom,sm8450-mpss-pas", .data = &mpss_resource_init}, { }, }; MODULE_DEVICE_TABLE(of, adsp_of_match); From patchwork Fri Jan 28 02:55:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 12727832 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 27D84C433F5 for ; Fri, 28 Jan 2022 02:55:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345679AbiA1CzG (ORCPT ); Thu, 27 Jan 2022 21:55:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345682AbiA1Cy7 (ORCPT ); Thu, 27 Jan 2022 21:54:59 -0500 Received: from mail-oi1-x236.google.com (mail-oi1-x236.google.com [IPv6:2607:f8b0:4864:20::236]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75D8FC061747 for ; Thu, 27 Jan 2022 18:54:59 -0800 (PST) Received: by mail-oi1-x236.google.com with SMTP id s185so9828047oie.3 for ; Thu, 27 Jan 2022 18:54:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=f0839BG7VZciEgCdDw4i0L62SacP05qx4MZ9H1fCyts=; b=ybLwDYw4DLJtIQTFGtWiPYs+LQWb6y7iA5F9z0EcJv+3y9//THQTIVCY5th/ns4hil 5/8cJZjqC+hwnR0jAwFXR+w2Q7GJehP949+u3VzI2BI6UYbbbNm7yGDcv7ATAmFgMOHA Tkx1u0QTVRk9aCfvkj+Krj+Oo43dtBGPuDnxBX6VJs9Qb1d8QGr+8LDcEpRq5YVY0KdX 3z1vaq004bAWoBaho6XXrZHF0bUQ3NSKiHUH9iMILSnciSXpY4MQwo7ewv/EJ5hr7uGh 3gC95jnfPlUUc3waAZl1AyNasDj5SIYxiaMjO1PKMhU6Td1PzMhx81GPeqbaLHCiZR+P eS6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=f0839BG7VZciEgCdDw4i0L62SacP05qx4MZ9H1fCyts=; b=h98vJAGqQfuFi/MS3XHEZqUopOtNBMtwFXFpkJ6UYJwMN4Xpuzvn7KD0UBGDtT8+j/ TxA/70JAVcUfl1SdeloVqztSAos+VvKWg7D/phoZ7GVVP5YQG8OptACNFHFxJGv0xZnF WqO9uXz41J42qjqczZVvMBRAXK8kEfNUsoL+o2VVwMlZ8qtu2N2rRWTkVo1+iRk5BjSl MYlbfVynzpsMM/XryGUfHz+f1T+0uPm9GnHHK9a5NBi0ss3jB2nY1Y+EGNipd04slhls z2/4SMfpTbkjkKlmB6K/b1jcvyvQW5p75sXAeayCWLdX9fwx/kzQqQpc44uAiQxn44Zc RN0A== X-Gm-Message-State: AOAM532VDWE6oJidNCfdXTcQ9zxanUkR/mKJkWxjDOdBUO8SHQ2rbiAl i+N3/dfBcZVaz0iY0rDkPs8s1A== X-Google-Smtp-Source: ABdhPJy6XZ5eTKT8uLCvGblLfVUGihiaK7H+EO6Ucg32M7Pu8Ch+KN7IfJYEBMNbRPLq6Oqss+s8ew== X-Received: by 2002:a05:6808:1396:: with SMTP id c22mr9016703oiw.190.1643338498844; Thu, 27 Jan 2022 18:54:58 -0800 (PST) Received: from ripper.. ([2600:1700:a0:3dc8:205:1bff:fec0:b9b3]) by smtp.gmail.com with ESMTPSA id k6sm5677352oop.28.2022.01.27.18.54.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 18:54:58 -0800 (PST) From: Bjorn Andersson To: Bjorn Andersson , Mathieu Poirier Cc: Rob Herring , linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 12/13] arm64: dts: qcom: sm8450: Add remoteproc enablers and instances Date: Thu, 27 Jan 2022 18:55:12 -0800 Message-Id: <20220128025513.97188-13-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220128025513.97188-1-bjorn.andersson@linaro.org> References: <20220128025513.97188-1-bjorn.andersson@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org The Qualcomm SM8450 carries the familiar set of audio, compute, sensor and modem remoteprocs. Add these and their dependencies. Signed-off-by: Bjorn Andersson Reviewed-by: Dmitry Baryshkov --- arch/arm64/boot/dts/qcom/sm8450.dtsi | 297 +++++++++++++++++++++++++++ 1 file changed, 297 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/sm8450.dtsi b/arch/arm64/boot/dts/qcom/sm8450.dtsi index 10c25ad2d0c7..24fb3d3e667b 100644 --- a/arch/arm64/boot/dts/qcom/sm8450.dtsi +++ b/arch/arm64/boot/dts/qcom/sm8450.dtsi @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -460,6 +461,15 @@ cvp_mem: memory@9ee00000 { no-map; }; + rmtfs_mem: memory@9fd00000 { + compatible = "qcom,rmtfs-mem"; + reg = <0x0 0x9fd00000 0x0 0x280000>; + no-map; + + qcom,client-id = <1>; + qcom,vmid = <15>; + }; + global_sync_mem: memory@a6f00000 { reg = <0x0 0xa6f00000 0x0 0x100000>; no-map; @@ -540,6 +550,113 @@ trusted_apps_ext_mem: memory@ed900000 { }; }; + smp2p-adsp { + compatible = "qcom,smp2p"; + qcom,smem = <443>, <429>; + interrupts-extended = <&ipcc IPCC_CLIENT_LPASS + IPCC_MPROC_SIGNAL_SMP2P + IRQ_TYPE_EDGE_RISING>; + mboxes = <&ipcc IPCC_CLIENT_LPASS + IPCC_MPROC_SIGNAL_SMP2P>; + + qcom,local-pid = <0>; + qcom,remote-pid = <2>; + + smp2p_adsp_out: master-kernel { + qcom,entry-name = "master-kernel"; + #qcom,smem-state-cells = <1>; + }; + + smp2p_adsp_in: slave-kernel { + qcom,entry-name = "slave-kernel"; + interrupt-controller; + #interrupt-cells = <2>; + }; + }; + + smp2p-cdsp { + compatible = "qcom,smp2p"; + qcom,smem = <94>, <432>; + interrupts-extended = <&ipcc IPCC_CLIENT_CDSP + IPCC_MPROC_SIGNAL_SMP2P + IRQ_TYPE_EDGE_RISING>; + mboxes = <&ipcc IPCC_CLIENT_CDSP + IPCC_MPROC_SIGNAL_SMP2P>; + + qcom,local-pid = <0>; + qcom,remote-pid = <5>; + + smp2p_cdsp_out: master-kernel { + qcom,entry-name = "master-kernel"; + #qcom,smem-state-cells = <1>; + }; + + smp2p_cdsp_in: slave-kernel { + qcom,entry-name = "slave-kernel"; + interrupt-controller; + #interrupt-cells = <2>; + }; + }; + + smp2p-modem { + compatible = "qcom,smp2p"; + qcom,smem = <435>, <428>; + interrupts-extended = <&ipcc IPCC_CLIENT_MPSS + IPCC_MPROC_SIGNAL_SMP2P + IRQ_TYPE_EDGE_RISING>; + mboxes = <&ipcc IPCC_CLIENT_MPSS + IPCC_MPROC_SIGNAL_SMP2P>; + + qcom,local-pid = <0>; + qcom,remote-pid = <1>; + + smp2p_modem_out: master-kernel { + qcom,entry-name = "master-kernel"; + #qcom,smem-state-cells = <1>; + }; + + smp2p_modem_in: slave-kernel { + qcom,entry-name = "slave-kernel"; + interrupt-controller; + #interrupt-cells = <2>; + }; + + ipa_smp2p_out: ipa-ap-to-modem { + qcom,entry-name = "ipa"; + #qcom,smem-state-cells = <1>; + }; + + ipa_smp2p_in: ipa-modem-to-ap { + qcom,entry-name = "ipa"; + interrupt-controller; + #interrupt-cells = <2>; + }; + }; + + smp2p-slpi { + compatible = "qcom,smp2p"; + qcom,smem = <481>, <430>; + interrupts-extended = <&ipcc IPCC_CLIENT_SLPI + IPCC_MPROC_SIGNAL_SMP2P + IRQ_TYPE_EDGE_RISING>; + mboxes = <&ipcc IPCC_CLIENT_SLPI + IPCC_MPROC_SIGNAL_SMP2P>; + + qcom,local-pid = <0>; + qcom,remote-pid = <3>; + + smp2p_slpi_out: master-kernel { + qcom,entry-name = "master-kernel"; + #qcom,smem-state-cells = <1>; + }; + + smp2p_slpi_in: slave-kernel { + qcom,entry-name = "slave-kernel"; + interrupt-controller; + #interrupt-cells = <2>; + }; + }; + soc: soc@0 { #address-cells = <2>; #size-cells = <2>; @@ -672,6 +789,167 @@ usb_1_ssphy: phy@88e9200 { }; }; + remoteproc_slpi: remoteproc@2400000 { + compatible = "qcom,sm8350-slpi-pas"; + reg = <0 0x02400000 0 0x4000>; + + interrupts-extended = <&pdc 9 IRQ_TYPE_LEVEL_HIGH>, + <&smp2p_slpi_in 0 IRQ_TYPE_EDGE_RISING>, + <&smp2p_slpi_in 1 IRQ_TYPE_EDGE_RISING>, + <&smp2p_slpi_in 2 IRQ_TYPE_EDGE_RISING>, + <&smp2p_slpi_in 3 IRQ_TYPE_EDGE_RISING>; + interrupt-names = "wdog", "fatal", "ready", + "handover", "stop-ack"; + + clocks = <&rpmhcc RPMH_CXO_CLK>; + clock-names = "xo"; + + power-domains = <&rpmhpd SM8450_LCX>, + <&rpmhpd SM8450_LMX>; + power-domain-names = "lcx", "lmx"; + + memory-region = <&slpi_mem>; + + qcom,qmp = <&aoss_qmp>; + + qcom,smem-states = <&smp2p_slpi_out 0>; + qcom,smem-state-names = "stop"; + + status = "disabled"; + + glink-edge { + interrupts-extended = <&ipcc IPCC_CLIENT_SLPI + IPCC_MPROC_SIGNAL_GLINK_QMP + IRQ_TYPE_EDGE_RISING>; + mboxes = <&ipcc IPCC_CLIENT_SLPI + IPCC_MPROC_SIGNAL_GLINK_QMP>; + + label = "slpi"; + qcom,remote-pid = <3>; + }; + }; + + remoteproc_adsp: remoteproc@30000000 { + compatible = "qcom,sm8450-adsp-pas"; + reg = <0 0x030000000 0 0x100>; + + interrupts-extended = <&pdc 6 IRQ_TYPE_LEVEL_HIGH>, + <&smp2p_adsp_in 0 IRQ_TYPE_EDGE_RISING>, + <&smp2p_adsp_in 1 IRQ_TYPE_EDGE_RISING>, + <&smp2p_adsp_in 2 IRQ_TYPE_EDGE_RISING>, + <&smp2p_adsp_in 3 IRQ_TYPE_EDGE_RISING>; + interrupt-names = "wdog", "fatal", "ready", + "handover", "stop-ack"; + + clocks = <&rpmhcc RPMH_CXO_CLK>; + clock-names = "xo"; + + power-domains = <&rpmhpd SM8450_LCX>, + <&rpmhpd SM8450_LMX>; + power-domain-names = "lcx", "lmx"; + + memory-region = <&adsp_mem>; + + qcom,qmp = <&aoss_qmp>; + + qcom,smem-states = <&smp2p_adsp_out 0>; + qcom,smem-state-names = "stop"; + + status = "disabled"; + + remoteproc_adsp_glink: glink-edge { + interrupts-extended = <&ipcc IPCC_CLIENT_LPASS + IPCC_MPROC_SIGNAL_GLINK_QMP + IRQ_TYPE_EDGE_RISING>; + mboxes = <&ipcc IPCC_CLIENT_LPASS + IPCC_MPROC_SIGNAL_GLINK_QMP>; + + label = "lpass"; + qcom,remote-pid = <2>; + }; + }; + + remoteproc_cdsp: remoteproc@32300000 { + compatible = "qcom,sm8450-cdsp-pas"; + reg = <0 0x032300000 0 0x1400000>; + + interrupts-extended = <&intc GIC_SPI 578 IRQ_TYPE_LEVEL_HIGH>, + <&smp2p_cdsp_in 0 IRQ_TYPE_EDGE_RISING>, + <&smp2p_cdsp_in 1 IRQ_TYPE_EDGE_RISING>, + <&smp2p_cdsp_in 2 IRQ_TYPE_EDGE_RISING>, + <&smp2p_cdsp_in 3 IRQ_TYPE_EDGE_RISING>; + interrupt-names = "wdog", "fatal", "ready", + "handover", "stop-ack"; + + clocks = <&rpmhcc RPMH_CXO_CLK>; + clock-names = "xo"; + + power-domains = <&rpmhpd SM8450_CX>, + <&rpmhpd SM8450_MXC>; + power-domain-names = "cx", "mxc"; + + memory-region = <&cdsp_mem>; + + qcom,qmp = <&aoss_qmp>; + + qcom,smem-states = <&smp2p_cdsp_out 0>; + qcom,smem-state-names = "stop"; + + status = "disabled"; + + glink-edge { + interrupts-extended = <&ipcc IPCC_CLIENT_CDSP + IPCC_MPROC_SIGNAL_GLINK_QMP + IRQ_TYPE_EDGE_RISING>; + mboxes = <&ipcc IPCC_CLIENT_CDSP + IPCC_MPROC_SIGNAL_GLINK_QMP>; + + label = "cdsp"; + qcom,remote-pid = <5>; + }; + }; + + remoteproc_mpss: remoteproc@4080000 { + compatible = "qcom,sm8450-mpss-pas"; + reg = <0x0 0x04080000 0x0 0x4040>; + + interrupts-extended = <&intc GIC_SPI 264 IRQ_TYPE_LEVEL_HIGH>, + <&smp2p_modem_in 0 IRQ_TYPE_EDGE_RISING>, + <&smp2p_modem_in 1 IRQ_TYPE_EDGE_RISING>, + <&smp2p_modem_in 2 IRQ_TYPE_EDGE_RISING>, + <&smp2p_modem_in 3 IRQ_TYPE_EDGE_RISING>, + <&smp2p_modem_in 7 IRQ_TYPE_EDGE_RISING>; + interrupt-names = "wdog", "fatal", "ready", "handover", + "stop-ack", "shutdown-ack"; + + clocks = <&rpmhcc RPMH_CXO_CLK>; + clock-names = "xo"; + + power-domains = <&rpmhpd 0>, + <&rpmhpd 12>; + power-domain-names = "cx", "mss"; + + memory-region = <&mpss_mem>; + + qcom,qmp = <&aoss_qmp>; + + qcom,smem-states = <&smp2p_modem_out 0>; + qcom,smem-state-names = "stop"; + + status = "disabled"; + + glink-edge { + interrupts-extended = <&ipcc IPCC_CLIENT_MPSS + IPCC_MPROC_SIGNAL_GLINK_QMP + IRQ_TYPE_EDGE_RISING>; + mboxes = <&ipcc IPCC_CLIENT_MPSS + IPCC_MPROC_SIGNAL_GLINK_QMP>; + interrupts = ; + label = "modem"; + qcom,remote-pid = <1>; + }; + }; + pdc: interrupt-controller@b220000 { compatible = "qcom,sm8450-pdc", "qcom,pdc"; reg = <0 0x0b220000 0 0x30000>, <0 0x174000f0 0 0x64>; @@ -682,6 +960,25 @@ pdc: interrupt-controller@b220000 { interrupt-controller; }; + aoss_qmp: power-controller@c300000 { + compatible = "qcom,sm8450-aoss-qmp", "qcom,aoss-qmp"; + reg = <0 0x0c300000 0 0x400>; + interrupts-extended = <&ipcc IPCC_CLIENT_AOP IPCC_MPROC_SIGNAL_GLINK_QMP + IRQ_TYPE_EDGE_RISING>; + mboxes = <&ipcc IPCC_CLIENT_AOP IPCC_MPROC_SIGNAL_GLINK_QMP>; + + #clock-cells = <0>; + }; + + ipcc: mailbox@ed18000 { + compatible = "qcom,sm8450-ipcc", "qcom,ipcc"; + reg = <0 0x0ed18000 0 0x1000>; + interrupts = ; + interrupt-controller; + #interrupt-cells = <3>; + #mbox-cells = <2>; + }; + tlmm: pinctrl@f100000 { compatible = "qcom,sm8450-tlmm"; reg = <0 0x0f100000 0 0x300000>; From patchwork Fri Jan 28 02:55:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 12727833 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 96CA1C43217 for ; Fri, 28 Jan 2022 02:55:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345682AbiA1CzJ (ORCPT ); Thu, 27 Jan 2022 21:55:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345688AbiA1CzA (ORCPT ); Thu, 27 Jan 2022 21:55:00 -0500 Received: from mail-oi1-x236.google.com (mail-oi1-x236.google.com [IPv6:2607:f8b0:4864:20::236]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5131CC061753 for ; Thu, 27 Jan 2022 18:55:00 -0800 (PST) Received: by mail-oi1-x236.google.com with SMTP id m9so9745929oia.12 for ; Thu, 27 Jan 2022 18:55:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ZFOGW+nVn/EM1Z2BztmM+/jCRAogoevTBkpE6moeqjw=; b=HdaemvutluNp99sWBlcuaC1SxIFeOm3iywNN8TxBxGmC62cU911Ph2uHk4jsJU7vqY S6Lqs1ibqhqQ0VOetBb7NOuUAkTRN6ewV2zYblA6uxhpSr4ZNiZzsvJShmsf8PQGwXRJ B8SvZAD5yKdQ7G1QwWL8v/kCPmuWxLNHmBM3/tu0MkC2ZES2V7u6e1b5g9NI/Pz4fkNw iuMzWiq8diKFZtwomPbEWZvTz5e17SMdd9JmmCYTyMdnqrMxXUUMH690uJs/DyFcVhe3 opbiv2mJVOxuBH5ORq9/uj3wEJmsIaZleoW5sQeVkjV2SsMUtkZO7fNVcR0wgKKSJcTF syUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZFOGW+nVn/EM1Z2BztmM+/jCRAogoevTBkpE6moeqjw=; b=qAb65Judg3FvjS87VLBFnP9gdMKUVPyOizpW+RnI58akE6n7uBUqq75sA9EjGq3Gqd 5fpc5ENVW15l3LCdBjghNQlJSNQO+MHGkuAdlJ6gKfYF8MANuiJMmN5TgBVImys+RzOI 1IWTNtCBc6K4rYn9OdceS0r5q/NoWEe31GT/zMOfNAO9VBhq8pTD64XEGCgxvqUnRHjq cDls+eT9x9GiAWBQr9E0Fue+t5u5k6ZtNnnBa0kWTybZuHRcNBhO2tfq6pmQtTE1Db8B MfJuUtwMvxUwVvxki7sGcgtzuBZMXtPAmqNrKSu4JDV2WokWLYTZhL4JQFUXUmuJXMr4 uDlQ== X-Gm-Message-State: AOAM533DtR+hKXlESQtBiWdxmINvtm1YnRdnzwP8QoDWYDAui3VLOxa2 /FYJvip0ogGQ5HDz0VOX/FnbsQ== X-Google-Smtp-Source: ABdhPJzK2qMTXj7NERh/AtWEIFGTW3DUbZtlsOUyoBZqt+PngY65GEw549w2aJ2kvxJIo8FmPw5UqA== X-Received: by 2002:aca:ad0c:: with SMTP id w12mr4128987oie.287.1643338499659; Thu, 27 Jan 2022 18:54:59 -0800 (PST) Received: from ripper.. ([2600:1700:a0:3dc8:205:1bff:fec0:b9b3]) by smtp.gmail.com with ESMTPSA id k6sm5677352oop.28.2022.01.27.18.54.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jan 2022 18:54:59 -0800 (PST) From: Bjorn Andersson To: Bjorn Andersson , Mathieu Poirier Cc: Rob Herring , linux-arm-msm@vger.kernel.org, linux-remoteproc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 13/13] arm64: dts: qcom: sm8450-qrd: Enable remoteproc instances Date: Thu, 27 Jan 2022 18:55:13 -0800 Message-Id: <20220128025513.97188-14-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220128025513.97188-1-bjorn.andersson@linaro.org> References: <20220128025513.97188-1-bjorn.andersson@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org Enable the audio, compute, sensor and modem remoteproc and specify firmware path for these on the Qualcomm SM8450 QRD. Signed-off-by: Bjorn Andersson --- arch/arm64/boot/dts/qcom/sm8450-qrd.dts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/sm8450-qrd.dts b/arch/arm64/boot/dts/qcom/sm8450-qrd.dts index b68ab247e6ae..9526632d4029 100644 --- a/arch/arm64/boot/dts/qcom/sm8450-qrd.dts +++ b/arch/arm64/boot/dts/qcom/sm8450-qrd.dts @@ -346,6 +346,26 @@ &qupv3_id_0 { status = "okay"; }; +&remoteproc_adsp { + status = "okay"; + firmware-name = "qcom/sm8450/adsp.mbn"; +}; + +&remoteproc_cdsp { + status = "okay"; + firmware-name = "qcom/sm8450/cdsp.mbn"; +}; + +&remoteproc_mpss { + status = "okay"; + firmware-name = "qcom/sm8450/modem.mbn"; +}; + +&remoteproc_slpi { + status = "okay"; + firmware-name = "qcom/sm8450/slpi.mbn"; +}; + &tlmm { gpio-reserved-ranges = <28 4>, <36 4>; };