2017-06-06 10:49:00

by Ganapatrao Kulkarni

[permalink] [raw]
Subject: [PATCH v2 0/2] acpi/iort, numa: Add numa node mapping for smmuv3 devices

ARM IORT specification(rev. C) has added provision to define proximity
domain in SMMUv3 IORT table. Adding required code to parse Proximity
domain and set numa_node of smmv3 platform devices.

Signed-off-by: Ganapatrao Kulkarni <[email protected]>

v2:
- Changed as per Lorenzo Pieralisi and Hanjun Guo suggestions.

v1:
- Initial patch

Ganapatrao Kulkarni (2):
acpica: iort: Update SMMUv3 header for proximity domain mapping
acpi/iort, numa: Add numa node mapping for smmuv3 devices

drivers/acpi/arm64/iort.c | 20 ++++++++++++++++++++
include/acpi/actbl2.h | 4 ++++
2 files changed, 24 insertions(+)

--
1.8.1.4


2017-06-06 10:49:18

by Ganapatrao Kulkarni

[permalink] [raw]
Subject: [PATCH v2 1/2] acpica: iort: Update SMMUv3 header for proximity domain mapping

ARM IORT specification (rev. C) has added two new fields to define
proximity domain for the SMMUv3 node in the IORT table.

Proximity Domain Valid:
Set to 1 if the value provided in the Proximity Domain field is
valid. Set to 0 otherwise.

Proximity domain:
If the Proximity Domain Valid flag is set to 1, this entry
provides the proximity domain to which this SMMU
instance belongs.

Update header file to reflect this.

Signed-off-by: Ganapatrao Kulkarni <[email protected]>
---
include/acpi/actbl2.h | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h
index 4b306a6..c16ced8 100644
--- a/include/acpi/actbl2.h
+++ b/include/acpi/actbl2.h
@@ -805,6 +805,9 @@ struct acpi_iort_smmu_v3 {
u32 pri_gsiv;
u32 gerr_gsiv;
u32 sync_gsiv;
+ u8 pxm;
+ u8 reserved1;
+ u16 reserved2;
};

