From patchwork Wed Sep 7 06:56:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 9318303 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3336C6077F for ; Wed, 7 Sep 2016 06:58:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 273EE2909B for ; Wed, 7 Sep 2016 06:58:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1C0DB2909D; Wed, 7 Sep 2016 06:58:37 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 163782909B for ; Wed, 7 Sep 2016 06:58:36 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bhWmr-0000FM-QS; Wed, 07 Sep 2016 06:56:45 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bhWmq-0000Di-9P for xen-devel@lists.xen.org; Wed, 07 Sep 2016 06:56:44 +0000 Received: from [85.158.139.211] by server-12.bemta-5.messagelabs.com id F8/9D-09561-B2ABFC75; Wed, 07 Sep 2016 06:56:43 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrDIsWRWlGSWpSXmKPExsVyMfSOi67WrvP hBn8Omlos+biYxYHR4+ju30wBjFGsmXlJ+RUJrBmTdrWzFDwTrPjQ1crawPiSt4uRi0NIoI9R ore9hwnEYRF4ySKxf/IhZhBHQqCfVeLp9xksXYycQE6MxIvHB5kg7EqJ4/9+soPYQgLqEqff7 WCDGPWIUaJn6l1mkASbgInE3j8PwBpEBKQlrn2+zAhiMwv4StzceRwsLizgIdE5qRuomQNota rE/C3+IGFeAXeJc7t+sUHskpM4eWwyK4jNCVQ+c/tLqL3uEns+TWWewCiwgJFhFaNGcWpRWWq RrpGRXlJRZnpGSW5iZo6uoYGpXm5qcXFiempOYlKxXnJ+7iZGYGjVMzAw7mDc0+53iFGSg0lJ lHfrpPPhQnxJ+SmVGYnFGfFFpTmpxYcYZTg4lCR4t+8AygkWpaanVqRl5gCDHCYtwcGjJMI7G yTNW1yQmFucmQ6ROsVoybHl97W1TBzLNt8Bktum3lvLJMSSl5+XKiXOewakQQCkIaM0D24cLB IvMcpKCfMyMjAwCPEUpBblZpagyr9iFOdgVBLmVdgJNIUnM68EbusroIOYgA5at/s0yEEliQg pqQZGsV8uXS+27A94cOjtEveOP9XHDQ/5pFvXORZG5MibsJXLJLsukZbwKF+jmvzja7p7wfpJ Qbmfbv3RuB3/0vIFk97XpxffnrjuG3Iq/XnMgaWcy6z8EuRCjMWt1691ldMOTDUUcwj/bfBzB UvQFLl197mK/a8wcF1+uW4ls6vJr61sz17GHviqxFKckWioxVxUnAgAeAi99b8CAAA= X-Env-Sender: edgar.iglesias@gmail.com X-Msg-Ref: server-16.tower-206.messagelabs.com!1473231401!42291533!1 X-Originating-IP: [209.85.220.68] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 21733 invoked from network); 7 Sep 2016 06:56:42 -0000 Received: from mail-pa0-f68.google.com (HELO mail-pa0-f68.google.com) (209.85.220.68) by server-16.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 7 Sep 2016 06:56:42 -0000 Received: by mail-pa0-f68.google.com with SMTP id h5so438918pao.0 for ; Tue, 06 Sep 2016 23:56:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=b85RKvBasnSI4ZgCO9K0V0Gv1vojOmfxd7lbUN9Yocw=; b=XKHXtnb8IgnrL6guPHRhj2LSZSsCJLWjQu/mpAtCBdoygvFix4GG5lSe3iHW/mDGso tL/6ni2ekOEg1Zy063m9waD7Bb5xs1fuMmFxnlhOYDlCXCqP9MbPbWGGhi8048EQHvSe yL3LfHJ1cmHtTNtpkzwtrokf/AyWVoFPtEoX3P4CqwjkP1oGr10z7hlRdywAcH9d7prs 12qyANcAqIMfygTDZ8cw38XcwRaPdZ1OV2LIZ5rcL6vSGmShatv1Zcxvqtyljom2LRoT +2jXFrmPbDO6bdYKbWwqRg2NAQVQezYpYF3LsdoAs0w/al+8YSjkOPyB8jTiqgR7U8bH tfeg== 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=b85RKvBasnSI4ZgCO9K0V0Gv1vojOmfxd7lbUN9Yocw=; b=OG637mzKpQARdeEZLkRYifMNXiSh2yzgFj27Ewu0amm8LtTb7qjtqh6+2IEMQdqKYg V9z+CQ+pdK8h4H9ZH8WTuZH9M8a3c+oVCgnMOPoXTbspptblMOkCB1Wya2/PYsmsXqAK y1WRRH0hGjzgmyVfTIPxbUYunUPn3lktkRQALZnWNq/pT3KM7F8cwL7I7sGY8oGJHVf+ 5J5ZUtUpe3Kh4AcaiFbvKObUB7j6xLeouxkWYLvXNixP0ChNO0nRbw34gA0r+Vn/r3HB oDEH6DeT2Xh1yHGIo2ykAaC/5GsVwsOryYMNQwqyfLTEvifnGH33ovnaInSVmqKn2OZ5 qDKg== X-Gm-Message-State: AE9vXwORCWPqxampp8VLtat8+8AmQS8sspv3+6cg9lB6VngHEVWJA+HiwLAZD08MKaHRJg== X-Received: by 10.66.13.200 with SMTP id j8mr78917260pac.150.1473231401101; Tue, 06 Sep 2016 23:56:41 -0700 (PDT) Received: from localhost ([40.140.7.61]) by smtp.gmail.com with ESMTPSA id x126sm45727743pfx.61.2016.09.06.23.56.39 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Tue, 06 Sep 2016 23:56:40 -0700 (PDT) From: "Edgar E. Iglesias" To: xen-devel@lists.xen.org Date: Wed, 7 Sep 2016 08:56:17 +0200 Message-Id: <1473231377-7800-7-git-send-email-edgar.iglesias@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1473231377-7800-1-git-send-email-edgar.iglesias@gmail.com> References: <1473231377-7800-1-git-send-email-edgar.iglesias@gmail.com> Cc: edgar.iglesias@xilinx.com, julien.grall@arm.com, sstabellini@kernel.org Subject: [Xen-devel] [PATCH v3 6/6] xen/arm: Map mmio-sram nodes as un-cached memory X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: "Edgar E. Iglesias" Map mmio-sram nodes as un-cached memory. If the node has set the no-memory-wc property, we map it as device. The DTS bindings for mmio-sram nodes can be found in the Linux tree under Documentation/devicetree/bindings/sram/sram.txt. Signed-off-by: Edgar E. Iglesias --- xen/arch/arm/domain_build.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index bbe4895..f55d67f 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -48,6 +48,20 @@ struct map_range_data p2m_type_t p2mt; }; +static const struct dt_device_match dev_map_attrs[] __initconst = +{ + { + __DT_MATCH_COMPATIBLE("mmio-sram"), + __DT_MATCH_PROP("no-memory-wc"), + .data = (void *) (uintptr_t) p2m_mmio_direct_nc, + }, + { + __DT_MATCH_COMPATIBLE("mmio-sram"), + .data = (void *) (uintptr_t) p2m_mmio_direct_c, + }, + { /* sentinel */ }, +}; + //#define DEBUG_11_ALLOCATION #ifdef DEBUG_11_ALLOCATION # define D11PRINT(fmt, args...) printk(XENLOG_DEBUG fmt, ##args) @@ -1145,6 +1159,21 @@ static int handle_device(struct domain *d, struct dt_device_node *dev, return 0; } +static p2m_type_t lookup_map_attr(struct dt_device_node *node, + p2m_type_t parent_p2mt) +{ + const struct dt_device_match *r; + + /* Search and if nothing matches, use the parent's attributes. */ + r = dt_match_node(dev_map_attrs, node); + + /* + * If this node does not dictate specific mapping attributes, + * it inherits its parent's attributes. + */ + return r ? (uintptr_t) r->data : parent_p2mt; +} + static int handle_node(struct domain *d, struct kernel_info *kinfo, struct dt_device_node *node, p2m_type_t p2mt) @@ -1234,6 +1263,7 @@ static int handle_node(struct domain *d, struct kernel_info *kinfo, "WARNING: Path %s is reserved, skip the node as we may re-use the path.\n", path); + p2mt = lookup_map_attr(node, p2mt); res = handle_device(d, node, p2mt); if ( res) return res;