mirror of
https://github.com/torvalds/linux.git
synced 2026-11-20 13:03:48 +00:00
Merge tag 'powerpc-7.4-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux
Pull powerpc fixes from Madhavan Srinivasan: - Handle of_property_count_u32_elems() error in parse_thread_groups() - Defer Nemo IRQ initialization - disable watchdog when watchdog_thresh=0 - Reserve a PLT entry for ftrace_regs_caller - powerpc KVM fixes - misc fixes and cleanups Thanks to Amit Machhiwal, Bradley Morgan, Christian Zigotzky, Christophe Leroy, Gautam Menghani, Jiale Yao, Luiz Capitulino, Michael Ellerman, Mohammad Shahid, Nathan Chancellor, Ritesh Harjani, Sasha Levin, Shrikanth Hegde, and Timothy Pearson * tag 'powerpc-7.4-2' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux: powerpc/perf/vpa-dtl: use GFP_ATOMIC for DTL buffer allocation powerpc32/modules: Reserve a PLT entry for ftrace_regs_caller powerpc/watchdog: disable watchdog when watchdog_thresh=0 selftests/powerpc: override EMIT_TESTS instead of the emit_tests rule powerpc/smp: Handle of_property_count_u32_elems() error in parse_thread_groups() powerpc/pasemi: Defer Nemo IRQ initialization KVM: PPC: Book3S HV: Avoid spurious interrupts caused by LPCR_MER bit KVM: PPC: Book3S HV: Take SRCU read lock around kvmppc_h_page_init() call KVM: PPC: Book3S HV: XICS: Avoid NULL ptr deref in kvmppc_xive_cleanup_vcpu() KVM: PPC: Book3S HV: XICS: Update irq_type for cleanup to work KVM: PPC: Book3S HV: Ensure that calls to idr_alloc are synchronized KVM: PPC: Book3S HV: Disable preemption around host-side HPT lock users powerpc/eeh: NUL-terminate force recovery input
This commit is contained in:
@@ -1728,10 +1728,12 @@ static ssize_t eeh_force_recover_write(struct file *filp,
|
||||
struct pci_controller *hose;
|
||||
uint32_t phbid, pe_no;
|
||||
struct eeh_pe *pe;
|
||||
char buf[20];
|
||||
char buf[20] = {};
|
||||
int ret;
|
||||
|
||||
ret = simple_write_to_buffer(buf, sizeof(buf), ppos, user_buf, count);
|
||||
ret = simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, user_buf, count);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
if (!ret)
|
||||
return -EFAULT;
|
||||
|
||||
|
||||
@@ -41,6 +41,9 @@ static unsigned int count_relocs(const Elf32_Rela *rela, unsigned int num)
|
||||
|
||||
#ifdef CONFIG_DYNAMIC_FTRACE
|
||||
_count_relocs++; /* add one for ftrace_caller */
|
||||
#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
|
||||
_count_relocs++; /* add one for ftrace_regs_caller */
|
||||
#endif
|
||||
#endif
|
||||
return _count_relocs;
|
||||
}
|
||||
|
||||
@@ -824,6 +824,8 @@ static int parse_thread_groups(struct device_node *dn,
|
||||
int i = 0;
|
||||
|
||||
count = of_property_count_u32_elems(dn, "ibm,thread-groups");
|
||||
if (count < 0)
|
||||
return count;
|
||||
thread_group_array = kzalloc_objs(u32, count);
|
||||
if (!thread_group_array)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -487,6 +487,9 @@ static void start_watchdog(void *arg)
|
||||
if (!(watchdog_enabled & WATCHDOG_HARDLOCKUP_ENABLED))
|
||||
return;
|
||||
|
||||
if (!watchdog_thresh)
|
||||
return;
|
||||
|
||||
if (!cpumask_test_cpu(cpu, &watchdog_cpumask))
|
||||
return;
|
||||
|
||||
|
||||
@@ -47,6 +47,9 @@
|
||||
static long kvmppc_virtmode_do_h_enter(struct kvm *kvm, unsigned long flags,
|
||||
long pte_index, unsigned long pteh,
|
||||
unsigned long ptel, unsigned long *pte_idx_ret);
|
||||
static void kvmppc_virtmode_do_h_remove(struct kvm *kvm, unsigned long flags,
|
||||
unsigned long pte_index, unsigned long avpn,
|
||||
unsigned long *hpret);
|
||||
|
||||
struct kvm_resize_hpt {
|
||||
/* These fields read-only after init */
|
||||
@@ -308,6 +311,22 @@ static long kvmppc_virtmode_do_h_enter(struct kvm *kvm, unsigned long flags,
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Virtual-mode H_REMOVE. kvmppc_do_h_remove() is also called from real mode,
|
||||
* where preempt_disable() is not usable, so the guard stays here. The function
|
||||
* spins on HPTE_V_HVLOCK and then lock_rmap() (via remove_revmap_chain());
|
||||
* preemption must be disabled across both bit-locks so that spinning callers
|
||||
* holding preempt_disable() can make forward progress.
|
||||
*/
|
||||
static void kvmppc_virtmode_do_h_remove(struct kvm *kvm, unsigned long flags,
|
||||
unsigned long pte_index, unsigned long avpn,
|
||||
unsigned long *hpret)
|
||||
{
|
||||
preempt_disable();
|
||||
kvmppc_do_h_remove(kvm, flags, pte_index, avpn, hpret);
|
||||
preempt_enable();
|
||||
}
|
||||
|
||||
static struct kvmppc_slb *kvmppc_mmu_book3s_hv_find_slbe(struct kvm_vcpu *vcpu,
|
||||
gva_t eaddr)
|
||||
{
|
||||
@@ -810,9 +829,11 @@ static void kvm_unmap_rmapp(struct kvm *kvm, struct kvm_memory_slot *memslot,
|
||||
|
||||
rmapp = &memslot->arch.rmap[gfn - memslot->base_gfn];
|
||||
for (;;) {
|
||||
preempt_disable();
|
||||
lock_rmap(rmapp);
|
||||
if (!(*rmapp & KVMPPC_RMAP_PRESENT)) {
|
||||
unlock_rmap(rmapp);
|
||||
preempt_enable();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -826,6 +847,7 @@ static void kvm_unmap_rmapp(struct kvm *kvm, struct kvm_memory_slot *memslot,
|
||||
if (!try_lock_hpte(hptep, HPTE_V_HVLOCK)) {
|
||||
/* unlock rmap before spinning on the HPTE lock */
|
||||
unlock_rmap(rmapp);
|
||||
preempt_enable();
|
||||
while (be64_to_cpu(hptep[0]) & HPTE_V_HVLOCK)
|
||||
cpu_relax();
|
||||
continue;
|
||||
@@ -834,6 +856,7 @@ static void kvm_unmap_rmapp(struct kvm *kvm, struct kvm_memory_slot *memslot,
|
||||
kvmppc_unmap_hpte(kvm, i, memslot, rmapp, gfn);
|
||||
unlock_rmap(rmapp);
|
||||
__unlock_hpte(hptep, be64_to_cpu(hptep[0]));
|
||||
preempt_enable();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -890,6 +913,7 @@ static bool kvm_age_rmapp(struct kvm *kvm, struct kvm_memory_slot *memslot,
|
||||
|
||||
rmapp = &memslot->arch.rmap[gfn - memslot->base_gfn];
|
||||
retry:
|
||||
preempt_disable();
|
||||
lock_rmap(rmapp);
|
||||
if (*rmapp & KVMPPC_RMAP_REFERENCED) {
|
||||
*rmapp &= ~KVMPPC_RMAP_REFERENCED;
|
||||
@@ -897,6 +921,7 @@ static bool kvm_age_rmapp(struct kvm *kvm, struct kvm_memory_slot *memslot,
|
||||
}
|
||||
if (!(*rmapp & KVMPPC_RMAP_PRESENT)) {
|
||||
unlock_rmap(rmapp);
|
||||
preempt_enable();
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -912,6 +937,7 @@ static bool kvm_age_rmapp(struct kvm *kvm, struct kvm_memory_slot *memslot,
|
||||
if (!try_lock_hpte(hptep, HPTE_V_HVLOCK)) {
|
||||
/* unlock rmap before spinning on the HPTE lock */
|
||||
unlock_rmap(rmapp);
|
||||
preempt_enable();
|
||||
while (be64_to_cpu(hptep[0]) & HPTE_V_HVLOCK)
|
||||
cpu_relax();
|
||||
goto retry;
|
||||
@@ -931,6 +957,7 @@ static bool kvm_age_rmapp(struct kvm *kvm, struct kvm_memory_slot *memslot,
|
||||
} while ((i = j) != head);
|
||||
|
||||
unlock_rmap(rmapp);
|
||||
preempt_enable();
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1219,6 +1246,7 @@ static unsigned long resize_hpt_rehash_hpte(struct kvm_resize_hpt *resize,
|
||||
if (!(vpte & HPTE_V_VALID) && !(vpte & HPTE_V_ABSENT))
|
||||
return 0; /* nothing to do */
|
||||
|
||||
preempt_disable();
|
||||
while (!try_lock_hpte(hptep, HPTE_V_HVLOCK))
|
||||
cpu_relax();
|
||||
|
||||
@@ -1346,6 +1374,7 @@ static unsigned long resize_hpt_rehash_hpte(struct kvm_resize_hpt *resize,
|
||||
|
||||
out:
|
||||
unlock_hpte(hptep, vpte);
|
||||
preempt_enable();
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1868,7 +1897,7 @@ static ssize_t kvm_htab_write(struct file *file, const char __user *buf,
|
||||
nb += HPTE_SIZE;
|
||||
|
||||
if (be64_to_cpu(hptp[0]) & (HPTE_V_VALID | HPTE_V_ABSENT))
|
||||
kvmppc_do_h_remove(kvm, 0, i, 0, tmp);
|
||||
kvmppc_virtmode_do_h_remove(kvm, 0, i, 0, tmp);
|
||||
err = -EIO;
|
||||
ret = kvmppc_virtmode_do_h_enter(kvm, H_EXACT, i, v, r,
|
||||
tmp);
|
||||
@@ -1897,7 +1926,7 @@ static ssize_t kvm_htab_write(struct file *file, const char __user *buf,
|
||||
|
||||
for (j = 0; j < hdr.n_invalid; ++j) {
|
||||
if (be64_to_cpu(hptp[0]) & (HPTE_V_VALID | HPTE_V_ABSENT))
|
||||
kvmppc_do_h_remove(kvm, 0, i, 0, tmp);
|
||||
kvmppc_virtmode_do_h_remove(kvm, 0, i, 0, tmp);
|
||||
++i;
|
||||
hptp += 2;
|
||||
}
|
||||
|
||||
@@ -1388,9 +1388,11 @@ int kvmppc_pseries_do_hcall(struct kvm_vcpu *vcpu)
|
||||
ret = kvmhv_copy_tofrom_guest_nested(vcpu);
|
||||
break;
|
||||
case H_PAGE_INIT:
|
||||
idx = srcu_read_lock(&kvm->srcu);
|
||||
ret = kvmppc_h_page_init(vcpu, kvmppc_get_gpr(vcpu, 4),
|
||||
kvmppc_get_gpr(vcpu, 5),
|
||||
kvmppc_get_gpr(vcpu, 6));
|
||||
srcu_read_unlock(&kvm->srcu, idx);
|
||||
break;
|
||||
case H_SVM_PAGE_IN:
|
||||
ret = H_UNSUPPORTED;
|
||||
@@ -4984,7 +4986,7 @@ int kvmhv_run_single_vcpu(struct kvm_vcpu *vcpu, u64 time_limit,
|
||||
if (!kvmhv_on_pseries() && (__kvmppc_get_msr_hv(vcpu) & MSR_EE))
|
||||
kvmppc_inject_interrupt_hv(vcpu,
|
||||
BOOK3S_INTERRUPT_EXTERNAL, 0);
|
||||
else
|
||||
else if (!kvmppc_xive_enabled(vcpu))
|
||||
lpcr |= LPCR_MER;
|
||||
} else {
|
||||
/*
|
||||
|
||||
@@ -702,20 +702,6 @@ static struct kvm_nested_guest *__find_nested(struct kvm *kvm, int lpid)
|
||||
return idr_find(&kvm->arch.kvm_nested_guest_idr, lpid);
|
||||
}
|
||||
|
||||
static bool __prealloc_nested(struct kvm *kvm, int lpid)
|
||||
{
|
||||
if (idr_alloc(&kvm->arch.kvm_nested_guest_idr,
|
||||
NULL, lpid, lpid + 1, GFP_KERNEL) != lpid)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
static void __add_nested(struct kvm *kvm, int lpid, struct kvm_nested_guest *gp)
|
||||
{
|
||||
if (idr_replace(&kvm->arch.kvm_nested_guest_idr, gp, lpid))
|
||||
WARN_ON(1);
|
||||
}
|
||||
|
||||
static void __remove_nested(struct kvm *kvm, int lpid)
|
||||
{
|
||||
idr_remove(&kvm->arch.kvm_nested_guest_idr, lpid);
|
||||
@@ -862,21 +848,21 @@ struct kvm_nested_guest *kvmhv_get_nested(struct kvm *kvm, int l1_lpid,
|
||||
if (!newgp)
|
||||
return NULL;
|
||||
|
||||
if (!__prealloc_nested(kvm, l1_lpid)) {
|
||||
kvmhv_release_nested(newgp);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
idr_preload(GFP_KERNEL);
|
||||
spin_lock(&kvm->mmu_lock);
|
||||
gp = __find_nested(kvm, l1_lpid);
|
||||
if (!gp) {
|
||||
__add_nested(kvm, l1_lpid, newgp);
|
||||
++newgp->refcnt;
|
||||
gp = newgp;
|
||||
newgp = NULL;
|
||||
if (idr_alloc(&kvm->arch.kvm_nested_guest_idr, newgp,
|
||||
l1_lpid, l1_lpid + 1, GFP_NOWAIT) >= 0) {
|
||||
++newgp->refcnt;
|
||||
gp = newgp;
|
||||
newgp = NULL;
|
||||
}
|
||||
}
|
||||
++gp->refcnt;
|
||||
if (gp)
|
||||
++gp->refcnt;
|
||||
spin_unlock(&kvm->mmu_lock);
|
||||
idr_preload_end();
|
||||
|
||||
if (newgp)
|
||||
kvmhv_release_nested(newgp);
|
||||
|
||||
@@ -1820,7 +1820,8 @@ void kvmppc_xive_cleanup_vcpu(struct kvm_vcpu *vcpu)
|
||||
kvmppc_xive_disable_vcpu_interrupts(vcpu);
|
||||
|
||||
/* Mask the VP IPI */
|
||||
xive_vm_esb_load(&xc->vp_ipi_data, XIVE_ESB_SET_PQ_01);
|
||||
if (xc->vp_ipi_data.eoi_mmio)
|
||||
xive_vm_esb_load(&xc->vp_ipi_data, XIVE_ESB_SET_PQ_01);
|
||||
|
||||
/* Free escalations */
|
||||
for (i = 0; i < KVMPPC_XIVE_Q_COUNT; i++) {
|
||||
@@ -1939,6 +1940,7 @@ int kvmppc_xive_connect_vcpu(struct kvm_device *dev,
|
||||
xc->vp_id = vp_id;
|
||||
xc->mfrr = 0xff;
|
||||
xc->valid = true;
|
||||
vcpu->arch.irq_type = KVMPPC_IRQ_XICS;
|
||||
|
||||
r = xive_native_get_vp_info(xc->vp_id, &xc->vp_cam, &xc->vp_chip_id);
|
||||
if (r)
|
||||
@@ -2027,7 +2029,6 @@ bail:
|
||||
return r;
|
||||
}
|
||||
|
||||
vcpu->arch.irq_type = KVMPPC_IRQ_XICS;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -338,7 +338,7 @@ static int vpa_dtl_mem_alloc(int cpu)
|
||||
if (!dtl_cache)
|
||||
return -ENOMEM;
|
||||
|
||||
buf = kmem_cache_alloc_node(dtl_cache, GFP_KERNEL | GFP_ATOMIC, cpu_to_node(cpu));
|
||||
buf = kmem_cache_alloc_node(dtl_cache, GFP_ATOMIC, cpu_to_node(cpu));
|
||||
if (!buf) {
|
||||
pr_warn("buffer allocation failed for cpu %d\n", cpu);
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -7,6 +7,12 @@ extern void pas_pci_init(void);
|
||||
struct pci_dev;
|
||||
extern void pas_pci_dma_dev_setup(struct pci_dev *dev);
|
||||
|
||||
#ifdef CONFIG_PPC_PASEMI_NEMO
|
||||
void __init nemo_init_IRQ(void);
|
||||
#else
|
||||
static inline void __init nemo_init_IRQ(void) { }
|
||||
#endif
|
||||
|
||||
void __iomem *__init pasemi_pci_getcfgaddr(struct pci_dev *dev, int offset);
|
||||
|
||||
extern void __init pasemi_map_registers(void);
|
||||
|
||||
@@ -265,6 +265,11 @@ static int __init pas_add_bridge(struct device_node *dev)
|
||||
*/
|
||||
isa_bridge_find_early(hose);
|
||||
|
||||
/*
|
||||
* ISA bridge is now active, add the i8259 cascade (if needed)
|
||||
*/
|
||||
nemo_init_IRQ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -216,10 +216,12 @@ static void sb600_8259_cascade(struct irq_desc *desc)
|
||||
chip->irq_eoi(&desc->irq_data);
|
||||
}
|
||||
|
||||
static void __init nemo_init_IRQ(struct mpic *mpic)
|
||||
void __init nemo_init_IRQ(void)
|
||||
{
|
||||
struct device_node *np;
|
||||
int gpio_virq;
|
||||
struct mpic *mpic;
|
||||
|
||||
/* Connect the SB600's legacy i8259 controller */
|
||||
np = of_find_node_by_path("/pxp@0,e0000000");
|
||||
i8259_init(np, 0);
|
||||
@@ -230,14 +232,10 @@ static void __init nemo_init_IRQ(struct mpic *mpic)
|
||||
irq_set_chained_handler(gpio_virq, sb600_8259_cascade);
|
||||
mpic_unmask_irq(irq_get_irq_data(gpio_virq));
|
||||
|
||||
mpic = irq_get_chip_data(gpio_virq);
|
||||
irq_set_default_domain(mpic->irqhost);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static inline void nemo_init_IRQ(struct mpic *mpic)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
static __init void pas_init_IRQ(void)
|
||||
@@ -300,8 +298,6 @@ static __init void pas_init_IRQ(void)
|
||||
mpic_unmask_irq(irq_get_irq_data(nmi_virq));
|
||||
}
|
||||
|
||||
nemo_init_IRQ(mpic);
|
||||
|
||||
of_node_put(mpic_node);
|
||||
of_node_put(root);
|
||||
}
|
||||
|
||||
@@ -179,11 +179,15 @@ else
|
||||
$(error Error: set INSTALL_PATH to use install)
|
||||
endif
|
||||
|
||||
emit_tests:
|
||||
define EMIT_TESTS
|
||||
for TEST in $(TEST_GEN_PROGS) $(TEST_CUSTOM_PROGS) $(TEST_PROGS); do \
|
||||
BASENAME_TEST=`basename $$TEST`; \
|
||||
echo "$(COLLECTION):$$BASENAME_TEST"; \
|
||||
done
|
||||
endef
|
||||
|
||||
emit_tests:
|
||||
+$(EMIT_TESTS)
|
||||
|
||||
# define if isn't already. It is undefined in make O= case.
|
||||
ifeq ($(RM),)
|
||||
|
||||
@@ -56,11 +56,12 @@ override define INSTALL_RULE
|
||||
done;
|
||||
endef
|
||||
|
||||
emit_tests:
|
||||
override define EMIT_TESTS
|
||||
+@for TARGET in $(SUB_DIRS); do \
|
||||
BUILD_TARGET=$(OUTPUT)/$$TARGET; \
|
||||
$(MAKE) OUTPUT=$$BUILD_TARGET COLLECTION=$(COLLECTION)/$$TARGET -s -C $$TARGET $@;\
|
||||
done;
|
||||
endef
|
||||
|
||||
override define CLEAN
|
||||
+@for TARGET in $(SUB_DIRS); do \
|
||||
|
||||
@@ -37,7 +37,7 @@ override define RUN_TESTS
|
||||
done;
|
||||
endef
|
||||
|
||||
emit_tests:
|
||||
override define EMIT_TESTS
|
||||
for TEST in $(TEST_GEN_PROGS); do \
|
||||
BASENAME_TEST=`basename $$TEST`; \
|
||||
echo "$(COLLECTION):$$BASENAME_TEST"; \
|
||||
@@ -46,6 +46,7 @@ emit_tests:
|
||||
BUILD_TARGET=$(OUTPUT)/$$TARGET; \
|
||||
$(MAKE) OUTPUT=$$BUILD_TARGET COLLECTION=$(COLLECTION)/$$TARGET -s -C $$TARGET emit_tests; \
|
||||
done;
|
||||
endef
|
||||
|
||||
DEFAULT_INSTALL_RULE := $(INSTALL_RULE)
|
||||
override define INSTALL_RULE
|
||||
|
||||
Reference in New Issue
Block a user