aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2006-06-12 03:53:34 -0400
committerPaul Mackerras <paulus@samba.org>2006-06-12 03:53:34 -0400
commit7a0c58d0513c246ac5438ef4a55ce8b93395ae0e (patch)
treed18f58349ced242aa62e622e381e60933f71d451 /arch/powerpc
parent6218a761bbc27acc65248c80024875bcc06d52b1 (diff)
parent289a1e995e74734b5ec76ca8a5490058f4fecc24 (diff)
Merge branch 'merge'
Diffstat (limited to 'arch/powerpc')
-rw-r--r--arch/powerpc/kernel/prom_init.c10
-rw-r--r--arch/powerpc/kernel/signal_32.c11
-rw-r--r--arch/powerpc/kernel/signal_64.c2
-rw-r--r--arch/powerpc/platforms/cell/setup.c11
-rw-r--r--arch/powerpc/platforms/powermac/pfunc_core.c18
-rw-r--r--arch/powerpc/platforms/pseries/setup.c8
6 files changed, 46 insertions, 14 deletions
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index 5908690d0868..57d8a16438a0 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -776,6 +776,7 @@ static void __init prom_send_capabilities(void)
776 /* try calling the ibm,client-architecture-support method */ 776 /* try calling the ibm,client-architecture-support method */
777 if (call_prom_ret("call-method", 3, 2, &ret, 777 if (call_prom_ret("call-method", 3, 2, &ret,
778 ADDR("ibm,client-architecture-support"), 778 ADDR("ibm,client-architecture-support"),
779 root,
779 ADDR(ibm_architecture_vec)) == 0) { 780 ADDR(ibm_architecture_vec)) == 0) {
780 /* the call exists... */ 781 /* the call exists... */
781 if (ret) 782 if (ret)
@@ -1541,6 +1542,15 @@ static int __init prom_find_machine_type(void)
1541 if (strstr(p, RELOC("Power Macintosh")) || 1542 if (strstr(p, RELOC("Power Macintosh")) ||
1542 strstr(p, RELOC("MacRISC"))) 1543 strstr(p, RELOC("MacRISC")))
1543 return PLATFORM_POWERMAC; 1544 return PLATFORM_POWERMAC;
1545#ifdef CONFIG_PPC64
1546 /* We must make sure we don't detect the IBM Cell
1547 * blades as pSeries due to some firmware issues,
1548 * so we do it here.
1549 */
1550 if (strstr(p, RELOC("IBM,CBEA")) ||
1551 strstr(p, RELOC("IBM,CPBW-1.0")))
1552 return PLATFORM_GENERIC;
1553#endif /* CONFIG_PPC64 */
1544 i += sl + 1; 1554 i += sl + 1;
1545 } 1555 }
1546 } 1556 }
diff --git a/arch/powerpc/kernel/signal_32.c b/arch/powerpc/kernel/signal_32.c
index 237faeec2ec2..d73b25e22fca 100644
--- a/arch/powerpc/kernel/signal_32.c
+++ b/arch/powerpc/kernel/signal_32.c
@@ -808,10 +808,13 @@ static int do_setcontext(struct ucontext __user *ucp, struct pt_regs *regs, int
808 if (__get_user(cmcp, &ucp->uc_regs)) 808 if (__get_user(cmcp, &ucp->uc_regs))
809 return -EFAULT; 809 return -EFAULT;
810 mcp = (struct mcontext __user *)(u64)cmcp; 810 mcp = (struct mcontext __user *)(u64)cmcp;
811 /* no need to check access_ok(mcp), since mcp < 4GB */
811 } 812 }
812#else 813#else
813 if (__get_user(mcp, &ucp->uc_regs)) 814 if (__get_user(mcp, &ucp->uc_regs))
814 return -EFAULT; 815 return -EFAULT;
816 if (!access_ok(VERIFY_READ, mcp, sizeof(*mcp)))
817 return -EFAULT;
815#endif 818#endif
816 restore_sigmask(&set); 819 restore_sigmask(&set);
817 if (restore_user_regs(regs, mcp, sig)) 820 if (restore_user_regs(regs, mcp, sig))
@@ -913,13 +916,14 @@ int sys_debug_setcontext(struct ucontext __user *ctx,
913{ 916{
914 struct sig_dbg_op op; 917 struct sig_dbg_op op;
915 int i; 918 int i;
919 unsigned char tmp;
916 unsigned long new_msr = regs->msr; 920 unsigned long new_msr = regs->msr;
917#if defined(CONFIG_4xx) || defined(CONFIG_BOOKE) 921#if defined(CONFIG_4xx) || defined(CONFIG_BOOKE)
918 unsigned long new_dbcr0 = current->thread.dbcr0; 922 unsigned long new_dbcr0 = current->thread.dbcr0;
919#endif 923#endif
920 924
921 for (i=0; i<ndbg; i++) { 925 for (i=0; i<ndbg; i++) {
922 if (__copy_from_user(&op, dbg, sizeof(op))) 926 if (copy_from_user(&op, dbg + i, sizeof(op)))
923 return -EFAULT; 927 return -EFAULT;
924 switch (op.dbg_type) { 928 switch (op.dbg_type) {
925 case SIG_DBG_SINGLE_STEPPING: 929 case SIG_DBG_SINGLE_STEPPING:
@@ -964,6 +968,11 @@ int sys_debug_setcontext(struct ucontext __user *ctx,
964 current->thread.dbcr0 = new_dbcr0; 968 current->thread.dbcr0 = new_dbcr0;
965#endif 969#endif
966 970
971 if (!access_ok(VERIFY_READ, ctx, sizeof(*ctx))
972 || __get_user(tmp, (u8 __user *) ctx)
973 || __get_user(tmp, (u8 __user *) (ctx + 1) - 1))
974 return -EFAULT;
975
967 /* 976 /*
968 * If we get a fault copying the context into the kernel's 977 * If we get a fault copying the context into the kernel's
969 * image of the user's registers, we can't just return -EFAULT 978 * image of the user's registers, we can't just return -EFAULT
diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c
index 66a5fbe31989..6e75d7ab6d4d 100644
--- a/arch/powerpc/kernel/signal_64.c
+++ b/arch/powerpc/kernel/signal_64.c
@@ -184,6 +184,8 @@ static long restore_sigcontext(struct pt_regs *regs, sigset_t *set, int sig,
184 err |= __get_user(v_regs, &sc->v_regs); 184 err |= __get_user(v_regs, &sc->v_regs);
185 if (err) 185 if (err)
186 return err; 186 return err;
187 if (v_regs && !access_ok(VERIFY_READ, v_regs, 34 * sizeof(vector128)))
188 return -EFAULT;
187 /* Copy 33 vec registers (vr0..31 and vscr) from the stack */ 189 /* Copy 33 vec registers (vr0..31 and vscr) from the stack */
188 if (v_regs != 0 && (msr & MSR_VEC) != 0) 190 if (v_regs != 0 && (msr & MSR_VEC) != 0)
189 err |= __copy_from_user(current->thread.vr, v_regs, 191 err |= __copy_from_user(current->thread.vr, v_regs,
diff --git a/arch/powerpc/platforms/cell/setup.c b/arch/powerpc/platforms/cell/setup.c
index 6574b22b3cf3..fd3e5609e3e0 100644
--- a/arch/powerpc/platforms/cell/setup.c
+++ b/arch/powerpc/platforms/cell/setup.c
@@ -125,14 +125,13 @@ static void __init cell_init_early(void)
125 125
126static int __init cell_probe(void) 126static int __init cell_probe(void)
127{ 127{
128 /* XXX This is temporary, the Cell maintainer will come up with
129 * more appropriate detection logic
130 */
131 unsigned long root = of_get_flat_dt_root(); 128 unsigned long root = of_get_flat_dt_root();
132 if (!of_flat_dt_is_compatible(root, "IBM,CPBW-1.0"))
133 return 0;
134 129
135 return 1; 130 if (of_flat_dt_is_compatible(root, "IBM,CBEA") ||
131 of_flat_dt_is_compatible(root, "IBM,CPBW-1.0"))
132 return 1;
133
134 return 0;
136} 135}
137 136
138/* 137/*
diff --git a/arch/powerpc/platforms/powermac/pfunc_core.c b/arch/powerpc/platforms/powermac/pfunc_core.c
index 4baa75b1d36f..f08173b0f065 100644
--- a/arch/powerpc/platforms/powermac/pfunc_core.c
+++ b/arch/powerpc/platforms/powermac/pfunc_core.c
@@ -11,6 +11,7 @@
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/spinlock.h> 12#include <linux/spinlock.h>
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/mutex.h>
14 15
15#include <asm/semaphore.h> 16#include <asm/semaphore.h>
16#include <asm/prom.h> 17#include <asm/prom.h>
@@ -546,6 +547,7 @@ struct pmf_device {
546 547
547static LIST_HEAD(pmf_devices); 548static LIST_HEAD(pmf_devices);
548static spinlock_t pmf_lock = SPIN_LOCK_UNLOCKED; 549static spinlock_t pmf_lock = SPIN_LOCK_UNLOCKED;
550static DEFINE_MUTEX(pmf_irq_mutex);
549 551
550static void pmf_release_device(struct kref *kref) 552static void pmf_release_device(struct kref *kref)
551{ 553{
@@ -864,15 +866,17 @@ int pmf_register_irq_client(struct device_node *target,
864 866
865 spin_lock_irqsave(&pmf_lock, flags); 867 spin_lock_irqsave(&pmf_lock, flags);
866 func = __pmf_find_function(target, name, PMF_FLAGS_INT_GEN); 868 func = __pmf_find_function(target, name, PMF_FLAGS_INT_GEN);
867 if (func == NULL) { 869 if (func)
868 spin_unlock_irqrestore(&pmf_lock, flags); 870 func = pmf_get_function(func);
871 spin_unlock_irqrestore(&pmf_lock, flags);
872 if (func == NULL)
869 return -ENODEV; 873 return -ENODEV;
870 } 874 mutex_lock(&pmf_irq_mutex);
871 if (list_empty(&func->irq_clients)) 875 if (list_empty(&func->irq_clients))
872 func->dev->handlers->irq_enable(func); 876 func->dev->handlers->irq_enable(func);
873 list_add(&client->link, &func->irq_clients); 877 list_add(&client->link, &func->irq_clients);
874 client->func = func; 878 client->func = func;
875 spin_unlock_irqrestore(&pmf_lock, flags); 879 mutex_unlock(&pmf_irq_mutex);
876 880
877 return 0; 881 return 0;
878} 882}
@@ -881,16 +885,16 @@ EXPORT_SYMBOL_GPL(pmf_register_irq_client);
881void pmf_unregister_irq_client(struct pmf_irq_client *client) 885void pmf_unregister_irq_client(struct pmf_irq_client *client)
882{ 886{
883 struct pmf_function *func = client->func; 887 struct pmf_function *func = client->func;
884 unsigned long flags;
885 888
886 BUG_ON(func == NULL); 889 BUG_ON(func == NULL);
887 890
888 spin_lock_irqsave(&pmf_lock, flags); 891 mutex_lock(&pmf_irq_mutex);
889 client->func = NULL; 892 client->func = NULL;
890 list_del(&client->link); 893 list_del(&client->link);
891 if (list_empty(&func->irq_clients)) 894 if (list_empty(&func->irq_clients))
892 func->dev->handlers->irq_disable(func); 895 func->dev->handlers->irq_disable(func);
893 spin_unlock_irqrestore(&pmf_lock, flags); 896 mutex_unlock(&pmf_irq_mutex);
897 pmf_put_function(func);
894} 898}
895EXPORT_SYMBOL_GPL(pmf_unregister_irq_client); 899EXPORT_SYMBOL_GPL(pmf_unregister_irq_client);
896 900
diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index ee89d19c436a..1e28518c6121 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -389,6 +389,7 @@ static int __init pSeries_probe_hypertas(unsigned long node,
389 389
390static int __init pSeries_probe(void) 390static int __init pSeries_probe(void)
391{ 391{
392 unsigned long root = of_get_flat_dt_root();
392 char *dtype = of_get_flat_dt_prop(of_get_flat_dt_root(), 393 char *dtype = of_get_flat_dt_prop(of_get_flat_dt_root(),
393 "device_type", NULL); 394 "device_type", NULL);
394 if (dtype == NULL) 395 if (dtype == NULL)
@@ -396,6 +397,13 @@ static int __init pSeries_probe(void)
396 if (strcmp(dtype, "chrp")) 397 if (strcmp(dtype, "chrp"))
397 return 0; 398 return 0;
398 399
400 /* Cell blades firmware claims to be chrp while it's not. Until this
401 * is fixed, we need to avoid those here.
402 */
403 if (of_flat_dt_is_compatible(root, "IBM,CPBW-1.0") ||
404 of_flat_dt_is_compatible(root, "IBM,CBEA"))
405 return 0;
406
399 DBG("pSeries detected, looking for LPAR capability...\n"); 407 DBG("pSeries detected, looking for LPAR capability...\n");
400 408
401 /* Now try to figure out if we are running on LPAR */ 409 /* Now try to figure out if we are running on LPAR */