Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1297012 > unrolled thread

[PATCH 3/6] iommu/amd: Introduce amd_iommu_get_num_iommus()

Started bySuravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
First post2015-12-22 20:40 +0100
Last post2015-12-29 22:30 +0100
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 3/6] iommu/amd: Introduce amd_iommu_get_num_iommus() Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com> - 2015-12-22 20:40 +0100
    Re: [PATCH 3/6] iommu/amd: Introduce amd_iommu_get_num_iommus() Joerg Roedel <joro@8bytes.org> - 2015-12-28 16:50 +0100
      Re: [PATCH 3/6] iommu/amd: Introduce amd_iommu_get_num_iommus() Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com> - 2015-12-29 22:30 +0100

#1297012 — [PATCH 3/6] iommu/amd: Introduce amd_iommu_get_num_iommus()

FromSuravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Date2015-12-22 20:40 +0100
Subject[PATCH 3/6] iommu/amd: Introduce amd_iommu_get_num_iommus()
Message-ID<qIAWR-86s-9@gated-at.bofh.it>
This patch introduces amd_iommu_get_num_iommus(). Initially, this is
intended to be used by Perf AMD IOMMU driver.

Signed-off-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
---
 drivers/iommu/amd_iommu_init.c            | 16 ++++++++++++++++
 include/linux/perf/perf_event_amd_iommu.h |  2 ++
 2 files changed, 18 insertions(+)

diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c
index 275c0f5..9c62613 100644
--- a/drivers/iommu/amd_iommu_init.c
+++ b/drivers/iommu/amd_iommu_init.c
@@ -2244,6 +2244,22 @@ bool amd_iommu_v2_supported(void)
 }
 EXPORT_SYMBOL(amd_iommu_v2_supported);
 
+static int amd_iommu_cnt;
+
+int amd_iommu_get_num_iommus(void)
+{
+	struct amd_iommu *iommu;
+
+	if (amd_iommu_cnt)
+		return amd_iommu_cnt;
+
+	for_each_iommu(iommu)
+		amd_iommu_cnt++;
+
+	return amd_iommu_cnt;
+}
+EXPORT_SYMBOL(amd_iommu_get_num_iommus);
+
 /****************************************************************************
  *
  * IOMMU EFR Performance Counter support functionality. This code allows
diff --git a/include/linux/perf/perf_event_amd_iommu.h b/include/linux/perf/perf_event_amd_iommu.h
index 815eabb..cb820c2 100644
--- a/include/linux/perf/perf_event_amd_iommu.h
+++ b/include/linux/perf/perf_event_amd_iommu.h
@@ -25,6 +25,8 @@
 #define PC_MAX_SPEC_CNTRS			16
 
 /* amd_iommu_init.c external support functions */
+extern int amd_iommu_get_num_iommus(void);
+
 extern bool amd_iommu_pc_supported(void);
 
 extern u8 amd_iommu_pc_get_max_banks(void);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1298689

FromJoerg Roedel <joro@8bytes.org>
Date2015-12-28 16:50 +0100
Message-ID<qKIdB-43M-31@gated-at.bofh.it>
In reply to#1297012
On Tue, Dec 22, 2015 at 01:19:14PM -0600, Suthikulpanit, Suravee wrote:
> This patch introduces amd_iommu_get_num_iommus(). Initially, this is
> intended to be used by Perf AMD IOMMU driver.
> 
> Signed-off-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
> ---
>  drivers/iommu/amd_iommu_init.c            | 16 ++++++++++++++++
>  include/linux/perf/perf_event_amd_iommu.h |  2 ++
>  2 files changed, 18 insertions(+)
> 
> diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c
> index 275c0f5..9c62613 100644
> --- a/drivers/iommu/amd_iommu_init.c
> +++ b/drivers/iommu/amd_iommu_init.c
> @@ -2244,6 +2244,22 @@ bool amd_iommu_v2_supported(void)
>  }
>  EXPORT_SYMBOL(amd_iommu_v2_supported);
>  
> +static int amd_iommu_cnt;
> +
> +int amd_iommu_get_num_iommus(void)
> +{
> +	struct amd_iommu *iommu;
> +
> +	if (amd_iommu_cnt)
> +		return amd_iommu_cnt;
> +
> +	for_each_iommu(iommu)
> +		amd_iommu_cnt++;

It is better to set amd_iommu_cnt during IOMMU initialization. You can
just increment this value after an IOMMU has been set up.



	Joerg

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1299144

FromSuravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
Date2015-12-29 22:30 +0100
Message-ID<qLa0a-5S6-11@gated-at.bofh.it>
In reply to#1298689
Hi Jorge,

On 12/28/15 09:43, Joerg Roedel wrote:
> On Tue, Dec 22, 2015 at 01:19:14PM -0600, Suthikulpanit, Suravee wrote:
>> This patch introduces amd_iommu_get_num_iommus(). Initially, this is
>> intended to be used by Perf AMD IOMMU driver.
>>
>> Signed-off-by: Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>
>> ---
>>   drivers/iommu/amd_iommu_init.c            | 16 ++++++++++++++++
>>   include/linux/perf/perf_event_amd_iommu.h |  2 ++
>>   2 files changed, 18 insertions(+)
>>
>> diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c
>> index 275c0f5..9c62613 100644
>> --- a/drivers/iommu/amd_iommu_init.c
>> +++ b/drivers/iommu/amd_iommu_init.c
>> @@ -2244,6 +2244,22 @@ bool amd_iommu_v2_supported(void)
>>   }
>>   EXPORT_SYMBOL(amd_iommu_v2_supported);
>>
>> +static int amd_iommu_cnt;
>> +
>> +int amd_iommu_get_num_iommus(void)
>> +{
>> +	struct amd_iommu *iommu;
>> +
>> +	if (amd_iommu_cnt)
>> +		return amd_iommu_cnt;
>> +
>> +	for_each_iommu(iommu)
>> +		amd_iommu_cnt++;
>
> It is better to set amd_iommu_cnt during IOMMU initialization. You can
> just increment this value after an IOMMU has been set up.
>
>
>
> 	Joerg
>

Sure. I'll take care of this in V2.

Thanks,
Suravee
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web