Skip to content

Commit 127ec4c

Browse files
committed
Merge tag 'platform-drivers-x86-v6.8-4' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86
Pull x86 platform driver fixes from Hans de Goede: - Fix P2SB regression causing ACPI errors and high CPU load - Fix error return path in amd_pmf_init_smart_pc() * tag 'platform-drivers-x86-v6.8-4' of git://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86: platform/x86/amd/pmf: Fix missing error code in amd_pmf_init_smart_pc() platform/x86: p2sb: On Goldmont only cache P2SB and SPI devfn BAR
2 parents 1c46d04 + 0314ceb commit 127ec4c

File tree

2 files changed

+12
-17
lines changed

2 files changed

+12
-17
lines changed

drivers/platform/x86/amd/pmf/tee-if.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -458,8 +458,10 @@ int amd_pmf_init_smart_pc(struct amd_pmf_dev *dev)
458458
amd_pmf_hex_dump_pb(dev);
459459

460460
dev->prev_data = kzalloc(sizeof(*dev->prev_data), GFP_KERNEL);
461-
if (!dev->prev_data)
461+
if (!dev->prev_data) {
462+
ret = -ENOMEM;
462463
goto error;
464+
}
463465

464466
ret = amd_pmf_start_policy_engine(dev);
465467
if (ret)

drivers/platform/x86/p2sb.c

+9-16
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)