Skip to content

Commit 32dd68f

Browse files
committed
Merge tag 'powerpc-6.0-3' of git://git.kernel.org/pub/scm/linux/kernel/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
2 parents f31c32e + f889a2e commit 32dd68f

File tree

3 files changed

+44
-10
lines changed

3 files changed

+44
-10
lines changed

arch/powerpc/kernel/pci-common.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,6 @@ void __init set_pci_dma_ops(const struct dma_map_ops *dma_ops)
6868
pci_dma_ops = dma_ops;
6969
}
7070

71-
/*
72-
* This function should run under locking protection, specifically
73-
* hose_spinlock.
74-
*/
7571
static int get_phb_number(struct device_node *dn)
7672
{
7773
int ret, phb_id = -1;
@@ -108,15 +104,20 @@ static int get_phb_number(struct device_node *dn)
108104
if (!ret)
109105
phb_id = (int)(prop & (MAX_PHBS - 1));
110106

107+
spin_lock(&hose_spinlock);
108+
111109
/* We need to be sure to not use the same PHB number twice. */
112110
if ((phb_id >= 0) && !test_and_set_bit(phb_id, phb_bitmap))
113-
return phb_id;
111+
goto out_unlock;
114112

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

118+
out_unlock:
119+
spin_unlock(&hose_spinlock);
120+
120121
return phb_id;
121122
}
122123

@@ -127,10 +128,13 @@ struct pci_controller *pcibios_alloc_controller(struct device_node *dev)
127128
phb = zalloc_maybe_bootmem(sizeof(struct pci_controller), GFP_KERNEL);
128129
if (phb == NULL)
129130
return NULL;
130-
spin_lock(&hose_spinlock);
131+
131132
phb->global_number = get_phb_number(dev);
133+
134+
spin_lock(&hose_spinlock);
132135
list_add_tail(&phb->list_node, &hose_list);
133136
spin_unlock(&hose_spinlock);
137+
134138
phb->dn = dev;
135139
phb->is_dynamic = slab_is_available();
136140
#ifdef CONFIG_PPC64
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
blacklisted_events_test
2+
event_alternatives_tests_p10
3+
event_alternatives_tests_p9
4+
generic_events_valid_test
5+
group_constraint_cache_test
6+
group_constraint_l2l3_sel_test
7+
group_constraint_mmcra_sample_test
8+
group_constraint_pmc56_test
9+
group_constraint_pmc_count_test
10+
group_constraint_radix_scope_qual_test
11+
group_constraint_repeat_test
12+
group_constraint_thresh_cmp_test
13+
group_constraint_thresh_ctl_test
14+
group_constraint_thresh_sel_test
15+
group_constraint_unit_test
16+
group_pmc56_exclude_constraints_test
17+
hw_cache_event_type_test
18+
invalid_event_code_test
19+
reserved_bits_mmcra_sample_elig_mode_test
20+
reserved_bits_mmcra_thresh_ctl_test
Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
1-
mmcr0_exceptionbits_test
1+
bhrb_filter_map_test
2+
bhrb_no_crash_wo_pmu_test
3+
intr_regs_no_crash_wo_pmu_test
24
mmcr0_cc56run_test
3-
mmcr0_pmccext_test
4-
mmcr0_pmcjce_test
5+
mmcr0_exceptionbits_test
56
mmcr0_fc56_pmc1ce_test
67
mmcr0_fc56_pmc56_test
8+
mmcr0_pmccext_test
9+
mmcr0_pmcjce_test
710
mmcr1_comb_test
8-
mmcr2_l2l3_test
11+
mmcr1_sel_unit_cache_test
912
mmcr2_fcs_fch_test
13+
mmcr2_l2l3_test
1014
mmcr3_src_test
15+
mmcra_bhrb_any_test
16+
mmcra_bhrb_cond_test
17+
mmcra_bhrb_disable_no_branch_test
18+
mmcra_bhrb_disable_test
19+
mmcra_bhrb_ind_call_test
20+
mmcra_thresh_cmp_test
1121
mmcra_thresh_marked_sample_test

0 commit comments

Comments
 (0)