From patchwork Thu Mar 7 10:12:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 159830 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp7251561jad; Thu, 7 Mar 2019 02:14:03 -0800 (PST) X-Google-Smtp-Source: APXvYqw00T3bpl81F4tDTBySJy1gDmOXm+9OG1DGIJZecaTyqr4Mz9anbfIAsnCReNi4uidqskxO X-Received: by 2002:a17:902:848b:: with SMTP id c11mr11525037plo.279.1551953642974; Thu, 07 Mar 2019 02:14:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551953642; cv=none; d=google.com; s=arc-20160816; b=EXYvI6tj0YSFWlYWgHXfl4eGX7XaywzAQkXWoS54Tp2W0onWIRjLzgJEql9+OITjHW KHAnoIv5/gjT6XZ6oS02KeFgjn4gOqqr6vle0xxgwObIN+Uq4n2VL58JB5H+aoa6o2GG LaYlIbx755ju7ig7tzoUJ2DBSZrq9u8Vgqy5Ldc9GVT1EhxCfo/AeD9D7bmm7jN0taJx iU4ZtnsJoJ5Ls59Kgpc9EfJRhrLzOApJvoZKM7zI+zwYHlH/EPV4pDiTIVhA96WicPMV sVFdyZs/rodGldx4ozpj6Ob0HQF+m92T+pLoQE+B8xsn27aqyonGXAqfa+TlLcKvsDYd qeSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=BN3mETDxO7NCrA/T4tG8om1pvyGRKVieStW75qGQ3Gs=; b=fOB3+UXTzgF6hpRIcYsAhyuW92TQ5pS8+fUtFAsbzhy4qi6Y6+z0V6HIiLjkKQzHhK BB1PKbf8B0041XpUZiQZJOI0/+tVvSZWjAvcTyygCP1gT1WeZ+MFnQhGP5khd3mYhHS0 Fv9NuswAUIhcoPk8ww95XbppvsH+cIMZ/tRcMprrTNFQAyO5hnfKNKL1+IqFJSF13BX7 vJnw2ZxXlZeUWOir0BZUlz2xGH/XsC8itTW5oUFUzKKXK+tqFVotnjmOPVCq4eRf6EPo Zp2K9y27VZai52LONGyXdEtd0dJWBM3qPFu1CleV8AW/Z2z/pRbQHB/9oO/0kermXKKi C5JA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jgKi668E; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u12si3740874plr.335.2019.03.07.02.14.02; Thu, 07 Mar 2019 02:14:02 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jgKi668E; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726614AbfCGKOB (ORCPT + 31 others); Thu, 7 Mar 2019 05:14:01 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:37025 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726275AbfCGKNT (ORCPT ); Thu, 7 Mar 2019 05:13:19 -0500 Received: by mail-wr1-f68.google.com with SMTP id w6so16710632wrs.4 for ; Thu, 07 Mar 2019 02:13:17 -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=BN3mETDxO7NCrA/T4tG8om1pvyGRKVieStW75qGQ3Gs=; b=jgKi668EjRONXhMjHjPq8+3uT7o5yYGkQ9wIoIksWJXOPIpPefAZ1jNU6RZmAqNb1N 1zAC0UGzSDI1POOztCGLPgVR55cYHcBT7PDR8K6Elp6XjWxqDxoYIVxbchuJx4FEQW8V z+3eFNJftGE738LHlkVnfKlG8LAW2lBNqYX8EI13xsv0ubkcsY9QHD1ssQIfU6KbK/0y IwgmSItGIf6Nl3pvohJYc+TKqBJGTR0GKN69/RVLKsqW5WVZpMnaXDMqDmuXqn7u3lfZ pyPvfuGmWoM/Rb8gszX4NO21kbKRw43BweTajPHpkCRVBJTvNZhpZNeUlheM9GMu0d4i k5gA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BN3mETDxO7NCrA/T4tG8om1pvyGRKVieStW75qGQ3Gs=; b=SJw4a1rFIx1ajpBUtYljldEoKZIS8nD2cRgI0J7lP3IeCBd699/iXgE+QxeV+k8Sxp vCxbju1yaIoiQxX5x65q33Q978zu0B9aS0INwrR+f92j/QAu3M9XXMO15ECHnpdeEPqx 7hzHhSUBaFNl79DaiRshSw5TDr6dRQ9lRRX7/GJf3XKQDU4wlRL3nPToyDrZxxV9Eiwj OZ83xchww1IRzlmqix5R9FcnZsmLZlUxIY5KkPRMDCjk9SRf9X36WJxRgYisUrAIiYbc emLXV9QCfKmJwX+20UavhSl8zKvajalWXd+HuNRCIJuf7HNr6GNvcAf4WJ7cYo5ySEU6 lQGw== X-Gm-Message-State: APjAAAXkZDQsbv7s6xyVFbAcdszBvgp7sm8BdLuxSVbRFtdkwYMo2Tfj bXmycyucru16ekUOZSrrwgSY+w== X-Received: by 2002:adf:ce90:: with SMTP id r16mr6218993wrn.64.1551953597047; Thu, 07 Mar 2019 02:13:17 -0800 (PST) Received: from srini-hackbox.lan (cpc89974-aztw32-2-0-cust43.18-1.cable.virginm.net. [86.30.250.44]) by smtp.gmail.com with ESMTPSA id n9sm3529767wmi.33.2019.03.07.02.13.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 07 Mar 2019 02:13:16 -0800 (PST) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org, arnd@arndb.de Cc: linux-kernel@vger.kernel.org, bjorn.andersson@linaro.org, bkumar@qti.qualcomm.com, linux-arm-msm@vger.kernel.org, ktadakam@qti.qualcomm.com, Thierry Escande , Srinivas Kandagatla Subject: [PATCH 2/8] misc: fastrpc: Fix a possible double free Date: Thu, 7 Mar 2019 10:12:23 +0000 Message-Id: <20190307101229.7856-3-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190307101229.7856-1-srinivas.kandagatla@linaro.org> References: <20190307101229.7856-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Thierry Escande This patch fixes the error exit path of fastrpc_init_create_process(). If the DMA allocation or the DSP invoke fails the fastrpc_map was freed but not removed from the mapping list leading to a double free once the mapping list is emptied in fastrpc_device_release(). [srinivas kandagatla]: Cleaned up error path labels and reset init mem to NULL after free Fixes: d73f71c7c6ee("misc: fastrpc: Add support for create remote init process") Signed-off-by: Thierry Escande Signed-off-by: Srinivas Kandagatla --- drivers/misc/fastrpc.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) -- 2.21.0 diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c index 82e7217ae87a..8fbcc607a77e 100644 --- a/drivers/misc/fastrpc.c +++ b/drivers/misc/fastrpc.c @@ -853,12 +853,12 @@ static int fastrpc_init_create_process(struct fastrpc_user *fl, if (copy_from_user(&init, argp, sizeof(init))) { err = -EFAULT; - goto bail; + goto err; } if (init.filelen > INIT_FILELEN_MAX) { err = -EINVAL; - goto bail; + goto err; } inbuf.pgid = fl->tgid; @@ -872,17 +872,15 @@ static int fastrpc_init_create_process(struct fastrpc_user *fl, if (init.filelen && init.filefd) { err = fastrpc_map_create(fl, init.filefd, init.filelen, &map); if (err) - goto bail; + goto err; } memlen = ALIGN(max(INIT_FILELEN_MAX, (int)init.filelen * 4), 1024 * 1024); err = fastrpc_buf_alloc(fl, fl->sctx->dev, memlen, &imem); - if (err) { - fastrpc_map_put(map); - goto bail; - } + if (err) + goto err_alloc; fl->init_mem = imem; args[0].ptr = (u64)(uintptr_t)&inbuf; @@ -918,13 +916,24 @@ static int fastrpc_init_create_process(struct fastrpc_user *fl, err = fastrpc_internal_invoke(fl, true, FASTRPC_INIT_HANDLE, sc, args); + if (err) + goto err_invoke; - if (err) { + kfree(args); + + return 0; + +err_invoke: + fl->init_mem = NULL; + fastrpc_buf_free(imem); +err_alloc: + if (map) { + spin_lock(&fl->lock); + list_del(&map->node); + spin_unlock(&fl->lock); fastrpc_map_put(map); - fastrpc_buf_free(imem); } - -bail: +err: kfree(args); return err; From patchwork Thu Mar 7 10:12:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 159829 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp7251405jad; Thu, 7 Mar 2019 02:13:52 -0800 (PST) X-Google-Smtp-Source: APXvYqwd7bstfUy2FHVbXk0E02X/cgKPi8NWMQQI+bcyI7JrKfDO1VJPYkX6yQ6wu+f8X66y4tQT X-Received: by 2002:a17:902:7293:: with SMTP id d19mr11496468pll.29.1551953632204; Thu, 07 Mar 2019 02:13:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551953632; cv=none; d=google.com; s=arc-20160816; b=g6oa1qpkDSIrvf4w3Xck0AbA3y9mdiwzpnJktVviZo+KBpJtFauUj2/l2IOCUDdxF1 qmhJmsl1KObYeWE/ueqLHxRX5svO9DIUEOUA1xwDc2aEB2BTgiHlZUyBdfVjXqXZpj+p Px3pR8uqv5YwJm2GIz8e59Qhe0OHIXEPGB7yUiFUFFAaVs/4Z5LtSGae5mKYoOCE78yZ z5Dm0pv8vOAWBa0qiSoKlE+LY6hqdG/8YysOloQ70yRFPg/4OGDEFTqr0BI+pmzJJv3r r+6SMgoKgAe4Rj6hVVJ3s5xJrsuEtXONRFSJAJP5pnKhXsIG5+5QzSd/a+kYQR6yfpwG rPAQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=kcTfOS4Sv44YjvbK1N2vMmkz/JIfFV0zpTQndWw2C2o=; b=OeAl5cJiKUFTgQi98dpl5luwtI20N95mxtZRv9N2AnGUxGORaMIO8mFaqxV9Xb9otj MkJCbFmP8X8+xTok2NCvPk2di+73vRB1T2fIKmgfxdLlZxSh4ud0o2wLpebRpnzZ3SNs FWbxNBvs5CmqJkWQ4FcwEta7X/P6X4I08ItPnr02PH49hRrBWqxcL+Kf2yLHp54VbQQ0 TFMi4KXTaP6wLKFdV2WWofjWIuXFVXEjzSmn+iG66WvwFved5IDb9wBkr1N7DASr+k7J GFHX2QjDYJ9UF+wqp1rWwUcRg2zgA9tb1TwRm56zIEFbIE4bPm4eyGn8B1A0OAxar5DD wQQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wO3FSUKZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 61si3893632plc.134.2019.03.07.02.13.51; Thu, 07 Mar 2019 02:13:52 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wO3FSUKZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726586AbfCGKNu (ORCPT + 31 others); Thu, 7 Mar 2019 05:13:50 -0500 Received: from mail-wr1-f68.google.com ([209.85.221.68]:37029 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726425AbfCGKNV (ORCPT ); Thu, 7 Mar 2019 05:13:21 -0500 Received: by mail-wr1-f68.google.com with SMTP id w6so16710732wrs.4 for ; Thu, 07 Mar 2019 02:13:19 -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=kcTfOS4Sv44YjvbK1N2vMmkz/JIfFV0zpTQndWw2C2o=; b=wO3FSUKZJKQmqaRn4bNgRRQBbS/urgDEedce1emHnQPNxHN6bwAxu+FxLng93k74x6 tm+gtcaPAh/X9TGu+We7nzdtQp+m+vlnVaFev0bg4sDarrgJG94EumxJ/0zTfAsmGNRi 2L+qGoAGLzPKi+ClzCASGnJmHhFkrwu5DU/CsG60PYUmX8l/50R97lhQqvkNbf51kVkE VNqqvwrJWwkhCGnpnX2JUbNx3uP0FWZ7zL2roK8yq7I64utV1PnOx2HRYdiBh0Xfd2Ti XsKmH+Bl1fDE9NTzKfLkcoZHJlMKdTY7CBGHfmyuCiHjI0GAtklN0t4Kzb+o+WqEnAxt s4WA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kcTfOS4Sv44YjvbK1N2vMmkz/JIfFV0zpTQndWw2C2o=; b=E+Bx2r6KlrcCytrodgKjES1bsMTpNBZZ0PEJtZDOsT2UetuNscoO4OHahNRhfQ5hj5 27FjPX1eeANdqgUz9RCteoeoKbGvYI0nbBuV/qpZLBvOn87d9u229xM3OTr3mkB7ut6Z aCjMJN81VePS1l2N7zHeqmKmnQiH76v/7x7pBeHFKGqqX+8oFFsGbsxrFtpMqvhDDsIA Tlj+kbCTZq4oQBhdxNYg4U16MNLmgoUliaIZpo7owBK5f7XxP8kKFgObMG3MiZzohrZs hUvhDeus9JSEFdNyr8qtMIEwnaQ8birRQk+vriUiWcpw1hgPt9E8sLkwkHKB0Cpyp/hZ j7Xg== X-Gm-Message-State: APjAAAU93FhAvMD1eIPlFz8ak5L9kJUIbeXuvuJWW3zTrAVZfdZkRvOY 9AFA8io1NwEc52Lt8kwKAQIdHA== X-Received: by 2002:adf:afe3:: with SMTP id y35mr6136409wrd.318.1551953599096; Thu, 07 Mar 2019 02:13:19 -0800 (PST) Received: from srini-hackbox.lan (cpc89974-aztw32-2-0-cust43.18-1.cable.virginm.net. [86.30.250.44]) by smtp.gmail.com with ESMTPSA id n9sm3529767wmi.33.2019.03.07.02.13.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 07 Mar 2019 02:13:18 -0800 (PST) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org, arnd@arndb.de Cc: linux-kernel@vger.kernel.org, bjorn.andersson@linaro.org, bkumar@qti.qualcomm.com, linux-arm-msm@vger.kernel.org, ktadakam@qti.qualcomm.com, Srinivas Kandagatla Subject: [PATCH 4/8] misc: fastrpc: use correct spinlock variant Date: Thu, 7 Mar 2019 10:12:25 +0000 Message-Id: <20190307101229.7856-5-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190307101229.7856-1-srinivas.kandagatla@linaro.org> References: <20190307101229.7856-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org context spin lock can be interrupted from callback path so use correct spinlock so that we do not hit spinlock recursion. Fixes: c68cfb718c8f ("misc: fastrpc: Add support for context Invoke method") Signed-off-by: Srinivas Kandagatla --- drivers/misc/fastrpc.c | 48 +++++++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 19 deletions(-) -- 2.21.0 diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c index 753d62ceb1fb..f71b5faae1dd 100644 --- a/drivers/misc/fastrpc.c +++ b/drivers/misc/fastrpc.c @@ -283,6 +283,7 @@ static void fastrpc_context_free(struct kref *ref) { struct fastrpc_invoke_ctx *ctx; struct fastrpc_channel_ctx *cctx; + unsigned long flags; int i; ctx = container_of(ref, struct fastrpc_invoke_ctx, refcount); @@ -294,9 +295,9 @@ static void fastrpc_context_free(struct kref *ref) if (ctx->buf) fastrpc_buf_free(ctx->buf); - spin_lock(&cctx->lock); + spin_lock_irqsave(&cctx->lock, flags); idr_remove(&cctx->ctx_idr, ctx->ctxid >> 4); - spin_unlock(&cctx->lock); + spin_unlock_irqrestore(&cctx->lock, flags); kfree(ctx->maps); kfree(ctx); @@ -326,6 +327,7 @@ static struct fastrpc_invoke_ctx *fastrpc_context_alloc( { struct fastrpc_channel_ctx *cctx = user->cctx; struct fastrpc_invoke_ctx *ctx = NULL; + unsigned long flags; int ret; ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); @@ -360,15 +362,15 @@ static struct fastrpc_invoke_ctx *fastrpc_context_alloc( list_add_tail(&ctx->node, &user->pending); spin_unlock(&user->lock); - spin_lock(&cctx->lock); + spin_lock_irqsave(&cctx->lock, flags); ret = idr_alloc_cyclic(&cctx->ctx_idr, ctx, 1, FASTRPC_CTX_MAX, GFP_ATOMIC); if (ret < 0) { - spin_unlock(&cctx->lock); + spin_unlock_irqrestore(&cctx->lock, flags); goto err_idr; } ctx->ctxid = ret << 4; - spin_unlock(&cctx->lock); + spin_unlock_irqrestore(&cctx->lock, flags); kref_init(&ctx->refcount); @@ -948,9 +950,10 @@ static struct fastrpc_session_ctx *fastrpc_session_alloc( struct fastrpc_channel_ctx *cctx) { struct fastrpc_session_ctx *session = NULL; + unsigned long flags; int i; - spin_lock(&cctx->lock); + spin_lock_irqsave(&cctx->lock, flags); for (i = 0; i < cctx->sesscount; i++) { if (!cctx->session[i].used && cctx->session[i].valid) { cctx->session[i].used = true; @@ -958,7 +961,7 @@ static struct fastrpc_session_ctx *fastrpc_session_alloc( break; } } - spin_unlock(&cctx->lock); + spin_unlock_irqrestore(&cctx->lock, flags); return session; } @@ -966,9 +969,11 @@ static struct fastrpc_session_ctx *fastrpc_session_alloc( static void fastrpc_session_free(struct fastrpc_channel_ctx *cctx, struct fastrpc_session_ctx *session) { - spin_lock(&cctx->lock); + unsigned long flags; + + spin_lock_irqsave(&cctx->lock, flags); session->used = false; - spin_unlock(&cctx->lock); + spin_unlock_irqrestore(&cctx->lock, flags); } static int fastrpc_release_current_dsp_process(struct fastrpc_user *fl) @@ -994,12 +999,13 @@ static int fastrpc_device_release(struct inode *inode, struct file *file) struct fastrpc_channel_ctx *cctx = fl->cctx; struct fastrpc_invoke_ctx *ctx, *n; struct fastrpc_map *map, *m; + unsigned long flags; fastrpc_release_current_dsp_process(fl); - spin_lock(&cctx->lock); + spin_lock_irqsave(&cctx->lock, flags); list_del(&fl->user); - spin_unlock(&cctx->lock); + spin_unlock_irqrestore(&cctx->lock, flags); if (fl->init_mem) fastrpc_buf_free(fl->init_mem); @@ -1027,6 +1033,7 @@ static int fastrpc_device_open(struct inode *inode, struct file *filp) { struct fastrpc_channel_ctx *cctx = miscdev_to_cctx(filp->private_data); struct fastrpc_user *fl = NULL; + unsigned long flags; fl = kzalloc(sizeof(*fl), GFP_KERNEL); if (!fl) @@ -1050,9 +1057,9 @@ static int fastrpc_device_open(struct inode *inode, struct file *filp) return -EBUSY; } - spin_lock(&cctx->lock); + spin_lock_irqsave(&cctx->lock, flags); list_add_tail(&fl->user, &cctx->users); - spin_unlock(&cctx->lock); + spin_unlock_irqrestore(&cctx->lock, flags); return 0; } @@ -1208,6 +1215,7 @@ static int fastrpc_cb_probe(struct platform_device *pdev) struct fastrpc_session_ctx *sess; struct device *dev = &pdev->dev; int i, sessions = 0; + unsigned long flags; cctx = dev_get_drvdata(dev->parent); if (!cctx) @@ -1215,7 +1223,7 @@ static int fastrpc_cb_probe(struct platform_device *pdev) of_property_read_u32(dev->of_node, "qcom,nsessions", &sessions); - spin_lock(&cctx->lock); + spin_lock_irqsave(&cctx->lock, flags); sess = &cctx->session[cctx->sesscount]; sess->used = false; sess->valid = true; @@ -1236,7 +1244,7 @@ static int fastrpc_cb_probe(struct platform_device *pdev) } } cctx->sesscount++; - spin_unlock(&cctx->lock); + spin_unlock_irqrestore(&cctx->lock, flags); dma_set_mask(dev, DMA_BIT_MASK(32)); return 0; @@ -1246,16 +1254,17 @@ static int fastrpc_cb_remove(struct platform_device *pdev) { struct fastrpc_channel_ctx *cctx = dev_get_drvdata(pdev->dev.parent); struct fastrpc_session_ctx *sess = dev_get_drvdata(&pdev->dev); + unsigned long flags; int i; - spin_lock(&cctx->lock); + spin_lock_irqsave(&cctx->lock, flags); for (i = 1; i < FASTRPC_MAX_SESSIONS; i++) { if (cctx->session[i].sid == sess->sid) { cctx->session[i].valid = false; cctx->sesscount--; } } - spin_unlock(&cctx->lock); + spin_unlock_irqrestore(&cctx->lock, flags); return 0; } @@ -1337,11 +1346,12 @@ static void fastrpc_rpmsg_remove(struct rpmsg_device *rpdev) { struct fastrpc_channel_ctx *cctx = dev_get_drvdata(&rpdev->dev); struct fastrpc_user *user; + unsigned long flags; - spin_lock(&cctx->lock); + spin_lock_irqsave(&cctx->lock, flags); list_for_each_entry(user, &cctx->users, user) fastrpc_notify_users(user); - spin_unlock(&cctx->lock); + spin_unlock_irqrestore(&cctx->lock, flags); misc_deregister(&cctx->miscdev); of_platform_depopulate(&rpdev->dev); From patchwork Thu Mar 7 10:12:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 159825 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp7251181jad; Thu, 7 Mar 2019 02:13:38 -0800 (PST) X-Google-Smtp-Source: APXvYqxleeUuYH+M+iEfn+0GlODr0NIZhM5y9dpEnMaqRu3TtS7ZEjXCOR+xPdzPFAmSzDlAJU2j X-Received: by 2002:aa7:8a0a:: with SMTP id m10mr11934237pfa.129.1551953618145; Thu, 07 Mar 2019 02:13:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551953618; cv=none; d=google.com; s=arc-20160816; b=Ta9Q9Os6MaxaKIPJwaiivVMs1UUbJ/Uo1u8WcLAwtmI7cvCPrzPi8S+UHUxuu4bKKV UEyiJk8shSVveIG+eZaNG6eS7skHeNf/KQC1V01H5Gv+N913u2WMRzPyggZzV+l0HsLN Notvp7NppCiBJeitSohwAB/KtSGEK54r1eZ+/+5vq6VAD5mIDwhd0tfN8xB6BYcImcIo Oxd94LthThBBnBifRKvMM4skzRi45iK2+XGFoz7n+I6bSvcedFV66hzn6MoydmGms7VK gObSnv56Na1e2lV5ERURAzkuGTPKgW6980BiBS5lbxaVEJlBu3SDpiPuYAK2N9ed4fZc cPtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=QZXoHVQPaXkLWzJQl44F85OjDTIH9iGYQGdOEpv6nuY=; b=bWW69LMzPClUFtg5QcjAAbbd/lGvSel+V4p+Fib49UZTq8fC7WZ20sq8BKMrVhHj4B Vbs3XZuobtCKgip/sEKmrihBNP/7x6/GMcyICnvJrs2W30UKSCgpk9XUzvGMSNAQo0Xj 0D6hkcpgog2DHgqiOIT+u1S4JwpZdfKvcVQLWGrUYDIW3ODVdyaICj80vS+aV9x7LewT 0tw1+U3FxjaCWJ5i29USlGwyDFTMyCvHMYRnft11pVPVXt4zWcA9/M9r9jWBxj5Ffzlw foBJuF7hqAcYgT2HPqJB4oXY0CPaRUMK9W2wxaDvhf8DqKUTNvRA7kJChKFLRschgBDz ZSBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pMjDtZJP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p25si3957312pff.77.2019.03.07.02.13.37; Thu, 07 Mar 2019 02:13:38 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pMjDtZJP; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726360AbfCGKNZ (ORCPT + 31 others); Thu, 7 Mar 2019 05:13:25 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:39941 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726442AbfCGKNW (ORCPT ); Thu, 7 Mar 2019 05:13:22 -0500 Received: by mail-wr1-f65.google.com with SMTP id y6so1563337wrn.7 for ; Thu, 07 Mar 2019 02:13:21 -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=QZXoHVQPaXkLWzJQl44F85OjDTIH9iGYQGdOEpv6nuY=; b=pMjDtZJPJQTw0RSw2Ka5bahtRkfV765FB9eL2raft0YXUfyRD7NI7HsQwp3PwWVC8z 5PH6MjR3S88X8GTvDCApUmoebrLIHWKhVliVHwPxFsvxG0V0nfpbok5UKiL3faQZ2DQC OjpxtrGMQI7yoXR2KW2LqFxn7YTiSenp6jyMkxYDt4OgvLBJe3a1fWJp9EskU2WBtjz0 1dnocfoXzTm9I1CBCzj0Xu5N6W5KmXFppVhQZ83lC0q4CwXyAFGIyshkgdRkB4QBm+OZ ZeXUqREKk2Dew0l0wtcnMTSWxR7V4+8CiB5UFbdZrGsq/t1YvfDTmOOIRFfROBXDRpvv OnhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QZXoHVQPaXkLWzJQl44F85OjDTIH9iGYQGdOEpv6nuY=; b=XHUM1c/+J1paIJoekdhoB/h1UA6KeAYJ8MC9sdsiVxdrOKf/SPPrPzJf9I5ASKFvYW wyCdVt0rbEmaGgCPsar3k7IykW0doU+hkZpBkGXUSSiMfE+RqH6ZLIs/Zk7+n0rUrBba rm3a+k1wQKVr51o6Otyzg+Q69Ag2vOtbLAyAcPjNJDKIe1MUCUDG2Rg/XHA0HmY1YAMz tcQvV7D+B8ZyYkteLBXIKkS9DK/4VK8okyf43SKkDApR3TvzQe0ZBcYxDBI6g4vCVtTg 04w7XIzj6XpXxQ4zQZbpoOS1UgxS1zAdoj6qm7ZTKGTDvX57SQaDwymmEKn75EGUb9H0 gG/A== X-Gm-Message-State: APjAAAUttM8XGCELyERtzNgNkQO44thkWwBTRXUe0m+xAj0ukkX5AfkI LtBSMBQdAfvk7qQ0p5Zqrr24TA== X-Received: by 2002:a5d:690d:: with SMTP id t13mr6067865wru.135.1551953600131; Thu, 07 Mar 2019 02:13:20 -0800 (PST) Received: from srini-hackbox.lan (cpc89974-aztw32-2-0-cust43.18-1.cable.virginm.net. [86.30.250.44]) by smtp.gmail.com with ESMTPSA id n9sm3529767wmi.33.2019.03.07.02.13.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 07 Mar 2019 02:13:19 -0800 (PST) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org, arnd@arndb.de Cc: linux-kernel@vger.kernel.org, bjorn.andersson@linaro.org, bkumar@qti.qualcomm.com, linux-arm-msm@vger.kernel.org, ktadakam@qti.qualcomm.com, Srinivas Kandagatla Subject: [PATCH 5/8] misc: fastrpc: consider address offset before sending to DSP Date: Thu, 7 Mar 2019 10:12:26 +0000 Message-Id: <20190307101229.7856-6-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190307101229.7856-1-srinivas.kandagatla@linaro.org> References: <20190307101229.7856-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org While passing address phy address to DSP, take care of the offset calculated from virtual address vma. Fixes: c68cfb718c8f ("misc: fastrpc: Add support for context Invoke method") Signed-off-by: Srinivas Kandagatla --- drivers/misc/fastrpc.c | 8 ++++++++ 1 file changed, 8 insertions(+) -- 2.21.0 diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c index f71b5faae1dd..209f3e63f660 100644 --- a/drivers/misc/fastrpc.c +++ b/drivers/misc/fastrpc.c @@ -679,8 +679,16 @@ static int fastrpc_get_args(u32 kernel, struct fastrpc_invoke_ctx *ctx) pages[i].size = roundup(len, PAGE_SIZE); if (ctx->maps[i]) { + struct vm_area_struct *vma = NULL; + rpra[i].pv = (u64) ctx->args[i].ptr; pages[i].addr = ctx->maps[i]->phys; + + vma = find_vma(current->mm, ctx->args[i].ptr); + if (vma) + pages[i].addr += ctx->args[i].ptr - + vma->vm_start; + } else { rlen -= ALIGN(args, FASTRPC_ALIGN) - args; args = ALIGN(args, FASTRPC_ALIGN); From patchwork Thu Mar 7 10:12:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 159828 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp7251266jad; Thu, 7 Mar 2019 02:13:42 -0800 (PST) X-Google-Smtp-Source: APXvYqy/6Qt/g/ZLaTtYOpvw9OMYFZFA9CSXqO/DVijaBBOs+V8n1OU+FYU287untqpIPCDulF2/ X-Received: by 2002:a63:e509:: with SMTP id r9mr10777168pgh.49.1551953622395; Thu, 07 Mar 2019 02:13:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551953622; cv=none; d=google.com; s=arc-20160816; b=CSyG4b1vYm5OEFNtnNP2TaAaU6aGLgaXBFuSe5UkCc/ZppqeCU7zFnedMbGpiA17zN cShif25Qtb81gXz/ei/Gq6tsrcB5mHSENS5UXU7F5DjXjAHvmV2iUgT008z893chxgFx RbSEKUx+CzI+fEQmsI8GF9269fAgmWOW8VssgBKbXTZIjesVxWcRHCK6gW5RRDwE/gfZ 8hHNj7l9xP8H8nFDUJWFFMFH3ayLfQXK1/eDAqz2PJEc+/Fg95AF204odKJ1txFDTIWO 92ZUNqgpKQan57kEDy/o4ALnG18Z4c7/EUwnSsAMWCCSV9QsUvYAeZ5mDpng+Vy8uo7E soTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=lY5fme3k/AIN047HEtN16Hcq0nFOQyFwzBciIshWG10=; b=Bw0FdBFzoYz7Iin6l7kGt9uKbPtiHBUn7thqPGusy877LAFFNL6t2Jdp7mTOIRukE+ g2Ire6pXltdF5TA8l3/lZA5mCa/j3+RWTQQTmUoXohBZbSc4lijxaGJI2rSvN7M5ACjk OmYTb6tMnrZrTzUNtUyo54eghIjsR/iDU5gGQ2W1l5m0f0cXV3yDVXvY4GOvzLitra8G K041p/v0pIx+E28Ib4epUIXLFVdugEgGMuCoLPkw3MYOZaMkztcAZyUYldF/idLXiHr1 s65XmpfPEt974eB3Fv7zla1lq4yD1ZW40YkWBZ1kUviIVr7eaTmv7jgt5C369QXLbmFA Q21Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fItgmMtQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w3si3977816pll.417.2019.03.07.02.13.42; Thu, 07 Mar 2019 02:13:42 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fItgmMtQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726579AbfCGKNk (ORCPT + 31 others); Thu, 7 Mar 2019 05:13:40 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:37555 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726324AbfCGKNX (ORCPT ); Thu, 7 Mar 2019 05:13:23 -0500 Received: by mail-wm1-f68.google.com with SMTP id x10so8584766wmg.2 for ; Thu, 07 Mar 2019 02:13:22 -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=lY5fme3k/AIN047HEtN16Hcq0nFOQyFwzBciIshWG10=; b=fItgmMtQYoRoAlSj4omNm/jYeERMEeY/EFrHZg53IaUQgWUPuRb/xap32+6XrbjKjA u6fzu3Awl8PIV6fVudBjS+plRt97qIuliwV9VUoceLyUATA3OkNcJHV/oZbYnUdJJKKr mBNtRboVw39EU5LKh/LnlOTBCpFqVzvva1byMElwWnt97vPM/1R6O1ZRGTuN0+NpnReQ j/HQJ/0oQAI/jbSe2e60XAydql/bpYIB2FgcIYKiEwMj2Ap6oNnI5v4X7lq+XqVFUBuX zKJ0QJwAVKuc7aIKjix4R8NG6PpHF6KcGECCZ9nHj69ZYJyltQ0MXX/f5IJK+TM7Ospg /u1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lY5fme3k/AIN047HEtN16Hcq0nFOQyFwzBciIshWG10=; b=E+4qbDaZmONgyHAYj0iXO2PqBmBKYNV7NruU64D7o8tz+SyF8F+TB3vanppxO02hiS fd/3uX+Lvihr+u35XKZsnmw9jJNTUf5tgy+NMm4VYbc+kg1qxAqdnNogLmQgdVuBj4Q+ rdfv2M4YYc2ApeAw1n7iXnHSMehGYfflCbYbxWBvhvIXW9OMl1Wwci3R2gsICpErJaYa olGjPtqStiLOay4pGHwSTDKwQuFhn1NLN6dc5qvDaYvYC5ZAg5R7oh+2zhfmnDSzoy3u VJCFTHBOHX4bnhIe1WSMPeavbZ2xNduHYp0hzvhRIQdBppNaFItJKpCXnIzDMMvOQpR2 L9Hg== X-Gm-Message-State: APjAAAXjmePwUBC0JBYys+CZJmSQ7gWeCyjbdehcCLyb/to3c2qgMyMl fCZh4LwiVU7qmu3+Nswdotph2g== X-Received: by 2002:a1c:f70c:: with SMTP id v12mr5035977wmh.19.1551953601216; Thu, 07 Mar 2019 02:13:21 -0800 (PST) Received: from srini-hackbox.lan (cpc89974-aztw32-2-0-cust43.18-1.cable.virginm.net. [86.30.250.44]) by smtp.gmail.com with ESMTPSA id n9sm3529767wmi.33.2019.03.07.02.13.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 07 Mar 2019 02:13:20 -0800 (PST) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org, arnd@arndb.de Cc: linux-kernel@vger.kernel.org, bjorn.andersson@linaro.org, bkumar@qti.qualcomm.com, linux-arm-msm@vger.kernel.org, ktadakam@qti.qualcomm.com, Srinivas Kandagatla Subject: [PATCH 6/8] misc: fastrpc: take into account of overlapping buffers Date: Thu, 7 Mar 2019 10:12:27 +0000 Message-Id: <20190307101229.7856-7-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190307101229.7856-1-srinivas.kandagatla@linaro.org> References: <20190307101229.7856-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Argument buffers that are passed could be derived from a big buffer, and some of the arguments buffers could overlap each other. Take care of such instanaces. This is optimization that DSP expects while sending buffers which overlap. So make the DSP happy doing it. Without which DSP seems to crash. Fixes: c68cfb718c8f ("misc: fastrpc: Add support for context Invoke method") Signed-off-by: Srinivas Kandagatla --- drivers/misc/fastrpc.c | 112 +++++++++++++++++++++++++++++++++++------ 1 file changed, 98 insertions(+), 14 deletions(-) -- 2.21.0 diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c index 209f3e63f660..17bbb017bb08 100644 --- a/drivers/misc/fastrpc.c +++ b/drivers/misc/fastrpc.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -104,6 +105,15 @@ struct fastrpc_invoke_rsp { int retval; /* invoke return value */ }; +struct fastrpc_buf_overlap { + u64 start; + u64 end; + int raix; + u64 mstart; + u64 mend; + u64 offset; +}; + struct fastrpc_buf { struct fastrpc_user *fl; struct dma_buf *dmabuf; @@ -156,6 +166,7 @@ struct fastrpc_invoke_ctx { struct fastrpc_map **maps; struct fastrpc_buf *buf; struct fastrpc_invoke_args *args; + struct fastrpc_buf_overlap *olaps; struct fastrpc_channel_ctx *cctx; }; @@ -300,6 +311,7 @@ static void fastrpc_context_free(struct kref *ref) spin_unlock_irqrestore(&cctx->lock, flags); kfree(ctx->maps); + kfree(ctx->olaps); kfree(ctx); } @@ -321,6 +333,55 @@ static void fastrpc_context_put_wq(struct work_struct *work) fastrpc_context_put(ctx); } +#define CMP(aa, bb) ((aa) == (bb) ? 0 : (aa) < (bb) ? -1 : 1) +static int olaps_cmp(const void *a, const void *b) +{ + struct fastrpc_buf_overlap *pa = (struct fastrpc_buf_overlap *)a; + struct fastrpc_buf_overlap *pb = (struct fastrpc_buf_overlap *)b; + /* sort with lowest starting buffer first */ + int st = CMP(pa->start, pb->start); + /* sort with highest ending buffer first */ + int ed = CMP(pb->end, pa->end); + + return st == 0 ? ed : st; +} + +static void fastrpc_get_buff_overlaps(struct fastrpc_invoke_ctx *ctx) +{ + u64 max_end = 0; + int i; + + for (i = 0; i < ctx->nbufs; ++i) { + ctx->olaps[i].start = ctx->args[i].ptr; + ctx->olaps[i].end = ctx->olaps[i].start + ctx->args[i].length; + ctx->olaps[i].raix = i; + } + + sort(ctx->olaps, ctx->nbufs, sizeof(*ctx->olaps), olaps_cmp, NULL); + + for (i = 0; i < ctx->nbufs; ++i) { + /* Falling inside previous range */ + if (ctx->olaps[i].start < max_end) { + ctx->olaps[i].mstart = max_end; + ctx->olaps[i].mend = ctx->olaps[i].end; + ctx->olaps[i].offset = max_end - ctx->olaps[i].start; + + if (ctx->olaps[i].end > max_end) { + max_end = ctx->olaps[i].end; + } else { + ctx->olaps[i].mend = 0; + ctx->olaps[i].mstart = 0; + } + + } else { + ctx->olaps[i].mend = ctx->olaps[i].end; + ctx->olaps[i].mstart = ctx->olaps[i].start; + ctx->olaps[i].offset = 0; + max_end = ctx->olaps[i].end; + } + } +} + static struct fastrpc_invoke_ctx *fastrpc_context_alloc( struct fastrpc_user *user, u32 kernel, u32 sc, struct fastrpc_invoke_args *args) @@ -347,7 +408,15 @@ static struct fastrpc_invoke_ctx *fastrpc_context_alloc( kfree(ctx); return ERR_PTR(-ENOMEM); } + ctx->olaps = kcalloc(ctx->nscalars, + sizeof(*ctx->olaps), GFP_KERNEL); + if (!ctx->olaps) { + kfree(ctx->maps); + kfree(ctx); + return ERR_PTR(-ENOMEM); + } ctx->args = args; + fastrpc_get_buff_overlaps(ctx); } ctx->sc = sc; @@ -380,6 +449,7 @@ static struct fastrpc_invoke_ctx *fastrpc_context_alloc( list_del(&ctx->node); spin_unlock(&user->lock); kfree(ctx->maps); + kfree(ctx->olaps); kfree(ctx); return ERR_PTR(ret); @@ -598,8 +668,11 @@ static u64 fastrpc_get_payload_size(struct fastrpc_invoke_ctx *ctx, int metalen) size = ALIGN(metalen, FASTRPC_ALIGN); for (i = 0; i < ctx->nscalars; i++) { if (ctx->args[i].fd == 0 || ctx->args[i].fd == -1) { - size = ALIGN(size, FASTRPC_ALIGN); - size += ctx->args[i].length; + + if (ctx->olaps[i].offset == 0) + size = ALIGN(size, FASTRPC_ALIGN); + + size += (ctx->olaps[i].mend - ctx->olaps[i].mstart); } } @@ -637,12 +710,11 @@ static int fastrpc_get_args(u32 kernel, struct fastrpc_invoke_ctx *ctx) struct fastrpc_remote_arg *rpra; struct fastrpc_invoke_buf *list; struct fastrpc_phy_page *pages; - int inbufs, i, err = 0; - u64 rlen, pkt_size; + int inbufs, i, oix, err = 0; + u64 len, rlen, pkt_size; uintptr_t args; int metalen; - inbufs = REMOTE_SCALARS_INBUFS(ctx->sc); metalen = fastrpc_get_meta_size(ctx); pkt_size = fastrpc_get_payload_size(ctx, metalen); @@ -665,8 +737,11 @@ static int fastrpc_get_args(u32 kernel, struct fastrpc_invoke_ctx *ctx) rlen = pkt_size - metalen; ctx->rpra = rpra; - for (i = 0; i < ctx->nbufs; ++i) { - u64 len = ctx->args[i].length; + for (oix = 0; oix < ctx->nbufs; ++oix) { + int mlen; + + i = ctx->olaps[oix].raix; + len = ctx->args[i].length; rpra[i].pv = 0; rpra[i].len = len; @@ -690,16 +765,25 @@ static int fastrpc_get_args(u32 kernel, struct fastrpc_invoke_ctx *ctx) vma->vm_start; } else { - rlen -= ALIGN(args, FASTRPC_ALIGN) - args; - args = ALIGN(args, FASTRPC_ALIGN); - if (rlen < len) + + if (ctx->olaps[oix].offset == 0) { + rlen -= ALIGN(args, FASTRPC_ALIGN) - args; + args = ALIGN(args, FASTRPC_ALIGN); + } + + mlen = ctx->olaps[oix].mend - ctx->olaps[oix].mstart; + + if (rlen < mlen) goto bail; - rpra[i].pv = args; - pages[i].addr = ctx->buf->phys + (pkt_size - rlen); + rpra[i].pv = args - ctx->olaps[oix].offset; + pages[i].addr = ctx->buf->phys - + ctx->olaps[oix].offset + + (pkt_size - rlen); pages[i].addr = pages[i].addr & PAGE_MASK; - args = args + len; - rlen -= len; + + args = args + mlen; + rlen -= mlen; } if (i < inbufs && !ctx->maps[i]) { From patchwork Thu Mar 7 10:12:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 159827 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp7251244jad; Thu, 7 Mar 2019 02:13:41 -0800 (PST) X-Google-Smtp-Source: APXvYqznc1iYSMI/O0EKiy01XjJuVMfNdgZFHHiY2WZf9ZpQUhjBO+qlc+W9R0lZk0zL7T/PWvMX X-Received: by 2002:a65:6283:: with SMTP id f3mr10751114pgv.125.1551953621387; Thu, 07 Mar 2019 02:13:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551953621; cv=none; d=google.com; s=arc-20160816; b=G/ZpDsw7rhOxnbSins7Yh94m6WAG96YgPb1kp+QarSmVcdRG0ssaqY4HRrngemhTo0 mamdRGd0PigDwdl48FXLJuZ3aHe/iK7v/em7qIb4/9pns1VzWWUa7HyOyV95tYYOk/5+ xVV5HgCheURIySd27eBTp44pyeOdNVlfrTl3CwF+Lbi2HzwP46z62xdt0IXFgiJA9FBV egtf0lsH3yXT7bSBrV0kiBul+gq3pGQKd/0kr74YlmTw2XrisYS6gjNk8VD6GRxcPgCy PKAB6XkmipJMnA9X2dAStVQXhJzkg/lKRfZ1W+vTx/mOZg2gMNR1VPqUedVcz2RlIRD3 3Reg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=FPxNdvt+kGcCG8uzNQ9lroy0iRhdBt0KuB6zFefUSXk=; b=VKmf3kMNhYUT2abctQ6wl7XJ26m5OCiN7/TACdP5BFOTLJMLJOXl6kZnyVnIfn9e82 /qMO4TUnDPwjGzXUIgzmZkspRFlbba+uKP9cRKvTjdAmxoah3DReOZueYqKhGR4O0yj2 r+N3pUp2s2fPbl5SEyl0Y29KCiSEcuegBnQgMAjbWyTc/ZFjJwsufhTPiUKn5vR9NrKH Ekv2E6Qk0L75OXzQlBTFEhKObyqrjVifvMpZ1mUdaVeqGmC4N9ikt79Ay82auNprGtSL kVwZK6Cl8cyXQvjK3a22aIDc4+y2cDZNRc0syuAcQ+y5LpqVX5JONr6G0HZa4yofUFJ9 HyoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="MyY/T+4h"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a8si3922753ple.346.2019.03.07.02.13.40; Thu, 07 Mar 2019 02:13:41 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="MyY/T+4h"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726556AbfCGKNj (ORCPT + 31 others); Thu, 7 Mar 2019 05:13:39 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:34631 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726483AbfCGKNY (ORCPT ); Thu, 7 Mar 2019 05:13:24 -0500 Received: by mail-wm1-f68.google.com with SMTP id o10so6364248wmc.1 for ; Thu, 07 Mar 2019 02:13:23 -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=FPxNdvt+kGcCG8uzNQ9lroy0iRhdBt0KuB6zFefUSXk=; b=MyY/T+4heOH9NyLJAPUtf+h+tOOTQ8w5lyCiHswAOkciuxnZZ6cy4xY5fRJAIrbjih Xp54rf/2Zv++De+fDp4m9fGyqICPYROXsUdk/YZoseajrB1xo4P2YMJtPYvsdF4F2Ui2 39pm5ovfhNJokRMnByEP0I1o5wWOt8a2SRShhX7x29DT9G/5FZucynJqqJA+IbbMSxmJ HWljc38inYK6/Bm0k1Ig0UIBE0G48KLlHPWINZJS0p5Dbl59bHDsCQHfQblTwclFU6tJ Gjq6MplvHraf/q+8pEIAE4kMDPXOENrR85NTf7T7mAu8I/z9Dr8WcKSr1b8liB6QzeZR Twxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FPxNdvt+kGcCG8uzNQ9lroy0iRhdBt0KuB6zFefUSXk=; b=ZmEH10zK9bk36vaRrsHXvcKkgKgE/IwtXIsq0eb/PDYo/xdD9wgP+58OKZItJmG2ez aM7XMWYPB0EN5kVnQ7f9RH4suGnsx25b2898HXApNMDzA4IIkEx+++AJipJOAjZlNCyY b7XZPmbylC9Jc3XUhD/mDhfqgwHVit8LcaV0Y8zFN0ZzcRXgaV1KUORULnqdcK/bLNCM NGVc7rZtQ35wmx7bveVGoNM1hrlCE0ku46DrL3hwtmMcol5ZVXhnKJUVf7zxb0FoSglx ss8qd3wH4tbQhwXJ4GW7FwOHPpbLJNcteJ/nL4L9habVl7p+X91QVQkUkon6CZ3NATMD FySA== X-Gm-Message-State: APjAAAUuAugCHdWjc9n1Ybb1dEE0lgr0iFAWiagGCG1G2VC1mglWhBJa 3xdEvxtRZfJ9oodyfW3Ahak1YA== X-Received: by 2002:a1c:a885:: with SMTP id r127mr5582093wme.74.1551953602372; Thu, 07 Mar 2019 02:13:22 -0800 (PST) Received: from srini-hackbox.lan (cpc89974-aztw32-2-0-cust43.18-1.cable.virginm.net. [86.30.250.44]) by smtp.gmail.com with ESMTPSA id n9sm3529767wmi.33.2019.03.07.02.13.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 07 Mar 2019 02:13:21 -0800 (PST) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org, arnd@arndb.de Cc: linux-kernel@vger.kernel.org, bjorn.andersson@linaro.org, bkumar@qti.qualcomm.com, linux-arm-msm@vger.kernel.org, ktadakam@qti.qualcomm.com, Srinivas Kandagatla Subject: [PATCH 7/8] misc: fastrpc: fix remote page size calculation Date: Thu, 7 Mar 2019 10:12:28 +0000 Message-Id: <20190307101229.7856-8-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190307101229.7856-1-srinivas.kandagatla@linaro.org> References: <20190307101229.7856-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Remote page size should be calculated based on address and size, fix this! Without this we will endup with one page less in cases where the buffer is across 3 pages. Fixes: c68cfb718c8f ("misc: fastrpc: Add support for context Invoke method") Reported-by: Krishnaiah Tadakamalla Signed-off-by: Srinivas Kandagatla --- drivers/misc/fastrpc.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) -- 2.21.0 diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c index 17bbb017bb08..d0e2e2620087 100644 --- a/drivers/misc/fastrpc.c +++ b/drivers/misc/fastrpc.c @@ -712,6 +712,7 @@ static int fastrpc_get_args(u32 kernel, struct fastrpc_invoke_ctx *ctx) struct fastrpc_phy_page *pages; int inbufs, i, oix, err = 0; u64 len, rlen, pkt_size; + u64 pg_start, pg_end; uintptr_t args; int metalen; @@ -751,8 +752,6 @@ static int fastrpc_get_args(u32 kernel, struct fastrpc_invoke_ctx *ctx) if (!len) continue; - pages[i].size = roundup(len, PAGE_SIZE); - if (ctx->maps[i]) { struct vm_area_struct *vma = NULL; @@ -764,6 +763,11 @@ static int fastrpc_get_args(u32 kernel, struct fastrpc_invoke_ctx *ctx) pages[i].addr += ctx->args[i].ptr - vma->vm_start; + pg_start = (ctx->args[i].ptr & PAGE_MASK) >> PAGE_SHIFT; + pg_end = ((ctx->args[i].ptr + len - 1) & PAGE_MASK) >> + PAGE_SHIFT; + pages[i].size = (pg_end - pg_start + 1) * PAGE_SIZE; + } else { if (ctx->olaps[oix].offset == 0) { @@ -782,6 +786,9 @@ static int fastrpc_get_args(u32 kernel, struct fastrpc_invoke_ctx *ctx) (pkt_size - rlen); pages[i].addr = pages[i].addr & PAGE_MASK; + pg_start = (args & PAGE_MASK) >> PAGE_SHIFT; + pg_end = ((args + len - 1) & PAGE_MASK) >> PAGE_SHIFT; + pages[i].size = (pg_end - pg_start + 1) * PAGE_SIZE; args = args + mlen; rlen -= mlen; } From patchwork Thu Mar 7 10:12:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srinivas Kandagatla X-Patchwork-Id: 159826 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp7251186jad; Thu, 7 Mar 2019 02:13:38 -0800 (PST) X-Google-Smtp-Source: APXvYqyiq6AzMlf0Zyl4u/mmomBcAGDIeclpZ+7zqDLbnRAmSW6tGATJ+a5HlXxYtrF3QoUykaG+ X-Received: by 2002:a63:7341:: with SMTP id d1mr10886725pgn.405.1551953618540; Thu, 07 Mar 2019 02:13:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551953618; cv=none; d=google.com; s=arc-20160816; b=q1hECUpZ5oAafYTlg32+dz/cpEBz903CgMs9pfJdDnNyYnBO46w+NhGJQWnrgdKa2W flfvCqC+cT+P5S4d3U2HKhkOvzmahBs7OUX4hw/M3b3YZ64bPdJ6S3dhfFnD0eRJLr5x zRN/LQw28WAWYkZXEvqS2hXgKo6lCcNmFmBgA7WSCnq0udH4u9hig/F1AmgoEzvzHews sXcWa9JwD2Oc3kErLpvkj1g/pBZUhTA+AqDnr9qhFtqWNY+xuiBBUxHepmvIt6sVsust YEI11uuM/40Tn7U5GUu/tIAD7uFo0EEdb3P3ZOuMuOg7kG1rZMno8pxwG5FTpd7VEeJM ql3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Niv4ry4Ht+sxGjnCxKmfDqaEVLiah3CqjMUhN/hOXN4=; b=LyN08ShPytT6wMkn4EZ98UT6Ko4LPx+2EA3liR9OylaiJX0l3e7konD5bUMSjXYc6F ssrfaC2usQhOymrdtjl9eWu10ZvIevS7o9s8UN/4J8HpHy/07gzQV/qj/kubhDmOyJWO 9/0WSHbHwRVkSLHxW+trXb/Xs5aHqkKI+bdVyWr3yBEXqgK/v7r2sjyaga4c10pVhBKt 3JdhGgMkmERbFxTZb6NFKp2aCw5y5jzbsTXQesUh3bxLM9jqJgxSHJ7n+Mor6e2BxKfZ 3PpPkjlu/2yC8x5fv9Ls6gydse8WQeTRWKeT37xGLUbziDJQaOAoBqOXsFfUDrt7ySZY Vagw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yR1nmvMf; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p25si3957312pff.77.2019.03.07.02.13.38; Thu, 07 Mar 2019 02:13:38 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yR1nmvMf; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726526AbfCGKN2 (ORCPT + 31 others); Thu, 7 Mar 2019 05:13:28 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:40201 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726491AbfCGKNZ (ORCPT ); Thu, 7 Mar 2019 05:13:25 -0500 Received: by mail-wm1-f67.google.com with SMTP id g20so8559628wmh.5 for ; Thu, 07 Mar 2019 02:13:24 -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=Niv4ry4Ht+sxGjnCxKmfDqaEVLiah3CqjMUhN/hOXN4=; b=yR1nmvMf1fCdlxvgSENtriX3WgsjDI+IPDnnJk7JFdhE8JCSWg4NTREZytgNAcvFaT IK3l2fRCkQPyDD2Hz4Zsu8j3+ygSljewQzP484SfLz5HPxag9gg3Mre8FwziCHLOE1oJ 78e3K+2UUjYbQVJUl4AUywyzL2uMNP/KLtrELjQBW6vlZMGng2n0gcH/0vwzIVQ2SDZr 0gMdF2+58yoSIefo7o/kJ0VU7Kqcqb5alBDB14uZC4LF797rUozoJpyrf79WA1CDuglq xhXuOwNC7LfiOlsQsw4sIjbib50TmtBenyT70Fr2TDHLqEQE+TCF0E1VC2TJK2joaBvi EZ0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Niv4ry4Ht+sxGjnCxKmfDqaEVLiah3CqjMUhN/hOXN4=; b=JsvYRQXJczjwPXKoUufCGRikbsKNrRwalncgj0Vl9eCZ4A16nH9pF3gep7KWNXzrqO 7S0tUyz+3Q5ea5CVhN0FanQmqPorjhEU83nznowC/YuYFIRmQhLEYoWPQlAlN2yG0kvF ZQ3JCxlzXfhHOj0zCfgHMywJe4wzqSzLf/Bf0GwwJZmX8AZtRlvXbGY5H1i8qsUb+oS2 YtpMmXJuEvWZishT23QUnuEwKR1JaV3Mz6lDO4RAfboUCHjrTVDir3lN9lKsOoygvjdv e5BbbQo44noPnOCc385PZKjJUPtJAeVJrBw+JkIlYizEmHFYmqZZ5cJsTvlVzW49kYKC EIkg== X-Gm-Message-State: APjAAAXcSpCb08szAQOXIttxYBmVOStF6FaOeQ6gqKlz6cBqwSHwp741 pqwOJAuTte31WHDl1+U7OCLBQBQo7+0= X-Received: by 2002:a1c:2dd1:: with SMTP id t200mr5046697wmt.148.1551953603357; Thu, 07 Mar 2019 02:13:23 -0800 (PST) Received: from srini-hackbox.lan (cpc89974-aztw32-2-0-cust43.18-1.cable.virginm.net. [86.30.250.44]) by smtp.gmail.com with ESMTPSA id n9sm3529767wmi.33.2019.03.07.02.13.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 07 Mar 2019 02:13:22 -0800 (PST) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org, arnd@arndb.de Cc: linux-kernel@vger.kernel.org, bjorn.andersson@linaro.org, bkumar@qti.qualcomm.com, linux-arm-msm@vger.kernel.org, ktadakam@qti.qualcomm.com, Srinivas Kandagatla Subject: [PATCH 8/8] misc: fastrpc: increase max init file size to 64 MB Date: Thu, 7 Mar 2019 10:12:29 +0000 Message-Id: <20190307101229.7856-9-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190307101229.7856-1-srinivas.kandagatla@linaro.org> References: <20190307101229.7856-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In some cases where Neural Processing is required the size of init process exceeds default size of 2MB, increase this size to 64MB which is required for QCS404 CDSP Neural Processing. Signed-off-by: Srinivas Kandagatla --- drivers/misc/fastrpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.21.0 diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c index d0e2e2620087..7e0d4528f3b9 100644 --- a/drivers/misc/fastrpc.c +++ b/drivers/misc/fastrpc.c @@ -32,7 +32,7 @@ #define FASTRPC_CTX_MAX (256) #define FASTRPC_INIT_HANDLE 1 #define FASTRPC_CTXID_MASK (0xFF0) -#define INIT_FILELEN_MAX (2 * 1024 * 1024) +#define INIT_FILELEN_MAX (64 * 1024 * 1024) #define INIT_MEMLEN_MAX (8 * 1024 * 1024) #define FASTRPC_DEVICE_NAME "fastrpc"