Skip to content

Commit

Permalink
Merge branch 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git…
Browse files Browse the repository at this point in the history
…/paulus/powerpc

* 'merge' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc:
  powerpc: Fix vio_bus_probe oops on probe error
  powerpc/ibmebus: Restore "name" sysfs attribute on ibmebus devices
  powerpc: Fix /dev/oldmem interface for kdump
  powerpc/spufs: Remove invalid semicolon after if statement
  powerpc/spufs: reference context while dropping state mutex in scheduler
  powerpc/spufs: fix npc setting for NOSCHED contexts
  • Loading branch information
torvalds committed Aug 20, 2008
2 parents 75d9506 + cd5aeb9 commit 8498ffd
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 31 deletions.
31 changes: 22 additions & 9 deletions arch/powerpc/kernel/crash_dump.c
Expand Up @@ -86,6 +86,19 @@ static int __init parse_savemaxmem(char *p)
}
__setup("savemaxmem=", parse_savemaxmem);


static size_t copy_oldmem_vaddr(void *vaddr, char *buf, size_t csize,
unsigned long offset, int userbuf)
{
if (userbuf) {
if (copy_to_user((char __user *)buf, (vaddr + offset), csize))
return -EFAULT;
} else
memcpy(buf, (vaddr + offset), csize);

return csize;
}

/**
* copy_oldmem_page - copy one page from "oldmem"
* @pfn: page frame number to be copied
Expand All @@ -107,16 +120,16 @@ ssize_t copy_oldmem_page(unsigned long pfn, char *buf,
if (!csize)
return 0;

vaddr = __ioremap(pfn << PAGE_SHIFT, PAGE_SIZE, 0);
csize = min(csize, PAGE_SIZE);

if (userbuf) {
if (copy_to_user((char __user *)buf, (vaddr + offset), csize)) {
iounmap(vaddr);
return -EFAULT;
}
} else
memcpy(buf, (vaddr + offset), csize);
if (pfn < max_pfn) {
vaddr = __va(pfn << PAGE_SHIFT);
csize = copy_oldmem_vaddr(vaddr, buf, csize, offset, userbuf);
} else {
vaddr = __ioremap(pfn << PAGE_SHIFT, PAGE_SIZE, 0);
csize = copy_oldmem_vaddr(vaddr, buf, csize, offset, userbuf);
iounmap(vaddr);
}

iounmap(vaddr);
return csize;
}
12 changes: 0 additions & 12 deletions arch/powerpc/kernel/ibmebus.c
Expand Up @@ -233,17 +233,6 @@ void ibmebus_free_irq(u32 ist, void *dev_id)
}
EXPORT_SYMBOL(ibmebus_free_irq);

static ssize_t name_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
return sprintf(buf, "%s\n", to_of_device(dev)->node->name);
}

static struct device_attribute ibmebus_dev_attrs[] = {
__ATTR_RO(name),
__ATTR_NULL
};

static char *ibmebus_chomp(const char *in, size_t count)
{
char *out = kmalloc(count + 1, GFP_KERNEL);
Expand Down Expand Up @@ -327,7 +316,6 @@ static struct bus_attribute ibmebus_bus_attrs[] = {

struct bus_type ibmebus_bus_type = {
.uevent = of_device_uevent,
.dev_attrs = ibmebus_dev_attrs,
.bus_attrs = ibmebus_bus_attrs
};
EXPORT_SYMBOL(ibmebus_bus_type);
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/kernel/vio.c
Expand Up @@ -1113,7 +1113,7 @@ static int vio_bus_probe(struct device *dev)
return error;
}
error = viodrv->probe(viodev, id);
if (error)
if (error && firmware_has_feature(FW_FEATURE_CMO))
vio_cmo_bus_remove(viodev);
}

Expand Down
15 changes: 8 additions & 7 deletions arch/powerpc/platforms/cell/spufs/run.c
Expand Up @@ -206,11 +206,6 @@ static int spu_run_init(struct spu_context *ctx, u32 *npc)
(SPU_RUNCNTL_RUNNABLE | SPU_RUNCNTL_ISOLATE);
if (runcntl == 0)
runcntl = SPU_RUNCNTL_RUNNABLE;
}

if (ctx->flags & SPU_CREATE_NOSCHED) {
spuctx_switch_state(ctx, SPU_UTIL_USER);
ctx->ops->runcntl_write(ctx, runcntl);
} else {
unsigned long privcntl;

Expand All @@ -219,9 +214,15 @@ static int spu_run_init(struct spu_context *ctx, u32 *npc)
else
privcntl = SPU_PRIVCNTL_MODE_NORMAL;

ctx->ops->npc_write(ctx, *npc);
ctx->ops->privcntl_write(ctx, privcntl);
ctx->ops->runcntl_write(ctx, runcntl);
ctx->ops->npc_write(ctx, *npc);
}

ctx->ops->runcntl_write(ctx, runcntl);

if (ctx->flags & SPU_CREATE_NOSCHED) {
spuctx_switch_state(ctx, SPU_UTIL_USER);
} else {

if (ctx->state == SPU_STATE_SAVED) {
ret = spu_activate(ctx, 0);
Expand Down
11 changes: 9 additions & 2 deletions arch/powerpc/platforms/cell/spufs/sched.c
Expand Up @@ -641,8 +641,10 @@ static struct spu *find_victim(struct spu_context *ctx)

if (tmp && tmp->prio > ctx->prio &&
!(tmp->flags & SPU_CREATE_NOSCHED) &&
(!victim || tmp->prio > victim->prio))
(!victim || tmp->prio > victim->prio)) {
victim = spu->ctx;
get_spu_context(victim);
}
}
mutex_unlock(&cbe_spu_info[node].list_mutex);

Expand All @@ -658,6 +660,7 @@ static struct spu *find_victim(struct spu_context *ctx)
* look at another context or give up after X retries.
*/
if (!mutex_trylock(&victim->state_mutex)) {
put_spu_context(victim);
victim = NULL;
goto restart;
}
Expand All @@ -670,6 +673,7 @@ static struct spu *find_victim(struct spu_context *ctx)
* restart the search.
*/
mutex_unlock(&victim->state_mutex);
put_spu_context(victim);
victim = NULL;
goto restart;
}
Expand All @@ -687,6 +691,7 @@ static struct spu *find_victim(struct spu_context *ctx)
spu_add_to_rq(victim);

