diff mbox

iommu/fsl_pamu: use physical cpu index to find the matched cpu nodes

Message ID 1384457440.2144.15.camel@haiying-laptop (mailing list archive)
State Not Applicable
Delegated to: Scott Wood
Headers show

Commit Message

Haiying Wang Nov. 14, 2013, 7:30 p.m. UTC
In the case we miss to bring up some cpus, we need to make sure we can
find the correct cpu nodes in the device tree based on the given logical
cpu index from the caller.

Signed-off-by: Haiying Wang <Haiying.Wang@freescale.com>
---
 drivers/iommu/fsl_pamu.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

Comments

Scott Wood Nov. 14, 2013, 10:10 p.m. UTC | #1
On Thu, 2013-11-14 at 14:30 -0500, Haiying Wang wrote:
> In the case we miss to bring up some cpus, we need to make sure we can
> find the correct cpu nodes in the device tree based on the given logical
> cpu index from the caller.
> 
> Signed-off-by: Haiying Wang <Haiying.Wang@freescale.com>
> ---
>  drivers/iommu/fsl_pamu.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/iommu/fsl_pamu.c b/drivers/iommu/fsl_pamu.c
> index cba0498..a9ab57b 100644
> --- a/drivers/iommu/fsl_pamu.c
> +++ b/drivers/iommu/fsl_pamu.c
> @@ -539,6 +539,7 @@ u32 get_stash_id(u32 stash_dest_hint, u32 vcpu)

Should probably also s/vcpu/cpu/g as vcpu makes no sense outside of
virtualization code.

>  	u32 cache_level;
>  	int len, found = 0;
>  	int i;
> +	u32 cpuid = get_hard_smp_processor_id(vcpu);

s/cpuid/phys_cpu/ or similar

-Scott
Varun Sethi Nov. 15, 2013, 3:16 a.m. UTC | #2
Haiying/Scott,
Forgot to mention this, the PAMU driver has to handle stash destination settings both for power and dsp cores (on B4 platform). For the dsp cores we would expect the physical core id (not controlled by Linux). To make the interface consistent, I would expect the caller (for iommu_set_attr) to pass the physical core id.

Regards
Varun

> -----Original Message-----
> From: Wood Scott-B07421
> Sent: Friday, November 15, 2013 3:40 AM
> To: Wang Haiying-R54964
> Cc: joro@8bytes.org; iommu@lists.linux-foundation.org; linuxppc-
> dev@lists.ozlabs.org; Sethi Varun-B16395
> Subject: Re: [PATCH] iommu/fsl_pamu: use physical cpu index to find the
> matched cpu nodes
> 
> On Thu, 2013-11-14 at 14:30 -0500, Haiying Wang wrote:
> > In the case we miss to bring up some cpus, we need to make sure we can
> > find the correct cpu nodes in the device tree based on the given
> > logical cpu index from the caller.
> >
> > Signed-off-by: Haiying Wang <Haiying.Wang@freescale.com>
> > ---
> >  drivers/iommu/fsl_pamu.c |    3 ++-
> >  1 files changed, 2 insertions(+), 1 deletions(-)
> >
> > diff --git a/drivers/iommu/fsl_pamu.c b/drivers/iommu/fsl_pamu.c index
> > cba0498..a9ab57b 100644
> > --- a/drivers/iommu/fsl_pamu.c
> > +++ b/drivers/iommu/fsl_pamu.c
> > @@ -539,6 +539,7 @@ u32 get_stash_id(u32 stash_dest_hint, u32 vcpu)
> 
> Should probably also s/vcpu/cpu/g as vcpu makes no sense outside of
> virtualization code.
> 
> >  	u32 cache_level;
> >  	int len, found = 0;
> >  	int i;
> > +	u32 cpuid = get_hard_smp_processor_id(vcpu);
> 
> s/cpuid/phys_cpu/ or similar
> 
> -Scott
>
Scott Wood Nov. 18, 2013, 7:37 p.m. UTC | #3
On Thu, 2013-11-14 at 21:16 -0600, Sethi Varun-B16395 wrote:
> Haiying/Scott,
> Forgot to mention this, the PAMU driver has to handle stash destination
> settings both for power and dsp cores (on B4 platform). For the dsp
> cores we would expect the physical core id (not controlled by Linux).
> To make the interface consistent, I would expect the caller (for
> iommu_set_attr) to pass the physical core id.

