Skip to contentSkip to conversation

ARM: DT/kernel: fix arch_match_cpu_phys_id to avoid erroneous match

PATCH New Sudeep KarkadaNagesha 4 participants 5 messages Oct 21, 2013 – Jan 8, 2014 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: DT/kernel: fix arch_match_cpu_phys_id to avoid erroneous match

From: Sudeep KarkadaNagesha <[email protected]>

The MPIDR contains specific bitfields(MPIDR.Aff{2..0}) which uniquely identify a CPU, in addition to some non-identifying information and reserved bits. The ARM cpu binding defines the 'reg' property to only contain the affinity bits, and any cpu nodes with other bits set in their 'reg' entry are skipped.

As such it is not necessary to mask the phys_id with MPIDR_HWID_BITMASK, and doing so could lead to matching erroneous CPU nodes in the device tree. This patch removes the masking of the physical identifier.

---
 arch/arm/kernel/devtree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/kernel/devtree.c +1 -1
index f35906b..41960fb 100644
@@ -171,7 +171,7 @@ void __init arm_dt_init_cpu_maps(void)
 
 bool arch_match_cpu_phys_id(int cpu, u64 phys_id)
 {
-	return (phys_id & MPIDR_HWID_BITMASK) == cpu_logical_map(cpu);
+	return phys_id == cpu_logical_map(cpu);
 }
 
 /**
Signature · 1 line
1.8.1.2
#1 lore raw

PATCH 1/1 ARM: DT/kernel: fix arch_match_cpu_phys_id to avoid erroneous match

Hi,

I was just looking in devtree.c and I noticed this seems to have fallen by the wayside. Given that this fixes a possible bug and there have been no negative comments, I think it's good for mainline.

Could you place this in the patch system, assuming Russell has no comments?

Cheers,
Mark.

Quoted 35 lines · Sudeep KarkadaNagesha

From: Sudeep KarkadaNagesha <[email protected]>

The MPIDR contains specific bitfields(MPIDR.Aff{2..0}) which uniquely identify a CPU, in addition to some non-identifying information and reserved bits. The ARM cpu binding defines the 'reg' property to only contain the affinity bits, and any cpu nodes with other bits set in their 'reg' entry are skipped.

As such it is not necessary to mask the phys_id with MPIDR_HWID_BITMASK, and doing so could lead to matching erroneous CPU nodes in the device tree. This patch removes the masking of the physical identifier.

---
 arch/arm/kernel/devtree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/kernel/devtree.c +1 -1
index f35906b..41960fb 100644
@@ -171,7 +171,7 @@ void __init arm_dt_init_cpu_maps(void)
 
 bool arch_match_cpu_phys_id(int cpu, u64 phys_id)
 {
-	return (phys_id & MPIDR_HWID_BITMASK) == cpu_logical_map(cpu);
+	return phys_id == cpu_logical_map(cpu);
 }
 
 /**
Signature · 1 line
1.8.1.2
#2 lore raw

PATCH 1/1 ARM: DT/kernel: fix arch_match_cpu_phys_id to avoid erroneous match

Hi Russell,

Quoted 9 lines · Mark Rutland

Hi,

I was just looking in devtree.c and I noticed this seems to have fallen by the wayside. Given that this fixes a possible bug and there have been no negative comments, I think it's good for mainline.

Could you place this in the patch system, assuming Russell has no comments?

Can I put this in patch tracker if you have no objections ?

Regards,
Sudeep

Quoted 39 lines

Cheers,
Mark.

Quoted 35 lines · Sudeep KarkadaNagesha

From: Sudeep KarkadaNagesha <[email protected]>

The MPIDR contains specific bitfields(MPIDR.Aff{2..0}) which uniquely identify a CPU, in addition to some non-identifying information and reserved bits. The ARM cpu binding defines the 'reg' property to only contain the affinity bits, and any cpu nodes with other bits set in their 'reg' entry are skipped.

As such it is not necessary to mask the phys_id with MPIDR_HWID_BITMASK, and doing so could lead to matching erroneous CPU nodes in the device tree. This patch removes the masking of the physical identifier.

---
 arch/arm/kernel/devtree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/kernel/devtree.c +1 -1
index f35906b..41960fb 100644
@@ -171,7 +171,7 @@ void __init arm_dt_init_cpu_maps(void)
 
 bool arch_match_cpu_phys_id(int cpu, u64 phys_id)
 {
-	return (phys_id & MPIDR_HWID_BITMASK) == cpu_logical_map(cpu);
+	return phys_id == cpu_logical_map(cpu);
 }
 
 /**
Signature · 1 line
1.8.1.2
#3 lore raw

PATCH 1/1 ARM: DT/kernel: fix arch_match_cpu_phys_id to avoid erroneous match

Quoted 9 lines · Sudeep Holla

Hi Russell,

Quoted 6 lines · Mark Rutland

Hi,

I was just looking in devtree.c and I noticed this seems to have fallen by the wayside. Given that this fixes a possible bug and there have been no negative comments, I think it's good for mainline.

Quoted 5 lines
Quoted 3 lines

Could you place this in the patch system, assuming Russell has no comments?

Can I put this in patch tracker if you have no objections ?

Yes please.

Signature · 3 lines
FTTC broadband for 0.8mile line: 5.8Mbps down 500kbps up.  Estimation
in database were 13.1 to 19Mbit for a good line, about 7.5+ for a bad.
Estimate before purchase was "up to 13.2Mbit".
#4 lore raw

PATCH 1/1 ARM: DT/kernel: fix arch_match_cpu_phys_id to avoid erroneous match

Quoted 10 lines · Russell King - ARM Linux
Quoted 9 lines · Sudeep Holla

Hi Russell,

Quoted 6 lines · Mark Rutland

Hi,

I was just looking in devtree.c and I noticed this seems to have fallen by the wayside. Given that this fixes a possible bug and there have been no negative comments, I think it's good for mainline.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

Could you place this in the patch system, assuming Russell has no comments?

Can I put this in patch tracker if you have no objections ?

Yes please.

Thanks and it's done(7934/1).

Regards,
Sudeep