LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [POWERPC 07/18] Have cell use its own dma_direct_offset variable
From: Benjamin Herrenschmidt @ 2007-12-18 19:50 UTC (permalink / raw)
  To: arnd; +Cc: linuxppc-dev, paulus
In-Reply-To: <20071218175104.846274000@arndb.de>


On Tue, 2007-12-18 at 18:48 +0100, arnd@arndb.de wrote:
> plain text document attachment
> (0017-Have-cell-use-its-own-dma_direct_offset-variable.patch)
> Rather than using the global variable, have cell use its own variable to
> store the direct DMA offset.
> 
> Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---

Ack.

>  arch/powerpc/platforms/cell/iommu.c |   10 ++++++----
>  1 files changed, 6 insertions(+), 4 deletions(-)
> 
> Index: linux-2.6-new/arch/powerpc/platforms/cell/iommu.c
> ===================================================================
> --- linux-2.6-new.orig/arch/powerpc/platforms/cell/iommu.c
> +++ linux-2.6-new/arch/powerpc/platforms/cell/iommu.c
> @@ -490,6 +490,8 @@ static struct cbe_iommu *cell_iommu_for_
>  	return NULL;
>  }
>  
> +static unsigned long cell_dma_direct_offset;
> +
>  static void cell_dma_dev_setup(struct device *dev)
>  {
>  	struct iommu_window *window;
> @@ -497,7 +499,7 @@ static void cell_dma_dev_setup(struct de
>  	struct dev_archdata *archdata = &dev->archdata;
>  
>  	if (get_pci_dma_ops() == &dma_direct_ops) {
> -		archdata->dma_data = &dma_direct_offset;
> +		archdata->dma_data = &cell_dma_direct_offset;
>  		return;
>  	}
>  
> @@ -655,7 +657,7 @@ static int __init cell_iommu_init_disabl
>  
>  	/* If we have no Axon, we set up the spider DMA magic offset */
>  	if (of_find_node_by_name(NULL, "axon") == NULL)
> -		dma_direct_offset = SPIDER_DMA_OFFSET;
> +		cell_dma_direct_offset = SPIDER_DMA_OFFSET;
>  
>  	/* Now we need to check to see where the memory is mapped
>  	 * in PCI space. We assume that all busses use the same dma
> @@ -689,10 +691,10 @@ static int __init cell_iommu_init_disabl
>  		return -ENODEV;
>  	}
>  
> -	dma_direct_offset += base;
> +	cell_dma_direct_offset += base;
>  
>  	printk("iommu: disabled, direct DMA offset is 0x%lx\n",
> -	       dma_direct_offset);
> +	       cell_dma_direct_offset);
>  
>  	return 0;
>  }
> 

^ permalink raw reply

* Re: [POWERPC 06/18] Use archdata.dma_data in dma_direct_ops
From: Benjamin Herrenschmidt @ 2007-12-18 19:49 UTC (permalink / raw)
  To: arnd; +Cc: linuxppc-dev, paulus
In-Reply-To: <20071218175104.638243000@arndb.de>


On Tue, 2007-12-18 at 18:48 +0100, arnd@arndb.de wrote:
> plain text document attachment
> (0016-Use-archdata.dma_data-in-dma_direct_ops.patch)
> Now that all platforms using dma_direct_offset setup the archdata.dma_data
> correctly, we can change the dma_direct_ops to retrieve the offset from
> the dma_data, rather than directly from the global.
> 
> Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Ack.

>  arch/powerpc/kernel/dma_64.c |   18 +++++++++++++++---
>  1 files changed, 15 insertions(+), 3 deletions(-)
> 
> Index: linux-2.6-new/arch/powerpc/kernel/dma_64.c
> ===================================================================
> --- linux-2.6-new.orig/arch/powerpc/kernel/dma_64.c
> +++ linux-2.6-new/arch/powerpc/kernel/dma_64.c
> @@ -117,6 +117,18 @@ EXPORT_SYMBOL(dma_iommu_ops);
>   */
>  unsigned long dma_direct_offset;
>  
> +static unsigned long get_dma_direct_offset(struct device *dev)
> +{
> +	unsigned long *offset;
> +
> +	offset = dev->archdata.dma_data;
> +
> +	if (offset)
> +		return *offset;
> +
> +	return 0;
> +}
> +
>  static void *dma_direct_alloc_coherent(struct device *dev, size_t size,
>  				       dma_addr_t *dma_handle, gfp_t flag)
>  {
> @@ -130,7 +142,7 @@ static void *dma_direct_alloc_coherent(s
>  		return NULL;
>  	ret = page_address(page);
>  	memset(ret, 0, size);
> -	*dma_handle = virt_to_abs(ret) | dma_direct_offset;
> +	*dma_handle = virt_to_abs(ret) | get_dma_direct_offset(dev);
>  
>  	return ret;
>  }
> @@ -145,7 +157,7 @@ static dma_addr_t dma_direct_map_single(
>  					size_t size,
>  					enum dma_data_direction direction)
>  {
> -	return virt_to_abs(ptr) | dma_direct_offset;
> +	return virt_to_abs(ptr) | get_dma_direct_offset(dev);
>  }
>  
>  static void dma_direct_unmap_single(struct device *dev, dma_addr_t dma_addr,
> @@ -161,7 +173,7 @@ static int dma_direct_map_sg(struct devi
>  	int i;
>  
>  	for_each_sg(sgl, sg, nents, i) {
> -		sg->dma_address = sg_phys(sg) | dma_direct_offset;
> +		sg->dma_address = sg_phys(sg) | get_dma_direct_offset(dev);
>  		sg->dma_length = sg->length;
>  	}
>  
> 

^ permalink raw reply

* Re: [POWERPC 05/18] Add celleb_dma_dev_setup()
From: Benjamin Herrenschmidt @ 2007-12-18 19:48 UTC (permalink / raw)
  To: arnd; +Cc: linuxppc-dev, paulus
In-Reply-To: <20071218175104.432538000@arndb.de>


On Tue, 2007-12-18 at 18:48 +0100, arnd@arndb.de wrote:
> plain text document attachment (0015-Add-celleb_dma_dev_setup.patch)
> Celleb always uses dma_direct_ops, and sets dma_direct_offset, so it too
> should set dma_data to dma_direct_offset.
> 
> Currently there's no pci_dma_dev_setup() routine for Celleb so add one.
> 
> Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---

Ack.

>  arch/powerpc/platforms/celleb/iommu.c |   14 +++++++++++++-
>  1 files changed, 13 insertions(+), 1 deletions(-)
> 
> Index: linux-2.6-new/arch/powerpc/platforms/celleb/iommu.c
> ===================================================================
> --- linux-2.6-new.orig/arch/powerpc/platforms/celleb/iommu.c
> +++ linux-2.6-new/arch/powerpc/platforms/celleb/iommu.c
> @@ -72,6 +72,17 @@ static void __init celleb_init_direct_ma
>  	dma_direct_offset = dma_base;
>  }
>  
> +static void celleb_dma_dev_setup(struct device *dev)
> +{
> +	dev->archdata.dma_ops = get_pci_dma_ops();
> +	dev->archdata.dma_data = &dma_direct_offset;
> +}
> +
> +static void celleb_pci_dma_dev_setup(struct pci_dev *pdev)
> +{
> +	celleb_dma_dev_setup(&pdev->dev);
> +}
> +
>  static int celleb_of_bus_notify(struct notifier_block *nb,
>  				unsigned long action, void *data)
>  {
> @@ -81,7 +92,7 @@ static int celleb_of_bus_notify(struct n
>  	if (action != BUS_NOTIFY_ADD_DEVICE)
>  		return 0;
>  
> -	dev->archdata.dma_ops = get_pci_dma_ops();
> +	celleb_dma_dev_setup(dev);
>  
>  	return 0;
>  }
> @@ -97,6 +108,7 @@ static int __init celleb_init_iommu(void
>  
>  	celleb_init_direct_mapping();
>  	set_pci_dma_ops(&dma_direct_ops);
> +	ppc_md.pci_dma_dev_setup = celleb_pci_dma_dev_setup;
>  	bus_register_notifier(&of_platform_bus_type, &celleb_of_bus_notifier);
>  
>  	return 0;
> 

^ permalink raw reply

* Re: [POWERPC 04/18] Set archdata.dma_data for direct DMA in cell_dma_dev_setup()
From: Benjamin Herrenschmidt @ 2007-12-18 19:48 UTC (permalink / raw)
  To: arnd; +Cc: linuxppc-dev, paulus
In-Reply-To: <20071218175104.219782000@arndb.de>


On Tue, 2007-12-18 at 18:48 +0100, arnd@arndb.de wrote:
> plain text document attachment
> (0014-Set-archdata.dma_data-for-direct-DMA-in-cell_dma_dev.patch)
> Store a pointer to the direct_dma_offset in each device's dma_data
> in the case where we're using the direct DMA ops.
> 
> Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Ack.

> ---
>  arch/powerpc/platforms/cell/iommu.c |    5 +++--
>  1 files changed, 3 insertions(+), 2 deletions(-)
> 
> Index: linux-2.6-new/arch/powerpc/platforms/cell/iommu.c
> ===================================================================
> --- linux-2.6-new.orig/arch/powerpc/platforms/cell/iommu.c
> +++ linux-2.6-new/arch/powerpc/platforms/cell/iommu.c
> @@ -496,9 +496,10 @@ static void cell_dma_dev_setup(struct de
>  	struct cbe_iommu *iommu;
>  	struct dev_archdata *archdata = &dev->archdata;
>  
> -	/* If we run without iommu, no need to do anything */
> -	if (get_pci_dma_ops() == &dma_direct_ops)
> +	if (get_pci_dma_ops() == &dma_direct_ops) {
> +		archdata->dma_data = &dma_direct_offset;
>  		return;
> +	}
>  
>  	/* Current implementation uses the first window available in that
>  	 * node's iommu. We -might- do something smarter later though it may
> 

^ permalink raw reply

* Getting this error when mounting the jffs2 partition created using mkImage..
From: ravi.rao @ 2007-12-18 19:02 UTC (permalink / raw)
  To: linuxlink-help, linuxppc-embedded; +Cc: Miki.Groftisza

[-- Attachment #1: Type: text/plain, Size: 14453 bytes --]

Hi All,
      I have u-boot based bootloader on our custom board based on 
ppc405EP. 
Various partitions are..
Amd/Fujitsu Extended Query Table at 0x0040
RoadRunner: CFI does not contain boot bank location. Assuming top.
number of CFI chips: 2
cfi_cmdset_0002: Disabling erase-suspend-program due to code brokenness.
Creating 5 MTD partitions on "RoadRunner":
0x03fc0000-0x04000000 : "U-Boot based RR Boot loader"
0x03fa0000-0x03fc0000 : "U-Boot Env Storage"
0x03f80000-0x03fa0000 : "U-Boot Redundant Env Storage"
0x027c0000-0x03f80000 : "Kernel Image"
0x00000000-0x027c0000 : "JFFS2 Linux FS"

I have used the following command to create the jffs2 file system image.
$BLDTOOLS/mkfs.jffs2 -b -e 0x10000 -d $JFFS2 -p 0x27c0000 -o rr-app_64.img
${MKIMAGE} -T filesystem -n 'RR App Image for AMD' -d rr-app_64.img 
uRR-app_64

I did tftp the uRR-app_64 at the uboot prompt and copy the image to flash 
at address 0xfc000000 using the command..
=> tftp 1000000 rr1/uRR-app_64
Trying ppc_4xx_eth0
PHY AN speed read failed, assuming 10BASE-T
PHY AN duplex read failed, assuming half duplex
ENET Speed is 10 Mbps - HALF duplex connection (EMAC0)
Using ppc_4xx_eth0 device
TFTP from server 10.2.1.1; our IP address is 10.2.254.125
Filename 'rr1/uRR-app_64'.
Load address: 0x1000000
Loading: #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #########################
done
Bytes transferred = 9109568 (8b0040 hex)
=> cp.b 1000000 fc000000 8b0040

addr=>FC000000 ...flash_id=>000000AA ... start=>FC000000 ...end=>FDFFFFFF 
...Copy to Flash...
addr=>FC000000 ...flash_id=>000000AA ... start=>FC000000 ...end=>FDFFFFFF 
...
addr=>FC8B003F ...flash_id=>000000AA ... start=>FC000000 ...end=>FDFFFFFF 
...
addr=>FC000000 ... end=>FC8B003F ...info_first=>03FFDF00 ... 
info_last=>03FFDF00 ...

Writing from src 0x1000000 to addr 0xfc000000 of length 9109568 and count 
= 9109568
done

Board boot's up fine but I get the following error at the end of boot..

IP-Config: Complete:
      device=eth0, addr=10.2.254.125, mask=255.255.0.0, gw=10.2.0.1,
     host=unknown, domain=, nis-domain=(none),
     bootserver=10.2.1.1, rootserver=10.2.1.1, rootpath=
Freeing unused kernel memory: 112k init
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000000: 
0x2705 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000004: 
0xdf63 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000008: 
0x4768 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0000000c: 
0x008b instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000018: 
0xe581 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0000001c: 
0x0507 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000020: 
0x5252 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000024: 
0x7070 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00000028: 
0x6d61 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0000002c: 
0x2066 instead
Further such events for this erase block will not be printed
CLEANMARKER node found at 0x00000040, not first node in block (0x00000000)
Node at 0x0000fbe0 with length 0x0000045a would run over the end of the 
erase block
Perhaps the file system was created with the wrong erase size?
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00010000: 
0x0103 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00010004: 
0xffa0 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00010008: 
0xa361 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0001000c: 
0x15a0 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00010010: 
0xfd66 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00010014: 
0xcfd1 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00010018: 
0x1040 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0001001c: 
0x52ab instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00010020: 
0x002c instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00010024: 
0xe510 instead
Further such events for this erase block will not be printed
Empty flash at 0x0001003c ends at 0x00010040
CLEANMARKER node found at 0x00010040, not first node in block (0x00010000)
Node at 0x0001fc38 with length 0x00000403 would run over the end of the 
erase block
Perhaps the file system was created with the wrong erase size?
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00020000: 
0x0c22 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00020004: 
0x1924 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00020008: 
0x32c8 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0002000c: 
0xc8a0 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00020010: 
0x91c1 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00020014: 
0x46ba instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00020018: 
0xbf76 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0002001c: 
0x1313 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00020020: 
0x3c50 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00020024: 
0x1040 instead
Further such events for this erase block will not be printed
Empty flash at 0x0002003c ends at 0x00020040
CLEANMARKER node found at 0x00020040, not first node in block (0x00020000)
Node at 0x0002f8e0 with length 0x0000075b would run over the end of the 
erase block
Perhaps the file system was created with the wrong erase size?
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00030000: 
0x4cff instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00030004: 
0x0e27 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00030008: 
0x1b50 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0003000c: 
0xc760 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00030010: 
0x4f80 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00030014: 
0xdaaf instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00030018: 
0x9b43 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0003001c: 
0x6103 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00030020: 
0xb076 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00030024: 
0x00a1 instead
Further such events for this erase block will not be printed
Empty flash at 0x0003003c ends at 0x00030040
CLEANMARKER node found at 0x00030040, not first node in block (0x00030000)
Node at 0x0003f954 with length 0x000006e8 would run over the end of the 
erase block
Perhaps the file system was created with the wrong erase size?
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00040000: 
0x2b40 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00040004: 
0x6d4f instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00040008: 
0x6db6 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0004000c: 
0xb0be instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00040010: 
0xe8c8 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00040014: 
0x712e instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00040018: 
0xd01d instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0004001c: 
0xf2bb instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00040020: 
0x0350 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00040024: 
0x0a83 instead
Further such events for this erase block will not be printed
Empty flash at 0x0004003c ends at 0x00040040
CLEANMARKER node found at 0x00040040, not first node in block (0x00040000)
Node at 0x0004f7f0 with length 0x0000084a would run over the end of the 
erase block
Perhaps the file system was created with the wrong erase size?
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00050000: 
0xfda7 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00050004: 
0xd769 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00050008: 
0xf4db instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0005000c: 
0x06fa instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00050010: 
0xe86f instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00050014: 
0x0132 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00050018: 
0xd8be instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0005001c: 
0x0710 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00050020: 
0x7980 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00050024: 
0x63a8 instead
Further such events for this erase block will not be printed
Empty flash at 0x0005003c ends at 0x00050040
CLEANMARKER node found at 0x00050040, not first node in block (0x00050000)
Node at 0x0005f8ac with length 0x0000078f would run over the end of the 
erase block
Perhaps the file system was created with the wrong erase size?
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00060000: 
0x501a instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00060004: 
0x00b6 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00060008: 
0x4e02 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0006000c: 
0x9ccc instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00060010: 
0x4d0c instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00060014: 
0x0c3f instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00060018: 
0xd81b instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0006001c: 
0xea19 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00060020: 
0x3258 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00060024: 
0xfb51 instead
Further such events for this erase block will not be printed
Empty flash at 0x0006003c ends at 0x00060040
CLEANMARKER node found at 0x00060040, not first node in block (0x00060000)
Node at 0x0006f8c0 with length 0x0000077c would run over the end of the 
erase block
Perhaps the file system was created with the wrong erase size?
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00070000: 
0x7dc1 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00070004: 
0x9b76 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00070008: 
0x0750 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0007000c: 
0x5a5f instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00070010: 
0x90cd instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00070014: 
0x7803 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00070018: 
0xacfe instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x0007001c: 
0x2fc0 instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00070020: 
0x6a6f instead
jffs2_scan_eraseblock(): Magic bitmask 0x1985 not found at 0x00070024: 
0xba07 instead
Further such events for this erase block will not be printed
Empty flash at 0x0007003c ends at 0x00070040
CLEANMARKER node found at 0x00070040, not first node in block (0x00070000)
Node at 0x0007ff34 with length 0x00000107 would run over the end of the 
erase block
Perhaps the file system was created with the wrong erase size?

Any help to resolve this issue is greatly appreciated..
Ravishankar Govindarao
RFL Electronics Inc.
E-mail : Ravi.Rao@rflelect.com
Voice: 973.334.3100 Ext. 233
Fax: 973.334.3863
 
CONFIDENTIALITY NOTE
This e-mail, including any attachments, may contain confidential and/or 
legally privileged information.  The Information is intended only for the 
use of the individual or entity named on this e-mail .  If you are not the 
intended recipient, you are hereby notified that any disclosure, copying, 
distribution, or the taking of any action in reliance on the contents of 
this transmitted Information is strictly prohibited.  Further, if you are 
not the intended recipient, please notify us by return e-mail and delete 
the Information promptly.
 
 
 

[-- Attachment #2: Type: text/html, Size: 22723 bytes --]

^ permalink raw reply

* [POWERPC 03/18] cell: add missing \n
From: arnd @ 2007-12-18 17:48 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev
In-Reply-To: <20071218174852.112644000@arndb.de>

Two printk() calls were missing the terminating '\n'.

Signed-off-by: Kou Ishizaki <kou.ishizaki@toshiba.co.jp>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/powerpc/platforms/cell/spu_manage.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Index: linux-2.6-new/arch/powerpc/platforms/cell/spu_manage.c
===================================================================
--- linux-2.6-new.orig/arch/powerpc/platforms/cell/spu_manage.c
+++ linux-2.6-new/arch/powerpc/platforms/cell/spu_manage.c
@@ -345,7 +345,7 @@ static int __init of_create_spu(struct s
 		}
 		ret = spu_map_interrupts_old(spu, spe);
 		if (ret) {
-			printk(KERN_ERR "%s: could not map interrupts",
+			printk(KERN_ERR "%s: could not map interrupts\n",
 				spu->name);
 			goto out_unmap;
 		}
@@ -525,7 +525,7 @@ static int __init init_affinity(void)
 		if (of_flat_dt_is_compatible(root, "IBM,CPBW-1.0"))
 			init_affinity_qs20_harcoded();
 		else
-			printk("No affinity configuration found");
+			printk("No affinity configuration found\n");
 	}
 
 	return 0;

-- 

^ permalink raw reply

* [POWERPC 11/18] cell: Convert #include of asm/of_{platform, device}.h into linux/of_{platform, device}.h.
From: arnd @ 2007-12-18 17:49 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev, Stephen Rothwell
In-Reply-To: <20071218174852.112644000@arndb.de>

Signed-off-by: Jon Loeliger <jdl@freescale.com>
Acked-by: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/powerpc/platforms/cell/cbe_cpufreq.c     |    3 ++-
 arch/powerpc/platforms/cell/cbe_cpufreq_pmi.c |    3 ++-
 arch/powerpc/platforms/cell/cbe_regs.c        |    4 ++--
 arch/powerpc/platforms/cell/iommu.c           |    2 +-
 arch/powerpc/platforms/cell/setup.c           |    2 +-
 arch/powerpc/platforms/celleb/iommu.c         |    3 +--
 arch/powerpc/platforms/celleb/setup.c         |    2 +-
 7 files changed, 10 insertions(+), 9 deletions(-)

Index: linux-2.6-new/arch/powerpc/platforms/cell/cbe_cpufreq.c
===================================================================
--- linux-2.6-new.orig/arch/powerpc/platforms/cell/cbe_cpufreq.c
+++ linux-2.6-new/arch/powerpc/platforms/cell/cbe_cpufreq.c
@@ -21,8 +21,9 @@
  */
 
 #include <linux/cpufreq.h>
+#include <linux/of_platform.h>
+
 #include <asm/machdep.h>
-#include <asm/of_platform.h>
 #include <asm/prom.h>
 #include <asm/cell-regs.h>
 #include "cbe_cpufreq.h"
Index: linux-2.6-new/arch/powerpc/platforms/cell/cbe_cpufreq_pmi.c
===================================================================
--- linux-2.6-new.orig/arch/powerpc/platforms/cell/cbe_cpufreq_pmi.c
+++ linux-2.6-new/arch/powerpc/platforms/cell/cbe_cpufreq_pmi.c
@@ -23,7 +23,8 @@
 #include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/timer.h>
-#include <asm/of_platform.h>
+#include <linux/of_platform.h>
+
 #include <asm/processor.h>
 #include <asm/prom.h>
 #include <asm/pmi.h>
Index: linux-2.6-new/arch/powerpc/platforms/cell/cbe_regs.c
===================================================================
--- linux-2.6-new.orig/arch/powerpc/platforms/cell/cbe_regs.c
+++ linux-2.6-new/arch/powerpc/platforms/cell/cbe_regs.c
@@ -9,13 +9,13 @@
 #include <linux/percpu.h>
 #include <linux/types.h>
 #include <linux/module.h>
+#include <linux/of_device.h>
+#include <linux/of_platform.h>
 
 #include <asm/io.h>
 #include <asm/pgtable.h>
 #include <asm/prom.h>
 #include <asm/ptrace.h>
-#include <asm/of_device.h>
-#include <asm/of_platform.h>
 #include <asm/cell-regs.h>
 
 /*
Index: linux-2.6-new/arch/powerpc/platforms/cell/iommu.c
===================================================================
--- linux-2.6-new.orig/arch/powerpc/platforms/cell/iommu.c
+++ linux-2.6-new/arch/powerpc/platforms/cell/iommu.c
@@ -26,13 +26,13 @@
 #include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/notifier.h>
+#include <linux/of_platform.h>
 
 #include <asm/prom.h>
 #include <asm/iommu.h>
 #include <asm/machdep.h>
 #include <asm/pci-bridge.h>
 #include <asm/udbg.h>
-#include <asm/of_platform.h>
 #include <asm/lmb.h>
 #include <asm/firmware.h>
 #include <asm/cell-regs.h>
Index: linux-2.6-new/arch/powerpc/platforms/cell/setup.c
===================================================================
--- linux-2.6-new.orig/arch/powerpc/platforms/cell/setup.c
+++ linux-2.6-new/arch/powerpc/platforms/cell/setup.c
@@ -30,6 +30,7 @@
 #include <linux/console.h>
 #include <linux/mutex.h>
 #include <linux/memory_hotplug.h>
+#include <linux/of_platform.h>
 
 #include <asm/mmu.h>
 #include <asm/processor.h>
@@ -51,7 +52,6 @@
 #include <asm/spu_priv1.h>
 #include <asm/udbg.h>
 #include <asm/mpic.h>
-#include <asm/of_platform.h>
 #include <asm/cell-regs.h>
 
 #include "interrupt.h"
Index: linux-2.6-new/arch/powerpc/platforms/celleb/iommu.c
===================================================================
--- linux-2.6-new.orig/arch/powerpc/platforms/celleb/iommu.c
+++ linux-2.6-new/arch/powerpc/platforms/celleb/iommu.c
@@ -22,8 +22,8 @@
 #include <linux/init.h>
 #include <linux/dma-mapping.h>
 #include <linux/pci.h>
+#include <linux/of_platform.h>
 
-#include <asm/of_platform.h>
 #include <asm/firmware.h>
 
 #include "beat_wrapper.h"
Index: linux-2.6-new/arch/powerpc/platforms/celleb/setup.c
===================================================================
--- linux-2.6-new.orig/arch/powerpc/platforms/celleb/setup.c
+++ linux-2.6-new/arch/powerpc/platforms/celleb/setup.c
@@ -40,6 +40,7 @@
 #include <linux/seq_file.h>
 #include <linux/root_dev.h>
 #include <linux/console.h>
+#include <linux/of_platform.h>
 
 #include <asm/mmu.h>
 #include <asm/processor.h>
@@ -52,7 +53,6 @@
 #include <asm/time.h>
 #include <asm/spu_priv1.h>
 #include <asm/firmware.h>
-#include <asm/of_platform.h>
 #include <asm/rtas.h>
 #include <asm/cell-regs.h>
 

-- 

^ permalink raw reply

* [POWERPC 08/18] Have celleb use its own dma_direct_offset variable
From: arnd @ 2007-12-18 17:49 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev
In-Reply-To: <20071218174852.112644000@arndb.de>

Rather than using the global variable, have celleb use its own variable to
store the direct DMA offset.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/powerpc/platforms/celleb/iommu.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

Index: linux-2.6-new/arch/powerpc/platforms/celleb/iommu.c
===================================================================
--- linux-2.6-new.orig/arch/powerpc/platforms/celleb/iommu.c
+++ linux-2.6-new/arch/powerpc/platforms/celleb/iommu.c
@@ -52,6 +52,8 @@ static int __init find_dma_window(u64 *i
 	return 0;
 }
 
+static unsigned long celleb_dma_direct_offset;
+
 static void __init celleb_init_direct_mapping(void)
 {
 	u64 lpar_addr, io_addr;
@@ -69,13 +71,13 @@ static void __init celleb_init_direct_ma
 				     ioid, DMA_FLAGS);
 	}
 
-	dma_direct_offset = dma_base;
+	celleb_dma_direct_offset = dma_base;
 }
 
 static void celleb_dma_dev_setup(struct device *dev)
 {
 	dev->archdata.dma_ops = get_pci_dma_ops();
-	dev->archdata.dma_data = &dma_direct_offset;
+	dev->archdata.dma_data = &celleb_dma_direct_offset;
 }
 
 static void celleb_pci_dma_dev_setup(struct pci_dev *pdev)

-- 

^ permalink raw reply

* [POWERPC 04/18] Set archdata.dma_data for direct DMA in cell_dma_dev_setup()
From: arnd @ 2007-12-18 17:48 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev
In-Reply-To: <20071218174852.112644000@arndb.de>

Store a pointer to the direct_dma_offset in each device's dma_data
in the case where we're using the direct DMA ops.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/powerpc/platforms/cell/iommu.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

Index: linux-2.6-new/arch/powerpc/platforms/cell/iommu.c
===================================================================
--- linux-2.6-new.orig/arch/powerpc/platforms/cell/iommu.c
+++ linux-2.6-new/arch/powerpc/platforms/cell/iommu.c
@@ -496,9 +496,10 @@ static void cell_dma_dev_setup(struct de
 	struct cbe_iommu *iommu;
 	struct dev_archdata *archdata = &dev->archdata;
 
-	/* If we run without iommu, no need to do anything */
-	if (get_pci_dma_ops() == &dma_direct_ops)
+	if (get_pci_dma_ops() == &dma_direct_ops) {
+		archdata->dma_data = &dma_direct_offset;
 		return;
+	}
 
 	/* Current implementation uses the first window available in that
 	 * node's iommu. We -might- do something smarter later though it may

-- 

^ permalink raw reply

* [POWERPC 09/18] Remove the global dma_direct_offset
From: arnd @ 2007-12-18 17:49 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev
In-Reply-To: <20071218174852.112644000@arndb.de>

We no longer need the global dma_direct_offset, update the comment to
reflect the new reality.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/powerpc/kernel/dma_64.c      |    7 ++++---
 include/asm-powerpc/dma-mapping.h |    2 --
 2 files changed, 4 insertions(+), 5 deletions(-)

Index: linux-2.6-new/arch/powerpc/kernel/dma_64.c
===================================================================
--- linux-2.6-new.orig/arch/powerpc/kernel/dma_64.c
+++ linux-2.6-new/arch/powerpc/kernel/dma_64.c
@@ -112,10 +112,11 @@ EXPORT_SYMBOL(dma_iommu_ops);
 /*
  * Generic direct DMA implementation
  *
- * This implementation supports a global offset that can be applied if
- * the address at which memory is visible to devices is not 0.
+ * This implementation supports a per-device offset that can be applied if
+ * the address at which memory is visible to devices is not 0. Platform code
+ * can point archdata.dma_data at an unsigned long holding the offset. By
+ * default no offset is used.
  */
-unsigned long dma_direct_offset;
 
 static unsigned long get_dma_direct_offset(struct device *dev)
 {
Index: linux-2.6-new/include/asm-powerpc/dma-mapping.h
===================================================================
--- linux-2.6-new.orig/include/asm-powerpc/dma-mapping.h
+++ linux-2.6-new/include/asm-powerpc/dma-mapping.h
@@ -186,8 +186,6 @@ static inline void dma_unmap_sg(struct d
 extern struct dma_mapping_ops dma_iommu_ops;
 extern struct dma_mapping_ops dma_direct_ops;
 
-extern unsigned long dma_direct_offset;
-
 #else /* CONFIG_PPC64 */
 
 #define dma_supported(dev, mask)	(1)

-- 

^ permalink raw reply

* [POWERPC 05/18] Add celleb_dma_dev_setup()
From: arnd @ 2007-12-18 17:48 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev
In-Reply-To: <20071218174852.112644000@arndb.de>

Celleb always uses dma_direct_ops, and sets dma_direct_offset, so it too
should set dma_data to dma_direct_offset.

Currently there's no pci_dma_dev_setup() routine for Celleb so add one.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/powerpc/platforms/celleb/iommu.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

Index: linux-2.6-new/arch/powerpc/platforms/celleb/iommu.c
===================================================================
--- linux-2.6-new.orig/arch/powerpc/platforms/celleb/iommu.c
+++ linux-2.6-new/arch/powerpc/platforms/celleb/iommu.c
@@ -72,6 +72,17 @@ static void __init celleb_init_direct_ma
 	dma_direct_offset = dma_base;
 }
 
+static void celleb_dma_dev_setup(struct device *dev)
+{
+	dev->archdata.dma_ops = get_pci_dma_ops();
+	dev->archdata.dma_data = &dma_direct_offset;
+}
+
+static void celleb_pci_dma_dev_setup(struct pci_dev *pdev)
+{
+	celleb_dma_dev_setup(&pdev->dev);
+}
+
 static int celleb_of_bus_notify(struct notifier_block *nb,
 				unsigned long action, void *data)
 {
@@ -81,7 +92,7 @@ static int celleb_of_bus_notify(struct n
 	if (action != BUS_NOTIFY_ADD_DEVICE)
 		return 0;
 
-	dev->archdata.dma_ops = get_pci_dma_ops();
+	celleb_dma_dev_setup(dev);
 
 	return 0;
 }
@@ -97,6 +108,7 @@ static int __init celleb_init_iommu(void
 
 	celleb_init_direct_mapping();
 	set_pci_dma_ops(&dma_direct_ops);
+	ppc_md.pci_dma_dev_setup = celleb_pci_dma_dev_setup;
 	bus_register_notifier(&of_platform_bus_type, &celleb_of_bus_notifier);
 
 	return 0;

-- 

^ permalink raw reply

* [POWERPC 07/18] Have cell use its own dma_direct_offset variable
From: arnd @ 2007-12-18 17:48 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev
In-Reply-To: <20071218174852.112644000@arndb.de>

Rather than using the global variable, have cell use its own variable to
store the direct DMA offset.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/powerpc/platforms/cell/iommu.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

Index: linux-2.6-new/arch/powerpc/platforms/cell/iommu.c
===================================================================
--- linux-2.6-new.orig/arch/powerpc/platforms/cell/iommu.c
+++ linux-2.6-new/arch/powerpc/platforms/cell/iommu.c
@@ -490,6 +490,8 @@ static struct cbe_iommu *cell_iommu_for_
 	return NULL;
 }
 
+static unsigned long cell_dma_direct_offset;
+
 static void cell_dma_dev_setup(struct device *dev)
 {
 	struct iommu_window *window;
@@ -497,7 +499,7 @@ static void cell_dma_dev_setup(struct de
 	struct dev_archdata *archdata = &dev->archdata;
 
 	if (get_pci_dma_ops() == &dma_direct_ops) {
-		archdata->dma_data = &dma_direct_offset;
+		archdata->dma_data = &cell_dma_direct_offset;
 		return;
 	}
 
@@ -655,7 +657,7 @@ static int __init cell_iommu_init_disabl
 
 	/* If we have no Axon, we set up the spider DMA magic offset */
 	if (of_find_node_by_name(NULL, "axon") == NULL)
-		dma_direct_offset = SPIDER_DMA_OFFSET;
+		cell_dma_direct_offset = SPIDER_DMA_OFFSET;
 
 	/* Now we need to check to see where the memory is mapped
 	 * in PCI space. We assume that all busses use the same dma
@@ -689,10 +691,10 @@ static int __init cell_iommu_init_disabl
 		return -ENODEV;
 	}
 
-	dma_direct_offset += base;
+	cell_dma_direct_offset += base;
 
 	printk("iommu: disabled, direct DMA offset is 0x%lx\n",
-	       dma_direct_offset);
+	       cell_dma_direct_offset);
 
 	return 0;
 }

-- 

^ permalink raw reply

* [POWERPC 06/18] Use archdata.dma_data in dma_direct_ops
From: arnd @ 2007-12-18 17:48 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev
In-Reply-To: <20071218174852.112644000@arndb.de>

Now that all platforms using dma_direct_offset setup the archdata.dma_data
correctly, we can change the dma_direct_ops to retrieve the offset from
the dma_data, rather than directly from the global.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/powerpc/kernel/dma_64.c |   18 +++++++++++++++---
 1 files changed, 15 insertions(+), 3 deletions(-)

Index: linux-2.6-new/arch/powerpc/kernel/dma_64.c
===================================================================
--- linux-2.6-new.orig/arch/powerpc/kernel/dma_64.c
+++ linux-2.6-new/arch/powerpc/kernel/dma_64.c
@@ -117,6 +117,18 @@ EXPORT_SYMBOL(dma_iommu_ops);
  */
 unsigned long dma_direct_offset;
 
+static unsigned long get_dma_direct_offset(struct device *dev)
+{
+	unsigned long *offset;
+
+	offset = dev->archdata.dma_data;
+
+	if (offset)
+		return *offset;
+
+	return 0;
+}
+
 static void *dma_direct_alloc_coherent(struct device *dev, size_t size,
 				       dma_addr_t *dma_handle, gfp_t flag)
 {
@@ -130,7 +142,7 @@ static void *dma_direct_alloc_coherent(s
 		return NULL;
 	ret = page_address(page);
 	memset(ret, 0, size);
-	*dma_handle = virt_to_abs(ret) | dma_direct_offset;
+	*dma_handle = virt_to_abs(ret) | get_dma_direct_offset(dev);
 
 	return ret;
 }
@@ -145,7 +157,7 @@ static dma_addr_t dma_direct_map_single(
 					size_t size,
 					enum dma_data_direction direction)
 {
-	return virt_to_abs(ptr) | dma_direct_offset;
+	return virt_to_abs(ptr) | get_dma_direct_offset(dev);
 }
 
 static void dma_direct_unmap_single(struct device *dev, dma_addr_t dma_addr,
@@ -161,7 +173,7 @@ static int dma_direct_map_sg(struct devi
 	int i;
 
 	for_each_sg(sgl, sg, nents, i) {
-		sg->dma_address = sg_phys(sg) | dma_direct_offset;
+		sg->dma_address = sg_phys(sg) | get_dma_direct_offset(dev);
 		sg->dma_length = sg->length;
 	}
 

-- 

^ permalink raw reply

* [POWERPC 10/18] Remove bogus comment in dma_direct_alloc_coherent()
From: arnd @ 2007-12-18 17:49 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev
In-Reply-To: <20071218174852.112644000@arndb.de>

Since commit c80d9133e99de1af607314107910a2a1645efb17 (Make direct DMA use
node local allocations) went in this comment makes no sense.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/powerpc/kernel/dma_64.c |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

Index: linux-2.6-new/arch/powerpc/kernel/dma_64.c
===================================================================
--- linux-2.6-new.orig/arch/powerpc/kernel/dma_64.c
+++ linux-2.6-new/arch/powerpc/kernel/dma_64.c
@@ -137,7 +137,6 @@ static void *dma_direct_alloc_coherent(s
 	void *ret;
 	int node = dev->archdata.numa_node;
 
-	/* TODO: Maybe use the numa node here too ? */
 	page = alloc_pages_node(node, flag, get_order(size));
 	if (page == NULL)
 		return NULL;

-- 

^ permalink raw reply

* [POWERPC 02/18] OProfile: fix cbe pm signal routing problem
From: arnd @ 2007-12-18 17:48 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev, Bob Nelson
In-Reply-To: <20071218174852.112644000@arndb.de>

Fix debug_bus_control and group_control PMU register values set up in
set_pm_event().  Initialize variables before calling set_pm_event().
Delete unused static array and code that initialized it.
Rename constant to better reflect usage.

Signed-off-by: Bob Nelson <rrnelson@us.ibm.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/powerpc/oprofile/op_model_cell.c |   20 +++++++++++---------
 1 files changed, 11 insertions(+), 9 deletions(-)

Index: linux-2.6-new/arch/powerpc/oprofile/op_model_cell.c
===================================================================
--- linux-2.6-new.orig/arch/powerpc/oprofile/op_model_cell.c
+++ linux-2.6-new/arch/powerpc/oprofile/op_model_cell.c
@@ -61,7 +61,7 @@ static unsigned int spu_cycle_reset;
 #define NUM_THREADS 2         /* number of physical threads in
 			       * physical processor
 			       */
-#define NUM_TRACE_BUS_WORDS 4
+#define NUM_DEBUG_BUS_WORDS 4
 #define NUM_INPUT_BUS_WORDS 2
 
 #define MAX_SPU_COUNT 0xFFFFFF	/* maximum 24 bit LFSR value */
@@ -169,7 +169,6 @@ static DEFINE_SPINLOCK(virt_cntr_lock);
 
 static u32 ctr_enabled;
 
-static unsigned char trace_bus[NUM_TRACE_BUS_WORDS];
 static unsigned char input_bus[NUM_INPUT_BUS_WORDS];
 
 /*
@@ -298,7 +297,7 @@ static void set_pm_event(u32 ctr, int ev
 
 	p->signal_group = event / 100;
 	p->bus_word = bus_word;
-	p->sub_unit = (unit_mask & 0x0000f000) >> 12;
+	p->sub_unit = GET_SUB_UNIT(unit_mask);
 
 	pm_regs.pm07_cntrl[ctr] = 0;
 	pm_regs.pm07_cntrl[ctr] |= PM07_CTR_COUNT_CYCLES(count_cycles);
@@ -334,16 +333,16 @@ static void set_pm_event(u32 ctr, int ev
 		p->bit = signal_bit;
 	}
 
-	for (i = 0; i < NUM_TRACE_BUS_WORDS; i++) {
+	for (i = 0; i < NUM_DEBUG_BUS_WORDS; i++) {
 		if (bus_word & (1 << i)) {
 			pm_regs.debug_bus_control |=
-			    (bus_type << (31 - (2 * i) + 1));
+			    (bus_type << (30 - (2 * i)));
 
 			for (j = 0; j < NUM_INPUT_BUS_WORDS; j++) {
 				if (input_bus[j] == 0xff) {
 					input_bus[j] = i;
 					pm_regs.group_control |=
-					    (i << (31 - i));
+					    (i << (30 - (2 * j)));
 
 					break;
 				}
@@ -450,6 +449,12 @@ static void cell_virtual_cntr(unsigned l
 	hdw_thread = 1 ^ hdw_thread;
 	next_hdw_thread = hdw_thread;
 
+	pm_regs.group_control = 0;
+	pm_regs.debug_bus_control = 0;
+
+	for (i = 0; i < NUM_INPUT_BUS_WORDS; i++)
+		input_bus[i] = 0xff;
+
 	/*
 	 * There are some per thread events.  Must do the
 	 * set event, for the thread that is being started
@@ -619,9 +624,6 @@ static int cell_reg_setup(struct op_coun
 		pmc_cntrl[1][i].vcntr = i;
 	}
 
-	for (i = 0; i < NUM_TRACE_BUS_WORDS; i++)
-		trace_bus[i] = 0xff;
-
 	for (i = 0; i < NUM_INPUT_BUS_WORDS; i++)
 		input_bus[i] = 0xff;
 

-- 

^ permalink raw reply

* [POWERPC 00/18] cell patches for 2.6.25
From: arnd @ 2007-12-18 17:48 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev

These are the patches I have collected for 2.6.25. It's been a bit since
the first call-for-patches for that version, but as it seems that 2.6.24
isn't imminent yet, I hope it's not too late for them.

Everyone, if there is some cell related patch that is not yet in
powerpc.git, in cell-2.6.git#spufs or in this series, it probably fell under
the table and you should resend it.

Paul, if there are no objections to these patches, please pull them from

  git://git.kernel.org/pub/scm/linux/kernel/git/arnd/cell-2.6.git for-2.6.25

Thanks,

	Arnd <><

--

^ permalink raw reply

* [POWERPC 01/18] perfmon2: make pm_interval register read/write
From: arnd @ 2007-12-18 17:48 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev, Kevin Corry, Carl Love
In-Reply-To: <20071218174852.112644000@arndb.de>

The pm_interval register in the Cell PMU is read/write, but was implemented in
the kernel as write-only. Previously, the written value was saved in a "shadow"
copy so calls to cbe_read_pm() could return the value.

Perfmon2 needs to be able to read the current values of pm_interval, so change
cbe_read_pm() to read the actual register instead of the "shadow" copy. There
is currently no code in the kernel that tries to read the pm_interval register
with cbe_read_pm() (expecting to receive the "shadow" value), so this should
not break any existing code.

Signed-off-by: Kevin Corry <kevcorry@us.ibm.com>
Signed-off-by: Carl Love <carll@us.ibm.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/powerpc/platforms/cell/pmu.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Index: linux-2.6-new/arch/powerpc/platforms/cell/pmu.c
===================================================================
--- linux-2.6-new.orig/arch/powerpc/platforms/cell/pmu.c
+++ linux-2.6-new/arch/powerpc/platforms/cell/pmu.c
@@ -213,7 +213,7 @@ u32 cbe_read_pm(u32 cpu, enum pm_reg_nam
 		break;
 
 	case pm_interval:
-		READ_SHADOW_REG(val, pm_interval);
+		READ_MMIO_UPPER32(val, pm_interval);
 		break;
 
 	case pm_start_stop:

-- 

^ permalink raw reply

* [POWERPC 18/18] cell: catch errors from sysfs_create_group()
From: arnd @ 2007-12-18 17:49 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev, Jeremy Kerr
In-Reply-To: <20071218174852.112644000@arndb.de>

We're currently getting a warning from not checking the result of
sysfs_create_group, which is declared as __must_check.

This change introduces appropriate error-handling for
spu_add_sysdev_attr_group()

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/powerpc/platforms/cell/spu_base.c |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)

Index: linux-2.6-new/arch/powerpc/platforms/cell/spu_base.c
===================================================================
--- linux-2.6-new.orig/arch/powerpc/platforms/cell/spu_base.c
+++ linux-2.6-new/arch/powerpc/platforms/cell/spu_base.c
@@ -574,13 +574,27 @@ EXPORT_SYMBOL_GPL(spu_add_sysdev_attr);
 int spu_add_sysdev_attr_group(struct attribute_group *attrs)
 {
 	struct spu *spu;
+	int rc = 0;
 
 	mutex_lock(&spu_full_list_mutex);
-	list_for_each_entry(spu, &spu_full_list, full_list)
-		sysfs_create_group(&spu->sysdev.kobj, attrs);
+	list_for_each_entry(spu, &spu_full_list, full_list) {
+		rc = sysfs_create_group(&spu->sysdev.kobj, attrs);
+
+		/* we're in trouble here, but try unwinding anyway */
+		if (rc) {
+			printk(KERN_ERR "%s: can't create sysfs group '%s'\n",
+					__func__, attrs->name);
+
+			list_for_each_entry_continue_reverse(spu,
+					&spu_full_list, full_list)
+				sysfs_remove_group(&spu->sysdev.kobj, attrs);
+			break;
+		}
+	}
+
 	mutex_unlock(&spu_full_list_mutex);
 
-	return 0;
+	return rc;
 }
 EXPORT_SYMBOL_GPL(spu_add_sysdev_attr_group);
 

-- 

^ permalink raw reply

* [POWERPC 17/18] cell: handle SPE kernel mappings that cross segment boundaries
From: arnd @ 2007-12-18 17:49 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev, Jeremy Kerr
In-Reply-To: <20071218174852.112644000@arndb.de>

Currently, we have a possibilty that the SLBs setup during context
switch don't cover the entirety of the necessary lscsa and code
regions, if these regions cross a segment boundary.

This change checks the start and end of each region, and inserts a SLB
entry for each, if unique. We also remove the assumption that the
spu_save_code and spu_restore_code reside in the same segment, by using
the specific code array for save and restore.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/powerpc/platforms/cell/spu_base.c     |   50 ++++++++++++++++++++++++----
 arch/powerpc/platforms/cell/spufs/switch.c |   11 ++++--
 include/asm-powerpc/spu.h                  |    4 +-
 3 files changed, 52 insertions(+), 13 deletions(-)

Index: linux-2.6-new/arch/powerpc/platforms/cell/spu_base.c
===================================================================
--- linux-2.6-new.orig/arch/powerpc/platforms/cell/spu_base.c
+++ linux-2.6-new/arch/powerpc/platforms/cell/spu_base.c
@@ -275,19 +275,55 @@ static void __spu_kernel_slb(void *addr,
 }
 
 /**
+ * Given an array of @nr_slbs SLB entries, @slbs, return non-zero if the
+ * address @new_addr is present.
+ */
+static inline int __slb_present(struct spu_slb *slbs, int nr_slbs,
+		void *new_addr)
+{
+	unsigned long ea = (unsigned long)new_addr;
+	int i;
+
+	for (i = 0; i < nr_slbs; i++)
+		if (!((slbs[i].esid ^ ea) & ESID_MASK))
+			return 1;
+
+	return 0;
+}
+
+/**
  * Setup the SPU kernel SLBs, in preparation for a context save/restore. We
  * need to map both the context save area, and the save/restore code.
+ *
+ * Because the lscsa and code may cross segment boundaires, we check to see
+ * if mappings are required for the start and end of each range. We currently
+ * assume that the mappings are smaller that one segment - if not, something
+ * is seriously wrong.
  */
-void spu_setup_kernel_slbs(struct spu *spu, struct spu_lscsa *lscsa, void *code)
+void spu_setup_kernel_slbs(struct spu *spu, struct spu_lscsa *lscsa,
+		void *code, int code_size)
 {
-	struct spu_slb code_slb, lscsa_slb;
+	struct spu_slb slbs[4];
+	int i, nr_slbs = 0;
+	/* start and end addresses of both mappings */
+	void *addrs[] = {
+		lscsa, (void *)lscsa + sizeof(*lscsa) - 1,
+		code, code + code_size - 1
+	};
 
-	__spu_kernel_slb(lscsa, &lscsa_slb);
-	__spu_kernel_slb(code, &code_slb);
+	/* check the set of addresses, and create a new entry in the slbs array
+	 * if there isn't already a SLB for that address */
+	for (i = 0; i < ARRAY_SIZE(addrs); i++) {
+		if (__slb_present(slbs, nr_slbs, addrs[i]))
+			continue;
+
+		__spu_kernel_slb(addrs[i], &slbs[nr_slbs]);
+		nr_slbs++;
+	}
 
-	spu_load_slb(spu, 0, &lscsa_slb);
-	if (lscsa_slb.esid != code_slb.esid)
-		spu_load_slb(spu, 1, &code_slb);
+	/* Add the set of SLBs */
+	for (i = 0; i < nr_slbs; i++)
+		spu_load_slb(spu, i, &slbs[i]);
 }
 EXPORT_SYMBOL_GPL(spu_setup_kernel_slbs);
 
Index: linux-2.6-new/arch/powerpc/platforms/cell/spufs/switch.c
===================================================================
--- linux-2.6-new.orig/arch/powerpc/platforms/cell/spufs/switch.c
+++ linux-2.6-new/arch/powerpc/platforms/cell/spufs/switch.c
@@ -691,7 +691,8 @@ static inline void resume_mfc_queue(stru
 	out_be64(&priv2->mfc_control_RW, MFC_CNTL_RESUME_DMA_QUEUE);
 }
 
-static inline void setup_mfc_slbs(struct spu_state *csa, struct spu *spu)
+static inline void setup_mfc_slbs(struct spu_state *csa, struct spu *spu,
+		unsigned int *code, int code_size)
 {
 	/* Save, Step 47:
 	 * Restore, Step 30.
@@ -708,7 +709,7 @@ static inline void setup_mfc_slbs(struct
 	 *     translation is desired by OS environment).
 	 */
 	spu_invalidate_slbs(spu);
-	spu_setup_kernel_slbs(spu, csa->lscsa, &spu_save_code);
+	spu_setup_kernel_slbs(spu, csa->lscsa, code, code_size);
 }
 
 static inline void set_switch_active(struct spu_state *csa, struct spu *spu)
@@ -1835,7 +1836,8 @@ static void save_lscsa(struct spu_state 
 	 */
 
 	resume_mfc_queue(prev, spu);	/* Step 46. */
-	setup_mfc_slbs(prev, spu);	/* Step 47. */
+	/* Step 47. */
+	setup_mfc_slbs(prev, spu, spu_save_code, sizeof(spu_save_code));
 	set_switch_active(prev, spu);	/* Step 48. */
 	enable_interrupts(prev, spu);	/* Step 49. */
 	save_ls_16kb(prev, spu);	/* Step 50. */
@@ -1940,7 +1942,8 @@ static void restore_lscsa(struct spu_sta
 	setup_spu_status_part1(next, spu);	/* Step 27. */
 	setup_spu_status_part2(next, spu);	/* Step 28. */
 	restore_mfc_rag(next, spu);	        /* Step 29. */
-	setup_mfc_slbs(next, spu);	        /* Step 30. */
+	/* Step 30. */
+	setup_mfc_slbs(next, spu, spu_restore_code, sizeof(spu_restore_code));
 	set_spu_npc(next, spu);	                /* Step 31. */
 	set_signot1(next, spu);	                /* Step 32. */
 	set_signot2(next, spu);	                /* Step 33. */
Index: linux-2.6-new/include/asm-powerpc/spu.h
===================================================================
--- linux-2.6-new.orig/include/asm-powerpc/spu.h
+++ linux-2.6-new/include/asm-powerpc/spu.h
@@ -201,8 +201,8 @@ int spu_irq_class_0_bottom(struct spu *s
 int spu_irq_class_1_bottom(struct spu *spu);
 void spu_irq_setaffinity(struct spu *spu, int cpu);
 
-void spu_setup_kernel_slbs(struct spu *spu,
-		struct spu_lscsa *lscsa, void *code);
+void spu_setup_kernel_slbs(struct spu *spu, struct spu_lscsa *lscsa,
+		void *code, int code_size);
 
 #ifdef CONFIG_KEXEC
 void crash_register_spus(struct list_head *list);

-- 

^ permalink raw reply

* [POWERPC 16/18] cell: add spu_64k_pages_available() check
From: arnd @ 2007-12-18 17:49 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev, Jeremy Kerr
In-Reply-To: <20071218174852.112644000@arndb.de>

Add a function spu_64k_pages_available(), so that we can abstract the
explicity use of mmu_psize_defs() in lssca_alloc.c

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/powerpc/platforms/cell/spu_base.c          |    6 ++++++
 arch/powerpc/platforms/cell/spufs/lscsa_alloc.c |    2 +-
 include/asm-powerpc/spu.h                       |    1 +
 3 files changed, 8 insertions(+), 1 deletions(-)

Index: linux-2.6-new/arch/powerpc/platforms/cell/spu_base.c
===================================================================
--- linux-2.6-new.orig/arch/powerpc/platforms/cell/spu_base.c
+++ linux-2.6-new/arch/powerpc/platforms/cell/spu_base.c
@@ -126,6 +126,12 @@ void spu_associate_mm(struct spu *spu, s
 }
 EXPORT_SYMBOL_GPL(spu_associate_mm);
 
+int spu_64k_pages_available(void)
+{
+	return mmu_psize_defs[MMU_PAGE_64K].shift != 0;
+}
+EXPORT_SYMBOL_GPL(spu_64k_pages_available);
+
 static int __spu_trap_invalid_dma(struct spu *spu)
 {
 	pr_debug("%s\n", __FUNCTION__);
Index: linux-2.6-new/arch/powerpc/platforms/cell/spufs/lscsa_alloc.c
===================================================================
--- linux-2.6-new.orig/arch/powerpc/platforms/cell/spufs/lscsa_alloc.c
+++ linux-2.6-new/arch/powerpc/platforms/cell/spufs/lscsa_alloc.c
@@ -73,7 +73,7 @@ int spu_alloc_lscsa(struct spu_state *cs
 	int		i, j, n_4k;
 
 	/* Check availability of 64K pages */
-	if (mmu_psize_defs[MMU_PAGE_64K].shift == 0)
+	if (!spu_64k_pages_available())
 		goto fail;
 
 	csa->use_big_pages = 1;
Index: linux-2.6-new/include/asm-powerpc/spu.h
===================================================================
--- linux-2.6-new.orig/include/asm-powerpc/spu.h
+++ linux-2.6-new/include/asm-powerpc/spu.h
@@ -214,6 +214,7 @@ static inline void crash_register_spus(s
 
 extern void spu_invalidate_slbs(struct spu *spu);
 extern void spu_associate_mm(struct spu *spu, struct mm_struct *mm);
+int spu_64k_pages_available(void);
 
 /* Calls from the memory management to the SPU */
 struct mm_struct;

-- 

^ permalink raw reply

* [POWERPC 15/18] cell: use spu_load_slb for SLB setup
From: arnd @ 2007-12-18 17:49 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev, Jeremy Kerr
In-Reply-To: <20071218174852.112644000@arndb.de>

Now that we have a helper function to setup a SPU SLB, use it for
__spu_trap_data_seq.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/powerpc/platforms/cell/spu_base.c |   23 ++++++++++-------------
 1 files changed, 10 insertions(+), 13 deletions(-)

Index: linux-2.6-new/arch/powerpc/platforms/cell/spu_base.c
===================================================================
--- linux-2.6-new.orig/arch/powerpc/platforms/cell/spu_base.c
+++ linux-2.6-new/arch/powerpc/platforms/cell/spu_base.c
@@ -169,9 +169,8 @@ static inline void spu_load_slb(struct s
 
 static int __spu_trap_data_seg(struct spu *spu, unsigned long ea)
 {
-	struct spu_priv2 __iomem *priv2 = spu->priv2;
 	struct mm_struct *mm = spu->mm;
-	u64 esid, vsid, llp;
+	struct spu_slb slb;
 	int psize;
 
 	pr_debug("%s\n", __FUNCTION__);
@@ -183,7 +182,7 @@ static int __spu_trap_data_seg(struct sp
 		printk("%s: invalid access during switch!\n", __func__);
 		return 1;
 	}
-	esid = (ea & ESID_MASK) | SLB_ESID_V;
+	slb.esid = (ea & ESID_MASK) | SLB_ESID_V;
 
 	switch(REGION_ID(ea)) {
 	case USER_REGION_ID:
@@ -192,21 +191,21 @@ static int __spu_trap_data_seg(struct sp
 #else
 		psize = mm->context.user_psize;
 #endif
-		vsid = (get_vsid(mm->context.id, ea, MMU_SEGSIZE_256M) << SLB_VSID_SHIFT) |
-				SLB_VSID_USER;
+		slb.vsid = (get_vsid(mm->context.id, ea, MMU_SEGSIZE_256M)
+				<< SLB_VSID_SHIFT) | SLB_VSID_USER;
 		break;
 	case VMALLOC_REGION_ID:
 		if (ea < VMALLOC_END)
 			psize = mmu_vmalloc_psize;
 		else
 			psize = mmu_io_psize;
-		vsid = (get_kernel_vsid(ea, MMU_SEGSIZE_256M) << SLB_VSID_SHIFT) |
-			SLB_VSID_KERNEL;
+		slb.vsid = (get_kernel_vsid(ea, MMU_SEGSIZE_256M)
+				<< SLB_VSID_SHIFT) | SLB_VSID_KERNEL;
 		break;
 	case KERNEL_REGION_ID:
 		psize = mmu_linear_psize;
-		vsid = (get_kernel_vsid(ea, MMU_SEGSIZE_256M) << SLB_VSID_SHIFT) |
-			SLB_VSID_KERNEL;
+		slb.vsid = (get_kernel_vsid(ea, MMU_SEGSIZE_256M)
+				<< SLB_VSID_SHIFT) | SLB_VSID_KERNEL;
 		break;
 	default:
 		/* Future: support kernel segments so that drivers
@@ -215,11 +214,9 @@ static int __spu_trap_data_seg(struct sp
 		pr_debug("invalid region access at %016lx\n", ea);
 		return 1;
 	}
-	llp = mmu_psize_defs[psize].sllp;
+	slb.vsid |= mmu_psize_defs[psize].sllp;
 
-	out_be64(&priv2->slb_index_W, spu->slb_replace);
-	out_be64(&priv2->slb_vsid_RW, vsid | llp);
-	out_be64(&priv2->slb_esid_RW, esid);
+	spu_load_slb(spu, spu->slb_replace, &slb);
 
 	spu->slb_replace++;
 	if (spu->slb_replace >= 8)

-- 

^ permalink raw reply

* [POWERPC 14/18] cell: handle kernel SLB setup in spu_base.c
From: arnd @ 2007-12-18 17:49 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev, Jeremy Kerr
In-Reply-To: <20071218174852.112644000@arndb.de>

Currently, the SPU context switch code (spufs/switch.c) sets up the
SPU's SLBs directly, which requires some low-level mm stuff.

This change moves the kernel SLB setup to spu_base.c, by exposing
a function spu_setup_kernel_slbs() to do this setup. This allows us
to remove the low-level mm code from switch.c, making it possible
to later move switch.c to the spufs module.

Also, add a struct spu_slb for the cases where we need to deal with
SLB entries.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/powerpc/platforms/cell/spu_base.c     |   49 ++++++++++++++++++++++++++++
 arch/powerpc/platforms/cell/spufs/switch.c |   33 +------------------
 include/asm-powerpc/spu.h                  |    4 ++
 3 files changed, 54 insertions(+), 32 deletions(-)

Index: linux-2.6-new/arch/powerpc/platforms/cell/spu_base.c
===================================================================
--- linux-2.6-new.orig/arch/powerpc/platforms/cell/spu_base.c
+++ linux-2.6-new/arch/powerpc/platforms/cell/spu_base.c
@@ -34,6 +34,7 @@
 #include <linux/linux_logo.h>
 #include <asm/spu.h>
 #include <asm/spu_priv1.h>
+#include <asm/spu_csa.h>
 #include <asm/xmon.h>
 #include <asm/prom.h>
 
@@ -73,6 +74,10 @@ static LIST_HEAD(spu_full_list);
 static DEFINE_SPINLOCK(spu_full_list_lock);
 static DEFINE_MUTEX(spu_full_list_mutex);
 
+struct spu_slb {
+	u64 esid, vsid;
+};
+
 void spu_invalidate_slbs(struct spu *spu)
 {
 	struct spu_priv2 __iomem *priv2 = spu->priv2;
@@ -150,6 +155,18 @@ static void spu_restart_dma(struct spu *
 		out_be64(&priv2->mfc_control_RW, MFC_CNTL_RESTART_DMA_COMMAND);
 }
 
+static inline void spu_load_slb(struct spu *spu, int slbe, struct spu_slb *slb)
+{
+	struct spu_priv2 __iomem *priv2 = spu->priv2;
+
+	pr_debug("%s: adding SLB[%d] 0x%016lx 0x%016lx\n",
+			__func__, slbe, slb->vsid, slb->esid);
+
+	out_be64(&priv2->slb_index_W, slbe);
+	out_be64(&priv2->slb_vsid_RW, slb->vsid);
+	out_be64(&priv2->slb_esid_RW, slb->esid);
+}
+
 static int __spu_trap_data_seg(struct spu *spu, unsigned long ea)
 {
 	struct spu_priv2 __iomem *priv2 = spu->priv2;
@@ -239,6 +256,38 @@ static int __spu_trap_data_map(struct sp
 	return 0;
 }
 
+static void __spu_kernel_slb(void *addr, struct spu_slb *slb)
+{
+	unsigned long ea = (unsigned long)addr;
+	u64 llp;
+
+	if (REGION_ID(ea) == KERNEL_REGION_ID)
+		llp = mmu_psize_defs[mmu_linear_psize].sllp;
+	else
+		llp = mmu_psize_defs[mmu_virtual_psize].sllp;
+
+	slb->vsid = (get_kernel_vsid(ea, MMU_SEGSIZE_256M) << SLB_VSID_SHIFT) |
+		SLB_VSID_KERNEL | llp;
+	slb->esid = (ea & ESID_MASK) | SLB_ESID_V;
+}
+
+/**
+ * Setup the SPU kernel SLBs, in preparation for a context save/restore. We
+ * need to map both the context save area, and the save/restore code.
+ */
+void spu_setup_kernel_slbs(struct spu *spu, struct spu_lscsa *lscsa, void *code)
+{
+	struct spu_slb code_slb, lscsa_slb;
+
+	__spu_kernel_slb(lscsa, &lscsa_slb);
+	__spu_kernel_slb(code, &code_slb);
+
+	spu_load_slb(spu, 0, &lscsa_slb);
+	if (lscsa_slb.esid != code_slb.esid)
+		spu_load_slb(spu, 1, &code_slb);
+}
+EXPORT_SYMBOL_GPL(spu_setup_kernel_slbs);
+
 static irqreturn_t
 spu_irq_class_0(int irq, void *data)
 {
Index: linux-2.6-new/arch/powerpc/platforms/cell/spufs/switch.c
===================================================================
--- linux-2.6-new.orig/arch/powerpc/platforms/cell/spufs/switch.c
+++ linux-2.6-new/arch/powerpc/platforms/cell/spufs/switch.c
@@ -691,35 +691,8 @@ static inline void resume_mfc_queue(stru
 	out_be64(&priv2->mfc_control_RW, MFC_CNTL_RESUME_DMA_QUEUE);
 }
 
-static inline void get_kernel_slb(u64 ea, u64 slb[2])
-{
-	u64 llp;
-
-	if (REGION_ID(ea) == KERNEL_REGION_ID)
-		llp = mmu_psize_defs[mmu_linear_psize].sllp;
-	else
-		llp = mmu_psize_defs[mmu_virtual_psize].sllp;
-	slb[0] = (get_kernel_vsid(ea, MMU_SEGSIZE_256M) << SLB_VSID_SHIFT) |
-		SLB_VSID_KERNEL | llp;
-	slb[1] = (ea & ESID_MASK) | SLB_ESID_V;
-}
-
-static inline void load_mfc_slb(struct spu *spu, u64 slb[2], int slbe)
-{
-	struct spu_priv2 __iomem *priv2 = spu->priv2;
-
-	out_be64(&priv2->slb_index_W, slbe);
-	eieio();
-	out_be64(&priv2->slb_vsid_RW, slb[0]);
-	out_be64(&priv2->slb_esid_RW, slb[1]);
-	eieio();
-}
-
 static inline void setup_mfc_slbs(struct spu_state *csa, struct spu *spu)
 {
-	u64 code_slb[2];
-	u64 lscsa_slb[2];
-
 	/* Save, Step 47:
 	 * Restore, Step 30.
 	 *     If MFC_SR1[R]=1, write 0 to SLB_Invalidate_All
@@ -735,11 +708,7 @@ static inline void setup_mfc_slbs(struct
 	 *     translation is desired by OS environment).
 	 */
 	spu_invalidate_slbs(spu);
-	get_kernel_slb((unsigned long)&spu_save_code[0], code_slb);
-	get_kernel_slb((unsigned long)csa->lscsa, lscsa_slb);
-	load_mfc_slb(spu, code_slb, 0);
-	if ((lscsa_slb[0] != code_slb[0]) || (lscsa_slb[1] != code_slb[1]))
-		load_mfc_slb(spu, lscsa_slb, 1);
+	spu_setup_kernel_slbs(spu, csa->lscsa, &spu_save_code);
 }
 
 static inline void set_switch_active(struct spu_state *csa, struct spu *spu)
Index: linux-2.6-new/include/asm-powerpc/spu.h
===================================================================
--- linux-2.6-new.orig/include/asm-powerpc/spu.h
+++ linux-2.6-new/include/asm-powerpc/spu.h
@@ -104,6 +104,7 @@
 
 struct spu_context;
 struct spu_runqueue;
+struct spu_lscsa;
 struct device_node;
 
 enum spu_utilization_state {
@@ -200,6 +201,9 @@ int spu_irq_class_0_bottom(struct spu *s
 int spu_irq_class_1_bottom(struct spu *spu);
 void spu_irq_setaffinity(struct spu *spu, int cpu);
 
+void spu_setup_kernel_slbs(struct spu *spu,
+		struct spu_lscsa *lscsa, void *code);
+
 #ifdef CONFIG_KEXEC
 void crash_register_spus(struct list_head *list);
 #else

-- 

^ permalink raw reply

* [POWERPC 13/18] cell: safer of_has_vicinity routine
From: arnd @ 2007-12-18 17:49 UTC (permalink / raw)
  To: paulus; +Cc: Jeremy Kerr, linuxppc-dev, Arnd Bergmann, Andre Detsch
In-Reply-To: <20071218174852.112644000@arndb.de>

This patch changes the way we check for the existence of
vicinity property in spe device nodes.

The new implementation does not depend on having an initialized
cbe_spu_info[0].spus, and checks for presence of vicinity in all
nodes, not only in the first one.

Signed-off-by: Andre Detsch <adetsch@br.ibm.com>
Signed-off-by: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/powerpc/platforms/cell/spu_manage.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)

Index: linux-2.6-new/arch/powerpc/platforms/cell/spu_manage.c
===================================================================
--- linux-2.6-new.orig/arch/powerpc/platforms/cell/spu_manage.c
+++ linux-2.6-new/arch/powerpc/platforms/cell/spu_manage.c
@@ -422,10 +422,15 @@ static void init_affinity_qs20_harcoded(
 
 static int of_has_vicinity(void)
 {
-	struct spu* spu;
+	struct device_node *dn;
 
-	spu = list_first_entry(&cbe_spu_info[0].spus, struct spu, cbe_list);
-	return of_find_property(spu_devnode(spu), "vicinity", NULL) != NULL;
+	for_each_node_by_type(dn, "spe") {
+		if (of_find_property(dn, "vicinity", NULL))  {
+			of_node_put(dn);
+			return 1;
+		}
+	}
+	return 0;
 }
 
 static struct spu *devnode_spu(int cbe, struct device_node *dn)

-- 

^ permalink raw reply

* [POWERPC 12/18] cell: export force_sig_info()
From: arnd @ 2007-12-18 17:49 UTC (permalink / raw)
  To: paulus; +Cc: linuxppc-dev, Jeremy Kerr
In-Reply-To: <20071218174852.112644000@arndb.de>

Export force_sig_info to allow signals to be sent from a modular spufs.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/powerpc/platforms/cell/spu_base.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

Index: linux-2.6-new/arch/powerpc/platforms/cell/spu_base.c
===================================================================
--- linux-2.6-new.orig/arch/powerpc/platforms/cell/spu_base.c
+++ linux-2.6-new/arch/powerpc/platforms/cell/spu_base.c
@@ -47,6 +47,13 @@ struct cbe_spu_info cbe_spu_info[MAX_NUM
 EXPORT_SYMBOL_GPL(cbe_spu_info);
 
 /*
+ * The spufs fault-handling code needs to call force_sig_info to raise signals
+ * on DMA errors. Export it here to avoid general kernel-wide access to this
+ * function
+ */
+EXPORT_SYMBOL_GPL(force_sig_info);
+
+/*
  * Protects cbe_spu_info and spu->number.
  */
 static DEFINE_SPINLOCK(spu_lock);

-- 

^ permalink raw reply

* Re: [PATCH] [POWERPC][RFC] MPC8360E-RDK: Device tree and board file
From: Anton Vorontsov @ 2007-12-18 16:51 UTC (permalink / raw)
  To: Scott Wood; +Cc: Stephen Rothwell, linuxppc-dev
In-Reply-To: <4767F271.4090703@freescale.com>

On Tue, Dec 18, 2007 at 10:16:49AM -0600, Scott Wood wrote:
> David Gibson wrote:
> >In this case the driver and binding have been developed together and
> >for the time being it does require PHY nodes, obviously.  I'm saying
> >that maybe that requirement ought to be changed.
> 
> I don't see why.
> 
> >Well, phandle is only used to find the phy node itself, so it doesn't
> >count.  The only piece of information there is the reg - the PHY id.
> >Following a phandle to another node is a fairly complex way of finding
> >a single integer.  
> >
> >Eh, I guess it's ok, but just directly giving the PHY id or a probe
> >mask in the MAC node would also be fine (we do this for 4xx EMAC).
> 
> It's not just a simple integer -- it also tells you which mdio bus it's on.

Exactly. And at least one board (MPC8568E-MDS) using this feature:
UECs are using PHYs placed on the TSEC's MDIO bus. This is hardware
configurable, and could be contrariwise: TSECs can use PHYs that
are under control of UEC MDIO bus controller.

That's why we're naming PHYs as bus:phyid.

-- 
Anton Vorontsov
email: cbou@mail.ru
backup email: ya-cbou@yandex.ru
irc://irc.freenode.net/bd2

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox