Skip to content

Commit aec7d25

Browse files
committed
platform/x86: p2sb: On Goldmont only cache P2SB and SPI devfn BAR
On Goldmont p2sb_bar() only ever gets called for 2 devices, the actual P2SB devfn 13,0 and the SPI controller which is part of the P2SB, devfn 13,2. But the current p2sb code tries to cache BAR0 info for all of devfn 13,0 to 13,7 . This involves calling pci_scan_single_device() for device 13 functions 0-7 and the hw does not seem to like pci_scan_single_device() getting called for some of the other hidden devices. E.g. on an ASUS VivoBook D540NV-GQ065T this leads to continuous ACPI errors leading to high CPU usage. Fix this by only caching BAR0 info and thus only calling pci_scan_single_device() for the P2SB and the SPI controller. Fixes: 5913320 ("platform/x86: p2sb: Allow p2sb_bar() calls during PCI device probe") Reported-by: Danil Rybakov <[email protected]> Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218531 Tested-by: Danil Rybakov <[email protected]> Signed-off-by: Hans de Goede <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 427c70d commit aec7d25

File tree

1 file changed

+9
-16
lines changed

1 file changed

+9
-16
lines changed

drivers/platform/x86/p2sb.c

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,11 @@
2020
#define P2SBC_HIDE BIT(8)
2121

2222
#define P2SB_DEVFN_DEFAULT PCI_DEVFN(31, 1)
23+
#define P2SB_DEVFN_GOLDMONT PCI_DEVFN(13, 0)
24+
#define SPI_DEVFN_GOLDMONT PCI_DEVFN(13, 2)
2325

2426
static const struct x86_cpu_id p2sb_cpu_ids[] = {
25-
X86_MATCH_INTEL_FAM6_MODEL(ATOM_GOLDMONT, PCI_DEVFN(13, 0)),
27+
X86_MATCH_INTEL_FAM6_MODEL(ATOM_GOLDMONT, P2SB_DEVFN_GOLDMONT),
2628
{}
2729
};
2830

@@ -98,21 +100,12 @@ static void p2sb_scan_and_cache_devfn(struct pci_bus *bus, unsigned int devfn)
98100

99101
static int p2sb_scan_and_cache(struct pci_bus *bus, unsigned int devfn)
100102
{
101-
unsigned int slot, fn;
102-
103-
if (PCI_FUNC(devfn) == 0) {
104-
/*
105-
* When function number of the P2SB device is zero, scan it and
106-
* other function numbers, and if devices are available, cache
107-
* their BAR0s.
108-
*/
109-
slot = PCI_SLOT(devfn);
110-
for (fn = 0; fn < NR_P2SB_RES_CACHE; fn++)
111-
p2sb_scan_and_cache_devfn(bus, PCI_DEVFN(slot, fn));
112-
} else {
113-
/* Scan the P2SB device and cache its BAR0 */
114-
p2sb_scan_and_cache_devfn(bus, devfn);
115-
}
103+
/* Scan the P2SB device and cache its BAR0 */
104+
p2sb_scan_and_cache_devfn(bus, devfn);
105+
106+
/* On Goldmont p2sb_bar() also gets called for the SPI controller */
107+
if (devfn == P2SB_DEVFN_GOLDMONT)
108+
p2sb_scan_and_cache_devfn(bus, SPI_DEVFN_GOLDMONT);
116109

117110
if (!p2sb_valid_resource(&p2sb_resources[PCI_FUNC(devfn)].res))
118111
return -ENOENT;

0 commit comments

Comments
 (0)