diff options
| -rw-r--r-- | arch/powerpc/kernel/process.c | 2 | ||||
| -rw-r--r-- | arch/powerpc/kvm/book3s_xive.c | 7 | ||||
| -rw-r--r-- | arch/powerpc/perf/core-book3s.c | 8 | ||||
| -rw-r--r-- | arch/powerpc/perf/imc-pmu.c | 17 |
4 files changed, 27 insertions, 7 deletions
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c index 5acb5a176dbe..72be0c32e902 100644 --- a/arch/powerpc/kernel/process.c +++ b/arch/powerpc/kernel/process.c | |||
| @@ -1403,7 +1403,7 @@ void show_regs(struct pt_regs * regs) | |||
| 1403 | 1403 | ||
| 1404 | printk("NIP: "REG" LR: "REG" CTR: "REG"\n", | 1404 | printk("NIP: "REG" LR: "REG" CTR: "REG"\n", |
| 1405 | regs->nip, regs->link, regs->ctr); | 1405 | regs->nip, regs->link, regs->ctr); |
| 1406 | printk("REGS: %p TRAP: %04lx %s (%s)\n", | 1406 | printk("REGS: %px TRAP: %04lx %s (%s)\n", |
| 1407 | regs, regs->trap, print_tainted(), init_utsname()->release); | 1407 | regs, regs->trap, print_tainted(), init_utsname()->release); |
| 1408 | printk("MSR: "REG" ", regs->msr); | 1408 | printk("MSR: "REG" ", regs->msr); |
| 1409 | print_msr_bits(regs->msr); | 1409 | print_msr_bits(regs->msr); |
diff --git a/arch/powerpc/kvm/book3s_xive.c b/arch/powerpc/kvm/book3s_xive.c index bf457843e032..0d750d274c4e 100644 --- a/arch/powerpc/kvm/book3s_xive.c +++ b/arch/powerpc/kvm/book3s_xive.c | |||
| @@ -725,7 +725,8 @@ u64 kvmppc_xive_get_icp(struct kvm_vcpu *vcpu) | |||
| 725 | 725 | ||
| 726 | /* Return the per-cpu state for state saving/migration */ | 726 | /* Return the per-cpu state for state saving/migration */ |
| 727 | return (u64)xc->cppr << KVM_REG_PPC_ICP_CPPR_SHIFT | | 727 | return (u64)xc->cppr << KVM_REG_PPC_ICP_CPPR_SHIFT | |
| 728 | (u64)xc->mfrr << KVM_REG_PPC_ICP_MFRR_SHIFT; | 728 | (u64)xc->mfrr << KVM_REG_PPC_ICP_MFRR_SHIFT | |
| 729 | (u64)0xff << KVM_REG_PPC_ICP_PPRI_SHIFT; | ||
| 729 | } | 730 | } |
| 730 | 731 | ||
| 731 | int kvmppc_xive_set_icp(struct kvm_vcpu *vcpu, u64 icpval) | 732 | int kvmppc_xive_set_icp(struct kvm_vcpu *vcpu, u64 icpval) |
| @@ -1558,7 +1559,7 @@ static int xive_set_source(struct kvmppc_xive *xive, long irq, u64 addr) | |||
| 1558 | 1559 | ||
| 1559 | /* | 1560 | /* |
| 1560 | * Restore P and Q. If the interrupt was pending, we | 1561 | * Restore P and Q. If the interrupt was pending, we |
| 1561 | * force both P and Q, which will trigger a resend. | 1562 | * force Q and !P, which will trigger a resend. |
| 1562 | * | 1563 | * |
| 1563 | * That means that a guest that had both an interrupt | 1564 | * That means that a guest that had both an interrupt |
| 1564 | * pending (queued) and Q set will restore with only | 1565 | * pending (queued) and Q set will restore with only |
| @@ -1566,7 +1567,7 @@ static int xive_set_source(struct kvmppc_xive *xive, long irq, u64 addr) | |||
| 1566 | * is perfectly fine as coalescing interrupts that haven't | 1567 | * is perfectly fine as coalescing interrupts that haven't |
| 1567 | * been presented yet is always allowed. | 1568 | * been presented yet is always allowed. |
| 1568 | */ | 1569 | */ |
| 1569 | if (val & KVM_XICS_PRESENTED || val & KVM_XICS_PENDING) | 1570 | if (val & KVM_XICS_PRESENTED && !(val & KVM_XICS_PENDING)) |
| 1570 | state->old_p = true; | 1571 | state->old_p = true; |
| 1571 | if (val & KVM_XICS_QUEUED || val & KVM_XICS_PENDING) | 1572 | if (val & KVM_XICS_QUEUED || val & KVM_XICS_PENDING) |
| 1572 | state->old_q = true; | 1573 | state->old_q = true; |
diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c index 153812966365..fce545774d50 100644 --- a/arch/powerpc/perf/core-book3s.c +++ b/arch/powerpc/perf/core-book3s.c | |||
| @@ -410,8 +410,12 @@ static __u64 power_pmu_bhrb_to(u64 addr) | |||
| 410 | int ret; | 410 | int ret; |
| 411 | __u64 target; | 411 | __u64 target; |
| 412 | 412 | ||
| 413 | if (is_kernel_addr(addr)) | 413 | if (is_kernel_addr(addr)) { |
| 414 | return branch_target((unsigned int *)addr); | 414 | if (probe_kernel_read(&instr, (void *)addr, sizeof(instr))) |
| 415 | return 0; | ||
| 416 | |||
| 417 | return branch_target(&instr); | ||
| 418 | } | ||
| 415 | 419 | ||
| 416 | /* Userspace: need copy instruction here then translate it */ | 420 | /* Userspace: need copy instruction here then translate it */ |
| 417 | pagefault_disable(); | 421 | pagefault_disable(); |
diff --git a/arch/powerpc/perf/imc-pmu.c b/arch/powerpc/perf/imc-pmu.c index 0ead3cd73caa..be4e7f84f70a 100644 --- a/arch/powerpc/perf/imc-pmu.c +++ b/arch/powerpc/perf/imc-pmu.c | |||
| @@ -310,6 +310,19 @@ static int ppc_nest_imc_cpu_offline(unsigned int cpu) | |||
| 310 | return 0; | 310 | return 0; |
| 311 | 311 | ||
| 312 | /* | 312 | /* |
| 313 | * Check whether nest_imc is registered. We could end up here if the | ||
| 314 | * cpuhotplug callback registration fails. i.e, callback invokes the | ||
| 315 | * offline path for all successfully registered nodes. At this stage, | ||
| 316 | * nest_imc pmu will not be registered and we should return here. | ||
| 317 | * | ||
| 318 | * We return with a zero since this is not an offline failure. And | ||
| 319 | * cpuhp_setup_state() returns the actual failure reason to the caller, | ||
| 320 | * which in turn will call the cleanup routine. | ||
| 321 | */ | ||
| 322 | if (!nest_pmus) | ||
| 323 | return 0; | ||
| 324 | |||
| 325 | /* | ||
| 313 | * Now that this cpu is one of the designated, | 326 | * Now that this cpu is one of the designated, |
| 314 | * find a next cpu a) which is online and b) in same chip. | 327 | * find a next cpu a) which is online and b) in same chip. |
| 315 | */ | 328 | */ |
| @@ -1171,6 +1184,7 @@ static void imc_common_cpuhp_mem_free(struct imc_pmu *pmu_ptr) | |||
| 1171 | if (nest_pmus == 1) { | 1184 | if (nest_pmus == 1) { |
| 1172 | cpuhp_remove_state(CPUHP_AP_PERF_POWERPC_NEST_IMC_ONLINE); | 1185 | cpuhp_remove_state(CPUHP_AP_PERF_POWERPC_NEST_IMC_ONLINE); |
| 1173 | kfree(nest_imc_refc); | 1186 | kfree(nest_imc_refc); |
| 1187 | kfree(per_nest_pmu_arr); | ||
| 1174 | } | 1188 | } |
| 1175 | 1189 | ||
| 1176 | if (nest_pmus > 0) | 1190 | if (nest_pmus > 0) |
| @@ -1195,7 +1209,6 @@ static void imc_common_cpuhp_mem_free(struct imc_pmu *pmu_ptr) | |||
| 1195 | kfree(pmu_ptr->attr_groups[IMC_EVENT_ATTR]->attrs); | 1209 | kfree(pmu_ptr->attr_groups[IMC_EVENT_ATTR]->attrs); |
| 1196 | kfree(pmu_ptr->attr_groups[IMC_EVENT_ATTR]); | 1210 | kfree(pmu_ptr->attr_groups[IMC_EVENT_ATTR]); |
| 1197 | kfree(pmu_ptr); | 1211 | kfree(pmu_ptr); |
| 1198 | kfree(per_nest_pmu_arr); | ||
| 1199 | return; | 1212 | return; |
| 1200 | } | 1213 | } |
| 1201 | 1214 | ||
| @@ -1309,6 +1322,8 @@ int init_imc_pmu(struct device_node *parent, struct imc_pmu *pmu_ptr, int pmu_id | |||
| 1309 | ret = nest_pmu_cpumask_init(); | 1322 | ret = nest_pmu_cpumask_init(); |
| 1310 | if (ret) { | 1323 | if (ret) { |
| 1311 | mutex_unlock(&nest_init_lock); | 1324 | mutex_unlock(&nest_init_lock); |
| 1325 | kfree(nest_imc_refc); | ||
| 1326 | kfree(per_nest_pmu_arr); | ||
| 1312 | goto err_free; | 1327 | goto err_free; |
| 1313 | } | 1328 | } |
| 1314 | } | 1329 | } |
