Skip to content

Commit f89d416

Browse files
committed
Merge tag 'powerpc-5.5-3' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux
Pull powerpc fixes from Michael Ellerman: "One fix for a regression introduced by our recent rework of cache flushing on memory hotunplug. Like several other arches, our VDSO clock_getres() needed a fix to match the semantics of posix_get_hrtimer_res(). A fix for a boot crash on Power9 LPARs using PCI LSI interrupts. A commit disabling use of the trace_imc PMU (not the core PMU) on Power9 systems, because it can lead to checkstops, until a workaround is developed. A handful of other minor fixes. Thanks to: Aneesh Kumar K.V, Anju T Sudhakar, Ard Biesheuvel, Christophe Leroy, Cédric Le Goater, Madhavan Srinivasan, Vincenzo Frascino" * tag 'powerpc-5.5-3' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: powerpc/perf: Disable trace_imc pmu powerpc/powernv: Avoid re-registration of imc debugfs directory powerpc/pmem: Convert to EXPORT_SYMBOL_GPL powerpc/archrandom: fix arch_get_random_seed_int() powerpc: Fix vDSO clock_getres() powerpc/pmem: Fix kernel crash due to wrong range value usage in flush_dcache_range powerpc/xive: Skip ioremap() of ESB pages for LSI interrupts powerpc/kasan: Fix boot failure with RELOCATABLE && FSL_BOOKE
2 parents 3cf2890 + 249fad7 commit f89d416

File tree

11 files changed

+55
-38
lines changed

11 files changed

+55
-38
lines changed

arch/powerpc/include/asm/archrandom.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ static inline int arch_get_random_seed_int(unsigned int *v)
2828
unsigned long val;
2929
int rc;
3030

31-
rc = arch_get_random_long(&val);
31+
rc = arch_get_random_seed_long(&val);
3232
if (rc)
3333
*v = val;
3434

arch/powerpc/include/asm/vdso_datapage.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ struct vdso_data {
8383
__s64 wtom_clock_sec; /* Wall to monotonic clock sec */
8484
__s64 stamp_xtime_sec; /* xtime secs as at tb_orig_stamp */
8585
__s64 stamp_xtime_nsec; /* xtime nsecs as at tb_orig_stamp */
86+
__u32 hrtimer_res; /* hrtimer resolution */
8687
__u32 syscall_map_64[SYSCALL_MAP_SIZE]; /* map of syscalls */
8788
__u32 syscall_map_32[SYSCALL_MAP_SIZE]; /* map of syscalls */
8889
};
@@ -105,6 +106,7 @@ struct vdso_data {
105106
__s32 stamp_xtime_sec; /* xtime seconds as at tb_orig_stamp */
106107
__s32 stamp_xtime_nsec; /* xtime nsecs as at tb_orig_stamp */
107108
__u32 stamp_sec_fraction; /* fractional seconds of stamp_xtime */
109+
__u32 hrtimer_res; /* hrtimer resolution */
108110
__u32 syscall_map_32[SYSCALL_MAP_SIZE]; /* map of syscalls */
109111
__u32 dcache_block_size; /* L1 d-cache block size */
110112
__u32 icache_block_size; /* L1 i-cache block size */

arch/powerpc/kernel/asm-offsets.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,7 @@ int main(void)
388388
OFFSET(STAMP_XTIME_SEC, vdso_data, stamp_xtime_sec);
389389
OFFSET(STAMP_XTIME_NSEC, vdso_data, stamp_xtime_nsec);
390390
OFFSET(STAMP_SEC_FRAC, vdso_data, stamp_sec_fraction);
391+
OFFSET(CLOCK_HRTIMER_RES, vdso_data, hrtimer_res);
391392
OFFSET(CFG_ICACHE_BLOCKSZ, vdso_data, icache_block_size);
392393
OFFSET(CFG_DCACHE_BLOCKSZ, vdso_data, dcache_block_size);
393394
OFFSET(CFG_ICACHE_LOGBLOCKSZ, vdso_data, icache_log_block_size);
@@ -413,7 +414,6 @@ int main(void)
413414
DEFINE(CLOCK_REALTIME_COARSE, CLOCK_REALTIME_COARSE);
414415
DEFINE(CLOCK_MONOTONIC_COARSE, CLOCK_MONOTONIC_COARSE);
415416
DEFINE(NSEC_PER_SEC, NSEC_PER_SEC);
416-
DEFINE(CLOCK_REALTIME_RES, MONOTONIC_RES_NSEC);
417417

418418
#ifdef CONFIG_BUG
419419
DEFINE(BUG_ENTRY_SIZE, sizeof(struct bug_entry));

arch/powerpc/kernel/head_fsl_booke.S

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,9 @@ set_ivor:
240240

241241
bl early_init
242242

243+
#ifdef CONFIG_KASAN
244+
bl kasan_early_init
245+
#endif
243246
#ifdef CONFIG_RELOCATABLE
244247
mr r3,r30
245248
mr r4,r31
@@ -266,9 +269,6 @@ set_ivor:
266269
/*
267270
* Decide what sort of machine this is and initialize the MMU.
268271
*/
269-
#ifdef CONFIG_KASAN
270-
bl kasan_early_init
271-
#endif
272272
mr r3,r30
273273
mr r4,r31
274274
bl machine_init

arch/powerpc/kernel/time.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -960,6 +960,7 @@ void update_vsyscall(struct timekeeper *tk)
960960
vdso_data->stamp_xtime_sec = xt.tv_sec;
961961
vdso_data->stamp_xtime_nsec = xt.tv_nsec;
962962
vdso_data->stamp_sec_fraction = frac_sec;
963+
vdso_data->hrtimer_res = hrtimer_resolution;
963964
smp_wmb();
964965
++(vdso_data->tb_update_count);
965966
}

