Skip to content

Commit 091353c

Browse files
committed
soc: bcm: brcmstb: biuctrl: Change RAC prefetch distance from +/-1 to +/- 2
Change the RAC prefetch distance from +/- 1 to +/- 2 for Cortex-A72 CPUs since this provides an average of a 3.8% performance increase for synthetic memcpy benchmarks. Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
1 parent 4029f3b commit 091353c

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

drivers/soc/bcm/brcmstb/biuctrl.c

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
#define RACENDATA_SHIFT 6
2121
#define RAC_CPU_SHIFT 8
2222
#define RACCFG_MASK 0xff
23+
#define DPREF_LINE_2_SHIFT 24
24+
#define DPREF_LINE_2_MASK 0xff
2325

2426
/* Bitmask to enable instruction and data prefetching with a 256-bytes stride */
2527
#define RAC_DATA_INST_EN_MASK (1 << RACPREFINST_SHIFT | \
@@ -50,6 +52,7 @@ enum cpubiuctrl_regs {
5052
CPU_MCP_FLOW_REG,
5153
CPU_WRITEBACK_CTRL_REG,
5254
RAC_CONFIG0_REG,
55+
RAC_CONFIG1_REG,
5356
NUM_CPU_BIUCTRL_REGS,
5457
};
5558

@@ -58,7 +61,7 @@ static inline u32 cbc_readl(int reg)
5861
int offset = cpubiuctrl_regs[reg];
5962

6063
if (offset == -1 ||
61-
(IS_ENABLED(CONFIG_CACHE_B15_RAC) && reg == RAC_CONFIG0_REG))
64+
(IS_ENABLED(CONFIG_CACHE_B15_RAC) && reg >= RAC_CONFIG0_REG))
6265
return (u32)-1;
6366

6467
return readl_relaxed(cpubiuctrl_base + offset);
@@ -69,7 +72,7 @@ static inline void cbc_writel(u32 val, int reg)
6972
int offset = cpubiuctrl_regs[reg];
7073

7174
if (offset == -1 ||
72-
(IS_ENABLED(CONFIG_CACHE_B15_RAC) && reg == RAC_CONFIG0_REG))
75+
(IS_ENABLED(CONFIG_CACHE_B15_RAC) && reg >= RAC_CONFIG0_REG))
7376
return;
7477

7578
writel(val, cpubiuctrl_base + offset);
@@ -80,6 +83,7 @@ static const int b15_cpubiuctrl_regs[] = {
8083
[CPU_MCP_FLOW_REG] = -1,
8184
[CPU_WRITEBACK_CTRL_REG] = -1,
8285
[RAC_CONFIG0_REG] = -1,
86+
[RAC_CONFIG1_REG] = -1,
8387
};
8488

8589
/* Odd cases, e.g: 7260A0 */
@@ -88,20 +92,23 @@ static const int b53_cpubiuctrl_no_wb_regs[] = {
8892
[CPU_MCP_FLOW_REG] = 0x0b4,
8993
[CPU_WRITEBACK_CTRL_REG] = -1,
9094
[RAC_CONFIG0_REG] = 0x78,
95+
[RAC_CONFIG1_REG] = 0x7c,
9196
};
9297

9398
static const int b53_cpubiuctrl_regs[] = {
9499
[CPU_CREDIT_REG] = 0x0b0,
95100
[CPU_MCP_FLOW_REG] = 0x0b4,
96101
[CPU_WRITEBACK_CTRL_REG] = 0x22c,
97102
[RAC_CONFIG0_REG] = 0x78,
103+
[RAC_CONFIG1_REG] = 0x7c,
98104
};
99105

100106
static const int a72_cpubiuctrl_regs[] = {
101107
[CPU_CREDIT_REG] = 0x18,
102108
[CPU_MCP_FLOW_REG] = 0x1c,
103109
[CPU_WRITEBACK_CTRL_REG] = 0x20,
104110
[RAC_CONFIG0_REG] = 0x08,
111+
[RAC_CONFIG1_REG] = 0x0c,
105112
};
106113

107114
static int __init mcp_write_pairing_set(void)
@@ -167,18 +174,23 @@ static const u32 a72_b53_mach_compat[] = {
167174
static void __init a72_b53_rac_enable_all(struct device_node *np)
168175
{
169176
unsigned int cpu;
170-
u32 enable = 0;
177+
u32 enable = 0, pref_dist;
171178

172179
if (IS_ENABLED(CONFIG_CACHE_B15_RAC))
173180
return;
174181

175182
if (WARN(num_possible_cpus() > 4, "RAC only supports 4 CPUs\n"))
176183
return;
177184

178-
for_each_possible_cpu(cpu)
185+
pref_dist = cbc_readl(RAC_CONFIG1_REG);
186+
for_each_possible_cpu(cpu) {
179187
enable |= RAC_DATA_INST_EN_MASK << (cpu * RAC_CPU_SHIFT);
188+
if (cpubiuctrl_regs == a72_cpubiuctrl_regs)
189+
pref_dist |= 1 << (cpu + DPREF_LINE_2_SHIFT);
190+
}
180191

181192
cbc_writel(enable, RAC_CONFIG0_REG);
193+
cbc_writel(pref_dist, RAC_CONFIG1_REG);
182194

183195
pr_info("%pOF: Broadcom %s read-ahead cache\n",
184196
np, cpubiuctrl_regs == a72_cpubiuctrl_regs ?

0 commit comments

Comments
 (0)