Skip to content

Commit da5fb9e

Browse files
rmurphy-armctmarinas
authored andcommitted
ACPI/IORT: Check node revision for PMCG resources
The original version of the IORT PMCG definition had an oversight wherein there was no way to describe the second register page for an implementation using the recommended RELOC_CTRS feature. Although the spec was fixed, and the final patches merged to ACPICA and Linux written against the new version, it seems that some old firmware based on the original revision has survived and turned up in the wild. Add a check for the original PMCG definition, and avoid filling in the second memory resource with nonsense if so. Otherwise it is likely that something horrible will happen when the PMCG driver attempts to probe. Reported-by: Michael Petlan <[email protected]> Fixes: 24e5160 ("ACPI/IORT: Add support for PMCG") Cc: <[email protected]> # 5.2.x Signed-off-by: Robin Murphy <[email protected]> Acked-by: Lorenzo Pieralisi <[email protected]> Link: https://lore.kernel.org/r/75628ae41c257fb73588f7bf1c4459160e04be2b.1643916258.git.robin.murphy@arm.com Signed-off-by: Catalin Marinas <[email protected]>
1 parent a4b92ce commit da5fb9e

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

drivers/acpi/arm64/iort.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1361,9 +1361,17 @@ static void __init arm_smmu_v3_pmcg_init_resources(struct resource *res,
13611361
res[0].start = pmcg->page0_base_address;
13621362
res[0].end = pmcg->page0_base_address + SZ_4K - 1;
13631363
res[0].flags = IORESOURCE_MEM;
1364-
res[1].start = pmcg->page1_base_address;
1365-
res[1].end = pmcg->page1_base_address + SZ_4K - 1;
1366-
res[1].flags = IORESOURCE_MEM;
1364+
/*
1365+
* The initial version in DEN0049C lacked a way to describe register
1366+
* page 1, which makes it broken for most PMCG implementations; in
1367+
* that case, just let the driver fail gracefully if it expects to
1368+
* find a second memory resource.
1369+
*/
1370+
if (node->revision > 0) {
1371+
res[1].start = pmcg->page1_base_address;
1372+
res[1].end = pmcg->page1_base_address + SZ_4K - 1;
1373+
res[1].flags = IORESOURCE_MEM;
1374+
}
13671375

13681376
if (pmcg->overflow_gsiv)
13691377
acpi_iort_register_irq(pmcg->overflow_gsiv, "overflow",

0 commit comments

Comments
 (0)