mutex_unlock(&victim->state_mutex);
put_spu_context(victim);

return spu;
}
Expand Down Expand Up @@ -985,9 +990,11 @@ static int spusched_thread(void *unused)
struct spu_context *ctx = spu->ctx;

if (ctx) {
get_spu_context(ctx);
mutex_unlock(mtx);
spusched_tick(ctx);
mutex_lock(mtx);
put_spu_context(ctx);
}
}
mutex_unlock(mtx);
Expand Down Expand Up @@ -1030,7 +1037,7 @@ void spuctx_switch_state(struct spu_context *ctx,
node = spu->node;
if (old_state == SPU_UTIL_USER)
atomic_dec(&cbe_spu_info[node].busy_spus);
if (new_state == SPU_UTIL_USER);
if (new_state == SPU_UTIL_USER)
atomic_inc(&cbe_spu_info[node].busy_spus);
}
}
Expand Down
10 changes: 10 additions & 0 deletions drivers/of/device.c
Expand Up @@ -57,6 +57,15 @@ static ssize_t devspec_show(struct device *dev,
return sprintf(buf, "%s\n", ofdev->node->full_name);
}

static ssize_t name_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct of_device *ofdev;

ofdev = to_of_device(dev);
return sprintf(buf, "%s\n", ofdev->node->name);
}

static ssize_t modalias_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
Expand All @@ -71,6 +80,7 @@ static ssize_t modalias_show(struct device *dev,

struct device_attribute of_platform_device_attrs[] = {
__ATTR_RO(devspec),
__ATTR_RO(name),
__ATTR_RO(modalias),
__ATTR_NULL
};
Expand Down

0 comments on commit 8498ffd

Please sign in to comment.