That sounds like you need two different interfaces.

-Scott
Varun Sethi Nov. 19, 2013, 2:42 a.m. UTC | #4
For the DSP case again we have to set up the stash attribute. Are you saying that this should be a separate attribute? 

-Varun

> -----Original Message-----
> From: Wood Scott-B07421
> Sent: Tuesday, November 19, 2013 1:07 AM
> To: Sethi Varun-B16395
> Cc: Wang Haiying-R54964; joro@8bytes.org; iommu@lists.linux-
> foundation.org; linuxppc-dev@lists.ozlabs.org
> Subject: Re: [PATCH] iommu/fsl_pamu: use physical cpu index to find the
> matched cpu nodes
> 
> On Thu, 2013-11-14 at 21:16 -0600, Sethi Varun-B16395 wrote:
> > Haiying/Scott,
> > Forgot to mention this, the PAMU driver has to handle stash
> > destination settings both for power and dsp cores (on B4 platform).
> > For the dsp cores we would expect the physical core id (not controlled
> by Linux).
> > To make the interface consistent, I would expect the caller (for
> > iommu_set_attr) to pass the physical core id.
> 
> That sounds like you need two different interfaces.
> 
> -Scott
>
Scott Wood Nov. 19, 2013, 3:04 a.m. UTC | #5
On Mon, 2013-11-18 at 20:42 -0600, Varun Sethi wrote:
> For the DSP case again we have to set up the stash attribute. Are you saying that this should be a separate attribute?

Not necessarily a separate attribute, but there should be some way to
distinguish whether you're providing a Linux cpu number or some external
stash destination.

-Scott
Varun Sethi Nov. 19, 2013, 3:09 a.m. UTC | #6
> -----Original Message-----
> From: Wood Scott-B07421
> Sent: Tuesday, November 19, 2013 8:34 AM
> To: Sethi Varun-B16395
> Cc: Wang Haiying-R54964; joro@8bytes.org; iommu@lists.linux-
> foundation.org; linuxppc-dev@lists.ozlabs.org
> Subject: Re: [PATCH] iommu/fsl_pamu: use physical cpu index to find the
> matched cpu nodes
> 
> On Mon, 2013-11-18 at 20:42 -0600, Varun Sethi wrote:
> > For the DSP case again we have to set up the stash attribute. Are you
> saying that this should be a separate attribute?
> 
> Not necessarily a separate attribute, but there should be some way to
> distinguish whether you're providing a Linux cpu number or some external
> stash destination.
Yes, the current idea is to use a separate L2 cache type for the DSP cores (PAMU_DSP_L2_CACHE). DSP cores can stash only to the L2 cache.

-Varun
diff mbox

Patch

diff --git a/drivers/iommu/fsl_pamu.c b/drivers/iommu/fsl_pamu.c
index cba0498..a9ab57b 100644
--- a/drivers/iommu/fsl_pamu.c
+++ b/drivers/iommu/fsl_pamu.c
@@ -539,6 +539,7 @@  u32 get_stash_id(u32 stash_dest_hint, u32 vcpu)
 	u32 cache_level;
 	int len, found = 0;
 	int i;
+	u32 cpuid = get_hard_smp_processor_id(vcpu);
 
 	/* Fastpath, exit early if L3/CPC cache is target for stashing */
 	if (stash_dest_hint == PAMU_ATTR_CACHE_L3) {
@@ -559,7 +560,7 @@  u32 get_stash_id(u32 stash_dest_hint, u32 vcpu)
 	for_each_node_by_type(node, "cpu") {
 		prop = of_get_property(node, "reg", &len);
 		for (i = 0; i < len / sizeof(u32); i++) {
-			if (be32_to_cpup(&prop[i]) == vcpu) {
+			if (be32_to_cpup(&prop[i]) == cpuid) {
 				found = 1;
 				goto found_cpu_node;
 			}