From patchwork Sat Apr 22 17:35:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 97953 Delivered-To: patch@linaro.org Received: by 10.140.109.52 with SMTP id k49csp814207qgf; Sat, 22 Apr 2017 10:35:29 -0700 (PDT) X-Received: by 10.98.97.195 with SMTP id v186mr17211295pfb.81.1492882529222; Sat, 22 Apr 2017 10:35:29 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o13si13825668pfg.277.2017.04.22.10.35.28; Sat, 22 Apr 2017 10:35:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; 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 devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1044001AbdDVRf0 (ORCPT + 7 others); Sat, 22 Apr 2017 13:35:26 -0400 Received: from mail-it0-f43.google.com ([209.85.214.43]:36464 "EHLO mail-it0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1043995AbdDVRfZ (ORCPT ); Sat, 22 Apr 2017 13:35:25 -0400 Received: by mail-it0-f43.google.com with SMTP id g66so18157467ite.1 for ; Sat, 22 Apr 2017 10:35:24 -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; bh=iTt+rGe4t3aqsuvGwF+6DoewZ3//odqxL0KRsMuc5+4=; b=N/4/62u/chLbPY74iuFnjhVE2AKoL0SumOHFdbv20iD0OE/BGPwrY80z4RdCmsqdeq Hh/0VLqexZDBGfugKESVUUXikSaC2+9uufarlI56lPkYJxM1ZNyPMwOFFw6/XRVbfQvs r3jUcxKZPNoEN3sRjAmwTvyiZOZBm2mGHPPgI= 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; bh=iTt+rGe4t3aqsuvGwF+6DoewZ3//odqxL0KRsMuc5+4=; b=gbPUg/L5BOdqYFtqHWZhwN0p6V8bArVBf5/J2N7dfwFhApeK9qD+6GVnKumYAZsCyD nlBPCTd0VF+vktUni1fcjxEsURqNZ9dqMz/M5hizoaGhcJpiCOSwna+iiQQ2QIidYD57 bkm+hVI4i6J3iCRLJ3OWoAF0KC34Tr4eJ70Aqn/bdy9s0pcUG7LItYGXssMjJ6xUJrOa MFHk8jYjd6VxV772+0yHD9JIzV4KGeEHVqtlOz9ACWxUNiPixCeguYpSjAr/2+tAKmA+ MveJR6l6rCnmK3z8t058jsfGGAkxrPHXxQmdPneDLGQSjt7OqcTJG6gW+5P52ZXh1n4R d82A== X-Gm-Message-State: AN3rC/6B3xpOG4IFORyQU4d3uj4XMUorjRLrGLMIOixfrDUHtEGKbZFx ff6QmuyG9gEM37NB6Zk8Lw== X-Received: by 10.84.218.14 with SMTP id q14mr22547055pli.80.1492882523994; Sat, 22 Apr 2017 10:35:23 -0700 (PDT) Received: from localhost.localdomain (ip68-111-223-48.sd.sd.cox.net. [68.111.223.48]) by smtp.gmail.com with ESMTPSA id r73sm22477462pfa.65.2017.04.22.10.35.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 22 Apr 2017 10:35:22 -0700 (PDT) From: Bjorn Andersson To: Andy Gross , David Brown , Frank Rowand , Rob Herring , Mark Rutland Cc: linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC 1/3] dt-binding: soc: qcom: Add binding for RFSA Date: Sat, 22 Apr 2017 10:35:17 -0700 Message-Id: <20170422173519.5782-1-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.12.0 Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org This adds the binding for describing shared memory buffers for implementing the remote filesystem protocol. Signed-off-by: Bjorn Andersson --- My initial attempt was to mimic the ramoops of just adding the compatible to the reserved-memory node, but I have not been able to figure out a sane way of getting hold of the base address in the case that the memory region is described my a "size" only (done on some platforms). The problem is that we create the reserved_mem objects (and remove the memblocks) while we're still operating on the flattened representation, so without a phandle it doesn't seem like we have anything to perform the comparison with later on. .../devicetree/bindings/soc/qcom/qcom,rfsa.txt | 43 ++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 Documentation/devicetree/bindings/soc/qcom/qcom,rfsa.txt -- 2.12.0 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/Documentation/devicetree/bindings/soc/qcom/qcom,rfsa.txt b/Documentation/devicetree/bindings/soc/qcom/qcom,rfsa.txt new file mode 100644 index 000000000000..b4de0de74e46 --- /dev/null +++ b/Documentation/devicetree/bindings/soc/qcom/qcom,rfsa.txt @@ -0,0 +1,43 @@ +Qualcomm Remote File System Access binding + +This binding describes the Qualcomm RFSA, which serves the purpose of managing +the shared memory region used for remote processors to access block device data +using the Remote Filesystem protocol. + +- compatible: + Usage: required + Value type: + Definition: must be: + "qcom,rfsa" + +- memory-region: + Usage: required + Value type: + Definition: handle to memory reservation the associated rfsa region. + +- qcom,client-id: + Usage: required + Value type: + Definition: identifier of the client to use this region for buffers. + += EXAMPLE +The following example shows the RFSA setup for APQ8016, with the RFSA region +for the Hexagon DSP (id #1) located at 0x86700000. + + reserved-memory { + #address-cells = <2>; + #size-cells = <2>; + ranges; + + rmtfs: rmtfs@86700000 { + reg = <0x0 0x86700000 0x0 0xe0000>; + no-map; + }; + }; + + hexagon-rfsa { + compatible = "qcom,rfsa"; + memory-region = <&rmtfs>; + + qcom,client-id = <1>; + }; From patchwork Sat Apr 22 17:35:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 97955 Delivered-To: patch@linaro.org Received: by 10.140.109.52 with SMTP id k49csp814327qgf; Sat, 22 Apr 2017 10:35:56 -0700 (PDT) X-Received: by 10.84.209.167 with SMTP id y36mr22668913plh.78.1492882556685; Sat, 22 Apr 2017 10:35:56 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o13si13825668pfg.277.2017.04.22.10.35.56; Sat, 22 Apr 2017 10:35:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; 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 devicetree-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=devicetree-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1044000AbdDVRfz (ORCPT + 7 others); Sat, 22 Apr 2017 13:35:55 -0400 Received: from mail-it0-f50.google.com ([209.85.214.50]:34959 "EHLO mail-it0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1043999AbdDVRf0 (ORCPT ); Sat, 22 Apr 2017 13:35:26 -0400 Received: by mail-it0-f50.google.com with SMTP id 70so18110768ita.0 for ; Sat, 22 Apr 2017 10:35:26 -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=nRCWhyZZVO8/+dsydHueTae9K5EiQMooiLS/8V1WhOw=; b=jelasMpD3AYSZYa51xf2myZd2PexG6bDddM3fsPqLtxhU4Wqy/Pm5gVM95qUM9MnoW QTgdOVv0pTM6ERcPvwXfdEfCTBtavMI8zRg62gsahBz6dUh4MmtFlddApLR7aFHXPsNP 2rOkDM2aprd3AWdVojQXozElr2f7Jyovj7N1Q= 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; bh=nRCWhyZZVO8/+dsydHueTae9K5EiQMooiLS/8V1WhOw=; b=kRUjVUktt9V7FLPX5D2wpGZSWL0lDc4u3MM4QuYdJmGIsgrdrfcE/1BK9g8Sk7GabP iOsET1kNas4DsbO74XIa3YHD+RfTQcs/yhxfWvMQ2JxVrojYWDFQh78ZKl4y6lFFxQhH p233Ae+fEtHn7TJQtBG0jw5rToy4ClMttIQBnZrVNY4BMYRSmJMzCQou/3DqClaBws0z 5WCUbBz0OHGN5AaxEkhqNVlHw3YDHnA7yLKPdRIC7Lx7jKFPxOULNTfUQ+ESyxeVr8sO gBde+jSrgB9a6vZKHdJ6/HaNowfSUXU18QKpAa60Ve1rehxE5bCvx6TUvZg9uy5akpzU 0yIg== X-Gm-Message-State: AN3rC/5KYq60/Nqkv1mZnlXp2eaoCai+19xHg+mgpvX8oXLfqtBDuCk5 SLYi2UvrmqbrlmMf X-Received: by 10.84.143.1 with SMTP id 1mr22663120ply.70.1492882525551; Sat, 22 Apr 2017 10:35:25 -0700 (PDT) Received: from localhost.localdomain (ip68-111-223-48.sd.sd.cox.net. [68.111.223.48]) by smtp.gmail.com with ESMTPSA id r73sm22477462pfa.65.2017.04.22.10.35.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 22 Apr 2017 10:35:24 -0700 (PDT) From: Bjorn Andersson To: Andy Gross , David Brown , Frank Rowand , Rob Herring , Mark Rutland Cc: linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [RFC 2/3] of: reserved_mem: Accessor for acquiring reserved_mem Date: Sat, 22 Apr 2017 10:35:18 -0700 Message-Id: <20170422173519.5782-2-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170422173519.5782-1-bjorn.andersson@linaro.org> References: <20170422173519.5782-1-bjorn.andersson@linaro.org> Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org In some cases drivers referencing a reserved-memory region might want to remap the entire region, but when defining the reserved-memory by "size" the client driver has no means to know the associated base address of the reserved memory region. This patch adds an accessor for such drivers to acquire a handle to their associated reserved-memory for this purpose. Signed-off-by: Bjorn Andersson --- I would have preferred if we could provide a mechanism for drivers to find the reserved_mem of their own device_node, but without a phandle I have not been able to figure out a sane way to make the match. Suggestions are very welcome. drivers/of/of_reserved_mem.c | 26 ++++++++++++++++++++++++++ include/linux/of_reserved_mem.h | 8 ++++++++ 2 files changed, 34 insertions(+) -- 2.12.0 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Reviewed-by: Frank Rowand diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c index d507c3569a88..aa69c9590a5c 100644 --- a/drivers/of/of_reserved_mem.c +++ b/drivers/of/of_reserved_mem.c @@ -397,3 +397,29 @@ void of_reserved_mem_device_release(struct device *dev) rmem->ops->device_release(rmem, dev); } EXPORT_SYMBOL_GPL(of_reserved_mem_device_release); + +/** + * of_get_reserved_mem_by_idx() - acquire reserved_mem from memory-region + * @np: node pointer containing the "memory-region" + * @idx: index within memory-region + * + * This function allows drivers to acquire a reference to the reserved_mem + * struct which is referenced by their memory-region. + * + * Returns a reserved_mem reference, or NULL on error. + */ +struct reserved_mem *of_get_reserved_mem_by_idx(struct device_node *np, int idx) +{ + struct device_node *target; + struct reserved_mem *rmem; + + target = of_parse_phandle(np, "memory-region", idx); + if (!target) + return NULL; + + rmem = __find_rmem(target); + of_node_put(target); + + return rmem; +} +EXPORT_SYMBOL_GPL(of_get_reserved_mem_by_idx); diff --git a/include/linux/of_reserved_mem.h b/include/linux/of_reserved_mem.h index f8e1992d6423..a9abbe7dd3de 100644 --- a/include/linux/of_reserved_mem.h +++ b/include/linux/of_reserved_mem.h @@ -34,6 +34,8 @@ int of_reserved_mem_device_init_by_idx(struct device *dev, struct device_node *np, int idx); void of_reserved_mem_device_release(struct device *dev); +struct reserved_mem *of_get_reserved_mem_by_idx(struct device_node *np, int idx); + int early_init_dt_alloc_reserved_memory_arch(phys_addr_t size, phys_addr_t align, phys_addr_t start, @@ -52,6 +54,12 @@ static inline int of_reserved_mem_device_init_by_idx(struct device *dev, } static inline void of_reserved_mem_device_release(struct device *pdev) { } +static inline struct reserved_mem *of_get_reserved_mem_by_idx(struct device_node *np, + int idx); +{ + return NULL; +} + static inline void fdt_init_reserved_mem(void) { } static inline void fdt_reserved_mem_save_node(unsigned long node, const char *uname, phys_addr_t base, phys_addr_t size) { }