Skip to content

Commit 50c8ab8

Browse files
Tuan Phanwilldeacon
authored andcommitted
ACPI/IORT: Fix PMCG node single ID mapping handling
An IORT PMCG node can have no ID mapping if its overflow interrupt is wire based therefore the code that parses the PMCG node can not assume the node will always have a single mapping present at index 0. Fix iort_get_id_mapping_index() by checking for an overflow interrupt and mapping count. Fixes: 24e5160 ("ACPI/IORT: Add support for PMCG") Signed-off-by: Tuan Phan <[email protected]> Reviewed-by: Hanjun Guo <[email protected]> Acked-by: Lorenzo Pieralisi <[email protected]> Link: https://lore.kernel.org/r/1589994787-28637-1-git-send-email-tuanphan@os.amperecomputing.com Signed-off-by: Will Deacon <[email protected]>
1 parent 701dafe commit 50c8ab8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/acpi/arm64/iort.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,7 @@ static struct acpi_iort_node *iort_node_get_id(struct acpi_iort_node *node,
388388
static int iort_get_id_mapping_index(struct acpi_iort_node *node)
389389
{
390390
struct acpi_iort_smmu_v3 *smmu;
391+
struct acpi_iort_pmcg *pmcg;
391392

392393
switch (node->type) {
393394
case ACPI_IORT_NODE_SMMU_V3:
@@ -415,6 +416,10 @@ static int iort_get_id_mapping_index(struct acpi_iort_node *node)
415416

416417
return smmu->id_mapping_index;
417418
case ACPI_IORT_NODE_PMCG:
419+
pmcg = (struct acpi_iort_pmcg *)node->node_data;
420+
if (pmcg->overflow_gsiv || node->mapping_count == 0)
421+
return -EINVAL;
422+
418423
return 0;
419424
default:
420425
return -EINVAL;

0 commit comments

Comments
 (0)