lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140924111446.GE5729@leverpostej>
Date:	Wed, 24 Sep 2014 12:14:47 +0100
From:	Mark Rutland <mark.rutland@....com>
To:	Marek Szyprowski <m.szyprowski@...sung.com>
Cc:	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"linux-arm-kernel@...ts.infradead.org" 
	<linux-arm-kernel@...ts.infradead.org>,
	"linux-samsung-soc@...r.kernel.org" 
	<linux-samsung-soc@...r.kernel.org>,
	Kukjin Kim <kgene.kim@...sung.com>,
	"lauraa@...eaurora.org" <lauraa@...eaurora.org>,
	"tony@...mide.com" <tony@...mide.com>,
	"linus.walleij@...aro.org" <linus.walleij@...aro.org>,
	Tomasz Figa <tomasz.figa@...il.com>,
	"drake@...lessm.com" <drake@...lessm.com>,
	"loeliger@...il.com" <loeliger@...il.com>,
	Kyungmin Park <kyungmin.park@...sung.com>,
	"santosh.shilimkar@...com" <santosh.shilimkar@...com>,
	Russell King - ARM Linux <linux@....linux.org.uk>,
	"linux-omap@...r.kernel.org" <linux-omap@...r.kernel.org>
Subject: Re: [PATCH v5 4/7] ARM: l2c: Add support for overriding prefetch
 settings

On Wed, Sep 24, 2014 at 12:05:38PM +0100, Marek Szyprowski wrote:
> From: Tomasz Figa <t.figa@...sung.com>
> 
> 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 <t.figa@...sung.com>
> Signed-off-by: Marek Szyprowski <m.szyprowski@...sung.com>
> ---
>  Documentation/devicetree/bindings/arm/l2cc.txt | 10 +++++++
>  arch/arm/mm/cache-l2x0.c                       | 39 ++++++++++++++++++++++++++
>  2 files changed, 49 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/arm/l2cc.txt b/Documentation/devicetree/bindings/arm/l2cc.txt
> index af527ee111c2..3443d2d76788 100644
> --- a/Documentation/devicetree/bindings/arm/l2cc.txt
> +++ b/Documentation/devicetree/bindings/arm/l2cc.txt
> @@ -47,6 +47,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.

I'm not too keen on tristate properties. Is this level of flexibility
really required?

What exact overrides do you need for boards you know of? Why do these
cause crashes if not overridden?

Mark.

> +- 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 84c6c55ab896..af90a6ff6b49 100644
> --- a/arch/arm/mm/cache-l2x0.c
> +++ b/arch/arm/mm/cache-l2x0.c
> @@ -1059,6 +1059,8 @@ static void __init l2c310_of_parse(const struct device_node *np,
>  	u32 data[3] = { 0, 0, 0 };
>  	u32 tag[3] = { 0, 0, 0 };
>  	u32 filter[2] = { 0, 0 };
> +	u32 prefetch;
> +	u32 val;
>  
>  	of_property_read_u32_array(np, "arm,tag-latency", tag, ARRAY_SIZE(tag));
>  	if (tag[0] && tag[1] && tag[2])
> @@ -1083,6 +1085,43 @@ static void __init l2c310_of_parse(const struct device_node *np,
>  		l2x0_saved_regs.filter_start = (filter[0] & ~(SZ_1M - 1))
>  					| L310_ADDR_FILTER_EN;
>  	}
> +
> +	prefetch = l2x0_saved_regs.prefetch_ctrl;
> +
> +	if (!of_property_read_u32(np, "arm,double-linefill", &val)) {
> +		if (val)
> +			prefetch |= L310_PREFETCH_CTRL_DBL_LINEFILL;
> +		else
> +			prefetch &= ~L310_PREFETCH_CTRL_DBL_LINEFILL;
> +	}
> +
> +	if (!of_property_read_u32(np, "arm,double-linefill-incr", &val)) {
> +		if (val)
> +			prefetch |= L310_PREFETCH_CTRL_DBL_LINEFILL_INCR;
> +		else
> +			prefetch &= ~L310_PREFETCH_CTRL_DBL_LINEFILL_INCR;
> +	}
> +
> +	if (!of_property_read_u32(np, "arm,double-linefill-wrap", &val)) {
> +		if (!val)
> +			prefetch |= L310_PREFETCH_CTRL_DBL_LINEFILL_WRAP;
> +		else
> +			prefetch &= ~L310_PREFETCH_CTRL_DBL_LINEFILL_WRAP;
> +	}
> +
> +	if (!of_property_read_u32(np, "arm,prefetch-drop", &val)) {
> +		if (val)
> +			prefetch |= L310_PREFETCH_CTRL_PREFETCH_DROP;
> +		else
> +			prefetch &= ~L310_PREFETCH_CTRL_PREFETCH_DROP;
> +	}
> +
> +	if (!of_property_read_u32(np, "arm,prefetch-offset", &val)) {
> +		prefetch &= ~L310_PREFETCH_CTRL_OFFSET_MASK;
> +		prefetch |= val & L310_PREFETCH_CTRL_OFFSET_MASK;
> +	}
> +
> +	l2x0_saved_regs.prefetch_ctrl = prefetch;
>  }
>  
>  static const struct l2c_init_data of_l2c310_data __initconst = {
> -- 
> 1.9.2
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@...ts.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