diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2005-04-16 15:24:36 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 15:24:36 -0700 |
commit | 187335a4ec72c9bc7f3f168d6858a41fcfb63302 (patch) | |
tree | d5f1ae0d320e6325ed056469773e855fc635c53d /arch/ppc64/kernel/prom.c | |
parent | 547ee84cea37696d25c93306e909378a87db2f66 (diff) | |
download | op-kernel-dev-187335a4ec72c9bc7f3f168d6858a41fcfb63302.zip op-kernel-dev-187335a4ec72c9bc7f3f168d6858a41fcfb63302.tar.gz |
[PATCH] ppc64: Detect altivec via firmware on unknown CPUs
This patch adds detection of the Altivec capability of the CPU via the
firmware in addition to the cpu table. This allows newer CPUs that aren't
in the table to still have working altivec support in the kernel.
It also fixes a problem where if a CPU isn't recognized as having altivec
features, and takes an altivec unavailable exception due to userland
issuing altivec instructions, the kernel would happily enable it and
context switch the registers ... but not all of them (it would basically
forget vrsave). With this patch, the kernel will refuse to enable altivec
when the feature isn't detected for the CPU (SIGILL).
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/ppc64/kernel/prom.c')
-rw-r--r-- | arch/ppc64/kernel/prom.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/arch/ppc64/kernel/prom.c b/arch/ppc64/kernel/prom.c index 01739d5..b08aac6 100644 --- a/arch/ppc64/kernel/prom.c +++ b/arch/ppc64/kernel/prom.c @@ -885,6 +885,7 @@ static int __init early_init_dt_scan_cpus(unsigned long node, const char *full_path, void *data) { char *type = get_flat_dt_prop(node, "device_type", NULL); + u32 *prop; /* We are scanning "cpu" nodes only */ if (type == NULL || strcmp(type, "cpu") != 0) @@ -916,6 +917,20 @@ static int __init early_init_dt_scan_cpus(unsigned long node, } } + /* Check if we have a VMX and eventually update CPU features */ + prop = (u32 *)get_flat_dt_prop(node, "ibm,vmx", NULL); + if (prop && (*prop) > 0) { + cur_cpu_spec->cpu_features |= CPU_FTR_ALTIVEC; + cur_cpu_spec->cpu_user_features |= PPC_FEATURE_HAS_ALTIVEC; + } + + /* Same goes for Apple's "altivec" property */ + prop = (u32 *)get_flat_dt_prop(node, "altivec", NULL); + if (prop) { + cur_cpu_spec->cpu_features |= CPU_FTR_ALTIVEC; + cur_cpu_spec->cpu_user_features |= PPC_FEATURE_HAS_ALTIVEC; + } + return 0; } @@ -1104,7 +1119,9 @@ void __init early_init_devtree(void *params) DBG("Scanning CPUs ...\n"); - /* Retreive hash table size from flattened tree */ + /* Retreive hash table size from flattened tree plus other + * CPU related informations (altivec support, boot CPU ID, ...) + */ scan_flat_dt(early_init_dt_scan_cpus, NULL); /* If hash size wasn't obtained above, we calculate it now based on |