From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 072ADECAAA1 for ; Fri, 9 Sep 2022 13:41:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231466AbiIINlE (ORCPT ); Fri, 9 Sep 2022 09:41:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34912 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231360AbiIINkx (ORCPT ); Fri, 9 Sep 2022 09:40:53 -0400 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D70068C477 for ; Fri, 9 Sep 2022 06:40:45 -0700 (PDT) Received: by mail-wm1-x329.google.com with SMTP id az24-20020a05600c601800b003a842e4983cso1375386wmb.0 for ; Fri, 09 Sep 2022 06:40:45 -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=p0sGgbM82CjL9PsiMTQ3j5vV2E53Gvm1ePK9SKxgJ/I=; b=asHoCOq0torX3QVprYKLe4JhE1kzQs9+Y0jbeleTaDCvpFLa/r3LkLNuFdLZoP/q2+ hZm1bXPkpib7aUxrpAfTyGbtdJE3fv7x5Sep+lCoqBaMBd9WEpYqcXJqUSOGV5NTrmNs 1/0HRDZ90o21cXvvd4pAu7kQcZ2soGEDdPHNjzmvRRro5TDc+Q48HFirAEvXXZP06TXW b/iogyntgNt4Nz/IwLRrwcCrCfebt8v5DUroD/HRhKRVEk8u1NWbcggLApzeaCVx3JOo 8GGOcBXKbF1ZvUMY6IHM/FORP8valBI8KHNsHspnaGn/EIT7sHvccxKmMtg2WQMWrcKM tUbA== 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=p0sGgbM82CjL9PsiMTQ3j5vV2E53Gvm1ePK9SKxgJ/I=; b=oKhi0TtX4yDwjyNjs+bt0uCHr2qdyAF0Sw/fVUnnUk2HsPtFElB/k3HXxfSiBaAV2h j1jpZx6e4xIC7EUvzlxEnsBVnabjdYtY9zYrQ9YpaOmBNFxCRWae94oq9lMubXvdWu56 Q7ceM6xC4XbKnca/xOxtR2yuIqnYD0PDGFF0D9aK9RaYQeIMf+7KT+nu+XW0wrVy+z/u /Uz5Dj3dm+QCFQZphMvXjjqWciyHWlromBC+FM0AD06dlpGUlNJNojUAJCYZ71bhMNm3 pOe6SY/Yclgl7z6oFtQpsvToH0u96qg0cNM2HLFz1ehogHd9o9+DghQqT0ytAWLUc0rM 3qlQ== X-Gm-Message-State: ACgBeo1TAHeQV3K5eOXjvLgubLV7b0NwHf2WsXSUNustaSjdcEPqJ6fU KefJ4RI4+B5GhsGFDaWiV29N4w== X-Google-Smtp-Source: AA6agR5njBztb6BGvrHcwV0nT+BG9qXwwn1YbTO8E//YrwUkKWEhTTjqZU7gvdUjaPOw+1VPNTM/IQ== X-Received: by 2002:a05:600c:35cc:b0:3a6:1785:ca4 with SMTP id r12-20020a05600c35cc00b003a617850ca4mr5775611wmq.192.1662730844058; Fri, 09 Sep 2022 06:40:44 -0700 (PDT) Received: from hackbox.lan ([94.52.112.99]) by smtp.gmail.com with ESMTPSA id q20-20020a1cf314000000b003a604a29a34sm660622wmq.35.2022.09.09.06.40.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Sep 2022 06:40:43 -0700 (PDT) From: Abel Vesa To: Srinivas Kandagatla , Amol Maheshwari , Andy Gross , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , Ekansh Gupta , Bharath Kumar , Himateja Reddy , Anirudh Raghavendra Cc: Arnd Bergmann , Greg Kroah-Hartman , linux-arm-msm@vger.kernel.org, Linux Kernel Mailing List , devicetree@vger.kernel.org Subject: [PATCH v3 04/10] misc: fastrpc: Add fastrpc_remote_heap_alloc Date: Fri, 9 Sep 2022 16:39:32 +0300 Message-Id: <20220909133938.3518520-5-abel.vesa@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220909133938.3518520-1-abel.vesa@linaro.org> References: <20220909133938.3518520-1-abel.vesa@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: devicetree@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 9afc3528dab4..d421e3e473d6 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