From a2f9f6bbb30e60ee9f9f83cede960123a65876a2 Mon Sep 17 00:00:00 2001
From: "David S. Miller" <davem@hutch.davemloft.net>
Date: Mon, 4 Jun 2007 21:48:33 -0700
Subject: [PATCH] [SPARC64]: Fix {mc,smt}_capable().

It's not just sun4v hypervisor platforms that should return true
for this, sun4u with UltraSPARC-IV should return true too.

Signed-off-by: David S. Miller <davem@davemloft.net>
---
 arch/sparc64/kernel/mdesc.c    | 4 ++++
 arch/sparc64/kernel/prom.c     | 3 +++
 arch/sparc64/kernel/smp.c      | 2 ++
 include/asm-sparc64/smp.h      | 1 +
 include/asm-sparc64/topology.h | 6 ++----
 5 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/arch/sparc64/kernel/mdesc.c b/arch/sparc64/kernel/mdesc.c
index 1b5db4bc6b3..f0e16045fb1 100644
--- a/arch/sparc64/kernel/mdesc.c
+++ b/arch/sparc64/kernel/mdesc.c
@@ -624,6 +624,10 @@ static void __init mdesc_fill_in_cpu_data(void)
 		c->proc_id = -1;
 	}
 
+#ifdef CONFIG_SMP
+	sparc64_multi_core = 1;
+#endif
+
 	set_core_ids();
 	set_proc_ids();
 
diff --git a/arch/sparc64/kernel/prom.c b/arch/sparc64/kernel/prom.c
index 172387d1f66..6f4a5284b0e 100644
--- a/arch/sparc64/kernel/prom.c
+++ b/arch/sparc64/kernel/prom.c
@@ -1782,6 +1782,9 @@ static void __init of_fill_in_cpu_data(void)
 
 			cpu_data(cpuid).core_id = portid + 1;
 			cpu_data(cpuid).proc_id = portid;
+#ifdef CONFIG_SMP
+			sparc64_multi_core = 1;
+#endif
 		} else {
 			cpu_data(cpuid).dcache_size =
 				of_getintprop_default(dp, "dcache-size", 16 * 1024);
diff --git a/arch/sparc64/kernel/smp.c b/arch/sparc64/kernel/smp.c
index 68a45ac9337..4dcd7d0b60f 100644
--- a/arch/sparc64/kernel/smp.c
+++ b/arch/sparc64/kernel/smp.c
@@ -44,6 +44,8 @@
 
 extern void calibrate_delay(void);
 
+int sparc64_multi_core __read_mostly;
+
 /* Please don't make this stuff initdata!!!  --DaveM */
 unsigned char boot_cpu_id;
 
diff --git a/include/asm-sparc64/smp.h b/include/asm-sparc64/smp.h
index 54002126868..4fb8c4bfb84 100644
--- a/include/asm-sparc64/smp.h
+++ b/include/asm-sparc64/smp.h
@@ -34,6 +34,7 @@ extern cpumask_t phys_cpu_present_map;
 
 extern cpumask_t cpu_sibling_map[NR_CPUS];
 extern cpumask_t cpu_core_map[NR_CPUS];
+extern int sparc64_multi_core;
 
 /*
  *	General functions that each host system must provide.
diff --git a/include/asm-sparc64/topology.h b/include/asm-sparc64/topology.h
index 4880f7ca0b6..290ac75f385 100644
--- a/include/asm-sparc64/topology.h
+++ b/include/asm-sparc64/topology.h
@@ -2,14 +2,12 @@
 #define _ASM_SPARC64_TOPOLOGY_H
 
 #ifdef CONFIG_SMP
-#include <asm/spitfire.h>
-
 #define topology_physical_package_id(cpu)	(cpu_data(cpu).proc_id)
 #define topology_core_id(cpu)			(cpu_data(cpu).core_id)
 #define topology_core_siblings(cpu)		(cpu_core_map[cpu])
 #define topology_thread_siblings(cpu)		(cpu_sibling_map[cpu])
-#define mc_capable()				(tlb_type == hypervisor)
-#define smt_capable()				(tlb_type == hypervisor)
+#define mc_capable()				(sparc64_multi_core)
+#define smt_capable()				(sparc64_multi_core)
 #endif /* CONFIG_SMP */
 
 #include <asm-generic/topology.h>
-- 
2.41.3