diff mbox series

ACPI/IORT: Fix PMCG node always look for a single ID mapping.

Message ID 1589228576-18053-1-git-send-email-tuanphan@os.amperecomputing.com (mailing list archive)
State New, archived
Headers show
Series ACPI/IORT: Fix PMCG node always look for a single ID mapping. | expand

Commit Message

Tuan Phan May 11, 2020, 8:22 p.m. UTC
PMCG node can have zero ID mapping if its overflow interrupt
is wire based. The code to parse PMCG node can not assume it will
have a single ID mapping.

Signed-off-by: Tuan Phan <tuanphan@os.amperecomputing.com>
---
 drivers/acpi/arm64/iort.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Lorenzo Pieralisi May 12, 2020, 10:40 a.m. UTC | #1
On Mon, May 11, 2020 at 01:22:56PM -0700, Tuan Phan wrote:
> PMCG node can have zero ID mapping if its overflow interrupt
> is wire based. The code to parse PMCG node can not assume it will
> have a single ID mapping.
> 
> Signed-off-by: Tuan Phan <tuanphan@os.amperecomputing.com>
> ---
>  drivers/acpi/arm64/iort.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c
> index ed3d2d1..72444e1 100644
> --- a/drivers/acpi/arm64/iort.c
> +++ b/drivers/acpi/arm64/iort.c
> @@ -441,7 +441,9 @@ static int iort_get_id_mapping_index(struct acpi_iort_node *node)
>  
>  		return smmu->id_mapping_index;
>  	case ACPI_IORT_NODE_PMCG:
> -		return 0;
> +		if (node->mapping_count)
> +			return 0;

Check struct acpi_iort_pmcg->overflow_gsiv to be coherent with SMMUv3
code.

Lorenzo

> +		return -EINVAL;
>  	default:
>  		return -EINVAL;
>  	}
> -- 
> 2.7.4
>
Tuan Phan May 12, 2020, 11:53 p.m. UTC | #2
> On May 12, 2020, at 3:40 AM, Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> wrote:
> 
> On Mon, May 11, 2020 at 01:22:56PM -0700, Tuan Phan wrote:
>> PMCG node can have zero ID mapping if its overflow interrupt
>> is wire based. The code to parse PMCG node can not assume it will
>> have a single ID mapping.
>> 
>> Signed-off-by: Tuan Phan <tuanphan@os.amperecomputing.com>
>> ---
>> drivers/acpi/arm64/iort.c | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>> 
>> diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c
>> index ed3d2d1..72444e1 100644
>> --- a/drivers/acpi/arm64/iort.c
>> +++ b/drivers/acpi/arm64/iort.c
>> @@ -441,7 +441,9 @@ static int iort_get_id_mapping_index(struct acpi_iort_node *node)
>> 
>> 		return smmu->id_mapping_index;
>> 	case ACPI_IORT_NODE_PMCG:
>> -		return 0;
>> +		if (node->mapping_count)
>> +			return 0;
> 
> Check struct acpi_iort_pmcg->overflow_gsiv to be coherent with SMMUv3
> code.
> 
> Lorenzo

Sure, I will fix it.
> 
>> +		return -EINVAL;
>> 	default:
>> 		return -EINVAL;
>> 	}
>> -- 
>> 2.7.4
>>
diff mbox series

Patch

diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c
index ed3d2d1..72444e1 100644
--- a/drivers/acpi/arm64/iort.c
+++ b/drivers/acpi/arm64/iort.c
@@ -441,7 +441,9 @@  static int iort_get_id_mapping_index(struct acpi_iort_node *node)
 
 		return smmu->id_mapping_index;
 	case ACPI_IORT_NODE_PMCG:
-		return 0;
+		if (node->mapping_count)
+			return 0;
+		return -EINVAL;
 	default:
 		return -EINVAL;
 	}