Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp2132816rwe; Fri, 2 Sep 2022 09:00:23 -0700 (PDT) X-Google-Smtp-Source: AA6agR6J33z9Vhjztm971zvODezyiRO/DjCe8d1/ZgFz6XScrow3pFI0iJrIoGZ1e7ag3T2EMELs X-Received: by 2002:a05:6402:379:b0:448:de41:2c0c with SMTP id s25-20020a056402037900b00448de412c0cmr14451109edw.290.1662134423127; Fri, 02 Sep 2022 09:00:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662134423; cv=none; d=google.com; s=arc-20160816; b=NS1NEd0p4zy3FJgs2Z5JWq/6iBkPMKvL4HSuYc+CnF9yqM/NSHy+5TzextqRP5rlNr OzZkXtmUj8OgSrAPv3GKQzlwd4jk5z8pio+5gyXyqqYCPup2CO9qzkGmZ1+7MwWEgxlb RoA+1yV4p4yV+oNvwwfom1cE1TQo5jKC3/HPwe4KwZa78cesqkzkgvzV1BpJy2UW4w74 ixz0X8s5xgOihbm4+FbcByNCgMgn8LGAuknXq+r+LVgrxzrk7cdkAXGfJ//I+rw5zPYP cLS6X39Bk2QyY+HtphD1TL6VtoFp3P54GwwItgObv2Kl1YPi1ps5Yn8JxQKQWziJAovD 99RQ== 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=1fcl6Kulh1x6/Y+M+GkZaGHNlzH6/YOoS5vivMb0MlE=; b=1ITFVVLED4JOiB9i9ovMkGg6DQ++3kkaQ6obWy/bDHjy58W/etJ+fh7o1oYK5zMSa8 N/hXL63kthyMrKFh5DfVvjfl12hTwS8yU3LmsC1dwCM3wT4KN2TIGCCl/cfTixDvYZLU Fc1jsV1uF4cBRefTUExOFn9/b+Gz0Vm1qd+srlbvmxJ0KlG2dAdCltbXdsn91bAKXCip VndkJP461hUFQRF814/i+tDuu+8UhDTxdEOIEEYPUFDUNCywTKqWkoeUoQzkH+fsYvq7 nc8BlzuRKer/HAkTStDn+VsrocMr+FSvaUXhWPG7OagPWUeGAtbBsLeSU5jva9fEjoCl PFvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="GdX0/Lr7"; 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 s5-20020a17090699c500b0073dab845a38si2116052ejn.346.2022.09.02.08.59.46; Fri, 02 Sep 2022 09:00:23 -0700 (PDT) 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="GdX0/Lr7"; 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 S237319AbiIBP4o (ORCPT + 99 others); Fri, 2 Sep 2022 11:56:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37156 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237170AbiIBPzG (ORCPT ); Fri, 2 Sep 2022 11:55:06 -0400 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8036338478 for ; Fri, 2 Sep 2022 08:49:28 -0700 (PDT) Received: by mail-wr1-x434.google.com with SMTP id u18so2827038wrq.10 for ; Fri, 02 Sep 2022 08:49:28 -0700 (PDT) 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; bh=1fcl6Kulh1x6/Y+M+GkZaGHNlzH6/YOoS5vivMb0MlE=; b=GdX0/Lr71x+leoWDFGxoX9mQ4gWhiifvqrIG58YF8FjeVf3ugyvMJYpn2HRMaAgfXZ 3wAfUVchhYk3g1ahLeJpRNYi8UiplDDOkIEN+FhoITX1Uk+OJj4AIItimVO3NxdSI/w2 sGxKvfRi3O95WWXWnPXP0rqFXpvoY0UieDFq+yqX+Q2gtyGMwIOjaHntPP7tqiYhDCdU czUozYtMay1nywMCprsxZcyfwIYXqPvTcMB/pHmhOsYp1TvnD0eAq+7fwzAQ92Z3kE6m L1J2emAa4nx1n3ZV5VZ0IErL/4s2maRiA9Hn9rV2K50DHDI2w7bnQQde2DqYohnaiKoE xiFw== 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; bh=1fcl6Kulh1x6/Y+M+GkZaGHNlzH6/YOoS5vivMb0MlE=; b=wPXLClwCwtoREYKhBUvXO9MkY95h+jGAQFgn5HUDJssS+Vhb8e5a911y9mLnSyEHd+ d9NIckSiOKisWX7nXixsEUOlN0tGKDV8y1U2mrtG5IkHkO8BnljNG1ZMMfGhxMm9JdC/ UJQbB61rPEgmWb0wcqoO+U4V1gXpUAPN3FFIWep0fNDNLfF5HLmcaMnA2QgeLnHF0VD8 NDlQUUnEx87ea0Q6rTgglAMuXi4NMRxrk3+FHUPiwmZWGYohKZiBEiZIWn9X4ePz/IVs fQqiGJdXBZuYMd/gCreNu3DrGC+ZfPaa+rL/Zpt+gV1lN/Raf4Uwiizo4LCM+2VAJJ1U fM4Q== X-Gm-Message-State: ACgBeo0SWplkli4G5ReyO50oIAtNJNPdrXnT+XCHQ73lRHOxHa4Je8nK 6gku94pO6udR7UlgAkvo6ZTUBw== X-Received: by 2002:a5d:430d:0:b0:223:808f:19c6 with SMTP id h13-20020a5d430d000000b00223808f19c6mr18124926wrq.273.1662133768058; Fri, 02 Sep 2022 08:49:28 -0700 (PDT) Received: from hackbox.lan ([94.52.112.99]) by smtp.gmail.com with ESMTPSA id b1-20020a05600010c100b002250f9abdefsm2046741wrx.117.2022.09.02.08.49.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Sep 2022 08:49:27 -0700 (PDT) From: Abel Vesa To: Srinivas Kandagatla , Amol Maheshwari , Andy Gross , Bjorn Andersson , Konrad Dybcio , Ekansh Gupta Cc: Rob Herring , Krzysztof Kozlowski , Arnd Bergmann , Greg Kroah-Hartman , linux-arm-msm@vger.kernel.org, Linux Kernel Mailing List , devicetree@vger.kernel.org Subject: [PATCH v2 04/10] misc: fastrpc: Add fastrpc_remote_heap_alloc Date: Fri, 2 Sep 2022 18:48:54 +0300 Message-Id: <20220902154900.3404524-5-abel.vesa@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220902154900.3404524-1-abel.vesa@linaro.org> References: <20220902154900.3404524-1-abel.vesa@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,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 Split fastrpc_buf_alloc in such a way it allows allocation of remote heap too and add fastrpc_remote_heap_alloc to do so. Co-developed-by: Srinivas Kandagatla Signed-off-by: Srinivas Kandagatla Signed-off-by: Abel Vesa --- 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 52271f51800d..6730aa324e10 100644 --- a/drivers/misc/fastrpc.c +++ b/drivers/misc/fastrpc.c @@ -379,7 +379,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; @@ -407,14 +407,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.34.1