LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: Linux Kernel 2.6 on Artesyn Katana Board (3750) with IBM 750F X PP C
From: Wolfgang Denk @ 2006-11-06 23:34 UTC (permalink / raw)
  To: Goel, Mudit (Mudit); +Cc: 'linuxppc-embedded@ozlabs.org'
In-Reply-To: <3BE48DD0EC7D3948BC183931D9150C210BBB0CA1@ii0015exch001u.iprc.lucent.com>

In message <3BE48DD0EC7D3948BC183931D9150C210BBB0CA1@ii0015exch001u.iprc.lucent.com> you wrote:
>   After making an uIamge and using bootm here is the o/p. I have tried using
> DHCP/ RARP options also
>   but I dont see any requests coming onto the host machine where the server
> is runnig. Is there something
>   incorrect in the configuration that I have. 

Probably a bug or configuration problem in your Linux kernel and/or
your toolchain.

> Linux version 2.6.10_mvlcge401-katana (root@hdrlin03) (gcc version 3.4.3
> (MontaVista 3.4.3-25.0.41.0501420 2005-09-07)) #32 Mon Nov 6 16:03:17 IST 2006

Since this is a MVL source tree and tools, you probably want  to  ask
MV support...

Best regards,

Wolfgang Denk

-- 
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
Never call a man a fool.  Borrow from him.

^ permalink raw reply

* Re: Please give your feedback
From: Wolfgang Denk @ 2006-11-06 23:32 UTC (permalink / raw)
  To: Manjunath AM; +Cc: linuxppc-embedded
In-Reply-To: <OF6157E3D5.6B060538-ON6525721E.00258EC0-6525721E.00261A01@lntemsys.com>

In message <OF6157E3D5.6B060538-ON6525721E.00258EC0-6525721E.00261A01@lntemsys.com> you wrote:
> 
> Please suggest me where i can download the toolchain to  use u-boot1.1.3 

See for example http://www.denx.de/wiki/view/DULG/ELDKAvailability

Best regards,

Wolfgang Denk

-- 
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
Real programmers don't comment their code. It was hard to  write,  it
should be hard to understand.

^ permalink raw reply

* Re: [PATCH] powerpc: Add of_platform support for OHCI/Bigendian HC
From: Sylvain Munaut @ 2006-11-06 23:28 UTC (permalink / raw)
  To: Kumar Gala; +Cc: linuxppc-dev, linuxppc-embedded
In-Reply-To: <9580D2CE-BD68-440F-A1FD-09E882D93231@kernel.crashing.org>

Kumar Gala wrote:
> On Nov 6, 2006, at 4:35 AM, Nicolas DET wrote:
>
>   
>> This patch use of_platform device to probe and install OHCI big  
>> endian HC.
>>
>> PS: I did not success to properly inline the file using thrunderbird.
>>     
>
> You really copy the USB maintainers on this.  Also, why bother with  
> the Kconfig for USB_OHCI_HCD_PPC_OF_BE/USB_OHCI_HCD_PPC_OF_LE?
>   
I think it's a good idea to use those :
 - Just including both when PPC_OF is used is overkill because it makes
all USB
perform useless tests if you never intend to use the LE version for example.
 - Using the already defined symbol USB_OHCI_BIG_ENDIAN would force
other ohci user to select BE/LE and they may not want to expose this.



However in this bus glue test :

+      || defined (CONFIG_USB_OHCI_HCD_PPC_OF_LE) \
+      || defined (CONFIG_USB_OHCI_HCD_PPC_OF_BE) \

I would just test for CONFIG_USB_OHCI_HCD_PPC_OF to keep things the same
betwenn all the bus glues. (Sure it would be stupid to select PPC_OF and neither
LE nor BE ...)

But that's just me and if the usb maintainer is ok with it, it's his call.


So otherwise, looks good to me. Haven't tested in hw yet ... I'll report asap.


Sylvain

^ permalink raw reply

* mpc83xx_spi driver for mpc832x?
From: Joakim Tjernlund @ 2006-11-06 22:48 UTC (permalink / raw)
  To: linuxppc-dev

Anyone working on extending the mpc83xx_spi driver to support
mpc832x? I don't think the current one supports either "cpu" mode
or "quicc" mode.

 Jocke

^ permalink raw reply

* Re: powerpc: "unable to handle .. paging request" during IPR probe
From: Brian King @ 2006-11-06 23:23 UTC (permalink / raw)
  To: John Rose; +Cc: External List, Brian King
In-Reply-To: <1162407611.28335.27.camel@sinatra.austin.ibm.com>

John Rose wrote:
> Anyone else seen this crash during boot on pseries?  This is 2.6.19-rc4
> with 4k pages.

This is the exact same signature of the failure that is fixed with
this patch:

http://marc.theaimsgroup.com/?l=linux-ide&m=116169938407596&w=2

It's an initialization sequence problem that exists for monolithic kernels.
Please try the patch and let me know if you are still having a problem.

Brian

> 
> Unable to handle kernel paging request for data at address 0x00000010
> Faulting instruction address: 0xc00000000006a204
> cpu 0x1: Vector: 300 (Data Access) at [c00000006ff82bc0]
> pc: c00000000006a204: .flush_workqueue+0x24/0xec
> lr: c0000000003848f4: .ata_port_flush_task+0x5c/0x12c
> sp: c00000006ff82e40
> msr: 8000000000009032
> dar: 10
> dsisr: 40000000
> current = 0xc000000002e3d810
> paca = 0xc000000000602700
> pid = 1, comm = swapper
> enter ? for help
> [c00000006ff82ed0] c0000000003848f4 .ata_port_flush_task+0x5c/0x12c
> [c00000006ff82f60] c000000000384c78 .ata_exec_internal+0x28c/0x458
> [c00000006ff83070] c000000000385070 .ata_dev_read_id+0x12c/0x2f8
> [c00000006ff83150] c000000000385bfc .ata_bus_probe+0x180/0x330
> [c00000006ff83210] c0000000003912ac .ata_sas_port_init+0x4c/0x6c
> [c00000006ff832a0] c0000000003675a4 .ipr_ata_slave_alloc+0x68/0xc0
> [c00000006ff83330] c000000000346750 .scsi_alloc_sdev+0x1d0/0x25c
> [c00000006ff833e0] c0000000003477c8 .scsi_probe_and_add_lun+0x110/0x2ec
> [c00000006ff834b0] c00000000034833c .__scsi_scan_target+0xd8/0x150
> [c00000006ff83560] c000000000348518 .scsi_scan_channel+0x7c/0xe0
> [c00000006ff83600] c000000000348648 .scsi_scan_host_selected+0xcc/0x13c
> [c00000006ff836a0] c00000000036e6dc .ipr_probe+0xe0/0x158
> [c00000006ff83740] c00000000024da10 .pci_call_probe+0x104/0x168
> [c00000006ff83800] c00000000024dad0 .__pci_device_probe+0x5c/0x8c
> [c00000006ff83880] c00000000024db38 .pci_device_probe+0x38/0x6c
> [c00000006ff83910] c0000000002be40c .really_probe+0x78/0x1a4
> [c00000006ff839b0] c0000000002be660 .driver_probe_device+0xfc/0x12c
> [c00000006ff83a50] c0000000002be818 .__driver_attach+0xa0/0x12c
> [c00000006ff83ae0] c0000000002bd240 .bus_for_each_dev+0x70/0xc0
> [c00000006ff83b90] c0000000002be8cc .driver_attach+0x28/0x40
> [c00000006ff83c10] c0000000002bdb7c .bus_add_driver+0x90/0x154
> [c00000006ff83cb0] c0000000002befcc .driver_register+0xa8/0xc4
> [c00000006ff83d30] c00000000024e06c .__pci_register_driver+0x88/0xc0
> [c00000006ff83db0] c0000000005c6a2c .ipr_init+0x34/0x4c
> [c00000006ff83e30] c00000000059fb20 .do_initcalls+0x9c/0x19c
> [c00000006ff83f00] c000000000009294 .init+0x94/0x1a8
> [c00000006ff83f90] c000000000025540 .kernel_thread+0x4c/0x68
> 
> 
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev


-- 
Brian King
eServer Storage I/O
IBM Linux Technology Center

^ permalink raw reply

* [PATCH 1/1]  PPC32 : Huge-page support for ppc440
From: Edi Shmueli @ 2006-11-06 23:21 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: linuxppc-embedded

From: Edi Shmueli edi@linux.vnet.ibm.com

This patch enables applications to exploit the PPC440 TLB support for 
huge-page mapping, to minimize TLB thrashing.
Applications with large memory footprint that exploit this support, 
experience minimal TLB misses, and boost in performance.
NAS benchmarks performed with this patch indicate hundreds of percent of 
improvement in performance for some application.
Known limitations: because each PMD covers 2MB of the process address 
space, the minimal huge-page size supported by this patch is 2M.

Signed-off-by: Edi Shmueli edi@linux.vnet.ibm.com
-----

Benchmarks and Implementation comments
======================================
Below is the NAS IS benchmark results, executing under Linux, with and 
without this huge-page mapping support.
IS Benchmark        4KB pages    16MB pages
==============================================
 Class        =    A                                A
 Size        =    8388608    8388608
 Iterations    =    10        10
 Time in seconds =    24.44        6.38
 Mop/s total    =    3.43         13.15
 Operation type    =    keys ranked         keys ranked
 Verification    =    SUCCESSFUL    SUCCESSFUL
Implementation details:
====================
This patch is ppc440 architecture-specific. It enables the use of 
huge-pages by processes executing under the 2.6.16 kernel on the ppc440 
processors.
Huge-pages are accessible to user processes using either the hugetlbfs 
or using shared memory. See Documentation/vs/hugetlbpage.txt.
This patch supports huge-pages of size 16MB and 256MB.
==
The ppc 32bit kernel uses 64bit PTEs (set by CONFIG_PTE_64BIT).
I exploit a "hole" of 4 unused bits in the PTE MS word (bits 24-27) and 
code the page size information in those bits.
I then modified the TLB miss handler (head_44x.S) to stop using the 
constant PPC44x_TLB_4K to set the page size in the TLB,
Instead, when a TLB miss happens, the miss handler reads the size 
information from the PTE and sets that size in the TLB entry.
This way, different TLB entries get to map different page sizes (e.g., 
4KB or 16MB).
The TLB replacement policy remains RR. This means that a huge-page entry 
in the TLB may be overwritten if not used for a long time, but when 
accessed it will be set again by the TLB miss handler, with the correct 
size, as set in the PTE.
==
In arch/ppc/mm/hugetlbpage.c is where page table entries are set to map 
huge pages:
By default , each process has two-level page-tables.
It has 2048, 32bit PMD (or PGD) entries at the higher-level, each maps 
2MB of the process address spase, and 512, 64bit PTE entries in each 
lower-level page table.
When a TLB miss happens and no PTE is found by the miss handler to offer 
the translation, a check is made (memory.c) on whether the faulting 
address belongs to a huge-page VM region.
If so, the code in set_huge_pte_at()  will set 8 PMD (8 x 2M=16MB, for 
the 16MB page case) entries. All will point to the *same* lower-level 
PTE page table.
It will also set all 512 PTEs in that page table to point to the *same* 
physical huge-page. All these PTEs will be *identical* and have 16MB 
size coded in their MS word as described above.
==
Once the TLB miss handler copies the mapping (and the size) from the PTE 
into on of the TLB entries, the process will not suffer any TLB misses 
for that huge-page.
If the mapping was overwritten by the TLB RR replacement policy, it will 
be re-loaded again (possibly in a different TLB entry) when the process 
re-access that huge-page.
Because all 8 PMDs point to the same PTE page-table, and all 512 PTEs 
point to the same physical address, it makes no difference where the 
process accesses that huge-page.
For any address in this huge-pages, the process will get the same 
translation in the TLB.



diff -uprP -X linux-2.6.16.29-vanilla/Documentation/dontdiff 
linux-2.6.16.29-vanilla/arch/ppc/kernel/head_44x.S 
my_linux/arch/ppc/kernel/head_44x.S
--- linux-2.6.16.29-vanilla/arch/ppc/kernel/head_44x.S    2006-09-12 
14:02:10.000000000 -0400
+++ my_linux/arch/ppc/kernel/head_44x.S    2006-11-06 17:43:46.575443395 
-0500
@@ -23,12 +23,14 @@
  *            debbie_chu@mvista.com
  *    Copyright 2002-2005 MontaVista Software, Inc.
  *      PowerPC 44x support, Matt Porter <mporter@kernel.crashing.org>
+ *    Copyright (C) 2006 Edi Shmueli, IBM Corporation.
+ *    PowerPC 44x handling of huge-page misses.
  *
  * 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 <linux/config.h>
 #include <asm/processor.h>
@@ -657,19 +659,22 @@ finish_tlb_load:
     lis    r11, tlb_44x_index@ha
     stw    r13, tlb_44x_index@l(r11)
 
-    lwz    r11, 0(r12)            /* Get MS word of PTE */
-    lwz    r12, 4(r12)            /* Get LS word of PTE */
-    rlwimi    r11, r12, 0, 0 , 19        /* Insert RPN */
-    tlbwe    r11, r13, PPC44x_TLB_XLAT    /* Write XLAT */
-
+    /*huge-page support*/
     /*
      * Create PAGEID. This is the faulting address,
      * page size, and valid flag.
-     */
-    li    r11, PPC44x_TLB_VALID | PPC44x_TLB_4K
-    rlwimi    r10, r11, 0, 20, 31        /* Insert valid and page size */
+    */
+    lwz    r11, 0(r12)            /* Get MS word of PTE */       
+    andi.   r11, r11, 0x000000F0        /* Leave only the size */
+    ori     r11, r11, PPC44x_TLB_VALID | PPC44x_TLB_4K /* Insert valid 
and page size */
+    rlwimi    r10, r11, 0, 20, 31        /* Combine EA from r10 with 
flags from r11 */
     tlbwe    r10, r13, PPC44x_TLB_PAGEID    /* Write PAGEID */
 
+    lwz    r11, 0(r12)            /* Get MS word of PTE */
+    lwz    r12, 4(r12)            /* Get LS word of PTE */
+    rlwimi    r11, r12, 0, 0 , 19        /* Insert RPN */
+    tlbwe    r11, r13, PPC44x_TLB_XLAT    /* Write XLAT */
+
     li    r10, PPC44x_TLB_SR@l        /* Set SR */
     rlwimi    r10, r12, 0, 30, 30        /* Set SW = _PAGE_RW */
     rlwimi    r10, r12, 29, 29, 29        /* SX = _PAGE_HWEXEC */