arch/powerpc/kernel/vdso32/gettimeofday.S

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,15 @@ V_FUNCTION_BEGIN(__kernel_clock_getres)
154154
cror cr0*4+eq,cr0*4+eq,cr1*4+eq
155155
bne cr0,99f
156156

157+
mflr r12
158+
.cfi_register lr,r12
159+
bl __get_datapage@local /* get data page */
160+
lwz r5, CLOCK_HRTIMER_RES(r3)
161+
mtlr r12
157162
li r3,0
158163
cmpli cr0,r4,0
159164
crclr cr0*4+so
160165
beqlr
161-
lis r5,CLOCK_REALTIME_RES@h
162-
ori r5,r5,CLOCK_REALTIME_RES@l
163166
stw r3,TSPC32_TV_SEC(r4)
164167
stw r5,TSPC32_TV_NSEC(r4)
165168
blr

arch/powerpc/kernel/vdso64/gettimeofday.S

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,12 +186,15 @@ V_FUNCTION_BEGIN(__kernel_clock_getres)
186186
cror cr0*4+eq,cr0*4+eq,cr1*4+eq
187187
bne cr0,99f
188188

189+
mflr r12
190+
.cfi_register lr,r12
191+
bl V_LOCAL_FUNC(__get_datapage)
192+
lwz r5, CLOCK_HRTIMER_RES(r3)
193+
mtlr r12
189194
li r3,0
190195
cmpldi cr0,r4,0
191196
crclr cr0*4+so
192197
beqlr
193-
lis r5,CLOCK_REALTIME_RES@h
194-
ori r5,r5,CLOCK_REALTIME_RES@l
195198
std r3,TSPC64_TV_SEC(r4)
196199
std r5,TSPC64_TV_NSEC(r4)
197200
blr

arch/powerpc/lib/pmem.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ void arch_wb_cache_pmem(void *addr, size_t size)
1717
unsigned long start = (unsigned long) addr;
1818
flush_dcache_range(start, start + size);
1919
}
20-
EXPORT_SYMBOL(arch_wb_cache_pmem);
20+
EXPORT_SYMBOL_GPL(arch_wb_cache_pmem);
2121

2222
void arch_invalidate_pmem(void *addr, size_t size)
2323
{
2424
unsigned long start = (unsigned long) addr;
2525
flush_dcache_range(start, start + size);
2626
}
27-
EXPORT_SYMBOL(arch_invalidate_pmem);
27+
EXPORT_SYMBOL_GPL(arch_invalidate_pmem);
2828

2929
/*
3030
* CONFIG_ARCH_HAS_UACCESS_FLUSHCACHE symbols

arch/powerpc/mm/mem.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ static void flush_dcache_range_chunked(unsigned long start, unsigned long stop,
121121
unsigned long i;
122122

123123
for (i = start; i < stop; i += chunk) {
124-
flush_dcache_range(i, min(stop, start + chunk));
124+
flush_dcache_range(i, min(stop, i + chunk));
125125
cond_resched();
126126
}
127127
}

arch/powerpc/platforms/powernv/opal-imc.c

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,6 @@ static void export_imc_mode_and_cmd(struct device_node *node,
5959

6060
imc_debugfs_parent = debugfs_create_dir("imc", powerpc_debugfs_root);
6161

62-
/*
63-
* Return here, either because 'imc' directory already exists,
64-
* Or failed to create a new one.
65-
*/
6662
if (!imc_debugfs_parent)
6763
return;
6864

@@ -135,7 +131,6 @@ static int imc_get_mem_addr_nest(struct device_node *node,
135131
}
136132