/* Values for Model field above */
@@ -817,6 +820,7 @@ struct acpi_iort_smmu_v3 {

#define ACPI_IORT_SMMU_V3_COHACC_OVERRIDE (1)
#define ACPI_IORT_SMMU_V3_HTTU_OVERRIDE (1<<1)
+#define ACPI_IORT_SMMU_V3_PXM_VALID (1<<3)

/*******************************************************************************
*
--
1.8.1.4

2017-06-06 10:49:23

by Ganapatrao Kulkarni

[permalink] [raw]
Subject: [PATCH v2 2/2] acpi/iort: numa: Add numa node mapping for smmuv3 devices

Add code to parse proximity domain in SMMUv3 IORT table to
set numa node mapping for smmuv3 devices.

Signed-off-by: Ganapatrao Kulkarni <[email protected]>
---
drivers/acpi/arm64/iort.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)

diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c
index bba2b59..b4f328f 100644
--- a/drivers/acpi/arm64/iort.c
+++ b/drivers/acpi/arm64/iort.c
@@ -882,6 +882,23 @@ static bool __init arm_smmu_v3_is_coherent(struct acpi_iort_node *node)
return smmu->flags & ACPI_IORT_SMMU_V3_COHACC_OVERRIDE;
}

+/*
+ * set numa proximity domain for smmv3 device
+ */
+static void __init iort_set_proximity(struct acpi_iort_node *node,
+ struct device *dev)
+{
+ struct acpi_iort_smmu_v3 *smmu;
+
+ smmu = (struct acpi_iort_smmu_v3 *)node->node_data;
+ if (smmu->flags & ACPI_IORT_SMMU_V3_PXM_VALID) {
+ set_dev_node(dev, acpi_map_pxm_to_node(smmu->pxm));
+ pr_info("SMMUV3[%llx] Mapped to Proximity domain %d\n",
+ smmu->base_address,
+ smmu->pxm);
+ }
+}
+
static int __init arm_smmu_count_resources(struct acpi_iort_node *node)
{
struct acpi_iort_smmu *smmu;
@@ -1002,6 +1019,9 @@ static int __init iort_add_smmu_platform_device(struct acpi_iort_node *node)
if (!pdev)
return -ENOMEM;

+ if (node->type == ACPI_IORT_NODE_SMMU_V3)
+ iort_set_proximity(node, &pdev->dev);
+
count = ops->iommu_count_resources(node);

r = kcalloc(count, sizeof(*r), GFP_KERNEL);
--
1.8.1.4

2017-06-07 16:37:30

by Lorenzo Pieralisi

[permalink] [raw]
Subject: Re: [PATCH v2 2/2] acpi/iort: numa: Add numa node mapping for smmuv3 devices

On Tue, Jun 06, 2017 at 04:17:45PM +0530, Ganapatrao Kulkarni wrote:
> Add code to parse proximity domain in SMMUv3 IORT table to
> set numa node mapping for smmuv3 devices.
>
> Signed-off-by: Ganapatrao Kulkarni <[email protected]>
> ---
> drivers/acpi/arm64/iort.c | 20 ++++++++++++++++++++
> 1 file changed, 20 insertions(+)
>
> diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c
> index bba2b59..b4f328f 100644
> --- a/drivers/acpi/arm64/iort.c
> +++ b/drivers/acpi/arm64/iort.c
> @@ -882,6 +882,23 @@ static bool __init arm_smmu_v3_is_coherent(struct acpi_iort_node *node)
> return smmu->flags & ACPI_IORT_SMMU_V3_COHACC_OVERRIDE;
> }
>
> +/*
> + * set numa proximity domain for smmv3 device
> + */
> +static void __init iort_set_proximity(struct acpi_iort_node *node,
> + struct device *dev)
> +{
> + struct acpi_iort_smmu_v3 *smmu;
> +
> + smmu = (struct acpi_iort_smmu_v3 *)node->node_data;
> + if (smmu->flags & ACPI_IORT_SMMU_V3_PXM_VALID) {
> + set_dev_node(dev, acpi_map_pxm_to_node(smmu->pxm));
> + pr_info("SMMUV3[%llx] Mapped to Proximity domain %d\n",
> + smmu->base_address,
> + smmu->pxm);
> + }
> +}
> +
> static int __init arm_smmu_count_resources(struct acpi_iort_node *node)
> {
> struct acpi_iort_smmu *smmu;
> @@ -1002,6 +1019,9 @@ static int __init iort_add_smmu_platform_device(struct acpi_iort_node *node)
> if (!pdev)
> return -ENOMEM;
>
> + if (node->type == ACPI_IORT_NODE_SMMU_V3)
> + iort_set_proximity(node, &pdev->dev);

Nit: while at it you may add an ops hook to set the proximity
(NULL for SMMU v2) and call it if present, it is just to make
the code adding devices more uniform.

Who is queueing these patches ? I am asking to make sure we sort
the ACPICA dependency (there are other IORT/ACPICA patches to consider
too).

Thanks,
Lorenzo

> count = ops->iommu_count_resources(node);
>
> r = kcalloc(count, sizeof(*r), GFP_KERNEL);
> --
> 1.8.1.4
>

2017-06-08 03:27:06

by Ganapatrao Kulkarni

[permalink] [raw]
Subject: Re: [PATCH v2 2/2] acpi/iort: numa: Add numa node mapping for smmuv3 devices

On Wed, Jun 7, 2017 at 10:08 PM, Lorenzo Pieralisi
<[email protected]> wrote:
> On Tue, Jun 06, 2017 at 04:17:45PM +0530, Ganapatrao Kulkarni wrote:
>> Add code to parse proximity domain in SMMUv3 IORT table to
>> set numa node mapping for smmuv3 devices.
>>
>> Signed-off-by: Ganapatrao Kulkarni <[email protected]>
>> ---
>> drivers/acpi/arm64/iort.c | 20 ++++++++++++++++++++
>> 1 file changed, 20 insertions(+)
>>
>> diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c
>> index bba2b59..b4f328f 100644
>> --- a/drivers/acpi/arm64/iort.c
>> +++ b/drivers/acpi/arm64/iort.c
>> @@ -882,6 +882,23 @@ static bool __init arm_smmu_v3_is_coherent(struct acpi_iort_node *node)
>> return smmu->flags & ACPI_IORT_SMMU_V3_COHACC_OVERRIDE;
>> }
>>
>> +/*
>> + * set numa proximity domain for smmv3 device
>> + */
>> +static void __init iort_set_proximity(struct acpi_iort_node *node,
>> + struct device *dev)
>> +{
>> + struct acpi_iort_smmu_v3 *smmu;
>> +
>> + smmu = (struct acpi_iort_smmu_v3 *)node->node_data;
>> + if (smmu->flags & ACPI_IORT_SMMU_V3_PXM_VALID) {
>> + set_dev_node(dev, acpi_map_pxm_to_node(smmu->pxm));
>> + pr_info("SMMUV3[%llx] Mapped to Proximity domain %d\n",
>> + smmu->base_address,
>> + smmu->pxm);
>> + }
>> +}
>> +
>> static int __init arm_smmu_count_resources(struct acpi_iort_node *node)
>> {
>> struct acpi_iort_smmu *smmu;
>> @@ -1002,6 +1019,9 @@ static int __init iort_add_smmu_platform_device(struct acpi_iort_node *node)
>> if (!pdev)
>> return -ENOMEM;
>>
>> + if (node->type == ACPI_IORT_NODE_SMMU_V3)
>> + iort_set_proximity(node, &pdev->dev);
>
> Nit: while at it you may add an ops hook to set the proximity
> (NULL for SMMU v2) and call it if present, it is just to make
> the code adding devices more uniform.

thanks, will do

>
> Who is queueing these patches ? I am asking to make sure we sort
> the ACPICA dependency (there are other IORT/ACPICA patches to consider
> too).
>
> Thanks,
> Lorenzo
>
>> count = ops->iommu_count_resources(node);
>>
>> r = kcalloc(count, sizeof(*r), GFP_KERNEL);
>> --
>> 1.8.1.4
>>

thanks
Ganapat