From nobody Mon Feb 9 00:55:53 2026 Received: from www316.your-server.de (www316.your-server.de [88.198.220.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E625E12F363; Fri, 24 May 2024 16:42:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=88.198.220.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716568981; cv=none; b=G7c3d9SH8AcvVg+fgYIklhT6iYEw9Z23Mn+Cj1cuqWK41sUvPYZmeCmCBCWItwdE9ZTan8egl8/cFcqsGIauOhG8840ukyGhdNM0ZTvPlxFTpadu5Wptn657i1GWfVVsQRpwhHr3reD9K1ewJZSbeg8TJmrM4MxauYVIzGpqp8c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716568981; c=relaxed/simple; bh=dtbYC5HHphLVUvfeXkdxQcn0lt59NyLvdwoqXy0rgnw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=G4S8IUesldr0APt1vXPWNo8jUNRmwWbGJWhyf9l0x7POh2//HATq4Bx/gpfDWIq6iPWw/6udscpfjYsvEa3C7jd/Rf6S9q/HZhdSgmZYe7Au0SxJ9GbwgOKoUTQohhYh6pYXvvD3eec3GLAmAGcRF6Eaf4DLu+ODWwsoNNCxSuk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=dylanvanassche.be; spf=pass smtp.mailfrom=dylanvanassche.be; dkim=pass (2048-bit key) header.d=dylanvanassche.be header.i=@dylanvanassche.be header.b=TlR6TeFi; arc=none smtp.client-ip=88.198.220.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=dylanvanassche.be Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=dylanvanassche.be Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=dylanvanassche.be header.i=@dylanvanassche.be header.b="TlR6TeFi" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=dylanvanassche.be; s=default2306; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=28uW/QO7kF1141euKPJB0QF0y7vWqj8GEzu4drjKWkU=; b=TlR6TeFitxLmM2UVmwwiuQFLQV M5YHHzUmS8yJ3eULdTe70zqyBIRnm01b41SpdNBPGGPztGZJvHd5BOcRSB1Caqqw/kVTt75C0xXLJ 10XxVUVMqpySAQlXiWDUoqJCd0JwIaMU3uqwr1ti+rCYhe/QYL5ZmDZMjHARQulSIYQyXaVLH6Y/C R5mdUXjHXTl8hKuuZq0jCSW4YzZWv0Ak8Tz53bnGTe4UatgPl4K58JwN957bpr5nScNIlzbCMcgaH NnKAC4TzaCd6dMSVomJZuX9NgG1qDOhtuyveSC9raohm4l4A4AY8q+NFU4rMY/Vc2NpfXXYrKnZLt JlMe4xgw==; Received: from sslproxy06.your-server.de ([78.46.172.3]) by www316.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sAXYq-000K0R-Ep; Fri, 24 May 2024 18:14:28 +0200 Received: from [169.150.196.25] (helo=desktop.telenet.be) by sslproxy06.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1sAXYp-0000gS-1g; Fri, 24 May 2024 18:14:27 +0200 From: Dylan Van Assche To: Srinivas Kandagatla , Amol Maheshwari , Arnd Bergmann , Greg Kroah-Hartman , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Caleb Connolly , phone-devel@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, Dylan Van Assche Subject: [PATCH v5 1/2] misc: fastrpc: support complete DMA pool access to the DSP Date: Fri, 24 May 2024 18:14:02 +0200 Message-ID: <20240524161423.15392-2-me@dylanvanassche.be> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240524161423.15392-1-me@dylanvanassche.be> References: <20240524161423.15392-1-me@dylanvanassche.be> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Authenticated-Sender: me@dylanvanassche.be X-Virus-Scanned: Clear (ClamAV 0.103.10/27285/Fri May 24 10:30:55 2024) Content-Type: text/plain; charset="utf-8" To support FastRPC Context Banks which aren't mapped via the SMMU, make the whole reserved memory region available to the DSP to allow access to coherent buffers. This is performed by assigning the memory to the DSP via a hypervisor call to set the correct permissions for the Virtual Machines on the DSP. This is only necessary when a memory region is provided for SLPI DSPs so guard this with a domain ID check. Signed-off-by: Dylan Van Assche Reviewed-by: Caleb Connolly Reviewed-by: Dmitry Baryshkov Reviewed-by: Ekansh Gupta --- drivers/misc/fastrpc.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c index 4c67e2c5a82e..c06667b29055 100644 --- a/drivers/misc/fastrpc.c +++ b/drivers/misc/fastrpc.c @@ -2255,6 +2255,8 @@ static int fastrpc_rpmsg_probe(struct rpmsg_device *r= pdev) int i, err, domain_id =3D -1, vmcount; const char *domain; bool secure_dsp; + struct device_node *rmem_node; + struct reserved_mem *rmem; unsigned int vmids[FASTRPC_MAX_VMIDS]; =20 err =3D of_property_read_string(rdev->of_node, "label", &domain); @@ -2297,6 +2299,23 @@ static int fastrpc_rpmsg_probe(struct rpmsg_device *= rpdev) } } =20 + rmem_node =3D of_parse_phandle(rdev->of_node, "memory-region", 0); + if (domain_id =3D=3D SDSP_DOMAIN_ID && rmem_node) { + u64 src_perms; + + rmem =3D of_reserved_mem_lookup(rmem_node); + if (!rmem) { + err =3D -EINVAL; + goto fdev_error; + } + + src_perms =3D BIT(QCOM_SCM_VMID_HLOS); + + qcom_scm_assign_mem(rmem->base, rmem->size, &src_perms, + data->vmperms, data->vmcount); + + } + secure_dsp =3D !(of_property_read_bool(rdev->of_node, "qcom,non-secure-do= main")); data->secure =3D secure_dsp; =20 --=20 2.45.1 From nobody Mon Feb 9 00:55:53 2026 Received: from www316.your-server.de (www316.your-server.de [88.198.220.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C660312F59D; Fri, 24 May 2024 16:43:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=88.198.220.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716568986; cv=none; b=oSycB8rmEkZY7TOIXQNlZjU20SqLF0PPOyU6UcXJGwUzKoN9VT36uY88WnyTQNj6mNNIWoA1++qr2qJbKKvHTplmMSHqOcksdmk9fSGJ5XQxgXGVu1OS6axi36c2gY9GaFqumBPR5N/OzWDLTqY7IoY8/MUp6xy7dpssw/l1ZQU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716568986; c=relaxed/simple; bh=kBGVY6CpHhaXJmaLY3ecr1SySiFvAY8aX82+3SK0Oig=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aJClvQNB9485ziE3cRrzMqfntaoYiBv9phE2r8bhW9fS2/rUlPW/1+NOarb9Jih+eYSTaJXWkHpbro5yg/e3M0ep7ivZ80cyV2kkhNZYCH84wfSe6kjCukcJzjKmhbMcKyrku1Pvqbru049Gxg9OCvpNVr22DPl4t9L19I4SqeE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=dylanvanassche.be; spf=pass smtp.mailfrom=dylanvanassche.be; dkim=pass (2048-bit key) header.d=dylanvanassche.be header.i=@dylanvanassche.be header.b=fIeNgb5/; arc=none smtp.client-ip=88.198.220.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=dylanvanassche.be Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=dylanvanassche.be Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=dylanvanassche.be header.i=@dylanvanassche.be header.b="fIeNgb5/" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=dylanvanassche.be; s=default2306; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=6fL1tq5YHxeAA+CRy4r/mRxLDFZ+WeZfw73SYF9S1o8=; b=fIeNgb5/aQGy0F4vl7Epu1fZZ9 CNd+F7myGRbzKMC1gvEm3TfcvUGp3kPHeAby0d2lRXglZ41AHBNRyHorse3Z4bVuWR4o7VJYcNX4w SUsfCSDtBqIA5n5qlZ36lpvSTfKmVk1mqihqYW3EMSbONg2XKVmh+2x6IEMqBYsVujud8u0HN4byP PZwqFXBDYJ4pPtCsoCZvft+p7sPm6zJgT6HyLEaVxYCnvLVyRT60yLGinjFs4AFNWPQMGSbZpfxYm 2DTU1FcJ87HLyWzStYo1wgxC42vFzyjeKMKO5gyjYiIHI9zw+4x2GQgKqbd8Sp5y/rIGZZXBD2SVF QrCGTxMQ==; Received: from sslproxy06.your-server.de ([78.46.172.3]) by www316.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sAXYq-000K0U-RS; Fri, 24 May 2024 18:14:28 +0200 Received: from [169.150.196.25] (helo=desktop.telenet.be) by sslproxy06.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1sAXYp-0000gS-2w; Fri, 24 May 2024 18:14:28 +0200 From: Dylan Van Assche To: Srinivas Kandagatla , Amol Maheshwari , Arnd Bergmann , Greg Kroah-Hartman , linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Caleb Connolly , phone-devel@vger.kernel.org, ~postmarketos/upstreaming@lists.sr.ht, Dylan Van Assche Subject: [PATCH v5 2/2] misc: fastrpc: use coherent pool for untranslated Compute Banks Date: Fri, 24 May 2024 18:14:03 +0200 Message-ID: <20240524161423.15392-3-me@dylanvanassche.be> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240524161423.15392-1-me@dylanvanassche.be> References: <20240524161423.15392-1-me@dylanvanassche.be> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Authenticated-Sender: me@dylanvanassche.be X-Virus-Scanned: Clear (ClamAV 0.103.10/27285/Fri May 24 10:30:55 2024) Content-Type: text/plain; charset="utf-8" Use fastrpc_remote_heap_alloc to allocate from the FastRPC device instead of the Compute Bank when the session ID is 0. This ensures that the allocation is inside the coherent DMA pool which is already accessible to the DSP. This is necessary to support FastRPC devices which do not have dedicated Compute Banks such as the SLPI on the SDM845. The latter uses an allocated CMA region instead of FastRPC Compute Banks. Signed-off-by: Dylan Van Assche Reviewed-by: Caleb Connolly Reviewed-by: Dmitry Baryshkov Reviewed-by: Ekansh Gupta --- drivers/misc/fastrpc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c index c06667b29055..f53d20e2e07e 100644 --- a/drivers/misc/fastrpc.c +++ b/drivers/misc/fastrpc.c @@ -953,7 +953,10 @@ static int fastrpc_get_args(u32 kernel, struct fastrpc= _invoke_ctx *ctx) =20 ctx->msg_sz =3D pkt_size; =20 - err =3D fastrpc_buf_alloc(ctx->fl, dev, pkt_size, &ctx->buf); + if (ctx->fl->sctx->sid) + err =3D fastrpc_buf_alloc(ctx->fl, dev, pkt_size, &ctx->buf); + else + err =3D fastrpc_remote_heap_alloc(ctx->fl, dev, pkt_size, &ctx->buf); if (err) return err; =20 --=20 2.45.1