137133
pmu_ptr->imc_counter_mmaped = true;
138-
export_imc_mode_and_cmd(node, pmu_ptr);
139134
kfree(base_addr_arr);
140135
kfree(chipid_arr);
141136
return 0;
@@ -151,35 +146,31 @@ static int imc_get_mem_addr_nest(struct device_node *node,
151146
* and domain as the inputs.
152147
* Allocates memory for the struct imc_pmu, sets up its domain, size and offsets
153148
*/
154-
static int imc_pmu_create(struct device_node *parent, int pmu_index, int domain)
149+
static struct imc_pmu *imc_pmu_create(struct device_node *parent, int pmu_index, int domain)
155150
{
156151
int ret = 0;
157152
struct imc_pmu *pmu_ptr;
158153
u32 offset;
159154

160155
/* Return for unknown domain */
161156
if (domain < 0)
162-
return -EINVAL;
157+
return NULL;
163158

164159
/* memory for pmu */
165160
pmu_ptr = kzalloc(sizeof(*pmu_ptr), GFP_KERNEL);
166161
if (!pmu_ptr)
167-
return -ENOMEM;
162+
return NULL;
168163

169164
/* Set the domain */
170165
pmu_ptr->domain = domain;
171166

172167
ret = of_property_read_u32(parent, "size", &pmu_ptr->counter_mem_size);
173-
if (ret) {
174-
ret = -EINVAL;
168+
if (ret)
175169
goto free_pmu;
176-
}
177170

178171
if (!of_property_read_u32(parent, "offset", &offset)) {
179-
if (imc_get_mem_addr_nest(parent, pmu_ptr, offset)) {
180-
ret = -EINVAL;
172+
if (imc_get_mem_addr_nest(parent, pmu_ptr, offset))
181173
goto free_pmu;
182-
}
183174
}
184175

185176
/* Function to register IMC pmu */
@@ -190,14 +181,14 @@ static int imc_pmu_create(struct device_node *parent, int pmu_index, int domain)
190181
if (pmu_ptr->domain == IMC_DOMAIN_NEST)
191182
kfree(pmu_ptr->mem_info);
192183
kfree(pmu_ptr);
193-
return ret;
184+
return NULL;
194185
}
195186

196-
return 0;
187+
return pmu_ptr;
197188

198189
free_pmu:
199190
kfree(pmu_ptr);
200-
return ret;
191+
return NULL;
201192
}
202193

203194
static void disable_nest_pmu_counters(void)
@@ -254,6 +245,7 @@ int get_max_nest_dev(void)
254245
static int opal_imc_counters_probe(struct platform_device *pdev)
255246
{
256247
struct device_node *imc_dev = pdev->dev.of_node;
248+
struct imc_pmu *pmu;
257249
int pmu_count = 0, domain;
258250
bool core_imc_reg = false, thread_imc_reg = false;
259251
u32 type;
@@ -269,6 +261,7 @@ static int opal_imc_counters_probe(struct platform_device *pdev)
269261
}
270262

271263
for_each_compatible_node(imc_dev, NULL, IMC_DTB_UNIT_COMPAT) {
264+
pmu = NULL;
272265
if (of_property_read_u32(imc_dev, "type", &type)) {
273266
pr_warn("IMC Device without type property\n");
274267
continue;
@@ -285,28 +278,35 @@ static int opal_imc_counters_probe(struct platform_device *pdev)
285278
domain = IMC_DOMAIN_THREAD;
286279
break;
287280
case IMC_TYPE_TRACE:
288-
domain = IMC_DOMAIN_TRACE;
281+
/*
282+
* FIXME. Using trace_imc events to monitor application
283+
* or KVM thread performance can cause a checkstop
284+
* (system crash).
285+
* Disable it for now.
286+
*/
287+
pr_info_once("IMC: disabling trace_imc PMU\n");
288+
domain = -1;
289289
break;
290290
default:
291291
pr_warn("IMC Unknown Device type \n");
292292
domain = -1;
293293
break;
294294
}
295295

296-
if (!imc_pmu_create(imc_dev, pmu_count, domain)) {
297-
if (domain == IMC_DOMAIN_NEST)
296+
pmu = imc_pmu_create(imc_dev, pmu_count, domain);
297+
if (pmu != NULL) {
298+
if (domain == IMC_DOMAIN_NEST) {
299+
if (!imc_debugfs_parent)
300+
export_imc_mode_and_cmd(imc_dev, pmu);
298301
pmu_count++;
302+
}
299303
if (domain == IMC_DOMAIN_CORE)
300304
core_imc_reg = true;
301305
if (domain == IMC_DOMAIN_THREAD)
302306
thread_imc_reg = true;
303307
}
304308
}
305309

306-
/* If none of the nest units are registered, remove debugfs interface */
307-
if (pmu_count == 0)
308-
debugfs_remove_recursive(imc_debugfs_parent);
309-
310310
/* If core imc is not registered, unregister thread-imc */
311311
if (!core_imc_reg && thread_imc_reg)
312312
unregister_thread_imc();

0 commit comments

Comments
 (0)