linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] acpi/iort, numa: Add numa node mapping for smmuv3 devices
@ 2017-06-06 10:47 Ganapatrao Kulkarni
  2017-06-06 10:47 ` [PATCH v2 1/2] acpica: iort: Update SMMUv3 header for proximity domain mapping Ganapatrao Kulkarni
  2017-06-06 10:47 ` [PATCH v2 2/2] acpi/iort: numa: Add numa node mapping for smmuv3 devices Ganapatrao Kulkarni
  0 siblings, 2 replies; 5+ messages in thread
From: Ganapatrao Kulkarni @ 2017-06-06 10:47 UTC (permalink / raw)
  To: linux-arm-kernel

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 <ganapatrao.kulkarni@cavium.com>

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2 1/2] acpica: iort: Update SMMUv3 header for proximity domain mapping
  2017-06-06 10:47 [PATCH v2 0/2] acpi/iort, numa: Add numa node mapping for smmuv3 devices Ganapatrao Kulkarni
@ 2017-06-06 10:47 ` Ganapatrao Kulkarni
  2017-06-06 10:47 ` [PATCH v2 2/2] acpi/iort: numa: Add numa node mapping for smmuv3 devices Ganapatrao Kulkarni
  1 sibling, 0 replies; 5+ messages in thread
From: Ganapatrao Kulkarni @ 2017-06-06 10:47 UTC (permalink / raw)
  To: linux-arm-kernel

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 <ganapatrao.kulkarni@cavium.com>
---
 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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v2 2/2] acpi/iort: numa: Add numa node mapping for smmuv3 devices
  2017-06-06 10:47 [PATCH v2 0/2] acpi/iort, numa: Add numa node mapping for smmuv3 devices Ganapatrao Kulkarni
  2017-06-06 10:47 ` [PATCH v2 1/2] acpica: iort: Update SMMUv3 header for proximity domain mapping Ganapatrao Kulkarni
@ 2017-06-06 10:47 ` Ganapatrao Kulkarni
  2017-06-07 16:38   ` Lorenzo Pieralisi
  1 sibling, 1 reply; 5+ messages in thread
From: Ganapatrao Kulkarni @ 2017-06-06 10:47 UTC (permalink / raw)
  To: linux-arm-kernel

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

Signed-off-by: Ganapatrao Kulkarni <ganapatrao.kulkarni@cavium.com>
---
 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

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v2 2/2] acpi/iort: numa: Add numa node mapping for smmuv3 devices
  2017-06-06 10:47 ` [PATCH v2 2/2] acpi/iort: numa: Add numa node mapping for smmuv3 devices Ganapatrao Kulkarni
@ 2017-06-07 16:38   ` Lorenzo Pieralisi
  2017-06-08  3:27     ` Ganapatrao Kulkarni
  0 siblings, 1 reply; 5+ messages in thread
From: Lorenzo Pieralisi @ 2017-06-07 16:38 UTC (permalink / raw)
  To: linux-arm-kernel

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 <ganapatrao.kulkarni@cavium.com>
> ---
>  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
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2 2/2] acpi/iort: numa: Add numa node mapping for smmuv3 devices
  2017-06-07 16:38   ` Lorenzo Pieralisi
@ 2017-06-08  3:27     ` Ganapatrao Kulkarni
  0 siblings, 0 replies; 5+ messages in thread
From: Ganapatrao Kulkarni @ 2017-06-08  3:27 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Jun 7, 2017 at 10:08 PM, Lorenzo Pieralisi
<lorenzo.pieralisi@arm.com> 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 <ganapatrao.kulkarni@cavium.com>
>> ---
>>  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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-06-08  3:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-06 10:47 [PATCH v2 0/2] acpi/iort, numa: Add numa node mapping for smmuv3 devices Ganapatrao Kulkarni
2017-06-06 10:47 ` [PATCH v2 1/2] acpica: iort: Update SMMUv3 header for proximity domain mapping Ganapatrao Kulkarni
2017-06-06 10:47 ` [PATCH v2 2/2] acpi/iort: numa: Add numa node mapping for smmuv3 devices Ganapatrao Kulkarni
2017-06-07 16:38   ` Lorenzo Pieralisi
2017-06-08  3:27     ` Ganapatrao Kulkarni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).