From patchwork Fri Sep 23 18:53:22 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: 9348593 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 773DA607D0 for ; Fri, 23 Sep 2016 18:55:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 630FE2A1BE for ; Fri, 23 Sep 2016 18:55:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 57DAB2AD53; Fri, 23 Sep 2016 18:55:43 +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=-3.6 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_SPAM, 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 08F552A1BE for ; Fri, 23 Sep 2016 18:55:43 +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 1bnVbM-0005eL-8I; Fri, 23 Sep 2016 18:53:36 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bnVbL-0005by-1T for xen-devel@lists.xen.org; Fri, 23 Sep 2016 18:53:35 +0000 Received: from [85.158.139.211] by server-5.bemta-5.messagelabs.com id 22/1A-30284-E2A75E75; Fri, 23 Sep 2016 18:53:34 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprLIsWRWlGSWpSXmKPExsXiVRvkpKtb9TT cYPZ8NYslHxezODB6HN39mymAMYo1My8pvyKBNeNt+23GgheCFRdPP2ZrYHzN28XIySEkMIFR 4vEP9S5GLg4WgZcsEn1d59lBEhIC/awSl9+XQNgxEt2/FzND2GUSq7smMEI0q0ucfreDDcKew SQxf5cmiM0mYCKx988DJhBbREBa4trny2D1zAK+Ejd3HgeKc3AIC3hI3HhqAxJmEVCVuDtxHt gYXqDw6i37WCBWyUncPNcJtpZTwFNiY/8GJohVHhI/9v1jn8AosICRYRWjRnFqUVlqka6hoV5 SUWZ6RkluYmaOrqGBqV5uanFxYnpqTmJSsV5yfu4mRmBQMQDBDsaV7c6HGCU5mJREeZXcnoYL 8SXlp1RmJBZnxBeV5qQWH2KU4eBQkuB1MADKCRalpqdWpGXmAMMbJi3BwaMkwnu3AijNW1yQm FucmQ6ROsWoy7Fl6r21TEIsefl5qVLivLNAigRAijJK8+BGwGLtEqOslDAvI9BRQjwFqUW5mS Wo8q8YxTkYlYR5L4FM4cnMK4Hb9AroCCagI77deQJyREkiQkqqgbFT+r2kULN3yNT48LLvGa/ qZ+w1bW06s6C9P7tET8Q27mR4n319e/sag8sb19cl6HY0eGSFJMqvZlgUsUKfY+m71Wpir6dN NtzrsXxB0HvlmRXXEg3Lv6/q0ll42u/aTO/Fkx2muVmx2F+OsL4edlnl0JrtSkpqF04FPfym/ 7jzJ5tpNtO9s0osxRmJhlrMRcWJAGU94RqwAgAA X-Env-Sender: edgar.iglesias@gmail.com X-Msg-Ref: server-12.tower-206.messagelabs.com!1474656813!24839382!1 X-Originating-IP: [74.125.82.66] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 36624 invoked from network); 23 Sep 2016 18:53:33 -0000 Received: from mail-wm0-f66.google.com (HELO mail-wm0-f66.google.com) (74.125.82.66) by server-12.tower-206.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 23 Sep 2016 18:53:33 -0000 Received: by mail-wm0-f66.google.com with SMTP id w84so4130304wmg.0 for ; Fri, 23 Sep 2016 11:53:33 -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=yla1XyY5hxJvD1Px8V1M0nKnFvIHWsg4G9cDaP89W+M=; b=c15Tn0mUjekga02YUOdEHjhePqeAfLYbJYioSbvWXB9aGcPHxXo/jIrZx7gVHxikTI kEdPm0WbhuDxluk+HUqqpuqUt1bbv5UNX3Ej8wX4Ch3TBDj+0wiWLZEZlcp3PHKTo2Kc bQQOnmvqoxY73IlHZEJrS57zQKB0Irvm1zeDIHUqPDouUZ4IhGq5QqzYAZ1/lJI07aKv GbOOJU2aD20/9ssDkqTDLqLaxBRTEH7WpYNqRBIfWvovhzQLjUoFzO8CZc29aoNahyxw 1Rc25atnBttKus4aAvNZHKbo+Ofzn9mLR4USbo47KC+tcfxuaZ3Tcz3H8faAIbSC8cF+ Bs5w== 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=yla1XyY5hxJvD1Px8V1M0nKnFvIHWsg4G9cDaP89W+M=; b=UDDhnrGcWsLgMAtGiMYPmMRG+le1v1eJxSSYk5gaQRWwqTzdmxPbg/FVplXf6Yn3V/ HRC1eI7Sn/moMg+FQapxLRh8PhNbM2J9Jp9yZ/jfu6G1U50dYTt9XfdeZs6Uv4L19XM+ lt3CFATtyyJ9SXYyIK09jV1umN7xjcksGRRmfy1oCi0Z3ynByzBFnQERgVvnvaQL2bUg 40LiVIAS2cOsnC87iace3iWDgXoXpxHcxr8KYCzQeSwLDsOfw71IiD/urbP+5H08Mv25 V7TRPgjy/lWT9h7JSdh6wTg+1TQhVq41hWa90MR9Tq/bo/mFqORZzibsYEOqfWxikns6 cmSw== X-Gm-Message-State: AA6/9Rn1BmedIJSMp/Z8WMJBBDZ7gK8ZZrJum3W45CLGfhHYWbwdOrDsi6sE8eh/hjYYgQ== X-Received: by 10.28.18.18 with SMTP id 18mr3986632wms.28.1474656813230; Fri, 23 Sep 2016 11:53:33 -0700 (PDT) Received: from localhost (81-231-233-234-no56.tbcn.telia.com. [81.231.233.234]) by smtp.gmail.com with ESMTPSA id bj8sm8480704wjc.49.2016.09.23.11.53.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Sep 2016 11:53:32 -0700 (PDT) From: "Edgar E. Iglesias" To: xen-devel@lists.xen.org Date: Fri, 23 Sep 2016 20:53:22 +0200 Message-Id: <1474656802-24081-8-git-send-email-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1474656802-24081-1-git-send-email-edgar.iglesias@gmail.com> References: <1474656802-24081-1-git-send-email-edgar.iglesias@gmail.com> Cc: edgar.iglesias@xilinx.com, julien.grall@arm.com, sstabellini@kernel.org Subject: [Xen-devel] [PATCH v4 7/7] 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 Acked-by: Julien Grall --- 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 0c30121..f1c5526 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_dev, + }, + { + __DT_MATCH_COMPATIBLE("mmio-sram"), + .data = (void *) (uintptr_t) p2m_mmio_direct_nc, + }, + { /* 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;