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 size check for hugetlbfs
  [POWERPC] Fix initialization and usage of dma_mask
  [POWERPC] Fix more section mismatches in head_64.S
  [POWERPC] Revert "[POWERPC] Add 'mdio' to bus scan id list for platforms with QE UEC"
  [POWERPC] PS3: Update ps3_defconfig
  [POWERPC] PS3: Remove text saying PS3 support is incomplete
  [POWERPC] PS3: Fix storage probe logic
  [POWERPC] cell: Move SPU affinity init to spu_management_of_ops
  [POWERPC] Fix potential duplicate entry in SLB shadow buffer
  • Loading branch information
Linus Torvalds committed Aug 11, 2007
2 parents 73819b2 + d1f5a77 commit 75ecb1a
Show file tree
Hide file tree
Showing 16 changed files with 295 additions and 339 deletions.
200 changes: 65 additions & 135 deletions arch/powerpc/configs/ps3_defconfig

Large diffs are not rendered by default.

16 changes: 9 additions & 7 deletions arch/powerpc/kernel/head_64.S
Original file line number Diff line number Diff line change
Expand Up @@ -1672,8 +1672,9 @@ _GLOBAL(__start_initialization_multiplatform)
* Are we booted from a PROM Of-type client-interface ?
*/
cmpldi cr0,r5,0
bne .__boot_from_prom /* yes -> prom */

beq 1f
b .__boot_from_prom /* yes -> prom */
1:
/* Save parameters */
mr r31,r3
mr r30,r4
Expand Down Expand Up @@ -1701,7 +1702,7 @@ _GLOBAL(__start_initialization_multiplatform)
bl .__mmu_off
b .__after_prom_start

_STATIC(__boot_from_prom)
_INIT_STATIC(__boot_from_prom)
/* Save parameters */
mr r31,r3
mr r30,r4
Expand Down Expand Up @@ -1768,9 +1769,10 @@ _STATIC(__after_prom_start)
/* the source addr */

cmpdi r4,0 /* In some cases the loader may */
beq .start_here_multiplatform /* have already put us at zero */
bne 1f
b .start_here_multiplatform /* have already put us at zero */
/* so we can skip the copy. */
LOAD_REG_IMMEDIATE(r5,copy_to_here) /* # bytes of memory to copy */
1: LOAD_REG_IMMEDIATE(r5,copy_to_here) /* # bytes of memory to copy */
sub r5,r5,r27

li r6,0x100 /* Start offset, the first 0x100 */
Expand Down Expand Up @@ -1957,7 +1959,7 @@ _GLOBAL(enable_64b_mode)
/*
* This is where the main kernel code starts.
*/
_STATIC(start_here_multiplatform)
_INIT_STATIC(start_here_multiplatform)
/* get a new offset, now that the kernel has moved. */
bl .reloc_offset
mr r26,r3
Expand Down Expand Up @@ -2019,7 +2021,7 @@ _STATIC(start_here_multiplatform)
b . /* prevent speculative execution */

/* This is where all platforms converge execution */
_STATIC(start_here_common)
_INIT_STATIC(start_here_common)
/* relocation is on at this point */

