Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp918145rdg; Fri, 13 Oct 2023 05:21:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHM9cKmmDyE2H+QnBQZ2Z5kisOm4HJbCBBP3TSm/jDC9RTeTRTBVBACcXEsig+qlalErSf8 X-Received: by 2002:a17:902:e5cc:b0:1c8:a06e:fce9 with SMTP id u12-20020a170902e5cc00b001c8a06efce9mr14739495plf.52.1697199675840; Fri, 13 Oct 2023 05:21:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697199675; cv=none; d=google.com; s=arc-20160816; b=C+dl+UZH+2QT5Fpg5bcYQJ9ErH8/cJCxbPUKucCTnK5M+uGSKntsXQtTsv3Qdi0h14 zD8lhmCJYGuvB0JKl13ORCIIhKwYXphPfXqiZ2CALCR0Q+2faXjgbKtFbVJo9mumU36Q nGtdfqqHHnhDWLt1AlJRzHI3sNO7/jMhXB2J0+PMnmICH/4QPZdGjVHmeWXg7+5CMMXm Iw2M8/vdg79oPw9DxDpAE1Odl7gokzHpWVFITky5dC5D3bkqNLLwgzdZrhhdHj7Ik5lx Q7pxMAIzy4UKoxnkEjWZa5mDQgj431B0IWx6TG1tf5s0+WIZnX4kpr2Dlm/iN5KXQ599 zQXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=9maBdCKwzsg+Tw6rLdAkiCV8ObC+49aKfX4G+YkoatQ=; fh=RIgHi7RtAPv4ykxnXHC0cc+SDPQh5caNeYyAeifbCsE=; b=B4tJgxu8bwMWQsxQHWtzEJqko1a4cllVL3rtudXNW4P4YLYvrF66ouXjO43QFz/Y8n i3CBk3uqb5oNPlBpxcR5GnADij9QeaM8JIaBxY0eTIlGQBotu7p9e5YxgjT4yTI3/z70 xhk2f08eEytyP8dZvPI3eRcTfunvuVGYBNTuQj2xzmYwnSMFb339/0TYqrFzS75beEdN cexqQHzU8bIaDURKo9fDHqblJDei5LffBKv47o13qTehgL561LVzrsqea12GAJOvMdrQ KpCt/WQhQ2ApQ3My7pCmwoojgCF+lpbc7nCchJjjwaJGTYjo7eKp+PQcOLGweiBmvHyg XX5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BEFsVMmI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id ik24-20020a170902ab1800b001c62e8c0a38si4356365plb.256.2023.10.13.05.21.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 05:21:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BEFsVMmI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id B00AF81D82E5; Fri, 13 Oct 2023 05:21:11 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231598AbjJMMUd (ORCPT + 99 others); Fri, 13 Oct 2023 08:20:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231381AbjJMMUZ (ORCPT ); Fri, 13 Oct 2023 08:20:25 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8FA6BD for ; Fri, 13 Oct 2023 05:20:23 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-405497850dbso21111395e9.0 for ; Fri, 13 Oct 2023 05:20:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1697199622; x=1697804422; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9maBdCKwzsg+Tw6rLdAkiCV8ObC+49aKfX4G+YkoatQ=; b=BEFsVMmIwRvJHAbyZNvDMDxdm/DwW4OQ7fypRWFHG9ojfoo2ugG4PXWyJ86aAAXD0G 5Za72ZTNhZEQ+ZSCOSy0AWNowrKWTDZ8YjO1keoAdqYafKru/3VgYQrjNXHTVHHF5QDg EDahkviDjW5aoRpBWp68dMKGFjZzK4QAzrhlZcTV8nj46SqP/f3bZm4nWNN9yDFkTvMk XauohuxUBCdyA4DhPYA/IH2IikeyB0URa5OGxLZ++RxwvRWj24qLLFimTLsJ/Y+0bMEd bD/isGboBydNPagAkQP9bggAYyR1s9A7atlUUlntS86ZyQe5SB5Dt2IFhYteMuQJV4h0 QztQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697199622; x=1697804422; 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:message-id:reply-to; bh=9maBdCKwzsg+Tw6rLdAkiCV8ObC+49aKfX4G+YkoatQ=; b=dTRS8DWUtI3d/kpRLT5uJGRHwOB8ERLpSCapGkKEDM4PH3BmkgdaMdDLKUEEXKyK3O IFlGX+0Crwqj+xwBisljk6mwDgI0BnxmqjwdVkylJE9Lswc8AhSL85Jcjep6tfcZuOWD FZT7YUytvtog8y/9ODjo8D6Zgm2eiCepqInec3vXmbZKS65vRItqzWub7NiAqLzp78v8 TlUluHNEShBNVZqCNQMv+WQPuM65JQ6qnx6czDc7v75vH5UypiTGkG6vBRUUKD3chNYJ j2eAE/fouo1GL8ViiVPIWGtoqiU7+iSjqNCvSykWgTq4xIljZ/W6B5NXk3ikdyS0LJNf L07w== X-Gm-Message-State: AOJu0YwJF5v8qJtmeYtxYBp+L5HV6+mrqNwNjglkV/Pbc1rQ4fOzaqA+ WaK9DsYhGTC+0wdnnZ+6yFK58Q== X-Received: by 2002:a05:600c:3652:b0:3fb:a0fc:1ba1 with SMTP id y18-20020a05600c365200b003fba0fc1ba1mr25171661wmq.35.1697199622323; Fri, 13 Oct 2023 05:20:22 -0700 (PDT) Received: from srini-hackbase.lan ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id o41-20020a05600c512900b0040772934b12sm1806751wms.7.2023.10.13.05.20.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Oct 2023 05:20:21 -0700 (PDT) From: srinivas.kandagatla@linaro.org To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Ekansh Gupta , stable , Srinivas Kandagatla Subject: [PATCH 2/4] misc: fastrpc: Free DMA handles for RPC calls with no arguments Date: Fri, 13 Oct 2023 13:20:05 +0100 Message-Id: <20231013122007.174464-3-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231013122007.174464-1-srinivas.kandagatla@linaro.org> References: <20231013122007.174464-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2086; i=srinivas.kandagatla@linaro.org; h=from:subject; bh=yd97s/oOAaEGvMi6NJfTTxpJrr9MoheU7y7jr4w7r40=; b=owEBbQGS/pANAwAKAXqh/VnHNFU3AcsmYgBlKTX3LLljk1Rqm0luEZuerO0osYjjQnjtc5T/l VVk06mpCA+JATMEAAEKAB0WIQQi509axvzi9vce3Y16of1ZxzRVNwUCZSk19wAKCRB6of1ZxzRV NycsB/46GpsdDKbvvrvpiTY4vbx40oMgV4igrx7GCLJXgtgOfSS6CNWqOWq7U5B6mtKqDkzPwk7 vs6eEK/HWz3ChrLhqkarWT0CFfUV3zPxt/VeSpupZuHkN49gbAj5i5xULjuB9R3q0Ka7RsY76V9 3VDxrbakb47yC1gzfBE4uWNnRsdlaTkgWxdYhy29NTpxkThgigDaoLiTBu4KdohjiDnufMIT/Zk o8kiAVxsqVTnXQw4f18WJslSDSsKAoA9lWJMBxwGnt790yesWEtfvAMXBnS+41eydsHAudPW5Vw NNIXvaC162vaz4Ih0GpfWYLF6S3bCgzlhBmUViLF10c528wn X-Developer-Key: i=srinivas.kandagatla@linaro.org; a=openpgp; fpr=ED6472765AB36EC43B3EF97AD77E3FC0562560D6 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=2.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: ** X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Fri, 13 Oct 2023 05:21:12 -0700 (PDT) From: Ekansh Gupta The FDs for DMA handles to be freed is updated in fdlist by DSP over a remote call. This holds true even for remote calls with no arguments. To handle this, get_args and put_args are needed to be called for remote calls with no arguments also as fdlist is allocated in get_args and FDs updated in fdlist is freed in put_args. Fixes: 8f6c1d8c4f0c ("misc: fastrpc: Add fdlist implementation") Cc: stable Signed-off-by: Ekansh Gupta Signed-off-by: Srinivas Kandagatla --- drivers/misc/fastrpc.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c index fb921975b56d..a52701c1b018 100644 --- a/drivers/misc/fastrpc.c +++ b/drivers/misc/fastrpc.c @@ -1091,6 +1091,7 @@ static int fastrpc_put_args(struct fastrpc_invoke_ctx *ctx, } } + /* Clean up fdlist which is updated by DSP */ for (i = 0; i < FASTRPC_MAX_FDLIST; i++) { if (!fdlist[i]) break; @@ -1157,11 +1158,9 @@ static int fastrpc_internal_invoke(struct fastrpc_user *fl, u32 kernel, if (IS_ERR(ctx)) return PTR_ERR(ctx); - if (ctx->nscalars) { - err = fastrpc_get_args(kernel, ctx); - if (err) - goto bail; - } + err = fastrpc_get_args(kernel, ctx); + if (err) + goto bail; /* make sure that all CPU memory writes are seen by DSP */ dma_wmb(); @@ -1185,14 +1184,12 @@ static int fastrpc_internal_invoke(struct fastrpc_user *fl, u32 kernel, if (err) goto bail; - if (ctx->nscalars) { - /* make sure that all memory writes by DSP are seen by CPU */ - dma_rmb(); - /* populate all the output buffers with results */ - err = fastrpc_put_args(ctx, kernel); - if (err) - goto bail; - } + /* make sure that all memory writes by DSP are seen by CPU */ + dma_rmb(); + /* populate all the output buffers with results */ + err = fastrpc_put_args(ctx, kernel); + if (err) + goto bail; bail: if (err != -ERESTARTSYS && err != -ETIMEDOUT) { -- 2.25.1