diff -uprP -X linux-2.6.16.29-vanilla/Documentation/dontdiff 
linux-2.6.16.29-vanilla/arch/ppc/mm/hugetlbpage.c 
my_linux/arch/ppc/mm/hugetlbpage.c
--- linux-2.6.16.29-vanilla/arch/ppc/mm/hugetlbpage.c    1969-12-31 
19:00:00.000000000 -0500
+++ my_linux/arch/ppc/mm/hugetlbpage.c    2006-11-06 17:50:51.714786630 
-0500
@@ -0,0 +1,186 @@
+/*
+ * PPC32 (440) Huge TLB Page Support for Kernel.
+ *
+ * Copyright (C) 2006 Edi Shmueli, IBM Corporation.
+ *
+ * Based on the IA-32 version:
+ * Copyright (C) 2002, Rohit Seth <rohit.seth@intel.com>
+ *
+ */
+
+#include <linux/config.h>
+#include <linux/init.h>
+#include <linux/fs.h>
+#include <linux/mm.h>
+#include <linux/hugetlb.h>
+#include <linux/pagemap.h>
+#include <linux/smp_lock.h>
+#include <linux/slab.h>
+#include <linux/err.h>
+#include <linux/sysctl.h>
+#include <asm/mman.h>
+#include <asm/tlb.h>
+#include <asm/tlbflush.h>
+
+pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr)
+{
+  pgd_t *pgd;
+  pud_t *pud;
+  pmd_t *pmd=NULL;
+  pte_t *ptep=NULL;
+
+  pgd = pgd_offset(mm, addr);
+
+  pud = pud_offset(pgd, addr);
+  if(!pud)
+    return NULL;
+
+  pmd = pmd_offset(pud, addr);
+  if(!pmd)
+    return NULL;
+
+  ptep = pte_offset_map(pmd, addr); /*also check pte_offset_map_lock()*/
+ 
+  return ptep;
+}
+
+pte_t *huge_pte_alloc(struct mm_struct *mm, unsigned long addr)
+{
+    pgd_t *pgd;
+    pud_t *pud;
+    pmd_t *pmd; //my
+    pte_t *pte = NULL;
+
+    pgd = pgd_offset(mm, addr);
+
+    pud = pud_alloc(mm, pgd, addr);
+    if (!pud)
+      return NULL;
+   
+    pmd = pmd_alloc(mm, pud, addr);
+    if (!pmd)
+      return NULL;
+
+    pte = pte_alloc_map(mm, pmd, addr); /* also sets pmd !!!*/
+    if (!pte)
+      return NULL;
+
+   
+    BUG_ON(pte && !pte_none(*pte) && !pte_huge(*pte));
+     
+    return pte;
+}
+
+#ifdef ARCH_HAS_SETCLEAR_HUGE_PTE
+void set_huge_pte_at(struct mm_struct *mm, unsigned long addr, pte_t 
*ptep, pte_t pte){
+  pgd_t *pgd;
+  pud_t *pud;
+  pmd_t *pmd;
+  pmd_t pmd_val;
+  int i;
+
+  /* For the cow case, we overwrite '*ptep' (which points to the orig 
huge-page) with 'pte' (which points to the new page). */
+  /* Cow is detected after the TLB exception handler has already wrote 
a TLB entry that points to the "orig" page but       */
+  /* this entry does not have the user write permission set (UW), so 
when the process tries the write, we get exception.    */
+  /* As we reach this call to overwrite the PTEs to point to the new 
huge-page, the TLB contains                            */
+  /* translation for the old huge-page. By invalidating the TLB, we 
ensure the TLB exception handler will re-fill           */
+  /* the entry from the updated page tables */
+  if (pte_present(*ptep)) {
+    flush_tlb_pending();
+  }
+
+  ptep = (pte_t *)((unsigned long)ptep & PAGE_MASK); /* point to base 
pte (idx=0) */
+ 
+  /* update all (512) pte entries, starting with ptep with value from 
pte */
+  for(i=0;i< ( 0x1 << PTE_SHIFT );i++){
+    set_pte_at(mm, addr, ptep, pte);
+    ptep++;
+  }
+
+  /* next, we set all pmd's that cover the huge-page to point to the 
above PTEs table. */
+  /* 'pmd' that mapps 'addr', was already set when hugetlb_fault() 
called huge_pte_alloc() */
+  /* we start by locating it... */
+  pgd = pgd_offset(mm, addr);
+  pud = pud_offset(pgd, addr);
+  pmd = pmd_offset(pud, addr); /*this pmd already points to the PTEs 
table. It was set be the call to huge_pte_alloc()  */
+  pmd_val=*pmd;
+
+  /* find the first pmd that mapps the huge page  */
+  addr=addr & HPAGE_MASK;
+  pgd = pgd_offset(mm, addr);
+  pud = pud_offset(pgd, addr);
+  pmd = pmd_offset(pud, addr);
+  
+  for(i=0;i< (HPAGE_SIZE >> PMD_SHIFT);i++){
+    *pmd=pmd_val;
+    pmd++;
+  }
+}
+
+pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, 
pte_t *ptep){
+  pgd_t *pgd;
+  pud_t *pud;
+  pmd_t *pmd;
+  pte_t pte;
+  int i;
+  pmd_t pmd_val;
+
+  BUG_ON( (unsigned long)ptep & ~PAGE_MASK ); /* make sure ptep point 
to index 0 in the PTE table */
+
+  /*Clean all (512) pte's in this page-table, starting with ptep */
+  for(i=0;i< ( 0x1 << PTE_SHIFT );i++){
+    pte=ptep_get_and_clear(mm, addr, ptep);
+    ptep++;
+  }
+
+  addr=addr & HPAGE_MASK; /* point to the base of the huge-page that 
contains addr */
+  pgd = pgd_offset(mm, addr);
+  pud = pud_offset(pgd, addr);
+  pmd = pmd_offset(pud, addr);
+
+  pmd_val=*pmd; //this is the first pmd that mappes the huge page;
+
+  pmd++; /* leave it... page cache will delete it */
+ 
+  for(i=1;i< (HPAGE_SIZE >> PMD_SHIFT);i++){
+    pmd_clear(pmd);
+    pmd++;
+  }
+
+  return pte; /*all pte's are the same, except maybe dirty bit*/
+}
+#endif
+
+int is_aligned_hugepage_range(unsigned long addr, unsigned long len)
+{
+  if (len & ~HPAGE_MASK)
+    return -EINVAL;
+  if (addr & ~HPAGE_MASK)
+    return -EINVAL;
+  return 0;
+}
+
+struct page *
+follow_huge_addr(struct mm_struct *mm, unsigned long address, int write)
+{
+  pte_t *pte;
+  struct page *page;
+
+  pte = huge_pte_offset(mm, address);
+  page = pte_page(*pte);
+  return page;
+}
+
+int pmd_huge(pmd_t pmd)
+{
+  return 0;
+}
+
+struct page *
+follow_huge_pmd(struct mm_struct *mm, unsigned long address,
+        pmd_t *pmd, int write)
+{
+   return NULL;
+}
+
+
diff -uprP -X linux-2.6.16.29-vanilla/Documentation/dontdiff 
linux-2.6.16.29-vanilla/arch/ppc/mm/Makefile my_linux/arch/ppc/mm/Makefile
--- linux-2.6.16.29-vanilla/arch/ppc/mm/Makefile    2006-09-12 
14:02:10.000000000 -0400
+++ my_linux/arch/ppc/mm/Makefile    2006-11-06 09:52:41.000000000 -0500
@@ -9,3 +9,4 @@ obj-$(CONFIG_PPC_STD_MMU)    += hashtable.o
 obj-$(CONFIG_40x)        += 4xx_mmu.o
 obj-$(CONFIG_44x)        += 44x_mmu.o
 obj-$(CONFIG_FSL_BOOKE)        += fsl_booke_mmu.o
+obj-$(CONFIG_HUGETLB_PAGE)      += hugetlbpage.o
diff -uprP -X linux-2.6.16.29-vanilla/Documentation/dontdiff 
linux-2.6.16.29-vanilla/fs/Kconfig my_linux/fs/Kconfig
--- linux-2.6.16.29-vanilla/fs/Kconfig    2006-09-12 14:02:10.000000000 
-0400
+++ my_linux/fs/Kconfig    2006-08-21 12:54:46.000000000 -0400
@@ -840,7 +840,7 @@ config TMPFS
 
 config HUGETLBFS
     bool "HugeTLB file system support"
-    depends X86 || IA64 || PPC64 || SPARC64 || SUPERH || BROKEN
+    depends X86 || IA64 || PPC || PPC64 || SPARC64 || SUPERH || BROKEN
 
 config HUGETLB_PAGE
     def_bool HUGETLBFS
diff -uprP -X linux-2.6.16.29-vanilla/Documentation/dontdiff 
linux-2.6.16.29-vanilla/include/asm-ppc/page.h 
my_linux/include/asm-ppc/page.h
--- linux-2.6.16.29-vanilla/include/asm-ppc/page.h    2006-09-12 
14:02:10.000000000 -0400
+++ my_linux/include/asm-ppc/page.h    2006-09-07 15:55:55.000000000 -0400
@@ -8,6 +8,12 @@
 #define PAGE_SHIFT    12
 #define PAGE_SIZE    (ASM_CONST(1) << PAGE_SHIFT)
 
+#ifdef CONFIG_HUGETLB_PAGE
+#define HPAGE_SHIFT     24
+#define HPAGE_SIZE      ((1UL) << HPAGE_SHIFT)
+#define HPAGE_MASK      (~(HPAGE_SIZE - 1))
+#define HUGETLB_PAGE_ORDER      (HPAGE_SHIFT - PAGE_SHIFT)
+#endif
 /*
  * Subtle: this is an int (not an unsigned long) and so it
  * gets extended to 64 bits the way want (i.e. with 1s).  -- paulus
diff -uprP -X linux-2.6.16.29-vanilla/Documentation/dontdiff 
linux-2.6.16.29-vanilla/include/asm-ppc/pgtable.h 
my_linux/include/asm-ppc/pgtable.h
--- linux-2.6.16.29-vanilla/include/asm-ppc/pgtable.h    2006-09-12 
14:02:10.000000000 -0400
+++ my_linux/include/asm-ppc/pgtable.h    2006-09-19 17:47:45.000000000 
-0400
@@ -264,6 +264,24 @@ extern unsigned long ioremap_bot, iorema
 #define    _PAGE_NO_CACHE    0x00000400        /* H: I bit */
 #define    _PAGE_WRITETHRU    0x00000800        /* H: W bit */
 
+#if   HPAGE_SHIFT == 10
+#define _PAGE_HUGE      0x0000000000000000ULL   /* H: SIZE=1K bytes */
+#elif HPAGE_SHIFT == 12
+#define _PAGE_HUGE      0x0000001000000000ULL   /* H: SIZE=4K bytes */
+#elif HPAGE_SHIFT == 14
+#define _PAGE_HUGE      0x0000002000000000ULL   /* H: SIZE=16K bytes */
+#elif HPAGE_SHIFT == 16
+#define _PAGE_HUGE      0x0000003000000000ULL   /* H: SIZE=64K bytes */
+#elif HPAGE_SHIFT == 18
+#define _PAGE_HUGE      0x0000004000000000ULL   /* H: SIZE=256K bytes */
+#elif HPAGE_SHIFT == 20
+#define _PAGE_HUGE      0x0000005000000000ULL   /* H: SIZE=1M bytes */
+#elif HPAGE_SHIFT == 24
+#define _PAGE_HUGE      0x0000007000000000ULL   /* H: SIZE=16M bytes */
+#elif HPAGE_SHIFT == 28
+#define _PAGE_HUGE      0x0000009000000000ULL   /* H: SIZE=256M bytes */
+#endif
+
 /* TODO: Add large page lowmem mapping support */
 #define _PMD_PRESENT    0
 #define _PMD_PRESENT_MASK (PAGE_MASK)
@@ -491,7 +509,12 @@ extern unsigned long bad_call_to_PMD_PAG
 #define PFN_SHIFT_OFFSET    (PAGE_SHIFT)
 #endif
 
-#define pte_pfn(x)        (pte_val(x) >> PFN_SHIFT_OFFSET)
+/*                                                                                    
v             */
+/* huge-page fix:  since now the PTE (MS) contains the size of the page 
e.g., 0x0000007000000000ULL */
+/* which was once assumed to be 0, we must zero it, otherwise we get 
extreamly huge (and wrong) pfn */
+//#define pte_pfn(x)        ( pte_val(x) >> PFN_SHIFT_OFFSET )
+#define pte_pfn(x)        ( ( pte_val(x) & 0x0000000fffffffffULL ) >> 
PFN_SHIFT_OFFSET )
+
 #define pte_page(x)        pfn_to_page(pte_pfn(x))
 
 #define pfn_pte(pfn, prot)    __pte(((pte_basic_t)(pfn) << 
