Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

+55 -38
+1 -1
arch/powerpc/include/asm/archrandom.h
··· 28 28 unsigned long val; 29 29 int rc; 30 30 31 - rc = arch_get_random_long(&val); 31 + rc = arch_get_random_seed_long(&val); 32 32 if (rc) 33 33 *v = val; 34 34
+2
arch/powerpc/include/asm/vdso_datapage.h
··· 83 83 __s64 wtom_clock_sec; /* Wall to monotonic clock sec */ 84 84 __s64 stamp_xtime_sec; /* xtime secs as at tb_orig_stamp */ 85 85 __s64 stamp_xtime_nsec; /* xtime nsecs as at tb_orig_stamp */ 86 + __u32 hrtimer_res; /* hrtimer resolution */ 86 87 __u32 syscall_map_64[SYSCALL_MAP_SIZE]; /* map of syscalls */ 87 88 __u32 syscall_map_32[SYSCALL_MAP_SIZE]; /* map of syscalls */ 88 89 }; ··· 106 105 __s32 stamp_xtime_sec; /* xtime seconds as at tb_orig_stamp */ 107 106 __s32 stamp_xtime_nsec; /* xtime nsecs as at tb_orig_stamp */ 108 107 __u32 stamp_sec_fraction; /* fractional seconds of stamp_xtime */ 108 + __u32 hrtimer_res; /* hrtimer resolution */ 109 109 __u32 syscall_map_32[SYSCALL_MAP_SIZE]; /* map of syscalls */ 110 110 __u32 dcache_block_size; /* L1 d-cache block size */ 111 111 __u32 icache_block_size; /* L1 i-cache block size */
+1 -1
arch/powerpc/kernel/asm-offsets.c
··· 388 388 OFFSET(STAMP_XTIME_SEC, vdso_data, stamp_xtime_sec); 389 389 OFFSET(STAMP_XTIME_NSEC, vdso_data, stamp_xtime_nsec); 390 390 OFFSET(STAMP_SEC_FRAC, vdso_data, stamp_sec_fraction); 391 + OFFSET(CLOCK_HRTIMER_RES, vdso_data, hrtimer_res); 391 392 OFFSET(CFG_ICACHE_BLOCKSZ, vdso_data, icache_block_size); 392 393 OFFSET(CFG_DCACHE_BLOCKSZ, vdso_data, dcache_block_size); 393 394 OFFSET(CFG_ICACHE_LOGBLOCKSZ, vdso_data, icache_log_block_size); ··· 414 413 DEFINE(CLOCK_REALTIME_COARSE, CLOCK_REALTIME_COARSE); 415 414 DEFINE(CLOCK_MONOTONIC_COARSE, CLOCK_MONOTONIC_COARSE); 416 415 DEFINE(NSEC_PER_SEC, NSEC_PER_SEC); 417 - DEFINE(CLOCK_REALTIME_RES, MONOTONIC_RES_NSEC); 418 416 419 417 #ifdef CONFIG_BUG 420 418 DEFINE(BUG_ENTRY_SIZE, sizeof(struct bug_entry));
+3 -3
arch/powerpc/kernel/head_fsl_booke.S
··· 240 240 241 241 bl early_init 242 242 243 + #ifdef CONFIG_KASAN 244 + bl kasan_early_init 245 + #endif 243 246 #ifdef CONFIG_RELOCATABLE 244 247 mr r3,r30 245 248 mr r4,r31 ··· 269 266 /* 270 267 * Decide what sort of machine this is and initialize the MMU. 271 268 */ 272 - #ifdef CONFIG_KASAN 273 - bl kasan_early_init 274 - #endif 275 269 mr r3,r30 276 270 mr r4,r31 277 271 bl machine_init
+1
arch/powerpc/kernel/time.c
··· 960 960 vdso_data->stamp_xtime_sec = xt.tv_sec; 961 961 vdso_data->stamp_xtime_nsec = xt.tv_nsec; 962 962 vdso_data->stamp_sec_fraction = frac_sec; 963 + vdso_data->hrtimer_res = hrtimer_resolution; 963 964 smp_wmb(); 964 965 ++(vdso_data->tb_update_count); 965 966 }
+5 -2
arch/powerpc/kernel/vdso32/gettimeofday.S
··· 154 154 cror cr0*4+eq,cr0*4+eq,cr1*4+eq 155 155 bne cr0,99f 156 156 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 157 162 li r3,0 158 163 cmpli cr0,r4,0 159 164 crclr cr0*4+so 160 165 beqlr 161 - lis r5,CLOCK_REALTIME_RES@h 162 - ori r5,r5,CLOCK_REALTIME_RES@l 163 166 stw r3,TSPC32_TV_SEC(r4) 164 167 stw r5,TSPC32_TV_NSEC(r4) 165 168 blr
+5 -2
arch/powerpc/kernel/vdso64/gettimeofday.S
··· 186 186 cror cr0*4+eq,cr0*4+eq,cr1*4+eq 187 187 bne cr0,99f 188 188 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 189 194 li r3,0 190 195 cmpldi cr0,r4,0 191 196 crclr cr0*4+so 192 197 beqlr 193 - lis r5,CLOCK_REALTIME_RES@h 194 - ori r5,r5,CLOCK_REALTIME_RES@l 195 198 std r3,TSPC64_TV_SEC(r4) 196 199 std r5,TSPC64_TV_NSEC(r4) 197 200 blr
+2 -2
arch/powerpc/lib/pmem.c
··· 17 17 unsigned long start = (unsigned long) addr; 18 18 flush_dcache_range(start, start + size); 19 19 } 20 - EXPORT_SYMBOL(arch_wb_cache_pmem); 20 + EXPORT_SYMBOL_GPL(arch_wb_cache_pmem); 21 21 22 22 void arch_invalidate_pmem(void *addr, size_t size) 23 23 { 24 24 unsigned long start = (unsigned long) addr; 25 25 flush_dcache_range(start, start + size); 26 26 } 27 - EXPORT_SYMBOL(arch_invalidate_pmem); 27 + EXPORT_SYMBOL_GPL(arch_invalidate_pmem); 28 28 29 29 /* 30 30 * CONFIG_ARCH_HAS_UACCESS_FLUSHCACHE symbols
+1 -1
arch/powerpc/mm/mem.c
··· 121 121 unsigned long i; 122 122 123 123 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)); 125 125 cond_resched(); 126 126 } 127 127 }
+24 -24
arch/powerpc/platforms/powernv/opal-imc.c
··· 59 59 60 60 imc_debugfs_parent = debugfs_create_dir("imc", powerpc_debugfs_root); 61 61 62 - /* 63 - * Return here, either because 'imc' directory already exists, 64 - * Or failed to create a new one. 65 - */ 66 62 if (!imc_debugfs_parent) 67 63 return; 68 64 ··· 131 135 } 132 136 133 137 pmu_ptr->imc_counter_mmaped = true; 134 - export_imc_mode_and_cmd(node, pmu_ptr); 135 138 kfree(base_addr_arr); 136 139 kfree(chipid_arr); 137 140 return 0; ··· 146 151 * and domain as the inputs. 147 152 * Allocates memory for the struct imc_pmu, sets up its domain, size and offsets 148 153 */ 149 - static int imc_pmu_create(struct device_node *parent, int pmu_index, int domain) 154 + static struct imc_pmu *imc_pmu_create(struct device_node *parent, int pmu_index, int domain) 150 155 { 151 156 int ret = 0; 152 157 struct imc_pmu *pmu_ptr; ··· 154 159 155 160 /* Return for unknown domain */ 156 161 if (domain < 0) 157 - return -EINVAL; 162 + return NULL; 158 163 159 164 /* memory for pmu */ 160 165 pmu_ptr = kzalloc(sizeof(*pmu_ptr), GFP_KERNEL); 161 166 if (!pmu_ptr) 162 - return -ENOMEM; 167 + return NULL; 163 168 164 169 /* Set the domain */ 165 170 pmu_ptr->domain = domain; 166 171 167 172 ret = of_property_read_u32(parent, "size", &pmu_ptr->counter_mem_size); 168 - if (ret) { 169 - ret = -EINVAL; 173 + if (ret) 170 174 goto free_pmu; 171 - } 172 175 173 176 if (!of_property_read_u32(parent, "offset", &offset)) { 174 - if (imc_get_mem_addr_nest(parent, pmu_ptr, offset)) { 175 - ret = -EINVAL; 177 + if (imc_get_mem_addr_nest(parent, pmu_ptr, offset)) 176 178 goto free_pmu; 177 - } 178 179 } 179 180 180 181 /* Function to register IMC pmu */ ··· 181 190 if (pmu_ptr->domain == IMC_DOMAIN_NEST) 182 191 kfree(pmu_ptr->mem_info); 183 192 kfree(pmu_ptr); 184 - return ret; 193 + return NULL; 185 194 } 186 195 187 - return 0; 196 + return pmu_ptr; 188 197 189 198 free_pmu: 190 199 kfree(pmu_ptr); 191 - return ret; 200 + return NULL; 192 201 } 193 202 194 203 static void disable_nest_pmu_counters(void) ··· 245 254 static int opal_imc_counters_probe(struct platform_device *pdev) 246 255 { 247 256 struct device_node *imc_dev = pdev->dev.of_node; 257 + struct imc_pmu *pmu; 248 258 int pmu_count = 0, domain; 249 259 bool core_imc_reg = false, thread_imc_reg = false; 250 260 u32 type; ··· 261 269 } 262 270 263 271 for_each_compatible_node(imc_dev, NULL, IMC_DTB_UNIT_COMPAT) { 272 + pmu = NULL; 264 273 if (of_property_read_u32(imc_dev, "type", &type)) { 265 274 pr_warn("IMC Device without type property\n"); 266 275 continue; ··· 278 285 domain = IMC_DOMAIN_THREAD; 279 286 break; 280 287 case IMC_TYPE_TRACE: 281 - domain = IMC_DOMAIN_TRACE; 288 + /* 289 + * FIXME. Using trace_imc events to monitor application 290 + * or KVM thread performance can cause a checkstop 291 + * (system crash). 292 + * Disable it for now. 293 + */ 294 + pr_info_once("IMC: disabling trace_imc PMU\n"); 295 + domain = -1; 282 296 break; 283 297 default: 284 298 pr_warn("IMC Unknown Device type \n"); ··· 293 293 break; 294 294 } 295 295 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); 298 301 pmu_count++; 302 + } 299 303 if (domain == IMC_DOMAIN_CORE) 300 304 core_imc_reg = true; 301 305 if (domain == IMC_DOMAIN_THREAD) 302 306 thread_imc_reg = true; 303 307 } 304 308 } 305 - 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 309 310 310 /* If core imc is not registered, unregister thread-imc */ 311 311 if (!core_imc_reg && thread_imc_reg)
+10 -2
arch/powerpc/sysdev/xive/spapr.c
··· 392 392 data->esb_shift = esb_shift; 393 393 data->trig_page = trig_page; 394 394 395 + data->hw_irq = hw_irq; 396 + 395 397 /* 396 398 * No chip-id for the sPAPR backend. This has an impact how we 397 399 * pick a target. See xive_pick_irq_target(). 398 400 */ 399 401 data->src_chip = XIVE_INVALID_CHIP_ID; 400 402 403 + /* 404 + * When the H_INT_ESB flag is set, the H_INT_ESB hcall should 405 + * be used for interrupt management. Skip the remapping of the 406 + * ESB pages which are not available. 407 + */ 408 + if (data->flags & XIVE_IRQ_FLAG_H_INT_ESB) 409 + return 0; 410 + 401 411 data->eoi_mmio = ioremap(data->eoi_page, 1u << data->esb_shift); 402 412 if (!data->eoi_mmio) { 403 413 pr_err("Failed to map EOI page for irq 0x%x\n", hw_irq); 404 414 return -ENOMEM; 405 415 } 406 - 407 - data->hw_irq = hw_irq; 408 416 409 417 /* Full function page supports trigger */ 410 418 if (flags & XIVE_SRC_TRIGGER) {