Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp675589lqb; Fri, 24 May 2024 09:43:20 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUNO+9DEdwVplxOSAZY37xddqgIxSGZFt5hrm++3tM3IZ2/ZZuueSOm8hHtd8z8GS0GhKh8Xn9AE+V58Sm1rmBt8IRBHHJLwUIVScMD3A== X-Google-Smtp-Source: AGHT+IGwJGLEDRT7BAJR2zCO8l/W7ZhC1dy6MljTsUHUlchPgHYBwcauf0c9PMKrUHNDSMGOBUBp X-Received: by 2002:a05:6a00:428e:b0:6f3:1be8:ab68 with SMTP id d2e1a72fcca58-6f8f43c183bmr2797102b3a.32.1716569000154; Fri, 24 May 2024 09:43:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716569000; cv=pass; d=google.com; s=arc-20160816; b=SDgtoOgVnE2JraZAu1UgkPWLBecgifASxlYqtW+kE+InEFk/ZE4Sv6BEWGsxyniFLg 79/xa7V7109Uf8NNmegw3u9ZT5RljcAd0LJI4DvT6m4fFQnj2Xc/+x899G6Qzz0L6yRQ cLPOmeoF2Ef23rsoTLeEm2zoj/74JPGD9nl+oOQ9csIjmDfGXfwq4h+xarKPWt3xgT57 RpOLN2Jk7PfpotBgQpZ2kx8X6ZVTxdmoIkKA81A65CvUHTg8v0wXSyK2HQpFkwv7uasf JPHhtJshUabJbgiBbjGAA9188ZKQfHBOdvKErpOhGEn+izjX9fKrnmMHWD2tJVGR0T0V 1ZUQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=28uW/QO7kF1141euKPJB0QF0y7vWqj8GEzu4drjKWkU=; fh=mtXBjmywHSrwwqTwrs2PRZxISbTB/CbndFHA9O6afMs=; b=A74BRW+iY1X2yt7p1ima+ZD/FVzAoWiUc9lSMDC+xCWmUeI23UFne2rWUUs/q1Mpo0 dtsoiHmYlJKqtTgqOkU13yV2e7pmHeo15VkPfBQ2sBmMHMDcx7R7x0WbhRsagRH1k3An kKFCjoVZs6nInvTllng9xFUUmQyBwYuYlCOp3JsGvOwpYhklJc80j3pH0dSYgVX7GhOC aEOYkbJMp5hRDhsKNBA4+oWJnExZ16Pae/Bzqs0lkP4a9qal5ztt72VXnoupCHiOaKNz 3O2NvLHMW/fZV/511a1NQYJz6yiaHF1UOOmNC8HeD3UXmc+cYe8TgniWeSPZrGIARouX eAhQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@dylanvanassche.be header.s=default2306 header.b=TlR6TeFi; arc=pass (i=1 spf=pass spfdomain=dylanvanassche.be dkim=pass dkdomain=dylanvanassche.be dmarc=pass fromdomain=dylanvanassche.be); spf=pass (google.com: domain of linux-kernel+bounces-188939-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-188939-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=dylanvanassche.be Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-68229283488si1557062a12.572.2024.05.24.09.43.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 09:43:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-188939-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@dylanvanassche.be header.s=default2306 header.b=TlR6TeFi; arc=pass (i=1 spf=pass spfdomain=dylanvanassche.be dkim=pass dkdomain=dylanvanassche.be dmarc=pass fromdomain=dylanvanassche.be); spf=pass (google.com: domain of linux-kernel+bounces-188939-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-188939-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=dylanvanassche.be Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id C25FB28251F for ; Fri, 24 May 2024 16:43:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5305212FB1E; Fri, 24 May 2024 16:43:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=dylanvanassche.be header.i=@dylanvanassche.be header.b="TlR6TeFi" 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 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: 8bit X-Authenticated-Sender: me@dylanvanassche.be X-Virus-Scanned: Clear (ClamAV 0.103.10/27285/Fri May 24 10:30:55 2024) 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 --- 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 *rpdev) int i, err, domain_id = -1, vmcount; const char *domain; bool secure_dsp; + struct device_node *rmem_node; + struct reserved_mem *rmem; unsigned int vmids[FASTRPC_MAX_VMIDS]; err = of_property_read_string(rdev->of_node, "label", &domain); @@ -2297,6 +2299,23 @@ static int fastrpc_rpmsg_probe(struct rpmsg_device *rpdev) } } + rmem_node = of_parse_phandle(rdev->of_node, "memory-region", 0); + if (domain_id == SDSP_DOMAIN_ID && rmem_node) { + u64 src_perms; + + rmem = of_reserved_mem_lookup(rmem_node); + if (!rmem) { + err = -EINVAL; + goto fdev_error; + } + + src_perms = BIT(QCOM_SCM_VMID_HLOS); + + qcom_scm_assign_mem(rmem->base, rmem->size, &src_perms, + data->vmperms, data->vmcount); + + } + secure_dsp = !(of_property_read_bool(rdev->of_node, "qcom,non-secure-domain")); data->secure = secure_dsp; -- 2.45.1