Commit 57cfb814 authored by Michael Ellerman's avatar Michael Ellerman Committed by Paul Mackerras

[PATCH] powerpc: Replace platform_is_lpar() with a firmware feature

It has been decreed that platform numbers are evil, so as a step in that
direction, replace platform_is_lpar() with a FW_FEATURE_LPAR bit.

Currently FW_FEATURE_LPAR really means i/pSeries LPAR, in the future we might
have to clean that up if we need to be more specific about what LPAR actually
means. But that's another patch ...
Signed-off-by: default avatarMichael Ellerman <michael@ellerman.id.au>
Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
parent 3d15910b
...@@ -422,7 +422,7 @@ void __init htab_initialize(void) ...@@ -422,7 +422,7 @@ void __init htab_initialize(void)
htab_hash_mask = pteg_count - 1; htab_hash_mask = pteg_count - 1;
if (platform_is_lpar()) { if (firmware_has_feature(FW_FEATURE_LPAR)) {
/* Using a hypervisor which owns the htab */ /* Using a hypervisor which owns the htab */
htab_address = NULL; htab_address = NULL;
_SDR1 = 0; _SDR1 = 0;
...@@ -517,7 +517,7 @@ void __init htab_initialize(void) ...@@ -517,7 +517,7 @@ void __init htab_initialize(void)
void htab_initialize_secondary(void) void htab_initialize_secondary(void)
{ {
if (!platform_is_lpar()) if (!firmware_has_feature(FW_FEATURE_LPAR))
mtspr(SPRN_SDR1, _SDR1); mtspr(SPRN_SDR1, _SDR1);
} }
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <linux/oprofile.h> #include <linux/oprofile.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/smp.h> #include <linux/smp.h>
#include <asm/firmware.h>
#include <asm/ptrace.h> #include <asm/ptrace.h>
#include <asm/system.h> #include <asm/system.h>
#include <asm/processor.h> #include <asm/processor.h>
...@@ -232,7 +233,7 @@ static unsigned long get_pc(struct pt_regs *regs) ...@@ -232,7 +233,7 @@ static unsigned long get_pc(struct pt_regs *regs)
mmcra = mfspr(SPRN_MMCRA); mmcra = mfspr(SPRN_MMCRA);
/* Were we in the hypervisor? */ /* Were we in the hypervisor? */
if (platform_is_lpar() && (mmcra & MMCRA_SIHV)) if (firmware_has_feature(FW_FEATURE_LPAR) && (mmcra & MMCRA_SIHV))
/* function descriptor madness */ /* function descriptor madness */
return *((unsigned long *)hypervisor_bucket); return *((unsigned long *)hypervisor_bucket);
......
...@@ -303,8 +303,6 @@ static void __init iSeries_init_early(void) ...@@ -303,8 +303,6 @@ static void __init iSeries_init_early(void)
{ {
DBG(" -> iSeries_init_early()\n"); DBG(" -> iSeries_init_early()\n");
ppc64_firmware_features = FW_FEATURE_ISERIES;
ppc64_interrupt_controller = IC_ISERIES; ppc64_interrupt_controller = IC_ISERIES;
#if defined(CONFIG_BLK_DEV_INITRD) #if defined(CONFIG_BLK_DEV_INITRD)
...@@ -711,7 +709,13 @@ void __init iSeries_init_IRQ(void) { } ...@@ -711,7 +709,13 @@ void __init iSeries_init_IRQ(void) { }
static int __init iseries_probe(int platform) static int __init iseries_probe(int platform)
{ {
return PLATFORM_ISERIES_LPAR == platform; if (PLATFORM_ISERIES_LPAR != platform)
return 0;
ppc64_firmware_features |= FW_FEATURE_ISERIES;
ppc64_firmware_features |= FW_FEATURE_LPAR;
return 1;
} }
struct machdep_calls __initdata iseries_md = { struct machdep_calls __initdata iseries_md = {
......
...@@ -580,7 +580,7 @@ void iommu_init_early_pSeries(void) ...@@ -580,7 +580,7 @@ void iommu_init_early_pSeries(void)
return; return;
} }
if (platform_is_lpar()) { if (firmware_has_feature(FW_FEATURE_LPAR)) {
if (firmware_has_feature(FW_FEATURE_MULTITCE)) { if (firmware_has_feature(FW_FEATURE_MULTITCE)) {
ppc_md.tce_build = tce_buildmulti_pSeriesLP; ppc_md.tce_build = tce_buildmulti_pSeriesLP;
ppc_md.tce_free = tce_freemulti_pSeriesLP; ppc_md.tce_free = tce_freemulti_pSeriesLP;
......
...@@ -246,7 +246,7 @@ static void __init pSeries_setup_arch(void) ...@@ -246,7 +246,7 @@ static void __init pSeries_setup_arch(void)
ppc_md.idle_loop = default_idle; ppc_md.idle_loop = default_idle;
} }
if (platform_is_lpar()) if (firmware_has_feature(FW_FEATURE_LPAR))
ppc_md.enable_pmcs = pseries_lpar_enable_pmcs; ppc_md.enable_pmcs = pseries_lpar_enable_pmcs;
else else
ppc_md.enable_pmcs = power4_enable_pmcs; ppc_md.enable_pmcs = power4_enable_pmcs;
...@@ -324,12 +324,12 @@ static void __init pSeries_init_early(void) ...@@ -324,12 +324,12 @@ static void __init pSeries_init_early(void)
fw_feature_init(); fw_feature_init();
if (platform_is_lpar()) if (firmware_has_feature(FW_FEATURE_LPAR))
hpte_init_lpar(); hpte_init_lpar();
else else
hpte_init_native(); hpte_init_native();
if (platform_is_lpar()) if (firmware_has_feature(FW_FEATURE_LPAR))
find_udbg_vterm(); find_udbg_vterm();
if (firmware_has_feature(FW_FEATURE_DABR)) if (firmware_has_feature(FW_FEATURE_DABR))
...@@ -385,6 +385,9 @@ static int __init pSeries_probe(int platform) ...@@ -385,6 +385,9 @@ static int __init pSeries_probe(int platform)
* it here ... * it here ...
*/ */
if (platform == PLATFORM_PSERIES_LPAR)
ppc64_firmware_features |= FW_FEATURE_LPAR;
return 1; return 1;
} }
...@@ -524,7 +527,7 @@ static void pseries_shared_idle(void) ...@@ -524,7 +527,7 @@ static void pseries_shared_idle(void)
static int pSeries_pci_probe_mode(struct pci_bus *bus) static int pSeries_pci_probe_mode(struct pci_bus *bus)
{ {
if (platform_is_lpar()) if (firmware_has_feature(FW_FEATURE_LPAR))
return PCI_PROBE_DEVTREE; return PCI_PROBE_DEVTREE;
return PCI_PROBE_NORMAL; return PCI_PROBE_NORMAL;
} }
......
...@@ -443,7 +443,7 @@ void __init smp_init_pSeries(void) ...@@ -443,7 +443,7 @@ void __init smp_init_pSeries(void)
smp_ops->cpu_die = pSeries_cpu_die; smp_ops->cpu_die = pSeries_cpu_die;
/* Processors can be added/removed only on LPAR */ /* Processors can be added/removed only on LPAR */
if (platform_is_lpar()) if (firmware_has_feature(FW_FEATURE_LPAR))
pSeries_reconfig_notifier_register(&pSeries_smp_nb); pSeries_reconfig_notifier_register(&pSeries_smp_nb);
#endif #endif
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <linux/gfp.h> #include <linux/gfp.h>
#include <linux/radix-tree.h> #include <linux/radix-tree.h>
#include <linux/cpu.h> #include <linux/cpu.h>
#include <asm/firmware.h>
#include <asm/prom.h> #include <asm/prom.h>
#include <asm/io.h> #include <asm/io.h>
#include <asm/pgtable.h> #include <asm/pgtable.h>
...@@ -536,7 +537,7 @@ nextnode: ...@@ -536,7 +537,7 @@ nextnode:
of_node_put(np); of_node_put(np);
} }
if (platform_is_lpar()) if (firmware_has_feature(FW_FEATURE_LPAR))
ops = &pSeriesLP_ops; ops = &pSeriesLP_ops;
else { else {
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#define FW_FEATURE_MULTITCE (1UL<<19) #define FW_FEATURE_MULTITCE (1UL<<19)
#define FW_FEATURE_SPLPAR (1UL<<20) #define FW_FEATURE_SPLPAR (1UL<<20)
#define FW_FEATURE_ISERIES (1UL<<21) #define FW_FEATURE_ISERIES (1UL<<21)
#define FW_FEATURE_LPAR (1UL<<22)
enum { enum {
#ifdef CONFIG_PPC64 #ifdef CONFIG_PPC64
...@@ -51,10 +52,10 @@ enum { ...@@ -51,10 +52,10 @@ enum {
FW_FEATURE_MIGRATE | FW_FEATURE_PERFMON | FW_FEATURE_CRQ | FW_FEATURE_MIGRATE | FW_FEATURE_PERFMON | FW_FEATURE_CRQ |
FW_FEATURE_VIO | FW_FEATURE_RDMA | FW_FEATURE_LLAN | FW_FEATURE_VIO | FW_FEATURE_RDMA | FW_FEATURE_LLAN |
FW_FEATURE_BULK | FW_FEATURE_XDABR | FW_FEATURE_MULTITCE | FW_FEATURE_BULK | FW_FEATURE_XDABR | FW_FEATURE_MULTITCE |
FW_FEATURE_SPLPAR, FW_FEATURE_SPLPAR | FW_FEATURE_LPAR,
FW_FEATURE_PSERIES_ALWAYS = 0, FW_FEATURE_PSERIES_ALWAYS = 0,
FW_FEATURE_ISERIES_POSSIBLE = FW_FEATURE_ISERIES, FW_FEATURE_ISERIES_POSSIBLE = FW_FEATURE_ISERIES | FW_FEATURE_LPAR,
FW_FEATURE_ISERIES_ALWAYS = FW_FEATURE_ISERIES, FW_FEATURE_ISERIES_ALWAYS = FW_FEATURE_ISERIES | FW_FEATURE_LPAR,
FW_FEATURE_POSSIBLE = FW_FEATURE_POSSIBLE =
#ifdef CONFIG_PPC_PSERIES #ifdef CONFIG_PPC_PSERIES
FW_FEATURE_PSERIES_POSSIBLE | FW_FEATURE_PSERIES_POSSIBLE |
......
...@@ -52,7 +52,6 @@ ...@@ -52,7 +52,6 @@
#ifdef __KERNEL__ #ifdef __KERNEL__
#define platform_is_pseries() (_machine == PLATFORM_PSERIES || \ #define platform_is_pseries() (_machine == PLATFORM_PSERIES || \
_machine == PLATFORM_PSERIES_LPAR) _machine == PLATFORM_PSERIES_LPAR)
#define platform_is_lpar() (!!(_machine & PLATFORM_LPAR))
#if defined(CONFIG_PPC_MULTIPLATFORM) #if defined(CONFIG_PPC_MULTIPLATFORM)
extern int _machine; extern int _machine;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment