[PATCH 8/8] Convert the cell IOMMU fixed mapping to 16M IOMMU pages

2008-02-28 Thread Michael Ellerman
The only tricky part is we need to adjust the PTE insertion loop to
cater for holes in the page table. The PTEs for each segment start on
a 4K boundary, so with 16M pages we have 16 PTEs per segment and then
a gap to the next 4K page boundary.

It might be possible to allocate the PTEs for each segment separately,
saving the memory currently filling the gaps. However we'd need to
check that's OK with the hardware, and that it actually saves memory.

Signed-off-by: Michael Ellerman <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/cell/iommu.c |   37 --
 1 files changed, 22 insertions(+), 15 deletions(-)

diff --git a/arch/powerpc/platforms/cell/iommu.c 
b/arch/powerpc/platforms/cell/iommu.c
index b0e347e..20ea0e1 100644
--- a/arch/powerpc/platforms/cell/iommu.c
+++ b/arch/powerpc/platforms/cell/iommu.c
@@ -882,38 +882,45 @@ static void cell_dma_dev_setup_fixed(struct device *dev)
dev_dbg(dev, "iommu: fixed addr = %lx\n", addr);
 }
 
+static void insert_16M_pte(unsigned long addr, unsigned long *ptab,
+  unsigned long base_pte)
+{
+   unsigned long segment, offset;
+
+   segment = addr >> IO_SEGMENT_SHIFT;
+   offset = (addr >> 24) - (segment << IO_PAGENO_BITS(24));
+   ptab = ptab + (segment * (1 << 12) / sizeof(unsigned long));
+
+   pr_debug("iommu: addr %lx ptab %p segment %lx offset %lx\n",
+ addr, ptab, segment, offset);
+
+   ptab[offset] = base_pte | (__pa(addr) & IOPTE_RPN_Mask);
+}
+
 static void cell_iommu_setup_fixed_ptab(struct cbe_iommu *iommu,
struct device_node *np, unsigned long dbase, unsigned long dsize,
unsigned long fbase, unsigned long fsize)
 {
-   int i;
-   unsigned long base_pte, uaddr, *io_pte, *ptab;
+   unsigned long base_pte, uaddr, ioaddr, *ptab;
 
-   ptab = cell_iommu_alloc_ptab(iommu, fbase, fsize, dbase, dsize,
-IOMMU_PAGE_SHIFT);
+   ptab = cell_iommu_alloc_ptab(iommu, fbase, fsize, dbase, dsize, 24);
 
dma_iommu_fixed_base = fbase;
 
-   /* convert from bytes into page table indices */
-   dbase = dbase >> IOMMU_PAGE_SHIFT;
-   dsize = dsize >> IOMMU_PAGE_SHIFT;
-   fbase = fbase >> IOMMU_PAGE_SHIFT;
-   fsize = fsize >> IOMMU_PAGE_SHIFT;
-
pr_debug("iommu: mapping 0x%lx pages from 0x%lx\n", fsize, fbase);
 
-   io_pte = ptab;
base_pte = IOPTE_PP_W | IOPTE_PP_R | IOPTE_M | IOPTE_SO_RW
| (cell_iommu_get_ioid(np) & IOPTE_IOID_Mask);
 
-   uaddr = 0;
-   for (i = fbase; i < fbase + fsize; i++, uaddr += IOMMU_PAGE_SIZE) {
+   for (uaddr = 0; uaddr < fsize; uaddr += (1 << 24)) {
/* Don't touch the dynamic region */
-   if (i >= dbase && i < (dbase + dsize)) {
+   ioaddr = uaddr + fbase;
+   if (ioaddr >= dbase && ioaddr < (dbase + dsize)) {
pr_debug("iommu: fixed/dynamic overlap, skipping\n");
continue;
}
-   io_pte[i - fbase] = base_pte | (__pa(uaddr) & IOPTE_RPN_Mask);
+
+   insert_16M_pte(uaddr, ptab, base_pte);
}
 
mb();
-- 
1.5.2.rc1.1884.g59b20

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


[PATCH 7/8] Allow for different IOMMU page sizes in cell IOMMU code

2008-02-28 Thread Michael Ellerman
Make some preliminary changes to cell_iommu_alloc_ptab() to allow it to
take the page size as a parameter rather than assuming IOMMU_PAGE_SIZE.

Signed-off-by: Michael Ellerman <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/cell/iommu.c |   31 ++-
 1 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/arch/powerpc/platforms/cell/iommu.c 
b/arch/powerpc/platforms/cell/iommu.c
index 7a861cb..b0e347e 100644
--- a/arch/powerpc/platforms/cell/iommu.c
+++ b/arch/powerpc/platforms/cell/iommu.c
@@ -113,7 +113,7 @@
 
 /* IOMMU sizing */
 #define IO_SEGMENT_SHIFT   28
-#define IO_PAGENO_BITS (IO_SEGMENT_SHIFT - IOMMU_PAGE_SHIFT)
+#define IO_PAGENO_BITS(shift)  (IO_SEGMENT_SHIFT - (shift))
 
 /* The high bit needs to be set on every DMA address */
 #define SPIDER_DMA_OFFSET  0x8000ul
@@ -328,7 +328,7 @@ static void cell_iommu_setup_stab(struct cbe_iommu *iommu,
 
 static unsigned long *cell_iommu_alloc_ptab(struct cbe_iommu *iommu,
unsigned long base, unsigned long size, unsigned long gap_base,
-   unsigned long gap_size)
+   unsigned long gap_size, unsigned long page_shift)
 {
struct page *page;
int i;
@@ -337,7 +337,10 @@ static unsigned long *cell_iommu_alloc_ptab(struct 
cbe_iommu *iommu,
 
start_seg = base >> IO_SEGMENT_SHIFT;
segments  = size >> IO_SEGMENT_SHIFT;
-   pages_per_segment = 1ull << IO_PAGENO_BITS;
+   pages_per_segment = 1ull << IO_PAGENO_BITS(page_shift);
+   /* PTEs for each segment must start on a 4K bounday */
+   pages_per_segment = max(pages_per_segment,
+   (1 << 12) / sizeof(unsigned long));
 
ptab_size = segments * pages_per_segment * sizeof(unsigned long);
pr_debug("%s: iommu[%d]: ptab_size: %lu, order: %d\n", __FUNCTION__,
@@ -358,13 +361,12 @@ static unsigned long *cell_iommu_alloc_ptab(struct 
cbe_iommu *iommu,
/* initialise the STEs */
reg = IOSTE_V | ((n_pte_pages - 1) << 5);
 
-   if (IOMMU_PAGE_SIZE == 0x1000)
-   reg |= IOSTE_PS_4K;
-   else if (IOMMU_PAGE_SIZE == 0x1)
-   reg |= IOSTE_PS_64K;
-   else {
-   extern void __unknown_page_size_error(void);
-   __unknown_page_size_error();
+   switch (page_shift) {
+   case 12: reg |= IOSTE_PS_4K;  break;
+   case 16: reg |= IOSTE_PS_64K; break;
+   case 20: reg |= IOSTE_PS_1M;  break;
+   case 24: reg |= IOSTE_PS_16M; break;
+   default: BUG();
}
 
gap_base = gap_base >> IO_SEGMENT_SHIFT;
@@ -429,7 +431,8 @@ static void cell_iommu_setup_hardware(struct cbe_iommu 
*iommu,
unsigned long base, unsigned long size)
 {
cell_iommu_setup_stab(iommu, base, size, 0, 0);
-   iommu->ptab = cell_iommu_alloc_ptab(iommu, base, size, 0, 0);
+   iommu->ptab = cell_iommu_alloc_ptab(iommu, base, size, 0, 0,
+   IOMMU_PAGE_SHIFT);
cell_iommu_enable_hardware(iommu);
 }
 
@@ -886,7 +889,8 @@ static void cell_iommu_setup_fixed_ptab(struct cbe_iommu 
*iommu,
int i;
unsigned long base_pte, uaddr, *io_pte, *ptab;
 
-   ptab = cell_iommu_alloc_ptab(iommu, fbase, fsize, dbase, dsize);
+   ptab = cell_iommu_alloc_ptab(iommu, fbase, fsize, dbase, dsize,
+IOMMU_PAGE_SHIFT);
 
dma_iommu_fixed_base = fbase;
 
@@ -1008,7 +1012,8 @@ static int __init cell_iommu_fixed_mapping_init(void)
 dbase + dsize, fbase, fbase + fsize);
 
cell_iommu_setup_stab(iommu, dbase, dsize, fbase, fsize);
-   iommu->ptab = cell_iommu_alloc_ptab(iommu, dbase, dsize, 0, 0);
+   iommu->ptab = cell_iommu_alloc_ptab(iommu, dbase, dsize, 0, 0,
+   IOMMU_PAGE_SHIFT);
cell_iommu_setup_fixed_ptab(iommu, np, dbase, dsize,
 fbase, fsize);
cell_iommu_enable_hardware(iommu);
-- 
1.5.2.rc1.1884.g59b20

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


[PATCH 6/8] Cell IOMMU: n_pte_pages is in 4K page units, not IOMMU_PAGE_SIZE

2008-02-28 Thread Michael Ellerman
We use n_pte_pages to calculate the stride through the page tables, but
we also use it to set the NPPT value in the segment table entry. That is
defined as the number of 4K pages per segment, so we should calculate
it as such regardless of the IOMMU page size.

Signed-off-by: Michael Ellerman <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/cell/iommu.c |9 -
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/platforms/cell/iommu.c 
b/arch/powerpc/platforms/cell/iommu.c
index 187a723..7a861cb 100644
--- a/arch/powerpc/platforms/cell/iommu.c
+++ b/arch/powerpc/platforms/cell/iommu.c
@@ -348,9 +348,8 @@ static unsigned long *cell_iommu_alloc_ptab(struct 
cbe_iommu *iommu,
ptab = page_address(page);
memset(ptab, 0, ptab_size);
 
-   /* number of pages needed for a page table */
-   n_pte_pages = (pages_per_segment *
-  sizeof(unsigned long)) >> IOMMU_PAGE_SHIFT;
+   /* number of 4K pages needed for a page table */
+   n_pte_pages = (pages_per_segment * sizeof(unsigned long)) >> 12;
 
pr_debug("%s: iommu[%d]: stab at %p, ptab at %p, n_pte_pages: %lu\n",
__FUNCTION__, iommu->nid, iommu->stab, ptab,
@@ -377,8 +376,8 @@ static unsigned long *cell_iommu_alloc_ptab(struct 
cbe_iommu *iommu,
pr_debug("\toverlap at %d, skipping\n", i);
continue;
}
-   iommu->stab[i] = reg | (__pa(ptab) + n_pte_pages *
-   IOMMU_PAGE_SIZE * (i - start_seg));
+   iommu->stab[i] = reg | (__pa(ptab) + (n_pte_pages << 12) *
+   (i - start_seg));
pr_debug("\t[%d] 0x%016lx\n", i, iommu->stab[i]);
}
 
-- 
1.5.2.rc1.1884.g59b20

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


[PATCH 5/8] Split setup of IOMMU stab and ptab, allocate dynamic/fixed ptabs separately

2008-02-28 Thread Michael Ellerman
Currently the cell IOMMU code allocates the entire IOMMU page table in a
contiguous chunk. This is nice and tidy, but for machines with larger
amounts of RAM the page table allocation can fail due to it simply being
too large.

So split the segment table and page table setup routine, and arrange to
have the dynamic and fixed page tables allocated separately.

Signed-off-by: Michael Ellerman <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/cell/iommu.c |   69 ++-
 1 files changed, 43 insertions(+), 26 deletions(-)

diff --git a/arch/powerpc/platforms/cell/iommu.c 
b/arch/powerpc/platforms/cell/iommu.c
index 8e57e1a..187a723 100644
--- a/arch/powerpc/platforms/cell/iommu.c
+++ b/arch/powerpc/platforms/cell/iommu.c
@@ -306,50 +306,54 @@ static int cell_iommu_find_ioc(int nid, unsigned long 
*base)
return -ENODEV;
 }
 
-static void cell_iommu_setup_page_tables(struct cbe_iommu *iommu,
+static void cell_iommu_setup_stab(struct cbe_iommu *iommu,
unsigned long dbase, unsigned long dsize,
unsigned long fbase, unsigned long fsize)
 {
struct page *page;
-   int i;
-   unsigned long reg, segments, pages_per_segment, ptab_size, stab_size,
- n_pte_pages, base;
-
-   base = dbase;
-   if (fsize != 0)
-   base = min(fbase, dbase);
+   unsigned long segments, stab_size;
 
segments = max(dbase + dsize, fbase + fsize) >> IO_SEGMENT_SHIFT;
-   pages_per_segment = 1ull << IO_PAGENO_BITS;
 
-   pr_debug("%s: iommu[%d]: segments: %lu, pages per segment: %lu\n",
-   __FUNCTION__, iommu->nid, segments, pages_per_segment);
+   pr_debug("%s: iommu[%d]: segments: %lu\n",
+   __FUNCTION__, iommu->nid, segments);
 
/* set up the segment table */
stab_size = segments * sizeof(unsigned long);
page = alloc_pages_node(iommu->nid, GFP_KERNEL, get_order(stab_size));
BUG_ON(!page);
iommu->stab = page_address(page);
-   clear_page(iommu->stab);
+   memset(iommu->stab, 0, stab_size);
+}
+
+static unsigned long *cell_iommu_alloc_ptab(struct cbe_iommu *iommu,
+   unsigned long base, unsigned long size, unsigned long gap_base,
+   unsigned long gap_size)
+{
+   struct page *page;
+   int i;
+   unsigned long reg, segments, pages_per_segment, ptab_size,
+ n_pte_pages, start_seg, *ptab;
+
+   start_seg = base >> IO_SEGMENT_SHIFT;
+   segments  = size >> IO_SEGMENT_SHIFT;
+   pages_per_segment = 1ull << IO_PAGENO_BITS;
 
-   /* ... and the page tables. Since these are contiguous, we can treat
-* the page tables as one array of ptes, like pSeries does.
-*/
ptab_size = segments * pages_per_segment * sizeof(unsigned long);
pr_debug("%s: iommu[%d]: ptab_size: %lu, order: %d\n", __FUNCTION__,
iommu->nid, ptab_size, get_order(ptab_size));
page = alloc_pages_node(iommu->nid, GFP_KERNEL, get_order(ptab_size));
BUG_ON(!page);
 
-   iommu->ptab = page_address(page);
-   memset(iommu->ptab, 0, ptab_size);
+   ptab = page_address(page);
+   memset(ptab, 0, ptab_size);
 
/* number of pages needed for a page table */
n_pte_pages = (pages_per_segment *
   sizeof(unsigned long)) >> IOMMU_PAGE_SHIFT;
 
pr_debug("%s: iommu[%d]: stab at %p, ptab at %p, n_pte_pages: %lu\n",
-   __FUNCTION__, iommu->nid, iommu->stab, iommu->ptab,
+   __FUNCTION__, iommu->nid, iommu->stab, ptab,
n_pte_pages);
 
/* initialise the STEs */
@@ -364,12 +368,21 @@ static void cell_iommu_setup_page_tables(struct cbe_iommu 
*iommu,
__unknown_page_size_error();
}
 
+   gap_base = gap_base >> IO_SEGMENT_SHIFT;
+   gap_size = gap_size >> IO_SEGMENT_SHIFT;
+
pr_debug("Setting up IOMMU stab:\n");
-   for (i = base >> IO_SEGMENT_SHIFT; i < segments; i++) {
-   iommu->stab[i] = reg |
-   (__pa(iommu->ptab) + n_pte_pages * IOMMU_PAGE_SIZE * i);
+   for (i = start_seg; i < (start_seg + segments); i++) {
+   if (i >= gap_base && i < (gap_base + gap_size)) {
+   pr_debug("\toverlap at %d, skipping\n", i);
+   continue;
+   }
+   iommu->stab[i] = reg | (__pa(ptab) + n_pte_pages *
+   IOMMU_PAGE_SIZE * (i - start_seg));
pr_debug("\t[%d] 0x%016lx\n", i, iommu->stab[i]);
}
+
+   return ptab;
 }
 
 static void cell_iommu_enable_hardware(struct cbe_iommu *iommu)
@@ -416,7 +429,8 @@ static void cell_iommu_enable_hardware(struct cbe_iommu 
*iommu)
 static void cell_iommu_setup_hardware(struct cbe_iommu *iommu,
unsigned long base, unsigned long size)
 {
-

[PATCH 4/8] Move allocation of cell IOMMU pad page

2008-02-28 Thread Michael Ellerman
There's no need to allocate the pad page unless we're going to actually
use it - so move the allocation to where we know we're going to use it.

Signed-off-by: Michael Ellerman <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/cell/iommu.c |   12 ++--
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/platforms/cell/iommu.c 
b/arch/powerpc/platforms/cell/iommu.c
index 555d264..8e57e1a 100644
--- a/arch/powerpc/platforms/cell/iommu.c
+++ b/arch/powerpc/platforms/cell/iommu.c
@@ -344,12 +344,6 @@ static void cell_iommu_setup_page_tables(struct cbe_iommu 
*iommu,
iommu->ptab = page_address(page);
memset(iommu->ptab, 0, ptab_size);
 
-   /* allocate a bogus page for the end of each mapping */
-   page = alloc_pages_node(iommu->nid, GFP_KERNEL, 0);
-   BUG_ON(!page);
-   iommu->pad_page = page_address(page);
-   clear_page(iommu->pad_page);
-
/* number of pages needed for a page table */
n_pte_pages = (pages_per_segment *
   sizeof(unsigned long)) >> IOMMU_PAGE_SHIFT;
@@ -463,6 +457,7 @@ cell_iommu_setup_window(struct cbe_iommu *iommu, struct 
device_node *np,
unsigned long pte_offset)
 {
struct iommu_window *window;
+   struct page *page;
u32 ioid;
 
ioid = cell_iommu_get_ioid(np);
@@ -501,6 +496,11 @@ cell_iommu_setup_window(struct cbe_iommu *iommu, struct 
device_node *np,
 * This code also assumes that we have a window that starts at 0,
 * which is the case on all spider based blades.
 */
+   page = alloc_pages_node(iommu->nid, GFP_KERNEL, 0);
+   BUG_ON(!page);
+   iommu->pad_page = page_address(page);
+   clear_page(iommu->pad_page);
+
__set_bit(0, window->table.it_map);
tce_build_cell(&window->table, window->table.it_offset, 1,
   (unsigned long)iommu->pad_page, DMA_TO_DEVICE);
-- 
1.5.2.rc1.1884.g59b20

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


[PATCH 3/8] Remove unused pte_offset variable

2008-02-28 Thread Michael Ellerman
The cell IOMMU code no longer needs to save the pte_offset variable
separately, it is incorporated into tbl->it_offset.

Signed-off-by: Michael Ellerman <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/cell/iommu.c |5 +
 1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/platforms/cell/iommu.c 
b/arch/powerpc/platforms/cell/iommu.c
index 4e75919..555d264 100644
--- a/arch/powerpc/platforms/cell/iommu.c
+++ b/arch/powerpc/platforms/cell/iommu.c
@@ -123,7 +123,6 @@ struct iommu_window {
struct cbe_iommu *iommu;
unsigned long offset;
unsigned long size;
-   unsigned long pte_offset;
unsigned int ioid;
struct iommu_table table;
 };
@@ -475,13 +474,11 @@ cell_iommu_setup_window(struct cbe_iommu *iommu, struct 
device_node *np,
window->size = size;
window->ioid = ioid;
window->iommu = iommu;
-   window->pte_offset = pte_offset;
 
window->table.it_blocksize = 16;
window->table.it_base = (unsigned long)iommu->ptab;
window->table.it_index = iommu->nid;
-   window->table.it_offset = (offset >> IOMMU_PAGE_SHIFT) +
-   window->pte_offset;
+   window->table.it_offset = (offset >> IOMMU_PAGE_SHIFT) + pte_offset;
window->table.it_size = size >> IOMMU_PAGE_SHIFT;
 
iommu_init_table(&window->table, iommu->nid);
-- 
1.5.2.rc1.1884.g59b20

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


[PATCH 2/8] Use it_offset not pte_offset in cell IOMMU code

2008-02-28 Thread Michael Ellerman
The cell IOMMU tce build and free routines use pte_offset to convert
the index passed from the generic IOMMU code into a page table offset.

This takes into account the SPIDER_DMA_OFFSET which sets the top bit
of every DMA address.

However it doesn't cater for the IOMMU window starting at a non-zero
address, as the base of the window is not incorporated into pte_offset
at all.

As it turns out tbl->it_offset already contains the value we need, it
takes into account the base of the window and also pte_offset. So use
it instead!

Signed-off-by: Michael Ellerman <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/cell/iommu.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/platforms/cell/iommu.c 
b/arch/powerpc/platforms/cell/iommu.c
index bbe8389..4e75919 100644
--- a/arch/powerpc/platforms/cell/iommu.c
+++ b/arch/powerpc/platforms/cell/iommu.c
@@ -200,7 +200,7 @@ static void tce_build_cell(struct iommu_table *tbl, long 
index, long npages,
(window->ioid & IOPTE_IOID_Mask);
 #endif
 
-   io_pte = (unsigned long *)tbl->it_base + (index - window->pte_offset);
+   io_pte = (unsigned long *)tbl->it_base + (index - tbl->it_offset);
 
for (i = 0; i < npages; i++, uaddr += IOMMU_PAGE_SIZE)
io_pte[i] = base_pte | (__pa(uaddr) & IOPTE_RPN_Mask);
@@ -232,7 +232,7 @@ static void tce_free_cell(struct iommu_table *tbl, long 
index, long npages)
| (window->ioid & IOPTE_IOID_Mask);
 #endif
 
-   io_pte = (unsigned long *)tbl->it_base + (index - window->pte_offset);
+   io_pte = (unsigned long *)tbl->it_base + (index - tbl->it_offset);
 
for (i = 0; i < npages; i++)
io_pte[i] = pte;
-- 
1.5.2.rc1.1884.g59b20

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


[PATCH 1/8] Clearup cell IOMMU fixed mapping terminology

2008-02-28 Thread Michael Ellerman
It's called the fixed mapping, not the static mapping.

Signed-off-by: Michael Ellerman <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/cell/iommu.c |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/platforms/cell/iommu.c 
b/arch/powerpc/platforms/cell/iommu.c
index edab631..bbe8389 100644
--- a/arch/powerpc/platforms/cell/iommu.c
+++ b/arch/powerpc/platforms/cell/iommu.c
@@ -549,7 +549,7 @@ static void cell_dma_dev_setup_iommu(struct device *dev)
archdata->dma_data = &window->table;
 }
 
-static void cell_dma_dev_setup_static(struct device *dev);
+static void cell_dma_dev_setup_fixed(struct device *dev);
 
 static void cell_dma_dev_setup(struct device *dev)
 {
@@ -557,7 +557,7 @@ static void cell_dma_dev_setup(struct device *dev)
 
/* Order is important here, these are not mutually exclusive */
if (get_dma_ops(dev) == &dma_iommu_fixed_ops)
-   cell_dma_dev_setup_static(dev);
+   cell_dma_dev_setup_fixed(dev);
else if (get_pci_dma_ops() == &dma_iommu_ops)
cell_dma_dev_setup_iommu(dev);
else if (get_pci_dma_ops() == &dma_direct_ops)
@@ -858,7 +858,7 @@ static int dma_set_mask_and_switch(struct device *dev, u64 
dma_mask)
return 0;
 }
 
-static void cell_dma_dev_setup_static(struct device *dev)
+static void cell_dma_dev_setup_fixed(struct device *dev)
 {
struct dev_archdata *archdata = &dev->archdata;
u64 addr;
@@ -894,7 +894,7 @@ static void cell_iommu_setup_fixed_ptab(struct cbe_iommu 
*iommu,
for (i = fbase; i < fbase + fsize; i++, uaddr += IOMMU_PAGE_SIZE) {
/* Don't touch the dynamic region */
if (i >= dbase && i < (dbase + dsize)) {
-   pr_debug("iommu: static/dynamic overlap, skipping\n");
+   pr_debug("iommu: fixed/dynamic overlap, skipping\n");
continue;
}
io_pte[i] = base_pte | (__pa(uaddr) & IOPTE_RPN_Mask);
-- 
1.5.2.rc1.1884.g59b20

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


Re: undefined references to __udivdi3 on powerpc

2008-02-28 Thread Adrian Bunk
On Thu, Feb 28, 2008 at 02:37:18PM +0100, Olaf Hering wrote:
> 
> While debugging __divdi3 calls in drivers/crypto/hifn_795x.c (due to the
> ndelay() delay call with a s64), I found even more breakage of that
> sort. This is after a allnoconfig with ARCH=powerpc in 2.6.25-rc3,
> plus CONFIG_MODULES=y and CONFIG_CRYPTO_DEV_HIFN_795X=y:
> 
>   LD  .tmp_vmlinux1
>   kernel/built-in.o: In function `update_xtime_cache':
>   (.text+0x221a0): undefined reference to `__umoddi3'
>   kernel/built-in.o: In function `update_xtime_cache':
>   (.text+0x221c0): undefined reference to `__udivdi3'
>   kernel/built-in.o: In function `getnstimeofday':
>   (.text+0x22330): undefined reference to `__umoddi3'
>   kernel/built-in.o: In function `getnstimeofday':
>   (.text+0x22350): undefined reference to `__udivdi3'
>   kernel/built-in.o: In function `timekeeping_resume':
>   timekeeping.c:(.text+0x226a0): undefined reference to `__udivdi3'
>   timekeeping.c:(.text+0x22778): undefined reference to `__umoddi3'
>   timekeeping.c:(.text+0x22798): undefined reference to `__udivdi3'
>   kernel/built-in.o: In function `update_wall_time':
>   (.text+0x22c7c): undefined reference to `__umoddi3'
>   kernel/built-in.o: In function `update_wall_time':
>   (.text+0x22c9c): undefined reference to `__udivdi3'
>   kernel/built-in.o: In function `update_wall_time':
>   (.text+0x230f8): undefined reference to `__umoddi3'
>   kernel/built-in.o: In function `update_wall_time':
>   (.text+0x23118): undefined reference to `__udivdi3'
>   kernel/built-in.o: In function `do_settimeofday':
>   (.text+0x23520): undefined reference to `__udivdi3'
>   kernel/built-in.o: In function `timekeeping_init':
>   (.init.text+0x1870): undefined reference to `__udivdi3'
>   make[1]: *** [.tmp_vmlinux1] Error 1
> 
> But its not a regression, 2.6.24 allnoconfig does not link either on
> powerpc32. 
>...

You didn't mention your gcc version, but you should only get these 
errors when using the not yet released gcc 4.3.

And this issue is known for at about half a year.

> Olaf

cu
Adrian

-- 

   "Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
   "Only a promise," Lao Er said.
   Pearl S. Buck - Dragon Seed

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


Re: [Cbe-oss-dev] Please pull 'for-2.6.25' branch of cell tree

2008-02-28 Thread Michael Ellerman
On Fri, 2008-02-29 at 06:12 +0100, Arnd Bergmann wrote:
> Hi Paul,
> 
> Please pull from:
> 
>  master.kernel.org:/pub/scm/linux/kernel/git/arnd/cell-2.6.git for-2.6.25
> 
> To pick up a few small fixes for the cell platform. Most of it is a follow-up
> to the IOMMU rework that got merged in 2.6.25-rc1 and caused problems on
> machines with large amounts of memory.

Sorry, I have updated versions of the IOMMU patches to send. Arnd is
away for the weekend, so Paul if you just want to cherry pick the other
fixes that might work. I'll send the updated IOMMU patches momentarily.

Apologies for the churn.

cheers

-- 
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person


signature.asc
Description: This is a digitally signed message part
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Re: [PATCH 1/2] firewire: endianess fix

2008-02-28 Thread Benjamin Herrenschmidt

> Still no luck finding one here. The person I was thinking of has a 
> Lombard, which has no firewire. I did get ahold of a 667MHz Titanium, 
> but its got an Agere FW323. Pretty sure my old man actually has a Pismo, 
> but its about a 3000 mile drive over to my folks house. The search 
> continues... I wonder how many people still actually 1) have a machine 
> with this controller, 2) are running Linux on it and 3) use firewire 
> devices with it. Both of you, please speak up, we're trying to help you! 
> (if only out of morbid curiosity to see this mythical goofy controller).

First gen titanium (400/500 Mhz models) might... Paulus has one at home
I think, I'll chase that up here.

Cheers,
Ben.


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


dtc: Make -I dtb mode use fill_fullpaths()

2008-02-28 Thread David Gibson
At present -I dts and -I fs modes both use the fill_fullpaths() helper
function to fill in the fullpath and basenamelen fields of struct
node, which are useful in later parts of the code.  -I dtb mode,
however, fills these in itself.

This patch simplifies flattree.c by making -I dtb mode use
fill_fullpaths() like the others.

Signed-off-by: David Gibson <[EMAIL PROTECTED]>

Index: dtc/flattree.c
===
--- dtc.orig/flattree.c 2008-02-29 13:38:15.0 +1100
+++ dtc/flattree.c  2008-02-29 16:46:02.0 +1100
@@ -704,59 +704,37 @@ static struct reserve_info *flat_read_me
 
 static char *nodename_from_path(const char *ppath, const char *cpath)
 {
-   const char *lslash;
int plen;
 
-   lslash = strrchr(cpath, '/');
-   if (! lslash)
-   return NULL;
+   plen = strlen(ppath);
 
-   plen = lslash - cpath;
+   if (!strneq(ppath, cpath, plen))
+   die("Path \"%s\" is not valid as a child of \"%s\"\n",
+   cpath, ppath);
 
-   if (streq(cpath, "/") && streq(ppath, ""))
-   return "";
+   /* root node is a special case */
+   if (!streq(ppath, "/"))
+   plen++;
 
-   if ((plen == 0) && streq(ppath, "/"))
-   return strdup(lslash+1);
-
-   if (! strneq(ppath, cpath, plen))
-   return NULL;
-
-   return strdup(lslash+1);
-}
-
-static int find_basenamelen(const char *name)
-{
-   const char *atpos = strchr(name, '@');
-
-   if (atpos)
-   return atpos - name;
-   else
-   return strlen(name);
+   return strdup(cpath + plen);
 }
 
 static struct node *unflatten_tree(struct inbuf *dtbuf,
   struct inbuf *strbuf,
-  const char *parent_path, int flags)
+  const char *parent_flatname, int flags)
 {
struct node *node;
+   char *flatname;
u32 val;
 
node = build_node(NULL, NULL);
 
-   if (flags & FTF_FULLPATH) {
-   node->fullpath = flat_read_string(dtbuf);
-   node->name = nodename_from_path(parent_path, node->fullpath);
-
-   if (! node->name)
-   die("Path \"%s\" is not valid as a child of \"%s\"\n",
-   node->fullpath, parent_path);
-   } else {
-   node->name = flat_read_string(dtbuf);
-   node->fullpath = join_path(parent_path, node->name);
-   }
+   flatname = flat_read_string(dtbuf);
 
-   node->basenamelen = find_basenamelen(node->name);
+   if (flags & FTF_FULLPATH)
+   node->name = nodename_from_path(parent_flatname, flatname);
+   else
+   node->name = flatname;
 
do {
struct property *prop;
@@ -773,8 +751,7 @@ static struct node *unflatten_tree(struc
break;
 
case FDT_BEGIN_NODE:
-   child = unflatten_tree(dtbuf,strbuf, node->fullpath,
-  flags);
+   child = unflatten_tree(dtbuf,strbuf, flatname, flags);
add_child(node, child);
break;
 
Index: dtc/dtc.c
===
--- dtc.orig/dtc.c  2008-02-28 12:55:04.0 +1100
+++ dtc/dtc.c   2008-02-29 16:16:07.0 +1100
@@ -55,7 +55,7 @@ char *join_path(const char *path, const 
return str;
 }
 
-void fill_fullpaths(struct node *tree, const char *prefix)
+static void fill_fullpaths(struct node *tree, const char *prefix)
 {
struct node *child;
const char *unit;
@@ -208,6 +208,7 @@ int main(int argc, char *argv[])
if (! bi || ! bi->dt || bi->error)
die("Couldn't read input tree\n");
 
+   fill_fullpaths(bi->dt, "");
process_checks(force, bi);
 
if (streq(outname, "-")) {
Index: dtc/dtc.h
===
--- dtc.orig/dtc.h  2008-02-28 17:02:38.0 +1100
+++ dtc/dtc.h   2008-02-29 16:16:07.0 +1100
@@ -264,6 +264,5 @@ struct boot_info *dt_from_fs(const char 
 /* misc */
 
 char *join_path(const char *path, const char *name);
-void fill_fullpaths(struct node *tree, const char *prefix);
 
 #endif /* _DTC_H */
Index: dtc/fstree.c
===
--- dtc.orig/fstree.c   2008-02-28 12:55:04.0 +1100
+++ dtc/fstree.c2008-02-29 16:16:07.0 +1100
@@ -87,8 +87,6 @@ struct boot_info *dt_from_fs(const char 
tree = read_fstree(dirname);
tree = name_node(tree, "", NULL);
 
-   fill_fullpaths(tree, "");
-
return build_boot_info(NULL, tree);
 }
 
Index: dtc/treesource.c
===
--- dtc.orig/treesource.c

Re: [PATCH 1/2] firewire: endianess fix

2008-02-28 Thread Jarod Wilson
Benjamin Herrenschmidt wrote:
> On Thu, 2008-02-28 at 13:42 -0500, Jarod Wilson wrote:
>> On Thursday 28 February 2008 01:25:59 am Benjamin Herrenschmidt wrote:
 Under Mac OS X, system.log says "FireWire (OHCI) Apple ID 31 built-in now
 active". Could still be lucent though, judging by the subsys device ID of
 5811, which matches up w/the Lucent/Agere FW323. But no, apparently I
 don't have the interesting one.
>>> Well, it's interesting in the sense that it's a "normal" OHCI then on a
>>> BE machine :-) My Pismo, which had the weirdo one, unfortunately died a
>>> while ago. I'll see if I can find another machine with that one in.
>> Ah, the pismo has it, eh? I think I may actually know of someone in the 
>> office 
>> that still has one of those that I might be able to borrow and poke at...
> 
> I -think- it has it... Pismo definitely has one of the first variant of
> UniNorth with "working" FW afaik.
> 
> The first UniNorth was used in the first "toilet-seat" ibook, but I
> think this one didn't have firewire, or a non-working one... and in the
> first Sawtooth G4 for which FW and Ethernet even were separate PCI chips
> because the ones in UniNorth were too broken.
> 
> It's possible that early G4 titanium powerbooks or other model of FW
> iBooks have that UniNorth FW variant too.

Still no luck finding one here. The person I was thinking of has a 
Lombard, which has no firewire. I did get ahold of a 667MHz Titanium, 
but its got an Agere FW323. Pretty sure my old man actually has a Pismo, 
but its about a 3000 mile drive over to my folks house. The search 
continues... I wonder how many people still actually 1) have a machine 
with this controller, 2) are running Linux on it and 3) use firewire 
devices with it. Both of you, please speak up, we're trying to help you! 
(if only out of morbid curiosity to see this mythical goofy controller).

-- 
Jarod Wilson
[EMAIL PROTECTED]
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Please pull 'for-2.6.25' branch of cell tree

2008-02-28 Thread Arnd Bergmann
Hi Paul,

Please pull from:

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

To pick up a few small fixes for the cell platform. Most of it is a follow-up
to the IOMMU rework that got merged in 2.6.25-rc1 and caused problems on
machines with large amounts of memory.

The fixes for oprofile and ptrace are not regressions, but are fixing
functionality that was broken on cell but has always worked on the
other platforms.

Thanks,

Arnd <><

Author: Michael Ellerman <[EMAIL PROTECTED]>
[POWERPC] Convert the cell IOMMU fixed mapping to 16M IOMMU pages
[POWERPC] Allow for different IOMMU page sizes in cell IOMMU code
[POWERPC] Cell IOMMU: n_pte_pages is in 4K page units, not IOMMU_PAGE_SIZE
[POWERPC] Split setup of IOMMU stab and ptab, allocate dynamic/fixed ptabs 
separately
[POWERPC] Move allocation of cell IOMMU pad page
[POWERPC] Remove unused pte_offset variable
[POWERPC] Use it_offset not pte_offset in cell IOMMU code
[POWERPC] Clearup cell IOMMU fixed mapping terminology

Author: Jens Osterkamp <[EMAIL PROTECTED]>
[POWERPC] enable hardware watchpoints on cell blades
[POWERPC] move celleb DABRX definitions

Author: Bob Nelson <[EMAIL PROTECTED]>
[POWERPC] OProfile: enable callgraph support for Cell

 arch/powerpc/oprofile/op_model_cell.c |2
 arch/powerpc/platforms/cell/iommu.c   |  144 +++---
 arch/powerpc/platforms/cell/setup.c   |7 +
 arch/powerpc/platforms/celleb/beat.h  |3
 include/asm-powerpc/reg.h |3
 5 files changed, 92 insertions(+), 67 deletions(-)
___
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 Badari Pulavarty
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...
>   
Yes, They are testing from HMC + running "drmgr" command manually to 
hash out
all the issues.

Thanks,
Badari

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


[PATCH] [POWERPC] pci: fix bogus test for unassigned resources

2008-02-28 Thread Benjamin Herrenschmidt
A bogus test for unassigned resources that came from our 32 bits
PCI code ended up being "merged" by my previous patch series,
breaking some 64 bits setups where devices have legal resources
ending at 0x.

This fixes it by completely changing the test. We now test for
res->start == 0, as the generic code expects, and we also only
do so on platforms that don't have the PPC_PCI_PROBE_ONLY flag
set, as there are cases of pSeries and iSeries where it could
be a valid value and those can't reassign devices.

Signed-off-by: Benjamin Herrenschmidt <[EMAIL PROTECTED]>
---
 
 arch/powerpc/kernel/pci-common.c |8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

--- linux-work.orig/arch/powerpc/kernel/pci-common.c2008-02-29 
13:37:51.0 +1100
+++ linux-work/arch/powerpc/kernel/pci-common.c 2008-02-29 14:39:28.0 
+1100
@@ -748,7 +748,13 @@ static void __devinit pcibios_fixup_reso
struct resource *res = dev->resource + i;
if (!res->flags)
continue;
-   if (res->end == 0x) {
+   /* On platforms that have PPC_PCI_PROBE_ONLY set, we don't
+* consider 0 as an unassigned BAR value. It's technically
+* a valid value, but linux doesn't like it... so when we can
+* re-assign things, we do so, but if we can't, we keep it
+* around and hope for the best...
+*/
+   if (res->start == 0 && !(ppc_pci_flags & PPC_PCI_PROBE_ONLY)) {
pr_debug("PCI:%s Resource %d %016llx-%016llx [%x] is 
unassigned\n",
 pci_name(dev), i,
 (unsigned long long)res->start,
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [dtc] breaking out libfdt from dtc so other progs can use it

2008-02-28 Thread Jerry Van Baren
Jerone Young wrote:
> On Thu, 2008-02-28 at 12:59 -0600, Josh Boyer wrote:
>> On Thu, 28 Feb 2008 10:30:44 -0600
>> Jerone Young <[EMAIL PROTECTED]> wrote:

[big snip]

>> You still haven't explained why maintenance is harder or somehow less
>> doable by having it in the dtc repo.  Maintenance is very much the
>> concern of the upstream developers, which seem to be saying it's not a
>> problem for them...
> 
> I guess what I see libfdt as something like shared userspace library. At
> the moment dtc is the only userspace project to use it.  So it make
> perfect since to keep it with the source and not separated.
> 
> Though when other projects need it .. the option of having to try to
> figure out what version of dtc to grab so understand what libfdt is
> usable, can be a bit of a pain.
> 
> Though I can't really argue that you can't get around this by just
> downloading dtc and grabbing out the libfdt package..though it does
> cause some indirection.  

FWIIW, that is what the u-boot project is doing.  The last pass, I 
actually extracted the libfdt git patch(es) and then applied them to the 
u-boot tree so that the history would be carried over.  The libfdt 
portion is now quite stable and I don't see major changes coming that 
would cause this methodology to be a problem.

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


Re: [PATCH 4/4] Emerson KSI8560 base support

2008-02-28 Thread Stephen Rothwell
Hi Alexandr,

On Thu, 28 Feb 2008 21:52:02 +0300 Alexandr Smirnov <[EMAIL PROTECTED]> wrote:
>
> +void __iomem *cpld_base = NULL;

Should this be static?

> +static void cpm2_cascade(unsigned int irq, struct irq_desc *desc)
> +{
> + int cascade_irq;
> +
> + while ((cascade_irq = cpm2_get_irq()) >= 0) {
> + generic_handle_irq(cascade_irq);
> + }

We normally don't bracket single line blocks.

> +static void __init ksi8560_pic_init(void)
> +{
> + struct mpic *mpic;
> + struct resource r;
> + struct device_node *np = NULL;
> +#ifdef CONFIG_CPM2
> + int irq;
> +#endif
> +
> + np = of_find_node_by_type(np, "open-pic");

You can pass NULL as the first argument here, so you don't need the
initialisation of "np" above.

> +static struct cpm_pin ksi8560_pins[] = {

This should be marked __init.

> +static void ksi8560_show_cpuinfo(struct seq_file *m)
> +{

> + seq_printf(m, "Hardware rev\t: %d\n",
> + in_8(cpld_base + KSI8560_CPLD_HVR));

What if cpld_base is NULL?

> +static struct of_device_id __initdata of_bus_ids[] = {
> + { .type = "soc", },
> + { .name = "cpm", },
> + { .name = "localbus", },
> + {},
> +};
> +
> +static int __init declare_of_platform_devices(void)
> +{
> + if (!machine_is(ksi8560))
> + return 0;

You don't need this test because this is a machine_init_call.

> +static int __init ksi8560_probe(void)
> +{
> + unsigned long root = of_get_flat_dt_root();
> +
> + return of_flat_dt_is_compatible(root, "emerson,KSI8560");

You need to include asm/prom.h to use these routines.

-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]
http://www.canb.auug.org.au/~sfr/


pgpCSsAb2qNIG.pgp
Description: PGP signature
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Re: [PATCH 2/4] Emerson KSI8560 device tree

2008-02-28 Thread David Gibson
On Thu, Feb 28, 2008 at 09:47:27PM +0300, Alexandr Smirnov wrote:
> 
> diff --git a/arch/powerpc/boot/dts/ksi8560.dts
> b/arch/powerpc/boot/dts/ksi8560.dts

What Scott said, plus:

[snip]
> + [EMAIL PROTECTED] {
> + device_type = "i2c";

No device_type here either.

-- 
David Gibson| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 0/8] pseries: phyp dump: hypervisor-assisted dump

2008-02-28 Thread Michael Ellerman
On Thu, 2008-02-28 at 17:57 -0600, Manish Ahuja wrote:
> Changes from previous version:
> 
> The only changes are in patch 2.
> moved early_init_dt_scan_phyp_dump from rtas.c to phyp_dump.c
> Added dummy function in phyp_dump.h

This fixes the build failures I was seeing!
http://kisskb.ellerman.id.au/kisskb/head/664/

cheers

-- 
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person


signature.asc
Description: This is a digitally signed message part
___
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 1/4] Emerson KSI8560 bootwrapper

2008-02-28 Thread Stephen Rothwell
On Thu, 28 Feb 2008 21:44:38 +0300 Alexandr Smirnov <[EMAIL PROTECTED]> wrote:
>
> 
> diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile

These patches all need Signed-off-by lines and diffstat is useful.

-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]


pgpfp3vXJxSnH.pgp
Description: PGP signature
___
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 Nathan Lynch
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...
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 3/3] ppc64-specific memory notifier support

2008-02-28 Thread Michael Ellerman
On Thu, 2008-02-28 at 18:39 -0600, Nathan Lynch wrote:
> Michael Ellerman wrote:
> > On Thu, 2008-02-28 at 08:46 -0800, Badari Pulavarty wrote:
> > > Hotplug memory notifier for ppc64. This gets invoked by writing
> > > the device-node that needs to be removed to /proc/ppc64/ofdt.
> > > We need to adjust the sections and remove sysfs entries by
> > > calling __remove_pages(). Then call arch specific code to
> > > get rid of htab mappings for the section of memory.
> > > 
> > > Signed-off-by: Badari Pulavarty <[EMAIL PROTECTED]>
> > > ---
> > >  arch/powerpc/platforms/pseries/Makefile |1 
> > >  arch/powerpc/platforms/pseries/hotplug-memory.c |   98 
> > > 
> > >  2 files changed, 99 insertions(+)
> > > 
> > > Index: linux-2.6.25-rc2/arch/powerpc/platforms/pseries/hotplug-memory.c
> > > ===
> > > --- /dev/null 1970-01-01 00:00:00.0 +
> > > +++ linux-2.6.25-rc2/arch/powerpc/platforms/pseries/hotplug-memory.c  
> > > 2008-02-28 08:20:14.0 -0800
> > 
> > > +
> > > +static struct notifier_block pseries_smp_nb = {
> > > + .notifier_call = pseries_memory_notifier,
> > > +};
> > > +
> > > +static int __init pseries_memory_hotplug_init(void)
> > > +{
> > > + if (firmware_has_feature(FW_FEATURE_LPAR))
> > > + pSeries_reconfig_notifier_register(&pseries_smp_nb);
> > > +
> > > + return 0;
> > > +}
> > > +arch_initcall(pseries_memory_hotplug_init);
> > 
> > This is going to fire on non-pseries LPAR platforms, like iSeries and
> > PS3. Which is not what you want I think.
> 
> Well, the notifier will be registered, yes, but it will never be
> called because that path is reachable only from a write to
> /proc/ppc64/ofdt, which is not created on non-pseries.

Sure. Still seems better not to register it in the first place.

> Maybe it should be
> 
> machine_device_initcall(pseries, pseries_memory_hotplug_init);

I think so.

> (and pseries_cpu_hotplug_init in hotplug-cpu.c should be changed to
> machine_arch_initcall)

Yeah I noticed that was not guarded as well, and I think I'm culpable
for that :)

cheers

-- 
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person


signature.asc
Description: This is a digitally signed message part
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

[PATCH 8/8] pseries: phyp dump: config file

2008-02-28 Thread Manish Ahuja



Add hypervisor-assisted dump to kernel config

Signed-off-by: Linas Vepstas <[EMAIL PROTECTED]>

-
 arch/powerpc/Kconfig |   11 +++
 1 file changed, 11 insertions(+)

Index: 2.6.25-rc1/arch/powerpc/Kconfig
===
--- 2.6.25-rc1.orig/arch/powerpc/Kconfig2008-02-18 03:22:06.0 
-0600
+++ 2.6.25-rc1/arch/powerpc/Kconfig 2008-02-18 03:22:45.0 -0600
@@ -306,6 +306,17 @@ config CRASH_DUMP
 
  Don't change this unless you know what you are doing.
 
+config PHYP_DUMP
+   bool "Hypervisor-assisted dump (EXPERIMENTAL)"
+   depends on PPC_PSERIES && EXPERIMENTAL
+   default y
+   help
+ Hypervisor-assisted dump is meant to be a kdump replacement
+ offering robustness and speed not possible without system
+ hypervisor assistence.
+
+ If unsure, say "Y"
+
 config PPCBUG_NVRAM
bool "Enable reading PPCBUG NVRAM during boot" if PPLUS || LOPEC
default y if PPC_PREP
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 7/8] pseries: phyp dump: Tracking memory range freed.

2008-02-28 Thread Manish Ahuja

This patch tracks the size freed. For now it does a simple
rudimentary calculation of the ranges freed. The idea is
to keep it simple at the external shell script level and 
send in large chunks for now.

Signed-off-by: Manish Ahuja <[EMAIL PROTECTED]>
-

---
 arch/powerpc/platforms/pseries/phyp_dump.c |   35 +
 1 file changed, 35 insertions(+)

Index: 2.6.25-rc1/arch/powerpc/platforms/pseries/phyp_dump.c
===
--- 2.6.25-rc1.orig/arch/powerpc/platforms/pseries/phyp_dump.c  2008-02-28 
23:36:47.0 -0600
+++ 2.6.25-rc1/arch/powerpc/platforms/pseries/phyp_dump.c   2008-02-28 
23:36:49.0 -0600
@@ -262,6 +262,39 @@ void release_memory_range(unsigned long 
}
 }
 
+/**
+ * track_freed_range -- Counts the range being freed.
+ * Once the counter goes to zero, it re-registers dump for
+ * future use.
+ */
+static void
+track_freed_range(unsigned long addr, unsigned long length)
+{
+   static unsigned long scratch_area_size, reserved_area_size;
+
+   if (addr < phyp_dump_info->init_reserve_start)
+   return;
+
+   if ((addr >= phyp_dump_info->init_reserve_start) &&
+   (addr <= phyp_dump_info->init_reserve_start +
+phyp_dump_info->init_reserve_size))
+   reserved_area_size += length;
+
+   if ((addr >= phyp_dump_info->reserved_scratch_addr) &&
+   (addr <= phyp_dump_info->reserved_scratch_addr +
+phyp_dump_info->reserved_scratch_size))
+   scratch_area_size += length;
+
+   if ((reserved_area_size == phyp_dump_info->init_reserve_size) &&
+   (scratch_area_size == phyp_dump_info->reserved_scratch_size)) {
+
+   invalidate_last_dump(&phdr,
+   phyp_dump_info->reserved_scratch_addr);
+   register_dump_area(&phdr,
+   phyp_dump_info->reserved_scratch_addr);
+   }
+}
+
 /* - */
 /**
  * sysfs_release_region -- sysfs interface to release memory range.
@@ -286,6 +319,8 @@ static ssize_t store_release_region(stru
if (ret != 2)
return -EINVAL;
 
+   track_freed_range(start_addr, length);
+
/* Range-check - don't free any reserved memory that
 * wasn't reserved for phyp-dump */
if (start_addr < phyp_dump_info->init_reserve_start)
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 6/8] pseries: phyp dump: Invalidate and print dump areas.

2008-02-28 Thread Manish Ahuja

Routines to 
a. invalidate dump 
b. Calculate region that is reserved and needs to be freed. This is 
   exported through sysfs interface.

Unregister has been removed for now as it wasn't being used.

Signed-off-by: Manish Ahuja <[EMAIL PROTECTED]>
-

---
 arch/powerpc/platforms/pseries/phyp_dump.c |   83 ++---
 include/asm-powerpc/phyp_dump.h|3 +
 2 files changed, 80 insertions(+), 6 deletions(-)

Index: 2.6.25-rc1/arch/powerpc/platforms/pseries/phyp_dump.c
===
--- 2.6.25-rc1.orig/arch/powerpc/platforms/pseries/phyp_dump.c  2008-02-28 
23:36:45.0 -0600
+++ 2.6.25-rc1/arch/powerpc/platforms/pseries/phyp_dump.c   2008-02-28 
23:36:47.0 -0600
@@ -71,6 +71,10 @@ static struct phyp_dump_header phdr;
 #define DUMP_SOURCE_CPU 0x0001
 #define DUMP_SOURCE_HPTE 0x0002
 #define DUMP_SOURCE_RMO  0x0011
+#define DUMP_ERROR_FLAG 0x2000
+#define DUMP_TRIGGERED 0x4000
+#define DUMP_PERFORMED 0x8000
+
 
 /**
  * init_dump_header() - initialize the header declaring a dump
@@ -182,9 +186,15 @@ static void print_dump_header(const stru
 static void register_dump_area(struct phyp_dump_header *ph, unsigned long addr)
 {
int rc;
-   ph->cpu_data.destination_address += addr;
-   ph->hpte_data.destination_address += addr;
-   ph->kernel_data.destination_address += addr;
+
+   /* Add addr value if not initialized before */
+   if (ph->cpu_data.destination_address == 0) {
+   ph->cpu_data.destination_address += addr;
+   ph->hpte_data.destination_address += addr;
+   ph->kernel_data.destination_address += addr;
+   }
+
+   /* ToDo Invalidate kdump and free memory range. */
 
do {
rc = rtas_call(ibm_configure_kernel_dump, 3, 1, NULL,
@@ -198,6 +208,30 @@ static void register_dump_area(struct ph
}
 }
 
+static
+void invalidate_last_dump(struct phyp_dump_header *ph, unsigned long addr)
+{
+   int rc;
+
+   /* Add addr value if not initialized before */
+   if (ph->cpu_data.destination_address == 0) {
+   ph->cpu_data.destination_address += addr;
+   ph->hpte_data.destination_address += addr;
+   ph->kernel_data.destination_address += addr;
+   }
+
+   do {
+   rc = rtas_call(ibm_configure_kernel_dump, 3, 1, NULL,
+   2, ph, sizeof(struct phyp_dump_header));
+   } while (rtas_busy_delay(rc));
+
+   if (rc) {
+   printk(KERN_ERR "phyp-dump: unexpected error (%d) "
+   "on invalidate\n", rc);
+   print_dump_header(ph);
+   }
+}
+
 /* - */
 /**
  * release_memory_range -- release memory previously lmb_reserved
@@ -208,8 +242,8 @@ static void register_dump_area(struct ph
  * lmb_reserved in early boot. The released memory becomes
  * available for genreal use.
  */
-static void
-release_memory_range(unsigned long start_pfn, unsigned long nr_pages)
+static
+void release_memory_range(unsigned long start_pfn, unsigned long nr_pages)
 {
struct page *rpage;
unsigned long end_pfn;
@@ -270,8 +304,29 @@ static ssize_t store_release_region(stru
return count;
 }
 
+static ssize_t show_release_region(struct kobject *kobj,
+   struct kobj_attribute *attr, char *buf)
+{
+   u64 second_addr_range;
+
+   /* total reserved size - start of scratch area */
+   second_addr_range = phyp_dump_info->init_reserve_size -
+   phyp_dump_info->reserved_scratch_size;
+   return sprintf(buf, "CPU:0x%lx-0x%lx: HPTE:0x%lx-0x%lx:"
+   " DUMP:0x%lx-0x%lx, 0x%lx-0x%lx:\n",
+   phdr.cpu_data.destination_address,
+   phdr.cpu_data.length_copied,
+   phdr.hpte_data.destination_address,
+   phdr.hpte_data.length_copied,
+   phdr.kernel_data.destination_address,
+   phdr.kernel_data.length_copied,
+   phyp_dump_info->init_reserve_start,
+   second_addr_range);
+}
+
 static struct kobj_attribute rr = __ATTR(release_region, 0600,
-NULL, store_release_region);
+   show_release_region,
+   store_release_region);
 
 static int __init phyp_dump_setup(void)
 {
@@ -314,6 +369,22 @@ static int __init phyp_dump_setup(void)
return 0;
}
 
+   /* re-register the dump area, if old dump was invalid */
+   if ((dump_header) && (dump_header->status & DUMP_ERROR_FLAG)) {
+   invalidate_last_dump(&phdr, dump_area_start);
+   register_dump_area(&phdr, dump_area_start);
+   return 0;
+   }
+
+   if (dump_header) {
+   phyp_dump_info->reserved_scratch

[PATCH 5/8] pseries: phyp dump: debugging print routines.

2008-02-28 Thread Manish Ahuja

Provide some basic debugging support.

Signed-off-by: Manish Ahuja <[EMAIL PROTECTED]>
Signed-off-by: Linas Vepstas <[EMAIL PROTECTED]>
-

 arch/powerpc/platforms/pseries/phyp_dump.c |   61 -
 1 file changed, 59 insertions(+), 2 deletions(-)

Index: 2.6.25-rc1/arch/powerpc/platforms/pseries/phyp_dump.c
===
--- 2.6.25-rc1.orig/arch/powerpc/platforms/pseries/phyp_dump.c  2008-02-28 
23:36:42.0 -0600
+++ 2.6.25-rc1/arch/powerpc/platforms/pseries/phyp_dump.c   2008-02-28 
23:36:45.0 -0600
@@ -124,6 +124,61 @@ static unsigned long init_dump_header(st
return addr_offset;
 }
 
+static void print_dump_header(const struct phyp_dump_header *ph)
+{
+#ifdef DEBUG
+   printk(KERN_INFO "dump header:\n");
+   /* setup some ph->sections required */
+   printk(KERN_INFO "version = %d\n", ph->version);
+   printk(KERN_INFO "Sections = %d\n", ph->num_of_sections);
+   printk(KERN_INFO "Status = 0x%x\n", ph->status);
+
+   /* No ph->disk, so all should be set to 0 */
+   printk(KERN_INFO "Offset to first section 0x%x\n",
+   ph->first_offset_section);
+   printk(KERN_INFO "dump disk sections should be zero\n");
+   printk(KERN_INFO "dump disk section = %d\n", ph->dump_disk_section);
+   printk(KERN_INFO "block num = %ld\n", ph->block_num_dd);
+   printk(KERN_INFO "number of blocks = %ld\n", ph->num_of_blocks_dd);
+   printk(KERN_INFO "dump disk offset = %d\n", ph->offset_dd);
+   printk(KERN_INFO "Max auto time= %d\n", ph->maxtime_to_auto);
+
+   /*set cpu state and hpte states as well scratch pad area */
+   printk(KERN_INFO " CPU AREA \n");
+   printk(KERN_INFO "cpu dump_flags =%d\n", ph->cpu_data.dump_flags);
+   printk(KERN_INFO "cpu source_type =%d\n", ph->cpu_data.source_type);
+   printk(KERN_INFO "cpu error_flags =%d\n", ph->cpu_data.error_flags);
+   printk(KERN_INFO "cpu source_address =%lx\n",
+   ph->cpu_data.source_address);
+   printk(KERN_INFO "cpu source_length =%lx\n",
+   ph->cpu_data.source_length);
+   printk(KERN_INFO "cpu length_copied =%lx\n",
+   ph->cpu_data.length_copied);
+
+   printk(KERN_INFO " HPTE AREA \n");
+   printk(KERN_INFO "HPTE dump_flags =%d\n", ph->hpte_data.dump_flags);
+   printk(KERN_INFO "HPTE source_type =%d\n", ph->hpte_data.source_type);
+   printk(KERN_INFO "HPTE error_flags =%d\n", ph->hpte_data.error_flags);
+   printk(KERN_INFO "HPTE source_address =%lx\n",
+   ph->hpte_data.source_address);
+   printk(KERN_INFO "HPTE source_length =%lx\n",
+   ph->hpte_data.source_length);
+   printk(KERN_INFO "HPTE length_copied =%lx\n",
+   ph->hpte_data.length_copied);
+
+   printk(KERN_INFO " SRSD AREA \n");
+   printk(KERN_INFO "SRSD dump_flags =%d\n", ph->kernel_data.dump_flags);
+   printk(KERN_INFO "SRSD source_type =%d\n", ph->kernel_data.source_type);
+   printk(KERN_INFO "SRSD error_flags =%d\n", ph->kernel_data.error_flags);
+   printk(KERN_INFO "SRSD source_address =%lx\n",
+   ph->kernel_data.source_address);
+   printk(KERN_INFO "SRSD source_length =%lx\n",
+   ph->kernel_data.source_length);
+   printk(KERN_INFO "SRSD length_copied =%lx\n",
+   ph->kernel_data.length_copied);
+#endif
+}
+
 static void register_dump_area(struct phyp_dump_header *ph, unsigned long addr)
 {
int rc;
@@ -136,9 +191,11 @@ static void register_dump_area(struct ph
1, ph, sizeof(struct phyp_dump_header));
} while (rtas_busy_delay(rc));
 
-   if (rc)
+   if (rc) {
printk(KERN_ERR "phyp-dump: unexpected error (%d) on "
"register\n", rc);
+   print_dump_header(ph);
+   }
 }
 
 /* - */
@@ -247,8 +304,8 @@ static int __init phyp_dump_setup(void)
of_node_put(rtas);
}
 
+   print_dump_header(dump_header);
dump_area_length = init_dump_header(&phdr);
-
/* align down */
dump_area_start = phyp_dump_info->init_reserve_start & PAGE_MASK;
 
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 4/8] pseries: phyp dump: register dump area.

2008-02-28 Thread Manish Ahuja

Set up the actual dump header, register it with the hypervisor.

Signed-off-by: Manish Ahuja <[EMAIL PROTECTED]>
Signed-off-by: Linas Vepstas <[EMAIL PROTECTED]>

--
 arch/powerpc/platforms/pseries/phyp_dump.c |  137 +++--
 1 file changed, 131 insertions(+), 6 deletions(-)

Index: 2.6.25-rc1/arch/powerpc/platforms/pseries/phyp_dump.c
===
--- 2.6.25-rc1.orig/arch/powerpc/platforms/pseries/phyp_dump.c  2008-02-28 
23:36:01.0 -0600
+++ 2.6.25-rc1/arch/powerpc/platforms/pseries/phyp_dump.c   2008-02-28 
23:36:42.0 -0600
@@ -30,6 +30,117 @@
 static struct phyp_dump phyp_dump_global;
 struct phyp_dump *phyp_dump_info = &phyp_dump_global;
 
+static int ibm_configure_kernel_dump;
+/* - */
+/* RTAS interfaces to declare the dump regions */
+
+struct dump_section {
+   u32 dump_flags;
+   u16 source_type;
+   u16 error_flags;
+   u64 source_address;
+   u64 source_length;
+   u64 length_copied;
+   u64 destination_address;
+};
+
+struct phyp_dump_header {
+   u32 version;
+   u16 num_of_sections;
+   u16 status;
+
+   u32 first_offset_section;
+   u32 dump_disk_section;
+   u64 block_num_dd;
+   u64 num_of_blocks_dd;
+   u32 offset_dd;
+   u32 maxtime_to_auto;
+   /* No dump disk path string used */
+
+   struct dump_section cpu_data;
+   struct dump_section hpte_data;
+   struct dump_section kernel_data;
+};
+
+/* The dump header *must be* in low memory, so .bss it */
+static struct phyp_dump_header phdr;
+
+#define NUM_DUMP_SECTIONS 3
+#define DUMP_HEADER_VERSION 0x1
+#define DUMP_REQUEST_FLAG 0x1
+#define DUMP_SOURCE_CPU 0x0001
+#define DUMP_SOURCE_HPTE 0x0002
+#define DUMP_SOURCE_RMO  0x0011
+
+/**
+ * init_dump_header() - initialize the header declaring a dump
+ * Returns: length of dump save area.
+ *
+ * When the hypervisor saves crashed state, it needs to put
+ * it somewhere. The dump header tells the hypervisor where
+ * the data can be saved.
+ */
+static unsigned long init_dump_header(struct phyp_dump_header *ph)
+{
+   unsigned long addr_offset = 0;
+
+   /* Set up the dump header */
+   ph->version = DUMP_HEADER_VERSION;
+   ph->num_of_sections = NUM_DUMP_SECTIONS;
+   ph->status = 0;
+
+   ph->first_offset_section =
+   (u32)offsetof(struct phyp_dump_header, cpu_data);
+   ph->dump_disk_section = 0;
+   ph->block_num_dd = 0;
+   ph->num_of_blocks_dd = 0;
+   ph->offset_dd = 0;
+
+   ph->maxtime_to_auto = 0; /* disabled */
+
+   /* The first two sections are mandatory */
+   ph->cpu_data.dump_flags = DUMP_REQUEST_FLAG;
+   ph->cpu_data.source_type = DUMP_SOURCE_CPU;
+   ph->cpu_data.source_address = 0;
+   ph->cpu_data.source_length = phyp_dump_info->cpu_state_size;
+   ph->cpu_data.destination_address = addr_offset;
+   addr_offset += phyp_dump_info->cpu_state_size;
+
+   ph->hpte_data.dump_flags = DUMP_REQUEST_FLAG;
+   ph->hpte_data.source_type = DUMP_SOURCE_HPTE;
+   ph->hpte_data.source_address = 0;
+   ph->hpte_data.source_length = phyp_dump_info->hpte_region_size;
+   ph->hpte_data.destination_address = addr_offset;
+   addr_offset += phyp_dump_info->hpte_region_size;
+
+   /* This section describes the low kernel region */
+   ph->kernel_data.dump_flags = DUMP_REQUEST_FLAG;
+   ph->kernel_data.source_type = DUMP_SOURCE_RMO;
+   ph->kernel_data.source_address = PHYP_DUMP_RMR_START;
+   ph->kernel_data.source_length = PHYP_DUMP_RMR_END;
+   ph->kernel_data.destination_address = addr_offset;
+   addr_offset += ph->kernel_data.source_length;
+
+   return addr_offset;
+}
+
+static void register_dump_area(struct phyp_dump_header *ph, unsigned long addr)
+{
+   int rc;
+   ph->cpu_data.destination_address += addr;
+   ph->hpte_data.destination_address += addr;
+   ph->kernel_data.destination_address += addr;
+
+   do {
+   rc = rtas_call(ibm_configure_kernel_dump, 3, 1, NULL,
+   1, ph, sizeof(struct phyp_dump_header));
+   } while (rtas_busy_delay(rc));
+
+   if (rc)
+   printk(KERN_ERR "phyp-dump: unexpected error (%d) on "
+   "register\n", rc);
+}
+
 /* - */
 /**
  * release_memory_range -- release memory previously lmb_reserved
@@ -108,7 +219,9 @@ static struct kobj_attribute rr = __ATTR
 static int __init phyp_dump_setup(void)
 {
struct device_node *rtas;
-   const int *dump_header = NULL;
+   const struct phyp_dump_header *dump_header = NULL;
+   unsigned long dump_area_start;
+   unsigned long dump_area_length;
int header_len = 0;
int rc;
 
@@ -120,7 +233,13 @@ static int __init phyp_dump_setup(void)
if 

[PATCH 3/8] pseries: phyp dump: use sysfs to release reserved mem

2008-02-28 Thread Manish Ahuja

Check to see if there actually is data from a previously
crashed kernel waiting. If so, Allow user-sapce tools to
grab the data (by reading /proc/kcore). When user-space 
finishes dumping a section, it must release that memory
by writing to sysfs. For example,

  echo "0x4000 0x1000" > /sys/kernel/release_region

will release 256MB starting at the 1GB.  The released memory
becomes free for general use.

Signed-off-by: Linas Vepstas <[EMAIL PROTECTED]>
Signed-off-by: Manish Ahuja <[EMAIL PROTECTED]>

--
 arch/powerpc/platforms/pseries/phyp_dump.c |   82 +++--
 1 file changed, 77 insertions(+), 5 deletions(-)

Index: 2.6.25-rc1/arch/powerpc/platforms/pseries/phyp_dump.c
===
--- 2.6.25-rc1.orig/arch/powerpc/platforms/pseries/phyp_dump.c  2008-02-28 
21:57:52.0 -0600
+++ 2.6.25-rc1/arch/powerpc/platforms/pseries/phyp_dump.c   2008-02-28 
23:36:01.0 -0600
@@ -12,19 +12,25 @@
  */
 
 #include 
+#include 
 #include 
+#include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
 #include 
 #include 
+#include 
+
 
 /* Global, used to communicate data between early boot and late boot */
 static struct phyp_dump phyp_dump_global;
 struct phyp_dump *phyp_dump_info = &phyp_dump_global;
 
+/* - */
 /**
  * release_memory_range -- release memory previously lmb_reserved
  * @start_pfn: starting physical frame number
@@ -54,18 +60,84 @@ release_memory_range(unsigned long start
}
 }
 
-static int __init phyp_dump_setup(void)
+/* - */
+/**
+ * sysfs_release_region -- sysfs interface to release memory range.
+ *
+ * Usage:
+ *   "echo   > /sys/kernel/release_region"
+ *
+ * Example:
+ *   "echo 0x4000 0x1000 > /sys/kernel/release_region"
+ *
+ * will release 256MB starting at 1GB.
+ */
+static ssize_t store_release_region(struct kobject *kobj,
+   struct kobj_attribute *attr,
+   const char *buf, size_t count)
 {
+   unsigned long start_addr, length, end_addr;
unsigned long start_pfn, nr_pages;
+   ssize_t ret;
+
+   ret = sscanf(buf, "%lx %lx", &start_addr, &length);
+   if (ret != 2)
+   return -EINVAL;
+
+   /* Range-check - don't free any reserved memory that
+* wasn't reserved for phyp-dump */
+   if (start_addr < phyp_dump_info->init_reserve_start)
+   start_addr = phyp_dump_info->init_reserve_start;
+
+   end_addr = phyp_dump_info->init_reserve_start +
+   phyp_dump_info->init_reserve_size;
+   if (start_addr+length > end_addr)
+   length = end_addr - start_addr;
+
+   /* Release the region of memory assed in by user */
+   start_pfn = PFN_DOWN(start_addr);
+   nr_pages = PFN_DOWN(length);
+   release_memory_range(start_pfn, nr_pages);
+
+   return count;
+}
+
+static struct kobj_attribute rr = __ATTR(release_region, 0600,
+NULL, store_release_region);
+
+static int __init phyp_dump_setup(void)
+{
+   struct device_node *rtas;
+   const int *dump_header = NULL;
+   int header_len = 0;
+   int rc;
 
/* If no memory was reserved in early boot, there is nothing to do */
if (phyp_dump_info->init_reserve_size == 0)
return 0;
 
-   /* Release memory that was reserved in early boot */
-   start_pfn = PFN_DOWN(phyp_dump_info->init_reserve_start);
-   nr_pages = PFN_DOWN(phyp_dump_info->init_reserve_size);
-   release_memory_range(start_pfn, nr_pages);
+   /* Return if phyp dump not supported */
+   if (!phyp_dump_info->phyp_dump_configured)
+   return -ENOSYS;
+
+   /* Is there dump data waiting for us? */
+   rtas = of_find_node_by_path("/rtas");
+   if (rtas) {
+   dump_header = of_get_property(rtas, "ibm,kernel-dump",
+   &header_len);
+   of_node_put(rtas);
+   }
+
+   if (dump_header == NULL)
+   return 0;
+
+   /* Should we create a dump_subsys, analogous to s390/ipl.c ? */
+   rc = sysfs_create_file(kernel_kobj, &rr.attr);
+   if (rc) {
+   printk(KERN_ERR "phyp-dump: unable to create sysfs file (%d)\n",
+   rc);
+   return 0;
+   }
 
return 0;
 }
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 2/8] pseries: phyp dump: reserve-release proof-of-concept

2008-02-28 Thread Manish Ahuja

Initial patch for reserving memory in early boot, and freeing it later.
If the previous boot had ended with a crash, the reserved memory would contain
a copy of the crashed kernel data.

Signed-off-by: Manish Ahuja <[EMAIL PROTECTED]>
Signed-off-by: Linas Vepstas <[EMAIL PROTECTED]>


 arch/powerpc/kernel/prom.c |   49 +
 arch/powerpc/platforms/pseries/Makefile|1 
 arch/powerpc/platforms/pseries/phyp_dump.c |  105 +
 include/asm-powerpc/phyp_dump.h|   44 
 4 files changed, 199 insertions(+)

Index: 2.6.25-rc1/include/asm-powerpc/phyp_dump.h
===
--- /dev/null   1970-01-01 00:00:00.0 +
+++ 2.6.25-rc1/include/asm-powerpc/phyp_dump.h  2008-02-28 22:05:25.0 
-0600
@@ -0,0 +1,44 @@
+/*
+ * Hypervisor-assisted dump
+ *
+ * Linas Vepstas, Manish Ahuja 2008
+ * Copyright 2008 IBM Corp.
+ *
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU General Public License
+ *  as published by the Free Software Foundation; either version
+ *  2 of the License, or (at your option) any later version.
+ */
+
+#ifndef _PPC64_PHYP_DUMP_H
+#define _PPC64_PHYP_DUMP_H
+
+#ifdef CONFIG_PHYP_DUMP
+
+/* The RMR region will be saved for later dumping
+ * whenever the kernel crashes. Set this to 256MB. */
+#define PHYP_DUMP_RMR_START 0x0
+#define PHYP_DUMP_RMR_END   (1UL<<28)
+
+struct phyp_dump {
+   /* Memory that is reserved during very early boot. */
+   unsigned long init_reserve_start;
+   unsigned long init_reserve_size;
+   /* Check status during boot if dump supported, active & present*/
+   unsigned long phyp_dump_configured;
+   unsigned long phyp_dump_is_active;
+   /* store cpu & hpte size */
+   unsigned long cpu_state_size;
+   unsigned long hpte_region_size;
+};
+
+extern struct phyp_dump *phyp_dump_info;
+
+int early_init_dt_scan_phyp_dump(unsigned long node,
+   const char *uname, int depth, void *data);
+#else /* CONFIG_PHYP_DUMP */
+int early_init_dt_scan_phyp_dump(unsigned long node,
+   const char *uname, int depth, void *data) { return 0; }
+
+#endif /* CONFIG_PHYP_DUMP */
+#endif /* _PPC64_PHYP_DUMP_H */
Index: 2.6.25-rc1/arch/powerpc/platforms/pseries/phyp_dump.c
===
--- /dev/null   1970-01-01 00:00:00.0 +
+++ 2.6.25-rc1/arch/powerpc/platforms/pseries/phyp_dump.c   2008-02-28 
21:57:52.0 -0600
@@ -0,0 +1,105 @@
+/*
+ * Hypervisor-assisted dump
+ *
+ * Linas Vepstas, Manish Ahuja 2008
+ * Copyright 2008 IBM Corp.
+ *
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU General Public License
+ *  as published by the Free Software Foundation; either version
+ *  2 of the License, or (at your option) any later version.
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+
+/* Global, used to communicate data between early boot and late boot */
+static struct phyp_dump phyp_dump_global;
+struct phyp_dump *phyp_dump_info = &phyp_dump_global;
+
+/**
+ * release_memory_range -- release memory previously lmb_reserved
+ * @start_pfn: starting physical frame number
+ * @nr_pages: number of pages to free.
+ *
+ * This routine will release memory that had been previously
+ * lmb_reserved in early boot. The released memory becomes
+ * available for genreal use.
+ */
+static void
+release_memory_range(unsigned long start_pfn, unsigned long nr_pages)
+{
+   struct page *rpage;
+   unsigned long end_pfn;
+   long i;
+
+   end_pfn = start_pfn + nr_pages;
+
+   for (i = start_pfn; i <= end_pfn; i++) {
+   rpage = pfn_to_page(i);
+   if (PageReserved(rpage)) {
+   ClearPageReserved(rpage);
+   init_page_count(rpage);
+   __free_page(rpage);
+   totalram_pages++;
+   }
+   }
+}
+
+static int __init phyp_dump_setup(void)
+{
+   unsigned long start_pfn, nr_pages;
+
+   /* If no memory was reserved in early boot, there is nothing to do */
+   if (phyp_dump_info->init_reserve_size == 0)
+   return 0;
+
+   /* Release memory that was reserved in early boot */
+   start_pfn = PFN_DOWN(phyp_dump_info->init_reserve_start);
+   nr_pages = PFN_DOWN(phyp_dump_info->init_reserve_size);
+   release_memory_range(start_pfn, nr_pages);
+
+   return 0;
+}
+machine_subsys_initcall(pseries, phyp_dump_setup);
+
+int __init early_init_dt_scan_phyp_dump(unsigned long node,
+   const char *uname, int depth, void *data)
+{
+#ifdef CONFIG_PHYP_DUMP
+   const unsigned int *sizes;
+
+   phyp_dump_info->phyp_dump_configured = 0;
+   phyp_dump_info

[PATCH 1/8] pseries: phyp dump: Docmentation

2008-02-28 Thread Manish Ahuja

Basic documentation for hypervisor-assisted dump.

Signed-off-by: Linas Vepstas <[EMAIL PROTECTED]>
Signed-off-by: Manish Ahuja <[EMAIL PROTECTED]>


 Documentation/powerpc/phyp-assisted-dump.txt |  127 +++
 1 file changed, 127 insertions(+)

Index: 2.6.25-rc1/Documentation/powerpc/phyp-assisted-dump.txt
===
--- /dev/null   1970-01-01 00:00:00.0 +
+++ 2.6.25-rc1/Documentation/powerpc/phyp-assisted-dump.txt 2008-02-18 
03:22:33.0 -0600
@@ -0,0 +1,127 @@
+
+   Hypervisor-Assisted Dump
+   
+   November 2007
+
+The goal of hypervisor-assisted dump is to enable the dump of
+a crashed system, and to do so from a fully-reset system, and
+to minimize the total elapsed time until the system is back
+in production use.
+
+As compared to kdump or other strategies, hypervisor-assisted
+dump offers several strong, practical advantages:
+
+-- Unlike kdump, the system has been reset, and loaded
+   with a fresh copy of the kernel.  In particular,
+   PCI and I/O devices have been reinitialized and are
+   in a clean, consistent state.
+-- As the dump is performed, the dumped memory becomes
+   immediately available to the system for normal use.
+-- After the dump is completed, no further reboots are
+   required; the system will be fully usable, and running
+   in it's normal, production mode on it normal kernel.
+
+The above can only be accomplished by coordination with,
+and assistance from the hypervisor. The procedure is
+as follows:
+
+-- When a system crashes, the hypervisor will save
+   the low 256MB of RAM to a previously registered
+   save region. It will also save system state, system
+   registers, and hardware PTE's.
+
+-- After the low 256MB area has been saved, the
+   hypervisor will reset PCI and other hardware state.
+   It will *not* clear RAM. It will then launch the
+   bootloader, as normal.
+
+-- The freshly booted kernel will notice that there
+   is a new node (ibm,dump-kernel) in the device tree,
+   indicating that there is crash data available from
+   a previous boot. It will boot into only 256MB of RAM,
+   reserving the rest of system memory.
+
+-- Userspace tools will parse /sys/kernel/release_region
+   and read /proc/vmcore to obtain the contents of memory,
+   which holds the previous crashed kernel. The userspace
+   tools may copy this info to disk, or network, nas, san,
+   iscsi, etc. as desired.
+
+   For Example: the values in /sys/kernel/release-region
+   would look something like this (address-range pairs).
+   CPU:0x177fee000-0x1: HPTE:0x177ffe020-0x1000: /
+   DUMP:0x177fff020-0x1000, 0x1000-0x16F1D370A
+
+-- As the userspace tools complete saving a portion of
+   dump, they echo an offset and size to
+   /sys/kernel/release_region to release the reserved
+   memory back to general use.
+
+   An example of this is:
+ "echo 0x4000 0x1000 > /sys/kernel/release_region"
+   which will release 256MB at the 1GB boundary.
+
+Please note that the hypervisor-assisted dump feature
+is only available on Power6-based systems with recent
+firmware versions.
+
+Implementation details:
+--
+
+During boot, a check is made to see if firmware supports
+this feature on this particular machine. If it does, then
+we check to see if a active dump is waiting for us. If yes
+then everything but 256 MB of RAM is reserved during early
+boot. This area is released once we collect a dump from user
+land scripts that are run. If there is dump data, then
+the /sys/kernel/release_region file is created, and
+the reserved memory is held.
+
+If there is no waiting dump data, then only the highest
+256MB of the ram is reserved as a scratch area. This area
+is *not* be released: this region will be kept permanently
+reserved, so that it can act as a receptacle for a copy
+of the low 256MB in the case a crash does occur. See,
+however, "open issues" below, as to whether
+such a reserved region is really needed.
+
+Currently the dump will be copied from /proc/vmcore to a
+a new file upon user intervention. The starting address
+to be read and the range for each data point in provided
+in /sys/kernel/release_region.
+
+The tools to examine the dump will be same as the ones
+used for kdump.
+
+General notes:
+--
+Security: please note that there are potential security issues
+with any sort of dump mechanism. In particular, plaintext
+(unencrypted) data, and possibly passwords, may be present in
+the dump data. Userspace tools must take adequate precautions to
+preserve security.
+
+Open issues/ToDo:
+
+ o The various code paths that tell the hypervisor that a crash
+   occurred, vs. it simply being a normal reboot, should be
+   reviewed, and possibly clarified/fixed.
+
+ o Instead of using /sys/kernel, should there be a /sys/dump
+   instead? There is a d

Re: [PATCH 3/3] ppc64-specific memory notifier support

2008-02-28 Thread Michael Ellerman
On Thu, 2008-02-28 at 08:46 -0800, Badari Pulavarty wrote:
> Hotplug memory notifier for ppc64. This gets invoked by writing
> the device-node that needs to be removed to /proc/ppc64/ofdt.
> We need to adjust the sections and remove sysfs entries by
> calling __remove_pages(). Then call arch specific code to
> get rid of htab mappings for the section of memory.
> 
> Signed-off-by: Badari Pulavarty <[EMAIL PROTECTED]>
> ---
>  arch/powerpc/platforms/pseries/Makefile |1 
>  arch/powerpc/platforms/pseries/hotplug-memory.c |   98 
> 
>  2 files changed, 99 insertions(+)
> 
> Index: linux-2.6.25-rc2/arch/powerpc/platforms/pseries/hotplug-memory.c
> ===
> --- /dev/null 1970-01-01 00:00:00.0 +
> +++ linux-2.6.25-rc2/arch/powerpc/platforms/pseries/hotplug-memory.c  
> 2008-02-28 08:20:14.0 -0800

> +
> +static struct notifier_block pseries_smp_nb = {
> + .notifier_call = pseries_memory_notifier,
> +};
> +
> +static int __init pseries_memory_hotplug_init(void)
> +{
> + if (firmware_has_feature(FW_FEATURE_LPAR))
> + pSeries_reconfig_notifier_register(&pseries_smp_nb);
> +
> + return 0;
> +}
> +arch_initcall(pseries_memory_hotplug_init);

This is going to fire on non-pseries LPAR platforms, like iSeries and
PS3. Which is not what you want I think.

cheers

-- 
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person


signature.asc
Description: This is a digitally signed message part
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

Re: [PATCH 0/8] pseries: phyp dump: hypervisor-assisted dump

2008-02-28 Thread Manish Ahuja
Changes from previous version:

The only changes are in patch 2.
moved early_init_dt_scan_phyp_dump from rtas.c to phyp_dump.c
Added dummy function in phyp_dump.h

Patch 3 required repatching due to changes to patch 2.
Resubmitting all patches to avoid confusion.

Thanks,
Manish


Michael Ellerman wrote:
> On Sun, 2008-02-17 at 22:53 -0600, Manish Ahuja wrote:
>> The following series of patches implement a basic framework
>> for hypervisor-assisted dump. The very first patch provides 
>> documentation explaining what this is  :-) . Yes, its supposed
>> to be an improvement over kdump.
>>
>> A list of open issues / todo list is included in the documentation.
>> It also appears that the not-yet-released firmware versions this was tested 
>> on are still, ahem, incomplete; this work is also pending.
>>
>> I have included most of the changes requested. Although, I did find
>> one or two, fixed in a later patch file rather than the first location
>> they appeared at.
> 
> This series still doesn't build on !CONFIG_RTAS configs:
> http://kisskb.ellerman.id.au/kisskb/head/629/
> 
> This solution is to move early_init_dt_scan_phyp_dump() into
> arch/powerpc/platforms/pseries/phyp_dump.c and provide a dummy
> implementation in asm-powerpc/phyp_dump.c for the !CONFIG_PHYP_DUMP
> case.
> 
> cheers
> 

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


Re: [PATCH 1/2] firewire: endianess fix

2008-02-28 Thread Benjamin Herrenschmidt

On Thu, 2008-02-28 at 13:42 -0500, Jarod Wilson wrote:
> On Thursday 28 February 2008 01:25:59 am Benjamin Herrenschmidt wrote:
> > > Under Mac OS X, system.log says "FireWire (OHCI) Apple ID 31 built-in now
> > > active". Could still be lucent though, judging by the subsys device ID of
> > > 5811, which matches up w/the Lucent/Agere FW323. But no, apparently I
> > > don't have the interesting one.
> >
> > Well, it's interesting in the sense that it's a "normal" OHCI then on a
> > BE machine :-) My Pismo, which had the weirdo one, unfortunately died a
> > while ago. I'll see if I can find another machine with that one in.
> 
> Ah, the pismo has it, eh? I think I may actually know of someone in the 
> office 
> that still has one of those that I might be able to borrow and poke at...

I -think- it has it... Pismo definitely has one of the first variant of
UniNorth with "working" FW afaik.

The first UniNorth was used in the first "toilet-seat" ibook, but I
think this one didn't have firewire, or a non-working one... and in the
first Sawtooth G4 for which FW and Ethernet even were separate PCI chips
because the ones in UniNorth were too broken.

It's possible that early G4 titanium powerbooks or other model of FW
iBooks have that UniNorth FW variant too.

Ben.


___
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: [dtc] breaking out libfdt from dtc so other progs can use it

2008-02-28 Thread Jerone Young

On Thu, 2008-02-28 at 12:59 -0600, Josh Boyer wrote:
> On Thu, 28 Feb 2008 10:30:44 -0600
> Jerone Young <[EMAIL PROTECTED]> wrote:
> 
> > 
> > On Thu, 2008-02-28 at 12:41 +1100, David Gibson wrote:
> > > On Wed, Feb 27, 2008 at 01:40:43PM -0600, Jerone Young wrote:
> > > > Currently the dtc source code has libfdt integrated in it. This seems to
> > > > have become place for upstream libfdt changes. Now we all know everyone
> > > > (linux kernel, cuboot) also have their own versions over libfdt. But if
> > > > another userspace app wants to use libfdt , it has to copy it from the
> > > > dtc source and try to maintain it's own copy.
> > > > 
> > > > The question I have is can libfdt be split out from dtc source, and
> > > > become it's own thing. This way other userspace apps can easily download
> > > > it and link with it?
> > > > 
> > > > The reason I ask is I have added dynamic manipulation support of device
> > > > trees in memory into qemu for KVM. But the issue is keeping a copy of
> > > > libfdt in the KVM userspace repository, which is getting some opposition
> > > > (understandably). But this would be much easier if there was a libfdt
> > > > repo for the library so that we wouldn't need to keep our own copy.
> > > 
> > > Um.. libfdt was moved into the dtc repo for convenience, both for us
> > > writing it (they help to test each other), and for those using it -
> > > don't have to have separate pulls for these closely related tools.
> > > 
> > > I don't understand why you're finding the merged libfdt inconvenient.
> > > "make" will build both dtc and libfdt, and libfdt can be easily taken
> > > out and embedded on other projects.
> > 
> > The reason for all the contention is that libfdt is more of a shared
> > userspace library. Even though dtc really has been the only user of it
> 
> Actually, in it's current form, it's not.  It's built to be statically
> linked, not as a shared library (.a vs. .so).

Right now the dtc makefiles do this. Though I have created a makefile so
that it does :-). 
> 
> > in userspace at the moment, now I want to add it's use to qemu. What
> > many are thinking about is the maintenance of the library. There are
> > still fixes going in the libfdt in dtc. 
> 
> You still haven't explained why maintenance is harder or somehow less
> doable by having it in the dtc repo.  Maintenance is very much the
> concern of the upstream developers, which seem to be saying it's not a
> problem for them...

I guess what I see libfdt as something like shared userspace library. At
the moment dtc is the only userspace project to use it.  So it make
perfect since to keep it with the source and not separated.

Though when other projects need it .. the option of having to try to
figure out what version of dtc to grab so understand what libfdt is
usable, can be a bit of a pain.

Though I can't really argue that you can't get around this by just
downloading dtc and grabbing out the libfdt package..though it does
cause some indirection.  


> > If it where broken out of dtc it would be easier to pickup and pull
> > fixes from it. Even package it so programs can easily build it
> > standalone.
> 
> That's akin to saying libcrypto should be broken out to be completely
> standalone from openssl.  That doesn't make sense either.

Actually ouch.. I think you got me dead on :-)  so basically I am
making the same argument.


Thanks for the feedback guys!

> 
> josh

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


Re: pci_proc_init: proc_dir_entry '00' already registered

2008-02-28 Thread Olaf Hering
On Sun, Feb 10, Alexey Dobriyan wrote:

> On Sun, Feb 10, 2008 at 11:07:57AM +0100, Olaf Hering wrote:
> > Current Linus tree gives this new warning during bootup:
> > 
> > +proc_dir_entry '00' already registered
> > +Call Trace:
> > +[c0007b0dfba0] [c000e4b0] .show_stack+0x70/0x1bc (unreliable)
> > +[c0007b0dfc50] [c00f2714] .proc_register+0x130/0x210
> > +[c0007b0dfd00] [c00f299c] .proc_mkdir_mode+0x40/0x70
> > +[c0007b0dfd80] [c0276ed8] .pci_proc_attach_device+0xac/0x144
> > +[c0007b0dfe20] [c05bdb3c] .pci_proc_init+0x74/0xac
> > +[c0007b0dfea0] [c05a27ac] .kernel_init+0x1d0/0x394
> > +[c0007b0dff90] [c001e258] .kernel_thread+0x4c/0x68
> 
> Can you insert dump_stack() when '00' is registered, not just second
> time?

Its pci_bus_add_device(). Full dmesg attached:

diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c
index ef5a6a2..3c6fcd9 100644
--- a/drivers/pci/bus.c
+++ b/drivers/pci/bus.c
@@ -16,6 +16,8 @@ #include 
 #include 
 
 #include "pci.h"
+#define olh(fmt,args ...) \
+   printk(KERN_DEBUG "%s(%u) %s(%u):c%u,j%lu " fmt 
"\n",__FUNCTION__,__LINE__,current->comm,current->pid,smp_processor_id(),jiffies,##args)
 
 /**
  * pci_bus_alloc_resource - allocate a resource from a parent bus
@@ -80,6 +82,7 @@ pci_bus_alloc_resource(struct pci_bus *b
 int pci_bus_add_device(struct pci_dev *dev)
 {
int retval;
+   olh("%s",dev->dev.bus_id);
retval = device_add(&dev->dev);
if (retval)
return retval;
diff --git a/drivers/pci/proc.c b/drivers/pci/proc.c
index ef18fcd..1a9ef7c 100644
--- a/drivers/pci/proc.c
+++ b/drivers/pci/proc.c
@@ -6,6 +6,8 @@
  * Copyright (c) 1997--1999 Martin Mares <[EMAIL PROTECTED]>
  */
 
+#define olh(fmt,args ...) \
+   printk(KERN_DEBUG "%s(%u) %s(%u):c%u,j%lu " fmt 
"\n",__FUNCTION__,__LINE__,current->comm,current->pid,smp_processor_id(),jiffies,##args)
 #include 
 #include 
 #include 
@@ -390,6 +392,7 @@ int pci_proc_attach_device(struct pci_de
struct proc_dir_entry *e;
char name[16];
 
+   olh("%d: %p - %s",proc_initialized,dev,dev->dev.bus_id);
if (!proc_initialized)
return -EACCES;
 
@@ -478,6 +481,7 @@ static int __init pci_proc_init(void)
entry->proc_fops = &proc_bus_pci_dev_operations;
proc_initialized = 1;
while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) {
+   olh("%s",dev->dev.bus_id);
pci_proc_attach_device(dev);
}
return 0;
DART table allocated at: c0007f00
Using PowerMac machine description
Page orders: linear mapping = 24, virtual = 12, io = 12
Found initrd at 0xc130:0xc1559c00
Found U4 memory controller & host bridge @ 0xf800 revision: 0x42
Mapped at 0xd8008000
Found a Shasta mac-io controller, rev: 0, mapped at 0xd80080041000
PowerMac motherboard: PowerMac G5 Dual Core
DART IOMMU initialized for U4 type chipset
console [udbg0] enabled
CPU maps initialized for 1 thread per core
 (thread shift is 0)
Starting Linux PPC64 #231 SMP Thu Feb 28 19:53:21 CET 2008
-
ppc64_pft_size= 0x0
physicalMemorySize= 0x8000
htab_address  = 0xc0007c00
htab_hash_mask= 0x3
-
Linux version 2.6.25-rc3-g5-dirty ([EMAIL PROTECTED]) (gcc version 4.1.0 (SUSE 
Linux)) #231 SMP Thu Feb 28 19:53:21 CET 2008
[boot]0012 Setup Arch
Entering add_active_range(0, 0, 524288) 0 entries of 256 used
Found U4-PCIE PCI host bridge.  Firmware bus number: 0->255
PCI host bridge /[EMAIL PROTECTED],f000  ranges:
 MEM 0xf100..0xf1ff -> 0xf100 
  IO 0xf000..0xf07f -> 0x
 MEM 0x9000..0xafff -> 0x9000 
Can't get bus-range for /[EMAIL PROTECTED],f200, assume bus 0
Found U3-HT PCI host bridge.  Firmware bus number: 0->239
PCI host bridge /[EMAIL PROTECTED],f200 (primary) ranges:
SMU: Driver 0.7 (c) 2005 Benjamin Herrenschmidt, IBM Corp.
nvram: Checking bank 0...
nvram: gen0=210, gen1=211
nvram: Active bank is: 1
nvram: OF partition at 0x410
nvram: XP partition at 0x1020
nvram: NR partition at 0x1120
Top of RAM: 0x8000, Total RAM: 0x8000
Memory hole size: 0MB
Zone PFN ranges:
  DMA 0 ->   524288
  Normal 524288 ->   524288
Movable zone start PFN for each node
early_node_map[1] active PFN ranges
0:0 ->   524288
On node 0 totalpages: 524288
  DMA zone: 7168 pages used for memmap
  DMA zone: 0 pages reserved
  DMA zone: 517120 pages, LIFO batch:31
  Normal zone: 0 pages used for memmap
  Movable zone: 0 pages used for memmap
[boot]0015 Setup Done
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 517120
Kernel command line: root=UUID=a77c3a2a-dd4a-4cf6-8c74

Re: [PATCH 2/4] Emerson KSI8560 device tree

2008-02-28 Thread Scott Wood
On Thu, Feb 28, 2008 at 09:47:27PM +0300, Alexandr Smirnov wrote:
> + [EMAIL PROTECTED] {
> + #address-cells = <1>;
> + #size-cells = <1>;
> + device_type = "soc";
> + ranges = <0x 0xfdf0 0x0010>;
> + reg = <0xfdf0 0x200>;

The reg property is no longer needed here.

> + [EMAIL PROTECTED] { /* For 
> TSECs */
> + #address-cells = <1>;
> + #size-cells = <0>;
> + device_type = "mdio";
> + compatible = "gianfar";

No device_type, compatible should be "fsl,gianfar-mdio".

> + [EMAIL PROTECTED] {
> + #address-cells = <1>;
> + #size-cells = <1>;
> + compatible = "fsl,mpc8560-localbus";
> + reg = <0xfdf05000 0x68>;
> +
> + ranges = <0xe000 0xe000 0x0080>;

The localbus node isn't just a container for flash; if you're not going to
use the chipselect mechanism (and you should), then at least use a blank
"ranges;".

> + [EMAIL PROTECTED] {
> + compatible = "altera,maxii";
> + reg = <0xe808 0x8>;
> + };

Should this go under the localbus node?

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


Re: [dtc] breaking out libfdt from dtc so other progs can use it

2008-02-28 Thread Josh Boyer
On Thu, 28 Feb 2008 10:30:44 -0600
Jerone Young <[EMAIL PROTECTED]> wrote:

> 
> On Thu, 2008-02-28 at 12:41 +1100, David Gibson wrote:
> > On Wed, Feb 27, 2008 at 01:40:43PM -0600, Jerone Young wrote:
> > > Currently the dtc source code has libfdt integrated in it. This seems to
> > > have become place for upstream libfdt changes. Now we all know everyone
> > > (linux kernel, cuboot) also have their own versions over libfdt. But if
> > > another userspace app wants to use libfdt , it has to copy it from the
> > > dtc source and try to maintain it's own copy.
> > > 
> > > The question I have is can libfdt be split out from dtc source, and
> > > become it's own thing. This way other userspace apps can easily download
> > > it and link with it?
> > > 
> > > The reason I ask is I have added dynamic manipulation support of device
> > > trees in memory into qemu for KVM. But the issue is keeping a copy of
> > > libfdt in the KVM userspace repository, which is getting some opposition
> > > (understandably). But this would be much easier if there was a libfdt
> > > repo for the library so that we wouldn't need to keep our own copy.
> > 
> > Um.. libfdt was moved into the dtc repo for convenience, both for us
> > writing it (they help to test each other), and for those using it -
> > don't have to have separate pulls for these closely related tools.
> > 
> > I don't understand why you're finding the merged libfdt inconvenient.
> > "make" will build both dtc and libfdt, and libfdt can be easily taken
> > out and embedded on other projects.
> 
> The reason for all the contention is that libfdt is more of a shared
> userspace library. Even though dtc really has been the only user of it

Actually, in it's current form, it's not.  It's built to be statically
linked, not as a shared library (.a vs. .so).

> in userspace at the moment, now I want to add it's use to qemu. What
> many are thinking about is the maintenance of the library. There are
> still fixes going in the libfdt in dtc. 

You still haven't explained why maintenance is harder or somehow less
doable by having it in the dtc repo.  Maintenance is very much the
concern of the upstream developers, which seem to be saying it's not a
problem for them...

> If it where broken out of dtc it would be easier to pickup and pull
> fixes from it. Even package it so programs can easily build it
> standalone.

That's akin to saying libcrypto should be broken out to be completely
standalone from openssl.  That doesn't make sense either.

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


Re: [PATCH 3/3] ppc64-specific memory notifier support

2008-02-28 Thread Badari Pulavarty
On Thu, 2008-02-28 at 11:20 -0600, Nathan Lynch wrote:
> Badari Pulavarty wrote:
> 
> > +static struct notifier_block pseries_smp_nb = {
> 
> Rename this to pseries_mem_nb?

Sure.

> 
> > +   .notifier_call = pseries_memory_notifier,
> > +};
> > +
> > +static int __init pseries_memory_hotplug_init(void)
> > +{
> > +   if (firmware_has_feature(FW_FEATURE_LPAR))
> > +   pSeries_reconfig_notifier_register(&pseries_smp_nb);
> > +
> > +   return 0;
> > +}
> > +arch_initcall(pseries_memory_hotplug_init);
> 
> arch_initcall doesn't seem appropriate.  __initcall should be fine.
> 

Okay, if you say so :)

I based the code on arch/powerpc/platforms/pseries/hotplug-cpu.c 

Thanks,
Badari


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


Re: [PATCH] fs_enet: Remove unused fields in the fs_mii_bb_platform_info structure.

2008-02-28 Thread Scott Wood
On Thu, Feb 28, 2008 at 01:49:01PM +0100, Laurent Pinchart wrote:
> On Friday 15 February 2008 14:27, Laurent Pinchart wrote:
> > The mdio_port, mdio_bit, mdc_port and mdc_bit fields in the
> > fs_mii_bb_platform_info structure are left-overs from the move to the Phy
> > Abstraction Layer subsystem. They can be safely removed.
> >
> > Signed-off-by: Laurent Pinchart <[EMAIL PROTECTED]>
> [snip]
> 
> Is there something wrong with the patch ?

No, the patch looks OK.  However, note that non-PPC_CPM_NEW_BINDING code
should go away altogether soon.

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


[PATCH 4/4] Emerson KSI8560 base support

2008-02-28 Thread Alexandr Smirnov

diff --git a/arch/powerpc/platforms/85xx/Kconfig 
b/arch/powerpc/platforms/85xx/Kconfig
index 7e76ddb..28bc6e5 100644
--- a/arch/powerpc/platforms/85xx/Kconfig
+++ b/arch/powerpc/platforms/85xx/Kconfig
@@ -46,6 +46,13 @@ config MPC85xx_DS
help
  This option enables support for the MPC85xx DS (MPC8544 DS) board
 
+config KSI8560
+bool "Emerson KSI8560"
+select PPC_CPM_NEW_BINDING
+select DEFAULT_UIMAGE
+help
+  This option enables support for the Emerson KSI8560 board
+
 config STX_GP3
bool "Silicon Turnkey Express GP3"
help
diff --git a/arch/powerpc/platforms/85xx/Makefile 
b/arch/powerpc/platforms/85xx/Makefile
index cb7af4e..6cea185 100644
--- a/arch/powerpc/platforms/85xx/Makefile
+++ b/arch/powerpc/platforms/85xx/Makefile
@@ -10,3 +10,4 @@ obj-$(CONFIG_STX_GP3)   += stx_gp3.o
 obj-$(CONFIG_TQM85xx)+= tqm85xx.o
 obj-$(CONFIG_SBC8560) += sbc8560.o
 obj-$(CONFIG_SBC8548) += sbc8548.o
+obj-$(CONFIG_KSI8560)+= ksi8560.o
diff --git a/arch/powerpc/platforms/85xx/ksi8560.c 
b/arch/powerpc/platforms/85xx/ksi8560.c
new file mode 100644
index 000..6ca3969
--- /dev/null
+++ b/arch/powerpc/platforms/85xx/ksi8560.c
@@ -0,0 +1,253 @@
+/*
+ * Board setup routines for the Emerson KSI8560
+ *
+ * Author: Alexandr Smirnov <[EMAIL PROTECTED]>
+ *
+ * Based on mpc85xx_ads.c maintained by Kumar Gala
+ *
+ * 2008 (c) MontaVista, Software, Inc.  This file is licensed under
+ * the terms of the GNU General Public License version 2.  This program
+ * is licensed "as is" without any warranty of any kind, whether express
+ * or implied.
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+#include 
+
+
+#define KSI8560_CPLD_HVR   0x04 /* Hardware Version Register */
+#define KSI8560_CPLD_PVR   0x08 /* PLD Version Register */
+#define KSI8560_CPLD_RCR1  0x30 /* Reset Command Register 1 */
+
+#define KSI8560_CPLD_RCR1_CPUHR0x80 /* CPU Hard Reset */
+
+void __iomem *cpld_base = NULL;
+
+static void machine_restart(char *cmd)
+{
+   if (cpld_base)
+   out_8(cpld_base + KSI8560_CPLD_RCR1, KSI8560_CPLD_RCR1_CPUHR);
+   else
+   printk(KERN_ERR "Can't find CPLD base, hang forever\n");
+
+   for (;;);
+}
+
+static void cpm2_cascade(unsigned int irq, struct irq_desc *desc)
+{
+   int cascade_irq;
+
+   while ((cascade_irq = cpm2_get_irq()) >= 0) {
+   generic_handle_irq(cascade_irq);
+   }
+   desc->chip->eoi(irq);
+}
+
+static void __init ksi8560_pic_init(void)
+{
+   struct mpic *mpic;
+   struct resource r;
+   struct device_node *np = NULL;
+#ifdef CONFIG_CPM2
+   int irq;
+#endif
+
+   np = of_find_node_by_type(np, "open-pic");
+
+   if (np == NULL) {
+   printk(KERN_ERR "Could not find open-pic node\n");
+   return;
+   }
+
+   if (of_address_to_resource(np, 0, &r)) {
+   printk(KERN_ERR "Could not map mpic register space\n");
+   of_node_put(np);
+   return;
+   }
+
+   mpic = mpic_alloc(np, r.start,
+   MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,
+   0, 256, " OpenPIC  ");
+   BUG_ON(mpic == NULL);
+   of_node_put(np);
+
+   mpic_init(mpic);
+
+#ifdef CONFIG_CPM2
+   /* Setup CPM2 PIC */
+   np = of_find_compatible_node(NULL, NULL, "fsl,cpm2-pic");
+   if (np == NULL) {
+   printk(KERN_ERR "PIC init: can not find fsl,cpm2-pic node\n");
+   return;
+   }
+   irq = irq_of_parse_and_map(np, 0);
+
+   cpm2_pic_init(np);
+   of_node_put(np);
+   set_irq_chained_handler(irq, cpm2_cascade);
+
+   setup_irq(0, NULL);
+#endif
+}
+
+#ifdef CONFIG_CPM2
+/*
+ * Setup I/O ports
+ */
+struct cpm_pin {
+   int port, pin, flags;
+};
+
+static struct cpm_pin ksi8560_pins[] = {
+   /* SCC1 */
+   {3, 29, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
+   {3, 30, CPM_PIN_OUTPUT | CPM_PIN_SECONDARY},
+   {3, 31, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
+
+   /* SCC2 */
+   {3, 26, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
+   {3, 27, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
+   {3, 28, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
+
+   /* FCC1 */
+   {0, 14, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
+   {0, 15, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
+   {0, 16, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
+   {0, 17, CPM_PIN_INPUT | CPM_PIN_PRIMARY},
+   {0, 18, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
+   {0, 19, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
+   {0, 20, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
+   {0, 21, CPM_PIN_OUTPUT | CPM_PIN_PRIMARY},
+   {0, 26, CPM_PIN_INPUT | CPM_PIN_SECONDARY},
+   {0, 27, CPM_PIN_INPUT | CPM_PIN_SECONDARY},
+   {0, 28, CPM_PIN_OUTPUT | CPM_PIN

Re: [PATCH 1/2] firewire: endianess fix

2008-02-28 Thread Jarod Wilson
On Thursday 28 February 2008 01:25:59 am Benjamin Herrenschmidt wrote:
> > Under Mac OS X, system.log says "FireWire (OHCI) Apple ID 31 built-in now
> > active". Could still be lucent though, judging by the subsys device ID of
> > 5811, which matches up w/the Lucent/Agere FW323. But no, apparently I
> > don't have the interesting one.
>
> Well, it's interesting in the sense that it's a "normal" OHCI then on a
> BE machine :-) My Pismo, which had the weirdo one, unfortunately died a
> while ago. I'll see if I can find another machine with that one in.

Ah, the pismo has it, eh? I think I may actually know of someone in the office 
that still has one of those that I might be able to borrow and poke at...


-- 
Jarod Wilson
[EMAIL PROTECTED]
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 3/4] Emerson KSI8560 default config

2008-02-28 Thread Alexandr Smirnov

diff --git a/arch/powerpc/configs/ksi8560_defconfig 
b/arch/powerpc/configs/ksi8560_defconfig
new file mode 100644
index 000..2d0debc
--- /dev/null
+++ b/arch/powerpc/configs/ksi8560_defconfig
@@ -0,0 +1,899 @@
+#
+# Automatically generated make config: don't edit
+# Linux kernel version: 2.6.24
+# Mon Feb 11 16:25:19 2008
+#
+# CONFIG_PPC64 is not set
+
+#
+# Processor support
+#
+# CONFIG_6xx is not set
+CONFIG_PPC_85xx=y
+# CONFIG_PPC_8xx is not set
+# CONFIG_40x is not set
+# CONFIG_44x is not set
+# CONFIG_E200 is not set
+CONFIG_E500=y
+CONFIG_BOOKE=y
+CONFIG_FSL_BOOKE=y
+CONFIG_FSL_EMB_PERFMON=y
+# CONFIG_PHYS_64BIT is not set
+CONFIG_SPE=y
+# CONFIG_PPC_MM_SLICES is not set
+CONFIG_PPC32=y
+CONFIG_WORD_SIZE=32
+CONFIG_PPC_MERGE=y
+CONFIG_MMU=y
+CONFIG_GENERIC_CMOS_UPDATE=y
+CONFIG_GENERIC_TIME=y
+CONFIG_GENERIC_TIME_VSYSCALL=y
+CONFIG_GENERIC_CLOCKEVENTS=y
+CONFIG_GENERIC_HARDIRQS=y
+# CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
+CONFIG_IRQ_PER_CPU=y
+CONFIG_RWSEM_XCHGADD_ALGORITHM=y
+CONFIG_ARCH_HAS_ILOG2_U32=y
+CONFIG_GENERIC_HWEIGHT=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
+CONFIG_GENERIC_FIND_NEXT_BIT=y
+# CONFIG_ARCH_NO_VIRT_TO_BUS is not set
+CONFIG_PPC=y
+CONFIG_EARLY_PRINTK=y
+CONFIG_GENERIC_NVRAM=y
+CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
+CONFIG_ARCH_MAY_HAVE_PC_FDC=y
+CONFIG_PPC_OF=y
+CONFIG_OF=y
+CONFIG_PPC_UDBG_16550=y
+# CONFIG_GENERIC_TBSYNC is not set
+CONFIG_AUDIT_ARCH=y
+CONFIG_GENERIC_BUG=y
+CONFIG_DEFAULT_UIMAGE=y
+# CONFIG_PPC_DCR_NATIVE is not set
+# CONFIG_PPC_DCR_MMIO is not set
+CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
+
+#
+# General setup
+#
+CONFIG_EXPERIMENTAL=y
+CONFIG_BROKEN_ON_SMP=y
+CONFIG_INIT_ENV_ARG_LIMIT=32
+CONFIG_LOCALVERSION=""
+CONFIG_LOCALVERSION_AUTO=y
+CONFIG_SWAP=y
+CONFIG_SYSVIPC=y
+CONFIG_SYSVIPC_SYSCTL=y
+# CONFIG_POSIX_MQUEUE is not set
+# CONFIG_BSD_PROCESS_ACCT is not set
+# CONFIG_TASKSTATS is not set
+# CONFIG_USER_NS is not set
+# CONFIG_PID_NS is not set
+# CONFIG_AUDIT is not set
+# CONFIG_IKCONFIG is not set
+CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_CGROUPS is not set
+CONFIG_FAIR_GROUP_SCHED=y
+CONFIG_FAIR_USER_SCHED=y
+# CONFIG_FAIR_CGROUP_SCHED is not set
+CONFIG_SYSFS_DEPRECATED=y
+# CONFIG_RELAY is not set
+CONFIG_BLK_DEV_INITRD=y
+CONFIG_INITRAMFS_SOURCE=""
+# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+CONFIG_SYSCTL=y
+CONFIG_EMBEDDED=y
+CONFIG_SYSCTL_SYSCALL=y
+CONFIG_KALLSYMS=y
+# CONFIG_KALLSYMS_ALL is not set
+# CONFIG_KALLSYMS_EXTRA_PASS is not set
+CONFIG_HOTPLUG=y
+CONFIG_PRINTK=y
+CONFIG_BUG=y
+CONFIG_ELF_CORE=y
+CONFIG_BASE_FULL=y
+CONFIG_FUTEX=y
+CONFIG_ANON_INODES=y
+CONFIG_EPOLL=y
+CONFIG_SIGNALFD=y
+CONFIG_TIMERFD=y
+CONFIG_EVENTFD=y
+CONFIG_SHMEM=y
+CONFIG_VM_EVENT_COUNTERS=y
+CONFIG_SLUB_DEBUG=y
+# CONFIG_SLAB is not set
+CONFIG_SLUB=y
+# CONFIG_SLOB is not set
+# CONFIG_PROFILING is not set
+# CONFIG_MARKERS is not set
+CONFIG_HAVE_OPROFILE=y
+CONFIG_HAVE_KPROBES=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 is not set
+CONFIG_BLOCK=y
+# CONFIG_LBD is not set
+# CONFIG_BLK_DEV_IO_TRACE is not set
+# CONFIG_LSF is not set
+# CONFIG_BLK_DEV_BSG is not set
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+CONFIG_IOSCHED_AS=y
+CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
+CONFIG_DEFAULT_AS=y
+# CONFIG_DEFAULT_DEADLINE is not set
+# CONFIG_DEFAULT_CFQ is not set
+# CONFIG_DEFAULT_NOOP is not set
+CONFIG_DEFAULT_IOSCHED="anticipatory"
+CONFIG_CLASSIC_RCU=y
+# CONFIG_PREEMPT_RCU is not set
+
+#
+# Platform support
+#
+# CONFIG_PPC_MPC512x is not set
+# CONFIG_PPC_MPC5121 is not set
+# CONFIG_PPC_CELL is not set
+# CONFIG_PPC_CELL_NATIVE is not set
+# CONFIG_PQ2ADS is not set
+CONFIG_MPC85xx=y
+# CONFIG_MPC8540_ADS is not set
+# CONFIG_MPC8560_ADS is not set
+# CONFIG_MPC85xx_CDS is not set
+# CONFIG_MPC85xx_MDS is not set
+# CONFIG_MPC85xx_DS is not set
+CONFIG_KSI8560=y
+# CONFIG_STX_GP3 is not set
+# CONFIG_TQM8540 is not set
+# CONFIG_TQM8541 is not set
+# CONFIG_TQM8555 is not set
+# CONFIG_TQM8560 is not set
+# CONFIG_SBC8548 is not set
+# CONFIG_SBC8560 is not set
+# CONFIG_IPIC is not set
+CONFIG_MPIC=y
+# CONFIG_MPIC_WEIRD is not set
+# CONFIG_PPC_I8259 is not set
+# CONFIG_PPC_RTAS is not set
+# CONFIG_MMIO_NVRAM is not set
+# CONFIG_PPC_MPC106 is not set
+# CONFIG_PPC_970_NAP is not set
+# CONFIG_PPC_INDIRECT_IO is not set
+# CONFIG_GENERIC_IOMAP is not set
+# CONFIG_CPU_FREQ is not set
+CONFIG_CPM2=y
+CONFIG_PPC_CPM_NEW_BINDING=y
+# CONFIG_FSL_ULI1575 is not set
+CONFIG_CPM=y
+
+#
+# Kernel options
+#
+CONFIG_HIGHMEM=y
+# CONFIG_TICK_ONESHOT is not set
+# CONFIG_NO_HZ is not set
+# CONFIG_HIGH_RES_TIMERS is not set
+CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
+# CONFIG_HZ_100 is not set
+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_PREEMPT_NONE=y
+# CONFIG_PREEMPT_VOLUNTARY is not set
+# CONFIG_PREEMPT is not set
+CONFIG_RCU_TRACE=y
+CONFIG

[PATCH 2/4] Emerson KSI8560 device tree

2008-02-28 Thread Alexandr Smirnov

diff --git a/arch/powerpc/boot/dts/ksi8560.dts 
b/arch/powerpc/boot/dts/ksi8560.dts
new file mode 100644
index 000..d6e8d8b
--- /dev/null
+++ b/arch/powerpc/boot/dts/ksi8560.dts
@@ -0,0 +1,269 @@
+/*
+ * Device Tree Source for Emerson KSI8560
+ *
+ * Author: Alexandr Smirnov <[EMAIL PROTECTED]>
+ *
+ * Based on mpc8560ads.dts
+ *
+ * 2008 (c) MontaVista, Software, Inc.  This file is licensed under
+ * the terms of the GNU General Public License version 2.  This program
+ * is licensed "as is" without any warranty of any kind, whether express
+ * or implied.
+ *
+ */
+
+/dts-v1/;
+
+/ {
+   model = "KSI8560";
+   compatible = "emerson,KSI8560";
+   #address-cells = <1>;
+   #size-cells = <1>;
+
+   aliases {
+   ethernet0 = &enet0;
+   ethernet1 = &enet1;
+   ethernet2 = &enet2;
+   };
+
+   cpus {
+   #address-cells = <1>;
+   #size-cells = <0>;
+
+   PowerPC,[EMAIL PROTECTED] {
+   device_type = "cpu";
+   reg = <0>;
+   d-cache-line-size = <32>;
+   i-cache-line-size = <32>;
+   d-cache-size = <0x8000>;/* L1, 32K */
+   i-cache-size = <0x8000>;/* L1, 32K */
+   timebase-frequency = <0>;   /* From U-boot 
*/
+   bus-frequency = <0>;/* From U-boot 
*/
+   clock-frequency = <0>;  /* From U-boot 
*/
+   };
+   };
+
+   memory {
+   device_type = "memory";
+   reg = <0x 0x1000>;  /* Fixed by 
bootwrapper */
+   };
+
+   [EMAIL PROTECTED] {
+   #address-cells = <1>;
+   #size-cells = <1>;
+   device_type = "soc";
+   ranges = <0x 0xfdf0 0x0010>;
+   reg = <0xfdf0 0x200>;
+   bus-frequency = <0>;/* Fixed by 
bootwrapper */
+
+   [EMAIL PROTECTED] {
+   compatible = "fsl,8540-memory-controller";
+   reg = <0x2000 0x1000>;
+   interrupt-parent = <&MPIC>;
+   interrupts = <0x12 0x2>;
+   };
+
+   [EMAIL PROTECTED] {
+   compatible = "fsl,8540-l2-cache-controller";
+   reg = <0x2 0x1000>;
+   cache-line-size = <0x20>;   /* 32 bytes */
+   cache-size = <0x4>; /* L2, 256K */
+   interrupt-parent = <&MPIC>;
+   interrupts = <0x10 0x2>;
+   };
+
+   [EMAIL PROTECTED] {
+   device_type = "i2c";
+   compatible = "fsl-i2c";
+   reg = <0x3000 0x100>;
+   interrupts = <0x2b 0x2>;
+   interrupt-parent = <&MPIC>;
+   dfsrr;
+   };
+
+   [EMAIL PROTECTED] { /* For 
TSECs */
+   #address-cells = <1>;
+   #size-cells = <0>;
+   device_type = "mdio";
+   compatible = "gianfar";
+   reg = <0x24520 0x20>;
+
+   PHY1: [EMAIL PROTECTED] {
+   interrupt-parent = <&MPIC>;
+   reg = <0x1>;
+   device_type = "ethernet-phy";
+   };
+
+   PHY2: [EMAIL PROTECTED] {
+   interrupt-parent = <&MPIC>;
+   reg = <0x2>;
+   device_type = "ethernet-phy";
+   };
+   };
+
+   enet0: [EMAIL PROTECTED] {
+   linux,network-index = <0>;
+   device_type = "network";
+   model = "TSEC";
+   compatible = "gianfar";
+   reg = <0x24000 0x1000>;
+   /* Mac address filled in by bootwrapper */
+   local-mac-address = [ 00 00 00 00 00 00 ];
+   interrupts = <0x1d 0x2 0x1e 0x2 0x22 0x2>;
+   interrupt-parent = <&MPIC>;
+   phy-handle = <&PHY1>;
+   };
+
+   enet1: [EMAIL PROTECTED] {
+   linux,network-index = <1>;
+   device_type = "network";
+   model = "TSEC";
+   compatible = "gianfar";
+   reg = <0x25000 0x1000>;
+   /* Mac address filled in by bootwrapper */
+   local-mac-address = [ 00 00 00 00 00 00 ];
+   

[PATCH 1/4] Emerson KSI8560 bootwrapper

2008-02-28 Thread Alexandr Smirnov

diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index e3993a6..f43dd6e 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -255,6 +255,7 @@ image-$(CONFIG_TQM8555) += 
cuImage.tqm8555
 image-$(CONFIG_TQM8560)+= cuImage.tqm8560
 image-$(CONFIG_SBC8548)+= cuImage.tqm8548
 image-$(CONFIG_SBC8560)+= cuImage.tqm8560
+image-$(CONFIG_KSI8560)+= cuImage.ksi8560
 
 # Board ports in arch/powerpc/platform/embedded6xx/Kconfig
 image-$(CONFIG_STORCENTER) += cuImage.storcenter
diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper
index c317815..6655a90 100755
--- a/arch/powerpc/boot/wrapper
+++ b/arch/powerpc/boot/wrapper
@@ -174,7 +174,7 @@ cuboot*)
 *-mpc83*)
 platformo=$object/cuboot-83xx.o
 ;;
-*-tqm8541|*-mpc8560*|*-tqm8560|*-tqm8555*)
+*-tqm8541|*-mpc8560*|*-tqm8560|*-tqm8555*|*-ksi8560*)
 platformo=$object/cuboot-85xx-cpm2.o
 ;;
 *-mpc85*)
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 0/0] Add Emerson KSI8560 board support

2008-02-28 Thread Alexandr Smirnov
Hi all,

The following sequence of patches intended to add support for Emerson KSI8560
board.

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


Re: [patch 6/6] PCI: consolidate several pcibios_enable_resources() implementations

2008-02-28 Thread David Howells
Bjorn Helgaas <[EMAIL PROTECTED]> wrote:

> 
> frv: checks only 6 resources at (1), has a different ROM
>   resource check at (4) and (6) that ignores IORESOURCE_ROM_ENABLE
> ...
> mn10300: checks only 6 resources at (1), has no IORESOURCE_{IO,MEM}
>   check at (3), has a different ROM resource check at (4) and (6)
>   that ignores IORESOURCE_ROM_ENABLE

Both parts:

Acked-by: David Howells <[EMAIL PROTECTED]>
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [patch 5/6] PARISC: move PERR & SERR enables out of pcibios_enable_resources()

2008-02-28 Thread Kyle McMartin
On Wed, Feb 27, 2008 at 05:04:42PM -0700, Bjorn Helgaas wrote:
> Move PERR and SERR enables from pcibios_enable_resources() to
> platform_pci_enable_device() so the former matches other
> architectures and can be shared.
> 

I don't have any problems with this, but I think the naming needs to
change. pcibios_* namespace should probably remain arch dependent.
Renaming the unified implementation to pci_enable_resources, and adding
a weak function pcibios_enable_resources that can be overridden by
parisc and arm to enable PERR/SERR after calling the generic
pci_enable_resources function. No?

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


Re: [dtc] breaking out libfdt from dtc so other progs can use it

2008-02-28 Thread Jerone Young

On Thu, 2008-02-28 at 12:41 +1100, David Gibson wrote:
> On Wed, Feb 27, 2008 at 01:40:43PM -0600, Jerone Young wrote:
> > Currently the dtc source code has libfdt integrated in it. This seems to
> > have become place for upstream libfdt changes. Now we all know everyone
> > (linux kernel, cuboot) also have their own versions over libfdt. But if
> > another userspace app wants to use libfdt , it has to copy it from the
> > dtc source and try to maintain it's own copy.
> > 
> > The question I have is can libfdt be split out from dtc source, and
> > become it's own thing. This way other userspace apps can easily download
> > it and link with it?
> > 
> > The reason I ask is I have added dynamic manipulation support of device
> > trees in memory into qemu for KVM. But the issue is keeping a copy of
> > libfdt in the KVM userspace repository, which is getting some opposition
> > (understandably). But this would be much easier if there was a libfdt
> > repo for the library so that we wouldn't need to keep our own copy.
> 
> Um.. libfdt was moved into the dtc repo for convenience, both for us
> writing it (they help to test each other), and for those using it -
> don't have to have separate pulls for these closely related tools.
> 
> I don't understand why you're finding the merged libfdt inconvenient.
> "make" will build both dtc and libfdt, and libfdt can be easily taken
> out and embedded on other projects.

The reason for all the contention is that libfdt is more of a shared
userspace library. Even though dtc really has been the only user of it
in userspace at the moment, now I want to add it's use to qemu. What
many are thinking about is the maintenance of the library. There are
still fixes going in the libfdt in dtc. 

If it where broken out of dtc it would be easier to pickup and pull
fixes from it. Even package it so programs can easily build it
standalone.

It's not often any userspace app needs libfdt. But now with
virtualization userspace apps actually can see the device tree in guest
memory and do have all sort of fun with it easily because of libfdt. 

> 

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


Re: [patch 5/6] PARISC: move PERR & SERR enables out of pcibios_enable_resources()

2008-02-28 Thread Grant Grundler
On Wed, Feb 27, 2008 at 05:04:42PM -0700, Bjorn Helgaas wrote:
> Move PERR and SERR enables from pcibios_enable_resources() to
> platform_pci_enable_device() so the former matches other
> architectures and can be shared.
> 
> Signed-off-by: Bjorn Helgaas <[EMAIL PROTECTED]>

Ack-By: Grant Grundler <[EMAIL PROTECTED]>

This patch sequence is heading in the right direction.
I've not tested this particular one yet but I'm pretty sure it's ok.
I'll fixup any breakage for parisc.

...
> +/*
> + * A driver is enabling the device.  We enable the PERR and SERR bits
> + * unconditionally.  Drivers that do not need parity (eg graphics and
> + * possibly networking) can clear these bits if they want.
> + */
> +static int platform_pci_enable_device(struct pci_dev *dev)

Thanks for preserving this comment.

In general, I'm wondering if the check for device class would be
sufficient here to NOT enable PERR/SERR for graphics automatically.
While disabling PERR was "the right thing" for older "mostly write"
devices of the 1990's and early 2000, it might not be correct for
current 3-D graphics devices which use host mem to buffer processed
results. I'm thinking of Intel graphics controllers in particular
but I don't know any details of how they actually work.

I'm also a bit concerned about this now becuase (IIRC) AGP didn't
implement parity though it looked like PCI protocol. PCI-e certainly
does but it's possible BIOS/Firmware disable parity generation
on the host bridge when connected to a gfx device.
We wouldn't want to enable parity checking on a PCI-e gfx device in this
case and I hope someone (perhaps at Intel) could double check this.

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


Re: Wrong IRQ assigned on MPC8349EMDS board

2008-02-28 Thread Scott Wood
On Thu, Feb 28, 2008 at 09:38:36PM +0530, [EMAIL PROTECTED] wrote:
> I found that the IRQ lines assigned to different peripherals are
> completely wrong.
> My serial ports are connected to pin 9 and 10, but in this kernel the
> IRQs assigned are 16 and 17. 

These are virtual IRQ numbers, which have nothing to do with the IPIC IRQ
numbers.

> On a little investigation I found that the base address assigned to the
> IPIC chip is '0xFDDFB700'

That's a virtual address returned from ioremap(), not the physical
address of the IPIC.

> Does this wrong assignment is due to the wrong base address of the IPIC
> chip?
> With IRQs 16 and 17, how the serial console is working fine?
> 
> When I tried hard coding the IPIC base value to '0xfe000700' then the
> system refuses to boot up.

That might be a hint that things aren't as wrong as you think. :-)

> I kept the IPIC base as 0xfddfb700 and hard coded the irq lines for
> serial ports as 9 and 10
> and in that case the 'request_irq' call fails with the error number as
> '-38',
> which translates to '-ENOSYS'. 

Likewise.

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


Re: [PATCH 3/3] ppc64-specific memory notifier support

2008-02-28 Thread Nathan Lynch
Badari Pulavarty wrote:

> +static struct notifier_block pseries_smp_nb = {

Rename this to pseries_mem_nb?

> + .notifier_call = pseries_memory_notifier,
> +};
> +
> +static int __init pseries_memory_hotplug_init(void)
> +{
> + if (firmware_has_feature(FW_FEATURE_LPAR))
> + pSeries_reconfig_notifier_register(&pseries_smp_nb);
> +
> + return 0;
> +}
> +arch_initcall(pseries_memory_hotplug_init);

arch_initcall doesn't seem appropriate.  __initcall should be fine.

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


Wrong IRQ assigned on MPC8349EMDS board

2008-02-28 Thread biswa.nayak
Hello list
I am trying to bring up MPC8349EMDS board with linux-2.6.18 kernel with
ramfs enabled.
I am passing a device tree binary (dtb) compiled from the corresponding
dts file found from the 'arch/powerpc/boot/dts' directory and compiled
with the device tree compiler.
 
I found that the IRQ lines assigned to different peripherals are
completely wrong.
My serial ports are connected to pin 9 and 10, but in this kernel the
IRQs assigned are 16 and 17. 

On a little investigation I found that the base address assigned to the
IPIC chip is '0xFDDFB700'

If I compile the linux version with 'ARCH=ppc' and boot then my IPIC
base address
is getting assigned as 0xFE000700, which I think is the correct
behaviour. 

I checked in the dts file and found that the IPIC offset is mentioned as
700 and size as 100,
which are correct as per the manual. 
Even the IRQ lines mentioned for the Serial ports in the DTS are '9' and
'A'.

Does this wrong assignment is due to the wrong base address of the IPIC
chip?
With IRQs 16 and 17, how the serial console is working fine?

When I tried hard coding the IPIC base value to '0xfe000700' then the
system refuses to boot up.

I kept the IPIC base as 0xfddfb700 and hard coded the irq lines for
serial ports as 9 and 10
and in that case the 'request_irq' call fails with the error number as
'-38',
which translates to '-ENOSYS'. 

The changes in the dts never gets reflected in the kernel, 
no matter what lines I set for serial line in the dts, the request
always goes for line 16 and 17.

Please let me know if you need any more information regarding the same.
Any help in this will be highly appreciated.

Thanks
Biswa

The information contained in this electronic message and any attachments to 
this message are intended for the exclusive use of the addressee(s) and may 
contain proprietary, confidential or privileged information. If you are not the 
intended recipient, you should not disseminate, distribute or copy this e-mail. 
Please notify the sender immediately and destroy all copies of this message and 
any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient should 
check this email and any attachments for the presence of viruses. The company 
accepts no liability for any damage caused by any virus transmitted by this 
email.

www.wipro.com

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


Re: FW: [PATCH] Xilinx: BSP: Updated ML405 to match hardware used for testing

2008-02-28 Thread Grant Likely
On Thu, Feb 28, 2008 at 9:07 AM, John Linn <[EMAIL PROTECTED]> wrote:
> I think I found my problem that mangled the messages.  I really meant to
>  send both messages to the embedded ppc list rather than this more
>  general list.

Don't bother using linuxppc-embedded.  Stick with linuxppc-dev.  There
has been talk about merging the two lists.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Please pull 'for-2.6.25' branch of 4xx tree

2008-02-28 Thread Josh Boyer
Hi Paul,

Please pull from:

 master.kernel.org:/pub/scm/linux/kernel/git/jwboyer/powerpc-4xx.git for-2.6.25

to pick up a few fixes for .25.  This includes Stephen's hwicap rework
that was done to address the comments that came up during review.

thx,
josh

Josh Boyer (1):
  [POWERPC] 4xx: Use correct board info structure in cuboot wrappers

Stefan Roese (2):
  [POWERPC] 4xx: Fix Haleakala PCIe compatibility problem in dts
  [POWERPC] 4xx: Fix L1 cache size in katmai DTS

Stephen Neuendorffer (1):
  [POWERPC] Xilinx: hwicap cleanup

Valentine Barshak (1):
  [POWERPC] 44x: add missing define TARGET_4xx and TARGET_440GX to cuboot-ta

 arch/powerpc/boot/cuboot-bamboo.c  |1 +
 arch/powerpc/boot/cuboot-ebony.c   |1 +
 arch/powerpc/boot/cuboot-katmai.c  |1 +
 arch/powerpc/boot/cuboot-taishan.c |2 +
 arch/powerpc/boot/cuboot-warp.c|1 +
 arch/powerpc/boot/dts/haleakala.dts|2 +-
 arch/powerpc/boot/dts/katmai.dts   |   58 ++--
 drivers/char/xilinx_hwicap/buffer_icap.c   |   80 
 drivers/char/xilinx_hwicap/fifo_icap.c |   60 ++--
 drivers/char/xilinx_hwicap/xilinx_hwicap.c |  138 +---
 drivers/char/xilinx_hwicap/xilinx_hwicap.h |   24 +++---
 11 files changed, 180 insertions(+), 188 deletions(-)
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: undefined references to __udivdi3 on powerpc

2008-02-28 Thread Olaf Hering
On Thu, Feb 28, Segher Boessenkool wrote:

>> While debugging __divdi3 calls in drivers/crypto/hifn_795x.c (due to the
>> ndelay() delay call with a s64), I found even more breakage of that
>> sort. This is after a allnoconfig with ARCH=powerpc in 2.6.25-rc3,
>> plus CONFIG_MODULES=y and CONFIG_CRYPTO_DEV_HIFN_795X=y:
>
> I cannot reproduce this, but my tree has
>
>   time: prevent the loop in timespec_add_ns() from being optimised away
>
> which is in -mm now.  Could you try that patch?

Yes, this patch fixes it.
Thanks.
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


[PATCH 3/3] ppc64-specific memory notifier support

2008-02-28 Thread Badari Pulavarty
Hotplug memory notifier for ppc64. This gets invoked by writing
the device-node that needs to be removed to /proc/ppc64/ofdt.
We need to adjust the sections and remove sysfs entries by
calling __remove_pages(). Then call arch specific code to
get rid of htab mappings for the section of memory.

Signed-off-by: Badari Pulavarty <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/pseries/Makefile |1 
 arch/powerpc/platforms/pseries/hotplug-memory.c |   98 
 2 files changed, 99 insertions(+)

Index: linux-2.6.25-rc2/arch/powerpc/platforms/pseries/hotplug-memory.c
===
--- /dev/null   1970-01-01 00:00:00.0 +
+++ linux-2.6.25-rc2/arch/powerpc/platforms/pseries/hotplug-memory.c
2008-02-28 08:20:14.0 -0800
@@ -0,0 +1,98 @@
+/*
+ * pseries Memory Hotplug infrastructure.
+ *
+ * Copyright (C) 2008 Badari Pulavarty, IBM Corporation
+ *
+ *  This program is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU General Public License
+ *  as published by the Free Software Foundation; either version
+ *  2 of the License, or (at your option) any later version.
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+static int pseries_remove_memory(struct device_node *np)
+{
+   const char *type;
+   const unsigned int *my_index;
+   const unsigned int *regs;
+   u64 start_pfn, start;
+   struct zone *zone;
+   int ret = -EINVAL;
+
+   /*
+* Check to see if we are actually removing memory
+*/
+   type = of_get_property(np, "device_type", NULL);
+   if (type == NULL || strcmp(type, "memory") != 0)
+   return 0;
+
+   /*
+* Find the memory index and size of the removing section
+*/
+   my_index = of_get_property(np, "ibm,my-drc-index", NULL);
+   if (!my_index)
+   return ret;
+
+   regs = of_get_property(np, "reg", NULL);
+   if (!regs)
+   return ret;
+
+   start_pfn = section_nr_to_pfn(*my_index & 0x);
+   zone = page_zone(pfn_to_page(start_pfn));
+
+   /*
+* Remove section mappings and sysfs entries for the
+* section of the memory we are removing.
+*
+* NOTE: Ideally, this should be done in generic code like
+* remove_memory(). But remove_memory() gets called by writing
+* to sysfs "state" file and we can't remove sysfs entries
+* while writing to it. So we have to defer it to here.
+*/
+   ret = __remove_pages(zone, start_pfn, regs[3] >> PAGE_SHIFT);
+   if (ret)
+   return ret;
+
+   /*
+* Remove htab bolted mappings for this section of memory
+*/
+   start = (unsigned long)__va(start_pfn << PAGE_SHIFT);
+   ret = remove_section_mapping(start, start + regs[3]);
+   return ret;
+}
+
+static int pseries_memory_notifier(struct notifier_block *nb,
+   unsigned long action, void *node)
+{
+   int err = NOTIFY_OK;
+
+   switch (action) {
+   case PSERIES_RECONFIG_ADD:
+   break;
+   case PSERIES_RECONFIG_REMOVE:
+   if (pseries_remove_memory(node))
+   err = NOTIFY_BAD;
+   break;
+   default:
+   err = NOTIFY_DONE;
+   break;
+   }
+   return err;
+}
+
+static struct notifier_block pseries_smp_nb = {
+   .notifier_call = pseries_memory_notifier,
+};
+
+static int __init pseries_memory_hotplug_init(void)
+{
+   if (firmware_has_feature(FW_FEATURE_LPAR))
+   pSeries_reconfig_notifier_register(&pseries_smp_nb);
+
+   return 0;
+}
+arch_initcall(pseries_memory_hotplug_init);
Index: linux-2.6.25-rc2/arch/powerpc/platforms/pseries/Makefile
===
--- linux-2.6.25-rc2.orig/arch/powerpc/platforms/pseries/Makefile   
2008-02-28 08:15:53.0 -0800
+++ linux-2.6.25-rc2/arch/powerpc/platforms/pseries/Makefile2008-02-28 
08:17:57.0 -0800
@@ -14,6 +14,7 @@ obj-$(CONFIG_PCI) += pci.o pci_dlpar.o
 obj-$(CONFIG_PCI_MSI)  += msi.o
 
 obj-$(CONFIG_HOTPLUG_CPU)  += hotplug-cpu.o
+obj-$(CONFIG_MEMORY_HOTPLUG)   += hotplug-memory.o
 
 obj-$(CONFIG_HVC_CONSOLE)  += hvconsole.o
 obj-$(CONFIG_HVCS) += hvcserver.o


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


[PATCH 2/3] generic __remove_pages() support

2008-02-28 Thread Badari Pulavarty
Generic helper function to remove section mappings and sysfs entries
for the section of the memory we are removing.  offline_pages() correctly 
adjusted zone and marked the pages reserved.

Issue: If mem_map, usemap allocation could come from different places -
kmalloc, vmalloc, alloc_pages or bootmem. There is no easy way
to find and free up properly. Especially for bootmem, we need to
know which node the allocation came from.

Signed-off-by: Badari Pulavarty <[EMAIL PROTECTED]>

---
 include/linux/memory_hotplug.h |4 +++
 mm/memory_hotplug.c|   44 +
 mm/sparse.c|   43 +---
 3 files changed, 88 insertions(+), 3 deletions(-)

Index: linux-2.6.25-rc2/mm/memory_hotplug.c
===
--- linux-2.6.25-rc2.orig/mm/memory_hotplug.c   2008-02-27 12:58:17.0 
-0800
+++ linux-2.6.25-rc2/mm/memory_hotplug.c2008-02-27 16:06:50.0 
-0800
@@ -102,6 +102,21 @@ static int __add_section(struct zone *zo
return register_new_memory(__pfn_to_section(phys_start_pfn));
 }
 
+static int __remove_section(struct zone *zone, struct mem_section *ms)
+{
+   int ret = -EINVAL;
+
+   if (!valid_section(ms))
+   return ret;
+
+   ret = unregister_memory_section(ms);
+   if (ret)
+   return ret;
+
+   sparse_remove_one_section(zone, ms);
+   return 0;
+}
+
 /*
  * Reasonably generic function for adding memory.  It is
  * expected that archs that support memory hotplug will
@@ -135,6 +150,35 @@ int __add_pages(struct zone *zone, unsig
 }
 EXPORT_SYMBOL_GPL(__add_pages);
 
+int __remove_pages(struct zone *zone, unsigned long phys_start_pfn,
+unsigned long nr_pages)
+{
+   unsigned long i, ret = 0;
+   int sections_to_remove;
+   unsigned long flags;
+   struct pglist_data *pgdat = zone->zone_pgdat;
+
+   /*
+* We can only remove entire sections
+*/
+   BUG_ON(phys_start_pfn & ~PAGE_SECTION_MASK);
+   BUG_ON(nr_pages % PAGES_PER_SECTION);
+
+   release_mem_region(phys_start_pfn << PAGE_SHIFT, nr_pages * PAGE_SIZE);
+
+   sections_to_remove = nr_pages / PAGES_PER_SECTION;
+   for (i = 0; i < sections_to_remove; i++) {
+   unsigned long pfn = phys_start_pfn + i*PAGES_PER_SECTION;
+   pgdat_resize_lock(pgdat, &flags);
+   ret = __remove_section(zone, __pfn_to_section(pfn));
+   pgdat_resize_unlock(pgdat, &flags);
+   if (ret)
+   break;
+   }
+   return ret;
+}
+EXPORT_SYMBOL_GPL(__remove_pages);
+
 static void grow_zone_span(struct zone *zone,
unsigned long start_pfn, unsigned long end_pfn)
 {
Index: linux-2.6.25-rc2/mm/sparse.c
===
--- linux-2.6.25-rc2.orig/mm/sparse.c   2008-02-15 12:57:20.0 -0800
+++ linux-2.6.25-rc2/mm/sparse.c2008-02-27 13:02:51.0 -0800
@@ -198,12 +198,13 @@ static unsigned long sparse_encode_mem_m
 }
 
 /*
- * We need this if we ever free the mem_maps.  While not implemented yet,
- * this function is included for parity with its sibling.
+ * Decode mem_map from the coded memmap
  */
-static __attribute((unused))
+static
 struct page *sparse_decode_mem_map(unsigned long coded_mem_map, unsigned long 
pnum)
 {
+   /* mask off the extra low bits of information */
+   coded_mem_map &= SECTION_MAP_MASK;
return ((struct page *)coded_mem_map) + section_nr_to_pfn(pnum);
 }
 
@@ -363,6 +364,26 @@ static void __kfree_section_memmap(struc
 }
 #endif /* CONFIG_SPARSEMEM_VMEMMAP */
 
+static void free_section_usemap(struct page *memmap, unsigned long *usemap)
+{
+   if (!usemap)
+   return;
+
+   /*
+* Check to see if allocation came from hot-plug-add
+*/
+   if (PageSlab(virt_to_page(usemap))) {
+   kfree(usemap);
+   if (memmap)
+   __kfree_section_memmap(memmap, PAGES_PER_SECTION);
+   return;
+   }
+
+   /*
+* Allocations came from bootmem - how do I free up ?
+*/
+}
+
 /*
  * returns the number of sections whose mem_maps were properly
  * set.  If this is <=0, then that means that the passed-in
@@ -415,4 +436,20 @@ out:
}
return ret;
 }
+
+void sparse_remove_one_section(struct zone *zone, struct mem_section *ms)
+{
+   struct page *memmap = NULL;
+   unsigned long *usemap = NULL;
+
+   if (ms->section_mem_map) {
+   usemap = ms->pageblock_flags;
+   memmap = sparse_decode_mem_map(ms->section_mem_map,
+   __section_nr(ms));
+   ms->section_mem_map = 0;
+   ms->pageblock_flags = NULL;
+   }
+
+   free_section_usemap(memmap, usemap);
+}
 #endif
Index: linux-2.6.25-rc2/incl

[PATCH 1/3] ppc64-specific remove htab bolted mapping support

2008-02-28 Thread Badari Pulavarty
For memory remove, we need to clean up htab mappings for the
section of the memory we are removing.

This patch implements support for removing htab bolted mappings
for ppc64 lpar. Other sub-archs, may need to implement similar
functionality for the hotplug memory remove to work. 

Signed-off-by: Badari Pulavarty <[EMAIL PROTECTED]>
Acked-by: Paul Mackerras <[EMAIL PROTECTED]>
---
 arch/powerpc/mm/hash_utils_64.c   |   26 ++
 arch/powerpc/platforms/pseries/lpar.c |   15 +++
 include/asm-powerpc/machdep.h |2 ++
 include/asm-powerpc/sparsemem.h   |1 +
 5 files changed, 44 insertions(+), 4 deletions(-)

Index: linux-2.6.25-rc2/arch/powerpc/mm/hash_utils_64.c
===
--- linux-2.6.25-rc2.orig/arch/powerpc/mm/hash_utils_64.c   2008-02-15 
12:57:20.0 -0800
+++ linux-2.6.25-rc2/arch/powerpc/mm/hash_utils_64.c2008-02-27 
12:59:53.0 -0800
@@ -191,6 +191,26 @@ int htab_bolt_mapping(unsigned long vsta
return ret < 0 ? ret : 0;
 }
 
+static int htab_remove_mapping(unsigned long vstart, unsigned long vend,
+ int psize, int ssize)
+{
+   unsigned long vaddr;
+   unsigned int step, shift;
+
+   shift = mmu_psize_defs[psize].shift;
+   step = 1 << shift;
+
+   if (!ppc_md.hpte_removebolted) {
+   printk("Sub-arch doesn't implement hpte_removebolted\n");
+   return -EINVAL;
+   }
+
+   for (vaddr = vstart; vaddr < vend; vaddr += step)
+   ppc_md.hpte_removebolted(vaddr, psize, ssize);
+
+   return 0;
+}
+
 static int __init htab_dt_scan_seg_sizes(unsigned long node,
 const char *uname, int depth,
 void *data)
@@ -429,6 +449,12 @@ void create_section_mapping(unsigned lon
_PAGE_ACCESSED | _PAGE_DIRTY | _PAGE_COHERENT | PP_RWXX,
mmu_linear_psize, mmu_kernel_ssize));
 }
+
+int remove_section_mapping(unsigned long start, unsigned long end)
+{
+   return htab_remove_mapping(start, end, mmu_linear_psize,
+   mmu_kernel_ssize);
+}
 #endif /* CONFIG_MEMORY_HOTPLUG */
 
 static inline void make_bl(unsigned int *insn_addr, void *func)
Index: linux-2.6.25-rc2/include/asm-powerpc/sparsemem.h
===
--- linux-2.6.25-rc2.orig/include/asm-powerpc/sparsemem.h   2008-02-15 
12:57:20.0 -0800
+++ linux-2.6.25-rc2/include/asm-powerpc/sparsemem.h2008-02-27 
12:59:53.0 -0800
@@ -15,6 +15,7 @@
 
 #ifdef CONFIG_MEMORY_HOTPLUG
 extern void create_section_mapping(unsigned long start, unsigned long end);
+extern int remove_section_mapping(unsigned long start, unsigned long end);
 #ifdef CONFIG_NUMA
 extern int hot_add_scn_to_nid(unsigned long scn_addr);
 #else
Index: linux-2.6.25-rc2/arch/powerpc/platforms/pseries/lpar.c
===
--- linux-2.6.25-rc2.orig/arch/powerpc/platforms/pseries/lpar.c 2008-02-15 
12:57:20.0 -0800
+++ linux-2.6.25-rc2/arch/powerpc/platforms/pseries/lpar.c  2008-02-27 
12:59:53.0 -0800
@@ -520,6 +520,20 @@ static void pSeries_lpar_hpte_invalidate
BUG_ON(lpar_rc != H_SUCCESS);
 }
 
+static void pSeries_lpar_hpte_removebolted(unsigned long ea,
+  int psize, int ssize)
+{
+   unsigned long slot, vsid, va;
+
+   vsid = get_kernel_vsid(ea, ssize);
+   va = hpt_va(ea, vsid, ssize);
+
+   slot = pSeries_lpar_hpte_find(va, psize, ssize);
+   BUG_ON(slot == -1);
+
+   pSeries_lpar_hpte_invalidate(slot, va, psize, ssize, 0);
+}
+
 /* Flag bits for H_BULK_REMOVE */
 #define HBR_REQUEST0x4000UL
 #define HBR_RESPONSE   0x8000UL
@@ -597,6 +611,7 @@ void __init hpte_init_lpar(void)
ppc_md.hpte_updateboltedpp = pSeries_lpar_hpte_updateboltedpp;
ppc_md.hpte_insert  = pSeries_lpar_hpte_insert;
ppc_md.hpte_remove  = pSeries_lpar_hpte_remove;
+   ppc_md.hpte_removebolted = pSeries_lpar_hpte_removebolted;
ppc_md.flush_hash_range = pSeries_lpar_flush_hash_range;
ppc_md.hpte_clear_all   = pSeries_lpar_hptab_clear;
 }
Index: linux-2.6.25-rc2/include/asm-powerpc/machdep.h
===
--- linux-2.6.25-rc2.orig/include/asm-powerpc/machdep.h 2008-02-15 
12:57:20.0 -0800
+++ linux-2.6.25-rc2/include/asm-powerpc/machdep.h  2008-02-27 
12:59:53.0 -0800
@@ -68,6 +68,8 @@ struct machdep_calls {
   unsigned long vflags,
   int psize, int ssize);
long(*hpte_remove)(unsigned long hpte_group);
+   void(*hpte_removebolted)(unsigned long ea,
+ 

[PATCH 0/3] hotplug memory remove updates

2008-02-28 Thread Badari Pulavarty
Hi Paul,

Here are the hotplug memory remove updates for 2.6.25-rc2-mm1.

[PATCH 1/3] ppc64-specific remove htab bolted mapping support
[PATCH 2/3] generic __remove_pages() support
[PATCH 3/3] ppc64-specific memory notifier support

As you can see PATCH 1,3 are ppc64-specific. PATCH 1 was already
reviewed by you. Could you please review PATCH 3 and let me know,
if I missing something ?

I would like to submit these for -mm inclusion after your review.

Thanks,
Badari

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


RE: FW: [PATCH] Xilinx: BSP: Updated ML405 to match hardware used for testing

2008-02-28 Thread John Linn
I think I found my problem that mangled the messages.  I really meant to
send both messages to the embedded ppc list rather than this more
general list.

Thanks,
John

-Original Message-
From: Stephen Rothwell [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, February 27, 2008 5:02 PM
To: John Linn
Cc: linuxppc-dev@ozlabs.org; git-dev
Subject: Re: FW: [PATCH] Xilinx: BSP: Updated ML405 to match hardware
used for testing

Hi John,

n Wed, 27 Feb 2008 16:15:18 -0700 "John Linn" <[EMAIL PROTECTED]>
wrote:
>
> The default config file for the ML405 and the xparameters*.h file
> were updated to match the hardware used for testing. The platform
> data in virtex_devices.c was updated for the LL TEMAC driver
> which now uses the dcr_host field to determine if it should use
> DCR for the DMA.
> 
> Signed-off-by: John Linn 

This was badly wrapped as well.

-- 
Cheers,
Stephen Rothwell[EMAIL PROTECTED]
http://www.canb.auug.org.au/~sfr/

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


Re: undefined references to __udivdi3 on powerpc

2008-02-28 Thread Segher Boessenkool
> While debugging __divdi3 calls in drivers/crypto/hifn_795x.c (due to 
> the
> ndelay() delay call with a s64), I found even more breakage of that
> sort. This is after a allnoconfig with ARCH=powerpc in 2.6.25-rc3,
> plus CONFIG_MODULES=y and CONFIG_CRYPTO_DEV_HIFN_795X=y:

I cannot reproduce this, but my tree has

time: prevent the loop in timespec_add_ns() from being optimised away

which is in -mm now.  Could you try that patch?


Segher

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


[PATCH] fs_enet: Don't call NAPI functions when NAPI is not used.

2008-02-28 Thread Laurent Pinchart
fs_enet_close() calls napi_disable() unconditionally. This patch skips the
call when use_napi isn't set.

Signed-off-by: Laurent Pinchart <[EMAIL PROTECTED]>
---
 drivers/net/fs_enet/fs_enet-main.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/net/fs_enet/fs_enet-main.c 
b/drivers/net/fs_enet/fs_enet-main.c
index c83bd65..1801ce3 100644
--- a/drivers/net/fs_enet/fs_enet-main.c
+++ b/drivers/net/fs_enet/fs_enet-main.c
@@ -835,7 +835,8 @@ static int fs_enet_close(struct net_device *dev)
 
netif_stop_queue(dev);
netif_carrier_off(dev);
-   napi_disable(&fep->napi);
+   if (fep->fpi->use_napi)
+   napi_disable(&fep->napi);
phy_stop(fep->phydev);
 
spin_lock_irqsave(&fep->lock, flags);
-- 
1.5.0

-- 
Laurent Pinchart
CSE Semaphore Belgium

Chaussée de Bruxelles, 732A
B-1410 Waterloo
Belgium

T +32 (2) 387 42 59
F +32 (2) 387 42 75


pgpOmGeeqvzf6.pgp
Description: PGP signature
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

undefined references to __udivdi3 on powerpc

2008-02-28 Thread Olaf Hering

While debugging __divdi3 calls in drivers/crypto/hifn_795x.c (due to the
ndelay() delay call with a s64), I found even more breakage of that
sort. This is after a allnoconfig with ARCH=powerpc in 2.6.25-rc3,
plus CONFIG_MODULES=y and CONFIG_CRYPTO_DEV_HIFN_795X=y:

  LD  .tmp_vmlinux1
  kernel/built-in.o: In function `update_xtime_cache':
  (.text+0x221a0): undefined reference to `__umoddi3'
  kernel/built-in.o: In function `update_xtime_cache':
  (.text+0x221c0): undefined reference to `__udivdi3'
  kernel/built-in.o: In function `getnstimeofday':
  (.text+0x22330): undefined reference to `__umoddi3'
  kernel/built-in.o: In function `getnstimeofday':
  (.text+0x22350): undefined reference to `__udivdi3'
  kernel/built-in.o: In function `timekeeping_resume':
  timekeeping.c:(.text+0x226a0): undefined reference to `__udivdi3'
  timekeeping.c:(.text+0x22778): undefined reference to `__umoddi3'
  timekeeping.c:(.text+0x22798): undefined reference to `__udivdi3'
  kernel/built-in.o: In function `update_wall_time':
  (.text+0x22c7c): undefined reference to `__umoddi3'
  kernel/built-in.o: In function `update_wall_time':
  (.text+0x22c9c): undefined reference to `__udivdi3'
  kernel/built-in.o: In function `update_wall_time':
  (.text+0x230f8): undefined reference to `__umoddi3'
  kernel/built-in.o: In function `update_wall_time':
  (.text+0x23118): undefined reference to `__udivdi3'
  kernel/built-in.o: In function `do_settimeofday':
  (.text+0x23520): undefined reference to `__udivdi3'
  kernel/built-in.o: In function `timekeeping_init':
  (.init.text+0x1870): undefined reference to `__udivdi3'
  make[1]: *** [.tmp_vmlinux1] Error 1

But its not a regression, 2.6.24 allnoconfig does not link either on
powerpc32. 

How can this be fixed?

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


Re: [RFC 05/10] mn10300: vmlinux.lds.S cleanup - use PAGE_SIZE, PERCPU macroses

2008-02-28 Thread David Howells
[EMAIL PROTECTED] wrote:

> Subject: [RFC 05/10] mn10300: vmlinux.lds.S cleanup - use PAGE_SIZE, PERCPU 
> macroses
> X-RedHat-Spam-Score: -1.005 
> 
> This patch includes page.h header into liker script that
> allow us to use PAGE_SIZE macro instead of numeric constant
> 
> Also PERCPU macro is used instead of explicit section definition
> 
> Signed-off-by: Cyrill Gorcunov <[EMAIL PROTECTED]>

Acked-by: David Howells <[EMAIL PROTECTED]>
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH] fs_enet: Remove unused fields in the fs_mii_bb_platform_info structure.

2008-02-28 Thread Laurent Pinchart
On Friday 15 February 2008 14:27, Laurent Pinchart wrote:
> The mdio_port, mdio_bit, mdc_port and mdc_bit fields in the
> fs_mii_bb_platform_info structure are left-overs from the move to the Phy
> Abstraction Layer subsystem. They can be safely removed.
>
> Signed-off-by: Laurent Pinchart <[EMAIL PROTECTED]>
[snip]

Is there something wrong with the patch ?

-- 
Laurent Pinchart
CSE Semaphore Belgium

Chaussée de Bruxelles, 732A
B-1410 Waterloo
Belgium

T +32 (2) 387 42 59
F +32 (2) 387 42 75


pgpU6SQlmwjoo.pgp
Description: PGP signature
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev

[PATCH] MTD: fix partition scan control logic in physmap_of and fsl_elbc_nand

2008-02-28 Thread Li Yang
The generic rule for partition scan is to try all supported
partition types before an usable partition table is found.
However the original code returns unsuccessful when there is
an error in any of the partition types.

Signed-off-by: Li Yang <[EMAIL PROTECTED]>
Cc: Stefan Roese <[EMAIL PROTECTED]>
Cc: Peter Korsgaard <[EMAIL PROTECTED]>
---
I later found that Stefan has proposed a similar patch for physmap_of
and Peter proposed another patch to fix cmdlinepart instead.
I'd say that even after cmdlinepart patch is applied the scan control
logic still needs to be fixed.

 drivers/mtd/maps/physmap_of.c|   12 ++--
 drivers/mtd/nand/fsl_elbc_nand.c |7 +--
 2 files changed, 3 insertions(+), 16 deletions(-)

diff --git a/drivers/mtd/maps/physmap_of.c b/drivers/mtd/maps/physmap_of.c
index 49acd41..5ebbbc4 100644
--- a/drivers/mtd/maps/physmap_of.c
+++ b/drivers/mtd/maps/physmap_of.c
@@ -225,23 +225,15 @@ static int __devinit of_flash_probe(struct of_device *dev,
 * line, these take precedence over device tree information */
err = parse_mtd_partitions(info->mtd, part_probe_types,
   &info->parts, 0);
-   if (err < 0)
-   return err;
 
 #ifdef CONFIG_MTD_OF_PARTS
-   if (err == 0) {
+   if (err <= 0)
err = of_mtd_parse_partitions(&dev->dev, info->mtd,
  dp, &info->parts);
-   if (err < 0)
-   return err;
-   }
 #endif
 
-   if (err == 0) {
+   if (err <= 0)
err = parse_obsolete_partitions(dev, info, dp);
-   if (err < 0)
-   return err;
-   }
 
if (err > 0)
add_mtd_partitions(info->mtd, info->parts, err);
diff --git a/drivers/mtd/nand/fsl_elbc_nand.c b/drivers/mtd/nand/fsl_elbc_nand.c
index b025dfe..72e9bd9 100644
--- a/drivers/mtd/nand/fsl_elbc_nand.c
+++ b/drivers/mtd/nand/fsl_elbc_nand.c
@@ -1054,16 +1054,11 @@ static int fsl_elbc_chip_probe(struct fsl_elbc_ctrl 
*ctrl,
/* First look for RedBoot table or partitions on the command
 * line, these take precedence over device tree information */
ret = parse_mtd_partitions(&priv->mtd, part_probe_types, &parts, 0);
-   if (ret < 0)
-   goto err;
 
 #ifdef CONFIG_MTD_OF_PARTS
-   if (ret == 0) {
+   if (ret <= 0)
ret = of_mtd_parse_partitions(priv->dev, &priv->mtd,
  node, &parts);
-   if (ret < 0)
-   goto err;
-   }
 #endif
 
if (ret > 0)
-- 
1.5.4.rc4

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


dtc: Use for_each_marker_of_type in asm_emit_data()

2008-02-28 Thread David Gibson
For no good reason, asm_emit_data() open-codes the equivalent of the
for_each_marker_of_type macro.  Use the macro instead.

Signed-off-by: David Gibson <[EMAIL PROTECTED]>

---
 flattree.c |   10 +++---
 1 file changed, 3 insertions(+), 7 deletions(-)

Index: dtc/flattree.c
===
--- dtc.orig/flattree.c 2008-02-28 20:53:51.0 +1100
+++ dtc/flattree.c  2008-02-28 20:56:56.0 +1100
@@ -162,14 +162,10 @@
 {
FILE *f = e;
int off = 0;
-   struct marker *m;
+   struct marker *m = d.markers;
 
-   m = d.markers;
-   while (m) {
-   if (m->type == LABEL)
-   emit_offset_label(f, m->ref, m->offset);
-   m = m->next;
-   }
+   for_each_marker_of_type(m, LABEL)
+   emit_offset_label(f, m->ref, m->offset);
 
while ((d.len - off) >= sizeof(u32)) {
fprintf(f, "\t.long\t0x%x\n",

-- 
David Gibson| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


dtc: Test and fix conversion to/from old dtb versions

2008-02-28 Thread David Gibson
This patch adds testcases which test dtc when used to convert between
different dtb versions.  These tests uncovered a couple of bugs
handling old dtb versions, which are also fixed.

Signed-off-by: David Gibson <[EMAIL PROTECTED]>

Index: dtc/tests/run_tests.sh
===
--- dtc.orig/tests/run_tests.sh 2008-02-28 16:58:46.0 +1100
+++ dtc/tests/run_tests.sh  2008-02-28 20:53:39.0 +1100
@@ -173,6 +173,19 @@
run_test dtbs_equal_ordered $tree odts_$tree.test.dtb
 done
 
+# Check version conversions
+for tree in test_tree1.dtb ; do
+for aver in 1 2 3 16 17; do
+atree="ov${aver}_$tree.test.dtb"
+run_test dtc.sh -I dtb -O dtb -V$aver -o $atree $tree
+for bver in 16 17; do
+btree="ov${bver}_$atree"
+run_test dtc.sh -I dtb -O dtb -V$bver -o $btree $atree
+run_test dtbs_equal_ordered $btree $tree
+done
+done
+done
+
 # Check some checks
 run_test dtc-checkfails.sh duplicate_node_names -- -I dts -O dtb 
dup-nodename.dts
 run_test dtc-checkfails.sh duplicate_property_names -- -I dts -O dtb 
dup-propname.dts
Index: dtc/flattree.c
===
--- dtc.orig/flattree.c 2008-02-28 17:02:36.0 +1100
+++ dtc/flattree.c  2008-02-28 20:53:39.0 +1100
@@ -410,7 +410,7 @@
 * the reserve buffer, add the reserve map terminating zeroes,
 * the device tree itself, and finally the strings.
 */
-   blob = data_append_data(blob, &fdt, sizeof(fdt));
+   blob = data_append_data(blob, &fdt, vi->hdr_size);
blob = data_append_align(blob, 8);
blob = data_merge(blob, reservebuf);
blob = data_append_zeroes(blob, sizeof(struct fdt_reserve_entry));
@@ -809,7 +809,7 @@
 
 struct boot_info *dt_from_blob(FILE *f)
 {
-   u32 magic, totalsize, version, size_str, size_dt;
+   u32 magic, totalsize, version, size_dt;
u32 off_dt, off_str, off_mem_rsvmap;
int rc;
char *blob;
@@ -889,11 +889,13 @@
if (off_str > totalsize)
die("String table offset exceeds total size\n");
 
-   size_str = -1;
if (version >= 3) {
-   size_str = be32_to_cpu(fdt->size_dt_strings);
+   u32 size_str = be32_to_cpu(fdt->size_dt_strings);
if (off_str+size_str > totalsize)
die("String table extends past total size\n");
+   inbuf_init(&strbuf, blob + off_str, blob + off_str + size_str);
+   } else {
+   inbuf_init(&strbuf, blob + off_str, blob + totalsize);
}
 
if (version >= 17) {
@@ -911,10 +913,6 @@
inbuf_init(&memresvbuf,
   blob + off_mem_rsvmap, blob + totalsize);
inbuf_init(&dtbuf, blob + off_dt, blob + totalsize);
-   if (size_str >= 0)
-   inbuf_init(&strbuf, blob + off_str, blob + off_str + size_str);
-   else
-   inbuf_init(&strbuf, blob + off_str, blob + totalsize);
 
reservelist = flat_read_mem_reserve(&memresvbuf);
 

-- 
David Gibson| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


dtc: Strip redundant "name" properties

2008-02-28 Thread David Gibson
If an input device tree has "name" properties which are correct, then
they are redundant (because they can be derived from the unit name).
Therefore, extend the checking code for correctness of "name"
properties to remove them if they are correct.  dtc will still insert
name properties in the output if that's of a sufficiently old version
to require them.

Signed-off-by: David Gibson <[EMAIL PROTECTED]>

Index: dtc/checks.c
===
--- dtc.orig/checks.c   2008-02-27 15:07:31.0 +1100
+++ dtc/checks.c2008-02-27 21:00:30.0 +1100
@@ -316,9 +316,14 @@
 static void check_name_properties(struct check *c, struct node *root,
  struct node *node)
 {
-   struct property *prop;
+   struct property **pp, *prop = NULL;
+
+   for (pp = &node->proplist; *pp; pp = &((*pp)->next))
+   if (streq((*pp)->name, "name")) {
+   prop = *pp;
+   break;
+   }
 
-   prop = get_property(node, "name");
if (!prop)
return; /* No name property, that's fine */
 
@@ -326,6 +331,12 @@
|| (memcmp(prop->val.val, node->name, node->basenamelen) != 0))
FAIL(c, "\"name\" property in %s is incorrect (\"%s\" instead"
 " of base node name)", node->fullpath, prop->val.val);
+
+   /* The name property is correct, and therefore redundant.  Delete it */
+   *pp = prop->next;
+   free(prop->name);
+   data_free(prop->val);
+   free(prop);
 }
 CHECK_IS_STRING(name_is_string, "name", ERROR);
 NODE_CHECK(name_properties, NULL, ERROR, &name_is_string);

-- 
David Gibson| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [PATCH 1/2] firewire: endianess fix

2008-02-28 Thread Stefan Richter
Benjamin Herrenschmidt wrote:
> Do we have the workaround for the old Apple UniNorth in the new FW OHCI
> driver (for selfID swapping iirc ?)

According to ohci1394.c, it selfIDs and headers of incoming packets are 
not byte-swapped by the old Apple Uninorth FireWire part.  And no, 
firewire-ohci doesn't have the workaround yet.

It should be trivial to copy'n'paste ohci1394's workaround into fw-ohci, 
but it would be good if someone could test before and after.

BTW, since that code is touched everytime a packet is received, we 
should enclose such a workaround in #ifdef CONFIG_PPC_PMAC && 
CONFIG_PPC32, shouldn't we?  (As a second step after adding the workaround.)
-- 
Stefan Richter
-=-==--- --=- ===--
http://arcgraph.de/sr/
___
Linuxppc-dev mailing list
Linuxppc-dev@ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-dev


Re: [RFC][PATCH] ibm_newemac: PowerPC 440EP/440GR EMAC PHY clock workaround

2008-02-28 Thread Benjamin Herrenschmidt

On Tue, 2008-02-26 at 09:02 -0600, Josh Boyer wrote:
> Seems the code will do the right thing since everything is using
> flags.  I suppose my question can be withdrawn.  It is slightly
> confusing to do it that way though.  Perhaps a function to do
> read-modify-writes on DCRs would be welcome.  dcr_modify anyone?

Yup, we probably want to expose a dcri_clrset(), though I would also
expose then __mtdcri/__mfdcri (non locked version) and the spinlock in
case somebody wants to do something fancy.

Cheers,
Ben.


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