PFN_SHIFT_OFFSET) |\
@@ -540,6 +563,7 @@ static inline int pte_exec(pte_t pte)        {
 static inline int pte_dirty(pte_t pte)        { return pte_val(pte) & 
_PAGE_DIRTY; }
 static inline int pte_young(pte_t pte)        { return pte_val(pte) & 
_PAGE_ACCESSED; }
 static inline int pte_file(pte_t pte)        { return pte_val(pte) & 
_PAGE_FILE; }
+static inline int pte_huge(pte_t pte)           { return (pte_val(pte) 
& _PAGE_HUGE)?1:0; }
 
 static inline void pte_uncache(pte_t pte)       { pte_val(pte) |= 
_PAGE_NO_CACHE; }
 static inline void pte_cache(pte_t pte)         { pte_val(pte) &= 
~_PAGE_NO_CACHE; }
@@ -565,6 +589,8 @@ static inline pte_t pte_mkdirty(pte_t pt
     pte_val(pte) |= _PAGE_DIRTY; return pte; }
 static inline pte_t pte_mkyoung(pte_t pte) {
     pte_val(pte) |= _PAGE_ACCESSED; return pte; }
+static inline pte_t pte_mkhuge(pte_t pte) {
+        pte_val(pte) |= _PAGE_HUGE; return pte; }
 
 static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
 {
diff -uprP -X linux-2.6.16.29-vanilla/Documentation/dontdiff 
linux-2.6.16.29-vanilla/include/linux/hugetlb.h 
my_linux/include/linux/hugetlb.h
--- linux-2.6.16.29-vanilla/include/linux/hugetlb.h    2006-09-12 
14:02:10.000000000 -0400
+++ my_linux/include/linux/hugetlb.h    2006-09-07 15:55:07.000000000 -0400
@@ -2,6 +2,7 @@
 #define _LINUX_HUGETLB_H
 
 #ifdef CONFIG_HUGETLB_PAGE
+#define ARCH_HAS_SETCLEAR_HUGE_PTE
 
 #include <linux/mempolicy.h>
 #include <asm/tlbflush.h>
diff -uprP -X linux-2.6.16.29-vanilla/Documentation/dontdiff 
linux-2.6.16.29-vanilla/include/linux/mmzone.h 
my_linux/include/linux/mmzone.h
--- linux-2.6.16.29-vanilla/include/linux/mmzone.h    2006-09-12 
14:02:10.000000000 -0400
+++ my_linux/include/linux/mmzone.h    2006-08-22 15:26:28.000000000 -0400
@@ -17,7 +17,7 @@
 
 /* Free memory management - zoned buddy allocator.  */
 #ifndef CONFIG_FORCE_MAX_ZONEORDER
-#define MAX_ORDER 11
+#define MAX_ORDER 13
 #else
 #define MAX_ORDER CONFIG_FORCE_MAX_ZONEORDER
 #endif

^ permalink raw reply

* Re: [PATCH] powerpc: Add Efika platform support
From: Benjamin Herrenschmidt @ 2006-11-06 23:19 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linuxppc-dev, linuxppc-embedded, sl, Paul Mackerras
In-Reply-To: <20061106144648.801c9441.akpm@osdl.org>

On Mon, 2006-11-06 at 14:46 -0800, Andrew Morton wrote:
> On Sun, 5 Nov 2006 12:57:16 +0100 (MET)
> Nicolas DET <nd@bplan-gmbh.de> wrote:
> 
> > Add Efika (http://www.bplan-gmbh.de/efika_spec_en.html) platform support for arch/powerpc
> 
> Who (if anyone) is the maintainer for this sort of thing?

It's powerpc, it will go through paulus tree I suppose. You can host
them in -mm if you like until the merge window.

In the specific case of Efika, I'm doing the ACK'ing/NACK'ing of the
patches. At this point, the platform patch and interrupt patches are
good to go.

Cheers,
Ben.

^ permalink raw reply

* [PATCH] of_irq_to_resource now returns the virq
From: Andy Fleming @ 2006-11-06 23:13 UTC (permalink / raw)
  To: linuxppc-dev


Mostly this is to allow for error checking (check the return for NO_IRQ)

Signed-off-by: Andrew Fleming <afleming@freescale.com>
---
For 2.6.20

 include/asm-powerpc/prom.h |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/include/asm-powerpc/prom.h b/include/asm-powerpc/prom.h
index 933ba27..e9226e3 100644
--- a/include/asm-powerpc/prom.h
+++ b/include/asm-powerpc/prom.h
@@ -334,10 +334,17 @@ extern int of_irq_map_one(struct device_
 struct pci_dev;
 extern int of_irq_map_pci(struct pci_dev *pdev, struct of_irq *out_irq);
 
-static inline void of_irq_to_resource(struct device_node *dev, int index, struct resource *r)
+static inline int of_irq_to_resource(struct device_node *dev, int index, struct resource *r)
 {
-	r->start = r->end = irq_of_parse_and_map(dev, index);
-	r->flags = IORESOURCE_IRQ;
+	int irq = irq_of_parse_and_map(dev, index);
+
+	/* Only dereference the resource if the irq is valid. */
+	if (irq != NO_IRQ) {
+		r->start = r->end = irq;
+		r->flags = IORESOURCE_IRQ;
+	}
+
+	return irq;
 }
 
 
-- 
1.4.2.3

^ permalink raw reply related

* Re: [PATCH] powerpc: Add of_platform support for OHCI/Bigendian HC
From: Benjamin Herrenschmidt @ 2006-11-06 22:55 UTC (permalink / raw)
  To: Nicolas DET; +Cc: linuxppc-dev, linuxppc-embedded
In-Reply-To: <200611061101.kA6B1qWe002251@post.webmailer.de>

On Mon, 2006-11-06 at 12:01 +0100, Nicolas DET wrote:
> This patch use of_platform device to probe and install OHCI big endian HC.
> 
> PS: I did not success to properly inline the file using thrunderbird.

It looks ok to me, inlined and all... make sure you use the "Preformat"
style in thunderbird.

Ben.

> Signed-off-by: Nicolas DET <nd@bplan-gmbh.de> 
> ---
> --- a/drivers/usb/host/ohci-ppc-of.c	1970-01-01 01:00:00.000000000 +0100
> +++ b/drivers/usb/host/ohci-ppc-of.c	2006-11-06 11:10:29.000000000 +0100
> @@ -0,0 +1,283 @@
> +/*
> + * OHCI HCD (Host Controller Driver) for USB.
> + *
> + * (C) Copyright 1999 Roman Weissgaerber <weissg@vienna.at>
> + * (C) Copyright 2000-2002 David Brownell <dbrownell@users.sourceforge.net>
> + * (C) Copyright 2002 Hewlett-Packard Company
> + * (C) Copyright 2003-2005 MontaVista Software Inc.
> + * 
> + * Probe and init OHCI Big endian HC from OpenFirmware device tree
> + * Tested on Efika 5k2
> + *
> + * Modified by Dale Farnsworth <dale@farnsworth.org> from ohci-sa1111.c
> + *
> + * This file is licenced under the GPL.
> + */
> +
> +#include <linux/signal.h>
> +
> +#include <asm/of_device.h>
> +#include <asm/prom.h>
> +
> +/* configure so an HC device and id are always provided */
> +/* always called with process context; sleeping is OK */
> +
> +/*
> + * usb_hcd_ppc_of_probe - initialize On-Chip HCDs
> + * Context: !in_interrupt()
> + *
> + * Allocates basic resources for this USB host controller.
> + *
> + * Store this function in the HCD's struct pci_driver as probe().
> + */
> +static int usb_hcd_ppc_of_probe(const struct hc_driver *driver,
> +			  struct of_device *dev, int is_bigendian)
> +{
> +	int retval;
> +	struct usb_hcd *hcd;
> +	struct ohci_hcd	*ohci;
> +	struct resource res;
> +	int irq;
> +	int ret;
> +
> +	pr_debug("initializing PPC-OF USB Controller\n");
> +
> +	if ((ret = of_address_to_resource(dev->node, 0, &res)) != 0)
> +		return ret;
> +
> +	hcd = usb_create_hcd(driver, &dev->dev, "PPC-OF USB");
> +	if (!hcd)
> +		return -ENOMEM;
> +
> +	hcd->rsrc_start = res.start;
> +	hcd->rsrc_len = res.end - res.start + 1;
> +
> +	if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) {
> +		pr_debug(__FILE__ ": request_mem_region failed\n");
> +		retval = -EBUSY;
> +		goto err1;
> +	}
> +
> +	irq = irq_of_parse_and_map(dev->node, 0);
> +	if (irq == NO_IRQ) {
> +		retval = -EBUSY;
> +		goto err2;
> +	}
> +
> +	hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len);
> +	if (!hcd->regs) {
> +		pr_debug(__FILE__ ": ioremap failed\n");
> +		retval = -ENOMEM;
> +		goto err2;
> +	}
> +
> +	ohci = hcd_to_ohci(hcd);
> +	if (is_bigendian)
> +		ohci->flags |= OHCI_BIG_ENDIAN;
> +
> +	ohci_hcd_init(ohci);
> +
> +	retval = usb_add_hcd(hcd, irq, 0);
> +	if (retval == 0)
> +		return retval;
> +
> +	pr_debug("Removing PPC-OF USB Controller\n");
> +
> +	iounmap(hcd->regs);
> + err2:
> +	release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
> + err1:
> + 	usb_put_hcd(hcd);
> +	return retval;
> +}
> +
> +
> +/* may be called without controller electrically present */
> +/* may be called with controller, bus, and devices active */
> +
> +/*
> + * usb_hcd_ppc_of_remove - shutdown processing for On-Chip HCDs
> + * @pdev: USB Host Controller being removed
> + * Context: !in_interrupt()
> + *
> + * Reverses the effect of usb_hcd_ppc_of_probe().
> + * It is always called from a thread
> + * context, normally "rmmod", "apmd", or something similar.
> + *
> + */
> +static void usb_hcd_ppc_of_remove(struct usb_hcd *hcd,
> +		struct of_device *op)
> +{
> +	usb_remove_hcd(hcd);
> +
> +	pr_debug("stopping PPC-OF USB Controller\n");
> +
> +	iounmap(hcd->regs);
> +	release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
> +	usb_put_hcd(hcd);
> +}
> +
> +static int __devinit
> +ohci_ppc_of_start(struct usb_hcd *hcd)
> +{
> +	struct ohci_hcd	*ohci = hcd_to_ohci(hcd);
> +	int		ret;
> +
> +	if ((ret = ohci_init(ohci)) < 0)
> +		return ret;
> +
> +	if ((ret = ohci_run(ohci)) < 0) {
> +		err("can't start %s", ohci_to_hcd(ohci)->self.bus_name);
> +		ohci_stop(hcd);
> +		return ret;
> +	}
> +
> +	return 0;
> +}
> +
> +static const struct hc_driver ohci_ppc_of_hc_driver = {
> +	.description =		hcd_name,
> +	.hcd_priv_size =	sizeof(struct ohci_hcd),
> +
> +	/*
> +	 * generic hardware linkage
> +	 */
> +	.irq =			ohci_irq,
> +	.flags =		HCD_USB11 | HCD_MEMORY,
> +
> +	/*
> +	 * basic lifecycle operations
> +	 */
> +	.start =		ohci_ppc_of_start,
> +	.stop =			ohci_stop,
> +	.shutdown = 		ohci_shutdown,
> +
> +	/*
> +	 * managing i/o requests and associated device resources
> +	 */
> +	.urb_enqueue =		ohci_urb_enqueue,
> +	.urb_dequeue =		ohci_urb_dequeue,
> +	.endpoint_disable =	ohci_endpoint_disable,
> +
> +	/*
> +	 * scheduling support
> +	 */
> +	.get_frame_number =	ohci_get_frame,
> +
> +	/*
> +	 * root hub support
> +	 */
> +	.hub_status_data =	ohci_hub_status_data,
> +	.hub_control =		ohci_hub_control,
> +	.hub_irq_enable =	ohci_rhsc_enable,
> +#ifdef	CONFIG_PM
> +	.bus_suspend =		ohci_bus_suspend,
> +	.bus_resume =		ohci_bus_resume,
> +#endif
> +	.start_port_reset =	ohci_start_port_reset,
> +};
> +
> +
> +
> +static int ohci_hcd_ppc_of_drv_remove(struct of_device *op)
> +{
> +	struct usb_hcd *hcd = dev_get_drvdata(&op->dev);
> +	dev_set_drvdata(&op->dev, NULL);
> +
> +	usb_hcd_ppc_of_remove(hcd, op);
> +	return 0;
> +}
> +
> +static int ohci_hcd_ppc_of_drv_shutdown(struct of_device *op)
> +{
> +	struct usb_hcd *hcd = dev_get_drvdata(&op->dev);
> +
> +        if (hcd->driver->shutdown)
> +                hcd->driver->shutdown(hcd);
> +
> +	return 0;
> +}
> +
> +/*
> + *
> +*/
> +
> +static struct of_device_id ohci_hcd_ppc_of_match[] = {
> +#ifdef CONFIG_USB_OHCI_HCD_PPC_OF_BE
> +	{
> +		.name = "usb",
> +		.compatible = "ohci-bigendian",
> +	},
> +	{
> +		.name = "usb",
> +		.compatible = "ohci-be",
> +	},
> +#endif
> +#ifdef CONFIG_USB_OHCI_HCD_PPC_OF_LE
> +	{
> +		.name = "usb",
> +		.compatible = "ohci-littledian",
> +	},
> +	{
> +		.name = "usb",
> +		.compatible = "ohci-le",
> +	},
> +#endif
> +	{},
> +};
> +
> +static int __devinit
> +ohci_hcd_ppc_of_drv_probe(struct of_device *op, const struct of_device_id *match)
> +{
> +	struct device_node *dev;
> +	int ret;
> +	int is_bigendian;
> +
> +	if (usb_disabled())
> +		return -ENODEV;
> +
> +	dev = op->node;
> +	is_bigendian = 0;
> +
> +	if ( device_is_compatible(dev, "ohci-bigendian") )
> +		is_bigendian = 1;
> +
> +	if ( device_is_compatible(dev, "ohci-be") )
> +		is_bigendian = 1;	
> +
> +	ret = usb_hcd_ppc_of_probe(&ohci_ppc_of_hc_driver, op, is_bigendian);
> +	return ret;
> +}
> +
> +static struct of_platform_driver ohci_hcd_ppc_of_driver = {
> +	.name	= "ppc-of-ohci",
> +	.match_table	= ohci_hcd_ppc_of_match,
> +	.probe		= ohci_hcd_ppc_of_drv_probe,
> +	.remove		= ohci_hcd_ppc_of_drv_remove,
> +	.shutdown 	= ohci_hcd_ppc_of_drv_shutdown,
> +#ifdef	CONFIG_PM
> +	/*.suspend	= ohci_hcd_ppc_soc_drv_suspend,*/
> +	/*.resume	= ohci_hcd_ppc_soc_drv_resume,*/
> +#endif
> +	.driver		= {
> +		.name	= "ppc-of-ohci",
> +		.owner	= THIS_MODULE,
> +	},
> +};
> +
> +static int __init ohci_hcd_ppc_of_init(void)
> +{
> +	pr_debug(DRIVER_INFO " (PPC OF)\n");
> +	pr_debug("block sizes: ed %d td %d\n", sizeof(struct ed),
> +							sizeof(struct td));
> +	
> +	return of_register_driver(&ohci_hcd_ppc_of_driver);    
> +}
> +
> +static void __exit ohci_hcd_ppc_of_cleanup(void)
> +{
> +	of_unregister_driver(&ohci_hcd_ppc_of_driver);
> +}
> +
> +module_init(ohci_hcd_ppc_of_init);
> +module_exit(ohci_hcd_ppc_of_cleanup);
> --- a/drivers/usb/host/Kconfig	2006-11-01 09:18:56.000000000 +0100
> +++ b/drivers/usb/host/Kconfig	2006-11-06 11:10:29.000000000 +0100
> @@ -106,6 +106,25 @@ config USB_OHCI_HCD_PPC_SOC
>  	  Enables support for the USB controller on the MPC52xx or
>  	  STB03xxx processor chip.  If unsure, say Y.
>  
> +config USB_OHCI_HCD_PPC_OF
> +	bool "OHCI support for PPC USB controller for OpenFirmware platform"
> +	depends on USB_OHCI_HCD && PPC_OF
> +	default y
> +	---help---
> +	  Enables support for the USB controller PowerPC OpenFirmware platform
> +
> +config USB_OHCI_HCD_PPC_OF_BE
> +	bool "Support big endian HC"
> +	depends on USB_OHCI_HCD_PPC_OF
> +	default y
> +	select USB_OHCI_BIG_ENDIAN
> +
> +config USB_OHCI_HCD_PPC_OF_LE
> +	bool "Support little endian HC"
> +	depends on USB_OHCI_HCD_PPC_OF
> +	default n
> +	select USB_OHCI_LITTLE_ENDIAN
> +
>  config USB_OHCI_HCD_PCI
>  	bool "OHCI support for PCI-bus USB controllers"
>  	depends on USB_OHCI_HCD && PCI && (STB03xxx || PPC_MPC52xx)
> --- a/drivers/usb/host/ohci-hcd.c	2006-11-01 09:18:56.000000000 +0100
> +++ b/drivers/usb/host/ohci-hcd.c	2006-11-06 11:10:29.000000000 +0100
> @@ -930,6 +930,10 @@ MODULE_LICENSE ("GPL");
>  #include "ohci-ppc-soc.c"
>  #endif
>  
> +#ifdef CONFIG_USB_OHCI_HCD_PPC_OF
> +#include "ohci-ppc-of.c"
> +#endif
> +
>  #if defined(CONFIG_ARCH_AT91RM9200) || defined(CONFIG_ARCH_AT91SAM9261)
>  #include "ohci-at91.c"
>  #endif
> @@ -950,6 +954,8 @@ MODULE_LICENSE ("GPL");
>        || defined (CONFIG_ARCH_AT91RM9200) \
>        || defined (CONFIG_ARCH_AT91SAM9261) \
>        || defined (CONFIG_ARCH_PNX4008) \
> +      || defined (CONFIG_USB_OHCI_HCD_PPC_OF_LE) \
> +      || defined (CONFIG_USB_OHCI_HCD_PPC_OF_BE) \
>  	)
>  #error "missing bus glue for ohci-hcd"
>  #endif
> 
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev

^ permalink raw reply

* Re: [PATCH] powerpc: Add Efika platform support
From: Andrew Morton @ 2006-11-06 22:46 UTC (permalink / raw)
  To: Nicolas DET; +Cc: linuxppc-dev, sl, Paul Mackerras, linuxppc-embedded
In-Reply-To: <20061105111118.ccffccfe.nd@bplan-gmbh.de>

On Sun, 5 Nov 2006 12:57:16 +0100 (MET)
Nicolas DET <nd@bplan-gmbh.de> wrote:

> Add Efika (http://www.bplan-gmbh.de/efika_spec_en.html) platform support for arch/powerpc

Who (if anyone) is the maintainer for this sort of thing?

Thanks.

^ permalink raw reply

* Re: [RFC] Fix for interrupt distribution
From: Nathan Lynch @ 2006-11-06 22:46 UTC (permalink / raw)
  To: Mohan Kumar M; +Cc: linuxppc-dev, fastboot, anton
In-Reply-To: <20061031110515.GB7884@in.ibm.com>

Mohan Kumar M wrote:
>
> Index: linux-2.6.19-rc3/arch/powerpc/platforms/pseries/xics.c
> ===================================================================
> --- linux-2.6.19-rc3.orig/arch/powerpc/platforms/pseries/xics.c
> +++ linux-2.6.19-rc3/arch/powerpc/platforms/pseries/xics.c
> @@ -658,7 +658,7 @@ static void __init xics_setup_8259_casca
>  
>  void __init xics_init_IRQ(void)
>  {
> -	int i;
> +	int i, j;
>  	struct device_node *np;
>  	u32 ilen, indx = 0;
>  	const u32 *ireg;
> @@ -686,23 +686,23 @@ void __init xics_init_IRQ(void)
>  	for (np = of_find_node_by_type(NULL, "cpu");
>  	     np;
>  	     np = of_find_node_by_type(np, "cpu")) {
> -		ireg = get_property(np, "reg", &ilen);
> -		if (ireg && ireg[0] == get_hard_smp_processor_id(boot_cpuid)) {
> -			ireg = get_property(np,
> -					"ibm,ppc-interrupt-gserver#s", &ilen);
> -			i = ilen / sizeof(int);
> -			if (ireg && i > 0) {
> -				default_server = ireg[0];
> -				/* take last element */
> -				default_distrib_server = ireg[i-1];
> -			}
> -			ireg = get_property(np,
> +		ireg = get_property(np, "ibm,ppc-interrupt-gserver#s", &ilen);
> +		i = ilen / sizeof(int);
> +		for (j = 0; ireg[j] && j < i; j+=2) {
                            ^^^^^^
I don't understand this condition in the loop -- zero is a valid (and
common) value for interrupt servers:

# xxd /proc/device-tree/cpus/PowerPC,POWER5@0/ibm,ppc-interrupt-server#s
0000000: 0000 0000 0000 0001

# xxd /proc/device-tree/cpus/PowerPC,POWER5@0/ibm,ppc-interrupt-gserver#s
0000000: 0000 0000 0000 00ff 0000 0001 0000 00ff

So I think this patch wouldn't always work.

> +			if (ireg[j] == get_hard_smp_processor_id(boot_cpuid)) {
> +				if ( j + 1 < i) {
> +					default_server = ireg[j];
> +					default_distrib_server = ireg[j+1];
> +				}
> +				ireg = get_property(np,
>  					"ibm,interrupt-server#-size", NULL);
> -			if (ireg)
> -				interrupt_server_size = *ireg;
> -			break;
> +				if (ireg)
> +					interrupt_server_size = *ireg;
> +				goto out;
> +			}
>  		}
>  	}
> +out:
>  	of_node_put(np);


I think we need a helper function or two to make this easier to do
correctly and readably, e.g.

/* Returns the device node (with refcount incremented)
 * corresponding to the given logical cpu id */
struct device_node * cpuid_to_of_node(int cpu) {
	struct device_node *np;
	u32 hcpuid = get_hard_smp_processor_id(cpu);

	for_each_node_by_type(np, "cpu") {
		int len, i;
		u32 *intserv = get_property(np,
				"ibm,ppc-interrupt-server#s", &len);

		if (!intserv)
			intserv = get_property(np, "reg", &len);

		i = len / sizeof(u32);

		while (i--)
			if (intserv[i] == hcpuid)
				return np;
	}
	return NULL;
}


And then the loop in xics_init_IRQ can be replaced with something like:

np = cpuid_to_of_node(boot_cpuid);
BUG_ON(!np);
ireg = get_property(np, "ibm,ppc-interrupt-gserver#s", &ilen);
hcpuid = get_hard_smp_processor_id(boot_cpuid);

if (ireg[0] == hcpuid)
	default_distrib_server = ireg[1];
else
	default_distrib_server = ireg[3];

default_server = hcpuid;

...

^ permalink raw reply

* Re: [Fwd: [Bug 7431] New: ohci1394 Oops after a rmmod/modprobe cycle]
From: Benjamin Herrenschmidt @ 2006-11-06 22:19 UTC (permalink / raw)
  To: Olaf Hering; +Cc: linuxppc-dev, Gioele Barabucci, Stefan Richter
In-Reply-To: <20061106165752.GA25595@aepfle.de>

On Mon, 2006-11-06 at 17:58 +0100, Olaf Hering wrote:
> On Sun, Nov 05, Stefan Richter wrote:
> 
> > Yes, PowerBook G3 Pismo seems affected.
> > https://bugzilla.novell.com/show_bug.cgi?id=115228
> 
> This patch does not help. Doing an ip link set dev eth0 up makes no
> difference.

What about trying to add a delay between the pmac clock code and the
init of the controller ? does that help ?

(You need to have a cable plug and the interface up for the power
management bits not to get in the way btw)

Ben.

^ permalink raw reply

* Re: [PATCH] PowerPC: remove broken vsyscall code
From: Benjamin Herrenschmidt @ 2006-11-06 22:18 UTC (permalink / raw)
  To: john stultz; +Cc: linuxppc-dev, tglx, greg.weeks
In-Reply-To: <1162850967.29826.62.camel@localhost>

On Mon, 2006-11-06 at 14:09 -0800, john stultz wrote:
> On Tue, 2006-11-07 at 08:46 +1100, Benjamin Herrenschmidt wrote:
> > On Mon, 2006-11-06 at 23:59 +0300, Sergei Shtylyov wrote:
> > > Remove vsyscalls that were broken by the PowerPC generic TOD patch, also
> > > fixing the build breakage due to its bad rebase.
> > > 
> > > The patch has been tested on PPC32 only. I had to preserve the data that
> > > are made visible to userland via /proc/ppc64/systemcfg on PPC64, however
> > > now there are only zeroes there and their affect isn't known to me...
> > > 
> > > Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
> > 
> > There is simply no way this will happen !
> 
> I believe this is just a short-term fix so the ppc tod/rt code can be
> tested. I do plan on getting the ppc vsyscall working before we push any
> ppc tod changes to mainline.

Ok.

Ben.

^ permalink raw reply

* Re: [PATCH] PowerPC: remove broken vsyscall code
From: john stultz @ 2006-11-06 22:09 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, tglx, greg.weeks
In-Reply-To: <1162849587.28571.356.camel@localhost.localdomain>

On Tue, 2006-11-07 at 08:46 +1100, Benjamin Herrenschmidt wrote:
> On Mon, 2006-11-06 at 23:59 +0300, Sergei Shtylyov wrote:
> > Remove vsyscalls that were broken by the PowerPC generic TOD patch, also
> > fixing the build breakage due to its bad rebase.
> > 
> > The patch has been tested on PPC32 only. I had to preserve the data that
> > are made visible to userland via /proc/ppc64/systemcfg on PPC64, however
> > now there are only zeroes there and their affect isn't known to me...
> > 
> > Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
> 
> There is simply no way this will happen !

I believe this is just a short-term fix so the ppc tod/rt code can be
tested. I do plan on getting the ppc vsyscall working before we push any
ppc tod changes to mainline.

thanks
-john

^ permalink raw reply

* Re: [PATCH] PowerPC: remove broken vsyscall code
From: Benjamin Herrenschmidt @ 2006-11-06 21:46 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: johnstul, tglx, greg.weeks, linuxppc-dev
In-Reply-To: <200611062359.10404.sshtylyov@ru.mvista.com>

On Mon, 2006-11-06 at 23:59 +0300, Sergei Shtylyov wrote:
> Remove vsyscalls that were broken by the PowerPC generic TOD patch, also
> fixing the build breakage due to its bad rebase.
> 
> The patch has been tested on PPC32 only. I had to preserve the data that
> are made visible to userland via /proc/ppc64/systemcfg on PPC64, however
> now there are only zeroes there and their affect isn't known to me...
> 
> Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>

There is simply no way this will happen !

Ben.

^ permalink raw reply

* Re: Booting without Uboot on 8548E
From: Benjamin Herrenschmidt @ 2006-11-06 21:38 UTC (permalink / raw)
  To: Andy Fleming; +Cc: M Ptich, linuxppc-dev
In-Reply-To: <C508D5D4-125D-47FD-81D2-2DE6545A240F@freescale.com>


> But moving to arch/powerpc (while a good idea) is not going to solve  
> your problems.  There are bound to be a large number of things the  
> kernel expects to have done for it by the firmware.  In arch/powerpc,  
> the 8548 kernel expects PCI to be set up, for instance (We plan to  
> fix that, but it involves porting some code that only exists in arch/ 
> ppc).

I hope you don't mean porting pci-auto over :)

While It was good to have back then, we should really fix out PCI layer
to properly assign unassigned devices itself.

There is much work to do to cleanup ppc32, ppc64 and core PCI so they
can deal with all the various setups around, but it's probably a
worthwhile goal.

Ben.

^ permalink raw reply

* [PATCH] 2.6.19-rc4-mm2 iseries net_device compile issue
From: Judith Lebzelter @ 2006-11-06 21:36 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: akpm, paulus, linux-kernel

Hi,

2.6.19-rc4-mm2 has this error for 'powerpc' allmodconfig:

drivers/net/iseries_veth.c: In function 'veth_probe_one':
drivers/net/iseries_veth.c:1103: error: 'struct net_device' has no member named 'class_dev'

This patch fixes the error.

Signed-off-by: Judith Lebzelter <judith@osdl.org>
---
Files edited:
drivers/net/iseries_veth.c
---

Index: linux/drivers/net/iseries_veth.c
===================================================================
--- linux.orig/drivers/net/iseries_veth.c	2006-11-02 13:59:38.000000000 -0800
+++ linux/drivers/net/iseries_veth.c	2006-11-02 14:05:44.000000000 -0800
@@ -1100,7 +1100,7 @@
 	}
 
 	kobject_init(&port->kobject);
-	port->kobject.parent = &dev->class_dev.kobj;
+	port->kobject.parent = &dev->dev.kobj;
 	port->kobject.ktype  = &veth_port_ktype;
 	kobject_set_name(&port->kobject, "veth_port");
 	if (0 != kobject_add(&port->kobject))

^ permalink raw reply

* Re: [PATCH 2.6.19 1/4] ehca: assure 4k alignment for firmware control block in 64k page mode
From: Arnd Bergmann @ 2006-11-06 21:35 UTC (permalink / raw)
  To: Hoang-Nam Ngyuen; +Cc: linux-kernel, openib-general, linuxppc-dev, raisch
In-Reply-To: <200611062226.44939.hnguyen@linux.vnet.ibm.com>

On Monday 06 November 2006 22:26, Hoang-Nam Ngyuen wrote:
> -=A0=A0=A0=A0=A0=A0=A0rblock =3D kzalloc(H_CB_ALIGNMENT, GFP_KERNEL);
> +=A0=A0=A0=A0=A0=A0=A0rblock =3D (struct hipz_query_hca*)ehca_alloc_fw_ct=
rlblock();

> =A0
> -=A0=A0=A0=A0=A0=A0=A0rblock =3D kzalloc(H_CB_ALIGNMENT, GFP_KERNEL);
> +=A0=A0=A0=A0=A0=A0=A0rblock =3D (struct hipz_query_port*)ehca_alloc_fw_c=
trlblock();

The point Heiko made in his comment is that with ehca_alloc_fw_ctrlblock
returning a void*, you can (and _should_) remove the casts to other
pointer types.

	Arnd <><

^ permalink raw reply

* Re: [PATCH 2.6.19 1/4] ehca: assure 4k alignment for firmware control block in 64k page mode
From: Hoang-Nam Ngyuen @ 2006-11-06 21:26 UTC (permalink / raw)
  To: rolandd; +Cc: arnd, linux-kernel, openib-general, linuxppc-dev, raisch

Hello Roland!
Below is the patch with the "ctor" bug fix and Heiko's improvement
to assure ehca_alloc_fw_ctrlblock() always returns (void*).
Hope it is in proper format.
Thanks!
Nam

This is a patch of ehca that assures 4k alignment for firmware control block
in 64k page mode, because kzalloc()'s result address might not be 4k aligned 
if kernel's 64k page is enabled. Thus, we introduced wrappers called
ehca_alloc/free_fw_ctrlblock(), which use a slab cache for objects with
4k length and 4k alignment in order to alloc/free firmware control blocks
in 64k page mode. In 4k page mode those wrappers just are defines of
get_zeroed_page() and free_page().


Signed-off-by: Hoang-Nam Nguyen <hnguyen@de.ibm.com>
---


 ehca_hca.c    |   17 +++++++++--------
 ehca_irq.c    |   17 ++++++++---------
 ehca_iverbs.h |    8 ++++++++
 ehca_main.c   |   56 +++++++++++++++++++++++++++++++++++++++++++++++---------
 ehca_mrmw.c   |    8 ++++----
 ehca_qp.c     |   12 +++++++-----
 6 files changed, 83 insertions(+), 35 deletions(-)


diff --git a/drivers/infiniband/hw/ehca/ehca_hca.c b/drivers/infiniband/hw/ehca/ehca_hca.c
index 5eae6ac..f77e626 100644
--- a/drivers/infiniband/hw/ehca/ehca_hca.c
+++ b/drivers/infiniband/hw/ehca/ehca_hca.c
@@ -40,6 +40,7 @@
  */
 
 #include "ehca_tools.h"
+#include "ehca_iverbs.h"
 #include "hcp_if.h"
 
 int ehca_query_device(struct ib_device *ibdev, struct ib_device_attr *props)
@@ -49,7 +50,7 @@ int ehca_query_device(struct ib_device *
 					      ib_device);
 	struct hipz_query_hca *rblock;
 
-	rblock = kzalloc(H_CB_ALIGNMENT, GFP_KERNEL);
+	rblock = (struct hipz_query_hca*)ehca_alloc_fw_ctrlblock();
 	if (!rblock) {
 		ehca_err(&shca->ib_device, "Can't allocate rblock memory.");
 		return -ENOMEM;
@@ -96,7 +97,7 @@ int ehca_query_device(struct ib_device *
 		= min_t(int, rblock->max_total_mcast_qp_attach, INT_MAX);
 
 query_device1:
-	kfree(rblock);
+	ehca_free_fw_ctrlblock(rblock);
 
 	return ret;
 }
@@ -109,7 +110,7 @@ int ehca_query_port(struct ib_device *ib
 					      ib_device);
 	struct hipz_query_port *rblock;
 
-	rblock = kzalloc(H_CB_ALIGNMENT, GFP_KERNEL);
+	rblock = (struct hipz_query_port*)ehca_alloc_fw_ctrlblock();
 	if (!rblock) {
 		ehca_err(&shca->ib_device, "Can't allocate rblock memory.");
 		return -ENOMEM;
@@ -162,7 +163,7 @@ int ehca_query_port(struct ib_device *ib
 	props->active_speed    = 0x1;
 
 query_port1:
-	kfree(rblock);
+	ehca_free_fw_ctrlblock(rblock);
 
 	return ret;
 }
@@ -178,7 +179,7 @@ int ehca_query_pkey(struct ib_device *ib
 		return -EINVAL;
 	}
 
-	rblock = kzalloc(H_CB_ALIGNMENT, GFP_KERNEL);
+	rblock = (struct hipz_query_port*)ehca_alloc_fw_ctrlblock();
 	if (!rblock) {
 		ehca_err(&shca->ib_device,  "Can't allocate rblock memory.");
 		return -ENOMEM;
@@ -193,7 +194,7 @@ int ehca_query_pkey(struct ib_device *ib
 	memcpy(pkey, &rblock->pkey_entries + index, sizeof(u16));
 
 query_pkey1:
-	kfree(rblock);
+	ehca_free_fw_ctrlblock(rblock);
 
 	return ret;
 }
@@ -211,7 +212,7 @@ int ehca_query_gid(struct ib_device *ibd
 		return -EINVAL;
 	}
 
-	rblock = kzalloc(H_CB_ALIGNMENT, GFP_KERNEL);
+	rblock = (struct hipz_query_port*)ehca_alloc_fw_ctrlblock();
 	if (!rblock) {
 		ehca_err(&shca->ib_device, "Can't allocate rblock memory.");
 		return -ENOMEM;
@@ -227,7 +228,7 @@ int ehca_query_gid(struct ib_device *ibd
 	memcpy(&gid->raw[8], &rblock->guid_entries[index], sizeof(u64));
 
 query_gid1:
-	kfree(rblock);
+	ehca_free_fw_ctrlblock(rblock);
 
 	return ret;
 }
diff --git a/drivers/infiniband/hw/ehca/ehca_irq.c b/drivers/infiniband/hw/ehca/ehca_irq.c
index 048cc44..01b66d7 100644
--- a/drivers/infiniband/hw/ehca/ehca_irq.c
+++ b/drivers/infiniband/hw/ehca/ehca_irq.c
@@ -45,6 +45,7 @@ #include "ehca_iverbs.h"
 #include "ehca_tools.h"
 #include "hcp_if.h"
 #include "hipz_fns.h"
+#include "ipz_pt_fn.h"
 
 #define EQE_COMPLETION_EVENT   EHCA_BMASK_IBM(1,1)
 #define EQE_CQ_QP_NUMBER       EHCA_BMASK_IBM(8,31)
@@ -137,38 +138,36 @@ int ehca_error_data(struct ehca_shca *sh
 	u64 *rblock;
 	unsigned long block_count;
 
-	rblock = kzalloc(H_CB_ALIGNMENT, GFP_KERNEL);
+	rblock = (u64*)ehca_alloc_fw_ctrlblock();
 	if (!rblock) {
 		ehca_err(&shca->ib_device, "Cannot allocate rblock memory.");
 		ret = -ENOMEM;
 		goto error_data1;
 	}
 
+	/* rblock must be 4K aligned and should be 4K large */
 	ret = hipz_h_error_data(shca->ipz_hca_handle,
 				resource,
 				rblock,
 				&block_count);
 
-	if (ret == H_R_STATE) {
+	if (ret == H_R_STATE)
 		ehca_err(&shca->ib_device,
 			 "No error data is available: %lx.", resource);
-	}
 	else if (ret == H_SUCCESS) {
 		int length;
 
 		length = EHCA_BMASK_GET(ERROR_DATA_LENGTH, rblock[0]);
 
-		if (length > PAGE_SIZE)
-			length = PAGE_SIZE;
+		if (length > EHCA_PAGESIZE)
+			length = EHCA_PAGESIZE;
 
 		print_error_data(shca, data, rblock, length);
-	}
-	else {
+	} else
 		ehca_err(&shca->ib_device,
 			 "Error data could not be fetched: %lx", resource);
-	}
 
-	kfree(rblock);
+	ehca_free_fw_ctrlblock(rblock);
 
 error_data1:
 	return ret;
diff --git a/drivers/infiniband/hw/ehca/ehca_iverbs.h b/drivers/infiniband/hw/ehca/ehca_iverbs.h
index 319c39d..7011aba 100644
--- a/drivers/infiniband/hw/ehca/ehca_iverbs.h
+++ b/drivers/infiniband/hw/ehca/ehca_iverbs.h
@@ -179,4 +179,12 @@ int ehca_mmap_register(u64 physical,void
 
 int ehca_munmap(unsigned long addr, size_t len);
 
+#ifdef CONFIG_PPC_64K_PAGES
+void *ehca_alloc_fw_ctrlblock(void);
+void ehca_free_fw_ctrlblock(void *ptr);
+#else
+#define ehca_alloc_fw_ctrlblock() ((void*)get_zeroed_page(GFP_KERNEL))
+#define ehca_free_fw_ctrlblock(ptr) free_page((unsigned long)(ptr))
+#endif
+
 #endif
diff --git a/drivers/infiniband/hw/ehca/ehca_main.c b/drivers/infiniband/hw/ehca/ehca_main.c
index 024d511..a40871f 100644
--- a/drivers/infiniband/hw/ehca/ehca_main.c
+++ b/drivers/infiniband/hw/ehca/ehca_main.c
@@ -40,6 +40,9 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#ifdef CONFIG_PPC_64K_PAGES
+#include <linux/slab.h>
+#endif
 #include "ehca_classes.h"
 #include "ehca_iverbs.h"
 #include "ehca_mrmw.h"
@@ -49,7 +52,7 @@ #include "hcp_if.h"
 MODULE_LICENSE("Dual BSD/GPL");
 MODULE_AUTHOR("Christoph Raisch <raisch@de.ibm.com>");
 MODULE_DESCRIPTION("IBM eServer HCA InfiniBand Device Driver");
-MODULE_VERSION("SVNEHCA_0017");
+MODULE_VERSION("SVNEHCA_0018");
 
 int ehca_open_aqp1     = 0;
 int ehca_debug_level   = 0;
@@ -94,11 +97,31 @@ spinlock_t ehca_cq_idr_lock;
 DEFINE_IDR(ehca_qp_idr);
 DEFINE_IDR(ehca_cq_idr);
 
+
 static struct list_head shca_list; /* list of all registered ehcas */
 static spinlock_t shca_list_lock;
 
 static struct timer_list poll_eqs_timer;
 
+#ifdef CONFIG_PPC_64K_PAGES
+static struct kmem_cache *ctblk_cache = NULL;
+
+void *ehca_alloc_fw_ctrlblock(void)
+{
+	void *ret = kmem_cache_zalloc(ctblk_cache, SLAB_KERNEL);
+	if (!ret)
+		ehca_gen_err("Out of memory for ctblk");
+	return ret;
+}
+
+void ehca_free_fw_ctrlblock(void *ptr)
+{
+	if (ptr)
+		kmem_cache_free(ctblk_cache, ptr);
+
+}
+#endif
+
 static int ehca_create_slab_caches(void)
 {
 	int ret;
@@ -133,6 +156,17 @@ static int ehca_create_slab_caches(void)
 		goto create_slab_caches5;
 	}
 
+#ifdef CONFIG_PPC_64K_PAGES
+	ctblk_cache = kmem_cache_create("ehca_cache_ctblk",
+					EHCA_PAGESIZE, H_CB_ALIGNMENT,
+					SLAB_HWCACHE_ALIGN,
+					NULL, NULL);
+	if (!ctblk_cache) {
+		ehca_gen_err("Cannot create ctblk SLAB cache.");
+		ehca_cleanup_mrmw_cache();
+		goto create_slab_caches5;
+	}
+#endif
 	return 0;
 
 create_slab_caches5:
@@ -157,6 +191,10 @@ static void ehca_destroy_slab_caches(voi
 	ehca_cleanup_qp_cache();
 	ehca_cleanup_cq_cache();
 	ehca_cleanup_pd_cache();
+#ifdef CONFIG_PPC_64K_PAGES
+	if (ctblk_cache)
+		kmem_cache_destroy(ctblk_cache);
+#endif
 }
 
 #define EHCA_HCAAVER  EHCA_BMASK_IBM(32,39)
@@ -168,7 +206,7 @@ int ehca_sense_attributes(struct ehca_sh
 	u64 h_ret;
 	struct hipz_query_hca *rblock;
 
-	rblock = kzalloc(H_CB_ALIGNMENT, GFP_KERNEL);
+	rblock = (struct hipz_query_hca*)ehca_alloc_fw_ctrlblock();
 	if (!rblock) {
 		ehca_gen_err("Cannot allocate rblock memory.");
 		return -ENOMEM;
@@ -211,7 +249,7 @@ int ehca_sense_attributes(struct ehca_sh
 	shca->sport[1].rate = IB_RATE_30_GBPS;
 
 num_ports1:
-	kfree(rblock);
+	ehca_free_fw_ctrlblock(rblock);
 	return ret;
 }
 
@@ -220,7 +258,7 @@ static int init_node_guid(struct ehca_sh
 	int ret = 0;
 	struct hipz_query_hca *rblock;
 
-	rblock = kzalloc(H_CB_ALIGNMENT, GFP_KERNEL);
+	rblock = (struct hipz_query_hca*)ehca_alloc_fw_ctrlblock();
 	if (!rblock) {
 		ehca_err(&shca->ib_device, "Can't allocate rblock memory.");
 		return -ENOMEM;
@@ -235,7 +273,7 @@ static int init_node_guid(struct ehca_sh
 	memcpy(&shca->ib_device.node_guid, &rblock->node_guid, sizeof(u64));
 
 init_node_guid1:
-	kfree(rblock);
+	ehca_free_fw_ctrlblock(rblock);
 	return ret;
 }
 
@@ -431,7 +469,7 @@ static ssize_t  ehca_show_##name(struct 
 									   \
 	shca = dev->driver_data;					   \
 									   \
-	rblock = kzalloc(H_CB_ALIGNMENT, GFP_KERNEL);			   \
+	rblock = (struct hipz_query_hca*)ehca_alloc_fw_ctrlblock();	   \
 	if (!rblock) {						           \
 		dev_err(dev, "Can't allocate rblock memory.");		   \
 		return 0;						   \
@@ -439,12 +477,12 @@ static ssize_t  ehca_show_##name(struct 
 									   \
 	if (hipz_h_query_hca(shca->ipz_hca_handle, rblock) != H_SUCCESS) { \
 		dev_err(dev, "Can't query device properties");	   	   \
-		kfree(rblock);					   	   \
+		ehca_free_fw_ctrlblock(rblock);			   	   \
 		return 0;					   	   \
 	}								   \
 									   \
 	data = rblock->name;                                               \
-	kfree(rblock);                                                     \
+	ehca_free_fw_ctrlblock(rblock);                                    \
 									   \
 	if ((strcmp(#name, "num_ports") == 0) && (ehca_nr_ports == 1))	   \
 		return snprintf(buf, 256, "1\n");			   \
@@ -752,7 +790,7 @@ int __init ehca_module_init(void)
 	int ret;
 
 	printk(KERN_INFO "eHCA Infiniband Device Driver "
-	                 "(Rel.: SVNEHCA_0017)\n");
+	                 "(Rel.: SVNEHCA_0018)\n");
 	idr_init(&ehca_qp_idr);
 	idr_init(&ehca_cq_idr);
 	spin_lock_init(&ehca_qp_idr_lock);
diff --git a/drivers/infiniband/hw/ehca/ehca_mrmw.c b/drivers/infiniband/hw/ehca/ehca_mrmw.c
index 5ca6544..1b77ac7 100644
--- a/drivers/infiniband/hw/ehca/ehca_mrmw.c
+++ b/drivers/infiniband/hw/ehca/ehca_mrmw.c
@@ -1013,7 +1013,7 @@ int ehca_reg_mr_rpages(struct ehca_shca 
 	u32 i;
 	u64 *kpage;
 
-	kpage = kzalloc(H_CB_ALIGNMENT, GFP_KERNEL);
+	kpage = (u64*)ehca_alloc_fw_ctrlblock();
 	if (!kpage) {
 		ehca_err(&shca->ib_device, "kpage alloc failed");
 		ret = -ENOMEM;
@@ -1092,7 +1092,7 @@ int ehca_reg_mr_rpages(struct ehca_shca 
 
 
 ehca_reg_mr_rpages_exit1:
-	kfree(kpage);
+	ehca_free_fw_ctrlblock(kpage);
 ehca_reg_mr_rpages_exit0:
 	if (ret)
 		ehca_err(&shca->ib_device, "ret=%x shca=%p e_mr=%p pginfo=%p "
@@ -1124,7 +1124,7 @@ inline int ehca_rereg_mr_rereg1(struct e
 	ehca_mrmw_map_acl(acl, &hipz_acl);
 	ehca_mrmw_set_pgsize_hipz_acl(&hipz_acl);
 
-	kpage = kzalloc(H_CB_ALIGNMENT, GFP_KERNEL);
+	kpage = (u64*)ehca_alloc_fw_ctrlblock();
 	if (!kpage) {
 		ehca_err(&shca->ib_device, "kpage alloc failed");
 		ret = -ENOMEM;
@@ -1181,7 +1181,7 @@ inline int ehca_rereg_mr_rereg1(struct e
 	}
 
 ehca_rereg_mr_rereg1_exit1:
-	kfree(kpage);
+	ehca_free_fw_ctrlblock(kpage);
 ehca_rereg_mr_rereg1_exit0:
 	if ( ret && (ret != -EAGAIN) )
 		ehca_err(&shca->ib_device, "ret=%x lkey=%x rkey=%x "
diff --git a/drivers/infiniband/hw/ehca/ehca_qp.c b/drivers/infiniband/hw/ehca/ehca_qp.c
index 4394123..3768d8d 100644
--- a/drivers/infiniband/hw/ehca/ehca_qp.c
+++ b/drivers/infiniband/hw/ehca/ehca_qp.c
@@ -811,8 +811,9 @@ static int internal_modify_qp(struct ib_
 	unsigned long spl_flags = 0;
 
 	/* do query_qp to obtain current attr values */
-	mqpcb = kzalloc(H_CB_ALIGNMENT, GFP_KERNEL);
-	if (mqpcb == NULL) {
+	mqpcb = (struct hcp_modify_qp_control_block*)
+		ehca_alloc_fw_ctrlblock();
+	if (!mqpcb) {
 		ehca_err(ibqp->device, "Could not get zeroed page for mqpcb "
 			 "ehca_qp=%p qp_num=%x ", my_qp, ibqp->qp_num);
 		return -ENOMEM;
@@ -1225,7 +1226,7 @@ modify_qp_exit2:
 	}
 
 modify_qp_exit1:
-	kfree(mqpcb);
+	ehca_free_fw_ctrlblock(mqpcb);
 
 	return ret;
 }
@@ -1277,7 +1278,8 @@ int ehca_query_qp(struct ib_qp *qp,
 		return -EINVAL;
 	}
 
-	qpcb = kzalloc(H_CB_ALIGNMENT, GFP_KERNEL );
+	qpcb = (struct hcp_modify_qp_control_block*)
+		ehca_alloc_fw_ctrlblock();
 	if (!qpcb) {
 		ehca_err(qp->device,"Out of memory for qpcb "
 			 "ehca_qp=%p qp_num=%x", my_qp, qp->qp_num);
@@ -1401,7 +1403,7 @@ int ehca_query_qp(struct ib_qp *qp,
 		ehca_dmp(qpcb, 4*70, "qp_num=%x", qp->qp_num);
 
 query_qp_exit1:
-	kfree(qpcb);
+	ehca_free_fw_ctrlblock(qpcb);
 
 	return ret;
 }

^ permalink raw reply related

* Re: Booting without Uboot on 8548E
From: Andy Fleming @ 2006-11-06 21:16 UTC (permalink / raw)
  To: M Ptich; +Cc: linuxppc-dev
In-Reply-To: <BAY102-F634C51A5AEEB25090456BA9FD0@phx.gbl>


On Nov 4, 2006, at 03:28, M Ptich wrote:

>> You should seriously think about porting
>> over to arch/powerpc instead.
>
> 8548E is E500v2 core. Our Kernel is from Freescale, it is using  
> arch/ppc. I
> am not sure how well (if at all) E500 is supported in the arch/ 
> powerpc from
> the FSF ditribution.


The 8548 is supported in arch/powerpc as of 2.6.18.

But moving to arch/powerpc (while a good idea) is not going to solve  
your problems.  There are bound to be a large number of things the  
kernel expects to have done for it by the firmware.  In arch/powerpc,  
the 8548 kernel expects PCI to be set up, for instance (We plan to  
fix that, but it involves porting some code that only exists in arch/ 
ppc).

Andy

^ permalink raw reply

* [PATCH] PowerPC: remove broken vsyscall code
From: Sergei Shtylyov @ 2006-11-06 20:59 UTC (permalink / raw)
  To: tglx, johnstul; +Cc: linuxppc-dev, greg.weeks

Remove vsyscalls that were broken by the PowerPC generic TOD patch, also
fixing the build breakage due to its bad rebase.

The patch has been tested on PPC32 only. I had to preserve the data that
are made visible to userland via /proc/ppc64/systemcfg on PPC64, however
now there are only zeroes there and their affect isn't known to me...

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>

---
This patch is against 2.6.18-hrt-dyntick2 patchset.
For the lack of time on restoring/reimplementing the vsyscall functionality,
the best thing I could do is to move the broken code out of the way...

 arch/powerpc/kernel/vdso32/gettimeofday.S |  322 ------------------------------
 arch/powerpc/kernel/vdso64/gettimeofday.S |  252 -----------------------
 arch/powerpc/kernel/asm-offsets.c         |   15 -
 arch/powerpc/kernel/smp.c                 |    2 
 arch/powerpc/kernel/time.c                |    1 
 arch/powerpc/kernel/vdso32/Makefile       |    2 
 arch/powerpc/kernel/vdso32/datapage.S     |   18 -
 arch/powerpc/kernel/vdso32/vdso32.lds.S   |    4 
 arch/powerpc/kernel/vdso64/Makefile       |    2 
 arch/powerpc/kernel/vdso64/datapage.S     |   18 -
 arch/powerpc/kernel/vdso64/vdso64.lds.S   |    4 
 include/asm-powerpc/time.h                |   20 -
 include/asm-powerpc/vdso_datapage.h       |   14 -
 13 files changed, 2 insertions(+), 672 deletions(-)

Index: linux-2.6/arch/powerpc/kernel/asm-offsets.c
===================================================================
--- linux-2.6.orig/arch/powerpc/kernel/asm-offsets.c
+++ linux-2.6/arch/powerpc/kernel/asm-offsets.c
@@ -251,16 +251,7 @@ int main(void)
 #endif /* ! CONFIG_PPC64 */
 
 	/* datapage offsets for use by vdso */
-	DEFINE(CFG_TB_ORIG_STAMP, offsetof(struct vdso_data, tb_orig_stamp));
-	DEFINE(CFG_TB_TICKS_PER_SEC, offsetof(struct vdso_data, tb_ticks_per_sec));
-	DEFINE(CFG_TB_TO_XS, offsetof(struct vdso_data, tb_to_xs));
-	DEFINE(CFG_STAMP_XSEC, offsetof(struct vdso_data, stamp_xsec));
-	DEFINE(CFG_TB_UPDATE_COUNT, offsetof(struct vdso_data, tb_update_count));
-	DEFINE(CFG_TZ_MINUTEWEST, offsetof(struct vdso_data, tz_minuteswest));
-	DEFINE(CFG_TZ_DSTTIME, offsetof(struct vdso_data, tz_dsttime));
 	DEFINE(CFG_SYSCALL_MAP32, offsetof(struct vdso_data, syscall_map_32));
-	DEFINE(WTOM_CLOCK_SEC, offsetof(struct vdso_data, wtom_clock_sec));
-	DEFINE(WTOM_CLOCK_NSEC, offsetof(struct vdso_data, wtom_clock_nsec));
 #ifdef CONFIG_PPC64
 	DEFINE(CFG_SYSCALL_MAP64, offsetof(struct vdso_data, syscall_map_64));
 	DEFINE(TVAL64_TV_SEC, offsetof(struct timeval, tv_sec));
@@ -281,11 +272,5 @@ int main(void)
 	DEFINE(TZONE_TZ_MINWEST, offsetof(struct timezone, tz_minuteswest));
 	DEFINE(TZONE_TZ_DSTTIME, offsetof(struct timezone, tz_dsttime));
 
-	/* Other bits used by the vdso */
-	DEFINE(CLOCK_REALTIME, CLOCK_REALTIME);
-	DEFINE(CLOCK_MONOTONIC, CLOCK_MONOTONIC);
-	DEFINE(NSEC_PER_SEC, NSEC_PER_SEC);
-	DEFINE(CLOCK_REALTIME_RES, TICK_NSEC);
-
 	return 0;
 }
Index: linux-2.6/arch/powerpc/kernel/smp.c
===================================================================
--- linux-2.6.orig/arch/powerpc/kernel/smp.c
+++ linux-2.6/arch/powerpc/kernel/smp.c
@@ -320,8 +320,6 @@ void smp_call_function_interrupt(void)
 	}
 }
 
-extern struct gettimeofday_struct do_gtod;
-
 struct thread_info *current_set[NR_CPUS];
 
 DECLARE_PER_CPU(unsigned int, pvr);
Index: linux-2.6/arch/powerpc/kernel/time.c
===================================================================
--- linux-2.6.orig/arch/powerpc/kernel/time.c
+++ linux-2.6/arch/powerpc/kernel/time.c
@@ -532,7 +532,6 @@ void timer_interrupt(struct pt_regs * re
 		if (per_cpu(last_jiffy, cpu) >= tb_next_jiffy) {
 			tb_last_jiffy = tb_next_jiffy;
 			do_timer(1);
-			timer_recalc_offset(tb_last_jiffy);
 			timer_check_rtc();
 		}
 		write_sequnlock(&xtime_lock);
Index: linux-2.6/arch/powerpc/kernel/vdso32/Makefile
===================================================================
--- linux-2.6.orig/arch/powerpc/kernel/vdso32/Makefile
+++ linux-2.6/arch/powerpc/kernel/vdso32/Makefile
@@ -1,7 +1,7 @@
 
 # List of files in the vdso, has to be asm only for now
 
-obj-vdso32 = sigtramp.o gettimeofday.o datapage.o cacheflush.o note.o
+obj-vdso32 = sigtramp.o datapage.o cacheflush.o note.o
 
 # Build rules
 
Index: linux-2.6/arch/powerpc/kernel/vdso32/datapage.S
===================================================================
--- linux-2.6.orig/arch/powerpc/kernel/vdso32/datapage.S
+++ linux-2.6/arch/powerpc/kernel/vdso32/datapage.S
@@ -65,21 +65,3 @@ V_FUNCTION_BEGIN(__kernel_get_syscall_ma
 	blr
   .cfi_endproc
 V_FUNCTION_END(__kernel_get_syscall_map)
-
-/*
- * void unsigned long long  __kernel_get_tbfreq(void);
- *
- * returns the timebase frequency in HZ
- */
-V_FUNCTION_BEGIN(__kernel_get_tbfreq)
-  .cfi_startproc
-	mflr	r12
-  .cfi_register lr,r12
-	bl	__get_datapage@local
-	lwz	r4,(CFG_TB_TICKS_PER_SEC + 4)(r3)
-	lwz	r3,CFG_TB_TICKS_PER_SEC(r3)
-	mtlr	r12
-	crclr	cr0*4+so
-	blr
-  .cfi_endproc
-V_FUNCTION_END(__kernel_get_tbfreq)
Index: linux-2.6/arch/powerpc/kernel/vdso32/gettimeofday.S
===================================================================
--- linux-2.6.orig/arch/powerpc/kernel/vdso32/gettimeofday.S
+++ /dev/null
@@ -1,322 +0,0 @@
-/*
- * Userland implementation of gettimeofday() for 32 bits processes in a
- * ppc64 kernel for use in the vDSO
- *
- * Copyright (C) 2004 Benjamin Herrenschmuidt (benh@kernel.crashing.org,
- *                    IBM Corp.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version
- * 2 of the License, or (at your option) any later version.
- */
-#include <asm/processor.h>
-#include <asm/ppc_asm.h>
-#include <asm/vdso.h>
-#include <asm/asm-offsets.h>
-#include <asm/unistd.h>
-
-	.text
-/*
- * Exact prototype of gettimeofday
- *
- * int __kernel_gettimeofday(struct timeval *tv, struct timezone *tz);
- *
- */
-V_FUNCTION_BEGIN(__kernel_gettimeofday)
-  .cfi_startproc
-	mflr	r12
-  .cfi_register lr,r12
-
-	mr	r10,r3			/* r10 saves tv */
-	mr	r11,r4			/* r11 saves tz */
-	bl	__get_datapage@local	/* get data page */
-	mr	r9, r3			/* datapage ptr in r9 */
-	bl	__do_get_xsec@local	/* get xsec from tb & kernel */
-	bne-	2f			/* out of line -> do syscall */
-
-	/* seconds are xsec >> 20 */
-	rlwinm	r5,r4,12,20,31
-	rlwimi	r5,r3,12,0,19
-	stw	r5,TVAL32_TV_SEC(r10)
-
-	/* get remaining xsec and convert to usec. we scale
-	 * up remaining xsec by 12 bits and get the top 32 bits
-	 * of the multiplication
-	 */
-	rlwinm	r5,r4,12,0,19
-	lis	r6,1000000@h
-	ori	r6,r6,1000000@l
-	mulhwu	r5,r5,r6
-	stw	r5,TVAL32_TV_USEC(r10)
-
-	cmpli	cr0,r11,0		/* check if tz is NULL */
-	beq	1f
-	lwz	r4,CFG_TZ_MINUTEWEST(r9)/* fill tz */
-	lwz	r5,CFG_TZ_DSTTIME(r9)
-	stw	r4,TZONE_TZ_MINWEST(r11)
-	stw	r5,TZONE_TZ_DSTTIME(r11)
-
-1:	mtlr	r12
-	crclr	cr0*4+so
-	li	r3,0
-	blr
-
-2:
-	mtlr	r12
-	mr	r3,r10
-	mr	r4,r11
-	li	r0,__NR_gettimeofday
-	sc
-	blr
-  .cfi_endproc
-V_FUNCTION_END(__kernel_gettimeofday)
-
-/*
- * Exact prototype of clock_gettime()
- *
- * int __kernel_clock_gettime(clockid_t clock_id, struct timespec *tp);
- *
- */
-V_FUNCTION_BEGIN(__kernel_clock_gettime)
-  .cfi_startproc
-	/* Check for supported clock IDs */
-	cmpli	cr0,r3,CLOCK_REALTIME
-	cmpli	cr1,r3,CLOCK_MONOTONIC
-	cror	cr0*4+eq,cr0*4+eq,cr1*4+eq
-	bne	cr0,99f
-
-	mflr	r12			/* r12 saves lr */
-  .cfi_register lr,r12
-	mr	r10,r3			/* r10 saves id */
-	mr	r11,r4			/* r11 saves tp */
-	bl	__get_datapage@local	/* get data page */
-	mr	r9,r3			/* datapage ptr in r9 */
-	beq	cr1,50f			/* if monotonic -> jump there */
-
-	/*
-	 * CLOCK_REALTIME
-	 */
-
-	bl	__do_get_xsec@local	/* get xsec from tb & kernel */
-	bne-	98f			/* out of line -> do syscall */
-
-	/* seconds are xsec >> 20 */
-	rlwinm	r5,r4,12,20,31
-	rlwimi	r5,r3,12,0,19
-	stw	r5,TSPC32_TV_SEC(r11)
-
-	/* get remaining xsec and convert to nsec. we scale
-	 * up remaining xsec by 12 bits and get the top 32 bits
-	 * of the multiplication, then we multiply by 1000
-	 */
-	rlwinm	r5,r4,12,0,19
-	lis	r6,1000000@h
-	ori	r6,r6,1000000@l
-	mulhwu	r5,r5,r6
-	mulli	r5,r5,1000
-	stw	r5,TSPC32_TV_NSEC(r11)
-	mtlr	r12
-	crclr	cr0*4+so
-	li	r3,0
-	blr
-
-	/*
-	 * CLOCK_MONOTONIC
-	 */
-
-50:	bl	__do_get_xsec@local	/* get xsec from tb & kernel */
-	bne-	98f			/* out of line -> do syscall */
-
-	/* seconds are xsec >> 20 */
-	rlwinm	r6,r4,12,20,31
-	rlwimi	r6,r3,12,0,19
-
-	/* get remaining xsec and convert to nsec. we scale
-	 * up remaining xsec by 12 bits and get the top 32 bits
-	 * of the multiplication, then we multiply by 1000
-	 */
-	rlwinm	r7,r4,12,0,19
-	lis	r5,1000000@h
-	ori	r5,r5,1000000@l
-	mulhwu	r7,r7,r5
-	mulli	r7,r7,1000
-
-	/* now we must fixup using wall to monotonic. We need to snapshot
-	 * that value and do the counter trick again. Fortunately, we still
-	 * have the counter value in r8 that was returned by __do_get_xsec.
-	 * At this point, r6,r7 contain our sec/nsec values, r3,r4 and r5
-	 * can be used
-	 */
-
-	lwz	r3,WTOM_CLOCK_SEC(r9)
-	lwz	r4,WTOM_CLOCK_NSEC(r9)
-
-	/* We now have our result in r3,r4. We create a fake dependency
-	 * on that result and re-check the counter
-	 */
-	or	r5,r4,r3
-	xor	r0,r5,r5
-	add	r9,r9,r0
-#ifdef CONFIG_PPC64
-	lwz	r0,(CFG_TB_UPDATE_COUNT+4)(r9)
-#else
-	lwz	r0,(CFG_TB_UPDATE_COUNT)(r9)
-#endif
-        cmpl    cr0,r8,r0		/* check if updated */
-	bne-	50b
-
-	/* Calculate and store result. Note that this mimmics the C code,
-	 * which may cause funny results if nsec goes negative... is that
-	 * possible at all ?
-	 */
-	add	r3,r3,r6
-	add	r4,r4,r7
-	lis	r5,NSEC_PER_SEC@h
-	ori	r5,r5,NSEC_PER_SEC@l
-	cmpl	cr0,r4,r5
-	cmpli	cr1,r4,0
-	blt	1f
-	subf	r4,r5,r4
-	addi	r3,r3,1
-1:	bge	cr1,1f
-	addi	r3,r3,-1
-	add	r4,r4,r5
-1:	stw	r3,TSPC32_TV_SEC(r11)
-	stw	r4,TSPC32_TV_NSEC(r11)
-
-	mtlr	r12
-	crclr	cr0*4+so
-	li	r3,0
-	blr
-
-	/*
-	 * syscall fallback
-	 */
-98:
-	mtlr	r12
-	mr	r3,r10
-	mr	r4,r11
-99:
-	li	r0,__NR_clock_gettime
-	sc
-	blr
-  .cfi_endproc
-V_FUNCTION_END(__kernel_clock_gettime)
-
-
-/*
- * Exact prototype of clock_getres()
- *
- * int __kernel_clock_getres(clockid_t clock_id, struct timespec *res);
- *
- */
-V_FUNCTION_BEGIN(__kernel_clock_getres)
-  .cfi_startproc
-	/* Check for supported clock IDs */
-	cmpwi	cr0,r3,CLOCK_REALTIME
-	cmpwi	cr1,r3,CLOCK_MONOTONIC
-	cror	cr0*4+eq,cr0*4+eq,cr1*4+eq
-	bne	cr0,99f
-
-	li	r3,0
-	cmpli	cr0,r4,0
-	crclr	cr0*4+so
-	beqlr
-	lis	r5,CLOCK_REALTIME_RES@h
-	ori	r5,r5,CLOCK_REALTIME_RES@l
-	stw	r3,TSPC32_TV_SEC(r4)
-	stw	r5,TSPC32_TV_NSEC(r4)
-	blr
-
-	/*
-	 * syscall fallback
-	 */
-99:
-	li	r0,__NR_clock_getres
-	sc
-	blr
-  .cfi_endproc
-V_FUNCTION_END(__kernel_clock_getres)
-
-
-/*
- * This is the core of gettimeofday() & friends, it returns the xsec
- * value in r3 & r4 and expects the datapage ptr (non clobbered)
- * in r9. clobbers r0,r4,r5,r6,r7,r8.
- * When returning, r8 contains the counter value that can be reused
- * by the monotonic clock implementation
- */
-__do_get_xsec:
-  .cfi_startproc
-	/* Check for update count & load values. We use the low
-	 * order 32 bits of the update count
-	 */
-#ifdef CONFIG_PPC64
-1:	lwz	r8,(CFG_TB_UPDATE_COUNT+4)(r9)
-#else
-1:	lwz	r8,(CFG_TB_UPDATE_COUNT)(r9)
-#endif
-	andi.	r0,r8,1			/* pending update ? loop */
-	bne-	1b
-	xor	r0,r8,r8		/* create dependency */
-	add	r9,r9,r0
-
-	/* Load orig stamp (offset to TB) */
-	lwz	r5,CFG_TB_ORIG_STAMP(r9)
-	lwz	r6,(CFG_TB_ORIG_STAMP+4)(r9)
-
-	/* Get a stable TB value */
-2:	mftbu	r3
-	mftbl	r4
-	mftbu	r0
-	cmpl	cr0,r3,r0
-	bne-	2b
-
-	/* Substract tb orig stamp. If the high part is non-zero, we jump to
-	 * the slow path which call the syscall.
-	 * If it's ok, then we have our 32 bits tb_ticks value in r7
-	 */
-	subfc	r7,r6,r4
-	subfe.	r0,r5,r3
-	bne-	3f
-
-	/* Load scale factor & do multiplication */
-	lwz	r5,CFG_TB_TO_XS(r9)	/* load values */
-	lwz	r6,(CFG_TB_TO_XS+4)(r9)
-	mulhwu	r4,r7,r5
-	mulhwu	r6,r7,r6
-	mullw	r0,r7,r5
-	addc	r6,r6,r0
-
-	/* At this point, we have the scaled xsec value in r4 + XER:CA
-	 * we load & add the stamp since epoch
-	 */
-	lwz	r5,CFG_STAMP_XSEC(r9)
-	lwz	r6,(CFG_STAMP_XSEC+4)(r9)
-	adde	r4,r4,r6
-	addze	r3,r5
-
-	/* We now have our result in r3,r4. We create a fake dependency
-	 * on that result and re-check the counter
-	 */
-	or	r6,r4,r3
-	xor	r0,r6,r6
-	add	r9,r9,r0
-#ifdef CONFIG_PPC64
-	lwz	r0,(CFG_TB_UPDATE_COUNT+4)(r9)
-#else
-	lwz	r0,(CFG_TB_UPDATE_COUNT)(r9)
-#endif
-        cmpl    cr0,r8,r0		/* check if updated */
-	bne-	1b
-
-	/* Warning ! The caller expects CR:EQ to be set to indicate a
-	 * successful calculation (so it won't fallback to the syscall
-	 * method). We have overriden that CR bit in the counter check,
-	 * but fortunately, the loop exit condition _is_ CR:EQ set, so
-	 * we can exit safely here. If you change this code, be careful
-	 * of that side effect.
-	 */
-3:	blr
-  .cfi_endproc
Index: linux-2.6/arch/powerpc/kernel/vdso32/vdso32.lds.S
===================================================================
--- linux-2.6.orig/arch/powerpc/kernel/vdso32/vdso32.lds.S
+++ linux-2.6/arch/powerpc/kernel/vdso32/vdso32.lds.S
@@ -105,10 +105,6 @@ VERSION
     global:
 	__kernel_datapage_offset; /* Has to be there for the kernel to find */
 	__kernel_get_syscall_map;
-	__kernel_gettimeofday;
-	__kernel_clock_gettime;
-	__kernel_clock_getres;
-	__kernel_get_tbfreq;
 	__kernel_sync_dicache;
 	__kernel_sync_dicache_p5;
 	__kernel_sigtramp32;
Index: linux-2.6/arch/powerpc/kernel/vdso64/Makefile
===================================================================
--- linux-2.6.orig/arch/powerpc/kernel/vdso64/Makefile
+++ linux-2.6/arch/powerpc/kernel/vdso64/Makefile
@@ -1,6 +1,6 @@
 # List of files in the vdso, has to be asm only for now
 
-obj-vdso64 = sigtramp.o gettimeofday.o datapage.o cacheflush.o note.o
+obj-vdso64 = sigtramp.o datapage.o cacheflush.o note.o
 
 # Build rules
 
Index: linux-2.6/arch/powerpc/kernel/vdso64/datapage.S
===================================================================
--- linux-2.6.orig/arch/powerpc/kernel/vdso64/datapage.S
+++ linux-2.6/arch/powerpc/kernel/vdso64/datapage.S
@@ -65,21 +65,3 @@ V_FUNCTION_BEGIN(__kernel_get_syscall_ma
 	blr
   .cfi_endproc
 V_FUNCTION_END(__kernel_get_syscall_map)
-
-
-/*
- * void unsigned long  __kernel_get_tbfreq(void);
- *
- * returns the timebase frequency in HZ
- */
-V_FUNCTION_BEGIN(__kernel_get_tbfreq)
-  .cfi_startproc
-	mflr	r12
-  .cfi_register lr,r12
-	bl	V_LOCAL_FUNC(__get_datapage)
-	ld	r3,CFG_TB_TICKS_PER_SEC(r3)
-	mtlr	r12
-	crclr	cr0*4+so
-	blr
-  .cfi_endproc
-V_FUNCTION_END(__kernel_get_tbfreq)
Index: linux-2.6/arch/powerpc/kernel/vdso64/gettimeofday.S
===================================================================
--- linux-2.6.orig/arch/powerpc/kernel/vdso64/gettimeofday.S
+++ /dev/null
@@ -1,252 +0,0 @@
-
-	/*
- * Userland implementation of gettimeofday() for 64 bits processes in a
- * ppc64 kernel for use in the vDSO
- *
- * Copyright (C) 2004 Benjamin Herrenschmuidt (benh@kernel.crashing.org),
- *                    IBM Corp.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version
- * 2 of the License, or (at your option) any later version.
- */
-#include <asm/processor.h>
-#include <asm/ppc_asm.h>
-#include <asm/vdso.h>
-#include <asm/asm-offsets.h>
-#include <asm/unistd.h>
-
-	.text
-/*
- * Exact prototype of gettimeofday
- *
- * int __kernel_gettimeofday(struct timeval *tv, struct timezone *tz);
- *
- */
-V_FUNCTION_BEGIN(__kernel_gettimeofday)
-  .cfi_startproc
-	mflr	r12
-  .cfi_register lr,r12
-
-	mr	r11,r3			/* r11 holds tv */
-	mr	r10,r4			/* r10 holds tz */
-	bl	V_LOCAL_FUNC(__get_datapage)	/* get data page */
-	bl	V_LOCAL_FUNC(__do_get_xsec)	/* get xsec from tb & kernel */
-	lis     r7,15			/* r7 = 1000000 = USEC_PER_SEC */
-	ori     r7,r7,16960
-	rldicl  r5,r4,44,20		/* r5 = sec = xsec / XSEC_PER_SEC */
-	rldicr  r6,r5,20,43		/* r6 = sec * XSEC_PER_SEC */
-	std	r5,TVAL64_TV_SEC(r11)	/* store sec in tv */
-	subf	r0,r6,r4		/* r0 = xsec = (xsec - r6) */
-	mulld   r0,r0,r7		/* usec = (xsec * USEC_PER_SEC) /
-					 * XSEC_PER_SEC
-					 */
-	rldicl  r0,r0,44,20
-	cmpldi	cr0,r10,0		/* check if tz is NULL */
-	std	r0,TVAL64_TV_USEC(r11)	/* store usec in tv */
-	beq	1f
-	lwz	r4,CFG_TZ_MINUTEWEST(r3)/* fill tz */
-	lwz	r5,CFG_TZ_DSTTIME(r3)
-	stw	r4,TZONE_TZ_MINWEST(r10)
-	stw	r5,TZONE_TZ_DSTTIME(r10)
-1:	mtlr	r12
-	crclr	cr0*4+so
-	li	r3,0			/* always success */
-	blr
-  .cfi_endproc
-V_FUNCTION_END(__kernel_gettimeofday)
-
-
-/*
- * Exact prototype of clock_gettime()
- *
- * int __kernel_clock_gettime(clockid_t clock_id, struct timespec *tp);
- *
- */
-V_FUNCTION_BEGIN(__kernel_clock_gettime)
-  .cfi_startproc
-	/* Check for supported clock IDs */
-	cmpwi	cr0,r3,CLOCK_REALTIME
-	cmpwi	cr1,r3,CLOCK_MONOTONIC
-	cror	cr0*4+eq,cr0*4+eq,cr1*4+eq
-	bne	cr0,99f
-
-	mflr	r12			/* r12 saves lr */
-  .cfi_register lr,r12
-	mr	r10,r3			/* r10 saves id */
-	mr	r11,r4			/* r11 saves tp */
-	bl	V_LOCAL_FUNC(__get_datapage)	/* get data page */
-	beq	cr1,50f			/* if monotonic -> jump there */
-
-	/*
-	 * CLOCK_REALTIME
-	 */
-
-	bl	V_LOCAL_FUNC(__do_get_xsec)	/* get xsec from tb & kernel */
-
-	lis     r7,15			/* r7 = 1000000 = USEC_PER_SEC */
-	ori     r7,r7,16960
-	rldicl  r5,r4,44,20		/* r5 = sec = xsec / XSEC_PER_SEC */
-	rldicr  r6,r5,20,43		/* r6 = sec * XSEC_PER_SEC */
-	std	r5,TSPC64_TV_SEC(r11)	/* store sec in tv */
-	subf	r0,r6,r4		/* r0 = xsec = (xsec - r6) */
-	mulld   r0,r0,r7		/* usec = (xsec * USEC_PER_SEC) /
-					 * XSEC_PER_SEC
-					 */
-	rldicl  r0,r0,44,20
-	mulli	r0,r0,1000		/* nsec = usec * 1000 */
-	std	r0,TSPC64_TV_NSEC(r11)	/* store nsec in tp */
-
-	mtlr	r12
-	crclr	cr0*4+so
-	li	r3,0
-	blr
-
-	/*
-	 * CLOCK_MONOTONIC
-	 */
-
-50:	bl	V_LOCAL_FUNC(__do_get_xsec)	/* get xsec from tb & kernel */
-
-	lis     r7,15			/* r7 = 1000000 = USEC_PER_SEC */
-	ori     r7,r7,16960
-	rldicl  r5,r4,44,20		/* r5 = sec = xsec / XSEC_PER_SEC */
-	rldicr  r6,r5,20,43		/* r6 = sec * XSEC_PER_SEC */
-	subf	r0,r6,r4		/* r0 = xsec = (xsec - r6) */
-	mulld   r0,r0,r7		/* usec = (xsec * USEC_PER_SEC) /
-					 * XSEC_PER_SEC
-					 */
-	rldicl  r6,r0,44,20
-	mulli	r6,r6,1000		/* nsec = usec * 1000 */
-
-	/* now we must fixup using wall to monotonic. We need to snapshot
-	 * that value and do the counter trick again. Fortunately, we still
-	 * have the counter value in r8 that was returned by __do_get_xsec.
-	 * At this point, r5,r6 contain our sec/nsec values.
-	 * can be used
-	 */
-
-	lwa	r4,WTOM_CLOCK_SEC(r3)
-	lwa	r7,WTOM_CLOCK_NSEC(r3)
-
-	/* We now have our result in r4,r7. We create a fake dependency
-	 * on that result and re-check the counter
-	 */
-	or	r9,r4,r7
-	xor	r0,r9,r9
-	add	r3,r3,r0
-	ld	r0,CFG_TB_UPDATE_COUNT(r3)
-        cmpld   cr0,r0,r8		/* check if updated */
-	bne-	50b
-
-	/* Calculate and store result. Note that this mimmics the C code,
-	 * which may cause funny results if nsec goes negative... is that
-	 * possible at all ?
-	 */
-	add	r4,r4,r5
-	add	r7,r7,r6
-	lis	r9,NSEC_PER_SEC@h
-	ori	r9,r9,NSEC_PER_SEC@l
-	cmpl	cr0,r7,r9
-	cmpli	cr1,r7,0
-	blt	1f
-	subf	r7,r9,r7
-	addi	r4,r4,1
-1:	bge	cr1,1f
-	addi	r4,r4,-1
-	add	r7,r7,r9
-1:	std	r4,TSPC64_TV_SEC(r11)
-	std	r7,TSPC64_TV_NSEC(r11)
-
-	mtlr	r12
-	crclr	cr0*4+so
-	li	r3,0
-	blr
-
-	/*
-	 * syscall fallback
-	 */
-98:
-	mtlr	r12
-	mr	r3,r10
-	mr	r4,r11
-99:
-	li	r0,__NR_clock_gettime
-	sc
-	blr
-  .cfi_endproc
-V_FUNCTION_END(__kernel_clock_gettime)
-
-
-/*
- * Exact prototype of clock_getres()
- *
- * int __kernel_clock_getres(clockid_t clock_id, struct timespec *res);
- *
- */
-V_FUNCTION_BEGIN(__kernel_clock_getres)
-  .cfi_startproc
-	/* Check for supported clock IDs */
-	cmpwi	cr0,r3,CLOCK_REALTIME
-	cmpwi	cr1,r3,CLOCK_MONOTONIC
-	cror	cr0*4+eq,cr0*4+eq,cr1*4+eq
-	bne	cr0,99f
-
-	li	r3,0
-	cmpli	cr0,r4,0
-	crclr	cr0*4+so
-	beqlr
-	lis	r5,CLOCK_REALTIME_RES@h
-	ori	r5,r5,CLOCK_REALTIME_RES@l
-	std	r3,TSPC64_TV_SEC(r4)
-	std	r5,TSPC64_TV_NSEC(r4)
-	blr
-
-	/*
-	 * syscall fallback
-	 */
-99:
-	li	r0,__NR_clock_getres
-	sc
-	blr
-  .cfi_endproc
-V_FUNCTION_END(__kernel_clock_getres)
-
-
-/*
- * This is the core of gettimeofday(), it returns the xsec
- * value in r4 and expects the datapage ptr (non clobbered)
- * in r3. clobbers r0,r4,r5,r6,r7,r8
- * When returning, r8 contains the counter value that can be reused
- */
-V_FUNCTION_BEGIN(__do_get_xsec)
-  .cfi_startproc
-	/* check for update count & load values */
-1:	ld	r8,CFG_TB_UPDATE_COUNT(r3)
-	andi.	r0,r8,1			/* pending update ? loop */
-	bne-	1b
-	xor	r0,r8,r8		/* create dependency */
-	add	r3,r3,r0
-
-	/* Get TB & offset it */
-	mftb	r7
-	ld	r9,CFG_TB_ORIG_STAMP(r3)
-	subf	r7,r9,r7
-
-	/* Scale result */
-	ld	r5,CFG_TB_TO_XS(r3)
-	mulhdu	r7,r7,r5
-
-	/* Add stamp since epoch */
-	ld	r6,CFG_STAMP_XSEC(r3)
-	add	r4,r6,r7
-
-	xor	r0,r4,r4
-	add	r3,r3,r0
-	ld	r0,CFG_TB_UPDATE_COUNT(r3)
-        cmpld   cr0,r0,r8		/* check if updated */
-	bne-	1b
-	blr
-  .cfi_endproc
-V_FUNCTION_END(__do_get_xsec)
Index: linux-2.6/arch/powerpc/kernel/vdso64/vdso64.lds.S
===================================================================
--- linux-2.6.orig/arch/powerpc/kernel/vdso64/vdso64.lds.S
+++ linux-2.6/arch/powerpc/kernel/vdso64/vdso64.lds.S
@@ -105,10 +105,6 @@ VERSION
     global:
 	__kernel_datapage_offset; /* Has to be there for the kernel to find */
 	__kernel_get_syscall_map;
-    	__kernel_gettimeofday;
-	__kernel_clock_gettime;
-	__kernel_clock_getres;
-	__kernel_get_tbfreq;
 	__kernel_sync_dicache;
 	__kernel_sync_dicache_p5;
 	__kernel_sigtramp_rt64;
Index: linux-2.6/include/asm-powerpc/time.h
===================================================================
--- linux-2.6.orig/include/asm-powerpc/time.h
+++ linux-2.6/include/asm-powerpc/time.h
@@ -45,26 +45,6 @@ extern unsigned long ppc_proc_freq;
 extern unsigned long ppc_tb_freq;
 #define DEFAULT_TB_FREQ		125000000UL
 
-/*
- * By putting all of this stuff into a single struct we 
- * reduce the number of cache lines touched by do_gettimeofday.
- * Both by collecting all of the data in one cache line and
- * by touching only one TOC entry on ppc64.
- */
-struct gettimeofday_vars {
-	u64 tb_to_xs;
-	u64 stamp_xsec;
-	u64 tb_orig_stamp;
-};
-
-struct gettimeofday_struct {
-	unsigned long tb_ticks_per_sec;
-	struct gettimeofday_vars vars[2];
-	struct gettimeofday_vars * volatile varp;
-	unsigned      var_idx;
-	unsigned      tb_to_us;
-};
-
 struct div_result {
 	u64 result_high;
 	u64 result_low;
Index: linux-2.6/include/asm-powerpc/vdso_datapage.h
===================================================================
--- linux-2.6.orig/include/asm-powerpc/vdso_datapage.h
+++ linux-2.6/include/asm-powerpc/vdso_datapage.h
@@ -74,11 +74,6 @@ struct vdso_data {
 	__u32 icache_size;		/* L1 i-cache size		0x68 */
 	__u32 icache_line_size;		/* L1 i-cache line size		0x6C */
 
-	/* those additional ones don't have to be located anywhere
-	 * special as they were not part of the original systemcfg
-	 */
-	__s32 wtom_clock_sec;			/* Wall to monotonic clock */
-	__s32 wtom_clock_nsec;
    	__u32 syscall_map_64[SYSCALL_MAP_SIZE]; /* map of syscalls  */
    	__u32 syscall_map_32[SYSCALL_MAP_SIZE]; /* map of syscalls */
 };
@@ -89,15 +84,6 @@ struct vdso_data {
  * And here is the simpler 32 bits version
  */
 struct vdso_data {
-	__u64 tb_orig_stamp;		/* Timebase at boot		0x30 */
-	__u64 tb_ticks_per_sec;		/* Timebase tics / sec		0x38 */
-	__u64 tb_to_xs;			/* Inverse of TB to 2^20	0x40 */
-	__u64 stamp_xsec;		/*				0x48 */
-	__u32 tb_update_count;		/* Timebase atomicity ctr	0x50 */
-	__u32 tz_minuteswest;		/* Minutes west of Greenwich	0x58 */
-	__u32 tz_dsttime;		/* Type of dst correction	0x5C */
-	__s32 wtom_clock_sec;			/* Wall to monotonic clock */
-	__s32 wtom_clock_nsec;
    	__u32 syscall_map_32[SYSCALL_MAP_SIZE]; /* map of syscalls */
 };
 

^ permalink raw reply

* Re: [PATCH] CPM_UART: Fixed SMC handling for CPM2 processors
From: Kalle Pokki @ 2006-11-06 20:49 UTC (permalink / raw)
  To: Vitaly Bordug; +Cc: linuxppc-embedded, Paul Mackerras
In-Reply-To: <20061106205543.43b2aacb@localhost.localdomain>

On Mon, 6 Nov 2006, Vitaly Bordug wrote:

>> This patch renames these the two existing resources, and introduces a
>> new one, "pram_base", which is a pointer to the parameter RAM. The
>> parameter RAM for SMC1 and SMC2 is put in the first 128 bytes of the
>> DPRAM. This memory was already reserved from the DPRAM memory
>> allocator for this purpose.
>>
> Well just one objection. pram_base should not be a device unless it applies to all the stuff of
> SoC family which is not the case.
>
> For this aim, I'd put what you need into the platform_data, or follow the same approach 8xx stuff having.

I'm not sure I follow you now. "pram_base" is not a device by itself, but 
it's just another resource in the PQ2 version of the SMC devices in the 
platform_data. So the resource is only present when it is needed, and for 
other platform devices that don't have this resource, the cpm_uart code 
does nothing (as it should not).

The only difference to the 8xx version is the new "pram_base" resource, 
and it is required with PQ2, right?

^ permalink raw reply

* Re: Can't build drivers/infiniband/hw/ipath/ipath_keys.c on arch/powerpc
From: Benjamin Herrenschmidt @ 2006-11-06 20:24 UTC (permalink / raw)
  To: Roland Dreier; +Cc: support, openib-general, Andrew Morton, linuxppc-dev list
In-Reply-To: <adak628o6ua.fsf@cisco.com>

On Mon, 2006-11-06 at 08:52 -0800, Roland Dreier wrote:
>  > I'm surprised that something as recent as infiniband requires a
>  > long-deprecated function bus_to_virt().
>  > 
>  > What is it trying to do there that needs that call ?
> 
> Don't ask -- just enjoy the fact that you don't know about this...

Deal :)

Ben.

^ permalink raw reply

* Re: APUS and IOs question
From: Benjamin Herrenschmidt @ 2006-11-06 20:14 UTC (permalink / raw)
  To: Simon Richter; +Cc: linuxppc-dev
In-Reply-To: <454F5259.3020107@hogyros.de>

On Mon, 2006-11-06 at 16:18 +0100, Simon Richter wrote:
> Hi,
> 
> Benjamin Herrenschmidt wrote:
> 
> > Somebody who understands APUS around ?
> 
> I have one, but I don't understand all of it. :-)
> 
> > In include/asm-ppc/io.h, we have a special definition of the PCI IO
> > accessors readw,writew,readl and writel for APUS that don't do byteswap
> > and also don't do barriers.
> 
> APUS PCI is weird, to say the least. The PCI extension is basically
> built to accomodate a single PCI device, which happens to be a Permedia2
> graphics chip that allows byte-swapped mappings of both register and
> framebuffer space and is never told to do DMA because nobody knows what
> kind of interesting effects that would have, so the only synchronisation
> that is needed is between accesses to the framebuffer and the GPU.
> 
> That, and that the 604e+ probably doesn't reorder accesses that much
> anyway that the barriers would do any good here. :-)

Still, it annoys me to have an  APUS-specific definition of accessors
that would otherwise be common to everybody...

Anyway, I decided not to change asm-ppc/io.h, so this will only become
an issue if we ever move APUS over to arch/powerpc

Ben.

^ permalink raw reply

* Re: [PATCH/RFC (take 2)] linkstation / kurobox support under arch/powerpc
From: Guennadi Liakhovetski @ 2006-11-06 20:00 UTC (permalink / raw)
  To: Kumar Gala; +Cc: linuxppc-dev
In-Reply-To: <4EC85F22-99A9-4B0F-987C-25B715235320@kernel.crashing.org>

On Mon, 6 Nov 2006, Kumar Gala wrote:

> > +config  KUROBOX
> > +	bool "Kurobox"
> > +
> > +config  KUROBOXHG
> > +	bool "Kurobox HG"
> > +
> 
> These two config options don't appear to be used anywhere

Yep, right, left-overs. Forgot I switched to fdt properties.

> > +void __init linkstation_pcibios_fixup(void)
> > +{
> > +	struct pci_dev *dev = NULL;
> > +
> > +	for_each_pci_dev(dev)
> > +		pci_read_irq_line(dev);
> > +}
> > +
> 
> You don't need this fixup going forward.

You mean this patch: 
http://ozlabs.org/pipermail/linuxppc-dev/2006-October/027287.html? Yes, I 
knew about it, just that my local tree didn't have it yet:-)

> > +#include <linux/serial_reg.h>
> > +#include <linux/serial_8250.h>
> > +#include <asm/io.h>
> > +#include <asm/mpc10x.h>
> > +#include <asm/ppc_sys.h>
> > +#include <asm/prom.h>
> > +#include <asm/termbits.h>
> > +
> 
> Can this code not be reworked to use the standard 8250 driver?

I would gladly do, but I don't know how. There's no standard API to serial 
drivers from the kernel. There's linedisc, serio, but I don't think any of 
them directly fits my needs? I think, there was a patch recently on LKML 
exactly for this, but I didn't look at it too closely, haven't seen many 
replies either.

> > diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
> > index f1c7575..25cd8de 100644
> > --- a/drivers/net/r8169.c
> > +++ b/drivers/net/r8169.c
> > @@ -1396,41 +1396,6 @@ static void rtl8169_netpoll(struct net_d
> >  }
> >  #endif
> 
> Pull this into a separate patch since it effects a driver.  Also, any reason
> this code is being removed?

I explained in version 1 of the patch, sorry, didn't repeat: This is a 
recent patch to this driver, which I proved to break my system, so it has 
been now reverted as of 19-rc4. Just included it here for completeness in 
case anybody wants to boot this kernel:-) Of course, it doesn't actually 
belong here.

Thanks for ther review! I'll remove the superfluous config options, will 
be glad to see any ideas as to how to interface to the serial driver.

Thanks
Guennadi
---
Guennadi Liakhovetski

^ permalink raw reply


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