Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 27180
b: refs/heads/master
c: 1f4d4a7
h: refs/heads/master
v: v3
  • Loading branch information
Linus Torvalds committed Jun 10, 2006
1 parent ff66040 commit ce7919c
Show file tree
Hide file tree
Showing 12 changed files with 353 additions and 127 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 46b304934de417a2238d659ef6459a74cb3f5e6b
refs/heads/master: 1f4d4a7e8f5a46929a987ec17987dbbdd73029d4
348 changes: 270 additions & 78 deletions trunk/Documentation/memory-barriers.txt

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions trunk/arch/powerpc/kernel/prom_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -822,6 +822,7 @@ static void __init prom_send_capabilities(void)
/* try calling the ibm,client-architecture-support method */
if (call_prom_ret("call-method", 3, 2, &ret,
ADDR("ibm,client-architecture-support"),
root,
ADDR(ibm_architecture_vec)) == 0) {
/* the call exists... */
if (ret)
Expand Down Expand Up @@ -1622,6 +1623,15 @@ static int __init prom_find_machine_type(void)
if (strstr(p, RELOC("Power Macintosh")) ||
strstr(p, RELOC("MacRISC")))
return PLATFORM_POWERMAC;
#ifdef CONFIG_PPC64
/* We must make sure we don't detect the IBM Cell
* blades as pSeries due to some firmware issues,
* so we do it here.
*/
if (strstr(p, RELOC("IBM,CBEA")) ||
strstr(p, RELOC("IBM,CPBW-1.0")))
return PLATFORM_GENERIC;
#endif /* CONFIG_PPC64 */
i += sl + 1;
}
}
Expand Down
11 changes: 10 additions & 1 deletion trunk/arch/powerpc/kernel/signal_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -803,10 +803,13 @@ static int do_setcontext(struct ucontext __user *ucp, struct pt_regs *regs, int
if (__get_user(cmcp, &ucp->uc_regs))
return -EFAULT;
mcp = (struct mcontext __user *)(u64)cmcp;
/* no need to check access_ok(mcp), since mcp < 4GB */
}
#else
if (__get_user(mcp, &ucp->uc_regs))
return -EFAULT;
if (!access_ok(VERIFY_READ, mcp, sizeof(*mcp)))
return -EFAULT;
#endif
restore_sigmask(&set);
if (restore_user_regs(regs, mcp, sig))
Expand Down Expand Up @@ -908,13 +911,14 @@ int sys_debug_setcontext(struct ucontext __user *ctx,
{
struct sig_dbg_op op;
int i;
unsigned char tmp;
unsigned long new_msr = regs->msr;
#if defined(CONFIG_4xx) || defined(CONFIG_BOOKE)
unsigned long new_dbcr0 = current->thread.dbcr0;
#endif

for (i=0; i<ndbg; i++) {
if (__copy_from_user(&op, dbg, sizeof(op)))
if (copy_from_user(&op, dbg + i, sizeof(op)))
return -EFAULT;
switch (op.dbg_type) {
case SIG_DBG_SINGLE_STEPPING:
Expand Down Expand Up @@ -959,6 +963,11 @@ int sys_debug_setcontext(struct ucontext __user *ctx,
current->thread.dbcr0 = new_dbcr0;
#endif

if (!access_ok(VERIFY_READ, ctx, sizeof(*ctx))
|| __get_user(tmp, (u8 __user *) ctx)
|| __get_user(tmp, (u8 __user *) (ctx + 1) - 1))
return -EFAULT;

/*
* If we get a fault copying the context into the kernel's
* image of the user's registers, we can't just return -EFAULT
Expand Down
2 changes: 2 additions & 0 deletions trunk/arch/powerpc/kernel/signal_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ static long restore_sigcontext(struct pt_regs *regs, sigset_t *set, int sig,
err |= __get_user(msr, &sc->gp_regs[PT_MSR]);
if (err)
return err;
if (v_regs && !access_ok(VERIFY_READ, v_regs, 34 * sizeof(vector128)))
return -EFAULT;
/* Copy 33 vec registers (vr0..31 and vscr) from the stack */
if (v_regs != 0 && (msr & MSR_VEC) != 0)
err |= __copy_from_user(current->thread.vr, v_regs,
Expand Down
11 changes: 5 additions & 6 deletions trunk/arch/powerpc/platforms/cell/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,13 @@ static void __init cell_init_early(void)

static int __init cell_probe(void)
{
/* XXX This is temporary, the Cell maintainer will come up with
* more appropriate detection logic
*/
unsigned long root = of_get_flat_dt_root();
if (!of_flat_dt_is_compatible(root, "IBM,CPBW-1.0"))
return 0;

return 1;
if (of_flat_dt_is_compatible(root, "IBM,CBEA") ||
of_flat_dt_is_compatible(root, "IBM,CPBW-1.0"))
return 1;

return 0;
}

/*
Expand Down
8 changes: 8 additions & 0 deletions trunk/arch/powerpc/platforms/pseries/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -389,13 +389,21 @@ static int __init pSeries_probe_hypertas(unsigned long node,

static int __init pSeries_probe(void)
{
unsigned long root = of_get_flat_dt_root();
char *dtype = of_get_flat_dt_prop(of_get_flat_dt_root(),
"device_type", NULL);
if (dtype == NULL)
return 0;
if (strcmp(dtype, "chrp"))
return 0;

/* Cell blades firmware claims to be chrp while it's not. Until this
* is fixed, we need to avoid those here.
*/
if (of_flat_dt_is_compatible(root, "IBM,CPBW-1.0") ||
of_flat_dt_is_compatible(root, "IBM,CBEA"))
return 0;

DBG("pSeries detected, looking for LPAR capability...\n");

/* Now try to figure out if we are running on LPAR */
Expand Down
5 changes: 4 additions & 1 deletion trunk/drivers/acpi/processor_perflib.c
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,8 @@ acpi_processor_register_performance(struct acpi_processor_performance
return_VALUE(-EBUSY);
}

WARN_ON(!performance);

pr->performance = performance;

if (acpi_processor_get_performance_info(pr)) {
Expand Down Expand Up @@ -609,7 +611,8 @@ acpi_processor_unregister_performance(struct acpi_processor_performance
return_VOID;
}

kfree(pr->performance->states);
if (pr->performance)
kfree(pr->performance->states);
pr->performance = NULL;

acpi_cpufreq_remove_file(pr);
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/char/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ obj-$(CONFIG_N_HDLC) += n_hdlc.o
obj-$(CONFIG_AMIGA_BUILTIN_SERIAL) += amiserial.o
obj-$(CONFIG_SX) += sx.o generic_serial.o
obj-$(CONFIG_RIO) += rio/ generic_serial.o
obj-$(CONFIG_HVC_DRIVER) += hvc_console.o
obj-$(CONFIG_HVC_CONSOLE) += hvc_vio.o hvsi.o
obj-$(CONFIG_HVC_RTAS) += hvc_rtas.o
obj-$(CONFIG_HVC_DRIVER) += hvc_console.o
obj-$(CONFIG_RAW_DRIVER) += raw.o
obj-$(CONFIG_SGI_SNSC) += snsc.o snsc_event.o
obj-$(CONFIG_MMTIMER) += mmtimer.o
Expand Down
72 changes: 37 additions & 35 deletions trunk/drivers/message/i2o/exec-osm.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ struct i2o_exec_wait {
u32 m; /* message id */
struct i2o_message *msg; /* pointer to the reply message */
struct list_head list; /* node in global wait list */
spinlock_t lock; /* lock before modifying */
};

/* Work struct needed to handle LCT NOTIFY replies */
Expand Down Expand Up @@ -87,6 +88,7 @@ static struct i2o_exec_wait *i2o_exec_wait_alloc(void)
return NULL;

INIT_LIST_HEAD(&wait->list);
spin_lock_init(&wait->lock);

return wait;
};
Expand Down Expand Up @@ -125,6 +127,7 @@ int i2o_msg_post_wait_mem(struct i2o_controller *c, struct i2o_message *msg,
DECLARE_WAIT_QUEUE_HEAD(wq);
struct i2o_exec_wait *wait;
static u32 tcntxt = 0x80000000;
long flags;
int rc = 0;

wait = i2o_exec_wait_alloc();
Expand All @@ -146,33 +149,28 @@ int i2o_msg_post_wait_mem(struct i2o_controller *c, struct i2o_message *msg,
wait->tcntxt = tcntxt++;
msg->u.s.tcntxt = cpu_to_le32(wait->tcntxt);

wait->wq = &wq;
/*
* we add elements to the head, because if a entry in the list will
* never be removed, we have to iterate over it every time
*/
list_add(&wait->list, &i2o_exec_wait_list);

/*
* Post the message to the controller. At some point later it will
* return. If we time out before it returns then complete will be zero.
*/
i2o_msg_post(c, msg);

if (!wait->complete) {
wait->wq = &wq;
/*
* we add elements add the head, because if a entry in the list
* will never be removed, we have to iterate over it every time
*/
list_add(&wait->list, &i2o_exec_wait_list);

wait_event_interruptible_timeout(wq, wait->complete,
timeout * HZ);
wait_event_interruptible_timeout(wq, wait->complete, timeout * HZ);

wait->wq = NULL;
}
spin_lock_irqsave(&wait->lock, flags);

barrier();
wait->wq = NULL;

if (wait->complete) {
if (wait->complete)
rc = le32_to_cpu(wait->msg->body[0]) >> 24;
i2o_flush_reply(c, wait->m);
i2o_exec_wait_free(wait);
} else {
else {
/*
* We cannot remove it now. This is important. When it does
* terminate (which it must do if the controller has not
Expand All @@ -186,6 +184,13 @@ int i2o_msg_post_wait_mem(struct i2o_controller *c, struct i2o_message *msg,
rc = -ETIMEDOUT;
}

spin_unlock_irqrestore(&wait->lock, flags);

if (rc != -ETIMEDOUT) {
i2o_flush_reply(c, wait->m);
i2o_exec_wait_free(wait);
}

return rc;
};

Expand Down Expand Up @@ -213,7 +218,6 @@ static int i2o_msg_post_wait_complete(struct i2o_controller *c, u32 m,
{
struct i2o_exec_wait *wait, *tmp;
unsigned long flags;
static spinlock_t lock = SPIN_LOCK_UNLOCKED;
int rc = 1;

/*
Expand All @@ -223,23 +227,24 @@ static int i2o_msg_post_wait_complete(struct i2o_controller *c, u32 m,
* already expired. Not much we can do about that except log it for
* debug purposes, increase timeout, and recompile.
*/
spin_lock_irqsave(&lock, flags);
list_for_each_entry_safe(wait, tmp, &i2o_exec_wait_list, list) {
if (wait->tcntxt == context) {
list_del(&wait->list);
spin_lock_irqsave(&wait->lock, flags);

spin_unlock_irqrestore(&lock, flags);
list_del(&wait->list);

wait->m = m;
wait->msg = msg;
wait->complete = 1;

barrier();

if (wait->wq) {
wake_up_interruptible(wait->wq);
if (wait->wq)
rc = 0;
} else {
else
rc = -1;

spin_unlock_irqrestore(&wait->lock, flags);

if (rc) {
struct device *dev;

dev = &c->pdev->dev;
Expand All @@ -248,15 +253,13 @@ static int i2o_msg_post_wait_complete(struct i2o_controller *c, u32 m,
c->name);
i2o_dma_free(dev, &wait->dma);
i2o_exec_wait_free(wait);
rc = -1;
}
} else
wake_up_interruptible(wait->wq);

return rc;
}
}

spin_unlock_irqrestore(&lock, flags);

osm_warn("%s: Bogus reply in POST WAIT (tr-context: %08x)!\n", c->name,
context);

Expand Down Expand Up @@ -322,14 +325,9 @@ static DEVICE_ATTR(product_id, S_IRUGO, i2o_exec_show_product_id, NULL);
static int i2o_exec_probe(struct device *dev)
{
struct i2o_device *i2o_dev = to_i2o_device(dev);
struct i2o_controller *c = i2o_dev->iop;

i2o_event_register(i2o_dev, &i2o_exec_driver, 0, 0xffffffff);

c->exec = i2o_dev;

i2o_exec_lct_notify(c, c->lct->change_ind + 1);

device_create_file(dev, &dev_attr_vendor_id);
device_create_file(dev, &dev_attr_product_id);

Expand Down Expand Up @@ -523,6 +521,8 @@ static int i2o_exec_lct_notify(struct i2o_controller *c, u32 change_ind)
struct device *dev;
struct i2o_message *msg;

down(&c->lct_lock);

dev = &c->pdev->dev;

if (i2o_dma_realloc
Expand All @@ -545,6 +545,8 @@ static int i2o_exec_lct_notify(struct i2o_controller *c, u32 change_ind)

i2o_msg_post(c, msg);

up(&c->lct_lock);

return 0;
};

Expand Down
4 changes: 1 addition & 3 deletions trunk/drivers/message/i2o/iop.c
Original file line number Diff line number Diff line change
Expand Up @@ -804,8 +804,6 @@ void i2o_iop_remove(struct i2o_controller *c)

/* Ask the IOP to switch to RESET state */
i2o_iop_reset(c);

put_device(&c->device);
}

/**
Expand Down Expand Up @@ -1059,7 +1057,7 @@ struct i2o_controller *i2o_iop_alloc(void)

snprintf(poolname, sizeof(poolname), "i2o_%s_msg_inpool", c->name);
if (i2o_pool_alloc
(&c->in_msg, poolname, I2O_INBOUND_MSG_FRAME_SIZE * 4,
(&c->in_msg, poolname, I2O_INBOUND_MSG_FRAME_SIZE * 4 + sizeof(u32),
I2O_MSG_INPOOL_MIN)) {
kfree(c);
return ERR_PTR(-ENOMEM);
Expand Down
5 changes: 4 additions & 1 deletion trunk/include/linux/i2o.h
Original file line number Diff line number Diff line change
Expand Up @@ -1114,8 +1114,11 @@ static inline struct i2o_message *i2o_msg_get(struct i2o_controller *c)

mmsg->mfa = readl(c->in_port);
if (unlikely(mmsg->mfa >= c->in_queue.len)) {
u32 mfa = mmsg->mfa;

mempool_free(mmsg, c->in_msg.mempool);
if(mmsg->mfa == I2O_QUEUE_EMPTY)

if (mfa == I2O_QUEUE_EMPTY)
return ERR_PTR(-EBUSY);
return ERR_PTR(-EFAULT);
}
Expand Down

0 comments on commit ce7919c

Please sign in to comment.