From patchwork Wed Oct 29 09:22:58 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 39734 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f69.google.com (mail-ee0-f69.google.com [74.125.83.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id EB8B424073 for ; Wed, 29 Oct 2014 09:26:46 +0000 (UTC) Received: by mail-ee0-f69.google.com with SMTP id c41sf500604eek.0 for ; Wed, 29 Oct 2014 02:26:46 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:cc:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:content-type:content-transfer-encoding; bh=7f6AVk3KSmsCTaaLEMV9mGPsbeCuw6hTlsjhEeztBjs=; b=iW2fWkDs2en9C2lfIITEwZYaTpnuHUDTS5Gl1aFt6Xdlwp6ZQz2QZX3rzPT5lbJXh7 JED076sRFiYn9VqeBv/gtP5u2/5m4ZToCMZBk6i5mUsPuRiqfVYliwgI+JB0mWvrCi6X km1sn1hwStBpdrOvse1tgMNh8VxCor0Fm/2PkuF345MnQTgknHwIKd2lo3g9b2nK/L/x ydFlDlyGrjmxokZfTt8iIFDENNWwLMwMh6iRRV9ShUIFrC680WffIIbRwJhJSuAWymQO gJ7PbLLkIYL053wd6F2I4uQRmEPy3vL86nfbNN0lxMHsNc/gFJchctl7ZJOhzbN6i/yQ agBw== X-Gm-Message-State: ALoCoQkrD/4YLBAu/iiskL3X+Pqgsu9zHj5kLJG2mHtQ4lJhBvuRwOSYiBc/SkOn8pzPqNvsUmOj X-Received: by 10.180.74.130 with SMTP id t2mr1661711wiv.4.1414574806160; Wed, 29 Oct 2014 02:26:46 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.88.38 with SMTP id bd6ls186449lab.24.gmail; Wed, 29 Oct 2014 02:26:46 -0700 (PDT) X-Received: by 10.112.135.229 with SMTP id pv5mr9957812lbb.52.1414574806001; Wed, 29 Oct 2014 02:26:46 -0700 (PDT) Received: from mail-la0-f41.google.com (mail-la0-f41.google.com. [209.85.215.41]) by mx.google.com with ESMTPS id h3si6290345laa.106.2014.10.29.02.26.45 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 29 Oct 2014 02:26:45 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.41 as permitted sender) client-ip=209.85.215.41; Received: by mail-la0-f41.google.com with SMTP id pn19so2176876lab.28 for ; Wed, 29 Oct 2014 02:26:45 -0700 (PDT) X-Received: by 10.112.77.74 with SMTP id q10mr9894633lbw.66.1414574805864; Wed, 29 Oct 2014 02:26:45 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.84.229 with SMTP id c5csp625100lbz; Wed, 29 Oct 2014 02:26:44 -0700 (PDT) X-Received: by 10.66.220.3 with SMTP id ps3mr9556704pac.8.1414574803042; Wed, 29 Oct 2014 02:26:43 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id of2si3624562pbb.31.2014.10.29.02.26.42 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 29 Oct 2014 02:26:43 -0700 (PDT) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=2001:1868:205::9; 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 1XjPVF-0004Fe-04; Wed, 29 Oct 2014 09:25:17 +0000 Received: from mailout2.w1.samsung.com ([210.118.77.12]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XjPTj-000216-Lt for linux-arm-kernel@lists.infradead.org; Wed, 29 Oct 2014 09:23:45 +0000 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout2.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NE700B5E8VCCW60@mailout2.w1.samsung.com> for linux-arm-kernel@lists.infradead.org; Wed, 29 Oct 2014 09:26:00 +0000 (GMT) X-AuditID: cbfec7f4-b7f6c6d00000120b-e6-5450b1ffddac Received: from eusync1.samsung.com ( [203.254.199.211]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id B9.04.04619.FF1B0545; Wed, 29 Oct 2014 09:23:11 +0000 (GMT) Received: from amdc1339.digital.local ([106.116.147.30]) by eusync1.samsung.com (Oracle Communications Messaging Server 7u4-23.01 (7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPA id <0NE700DWE8QECT50@eusync1.samsung.com>; Wed, 29 Oct 2014 09:23:11 +0000 (GMT) From: Marek Szyprowski To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH v7 5/8] ARM: l2c: Add support for overriding prefetch settings Date: Wed, 29 Oct 2014 10:22:58 +0100 Message-id: <1414574581-2320-6-git-send-email-m.szyprowski@samsung.com> X-Mailer: git-send-email 1.9.2 In-reply-to: <1414574581-2320-1-git-send-email-m.szyprowski@samsung.com> References: <1414574581-2320-1-git-send-email-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrCLMWRmVeSWpSXmKPExsVy+t/xy7r/NwaEGJyZrmvxaP5jZoveBVfZ LM42vWG32N45g91iyp/lTBabHl9jtbi8aw6bxewl/SwWM87vY7K4fZnX4tz2LSwWa4/cZbdY ev0ik8WqXX8YLfZf8XLg91gzbw2jR0tzD5vHt6+TWDwu9/UyeSz6nuWxc9Zddo871/aweWxe Uu/Rt2UVo8fnTXIBXFFcNimpOZllqUX6dglcGYu7TjEXXFeo+LDsOksD43upLkZODgkBE4ml u3exQ9hiEhfurWfrYuTiEBJYyijR3LSGEcLpY5K4OPU3WBWbgKFE19suNhBbRCBb4se3ySwg RcwCfcwS56f3MIMkhAX8JLquPmcCsVkEVCU+b50MZvMKuEvs+72YDWKdnMT/lyvA4pwCHhKr LywBiwsB1Ww83M02gZF3ASPDKkbR1NLkguKk9FxDveLE3OLSvHS95PzcTYyQkP6yg3HxMatD jAIcjEo8vBq7/UOEWBPLiitzDzFKcDArifDuMA8IEeJNSaysSi3Kjy8qzUktPsTIxMEp1cCY pFnwPaGVYf8p9ZjA1ZMEJjpLnnti+vFo2aQ7k+9l7X3XkRD9S+u12a/9if8zzZ8pe/wU0Ygy nbHd36JqxZf7i0N1QheXM39XvrDHRD7Bm9HMNb1mK3Mo9zoW4aiL4dfP9e6/mvBg8d0Tl/YL 6F0PC3mzNFfu8XLWRpU5khsjrt2MkZ+49dFcJZbijERDLeai4kQAYdx/+0cCAAA= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141029_022344_086105_39B42F7E X-CRM114-Status: GOOD ( 13.55 ) X-Spam-Score: -5.6 (-----) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-5.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [210.118.77.12 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [210.118.77.12 listed in wl.mailspike.net] -0.6 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders Cc: Mark Rutland , Kukjin Kim , lauraa@codeaurora.org, tony@atomide.com, linus.walleij@linaro.org, Tomasz Figa , drake@endlessm.com, loeliger@gmail.com, Kyungmin Park , Russell King - ARM Linux , linux-omap@vger.kernel.org, Marek Szyprowski X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: m.szyprowski@samsung.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.41 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Tomasz Figa Firmware on certain boards (e.g. ODROID-U3) can leave incorrect L2C prefetch settings configured in registers leading to crashes if L2C is enabled without overriding them. This patch introduces bindings to enable prefetch settings to be specified from DT and necessary support in the driver. Signed-off-by: Tomasz Figa [mszyprow: rebased onto v3.18-rc1, added error message when prefetch related dt property has been provided without any value] Signed-off-by: Marek Szyprowski --- Documentation/devicetree/bindings/arm/l2cc.txt | 10 +++++ arch/arm/mm/cache-l2x0.c | 55 ++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) diff --git a/Documentation/devicetree/bindings/arm/l2cc.txt b/Documentation/devicetree/bindings/arm/l2cc.txt index 292ef7ca3058..0dbabe9a6b0a 100644 --- a/Documentation/devicetree/bindings/arm/l2cc.txt +++ b/Documentation/devicetree/bindings/arm/l2cc.txt @@ -57,6 +57,16 @@ Optional properties: - cache-id-part: cache id part number to be used if it is not present on hardware - wt-override: If present then L2 is forced to Write through mode +- arm,double-linefill : Override double linefill enable setting. Enable if + non-zero, disable if zero. +- arm,double-linefill-incr : Override double linefill on INCR read. Enable + if non-zero, disable if zero. +- arm,double-linefill-wrap : Override double linefill on WRAP read. Enable + if non-zero, disable if zero. +- arm,prefetch-drop : Override prefetch drop enable setting. Enable if non-zero, + disable if zero. +- arm,prefetch-offset : Override prefetch offset value. Valid values are + 0-7, 15, 23, and 31. Example: diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c index 83b36f3b415c..ae417ddb05ed 100644 --- a/arch/arm/mm/cache-l2x0.c +++ b/arch/arm/mm/cache-l2x0.c @@ -1163,6 +1163,9 @@ static void __init l2c310_of_parse(const struct device_node *np, u32 tag[3] = { 0, 0, 0 }; u32 filter[2] = { 0, 0 }; u32 assoc; + u32 prefetch; + u32 val; + int ret; of_property_read_u32_array(np, "arm,tag-latency", tag, ARRAY_SIZE(tag)); if (tag[0] && tag[1] && tag[2]) @@ -1204,6 +1207,58 @@ static void __init l2c310_of_parse(const struct device_node *np, assoc); break; } + + prefetch = l2x0_saved_regs.prefetch_ctrl; + + ret = of_property_read_u32(np, "arm,double-linefill", &val); + if (ret == 0) { + if (val) + prefetch |= L310_PREFETCH_CTRL_DBL_LINEFILL; + else + prefetch &= ~L310_PREFETCH_CTRL_DBL_LINEFILL; + } else if (ret != -EINVAL) { + pr_err("L2C-310 OF arm,double-linefill property value is missing\n"); + } + + ret = of_property_read_u32(np, "arm,double-linefill-incr", &val); + if (ret == 0) { + if (val) + prefetch |= L310_PREFETCH_CTRL_DBL_LINEFILL_INCR; + else + prefetch &= ~L310_PREFETCH_CTRL_DBL_LINEFILL_INCR; + } else if (ret != -EINVAL) { + pr_err("L2C-310 OF arm,double-linefill-incr property value is missing\n"); + } + + ret = of_property_read_u32(np, "arm,double-linefill-wrap", &val); + if (ret == 0) { + if (!val) + prefetch |= L310_PREFETCH_CTRL_DBL_LINEFILL_WRAP; + else + prefetch &= ~L310_PREFETCH_CTRL_DBL_LINEFILL_WRAP; + } else if (ret != -EINVAL) { + pr_err("L2C-310 OF arm,double-linefill-wrap property value is missing\n"); + } + + ret = of_property_read_u32(np, "arm,prefetch-drop", &val); + if (ret == 0) { + if (val) + prefetch |= L310_PREFETCH_CTRL_PREFETCH_DROP; + else + prefetch &= ~L310_PREFETCH_CTRL_PREFETCH_DROP; + } else if (ret != -EINVAL) { + pr_err("L2C-310 OF arm,prefetch-drop property value is missing\n"); + } + + ret = of_property_read_u32(np, "arm,prefetch-offset", &val); + if (ret == 0) { + prefetch &= ~L310_PREFETCH_CTRL_OFFSET_MASK; + prefetch |= val & L310_PREFETCH_CTRL_OFFSET_MASK; + } else if (ret != -EINVAL) { + pr_err("L2C-310 OF arm,prefetch-offset property value is missing\n"); + } + + l2x0_saved_regs.prefetch_ctrl = prefetch; } static const struct l2c_init_data of_l2c310_data __initconst = {