From patchwork Mon Apr 25 23:08:41 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Gross X-Patchwork-Id: 66652 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp1300867qge; Mon, 25 Apr 2016 16:11:00 -0700 (PDT) X-Received: by 10.66.79.162 with SMTP id k2mr187486pax.121.1461625860110; Mon, 25 Apr 2016 16:11:00 -0700 (PDT) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id r82si568646pfa.239.2016.04.25.16.10.59 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 25 Apr 2016 16:11:00 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1aupdn-0003mD-9f; Mon, 25 Apr 2016 23:10:07 +0000 Received: from mail-oi0-x232.google.com ([2607:f8b0:4003:c06::232]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1aupd2-0002q7-Lv for linux-arm-kernel@lists.infradead.org; Mon, 25 Apr 2016 23:09:22 +0000 Received: by mail-oi0-x232.google.com with SMTP id x19so59089522oix.2 for ; Mon, 25 Apr 2016 16:08:59 -0700 (PDT) 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; bh=a/yeZfmwBoe2K0k7+yp4wjn9H5xMTbMkAth8hJxjQv0=; b=fThM9AZ1B0I0jZ+LKYBPcZnNtvx4hyW17veNdzolMyefc99dXr87kEMRH6uykvrgb6 G21HJmIpFjEHXww+FDyPuUV7k2ZQnNqrkmN03E4DchXw+sOzHJHKuWy/hPUzlRQtKpoN 32U3B1eYk7/hdfS0xou9rUKMhP3zouDsjcUNA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=a/yeZfmwBoe2K0k7+yp4wjn9H5xMTbMkAth8hJxjQv0=; b=lyE7ffNRW571bkGHOm+H80QHrQmOPuyH3l6x/zV76PHNbhdgKihGisuVo3/yY4p7ts w69TqjvP+x9nzcOYS4mxX/q5HCfhfSBYfbyg4kTbsxO9ejJNpUofGAoYiUfBW1dGpGhr /liID7JkkWGuLMtmjB7xpyBLpETuxYj8XirbSmd8IHKyYQZuS39BR+rSa6YjeNUADuWr anEbMHcMLKwSwvoFVL42hJrap2XvQ7PViTIwdxTOCkK/cbnFqS6NSnfK7/+QFQBqt2tq s1hgr6vv4AftsU54FOzBHhgBEOvnxaWT9xPbH80nrHkZ95jVlmwmRf/Xz1ZZFZXvH6zJ 7s5A== X-Gm-Message-State: AOPr4FVJyI0+Ee/YwYDnH66AIQHmkwfntA5vbvhAh3h19EjxtFRPmOAfYw84pARfMpmPaaEM X-Received: by 10.157.24.41 with SMTP id b38mr13088036ote.190.1461625738694; Mon, 25 Apr 2016 16:08:58 -0700 (PDT) Received: from localhost ([2602:306:c558:19b0:396f:541d:66bc:56f0]) by smtp.gmail.com with ESMTPSA id d65sm7202828oia.25.2016.04.25.16.08.58 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Mon, 25 Apr 2016 16:08:58 -0700 (PDT) From: Andy Gross To: linux-arm-msm@vger.kernel.org Subject: [Patch v2 4/8] firmware: qcom: scm: Add memory allocation API Date: Mon, 25 Apr 2016 18:08:41 -0500 Message-Id: <1461625725-32425-5-git-send-email-andy.gross@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1461625725-32425-1-git-send-email-andy.gross@linaro.org> References: <1461625725-32425-1-git-send-email-andy.gross@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160425_160920_972179_FED916E4 X-CRM114-Status: GOOD ( 11.14 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2607:f8b0:4003:c06:0:0:0:232 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Stephen Boyd , linux-kernel@vger.kernel.org, Andy Gross , jilai wang , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org This patch adds APIs for the scm-32 and scm-64 to use for coherent memory allocation. Signed-off-by: Andy Gross --- drivers/firmware/qcom_scm.c | 16 ++++++++++++++++ drivers/firmware/qcom_scm.h | 4 ++++ 2 files changed, 20 insertions(+) -- 1.9.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel diff --git a/drivers/firmware/qcom_scm.c b/drivers/firmware/qcom_scm.c index d4e9145..8f78938 100644 --- a/drivers/firmware/qcom_scm.c +++ b/drivers/firmware/qcom_scm.c @@ -20,6 +20,7 @@ #include #include #include +#include #include "qcom_scm.h" @@ -158,6 +159,21 @@ bool qcom_scm_is_available(void) } EXPORT_SYMBOL(qcom_scm_is_available); +void *qcom_scm_alloc_buffer(size_t size, dma_addr_t *dma_addr, + gfp_t gfp) +{ + if (__scm) + return dma_alloc_writecombine(__scm->dev, size, dma_addr, gfp); + else + return ERR_PTR(-ENODEV); +} + +void qcom_scm_free_buffer(size_t size, void *cpu_addr, + dma_addr_t dma_addr) +{ + dma_free_writecombine(__scm->dev, size, cpu_addr, dma_addr); +} + static int qcom_scm_probe(struct platform_device *pdev) { struct qcom_scm *scm; diff --git a/drivers/firmware/qcom_scm.h b/drivers/firmware/qcom_scm.h index 7dcc733..848c7de 100644 --- a/drivers/firmware/qcom_scm.h +++ b/drivers/firmware/qcom_scm.h @@ -36,6 +36,10 @@ extern int __qcom_scm_is_call_available(u32 svc_id, u32 cmd_id); extern int __qcom_scm_hdcp_req(struct qcom_scm_hdcp_req *req, u32 req_cnt, u32 *resp); +extern void *qcom_scm_alloc_buffer(size_t size, dma_addr_t *dma_addr, + gfp_t gfp); +extern void qcom_scm_free_buffer(size_t size, void *virt_addr, + dma_addr_t dma_addr); /* common error codes */ #define QCOM_SCM_ENOMEM -5 #define QCOM_SCM_EOPNOTSUPP -4