Re: [patch 6/6] PS3: Add os-area database routines

2007-10-08 Thread Geoff Levand
Geert Uytterhoeven wrote:
> On Sat, 6 Oct 2007 [EMAIL PROTECTED] wrote:
>> --- a/arch/powerpc/platforms/ps3/os-area.c
>> +++ b/arch/powerpc/platforms/ps3/os-area.c
> 
>> +static int db_get_video_mode(const struct os_area_db *db,
>> +unsigned int *video_mode)
> ^^
>> +{
>> +return db_get_64(db, &os_area_db_id_video_mode, (uint64_t*)video_mode);
> ^^^
>> +}
> 
> Woops, memory corruption, when writing a 64-bit value to a 32-bit variable.

Whoa!  That routines is not even used, so I removed it.

-Geoff  

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 5/5] [PPC] provide walk_memory_resource() for ppc

2008-05-12 Thread Geoff Levand
Hi,

I've had some trouble with this change.

Badari Pulavarty wrote:
> Provide walk_memory_resource() for ppc64. PPC maintains 
> logic memory region mapping in lmb.memory structures. Walk
> through these structures and do the callbacks for the
> contiguous chunks.

...

> --- linux-2.6.25-rc3.orig/arch/powerpc/mm/mem.c   2008-03-05 
> 10:14:28.0 -0800
> +++ linux-2.6.25-rc3/arch/powerpc/mm/mem.c2008-03-05 10:32:16.0 
> -0800
> @@ -148,19 +148,35 @@ out:
>  
>  /*
>   * walk_memory_resource() needs to make sure there is no holes in a given
> - * memory range. On PPC64, since this range comes from /sysfs, the range
> - * is guaranteed to be valid, non-overlapping and can not contain any
> - * holes. By the time we get here (memory add or remove), /proc/device-tree
> - * is updated and correct. Only reason we need to check against device-tree
> - * would be if we allow user-land to specify a memory range through a
> - * system call/ioctl etc. instead of doing offline/online through /sysfs.
> + * memory range. PPC64 does not maintain the memory layout in /proc/iomem.
> + * Instead it maintains it in lmb.memory structures. Walk through the
> + * memory regions, find holes and callback for contiguous regions.
>   */
>  int
>  walk_memory_resource(unsigned long start_pfn, unsigned long nr_pages, void 
> *arg,
>   int (*func)(unsigned long, unsigned long, void *))
>  {
> - return  (*func)(start_pfn, nr_pages, arg);
> + struct lmb_property res;
> + unsigned long pfn, len;
> + u64 end;
> + int ret = -1;
> +
> + res.base = (u64) start_pfn << PAGE_SHIFT;
> + res.size = (u64) nr_pages << PAGE_SHIFT;
> +
> + end = res.base + res.size - 1;
> + while ((res.base < end) && (lmb_find(&res) >= 0)) {
^^

In the PS3 platform code (arch/pwerpc/platfroms/ps3/mm.c) the hotplug
memory is added like this:

...
result = add_memory(0, start_addr, map.r1.size);
...
result = online_pages(start_pfn, nr_pages);
...

In its work, online_pages() eventually calls walk_memory_resource(),
which has been changed as above to do a test on lmb_find(). I found
that this lmb_find() test always fails for PS3 since add_memory()
does not call lmb_add().

Is it the responsibility of the platform code to call lmb_add(), or
should that be done by add_memory()?

-Geoff



___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[rfc patch] memory_hotplug: Check for walk_memory_resource() failure in online_pages()

2008-05-12 Thread Geoff Levand
Add a check to online_pages() to test for failure of
walk_memory_resource().  This fixes a condition where a failure
of walk_memory_resource() can lead to online_pages() returning
success without the requested pages being onlined.

Signed-off-by: Geoff Levand <[EMAIL PROTECTED]>
---

I'm not entirely sure this is the proper way to handle this
condition.  Comments welcome.

 mm/memory_hotplug.c |9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -408,8 +408,15 @@ int online_pages(unsigned long pfn, unsi
if (!populated_zone(zone))
need_zonelists_rebuild = 1;
 
-   walk_memory_resource(pfn, nr_pages, &onlined_pages,
+   ret = walk_memory_resource(pfn, nr_pages, &onlined_pages,
online_pages_range);
+   if (ret) {
+   printk(KERN_DEBUG "online_pages %lx at %lx failed\n",
+   nr_pages, pfn);
+   memory_notify(MEM_CANCEL_ONLINE, &arg);
+   return ret;
+   }
+
zone->present_pages += onlined_pages;
zone->zone_pgdat->node_present_pages += onlined_pages;
 

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


PS3: Fix memory hotplug

2008-05-13 Thread Geoff Levand
A change was made to walk_memory_resource() in commit
4b119e21d0c66c22e8ca03df05d9de623d0eb50f that added a
check of find_lmb().  Add the corresponding lmb_add()
call to ps3_mm_add_memory() so that that check will
succeed.

This fixes the condition where the PS3 boots up with
just the 128 MiB of boot memory.

Signed-off-by: Geoff Levand <[EMAIL PROTECTED]>
---

Paul,

Please send this one upstream at your earliest convenience.

-Geoff

 arch/powerpc/platforms/ps3/mm.c |2 ++
 1 file changed, 2 insertions(+)

--- a/arch/powerpc/platforms/ps3/mm.c
+++ b/arch/powerpc/platforms/ps3/mm.c
@@ -317,6 +317,8 @@ static int __init ps3_mm_add_memory(void
return result;
}
 
+   lmb_add(start_addr, map.r1.size);
+
result = online_pages(start_pfn, nr_pages);
 
if (result)

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: Convert remaining dts-v0 files to v1

2008-05-15 Thread Geoff Levand
David Gibson wrote:
> At the moment we have a mixture of left-over version 0 and new-format
> version 1 files in arch/powerpc/boot/dts.  This is potentially
> confusing to people new to the dts format attempting to figure it out.p
> 
> So, this patch converts all the as-yet unconverted dts v0 files and
> converts them to v1.  They're mechanically-converted, and not hand
> tweaked so in some cases they're not 100% in keeping with usual v1
> style, but the convertor program does have some heuristics so the
> discrepancies aren't too bad.
> 
> I have checked that this patch produces no changes to the resulting
> dtb binaries.
> 
> Signed-off-by: David Gibson <[EMAIL PROTECTED]>
> 
...
> Index: working-2.6/arch/powerpc/boot/dts/ps3.dts
> ===
> --- working-2.6.orig/arch/powerpc/boot/dts/ps3.dts2008-05-15 
> 16:32:08.0 +1000
> +++ working-2.6/arch/powerpc/boot/dts/ps3.dts 2008-05-15 16:32:08.00000 
> +1000

I tested this on PS3 and it seems to work OK.

Acked-by: Geoff Levand <[EMAIL PROTECTED]>


___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[patch v2] PS3: Fix memory hotplug

2008-05-15 Thread Geoff Levand
A change was made to walk_memory_resource() in commit
4b119e21d0c66c22e8ca03df05d9de623d0eb50f that added a
check of find_lmb().  Add the coresponding lmb_add()
call to ps3_mm_add_memory() so that that check will
succeed.

This fixes the condition where the PS3 boots up with
only the 128 MiB of boot memory.

Signed-off-by: Geoff Levand <[EMAIL PROTECTED]>
---

v2: Add call to lmb_analyze().

 arch/powerpc/platforms/ps3/mm.c |3 +++
 1 file changed, 3 insertions(+)

--- a/arch/powerpc/platforms/ps3/mm.c
+++ b/arch/powerpc/platforms/ps3/mm.c
@@ -317,6 +317,9 @@ static int __init ps3_mm_add_memory(void
return result;
}
 
+   lmb_add(start_addr, map.r1.size);
+   lmb_analyze();
+
result = online_pages(start_pfn, nr_pages);
 
if (result)

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [RFC] [PATCH] vmemmap fixes to use smaller pages

2008-05-15 Thread Geoff Levand
Benjamin Herrenschmidt wrote:
> This patch changes vmemmap to use a different region (region 0xf) of the
> address space whose page size can be dynamically configured at boot.

This doesn't seem to cause any problems, and users successfully used it
with the ubuntu hardy kernel, so I think it is OK to proceed with it.

  https://bugs.launchpad.net/ubuntu-ps3-port/+bug/220524

-Geoff

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[rfc] [patch] LMB: Add basic spin locking to lmb

2008-05-19 Thread Geoff Levand
Add a spinlock to struct lmb to enforce concurrency in
lmb_add(), lmb_remove(), lmb_analyze(), and lmb_dump_all().

This locking is needed for SMP systems that access the lmb structure
during hot memory add and remove operations after secondary cpus
have been started.

Signed-off-by: Geoff Levand <[EMAIL PROTECTED]>
---

This patch just adds locks for the few lmb routines that would
be used for hot memory adding and removing.

-Geoff


 include/linux/lmb.h |1 
 lib/lmb.c   |   54 +++-
 2 files changed, 42 insertions(+), 13 deletions(-)

--- a/include/linux/lmb.h
+++ b/include/linux/lmb.h
@@ -30,6 +30,7 @@ struct lmb_region {
 };
 
 struct lmb {
+   spinlock_t lock;
unsigned long debug;
u64 rmo_size;
struct lmb_region memory;
--- a/lib/lmb.c
+++ b/lib/lmb.c
@@ -32,28 +32,33 @@ early_param("lmb", early_lmb);
 void lmb_dump_all(void)
 {
unsigned long i;
+   struct lmb tmp;
 
if (!lmb_debug)
return;
 
+   spin_lock(&lmb.lock);
+   tmp = lmb;
+   spin_unlock(&lmb.lock);
+
pr_info("lmb_dump_all:\n");
-   pr_info("memory.cnt   = 0x%lx\n", lmb.memory.cnt);
+   pr_info("memory.cnt   = 0x%lx\n", tmp.memory.cnt);
pr_info("memory.size  = 0x%llx\n",
-   (unsigned long long)lmb.memory.size);
-   for (i=0; i < lmb.memory.cnt ;i++) {
+   (unsigned long long)tmp.memory.size);
+   for (i=0; i < tmp.memory.cnt ;i++) {
pr_info("memory.region[0x%lx].base   = 0x%llx\n",
-   i, (unsigned long long)lmb.memory.region[i].base);
+   i, (unsigned long long)tmp.memory.region[i].base);
pr_info(" .size = 0x%llx\n",
-   (unsigned long long)lmb.memory.region[i].size);
+   (unsigned long long)tmp.memory.region[i].size);
}
 
-   pr_info("reserved.cnt = 0x%lx\n", lmb.reserved.cnt);
-   pr_info("reserved.size= 0x%lx\n", lmb.reserved.size);
-   for (i=0; i < lmb.reserved.cnt ;i++) {
+   pr_info("reserved.cnt = 0x%lx\n", tmp.reserved.cnt);
+   pr_info("reserved.size= 0x%lx\n", tmp.reserved.size);
+   for (i=0; i < tmp.reserved.cnt ;i++) {
pr_info("reserved.region[0x%lx].base   = 0x%llx\n",
-   i, (unsigned long long)lmb.reserved.region[i].base);
+   i, (unsigned long long)tmp.reserved.region[i].base);
pr_info(" .size = 0x%llx\n",
-   (unsigned long long)lmb.reserved.region[i].size);
+   (unsigned long long)tmp.reserved.region[i].size);
}
 }
 
@@ -105,6 +110,8 @@ static void lmb_coalesce_regions(struct 
 
 void __init lmb_init(void)
 {
+   spin_lock_init(&lmb.lock);
+
/* Create a dummy zero size LMB which will get coalesced away later.
 * This simplifies the lmb_add() code below...
 */
@@ -122,10 +129,14 @@ void __init lmb_analyze(void)
 {
int i;
 
+   spin_lock(&lmb.lock);
+
lmb.memory.size = 0;
 
for (i = 0; i < lmb.memory.cnt; i++)
lmb.memory.size += lmb.memory.region[i].size;
+
+   spin_unlock(&lmb.lock);
 }
 
 static long lmb_add_region(struct lmb_region *rgn, u64 base, u64 size)
@@ -194,18 +205,25 @@ static long lmb_add_region(struct lmb_re
 
 long lmb_add(u64 base, u64 size)
 {
+   long ret;
struct lmb_region *_rgn = &lmb.memory;
 
+   spin_lock(&lmb.lock);
+
/* On pSeries LPAR systems, the first LMB is our RMO region. */
if (base == 0)
lmb.rmo_size = size;
 
-   return lmb_add_region(_rgn, base, size);
+   ret = lmb_add_region(_rgn, base, size);
+
+   spin_unlock(&lmb.lock);
+   return ret;
 
 }
 
 long lmb_remove(u64 base, u64 size)
 {
+   long ret;
struct lmb_region *rgn = &(lmb.memory);
u64 rgnbegin, rgnend;
u64 end = base + size;
@@ -213,6 +231,8 @@ long lmb_remove(u64 base, u64 size)
 
rgnbegin = rgnend = 0; /* supress gcc warnings */
 
+   spin_lock(&lmb.lock);
+
/* Find the region where (base, size) belongs to */
for (i=0; i < rgn->cnt; i++) {
rgnbegin = rgn->region[i].base;
@@ -223,12 +243,15 @@ long lmb_remove(u64 base, u64 size)
}
 
/* Didn't find the region */
-   if (i == rgn->cnt)
+   if (i == rgn->cnt) {
+   spin_unlock(&lmb.lock);
return -1;
+   }
 
/* Check to see if we are removing entire region */
if ((rgnbegin == base) && (rgnend == end)) {
l

[patch v2] LMB: Add basic spin locking to lmb

2008-05-19 Thread Geoff Levand
Add a spinlock to struct lmb to enforce concurrency in
lmb_add(), lmb_remove(), lmb_analyze(), lmb_find(), and
lmb_dump_all().

This locking is needed for SMP systems that access the lmb structure
during hot memory add and remove operations after secondary cpus
have been started.

Signed-off-by: Geoff Levand <[EMAIL PROTECTED]>
---

v2: o Add locking to lmb_find().

 include/linux/lmb.h |1 
 lib/lmb.c   |   62 
 2 files changed, 49 insertions(+), 14 deletions(-)

--- a/include/linux/lmb.h
+++ b/include/linux/lmb.h
@@ -30,6 +30,7 @@ struct lmb_region {
 };
 
 struct lmb {
+   spinlock_t lock;
unsigned long debug;
u64 rmo_size;
struct lmb_region memory;
--- a/lib/lmb.c
+++ b/lib/lmb.c
@@ -32,28 +32,33 @@ early_param("lmb", early_lmb);
 void lmb_dump_all(void)
 {
unsigned long i;
+   struct lmb tmp;
 
if (!lmb_debug)
return;
 
+   spin_lock(&lmb.lock);
+   tmp = lmb;
+   spin_unlock(&lmb.lock);
+
pr_info("lmb_dump_all:\n");
-   pr_info("memory.cnt   = 0x%lx\n", lmb.memory.cnt);
+   pr_info("memory.cnt   = 0x%lx\n", tmp.memory.cnt);
pr_info("memory.size  = 0x%llx\n",
-   (unsigned long long)lmb.memory.size);
-   for (i=0; i < lmb.memory.cnt ;i++) {
+   (unsigned long long)tmp.memory.size);
+   for (i=0; i < tmp.memory.cnt ;i++) {
pr_info("memory.region[0x%lx].base   = 0x%llx\n",
-   i, (unsigned long long)lmb.memory.region[i].base);
+   i, (unsigned long long)tmp.memory.region[i].base);
pr_info(" .size = 0x%llx\n",
-   (unsigned long long)lmb.memory.region[i].size);
+   (unsigned long long)tmp.memory.region[i].size);
}
 
-   pr_info("reserved.cnt = 0x%lx\n", lmb.reserved.cnt);
-   pr_info("reserved.size= 0x%lx\n", lmb.reserved.size);
-   for (i=0; i < lmb.reserved.cnt ;i++) {
+   pr_info("reserved.cnt = 0x%lx\n", tmp.reserved.cnt);
+   pr_info("reserved.size= 0x%lx\n", tmp.reserved.size);
+   for (i=0; i < tmp.reserved.cnt ;i++) {
pr_info("reserved.region[0x%lx].base   = 0x%llx\n",
-   i, (unsigned long long)lmb.reserved.region[i].base);
+   i, (unsigned long long)tmp.reserved.region[i].base);
pr_info(" .size = 0x%llx\n",
-   (unsigned long long)lmb.reserved.region[i].size);
+   (unsigned long long)tmp.reserved.region[i].size);
}
 }
 
@@ -105,6 +110,8 @@ static void lmb_coalesce_regions(struct 
 
 void __init lmb_init(void)
 {
+   spin_lock_init(&lmb.lock);
+
/* Create a dummy zero size LMB which will get coalesced away later.
 * This simplifies the lmb_add() code below...
 */
@@ -122,10 +129,14 @@ void __init lmb_analyze(void)
 {
int i;
 
+   spin_lock(&lmb.lock);
+
lmb.memory.size = 0;
 
for (i = 0; i < lmb.memory.cnt; i++)
lmb.memory.size += lmb.memory.region[i].size;
+
+   spin_unlock(&lmb.lock);
 }
 
 static long lmb_add_region(struct lmb_region *rgn, u64 base, u64 size)
@@ -194,18 +205,25 @@ static long lmb_add_region(struct lmb_re
 
 long lmb_add(u64 base, u64 size)
 {
+   long ret;
struct lmb_region *_rgn = &lmb.memory;
 
+   spin_lock(&lmb.lock);
+
/* On pSeries LPAR systems, the first LMB is our RMO region. */
if (base == 0)
lmb.rmo_size = size;
 
-   return lmb_add_region(_rgn, base, size);
+   ret = lmb_add_region(_rgn, base, size);
+
+   spin_unlock(&lmb.lock);
+   return ret;
 
 }
 
 long lmb_remove(u64 base, u64 size)
 {
+   long ret;
struct lmb_region *rgn = &(lmb.memory);
u64 rgnbegin, rgnend;
u64 end = base + size;
@@ -213,6 +231,8 @@ long lmb_remove(u64 base, u64 size)
 
rgnbegin = rgnend = 0; /* supress gcc warnings */
 
+   spin_lock(&lmb.lock);
+
/* Find the region where (base, size) belongs to */
for (i=0; i < rgn->cnt; i++) {
rgnbegin = rgn->region[i].base;
@@ -223,12 +243,15 @@ long lmb_remove(u64 base, u64 size)
}
 
/* Didn't find the region */
-   if (i == rgn->cnt)
+   if (i == rgn->cnt) {
+   spin_unlock(&lmb.lock);
return -1;
+   }
 
/* Check to see if we are removing entire region */
if ((rgnbegin == base) && (rgnend == end)) {
lmb_remove_region(rgn, i);
+   spin_unlock(&am

Re: [patch v2] PS3: Fix memory hotplug

2008-05-21 Thread Geoff Levand
Geoff Levand wrote:
> A change was made to walk_memory_resource() in commit
> 4b119e21d0c66c22e8ca03df05d9de623d0eb50f that added a
> check of find_lmb().  Add the coresponding lmb_add()
> call to ps3_mm_add_memory() so that that check will
> succeed.
> 
> This fixes the condition where the PS3 boots up with
> only the 128 MiB of boot memory.
> 
> Signed-off-by: Geoff Levand <[EMAIL PROTECTED]>
> ---
> 
> v2: Add call to lmb_analyze().
> 
>  arch/powerpc/platforms/ps3/mm.c |3 +++
>  1 file changed, 3 insertions(+)
> 
> --- a/arch/powerpc/platforms/ps3/mm.c
> +++ b/arch/powerpc/platforms/ps3/mm.c
> @@ -317,6 +317,9 @@ static int __init ps3_mm_add_memory(void
>   return result;
>   }
>  
> + lmb_add(start_addr, map.r1.size);
> + lmb_analyze();
> +
>   result = online_pages(start_pfn, nr_pages);
>  
>   if (result)
> 

Hi Paul,

Could you please merge this one in for 2.6.26.  Without it the
system boots with just 128 of the total 256 MiB of memory.

There is the concurrency problem as Ben commented on, but I
think not having the 128 MiB of memory is worse than having the
potential race, which we can work on as a separate fix.

-Geoff

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: PS3: Fix memory hotplug

2008-05-21 Thread Geoff Levand
Paul Mackerras wrote:
> Benjamin Herrenschmidt writes:
> 
>> When you do an lmb_add you should probably also do an lmb_analyze to
>> update the total memory count etc...
>> 
>> That leads to some interesting issues such as the LMB stuff wasn't
>> really meant to be dynamically modified after boot, and thus the kernel
>> has no locks in there. That can be an issue...
>> 
>> Paul, any thoughts here ? Should we add a lock ? That would mean being
>> careful as the LMB stuff can be called very early, and spinlock wants
>> things like PACA and possibly lockdep to be around.. 
> 
> Either that, or we give in and use iomem_resource to track where
> system RAM is, as well as the other things in the physical address
> space, like other architectures do...

The generic hot plug routines already use iomem_resource
(mm/memory_hotplug.c).  Both __add_pages() and add_memory()
add the new mem to iomem_resource, and so it seems there
is no need for the powerpc specific walk_memory_resource(),
since the generic one does its check with iomem_resource.

I need to look a little closer at how the pSeries does
its memory hot plug, but I think removing the powerpc
specific walk_memory_resource() won't effect pSeries since
it seems to have its own hot plug routines that do their
own thing entirely with lmb.

It doesn't seem that it would be difficult to make the
pSeries hot plug code to use iomem_resource, but some of the
generic hot plug routines cannot be called until fairly
late in the startup.

The other thing to do then would be to change the other
powerpc startup code to use iomem_resource instead of lmb.

-Geoff

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Debian kernel updates for Cell platforms

2008-05-24 Thread Geoff Levand
I made an updated debian config.powerpc64 to enable support for
the PS3 and fix the QS20 and QS21 options.

I put a kernel, initrd and modules archive here:

  http://cell.gotdns.org/pub/debian-cell-kernel-1/

Could people please test and report on various powerpc64
platforms.

-Geoff





___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [rtc-linux] state of GEN_RTC vs rtc subsystem

2008-05-30 Thread Geoff Levand
Alessandro Zummo wrote:
> On Wed, 20 Feb 2008 10:11:23 -0600
> Kumar Gala <[EMAIL PROTECTED]> wrote:
> 
>> 
>> Is the functionality provided by drivers/char/gen_rtc.c completely  
>> handled by the rtc subsystem in drivers/rtc?
>> 
>> I ask for two reasons:
>> 1. should we make it mutually exclusive in Kconfig
>> 2. I've enabled both and get (we'll my defconfig did):
> 
>  They shouldn't be enabled at once. I think a patch 
>  for Kconfig has been recently submitted to give a warning
>  in such a case.
> 
>  rtc-cmos should be able to handle the vast majority of x86
>  rtcs out there. 

gen_rtc was hooked up to the powerpc platform
ppc_md.set_rtc_time and ppc_md.get_rtc_time via the arch
specific get_rtc_time() and  set_rtc_time() routines.

>From what I can tell, those generic rtc routines the powerpc
arch provides are not properly hooked into the new rtc subsystem.
This causes problems for multi-platform builds where some platforms
must use gen_rtc, and some must the new rtc subsytem.

-Geoff


___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [rtc-linux] state of GEN_RTC vs rtc subsystem

2008-06-02 Thread Geoff Levand
Geoff Levand wrote:
> Alessandro Zummo wrote:
>> On Wed, 20 Feb 2008 10:11:23 -0600
>> Kumar Gala <[EMAIL PROTECTED]> wrote:
>> 
>>> 
>>> Is the functionality provided by drivers/char/gen_rtc.c completely  
>>> handled by the rtc subsystem in drivers/rtc?
>>> 
>>> I ask for two reasons:
>>> 1. should we make it mutually exclusive in Kconfig
>>> 2. I've enabled both and get (we'll my defconfig did):
>> 
>>  They shouldn't be enabled at once. I think a patch 
>>  for Kconfig has been recently submitted to give a warning
>>  in such a case.
>> 
>>  rtc-cmos should be able to handle the vast majority of x86
>>  rtcs out there. 
> 
> gen_rtc was hooked up to the powerpc platform
> ppc_md.set_rtc_time and ppc_md.get_rtc_time via the arch
> specific get_rtc_time() and  set_rtc_time() routines.
> 
>>From what I can tell, those generic rtc routines the powerpc
> arch provides are not properly hooked into the new rtc subsystem.
> This causes problems for multi-platform builds where some platforms
> must use gen_rtc, and some must the new rtc subsytem.

Just to follow up, I found that David Woodhouse has submitted
a patch which does this:

   http://patchwork.ozlabs.org/linuxppc/patch?id=18139

-Geoff

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [Cbe-oss-dev] 2.6.26-rc6 kernel bug on PS3?

2008-06-25 Thread Geoff Levand
On 06/25/2008 06:01 AM, Stefan Wald wrote:
> Hi,
> I think we have a kernel bug here... running a multimedia app with about 20
> spe contexts.
> Application hangs after a while defunct and dmesg output looks like d.txt.

Is it repeatable?

Nothing in your dump looks ps3 specific.  Did you try with a Cell Blade?

Could you try with an older kernel?

-Geoff

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[patch] PS3: Quiet system bus match output

2008-07-01 Thread Geoff Levand
Reduce the output verbosity of ps3_system_bus_match().

Signed-off-by: Geoff Levand <[EMAIL PROTECTED]>
---

Paul,

Please queue for 2.6.27.

-Geoff

 arch/powerpc/platforms/ps3/system-bus.c |   21 +
 1 file changed, 13 insertions(+), 8 deletions(-)

--- a/arch/powerpc/platforms/ps3/system-bus.c
+++ b/arch/powerpc/platforms/ps3/system-bus.c
@@ -349,9 +349,14 @@ static int ps3_system_bus_match(struct d
 
result = dev->match_id == drv->match_id;
 
-   pr_info("%s:%d: dev=%u(%s), drv=%u(%s): %s\n", __func__, __LINE__,
-   dev->match_id, dev->core.bus_id, drv->match_id, drv->core.name,
-   (result ? "match" : "miss"));
+   if (result)
+   pr_info("%s:%d: dev=%u(%s), drv=%u(%s): match\n", __func__,
+   __LINE__, dev->match_id, dev->core.bus_id,
+   drv->match_id, drv->core.name);
+   else
+   pr_debug("%s:%d: dev=%u(%s), drv=%u(%s): miss\n", __func__,
+   __LINE__, dev->match_id, dev->core.bus_id,
+   drv->match_id, drv->core.name);
return result;
 }
 
@@ -362,7 +367,7 @@ static int ps3_system_bus_probe(struct d
struct ps3_system_bus_driver *drv;
 
BUG_ON(!dev);
-   pr_info(" -> %s:%d: %s\n", __func__, __LINE__, _dev->bus_id);
+   pr_debug(" -> %s:%d: %s\n", __func__, __LINE__, _dev->bus_id);
 
drv = ps3_system_bus_dev_to_system_bus_drv(dev);
BUG_ON(!drv);
@@ -370,10 +375,10 @@ static int ps3_system_bus_probe(struct d
if (drv->probe)
result = drv->probe(dev);
else
-   pr_info("%s:%d: %s no probe method\n", __func__, __LINE__,
+   pr_debug("%s:%d: %s no probe method\n", __func__, __LINE__,
dev->core.bus_id);
 
-   pr_info(" <- %s:%d: %s\n", __func__, __LINE__, dev->core.bus_id);
+   pr_debug(" <- %s:%d: %s\n", __func__, __LINE__, dev->core.bus_id);
return result;
 }
 
@@ -384,7 +389,7 @@ static int ps3_system_bus_remove(struct 
struct ps3_system_bus_driver *drv;
 
BUG_ON(!dev);
-   pr_info(" -> %s:%d: %s\n", __func__, __LINE__, _dev->bus_id);
+   pr_debug(" -> %s:%d: %s\n", __func__, __LINE__, _dev->bus_id);
 
drv = ps3_system_bus_dev_to_system_bus_drv(dev);
BUG_ON(!drv);
@@ -395,7 +400,7 @@ static int ps3_system_bus_remove(struct 
dev_dbg(&dev->core, "%s:%d %s: no remove method\n",
__func__, __LINE__, drv->core.name);
 
-   pr_info(" <- %s:%d: %s\n", __func__, __LINE__, dev->core.bus_id);
+   pr_debug(" <- %s:%d: %s\n", __func__, __LINE__, dev->core.bus_id);
return result;
 }
 

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [patch 07/11] powerpc/dma: implement new dma_*map*_attrs() interfaces

2008-07-07 Thread Geoff Levand
Benjamin Herrenschmidt wrote:
> On Fri, 2008-07-04 at 21:05 +0200, [EMAIL PROTECTED] wrote:
>> plain text document attachment
>> (0007-powerpc-dma-implement-new-dma_-map-_attrs-interfa.patch)
>> Update powerpc to use the new dma_*map*_attrs() interfaces. In doing so
>> update struct dma_mapping_ops to accept a struct dma_attrs and propagate
>> these changes through to all users of the code (generic IOMMU and the
>> 64bit DMA code, and the iseries and ps3 platform code).
>> 
>> The old dma_*map_*() interfaces are reimplemented as calls to the
>> corresponding new interfaces.
> 
> Geoff, I think the PS3 bits in this patch are ok but I'd like
> you to double-check and send your ack if you think they are.


I tested on PS3 with ps3_defconfig, and it works OK.

Acked-by: Geoff Levand <[EMAIL PROTECTED]>


>> Signed-off-by: Mark Nelson <[EMAIL PROTECTED]>
>> Signed-off-by: Arnd Bergmann <[EMAIL PROTECTED]>
>> ---
>>  arch/powerpc/Kconfig|1 +
>>  arch/powerpc/kernel/dma_64.c|   34 ++---
>>  arch/powerpc/kernel/ibmebus.c   |   12 ++-
>>  arch/powerpc/kernel/iommu.c |   11 ++-
>>  arch/powerpc/platforms/iseries/iommu.c  |4 +-
>>  arch/powerpc/platforms/ps3/system-bus.c |   17 +++--
>>  include/asm-powerpc/dma-mapping.h   |  116 
>> +++
>>  include/asm-powerpc/iommu.h |   12 ++-
>>  8 files changed, 144 insertions(+), 63 deletions(-)


___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [patch 05/11] powerpc/cell: add spu aware cpufreq governor

2008-07-07 Thread Geoff Levand
[EMAIL PROTECTED] wrote:
> This patch adds a cpufreq governor that takes the number of running spus
> into account. It's very similar to the ondemand governor, but not as complex.
> Instead of hacking spu load into the ondemand governor it might be easier to
> have cpufreq accepting multiple governors per cpu in future.
> Don't know if this is the right way, but it would keep the governors simple.

I tried your current cell-2.6.git #cell_next branch with ps3_defconfig and
get these. ps3_defconfig has

 CONFIG_CBE_CPUFREQ=m
 CONFIG_CBE_CPUFREQ_SPU_GOVERNOR=m

I'm not sure if this patch is the one that introduced the problem though.
I guess we need to make an adjustment in the Kconfig.  I'll be away the
rest of this week, and will look at it next week if you don't.

-Geoff

cell-2.6/arch/powerpc/platforms/cell/cbe_spu_governor.c: In function 
'calc_freq':
cell-2.6/arch/powerpc/platforms/cell/cbe_spu_governor.c:53: warning: format 
'%d' expects type 'int', but argument 4 has type 'long unsigned int'

ERROR: ".cpufreq_register_governor" 
[arch/powerpc/platforms/cell/cbe_spu_governor.ko] undefined!
ERROR: ".__cpufreq_driver_target" 
[arch/powerpc/platforms/cell/cbe_spu_governor.ko] undefined!
ERROR: ".cpufreq_unregister_governor" 
[arch/powerpc/platforms/cell/cbe_spu_governor.ko] undefined!
ERROR: ".cpufreq_frequency_table_target" 
[arch/powerpc/platforms/cell/cbe-cpufreq.ko] undefined!
ERROR: ".cpufreq_register_driver" [arch/powerpc/platforms/cell/cbe-cpufreq.ko] 
undefined!
ERROR: ".cpufreq_frequency_table_verify" 
[arch/powerpc/platforms/cell/cbe-cpufreq.ko] undefined!
ERROR: ".cpufreq_frequency_table_get_attr" 
[arch/powerpc/platforms/cell/cbe-cpufreq.ko] undefined!
ERROR: ".cpufreq_notify_transition" 
[arch/powerpc/platforms/cell/cbe-cpufreq.ko] undefined!
ERROR: ".cpufreq_frequency_table_cpuinfo" 
[arch/powerpc/platforms/cell/cbe-cpufreq.ko] undefined!
ERROR: ".cbe_get_cpu_mic_tm_regs" [arch/powerpc/platforms/cell/cbe-cpufreq.ko] 
undefined!
ERROR: ".cbe_get_cpu_pmd_regs" [arch/powerpc/platforms/cell/cbe-cpufreq.ko] 
undefined!
ERROR: ".cpufreq_unregister_driver" 
[arch/powerpc/platforms/cell/cbe-cpufreq.ko] undefined!
ERROR: ".cpufreq_frequency_table_put_attr" 
[arch/powerpc/platforms/cell/cbe-cpufreq.ko] undefined!



___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[patch] PS3: Fix unlikely typo in ps3_get_irq

2008-02-28 Thread Geoff Levand

From: Roel Kluin <[EMAIL PROTECTED]>

Fix a typo bug 'unlikely(x) == y' and add an unlikely() call to
an unlikely code path in the PS3 interrupt routine ps3_get_irq().

Signed-off-by: Roel Kluin <[EMAIL PROTECTED]>
Signed-off-by: Geoff Levand <[EMAIL PROTECTED]>
---
Hi Paul,

Please apply for 2.6.25.

-Geoff

 arch/powerpc/platforms/ps3/interrupt.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/powerpc/platforms/ps3/interrupt.c
+++ b/arch/powerpc/platforms/ps3/interrupt.c
@@ -709,7 +709,7 @@ static unsigned int ps3_get_irq(void)
asm volatile("cntlzd %0,%1" : "=r" (plug) : "r" (x));
plug &= 0x3f;
 
-   if (unlikely(plug) == NO_IRQ) {
+   if (unlikely(plug == NO_IRQ)) {
pr_debug("%s:%d: no plug found: thread_id %lu\n", __func__,
__LINE__, pd->thread_id);
dump_bmp(&per_cpu(ps3_private, 0));



___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 0/3] hotplug memory remove updates

2008-02-28 Thread Geoff Levand
Hi.

Nathan Lynch wrote:
> Badari Pulavarty wrote:
>> Hi Paul,
>> 
>> Here are the hotplug memory remove updates for 2.6.25-rc2-mm1.
> 
> How have these been tested?  Have you initiated a memory remove
> operation from the HMC?  That's the only way to catch some bugs...

I'm wondering how the memory hot un-plug is initiated on the pseries.
Could you tell me about this HMC?  Is it an application running in
the lpar, or is it an external entity?

Is there a 'standard' interface from userspace that can be used to
trigger the hot-unplug sequence?  I'm asking because PS3's lv1
hypervisor supports hot un-plug of memory, but it would need to be
triggered from some kind of management application running in in
userspace.

-Geoff

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] [POWERPC] Fix zImage-dtb.initrd build error

2008-02-29 Thread Geoff Levand
On 02/29/2008 06:33 AM, Grant Likely wrote:
> Any comments on this patch?  It needs to go in for .25, but I haven't
> gotten any Acks on it.

I have it in ps3-linux.git, and seems to work OK.

Acked-by: Geoff Levand <[EMAIL PROTECTED]>

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] [POWERPC] bootwrapper: Allow specifying of image physical offset

2008-03-07 Thread Geoff Levand
On 03/07/2008 08:55 AM, Kumar Gala wrote:
> Normally we assume kernel images will be loaded at offset 0. However
> there are situations, like when the kernel itself is running at a non-zero
> physical address, that we don't want to load it at 0.
> 
> Allow the wrapper to take an offset.  We use this when building u-boot images.
> 
> Signed-off-by: Kumar Gala <[EMAIL PROTECTED]>
> ---
>  arch/powerpc/boot/Makefile |7 +++
>  arch/powerpc/boot/wrapper  |   12 ++--
>  2 files changed, 17 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
> index f43dd6e..1b4bfc6 100644
> --- a/arch/powerpc/boot/Makefile
> +++ b/arch/powerpc/boot/Makefile
> @@ -35,6 +35,12 @@ endif
> 
>  BOOTCFLAGS   += -I$(obj) -I$(srctree)/$(obj) -I$(srctree)/$(src)/libfdt
> 
> +ifdef CONFIG_MEMORY_START
> +MEMBASE=$(CONFIG_MEMORY_START)

We have the powerpc config option CONFIG_KERNEL_START.  I'm
wondering  how this CONFIG_MEMORY_START is different.  I just
did a quick search, and it seems that CONFIG_MEMORY_START is
only defined for the renesas arch's.

-Geoff

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[patch 0/6] PS3 patches for 2.6.26

2008-03-26 Thread Geoff Levand
Paul and Jeff,

This is a small set of PS3 patches for 2.6.26.  Patches
1-5 are ready to apply to the powerpc tree.

Patch 6 for the network driver needs an ACK by Jeff.


  [1/6] PS3: Fix unlikely typo in ps3_get_irq
  [2/6] PS3: Add ps3_get_speid routine
  [3/6] PS3: Bootwrapper improvements
  [4/6] PS3: Save power in busy loops on halt
  [5/6] PS3: Sys-manager Wake-on-LAN support
  [6/6] PS3: Gelic network driver Wake-on-LAN support


-Geoff

-- 



___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[patch 1/6] PS3: Fix unlikely typo in ps3_get_irq

2008-03-26 Thread Geoff Levand
From: Roel Kluin <[EMAIL PROTECTED]>

Fix a typo bug 'unlikely(x) == y' and add an unlikely() call to
an unlikely code path in the PS3 interrupt routine ps3_get_irq().

Signed-off-by: Roel Kluin <[EMAIL PROTECTED]>
Signed-off-by: Geoff Levand <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/ps3/interrupt.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/powerpc/platforms/ps3/interrupt.c
+++ b/arch/powerpc/platforms/ps3/interrupt.c
@@ -709,7 +709,7 @@ static unsigned int ps3_get_irq(void)
asm volatile("cntlzd %0,%1" : "=r" (plug) : "r" (x));
plug &= 0x3f;
 
-   if (unlikely(plug) == NO_IRQ) {
+   if (unlikely(plug == NO_IRQ)) {
pr_debug("%s:%d: no plug found: thread_id %lu\n", __func__,
__LINE__, pd->thread_id);
dump_bmp(&per_cpu(ps3_private, 0));

-- 



___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[patch 2/6] PS3: Add ps3_get_speid routine

2008-03-26 Thread Geoff Levand
From: Takashi Yamamoto <[EMAIL PROTECTED]>

Add a new routine ps3_get_speid() which returns the logical
SPE ID.  This ID is needed for profiling support.

Signed-off-by: Takashi Yamamoto <[EMAIL PROTECTED]>
Signed-off-by: Geoff Levand <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/ps3/spu.c |7 +++
 1 file changed, 7 insertions(+)

--- a/arch/powerpc/platforms/ps3/spu.c
+++ b/arch/powerpc/platforms/ps3/spu.c
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "../cell/spufs/spufs.h"
 #include "platform.h"
@@ -140,6 +141,12 @@ static void _dump_areas(unsigned int spe
pr_debug("%s:%d: shadow:  %lxh\n", func, line, shadow);
 }
 
+inline u64 ps3_get_spe_id(void *arg)
+{
+   return spu_pdata(arg)->spe_id;
+}
+EXPORT_SYMBOL_GPL(ps3_get_spe_id);
+
 static unsigned long get_vas_id(void)
 {
unsigned long id;

-- 



___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[patch 3/6] PS3: Bootwrapper improvements

2008-03-26 Thread Geoff Levand
Improve the debuging support of the PS3 bootwraper code:

 o Increase the size of the PS3 bootwrapper overlay from 256 to 512 bytes to
   allow for more debugging code in the overlay.
 o Use the dot symbol to set the size of __system_reset_overlay.  The
   asembler will then emit an error if the overlay code is too big.
 o Remove some unused instructions.
 o Update the text describing the PS3 bootwrapper overlay.
 o Add a check for null pointer writes.
 o Change hcall return value from s64.

Signed-off-by: Geoff Levand <[EMAIL PROTECTED]>
---
 arch/powerpc/boot/ps3-head.S |   25 -
 arch/powerpc/boot/ps3.c  |   21 +
 arch/powerpc/boot/wrapper|   21 +++--
 3 files changed, 40 insertions(+), 27 deletions(-)

--- a/arch/powerpc/boot/ps3-head.S
+++ b/arch/powerpc/boot/ps3-head.S
@@ -27,8 +27,9 @@
 /*
  * __system_reset_overlay - The PS3 first stage entry.
  *
- * The bootwraper build script copies the 0x100 bytes at symbol
- * __system_reset_overlay to offset 0x100 of the rom image.
+ * The bootwraper build script copies the 512 bytes at symbol
+ * __system_reset_overlay to offset 0x100 of the rom image.  This symbol
+ * must occupy 512 or less bytes.
  *
  * The PS3 has a single processor with two threads.
  */
@@ -47,8 +48,6 @@ __system_reset_overlay:
 
mfspr   r3, 0x88
cntlzw. r3, r3
-   li  r4, 0
-   li  r5, 0
beq 1f
 
/* Secondary goes to __secondary_hold in kernel. */
@@ -57,8 +56,14 @@ __system_reset_overlay:
mtctr   r4
bctr
 
-   /* Primary delays then goes to _zimage_start in wrapper. */
 1:
+   /* Save the value at addr zero for a null pointer write check later. */
+
+   li  r4, 0
+   lwz r3, 0(r4)
+
+   /* Primary delays then goes to _zimage_start in wrapper. */
+
or  31, 31, 31 /* db16cyc */
or  31, 31, 31 /* db16cyc */
 
@@ -67,16 +72,18 @@ __system_reset_overlay:
mtctr   r4
bctr
 
+   . = __system_reset_overlay + 512
+
 /*
  * __system_reset_kernel - Place holder for the kernel reset vector.
  *
- * The bootwrapper build script copies 0x100 bytes from offset 0x100
+ * The bootwrapper build script copies 512 bytes from offset 0x100
  * of the rom image to the symbol __system_reset_kernel.  At runtime
- * the bootwrapper program copies the 0x100 bytes at __system_reset_kernel
- * to ram address 0x100.  This symbol must occupy 0x100 bytes.
+ * the bootwrapper program copies the 512 bytes at __system_reset_kernel
+ * to ram address 0x100.  This symbol must occupy 512 bytes.
  */
 
.globl __system_reset_kernel
 __system_reset_kernel:
 
-   . = __system_reset_kernel + 0x100
+   . = __system_reset_kernel + 512
--- a/arch/powerpc/boot/ps3.c
+++ b/arch/powerpc/boot/ps3.c
@@ -27,10 +27,10 @@
 #include "page.h"
 #include "ops.h"
 
-extern s64 lv1_panic(u64 in_1);
-extern s64 lv1_get_logical_partition_id(u64 *out_1);
-extern s64 lv1_get_logical_ppe_id(u64 *out_1);
-extern s64 lv1_get_repository_node_value(u64 in_1, u64 in_2, u64 in_3,
+extern int lv1_panic(u64 in_1);
+extern int lv1_get_logical_partition_id(u64 *out_1);
+extern int lv1_get_logical_ppe_id(u64 *out_1);
+extern int lv1_get_repository_node_value(u64 in_1, u64 in_2, u64 in_3,
u64 in_4, u64 in_5, u64 *out_1, u64 *out_2);
 
 #ifdef DEBUG
@@ -46,6 +46,7 @@ BSS_STACK(4096);
  * edit the command line passed to vmlinux (by setting /chosen/bootargs).
  * The buffer is put in it's own section so that tools may locate it easier.
  */
+
 static char cmdline[COMMAND_LINE_SIZE]
__attribute__((__section__("__builtin_cmdline")));
 
@@ -75,7 +76,7 @@ static void ps3_exit(void)
 
 static int ps3_repository_read_rm_size(u64 *rm_size)
 {
-   s64 result;
+   int result;
u64 lpar_id;
u64 ppe_id;
u64 v2;
@@ -114,11 +115,11 @@ void ps3_copy_vectors(void)
 {
extern char __system_reset_kernel[];
 
-   memcpy((void *)0x100, __system_reset_kernel, 0x100);
-   flush_cache((void *)0x100, 0x100);
+   memcpy((void *)0x100, __system_reset_kernel, 512);
+   flush_cache((void *)0x100, 512);
 }
 
-void platform_init(void)
+void platform_init(unsigned long null_check)
 {
const u32 heapsize = 0x100 - (u32)_end; /* 16MiB */
void *chosen;
@@ -151,6 +152,10 @@ void platform_init(void)
 
printf(" flat tree at 0x%lx\n\r", ft_addr);
 
+   if (*(unsigned long *)0 != null_check)
+   printf("null check failed: %lx != %lx\n\r", *(unsigned long *)0,
+   (unsigned long)null_check);
+
((kernel_entry_t)0)(ft_addr, 0, NULL);
 
ps3_exit();
--- a/arch/powerpc/boot/wrapper
+++ b/arch/powerpc/boot/wrapper
@@ -298,15 +298,16 @@ treeboot*)
 exit 0
 ;;
 ps3)
-# The ps3's loader supports loading gzipped binary images from flash
-# rom to addr zero. The lo

[patch 4/6] PS3: Save power in busy loops on halt

2008-03-26 Thread Geoff Levand
From: Geert Uytterhoeven <[EMAIL PROTECTED]>

PS3 save power on halt:
  - Replace infinite busy loops by smarter loops calling
lv1_pause() to save power.
  - Add ps3_halt() and ps3_sys_manager_halt().
  - Add __noreturn annotations.

Signed-off-by: Geert Uytterhoeven <[EMAIL PROTECTED]>
Signed-off-by: Geoff Levand <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/ps3/setup.c |   12 +++-
 drivers/ps3/ps3-sys-manager.c  |   30 --
 drivers/ps3/sys-manager-core.c |   16 ++--
 include/asm-powerpc/ps3.h  |5 +++--
 4 files changed, 44 insertions(+), 19 deletions(-)

--- a/arch/powerpc/platforms/ps3/setup.c
+++ b/arch/powerpc/platforms/ps3/setup.c
@@ -95,6 +95,14 @@ static void ps3_power_off(void)
ps3_sys_manager_power_off(); /* never returns */
 }
 
+static void ps3_halt(void)
+{
+   DBG("%s:%d\n", __func__, __LINE__);
+
+   smp_send_stop();
+   ps3_sys_manager_halt(); /* never returns */
+}
+
 static void ps3_panic(char *str)
 {
DBG("%s:%d %s\n", __func__, __LINE__, str);
@@ -105,7 +113,8 @@ static void ps3_panic(char *str)
printk("   Please press POWER button.\n");
printk("\n");
 
-   while(1);
+   while(1)
+   lv1_pause(1);
 }
 
 #if defined(CONFIG_FB_PS3) || defined(CONFIG_FB_PS3_MODULE) || \
@@ -266,6 +275,7 @@ define_machine(ps3) {
.progress   = ps3_progress,
.restart= ps3_restart,
.power_off  = ps3_power_off,
+   .halt   = ps3_halt,
 #if defined(CONFIG_KEXEC)
.kexec_cpu_down = ps3_kexec_cpu_down,
.machine_kexec  = default_machine_kexec,
--- a/drivers/ps3/ps3-sys-manager.c
+++ b/drivers/ps3/ps3-sys-manager.c
@@ -24,6 +24,7 @@
 #include 
 
 #include 
+#include 
 #include 
 
 #include "vuart.h"
@@ -581,6 +582,23 @@ fail_id:
return -EIO;
 }
 
+static void ps3_sys_manager_fin(struct ps3_system_bus_device *dev)
+{
+   ps3_sys_manager_send_request_shutdown(dev);
+
+   pr_emerg("System Halted, OK to turn off power\n");
+
+   while (ps3_sys_manager_handle_msg(dev)) {
+   /* pause until next DEC interrupt */
+   lv1_pause(0);
+   }
+
+   while (1) {
+   /* pause, ignoring DEC interrupt */
+   lv1_pause(1);
+   }
+}
+
 /**
  * ps3_sys_manager_final_power_off - The final platform machine_power_off 
routine.
  *
@@ -602,12 +620,8 @@ static void ps3_sys_manager_final_power_
 
ps3_sys_manager_send_next_op(dev, PS3_SM_NEXT_OP_SYS_SHUTDOWN,
PS3_SM_WAKE_DEFAULT);
-   ps3_sys_manager_send_request_shutdown(dev);
-
-   pr_emerg("System Halted, OK to turn off power\n");
 
-   while (1)
-   ps3_sys_manager_handle_msg(dev);
+   ps3_sys_manager_fin(dev);
 }
 
 /**
@@ -639,12 +653,8 @@ static void ps3_sys_manager_final_restar
ps3_sys_manager_send_attr(dev, 0);
ps3_sys_manager_send_next_op(dev, PS3_SM_NEXT_OP_SYS_REBOOT,
PS3_SM_WAKE_DEFAULT);
-   ps3_sys_manager_send_request_shutdown(dev);
-
-   pr_emerg("System Halted, OK to turn off power\n");
 
-   while (1)
-   ps3_sys_manager_handle_msg(dev);
+   ps3_sys_manager_fin(dev);
 }
 
 /**
--- a/drivers/ps3/sys-manager-core.c
+++ b/drivers/ps3/sys-manager-core.c
@@ -19,6 +19,7 @@
  */
 
 #include 
+#include 
 #include 
 
 /**
@@ -50,10 +51,7 @@ void ps3_sys_manager_power_off(void)
if (ps3_sys_manager_ops.power_off)
ps3_sys_manager_ops.power_off(ps3_sys_manager_ops.dev);
 
-   printk(KERN_EMERG "System Halted, OK to turn off power\n");
-   local_irq_disable();
-   while (1)
-   (void)0;
+   ps3_sys_manager_halt();
 }
 
 void ps3_sys_manager_restart(void)
@@ -61,8 +59,14 @@ void ps3_sys_manager_restart(void)
if (ps3_sys_manager_ops.restart)
ps3_sys_manager_ops.restart(ps3_sys_manager_ops.dev);
 
-   printk(KERN_EMERG "System Halted, OK to turn off power\n");
+   ps3_sys_manager_halt();
+}
+
+void ps3_sys_manager_halt(void)
+{
+   pr_emerg("System Halted, OK to turn off power\n");
local_irq_disable();
while (1)
-   (void)0;
+   lv1_pause(1);
 }
+
--- a/include/asm-powerpc/ps3.h
+++ b/include/asm-powerpc/ps3.h
@@ -434,8 +434,9 @@ struct ps3_sys_manager_ops {
 };
 
 void ps3_sys_manager_register_ops(const struct ps3_sys_manager_ops *ops);
-void ps3_sys_manager_power_off(void);
-void ps3_sys_manager_restart(void);
+void __noreturn ps3_sys_manager_power_off(void);
+void __noreturn ps3_sys_manager_restart(void);
+void __noreturn ps3_sys_manager_halt(void);
 
 struct ps3_prealloc {
 const char *name;

-- 



___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[patch 5/6] PS3: Sys-manager Wake-on-LAN support

2008-03-26 Thread Geoff Levand
Add Wake-on-LAN support to the PS3 system-manager.  Other OS WOL
support was introduced in PS3 system firmware 2.20.

Signed-off-by: Geoff Levand <[EMAIL PROTECTED]>
---
 drivers/ps3/ps3-sys-manager.c |   46 --
 include/asm-powerpc/ps3.h |2 +
 2 files changed, 46 insertions(+), 2 deletions(-)

--- a/drivers/ps3/ps3-sys-manager.c
+++ b/drivers/ps3/ps3-sys-manager.c
@@ -188,6 +188,7 @@ enum ps3_sys_manager_next_op {
  * controller, and bluetooth controller.
  * @PS3_SM_WAKE_RTC:
  * @PS3_SM_WAKE_RTC_ERROR:
+ * @PS3_SM_WAKE_W_O_L: Ether or wireless LAN.
  * @PS3_SM_WAKE_P_O_R: Power on reset.
  *
  * Additional wakeup sources when specifying PS3_SM_NEXT_OP_SYS_SHUTDOWN.
@@ -201,10 +202,19 @@ enum ps3_sys_manager_wake_source {
PS3_SM_WAKE_DEFAULT   = 0,
PS3_SM_WAKE_RTC   = 0x0040,
PS3_SM_WAKE_RTC_ERROR = 0x0080,
+   PS3_SM_WAKE_W_O_L = 0x0400,
PS3_SM_WAKE_P_O_R = 0x8000,
 };
 
 /**
+ * user_wake_sources - User specified wakeup sources.
+ *
+ * Logical OR of enum ps3_sys_manager_wake_source types.
+ */
+
+static u32 user_wake_sources = PS3_SM_WAKE_DEFAULT;
+
+/**
  * enum ps3_sys_manager_cmd - Command from system manager to guest.
  *
  * The guest completes the actions needed, then acks or naks the command via
@@ -619,7 +629,7 @@ static void ps3_sys_manager_final_power_
ps3_vuart_cancel_async(dev);
 
ps3_sys_manager_send_next_op(dev, PS3_SM_NEXT_OP_SYS_SHUTDOWN,
-   PS3_SM_WAKE_DEFAULT);
+   user_wake_sources);
 
ps3_sys_manager_fin(dev);
 }
@@ -652,12 +662,44 @@ static void ps3_sys_manager_final_restar
 
ps3_sys_manager_send_attr(dev, 0);
ps3_sys_manager_send_next_op(dev, PS3_SM_NEXT_OP_SYS_REBOOT,
-   PS3_SM_WAKE_DEFAULT);
+   user_wake_sources);
 
ps3_sys_manager_fin(dev);
 }
 
 /**
+ * ps3_sys_manager_get_wol - Get wake-on-lan setting.
+ */
+
+int ps3_sys_manager_get_wol(void)
+{
+   pr_debug("%s:%d\n", __func__, __LINE__);
+
+   return (user_wake_sources & PS3_SM_WAKE_W_O_L) != 0;
+}
+EXPORT_SYMBOL_GPL(ps3_sys_manager_get_wol);
+
+/**
+ * ps3_sys_manager_set_wol - Set wake-on-lan setting.
+ */
+
+void ps3_sys_manager_set_wol(int state)
+{
+   static DEFINE_MUTEX(mutex);
+
+   mutex_lock(&mutex);
+
+   pr_debug("%s:%d: %d\n", __func__, __LINE__, state);
+
+   if (state)
+   user_wake_sources |= PS3_SM_WAKE_W_O_L;
+   else
+   user_wake_sources &= ~PS3_SM_WAKE_W_O_L;
+   mutex_unlock(&mutex);
+}
+EXPORT_SYMBOL_GPL(ps3_sys_manager_set_wol);
+
+/**
  * ps3_sys_manager_work - Asynchronous read handler.
  *
  * Signaled when PS3_SM_RX_MSG_LEN_MIN bytes arrive at the vuart port.
--- a/include/asm-powerpc/ps3.h
+++ b/include/asm-powerpc/ps3.h
@@ -437,6 +437,8 @@ void ps3_sys_manager_register_ops(const 
 void __noreturn ps3_sys_manager_power_off(void);
 void __noreturn ps3_sys_manager_restart(void);
 void __noreturn ps3_sys_manager_halt(void);
+int ps3_sys_manager_get_wol(void);
+void ps3_sys_manager_set_wol(int state);
 
 struct ps3_prealloc {
 const char *name;

-- 



___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[patch 6/6] PS3: Gelic network driver Wake-on-LAN support

2008-03-26 Thread Geoff Levand
From: Masakazu Mokuno <[EMAIL PROTECTED]>

Add Wake-on-LAN support to the PS3 Gelic network driver.
Other OS WOL support was introduced in PS3 system firmware
2.20.

Signed-off-by: Masakazu Mokuno <[EMAIL PROTECTED]>
Signed-off-by: Geoff Levand <[EMAIL PROTECTED]>
---
 drivers/net/ps3_gelic_net.c |   81 
 drivers/net/ps3_gelic_net.h |   20 ++
 2 files changed, 101 insertions(+)

--- a/drivers/net/ps3_gelic_net.c
+++ b/drivers/net/ps3_gelic_net.c
@@ -1266,6 +1266,85 @@ int gelic_net_set_rx_csum(struct net_dev
return 0;
 }
 
+static void gelic_net_get_wol(struct net_device *netdev,
+ struct ethtool_wolinfo *wol)
+{
+   if (0 <= ps3_compare_firmware_version(2, 2, 0))
+   wol->supported = WAKE_MAGIC;
+   else
+   wol->supported = 0;
+
+   wol->wolopts = ps3_sys_manager_get_wol() ? wol->supported : 0;
+   memset(&wol->sopass, 0, sizeof(wol->sopass));
+}
+static int gelic_net_set_wol(struct net_device *netdev,
+struct ethtool_wolinfo *wol)
+{
+   int status;
+   struct gelic_card *card;
+   u64 v1, v2;
+
+   if (ps3_compare_firmware_version(2, 2, 0) < 0 ||
+   !capable(CAP_NET_ADMIN))
+   return -EPERM;
+
+   if (wol->wolopts & ~WAKE_MAGIC)
+   return -EINVAL;
+
+   card = netdev_card(netdev);
+   if (wol->wolopts & WAKE_MAGIC) {
+   status = lv1_net_control(bus_id(card), dev_id(card),
+GELIC_LV1_SET_WOL,
+GELIC_LV1_WOL_MAGIC_PACKET,
+0, GELIC_LV1_WOL_MP_ENABLE,
+&v1, &v2);
+   if (status) {
+   pr_info("%s: enabling WOL failed %d\n", __func__,
+   status);
+   status = -EIO;
+   goto done;
+   }
+   status = lv1_net_control(bus_id(card), dev_id(card),
+GELIC_LV1_SET_WOL,
+GELIC_LV1_WOL_ADD_MATCH_ADDR,
+0, GELIC_LV1_WOL_MATCH_ALL,
+&v1, &v2);
+   if (!status)
+   ps3_sys_manager_set_wol(1);
+   else {
+   pr_info("%s: enabling WOL filter failed %d\n",
+   __func__, status);
+   status = -EIO;
+   }
+   } else {
+   status = lv1_net_control(bus_id(card), dev_id(card),
+GELIC_LV1_SET_WOL,
+GELIC_LV1_WOL_MAGIC_PACKET,
+0, GELIC_LV1_WOL_MP_DISABLE,
+&v1, &v2);
+   if (status) {
+   pr_info("%s: disabling WOL failed %d\n", __func__,
+   status);
+   status = -EIO;
+   goto done;
+   }
+   status = lv1_net_control(bus_id(card), dev_id(card),
+GELIC_LV1_SET_WOL,
+GELIC_LV1_WOL_DELETE_MATCH_ADDR,
+0, GELIC_LV1_WOL_MATCH_ALL,
+&v1, &v2);
+   if (!status)
+   ps3_sys_manager_set_wol(0);
+   else {
+   pr_info("%s: removing WOL filter failed %d\n",
+   __func__, status);
+   status = -EIO;
+   }
+   }
+done:
+   return status;
+}
+
 static struct ethtool_ops gelic_ether_ethtool_ops = {
.get_drvinfo= gelic_net_get_drvinfo,
.get_settings   = gelic_ether_get_settings,
@@ -1274,6 +1353,8 @@ static struct ethtool_ops gelic_ether_et
.set_tx_csum= ethtool_op_set_tx_csum,
.get_rx_csum= gelic_net_get_rx_csum,
.set_rx_csum= gelic_net_set_rx_csum,
+   .get_wol= gelic_net_get_wol,
+   .set_wol= gelic_net_set_wol,
 };
 
 /**
--- a/drivers/net/ps3_gelic_net.h
+++ b/drivers/net/ps3_gelic_net.h
@@ -182,12 +182,32 @@ enum gelic_lv1_net_control_code {
GELIC_LV1_GET_ETH_PORT_STATUS   = 2,
GELIC_LV1_SET_NEGOTIATION_MODE  = 3,
GELIC_LV1_GET_VLAN_ID   = 4,
+   GELIC_LV1_SET_WOL   = 5,
GELIC_LV1_GET_CHANNEL   = 6,
GELIC_LV1_POST_WLAN_CMD = 9,
GELIC_LV1_GET_WLAN_CMD_RESULT   = 10,
GELIC_LV1_GET_WLAN_EVENT= 11
 };
 
+/* for GELIC_LV1_SET_WOL */
+enum gelic_lv1_wol_command {
+

Re: [patch 5/6] PS3: Sys-manager Wake-on-LAN support

2008-03-26 Thread Geoff Levand
Hi,

Benjamin Herrenschmidt wrote:
> On Wed, 2008-03-26 at 17:39 -0700, Geoff Levand wrote:
>> Add Wake-on-LAN support to the PS3 system-manager.  Other OS WOL
>> support was introduced in PS3 system firmware 2.20.
> 
> There is no sleep in the first place tho :-) Or does this power it up /
> boot it using WoL packets ?

Whenever that red light in ON in the front, the system is in 'stand by'
mode.  If you setup WOL before entering standby mode (by using linux
poweroff command, pressing the power button, etc.), you can wake it up:

  On ps3
  # ethtool -s eth0 wol g
  # shutdown -h now

  by remote host (eth1 is connected to the subnet which PS3 resides in)
  # etherwake -i eth1 aa:bb:cc:dd:ee:ff


I plan to send out a how-to to the ceb-oss-dev ML in the next day or so.

-Geoff

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[patch 3/6 v2] PS3: Bootwrapper improvements

2008-03-27 Thread Geoff Levand
Improve the debugging support of the PS3 bootwraper code:

 o Increase the size of the PS3 bootwrapper overlay from 256 to 512 bytes to
   allow for more debugging code in the overlay.
 o Use the dot symbol to set the size of __system_reset_overlay.  The
   assembler will then emit an error if the overlay code is too big.
 o Remove some unused instructions.
 o Update the text describing the PS3 bootwrapper overlay.
 o Add a check for null pointer writes.
 o Change hcall return value from s64.

Signed-off-by: Geoff Levand <[EMAIL PROTECTED]>
---
v2:
  o Cleanup null check code.

 arch/powerpc/boot/ps3-head.S |   25 -
 arch/powerpc/boot/ps3.c  |   23 +++
 arch/powerpc/boot/wrapper|   21 +++--
 3 files changed, 42 insertions(+), 27 deletions(-)

--- a/arch/powerpc/boot/ps3-head.S
+++ b/arch/powerpc/boot/ps3-head.S
@@ -27,8 +27,9 @@
 /*
  * __system_reset_overlay - The PS3 first stage entry.
  *
- * The bootwraper build script copies the 0x100 bytes at symbol
- * __system_reset_overlay to offset 0x100 of the rom image.
+ * The bootwraper build script copies the 512 bytes at symbol
+ * __system_reset_overlay to offset 0x100 of the rom image.  This symbol
+ * must occupy 512 or less bytes.
  *
  * The PS3 has a single processor with two threads.
  */
@@ -47,8 +48,6 @@ __system_reset_overlay:
 
mfspr   r3, 0x88
cntlzw. r3, r3
-   li  r4, 0
-   li  r5, 0
beq 1f
 
/* Secondary goes to __secondary_hold in kernel. */
@@ -57,8 +56,14 @@ __system_reset_overlay:
mtctr   r4
bctr
 
-   /* Primary delays then goes to _zimage_start in wrapper. */
 1:
+   /* Save the value at addr zero for a null pointer write check later. */
+
+   li  r4, 0
+   lwz r3, 0(r4)
+
+   /* Primary delays then goes to _zimage_start in wrapper. */
+
or  31, 31, 31 /* db16cyc */
or  31, 31, 31 /* db16cyc */
 
@@ -67,16 +72,18 @@ __system_reset_overlay:
mtctr   r4
bctr
 
+   . = __system_reset_overlay + 512
+
 /*
  * __system_reset_kernel - Place holder for the kernel reset vector.
  *
- * The bootwrapper build script copies 0x100 bytes from offset 0x100
+ * The bootwrapper build script copies 512 bytes from offset 0x100
  * of the rom image to the symbol __system_reset_kernel.  At runtime
- * the bootwrapper program copies the 0x100 bytes at __system_reset_kernel
- * to ram address 0x100.  This symbol must occupy 0x100 bytes.
+ * the bootwrapper program copies the 512 bytes at __system_reset_kernel
+ * to ram address 0x100.  This symbol must occupy 512 bytes.
  */
 
.globl __system_reset_kernel
 __system_reset_kernel:
 
-   . = __system_reset_kernel + 0x100
+   . = __system_reset_kernel + 512
--- a/arch/powerpc/boot/ps3.c
+++ b/arch/powerpc/boot/ps3.c
@@ -27,10 +27,10 @@
 #include "page.h"
 #include "ops.h"
 
-extern s64 lv1_panic(u64 in_1);
-extern s64 lv1_get_logical_partition_id(u64 *out_1);
-extern s64 lv1_get_logical_ppe_id(u64 *out_1);
-extern s64 lv1_get_repository_node_value(u64 in_1, u64 in_2, u64 in_3,
+extern int lv1_panic(u64 in_1);
+extern int lv1_get_logical_partition_id(u64 *out_1);
+extern int lv1_get_logical_ppe_id(u64 *out_1);
+extern int lv1_get_repository_node_value(u64 in_1, u64 in_2, u64 in_3,
u64 in_4, u64 in_5, u64 *out_1, u64 *out_2);
 
 #ifdef DEBUG
@@ -46,6 +46,7 @@ BSS_STACK(4096);
  * edit the command line passed to vmlinux (by setting /chosen/bootargs).
  * The buffer is put in it's own section so that tools may locate it easier.
  */
+
 static char cmdline[COMMAND_LINE_SIZE]
__attribute__((__section__("__builtin_cmdline")));
 
@@ -75,7 +76,7 @@ static void ps3_exit(void)
 
 static int ps3_repository_read_rm_size(u64 *rm_size)
 {
-   s64 result;
+   int result;
u64 lpar_id;
u64 ppe_id;
u64 v2;
@@ -114,16 +115,17 @@ void ps3_copy_vectors(void)
 {
extern char __system_reset_kernel[];
 
-   memcpy((void *)0x100, __system_reset_kernel, 0x100);
-   flush_cache((void *)0x100, 0x100);
+   memcpy((void *)0x100, __system_reset_kernel, 512);
+   flush_cache((void *)0x100, 512);
 }
 
-void platform_init(void)
+void platform_init(unsigned long null_check)
 {
const u32 heapsize = 0x100 - (u32)_end; /* 16MiB */
void *chosen;
unsigned long ft_addr;
u64 rm_size;
+   unsigned long val;
 
console_ops.write = ps3_console_write;
platform_ops.exit = ps3_exit;
@@ -151,6 +153,11 @@ void platform_init(void)
 
printf(" flat tree at 0x%lx\n\r", ft_addr);
 
+   val = *(unsigned long *)0;
+
+   if (val != null_check)
+   printf("null check failed: %lx != %lx\n\r", val, null_check);
+
((kernel_entry_t)0)(ft_addr, 0, NULL);
 
ps3_exit();
--- a/arch/powerpc/boot/wrapper
+++ b/arch/powerpc/boot/wrap

[patch] PS3: Split device setup for static vs. dynamic devices

2008-03-28 Thread Geoff Levand

From: Geert Uytterhoeven <[EMAIL PROTECTED]>

Split the device setup code in ps3_register_repository_device() in two
routines:
  1. ps3_setup_static_device(), to handle the setup of static devices in the
 PS3 repository, which can be __init,
  2. ps3_setup_dynamic_device(), to handle the setup of storage devices that
 may appear later in the PS3 repository.

This fixes a few section mismatch warnings.

Signed-off-by: Geert Uytterhoeven <[EMAIL PROTECTED]>
Signed-off-by: Geoff Levand <[EMAIL PROTECTED]>
---

Hi Paul,

Here is another one for 2.6.26 that Geert just sent me.  Please apply.

-Geoff

 arch/powerpc/platforms/ps3/device-init.c |   78 ++-
 1 file changed, 46 insertions(+), 32 deletions(-)

--- a/arch/powerpc/platforms/ps3/device-init.c
+++ b/arch/powerpc/platforms/ps3/device-init.c
@@ -499,41 +499,14 @@ static int __init ps3_register_graphics_
 }
 
 /**
- * ps3_register_repository_device - Register a device from the repositiory 
info.
- *
+ * ps3_setup_dynamic_device - Setup a dynamic device from the repository
  */
 
-static int ps3_register_repository_device(
-   const struct ps3_repository_device *repo)
+static int ps3_setup_dynamic_device(const struct ps3_repository_device *repo)
 {
int result;
 
switch (repo->dev_type) {
-   case PS3_DEV_TYPE_SB_GELIC:
-   result = ps3_setup_gelic_device(repo);
-   if (result) {
-   pr_debug("%s:%d ps3_setup_gelic_device failed\n",
-   __func__, __LINE__);
-   }
-   break;
-   case PS3_DEV_TYPE_SB_USB:
-
-   /* Each USB device has both an EHCI and an OHCI HC */
-
-   result = ps3_setup_ehci_device(repo);
-
-   if (result) {
-   pr_debug("%s:%d ps3_setup_ehci_device failed\n",
-   __func__, __LINE__);
-   }
-
-   result = ps3_setup_ohci_device(repo);
-
-   if (result) {
-   pr_debug("%s:%d ps3_setup_ohci_device failed\n",
-   __func__, __LINE__);
-   }
-   break;
case PS3_DEV_TYPE_STOR_DISK:
result = ps3_setup_storage_dev(repo, PS3_MATCH_ID_STOR_DISK);
 
@@ -572,6 +545,48 @@ static int ps3_register_repository_devic
return result;
 }
 
+/**
+ * ps3_setup_static_device - Setup a static device from the repository
+ */
+
+static int __init ps3_setup_static_device(const struct ps3_repository_device 
*repo)
+{
+   int result;
+
+   switch (repo->dev_type) {
+   case PS3_DEV_TYPE_SB_GELIC:
+   result = ps3_setup_gelic_device(repo);
+   if (result) {
+   pr_debug("%s:%d ps3_setup_gelic_device failed\n",
+   __func__, __LINE__);
+   }
+   break;
+   case PS3_DEV_TYPE_SB_USB:
+
+   /* Each USB device has both an EHCI and an OHCI HC */
+
+   result = ps3_setup_ehci_device(repo);
+
+   if (result) {
+   pr_debug("%s:%d ps3_setup_ehci_device failed\n",
+   __func__, __LINE__);
+   }
+
+   result = ps3_setup_ohci_device(repo);
+
+   if (result) {
+   pr_debug("%s:%d ps3_setup_ohci_device failed\n",
+   __func__, __LINE__);
+   }
+   break;
+
+   default:
+   return ps3_setup_dynamic_device(repo);
+   }
+
+   return result;
+}
+
 static void ps3_find_and_add_device(u64 bus_id, u64 dev_id)
 {
struct ps3_repository_device repo;
@@ -601,7 +616,7 @@ found:
pr_debug("%s:%u: device %lu:%lu found after %u retries\n",
 __func__, __LINE__, bus_id, dev_id, retries);
 
-   ps3_register_repository_device(&repo);
+   ps3_setup_dynamic_device(&repo);
return;
 }
 
@@ -905,8 +920,7 @@ static int __init ps3_register_devices(v
 
ps3_register_graphics_devices();
 
-   ps3_repository_find_devices(PS3_BUS_TYPE_SB,
-   ps3_register_repository_device);
+   ps3_repository_find_devices(PS3_BUS_TYPE_SB, ps3_setup_static_device);
 
ps3_register_sound_devices();
 


___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[patch] PS3: Fix gelic net module dependency

2008-04-09 Thread Geoff Levand
The PS3 gelic network driver depends on the wake-on-lan support
provided by the PS3 sys manager driver.  Add that dependency
to the GELIC_NET Kconfig option.

Prevents these build errors:

  ps3_gelic_net.c:1277: undefined reference to `.ps3_sys_manager_get_wol'
  ps3_gelic_net.c:1337: undefined reference to `.ps3_sys_manager_set_wol'

CC: Masakazu Mokuno <[EMAIL PROTECTED]>
CC: Jeff Garzik <[EMAIL PROTECTED]>
Signed-off-by: Geoff Levand <[EMAIL PROTECTED]>
---
Hi Paul,

This fixes an error introduced in my 2.6.26 WOL patches now
queued in your powerpc tree.  Please apply.

-Geoff

 drivers/net/Kconfig |1 +
 1 file changed, 1 insertion(+)

--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -2358,6 +2358,7 @@ config TSI108_ETH
 config GELIC_NET
tristate "PS3 Gigabit Ethernet driver"
depends on PPC_PS3
+   select PS3_SYS_MANAGER
help
  This driver supports the network device on the PS3 game
  console.  This driver has built-in support for Ethernet.

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [RFC] [PATCH] vmemmap fixes to use smaller pages

2008-04-30 Thread Geoff Levand
Benjamin Herrenschmidt wrote:
> This patch changes vmemmap to use a different region (region 0xf) of the
> address space whose page size can be dynamically configured at boot.
> 
> The problem with the current approach of always using 16M pages is that
> it's not well suited to machines that have small amounts of memory such
> as small partitions on pseries, or PS3's.
> 
> In fact, on the PS3, failure to allocate the 16M page backing vmmemmap
> tends to prevent hotplugging the HV's "additional" memory, thus limiting
> the available memory even more, from my experience down to something
> like 80M total, which makes it really not very useable.
> 
> The logic used by my match to choose the vmemmap page size is:
> 
>  - If 16M pages are available and there's 1G or more RAM at boot, use that 
> size.
>  - Else if 64K pages are available, use that
>  - Else use 4K pages
> 
> I've tested on a POWER6 (16M pages) and on an iSeries POWER3 (4K pages)
> and it seems to work fine.
> 
> However, when attempting to test on a PS3, it didn't boot.
> 
> In fact, it doesn't boot without my patch with current upstream. 


Yes, this is a know problem I am working on, related to recent
changes in bootmem.  Errors with: 'sparse_early_usemap_alloc: allocation 
failed'.


I tried
> booting 2.6.25 with a ps3_defconfig and that doesn't work neither
> (though at least when doing the later, I do get a black screen & no
> sync, like of ps3fb failed monitor detection, while with current
> upstream, I just get the last kexec messages and nothing happens).


This should work.  You are the first to report a problem with 
2.6.25.  Could you double check your build, and if you still have
trouble, put your vmlinux somewhere I can get it?


> Since the PS3 boot failures are impossible to debug unless your email is
> @sony* and you have the special magic tools, I'll let Geoff try the
> patch out.


OK, I'll try it with the upstream kernel from last week and report
within the next day or so.


-Geoff

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[patch 0/5] PS3 patches for 2.6.26

2008-04-30 Thread Geoff Levand
Paul,

This is a small set of PS3 fixup patches for 2.6.26.

  [patch 1/5] POWERPC: Fix slb.c compile warnings
  [patch 2/5] PS3: Add time include to lpm
  [patch 3/5] PS3: Make ps3_virq_setup and ps3_virq_destroy static
  [patch 4/5] PS3: Remove unsupported wakeup sources
  [patch 5/5] PS3: Update ps3_defconfig

-Geoff


-- 



___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[patch 4/5] PS3: Remove unsupported wakeup sources

2008-04-30 Thread Geoff Levand
Other OS wakeup is not supported from the IR controller,
the bluetooth controller nor the RTC.  Remove references
to these in the PS3 sys-manager source.

Signed-off-by: Geoff Levand <[EMAIL PROTECTED]>
---
 drivers/ps3/ps3-sys-manager.c |7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)

--- a/drivers/ps3/ps3-sys-manager.c
+++ b/drivers/ps3/ps3-sys-manager.c
@@ -184,10 +184,7 @@ enum ps3_sys_manager_next_op {
 
 /**
  * enum ps3_sys_manager_wake_source - Next-op wakeup source (bit position 
mask).
- * @PS3_SM_WAKE_DEFAULT: Disk insert, power button, eject button, IR
- * controller, and bluetooth controller.
- * @PS3_SM_WAKE_RTC:
- * @PS3_SM_WAKE_RTC_ERROR:
+ * @PS3_SM_WAKE_DEFAULT: Disk insert, power button, eject button.
  * @PS3_SM_WAKE_W_O_L: Ether or wireless LAN.
  * @PS3_SM_WAKE_P_O_R: Power on reset.
  *
@@ -200,8 +197,6 @@ enum ps3_sys_manager_next_op {
 enum ps3_sys_manager_wake_source {
/* version 3 */
PS3_SM_WAKE_DEFAULT   = 0,
-   PS3_SM_WAKE_RTC   = 0x0040,
-   PS3_SM_WAKE_RTC_ERROR = 0x0080,
PS3_SM_WAKE_W_O_L = 0x0400,
PS3_SM_WAKE_P_O_R = 0x8000,
 };

-- 



___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[patch 5/5] PS3: Update ps3_defconfig

2008-04-30 Thread Geoff Levand
Update ps3_defconfig.

Signed-off-by: Geoff Levand <[EMAIL PROTECTED]>
---
 arch/powerpc/configs/ps3_defconfig |  132 +++--
 1 file changed, 84 insertions(+), 48 deletions(-)

--- a/arch/powerpc/configs/ps3_defconfig
+++ b/arch/powerpc/configs/ps3_defconfig
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.25-rc6
-# Thu Mar 20 11:07:04 2008
+# Linux kernel version: 2.6.25
+# Mon Apr 28 12:39:10 2008
 #
 CONFIG_PPC64=y
 
@@ -30,6 +30,9 @@ CONFIG_GENERIC_CLOCKEVENTS=y
 CONFIG_GENERIC_HARDIRQS=y
 CONFIG_HAVE_SETUP_PER_CPU_AREA=y
 CONFIG_IRQ_PER_CPU=y
+CONFIG_STACKTRACE_SUPPORT=y
+CONFIG_TRACE_IRQFLAGS_SUPPORT=y
+CONFIG_LOCKDEP_SUPPORT=y
 CONFIG_RWSEM_XCHGADD_ALGORITHM=y
 CONFIG_ARCH_HAS_ILOG2_U32=y
 CONFIG_ARCH_HAS_ILOG2_U64=y
@@ -73,8 +76,6 @@ CONFIG_POSIX_MQUEUE=y
 CONFIG_LOG_BUF_SHIFT=17
 # CONFIG_CGROUPS is not set
 # CONFIG_GROUP_SCHED is not set
-# CONFIG_USER_SCHED is not set
-# CONFIG_CGROUP_SCHED is not set
 CONFIG_SYSFS_DEPRECATED=y
 CONFIG_SYSFS_DEPRECATED_V2=y
 # CONFIG_RELAY is not set
@@ -161,7 +162,6 @@ CONFIG_PPC_MULTIPLATFORM=y
 # CONFIG_PPC_PMAC is not set
 # CONFIG_PPC_MAPLE is not set
 # CONFIG_PPC_PASEMI is not set
-# CONFIG_PPC_CELLEB is not set
 CONFIG_PPC_PS3=y
 
 #
@@ -181,6 +181,7 @@ CONFIG_PS3_LPM=m
 CONFIG_PPC_CELL=y
 # CONFIG_PPC_CELL_NATIVE is not set
 # CONFIG_PPC_IBM_CELL_BLADE is not set
+# CONFIG_PPC_CELLEB is not set
 
 #
 # Cell Broadband Engine options
@@ -205,9 +206,9 @@ CONFIG_SPU_BASE=y
 #
 # Kernel options
 #
-# CONFIG_TICK_ONESHOT is not set
+CONFIG_TICK_ONESHOT=y
 # CONFIG_NO_HZ is not set
-# CONFIG_HIGH_RES_TIMERS is not set
+CONFIG_HIGH_RES_TIMERS=y
 CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
 # CONFIG_HZ_100 is not set
 CONFIG_HZ_250=y
@@ -221,7 +222,6 @@ CONFIG_PREEMPT_NONE=y
 CONFIG_BINFMT_ELF=y
 CONFIG_COMPAT_BINFMT_ELF=y
 CONFIG_BINFMT_MISC=y
-CONFIG_FORCE_MAX_ZONEORDER=13
 # CONFIG_IOMMU_VMERGE is not set
 CONFIG_IOMMU_HELPER=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
@@ -255,6 +255,7 @@ CONFIG_BOUNCE=y
 CONFIG_ARCH_MEMORY_PROBE=y
 # CONFIG_PPC_HAS_HASH_64K is not set
 # CONFIG_PPC_64K_PAGES is not set
+CONFIG_FORCE_MAX_ZONEORDER=13
 # CONFIG_SCHED_SMT is not set
 CONFIG_PROC_DEVICETREE=y
 # CONFIG_CMDLINE_BOOL is not set
@@ -272,7 +273,9 @@ CONFIG_GENERIC_ISA_DMA=y
 # CONFIG_PCI_SYSCALL is not set
 # CONFIG_ARCH_SUPPORTS_MSI is not set
 # CONFIG_PCCARD is not set
+CONFIG_PAGE_OFFSET=0xc000
 CONFIG_KERNEL_START=0xc000
+CONFIG_PHYSICAL_START=0x
 
 #
 # Networking
@@ -292,7 +295,7 @@ CONFIG_XFRM=y
 # CONFIG_XFRM_STATISTICS is not set
 # CONFIG_NET_KEY is not set
 CONFIG_INET=y
-# CONFIG_IP_MULTICAST is not set
+CONFIG_IP_MULTICAST=y
 # CONFIG_IP_ADVANCED_ROUTER is not set
 CONFIG_IP_FIB_HASH=y
 CONFIG_IP_PNP=y
@@ -301,6 +304,7 @@ CONFIG_IP_PNP_DHCP=y
 # CONFIG_IP_PNP_RARP is not set
 # CONFIG_NET_IPIP is not set
 # CONFIG_NET_IPGRE is not set
+# CONFIG_IP_MROUTE is not set
 # CONFIG_ARPD is not set
 # CONFIG_SYN_COOKIES is not set
 # CONFIG_INET_AH is not set
@@ -332,8 +336,10 @@ CONFIG_INET6_XFRM_MODE_TUNNEL=y
 CONFIG_INET6_XFRM_MODE_BEET=y
 # CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
 CONFIG_IPV6_SIT=y
+CONFIG_IPV6_NDISC_NODETYPE=y
 # CONFIG_IPV6_TUNNEL is not set
 # CONFIG_IPV6_MULTIPLE_TABLES is not set
+# CONFIG_IPV6_MROUTE is not set
 # CONFIG_NETWORK_SECMARK is not set
 # CONFIG_NETFILTER is not set
 # CONFIG_IP_DCCP is not set
@@ -392,8 +398,6 @@ CONFIG_IEEE80211=m
 CONFIG_IEEE80211_CRYPT_WEP=m
 CONFIG_IEEE80211_CRYPT_CCMP=m
 CONFIG_IEEE80211_CRYPT_TKIP=m
-CONFIG_IEEE80211_SOFTMAC=m
-# CONFIG_IEEE80211_SOFTMAC_DEBUG is not set
 # CONFIG_RFKILL is not set
 # CONFIG_NET_9P is not set
 
@@ -507,6 +511,7 @@ CONFIG_WLAN_80211=y
 # CONFIG_LIBERTAS is not set
 # CONFIG_USB_ZD1201 is not set
 # CONFIG_USB_NET_RNDIS_WLAN is not set
+# CONFIG_IWLWIFI_LEDS is not set
 # CONFIG_HOSTAP is not set
 
 #
@@ -578,6 +583,7 @@ CONFIG_INPUT_JOYSTICK=y
 # CONFIG_JOYSTICK_SPACEBALL is not set
 # CONFIG_JOYSTICK_STINGER is not set
 # CONFIG_JOYSTICK_TWIDJOY is not set
+# CONFIG_JOYSTICK_ZHENHUA is not set
 # CONFIG_JOYSTICK_JOYDUMP is not set
 # CONFIG_JOYSTICK_XPAD is not set
 # CONFIG_INPUT_TABLET is not set
@@ -641,6 +647,7 @@ CONFIG_SSB_POSSIBLE=y
 # Multifunction device drivers
 #
 # CONFIG_MFD_SM501 is not set
+# CONFIG_HTC_PASIC3 is not set
 
 #
 # Multimedia devices
@@ -761,10 +768,6 @@ CONFIG_SND_PS3_DEFAULT_START_DELAY=2000
 # CONFIG_SND_SOC is not set
 
 #
-# SoC Audio support for SuperH
-#
-
-#
 # ALSA SoC audio for Freescale SOCs
 #
 
@@ -849,6 +852,7 @@ CONFIG_USB_STORAGE=m
 # CONFIG_USB_STORAGE_ALAUDA is not set
 # CONFIG_USB_STORAGE_ONETOUCH is not set
 # CONFIG_USB_STORAGE_KARMA is not set
+# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
 # CONFIG_USB_LIBUSUAL is not set
 
 #
@@ -893,10 +897,6 @@ CONFIG_USB_MON=y
 # CONFIG_EDAC is not set
 # CONFIG_RTC_CLASS is not set
 # CONFIG_DMADEVICES is not set
-
-#
-# Userspace I/O
-#
 # CONFIG_UIO

[patch 2/5] PS3: Add time include to lpm

2008-04-30 Thread Geoff Levand
From: FUJITA Tomonori <[EMAIL PROTECTED]>

Add an include  statement for get_tb().

Signed-off-by: FUJITA Tomonori <[EMAIL PROTECTED]>
Signed-off-by: Geoff Levand <[EMAIL PROTECTED]>
---
drivers/ps3/ps3-lpm.c:192: error: implicit declaration of function 'get_tb'

I could not recreate this error.  asm/time.h seems to be included
from linux/module.h:

In file included from include2/asm/cputime.h:27,
 from 
/home/geoff/projects/cell/linux-2.6/include/linux/sched.h:67,
 from include2/asm/elf.h:6,
 from /home/geoff/projects/cell/linux-2.6/include/linux/elf.h:8,
 from 
/home/geoff/projects/cell/linux-2.6/include/linux/module.h:15,
 from 
/home/geoff/projects/cell/linux-2.6/drivers/ps3/ps3-lpm.c:24:
include2/asm/time.h:134

 drivers/ps3/ps3-lpm.c |1 +
 1 file changed, 1 insertion(+)

--- a/drivers/ps3/ps3-lpm.c
+++ b/drivers/ps3/ps3-lpm.c
@@ -22,6 +22,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 

-- 



___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[patch 3/5] PS3: Make ps3_virq_setup and ps3_virq_destroy static

2008-04-30 Thread Geoff Levand
From: Geert Uytterhoeven <[EMAIL PROTECTED]>

The routines ps3_virq_setup() and ps3_virq_destroy() are used
in only one file, so make them static.

Signed-off-by: Geert Uytterhoeven <[EMAIL PROTECTED]>
Signed-off-by: Geoff Levand <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/ps3/interrupt.c |6 +++---
 include/asm-powerpc/ps3.h  |3 ---
 2 files changed, 3 insertions(+), 6 deletions(-)

--- a/arch/powerpc/platforms/ps3/interrupt.c
+++ b/arch/powerpc/platforms/ps3/interrupt.c
@@ -167,8 +167,8 @@ static struct irq_chip ps3_irq_chip = {
  * ps3_private data.
  */
 
-int ps3_virq_setup(enum ps3_cpu_binding cpu, unsigned long outlet,
-   unsigned int *virq)
+static int ps3_virq_setup(enum ps3_cpu_binding cpu, unsigned long outlet,
+ unsigned int *virq)
 {
int result;
struct ps3_private *pd;
@@ -217,7 +217,7 @@ fail_create:
  * Clears chip data and calls irq_dispose_mapping() for the virq.
  */
 
-int ps3_virq_destroy(unsigned int virq)
+static int ps3_virq_destroy(unsigned int virq)
 {
const struct ps3_private *pd = get_irq_chip_data(virq);
 
--- a/include/asm-powerpc/ps3.h
+++ b/include/asm-powerpc/ps3.h
@@ -178,9 +178,6 @@ enum ps3_cpu_binding {
PS3_BINDING_CPU_1 = 1,
 };
 
-int ps3_virq_setup(enum ps3_cpu_binding cpu, unsigned long outlet,
-   unsigned int *virq);
-int ps3_virq_destroy(unsigned int virq);
 int ps3_irq_plug_setup(enum ps3_cpu_binding cpu, unsigned long outlet,
unsigned int *virq);
 int ps3_irq_plug_destroy(unsigned int virq);

-- 



___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[patch 1/5] POWERPC: Fix slb.c compile warnings

2008-04-30 Thread Geoff Levand
Arrange for a syntax check to always be done on the powerpc/mm/slb.c
DBG() macro by defining it to pr_debug() for non-debug builds. 

Also, fix these related compile warnings:

  slb.c:273: warning: format '%04x' expects type 'unsigned int', but argument 2 
has type 'long unsigned int
  slb.c:274: warning: format '%04x' expects type 'unsigned int', but argument 2 
has type 'long unsigned int'

Signed-off-by: Geoff Levand <[EMAIL PROTECTED]>
---
 arch/powerpc/mm/slb.c |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

--- a/arch/powerpc/mm/slb.c
+++ b/arch/powerpc/mm/slb.c
@@ -30,7 +30,7 @@
 #ifdef DEBUG
 #define DBG(fmt...) udbg_printf(fmt)
 #else
-#define DBG(fmt...)
+#define DBG pr_debug
 #endif
 
 extern void slb_allocate_realmode(unsigned long ea);
@@ -279,8 +279,8 @@ void slb_initialize(void)
patch_slb_encoding(slb_compare_rr_to_size,
   mmu_slb_size);
 
-   DBG("SLB: linear  LLP = %04x\n", linear_llp);
-   DBG("SLB: io  LLP = %04x\n", io_llp);
+   DBG("SLB: linear  LLP = %04lx\n", linear_llp);
+   DBG("SLB: io  LLP = %04lx\n", io_llp);
}
 
get_paca()->stab_rr = SLB_NUM_BOLTED;

-- 



___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: powerpc boot regression

2008-05-01 Thread Geoff Levand
Badari Pulavarty wrote:
> On Thu, 2008-05-01 at 15:13 +1000, Tony Breeds wrote:
>> On Tue, Apr 29, 2008 at 11:12:41PM -0700, David Miller wrote:
>> > 
>> > This commit causes bootup failures on sparc64:
>> > 
>> > commit 86f6dae1377523689bd8468fed2f2dd180fc0560
>> > Author: Yasunori Goto <[EMAIL PROTECTED]>
>> > Date:   Mon Apr 28 02:13:33 2008 -0700
>> > 
>> > memory hotplug: allocate usemap on the section with pgdat
>> 
>> 
>> 
>> 
>> We're seeing a boot failure on powerpc.  git bisect points the problem
>> at this commit.   However reverting just this one comitt doesn't fix the
>> regression.  I also needed to revert
>> 04753278769f3b6c3b79a080edb52f21d83bf6e2 (memory hotplug: register
>> section/node id to free")
>> 
>> Problem seen on power4, power5 and ps3.
> 
> I don't see the problem on my power5 machine. Can you send the
> config ? Is CONFIG_SPARSEMEM_VMEMMAP enabled ?


The bug is hit with ps3_defconfig.  It does not have
CONFIG_SPARSEMEM_VMEMMAP set.


-Geoff

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [RFC] [PATCH] vmemmap fixes to use smaller pages

2008-05-01 Thread Geoff Levand
Benjamin Herrenschmidt wrote:
> This patch changes vmemmap to use a different region (region 0xf) of the
> address space whose page size can be dynamically configured at boot.
> 
> The problem with the current approach of always using 16M pages is that
> it's not well suited to machines that have small amounts of memory such
> as small partitions on pseries, or PS3's.
> 
> In fact, on the PS3, failure to allocate the 16M page backing vmmemmap
> tends to prevent hotplugging the HV's "additional" memory, thus limiting
> the available memory even more, from my experience down to something
> like 80M total, which makes it really not very useable.
> 
> The logic used by my match to choose the vmemmap page size is:
> 
>  - If 16M pages are available and there's 1G or more RAM at boot, use that 
> size.
>  - Else if 64K pages are available, use that
>  - Else use 4K pages


It doesn't seem to cause problems on PS3, and I added it into ps3-linux.git
as other/powerpc-vmemmap-variable-page-size.diff, but I couldn't get it to
fail without the patch...
 
Could you send me your kernel .config?

-Geoff

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [RFC] [PATCH] vmemmap fixes to use smaller pages

2008-05-02 Thread Geoff Levand
Benjamin Herrenschmidt wrote:
> On Thu, 2008-05-01 at 14:46 -0700, Geoff Levand wrote:
>> 
>> It doesn't seem to cause problems on PS3, and I added it into
>> ps3-linux.git
>> as other/powerpc-vmemmap-variable-page-size.diff, but I couldn't get
>> it to
>> fail without the patch...
>>  
>> Could you send me your kernel .config?
> 
> ps3_defconfig with added vmmemap (which is disabled by default).

Well, it seems that it wasn't that I couldn't get it to fail, but
that it always fails.  add_memory() doesn't work anymore, with or
without vmmemap.

I'll look at it more next week.

-Geoff

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [patch 5/5] PS3: Update ps3_defconfig

2008-05-05 Thread Geoff Levand
Marvin wrote:
> what about adding these defaults:
>   - CONFIG_SCHED_SMT
>   - CONFIG_HUGETLBFS (needed by ibm cell sdk) 
> 
> not sure about:
>   - CONFIG_SPU_FS_64K_LS

Did you test these options?  Please let me know
your results.

-Geoff

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


PS3 patches for 2.6.27

2008-07-16 Thread Geoff Levand
Hi Ben,

Here are two more PS3 patches for 2.6.27.  Please apply.

-Geoff




___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[patch 1/2] powerpc/ps3: Add a sub-match id to ps3_system_bus

2008-07-16 Thread Geoff Levand

From: Masakazu Mokuno <[EMAIL PROTECTED]>

Add sub match id for ps3 system bus so that two different system bus
devices can be connected to a shared device.

Signed-off-by: Masakazu Mokuno <[EMAIL PROTECTED]>
Signed-off-by: Geoff Levand <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/ps3/device-init.c |1 +
 arch/powerpc/platforms/ps3/system-bus.c  |   21 ++---
 drivers/video/ps3fb.c|1 +
 include/asm-powerpc/ps3.h|7 +++
 4 files changed, 23 insertions(+), 7 deletions(-)

--- a/arch/powerpc/platforms/ps3/device-init.c
+++ b/arch/powerpc/platforms/ps3/device-init.c
@@ -486,6 +486,7 @@ static int __init ps3_register_graphics_
return -ENOMEM;
 
p->dev.match_id = PS3_MATCH_ID_GRAPHICS;
+   p->dev.match_sub_id = PS3_MATCH_SUB_ID_FB;
p->dev.dev_type = PS3_DEVICE_TYPE_IOC0;
 
result = ps3_system_bus_device_register(&p->dev);
--- a/arch/powerpc/platforms/ps3/system-bus.c
+++ b/arch/powerpc/platforms/ps3/system-bus.c
@@ -347,16 +347,23 @@ static int ps3_system_bus_match(struct d
struct ps3_system_bus_driver *drv = ps3_drv_to_system_bus_drv(_drv);
struct ps3_system_bus_device *dev = ps3_dev_to_system_bus_dev(_dev);
 
-   result = dev->match_id == drv->match_id;
+   if (!dev->match_sub_id)
+   result = dev->match_id == drv->match_id;
+   else
+   result = dev->match_sub_id == drv->match_sub_id &&
+   dev->match_id == drv->match_id;
 
if (result)
-   pr_info("%s:%d: dev=%u(%s), drv=%u(%s): match\n", __func__,
-   __LINE__, dev->match_id, dev->core.bus_id,
-   drv->match_id, drv->core.name);
+   pr_info("%s:%d: dev=%u.%u(%s), drv=%u.%u(%s): match\n",
+   __func__, __LINE__,
+   dev->match_id, dev->match_sub_id, dev->core.bus_id,
+   drv->match_id, drv->match_sub_id, drv->core.name);
else
-   pr_debug("%s:%d: dev=%u(%s), drv=%u(%s): miss\n", __func__,
-   __LINE__, dev->match_id, dev->core.bus_id,
-   drv->match_id, drv->core.name);
+   pr_debug("%s:%d: dev=%u.%u(%s), drv=%u.%u(%s): miss\n",
+   __func__, __LINE__,
+   dev->match_id, dev->match_sub_id, dev->core.bus_id,
+   drv->match_id, drv->match_sub_id, drv->core.name);
+
return result;
 }
 
--- a/drivers/video/ps3fb.c
+++ b/drivers/video/ps3fb.c
@@ -1297,6 +1297,7 @@ static int ps3fb_shutdown(struct ps3_sys
 
 static struct ps3_system_bus_driver ps3fb_driver = {
.match_id   = PS3_MATCH_ID_GRAPHICS,
+   .match_sub_id   = PS3_MATCH_SUB_ID_FB,
.core.name  = DEVICE_NAME,
.core.owner = THIS_MODULE,
.probe  = ps3fb_probe,
--- a/include/asm-powerpc/ps3.h
+++ b/include/asm-powerpc/ps3.h
@@ -337,12 +337,18 @@ enum ps3_system_bus_device_type {
PS3_DEVICE_TYPE_LPM,
 };
 
+enum ps3_match_sub_id {
+   /* for PS3_MATCH_ID_GRAPHICS */
+   PS3_MATCH_SUB_ID_FB = 1,
+};
+
 /**
  * struct ps3_system_bus_device - a device on the system bus
  */
 
 struct ps3_system_bus_device {
enum ps3_match_id match_id;
+   enum ps3_match_sub_id match_sub_id;
enum ps3_system_bus_device_type dev_type;
 
u64 bus_id;   /* SB */
@@ -371,6 +377,7 @@ int ps3_close_hv_device(struct ps3_syste
 
 struct ps3_system_bus_driver {
enum ps3_match_id match_id;
+   enum ps3_match_sub_id match_sub_id;
struct device_driver core;
int (*probe)(struct ps3_system_bus_device *);
int (*remove)(struct ps3_system_bus_device *);




___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[patch 2/2] powerpc/ps3: Update ps3_defconfig

2008-07-16 Thread Geoff Levand
Update ps3_defconfig.

Signed-off-by: Geoff Levand <[EMAIL PROTECTED]>
---
 arch/powerpc/configs/ps3_defconfig |  196 +++--
 1 file changed, 122 insertions(+), 74 deletions(-)

--- a/arch/powerpc/configs/ps3_defconfig
+++ b/arch/powerpc/configs/ps3_defconfig
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.25
-# Mon Apr 28 12:39:10 2008
+# Linux kernel version: 2.6.26
+# Wed Jul 16 13:59:24 2008
 #
 CONFIG_PPC64=y
 
@@ -14,8 +14,9 @@ CONFIG_POWER4=y
 CONFIG_TUNE_CELL=y
 CONFIG_PPC_FPU=y
 CONFIG_ALTIVEC=y
+# CONFIG_VSX is not set
 CONFIG_PPC_STD_MMU=y
-# CONFIG_PPC_MM_SLICES is not set
+CONFIG_PPC_MM_SLICES=y
 CONFIG_VIRT_CPU_ACCOUNTING=y
 CONFIG_SMP=y
 CONFIG_NR_CPUS=2
@@ -31,6 +32,7 @@ CONFIG_GENERIC_HARDIRQS=y
 CONFIG_HAVE_SETUP_PER_CPU_AREA=y
 CONFIG_IRQ_PER_CPU=y
 CONFIG_STACKTRACE_SUPPORT=y
+CONFIG_HAVE_LATENCYTOP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
 CONFIG_LOCKDEP_SUPPORT=y
 CONFIG_RWSEM_XCHGADD_ALGORITHM=y
@@ -90,6 +92,7 @@ CONFIG_CC_OPTIMIZE_FOR_SIZE=y
 CONFIG_SYSCTL=y
 # CONFIG_EMBEDDED is not set
 CONFIG_SYSCTL_SYSCALL=y
+CONFIG_SYSCTL_SYSCALL_CHECK=y
 CONFIG_KALLSYMS=y
 CONFIG_KALLSYMS_ALL=y
 CONFIG_KALLSYMS_EXTRA_PASS=y
@@ -117,12 +120,15 @@ CONFIG_HAVE_OPROFILE=y
 # CONFIG_KPROBES is not set
 CONFIG_HAVE_KPROBES=y
 CONFIG_HAVE_KRETPROBES=y
+CONFIG_HAVE_DMA_ATTRS=y
+CONFIG_USE_GENERIC_SMP_HELPERS=y
 CONFIG_PROC_PAGE_MONITOR=y
 CONFIG_SLABINFO=y
 CONFIG_RT_MUTEXES=y
 # CONFIG_TINY_SHMEM is not set
 CONFIG_BASE_SMALL=0
 CONFIG_MODULES=y
+# CONFIG_MODULE_FORCE_LOAD is not set
 CONFIG_MODULE_UNLOAD=y
 # CONFIG_MODULE_FORCE_UNLOAD is not set
 # CONFIG_MODVERSIONS is not set
@@ -132,6 +138,7 @@ CONFIG_STOP_MACHINE=y
 CONFIG_BLOCK=y
 # CONFIG_BLK_DEV_IO_TRACE is not set
 CONFIG_BLK_DEV_BSG=y
+# CONFIG_BLK_DEV_INTEGRITY is not set
 CONFIG_BLOCK_COMPAT=y
 
 #
@@ -152,13 +159,8 @@ CONFIG_CLASSIC_RCU=y
 # Platform support
 #
 CONFIG_PPC_MULTIPLATFORM=y
-# CONFIG_PPC_82xx is not set
-# CONFIG_PPC_83xx is not set
-# CONFIG_PPC_86xx is not set
 # CONFIG_PPC_PSERIES is not set
 # CONFIG_PPC_ISERIES is not set
-# CONFIG_PPC_MPC512x is not set
-# CONFIG_PPC_MPC5121 is not set
 # CONFIG_PPC_PMAC is not set
 # CONFIG_PPC_MAPLE is not set
 # CONFIG_PPC_PASEMI is not set
@@ -187,6 +189,7 @@ CONFIG_PPC_CELL=y
 # Cell Broadband Engine options
 #
 CONFIG_SPU_FS=y
+CONFIG_SPU_FS_64K_LS=y
 CONFIG_SPU_BASE=y
 # CONFIG_PQ2ADS is not set
 # CONFIG_IPIC is not set
@@ -222,6 +225,7 @@ CONFIG_PREEMPT_NONE=y
 CONFIG_BINFMT_ELF=y
 CONFIG_COMPAT_BINFMT_ELF=y
 CONFIG_BINFMT_MISC=y
+CONFIG_HUGETLB_PAGE_SIZE_VARIABLE=y
 # CONFIG_IOMMU_VMERGE is not set
 CONFIG_IOMMU_HELPER=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
@@ -248,18 +252,22 @@ CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
 # CONFIG_SPARSEMEM_VMEMMAP is not set
 CONFIG_MEMORY_HOTPLUG=y
 CONFIG_MEMORY_HOTPLUG_SPARSE=y
+CONFIG_PAGEFLAGS_EXTENDED=y
 CONFIG_SPLIT_PTLOCK_CPUS=4
 CONFIG_RESOURCES_64BIT=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
 CONFIG_ARCH_MEMORY_PROBE=y
-# CONFIG_PPC_HAS_HASH_64K is not set
+CONFIG_PPC_HAS_HASH_64K=y
 # CONFIG_PPC_64K_PAGES is not set
 CONFIG_FORCE_MAX_ZONEORDER=13
-# CONFIG_SCHED_SMT is not set
+CONFIG_SCHED_SMT=y
 CONFIG_PROC_DEVICETREE=y
 # CONFIG_CMDLINE_BOOL is not set
-# CONFIG_PM is not set
+CONFIG_EXTRA_TARGETS=""
+CONFIG_PM=y
+CONFIG_PM_DEBUG=y
+# CONFIG_PM_VERBOSE is not set
 # CONFIG_SECCOMP is not set
 CONFIG_ISA_DMA_API=y
 
@@ -273,6 +281,7 @@ CONFIG_GENERIC_ISA_DMA=y
 # CONFIG_PCI_SYSCALL is not set
 # CONFIG_ARCH_SUPPORTS_MSI is not set
 # CONFIG_PCCARD is not set
+# CONFIG_HAS_RAPIDIO is not set
 CONFIG_PAGE_OFFSET=0xc000
 CONFIG_KERNEL_START=0xc000
 CONFIG_PHYSICAL_START=0x
@@ -412,6 +421,8 @@ CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug
 CONFIG_STANDALONE=y
 CONFIG_PREVENT_FIRMWARE_BUILD=y
 CONFIG_FW_LOADER=m
+# CONFIG_FIRMWARE_IN_KERNEL is not set
+CONFIG_EXTRA_FIRMWARE=""
 # CONFIG_DEBUG_DRIVER is not set
 # CONFIG_DEBUG_DEVRES is not set
 # CONFIG_SYS_HYPERVISOR is not set
@@ -478,6 +489,7 @@ CONFIG_SCSI_WAIT_SCAN=m
 # CONFIG_SCSI_SAS_LIBSAS is not set
 # CONFIG_SCSI_SRP_ATTRS is not set
 # CONFIG_SCSI_LOWLEVEL is not set
+# CONFIG_SCSI_DH is not set
 # CONFIG_ATA is not set
 # CONFIG_MD is not set
 # CONFIG_MACINTOSH_DRIVERS is not set
@@ -533,8 +545,18 @@ CONFIG_USB_NET_MCS7830=m
 # CONFIG_USB_NET_CDC_SUBSET is not set
 # CONFIG_USB_NET_ZAURUS is not set
 # CONFIG_WAN is not set
-# CONFIG_PPP is not set
+CONFIG_PPP=m
+CONFIG_PPP_MULTILINK=y
+# CONFIG_PPP_FILTER is not set
+CONFIG_PPP_ASYNC=m
+# CONFIG_PPP_SYNC_TTY is not set
+CONFIG_PPP_DEFLATE=m
+# CONFIG_PPP_BSDCOMP is not set
+# CONFIG_PPP_MPPE is not set
+CONFIG_PPPOE=m
+# CONFIG_PPPOL2TP is not set
 # CONFIG_SLIP is not set
+CONFIG_SLHC=m
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
@@ -603,6 +625,7 @@ CONFIG_VT=y
 CONFIG_VT_CONSOLE=y
 CONFIG_HW_CONSOLE=y
 CONFIG_VT_HW

Re: going to OLS?

2008-07-18 Thread Geoff Levand
Kumar Gala wrote:
> So if your headed to OLS respond to this thread and maybe we'll have  
> an inform PPC BoF @ a pub.

I will go.

-Geoff

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: PS3 early lock-up

2008-08-04 Thread Geoff Levand
Hi,

Benjamin Herrenschmidt wrote:
>> > ps3_hpte_insert() seems to be called during system initialization with the
>> > following values of rflags:
>> >   - first call: 0x190
>> >   - initial memory: 0x194 (455 times)
>> >   - hotplug memory:
>> >   o crash: 0x115
>> >   o OK: 0x117
>> > 
>> > Do you have an idea of what's really going on?
>> 
>> Weird... Both look incorrect. In fact, it's a bit scary...
>> 
>> The one with the 7 at the end means that user space as RO access to
>> the segment (oops !) and supervisor too. The one with the 5 means
>> RO for user and RW for supervisor.
>> 
>> That is unless your HV is munging them in strange ways... I don't
>> know why LV1 is refusing a combination though.
>> 
>> As for the flags, it depends what htab_bolt_mapping() is called
>> with.
>> 
>> Do you have a backtrace ? I'm a bit lots in the mem hotswap code
>> trying to figure out where the mapping comes from..
> 
> Ah, found it... It should be ok... both the mapping of the RAM itself
> and vmemmap_populate() should be passing 
> 
>   _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_COHERENT | PP_RWXX;
> 
> Which should be 0x194.

That is 0x190.

0x194 = _PAGE_EXEC | _PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_COHERENT | PP_RWXX

> 
> Can you find out where that stupid value comes from ?

I didn't have time to look at in detail, but it fails from the
ioremap call in ps3_map_htab (arch/powerpc/platfroms/ps3/htab.c):

 htab = (__force struct hash_pte *)ioremap_flags(htab_addr, htab_size,
 pgprot_val(PAGE_READONLY_X));

IIRC, lv1 doesn't allow a read/write mapping of the htab, and that is
why I used pgprot_val(PAGE_READONLY_X) here.

I guess the value returned from pgprot_val(PAGE_READONLY_X)
changed in recent kernels, and that is what is causing the failure.

Just FYI, I put these in:

  printk("%s:%d: flags = %x\n", __func__, __LINE__, (_PAGE_ACCESSED | 
_PAGE_DIRTY | _PAGE_COHERENT | PP_RWXX));
  printk("%s:%d: flags = %x\n", __func__, __LINE__, 
pgprot_val(PAGE_READONLY_X));

and got this (and lv1_write_htab_entry failed):

  ps3_map_htab:288: flags = 190
  ps3_map_htab:289: flags = 117

-Geoff



___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: PS3 early lock-up

2008-08-05 Thread Geoff Levand
Benjamin Herrenschmidt wrote:
>> arch/powerpc/platfroms/ps3/htab.c:ps3_hpte_updatepp() uses `htab[slot].v'.
> 
> Ok, that leaves us with 2 options:
> 
>  - Change ps3_hpte_updatepp() to not read from the hash table via that
> mapping (ie, do you have an LV1 call to read an HPTE ? Do you measure
> any significant performance loss using that instead ? updatepp shouldn't
> be something called -that- often).

Yes, we have lv1_read_htab_entries().  Mokuno-san started some work to
convert to using it and removing the htab mapping:

  
http://git.kernel.org/?p=linux/kernel/git/geoff/ps3-linux-patches.git;a=blob;f=ps3-wip/ps3-htab-rework.diff;hb=HEAD

Unfortunately, this week Mokuno-san is on holiday, and I am busy preparing
for SIGGRAPH (next week).

>  - Add a way to setup HPTEs using 3 PPP bits. I'm not going to implement
> that for the main hash code just yet though (the assembly) but it might
> be possible to implement it specifically for mappings bolted. That
> means it would only work when the mapping is done early but on PS3, we
> know that the hash table is always mapped early.
> 
> The later would be a matter of taking my htab_convert_pte_flags() function
> and making it capable, when _PAGE_USER is _not_ set and _PAGE_RW is not
> set neither, to set PPP to 110.
> 
> You could do that by adding:
> 
>   if (!(pteflags & (_PAGE_USER | _PAGE_RW)))
>   rflags |= (1 << 1) | (1 << 63);
> 
> Dbl check that the resulting mapping isn't accessible to user space though.

If we can't remove the htab mapping with lv1_read_htab_entries(), I'll
look into this way.

-Geoff


___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

[patch 0/4] PS3 patches for 2.6.27

2008-08-20 Thread Geoff Levand
Hi Paul,

This is a set of PS3 fixup patches for 2.6.27.

Patch 4/4, Fix ioremap of spu shadow regs, is a bit of a hack, but I
can't think of a better way to get the needed protection bits.

 [patch 1/4] powerpc: Fix typo in pgtable-ppc64.h
 [patch 2/4] powerpc/ps3: Update ps3_defconfig
 [patch 3/4] powerpc/ps3: Rework htab to remove ioremap
 [patch 4/4] powerpc/ps3: Fix ioremap of spu shadow regs

-Geoff


-- 




___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[patch 1/4] powerpc: Fix typo in pgtable-ppc64.h

2008-08-20 Thread Geoff Levand
Fix a minor comment typo in pgtable-ppc64.h.

Signed-off-by: Geoff Levand <[EMAIL PROTECTED]>
---
 arch/powerpc/include/asm/pgtable-ppc64.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/powerpc/include/asm/pgtable-ppc64.h
+++ b/arch/powerpc/include/asm/pgtable-ppc64.h
@@ -100,7 +100,7 @@
 
 #define _PAGE_WRENABLE (_PAGE_RW | _PAGE_DIRTY)
 
-/* __pgprot defined in arch/powerpc/incliude/asm/page.h */
+/* __pgprot defined in arch/powerpc/include/asm/page.h */
 #define PAGE_NONE  __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED)
 
 #define PAGE_SHARED__pgprot(_PAGE_BASE | _PAGE_RW | _PAGE_USER)

-- 





___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[patch 2/4] powerpc/ps3: Update ps3_defconfig

2008-08-20 Thread Geoff Levand
Update ps3_defconfig.

Signed-off-by: Geoff Levand <[EMAIL PROTECTED]>
---
 arch/powerpc/configs/ps3_defconfig |  153 -
 1 file changed, 133 insertions(+), 20 deletions(-)

--- a/arch/powerpc/configs/ps3_defconfig
+++ b/arch/powerpc/configs/ps3_defconfig
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.26
-# Wed Jul 16 13:59:24 2008
+# Linux kernel version: 2.6.27-rc3
+# Wed Aug 20 08:16:53 2008
 #
 CONFIG_PPC64=y
 
@@ -92,7 +92,6 @@ CONFIG_CC_OPTIMIZE_FOR_SIZE=y
 CONFIG_SYSCTL=y
 # CONFIG_EMBEDDED is not set
 CONFIG_SYSCTL_SYSCALL=y
-CONFIG_SYSCTL_SYSCALL_CHECK=y
 CONFIG_KALLSYMS=y
 CONFIG_KALLSYMS_ALL=y
 CONFIG_KALLSYMS_EXTRA_PASS=y
@@ -118,11 +117,16 @@ CONFIG_PROFILING=y
 CONFIG_OPROFILE=m
 CONFIG_HAVE_OPROFILE=y
 # CONFIG_KPROBES is not set
+CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
+CONFIG_HAVE_IOREMAP_PROT=y
 CONFIG_HAVE_KPROBES=y
 CONFIG_HAVE_KRETPROBES=y
+CONFIG_HAVE_ARCH_TRACEHOOK=y
 CONFIG_HAVE_DMA_ATTRS=y
 CONFIG_USE_GENERIC_SMP_HELPERS=y
+# CONFIG_HAVE_CLK is not set
 CONFIG_PROC_PAGE_MONITOR=y
+# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
 CONFIG_SLABINFO=y
 CONFIG_RT_MUTEXES=y
 # CONFIG_TINY_SHMEM is not set
@@ -179,6 +183,7 @@ CONFIG_PS3_STORAGE=y
 CONFIG_PS3_DISK=y
 CONFIG_PS3_ROM=y
 CONFIG_PS3_FLASH=y
+CONFIG_OPROFILE_PS3=y
 CONFIG_PS3_LPM=m
 CONFIG_PPC_CELL=y
 # CONFIG_PPC_CELL_NATIVE is not set
@@ -218,7 +223,7 @@ CONFIG_HZ_250=y
 # CONFIG_HZ_300 is not set
 # CONFIG_HZ_1000 is not set
 CONFIG_HZ=250
-# CONFIG_SCHED_HRTICK is not set
+CONFIG_SCHED_HRTICK=y
 CONFIG_PREEMPT_NONE=y
 # CONFIG_PREEMPT_VOLUNTARY is not set
 # CONFIG_PREEMPT is not set
@@ -252,8 +257,10 @@ CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
 # CONFIG_SPARSEMEM_VMEMMAP is not set
 CONFIG_MEMORY_HOTPLUG=y
 CONFIG_MEMORY_HOTPLUG_SPARSE=y
+# CONFIG_MEMORY_HOTREMOVE is not set
 CONFIG_PAGEFLAGS_EXTENDED=y
 CONFIG_SPLIT_PTLOCK_CPUS=4
+CONFIG_MIGRATION=y
 CONFIG_RESOURCES_64BIT=y
 CONFIG_ZONE_DMA_FLAG=1
 CONFIG_BOUNCE=y
@@ -276,19 +283,17 @@ CONFIG_ISA_DMA_API=y
 #
 CONFIG_ZONE_DMA=y
 CONFIG_GENERIC_ISA_DMA=y
+CONFIG_PPC_PCI_CHOICE=y
 # CONFIG_PCI is not set
 # CONFIG_PCI_DOMAINS is not set
 # CONFIG_PCI_SYSCALL is not set
 # CONFIG_ARCH_SUPPORTS_MSI is not set
 # CONFIG_PCCARD is not set
 # CONFIG_HAS_RAPIDIO is not set
+# CONFIG_RELOCATABLE is not set
 CONFIG_PAGE_OFFSET=0xc000
 CONFIG_KERNEL_START=0xc000
 CONFIG_PHYSICAL_START=0x
-
-#
-# Networking
-#
 CONFIG_NET=y
 
 #
@@ -399,9 +404,22 @@ CONFIG_BT_HCIUSB_SCO=y
 #
 # Wireless
 #
-# CONFIG_CFG80211 is not set
+CONFIG_CFG80211=m
+CONFIG_NL80211=y
 CONFIG_WIRELESS_EXT=y
-# CONFIG_MAC80211 is not set
+# CONFIG_WIRELESS_EXT_SYSFS is not set
+CONFIG_MAC80211=m
+
+#
+# Rate control algorithm selection
+#
+CONFIG_MAC80211_RC_PID=y
+CONFIG_MAC80211_RC_DEFAULT_PID=y
+CONFIG_MAC80211_RC_DEFAULT="pid"
+# CONFIG_MAC80211_MESH is not set
+# CONFIG_MAC80211_LEDS is not set
+# CONFIG_MAC80211_DEBUGFS is not set
+# CONFIG_MAC80211_DEBUG_MENU is not set
 CONFIG_IEEE80211=m
 # CONFIG_IEEE80211_DEBUG is not set
 CONFIG_IEEE80211_CRYPT_WEP=m
@@ -420,14 +438,79 @@ CONFIG_IEEE80211_CRYPT_TKIP=m
 CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
 CONFIG_STANDALONE=y
 CONFIG_PREVENT_FIRMWARE_BUILD=y
-CONFIG_FW_LOADER=m
+CONFIG_FW_LOADER=y
 # CONFIG_FIRMWARE_IN_KERNEL is not set
 CONFIG_EXTRA_FIRMWARE=""
 # CONFIG_DEBUG_DRIVER is not set
 # CONFIG_DEBUG_DEVRES is not set
 # CONFIG_SYS_HYPERVISOR is not set
 # CONFIG_CONNECTOR is not set
-# CONFIG_MTD is not set
+CONFIG_MTD=y
+CONFIG_MTD_DEBUG=y
+CONFIG_MTD_DEBUG_VERBOSE=0
+# CONFIG_MTD_CONCAT is not set
+# CONFIG_MTD_PARTITIONS is not set
+
+#
+# User Modules And Translation Layers
+#
+# CONFIG_MTD_CHAR is not set
+CONFIG_MTD_BLKDEVS=y
+CONFIG_MTD_BLOCK=y
+# CONFIG_FTL is not set
+# CONFIG_NFTL is not set
+# CONFIG_INFTL is not set
+# CONFIG_RFD_FTL is not set
+# CONFIG_SSFDC is not set
+# CONFIG_MTD_OOPS is not set
+
+#
+# RAM/ROM/Flash chip drivers
+#
+# CONFIG_MTD_CFI is not set
+# CONFIG_MTD_JEDECPROBE is not set
+CONFIG_MTD_MAP_BANK_WIDTH_1=y
+CONFIG_MTD_MAP_BANK_WIDTH_2=y
+CONFIG_MTD_MAP_BANK_WIDTH_4=y
+# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
+# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
+# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
+CONFIG_MTD_CFI_I1=y
+CONFIG_MTD_CFI_I2=y
+# CONFIG_MTD_CFI_I4 is not set
+# CONFIG_MTD_CFI_I8 is not set
+# CONFIG_MTD_RAM is not set
+# CONFIG_MTD_ROM is not set
+# CONFIG_MTD_ABSENT is not set
+
+#
+# Mapping drivers for chip access
+#
+# CONFIG_MTD_COMPLEX_MAPPINGS is not set
+# CONFIG_MTD_PLATRAM is not set
+
+#
+# Self-contained MTD device drivers
+#
+# CONFIG_MTD_SLRAM is not set
+# CONFIG_MTD_PHRAM is not set
+CONFIG_MTD_PS3VRAM=y
+# CONFIG_MTD_MTDRAM is not set
+# CONFIG_MTD_BLOCK2MTD is not set
+
+#
+# Disk-On-Chip Device Drivers
+#
+# CONFIG_MTD_DOC2000 is not set
+# CONFIG_MTD_DOC2001 is not set
+# CONFIG_MTD_DOC2001PLUS is not set
+# CONFIG_MTD_NAND is not set
+# 

[patch 4/4] powerpc/ps3: Fix ioremap of spu shadow regs

2008-08-20 Thread Geoff Levand
From: Masakazu Mokuno <[EMAIL PROTECTED]>

Fix the ioremap of the spu shadow regs on the PS3.

The current PS3 hypervisor requires the spu shadow regs to be
mapped with the PTE page protection bits set as read-only (PP=3).
This implementation uses the low level __ioremap() to bypass the
page protection settings inforced by ioremap_flags() to get the
needed PTE bits set for the shadow regs.

This fixes a runtime failure on the PS3 introduced by the powerpc
ioremap_prot rework of commit a1f242ff460e4b50a045fa237c3c56cce9eabf83.

Signed-off-by: Masakazu Mokuno <[EMAIL PROTECTED]>
CC: Benjamin Herrenschmidt <[EMAIL PROTECTED]>
Signed-off-by: Geoff Levand <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/ps3/spu.c |   18 ++
 1 file changed, 14 insertions(+), 4 deletions(-)

--- a/arch/powerpc/platforms/ps3/spu.c
+++ b/arch/powerpc/platforms/ps3/spu.c
@@ -186,14 +186,24 @@ static void spu_unmap(struct spu *spu)
iounmap(spu_pdata(spu)->shadow);
 }
 
+/**
+ * setup_areas - Map the spu regions into the address space.
+ *
+ * The current HV requires the spu shadow regs to be mapped with the
+ * PTE page protection bits set as read-only (PP=3).  This implementation
+ * uses the low level __ioremap() to bypass the page protection settings
+ * inforced by ioremap_flags() to get the needed PTE bits set for the
+ * shadow regs.
+ */
+
 static int __init setup_areas(struct spu *spu)
 {
struct table {char* name; unsigned long addr; unsigned long size;};
+   static const unsigned long shadow_flags = _PAGE_NO_CACHE | 3;
 
-   spu_pdata(spu)->shadow = ioremap_flags(spu_pdata(spu)->shadow_addr,
-  sizeof(struct spe_shadow),
-  pgprot_val(PAGE_READONLY) |
-  _PAGE_NO_CACHE);
+   spu_pdata(spu)->shadow = __ioremap(spu_pdata(spu)->shadow_addr,
+  sizeof(struct spe_shadow),
+  shadow_flags);
if (!spu_pdata(spu)->shadow) {
pr_debug("%s:%d: ioremap shadow failed\n", __func__, __LINE__);
goto fail_ioremap;

-- 





___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[patch 3/4] powerpc/ps3: Rework htab to remove ioremap

2008-08-20 Thread Geoff Levand
From: Masakazu Mokuno <[EMAIL PROTECTED]>

Rework the PS3 htab code to remove the need to ioremap the hash table
by using the HV calls lv1_insert_htab_entry() and
lv1_read_htab_entries().

This fixes a runtime failure on the PS3 introduced by the powerpc
ioremap_prot rework of commit a1f242ff460e4b50a045fa237c3c56cce9eabf83.

Signed-off-by: Masakazu Mokuno <[EMAIL PROTECTED]>
CC: Benjamin Herrenschmidt <[EMAIL PROTECTED]>
Signed-off-by: Geoff Levand <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/ps3/htab.c  |  269 -
 arch/powerpc/platforms/ps3/setup.c |1 
 2 files changed, 91 insertions(+), 179 deletions(-)

--- a/arch/powerpc/platforms/ps3/htab.c
+++ b/arch/powerpc/platforms/ps3/htab.c
@@ -29,138 +29,75 @@
 
 #include "platform.h"
 
-#if defined(DEBUG)
-#define DBG udbg_printf
-#else
-#define DBG pr_debug
-#endif
-
-static struct hash_pte *htab;
-static unsigned long htab_addr;
-static unsigned char *bolttab;
-static unsigned char *inusetab;
-
-static DEFINE_SPINLOCK(ps3_bolttab_lock);
-
-#define debug_dump_hpte(_a, _b, _c, _d, _e, _f, _g) \
-   _debug_dump_hpte(_a, _b, _c, _d, _e, _f, _g, __func__, __LINE__)
-static void _debug_dump_hpte(unsigned long pa, unsigned long va,
-   unsigned long group, unsigned long bitmap, struct hash_pte lhpte,
-   int psize, unsigned long slot, const char* func, int line)
-{
-   DBG("%s:%d: pa = %lxh\n", func, line, pa);
-   DBG("%s:%d: lpar   = %lxh\n", func, line,
-   ps3_mm_phys_to_lpar(pa));
-   DBG("%s:%d: va = %lxh\n", func, line, va);
-   DBG("%s:%d: group  = %lxh\n", func, line, group);
-   DBG("%s:%d: bitmap = %lxh\n", func, line, bitmap);
-   DBG("%s:%d: hpte.v = %lxh\n", func, line, lhpte.v);
-   DBG("%s:%d: hpte.r = %lxh\n", func, line, lhpte.r);
-   DBG("%s:%d: psize  = %xh\n", func, line, psize);
-   DBG("%s:%d: slot   = %lxh\n", func, line, slot);
-}
+/**
+ * enum lpar_vas_id - id of LPAR virtual address space.
+ * @lpar_vas_id_current: Current selected virtual address space
+ *
+ * Identify the target LPAR address space.
+ */
+
+enum ps3_lpar_vas_id {
+   PS3_LPAR_VAS_ID_CURRENT = 0,
+};
+
+
+static DEFINE_SPINLOCK(ps3_htab_lock);
 
 static long ps3_hpte_insert(unsigned long hpte_group, unsigned long va,
unsigned long pa, unsigned long rflags, unsigned long vflags,
int psize, int ssize)
 {
-   unsigned long slot;
-   struct hash_pte lhpte;
-   int secondary = 0;
-   unsigned long result;
-   unsigned long bitmap;
+   int result;
+   u64 hpte_v, hpte_r;
+   u64 inserted_index;
+   u64 evicted_v, evicted_r;
+   u64 hpte_v_array[4], hpte_rs;
unsigned long flags;
-   unsigned long p_pteg, s_pteg, b_index, b_mask, cb, ci;
-
-   vflags &= ~HPTE_V_SECONDARY; /* this bit is ignored */
+   long ret = -1;
 
-   lhpte.v = hpte_encode_v(va, psize, MMU_SEGSIZE_256M) |
-   vflags | HPTE_V_VALID;
-   lhpte.r = hpte_encode_r(ps3_mm_phys_to_lpar(pa), psize) | rflags;
-
-   p_pteg = hpte_group / HPTES_PER_GROUP;
-   s_pteg = ~p_pteg & htab_hash_mask;
-
-   spin_lock_irqsave(&ps3_bolttab_lock, flags);
+   /*
+* lv1_insert_htab_entry() will search for victim
+* entry in both primary and secondary pte group
+*/
+   vflags &= ~HPTE_V_SECONDARY;
 
-   BUG_ON(bolttab[p_pteg] == 0xff && bolttab[s_pteg] == 0xff);
+   hpte_v = hpte_encode_v(va, psize, ssize) | vflags | HPTE_V_VALID;
+   hpte_r = hpte_encode_r(ps3_mm_phys_to_lpar(pa), psize) | rflags;
 
-   bitmap = (inusetab[p_pteg] << 8) | inusetab[s_pteg];
+   spin_lock_irqsave(&ps3_htab_lock, flags);
 
-   if (bitmap == 0x) {
-   /*
-* PTEG is full. Search for victim.
-*/
-   bitmap &= ~((bolttab[p_pteg] << 8) | bolttab[s_pteg]);
-   do {
-   ci = mftb() & 15;
-   cb = 0x8000UL >> ci;
-   } while ((cb & bitmap) == 0);
-   } else {
-   /*
-* search free slot in hardware order
-*  [primary]   0, 2, 4, 6, 1, 3, 5, 7
-*  [secondary] 0, 2, 4, 6, 1, 3, 5, 7
-*/
-   for (ci = 0; ci < HPTES_PER_GROUP; ci += 2) {
-   cb = 0x8000UL >> ci;
-   if ((cb & bitmap) == 0)
-   goto found;
-   }
-   for (ci = 1; ci < HPTES_PER_GROUP; ci += 2) {
-   cb = 0x8000UL >> ci;
-   if ((cb & bitmap) == 0)
-   goto found;
-   }
-   for (ci = HPTES_PER_GROUP; ci &l

[patch] powerpc/ps3: Replace the flip_ctl logic in ps3av and ps3fb by a mutex

2008-10-30 Thread Geoff Levand

From: Geert Uytterhoeven <[EMAIL PROTECTED]>

Introduce ps3_gpu_mutex to synchronizes GPU-related operations, like:
  - invoking the L1GPU_CONTEXT_ATTRIBUTE_FB_BLIT command using the
lv1_gpu_context_attribute() hypervisor call,
  - handling the PS3AV_CID_AVB_PARAM packet in the PS3 A/V Settings driver.

Signed-off-by: Geert Uytterhoeven <[EMAIL PROTECTED]>
Signed-off-by: Geoff Levand <[EMAIL PROTECTED]>
---
This was submitted to the linux-fbdev-devel and cbe-oss-dev MLs
for review some time ago with no comments so far.

Please consider for 2.6.29.

-Geoff

 arch/powerpc/include/asm/ps3.h |3 +++
 arch/powerpc/include/asm/ps3av.h   |4 
 arch/powerpc/platforms/ps3/setup.c |4 
 drivers/ps3/ps3av.c|   20 
 drivers/ps3/ps3av_cmd.c|4 ++--
 drivers/video/ps3fb.c  |   17 +
 6 files changed, 14 insertions(+), 38 deletions(-)

--- a/arch/powerpc/include/asm/ps3.h
+++ b/arch/powerpc/include/asm/ps3.h
@@ -516,4 +516,7 @@ void ps3_sync_irq(int node);
 u32 ps3_get_hw_thread_id(int cpu);
 u64 ps3_get_spe_id(void *arg);
 
+/* mutex synchronizing GPU accesses and video mode changes */
+extern struct mutex ps3_gpu_mutex;
+
 #endif
--- a/arch/powerpc/include/asm/ps3av.h
+++ b/arch/powerpc/include/asm/ps3av.h
@@ -740,8 +740,4 @@ extern int ps3av_audio_mute(int);
 extern int ps3av_audio_mute_analog(int);
 extern int ps3av_dev_open(void);
 extern int ps3av_dev_close(void);
-extern void ps3av_register_flip_ctl(void (*flip_ctl)(int on, void *data),
-   void *flip_data);
-extern void ps3av_flip_ctl(int on);
-
 #endif /* _ASM_POWERPC_PS3AV_H_ */
--- a/arch/powerpc/platforms/ps3/setup.c
+++ b/arch/powerpc/platforms/ps3/setup.c
@@ -42,6 +42,10 @@
 #define DBG pr_debug
 #endif
 
+/* mutex synchronizing GPU accesses and video mode changes */
+DEFINE_MUTEX(ps3_gpu_mutex);
+EXPORT_SYMBOL_GPL(ps3_gpu_mutex);
+
 #if !defined(CONFIG_SMP)
 static void smp_send_stop(void) {}
 #endif
--- a/drivers/ps3/ps3av.c
+++ b/drivers/ps3/ps3av.c
@@ -59,8 +59,6 @@ static struct ps3av {
struct ps3av_reply_hdr reply_hdr;
u8 raw[PS3AV_BUF_SIZE];
} recv_buf;
-   void (*flip_ctl)(int on, void *data);
-   void *flip_data;
 } *ps3av;
 
 /* color space */
@@ -939,24 +937,6 @@ int ps3av_audio_mute(int mute)
 
 EXPORT_SYMBOL_GPL(ps3av_audio_mute);
 
-void ps3av_register_flip_ctl(void (*flip_ctl)(int on, void *data),
-void *flip_data)
-{
-   mutex_lock(&ps3av->mutex);
-   ps3av->flip_ctl = flip_ctl;
-   ps3av->flip_data = flip_data;
-   mutex_unlock(&ps3av->mutex);
-}
-EXPORT_SYMBOL_GPL(ps3av_register_flip_ctl);
-
-void ps3av_flip_ctl(int on)
-{
-   mutex_lock(&ps3av->mutex);
-   if (ps3av->flip_ctl)
-   ps3av->flip_ctl(on, ps3av->flip_data);
-   mutex_unlock(&ps3av->mutex);
-}
-
 static int ps3av_probe(struct ps3_system_bus_device *dev)
 {
int res;
--- a/drivers/ps3/ps3av_cmd.c
+++ b/drivers/ps3/ps3av_cmd.c
@@ -864,7 +864,7 @@ int ps3av_cmd_avb_param(struct ps3av_pkt
 {
int res;
 
-   ps3av_flip_ctl(0);  /* flip off */
+   mutex_lock(&ps3_gpu_mutex);
 
/* avb packet */
res = ps3av_do_pkt(PS3AV_CID_AVB_PARAM, send_len, sizeof(*avb),
@@ -878,7 +878,7 @@ int ps3av_cmd_avb_param(struct ps3av_pkt
 res);
 
   out:
-   ps3av_flip_ctl(1);  /* flip on */
+   mutex_unlock(&ps3_gpu_mutex);
return res;
 }
 
--- a/drivers/video/ps3fb.c
+++ b/drivers/video/ps3fb.c
@@ -460,12 +460,16 @@ static void ps3fb_sync_image(struct devi
line_length |= (u64)src_line_length << 32;
 
src_offset += GPU_FB_START;
+
+   mutex_lock(&ps3_gpu_mutex);
status = lv1_gpu_context_attribute(ps3fb.context_handle,
   L1GPU_CONTEXT_ATTRIBUTE_FB_BLIT,
   dst_offset, GPU_IOIF + src_offset,
   L1GPU_FB_BLIT_WAIT_FOR_COMPLETION |
   (width << 16) | height,
   line_length);
+   mutex_unlock(&ps3_gpu_mutex);
+
if (status)
dev_err(dev,
"%s: lv1_gpu_context_attribute FB_BLIT failed: %d\n",
@@ -784,15 +788,6 @@ static int ps3fb_wait_for_vsync(u32 crtc
return 0;
 }
 
-static void ps3fb_flip_ctl(int on, void *data)
-{
-   struct ps3fb_priv *priv = data;
-   if (on)
-   atomic_dec_if_positive(&priv->ext_flip);
-   else
-   atomic_inc(&priv->ext_flip);
-}
-
 
 /*
  * ioctl
@@ -1228,7 +1223,6 @@ static int __devinit ps3fb_probe(struct 
}
 
ps3fb.task = task;
-   ps3av_register_flip_ctl(ps3fb_flip_ctl, &ps3fb

[patch] powerpc/ps3: Fix memory leak in device init

2008-10-30 Thread Geoff Levand

From: Masakazu Mokuno <[EMAIL PROTECTED]>

Free dynamically allocated device data structures when device registration
fails.  This fixes memory leakage when the registration fails.

Signed-off-by: Masakazu Mokuno <[EMAIL PROTECTED]>
Signed-off-by: Geoff Levand <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/ps3/device-init.c |   29 -
 1 file changed, 24 insertions(+), 5 deletions(-)

--- a/arch/powerpc/platforms/ps3/device-init.c
+++ b/arch/powerpc/platforms/ps3/device-init.c
@@ -314,11 +314,17 @@ static int __init ps3_setup_vuart_device
 
result = ps3_system_bus_device_register(&p->dev);
 
-   if (result)
+   if (result) {
pr_debug("%s:%d ps3_system_bus_device_register failed\n",
__func__, __LINE__);
-
+   goto fail_device_register;
+   }
pr_debug(" <- %s:%d\n", __func__, __LINE__);
+   return 0;
+
+fail_device_register:
+   kfree(p);
+   pr_debug(" <- %s:%d fail\n", __func__, __LINE__);
return result;
 }
 
@@ -463,11 +469,17 @@ static int __init ps3_register_sound_dev
 
result = ps3_system_bus_device_register(&p->dev);
 
-   if (result)
+   if (result) {
pr_debug("%s:%d ps3_system_bus_device_register failed\n",
__func__, __LINE__);
-
+   goto fail_device_register;
+   }
pr_debug(" <- %s:%d\n", __func__, __LINE__);
+   return 0;
+
+fail_device_register:
+   kfree(p);
+   pr_debug(" <- %s:%d failed\n", __func__, __LINE__);
return result;
 }
 
@@ -491,11 +503,18 @@ static int __init ps3_register_graphics_
 
result = ps3_system_bus_device_register(&p->dev);
 
-   if (result)
+   if (result) {
pr_debug("%s:%d ps3_system_bus_device_register failed\n",
__func__, __LINE__);
+   goto fail_device_register;
+   }
 
pr_debug(" <- %s:%d\n", __func__, __LINE__);
+   return 0;
+
+fail_device_register:
+   kfree(p);
+   pr_debug(" <- %s:%d failed\n", __func__, __LINE__);
return result;
 }
 

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] ps3: ps3-lpm.c compile fix

2008-11-03 Thread Geoff Levand
Alexey Dobriyan wrote:
> On Mon, Nov 03, 2008 at 09:20:28AM +0100, Geert Uytterhoeven wrote:
>> On Sun, 2 Nov 2008, Alexey Dobriyan wrote:
>> > drivers/ps3/ps3-lpm.c:838: error: implicit declaration of function 
>> > 'get_hard_smp_processor_id'
>> > 
>> > Signed-off-by: Alexey Dobriyan <[EMAIL PROTECTED]>


Acked-by: Geoff Levand <[EMAIL PROTECTED]>


>> > --- a/drivers/ps3/ps3-lpm.c
>> > +++ b/drivers/ps3/ps3-lpm.c
>> > @@ -22,6 +22,7 @@
>> >  #include 
>> >  #include 
>> >  #include 
>> > +#include 
>> 
>> #include ?
> 
> Nope, everybody else uses asm/smp.h.

That doesn't quite seem like enough reason for me.

Looking at the source, I see linux/smp.h only includes
asm/smp.h when CONFIG_SMP=y, so we at least need to
include asm/smp.h to get the get_hard_smp_processor_id
def when CONFIG_SMP=n.

-Geoff

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: RTC problem in PS3

2008-12-02 Thread Geoff Levand
Hi,

Marvin wrote:
> forward to a better place...
> 
> On Sunday 16 November 2008 23:44:50 Fabiano Manoel de Andrade wrote:
>>  Hi I've compiled the latest version of linux kernel (2.6.27.6) in my
>> PS3 running debian and get a warning message listed here
>>
>>  Setting the system clock.
>>  Cannot access the Hardware Clock via any known method.
>>  Use the --debug option to see the details of our search for an access
>> method. * Unable to set System Clock to: Sun Nov 16 20:33:06 UTC 2008
>>
>>
>>  The problem can be reproduced with the commands
>>
>>  # hwclock --debug
>>  hwclock from util-linux-ng 2.13.1.1
>>  hwclock: Open of /dev/rtc failed, errno=2: No such file or directory.
>>  No usable clock interface found.
>>  Cannot access the Hardware Clock via any known method.
>>  # ls -l /dev/rtc*
>>  ls: cannot access /dev/rtc*: No such file or directory
>>
>>  Loading the rtc-ppc module solve the problem, but after restart
>> the system I still have the problem. Looking at kernel config I change the
>> rtc-ppc to be build into kernel and this solve totally the problem. So the
>> ps3_defconfig must set the rtc-ppc to be build into kernel.

This is do to a bug in the rtc-ppc driver.  It is not PS3 specific, but
will affect all powerpc machines that use the rtc-ppc driver and have it
built as a loadable module.

Normally, udev will automatically load drivers for the devices present in the
system.  The info udev uses to autoload the driver is not provided by the
rtc-ppc driver, so when it is build as a loadable module udev can't figure
out which driver to load.

Here is some discussion Geert and I had:

 Original Message 
On Tue, 2 Dec 2008, Geert Uytterhoeven wrote:
> On Mon, 1 Dec 2008, Geoff Levand wrote:
> > There is a similar problem when the new generic ppc-rtc driver is
> > built as a module and the startup scripts try to access the RTC.
> 
> Add it to /etc/modules? But then it'll be loaded on all platforms. But as it
> uses the ppc_md infrastructure, that may actually be the right thing to do on
> all PPC platforms.
> 
> However, ppc-rtc looks like a strange driver: it creates a platform_device, 
> but
> doesn't contain the corresponding platform_driver.
> Ah, it creates the platform_device just to be able to pass a struct device to
> rtc_device_register().
> 
> But as all of this is done from module_init(), there's no opportunity for
> autoloading

It can be solved...

If the creation of the "ppc-rtc" platform device would be moved to builtin
core code (e.g. arch/powerpc/kernel/setup-common.c?), and drivers/rtc/rtc-ppc.c
would become a real platform driver that binds to the "ppc-rtc" platform
device, then it would be autoloaded by udev.

-Geoff

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[patch 0/3] PS3 patches for 2.6.29

2008-12-03 Thread Geoff Levand
Hi Paul,

Here is a small set of patches for 2.6.29.  Please consider
them for your next branch.

 [patch 1/3] powerpc: Fix typo in pgtable-ppc64.h
 [patch 2/3] powerpc/ps3: Quiet dmesg output
 [patch 3/3] powerpc/ps3: Add sub-match id modalias support

-Geoff


-- 



___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[patch 1/3] powerpc: Fix typo in pgtable-ppc64.h

2008-12-03 Thread Geoff Levand
Fix a minor comment typo in pgtable-ppc64.h.

Signed-off-by: Geoff Levand <[EMAIL PROTECTED]>
---
 arch/powerpc/include/asm/pgtable-ppc64.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/powerpc/include/asm/pgtable-ppc64.h
+++ b/arch/powerpc/include/asm/pgtable-ppc64.h
@@ -100,7 +100,7 @@
 
 #define _PAGE_WRENABLE (_PAGE_RW | _PAGE_DIRTY)
 
-/* __pgprot defined in arch/powerpc/incliude/asm/page.h */
+/* __pgprot defined in arch/powerpc/include/asm/page.h */
 #define PAGE_NONE  __pgprot(_PAGE_PRESENT | _PAGE_ACCESSED)
 
 #define PAGE_SHARED__pgprot(_PAGE_BASE | _PAGE_RW | _PAGE_USER)

-- 




___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[patch 2/3] powerpc/ps3: Quiet dmesg output

2008-12-03 Thread Geoff Levand
Change the debug message in dma_sb_region_create() from
pr_info() to DBG() to quiet the dmesg output.

Signed-off-by: Geoff Levand <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/ps3/mm.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/powerpc/platforms/ps3/mm.c
+++ b/arch/powerpc/platforms/ps3/mm.c
@@ -649,7 +649,7 @@ static int dma_sb_region_create(struct p
 {
int result;
 
-   pr_info(" -> %s:%d:\n", __func__, __LINE__);
+   DBG(" -> %s:%d:\n", __func__, __LINE__);
 
BUG_ON(!r);
 

-- 



___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[patch 3/3] powerpc/ps3: Add sub-match id modalias support

2008-12-03 Thread Geoff Levand
From: Geert Uytterhoeven <[EMAIL PROTECTED]>

commit 059e4938f8b060b10c4352e6c45739473bc73267 ("powerpc/ps3: Add a sub-match
id to ps3_system_bus") forgot to update the module alias support:
  - Add the sub-match ids to the module aliases, so udev can distinguish
between different types of sub-devices.
  - Rename PS3_MODULE_ALIAS_GRAPHICS to PS3_MODULE_ALIAS_GPU_FB, as ps3fb
binds to the "FB" sub-device.

Signed-off-by: Geert Uytterhoeven <[EMAIL PROTECTED]>
Signed-off-by: Geoff Levand <[EMAIL PROTECTED]>
---
 arch/powerpc/include/asm/ps3.h   |   57 +++
 arch/powerpc/platforms/ps3/device-init.c |4 +-
 arch/powerpc/platforms/ps3/system-bus.c  |   10 +++--
 drivers/video/ps3fb.c|6 +--
 4 files changed, 39 insertions(+), 38 deletions(-)

--- a/arch/powerpc/include/asm/ps3.h
+++ b/arch/powerpc/include/asm/ps3.h
@@ -305,30 +305,34 @@ static inline const char* ps3_result(int
 /* system bus routines */
 
 enum ps3_match_id {
-   PS3_MATCH_ID_EHCI   = 1,
-   PS3_MATCH_ID_OHCI   = 2,
-   PS3_MATCH_ID_GELIC  = 3,
-   PS3_MATCH_ID_AV_SETTINGS= 4,
-   PS3_MATCH_ID_SYSTEM_MANAGER = 5,
-   PS3_MATCH_ID_STOR_DISK  = 6,
-   PS3_MATCH_ID_STOR_ROM   = 7,
-   PS3_MATCH_ID_STOR_FLASH = 8,
-   PS3_MATCH_ID_SOUND  = 9,
-   PS3_MATCH_ID_GRAPHICS   = 10,
-   PS3_MATCH_ID_LPM= 11,
-};
-
-#define PS3_MODULE_ALIAS_EHCI   "ps3:1"
-#define PS3_MODULE_ALIAS_OHCI   "ps3:2"
-#define PS3_MODULE_ALIAS_GELIC  "ps3:3"
-#define PS3_MODULE_ALIAS_AV_SETTINGS"ps3:4"
-#define PS3_MODULE_ALIAS_SYSTEM_MANAGER "ps3:5"
-#define PS3_MODULE_ALIAS_STOR_DISK  "ps3:6"
-#define PS3_MODULE_ALIAS_STOR_ROM   "ps3:7"
-#define PS3_MODULE_ALIAS_STOR_FLASH "ps3:8"
-#define PS3_MODULE_ALIAS_SOUND  "ps3:9"
-#define PS3_MODULE_ALIAS_GRAPHICS   "ps3:10"
-#define PS3_MODULE_ALIAS_LPM"ps3:11"
+   PS3_MATCH_ID_EHCI   = 1,
+   PS3_MATCH_ID_OHCI   = 2,
+   PS3_MATCH_ID_GELIC  = 3,
+   PS3_MATCH_ID_AV_SETTINGS= 4,
+   PS3_MATCH_ID_SYSTEM_MANAGER = 5,
+   PS3_MATCH_ID_STOR_DISK  = 6,
+   PS3_MATCH_ID_STOR_ROM   = 7,
+   PS3_MATCH_ID_STOR_FLASH = 8,
+   PS3_MATCH_ID_SOUND  = 9,
+   PS3_MATCH_ID_GPU= 10,
+   PS3_MATCH_ID_LPM= 11,
+};
+
+enum ps3_match_sub_id {
+   PS3_MATCH_SUB_ID_GPU_FB = 1,
+};
+
+#define PS3_MODULE_ALIAS_EHCI  "ps3:1:0"
+#define PS3_MODULE_ALIAS_OHCI  "ps3:2:0"
+#define PS3_MODULE_ALIAS_GELIC "ps3:3:0"
+#define PS3_MODULE_ALIAS_AV_SETTINGS   "ps3:4:0"
+#define PS3_MODULE_ALIAS_SYSTEM_MANAGER"ps3:5:0"
+#define PS3_MODULE_ALIAS_STOR_DISK "ps3:6:0"
+#define PS3_MODULE_ALIAS_STOR_ROM  "ps3:7:0"
+#define PS3_MODULE_ALIAS_STOR_FLASH"ps3:8:0"
+#define PS3_MODULE_ALIAS_SOUND "ps3:9:0"
+#define PS3_MODULE_ALIAS_GPU_FB"ps3:10:1"
+#define PS3_MODULE_ALIAS_LPM   "ps3:11:0"
 
 enum ps3_system_bus_device_type {
PS3_DEVICE_TYPE_IOC0 = 1,
@@ -337,11 +341,6 @@ enum ps3_system_bus_device_type {
PS3_DEVICE_TYPE_LPM,
 };
 
-enum ps3_match_sub_id {
-   /* for PS3_MATCH_ID_GRAPHICS */
-   PS3_MATCH_SUB_ID_FB = 1,
-};
-
 /**
  * struct ps3_system_bus_device - a device on the system bus
  */
--- a/arch/powerpc/platforms/ps3/device-init.c
+++ b/arch/powerpc/platforms/ps3/device-init.c
@@ -497,8 +497,8 @@ static int __init ps3_register_graphics_
if (!p)
return -ENOMEM;
 
-   p->dev.match_id = PS3_MATCH_ID_GRAPHICS;
-   p->dev.match_sub_id = PS3_MATCH_SUB_ID_FB;
+   p->dev.match_id = PS3_MATCH_ID_GPU;
+   p->dev.match_sub_id = PS3_MATCH_SUB_ID_GPU_FB;
p->dev.dev_type = PS3_DEVICE_TYPE_IOC0;
 
result = ps3_system_bus_device_register(&p->dev);
--- a/arch/powerpc/platforms/ps3/system-bus.c
+++ b/arch/powerpc/platforms/ps3/system-bus.c
@@ -175,7 +175,7 @@ int ps3_open_hv_device(struct ps3_system
return ps3_open_hv_device_sb(dev);
 
case PS3_MATCH_ID_SOUND:
-   case PS3_MATCH_ID_GRAPHICS:
+   case PS3_MATCH_ID_GPU:
return ps3_open_hv_device_gpu(dev);
 
case PS3_MATCH_ID_AV_SETTINGS:
@@ -213,7 +213,7 @@ int ps3_close_hv_device(struct ps3_syste
return ps3_close_hv_device_sb(dev);
 
case PS3_MATCH_ID_SOUND:
-   case PS3_MATCH_ID_GRAPHICS:
+   case PS3_MATCH_ID_GPU:
return ps3_close_hv_device_gpu(dev);
 
case PS3_MATCH_ID_AV_SETTING

[patch 2/6] powerpc/ps3: Add modalias support to the ps3vram driver

2009-01-06 Thread Geoff Levand
From: Geert Uytterhoeven 

Update ps3vram driver to use the new ps3 three id modalias support.

Signed-off-by: Geert Uytterhoeven 
Signed-off-by: Geoff Levand 
---
 arch/powerpc/include/asm/ps3.h |1 +
 drivers/mtd/devices/ps3vram.c  |1 +
 2 files changed, 2 insertions(+)

--- a/arch/powerpc/include/asm/ps3.h
+++ b/arch/powerpc/include/asm/ps3.h
@@ -333,6 +333,7 @@ enum ps3_match_sub_id {
 #define PS3_MODULE_ALIAS_STOR_FLASH"ps3:8:0"
 #define PS3_MODULE_ALIAS_SOUND "ps3:9:0"
 #define PS3_MODULE_ALIAS_GPU_FB"ps3:10:1"
+#define PS3_MODULE_ALIAS_GPU_RAMDISK   "ps3:10:2"
 #define PS3_MODULE_ALIAS_LPM   "ps3:11:0"
 
 enum ps3_system_bus_device_type {
--- a/drivers/mtd/devices/ps3vram.c
+++ b/drivers/mtd/devices/ps3vram.c
@@ -774,3 +774,4 @@ module_exit(ps3vram_exit);
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Jim Paris ");
 MODULE_DESCRIPTION("MTD driver for PS3 video RAM");
+MODULE_ALIAS(PS3_MODULE_ALIAS_GPU_RAMDISK);






___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[patch 5/6] mtd/ps3vram: Use kernel types

2009-01-06 Thread Geoff Levand
Replace the use of stdint.h types with kernel types
in the ps3vram driver.

Signed-off-by: Geoff Levand 
---
 drivers/mtd/devices/ps3vram.c |   56 ++
 1 file changed, 30 insertions(+), 26 deletions(-)

--- a/drivers/mtd/devices/ps3vram.c
+++ b/drivers/mtd/devices/ps3vram.c
@@ -65,15 +65,15 @@ struct ps3vram_cache {
 };
 
 struct ps3vram_priv {
-   uint64_t memory_handle;
-   uint64_t context_handle;
-   uint8_t *base;
-   uint32_t *ctrl;
-   uint32_t *reports;
-   uint8_t *xdr_buf;
+   u64 memory_handle;
+   u64 context_handle;
+   u32 *ctrl;
+   u32 *reports;
+   u8 *base;
+   u8 *xdr_buf;
 
-   uint32_t *fifo_base;
-   uint32_t *fifo_ptr;
+   u32 *fifo_base;
+   u32 *fifo_ptr;
 
struct device *dev;
struct ps3vram_cache cache;
@@ -92,7 +92,7 @@ char *size = "256M-";
 module_param(size, charp, 0);
 MODULE_PARM_DESC(size, "memory size");
 
-static inline uint32_t *ps3vram_get_notifier(uint32_t *reports, int notifier)
+static u32 *ps3vram_get_notifier(u32 *reports, int notifier)
 {
return (void *) reports +
DMA_NOTIFIER_OFFSET_BASE +
@@ -102,8 +102,9 @@ static inline uint32_t *ps3vram_get_noti
 static void ps3vram_notifier_reset(struct mtd_info *mtd)
 {
int i;
+
struct ps3vram_priv *priv = mtd->priv;
-   uint32_t *notify = ps3vram_get_notifier(priv->reports, NOTIFIER);
+   u32 *notify = ps3vram_get_notifier(priv->reports, NOTIFIER);
for (i = 0; i < 4; i++)
notify[i] = 0x;
 }
@@ -111,7 +112,7 @@ static void ps3vram_notifier_reset(struc
 static int ps3vram_notifier_wait(struct mtd_info *mtd, int timeout_ms)
 {
struct ps3vram_priv *priv = mtd->priv;
-   uint32_t *notify = ps3vram_get_notifier(priv->reports, NOTIFIER);
+   u32 *notify = ps3vram_get_notifier(priv->reports, NOTIFIER);
 
timeout_ms *= 1000;
 
@@ -155,13 +156,13 @@ static int ps3vram_wait_ring(struct mtd_
return 0;
 }
 
-static inline void ps3vram_out_ring(struct ps3vram_priv *priv, uint32_t data)
+static void ps3vram_out_ring(struct ps3vram_priv *priv, u32 data)
 {
*(priv->fifo_ptr)++ = data;
 }
 
-static inline void ps3vram_begin_ring(struct ps3vram_priv *priv, uint32_t chan,
- uint32_t tag, uint32_t size)
+static void ps3vram_begin_ring(struct ps3vram_priv *priv, u32 chan,
+ u32 tag, u32 size)
 {
ps3vram_out_ring(priv, (size << 18) | (chan << 13) | tag);
 }
@@ -194,7 +195,7 @@ static void ps3vram_fire_ring(struct mtd
mutex_lock(&ps3_gpu_mutex);
 
priv->ctrl[CTRL_PUT] = FIFO_BASE + FIFO_OFFSET +
-   (priv->fifo_ptr - priv->fifo_base) * sizeof(uint32_t);
+   (priv->fifo_ptr - priv->fifo_base) * sizeof(u32);
 
/* asking the HV for a blit will kick the fifo */
status = lv1_gpu_context_attribute(priv->context_handle,
@@ -204,8 +205,8 @@ static void ps3vram_fire_ring(struct mtd
dev_err(priv->dev, "%s:%d: lv1_gpu_context_attribute failed\n",
__func__, __LINE__);
 
-   if ((priv->fifo_ptr - priv->fifo_base) * sizeof(uint32_t) >
-   FIFO_SIZE - 1024) {
+   if ((priv->fifo_ptr - priv->fifo_base) * sizeof(u32) >
+   FIFO_SIZE - 1024) {
dev_dbg(priv->dev, "%s:%d: fifo full, rewinding\n", __func__,
__LINE__);
ps3vram_wait_ring(mtd, 200);
@@ -538,10 +539,13 @@ static int ps3vram_write(struct mtd_info
 static int __devinit ps3vram_probe(struct ps3_system_bus_device *dev)
 {
struct ps3vram_priv *priv;
-   uint64_t status;
-   uint64_t ddr_lpar, ctrl_lpar, info_lpar, reports_lpar;
-   int64_t ddr_size;
-   uint64_t reports_size;
+   int status;
+   u64 ddr_lpar;
+   u64 ctrl_lpar;
+   u64 info_lpar;
+   u64 reports_lpar;
+   u64 ddr_size;
+   u64 reports_size;
int ret = -ENOMEM;
char *rest;
 
@@ -555,8 +559,8 @@ static int __devinit ps3vram_probe(struc
priv->dev = &dev->core;
 
/* Allocate XDR buffer (1MiB aligned) */
-   priv->xdr_buf = (uint8_t *) __get_free_pages(GFP_KERNEL,
-get_order(XDR_BUF_SIZE));
+   priv->xdr_buf = (void *)__get_free_pages(GFP_KERNEL,
+   get_order(XDR_BUF_SIZE));
if (priv->xdr_buf == NULL) {
dev_dbg(&dev->core, "%s:%d: could not allocate XDR buffer\n",
__func__, __LINE__);
@@ -565,7 +569,7 @@ static int __devinit ps3vram_probe(struc
}
 
/* Put FIFO at begginning of XDR buffer */
-   priv->fifo_base = (uint32_t *) (priv->xdr_buf + FIFO_OFFSET);
+   priv->

[patch 6/6] mtd/ps3vram: Use msleep in waits

2009-01-06 Thread Geoff Levand
Replace the use of udelay() with msleep() in the looping wait routines
ps3vram_notifier_wait() and ps3vram_wait_ring().

Signed-off-by: Geoff Levand 
---
 drivers/mtd/devices/ps3vram.c |   36 ++--
 1 file changed, 14 insertions(+), 22 deletions(-)

--- a/drivers/mtd/devices/ps3vram.c
+++ b/drivers/mtd/devices/ps3vram.c
@@ -109,22 +109,18 @@ static void ps3vram_notifier_reset(struc
notify[i] = 0x;
 }
 
-static int ps3vram_notifier_wait(struct mtd_info *mtd, int timeout_ms)
+static int ps3vram_notifier_wait(struct mtd_info *mtd, unsigned int timeout_ms)
 {
struct ps3vram_priv *priv = mtd->priv;
u32 *notify = ps3vram_get_notifier(priv->reports, NOTIFIER);
 
-   timeout_ms *= 1000;
-
do {
-   if (notify[3] == 0)
+   if (!notify[3])
return 0;
-
-   if (timeout_ms)
-   udelay(1);
+   msleep(1);
} while (timeout_ms--);
 
-   return -1;
+   return -ETIMEDOUT;
 }
 
 static void ps3vram_init_ring(struct mtd_info *mtd)
@@ -135,25 +131,21 @@ static void ps3vram_init_ring(struct mtd
priv->ctrl[CTRL_GET] = FIFO_BASE + FIFO_OFFSET;
 }
 
-static int ps3vram_wait_ring(struct mtd_info *mtd, int timeout)
+static int ps3vram_wait_ring(struct mtd_info *mtd, unsigned int timeout_ms)
 {
struct ps3vram_priv *priv = mtd->priv;
 
-   /* wait until setup commands are processed */
-   timeout *= 1000;
-   while (--timeout) {
+   do {
if (priv->ctrl[CTRL_PUT] == priv->ctrl[CTRL_GET])
-   break;
-   udelay(1);
-   }
-   if (timeout == 0) {
-   dev_dbg(priv->dev, "%s:%d: FIFO timeout (%08x/%08x/%08x)\n",
-   __func__, __LINE__, priv->ctrl[CTRL_PUT],
-   priv->ctrl[CTRL_GET], priv->ctrl[CTRL_TOP]);
-   return -ETIMEDOUT;
-   }
+   return 0;
+   msleep(1);
+   } while (timeout_ms--);
 
-   return 0;
+   dev_dbg(priv->dev, "%s:%d: FIFO timeout (%08x/%08x/%08x)\n", __func__,
+   __LINE__, priv->ctrl[CTRL_PUT], priv->ctrl[CTRL_GET],
+   priv->ctrl[CTRL_TOP]);
+
+   return -ETIMEDOUT;
 }
 
 static void ps3vram_out_ring(struct ps3vram_priv *priv, u32 data)

-- 





___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[patch 3/6] mtd/ps3vram: Remove ps3vram debug routines

2009-01-06 Thread Geoff Levand
Remove the ps3vram debug routines ps3vram_dump_ring() and
ps3vram_dump_reports().  These routines are not needed.

Signed-off-by: Geoff Levand 
---
 drivers/mtd/devices/ps3vram.c |   29 -
 1 file changed, 29 deletions(-)

--- a/drivers/mtd/devices/ps3vram.c
+++ b/drivers/mtd/devices/ps3vram.c
@@ -87,9 +87,6 @@ struct ps3vram_priv {
 #define DMA_NOTIFIER_HANDLE_BASE 0x66604200 /* first DMA notifier handle */
 #define DMA_NOTIFIER_OFFSET_BASE 0x1000 /* first DMA notifier offset */
 #define DMA_NOTIFIER_SIZE0x40
-
-#define NUM_NOTIFIERS  16
-
 #define NOTIFIER 7 /* notifier used for completion report */
 
 /* A trailing '-' means to subtract off ps3fb_videomemory.size */
@@ -131,28 +128,6 @@ static int ps3vram_notifier_wait(struct 
return -1;
 }
 
-static void ps3vram_dump_ring(struct mtd_info *mtd)
-{
-   struct ps3vram_priv *priv = mtd->priv;
-   uint32_t *fifo;
-
-   pr_info("PUT = %08x GET = %08x\n", priv->ctrl[CTRL_PUT],
-   priv->ctrl[CTRL_GET]);
-   for (fifo = priv->fifo_base; fifo < priv->fifo_ptr; fifo++)
-   pr_info("%p: %08x\n", fifo, *fifo);
-}
-
-static void ps3vram_dump_reports(struct mtd_info *mtd)
-{
-   struct ps3vram_priv *priv = mtd->priv;
-   int i;
-
-   for (i = 0; i < NUM_NOTIFIERS; i++) {
-   uint32_t *n = ps3vram_get_notifier(priv->reports, i);
-   pr_info("%p: %08x\n", n, *n);
-   }
-}
-
 static void ps3vram_init_ring(struct mtd_info *mtd)
 {
struct ps3vram_priv *priv = mtd->priv;
@@ -284,8 +259,6 @@ static int ps3vram_upload(struct mtd_inf
ps3vram_fire_ring(mtd);
if (ps3vram_notifier_wait(mtd, 200) < 0) {
pr_err("notifier timeout\n");
-   ps3vram_dump_ring(mtd);
-   ps3vram_dump_reports(mtd);
return -1;
}
 
@@ -317,8 +290,6 @@ static int ps3vram_download(struct mtd_i
ps3vram_fire_ring(mtd);
if (ps3vram_notifier_wait(mtd, 200) < 0) {
pr_err("notifier timeout\n");
-   ps3vram_dump_ring(mtd);
-   ps3vram_dump_reports(mtd);
return -1;
}
 

-- 






___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[patch 1/6] powerpc/ps3: ps3vram driver for accessing video RAM as MTD

2009-01-06 Thread Geoff Levand
From: Jim Paris 

Add ps3vram driver, which exposes unused video RAM on the PS3 as a MTD
device suitable for storage or swap.  Fast data transfer is achieved
using a local cache in system RAM and DMA transfers via the GPU.

CC: Geert Uytterhoeven 
Signed-off-by: Vivien Chappelier 
Signed-off-by: Jim Paris 
Acked-by: Geoff Levand 
Acked-by: David Woodhouse 
---
v1: This version has been updated to work with PS3 firmware 2.50, and
to use ps3_gpu_mutex.

v2: Updated to use new ps3 match ids.

v3: Change MB to MiB.

 MAINTAINERS  |6 
 arch/powerpc/include/asm/ps3.h   |1 
 arch/powerpc/platforms/ps3/device-init.c |   37 +
 drivers/mtd/devices/Kconfig  |7 
 drivers/mtd/devices/Makefile |1 
 drivers/mtd/devices/ps3vram.c|  776 +++
 6 files changed, 828 insertions(+)
 create mode 100644 drivers/mtd/devices/ps3vram.c

--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3470,6 +3470,12 @@ L:   linuxppc-dev@ozlabs.org
 L: cbe-oss-...@ozlabs.org
 S: Supported
 
+PS3VRAM DRIVER
+P: Jim Paris
+M: j...@jtan.com
+L: cbe-oss-...@ozlabs.org
+S: Maintained
+
 PVRUSB2 VIDEO4LINUX DRIVER
 P: Mike Isely
 M: is...@pobox.com
--- a/arch/powerpc/include/asm/ps3.h
+++ b/arch/powerpc/include/asm/ps3.h
@@ -320,6 +320,7 @@ enum ps3_match_id {
 
 enum ps3_match_sub_id {
PS3_MATCH_SUB_ID_GPU_FB = 1,
+   PS3_MATCH_SUB_ID_GPU_RAMDISK= 2,
 };
 
 #define PS3_MODULE_ALIAS_EHCI  "ps3:1:0"
--- a/arch/powerpc/platforms/ps3/device-init.c
+++ b/arch/powerpc/platforms/ps3/device-init.c
@@ -518,6 +518,41 @@ fail_device_register:
return result;
 }
 
+static int __init ps3_register_ramdisk_device(void)
+{
+   int result;
+   struct layout {
+   struct ps3_system_bus_device dev;
+   } *p;
+
+   pr_debug(" -> %s:%d\n", __func__, __LINE__);
+
+   p = kzalloc(sizeof(struct layout), GFP_KERNEL);
+
+   if (!p)
+   return -ENOMEM;
+
+   p->dev.match_id = PS3_MATCH_ID_GPU;
+   p->dev.match_sub_id = PS3_MATCH_SUB_ID_GPU_RAMDISK;
+   p->dev.dev_type = PS3_DEVICE_TYPE_IOC0;
+
+   result = ps3_system_bus_device_register(&p->dev);
+
+   if (result) {
+   pr_debug("%s:%d ps3_system_bus_device_register failed\n",
+   __func__, __LINE__);
+   goto fail_device_register;
+   }
+
+   pr_debug(" <- %s:%d\n", __func__, __LINE__);
+   return 0;
+
+fail_device_register:
+   kfree(p);
+   pr_debug(" <- %s:%d failed\n", __func__, __LINE__);
+   return result;
+}
+
 /**
  * ps3_setup_dynamic_device - Setup a dynamic device from the repository
  */
@@ -946,6 +981,8 @@ static int __init ps3_register_devices(v
 
ps3_register_lpm_devices();
 
+   ps3_register_ramdisk_device();
+
pr_debug(" <- %s:%d\n", __func__, __LINE__);
return 0;
 }
--- a/drivers/mtd/devices/Kconfig
+++ b/drivers/mtd/devices/Kconfig
@@ -120,6 +120,13 @@ config MTD_PHRAM
  doesn't have access to, memory beyond the mem=xxx limit, nvram,
  memory on the video card, etc...
 
+config MTD_PS3VRAM
+   tristate "PS3 video RAM"
+   depends on FB_PS3
+   help
+ This driver allows you to use excess PS3 video RAM as volatile
+ storage or system swap.
+
 config MTD_LART
tristate "28F160xx flash driver for LART"
depends on SA1100_LART
--- a/drivers/mtd/devices/Makefile
+++ b/drivers/mtd/devices/Makefile
@@ -16,3 +16,4 @@ obj-$(CONFIG_MTD_LART)+= lart.o
 obj-$(CONFIG_MTD_BLOCK2MTD)+= block2mtd.o
 obj-$(CONFIG_MTD_DATAFLASH)+= mtd_dataflash.o
 obj-$(CONFIG_MTD_M25P80)   += m25p80.o
+obj-$(CONFIG_MTD_PS3VRAM)  += ps3vram.o
--- /dev/null
+++ b/drivers/mtd/devices/ps3vram.c
@@ -0,0 +1,776 @@
+/**
+ * ps3vram - Use extra PS3 video ram as MTD block device.
+ *
+ * Copyright (c) 2007-2008 Jim Paris 
+ * Added support RSX DMA Vivien Chappelier 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#define DEVICE_NAME"ps3vram"
+
+#define XDR_BUF_SIZE (2 * 1024 * 1024) /* XDR buffer (must be 1MiB aligned) */
+#define XDR_IOIF 0x0c00
+
+#define FIFO_BASE XDR_IOIF
+#define FIFO_SIZE (64 * 1024)
+
+#define DMA_PAGE_SIZE (4 * 1024)
+
+#define CACHE_PAGE_SIZE (256 * 1024)
+#define CACHE_PAGE_COUNT ((XDR_BUF_SIZE - FIFO_SIZE) / CACHE_PAGE_SIZE)
+
+#define CACHE_OFFSET CACHE_PAGE_SIZE
+#define FIFO_OFFSET 0
+
+#define CTRL_PUT 0x10
+#define CTRL_GET 0x11
+#define CTRL_TOP 0x15
+
+#define UPLOAD_SUBCH   1
+#define DOWNLOAD_SUBCH 2
+
+#define NV_MEMORY_TO_MEMORY_FORMAT_OFFSET_IN   0x030c
+#define NV_MEMORY_TO_MEMORY_FORMAT_NOTIFY  0x0104
+
+#define L1GPU_CO

[patch 4/6] mtd/ps3vram: Cleanup ps3vram driver messages

2009-01-06 Thread Geoff Levand
Cleanup the ps3vram driver messages.  Add a new struct device pointer
variable dev to struct ps3vram_priv and use dev_dbg(), pr_dbg(), etc.
where appropriate.

Signed-off-by: Geoff Levand 
---
 drivers/mtd/devices/ps3vram.c |  116 --
 1 file changed, 68 insertions(+), 48 deletions(-)

--- a/drivers/mtd/devices/ps3vram.c
+++ b/drivers/mtd/devices/ps3vram.c
@@ -53,9 +53,6 @@ struct mtd_info ps3vram_mtd;
 #define CACHE_PAGE_PRESENT 1
 #define CACHE_PAGE_DIRTY   2
 
-#define dbg(fmt, args...)  \
-   pr_debug("%s:%d " fmt "\n", __func__, __LINE__, ## args)
-
 struct ps3vram_tag {
unsigned int address;
unsigned int flags;
@@ -78,6 +75,7 @@ struct ps3vram_priv {
uint32_t *fifo_base;
uint32_t *fifo_ptr;
 
+   struct device *dev;
struct ps3vram_cache cache;
 
/* Used to serialize cache/DMA operations */
@@ -148,8 +146,9 @@ static int ps3vram_wait_ring(struct mtd_
udelay(1);
}
if (timeout == 0) {
-   pr_err("FIFO timeout (%08x/%08x/%08x)\n", priv->ctrl[CTRL_PUT],
-  priv->ctrl[CTRL_GET], priv->ctrl[CTRL_TOP]);
+   dev_dbg(priv->dev, "%s:%d: FIFO timeout (%08x/%08x/%08x)\n",
+   __func__, __LINE__, priv->ctrl[CTRL_PUT],
+   priv->ctrl[CTRL_GET], priv->ctrl[CTRL_TOP]);
return -ETIMEDOUT;
}
 
@@ -181,7 +180,8 @@ static void ps3vram_rewind_ring(struct m
   L1GPU_CONTEXT_ATTRIBUTE_FB_BLIT,
   0, 0, 0, 0);
if (status)
-   pr_err("ps3vram: lv1_gpu_context_attribute FB_BLIT failed\n");
+   dev_err(priv->dev, "%s:%d: lv1_gpu_context_attribute failed\n",
+   __func__, __LINE__);
 
priv->fifo_ptr = priv->fifo_base;
 }
@@ -201,11 +201,13 @@ static void ps3vram_fire_ring(struct mtd
   L1GPU_CONTEXT_ATTRIBUTE_FB_BLIT,
   0, 0, 0, 0);
if (status)
-   pr_err("ps3vram: lv1_gpu_context_attribute FB_BLIT failed\n");
+   dev_err(priv->dev, "%s:%d: lv1_gpu_context_attribute failed\n",
+   __func__, __LINE__);
 
if ((priv->fifo_ptr - priv->fifo_base) * sizeof(uint32_t) >
FIFO_SIZE - 1024) {
-   dbg("fifo full, rewinding");
+   dev_dbg(priv->dev, "%s:%d: fifo full, rewinding\n", __func__,
+   __LINE__);
ps3vram_wait_ring(mtd, 200);
ps3vram_rewind_ring(mtd);
}
@@ -258,7 +260,8 @@ static int ps3vram_upload(struct mtd_inf
ps3vram_out_ring(priv, 0);
ps3vram_fire_ring(mtd);
if (ps3vram_notifier_wait(mtd, 200) < 0) {
-   pr_err("notifier timeout\n");
+   dev_dbg(priv->dev, "%s:%d: notifier timeout\n", __func__,
+   __LINE__);
return -1;
}
 
@@ -289,7 +292,8 @@ static int ps3vram_download(struct mtd_i
ps3vram_out_ring(priv, 0);
ps3vram_fire_ring(mtd);
if (ps3vram_notifier_wait(mtd, 200) < 0) {
-   pr_err("notifier timeout\n");
+   dev_dbg(priv->dev, "%s:%d: notifier timeout\n", __func__,
+   __LINE__);
return -1;
}
 
@@ -302,16 +306,17 @@ static void ps3vram_cache_evict(struct m
struct ps3vram_cache *cache = &priv->cache;
 
if (cache->tags[entry].flags & CACHE_PAGE_DIRTY) {
-   dbg("flushing %d : 0x%08x", entry, cache->tags[entry].address);
+   dev_dbg(priv->dev, "%s:%d: flushing %d : 0x%08x\n", __func__,
+   __LINE__, entry, cache->tags[entry].address);
if (ps3vram_upload(mtd,
   CACHE_OFFSET + entry * cache->page_size,
   cache->tags[entry].address,
   DMA_PAGE_SIZE,
   cache->page_size / DMA_PAGE_SIZE) < 0) {
-   pr_err("failed to upload from 0x%x to 0x%x size 0x%x\n",
-  entry * cache->page_size,
-  cache->tags[entry].address,
-  cache->page_size);
+   dev_dbg(priv->dev, "%s:%d: failed to upload from "
+   "0x%x to 0x%x size 0x%x\n", __func__, __LINE__,
+   entry * cache->page_size,
+   cache->tags[entry].address, cache->page_size);
}
  

[patch 0/6] ps3vram driver patches

2009-01-06 Thread Geoff Levand
Hi Ben,

This is a set of patches for the ps3vram driver.

Patch 1 adds the driver.  It has already been reviewed on the cbe-oss-dev ML
and has been acked by David Woodhouse, so should be ready to merge.

Patch 2 is a minor update to reflect changes to the ps3-system-bus that have
been merged into mainline since this driver was posted, and so can be merged.

Patches 3-6 are minor cleanups suggested by Arnd Bergmann.  I have left two
of Arnd's sugestions, implementing the driver as a block device, similar to
the axonram driver, and eliminating the need to ioremap.  These will require
a significant re-work.


 [patch 1/6] powerpc/ps3: ps3vram driver for accessing video RAM as MTD
 [patch 2/6] powerpc/ps3: Add modalias support to the ps3vram driver
 [patch 3/6] mtd/ps3vram: Remove ps3vram debug routines
 [patch 4/6] mtd/ps3vram: Cleanup ps3vram driver messages
 [patch 5/6] mtd/ps3vram: Use kernel types
 [patch 6/6] mtd/ps3vram: Use msleep in waits

-Geoff


-- 





___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [patch 0/6] ps3vram driver patches

2009-01-07 Thread Geoff Levand
Arnd Bergmann wrote:
> On Tuesday 06 January 2009, Geoff Levand wrote:
>> Patches 3-6 are minor cleanups suggested by Arnd Bergmann.  I have left two
>> of Arnd's sugestions, implementing the driver as a block device, similar to
>> the axonram driver, and eliminating the need to ioremap.  These will require
>> a significant re-work.
> 
> My complaint about the ioremap was just about the type of the mapping,
> not something fundamental. Please just replace ioremap(addr, size) with
> ioremap_flags(addr, size, _PAGE_NO_CACHE) in order to get a mapping without
> the guarded bit.

OK, I see.  I'll post a patch.

Geert and I were discussing actually removing the direct write to the XDR
memory, and so the need for that ioremap, as the mapping is just used in
ps3vram_erase(), which seems could be removed.

> If everyone else thinks that doing the ps3vram driver as an MTD rather than
> a block device is acceptable, I have no further objections. Thanks for
> following up on my other comments.

I want to get it converted to a block device, and I will work towards
that, but it will take some time.  As it is, it is very useful for typical
systems that are running full desktops like gmome or KDE and do a lot of
swapping.  Many of the distros now use it, and users want it.

-Geoff

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[patch 6/6 v2] mtd/ps3vram: Use msleep in waits

2009-01-07 Thread Geoff Levand
Subject: [patch] mtd/ps3vram: Use msleep in waits

Replace the use of udelay() with msleep() in the looping wait routines
ps3vram_notifier_wait() and ps3vram_wait_ring().

Signed-off-by: Geoff Levand 
---
v2: Use time_before() in loops.

 drivers/mtd/devices/ps3vram.c |   40 +---
 1 file changed, 17 insertions(+), 23 deletions(-)

--- a/drivers/mtd/devices/ps3vram.c
+++ b/drivers/mtd/devices/ps3vram.c
@@ -109,22 +109,19 @@ static void ps3vram_notifier_reset(struc
notify[i] = 0x;
 }
 
-static int ps3vram_notifier_wait(struct mtd_info *mtd, int timeout_ms)
+static int ps3vram_notifier_wait(struct mtd_info *mtd, unsigned int timeout_ms)
 {
struct ps3vram_priv *priv = mtd->priv;
u32 *notify = ps3vram_get_notifier(priv->reports, NOTIFIER);
-
-   timeout_ms *= 1000;
+   unsigned long timeout = jiffies + msecs_to_jiffies(timeout_ms);
 
do {
-   if (notify[3] == 0)
+   if (!notify[3])
return 0;
+   msleep(1);
+   } while (time_before(jiffies, timeout));
 
-   if (timeout_ms)
-   udelay(1);
-   } while (timeout_ms--);
-
-   return -1;
+   return -ETIMEDOUT;
 }
 
 static void ps3vram_init_ring(struct mtd_info *mtd)
@@ -135,25 +132,22 @@ static void ps3vram_init_ring(struct mtd
priv->ctrl[CTRL_GET] = FIFO_BASE + FIFO_OFFSET;
 }
 
-static int ps3vram_wait_ring(struct mtd_info *mtd, int timeout)
+static int ps3vram_wait_ring(struct mtd_info *mtd, unsigned int timeout_ms)
 {
struct ps3vram_priv *priv = mtd->priv;
+   unsigned long timeout = jiffies + msecs_to_jiffies(timeout_ms);
 
-   /* wait until setup commands are processed */
-   timeout *= 1000;
-   while (--timeout) {
+   do {
if (priv->ctrl[CTRL_PUT] == priv->ctrl[CTRL_GET])
-   break;
-   udelay(1);
-   }
-   if (timeout == 0) {
-   dev_dbg(priv->dev, "%s:%d: FIFO timeout (%08x/%08x/%08x)\n",
-   __func__, __LINE__, priv->ctrl[CTRL_PUT],
-   priv->ctrl[CTRL_GET], priv->ctrl[CTRL_TOP]);
-   return -ETIMEDOUT;
-   }
+   return 0;
+   msleep(1);
+   } while (time_before(jiffies, timeout));
 
-   return 0;
+   dev_dbg(priv->dev, "%s:%d: FIFO timeout (%08x/%08x/%08x)\n", __func__,
+   __LINE__, priv->ctrl[CTRL_PUT], priv->ctrl[CTRL_GET],
+   priv->ctrl[CTRL_TOP]);
+
+   return -ETIMEDOUT;
 }
 
 static void ps3vram_out_ring(struct ps3vram_priv *priv, u32 data)


___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[patch] mtd/ps3vram: Use _PAGE_NO_CACHE in memory ioremap

2009-01-07 Thread Geoff Levand
Use _PAGE_NO_CACHE for gpu memory ioremap.  Also,
add __iomem attribute to gpu memory pointer and
change use of memset() to memset_io().

Signed-off-by: Geoff Levand 
---
 drivers/mtd/devices/ps3vram.c |   14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

--- a/drivers/mtd/devices/ps3vram.c
+++ b/drivers/mtd/devices/ps3vram.c
@@ -6,6 +6,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -69,7 +70,7 @@ struct ps3vram_priv {
u64 context_handle;
u32 *ctrl;
u32 *reports;
-   u8 *base;
+   u8 __iomem *ddr_base;
u8 *xdr_buf;
 
u32 *fifo_base;
@@ -425,7 +426,7 @@ static int ps3vram_erase(struct mtd_info
ps3vram_cache_flush(mtd);
 
/* Set bytes to 0xFF */
-   memset(priv->base + instr->addr, 0xFF, instr->len);
+   memset_io(priv->ddr_base + instr->addr, 0xFF, instr->len);
 
mutex_unlock(&priv->lock);
 
@@ -628,8 +629,9 @@ static int __devinit ps3vram_probe(struc
goto out_free_context;
}
 
-   priv->base = ioremap(ddr_lpar, ddr_size);
-   if (!priv->base) {
+   priv->ddr_base = ioremap_flags(ddr_lpar, ddr_size, _PAGE_NO_CACHE);
+
+   if (!priv->ddr_base) {
dev_err(&dev->core, "%s:%d: ioremap failed\n", __func__,
__LINE__);
ret = -ENOMEM;
@@ -702,7 +704,7 @@ out_unmap_reports:
 out_unmap_ctrl:
iounmap(priv->ctrl);
 out_unmap_vram:
-   iounmap(priv->base);
+   iounmap(priv->ddr_base);
 out_free_context:
lv1_gpu_context_free(priv->context_handle);
 out_free_memory:
@@ -728,7 +730,7 @@ static int ps3vram_shutdown(struct ps3_s
ps3vram_cache_cleanup(&ps3vram_mtd);
iounmap(priv->reports);
iounmap(priv->ctrl);
-   iounmap(priv->base);
+   iounmap(priv->ddr_base);
lv1_gpu_context_free(priv->context_handle);
lv1_gpu_memory_free(priv->memory_handle);
ps3_close_hv_device(dev);


___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: submitted patches

2009-01-12 Thread Geoff Levand
Milton Miller wrote:
> I request the following patches in patchwork be considered for 2.6.29:
> 
> http://patchwork.ozlabs.org/patch/3778/
> powerpc ps3: use smp_request_message_ipi

I tested this on PS3, and it seems to work OK.

Acked-by: Geoff Levand 


___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] powerpc: Enable PS3 options and QPACE in ppc64_defconfig

2009-01-13 Thread Geoff Levand
Michael Ellerman wrote:
> To increase the amount of code that's built for a defconfig build.
> 
> Signed-off-by: Michael Ellerman 
> ---
>  arch/powerpc/configs/ppc64_defconfig |   26 +-
>  1 files changed, 25 insertions(+), 1 deletions(-)

> -# CONFIG_PPC_PS3 is not set
> +CONFIG_PPC_PS3=y

I tested this ppc64_defconfig, and it could boot on PS3.

Acked-by: Geoff Levand 

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 01/13] powerpc/ps3: set_dabr takes an unsigned long

2009-01-14 Thread Geoff Levand
Hi Stephen,

Thanks for working through it and making these fixups.  I
tested the set applied onto Ben's powerpc tree and they
seem to work OK (with ps3_defconfig).

Stephen Rothwell wrote:
> Also silences this warning:
> 
> arch/powerpc/platforms/ps3/setup.c:275: warning: initialization from 
> incompatible pointer type
> 
> Signed-off-by: Stephen Rothwell 
> ---
>  arch/powerpc/platforms/ps3/setup.c |2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)

Acked-by: Geoff Levand 



___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 02/13] powerpc/ps3: use dma_addr_t down through the stack

2009-01-14 Thread Geoff Levand
Stephen Rothwell wrote:
> Push the dma_addr_t type usage all the way down to where the actual
> values are manipulated.
> 
> Now that u64 is "unsigned long long", this removes warnings like:
> 
> arch/powerpc/platforms/ps3/system-bus.c:532: warning: passing argument 4 of 
> 'ps3_dma_map' from incompatible pointer type
> arch/powerpc/platforms/ps3/system-bus.c:649: warning: passing argument 4 of 
> 'ps3_dma_map' from incompatible pointer type
> 
> Signed-off-by: Stephen Rothwell 
> ---
>  arch/powerpc/include/asm/ps3.h  |8 +++---
>  arch/powerpc/platforms/ps3/mm.c |   32 --
>  arch/powerpc/platforms/ps3/system-bus.c |4 +-
>  3 files changed, 23 insertions(+), 21 deletions(-)

Acked-by: Geoff Levand 





___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 04/13] powerpc/ps3: clear_bit/set_bit operate on unsigned longs

2009-01-14 Thread Geoff Levand
Stephen Rothwell wrote:
> This fixes these compiler warning:
> 
> arch/powerpc/platforms/ps3/interrupt.c:109: warning: passing argument 2 of 
> 'clear_bit' from incompatible pointer type
> arch/powerpc/platforms/ps3/interrupt.c:130: warning: passing argument 2 of 
> 'set_bit' from incompatible pointer type
> 
> Signed-off-by: Stephen Rothwell 
> ---
>  arch/powerpc/platforms/ps3/interrupt.c |4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)

Acked-by: Geoff Levand 





___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 05/13] powerpc/ps3: ps3_repository_read_mm_info takes u64 * arguments

2009-01-14 Thread Geoff Levand
Stephen Rothwell wrote:
> Fixes compiler warnings:
> 
> arch/powerpc/platforms/ps3/mm.c:1205: warning: passing argument 2 of 
> 'ps3_repository_read_mm_info' from incompatible pointer type
> arch/powerpc/platforms/ps3/mm.c:1205: warning: passing argument 3 of 
> 'ps3_repository_read_mm_info' from incompatible pointer type
> 
> Signed-off-by: Stephen Rothwell 
> ---
>  arch/powerpc/platforms/ps3/mm.c |   17 -
>  1 files changed, 8 insertions(+), 9 deletions(-)

Acked-by: Geoff Levand 




___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 03/13] powerpc/ps3: the lv1_ routines have u64 parameters

2009-01-14 Thread Geoff Levand
Stephen Rothwell wrote:
> We just fix up the reference parameters as the others are dealt with by
> arithmetic promotion rules and don't cause warnings.
> 
> This removes warnings like this:
> 
> arch/powerpc/platforms/ps3/interrupt.c:327: warning: passing argument 1 of 
> 'lv1_construct_event_receive_port' from incompatible pointer type
> 
> Also, these:
> 
> drivers/ps3/ps3-vuart.c:462: warning: passing argument 4 of 
> 'ps3_vuart_raw_read' from incompatible pointer type
> drivers/ps3/ps3-vuart.c:592: warning: passing argument 4 of 
> 'ps3_vuart_raw_read' from incompatible pointer type
> 
> Signed-off-by: Stephen Rothwell 
> ---
>  arch/powerpc/platforms/ps3/interrupt.c  |8 +++---
>  arch/powerpc/platforms/ps3/mm.c |   38 +-
>  arch/powerpc/platforms/ps3/spu.c|   12 ++---
>  arch/powerpc/platforms/ps3/system-bus.c |4 ++-
>  drivers/ps3/ps3-vuart.c     |   24 ++-
>  5 files changed, 49 insertions(+), 37 deletions(-)

Acked-by: Geoff Levand 



___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 06/13] powerpc/ps3: printing fixups for l64 to ll64 conversion: arch/powerpc

2009-01-14 Thread Geoff Levand
Stephen Rothwell wrote:
> Signed-off-by: Stephen Rothwell 
> ---
>  arch/powerpc/platforms/ps3/device-init.c |   26 +-
>  arch/powerpc/platforms/ps3/htab.c|2 +-
>  arch/powerpc/platforms/ps3/interrupt.c   |   16 
>  arch/powerpc/platforms/ps3/mm.c  |   10 +-
>  arch/powerpc/platforms/ps3/os-area.c |2 +-
>  arch/powerpc/platforms/ps3/repository.c  |   22 +++---
>  arch/powerpc/platforms/ps3/system-bus.c  |6 +++---
>  7 files changed, 42 insertions(+), 42 deletions(-)

Acked-by: Geoff Levand 



___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 09/13] powerpc/ps3: printing fixups for l64 to ll64 conversion: sound/ppc

2009-01-14 Thread Geoff Levand
Stephen Rothwell wrote:
> Signed-off-by: Stephen Rothwell 
> ---
>  sound/ppc/snd_ps3.c |4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)

Acked-by: Geoff Levand 




___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 13/13] powerpc/ps3: printing fixups for l64 to ll64 conversion: drivers/video

2009-01-14 Thread Geoff Levand
Stephen Rothwell wrote:
> Signed-off-by: Stephen Rothwell 
> ---
>  drivers/video/ps3fb.c |4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)

Acked-by: Geoff Levand 




___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 12/13] powerpc/ps3: printing fixups for l64 to ll64 conversion: drivers/scsi

2009-01-14 Thread Geoff Levand
Stephen Rothwell wrote:
> Signed-off-by: Stephen Rothwell 
> ---
>  drivers/scsi/ps3rom.c |6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)

Acked-by: Geoff Levand 




___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 08/13] powerpc/ps3: printing fixups for l64 to ll64 convserion: drivers/char

2009-01-14 Thread Geoff Levand
Stephen Rothwell wrote:
> Also a couple of min -> min_t changes.
> 
> Signed-off-by: Stephen Rothwell 
> ---
>  drivers/char/ps3flash.c |   18 +-
>  1 files changed, 9 insertions(+), 9 deletions(-)

Acked-by: Geoff Levand 




___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 11/13] powerpc/ps3: printing fixups for l64 to ll64 conversion: drivers/ps3

2009-01-14 Thread Geoff Levand
Stephen Rothwell wrote:
> Also some min -> mint_t conversion.
> 
> Signed-off-by: Stephen Rothwell 
> ---
>  drivers/ps3/ps3-lpm.c |   16 
>  drivers/ps3/ps3-vuart.c   |8 
>  drivers/ps3/ps3stor_lib.c |   14 +++---
>  3 files changed, 19 insertions(+), 19 deletions(-)

Acked-by: Geoff Levand 




___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 07/13] powerpc/ps3: printing fixups for l64 to ll64 conversion: drivers/block

2009-01-14 Thread Geoff Levand
Stephen Rothwell wrote:
> Signed-off-by: Stephen Rothwell 
> ---
>  drivers/block/ps3disk.c |   18 +-
>  1 files changed, 9 insertions(+), 9 deletions(-)

Acked-by: Geoff Levand 




___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 10/13] powerpc/ps3: printing fixups for l64 to ll64 convserion: drivers/net

2009-01-14 Thread Geoff Levand
Stephen Rothwell wrote:
> Signed-off-by: Stephen Rothwell 
> ---
>  drivers/net/ps3_gelic_wireless.c |2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)

Acked-by: Geoff Levand 




___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[patch v4] PS3: Bootwrapper support.

2007-07-03 Thread Geoff Levand
Subject: PS3: Bootwrapper support.

Add support to build the PS3 flash rom image and remove some unneeded
lmb calls.

The PS3's lv1 loader supports loading gzipped binary images from flash
rom to addr zero. The loader enters the image at addr 0x100.

In this implementation a bootwrapper overlay is use to arrange for the kernel to
be loaded to addr zero and to have a suitable bootwrapper entry at 0x100.  To
construct the rom image, 0x100 bytes from offset 0x100 in the kernel is copied
to the bootwrapper symbol __system_reset_kernel.  The 0x100 bytes at the
bootwrapper symbol __system_reset_overlay is then copied to offset 0x100.  At
runtime the bootwrapper program copies the 0x100 bytes at __system_reset_kernel
to addr 0x100.

zImage.ps3 is a wrapped image that contains a flat device tree, an lv1
compatible entry point, and an optional initrd.  otheros.bld is the gzip
compresed rom image built from zImage.ps3.  otheros.bld is suitable for
programming into the PS3 boot flash memory.


Signed-off-by: Geoff Levand <[EMAIL PROTECTED]>
---

Hi Paul.

I rebased this to your latest for-2.6.23 branch.  Please
apply.

-Geoff

v4 changes:
  o Rebase to for-2.6.23 branch of powerpc.git. 
v3 changes:
  o Add details about PS3 loader to patch description.
v2 changes:
  o Make platform specific files build for all platforms.
  o Remove use of __secondary_hold_acknowledge.
  o Change patch comment about zImage entry.
  o Add comment about lv1_panic() to ps3_exit().
  o Make room for bss section in otheros.bld.

 arch/powerpc/boot/Makefile |   21 ++--
 arch/powerpc/boot/ps3-head.S   |   80 
 arch/powerpc/boot/ps3-hvcall.S |  184 +
 arch/powerpc/boot/ps3.c|  161 
 arch/powerpc/boot/wrapper  |   55 +++
 arch/powerpc/boot/zImage.ps3.lds.S |   50 ++
 arch/powerpc/platforms/ps3/mm.c|2 
 7 files changed, 542 insertions(+), 11 deletions(-)

--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -46,7 +46,8 @@ src-wlib := string.S crt0.S stdio.c main
gunzip_util.c elf_util.c $(zlib) devtree.c oflib.c ofconsole.c \
44x.c ebony.c mv64x60.c mpsc.c mv64x60_i2c.c cuboot.c
 src-plat := of.c cuboot-83xx.c cuboot-85xx.c holly.c \
-   cuboot-ebony.c treeboot-ebony.c prpmc2800.c
+   cuboot-ebony.c treeboot-ebony.c prpmc2800.c \
+   ps3-head.S ps3-hvcall.S ps3.c
 src-boot := $(src-wlib) $(src-plat) empty.c
 
 src-boot := $(addprefix $(obj)/, $(src-boot))
@@ -75,11 +76,11 @@ $(addprefix $(obj)/,$(zliblinuxheader)):
 $(obj)/empty.c:
@touch $@
 
-$(obj)/zImage.lds $(obj)/zImage.coff.lds: $(obj)/%: $(srctree)/$(src)/%.S
+$(obj)/zImage.lds $(obj)/zImage.coff.lds $(obj)/zImage.ps3.lds: $(obj)/%: 
$(srctree)/$(src)/%.S
@cp $< $@
 
 clean-files := $(zlib) $(zlibheader) $(zliblinuxheader) \
-   empty.c zImage.coff.lds zImage.lds
+   empty.c zImage zImage.coff.lds zImage.ps3.lds zImage.lds
 
 quiet_cmd_bootcc = BOOTCC  $@
   cmd_bootcc = $(CROSS32CC) -Wp,-MD,$(depfile) $(BOOTCFLAGS) -c -o $@ $<
@@ -102,7 +103,7 @@ hostprogs-y := addnote addRamDisk hack-c
 
 targets+= $(patsubst $(obj)/%,%,$(obj-boot) wrapper.a)
 extra-y:= $(obj)/wrapper.a $(obj-plat) $(obj)/empty.o \
-  $(obj)/zImage.lds $(obj)/zImage.coff.lds
+  $(obj)/zImage.lds $(obj)/zImage.coff.lds 
$(obj)/zImage.ps3.lds
 
 wrapper:=$(srctree)/$(src)/wrapper
 wrapperbits:= $(extra-y) $(addprefix $(obj)/,addnote hack-coff mktree) \
@@ -179,11 +180,12 @@ $(obj)/zImage.%: vmlinux $(wrapperbits) 
 $(obj)/zImage.iseries: vmlinux
$(STRIP) -s -R .comment $< -o $@
 
-$(obj)/zImage.ps3: vmlinux
-   $(STRIP) -s -R .comment $< -o $@
+$(obj)/zImage.ps3: vmlinux  $(wrapper) $(wrapperbits) 
$(srctree)/$(src)/dts/ps3.dts
+   $(STRIP) -s -R .comment $< -o vmlinux.strip
+   $(call cmd,wrap,ps3,$(srctree)/$(src)/dts/ps3.dts,,)
 
-$(obj)/zImage.initrd.ps3: vmlinux
-   @echo "  WARNING zImage.initrd.ps3 not supported (yet)"
+$(obj)/zImage.initrd.ps3: vmlinux  $(wrapper) $(wrapperbits) 
$(srctree)/$(src)/dts/ps3.dts $(obj)/ramdisk.image.gz
+   $(call 
cmd,wrap,ps3,$(srctree)/$(src)/dts/ps3.dts,,$(obj)/ramdisk.image.gz)
 
 $(obj)/uImage: vmlinux $(wrapperbits)
$(call if_changed,wrap,uboot)
@@ -206,7 +208,8 @@ install: $(CONFIGURE) $(addprefix $(obj)
sh -x $(srctree)/$(src)/install.sh "$(KERNELRELEASE)" vmlinux 
System.map "$(INSTALL_PATH)" $<
 
 # anything not in $(targets)
-clean-files += $(image-) $(initrd-) zImage zImage.initrd cuImage.* treeImage.*
+clean-files += $(image-) $(initrd-) zImage zImage.initrd cuImage.* treeImage.* 
\
+   otheros.bld
 
 # clean up files cached by wrapper
 clean-kernel := vmlinux.strip vmlinux.bin
--- /dev/null
+++ b/arch/powerp

Re: PS3 Storage Driver O_DIRECT issue

2007-07-17 Thread Geoff Levand
Geert Uytterhoeven wrote:
> On Fri, 13 Jul 2007, Olaf Hering wrote:
>> This driver (or the generic PS3 code) has appearently problems with
>> O_DIRECT. 
>> glibc aborts parted because the malloc metadata get corrupted. While it
>> is reproducible, the place where it crashes changes with every version
>> of the debug attempt.
>> I dont have a handle right now, all I know is that the metadata after a
>> malloc area get overwritten with zeros.
>> 
>> 
>> Can you have a look at this? 
>> parted /dev/ps3da
>> print (a few times)
> 
> I can't seem to reproduce this with parted 1.7.1-5.1 (from Debian
> etch/lenny/sid) and kernel 2.6.22-g77320894.

Hi.

I found this happens on Fedora 7:

[EMAIL PROTECTED] ~]# uname -a
Linux ps3-nfs 2.6.22-ps3-linux-dev-g4d898766-dirty #1 SMP Wed Jul 11 13:29:46 
PDT 2007 ppc64 ppc64 ppc64 GNU/Linux
[EMAIL PROTECTED] ~]# parted --version
parted (GNU parted) 1.8.6

Here is the error message from parted:

Command History:
print

Error: SEGV_MAPERR (Address not mapped to object)
Backtrace has 20 calls on stack:
  20: /usr/lib/libparted-1.8.so.6(ped_assert+0xb0) [0xfb7ea50]
  19: parted [0x1000c6dc]
  18: [0x100350]
  17: [(nil)]
  16: /lib/libc.so.6 [0xfdcfe64]
  15: /lib/libc.so.6 [0xfdd0b34]
  14: /lib/libc.so.6(__libc_memalign+0xec) [0xfdd1e1c]
  13: /lib/libc.so.6(posix_memalign+0xbc) [0xfdd207c]
  12: /usr/lib/libparted-1.8.so.6 [0xfb8f42c]
  11: /usr/lib/libparted-1.8.so.6(ped_device_read+0x164) [0xfb7f5f4]
  10: /usr/lib/libparted-1.8.so.6(ped_geometry_read+0x16c) [0xfb89a5c]
  9: /usr/lib/libparted-1.8.so.6 [0xfba739c]
  8: /usr/lib/libparted-1.8.so.6(ped_file_system_probe_specific+0x104) 
[0xfb80d04]
  7: /usr/lib/libparted-1.8.so.6(ped_file_system_probe+0xec) [0xfb8134c]
  6: /usr/lib/libparted-1.8.so.6 [0xfbbcc38]
  5: /usr/lib/libparted-1.8.so.6 [0xfbbcfb4]
  4: /usr/lib/libparted-1.8.so.6(ped_disk_new+0xc0) [0xfb88bf0]
  3: parted [0x10006e00]
  2: parted(command_run+0x1c) [0x10004d8c]
  1: parted(interactive_mode+0x134) [0x1000e4b4]
Aborted


___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


PS3: Fix build with 32-bit toolchains

2007-07-19 Thread Geoff Levand
The PS3 bootwrapper files use instructions only available on
64-bit CPUs.  Add the code generation directive '.machine "ppc64"'
for toolchains configured for 32-bit CPUs.

Signed-off-by: Geoff Levand <[EMAIL PROTECTED]>
---
Paul,

Please apply for 2.6.23-rc1.

 arch/powerpc/boot/ps3-head.S   |2 ++
 arch/powerpc/boot/ps3-hvcall.S |2 ++
 2 files changed, 4 insertions(+)

--- a/arch/powerpc/boot/ps3-head.S
+++ b/arch/powerpc/boot/ps3-head.S
@@ -20,6 +20,8 @@
 
 #include "ppc_asm.h"
 
+   .machine "ppc64"
+
.text
 
 /*
--- a/arch/powerpc/boot/ps3-hvcall.S
+++ b/arch/powerpc/boot/ps3-hvcall.S
@@ -20,6 +20,8 @@
 
 #include "ppc_asm.h"
 
+   .machine "ppc64"
+
 /*
  * The PS3 hypervisor uses a 64 bit "C" language calling convention.
  * The routines here marshal arguments between the 32 bit wrapper

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: PS3: Fix build with 32-bit toolchains

2007-07-19 Thread Geoff Levand
Kumar Gala wrote:
> On Jul 19, 2007, at 4:47 PM, Geoff Levand wrote:
> 
>> The PS3 bootwrapper files use instructions only available on
>> 64-bit CPUs.  Add the code generation directive '.machine "ppc64"'
>> for toolchains configured for 32-bit CPUs.
>>
>> Signed-off-by: Geoff Levand <[EMAIL PROTECTED]>
> 
> while this is a fix, why are we even building it Grant's case of  
> building 834x itx.

I originally had the makefile setup to conditionally build these
files on CONFIG_PPC_PS3, but during the review I was requested to
change it to build them unconditionally.  See:

  http://ozlabs.org/pipermail/linuxppc-dev/2007-June/038072.html

-Geoff

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


PS3: Fix build with 32-bit toolchains

2007-07-20 Thread Geoff Levand
The PS3 bootwrapper files use instructions only available on
64-bit CPUs.  Add the code generation directive '.machine "ppc64"'
for toolchains configured for 32-bit CPUs.

Signed-off-by: Geoff Levand <[EMAIL PROTECTED]>
Acked-by: Grant Likely <[EMAIL PROTECTED]>
---
Hi Andrew,

It seems Paul is out on holiday, so I'm sending this to you.

This fixes a build error in Linus' current tree for a few
32 bit powerpc platforms.  It had some review on the
linuxppc-dev ML, and Grant Likely reported it fixed the
problem.

-Geoff

 arch/powerpc/boot/ps3-head.S   |2 ++
 arch/powerpc/boot/ps3-hvcall.S |2 ++
 2 files changed, 4 insertions(+)

--- a/arch/powerpc/boot/ps3-head.S
+++ b/arch/powerpc/boot/ps3-head.S
@@ -20,6 +20,8 @@
 
 #include "ppc_asm.h"
 
+   .machine "ppc64"
+
.text
 
 /*
--- a/arch/powerpc/boot/ps3-hvcall.S
+++ b/arch/powerpc/boot/ps3-hvcall.S
@@ -20,6 +20,8 @@
 
 #include "ppc_asm.h"
 
+   .machine "ppc64"
+
 /*
  * The PS3 hypervisor uses a 64 bit "C" language calling convention.
  * The routines here marshal arguments between the 32 bit wrapper

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH][36/37] Clean up duplicate includes in sound/ppc/

2007-07-23 Thread Geoff Levand
Jesper Juhl wrote:
> Hi,
> 
> This patch cleans up duplicate includes in
>   /
> 
> 
> Signed-off-by: Jesper Juhl <[EMAIL PROTECTED]>
> ---
> 
> diff --git a/sound/ppc/snd_ps3.c b/sound/ppc/snd_ps3.c
> index 1aa0b46..27b6189 100644
> --- a/sound/ppc/snd_ps3.c
> +++ b/sound/ppc/snd_ps3.c
> @@ -33,7 +33,6 @@
>  #include 
>  #include 
>  #include 
> -#include 
>  #include 
>  #include 
>  #include 

Acked-by: Geoff Levand <[EMAIL PROTECTED]>

___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: Using video memory on PS3 e.g. as SWAP?

2007-07-31 Thread Geoff Levand
� wrote:
> Hi all,
> 
> looking at the PS3 as one of the few PowerPC workstation options the RAM
> is obviously quite limitted with just 256MB. 


Can I recommend in the future you send this kind of PS3 specific inquiry to
the cbe-oss-dev mailing list?

  [EMAIL PROTECTED]
  https://ozlabs.org/mailman/listinfo/cbe-oss-dev


> I wonder if the 256MB of
> video memory can be mapped or at least be used as super-fast SWAP?


As Marc mentioned, some work was done using unsupported functionality of
the current hypervisor.  There is no assurance it will continue to work
with future system software updates.


> Or are there news regarding accessing the video chip from Linux beside
> the unaccelerated frame-buffer?


We plan to improve Linux graphics support, but we have not announced any
specifics.  The changes may make the above mentioned driver no longer work.

-Geoff


___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

[PATCH] MAINTAINERS: Update Spidernet network driver

2021-03-16 Thread Geoff Levand
Change the Spidernet network driver from supported to
maintained, add the linuxppc-dev ML, and add myself as
a 'maintainer'.

Cc: Ishizaki Kou 
Signed-off-by: Geoff Levand 
---
 MAINTAINERS | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index aa84121c5611..7451cd55af18 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -16887,8 +16887,10 @@ F: tools/spi/
 
 SPIDERNET NETWORK DRIVER for CELL
 M: Ishizaki Kou 
+M: Geoff Levand 
 L: net...@vger.kernel.org
-S: Supported
+L: linuxppc-dev@lists.ozlabs.org
+S: Maintained
 F: Documentation/networking/device_drivers/ethernet/toshiba/spider_net.rst
 F: drivers/net/ethernet/toshiba/spider_net*
 
-- 
2.25.1



[PATCH v1 2/2] powerpc/ps3: Re-align DTB in image

2021-03-16 Thread Geoff Levand
Change the PS3 linker script to align the DTB at 8 bytes,
the same alignment as that of the of the 'generic' powerpc
linker script.

Signed-off-by: Geoff Levand 
---
 arch/powerpc/boot/zImage.ps3.lds.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/powerpc/boot/zImage.ps3.lds.S 
b/arch/powerpc/boot/zImage.ps3.lds.S
index 7b2ff2eaa73a..d0ffb493614d 100644
--- a/arch/powerpc/boot/zImage.ps3.lds.S
+++ b/arch/powerpc/boot/zImage.ps3.lds.S
@@ -8,7 +8,7 @@ SECTIONS
   .kernel:vmlinux.bin : { *(.kernel:vmlinux.bin) }
   _vmlinux_end =  .;
 
-  . = ALIGN(4096);
+  . = ALIGN(8);
   _dtb_start = .;
   .kernel:dtb : { *(.kernel:dtb) }
   _dtb_end = .;
-- 
2.25.1



[PATCH v1 1/2] powerpc/ps3: Add firmware version to proc

2021-03-16 Thread Geoff Levand
Add a new proc FS entry /proc/ps3/firmware-version that exports the
PS3's firmware version.

The firmware version is available through an LV1 hypercall, and we've
been printing it to the boot log, but haven't provided an easy way for
user utilities to get it.

Signed-off-by: Geoff Levand 
---
 arch/powerpc/platforms/ps3/setup.c | 62 --
 1 file changed, 59 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/platforms/ps3/setup.c 
b/arch/powerpc/platforms/ps3/setup.c
index e9ae5dd03593..c3c4cbf16632 100644
--- a/arch/powerpc/platforms/ps3/setup.c
+++ b/arch/powerpc/platforms/ps3/setup.c
@@ -13,6 +13,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -36,6 +37,7 @@ DEFINE_MUTEX(ps3_gpu_mutex);
 EXPORT_SYMBOL_GPL(ps3_gpu_mutex);
 
 static union ps3_firmware_version ps3_firmware_version;
+static char ps3_firmware_version_str[16];
 
 void ps3_get_firmware_version(union ps3_firmware_version *v)
 {
@@ -182,6 +184,58 @@ static int ps3_set_dabr(unsigned long dabr, unsigned long 
dabrx)
return lv1_set_dabr(dabr, dabrx) ? -1 : 0;
 }
 
+static ssize_t ps3_fw_ver_read(struct file *file, char __user *buf, size_t 
size,
+   loff_t *ppos)
+{
+   ssize_t bytes = simple_read_from_buffer(buf, size, ppos,
+   ps3_firmware_version_str, strlen(ps3_firmware_version_str));
+
+   pr_debug("%s:%d: %zd bytes '%s'\n", __func__, __LINE__, bytes,
+  ps3_firmware_version_str);
+
+   if (bytes < 0) {
+   pr_err("%s:%d: failed: %zd\n", __func__, __LINE__, bytes);
+   return bytes;
+   }
+
+   buf += bytes;
+   size -= bytes;
+
+   return bytes;
+}
+
+static int __init ps3_setup_proc(void)
+{
+   static const struct proc_ops proc_ops = {
+   .proc_read = ps3_fw_ver_read,
+   .proc_lseek = default_llseek,
+   };
+   struct proc_dir_entry *entry;
+
+   entry = proc_mkdir("ps3", NULL);
+
+   if (!entry) {
+   pr_err("%s:%d: failed.\n", __func__, __LINE__);
+   return 1;
+   }
+
+   entry = proc_create_data("ps3/firmware-version", S_IFREG | 0444, NULL,
+   &proc_ops, NULL);
+
+   if (!entry) {
+   pr_err("%s:%d: failed.\n", __func__, __LINE__);
+   return 1;
+   }
+
+   proc_set_size(entry, strlen(ps3_firmware_version_str));
+
+   pr_debug("%s:%d: '%s' = %zd bytes\n", __func__, __LINE__,
+   ps3_firmware_version_str, strlen(ps3_firmware_version_str));
+
+   return 0;
+}
+core_initcall(ps3_setup_proc);
+
 static void __init ps3_setup_arch(void)
 {
u64 tmp;
@@ -190,9 +244,11 @@ static void __init ps3_setup_arch(void)
 
lv1_get_version_info(&ps3_firmware_version.raw, &tmp);
 
-   printk(KERN_INFO "PS3 firmware version %u.%u.%u\n",
-  ps3_firmware_version.major, ps3_firmware_version.minor,
-  ps3_firmware_version.rev);
+   snprintf(ps3_firmware_version_str, sizeof(ps3_firmware_version_str),
+   "%u.%u.%u", ps3_firmware_version.major,
+   ps3_firmware_version.minor, ps3_firmware_version.rev);
+
+   printk(KERN_INFO "PS3 firmware version %s\n", ps3_firmware_version_str);
 
ps3_spu_set_platform();
 
-- 
2.25.1




[PATCH v1 0/2] PS3 Updates

2021-03-16 Thread Geoff Levand
Hi Michael,

Here are two minor updates for PS3.  The first exports the firmware version to
the proc FS, and the second re-aligns the DTB to save a little space in the
PS3's limited flash memory.

-Geoff

The following changes since commit f40ddce88593482919761f74910f42f4b84c004b:

  Linux 5.11 (2021-02-14 14:32:24 -0800)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/geoff/ps3-linux.git 
for-merge-powerpc

for you to fetch changes up to 7bee1153671a3ec71775246887894eefbfcb4b25:

  powerpc/ps3: Re-align DTB in image (2021-03-13 18:43:16 -0800)


Geoff Levand (2):
  powerpc/ps3: Add firmware version to proc
  powerpc/ps3: Re-align DTB in image

 arch/powerpc/boot/zImage.ps3.lds.S |  2 +-
 arch/powerpc/platforms/ps3/setup.c | 62 --
 2 files changed, 60 insertions(+), 4 deletions(-)

-- 
2.25.1



Re: [PATCH] sound:ppc: fix spelling typo of values

2021-04-07 Thread Geoff Levand
On 3/23/21 1:55 AM, caizhichao wrote:
> From: caizhichao 
> 
> vaules -> values
> 
> Signed-off-by: caizhichao 
> ---
>  sound/ppc/snd_ps3_reg.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Seems fine. Thanks for your contribution.

Acked-by: Geoff Levand 



<    1   2   3   4   5   6   >