Skip to content

Commit

Permalink
Merge tag 'powerpc-6.0-3' of git://git.kernel.org/pub/scm/linux/kerne…
Browse files Browse the repository at this point in the history
…l/git/powerpc/linux

Pull powerpc fixes from Michael Ellerman:

 - Fix atomic sleep warnings at boot due to get_phb_number() taking a
   mutex with a spinlock held on some machines.

 - Add missing PMU selftests to .gitignores.

Thanks to Guenter Roeck and Russell Currey.

* tag 'powerpc-6.0-3' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
  selftests/powerpc: Add missing PMU selftests to .gitignores
  powerpc/pci: Fix get_phb_number() locking
  • Loading branch information
Linus Torvalds committed Aug 20, 2022
2 parents f31c32e + f889a2e commit 32dd68f
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 10 deletions.
16 changes: 10 additions & 6 deletions arch/powerpc/kernel/pci-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,6 @@ void __init set_pci_dma_ops(const struct dma_map_ops *dma_ops)
pci_dma_ops = dma_ops;
}

/*
* This function should run under locking protection, specifically
* hose_spinlock.
*/
static int get_phb_number(struct device_node *dn)
{
int ret, phb_id = -1;
Expand Down Expand Up @@ -108,15 +104,20 @@ static int get_phb_number(struct device_node *dn)
if (!ret)
phb_id = (int)(prop & (MAX_PHBS - 1));

spin_lock(&hose_spinlock);

/* We need to be sure to not use the same PHB number twice. */
if ((phb_id >= 0) && !test_and_set_bit(phb_id, phb_bitmap))
return phb_id;
goto out_unlock;

/* If everything fails then fallback to dynamic PHB numbering. */
phb_id = find_first_zero_bit(phb_bitmap, MAX_PHBS);
BUG_ON(phb_id >= MAX_PHBS);
set_bit(phb_id, phb_bitmap);

out_unlock:
spin_unlock(&hose_spinlock);

return phb_id;
}

Expand All @@ -127,10 +128,13 @@ struct pci_controller *pcibios_alloc_controller(struct device_node *dev)
phb = zalloc_maybe_bootmem(sizeof(struct pci_controller), GFP_KERNEL);
if (phb == NULL)
return NULL;
spin_lock(&hose_spinlock);

phb->global_number = get_phb_number(dev);

spin_lock(&hose_spinlock);
list_add_tail(&phb->list_node, &hose_list);
spin_unlock(&hose_spinlock);

phb->dn = dev;
phb->is_dynamic = slab_is_available();
#ifdef CONFIG_PPC64
Expand Down
20 changes: 20 additions & 0 deletions tools/testing/selftests/powerpc/pmu/event_code_tests/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
blacklisted_events_test
event_alternatives_tests_p10
event_alternatives_tests_p9
generic_events_valid_test
group_constraint_cache_test
group_constraint_l2l3_sel_test
group_constraint_mmcra_sample_test
group_constraint_pmc56_test
group_constraint_pmc_count_test
group_constraint_radix_scope_qual_test
group_constraint_repeat_test
group_constraint_thresh_cmp_test
group_constraint_thresh_ctl_test
group_constraint_thresh_sel_test
group_constraint_unit_test
group_pmc56_exclude_constraints_test
hw_cache_event_type_test
invalid_event_code_test
reserved_bits_mmcra_sample_elig_mode_test
reserved_bits_mmcra_thresh_ctl_test
18 changes: 14 additions & 4 deletions tools/testing/selftests/powerpc/pmu/sampling_tests/.gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
mmcr0_exceptionbits_test
bhrb_filter_map_test
bhrb_no_crash_wo_pmu_test
intr_regs_no_crash_wo_pmu_test
mmcr0_cc56run_test
mmcr0_pmccext_test
mmcr0_pmcjce_test
mmcr0_exceptionbits_test
mmcr0_fc56_pmc1ce_test
mmcr0_fc56_pmc56_test
mmcr0_pmccext_test
mmcr0_pmcjce_test
mmcr1_comb_test
mmcr2_l2l3_test
mmcr1_sel_unit_cache_test
mmcr2_fcs_fch_test
mmcr2_l2l3_test
mmcr3_src_test
mmcra_bhrb_any_test
mmcra_bhrb_cond_test
mmcra_bhrb_disable_no_branch_test
mmcra_bhrb_disable_test
mmcra_bhrb_ind_call_test
mmcra_thresh_cmp_test
mmcra_thresh_marked_sample_test

0 comments on commit 32dd68f

Please sign in to comment.