Re: net: fix typo in freescale/ucc_geth.c

2012-10-09 Thread Eric Dumazet
On Tue, 2012-10-09 at 10:52 +1100, Michael Neuling wrote:
 The following patch: 
   acb600d net: remove skb recycling
 added dev_free_skb() to drivers/net/ethernet/freescale/ucc_geth.c
 
 This is a typo and should be dev_kfree_skb().  This fixes this.
 
 Signed-off-by: Michael Neuling mi...@neuling.org
 ---
 This hit as a compile error in next-20121008 with mpc85xx_defconfig.
 
 diff --git a/drivers/net/ethernet/freescale/ucc_geth.c 
 b/drivers/net/ethernet/freescale/ucc_geth.c
 index dfa0aaa..0a70bb5 100644
 --- a/drivers/net/ethernet/freescale/ucc_geth.c
 +++ b/drivers/net/ethernet/freescale/ucc_geth.c
 @@ -3268,7 +3268,7 @@ static int ucc_geth_rx(struct ucc_geth_private *ugeth, 
 u8 rxQ, int rx_work_limit
   if (netif_msg_rx_err(ugeth))
   ugeth_err(%s, %d: ERROR!!! skb - 0x%08x,
  __func__, __LINE__, (u32) skb);
 - dev_free_skb(skb);
 + dev_kfree_skb(skb);
  
   ugeth-rx_skbuff[rxQ][ugeth-skb_currx[rxQ]] = NULL;
  

Oops, thanks Michael !


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


Re: [RFC v9 PATCH 00/21] memory-hotplug: hot-remove physical memory

2012-10-09 Thread Wen Congyang
At 09/27/2012 12:46 AM, Vasilis Liaskovitis Wrote:
 Hi,
 
 I am testing 3.6.0-rc7 with this v9 patchset plus more recent fixes 
 [1],[2],[3]
 Running in a guest (qemu+seabios from [4]). 
 CONFIG_SLAB=y
 CONFIG_DEBUG_SLAB=y
 
 After succesfull hot-add and online, I am doing a hot-remove with echo 1  
 /sys/bus/acpi/devices/PNP/eject
 When I do the OSPM-eject, I often get slab corruption in acpi-state cache, 
 or in other caches

I found the reason: when you do OSPM-eject, the kernel will auto offline and 
remove the memory.
But, offlining memory fails, and the memory is still used by the kernel. But 
device_release_driver()
doesn't tell this error to the caller acpi_bus_remove(). The kernel will 
poweroff and eject
the device by emulate _PS3 and _EJ0. The kernel uses some memory which doesn't 
exist. It's
very dangerous.

Thanks
Wen Conyang

 
 [  170.566995] Slab corruption (Not tainted): Acpi-State 
 start=88009fc1e548, len=80
 [  170.567265] Redzone: 0x0/0x0.
 [  170.567399] Last user: [  (null)](0x0)
 [  170.567667] 000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  
 
 [  170.568078] 010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  
 
 [  170.568487] 020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  
 
 [  170.568894] 030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  
 
 [  170.569302] 040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  
 
 [  170.569712] Prev obj: start=9fc1e4d0, len=80
 [  170.569869] BUG: unable to handle kernel paging request at 9fc1e520
 [  170.570171] IP: [8112803c] print_objinfo+0x9c/0x110
 [  170.570397] PGD 7cf37067 PUD 0 
 [  170.570619] Oops:  [#1] SMP 
 [  170.570843] Modules linked in: netconsole acpiphp pci_hotplug 
 acpi_memhotplug loop kvm_amd kvm tpm_tis microcode tpm tpm_bios psmouse 
 parport_pc serio_raw evdev parport i2c_piix4 processor thermal_sys i2c_core 
 button ext3 jbd mbcache sg sr_mod cdrom ata_generic virtio_net virtio_blk 
 ata_piix libata scsi_mod virtio_pci virtio_ring virtio
 [  170.573474] CPU 0 
 [  170.573568] Pid: 29, comm: kworker/0:1 Not tainted 3.6.0-rc7-guest #12 
 Bochs Bochs
 [  170.573830] RIP: 0010:[8112803c]  [8112803c] 
 print_objinfo+0x9c/0x110
 [  170.574106] RSP: 0018:88003eaf3a70  EFLAGS: 00010202
 [  170.574268] RAX: 9fc1e4c8 RBX: 0002 RCX: 
 24b8
 [  170.574468] RDX: 9fc1e4c8 RSI: 9fc1e4c8 RDI: 
 88003e9bb980
 [  170.574668] RBP: 88003e9bb980 R08: 880037964078 R09: 
 
 [  170.574870] R10: 021e R11: 0002 R12: 
 9fc1e4c8
 [  170.575070] R13: 9fc1e520 R14: 004f R15: 
 ffa5
 [  170.575274] FS:  7fc6b7530700() GS:88003fc0() 
 knlGS:
 [  170.575494] CS:  0010 DS:  ES:  CR0: 8005003b
 [  170.575665] CR2: 9fc1e520 CR3: 7c9c1000 CR4: 
 06f0
 [  170.575870] DR0:  DR1:  DR2: 
 
 [  170.576075] DR3:  DR6: 0ff0 DR7: 
 0400
 [  170.576276] Process kworker/0:1 (pid: 29, threadinfo 88003eaf2000, 
 task 88003ea941c0)
 [  170.576507] Stack:
 [  170.576599]  0010 01893fbe 88009fc1e000 
 0050
 [  170.576938]  9fc1e4c8 004f ffa5 
 8112899f
 [  170.576938]  88003eb309d8 81712d6d 88003e9bb980 
 88009fc1e540
 [  170.576938] Call Trace:
 [  170.576938]  [8112899f] ? check_poison_obj+0x1df/0x1f0
 [  170.576938]  [813047d0] ? acpi_ut_create_generic_state+0x2f/0x4c
 [  170.576938]  [813047d0] ? acpi_ut_create_generic_state+0x2f/0x4c
 [  170.576938]  [81128a9d] ? 
 cache_alloc_debugcheck_after.isra.52+0xed/0x220
 [  170.576938]  [813047d0] ? acpi_ut_create_generic_state+0x2f/0x4c
 [  170.576938]  [8112beb5] ? kmem_cache_alloc+0xb5/0x1e0
 [  170.576938]  [813047d0] ? acpi_ut_create_generic_state+0x2f/0x4c
 [  170.576938]  [812edf2d] ? acpi_ds_result_push+0x5d/0x12e
 [  170.576938]  [812ed127] ? acpi_ds_exec_end_op+0x28e/0x3d3
 [  170.576938]  [812fd86a] ? acpi_ps_parse_loop+0x79f/0x931
 [  170.576938]  [812fdd6c] ? acpi_ps_parse_aml+0x89/0x261
 [  170.576938]  [812fe50c] ? acpi_ps_execute_method+0x1be/0x266
 [  170.576938]  [812f91f7] ? acpi_ns_evaluate+0xd3/0x19a
 [  170.576938]  [812fb93e] ? acpi_evaluate_object+0xf3/0x1f4
 [  170.576938]  [812e1104] ? acpi_os_wait_events_complete+0x1b/0x1b
 [  170.576938]  [812e4782] ? acpi_bus_hot_remove_device+0xeb/0x123
 [  170.576938]  [812e1121] ? acpi_os_execute_deferred+0x1d/0x29
 [  170.576938]  [81058ec5] ? process_one_work+0x125/0x560
 [  170.576938]  [81059e7a] ? worker_thread+0x16a/0x4e0
 [  170.576938]  

Re: [RFC v9 PATCH 00/21] memory-hotplug: hot-remove physical memory

2012-10-09 Thread Wen Congyang
At 09/27/2012 12:46 AM, Vasilis Liaskovitis Wrote:
 Hi,
 
 I am testing 3.6.0-rc7 with this v9 patchset plus more recent fixes 
 [1],[2],[3]
 Running in a guest (qemu+seabios from [4]). 
 CONFIG_SLAB=y
 CONFIG_DEBUG_SLAB=y
 
 After succesfull hot-add and online, I am doing a hot-remove with echo 1  
 /sys/bus/acpi/devices/PNP/eject
 When I do the OSPM-eject, I often get slab corruption in acpi-state cache, 
 or in other caches

The following patch can fix this problem:
https://lkml.org/lkml/2012/7/12/186

Thanks
Wen Congyang

 
 [  170.566995] Slab corruption (Not tainted): Acpi-State 
 start=88009fc1e548, len=80
 [  170.567265] Redzone: 0x0/0x0.
 [  170.567399] Last user: [  (null)](0x0)
 [  170.567667] 000: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  
 
 [  170.568078] 010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  
 
 [  170.568487] 020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  
 
 [  170.568894] 030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  
 
 [  170.569302] 040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  
 
 [  170.569712] Prev obj: start=9fc1e4d0, len=80
 [  170.569869] BUG: unable to handle kernel paging request at 9fc1e520
 [  170.570171] IP: [8112803c] print_objinfo+0x9c/0x110
 [  170.570397] PGD 7cf37067 PUD 0 
 [  170.570619] Oops:  [#1] SMP 
 [  170.570843] Modules linked in: netconsole acpiphp pci_hotplug 
 acpi_memhotplug loop kvm_amd kvm tpm_tis microcode tpm tpm_bios psmouse 
 parport_pc serio_raw evdev parport i2c_piix4 processor thermal_sys i2c_core 
 button ext3 jbd mbcache sg sr_mod cdrom ata_generic virtio_net virtio_blk 
 ata_piix libata scsi_mod virtio_pci virtio_ring virtio
 [  170.573474] CPU 0 
 [  170.573568] Pid: 29, comm: kworker/0:1 Not tainted 3.6.0-rc7-guest #12 
 Bochs Bochs
 [  170.573830] RIP: 0010:[8112803c]  [8112803c] 
 print_objinfo+0x9c/0x110
 [  170.574106] RSP: 0018:88003eaf3a70  EFLAGS: 00010202
 [  170.574268] RAX: 9fc1e4c8 RBX: 0002 RCX: 
 24b8
 [  170.574468] RDX: 9fc1e4c8 RSI: 9fc1e4c8 RDI: 
 88003e9bb980
 [  170.574668] RBP: 88003e9bb980 R08: 880037964078 R09: 
 
 [  170.574870] R10: 021e R11: 0002 R12: 
 9fc1e4c8
 [  170.575070] R13: 9fc1e520 R14: 004f R15: 
 ffa5
 [  170.575274] FS:  7fc6b7530700() GS:88003fc0() 
 knlGS:
 [  170.575494] CS:  0010 DS:  ES:  CR0: 8005003b
 [  170.575665] CR2: 9fc1e520 CR3: 7c9c1000 CR4: 
 06f0
 [  170.575870] DR0:  DR1:  DR2: 
 
 [  170.576075] DR3:  DR6: 0ff0 DR7: 
 0400
 [  170.576276] Process kworker/0:1 (pid: 29, threadinfo 88003eaf2000, 
 task 88003ea941c0)
 [  170.576507] Stack:
 [  170.576599]  0010 01893fbe 88009fc1e000 
 0050
 [  170.576938]  9fc1e4c8 004f ffa5 
 8112899f
 [  170.576938]  88003eb309d8 81712d6d 88003e9bb980 
 88009fc1e540
 [  170.576938] Call Trace:
 [  170.576938]  [8112899f] ? check_poison_obj+0x1df/0x1f0
 [  170.576938]  [813047d0] ? acpi_ut_create_generic_state+0x2f/0x4c
 [  170.576938]  [813047d0] ? acpi_ut_create_generic_state+0x2f/0x4c
 [  170.576938]  [81128a9d] ? 
 cache_alloc_debugcheck_after.isra.52+0xed/0x220
 [  170.576938]  [813047d0] ? acpi_ut_create_generic_state+0x2f/0x4c
 [  170.576938]  [8112beb5] ? kmem_cache_alloc+0xb5/0x1e0
 [  170.576938]  [813047d0] ? acpi_ut_create_generic_state+0x2f/0x4c
 [  170.576938]  [812edf2d] ? acpi_ds_result_push+0x5d/0x12e
 [  170.576938]  [812ed127] ? acpi_ds_exec_end_op+0x28e/0x3d3
 [  170.576938]  [812fd86a] ? acpi_ps_parse_loop+0x79f/0x931
 [  170.576938]  [812fdd6c] ? acpi_ps_parse_aml+0x89/0x261
 [  170.576938]  [812fe50c] ? acpi_ps_execute_method+0x1be/0x266
 [  170.576938]  [812f91f7] ? acpi_ns_evaluate+0xd3/0x19a
 [  170.576938]  [812fb93e] ? acpi_evaluate_object+0xf3/0x1f4
 [  170.576938]  [812e1104] ? acpi_os_wait_events_complete+0x1b/0x1b
 [  170.576938]  [812e4782] ? acpi_bus_hot_remove_device+0xeb/0x123
 [  170.576938]  [812e1121] ? acpi_os_execute_deferred+0x1d/0x29
 [  170.576938]  [81058ec5] ? process_one_work+0x125/0x560
 [  170.576938]  [81059e7a] ? worker_thread+0x16a/0x4e0
 [  170.576938]  [81059d10] ? manage_workers+0x310/0x310
 [  170.576938]  [8105e6c5] ? kthread+0x85/0x90
 [  170.576938]  [814eb2c4] ? kernel_thread_helper+0x4/0x10
 [  170.576938]  [8105e640] ? flush_kthread_worker+0xa0/0xa0
 [  170.576938]  [814eb2c0] ? gs_change+0x13/0x13
 [  170.576938] Code: 

Re: [PATCH 8/10] memory-hotplug : remove page table of x86_64 architecture

2012-10-09 Thread wujianguo
Hi Congyang,
I think we should also free pages which are used by page tables after 
removing
page tables of the memory.

From: Jianguo Wu wujian...@huawei.com

Signed-off-by: Jianguo Wu wujian...@huawei.com
Signed-off-by: Jiang Liu jiang@huawei.com
---
 arch/x86/mm/init_64.c |  110 +++-
 1 files changed, 89 insertions(+), 21 deletions(-)

diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index 5596dfa..81f9c3b 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -675,6 +675,74 @@ int arch_add_memory(int nid, u64 start, u64 size)
 }
 EXPORT_SYMBOL_GPL(arch_add_memory);

+static inline void free_pagetable(struct page *page)
+{
+   struct zone *zone;
+
+   __ClearPageReserved(page);
+   __free_page(page);
+
+   zone = page_zone(page);
+   zone_span_writelock(zone);
+   zone-present_pages++;
+   zone_span_writeunlock(zone);
+   totalram_pages++;
+}
+
+static void free_pte_table(pte_t *pte_start, pmd_t *pmd)
+{
+   pte_t *pte;
+   int i;
+
+   for (i = 0; i  PTRS_PER_PTE; i++) {
+   pte = pte_start + i;
+   if (pte_val(*pte))
+   break;
+   }
+
+   /* free a pte talbe */
+   if (i == PTRS_PER_PTE) {
+   free_pagetable(pmd_page(*pmd));
+   pmd_clear(pmd);
+   }
+}
+
+static void free_pmd_table(pmd_t *pmd_start, pud_t *pud)
+{
+   pmd_t *pmd;
+   int i;
+
+   for (i = 0; i  PTRS_PER_PMD; i++) {
+   pmd = pmd_start + i;
+   if (pmd_val(*pmd))
+   break;
+   }
+
+   /* free a pmd talbe */
+   if (i == PTRS_PER_PMD) {
+   free_pagetable(pud_page(*pud));
+   pud_clear(pud);
+   }
+}
+
+static void free_pud_table(pud_t *pud_start, pgd_t *pgd)
+{
+   pud_t *pud;
+   int i;
+
+   for (i = 0; i  PTRS_PER_PUD; i++) {
+   pud = pud_start + i;
+   if (pud_val(*pud))
+   break;
+   }
+
+   /* free a pud table */
+   if (i == PTRS_PER_PUD) {
+   free_pagetable(pgd_page(*pgd));
+   pgd_clear(pgd);
+   }
+}
+
 static void __meminit
 phys_pte_remove(pte_t *pte_page, unsigned long addr, unsigned long end)
 {
@@ -704,21 +772,19 @@ phys_pmd_remove(pmd_t *pmd_page, unsigned long addr, 
unsigned long end)
unsigned long pages = 0, next;
int i = pmd_index(addr);

-   for (; i  PTRS_PER_PMD; i++, addr = next) {
+   for (; i  PTRS_PER_PMD  addr  end; i++, addr = next) {
unsigned long pte_phys;
pmd_t *pmd = pmd_page + pmd_index(addr);
pte_t *pte;

-   if (addr = end)
-   break;
-
-   next = (addr  PMD_MASK) + PMD_SIZE;
+   next = pmd_addr_end(addr, end);

if (!pmd_present(*pmd))
continue;

if (pmd_large(*pmd)) {
-   if ((addr  ~PMD_MASK) == 0  next = end) {
+   if (IS_ALIGNED(addr, PMD_SIZE) 
+   IS_ALIGNED(next, PMD_SIZE)) {
set_pmd(pmd, __pmd(0));
pages++;
continue;
@@ -729,7 +795,8 @@ phys_pmd_remove(pmd_t *pmd_page, unsigned long addr, 
unsigned long end)
 * so split 2M page to 4K page.
 */
pte = alloc_low_page(pte_phys);
-   __split_large_page((pte_t *)pmd, addr, pte);
+   __split_large_page((pte_t *)pmd,
+  (unsigned long)__va(addr), pte);

spin_lock(init_mm.page_table_lock);
pmd_populate_kernel(init_mm, pmd, __va(pte_phys));
@@ -738,7 +805,8 @@ phys_pmd_remove(pmd_t *pmd_page, unsigned long addr, 
unsigned long end)

spin_lock(init_mm.page_table_lock);
pte = map_low_page((pte_t *)pmd_page_vaddr(*pmd));
-   phys_pte_remove(pte, addr, end);
+   phys_pte_remove(pte, addr, next);
+   free_pte_table(pte, pmd);
unmap_low_page(pte);
spin_unlock(init_mm.page_table_lock);
}
@@ -751,21 +819,19 @@ phys_pud_remove(pud_t *pud_page, unsigned long addr, 
unsigned long end)
unsigned long pages = 0, next;
int i = pud_index(addr);

-   for (; i  PTRS_PER_PUD; i++, addr = next) {
+   for (; i  PTRS_PER_PUD  addr  end; i++, addr = next) {
unsigned long pmd_phys;
pud_t *pud = pud_page + pud_index(addr);
pmd_t *pmd;

-   if (addr = end)
-   break;
-
-   next = (addr  PUD_MASK) + PUD_SIZE;
+   next = pud_addr_end(addr, end);

if (!pud_present(*pud))
continue;

[GIT PULL] Disintegrate UAPI for powerpc [ver #2]

2012-10-09 Thread David Howells
Can you merge the following branch into the powerpc tree please.

This is to complete part of the UAPI disintegration for which the preparatory
patches were pulled recently.

Now that the fixups and the asm-generic chunk have been merged, I've
regenerated the patches to get rid of those dependencies and to take account of
any changes made so far in the merge window.  If you have already pulled the
older version of the branch aimed at you, then please feel free to ignore this
request.

The following changes since commit 9e2d8656f5e8aa214e66b462680cf86b210b74a8:

  Merge branch 'akpm' (Andrew's patch-bomb) (2012-10-09 16:23:15 +0900)

are available in the git repository at:


  git://git.infradead.org/users/dhowells/linux-headers.git 
tags/disintegrate-powerpc-20121009

for you to fetch changes up to c3617f72036c909e1f6086b5b9e364e0ef90a6da:

  UAPI: (Scripted) Disintegrate arch/powerpc/include/asm (2012-10-09 09:47:26 
+0100)


UAPI Disintegration 2012-10-09


David Howells (1):
  UAPI: (Scripted) Disintegrate arch/powerpc/include/asm

 arch/powerpc/include/asm/Kbuild   |  35 --
 arch/powerpc/include/asm/bootx.h  | 123 +--
 arch/powerpc/include/asm/cputable.h   |  35 +-
 arch/powerpc/include/asm/elf.h| 311 +-
 arch/powerpc/include/asm/kvm_para.h   |  70 +---
 arch/powerpc/include/asm/mman.h   |  27 +-
 arch/powerpc/include/asm/nvram.h  |  55 +---
 arch/powerpc/include/asm/ptrace.h | 242 +-
 arch/powerpc/include/asm/signal.h | 143 +---
 arch/powerpc/include/asm/spu_info.h   |  29 +-
 arch/powerpc/include/asm/swab.h   |  15 +-
 arch/powerpc/include/asm/termios.h|  69 +---
 arch/powerpc/include/asm/types.h  |  30 +-
 arch/powerpc/include/asm/unistd.h | 374 +
 arch/powerpc/include/uapi/asm/Kbuild  |  41 +++
 arch/powerpc/include/{ = uapi}/asm/auxvec.h  |   0
 arch/powerpc/include/{ = uapi}/asm/bitsperlong.h |   0
 arch/powerpc/include/uapi/asm/bootx.h | 132 
 arch/powerpc/include/{ = uapi}/asm/byteorder.h   |   0
 arch/powerpc/include/uapi/asm/cputable.h  |  36 ++
 arch/powerpc/include/uapi/asm/elf.h   | 307 +
 arch/powerpc/include/{ = uapi}/asm/errno.h   |   0
 arch/powerpc/include/{ = uapi}/asm/fcntl.h   |   0
 arch/powerpc/include/{ = uapi}/asm/ioctl.h   |   0
 arch/powerpc/include/{ = uapi}/asm/ioctls.h  |   0
 arch/powerpc/include/{ = uapi}/asm/ipcbuf.h  |   0
 arch/powerpc/include/{ = uapi}/asm/kvm.h |   0
 arch/powerpc/include/uapi/asm/kvm_para.h  |  90 +
 arch/powerpc/include/{ = uapi}/asm/linkage.h |   0
 arch/powerpc/include/uapi/asm/mman.h  |  31 ++
 arch/powerpc/include/{ = uapi}/asm/msgbuf.h  |   0
 arch/powerpc/include/uapi/asm/nvram.h |  62 
 arch/powerpc/include/{ = uapi}/asm/param.h   |   0
 arch/powerpc/include/{ = uapi}/asm/poll.h|   0
 arch/powerpc/include/{ = uapi}/asm/posix_types.h |   0
 arch/powerpc/include/{ = uapi}/asm/ps3fb.h   |   0
 arch/powerpc/include/uapi/asm/ptrace.h| 259 +++
 arch/powerpc/include/{ = uapi}/asm/resource.h|   0
 arch/powerpc/include/{ = uapi}/asm/seccomp.h |   0
 arch/powerpc/include/{ = uapi}/asm/sembuf.h  |   0
 arch/powerpc/include/{ = uapi}/asm/setup.h   |   0
 arch/powerpc/include/{ = uapi}/asm/shmbuf.h  |   0
 arch/powerpc/include/{ = uapi}/asm/sigcontext.h  |   0
 arch/powerpc/include/{ = uapi}/asm/siginfo.h |   0
 arch/powerpc/include/uapi/asm/signal.h| 145 +
 arch/powerpc/include/{ = uapi}/asm/socket.h  |   0
 arch/powerpc/include/{ = uapi}/asm/sockios.h |   0
 arch/powerpc/include/uapi/asm/spu_info.h  |  53 +++
 arch/powerpc/include/{ = uapi}/asm/stat.h|   0
 arch/powerpc/include/{ = uapi}/asm/statfs.h  |   0
 arch/powerpc/include/uapi/asm/swab.h  |  23 ++
 arch/powerpc/include/{ = uapi}/asm/termbits.h|   0
 arch/powerpc/include/uapi/asm/termios.h   |  76 +
 arch/powerpc/include/uapi/asm/types.h |  40 +++
 arch/powerpc/include/{ = uapi}/asm/ucontext.h|   0
 arch/powerpc/include/uapi/asm/unistd.h| 380 ++
 56 files changed, 1705 insertions(+), 1528 deletions(-)
 rename arch/powerpc/include/{ = uapi}/asm/auxvec.h (100%)
 rename arch/powerpc/include/{ = uapi}/asm/bitsperlong.h (100%)
 create mode 100644 arch/powerpc/include/uapi/asm/bootx.h
 rename arch/powerpc/include/{ = uapi}/asm/byteorder.h (100%)
 create mode 100644 arch/powerpc/include/uapi/asm/cputable.h
 create mode 100644 arch/powerpc/include/uapi/asm/elf.h
 rename arch

[m68k,powerpc,dma,ethernet,freescale RFA] Coldfire m54xx FEC ethernet driver

2012-10-09 Thread Philippe De Muyter
[CCing lkml, linux-ppc, netdev, linux-m68k]

Hello kernel sources architects

I have a working driver for the m54xx FEC ethernet driver that I
would like to integrate in the kernel tree.  Problems are that
- this driver needs an associated DMA driver (provided by FreeScale)
wich is not dma-engine enabled
- they're are already many fec drivers in the kernel tree, and
at least one, fec_mpc52xx.c, seems to be very similar (information
below), to the one for the mcf54xx, except it uses a differently
named associated DMA driver (BestComm/SmartDma/SDMA) which is also
not dma-engine enabled, and even kept hidden in /arch/powerpc where
it is inaccessible when compiling for m68k.  The underlying DMA part
from Freescale however seems similar to the one used in the
m54xx. (again, see information below)

So, now I am lost, what should I do ?

The current state of my patches
[http://mailman.uclinux.org/pipermail/uclinux-dev/2012-September/052147.html]
is pushing the freescale provided MCD_DMA dma driver to /drivers/dma,
without adding the dma-engine compatibility layer, and adding the specific
fec_m54xx ethernet driver to /drivers/net/ethernet/freescale

Best regards

Philippe

On Tue, Oct 09, 2012 at 04:12:44PM +1000, Greg Ungerer wrote:
 Hi Philippe,

 On 05/10/12 01:03, Philippe De Muyter wrote:
 On Thu, Oct 04, 2012 at 04:56:01PM +0200, Philippe De Muyter wrote:
 On Thu, Oct 04, 2012 at 11:33:32PM +1000, Greg Ungerer wrote:

 My biggest concern is the amount of MCD/DMA support code. And it is
 all done quite differently to everything else in the kernel. We may
 get a bit of push back from kernel folk who look after DMA.

 Actually, there is already a similar code in arch/powerpc/sysdev/bestcomm
 (also from freescale, maybe an identical part, but I did not find any
 usable doc), but the powerpc folks kept that hidden in the arch/powerpc
 tree, instead of installing it in drivers/dma.

 The MCD DMA or DMA FEC code from freescale has a comment implying that 
 this
 was first used in the MPC8220 part.  And Montavista has a MPC8220 port, 
 but
 I did not find it, so I do not know where they installed the MCD DMA 
 driver.

 Ok, looks like there is a bit a variance in all this.

I also began to read the mpc5200 user's guide parts about the fec and
BestComm/SmartDma/SDMA (not sure which one is the official FreeScale name)
and they look very similar, but not identical, to their m54xx counterparts.

It seems possible to make the fec_mpc52xx.c driver work for the m54xx
but that needs at least:
- moving some files or part of them from /arch/powerpc/sysdev and
  /arch/powerpc/include/asm to /drivers/dma and /include/linux,
- renaming the fec_mpc52xx files to a more sensible name,
- providing out_be32 and in_be32 in /arch/m68k/include/asm/io.h,
- and then unifying the interface to BestComm/SmartDma/SDMA and MCD_DMA
  in mcf_52xx.c.

An additional problem is that the freescale docs for powerpcs and for
coldfires do not use the same mnemonics for the same registers.

e.g. FEC registers
offset  MPC5200 MCF5484
==  === ===
000 FEC_ID  n/a
004 IEVENT  EIR
008 IMASK   EIMR
010 R_DES_ACTIVEn/a
014 X_DES_ACTIVEn/a
024 ECNTRL  ECR
040 MII_DATAMDATA
044 MII_SPEED   MSCR
064 MIB_CONTROL MIBC
084 R_CNTRL RCR
088 R_HASH  RHR
0C4 X_CNTRL TCR
0E4 PADDR1  PALR
0E8 PADDR2  PAHR
0EC OP_PAUSEOPD
118 IADDR1  IAUR
11C IADDR1  IALR
120 GADDR1  GAUR
124 GADDR2  GALR
144 X_WMRK  FECTFWR
184 RFIFO_DATA  FECRFDR
188 RFIFO_STATUSFECRFSR
18C RFIFO_CONTROL   FECRFCR
190 RFIFO_LRF_PTR   FECRLRFP
194 RFIFO_LWF_PTR   FECRLWFP
198 RFIFO_ALARM FECRFAR
19C RFIFO_RDPTR FECRFRP
1A0 RFIFO_WRPTR FECRFWP
1A4 TFIFO_DATA  FECTFDR
1A8 TFIFO_STATUSFECTFSR
1AC TFIFO_CONTROL   FECTFCR
1B0 TFIFO_LRF_PTR   FECTLRFP
1B4 TFIFO_LWF_PTR   FECTLWFP
1B8 TFIFO_ALARM FECTFAR
1BC TFIFO_RDPTR FECTFRP
1C0 TFIFO_WRPTR FECTFWP
1C4 RESET_CNTRL FECFRST
1C8 XMIT_FSMFECCTCWR

 Probably the best thing to do is post the patches on the linux kernel
 mailing list then, asking for direction on a dma driver.

 I have no problem with it going into the arch/m68k area. So that is
 always an option.

For the dma engines, the similarity is also obvious.  For example, find
below side by side mpc52xx and m54xx definitions for the
main DMA registers :

from mpc52xx.h  from MCD_dma.h
/* SDMA */  

[RFC Patch] 405gp IBM EMAC Phy probe fails with no link

2012-10-09 Thread Andrew May
I have an older PPC 405GP board with a 2.6.33 kernel that fails to 
install a eth0 instance because the phy probe fails when there is no 
good ethernet link.
I have looked at the latest kernel code and it seems just about the same 
in this area, but I have not tried it.


Does anyone else still have a 405GP board to try and see if eth0 comes 
up with not enet cable?


I tried to probe the phy earlier and skip the emac_configure() call in 
emac_init_phy() to avoid doing the MR0_SRST bit set.

But the phy read still times out.

I then went with this approach to re-call emac_init_phy() after the 
emac_reset() finally completes when a cable is plugged in.

Does anyone else have any ideas why the phy probe fails on the first pass?
diff -ur linux.orig/drivers/net/ibm_newemac/core.c linux/drivers/net/ibm_newemac/core.c
--- linux.orig/drivers/net/ibm_newemac/core.c	2012-10-08 12:38:33.0 -0700
+++ linux/drivers/net/ibm_newemac/core.c	2012-10-08 14:31:35.797089192 -0700
@@ -106,6 +106,7 @@
  */
 static DECLARE_WAIT_QUEUE_HEAD(emac_probe_wait);
 
+static int emac_init_phy(struct emac_instance *dev);
 /* Having stable interface names is a doomed idea. However, it would be nice
  * if we didn't have completely random interface names at boot too :-) It's
  * just a matter of making everybody's life easier. Since we are doing
@@ -135,7 +136,7 @@
   EMAC_FTR_440EP_PHY_CLK_FIX))
 		DBG(dev, %s NL, error);
 	else if (net_ratelimit())
-		printk(KERN_ERR %s: %s\n, dev-ofdev-node-full_name, error);
+		printk(KERN_INFO %s: %s\n, dev-ofdev-node-full_name, error);
 }
 
 /* EMAC PHY clock workaround:
@@ -161,6 +162,7 @@
 }
 
 /* PHY polling intervals */
+#define PHY_POLL_NO_PHY 	(5 * HZ)
 #define PHY_POLL_LINK_ON	HZ
 #define PHY_POLL_LINK_OFF	(HZ / 5)
 
@@ -1156,8 +1158,12 @@
 
 	/* Start PHY polling now.
 	 */
-	if (dev-phy.address = 0) {
+	if (dev-phy.address = 0 || dev-phy.address == -2) {
 		int link_poll_interval;
+		if (dev-phy.address == -2) {
+			netif_carrier_off(dev-ndev);
+			link_poll_interval = PHY_POLL_NO_PHY;
+		}else 
 		if (dev-phy.def-ops-poll_link(dev-phy)) {
 			dev-phy.def-ops-read_link(dev-phy);
 			emac_rx_clk_default(dev);
@@ -1243,7 +1249,17 @@
 	if (!dev-opened)
 		goto bail;
 
-	if (dev-phy.def-ops-poll_link(dev-phy)) {
+
+	if (!dev-phy.def) {
+		/* If the reset finally clears, because the phy now
+		 * has a link, then reprobe for the phy.
+		 */
+		if (emac_reset(dev) == 0)
+		{
+			emac_init_phy(dev);
+		}
+		link_poll_interval = PHY_POLL_NO_PHY;
+	}else if (dev-phy.def-ops-poll_link(dev-phy)) {
 		if (!netif_carrier_ok(dev-ndev)) {
 			emac_rx_clk_default(dev);
 			/* Get new link parameters */
@@ -2376,7 +2392,7 @@
 	return 0;
 }
 
-static int __devinit emac_init_phy(struct emac_instance *dev)
+static int emac_init_phy(struct emac_instance *dev)
 {
 	struct device_node *np = dev-ofdev-node;
 	struct net_device *ndev = dev-ndev;
@@ -2470,7 +2486,9 @@
 	mutex_unlock(emac_phy_map_lock);
 	if (i == 0x20) {
 		printk(KERN_WARNING %s: can't find PHY!\n, np-full_name);
-		return -ENXIO;
+		busy_phy_map = 0;
+		dev-phy.address = -2;
+		return 0;
 	}
 
 	/* Init PHY */
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

support for Xilinx PCIe BUS IP core

2012-10-09 Thread Bashar Romanous
Dear All,

This is the first thread in the list, I'm working on research project that
requires me to have PCI Express Bus Support for Xilinx FPGA board
ML605 running PetaLinux (kernel 2.6.37.6) on MicroBlaze. I'm using Xilinx
soft IP core PLB2PCIe bridge configured as Root Complex. the problem is
that on the Linux Kernel side, in the Bus Options, there is no support
for Xilinx PCIe Bus.

Has anybody written Linux Driver for this IP core? what about Xilinx' (*AXI
RC*/*EP* Bridge for *PCI Express)? any drivers for this?*

Best Regards,
Bashar
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: gianfar driver crash on P1020

2012-10-09 Thread Avi Tsarfati
Hi, 

 

I have the same problem as you do. 

Have you found the CPU stuck reason (or fix) in P1020RDB board ?

 

Thanks,

Avi Tsarfati.

 



This footnote confirms that this email message has been scanned by
PineApp Mail-SeCure for the presence of malicious code, vandals  computer 
viruses(187).



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

答复: [RFC PATCH] powerpc/fsl: add timer wakeup source

2012-10-09 Thread Wang Dongsheng-B40534

I'm pretty sure /proc/ is NOT where we want this exposed.
  
   Should probably go under the sysfs directory of the mpic device.  Or
   better, make a generic interface for timer-based suspend wakeup (if
  there
   isn't one already).  This current approach sits in an unpleasant
 middle
   ground between generic and device-specific.
  
  /sys/power/wakeup_timer_seconds how about this?
  I think it is a freescale generic interface, this interface control by
  FSL_SOC  SUSPEND.

 There's no such thing as a Freescale generic interface.  Linux APIs
 are not organized by hardware vendor.  Either make a truly generic
 interface, reuse an existing one, or do something that is attached to
 the specific driver.
Thanks, I think i can change mpic timer registration, i will use 
platform_driver_register.
I will merge mpic timer and timer wakeup. In mpic timer the wakeup 
function
controls by SUSPEND. The sys path is 
/sys/devices/soc8572.4/ffe41100.timer/wakeup_seconds.
do you have any suggestions for this? or have a better idea about the sys path?

   Use depends rather than if/else.  Why do you need FSL_WAKEUP_SOURCE?
  
  It lists all wake up source. If later have wakeup source can be
  improved by
  it to control. Buttons event wakeup source will be added after the
  timer.

 It does not list all wake up sources -- there's also ethernet, USB, etc.
fine, change to depends. thanks.

  
   If the new time is zero, consider that a cancellation of the timer
  and
   don't request a new one or return -EINVAL.
  
  Thanks, I think i should add comments. Let this patch easy to read.
  Here is get a new timer.
  If the new time is zero, consider that has been checked.
 
  if (!time.tv_sec) {...} this is check zero.
  The mpic_request_timer before this code.

 Ah, I see.  Wouldn't it be simpler to remove that block and just test
 time.tv_sec when requesting the new timer?
Yes, wake up function only need seconds level, and it's just hold a timer.
echo zero to cancel, and echo a new time to update the timer time.
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 01/20] powerpc/udbg: Remove unused udbg_read()

2012-10-09 Thread Michael Ellerman
The last user of udbg_read() was removed in 2005, in commit fca5dcd
Simplify and clean up the xmon terminal I/O.

Given we haven't needed it for 7 years we can probably drop it.

Signed-off-by: Michael Ellerman mich...@ellerman.id.au
---
 arch/powerpc/include/asm/udbg.h |1 -
 arch/powerpc/kernel/udbg.c  |   23 ---
 2 files changed, 24 deletions(-)

diff --git a/arch/powerpc/include/asm/udbg.h b/arch/powerpc/include/asm/udbg.h
index b303881..5a7510e 100644
--- a/arch/powerpc/include/asm/udbg.h
+++ b/arch/powerpc/include/asm/udbg.h
@@ -21,7 +21,6 @@ extern int (*udbg_getc_poll)(void);
 
 extern void udbg_puts(const char *s);
 extern int udbg_write(const char *s, int n);
-extern int udbg_read(char *buf, int buflen);
 
 extern void register_early_udbg_console(void);
 extern void udbg_printf(const char *fmt, ...)
diff --git a/arch/powerpc/kernel/udbg.c b/arch/powerpc/kernel/udbg.c
index c39c1ca..f974849 100644
--- a/arch/powerpc/kernel/udbg.c
+++ b/arch/powerpc/kernel/udbg.c
@@ -122,29 +122,6 @@ int udbg_write(const char *s, int n)
return n - remain;
 }
 
-int udbg_read(char *buf, int buflen)
-{
-   char *p = buf;
-   int i, c;
-
-   if (!udbg_getc)
-   return 0;
-
-   for (i = 0; i  buflen; ++i) {
-   do {
-   c = udbg_getc();
-   if (c == -1  i == 0)
-   return -1;
-
-   } while (c == 0x11 || c == 0x13);
-   if (c == 0 || c == -1)
-   break;
-   *p++ = c;
-   }
-
-   return i;
-}
-
 #define UDBG_BUFSIZE 256
 void udbg_printf(const char *fmt, ...)
 {
-- 
1.7.9.5

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


[PATCH 02/20] powerpc/xmon: Remove unused xmon_expect() xmon_read_poll()

2012-10-09 Thread Michael Ellerman
It looks like xmon_expect() was used for doing xmon over a modem (!?),
that code was dropped in 2005 in commit 51d3082 Unify udbg (#2).

Once xmon_expect() is gone xmon_read_poll() is unused, drop it too.

Signed-off-by: Michael Ellerman mich...@ellerman.id.au
---
 arch/powerpc/xmon/nonstdio.c |   27 ---
 arch/powerpc/xmon/nonstdio.h |2 --
 arch/powerpc/xmon/start.c|7 ---
 3 files changed, 36 deletions(-)

diff --git a/arch/powerpc/xmon/nonstdio.c b/arch/powerpc/xmon/nonstdio.c
index bfac84f..a225d80 100644
--- a/arch/powerpc/xmon/nonstdio.c
+++ b/arch/powerpc/xmon/nonstdio.c
@@ -23,33 +23,6 @@ static char line[256];
 static char *lineptr;
 static int lineleft;
 
-int xmon_expect(const char *str, unsigned long timeout)
-{
-   int c;
-   unsigned long t0;
-
-   /* assume 25MHz default timebase if tb_ticks_per_sec not set yet */
-   timeout *= tb_ticks_per_sec? tb_ticks_per_sec: 2500;
-   t0 = get_tbl();
-   do {
-   lineptr = line;
-   for (;;) {
-   c = xmon_read_poll();
-   if (c == -1) {
-   if (get_tbl() - t0  timeout)
-   return 0;
-   continue;
-   }
-   if (c == '\n')
-   break;
-   if (c != '\r'  lineptr  line[sizeof(line) - 1])
-   *lineptr++ = c;
-   }
-   *lineptr = 0;
-   } while (strstr(line, str) == NULL);
-   return 1;
-}
-
 int xmon_getchar(void)
 {
int c;
diff --git a/arch/powerpc/xmon/nonstdio.h b/arch/powerpc/xmon/nonstdio.h
index 23dd95f..d8cec38 100644
--- a/arch/powerpc/xmon/nonstdio.h
+++ b/arch/powerpc/xmon/nonstdio.h
@@ -9,7 +9,5 @@ extern void xmon_puts(const char *);
 extern char *xmon_gets(char *, int);
 extern void xmon_printf(const char *, ...);
 extern void xmon_map_scc(void);
-extern int xmon_expect(const char *str, unsigned long timeout);
 extern int xmon_write(const void *ptr, int nb);
 extern int xmon_readchar(void);
-extern int xmon_read_poll(void);
diff --git a/arch/powerpc/xmon/start.c b/arch/powerpc/xmon/start.c
index 8864de2..84f3a15 100644
--- a/arch/powerpc/xmon/start.c
+++ b/arch/powerpc/xmon/start.c
@@ -25,10 +25,3 @@ int xmon_readchar(void)
return udbg_getc();
return -1;
 }
-
-int xmon_read_poll(void)
-{
-   if (udbg_getc_poll)
-   return udbg_getc_poll();
-   return -1;
-}
-- 
1.7.9.5

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


[PATCH 03/20] powerpc/xmon: Remove empty xmon_map_scc()

2012-10-09 Thread Michael Ellerman
This has been empty since 2005, commit 51d3082 Unify udbg (#2).

Signed-off-by: Michael Ellerman mich...@ellerman.id.au
---
 arch/powerpc/xmon/nonstdio.h |1 -
 arch/powerpc/xmon/start.c|4 
 arch/powerpc/xmon/xmon.c |1 -
 3 files changed, 6 deletions(-)

diff --git a/arch/powerpc/xmon/nonstdio.h b/arch/powerpc/xmon/nonstdio.h
index d8cec38..8799ccf 100644
--- a/arch/powerpc/xmon/nonstdio.h
+++ b/arch/powerpc/xmon/nonstdio.h
@@ -8,6 +8,5 @@ extern int xmon_getchar(void);
 extern void xmon_puts(const char *);
 extern char *xmon_gets(char *, int);
 extern void xmon_printf(const char *, ...);
-extern void xmon_map_scc(void);
 extern int xmon_write(const void *ptr, int nb);
 extern int xmon_readchar(void);
diff --git a/arch/powerpc/xmon/start.c b/arch/powerpc/xmon/start.c
index 84f3a15..7769cb5 100644
--- a/arch/powerpc/xmon/start.c
+++ b/arch/powerpc/xmon/start.c
@@ -10,10 +10,6 @@
 #include asm/udbg.h
 #include nonstdio.h
 
-void xmon_map_scc(void)
-{
-}
-
 int xmon_write(const void *ptr, int nb)
 {
return udbg_write(ptr, nb);
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 3a56a63..67d36ab 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -2943,7 +2943,6 @@ static void xmon_init(int enable)
__debugger_dabr_match = NULL;
__debugger_fault_handler = NULL;
}
-   xmon_map_scc();
 }
 
 #ifdef CONFIG_MAGIC_SYSRQ
-- 
1.7.9.5

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


[PATCH 04/20] powerpc/xmon: Make xmon_getchar() static

2012-10-09 Thread Michael Ellerman
xmon_getchar() is only called from within nonstdio.c, so make it static.

Signed-off-by: Michael Ellerman mich...@ellerman.id.au
---
 arch/powerpc/xmon/nonstdio.c |2 +-
 arch/powerpc/xmon/nonstdio.h |1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/powerpc/xmon/nonstdio.c b/arch/powerpc/xmon/nonstdio.c
index a225d80..2209485 100644
--- a/arch/powerpc/xmon/nonstdio.c
+++ b/arch/powerpc/xmon/nonstdio.c
@@ -23,7 +23,7 @@ static char line[256];
 static char *lineptr;
 static int lineleft;
 
-int xmon_getchar(void)
+static int xmon_getchar(void)
 {
int c;
 
diff --git a/arch/powerpc/xmon/nonstdio.h b/arch/powerpc/xmon/nonstdio.h
index 8799ccf..321284f 100644
--- a/arch/powerpc/xmon/nonstdio.h
+++ b/arch/powerpc/xmon/nonstdio.h
@@ -4,7 +4,6 @@
 #define putcharxmon_putchar
 
 extern int xmon_putchar(int c);
-extern int xmon_getchar(void);
 extern void xmon_puts(const char *);
 extern char *xmon_gets(char *, int);
 extern void xmon_printf(const char *, ...);
-- 
1.7.9.5

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


[PATCH 05/20] powerpc/xmon: Merge start.c into nonstdio.c

2012-10-09 Thread Michael Ellerman
The routines in start.c are only ever called from nonstdio.c, so if we
move them in there they can become static which is nice.

I suspect the idea behind the separation was that start.c could be
replaced in order to build xmon in userland. If anyone still cares about
doing that we could handle that with an ifdef or two.

Signed-off-by: Michael Ellerman mich...@ellerman.id.au
---
 arch/powerpc/xmon/Makefile   |2 +-
 arch/powerpc/xmon/nonstdio.c |   14 ++
 arch/powerpc/xmon/nonstdio.h |2 --
 arch/powerpc/xmon/start.c|   23 ---
 4 files changed, 15 insertions(+), 26 deletions(-)
 delete mode 100644 arch/powerpc/xmon/start.c

diff --git a/arch/powerpc/xmon/Makefile b/arch/powerpc/xmon/Makefile
index c168c54..b49fdbd 100644
--- a/arch/powerpc/xmon/Makefile
+++ b/arch/powerpc/xmon/Makefile
@@ -6,7 +6,7 @@ GCOV_PROFILE := n
 
 ccflags-$(CONFIG_PPC64) := -mno-minimal-toc
 
-obj-y  += xmon.o start.o nonstdio.o
+obj-y  += xmon.o nonstdio.o
 
 ifdef CONFIG_XMON_DISASSEMBLY
 obj-y  += ppc-dis.o ppc-opc.o
diff --git a/arch/powerpc/xmon/nonstdio.c b/arch/powerpc/xmon/nonstdio.c
index 2209485..942d0f6 100644
--- a/arch/powerpc/xmon/nonstdio.c
+++ b/arch/powerpc/xmon/nonstdio.c
@@ -7,9 +7,23 @@
  *  2 of the License, or (at your option) any later version.
  */
 #include linux/string.h
+#include asm/udbg.h
 #include asm/time.h
 #include nonstdio.h
 
+
+static int xmon_write(const void *ptr, int nb)
+{
+   return udbg_write(ptr, nb);
+}
+
+static int xmon_readchar(void)
+{
+   if (udbg_getc)
+   return udbg_getc();
+   return -1;
+}
+
 int xmon_putchar(int c)
 {
char ch = c;
diff --git a/arch/powerpc/xmon/nonstdio.h b/arch/powerpc/xmon/nonstdio.h
index 321284f..18a51de 100644
--- a/arch/powerpc/xmon/nonstdio.h
+++ b/arch/powerpc/xmon/nonstdio.h
@@ -7,5 +7,3 @@ extern int xmon_putchar(int c);
 extern void xmon_puts(const char *);
 extern char *xmon_gets(char *, int);
 extern void xmon_printf(const char *, ...);
-extern int xmon_write(const void *ptr, int nb);
-extern int xmon_readchar(void);
diff --git a/arch/powerpc/xmon/start.c b/arch/powerpc/xmon/start.c
deleted file mode 100644
index 7769cb5..000
--- a/arch/powerpc/xmon/start.c
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * Copyright (C) 1996 Paul Mackerras.
- *
- *  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 asm/machdep.h
-#include asm/udbg.h
-#include nonstdio.h
-
-int xmon_write(const void *ptr, int nb)
-{
-   return udbg_write(ptr, nb);
-}
-
-int xmon_readchar(void)
-{
-   if (udbg_getc)
-   return udbg_getc();
-   return -1;
-}
-- 
1.7.9.5

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


[PATCH 06/20] powerpc/xmon: Remove renaming #defines of scanhex() and skipbl()

2012-10-09 Thread Michael Ellerman
We have two #defines that rename scanhex() and skipbl() to
xmon_scanhex() and xmon_skipbl() - but no one ever uses those
names.

So the only effect is to rename the actual symbols in the generated
code, and AFACIS there is no reason to do that, so drop them.

Signed-off-by: Michael Ellerman mich...@ellerman.id.au
---
 arch/powerpc/xmon/xmon.c |3 ---
 1 file changed, 3 deletions(-)

diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 67d36ab..cc96a71 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -52,9 +52,6 @@
 #include nonstdio.h
 #include dis-asm.h
 
-#define scanhexxmon_scanhex
-#define skipbl xmon_skipbl
-
 #ifdef CONFIG_SMP
 static cpumask_t cpus_in_xmon = CPU_MASK_NONE;
 static unsigned long xmon_taken = 1;
-- 
1.7.9.5

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


[PATCH 07/20] powerpc/xmon: Remove unused #defines

2012-10-09 Thread Michael Ellerman
Neither REGS_PER_LINE or LAST_VOLATILE are used, nor have they ever
been as far back as I can see.

Signed-off-by: Michael Ellerman mich...@ellerman.id.au
---
 arch/powerpc/xmon/xmon.c |4 
 1 file changed, 4 deletions(-)

diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index cc96a71..abf6be4 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -166,12 +166,8 @@ extern void xmon_leave(void);
 
 #ifdef CONFIG_PPC64
 #define REG%.16lx
-#define REGS_PER_LINE  4
-#define LAST_VOLATILE  13
 #else
 #define REG%.8lx
-#define REGS_PER_LINE  8
-#define LAST_VOLATILE  12
 #endif
 
 #define GETWORD(v) (((v)[0]  24) + ((v)[1]  16) + ((v)[2]  8) + 
(v)[3])
-- 
1.7.9.5

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


[PATCH 08/20] powerpc/xmon: Use STACK_FRAME_OVERHEAD in xmon_show_stack()

2012-10-09 Thread Michael Ellerman
We use STACK_FRAME_OVERHEAD in the exception vectors to establish
the exception frame, so it should be good enough to use here.

Signed-off-by: Michael Ellerman mich...@ellerman.id.au
---
 arch/powerpc/xmon/xmon.c |   10 ++
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index abf6be4..d940234 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -1286,12 +1286,6 @@ static int xmon_depth_to_print = 64;
 #define LRSAVE_OFFSET  (STACK_FRAME_LR_SAVE * sizeof(unsigned long))
 #define MARKER_OFFSET  (STACK_FRAME_MARKER * sizeof(unsigned long))
 
-#ifdef __powerpc64__
-#define REGS_OFFSET0x70
-#else
-#define REGS_OFFSET16
-#endif
-
 static void xmon_show_stack(unsigned long sp, unsigned long lr,
unsigned long pc)
 {
@@ -1355,10 +1349,10 @@ static void xmon_show_stack(unsigned long sp, unsigned 
long lr,
   an exception frame. */
if (mread(sp + MARKER_OFFSET, marker, sizeof(unsigned long))
 marker == STACK_FRAME_REGS_MARKER) {
-   if (mread(sp + REGS_OFFSET, regs, sizeof(regs))
+   if (mread(sp + STACK_FRAME_OVERHEAD, regs, 
sizeof(regs))
!= sizeof(regs)) {
printf(Couldn't read registers at %lx\n,
-  sp + REGS_OFFSET);
+  sp + STACK_FRAME_OVERHEAD);
break;
}
printf(--- Exception: %lx %s at , regs.trap,
-- 
1.7.9.5

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


[PATCH 10/20] powerpc/xmon: Factor out the oft-repeated setjmp logic

2012-10-09 Thread Michael Ellerman
We have over 15 routines that implement essentially the same logic
in terms of catching faults. Pull the logic out into two helper
routines.

The pattern becomes:

if (start_bus_error_jump() == 0) {
do potentially faulting things

end_bus_error_jump();
} else {
printf(Faulting thing faulted!\n);
}

Also move the globals next to the functions.

Signed-off-by: Michael Ellerman mich...@ellerman.id.au
---
 arch/powerpc/xmon/xmon.c |   33 +++--
 1 file changed, 31 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 1f8d2f1..168c5e7 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -72,8 +72,6 @@ static unsigned long ncsum = 4096;
 static int termch;
 static char tmpstr[128];
 
-static long bus_error_jmp[JMP_BUF_LEN];
-static int catch_memory_errors;
 static long *xmon_fault_jmp[NR_CPUS];
 
 /* Breakpoint stuff */
@@ -636,6 +634,37 @@ static int xmon_ipi(struct pt_regs *regs)
return 0;
 }
 
+static long bus_error_jmp[JMP_BUF_LEN];
+static int catch_memory_errors;
+
+int start_bus_error_jump(void)
+{
+   int rc;
+
+   catch_memory_errors = 1;
+   sync();
+
+   rc = setjmp(bus_error_jmp);
+   if (rc)
+   catch_memory_errors = 0;
+
+   return rc;
+}
+
+void end_bus_error_jump(void)
+{
+   sync();
+
+   /* Wait a little while to see if we get a machine check */
+   __delay(200);
+
+   /*
+* We don't actually clear the jump buffer but setting
+* catch_memory_errors to zero means we'll no longer jump to it.
+*/
+   catch_memory_errors = 0;
+}
+
 static int xmon_fault_handler(struct pt_regs *regs)
 {
struct bpt *bp;
-- 
1.7.9.5

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


[PATCH 11/20] powerpc/xmon: Move handle_fault() next to related routines

2012-10-09 Thread Michael Ellerman
Signed-off-by: Michael Ellerman mich...@ellerman.id.au
---
 arch/powerpc/xmon/xmon.c |   48 +++---
 1 file changed, 24 insertions(+), 24 deletions(-)

diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 168c5e7..65c3d22 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -665,6 +665,30 @@ void end_bus_error_jump(void)
catch_memory_errors = 0;
 }
 
+static int fault_type;
+static int fault_except;
+static char *fault_chars[] = { --, **, ## };
+
+static int handle_fault(struct pt_regs *regs)
+{
+   fault_except = TRAP(regs);
+   switch (TRAP(regs)) {
+   case 0x200:
+   fault_type = 0;
+   break;
+   case 0x300:
+   case 0x380:
+   fault_type = 1;
+   break;
+   default:
+   fault_type = 2;
+   }
+
+   longjmp(bus_error_jmp, 1);
+
+   return 0;
+}
+
 static int xmon_fault_handler(struct pt_regs *regs)
 {
struct bpt *bp;
@@ -1755,30 +1779,6 @@ mwrite(unsigned long adrs, void *buf, int size)
return n;
 }
 
-static int fault_type;
-static int fault_except;
-static char *fault_chars[] = { --, **, ## };
-
-static int handle_fault(struct pt_regs *regs)
-{
-   fault_except = TRAP(regs);
-   switch (TRAP(regs)) {
-   case 0x200:
-   fault_type = 0;
-   break;
-   case 0x300:
-   case 0x380:
-   fault_type = 1;
-   break;
-   default:
-   fault_type = 2;
-   }
-
-   longjmp(bus_error_jmp, 1);
-
-   return 0;
-}
-
 #define SWAP(a, b, t)  ((t) = (a), (a) = (b), (b) = (t))
 
 static void
-- 
1.7.9.5

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


[PATCH 12/20] powerpc/xmon: Do so simple conversions to start/end_bus_error_jump()

2012-10-09 Thread Michael Ellerman
Signed-off-by: Michael Ellerman mich...@ellerman.id.au
---
 arch/powerpc/xmon/xmon.c |   79 +++---
 1 file changed, 18 insertions(+), 61 deletions(-)

diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 65c3d22..45be9ce 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -1503,19 +1503,14 @@ static void prregs(struct pt_regs *fp)
struct pt_regs regs;
 
if (scanhex(base)) {
-   if (setjmp(bus_error_jmp) == 0) {
-   catch_memory_errors = 1;
-   sync();
+   if (start_bus_error_jump() == 0) {
regs = *(struct pt_regs *)base;
-   sync();
-   __delay(200);
+   end_bus_error_jump();
} else {
-   catch_memory_errors = 0;
printf(*** Error reading registers from REG\n,
   base);
return;
}
-   catch_memory_errors = 0;
fp = regs;
}
 
@@ -1569,10 +1564,7 @@ static void cacheflush(void)
nflush = 1;
scanhex(nflush);
nflush = (nflush + L1_CACHE_BYTES - 1) / L1_CACHE_BYTES;
-   if (setjmp(bus_error_jmp) == 0) {
-   catch_memory_errors = 1;
-   sync();
-
+   if (start_bus_error_jump() == 0) {
if (cmd != 'i') {
for (; nflush  0; --nflush, adrs += L1_CACHE_BYTES)
cflush((void *) adrs);
@@ -1580,11 +1572,9 @@ static void cacheflush(void)
for (; nflush  0; --nflush, adrs += L1_CACHE_BYTES)
cinval((void *) adrs);
}
-   sync();
-   /* wait a little while to see if we get a machine check */
-   __delay(200);
+
+   end_bus_error_jump();
}
-   catch_memory_errors = 0;
 }
 
 static unsigned long
@@ -1710,9 +1700,7 @@ mread(unsigned long adrs, void *buf, int size)
char *p, *q;
 
n = 0;
-   if (setjmp(bus_error_jmp) == 0) {
-   catch_memory_errors = 1;
-   sync();
+   if (start_bus_error_jump() == 0) {
p = (char *)adrs;
q = (char *)buf;
switch (size) {
@@ -1731,12 +1719,9 @@ mread(unsigned long adrs, void *buf, int size)
sync();
}
}
-   sync();
-   /* wait a little while to see if we get a machine check */
-   __delay(200);
+   end_bus_error_jump();
n = size;
}
-   catch_memory_errors = 0;
return n;
 }
 
@@ -1747,9 +1732,7 @@ mwrite(unsigned long adrs, void *buf, int size)
char *p, *q;
 
n = 0;
-   if (setjmp(bus_error_jmp) == 0) {
-   catch_memory_errors = 1;
-   sync();
+   if (start_bus_error_jump() == 0) {
p = (char *) adrs;
q = (char *) buf;
switch (size) {
@@ -1768,14 +1751,11 @@ mwrite(unsigned long adrs, void *buf, int size)
sync();
}
}
-   sync();
-   /* wait a little while to see if we get a machine check */
-   __delay(200);
+   end_bus_error_jump();
n = size;
} else {
printf(*** Error writing address %x\n, adrs + n);
}
-   catch_memory_errors = 0;
return n;
 }
 
@@ -2272,24 +2252,18 @@ dump_log_buf(void)
unsigned char buf[128];
size_t len;
 
-   if (setjmp(bus_error_jmp) != 0) {
+   if (start_bus_error_jump() != 0) {
printf(Error dumping printk buffer!\n);
return;
}
 
-   catch_memory_errors = 1;
-   sync();
-
kmsg_dump_rewind_nolock(dumper);
while (kmsg_dump_get_line_nolock(dumper, false, buf, sizeof(buf), 
len)) {
buf[len] = '\0';
printf(%s, buf);
}
 
-   sync();
-   /* wait a little while to see if we get a machine check */
-   __delay(200);
-   catch_memory_errors = 0;
+   end_bus_error_jump();
 }
 
 /*
@@ -2672,18 +2646,12 @@ static void xmon_print_symbol(unsigned long address, 
const char *mid,
unsigned long offset, size;
 
printf(REG, address);
-   if (setjmp(bus_error_jmp) == 0) {
-   catch_memory_errors = 1;
-   sync();
+   if (start_bus_error_jump() == 0) {
name = kallsyms_lookup(address, size, offset, modname,
   tmpstr);
-   sync();
-   /* wait a little while to see if we get a machine check */
-   __delay(200);
+   end_bus_error_jump();
}
 

[PATCH 13/20] powerpc/xmon: Use start/end_bus_error_jump() in more routines

2012-10-09 Thread Michael Ellerman
These are not entirely equivalent to the old code. In most cases they
just gain a call to __delay() via end_bus_error_jump().

In symbol_lookup() we also move the printf() outside the protected area,
this should be safe as we are not derefencing the value we lookup, just
printing its value.

Signed-off-by: Michael Ellerman mich...@ellerman.id.au
---
 arch/powerpc/xmon/xmon.c |   39 +--
 1 file changed, 13 insertions(+), 26 deletions(-)

diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 45be9ce..ddae5cf 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -1321,17 +1321,16 @@ static void get_function_bounds(unsigned long pc, 
unsigned long *startp,
*startp = *endp = 0;
if (pc == 0)
return;
-   if (setjmp(bus_error_jmp) == 0) {
-   catch_memory_errors = 1;
-   sync();
+
+   if (start_bus_error_jump() == 0) {
name = kallsyms_lookup(pc, size, offset, NULL, tmpstr);
if (name != NULL) {
*startp = pc - offset;
*endp = pc - offset + size;
}
-   sync();
+
+   end_bus_error_jump();
}
-   catch_memory_errors = 0;
 }
 
 #define LRSAVE_OFFSET  (STACK_FRAME_LR_SAVE * sizeof(unsigned long))
@@ -2016,14 +2015,11 @@ static void dump_one_paca(int cpu)
 {
struct paca_struct *p;
 
-   if (setjmp(bus_error_jmp) != 0) {
+   if (start_bus_error_jump() != 0) {
printf(*** Error dumping paca for cpu 0x%x!\n, cpu);
return;
}
 
-   catch_memory_errors = 1;
-   sync();
-
p = paca[cpu];
 
printf(paca for cpu 0x%x @ %p:\n, cpu, p);
@@ -2063,8 +2059,7 @@ static void dump_one_paca(int cpu)
 
 #undef DUMP
 
-   catch_memory_errors = 0;
-   sync();
+   end_bus_error_jump();
 }
 
 static void dump_all_pacas(void)
@@ -2402,17 +2397,14 @@ static void proccall(void)
}
func = (callfunc_t) adrs;
ret = 0;
-   if (setjmp(bus_error_jmp) == 0) {
-   catch_memory_errors = 1;
-   sync();
+   if (start_bus_error_jump() == 0) {
ret = func(args[0], args[1], args[2], args[3],
   args[4], args[5], args[6], args[7]);
-   sync();
+   end_bus_error_jump();
printf(return value is %x\n, ret);
} else {
printf(*** %x exception occurred\n, fault_except);
}
-   catch_memory_errors = 0;
 }
 
 /* Input scanning routines */
@@ -2507,13 +2499,10 @@ scanhex(unsigned long *vp)
}
tmpstr[i++] = 0;
*vp = 0;
-   if (setjmp(bus_error_jmp) == 0) {
-   catch_memory_errors = 1;
-   sync();
+   if (start_bus_error_jump() == 0) {
*vp = kallsyms_lookup_name(tmpstr);
-   sync();
+   end_bus_error_jump();
}
-   catch_memory_errors = 0;
if (!(*vp)) {
printf(unknown symbol '%s'\n, tmpstr);
return 0;
@@ -2620,17 +2609,15 @@ symbol_lookup(void)
break;
case 's':
getstring(tmp, 64);
-   if (setjmp(bus_error_jmp) == 0) {
-   catch_memory_errors = 1;
-   sync();
+   if (start_bus_error_jump() == 0) {
addr = kallsyms_lookup_name(tmp);
+   end_bus_error_jump();
+
if (addr)
printf(%s: %lx\n, tmp, addr);
else
printf(Symbol '%s' not found.\n, tmp);
-   sync();
}
-   catch_memory_errors = 0;
termch = 0;
break;
}
-- 
1.7.9.5

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


[PATCH 14/20] powerpc/xmon: Convert read/write_spr() to use start_bus_error_jump()

2012-10-09 Thread Michael Ellerman
read_spr() and write_spr() were both forgetting to clear catch_memory_errors,
that's fixed now that they use start/end_bus_error_jump().

Also drop the setting of n in both routines, it's never used.

Signed-off-by: Michael Ellerman mich...@ellerman.id.au
---
 arch/powerpc/xmon/xmon.c |   22 --
 1 file changed, 4 insertions(+), 18 deletions(-)

diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index ddae5cf..a8188f0 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -1599,16 +1599,9 @@ read_spr(int n)
store_inst(instrs);
store_inst(instrs+1);
 
-   if (setjmp(bus_error_jmp) == 0) {
-   catch_memory_errors = 1;
-   sync();
-
+   if (start_bus_error_jump() == 0) {
ret = code();
-
-   sync();
-   /* wait a little while to see if we get a machine check */
-   __delay(200);
-   n = size;
+   end_bus_error_jump();
}
 
return ret;
@@ -1635,16 +1628,9 @@ write_spr(int n, unsigned long val)
store_inst(instrs);
store_inst(instrs+1);
 
-   if (setjmp(bus_error_jmp) == 0) {
-   catch_memory_errors = 1;
-   sync();
-
+   if (start_bus_error_jump() == 0) {
code(val);
-
-   sync();
-   /* wait a little while to see if we get a machine check */
-   __delay(200);
-   n = size;
+   end_bus_error_jump();
}
 }
 
-- 
1.7.9.5

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


[PATCH 15/20] powerpc/xmon: Deindent stop/restart_spus()

2012-10-09 Thread Michael Ellerman
Should be no logic change, use continue to avoid an indent.

Signed-off-by: Michael Ellerman mich...@ellerman.id.au
---
 arch/powerpc/xmon/xmon.c |   72 --
 1 file changed, 38 insertions(+), 34 deletions(-)

diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index a8188f0..0fefe03 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -2994,33 +2994,35 @@ static void stop_spus(void)
if (!spu_info[i].spu)
continue;
 
-   if (setjmp(bus_error_jmp) == 0) {
-   catch_memory_errors = 1;
-   sync();
+   if (setjmp(bus_error_jmp) != 0) {
+   catch_memory_errors = 0;
+   printf(*** Error stopping spu %.2d\n, i);
+   continue;
+   }
 
-   spu = spu_info[i].spu;
+   catch_memory_errors = 1;
+   sync();
 
-   spu_info[i].saved_spu_runcntl_RW =
-   in_be32(spu-problem-spu_runcntl_RW);
+   spu = spu_info[i].spu;
 
-   tmp = spu_mfc_sr1_get(spu);
-   spu_info[i].saved_mfc_sr1_RW = tmp;
+   spu_info[i].saved_spu_runcntl_RW =
+   in_be32(spu-problem-spu_runcntl_RW);
 
-   tmp = ~MFC_STATE1_MASTER_RUN_CONTROL_MASK;
-   spu_mfc_sr1_set(spu, tmp);
+   tmp = spu_mfc_sr1_get(spu);
+   spu_info[i].saved_mfc_sr1_RW = tmp;
 
-   sync();
-   __delay(200);
+   tmp = ~MFC_STATE1_MASTER_RUN_CONTROL_MASK;
+   spu_mfc_sr1_set(spu, tmp);
 
-   spu_info[i].stopped_ok = 1;
+   sync();
+   __delay(200);
+
+   spu_info[i].stopped_ok = 1;
+
+   printf(Stopped spu %.2d (was %s)\n, i,
+   spu_info[i].saved_spu_runcntl_RW ?
+   running : stopped);
 
-   printf(Stopped spu %.2d (was %s)\n, i,
-   spu_info[i].saved_spu_runcntl_RW ?
-   running : stopped);
-   } else {
-   catch_memory_errors = 0;
-   printf(*** Error stopping spu %.2d\n, i);
-   }
catch_memory_errors = 0;
}
 }
@@ -3040,23 +3042,25 @@ static void restart_spus(void)
continue;
}
 
-   if (setjmp(bus_error_jmp) == 0) {
-   catch_memory_errors = 1;
-   sync();
-
-   spu = spu_info[i].spu;
-   spu_mfc_sr1_set(spu, spu_info[i].saved_mfc_sr1_RW);
-   out_be32(spu-problem-spu_runcntl_RW,
-   spu_info[i].saved_spu_runcntl_RW);
-
-   sync();
-   __delay(200);
-
-   printf(Restarted spu %.2d\n, i);
-   } else {
+   if (setjmp(bus_error_jmp) != 0) {
catch_memory_errors = 0;
printf(*** Error restarting spu %.2d\n, i);
+   continue;
}
+
+   catch_memory_errors = 1;
+   sync();
+
+   spu = spu_info[i].spu;
+   spu_mfc_sr1_set(spu, spu_info[i].saved_mfc_sr1_RW);
+   out_be32(spu-problem-spu_runcntl_RW,
+   spu_info[i].saved_spu_runcntl_RW);
+
+   sync();
+   __delay(200);
+
+   printf(Restarted spu %.2d\n, i);
+
catch_memory_errors = 0;
}
 }
-- 
1.7.9.5

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


[PATCH 16/20] powerpc/xmon: Use start_bus_error_jump() in spu routines

2012-10-09 Thread Michael Ellerman
Moves the printfs  setting of stopped_ok out of the protected area.

Signed-off-by: Michael Ellerman mich...@ellerman.id.au
---
 arch/powerpc/xmon/xmon.c |   22 --
 1 file changed, 4 insertions(+), 18 deletions(-)

diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 0fefe03..abc89a4 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -2994,15 +2994,11 @@ static void stop_spus(void)
if (!spu_info[i].spu)
continue;
 
-   if (setjmp(bus_error_jmp) != 0) {
-   catch_memory_errors = 0;
+   if (start_bus_error_jump() != 0) {
printf(*** Error stopping spu %.2d\n, i);
continue;
}
 
-   catch_memory_errors = 1;
-   sync();
-
spu = spu_info[i].spu;
 
spu_info[i].saved_spu_runcntl_RW =
@@ -3014,16 +3010,13 @@ static void stop_spus(void)
tmp = ~MFC_STATE1_MASTER_RUN_CONTROL_MASK;
spu_mfc_sr1_set(spu, tmp);
 
-   sync();
-   __delay(200);
+   end_bus_error_jump();
 
spu_info[i].stopped_ok = 1;
 
printf(Stopped spu %.2d (was %s)\n, i,
spu_info[i].saved_spu_runcntl_RW ?
running : stopped);
-
-   catch_memory_errors = 0;
}
 }
 
@@ -3042,26 +3035,19 @@ static void restart_spus(void)
continue;
}
 
-   if (setjmp(bus_error_jmp) != 0) {
-   catch_memory_errors = 0;
+   if (start_bus_error_jump() != 0) {
printf(*** Error restarting spu %.2d\n, i);
continue;
}
 
-   catch_memory_errors = 1;
-   sync();
-
spu = spu_info[i].spu;
spu_mfc_sr1_set(spu, spu_info[i].saved_mfc_sr1_RW);
out_be32(spu-problem-spu_runcntl_RW,
spu_info[i].saved_spu_runcntl_RW);
 
-   sync();
-   __delay(200);
+   end_bus_error_jump();
 
printf(Restarted spu %.2d\n, i);
-
-   catch_memory_errors = 0;
}
 }
 
-- 
1.7.9.5

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


[PATCH 17/20] powerpc/xmon: Make less variables global

2012-10-09 Thread Michael Ellerman
Move a number of variables into their only user, reducing some of the
global variable clutter. They remain static, so their behaviour across
calls is unchanged.

Also use ARRAY_SIZE for regnames in scanhex().

Signed-off-by: Michael Ellerman mich...@ellerman.id.au
---
 arch/powerpc/xmon/xmon.c |   46 +-
 1 file changed, 21 insertions(+), 25 deletions(-)

diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index abc89a4..c6cd027 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -64,11 +64,7 @@ static int xmon_gate;
 static unsigned long in_xmon __read_mostly = 0;
 
 static unsigned long adrs;
-static int size = 1;
 #define MAX_DUMP (128 * 1024)
-static unsigned long ndump = 64;
-static unsigned long nidump = 16;
-static unsigned long ncsum = 4096;
 static int termch;
 static char tmpstr[128];
 
@@ -1109,6 +1105,7 @@ static unsigned short fcstab[256] = {
 static void
 csum(void)
 {
+   static unsigned long ncsum = 4096;
unsigned int i;
unsigned short fcs;
unsigned char v;
@@ -1634,12 +1631,12 @@ write_spr(int n, unsigned long val)
}
 }
 
-static unsigned long regno;
 extern char exc_prolog;
 extern char dec_exc;
 
 static void super_regs(void)
 {
+   static unsigned long regno;
int cmd;
unsigned long val;
 
@@ -1768,9 +1765,6 @@ byterev(unsigned char *val, int size)
}
 }
 
-static int brev;
-static int mnoread;
-
 static char *memex_help_string =
 Memory examine command usage:\n
 m [addr] [flags] examine/change memory\n
@@ -1811,6 +1805,7 @@ static char *memex_subcmd_help_string =
 static void
 memex(void)
 {
+   static int mnoread, brev, size = 1;
int cmd, inc, i, nslash;
unsigned long n;
unsigned char val[16];
@@ -2087,6 +2082,8 @@ static void dump_pacas(void)
 static void
 dump(void)
 {
+   static unsigned long ndump = 64;
+   static unsigned long nidump = 16;
int c;
 
c = inchar();
@@ -2253,12 +2250,13 @@ dump_log_buf(void)
 static unsigned long mdest;/* destination address */
 static unsigned long msrc; /* source address */
 static unsigned long mval; /* byte value to set memory to */
-static unsigned long mcount;   /* # bytes to affect */
-static unsigned long mdiffs;   /* max # differences to print */
 
 static void
 memops(int cmd)
 {
+   static unsigned long mcount;/* # bytes to affect */
+   static unsigned long mdiffs;/* max # differences to print */
+
scanhex((void *)mdest);
if( termch != '\n' )
termch = 0;
@@ -2297,12 +2295,12 @@ memdiffs(unsigned char *p1, unsigned char *p2, unsigned 
nb, unsigned maxpr)
printf(Total of %d differences\n, prt);
 }
 
-static unsigned mend;
-static unsigned mask;
-
 static void
 memlocate(void)
 {
+   static unsigned mend;
+   static unsigned mask;
+
unsigned a, n;
unsigned char val[4];
 
@@ -2330,12 +2328,11 @@ memlocate(void)
}
 }
 
-static unsigned long mskip = 0x1000;
-static unsigned long mlim = 0x;
-
 static void
 memzcan(void)
 {
+   static unsigned long mskip = 0x1000;
+   static unsigned long mlim = 0x;
unsigned char v;
unsigned a;
int ok, ook;
@@ -2409,8 +2406,10 @@ skipbl(void)
return c;
 }
 
-#define N_PTREGS   44
-static char *regnames[N_PTREGS] = {
+int
+scanhex(unsigned long *vp)
+{
+   static char *regnames[] = {
r0, r1, r2, r3, r4, r5, r6, r7,
r8, r9, r10, r11, r12, r13, r14, r15,
r16, r17, r18, r19, r20, r21, r22, r23,
@@ -2422,11 +2421,7 @@ static char *regnames[N_PTREGS] = {
mq,
 #endif
trap, dar, dsisr, res
-};
-
-int
-scanhex(unsigned long *vp)
-{
+   };
int c, d;
unsigned long v;
 
@@ -2445,7 +2440,7 @@ scanhex(unsigned long *vp)
regname[i] = c;
}
regname[i] = 0;
-   for (i = 0; i  N_PTREGS; ++i) {
+   for (i = 0; i  ARRAY_SIZE(regnames); ++i) {
if (strcmp(regnames[i], regname) == 0) {
if (xmon_regs == NULL) {
printf(regs not available\n);
@@ -2551,7 +2546,6 @@ getstring(char *s, int size)
*s = 0;
 }
 
-static char line[256];
 static char *lineptr;
 
 static void
@@ -2563,6 +2557,8 @@ flush_input(void)
 static int
 inchar(void)
 {
+   static char line[256];
+
if (lineptr == NULL || *lineptr == 0) {
if (xmon_gets(line, sizeof(line)) == NULL) {
lineptr = NULL;
-- 
1.7.9.5

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


[PATCH 18/20] powerpc/xmon: Use kallsyms_lookup_size_offset() in get_function_bounds()

2012-10-09 Thread Michael Ellerman
We throw away the name so we should use kallsyms_lookup_size_offset(),
which does what we need and nothing more.

Signed-off-by: Michael Ellerman mich...@ellerman.id.au
---
 arch/powerpc/xmon/xmon.c |4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index c6cd027..9eb1d34 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -1313,15 +1313,13 @@ static void get_function_bounds(unsigned long pc, 
unsigned long *startp,
unsigned long *endp)
 {
unsigned long size, offset;
-   const char *name;
 
*startp = *endp = 0;
if (pc == 0)
return;
 
if (start_bus_error_jump() == 0) {
-   name = kallsyms_lookup(pc, size, offset, NULL, tmpstr);
-   if (name != NULL) {
+   if (kallsyms_lookup_size_offset(pc, size, offset)) {
*startp = pc - offset;
*endp = pc - offset + size;
}
-- 
1.7.9.5

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


[PATCH 19/20] powerpc/xmon: Remove externs for non-existant routines

2012-10-09 Thread Michael Ellerman
The implementation of both xmon_enter()  xmon_leave() was removed in
commit 51d3082 Unify udbg (#2).

I can't find any reference to exc_prolog or dec_exc since the epoch.

Signed-off-by: Michael Ellerman mich...@ellerman.id.au
---
 arch/powerpc/xmon/xmon.c |6 --
 1 file changed, 6 deletions(-)

diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 9eb1d34..ded6c56 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -155,9 +155,6 @@ static void dump_tlb_book3e(void);
 
 static int xmon_no_auto_backtrace;
 
-extern void xmon_enter(void);
-extern void xmon_leave(void);
-
 #ifdef CONFIG_PPC64
 #define REG%.16lx
 #else
@@ -1629,9 +1626,6 @@ write_spr(int n, unsigned long val)
}
 }
 
-extern char exc_prolog;
-extern char dec_exc;
-
 static void super_regs(void)
 {
static unsigned long regno;
-- 
1.7.9.5

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


[PATCH 20/20] powerpc/xmon: Fallback to printk() in xmon_printf() if udbg is not setup

2012-10-09 Thread Michael Ellerman
It is possible to configure a kernel which has xmon enabled, but has no
udbg backend to provide IO. This can make xmon rather confusing, as it
produces no output, blocks for two seconds, and then returns.

As a last resort we can instead try to printk(), which may deadlock or
otherwise crash, but tries quite hard not to.

Signed-off-by: Michael Ellerman mich...@ellerman.id.au
---
 arch/powerpc/xmon/nonstdio.c |   10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/xmon/nonstdio.c b/arch/powerpc/xmon/nonstdio.c
index 942d0f6..bce3dcf 100644
--- a/arch/powerpc/xmon/nonstdio.c
+++ b/arch/powerpc/xmon/nonstdio.c
@@ -111,13 +111,19 @@ char *xmon_gets(char *str, int nb)
 void xmon_printf(const char *format, ...)
 {
va_list args;
-   int n;
static char xmon_outbuf[1024];
+   int rc, n;
 
va_start(args, format);
n = vsnprintf(xmon_outbuf, sizeof(xmon_outbuf), format, args);
va_end(args);
-   xmon_write(xmon_outbuf, n);
+
+   rc = xmon_write(xmon_outbuf, n);
+
+   if (n  rc == 0) {
+   /* No udbg hooks, fallback to printk() - dangerous */
+   printk(xmon_outbuf);
+   }
 }
 
 void xmon_puts(const char *str)
-- 
1.7.9.5

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


RE: [PATCH 06/20] powerpc/xmon: Remove renaming #defines of scanhex() and skipbl()

2012-10-09 Thread David Laight
 We have two #defines that rename scanhex() and skipbl() to
 xmon_scanhex() and xmon_skipbl() - but no one ever uses those
 names.

It looks like they are there for namespace protection.

David



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


Re: 答复: [RFC PATCH] powerpc/fsl: add timer wakeup source

2012-10-09 Thread Scott Wood

On 10/09/2012 08:56:53 AM, Wang Dongsheng-B40534 wrote:


I'm pretty sure /proc/ is NOT where we want this exposed.
  
   Should probably go under the sysfs directory of the mpic  
device.  Or
   better, make a generic interface for timer-based suspend wakeup  
(if

  there
   isn't one already).  This current approach sits in an unpleasant
 middle
   ground between generic and device-specific.
  
  /sys/power/wakeup_timer_seconds how about this?
  I think it is a freescale generic interface, this interface  
control by

  FSL_SOC  SUSPEND.

 There's no such thing as a Freescale generic interface.  Linux  
APIs

 are not organized by hardware vendor.  Either make a truly generic
 interface, reuse an existing one, or do something that is attached  
to

 the specific driver.
Thanks, I think i can change mpic timer registration, i will use  
platform_driver_register.
I will merge mpic timer and timer wakeup. In mpic timer the  
wakeup function
controls by SUSPEND. The sys path is  
/sys/devices/soc8572.4/ffe41100.timer/wakeup_seconds.
do you have any suggestions for this? or have a better idea about the  
sys path?


I'm not sure what you mean by the merging, but the path looks OK (I'd  
prefer a dash rather than underscore, but I'm not sure what the usual  
practice is in sysfs).


That said, this seems like something that could use a truly generic  
interface.


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


Re: gianfar driver crash on P1020

2012-10-09 Thread Claudiu Manoil

Hello,

Did you try this patch?
http://patchwork.ozlabs.org/patch/186315/

Claudiu

On 10/9/2012 3:22 PM, Avi Tsarfati wrote:


Hi,

I have the same problem as you do.

Have you found the CPU stuck reason (or fix) in P1020RDB board ?

Thanks,

Avi Tsarfati.



 


This footnote confirms that this email message has been scanned by
PineApp Mail-SeCure for the presence of malicious code, vandals  
computer viruses(187).




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


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

RE: gianfar driver crash on P1020

2012-10-09 Thread Avi Tsarfati
Thank you very much for your quick response and willing to share.

I'll test it and let you know.

 

 

From: Claudiu Manoil [mailto:claudiu.man...@freescale.com] 
Sent: Tuesday, October 09, 2012 6:37 PM
To: Avi Tsarfati
Cc: linuxppc-dev@lists.ozlabs.org
Subject: Re: gianfar driver crash on P1020

 

Hello,

Did you try this patch?
http://patchwork.ozlabs.org/patch/186315/

Claudiu

On 10/9/2012 3:22 PM, Avi Tsarfati wrote:

Hi, 

 

I have the same problem as you do. 

Have you found the CPU stuck reason (or fix) in P1020RDB board ?

 

Thanks,

Avi Tsarfati.

 





 
This footnote confirms that this email message has been scanned
by 
PineApp Mail-SeCure for the presence of malicious code, vandals
 computer viruses(187). 








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





 
This footnote confirms that this email message has been scanned by 
PineApp Mail-SeCure for the presence of malicious code, vandals 
computer viruses(100). 





 
This footnote confirms that this email message has been scanned by 
PineApp Mail-SeCure for the presence of malicious code, vandals 
computer viruses(42). 





This footnote confirms that this email message has been scanned by
PineApp Mail-SeCure for the presence of malicious code, vandals  computer 
viruses(187).



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

[PATCH 3/3] rapidio: update for destination ID allocation

2012-10-09 Thread Alexandre Bounine
This patch address comments provided by Andrew Morton:
https://lkml.org/lkml/2012/10/3/550

- Keeps consistent kerneldoc compatible comments style for new static functions.
- Removes unnecessary complexity from destination ID allocation routine.
- Uses kcalloc() for code clarity. 

Signed-off-by: Alexandre Bounine alexandre.boun...@idt.com
Cc: Matt Porter mpor...@kernel.crashing.org
Cc: Li Yang le...@freescale.com
---
 drivers/rapidio/rio-scan.c |   38 --
 include/linux/rio.h|1 -
 2 files changed, 16 insertions(+), 23 deletions(-)

diff --git a/drivers/rapidio/rio-scan.c b/drivers/rapidio/rio-scan.c
index 05f0ed9..07da58b 100644
--- a/drivers/rapidio/rio-scan.c
+++ b/drivers/rapidio/rio-scan.c
@@ -55,9 +55,9 @@ static int rio_mport_phys_table[] = {
 };
 
 
-/*
+/**
  * rio_destid_alloc - Allocate next available destID for given network
- * net: RIO network
+ * @net: RIO network
  *
  * Returns next available device destination ID for the specified RIO network.
  * Marks allocated ID as one in use.
@@ -69,14 +69,9 @@ static u16 rio_destid_alloc(struct rio_net *net)
struct rio_id_table *idtab = net-destid_table;
 
spin_lock(idtab-lock);
-   destid = find_next_zero_bit(idtab-table, idtab-max, idtab-next);
-   if (destid = idtab-max)
-   destid = find_first_zero_bit(idtab-table, idtab-max);
+   destid = find_first_zero_bit(idtab-table, idtab-max);
 
if (destid  idtab-max) {
-   idtab-next = destid + 1;
-   if (idtab-next = idtab-max)
-   idtab-next = 0;
set_bit(destid, idtab-table);
destid += idtab-start;
} else
@@ -86,10 +81,10 @@ static u16 rio_destid_alloc(struct rio_net *net)
return (u16)destid;
 }
 
-/*
+/**
  * rio_destid_reserve - Reserve the specivied destID
- * net: RIO network
- * destid: destID to reserve
+ * @net: RIO network
+ * @destid: destID to reserve
  *
  * Tries to reserve the specified destID.
  * Returns 0 if successfull.
@@ -106,10 +101,10 @@ static int rio_destid_reserve(struct rio_net *net, u16 
destid)
return oldbit;
 }
 
-/*
+/**
  * rio_destid_free - free a previously allocated destID
- * net: RIO network
- * destid: destID to free
+ * @net: RIO network
+ * @destid: destID to free
  *
  * Makes the specified destID available for use.
  */
@@ -123,9 +118,9 @@ static void rio_destid_free(struct rio_net *net, u16 destid)
spin_unlock(idtab-lock);
 }
 
-/*
+/**
  * rio_destid_first - return first destID in use
- * net: RIO network
+ * @net: RIO network
  */
 static u16 rio_destid_first(struct rio_net *net)
 {
@@ -142,10 +137,10 @@ static u16 rio_destid_first(struct rio_net *net)
return (u16)destid;
 }
 
-/*
+/**
  * rio_destid_next - return next destID in use
- * net: RIO network
- * from: destination ID from which search shall continue
+ * @net: RIO network
+ * @from: destination ID from which search shall continue
  */
 static u16 rio_destid_next(struct rio_net *net, u16 from)
 {
@@ -1163,8 +1158,8 @@ static struct rio_net __devinit *rio_alloc_net(struct 
rio_mport *port,
 
net = kzalloc(sizeof(struct rio_net), GFP_KERNEL);
if (net  do_enum) {
-   net-destid_table.table = kzalloc(
-   BITS_TO_LONGS(RIO_MAX_ROUTE_ENTRIES(port-sys_size)) *
+   net-destid_table.table = kcalloc(
+   BITS_TO_LONGS(RIO_MAX_ROUTE_ENTRIES(port-sys_size)),
sizeof(long),
GFP_KERNEL);
 
@@ -1174,7 +1169,6 @@ static struct rio_net __devinit *rio_alloc_net(struct 
rio_mport *port,
net = NULL;
} else {
net-destid_table.start = start;
-   net-destid_table.next = 0;
net-destid_table.max =
RIO_MAX_ROUTE_ENTRIES(port-sys_size);
spin_lock_init(net-destid_table.lock);
diff --git a/include/linux/rio.h b/include/linux/rio.h
index d2dff22..ac21ac6 100644
--- a/include/linux/rio.h
+++ b/include/linux/rio.h
@@ -266,7 +266,6 @@ struct rio_mport {
 
 struct rio_id_table {
u16 start;  /* logical minimal id */
-   u16 next;   /* hint for find */
u32 max;/* max number of IDs in table */
spinlock_t lock;
unsigned long *table;
-- 
1.7.8.4

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


[PATCH 0/3] rapidio: updates for multiple mport patches

2012-10-09 Thread Alexandre Bounine
This is a set of updates for patches submitted earlier:
https://lkml.org/lkml/2012/10/3/460.

Alexandre Bounine (3):
  rapidio: use msleep in discovery wait
  rapidio: update asynchronous discovery initialization
  rapidio: update for destination ID allocation

 drivers/rapidio/rio-scan.c |   40 ++-
 drivers/rapidio/rio.c  |   75 +++
 include/linux/rio.h|1 -
 3 files changed, 64 insertions(+), 52 deletions(-)

-- 
1.7.8.4

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


[PATCH 1/3] rapidio: use msleep in discovery wait

2012-10-09 Thread Alexandre Bounine
Use msleep() routine for code clarity as suggested by Andrew Morton in his
comments for the original patch: https://lkml.org/lkml/2012/10/3/546.

Signed-off-by: Alexandre Bounine alexandre.boun...@idt.com
Cc: Matt Porter mpor...@kernel.crashing.org
Cc: Li Yang le...@freescale.com
---
 drivers/rapidio/rio-scan.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/rapidio/rio-scan.c b/drivers/rapidio/rio-scan.c
index 48e9041..05f0ed9 100644
--- a/drivers/rapidio/rio-scan.c
+++ b/drivers/rapidio/rio-scan.c
@@ -1391,7 +1391,7 @@ int __devinit rio_disc_mport(struct rio_mport *mport)
while (time_before(jiffies, to_end)) {
if (rio_enum_complete(mport))
goto enum_done;
-   schedule_timeout_uninterruptible(msecs_to_jiffies(10));
+   msleep(10);
}
 
pr_debug(RIO: discovery timeout on mport %d %s\n,
-- 
1.7.8.4

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


[PATCH 2/3] rapidio: update asynchronous discovery initialization

2012-10-09 Thread Alexandre Bounine
Update discovery process initialization based on Andrew Morton's comments:
https://lkml.org/lkml/2012/10/3/552.

This update processes all enumerating mports first and schedules discovery
work after that. If the initialization routine fails to allocate resources
needed to execute discovery, it abandons discovery for all ports. 

Signed-off-by: Alexandre Bounine alexandre.boun...@idt.com
Cc: Matt Porter mpor...@kernel.crashing.org
Cc: Li Yang le...@freescale.com
---
 drivers/rapidio/rio.c |   75 ++--
 1 files changed, 47 insertions(+), 28 deletions(-)

diff --git a/drivers/rapidio/rio.c b/drivers/rapidio/rio.c
index d4bd690..c17ae22 100644
--- a/drivers/rapidio/rio.c
+++ b/drivers/rapidio/rio.c
@@ -1275,49 +1275,68 @@ static void __devinit disc_work_handler(struct 
work_struct *_work)
pr_debug(RIO: discovery work for mport %d %s\n,
 work-mport-id, work-mport-name);
rio_disc_mport(work-mport);
-
-   kfree(work);
 }
 
 int __devinit rio_init_mports(void)
 {
struct rio_mport *port;
struct rio_disc_work *work;
-   int no_disc = 0;
+   int n = 0;
+
+   if (!next_portid)
+   return -ENODEV;
 
+   /*
+* First, run enumerations and check if we need to perform discovery
+* on any of the registered mports.
+*/
list_for_each_entry(port, rio_mports, node) {
if (port-host_deviceid = 0)
rio_enum_mport(port);
-   else if (!no_disc) {
-   if (!rio_wq) {
-   rio_wq = alloc_workqueue(riodisc, 0, 0);
-   if (!rio_wq) {
-   pr_err(RIO: unable allocate rio_wq\n);
-   no_disc = 1;
-   continue;
-   }
-   }
-
-   work = kzalloc(sizeof *work, GFP_KERNEL);
-   if (!work) {
-   pr_err(RIO: no memory for work struct\n);
-   no_disc = 1;
-   continue;
-   }
-
-   work-mport = port;
-   INIT_WORK(work-work, disc_work_handler);
-   queue_work(rio_wq, work-work);
-   }
+   else
+   n++;
+   }
+
+   if (!n)
+   goto no_disc;
+
+   /*
+* If we have mports that require discovery schedule a discovery work
+* for each of them. If the code below fails to allocate needed
+* resources, exit without error to keep results of enumeration
+* process (if any).
+* TODO: Implement restart of dicovery process for all or
+* individual discovering mports.
+*/
+   rio_wq = alloc_workqueue(riodisc, 0, 0);
+   if (!rio_wq) {
+   pr_err(RIO: unable allocate rio_wq\n);
+   goto no_disc;
}
 
-   if (rio_wq) {
-   pr_debug(RIO: flush discovery workqueue\n);
-   flush_workqueue(rio_wq);
-   pr_debug(RIO: flush discovery workqueue finished\n);
+   work = kcalloc(n, sizeof *work, GFP_KERNEL);
+   if (!work) {
+   pr_err(RIO: no memory for work struct\n);
destroy_workqueue(rio_wq);
+   goto no_disc;
}
 
+   n = 0;
+   list_for_each_entry(port, rio_mports, node) {
+   if (port-host_deviceid  0) {
+   work[n].mport = port;
+   INIT_WORK(work[n].work, disc_work_handler);
+   queue_work(rio_wq, work[n].work);
+   n++;
+   }
+   }
+
+   flush_workqueue(rio_wq);
+   pr_debug(RIO: destroy discovery workqueue\n);
+   destroy_workqueue(rio_wq);
+   kfree(work);
+
+no_disc:
rio_init();
 
return 0;
-- 
1.7.8.4

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


Re: memory-hotplug : suppres Trying to free nonexistent resource XXXXXXXXXXXXXXXX-YYYYYYYYYYYYYYYY warning

2012-10-09 Thread Andrew Morton
On Tue, 9 Oct 2012 11:51:38 +0900
Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com wrote:

  Anyway, please have a think, and see if we can come up with the best
  and most accurate choice of types and identifiers in this code.
 
 Your concern is right. Overflow bug may occur in the future.
 So I changed type of i and sections_to_remove to unsigned long.
 Please merge it into your tree instead of previous patch.

Too late, the original patch was merged.  So I generated the delta.

I remain allergic to the `i' identifier so I renamed it to `section'. 
That's not 100% accurate, but it is better.

 __remove_pages() also has same concern. So I'll fix it.

Thanks.



From: Yasuaki Ishimatsu isimatu.yasu...@jp.fujitsu.com
Subject: arch/powerpc/platforms/pseries/hotplug-memory.c: section removal 
cleanups

Followups to d760afd4d25 (memory-hotplug: suppress Trying to free
nonexistent resource - warning).

- use unsigned long type, as overflows are conceivable

- rename `i' to the less-misleading and more informative `section'

Cc: Benjamin Herrenschmidt b...@kernel.crashing.org
Signed-off-by: Andrew Morton a...@linux-foundation.org
---

 arch/powerpc/platforms/pseries/hotplug-memory.c |9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff -puN 
arch/powerpc/platforms/pseries/hotplug-memory.c~arch-powerpc-platforms-pseries-hotplug-memoryc-section-removal-cleanups
 arch/powerpc/platforms/pseries/hotplug-memory.c
--- 
a/arch/powerpc/platforms/pseries/hotplug-memory.c~arch-powerpc-platforms-pseries-hotplug-memoryc-section-removal-cleanups
+++ a/arch/powerpc/platforms/pseries/hotplug-memory.c
@@ -77,8 +77,9 @@ static int pseries_remove_memblock(unsig
 {
unsigned long start, start_pfn;
struct zone *zone;
-   int i, ret;
-   int sections_to_remove;
+   int ret;
+   unsigned long section;
+   unsigned long sections_to_remove;
 
start_pfn = base  PAGE_SHIFT;
 
@@ -99,8 +100,8 @@ static int pseries_remove_memblock(unsig
 * while writing to it. So we have to defer it to here.
 */
sections_to_remove = (memblock_size  PAGE_SHIFT) / PAGES_PER_SECTION;
-   for (i = 0; i  sections_to_remove; i++) {
-   unsigned long pfn = start_pfn + i * PAGES_PER_SECTION;
+   for (section = 0; section  sections_to_remove; section++) {
+   unsigned long pfn = start_pfn + section * PAGES_PER_SECTION;
ret = __remove_pages(zone, start_pfn,  PAGES_PER_SECTION);
if (ret)
return ret;
diff -puN 
mm/memory_hotplug.c~arch-powerpc-platforms-pseries-hotplug-memoryc-section-removal-cleanups
 mm/memory_hotplug.c
_

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


Re: [PATCH 10/20] powerpc/xmon: Factor out the oft-repeated setjmp logic

2012-10-09 Thread Paul Mackerras
On Wed, Oct 10, 2012 at 01:20:37AM +1100, Michael Ellerman wrote:
 We have over 15 routines that implement essentially the same logic
 in terms of catching faults. Pull the logic out into two helper
 routines.
 
 The pattern becomes:
 
   if (start_bus_error_jump() == 0) {
   do potentially faulting things
 
   end_bus_error_jump();
   } else {
   printf(Faulting thing faulted!\n);
   }

NAK...  think about how setjmp() works.  You can't return from the
function that called setjmp() while there is any possibility that
longjmp() could be called for the same jmp_buf.

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


Re: [PATCH 06/20] powerpc/xmon: Remove renaming #defines of scanhex() and skipbl()

2012-10-09 Thread Paul Mackerras
On Wed, Oct 10, 2012 at 01:20:33AM +1100, Michael Ellerman wrote:
 We have two #defines that rename scanhex() and skipbl() to
 xmon_scanhex() and xmon_skipbl() - but no one ever uses those
 names.
 
 So the only effect is to rename the actual symbols in the generated
 code, and AFACIS there is no reason to do that, so drop them.

You might as well make scanhex() and skipbl() static while you're at
it.

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


linux-next: build failure after merge of the origin tree

2012-10-09 Thread Stephen Rothwell
Hi Linus,

In Linus' tree, today's linux-next build (powerpc ppc64_defconfig) failed
like this:

arch/powerpc/platforms/pseries/hotplug-memory.c: In function 
'pseries_remove_memblock':
arch/powerpc/platforms/pseries/hotplug-memory.c:103:17: error: unused variable 
'pfn' [-Werror=unused-variable]

Caused by commit d760afd4d257 (memory-hotplug: suppress Trying to free
nonexistent resource - warning).

I can't see what the point of the pfn variable is and this patch never
appeared in linux-next before being merged.  :-(

I have reverted that commit for today.

If this patch truly was authored yesterday (according the Author Date in
git), why was it merged yesterday while still under discussion?  And the
latest update to it still has this build problem ... did anyone even try
to build this for powerpc (since that architecture was obviously
affected)?  (Cross compilers available here
http://www.kernel.org/pub/tools/crosstool/).

-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au


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

Re: linux-next: build failure after merge of the origin tree

2012-10-09 Thread Andrew Morton
On Wed, 10 Oct 2012 10:21:50 +1100 Stephen Rothwell s...@canb.auug.org.au 
wrote:

 Hi Linus,
 
 In Linus' tree, today's linux-next build (powerpc ppc64_defconfig) failed
 like this:
 
 arch/powerpc/platforms/pseries/hotplug-memory.c: In function 
 'pseries_remove_memblock':
 arch/powerpc/platforms/pseries/hotplug-memory.c:103:17: error: unused 
 variable 'pfn' [-Werror=unused-variable]
 
 Caused by commit d760afd4d257 (memory-hotplug: suppress Trying to free
 nonexistent resource - warning).
 
 I can't see what the point of the pfn variable is

This:

--- a/arch/powerpc/platforms/pseries/hotplug-memory.c~a
+++ a/arch/powerpc/platforms/pseries/hotplug-memory.c
@@ -101,7 +101,7 @@ static int pseries_remove_memblock(unsig
sections_to_remove = (memblock_size  PAGE_SHIFT) / PAGES_PER_SECTION;
for (i = 0; i  sections_to_remove; i++) {
unsigned long pfn = start_pfn + i * PAGES_PER_SECTION;
-   ret = __remove_pages(zone, start_pfn,  PAGES_PER_SECTION);
+   ret = __remove_pages(zone, pfn, PAGES_PER_SECTION);
if (ret)
return ret;
}

 and this patch never
 appeared in linux-next before being merged.  :-(

It was first sighted October 3.

 I have reverted that commit for today.
 
 If this patch truly was authored yesterday (according the Author Date in
 git), why was it merged yesterday while still under discussion?  And the
 latest update to it still has this build problem ... did anyone even try
 to build this for powerpc (since that architecture was obviously
 affected)?

Apparently not - the ppc bit was a best-effort fixup for a patch which
addresses an x86 problem.

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


Re: linux-next: build failure after merge of the origin tree

2012-10-09 Thread Yasuaki Ishimatsu

Hi Stephen,

2012/10/10 8:45, Andrew Morton wrote:

On Wed, 10 Oct 2012 10:21:50 +1100 Stephen Rothwell s...@canb.auug.org.au 
wrote:


Hi Linus,

In Linus' tree, today's linux-next build (powerpc ppc64_defconfig) failed
like this:

arch/powerpc/platforms/pseries/hotplug-memory.c: In function 
'pseries_remove_memblock':
arch/powerpc/platforms/pseries/hotplug-memory.c:103:17: error: unused variable 
'pfn' [-Werror=unused-variable]

Caused by commit d760afd4d257 (memory-hotplug: suppress Trying to free
nonexistent resource - warning).

I can't see what the point of the pfn variable is


This:

--- a/arch/powerpc/platforms/pseries/hotplug-memory.c~a
+++ a/arch/powerpc/platforms/pseries/hotplug-memory.c
@@ -101,7 +101,7 @@ static int pseries_remove_memblock(unsig
sections_to_remove = (memblock_size  PAGE_SHIFT) / PAGES_PER_SECTION;
for (i = 0; i  sections_to_remove; i++) {
unsigned long pfn = start_pfn + i * PAGES_PER_SECTION;
-   ret = __remove_pages(zone, start_pfn,  PAGES_PER_SECTION);
+   ret = __remove_pages(zone, pfn, PAGES_PER_SECTION);
if (ret)
return ret;
}


I believe the error to be fixed with this patch.
Could you try it?

Thanks,
Yasuaki Ishimatsu




and this patch never
appeared in linux-next before being merged.  :-(


It was first sighted October 3.


I have reverted that commit for today.

If this patch truly was authored yesterday (according the Author Date in
git), why was it merged yesterday while still under discussion?  And the
latest update to it still has this build problem ... did anyone even try
to build this for powerpc (since that architecture was obviously
affected)?


Apparently not - the ppc bit was a best-effort fixup for a patch which
addresses an x86 problem.




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


Re: linux-next: build failure after merge of the origin tree

2012-10-09 Thread Stephen Rothwell
Hi Andrew,

On Tue, 9 Oct 2012 16:45:14 -0700 Andrew Morton a...@linux-foundation.org 
wrote:

 On Wed, 10 Oct 2012 10:21:50 +1100 Stephen Rothwell s...@canb.auug.org.au 
 wrote:
 
  I can't see what the point of the pfn variable is
 
 This:
 
 --- a/arch/powerpc/platforms/pseries/hotplug-memory.c~a
 +++ a/arch/powerpc/platforms/pseries/hotplug-memory.c
 @@ -101,7 +101,7 @@ static int pseries_remove_memblock(unsig
   sections_to_remove = (memblock_size  PAGE_SHIFT) / PAGES_PER_SECTION;
   for (i = 0; i  sections_to_remove; i++) {
   unsigned long pfn = start_pfn + i * PAGES_PER_SECTION;
 - ret = __remove_pages(zone, start_pfn,  PAGES_PER_SECTION);
 + ret = __remove_pages(zone, pfn, PAGES_PER_SECTION);
   if (ret)
   return ret;
   }

Can we get that fix to Linus ASAP, please?

  and this patch never
  appeared in linux-next before being merged.  :-(
 
 It was first sighted October 3.

Yeah, my mistake. But it never made it to linux-next.

  I have reverted that commit for today.
  
  If this patch truly was authored yesterday (according the Author Date in
  git), why was it merged yesterday while still under discussion?  And the
  latest update to it still has this build problem ... did anyone even try
  to build this for powerpc (since that architecture was obviously
  affected)?
 
 Apparently not - the ppc bit was a best-effort fixup for a patch which
 addresses an x86 problem.

Right, and that is one of the reasons we have linux-next - to test for
cross architecture problems.
-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au


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

Re: [PATCH 10/20] powerpc/xmon: Factor out the oft-repeated setjmp logic

2012-10-09 Thread Michael Ellerman
On Wed, 2012-10-10 at 09:23 +1100, Paul Mackerras wrote:
 On Wed, Oct 10, 2012 at 01:20:37AM +1100, Michael Ellerman wrote:
  We have over 15 routines that implement essentially the same logic
  in terms of catching faults. Pull the logic out into two helper
  routines.
  
  The pattern becomes:
  
  if (start_bus_error_jump() == 0) {
  do potentially faulting things
  
  end_bus_error_jump();
  } else {
  printf(Faulting thing faulted!\n);
  }
 
 NAK...  think about how setjmp() works.  You can't return from the
 function that called setjmp() while there is any possibility that
 longjmp() could be called for the same jmp_buf.

Sigh, yeah. Somehow I'd convinced myself that it worked in this case,
but after a night's sleep I'm not sure what my logic was.

cheers

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


Re: [PATCH 06/20] powerpc/xmon: Remove renaming #defines of scanhex() and skipbl()

2012-10-09 Thread Michael Ellerman
On Wed, 2012-10-10 at 09:15 +1100, Paul Mackerras wrote:
 On Wed, Oct 10, 2012 at 01:20:33AM +1100, Michael Ellerman wrote:
  We have two #defines that rename scanhex() and skipbl() to
  xmon_scanhex() and xmon_skipbl() - but no one ever uses those
  names.
  
  So the only effect is to rename the actual symbols in the generated
  code, and AFACIS there is no reason to do that, so drop them.
 
 You might as well make scanhex() and skipbl() static while you're at
 it.

Actually I was hoping to move the spu code that uses them into a
separate file, so I'll leave them for now.

cheers

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


Re: [GIT PULL] Disintegrate UAPI for powerpc [ver #2]

2012-10-09 Thread Benjamin Herrenschmidt
On Tue, 2012-10-09 at 10:15 +0100, David Howells wrote:
 Can you merge the following branch into the powerpc tree please.

Thanks, looking at this right now. If it passes my tests I'll ask Linus
to pull later today.

Cheers,
Ben.

 This is to complete part of the UAPI disintegration for which the preparatory
 patches were pulled recently.
 
 Now that the fixups and the asm-generic chunk have been merged, I've
 regenerated the patches to get rid of those dependencies and to take account 
 of
 any changes made so far in the merge window.  If you have already pulled the
 older version of the branch aimed at you, then please feel free to ignore this
 request.
 
 The following changes since commit 9e2d8656f5e8aa214e66b462680cf86b210b74a8:
 
   Merge branch 'akpm' (Andrew's patch-bomb) (2012-10-09 16:23:15 +0900)
 
 are available in the git repository at:
 
 
   git://git.infradead.org/users/dhowells/linux-headers.git 
 tags/disintegrate-powerpc-20121009
 
 for you to fetch changes up to c3617f72036c909e1f6086b5b9e364e0ef90a6da:
 
   UAPI: (Scripted) Disintegrate arch/powerpc/include/asm (2012-10-09 09:47:26 
 +0100)
 
 
 UAPI Disintegration 2012-10-09
 
 
 David Howells (1):
   UAPI: (Scripted) Disintegrate arch/powerpc/include/asm
 
  arch/powerpc/include/asm/Kbuild   |  35 --
  arch/powerpc/include/asm/bootx.h  | 123 +--
  arch/powerpc/include/asm/cputable.h   |  35 +-
  arch/powerpc/include/asm/elf.h| 311 +-
  arch/powerpc/include/asm/kvm_para.h   |  70 +---
  arch/powerpc/include/asm/mman.h   |  27 +-
  arch/powerpc/include/asm/nvram.h  |  55 +---
  arch/powerpc/include/asm/ptrace.h | 242 +-
  arch/powerpc/include/asm/signal.h | 143 +---
  arch/powerpc/include/asm/spu_info.h   |  29 +-
  arch/powerpc/include/asm/swab.h   |  15 +-
  arch/powerpc/include/asm/termios.h|  69 +---
  arch/powerpc/include/asm/types.h  |  30 +-
  arch/powerpc/include/asm/unistd.h | 374 +
  arch/powerpc/include/uapi/asm/Kbuild  |  41 +++
  arch/powerpc/include/{ = uapi}/asm/auxvec.h  |   0
  arch/powerpc/include/{ = uapi}/asm/bitsperlong.h |   0
  arch/powerpc/include/uapi/asm/bootx.h | 132 
  arch/powerpc/include/{ = uapi}/asm/byteorder.h   |   0
  arch/powerpc/include/uapi/asm/cputable.h  |  36 ++
  arch/powerpc/include/uapi/asm/elf.h   | 307 +
  arch/powerpc/include/{ = uapi}/asm/errno.h   |   0
  arch/powerpc/include/{ = uapi}/asm/fcntl.h   |   0
  arch/powerpc/include/{ = uapi}/asm/ioctl.h   |   0
  arch/powerpc/include/{ = uapi}/asm/ioctls.h  |   0
  arch/powerpc/include/{ = uapi}/asm/ipcbuf.h  |   0
  arch/powerpc/include/{ = uapi}/asm/kvm.h |   0
  arch/powerpc/include/uapi/asm/kvm_para.h  |  90 +
  arch/powerpc/include/{ = uapi}/asm/linkage.h |   0
  arch/powerpc/include/uapi/asm/mman.h  |  31 ++
  arch/powerpc/include/{ = uapi}/asm/msgbuf.h  |   0
  arch/powerpc/include/uapi/asm/nvram.h |  62 
  arch/powerpc/include/{ = uapi}/asm/param.h   |   0
  arch/powerpc/include/{ = uapi}/asm/poll.h|   0
  arch/powerpc/include/{ = uapi}/asm/posix_types.h |   0
  arch/powerpc/include/{ = uapi}/asm/ps3fb.h   |   0
  arch/powerpc/include/uapi/asm/ptrace.h| 259 +++
  arch/powerpc/include/{ = uapi}/asm/resource.h|   0
  arch/powerpc/include/{ = uapi}/asm/seccomp.h |   0
  arch/powerpc/include/{ = uapi}/asm/sembuf.h  |   0
  arch/powerpc/include/{ = uapi}/asm/setup.h   |   0
  arch/powerpc/include/{ = uapi}/asm/shmbuf.h  |   0
  arch/powerpc/include/{ = uapi}/asm/sigcontext.h  |   0
  arch/powerpc/include/{ = uapi}/asm/siginfo.h |   0
  arch/powerpc/include/uapi/asm/signal.h| 145 +
  arch/powerpc/include/{ = uapi}/asm/socket.h  |   0
  arch/powerpc/include/{ = uapi}/asm/sockios.h |   0
  arch/powerpc/include/uapi/asm/spu_info.h  |  53 +++
  arch/powerpc/include/{ = uapi}/asm/stat.h|   0
  arch/powerpc/include/{ = uapi}/asm/statfs.h  |   0
  arch/powerpc/include/uapi/asm/swab.h  |  23 ++
  arch/powerpc/include/{ = uapi}/asm/termbits.h|   0
  arch/powerpc/include/uapi/asm/termios.h   |  76 +
  arch/powerpc/include/uapi/asm/types.h |  40 +++
  arch/powerpc/include/{ = uapi}/asm/ucontext.h|   0
  arch/powerpc/include/uapi/asm/unistd.h| 380 
 ++
  56 files changed, 1705 insertions(+), 1528 deletions(-)
  rename arch/powerpc/include/{ = uapi}/asm/auxvec.h (100%)
  rename arch/powerpc/include/{ = uapi}/asm/bitsperlong.h

Re: linux-next: build failure after merge of the origin tree

2012-10-09 Thread Stephen Rothwell
Hi,

On Wed, 10 Oct 2012 08:52:21 +0900 Yasuaki Ishimatsu 
isimatu.yasu...@jp.fujitsu.com wrote:

 2012/10/10 8:45, Andrew Morton wrote:
  On Wed, 10 Oct 2012 10:21:50 +1100 Stephen Rothwell s...@canb.auug.org.au 
  wrote:
 
  Hi Linus,
 
  In Linus' tree, today's linux-next build (powerpc ppc64_defconfig) failed
  like this:
 
  arch/powerpc/platforms/pseries/hotplug-memory.c: In function 
  'pseries_remove_memblock':
  arch/powerpc/platforms/pseries/hotplug-memory.c:103:17: error: unused 
  variable 'pfn' [-Werror=unused-variable]
 
  Caused by commit d760afd4d257 (memory-hotplug: suppress Trying to free
  nonexistent resource - warning).
 
  I can't see what the point of the pfn variable is
 
  This:
 
  --- a/arch/powerpc/platforms/pseries/hotplug-memory.c~a
  +++ a/arch/powerpc/platforms/pseries/hotplug-memory.c
  @@ -101,7 +101,7 @@ static int pseries_remove_memblock(unsig
  sections_to_remove = (memblock_size  PAGE_SHIFT) / PAGES_PER_SECTION;
  for (i = 0; i  sections_to_remove; i++) {
  unsigned long pfn = start_pfn + i * PAGES_PER_SECTION;
  -   ret = __remove_pages(zone, start_pfn,  PAGES_PER_SECTION);
  +   ret = __remove_pages(zone, pfn, PAGES_PER_SECTION);
  if (ret)
  return ret;
  }
 
 I believe the error to be fixed with this patch.
 Could you try it?

The certainly fixes the build problem.  I can't comment in the semantics
of the patch.

Tested-by: Stephen Rothwell s...@canb.auug.org.au  (Build only)
-- 
Cheers,
Stephen Rothwells...@canb.auug.org.au


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

Re: [GIT PULL] Disintegrate UAPI for powerpc [ver #2]

2012-10-09 Thread Benjamin Herrenschmidt
On Tue, 2012-10-09 at 10:15 +0100, David Howells wrote:
 Can you merge the following branch into the powerpc tree please.
 
 This is to complete part of the UAPI disintegration for which the preparatory
 patches were pulled recently.

This is now in the powerpc merge branch:

git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc.git merge

Linus, free free to pull it.

Note that upstream Linus (and thus this branch) fails to build powerpc
configs with memory hotplug enabled due to Andrew merging a completely
untested and un-next'ed patch :-) (tsk tsk tsk !)

I assume you (Andrew) already has a fix on its way to Linus so I haven't
put it in this branch.

Cheers,
Ben.


 Now that the fixups and the asm-generic chunk have been merged, I've
 regenerated the patches to get rid of those dependencies and to take account 
 of
 any changes made so far in the merge window.  If you have already pulled the
 older version of the branch aimed at you, then please feel free to ignore this
 request.
 
 The following changes since commit 9e2d8656f5e8aa214e66b462680cf86b210b74a8:
 
   Merge branch 'akpm' (Andrew's patch-bomb) (2012-10-09 16:23:15 +0900)
 
 are available in the git repository at:
 
 
   git://git.infradead.org/users/dhowells/linux-headers.git 
 tags/disintegrate-powerpc-20121009
 
 for you to fetch changes up to c3617f72036c909e1f6086b5b9e364e0ef90a6da:
 
   UAPI: (Scripted) Disintegrate arch/powerpc/include/asm (2012-10-09 09:47:26 
 +0100)
 
 
 UAPI Disintegration 2012-10-09
 
 
 David Howells (1):
   UAPI: (Scripted) Disintegrate arch/powerpc/include/asm
 
  arch/powerpc/include/asm/Kbuild   |  35 --
  arch/powerpc/include/asm/bootx.h  | 123 +--
  arch/powerpc/include/asm/cputable.h   |  35 +-
  arch/powerpc/include/asm/elf.h| 311 +-
  arch/powerpc/include/asm/kvm_para.h   |  70 +---
  arch/powerpc/include/asm/mman.h   |  27 +-
  arch/powerpc/include/asm/nvram.h  |  55 +---
  arch/powerpc/include/asm/ptrace.h | 242 +-
  arch/powerpc/include/asm/signal.h | 143 +---
  arch/powerpc/include/asm/spu_info.h   |  29 +-
  arch/powerpc/include/asm/swab.h   |  15 +-
  arch/powerpc/include/asm/termios.h|  69 +---
  arch/powerpc/include/asm/types.h  |  30 +-
  arch/powerpc/include/asm/unistd.h | 374 +
  arch/powerpc/include/uapi/asm/Kbuild  |  41 +++
  arch/powerpc/include/{ = uapi}/asm/auxvec.h  |   0
  arch/powerpc/include/{ = uapi}/asm/bitsperlong.h |   0
  arch/powerpc/include/uapi/asm/bootx.h | 132 
  arch/powerpc/include/{ = uapi}/asm/byteorder.h   |   0
  arch/powerpc/include/uapi/asm/cputable.h  |  36 ++
  arch/powerpc/include/uapi/asm/elf.h   | 307 +
  arch/powerpc/include/{ = uapi}/asm/errno.h   |   0
  arch/powerpc/include/{ = uapi}/asm/fcntl.h   |   0
  arch/powerpc/include/{ = uapi}/asm/ioctl.h   |   0
  arch/powerpc/include/{ = uapi}/asm/ioctls.h  |   0
  arch/powerpc/include/{ = uapi}/asm/ipcbuf.h  |   0
  arch/powerpc/include/{ = uapi}/asm/kvm.h |   0
  arch/powerpc/include/uapi/asm/kvm_para.h  |  90 +
  arch/powerpc/include/{ = uapi}/asm/linkage.h |   0
  arch/powerpc/include/uapi/asm/mman.h  |  31 ++
  arch/powerpc/include/{ = uapi}/asm/msgbuf.h  |   0
  arch/powerpc/include/uapi/asm/nvram.h |  62 
  arch/powerpc/include/{ = uapi}/asm/param.h   |   0
  arch/powerpc/include/{ = uapi}/asm/poll.h|   0
  arch/powerpc/include/{ = uapi}/asm/posix_types.h |   0
  arch/powerpc/include/{ = uapi}/asm/ps3fb.h   |   0
  arch/powerpc/include/uapi/asm/ptrace.h| 259 +++
  arch/powerpc/include/{ = uapi}/asm/resource.h|   0
  arch/powerpc/include/{ = uapi}/asm/seccomp.h |   0
  arch/powerpc/include/{ = uapi}/asm/sembuf.h  |   0
  arch/powerpc/include/{ = uapi}/asm/setup.h   |   0
  arch/powerpc/include/{ = uapi}/asm/shmbuf.h  |   0
  arch/powerpc/include/{ = uapi}/asm/sigcontext.h  |   0
  arch/powerpc/include/{ = uapi}/asm/siginfo.h |   0
  arch/powerpc/include/uapi/asm/signal.h| 145 +
  arch/powerpc/include/{ = uapi}/asm/socket.h  |   0
  arch/powerpc/include/{ = uapi}/asm/sockios.h |   0
  arch/powerpc/include/uapi/asm/spu_info.h  |  53 +++
  arch/powerpc/include/{ = uapi}/asm/stat.h|   0
  arch/powerpc/include/{ = uapi}/asm/statfs.h  |   0
  arch/powerpc/include/uapi/asm/swab.h  |  23 ++
  arch/powerpc/include/{ = uapi}/asm/termbits.h|   0
  arch/powerpc/include/uapi/asm/termios.h   |  76 +
  arch/powerpc/include/uapi/asm