Skip to contentSkip to conversation

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

PATCH In review Haiying Wang 3 participants 7 messages Nov 14, 2013 – Nov 19, 2013 5 messages not in the archive IOMMU

lore
Share & tools
lore
#0 lore raw

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

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.

---
 drivers/iommu/fsl_pamu.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/iommu/fsl_pamu.c +2 -1
index cba0498..a9ab57b 100644
@@ -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;
 			}
Signature · 1 line
1.7.3.1.50.g1e633
#1 lore raw

drivers/iommu/fsl_pamu.c u32 get_stash_id(u32 stash_dest_hint, u32 vcpu)

Quoted 14 lines · Haiying Wang

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.

---
 drivers/iommu/fsl_pamu.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/iommu/fsl_pamu.c +0 -0
index cba0498..a9ab57b 100644
@@ -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.

drivers/iommu/fsl_pamu.c u32 get_stash_id(u32 stash_dest_hint, u32 vcpu) · line 542

Quoted 4 lines
drivers/iommu/fsl_pamu.c +1 -0
 	u32 cache_level;
 	int len, found = 0;
 	int i;
+	u32 cpuid = get_hard_smp_processor_id(vcpu);

s/cpuid/phys_cpu/ or similar

-Scott

A message that is not in the archive (sent off-list or not yet received): 1384467025.1403.210.camel-88ow+0ZRuxG2UiBs7uKeOtHuzzzSOjJt@public.gmane.org

#3 lore raw

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

Quoted 37 lines

-----Original Message-----
From: Wood Scott-B07421
Sent: Friday, November 15, 2013 3:40 AM
To: Wang Haiying-R54964
Cc: [email protected]; iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org; linuxppc- dev-uLR06cmDAlY/[email protected]; Sethi Varun-B16395
Subject: Re: [PATCH] iommu/fsl_pamu: use physical cpu index to find the
matched cpu nodes

drivers/iommu/fsl_pamu.c u32 get_stash_id(u32 stash_dest_hint, u32 vcpu)

Quoted 14 lines · Haiying Wang

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.

---
 drivers/iommu/fsl_pamu.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/iommu/fsl_pamu.c index renamed from drivers/iommu/fsl_pamu.c +0 -0

cba0498..a9ab57b 100644

drivers/iommu/fsl_pamu.c +0 -0
@@ -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.

drivers/iommu/fsl_pamu.c u32 get_stash_id(u32 stash_dest_hint, u32 vcpu) · line 542

Quoted 4 lines
drivers/iommu/fsl_pamu.c +1 -0
 	u32 cache_level;
 	int len, found = 0;
 	int i;
+	u32 cpuid = get_hard_smp_processor_id(vcpu);

s/cpuid/phys_cpu/ or similar

-Scott

A message that is not in the archive (sent off-list or not yet received): C5ECD7A89D1DC44195F34B25E172658D0A5B0AE8-RL0Hj/+nBVDAtPZc1oz0FK4g8xLGJsHaLnY5E4hWTkheoWH0uzbU5w@public.gmane.org

#5 lore raw
Quoted 6 lines · 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

A message that is not in the archive (sent off-list or not yet received): 1384803449.1403.313.camel-88ow+0ZRuxG2UiBs7uKeOtHuzzzSOjJt@public.gmane.org

#7 lore raw

For the DSP case again we have to set up the stash attribute. Are you saying that this should be a separate attribute?

-Varun

Quoted 22 lines

-----Original Message-----
From: Wood Scott-B07421
Sent: Tuesday, November 19, 2013 1:07 AM
To: Sethi Varun-B16395
Cc: Wang Haiying-R54964; [email protected]; iommu-cunTk1MwBs/[email protected] foundation.org; linuxppc-dev-uLR06cmDAlY/[email protected]
Subject: Re: [PATCH] iommu/fsl_pamu: use physical cpu index to find the
matched cpu nodes

Quoted 4 lines · 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).

Quoted 2 lines

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

A message that is not in the archive (sent off-list or not yet received): C5ECD7A89D1DC44195F34B25E172658D0A5B966D-RL0Hj/+nBVDAtPZc1oz0FK4g8xLGJsHaLnY5E4hWTkheoWH0uzbU5w@public.gmane.org

#9 lore raw
Quoted 1 line · Varun Sethi

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

A message that is not in the archive (sent off-list or not yet received): 1384830256.1403.340.camel-88ow+0ZRuxG2UiBs7uKeOtHuzzzSOjJt@public.gmane.org

#11 lore raw
Quoted 11 lines

-----Original Message-----
From: Wood Scott-B07421
Sent: Tuesday, November 19, 2013 8:34 AM
To: Sethi Varun-B16395
Cc: Wang Haiying-R54964; [email protected]; iommu-cunTk1MwBs/[email protected] foundation.org; linuxppc-dev-uLR06cmDAlY/[email protected]
Subject: Re: [PATCH] iommu/fsl_pamu: use physical cpu index to find the
matched cpu nodes

Quoted 7 lines
Quoted 1 line · Varun Sethi

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