From nobody Mon Apr 6 20:11:41 2026 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 5BA77ECAAD8 for ; Fri, 16 Sep 2022 15:41:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229609AbiIPPlV (ORCPT ); Fri, 16 Sep 2022 11:41:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32994 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229492AbiIPPlR (ORCPT ); Fri, 16 Sep 2022 11:41:17 -0400 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FBD2AB1A4 for ; Fri, 16 Sep 2022 08:41:16 -0700 (PDT) Received: by mail-ej1-x633.google.com with SMTP id lh5so8550818ejb.10 for ; Fri, 16 Sep 2022 08:41:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=jjOx+eaOm9REiti8lJSasVk8F5SWyKCCLMEi5kN3twQ=; b=Bx+LSNKqX1Y9FLiiS9Rs1xk63Lihp2h+GrZEEeBZwdt+R6v09IiihpSgkJemuwnGOv ffgu7b/QOo0GgKgnwUV8uZVhSzuV05mWb0ZFSS3M23YwvAsmGOt2xG2WXKo2XABzJSVo Dn5LpfFZQENYc4sFN/cFoPHt2/MWytHd3/hkcEGkFcE2Ti9PbVkJe2XEM2+QCf9Yp6Mk oMutSzSgR7CBpVhV/pa4JmEAlEb6hMXG2M58dP0bPDUrnbHF1PLY8cNPQiJ6gtyptpm4 Fq0RD/Cqz6TC5pify7pQSID6y9pMRGAUqScbeH16gYnUmovrhYWP0047WeESO40IubDg svjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=jjOx+eaOm9REiti8lJSasVk8F5SWyKCCLMEi5kN3twQ=; b=OBCqXeyKCaiRCpAum/i3dJFBjwprfEs0P3tFqWnCR2rmPBfC+K1AEo9KTpWMziak08 1ymSiD7GmT9yy7ZlO8zNUip9u9RQPWkMp0kbW8PpsQnj6QA25BIotkNPDBf3vUhSdJOz n5wYrZ0hl4514eD1y9VS8rHNDKFMgQKjDHUnifLB8ZQVnJBQumU4S2BsO7DjcBD+IlvR gk7xY5UBrlhDeNN/K7Gm2Qe3a7iX3YGKfRlEU+qbaOH7V8SnfitrVQt8t1zcJ/sgOhu+ kITpoVoUoEq0BJISMqh7QhAoiqOPM9zXo9F4JIILIzRAwP0NDQ3T4bekdppbLOuVG+DA eiVQ== X-Gm-Message-State: ACrzQf2lFuW3MWpLh4YFWq1aiwS5DHpk/wbzNe838NkX1w3Qzr0tFVsE dhitcEndufvGBm5T6phT/uefRQ== X-Google-Smtp-Source: AMsMyM4xRr3KlbTp9txd0c57bsm+J8VrgkPiNf7c5d19G/TywnHs0sZB5RDvTpDyvCC2324QoDLn8Q== X-Received: by 2002:a17:907:8a1f:b0:77d:8e2:66bc with SMTP id sc31-20020a1709078a1f00b0077d08e266bcmr4202343ejc.189.1663342874656; Fri, 16 Sep 2022 08:41:14 -0700 (PDT) Received: from hackbox.lan ([94.52.112.99]) by smtp.gmail.com with ESMTPSA id e10-20020a1709062c0a00b0073d638a7a89sm10567707ejh.99.2022.09.16.08.41.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Sep 2022 08:41:13 -0700 (PDT) From: Abel Vesa To: Srinivas Kandagatla , Amol Maheshwari , Ekansh Gupta , Bharath Kumar , Himateja Reddy , Anirudh Raghavendra Cc: Arnd Bergmann , Greg Kroah-Hartman , linux-arm-msm@vger.kernel.org, Linux Kernel Mailing List Subject: [PATCH v4 1/9] misc: fastrpc: Rename audio protection domain to root Date: Fri, 16 Sep 2022 18:40:54 +0300 Message-Id: <20220916154102.1768088-2-abel.vesa@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220916154102.1768088-1-abel.vesa@linaro.org> References: <20220916154102.1768088-1-abel.vesa@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The AUDIO_PD will be done via static pd, so the proper name here is actually ROOT_PD. Co-developed-by: Srinivas Kandagatla Signed-off-by: Srinivas Kandagatla Signed-off-by: Abel Vesa --- drivers/misc/fastrpc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c index 80811e852d8f..f80a00e9f508 100644 --- a/drivers/misc/fastrpc.c +++ b/drivers/misc/fastrpc.c @@ -83,7 +83,7 @@ #define FASTRPC_RMID_INIT_MEM_UNMAP 11 =20 /* Protection Domain(PD) ids */ -#define AUDIO_PD (0) /* also GUEST_OS PD? */ +#define ROOT_PD (0) #define USER_PD (1) #define SENSORS_PD (2) =20 @@ -1889,7 +1889,7 @@ static long fastrpc_device_ioctl(struct file *file, u= nsigned int cmd, err =3D fastrpc_invoke(fl, argp); break; case FASTRPC_IOCTL_INIT_ATTACH: - err =3D fastrpc_init_attach(fl, AUDIO_PD); + err =3D fastrpc_init_attach(fl, ROOT_PD); break; case FASTRPC_IOCTL_INIT_ATTACH_SNS: err =3D fastrpc_init_attach(fl, SENSORS_PD); --=20 2.34.1 From nobody Mon Apr 6 20:11:41 2026 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 1076AECAAA1 for ; Fri, 16 Sep 2022 15:41:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229702AbiIPPld (ORCPT ); Fri, 16 Sep 2022 11:41:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229473AbiIPPlT (ORCPT ); Fri, 16 Sep 2022 11:41:19 -0400 Received: from mail-ej1-x635.google.com (mail-ej1-x635.google.com [IPv6:2a00:1450:4864:20::635]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B745AB188 for ; Fri, 16 Sep 2022 08:41:18 -0700 (PDT) Received: by mail-ej1-x635.google.com with SMTP id a26so21588462ejc.4 for ; Fri, 16 Sep 2022 08:41:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=9HAW4NExDmyEYbCWPAgk73QCsbSp2/UVcS9ZvV1e16c=; b=ybwVe03y/wFA3XUgSppl+Ngo068sW5+w6rrcf9UveIz5Uk5oY2GbZbbOHBnTqwF+/g QWRbTfLYnkLjUhv2rLvjNJOo9MVf/YVpdEok/gv84DohK4wyChM1wYhWCUnQMZeejCmI dgtgD1HMrkfcd5+ff1Ihe/FvEaYWhsL4ieJUNReLY9/Kk7rn5UwLORRiz/iScafMMaK9 7IOIm9D8TQzwCRGbvnZ98n7wAP0LwSBxzO3iR+l1jedvFkJzkXEHW1/HL6ipW3rp564r Y51hnJKpDQfXSdBYTJAeuDZWcoPUFtaqP07vsChQbxmCmZNf7oC4lGD0o+ymDvcqiX0f 2rsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=9HAW4NExDmyEYbCWPAgk73QCsbSp2/UVcS9ZvV1e16c=; b=iTKDbCJN9sETZwR9yALsdEj8K+ETcuxcp6yuqKpiRn0JBQRVDQbDuUrbSvPZKcL/EC ppu9jxOEQzp/EF+sG67TaMxr+rnI8uDFKqZBUccJRCdi3sEfqS79wh7Tvn12hM0Ku1vN 7uIvUngjnhQ1l4pYQ8EUmBvs9BHwV7hyzU/IYGzyllnmMqL4a8kLMW1levxfNc4x0OBz q4SUElUEnqaA/qhK5WyVFoT7JtmjkHUzLnAEC6+0jbgtVuogX1XUkw26Pow6Cy8SVHtD JDf20xyANggG91fDtqetDbhum/baseY81TG0t7I122N/sFz5uxAcotOtS714RquNVKYC IEEw== X-Gm-Message-State: ACrzQf0rCzjQ3tKwnJkmHsB44aJh7zmj8Lp0ysr2c6Ows88UYEAIuFft vZslUD1JyKwQdtdW68ri5KX74A== X-Google-Smtp-Source: AMsMyM4U2TCsiPZOhS//A3TntB938R34O5xc1QmRZ7f3H15RjuxJtc0iSD35iQcl3V7+j/ya+XmZoA== X-Received: by 2002:a17:906:6a0f:b0:779:2fc:9a51 with SMTP id qw15-20020a1709066a0f00b0077902fc9a51mr4056084ejc.101.1663342876489; Fri, 16 Sep 2022 08:41:16 -0700 (PDT) Received: from hackbox.lan ([94.52.112.99]) by smtp.gmail.com with ESMTPSA id e10-20020a1709062c0a00b0073d638a7a89sm10567707ejh.99.2022.09.16.08.41.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Sep 2022 08:41:15 -0700 (PDT) From: Abel Vesa To: Srinivas Kandagatla , Amol Maheshwari , Ekansh Gupta , Bharath Kumar , Himateja Reddy , Anirudh Raghavendra Cc: Arnd Bergmann , Greg Kroah-Hartman , linux-arm-msm@vger.kernel.org, Linux Kernel Mailing List Subject: [PATCH v4 2/9] misc: fastrpc: Add reserved mem support Date: Fri, 16 Sep 2022 18:40:55 +0300 Message-Id: <20220916154102.1768088-3-abel.vesa@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220916154102.1768088-1-abel.vesa@linaro.org> References: <20220916154102.1768088-1-abel.vesa@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" The reserved mem support is needed for CMA heap support, which will be used by AUDIOPD. Co-developed-by: Srinivas Kandagatla Signed-off-by: Srinivas Kandagatla Signed-off-by: Abel Vesa --- drivers/misc/fastrpc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c index f80a00e9f508..395036a10e15 100644 --- a/drivers/misc/fastrpc.c +++ b/drivers/misc/fastrpc.c @@ -19,6 +19,7 @@ #include #include #include +#include =20 #define ADSP_DOMAIN_ID (0) #define MDSP_DOMAIN_ID (1) @@ -2068,6 +2069,9 @@ static int fastrpc_rpmsg_probe(struct rpmsg_device *r= pdev) return -EINVAL; } =20 + if (of_reserved_mem_device_init_by_idx(rdev, rdev->of_node, 0)) + dev_info(rdev, "no reserved DMA memory for FASTRPC\n"); + vmcount =3D of_property_read_variable_u32_array(rdev->of_node, "qcom,vmids", &vmids[0], 0, FASTRPC_MAX_VMIDS); if (vmcount < 0) --=20 2.34.1 From nobody Mon Apr 6 20:11:41 2026 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 E6310ECAAD8 for ; Fri, 16 Sep 2022 15:41:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229761AbiIPPlh (ORCPT ); Fri, 16 Sep 2022 11:41:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33026 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229539AbiIPPlU (ORCPT ); Fri, 16 Sep 2022 11:41:20 -0400 Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE0C0AB1A4 for ; Fri, 16 Sep 2022 08:41:19 -0700 (PDT) Received: by mail-ej1-x62e.google.com with SMTP id 13so21312166ejn.3 for ; Fri, 16 Sep 2022 08:41:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=ldvybrosVi8MveMV26a/sw9frFQdtZWh0kJMoa+dSIc=; b=GzFxBcmy5kN+ZV5Tv2gg7T9qR8wN6l1M49Ln4xe+q+ItR0qNzzxhdBnD1bto1V/EmJ b5kfgpmuBfEpn5CK8akv1wtEZpYs6WWEYsKdY5VStSmvwm7i3FFfqDPfMWPLOteGIQYj qb09rl/HFtfRx4lc/7/HbNNIugYBwlkWsw/sqciA4T65PynOp+Vcihq2qxU6u0mrGfL2 exg/2q8z9WqFKroHi7D94gqN49nLtmd1oQAfh6tB8FmTAH9gPyHxtdwtmQyYe+bq8GGO A+z2sVKs3d0vEtMJ/ErWeh31rLjvie3YqJm68NPusCs5DwgB9gC7dPHoj118w53TjYCH X4jQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=ldvybrosVi8MveMV26a/sw9frFQdtZWh0kJMoa+dSIc=; b=V0+8hjQL47kIGy0Hlw4oouB4RdsWSmbCDqYvNDWXAIp7ZPfwbaFFMlGdykocgUQlde O6IhWRIOxbHQZ0r0ohiLjc3PWIXnCRZig4EsydnxwCjaixp/fKEPKaYbdvwyOFmHLVOD R21vH3IDzYt1VQFRnbfNSDZCskonZe2e6zTo0AnmnmTBcBC+t4p+2b8SkQtoBPVzRATT v51Mjm2e/+BGLxQqNY2y60dcffTjuDZFiRDBkeD7e+WpjgUc0JXz3oqmF/NrO03K+nDG +0QwbFQ1ihzgYEGpCqdA0LloQZvyUx6huAVNK0FaspDBCCSPWLHa7MaXVYLxZCucS9eX IdKQ== X-Gm-Message-State: ACrzQf2+KKLElCRLnpfIEm40t9W47kkZIOM9FG2u06WxyHGP15pfd+1g qHLrx6k7tz0f+9OC1jc3F/Vn9g== X-Google-Smtp-Source: AMsMyM7X5ou5QgnKxl4UqQ4fTjHWhE9NEb1laaf2fHPI5nLqXbjGnbKSDc1F2ohOxzx37Pnpbf1sBw== X-Received: by 2002:a17:906:db0d:b0:77b:a7cd:8396 with SMTP id xj13-20020a170906db0d00b0077ba7cd8396mr4190962ejb.264.1663342878246; Fri, 16 Sep 2022 08:41:18 -0700 (PDT) Received: from hackbox.lan ([94.52.112.99]) by smtp.gmail.com with ESMTPSA id e10-20020a1709062c0a00b0073d638a7a89sm10567707ejh.99.2022.09.16.08.41.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Sep 2022 08:41:17 -0700 (PDT) From: Abel Vesa To: Srinivas Kandagatla , Amol Maheshwari , Ekansh Gupta , Bharath Kumar , Himateja Reddy , Anirudh Raghavendra Cc: Arnd Bergmann , Greg Kroah-Hartman , linux-arm-msm@vger.kernel.org, Linux Kernel Mailing List Subject: [PATCH v4 3/9] misc: fastrpc: Add fastrpc_remote_heap_alloc Date: Fri, 16 Sep 2022 18:40:56 +0300 Message-Id: <20220916154102.1768088-4-abel.vesa@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220916154102.1768088-1-abel.vesa@linaro.org> References: <20220916154102.1768088-1-abel.vesa@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Split fastrpc_buf_alloc in such a way it allows allocation of remote heap too and add fastrpc_remote_heap_alloc to do so. Co-developed-by: Srinivas Kandagatla Signed-off-by: Srinivas Kandagatla Signed-off-by: Abel Vesa --- drivers/misc/fastrpc.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c index 395036a10e15..9e83743eaca1 100644 --- a/drivers/misc/fastrpc.c +++ b/drivers/misc/fastrpc.c @@ -379,7 +379,7 @@ static void fastrpc_buf_free(struct fastrpc_buf *buf) kfree(buf); } =20 -static int fastrpc_buf_alloc(struct fastrpc_user *fl, struct device *dev, +static int __fastrpc_buf_alloc(struct fastrpc_user *fl, struct device *dev, u64 size, struct fastrpc_buf **obuf) { struct fastrpc_buf *buf; @@ -407,14 +407,37 @@ static int fastrpc_buf_alloc(struct fastrpc_user *fl,= struct device *dev, return -ENOMEM; } =20 + *obuf =3D buf; + + return 0; +} + +static int fastrpc_buf_alloc(struct fastrpc_user *fl, struct device *dev, + u64 size, struct fastrpc_buf **obuf) +{ + int ret; + struct fastrpc_buf *buf; + + ret =3D __fastrpc_buf_alloc(fl, dev, size, obuf); + if (ret) + return ret; + + buf =3D *obuf; + if (fl->sctx && fl->sctx->sid) buf->phys +=3D ((u64)fl->sctx->sid << 32); =20 - *obuf =3D buf; - return 0; } =20 +static int fastrpc_remote_heap_alloc(struct fastrpc_user *fl, struct devic= e *dev, + u64 size, struct fastrpc_buf **obuf) +{ + struct device *rdev =3D &fl->cctx->rpdev->dev; + + return __fastrpc_buf_alloc(fl, rdev, size, obuf); +} + static void fastrpc_channel_ctx_free(struct kref *ref) { struct fastrpc_channel_ctx *cctx; --=20 2.34.1 From nobody Mon Apr 6 20:11:41 2026 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 104CFC54EE9 for ; Fri, 16 Sep 2022 15:41:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229796AbiIPPln (ORCPT ); Fri, 16 Sep 2022 11:41:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229615AbiIPPlW (ORCPT ); Fri, 16 Sep 2022 11:41:22 -0400 Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 06E96AE84E for ; Fri, 16 Sep 2022 08:41:20 -0700 (PDT) Received: by mail-ej1-x62e.google.com with SMTP id a26so21588865ejc.4 for ; Fri, 16 Sep 2022 08:41:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=Lj5Qy7j6i9yUUDEm9MCuBWibYcbm/wliYlayeG3Sqfs=; b=eqqapHPooE3Ic6fOAG2r7DlrSEr4TXMYmciVXT38BnP0AjwrE4BAWjD88aPsBL7dJK 7Kjc8lZnGzPcuGN1Szp7utcGquEJcTQJj+MhNLfucUZFPacI/upojZhRWPg/9PemEqM6 lmyxWGbGdwCaLpdoW/kWYshBSmfwPFz//zx/8iYEepPEcbghYEFFAyiEJZ7hsMnOycb/ D7EKAi9WtALUM0q1LeNtw2RkPnBWYpwwmjOi1NnEZ5VhCVcZSD8R5VaCQV460zai2iF2 ejXOu0Om6tc58HpW7cvD61F14N0l3Mg6vYwId4zZUVDDQwey0MvwCQszHeXssM2HejvJ r2CQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=Lj5Qy7j6i9yUUDEm9MCuBWibYcbm/wliYlayeG3Sqfs=; b=rPOefhjVgrIENnAQNteNYgNmvBjbHEJqSxxDT8Es8A7N4W4RKWGNn+L0o9Ii6GoXp7 EUeP0UTXdnU74GWiHPhyDl9Z8L4/1YvqJvlqFEHQM5JYOTWlXPO78uCqNISmiKpNVc2U fsZkrDDaVzkzcv5c/G2HWKPQccD4TPKQumri5W08i096EzUrNzpJisquO0BUMYSZGZ2I oyeYSsZJzb9LRoEFcX0+7IIuOkkdGdcNNkNAVtIX1QF4baG5ZRhpYBNuy0lh89G1KQB/ 7/WW4bwv6rLgxSaihClG0WzjLX4ixhqveMo2n7ncpQjNb4V1KEpOthLhM3oCFewIYHuR sgmA== X-Gm-Message-State: ACrzQf3q9JSjJ5JEtUT26Wwfzr4J+wS5qomSul5sw5C9/9ppluXqR1ZF VQ3qEjlMeNdJ9jR/he352GNdCg== X-Google-Smtp-Source: AMsMyM78d4mfBSGV2VcyrDog5A0UNYzxzHi3lmAJzkky6t2kJs+8a/a7okZnIF6t/0p4x6R+huAl8w== X-Received: by 2002:a17:907:6e8a:b0:780:7379:2c76 with SMTP id sh10-20020a1709076e8a00b0078073792c76mr3911670ejc.643.1663342880330; Fri, 16 Sep 2022 08:41:20 -0700 (PDT) Received: from hackbox.lan ([94.52.112.99]) by smtp.gmail.com with ESMTPSA id e10-20020a1709062c0a00b0073d638a7a89sm10567707ejh.99.2022.09.16.08.41.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Sep 2022 08:41:19 -0700 (PDT) From: Abel Vesa To: Srinivas Kandagatla , Amol Maheshwari , Ekansh Gupta , Bharath Kumar , Himateja Reddy , Anirudh Raghavendra Cc: Arnd Bergmann , Greg Kroah-Hartman , linux-arm-msm@vger.kernel.org, Linux Kernel Mailing List Subject: [PATCH v4 4/9] misc: fastrpc: Use fastrpc_map_put in fastrpc_map_create on fail Date: Fri, 16 Sep 2022 18:40:57 +0300 Message-Id: <20220916154102.1768088-5-abel.vesa@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220916154102.1768088-1-abel.vesa@linaro.org> References: <20220916154102.1768088-1-abel.vesa@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Move the kref_init right after the allocation so that we can use fastrpc_map_put on any following error case. Signed-off-by: Abel Vesa Reviewed-by: Srinivas Kandagatla --- drivers/misc/fastrpc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c index 9e83743eaca1..0d9f1eb9a0ed 100644 --- a/drivers/misc/fastrpc.c +++ b/drivers/misc/fastrpc.c @@ -745,6 +745,8 @@ static int fastrpc_map_create(struct fastrpc_user *fl, = int fd, return -ENOMEM; =20 INIT_LIST_HEAD(&map->node); + kref_init(&map->refcount); + map->fl =3D fl; map->fd =3D fd; map->buf =3D dma_buf_get(fd); @@ -771,7 +773,6 @@ static int fastrpc_map_create(struct fastrpc_user *fl, = int fd, map->size =3D len; map->va =3D sg_virt(map->table->sgl); map->len =3D len; - kref_init(&map->refcount); =20 if (attr & FASTRPC_ATTR_SECUREMAP) { /* @@ -801,7 +802,7 @@ static int fastrpc_map_create(struct fastrpc_user *fl, = int fd, attach_err: dma_buf_put(map->buf); get_err: - kfree(map); + fastrpc_map_put(map); =20 return err; } --=20 2.34.1 From nobody Mon Apr 6 20:11:41 2026 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 23C8CC54EE9 for ; Fri, 16 Sep 2022 15:41:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229633AbiIPPlq (ORCPT ); Fri, 16 Sep 2022 11:41:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229663AbiIPPlZ (ORCPT ); Fri, 16 Sep 2022 11:41:25 -0400 Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B657FAF0F0 for ; Fri, 16 Sep 2022 08:41:23 -0700 (PDT) Received: by mail-ej1-x636.google.com with SMTP id dv25so50230810ejb.12 for ; Fri, 16 Sep 2022 08:41:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=sFmKzGr7/jgOrZ/KXcj+36r+yAiKgKvBcXidghY+S9k=; b=sbTCQRmEL2RUqCAmHX8cej9pw5rDERUBY6tTHP2RTYESizXMbBTbevCdadgIPREtjA +pJDKu8kAKKiAZu8ht5/LcnHNNIFUdSJ6VscgAOPKpnCGMAt9vlGiOkAHjbb0aNSKDyB IWYfOrQ5CvAEW+V3Kw0pNMwvZMqwMJk8Ukn9ADzhMGal4vOs/WxcVlnggqQ8AnlrrPrB RfXZbLNrPQ+zSjm8O4U+GIqTxec3b87u0tS8PoUVESXteiJdhtLg5N4+KsEvXHVC0B9c M2SnEVa4dBbwp42bDBmxHVQMzHoJ+r5mHY05MF8K20NXawyjim+Kj0VJa8VaeVwCRi2X PPRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=sFmKzGr7/jgOrZ/KXcj+36r+yAiKgKvBcXidghY+S9k=; b=Et5aZ5C1GaVmka1sQOqxGagnCBq5zLigZRWMu9biKoy6CxQWrV1yOWf/pHJB5F3dkt +MA33gKvHrfjJW6j/fl17RbmEFze9nFdzU/rvlUIU8cqDwuB6r9613PWYoPtAwaQ2ngl UZYfcXerGOzI4Ykx4jNDB60aIKGWNxk/FarHxcsUMq1F5FZeUNTDVpc/FgQ5O29YiKvh 3OfMZ/3ed+cQIgrsPZYjLDYPV4s+ldp18gLSf3k7CZpPStwiMUb5R409cWmuw8UC+B5o +sD3oxOuIxr0Jpnv2nBbsc03RZaOBmlYKfIpcvLqdxbXgAtXHwDi98pSwxMSgFiAbxjV nuoA== X-Gm-Message-State: ACrzQf0MkWICMR45oa8QZZh3TNj3c0jlzcG9QxdK7KfDHOf+mEWxc+4z qBYqYolV/D5pVgZqM2/LhcNvkA== X-Google-Smtp-Source: AMsMyM73lBlgJT0MQvP+sfcKbhxdgA2Bdis/UhYlASU9T8QM0NoBdLbaaTlpq5vjRFzASdl5bDwLJg== X-Received: by 2002:a17:907:3e12:b0:780:523b:d9cf with SMTP id hp18-20020a1709073e1200b00780523bd9cfmr4031323ejc.326.1663342882273; Fri, 16 Sep 2022 08:41:22 -0700 (PDT) Received: from hackbox.lan ([94.52.112.99]) by smtp.gmail.com with ESMTPSA id e10-20020a1709062c0a00b0073d638a7a89sm10567707ejh.99.2022.09.16.08.41.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Sep 2022 08:41:21 -0700 (PDT) From: Abel Vesa To: Srinivas Kandagatla , Amol Maheshwari , Ekansh Gupta , Bharath Kumar , Himateja Reddy , Anirudh Raghavendra Cc: Arnd Bergmann , Greg Kroah-Hartman , linux-arm-msm@vger.kernel.org, Linux Kernel Mailing List Subject: [PATCH v4 5/9] misc: fastrpc: Rework fastrpc_req_munmap Date: Fri, 16 Sep 2022 18:40:58 +0300 Message-Id: <20220916154102.1768088-6-abel.vesa@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220916154102.1768088-1-abel.vesa@linaro.org> References: <20220916154102.1768088-1-abel.vesa@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Move the lookup of the munmap request to the fastrpc_req_munmap and pass on only the buf to the lower level fastrpc_req_munmap_impl. That way we can use the lower level fastrpc_req_munmap_impl on error path in fastrpc_req_mmap to free the buf without searching for the munmap request it belongs to. Co-developed-by: Srinivas Kandagatla Signed-off-by: Srinivas Kandagatla Signed-off-by: Abel Vesa --- drivers/misc/fastrpc.c | 47 +++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 24 deletions(-) diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c index 0d9f1eb9a0ed..a1e916902deb 100644 --- a/drivers/misc/fastrpc.c +++ b/drivers/misc/fastrpc.c @@ -1630,30 +1630,14 @@ static int fastrpc_get_dsp_info(struct fastrpc_user= *fl, char __user *argp) return 0; } =20 -static int fastrpc_req_munmap_impl(struct fastrpc_user *fl, - struct fastrpc_req_munmap *req) +static int fastrpc_req_munmap_impl(struct fastrpc_user *fl, struct fastrpc= _buf *buf) { struct fastrpc_invoke_args args[1] =3D { [0] =3D { 0 } }; - struct fastrpc_buf *buf =3D NULL, *iter, *b; struct fastrpc_munmap_req_msg req_msg; struct device *dev =3D fl->sctx->dev; int err; u32 sc; =20 - spin_lock(&fl->lock); - list_for_each_entry_safe(iter, b, &fl->mmaps, node) { - if ((iter->raddr =3D=3D req->vaddrout) && (iter->size =3D=3D req->size))= { - buf =3D iter; - break; - } - } - spin_unlock(&fl->lock); - - if (!buf) { - dev_err(dev, "mmap not in list\n"); - return -EINVAL; - } - req_msg.pgid =3D fl->tgid; req_msg.size =3D buf->size; req_msg.vaddr =3D buf->raddr; @@ -1679,12 +1663,29 @@ static int fastrpc_req_munmap_impl(struct fastrpc_u= ser *fl, =20 static int fastrpc_req_munmap(struct fastrpc_user *fl, char __user *argp) { + struct fastrpc_buf *buf =3D NULL, *iter, *b; struct fastrpc_req_munmap req; + struct device *dev =3D fl->sctx->dev; =20 if (copy_from_user(&req, argp, sizeof(req))) return -EFAULT; =20 - return fastrpc_req_munmap_impl(fl, &req); + spin_lock(&fl->lock); + list_for_each_entry_safe(iter, b, &fl->mmaps, node) { + if ((iter->raddr =3D=3D req.vaddrout) && (iter->size =3D=3D req.size)) { + buf =3D iter; + break; + } + } + spin_unlock(&fl->lock); + + if (!buf) { + dev_err(dev, "mmap\t\tpt 0x%09llx [len 0x%08llx] not in list\n", + req.vaddrout, req.size); + return -EINVAL; + } + + return fastrpc_req_munmap_impl(fl, buf); } =20 static int fastrpc_req_mmap(struct fastrpc_user *fl, char __user *argp) @@ -1693,7 +1694,6 @@ static int fastrpc_req_mmap(struct fastrpc_user *fl, = char __user *argp) struct fastrpc_buf *buf =3D NULL; struct fastrpc_mmap_req_msg req_msg; struct fastrpc_mmap_rsp_msg rsp_msg; - struct fastrpc_req_munmap req_unmap; struct fastrpc_phy_page pages; struct fastrpc_req_mmap req; struct device *dev =3D fl->sctx->dev; @@ -1755,11 +1755,8 @@ static int fastrpc_req_mmap(struct fastrpc_user *fl,= char __user *argp) spin_unlock(&fl->lock); =20 if (copy_to_user((void __user *)argp, &req, sizeof(req))) { - /* unmap the memory and release the buffer */ - req_unmap.vaddrout =3D buf->raddr; - req_unmap.size =3D buf->size; - fastrpc_req_munmap_impl(fl, &req_unmap); - return -EFAULT; + err =3D -EFAULT; + goto err_assign; } =20 dev_dbg(dev, "mmap\t\tpt 0x%09lx OK [len 0x%08llx]\n", @@ -1767,6 +1764,8 @@ static int fastrpc_req_mmap(struct fastrpc_user *fl, = char __user *argp) =20 return 0; =20 +err_assign: + fastrpc_req_munmap_impl(fl, buf); err_invoke: fastrpc_buf_free(buf); =20 --=20 2.34.1 From nobody Mon Apr 6 20:11:41 2026 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 9AE2BECAAD8 for ; Fri, 16 Sep 2022 15:41:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229898AbiIPPlt (ORCPT ); Fri, 16 Sep 2022 11:41:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33238 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229586AbiIPPl1 (ORCPT ); Fri, 16 Sep 2022 11:41:27 -0400 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A52ADAED9A for ; Fri, 16 Sep 2022 08:41:25 -0700 (PDT) Received: by mail-ed1-x532.google.com with SMTP id f20so27575702edf.6 for ; Fri, 16 Sep 2022 08:41:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=4Y49wO5if8dVXJUM/lLU/u2tbdHWf8HN21G4C2cOXAA=; b=J7+k6B90oXr8zKczMc+zpfIK32+koi+bD5JJU4f6MIDwrog16RfYsOpInUd1lcsecF sE37uoLmN76CbhVqFvHWJt6XpjIVCmEVTi9I6/IYhA/oKyLGYSgIKdaitUbHE4ohGEJ+ bJQkgAhsBeAi3BnN2y3tOnVMssAdZoexjJasxsCAL62TULYNtXdAwsyShuqFAl73jPW8 6lZ6PVSk5ZRAOKtcSgqTUR4pj6c5acam6MUDgwunD5BbU24v6RkP8ZSYpY9YlyxNi6ev c7qRD31yQ9rmkwOgPl5cke7fjou5Maw2d6aGiSG+e55UrWjc4HXpCDGmjvCT1C6ip74v cXzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=4Y49wO5if8dVXJUM/lLU/u2tbdHWf8HN21G4C2cOXAA=; b=QI2nGBlJEu2JeITTGmb9OMWyXFLm4BAZ7RAcQKGfayt2T+DHNfENd6T7gD8gOA5K6o L3HSYjJ8O3hPUqgoBzMHr+wkktqRFC2IKn1kPvPehihqtBgzYLQI2/tQrsL1yj3ajDNL ZwkxWynTjCWeXOjzx1a4WRxToyjPXQJxmhdPmwwD0GsKx7NwgmqFyraI6a/WD17RHwFJ MIwY51uWmVuhbo9is+Mu8/u+Y5Yeg99HbIXs2X/zqIG6d21gNMOzf7L25ZhtxAEjT8/G ag4exJMCXUCz+2aYhOsfgdkEonq2fBw/WAEGa+3jbRZbpVnC15cIopihQUesJpwGsklu wUSA== X-Gm-Message-State: ACrzQf2UWDRZFUpa7r288/IQ+X3bQ1zxvlowC1InEA77LPXd/97ASN8e zBc117Zwx29yhJG4MkzWiAEUMw== X-Google-Smtp-Source: AMsMyM7u6x3NnM/F4eV4mPF0Wen5ve56biEAvdUlKok5uYNh9//Y0Hus/jIOaK0OL7oq4oEOcc3JiA== X-Received: by 2002:a05:6402:2694:b0:450:d537:f6d6 with SMTP id w20-20020a056402269400b00450d537f6d6mr4531642edd.344.1663342884196; Fri, 16 Sep 2022 08:41:24 -0700 (PDT) Received: from hackbox.lan ([94.52.112.99]) by smtp.gmail.com with ESMTPSA id e10-20020a1709062c0a00b0073d638a7a89sm10567707ejh.99.2022.09.16.08.41.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Sep 2022 08:41:23 -0700 (PDT) From: Abel Vesa To: Srinivas Kandagatla , Amol Maheshwari , Ekansh Gupta , Bharath Kumar , Himateja Reddy , Anirudh Raghavendra Cc: Arnd Bergmann , Greg Kroah-Hartman , linux-arm-msm@vger.kernel.org, Linux Kernel Mailing List Subject: [PATCH v4 6/9] misc: fastrpc: Add support for audiopd Date: Fri, 16 Sep 2022 18:40:59 +0300 Message-Id: <20220916154102.1768088-7-abel.vesa@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220916154102.1768088-1-abel.vesa@linaro.org> References: <20220916154102.1768088-1-abel.vesa@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" In order to be able to start the adsp listener for audiopd using adsprpcd, we need to add the corresponding ioctl for creating a static process. On that ioctl call we need to allocate the heap. Allocating the heap needs to be happening only once and needs to be kept between different device open calls, so attach it to the channel context to make sure that remains until the RPMSG driver is removed. Then, if there are any VMIDs associated with the static ADSP process, do a call to SCM to assign it. And then, send all the necessary info related to heap to the DSP. Co-developed-by: Srinivas Kandagatla Signed-off-by: Srinivas Kandagatla Signed-off-by: Abel Vesa --- drivers/misc/fastrpc.c | 135 ++++++++++++++++++++++++++++++++++++ include/uapi/misc/fastrpc.h | 7 ++ 2 files changed, 142 insertions(+) diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c index a1e916902deb..b123b6783920 100644 --- a/drivers/misc/fastrpc.c +++ b/drivers/misc/fastrpc.c @@ -37,8 +37,20 @@ #define FASTRPC_DSP_UTILITIES_HANDLE 2 #define FASTRPC_CTXID_MASK (0xFF0) #define INIT_FILELEN_MAX (2 * 1024 * 1024) +#define INIT_FILE_NAMELEN_MAX (128) #define FASTRPC_DEVICE_NAME "fastrpc" + +/* Add memory to static PD pool, protection thru XPU */ +#define ADSP_MMAP_HEAP_ADDR 4 +/* MAP static DMA buffer on DSP User PD */ +#define ADSP_MMAP_DMA_BUFFER 6 +/* Add memory to static PD pool protection thru hypervisor */ +#define ADSP_MMAP_REMOTE_HEAP_ADDR 8 +/* Add memory to userPD pool, for user heap */ #define ADSP_MMAP_ADD_PAGES 0x1000 +/* Add memory to userPD pool, for LLC heap */ +#define ADSP_MMAP_ADD_PAGES_LLC 0x3000, + #define DSP_UNSUPPORTED_API (0x80000414) /* MAX NUMBER of DSP ATTRIBUTES SUPPORTED */ #define FASTRPC_MAX_DSP_ATTRIBUTES (256) @@ -72,6 +84,7 @@ FASTRPC_BUILD_SCALARS(0, method, in, out, 0, 0) =20 #define FASTRPC_CREATE_PROCESS_NARGS 6 +#define FASTRPC_CREATE_STATIC_PROCESS_NARGS 3 /* Remote Method id table */ #define FASTRPC_RMID_INIT_ATTACH 0 #define FASTRPC_RMID_INIT_RELEASE 1 @@ -261,6 +274,7 @@ struct fastrpc_channel_ctx { u32 dsp_attributes[FASTRPC_MAX_DSP_ATTRIBUTES]; struct fastrpc_device *secure_fdevice; struct fastrpc_device *fdevice; + struct fastrpc_buf *remote_heap; bool secure; bool unsigned_support; }; @@ -1167,6 +1181,7 @@ static int fastrpc_internal_invoke(struct fastrpc_use= r *fl, u32 kernel, spin_unlock(&fl->lock); fastrpc_context_put(ctx); } + if (err) dev_dbg(fl->sctx->dev, "Error: Invoke Failed %d\n", err); =20 @@ -1191,6 +1206,120 @@ static bool is_session_rejected(struct fastrpc_user= *fl, bool unsigned_pd_reques return false; } =20 +static int fastrpc_init_create_static_process(struct fastrpc_user *fl, + char __user *argp) +{ + struct fastrpc_init_create_static init; + struct fastrpc_invoke_args *args; + struct fastrpc_phy_page pages[1]; + char *name; + int err; + struct { + int pgid; + u32 namelen; + u32 pageslen; + } inbuf; + u32 sc; + + args =3D kcalloc(FASTRPC_CREATE_STATIC_PROCESS_NARGS, sizeof(*args), GFP_= KERNEL); + if (!args) + return -ENOMEM; + + if (copy_from_user(&init, argp, sizeof(init))) { + err =3D -EFAULT; + goto err; + } + + if (init.namelen > INIT_FILE_NAMELEN_MAX) { + err =3D -EINVAL; + goto err; + } + + name =3D kzalloc(init.namelen, GFP_KERNEL); + if (!name) { + err =3D -ENOMEM; + goto err; + } + + if (copy_from_user(name, (void __user *)(uintptr_t)init.name, init.namele= n)) { + err =3D -EFAULT; + goto err_name; + } + + if (!fl->cctx->remote_heap) { + err =3D fastrpc_remote_heap_alloc(fl, fl->sctx->dev, init.memlen, + &fl->cctx->remote_heap); + if (err) + goto err_name; + + /* Map if we have any heap VMIDs associated with this ADSP Static Proces= s. */ + if (fl->cctx->vmcount) { + unsigned int perms =3D BIT(QCOM_SCM_VMID_HLOS); + + err =3D qcom_scm_assign_mem(fl->cctx->remote_heap->phys, + (u64)fl->cctx->remote_heap->size, &perms, + fl->cctx->vmperms, fl->cctx->vmcount); + if (err) { + dev_err(fl->sctx->dev, "Failed to assign memory with phys 0x%llx size = 0x%llx err %d", + fl->cctx->remote_heap->phys, fl->cctx->remote_heap->size, err); + goto err_map; + } + } + } + + inbuf.pgid =3D fl->tgid; + inbuf.namelen =3D init.namelen; + inbuf.pageslen =3D 0; + fl->pd =3D USER_PD; + + args[0].ptr =3D (u64)(uintptr_t)&inbuf; + args[0].length =3D sizeof(inbuf); + args[0].fd =3D -1; + + args[1].ptr =3D (u64)(uintptr_t)name; + args[1].length =3D inbuf.namelen; + args[1].fd =3D -1; + + pages[0].addr =3D fl->cctx->remote_heap->phys; + pages[0].size =3D fl->cctx->remote_heap->size; + + args[2].ptr =3D (u64)(uintptr_t) pages; + args[2].length =3D sizeof(*pages); + args[2].fd =3D -1; + + sc =3D FASTRPC_SCALARS(FASTRPC_RMID_INIT_CREATE_STATIC, 3, 0); + + err =3D fastrpc_internal_invoke(fl, true, FASTRPC_INIT_HANDLE, + sc, args); + if (err) + goto err_invoke; + + kfree(args); + + return 0; +err_invoke: + if (fl->cctx->vmcount) { + struct qcom_scm_vmperm perm; + + perm.vmid =3D QCOM_SCM_VMID_HLOS; + perm.perm =3D QCOM_SCM_PERM_RWX; + err =3D qcom_scm_assign_mem(fl->cctx->remote_heap->phys, + (u64)fl->cctx->remote_heap->size, + &(fl->cctx->vmperms[0].vmid), &perm, 1); + if (err) + dev_err(fl->sctx->dev, "Failed to assign memory phys 0x%llx size 0x%llx= err %d", + fl->cctx->remote_heap->phys, fl->cctx->remote_heap->size, err); + } +err_map: + fastrpc_buf_free(fl->cctx->remote_heap); +err_name: + kfree(name); +err: + kfree(args); + + return err; +} + static int fastrpc_init_create_process(struct fastrpc_user *fl, char __user *argp) { @@ -1918,6 +2047,9 @@ static long fastrpc_device_ioctl(struct file *file, u= nsigned int cmd, case FASTRPC_IOCTL_INIT_ATTACH_SNS: err =3D fastrpc_init_attach(fl, SENSORS_PD); break; + case FASTRPC_IOCTL_INIT_CREATE_STATIC: + err =3D fastrpc_init_create_static_process(fl, argp); + break; case FASTRPC_IOCTL_INIT_CREATE: err =3D fastrpc_init_create_process(fl, argp); break; @@ -2187,6 +2319,9 @@ static void fastrpc_rpmsg_remove(struct rpmsg_device = *rpdev) if (cctx->secure_fdevice) misc_deregister(&cctx->secure_fdevice->miscdev); =20 + if (cctx->remote_heap) + fastrpc_buf_free(cctx->remote_heap); + of_platform_depopulate(&rpdev->dev); =20 cctx->rpdev =3D NULL; diff --git a/include/uapi/misc/fastrpc.h b/include/uapi/misc/fastrpc.h index 5e29f2cfa42d..f33d914d8f46 100644 --- a/include/uapi/misc/fastrpc.h +++ b/include/uapi/misc/fastrpc.h @@ -13,6 +13,7 @@ #define FASTRPC_IOCTL_MMAP _IOWR('R', 6, struct fastrpc_req_mmap) #define FASTRPC_IOCTL_MUNMAP _IOWR('R', 7, struct fastrpc_req_munmap) #define FASTRPC_IOCTL_INIT_ATTACH_SNS _IO('R', 8) +#define FASTRPC_IOCTL_INIT_CREATE_STATIC _IOWR('R', 9, struct fastrpc_init= _create_static) #define FASTRPC_IOCTL_MEM_MAP _IOWR('R', 10, struct fastrpc_mem_map) #define FASTRPC_IOCTL_MEM_UNMAP _IOWR('R', 11, struct fastrpc_mem_unmap) #define FASTRPC_IOCTL_GET_DSP_INFO _IOWR('R', 13, struct fastrpc_ioctl_cap= ability) @@ -87,6 +88,12 @@ struct fastrpc_init_create { __u64 file; /* pointer to elf file */ }; =20 +struct fastrpc_init_create_static { + __u32 namelen; /* length of pd process name */ + __u32 memlen; + __u64 name; /* pd process name */ +}; + struct fastrpc_alloc_dma_buf { __s32 fd; /* fd */ __u32 flags; /* flags to map with */ --=20 2.34.1 From nobody Mon Apr 6 20:11:41 2026 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 386B0ECAAA1 for ; Fri, 16 Sep 2022 15:41:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229907AbiIPPly (ORCPT ); Fri, 16 Sep 2022 11:41:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229698AbiIPPld (ORCPT ); Fri, 16 Sep 2022 11:41:33 -0400 Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16F5AB07C5 for ; Fri, 16 Sep 2022 08:41:27 -0700 (PDT) Received: by mail-ej1-x62e.google.com with SMTP id y3so50364133ejc.1 for ; Fri, 16 Sep 2022 08:41:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=i1s44syzFEYnr0eNDyLT85KmbD8ohRjyNiKZIDjm3/o=; b=c3HQ5Ugb/LUNiXlZYL/qejNXQ2xsNsnG7rPz7B1k67AOWbTZUztIVb+j3O0A1ZMzgN YBXD4/9PK23WtMmlELuGmXD2+3UMXu+Kzif2qcxQbq7Ka/xvIH3McYljYTAjxSsXyT6n rQAq4pGEZEVHasSGwI1zjTFOIlD8TuZ3RYD9PViGC72085vqoMuBoltunJpOWXn/l4eP qD9OAz1FsD7frLp5dNHbvkwv7/ab8M8hWMVNNvJyJXa2WwAXC4ZAaqLziOxD6bLHgXvk OMQeiZjRzg47gQdoi9g9excYhVXFD4g34/xENJSPudlS4aRDeH5xVumgrtCQTz5XUMh8 ufYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=i1s44syzFEYnr0eNDyLT85KmbD8ohRjyNiKZIDjm3/o=; b=U75AprXnXrDDdr387dDR8gkOpko2kPpVE4E7pFDuLPT1bwg0Jd2FpR2FGZYAMOs/Ud /qBRXJ24ywIhvhLaDS0q1c49qmNB/E1b2rjr3JmEMVJBG6G0eO7wbrukSSRriJVAvY6i ze+d1larKzN0djPCk6CfPfPFy6ImIO3lzLspuJAmNX28lDi8vQylUk/MIr73h7fqhqLa QZMwGqwMUvJoJzwHBsDVWSqgQBXqNqdneMlw9Jyu2p5FGluVprnDHPNSZdJtBxzgm7St Yh+tyMACnAEBF/j6YL9nfMDFW4mFPtuHZtCTs27aeL8rs11IdH20EyPMaSlPiKR9iWup oIxg== X-Gm-Message-State: ACrzQf2FI/F6OLTttut4tq495isJWhb0PzZRoYo2zxY+2+WfFIMykXx7 yD32Odkg6W6FvBUN0dIMDCFhhA== X-Google-Smtp-Source: AMsMyM7I7AU8B33k9c3fSGSpbC1fQvriVGAIFnwscUKk4paQ8FqKb/I9zZXG3YG23nVptTglV/Qung== X-Received: by 2002:a17:907:c15:b0:775:df03:3f06 with SMTP id ga21-20020a1709070c1500b00775df033f06mr3887524ejc.89.1663342886049; Fri, 16 Sep 2022 08:41:26 -0700 (PDT) Received: from hackbox.lan ([94.52.112.99]) by smtp.gmail.com with ESMTPSA id e10-20020a1709062c0a00b0073d638a7a89sm10567707ejh.99.2022.09.16.08.41.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Sep 2022 08:41:25 -0700 (PDT) From: Abel Vesa To: Srinivas Kandagatla , Amol Maheshwari , Ekansh Gupta , Bharath Kumar , Himateja Reddy , Anirudh Raghavendra Cc: Arnd Bergmann , Greg Kroah-Hartman , linux-arm-msm@vger.kernel.org, Linux Kernel Mailing List Subject: [PATCH v4 7/9] misc: fastrpc: Safekeep mmaps on interrupted invoke Date: Fri, 16 Sep 2022 18:41:00 +0300 Message-Id: <20220916154102.1768088-8-abel.vesa@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220916154102.1768088-1-abel.vesa@linaro.org> References: <20220916154102.1768088-1-abel.vesa@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" If the userspace daemon is killed in the middle of an invoke (e.g. audiopd listerner invoke), we need to skip the unmapping on device release, otherwise the DSP will crash. So lets safekeep all the maps only if there is in invoke interrupted, by attaching them to the channel context (which is resident until RPMSG driver is removed), and free them on RPMSG driver remove. Signed-off-by: Abel Vesa --- drivers/misc/fastrpc.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c index b123b6783920..971d4fc697fa 100644 --- a/drivers/misc/fastrpc.c +++ b/drivers/misc/fastrpc.c @@ -275,6 +275,7 @@ struct fastrpc_channel_ctx { struct fastrpc_device *secure_fdevice; struct fastrpc_device *fdevice; struct fastrpc_buf *remote_heap; + struct list_head invoke_interrupted_mmaps; bool secure; bool unsigned_support; }; @@ -1119,6 +1120,7 @@ static int fastrpc_internal_invoke(struct fastrpc_use= r *fl, u32 kernel, struct fastrpc_invoke_args *args) { struct fastrpc_invoke_ctx *ctx =3D NULL; + struct fastrpc_buf *buf, *b; int err =3D 0; =20 if (!fl->sctx) @@ -1182,6 +1184,13 @@ static int fastrpc_internal_invoke(struct fastrpc_us= er *fl, u32 kernel, fastrpc_context_put(ctx); } =20 + if (err =3D=3D -ERESTARTSYS) { + list_for_each_entry_safe(buf, b, &fl->mmaps, node) { + list_del(&buf->node); + list_add_tail(&buf->node, &fl->cctx->invoke_interrupted_mmaps); + } + } + if (err) dev_dbg(fl->sctx->dev, "Error: Invoke Failed %d\n", err); =20 @@ -2281,6 +2290,7 @@ static int fastrpc_rpmsg_probe(struct rpmsg_device *r= pdev) dev_set_drvdata(&rpdev->dev, data); dma_set_mask_and_coherent(rdev, DMA_BIT_MASK(32)); INIT_LIST_HEAD(&data->users); + INIT_LIST_HEAD(&data->invoke_interrupted_mmaps); spin_lock_init(&data->lock); idr_init(&data->ctx_idr); data->domain_id =3D domain_id; @@ -2305,6 +2315,7 @@ static void fastrpc_notify_users(struct fastrpc_user = *user) static void fastrpc_rpmsg_remove(struct rpmsg_device *rpdev) { struct fastrpc_channel_ctx *cctx =3D dev_get_drvdata(&rpdev->dev); + struct fastrpc_buf *buf, *b; struct fastrpc_user *user; unsigned long flags; =20 @@ -2319,6 +2330,11 @@ static void fastrpc_rpmsg_remove(struct rpmsg_device= *rpdev) if (cctx->secure_fdevice) misc_deregister(&cctx->secure_fdevice->miscdev); =20 + list_for_each_entry_safe(buf, b, &cctx->invoke_interrupted_mmaps, node) { + list_del(&buf->node); + fastrpc_buf_free(buf); + } + if (cctx->remote_heap) fastrpc_buf_free(cctx->remote_heap); =20 --=20 2.34.1 From nobody Mon Apr 6 20:11:41 2026 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 4AB68ECAAD8 for ; Fri, 16 Sep 2022 15:42:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229919AbiIPPl6 (ORCPT ); Fri, 16 Sep 2022 11:41:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229769AbiIPPli (ORCPT ); Fri, 16 Sep 2022 11:41:38 -0400 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41C37B07D9 for ; Fri, 16 Sep 2022 08:41:29 -0700 (PDT) Received: by mail-ej1-x632.google.com with SMTP id r18so50301540eja.11 for ; Fri, 16 Sep 2022 08:41:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=3rWhpVU0FxYCOEFcDMaJ3/dzkVgGg4KH/F7dataNBvc=; b=WpeV0Sx4Da9Ad4X7fCVSIaKjmwghRQAGsYDw4LogGRg2EdktF9TPMCULNbLzZkw98M aP4HaqOQZ5+GzNQu4Y3aOgQP8w47XIPaMhPXPzmT3G7f8kKpTuH/y472OEnOr6KdjihZ 0yPJbavjaDnPAdnxSR/xUZl+pTwMrXmOFNeQbvzvL8Qae3Mr54Rhiv8p6y3iCzzE52IJ 0IfVvsx5KaRkaxLdrNCHjKupiwDL3IASqT+H0G2bfd6xLch/nQu04dYAiWlre3oIjMji butUoFjX70GkEDrVQmyF3GAecppcR0wXzByw9hgzZC2m7kCzd/WehjANL/RNIufBAbOr ktEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=3rWhpVU0FxYCOEFcDMaJ3/dzkVgGg4KH/F7dataNBvc=; b=K8ER4lT2O3ZTTrbdr2iIB/rns4NJ76PFxU5a7IvobVDxo5Y4KHQ17xEURvy++C10+c uZ6o9bHmxBpGchQfiwBgC8MOThC/epPNy2bKm12qgURvC7lqxvXaevioOWuTkSAU32tX YTtLXar1nDrBydrgoWCI7gcFJBTHDuSRCKI3zSj4Z7Qq2u7Wd+V8oqR7gYuLoixXleuY c+dzOms9GUyv2s/fleIndCR0j97/FViXSnTsl2H3uali23jbe5hl6M02dwzyhcyKw9na BoONjFQ5sWUS7v7I5Qpfy6mnmi6QUmf6mNlMxiJb17xm72KfWdvdgOEW3vw0krsLH0A0 wmVw== X-Gm-Message-State: ACrzQf0vLCnwxNYtToCMQAdQW9fdICYfvhv6cp+qcES8HDvnvP0CV5O6 6BfUM4aOFPVVOpT5k7A8uRQQqw== X-Google-Smtp-Source: AMsMyM5qELENsKyN4y9BUf9rbsxXWYMdsbLMVjZZlNvHHrgUdUHakR00cq8lmIvn8es9TIISjx8Qnw== X-Received: by 2002:a17:907:2c77:b0:77c:59aa:c011 with SMTP id ib23-20020a1709072c7700b0077c59aac011mr4122782ejc.724.1663342887927; Fri, 16 Sep 2022 08:41:27 -0700 (PDT) Received: from hackbox.lan ([94.52.112.99]) by smtp.gmail.com with ESMTPSA id e10-20020a1709062c0a00b0073d638a7a89sm10567707ejh.99.2022.09.16.08.41.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Sep 2022 08:41:26 -0700 (PDT) From: Abel Vesa To: Srinivas Kandagatla , Amol Maheshwari , Ekansh Gupta , Bharath Kumar , Himateja Reddy , Anirudh Raghavendra Cc: Arnd Bergmann , Greg Kroah-Hartman , linux-arm-msm@vger.kernel.org, Linux Kernel Mailing List Subject: [PATCH v4 8/9] misc: fastrpc: Add mmap request assigning for static PD pool Date: Fri, 16 Sep 2022 18:41:01 +0300 Message-Id: <20220916154102.1768088-9-abel.vesa@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220916154102.1768088-1-abel.vesa@linaro.org> References: <20220916154102.1768088-1-abel.vesa@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" If the mmap request is to add pages and thre are VMIDs associated with that context, do a call to SCM to reassign that memory. Do not do this for remote heap allocation, that is done on init create static process only. Co-developed-by: Srinivas Kandagatla Signed-off-by: Srinivas Kandagatla Signed-off-by: Abel Vesa --- drivers/misc/fastrpc.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c index 971d4fc697fa..b45f1285317a 100644 --- a/drivers/misc/fastrpc.c +++ b/drivers/misc/fastrpc.c @@ -1841,8 +1841,9 @@ static int fastrpc_req_mmap(struct fastrpc_user *fl, = char __user *argp) if (copy_from_user(&req, argp, sizeof(req))) return -EFAULT; =20 - if (req.flags !=3D ADSP_MMAP_ADD_PAGES) { + if (req.flags !=3D ADSP_MMAP_ADD_PAGES && req.flags !=3D ADSP_MMAP_REMOTE= _HEAP_ADDR) { dev_err(dev, "flag not supported 0x%x\n", req.flags); + return -EINVAL; } =20 @@ -1888,6 +1889,22 @@ static int fastrpc_req_mmap(struct fastrpc_user *fl,= char __user *argp) /* let the client know the address to use */ req.vaddrout =3D rsp_msg.vaddr; =20 + /* Add memory to static PD pool, protection thru hypervisor */ + if (req.flags !=3D ADSP_MMAP_REMOTE_HEAP_ADDR && fl->cctx->vmcount) { + struct qcom_scm_vmperm perm; + int err =3D 0; + + perm.vmid =3D QCOM_SCM_VMID_HLOS; + perm.perm =3D QCOM_SCM_PERM_RWX; + err =3D qcom_scm_assign_mem(buf->phys, buf->size, + &(fl->cctx->vmperms[0].vmid), &perm, 1); + if (err) { + dev_err(fl->sctx->dev, "Failed to assign memory phys 0x%llx size 0x%llx= err %d", + buf->phys, buf->size, err); + goto err_assign; + } + } + spin_lock(&fl->lock); list_add_tail(&buf->node, &fl->mmaps); spin_unlock(&fl->lock); --=20 2.34.1 From nobody Mon Apr 6 20:11:41 2026 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 06752ECAAD8 for ; Fri, 16 Sep 2022 15:42:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229824AbiIPPmE (ORCPT ); Fri, 16 Sep 2022 11:42:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229782AbiIPPlj (ORCPT ); Fri, 16 Sep 2022 11:41:39 -0400 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC578B07DE for ; Fri, 16 Sep 2022 08:41:30 -0700 (PDT) Received: by mail-ej1-x633.google.com with SMTP id lh5so8552475ejb.10 for ; Fri, 16 Sep 2022 08:41:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=no7tB6bV0ki3w63AwdNBLJM9I4TS3ao6JAtYcR5QLHI=; b=MkX1LmCiFNkymAw7/cm0E87wHSpBIjlKLh2pS+wk9Dx1VDw/5ZesX+dbkQhSYsvqas DKO7XpcpcdTx5hf1VKi6ZKQjc7bk8rjqMLk9f1j7ksbv93kAt8IoBrMYVo6G/fvAWTtf X7wnjvn0XVp6cO7wswwEv/wQTrqby7mtcFcwHCOtJvU8peajX9CMVPZ+9Ba0gVLRBSWq XroAAGLgUm5F0tcH5ZKO2eOAXrfZO+3U7+xixHgt11WClddvAfNEsusNULrW0fD0v2SL 5VNyNtLRA3u7AsyVzVoMMwDs+sZIquTpDeitbCpNRSVwong/GPTVYgnGq9scPtP01Bke E+uA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=no7tB6bV0ki3w63AwdNBLJM9I4TS3ao6JAtYcR5QLHI=; b=vUstHlgHahWvMayX+A1wlXsvlCoL331A+aleurJSDATf4BJve3yFP/BeX2N1rSeUah bTbRpj6T2DHAw07f8aq/AMB9mzJfbcKYW5sFYMA/CGbFn0Mb30FQHGU1j8pvSYKd3ba9 naaWM5R1DdnOzbVQLm2Tpdr30UB0EcwkRV7dOGqFCkXczJmsuIVEcjIAxBL9ci9zTuj8 kaN74AbFWmbB2tUfCPU0pjL7Byl1jKLkFpHgbJG58yKo/1AgMkfFXGGKQ07Nwvr05RWf BYriSaMuIIvuwKtRA6DtavDG0v9wHGU+wS6NuzKTwF3ZcCsb8WRdeupzRwu7jJsCPG7u 5oyw== X-Gm-Message-State: ACrzQf3+33+x0c5YlfEysaiY/bA4Us6JDgr+SwIw6y/h8lBArX8B/7Xk lkRuALkfeL5vz6/xk/py83z8LA== X-Google-Smtp-Source: AMsMyM4sDY5qZ/oOMrDS/0nBCG8jebVhHBkD1sEZ6NjuBfIhyE3Svh4iUuAcg4sWS4LsvubNN+6g9g== X-Received: by 2002:a17:907:2ccb:b0:77b:bdab:674a with SMTP id hg11-20020a1709072ccb00b0077bbdab674amr3998341ejc.241.1663342889922; Fri, 16 Sep 2022 08:41:29 -0700 (PDT) Received: from hackbox.lan ([94.52.112.99]) by smtp.gmail.com with ESMTPSA id e10-20020a1709062c0a00b0073d638a7a89sm10567707ejh.99.2022.09.16.08.41.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Sep 2022 08:41:28 -0700 (PDT) From: Abel Vesa To: Srinivas Kandagatla , Amol Maheshwari , Ekansh Gupta , Bharath Kumar , Himateja Reddy , Anirudh Raghavendra Cc: Arnd Bergmann , Greg Kroah-Hartman , linux-arm-msm@vger.kernel.org, Linux Kernel Mailing List Subject: [PATCH v4 9/9] misc: fastrpc: Add dma_mask to fastrpc_channel_ctx Date: Fri, 16 Sep 2022 18:41:02 +0300 Message-Id: <20220916154102.1768088-10-abel.vesa@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220916154102.1768088-1-abel.vesa@linaro.org> References: <20220916154102.1768088-1-abel.vesa@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" dma_set_mask_and_coherent only updates the mask to which the device dma_mask pointer points to. Add a dma_mask to the channel ctx and set the device dma_mask to point to that, otherwise the dma_set_mask will return an error and the dma_set_coherent_mask will be skipped too. Co-developed-by: Srinivas Kandagatla Signed-off-by: Srinivas Kandagatla Signed-off-by: Abel Vesa --- drivers/misc/fastrpc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c index b45f1285317a..c39eae8b26c7 100644 --- a/drivers/misc/fastrpc.c +++ b/drivers/misc/fastrpc.c @@ -278,6 +278,7 @@ struct fastrpc_channel_ctx { struct list_head invoke_interrupted_mmaps; bool secure; bool unsigned_support; + u64 dma_mask; }; =20 struct fastrpc_device { @@ -2305,6 +2306,7 @@ static int fastrpc_rpmsg_probe(struct rpmsg_device *r= pdev) kref_init(&data->refcount); =20 dev_set_drvdata(&rpdev->dev, data); + rdev->dma_mask =3D &data->dma_mask; dma_set_mask_and_coherent(rdev, DMA_BIT_MASK(32)); INIT_LIST_HEAD(&data->users); INIT_LIST_HEAD(&data->invoke_interrupted_mmaps); --=20 2.34.1