Skip to contentSkip to conversation

ARM: mm: show prefetch state when either data or instr prefect is enabled

PATCH New Thomas Petazzoni 2 participants 3 messages Jun 11, 2015 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: mm: show prefetch state when either data or instr prefect is enabled

The l2c310_enable() function shows the state of prefetch configuration only when both data *and* instruction prefetching is enabled, but the message itself is able to cope with having either data or instruction prefetch enabled, showing "ID prefetch enabled" when both are enabled, "D prefetch enabled" when only data prefetch is enabled, and "I prefetch enabled" when only instruction prefetch is enabled.

Therefore, this commit adjusts the code to display the prefetch configuration when either data *or* instruction prefetching is enabled. On my system with data prefetching enabled only, it shows:

  [    0.000000] L2C-310 D prefetch enabled, offset 1 lines
---
 arch/arm/mm/cache-l2x0.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/mm/cache-l2x0.c +2 -1
index d6e43d8..6bdf3a5 100644
@@ -656,7 +656,8 @@ static void __init l2c310_enable(void __iomem *base, u32 aux, unsigned num_lock)
 	/* Read back resulting AUX_CTRL value as it could have been altered. */
 	aux = readl_relaxed(base + L2X0_AUX_CTRL);
 
-	if (aux & (L310_AUX_CTRL_DATA_PREFETCH | L310_AUX_CTRL_INSTR_PREFETCH)) {
+	if ((aux & L310_AUX_CTRL_DATA_PREFETCH) ||
+	    (aux & L310_AUX_CTRL_INSTR_PREFETCH)) {
 		u32 prefetch = readl_relaxed(base + L310_PREFETCH_CTRL);
 
 		pr_info("L2C-310 %s%s prefetch enabled, offset %u lines\n",
Signature · 1 line
2.1.0
#1 lore raw

PATCH 1/1 ARM: mm: show prefetch state when either data or instr prefect is enabled

Quoted 2 lines · Thomas Petazzoni

The l2c310_enable() function shows the state of prefetch configuration only when both data *and* instruction prefetching is enabled, but the

Completely wrong, sorry.

arch/arm/mm/cache-l2x0.c static void __init l2c310_enable(void __iomem *base, u32 aux, unsigned num_lock) · line 659

Quoted 9 lines
arch/arm/mm/cache-l2x0.c +0 -1
index d6e43d8..6bdf3a5 100644
@@ -656,7 +656,8 @@ static void __init l2c310_enable(void __iomem *base, u32 aux, unsigned num_lock)
 	/* Read back resulting AUX_CTRL value as it could have been altered. */
 	aux = readl_relaxed(base + L2X0_AUX_CTRL);
 
-	if (aux & (L310_AUX_CTRL_DATA_PREFETCH | L310_AUX_CTRL_INSTR_PREFETCH)) {

What this says is...
first, bitwise _OR_ L310_AUX_CTRL_DATA_PREFETCH with L310_AUX_CTRL_INSTR_PREFETCH. This produces a number which has _two_ bits set.

then, bitwise _AND_ that number with the auxiliary control register.

If the result is non-zero, then execute the code within the if() { } block.

So, I'm not going to take this patch. The code is correct as it stands.

Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.
#2 lore raw

PATCH 1/1 ARM: mm: show prefetch state when either data or instr prefect is enabled

Russell,

Quoted 15 lines · Russell King - ARM Linux

arch/arm/mm/cache-l2x0.c static void __init l2c310_enable(void __iomem *base, u32 aux, unsigned num_lock) · line 659

Quoted 9 lines
arch/arm/mm/cache-l2x0.c +0 -1
index d6e43d8..6bdf3a5 100644
@@ -656,7 +656,8 @@ static void __init l2c310_enable(void __iomem *base, u32 aux, unsigned num_lock)
 	/* Read back resulting AUX_CTRL value as it could have been altered. */
 	aux = readl_relaxed(base + L2X0_AUX_CTRL);
 
-	if (aux & (L310_AUX_CTRL_DATA_PREFETCH | L310_AUX_CTRL_INSTR_PREFETCH)) {

What this says is...
first, bitwise _OR_ L310_AUX_CTRL_DATA_PREFETCH with L310_AUX_CTRL_INSTR_PREFETCH. This produces a number which has _two_ bits set.

Quoted 6 lines

then, bitwise _AND_ that number with the auxiliary control register.

If the result is non-zero, then execute the code within the if() { } block.

So, I'm not going to take this patch. The code is correct as it stands.

You are indeed absolutely correct. I got confused because I wasn't seeing the message, but it was caused by the other problem (writing AUX_CTRL overwriting the changes made to PREFETCH_CTRL). But that obviously had nothing to do with this part of the code.

Sorry for the noise, and thanks for the quick feedback,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com