Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp9319523rwb; Thu, 24 Nov 2022 10:59:10 -0800 (PST) X-Google-Smtp-Source: AA0mqf74xxiHI8TE9/BJF2L7V8UYboY17p1zZ9T3A+1/zwVUJEN7ucySLlkkePMEmCHnIBLAEiyP X-Received: by 2002:a62:198d:0:b0:572:5a7f:9f4a with SMTP id 135-20020a62198d000000b005725a7f9f4amr15161522pfz.33.1669316350468; Thu, 24 Nov 2022 10:59:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669316350; cv=none; d=google.com; s=arc-20160816; b=tnUuwIr1EYkNnFJL88t9IaeDMjHP3G9789+OsC/K58gQOTb4iDpcI0APxHdo9ESggo nedikI/eXYVrkuVPPVTErK0aNHtsDSIAOMCuqTEm7SoI4kSI5CuottJSNZFV3hDHFv9I nhgtdT/wIxSIUxSA6OmSGn5avZTyIvaE68jI6/we6k4lt2s3zunxZdpqeH5dL6lIhWU1 fkzVoKIFPS72AyGq6C7Lz6QCa9hg7nXPURt4b8III/n2u8bn4OkAoBqCQDpmEJeOrBbb sAktORfh4p3kMz/4pud5F2/FM8aJhm/ZFiqGfUrq3J87jxx05fbjPQkzf51FSos/kxPR yGmg== 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=cTmLcUHM8TPUmaE0W/RaZtsLjw1tkQ7u3GK43vuBULU=; b=aJb5WP6Yl8GqSyhWlzsv9UAF6awvMpS0+KfSWxFBAMfDA3KeEX/MbppZldHaKa6NUx xYvleGJLQDP47sNiZAjWeoNY6K6rBhe4z0LO1VWPeQSRfqbCXm7TO2ooFOHMyzV8U3zw 6FcuGEIIP2PB9v4ZKGncQc0kqIj5XA/ev6nDEJtVEUmiNYzm/gd2tOpP1omn+i3+txwH W05YOiVuNu657i01CWcy7QvTzCHW8tbM+BGuy3L+UfqYXo5qfm47vqopRPgoqFZBZTci m1Kw1lOWWMgI4o9h2nOaDR4XMGsIr1SUfO/o3LDUbzhb7h+MWTCr3aqIx1vwf77JfqrG Bjgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fO7DrylE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 21-20020a631355000000b0046ff26f21f0si1846563pgt.503.2022.11.24.10.58.59; Thu, 24 Nov 2022 10:59:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fO7DrylE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229783AbiKXRwB (ORCPT + 86 others); Thu, 24 Nov 2022 12:52:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44224 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229649AbiKXRvp (ORCPT ); Thu, 24 Nov 2022 12:51:45 -0500 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 26F1D13F4BE for ; Thu, 24 Nov 2022 09:51:45 -0800 (PST) Received: by mail-wr1-x436.google.com with SMTP id bs21so3462920wrb.4 for ; Thu, 24 Nov 2022 09:51:45 -0800 (PST) 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 :message-id:reply-to; bh=cTmLcUHM8TPUmaE0W/RaZtsLjw1tkQ7u3GK43vuBULU=; b=fO7DrylENu6t49oXq95ToTkrDPr9tSDxEM4MDfbVOrz7CbItBaACnnq6/eHUViKrje nZpa2kMdsY+ri9PUm/kdFP4UhMQDGAlABXG47GqzQ/01TzfsszJ2iP8irOGLb/0ggec3 j3P7jXOKA8vMg0JBPDC3r+3w+V6U41xK5q4624MDGlcYM18iRBAHNmIm3A7ZqgTfGU0h /JOmxc2znQVFJ7EcveBmG6R251GG2aKpTP3hB5s6MsuzppAez+ItEVxnx2GkwtkXFQ95 j233D917ZlzGwcOQIH0CprdE4Sddyg4Sl0FnkYZ0shS8K17MSCmDa4rSjUqjDUq/CRKY PhtA== 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:message-id:reply-to; bh=cTmLcUHM8TPUmaE0W/RaZtsLjw1tkQ7u3GK43vuBULU=; b=Om8zcpeBT65ttxoQKy7ofotFQs2w8O1AOvE58ni/wM+asuFSKUedfGehRQ+S4jhBY1 JBa55FK9LeB1HwlnDTK+/4DtUQ2K+QKwy28L08Dd8ZBOqGVwHvGZIiYzsCaUJ4YsI/Ul FUKQ9nnv/qTQ5GilckxV8cG2m5kQj8Ep0yJBw7LeYZvya1FOGCBmfdE/HoLKdra55xJK oz/t9EuMkjg0XKGymM/8PRPYFep6cHAj++h3OkaUbCFGfccZXWrz0mYChgFNkxEAGnOl xb1knlmSygZZqNO1KPgqXRZXnHBvJ86+R7mTcOmegQc0X6ttWEuEmm6s9bV1Gm3prkzU mkrQ== X-Gm-Message-State: ANoB5pmVqc0Tyu4jYKNMPCvFOGd1Ol0vUZwwauD8QVUppBRi2lyaRWSu arNGVa1814IqPpEvJRPoQmvqJQ== X-Received: by 2002:adf:f48f:0:b0:236:715c:aaa6 with SMTP id l15-20020adff48f000000b00236715caaa6mr14334046wro.25.1669312303538; Thu, 24 Nov 2022 09:51:43 -0800 (PST) Received: from localhost.localdomain ([5.133.47.210]) by smtp.gmail.com with ESMTPSA id bi8-20020a05600c3d8800b003c701c12a17sm6394192wmb.12.2022.11.24.09.51.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Nov 2022 09:51:43 -0800 (PST) From: Srinivas Kandagatla To: gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, Abel Vesa , Srinivas Kandagatla Subject: [PATCH 05/11] misc: fastrpc: Add fastrpc_remote_heap_alloc Date: Thu, 24 Nov 2022 17:51:19 +0000 Message-Id: <20221124175125.418702-6-srinivas.kandagatla@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221124175125.418702-1-srinivas.kandagatla@linaro.org> References: <20221124175125.418702-1-srinivas.kandagatla@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Abel Vesa Split fastrpc_buf_alloc in such a way it allows allocation of remote heap too and add fastrpc_remote_heap_alloc to do so. Signed-off-by: Abel Vesa Co-developed-by: Srinivas Kandagatla Signed-off-by: Srinivas Kandagatla --- 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 86d11ffadf29..0ddad976a4d2 100644 --- a/drivers/misc/fastrpc.c +++ b/drivers/misc/fastrpc.c @@ -380,7 +380,7 @@ static void fastrpc_buf_free(struct fastrpc_buf *buf) kfree(buf); } -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; @@ -408,14 +408,37 @@ static int fastrpc_buf_alloc(struct fastrpc_user *fl, struct device *dev, return -ENOMEM; } + *obuf = 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 = __fastrpc_buf_alloc(fl, dev, size, obuf); + if (ret) + return ret; + + buf = *obuf; + if (fl->sctx && fl->sctx->sid) buf->phys += ((u64)fl->sctx->sid << 32); - *obuf = buf; - return 0; } +static int fastrpc_remote_heap_alloc(struct fastrpc_user *fl, struct device *dev, + u64 size, struct fastrpc_buf **obuf) +{ + struct device *rdev = &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; -- 2.25.1