/* The following code sets up the SP and TOC now that we are */
Expand Down
1 change: 1 addition & 0 deletions arch/powerpc/kernel/pci_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ struct pci_dev *of_create_pci_dev(struct device_node *node,

dev->current_state = 4; /* unknown power state */
dev->error_state = pci_channel_io_normal;
dev->dma_mask = 0xffffffff;

if (!strcmp(type, "pci") || !strcmp(type, "pciex")) {
/* a PCI-PCI bridge */
Expand Down
45 changes: 16 additions & 29 deletions arch/powerpc/mm/slb.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,20 +69,9 @@ static inline void slb_shadow_update(unsigned long ea,
smp_wmb();
}

static inline void create_shadowed_slbe(unsigned long ea, unsigned long flags,
unsigned long entry)
static inline void slb_shadow_clear(unsigned long entry)
{
/*
* Updating the shadow buffer before writing the SLB ensures
* we don't get a stale entry here if we get preempted by PHYP
* between these two statements.
*/
slb_shadow_update(ea, flags, entry);

asm volatile("slbmte %0,%1" :
: "r" (mk_vsid_data(ea, flags)),
"r" (mk_esid_data(ea, entry))
: "memory" );
get_slb_shadow()->save_area[entry].esid = 0;
}

void slb_flush_and_rebolt(void)
Expand All @@ -100,11 +89,13 @@ void slb_flush_and_rebolt(void)
vflags = SLB_VSID_KERNEL | vmalloc_llp;

ksp_esid_data = mk_esid_data(get_paca()->kstack, 2);
if ((ksp_esid_data & ESID_MASK) == PAGE_OFFSET)
if ((ksp_esid_data & ESID_MASK) == PAGE_OFFSET) {
ksp_esid_data &= ~SLB_ESID_V;

/* Only third entry (stack) may change here so only resave that */
slb_shadow_update(get_paca()->kstack, lflags, 2);
slb_shadow_clear(2);
} else {
/* Update stack entry; others don't change */
slb_shadow_update(get_paca()->kstack, lflags, 2);
}

/* We need to do this all in asm, so we're sure we don't touch
* the stack between the slbia and rebolting it. */
Expand Down Expand Up @@ -235,16 +226,12 @@ void slb_initialize(void)
vflags = SLB_VSID_KERNEL | vmalloc_llp;

/* Invalidate the entire SLB (even slot 0) & all the ERATS */
asm volatile("isync":::"memory");
asm volatile("slbmte %0,%0"::"r" (0) : "memory");
asm volatile("isync; slbia; isync":::"memory");
create_shadowed_slbe(PAGE_OFFSET, lflags, 0);

create_shadowed_slbe(VMALLOC_START, vflags, 1);

/* We don't bolt the stack for the time being - we're in boot,
* so the stack is in the bolted segment. By the time it goes
* elsewhere, we'll call _switch() which will bolt in the new
* one. */
asm volatile("isync":::"memory");
slb_shadow_update(PAGE_OFFSET, lflags, 0);
asm volatile("isync; slbia; sync; slbmte %0,%1; isync" ::
"r" (get_slb_shadow()->save_area[0].vsid),
"r" (get_slb_shadow()->save_area[0].esid) : "memory");

slb_shadow_update(VMALLOC_START, vflags, 1);

slb_flush_and_rebolt();
}
2 changes: 2 additions & 0 deletions arch/powerpc/mm/slice.c
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,8 @@ unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len,

if (len > mm->task_size)
return -ENOMEM;
if (len & ((1ul << pshift) - 1))
return -EINVAL;
if (fixed && (addr & ((1ul << pshift) - 1)))
return -EINVAL;
if (fixed && addr > (mm->task_size - len))
Expand Down
1 change: 0 additions & 1 deletion arch/powerpc/platforms/83xx/mpc832x_mds.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ static struct of_device_id mpc832x_ids[] = {
{ .type = "soc", },
{ .compatible = "soc", },
{ .type = "qe", },
{ .type = "mdio", },
{},
};

Expand Down
1 change: 0 additions & 1 deletion arch/powerpc/platforms/83xx/mpc832x_rdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ static struct of_device_id mpc832x_ids[] = {
{ .type = "soc", },
{ .compatible = "soc", },
{ .type = "qe", },
{ .type = "mdio", },
{},
};

Expand Down
1 change: 0 additions & 1 deletion arch/powerpc/platforms/83xx/mpc836x_mds.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ static struct of_device_id mpc836x_ids[] = {
{ .type = "soc", },
{ .compatible = "soc", },
{ .type = "qe", },
{ .type = "mdio", },
{},
};

Expand Down
1 change: 0 additions & 1 deletion arch/powerpc/platforms/85xx/mpc85xx_mds.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ static struct of_device_id mpc85xx_ids[] = {
{ .type = "soc", },
{ .compatible = "soc", },
{ .type = "qe", },
{ .type = "mdio", },
{},
};

Expand Down
141 changes: 1 addition & 140 deletions arch/powerpc/platforms/cell/spu_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
#include <asm/spu_priv1.h>
#include <asm/xmon.h>
#include <asm/prom.h>
#include "spu_priv1_mmio.h"

const struct spu_management_ops *spu_management_ops;
EXPORT_SYMBOL_GPL(spu_management_ops);
Expand Down Expand Up @@ -636,138 +635,6 @@ static ssize_t spu_stat_show(struct sys_device *sysdev, char *buf)

static SYSDEV_ATTR(stat, 0644, spu_stat_show, NULL);

/* Hardcoded affinity idxs for QS20 */
#define SPES_PER_BE 8
static int QS20_reg_idxs[SPES_PER_BE] = { 0, 2, 4, 6, 7, 5, 3, 1 };
static int QS20_reg_memory[SPES_PER_BE] = { 1, 1, 0, 0, 0, 0, 0, 0 };

static struct spu *spu_lookup_reg(int node, u32 reg)
{
struct spu *spu;

list_for_each_entry(spu, &cbe_spu_info[node].spus, cbe_list) {
if (*(u32 *)get_property(spu_devnode(spu), "reg", NULL) == reg)
return spu;
}
return NULL;
}

static void init_aff_QS20_harcoded(void)
{
int node, i;
struct spu *last_spu, *spu;
u32 reg;

for (node = 0; node < MAX_NUMNODES; node++) {
last_spu = NULL;
for (i = 0; i < SPES_PER_BE; i++) {
reg = QS20_reg_idxs[i];
spu = spu_lookup_reg(node, reg);
if (!spu)
continue;
spu->has_mem_affinity = QS20_reg_memory[reg];
if (last_spu)
list_add_tail(&spu->aff_list,
&last_spu->aff_list);
last_spu = spu;
}
}
}

static int of_has_vicinity(void)
{
struct spu* spu;

spu = list_entry(cbe_spu_info[0].spus.next, struct spu, cbe_list);
return of_find_property(spu_devnode(spu), "vicinity", NULL) != NULL;
}

static struct spu *aff_devnode_spu(int cbe, struct device_node *dn)
{
struct spu *spu;

list_for_each_entry(spu, &cbe_spu_info[cbe].spus, cbe_list)
if (spu_devnode(spu) == dn)
return spu;
return NULL;
}

static struct spu *
aff_node_next_to(int cbe, struct device_node *target, struct device_node *avoid)
{
struct spu *spu;
const phandle *vic_handles;
int lenp, i;

list_for_each_entry(spu, &cbe_spu_info[cbe].spus, cbe_list) {
if (spu_devnode(spu) == avoid)
continue;
vic_handles = get_property(spu_devnode(spu), "vicinity", &lenp);
for (i=0; i < (lenp / sizeof(phandle)); i++) {
if (vic_handles[i] == target->linux_phandle)
return spu;
}
}
return NULL;
}

static void init_aff_fw_vicinity_node(int cbe)
{
struct spu *spu, *last_spu;
struct device_node *vic_dn, *last_spu_dn;
phandle avoid_ph;
const phandle *vic_handles;
const char *name;
int lenp, i, added, mem_aff;

last_spu = list_entry(cbe_spu_info[cbe].spus.next, struct spu, cbe_list);
avoid_ph = 0;
for (added = 1; added < cbe_spu_info[cbe].n_spus; added++) {
last_spu_dn = spu_devnode(last_spu);
vic_handles = get_property(last_spu_dn, "vicinity", &lenp);

for (i = 0; i < (lenp / sizeof(phandle)); i++) {
if (vic_handles[i] == avoid_ph)
continue;

vic_dn = of_find_node_by_phandle(vic_handles[i]);
if (!vic_dn)
continue;

name = get_property(vic_dn, "name", NULL);
if (strcmp(name, "spe") == 0) {
spu = aff_devnode_spu(cbe, vic_dn);
avoid_ph = last_spu_dn->linux_phandle;
}
else {
mem_aff = strcmp(name, "mic-tm") == 0;
spu = aff_node_next_to(cbe, vic_dn, last_spu_dn);
if (!spu)
continue;
if (mem_aff) {
last_spu->has_mem_affinity = 1;
spu->has_mem_affinity = 1;
}
avoid_ph = vic_dn->linux_phandle;
}
list_add_tail(&spu->aff_list, &last_spu->aff_list);
last_spu = spu;
break;
}
}
}

static void init_aff_fw_vicinity(void)
{
int cbe;

/* sets has_mem_affinity for each spu, as long as the
* spu->aff_list list, linking each spu to its neighbors
*/
for (cbe = 0; cbe < MAX_NUMNODES; cbe++)
init_aff_fw_vicinity_node(cbe);
}

static int __init init_spu_base(void)
{
int i, ret = 0;
Expand Down Expand Up @@ -811,13 +678,7 @@ static int __init init_spu_base(void)
mutex_unlock(&spu_full_list_mutex);
spu_add_sysdev_attr(&attr_stat);

if (of_has_vicinity()) {
init_aff_fw_vicinity();
} else {
long root = of_get_flat_dt_root();
if (of_flat_dt_is_compatible(root, "IBM,CPBW-1.0"))
init_aff_QS20_harcoded();
}
spu_init_affinity();

return 0;

Expand Down
Loading

0 comments on commit 75ecb1a

Please sign in to comment.