LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] powerpc/mm: Fix switch_mmu_context to iterate of the proper list of cpus
From: Josh Boyer @ 2009-08-05 13:16 UTC (permalink / raw)
  To: Michael Ellerman; +Cc: linuxppc-dev
In-Reply-To: <1249476742.5607.2.camel@concordia>

On Wed, Aug 05, 2009 at 10:52:22PM +1000, Michael Ellerman wrote:
>On Wed, 2009-08-05 at 07:32 -0400, Josh Boyer wrote:
>> On Tue, Aug 04, 2009 at 10:33:32PM -0500, Kumar Gala wrote:
>> >Introduced a temporary variable into our iterating over the list cpus
>> >that are threads on the same core.  For some reason Ben forgot how for
>> >loops work.
>> 
>> Have the powerpoint demons corrupted him already??
>
>No I think one of his kids gave him swine flu.

Whew.  You can recover from that at least ;)

josh

^ permalink raw reply

* Re: [PATCH] powerpc/mm: Fix switch_mmu_context to iterate of the proper list of cpus
From: Michael Ellerman @ 2009-08-05 12:52 UTC (permalink / raw)
  To: Josh Boyer; +Cc: linuxppc-dev
In-Reply-To: <20090805113230.GB8985@zod.rchland.ibm.com>

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

On Wed, 2009-08-05 at 07:32 -0400, Josh Boyer wrote:
> On Tue, Aug 04, 2009 at 10:33:32PM -0500, Kumar Gala wrote:
> >Introduced a temporary variable into our iterating over the list cpus
> >that are threads on the same core.  For some reason Ben forgot how for
> >loops work.
> 
> Have the powerpoint demons corrupted him already??

No I think one of his kids gave him swine flu.

cheers

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply

* ethernet phy attached to wrong driver
From: Stefan Strobl @ 2009-08-05 12:08 UTC (permalink / raw)
  To: linuxppc-dev

Hi

I'm having trouble with my Ethernet device on a TQM5200 based board with
LXT971 Phy. I'm running U-Boot 2009.03 and a Kernel 2.6.30.

When doing a ping under U-Boot before booting into Linux, Ethernet works
fine in Linux also. Dmesg reads:
[  262.369444] net eth0: Using PHY at MDIO address 0
[  263.265903] net eth0: attached phy 0 to driver LXT971

But if I start Linux without prior use of the fec under U-Boot, Ethernet
is not working in Linux. The wrong drivers seems to be attached to the
phy. Dmesg reads:
[    2.068285] net eth0: Using PHY at MDIO address 0
[    2.964774] net eth0: attached phy 0 to driver Generic PHY
                                                  ^^^^^^^^^^^
Is there a bootarg to tell linux which driver to use? Any ideas what I'm
doing wrong?

Regards
Stefan.

^ permalink raw reply

* Re: [PATCH] powerpc/mm: Fix switch_mmu_context to iterate of the proper list of cpus
From: Josh Boyer @ 2009-08-05 11:32 UTC (permalink / raw)
  To: Kumar Gala; +Cc: linuxppc-dev
In-Reply-To: <1249443212-25588-1-git-send-email-galak@kernel.crashing.org>

On Tue, Aug 04, 2009 at 10:33:32PM -0500, Kumar Gala wrote:
>Introduced a temporary variable into our iterating over the list cpus
>that are threads on the same core.  For some reason Ben forgot how for
>loops work.

Have the powerpoint demons corrupted him already??

josh

^ permalink raw reply

* Re: Next July 29 : Hugetlb test failure (OOPS free_hugepte_range)
From: Sachin Sant @ 2009-08-05 10:43 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: Stephen Rothwell, linux-next, linuxppc-dev
In-Reply-To: <1248957028.1509.85.camel@pasglop>

Benjamin Herrenschmidt wrote:
> Thanks. I'll have a look next week. I think when I changed the indices
> I may have forgotten to update something.
>   
Ben,

I can recreate this issue with today's next.
Let me know if i can help in any way to fix this issue.

Thanks
-Sachin

>> : ------------[ cut here ]------------
>> cpu 0x0: Vector: 700 (Program Check) at [c000000038923560]
>>     pc: c0000000000486d4: .free_hugepte_range+0x68/0xa0
>>     lr: c000000000048954: .hugetlb_free_pgd_range+0x248/0x38c
>>     sp: c0000000389237e0
>>    msr: 8000000000029032
>>   current = 0xc00000003b1d7780
>>   paca    = 0xc000000001002400
>>     pid   = 2839, comm = readback
>> kernel BUG at /home/linux-2.6.31-rc4/arch/powerpc/include/asm/pgalloc.h:36!
>> enter ? for help
>> [c000000038923880] c000000000048954 .hugetlb_free_pgd_range+0x248/0x38c
>> [c000000038923970] c000000000165a48 .free_pgtables+0xa0/0x154
>> [c000000038923a30] c000000000167f78 .exit_mmap+0x13c/0x1cc
>> [c000000038923ae0] c0000000000997ec .mmput+0x68/0x14c
>> [c000000038923b70] c00000000009f1d4 .exit_mm+0x190/0x1b8
>> [c000000038923c20] c0000000000a16e8 .do_exit+0x214/0x784
>> [c000000038923d00] c0000000000a1d1c .do_group_exit+0xc4/0xf8
>> [c000000038923da0] c0000000000a1d7c .SyS_exit_group+0x2c/0x48
>> [c000000038923e30] c0000000000085b4 syscall_exit+0x0/0x40
>> --- Exception: c01 (System Call) at 000000000fe15038
>> SP (ffb8e030) is in userspace
>> 0:mon> e
>> cpu 0x0: Vector: 700 (Program Check) at [c000000038923560]
>>     pc: c0000000000486d4: .free_hugepte_range+0x68/0xa0
>>     lr: c000000000048954: .hugetlb_free_pgd_range+0x248/0x38c
>>     sp: c0000000389237e0
>>    msr: 8000000000029032
>>   current = 0xc00000003b1d7780
>>   paca    = 0xc000000001002400
>>     pid   = 2839, comm = readback
>> kernel BUG at /home/linux-2.6.31-rc4/arch/powerpc/include/asm/pgalloc.h:36!
>> 0:mon> r
>> R00 = 0000000000000001   R16 = 0000000000000000
>> R01 = c0000000389237e0   R17 = 0000000000000001
>> R02 = c000000000f165a8   R18 = 000000003fffffff
>> R03 = c0000000014504d0   R19 = 0000000000000000
>> R04 = c000000039390001   R20 = 0000000000000000
>> R05 = 0000000000000007   R21 = 0000010000000000
>> R06 = 0000000000000000   R22 = 0000000040000000
>> R07 = 0000000040000000   R23 = c0000000014504d0
>> R08 = c00000003d708188   R24 = 000000003fffffff
>> R09 = c00000003eb40000   R25 = 0000000000000007
>> R10 = c00000003d708188   R26 = c00000003ebd41b8
>> R11 = 0000000000000018   R27 = c0000000014504d0
>> R12 = 0000000040000448   R28 = c00000003eb40018
>> R13 = c000000001002400   R29 = 0000000000000008
>> R14 = 00000000ffffffff   R30 = 0000000040000000
>> R15 = 00000000ffffffff   R31 = c0000000389237e0
>> pc  = c0000000000486d4 .free_hugepte_range+0x68/0xa0
>> lr  = c000000000048954 .hugetlb_free_pgd_range+0x248/0x38c
>> msr = 8000000000029032   cr  = 20042444
>> ctr = 800000000000b6f4   xer = 0000000000000001   trap =  700
>> 0:mon> 
>>
>> Line 36 of arch/powerpc/include/asm/pgalloc.h corresponds to
>>
>> BUG_ON(cachenum > PGF_CACHENUM_MASK);
>>
>> May be something to do with number of elements in huge_pgtable_cache_name ??
>>
>> Thanks
>> -Sachin
-- 

---------------------------------
Sachin Sant
IBM Linux Technology Center
India Systems and Technology Labs
Bangalore, India
---------------------------------

^ permalink raw reply

* Re: linux-next: Tree for August 5
From: Stephen Rothwell @ 2009-08-05 10:13 UTC (permalink / raw)
  To: Boaz Harrosh; +Cc: linux-next, ppc-dev, LKML
In-Reply-To: <4A793EA8.50306@panasas.com>

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

Hi Boaz,

On Wed, 05 Aug 2009 11:11:20 +0300 Boaz Harrosh <bharrosh@panasas.com> wrote:
>
> On 08/05/2009 10:23 AM, Stephen Rothwell wrote:
> > 
> > This tree fails to build for powerpc allyesconfig (final link problem).
> 
> Above is reported for a long time. Is it related to this:
> http://www.spinics.net/lists/kernel/msg921978.html

No, it is this:

powerpc-linux-ld: TOC section size exceeds 64k

It is powerpc specific and the only way we can think of fixing it
involves stopping building the built-in.o files and linking the entire
kernel in one go at the end.  We just haven't had time (or the energy) to
try to fix it properly while it only affects the final link of the
allyesconfig kernel. 

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply

* Re: 2.6.31-rc5-git2 crash on a idle system.
From: Benjamin Herrenschmidt @ 2009-08-05  9:52 UTC (permalink / raw)
  To: Sachin Sant; +Cc: neilb, linuxppc-dev, linux-raid
In-Reply-To: <4A794E26.8080207@in.ibm.com>


> 2.6.31-rc5-git1 (4905f92ed752d49ebe9cce4fe78a4bc39e710523) works fine
> on this box without any problem. So the problem was introduced between
> 2.6.31-rc5-git1 (4905f92ed752d49ebe9cce4fe78a4bc39e710523) and
> 2.6.31-rc5-git2 (a33a052f19a21d727847391c8c1aff3fb221c472).
> 
> Looking at the changelog all the changes are confined to
> drivers/md/ directory ( probably following five commits ). I do have
> all the CONFIG_MD* options enabled in my kernel.
> 
> 449aad3e25358812c43afc60918c5ad3819488e7
> 70471dafe3390243c598a3165dfb86b8b8b3f4fe
> 3673f305faf1bc66ead751344f8262ace851ff44
> 3a981b03f38dc3b8a69b77cbc679e66c1318a44a
> ac5e7113e74872928844d00085bd47c988f12728
> 
> I will try to find out the exact commit.

Thanks. Since it's a memory corruption (or seems to be) however, it's
possible that the bisection will mislead you. IE. The culprit could be
somewhere else, and the commit you'll find via bisection just happens to
move things around in the kernel in such a way that the corruption hits
that code path instead of another rarely used one.

I would suggest using printk to print out the content of memory where
the code appears to have been smashed at different stages during boot
(maybe even in the initcalls loop in init/main.c) to try to point out
what appears to be causing the corruption.

Cheers,
Ben.

> Thanks
> -Sachin
> 
> 
> plain text document attachment (rc5-git2-log)
> [root@mjs22lp1 home]# cpu 0x0: Vector: 700 (Program Check) at [c00000000ffffa90]
>     pc: c000000000600000: .flow_cache_new_hashrnd+0x3c/0xcc
>     lr: c0000000000c6038: .run_timer_softirq+0x20c/0x2f4
>     sp: c00000000ffffd10
>    msr: 8000000000089032
>   current = 0xc000000000f58b70
>   paca    = 0xc0000000010b2400
>     pid   = 0, comm = swapper
> enter ? for help
> [c00000000ffffda0] c0000000000c6038 .run_timer_softirq+0x20c/0x2f4
> [c00000000ffffea0] c0000000000be8a0 .__do_softirq+0x174/0x2c8
> [c00000000fffff90] c0000000000307b0 .call_do_softirq+0x14/0x24
> [c000000001013870] c00000000000ecf8 .do_softirq+0xa0/0x104
> [c000000001013910] c0000000000be1d0 .irq_exit+0x74/0xd4
> [c000000001013990] c00000000002ce20 .timer_interrupt+0x1cc/0x200
> [c000000001013a30] c000000000003728 decrementer_common+0x128/0x180
> --- Exception: 901 (Decrementer) at c00000000000ec3c .raw_local_irq_restore+0xc0/0xdc
> [c000000001013dc0] c000000000015824 .cpu_idle+0x13c/0x1e0
> [c000000001013e60] c000000000009fe8 .rest_init+0x94/0xcc
> [c000000001013ee0] c000000000990cf4 .start_kernel+0x484/0x4a8
> [c000000001013f90] c000000000008408 .start_here_common+0x2c/0xa4
> 0:mon> e
> cpu 0x0: Vector: 700 (Program Check) at [c00000000ffffa90]
>     pc: c000000000600000: .flow_cache_new_hashrnd+0x3c/0xcc
>     lr: c0000000000c6038: .run_timer_softirq+0x20c/0x2f4
>     sp: c00000000ffffd10
>    msr: 8000000000089032
>   current = 0xc000000000f58b70
>   paca    = 0xc0000000010b2400
>     pid   = 0, comm = swapper
> 0:mon> di c000000000600000 
> c000000000600000  00001010      .long 0x1010
> c000000000600004  00000008      .long 0x8
> c000000000600008  00001013      .long 0x1013
> c00000000060000c  0000000f      .long 0xf
> c000000000600010  7961626f      rldimi. r1,r11,44,41
> c000000000600014  6f740000      xoris   r20,r27,0
> c000000000600018  00101600      .long 0x101600
> c00000000060001c  00000c00      .long 0xc00
> c000000000600020  00000400      .long 0x400
> c000000000600024  00101100      .long 0x101100
> c000000000600028  000008e9      .long 0x8e9
> c00000000060002c  60000000      nop
> c000000000600030  e93e8050      ld      r9,-32688(r30)
> c000000000600034  7c6507b4      extsw   r5,r3
> c000000000600038  78ab4da4      rldicr  r11,r5,9,54
> c00000000060003c  396b0040      addi    r11,r11,64
> 0:mon> r
> R00 = c0000000000c6038   R16 = 0000000000000000
> R01 = c00000000ffffd10   R17 = 0000000000000100
> R02 = c000000001011110   R18 = c000000001059300
> R03 = 0000000000000000   R19 = c000000001102f98
> R04 = c00000000ffffd60   R20 = c000000001103398
> R05 = ffffffffffffffff   R21 = c000000001103798
> R06 = 0000000000000700   R22 = c000000001103b98
> R07 = 0000000000000001   R23 = 0000000000000000
> R08 = 0000000000830000   R24 = c00000000fffc000
> R09 = c00000000072f890   R25 = 0000000000000000
> R10 = c00000000120fbf8   R26 = 0000000000200200
> R11 = c000000000600090   R27 = c00000000ffffe10
> R12 = 0000000028000022   R28 = 0000000000000001
> R13 = c0000000010b2400   R29 = c0000000010805e8
> R14 = 0000000000382800   R30 = c000000000fb4f78
> R15 = 0000000000000000   R31 = c00000000ffffd10
> pc  = c000000000600000 .flow_cache_new_hashrnd+0x3c/0xcc
> lr  = c0000000000c6038 .run_timer_softirq+0x20c/0x2f4
> msr = 8000000000089032   cr  = 28000024
> ctr = c0000000005fffc4   xer = 0000000000000000   trap =  700
> 0:mon> dl
> <6>Phyp-dump disabled at boot time
> <6>Using pSeries machine description
> <7>Page orders: linear mapping = 24, virtual = 16, io = 12, vmemmap = 24
> <6>Using 1TB segments
> <4>Found initrd at 0xc000000002000000:0xc000000002382800
> <6>console [udbg0] enabled
> <6>Partition configured for 8 cpus.
> <6>CPU maps initialized for 2 threads per core
> <7> (thread shift is 1)
> <4>Starting Linux PPC64 #1 SMP Tue Aug 4 12:15:55 IST 2009
> <4>-----------------------------------------------------
> <4>ppc64_pft_size                = 0x1a
> <4>physicalMemorySize            = 0xa0000000
> <4>htab_hash_mask                = 0x7ffff
> <4>-----------------------------------------------------
> <6>Initializing cgroup subsys cpuset
> <6>Initializing cgroup subsys cpu
> <5>Linux version 2.6.31-rc5-git2 (root@mjs22lp1) (gcc version 4.4.0 20090307 (Red Hat 4.4.0-0.23) (GCC) ) #1 SMP Tue Aug 4 12:15:55 IST 2009
> <4>[boot]0012 Setup Arch
> <7>Node 0 Memory: 0x0-0x54000000
> <7>Node 1 Memory: 0x54000000-0xa0000000
> <4>EEH: No capable adapters found
> <6>PPC64 nvram contains 15360 bytes
> <7>Using shared processor idle loop
> <4>Zone PFN ranges:
> <4>  DMA      0x00000000 -> 0x0000a000
> <4>  Normal   0x0000a000 -> 0x0000a000
> <4>Movable zone start PFN for each node
> <4>early_node_map[2] active PFN ranges
> <4>    0: 0x00000000 -> 0x00005400
> <4>    1: 0x00005400 -> 0x0000a000
> <7>On node 0 totalpages: 21504
> <7>  DMA zone: 19 pages used for memmap
> <7>  DMA zone: 0 pages reserved
> <7>  DMA zone: 21485 pages, LIFO batch:1
> <7>On node 1 totalpages: 19456
> <7>  DMA zone: 17 pages used for memmap
> <7>  DMA zone: 0 pages reserved
> <7>  DMA zone: 19439 pages, LIFO batch:1
> <4>[boot]0015 Setup Done
> <4>Built 2 zonelists in Node order, mobility grouping on.  Total pages: 40924
> <4>Policy zone: DMA
> <5>Kernel command line: ro console=hvc0 root=UUID=9448b379-7842-486c-8bc8-22a1427c4462 
> <4>PID hash table entries: 4096 (order: 12, 32768 bytes)
> <4>freeing bootmem node 0
> <4>freeing bootmem node 1
> <6>Memory: 2570560k/2621440k available (15296k kernel code, 50880k reserved, 1152k data, 1488k bss, 5504k init)
> <6>SLUB: Genslabs=18, HWalign=128, Order=0-3, MinObjects=0, CPUs=8, Nodes=16
> <6>Hierarchical RCU implementation.
> <6>NR_IRQS:512
> <4>[boot]0020 XICS Init
> <4>[boot]0021 XICS Done
> <7>pic: no ISA interrupt controller
> <7>time_init: decrementer frequency = 512.000000 MHz
> <7>time_init: processor frequency   = 4005.000000 MHz
> <6>clocksource: timebase mult[7d0000] shift[22] registered
> <7>clockevent: decrementer mult[83126e97] shift[32] cpu[0]
> <4>Console: colour dummy device 80x25
> <6>console handover: boot [udbg0] -> real [hvc0]
> <6>allocated 1638400 bytes of page_cgroup
> <6>please try 'cgroup_disable=memory' option if you don't want memory cgroups
> <6>Security Framework initialized
> <6>SELinux:  Initializing.
> <7>SELinux:  Starting in permissive mode
> <6>Dentry cache hash table entries: 524288 (order: 6, 4194304 bytes)
> <6>Inode-cache hash table entries: 262144 (order: 5, 2097152 bytes)
> <4>Mount-cache hash table entries: 4096
> <6>Initializing cgroup subsys ns
> <6>Initializing cgroup subsys cpuacct
> <6>Initializing cgroup subsys memory
> <6>Initializing cgroup subsys devices
> <6>Initializing cgroup subsys freezer
> <6>Initializing cgroup subsys net_cls
> <6>ftrace: allocating 19543 entries in 8 pages
> <7>irq: irq 2 on host null mapped to virtual irq 16
> <7>clockevent: decrementer mult[83126e97] shift[32] cpu[1]
> <4>Processor 1 found.
> <7>clockevent: decrementer mult[83126e97] shift[32] cpu[2]
> <4>Processor 2 found.
> <7>clockevent: decrementer mult[83126e97] shift[32] cpu[3]
> <4>Processor 3 found.
> <7>clockevent: decrementer mult[83126e97] shift[32] cpu[4]
> <4>Processor 4 found.
> <7>clockevent: decrementer mult[83126e97] shift[32] cpu[5]
> <4>Processor 5 found.
> <7>clockevent: decrementer mult[83126e97] shift[32] cpu[6]
> <4>Processor 6 found.
> <7>clockevent: decrementer mult[83126e97] shift[32] cpu[7]
> <4>Processor 7 found.
> <6>Brought up 8 CPUs
> <7>Node 0 CPUs: 0-7
> <7>Node 1 CPUs:
> <7>CPU0 attaching sched-domain:
> <7> domain 0: span 0-1 level SIBLING
> <7>  groups: 0 1
> <7>  domain 1: span 0-7 level CPU
> <7>   groups: 0-1 2-3 4-5 6-7
> <7>   domain 2: span 0-7 level NODE
> <7>    groups: 0-7 (__cpu_power = 4096)
> <7>CPU1 attaching sched-domain:
> <7> domain 0: span 0-1 level SIBLING
> <7>  groups: 1 0
> <7>  domain 1: span 0-7 level CPU
> <7>   groups: 0-1 2-3 4-5 6-7
> <7>   domain 2: span 0-7 level NODE
> <7>    groups: 0-7 (__cpu_power = 4096)
> <7>CPU2 attaching sched-domain:
> <7> domain 0: span 2-3 level SIBLING
> <7>  groups: 2 3
> <7>  domain 1: span 0-7 level CPU
> <7>   groups: 2-3 4-5 6-7 0-1
> <7>   domain 2: span 0-7 level NODE
> <7>    groups: 0-7 (__cpu_power = 4096)
> <7>CPU3 attaching sched-domain:
> <7> domain 0: span 2-3 level SIBLING
> <7>  groups: 3 2
> <7>  domain 1: span 0-7 level CPU
> <7>   groups: 2-3 4-5 6-7 0-1
> <7>   domain 2: span 0-7 level NODE
> <7>    groups: 0-7 (__cpu_power = 4096)
> <7>CPU4 attaching sched-domain:
> <7> domain 0: span 4-5 level SIBLING
> <7>  groups: 4 5
> <7>  domain 1: span 0-7 level CPU
> <7>   groups: 4-5 6-7 0-1 2-3
> <7>   domain 2: span 0-7 level NODE
> <7>    groups: 0-7 (__cpu_power = 4096)
> <7>CPU5 attaching sched-domain:
> <7> domain 0: span 4-5 level SIBLING
> <7>  groups: 5 4
> <7>  domain 1: span 0-7 level CPU
> <7>   groups: 4-5 6-7 0-1 2-3
> <7>   domain 2: span 0-7 level NODE
> <7>    groups: 0-7 (__cpu_power = 4096)
> <7>CPU6 attaching sched-domain:
> <7> domain 0: span 6-7 level SIBLING
> <7>  groups: 6 7
> <7>  domain 1: span 0-7 level CPU
> <7>   groups: 6-7 0-1 2-3 4-5
> <7>   domain 2: span 0-7 level NODE
> <7>    groups: 0-7 (__cpu_power = 4096)
> <7>CPU7 attaching sched-domain:
> <7> domain 0: span 6-7 level SIBLING
> <7>  groups: 7 6
> <7>  domain 1: span 0-7 level CPU
> <7>   groups: 6-7 0-1 2-3 4-5
> <7>   domain 2: span 0-7 level NODE
> <7>    groups: 0-7 (__cpu_power = 4096)
> <6>regulator: core version 0.5
> <6>NET: Registered protocol family 16
> <6>IBM eBus Device Driver
> <6>POWER6 performance monitor hardware support registered
> <6>PCI: Probing PCI hardware
> <7>PCI: Probing PCI hardware done
> <4>bio: create slab <bio-0> at 0
> <5>SCSI subsystem initialized
> <7>libata version 3.00 loaded.
> <6>usbcore: registered new interface driver usbfs
> <6>usbcore: registered new interface driver hub
> <6>usbcore: registered new device driver usb
> <6>NetLabel: Initializing
> <6>NetLabel:  domain hash size = 128
> <6>NetLabel:  protocols = UNLABELED CIPSOv4
> <6>NetLabel:  unlabeled traffic allowed by default
> <7>Switched to high resolution mode on CPU 0
> <7>Switched to high resolution mode on CPU 3
> <7>Switched to high resolution mode on CPU 4
> <7>Switched to high resolution mode on CPU 5
> <7>Switched to high resolution mode on CPU 1
> <7>Switched to high resolution mode on CPU 6
> <7>Switched to high resolution mode on CPU 2
> <7>Switched to high resolution mode on CPU 7
> <6>NET: Registered protocol family 2
> <6>IP route cache hash table entries: 32768 (order: 2, 262144 bytes)
> <6>TCP established hash table entries: 131072 (order: 5, 2097152 bytes)
> <6>TCP bind hash table entries: 65536 (order: 4, 1048576 bytes)
> <6>TCP: Hash tables configured (established 131072 bind 65536)
> <6>TCP reno registered
> <6>NET: Registered protocol family 1
> <6>Trying to unpack rootfs image as initramfs...
> <4>Freeing initrd memory: 3594k freed
> <7>irq: irq 655360 on host null mapped to virtual irq 17
> <7>irq: irq 655362 on host null mapped to virtual irq 18
> <6>IOMMU table initialized, virtual merging enabled
> <7>irq: irq 655364 on host null mapped to virtual irq 19
> <7>irq: irq 655365 on host null mapped to virtual irq 20
> <7>irq: irq 589825 on host null mapped to virtual irq 21
> <7>RTAS daemon started
> <7>RTAS: event: 23, Type: Platform Information Event, Severity: 1
> <6>audit: initializing netlink socket (disabled)
> <5>type=2000 audit(1249386596.125:1): initialized
> <6>HugeTLB registered 16 MB page size, pre-allocated 0 pages
> <6>HugeTLB registered 16 GB page size, pre-allocated 0 pages
> <5>VFS: Disk quotas dquot_6.5.2
> <4>Dquot-cache hash table entries: 8192 (order 0, 65536 bytes)
> <6>msgmni has been set to 5024
> <7>SELinux:  Registering netfilter hooks
> <6>alg: No test for stdrng (krng)
> <6>Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)
> <6>io scheduler noop registered
> <6>io scheduler anticipatory registered
> <6>io scheduler deadline registered
> <6>io scheduler cfq registered (default)
> <6>pci_hotplug: PCI Hot Plug PCI Core version: 0.5
> <6>pciehp: PCI Express Hot Plug Controller Driver version: 0.4
> <7>vio_register_driver: driver hvc_console registering
> <7>HVSI: registered 0 devices
> <6>Linux agpgart interface v0.103
> <6>Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
> <4>Platform driver 'serial8250' needs updating - please use dev_pm_ops
> <6>TX39/49 Serial driver version 1.11
> <4>Platform driver 'serial_txx9' needs updating - please use dev_pm_ops
> <6>brd: module loaded
> <6>loop: module loaded
> <6>input: Macintosh mouse button emulation as /devices/virtual/input/input0
> <6>Uniform Multi-Platform E-IDE driver
> <6>ide-gd driver 1.18
> <6>Fixed MDIO Bus: probed
> <6>ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
> <6>ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
> <6>uhci_hcd: USB Universal Host Controller Interface driver
> <6>mice: PS/2 mouse device common for all mice
> <6>device-mapper: uevent: version 1.0.3
> <6>device-mapper: ioctl: 4.15.0-ioctl (2009-04-01) initialised: dm-devel@redhat.com
> <6>usbcore: registered new interface driver hiddev
> <6>usbcore: registered new interface driver usbhid
> <6>usbhid: v2.6:USB HID core driver
> <4>nf_conntrack version 0.5.0 (16384 buckets, 65536 max)
> <4>CONFIG_NF_CT_ACCT is deprecated and will be removed soon. Please use
> <4>nf_conntrack.acct=1 kernel parameter, acct=1 nf_conntrack module option or
> <4>sysctl net.netfilter.nf_conntrack_acct=1 to enable it.
> <6>ip_tables: (C) 2000-2006 Netfilter Core Team
> <6>TCP cubic registered
> <6>Initializing XFRM netlink socket
> <6>NET: Registered protocol family 17
> <7>Running MSI bitmap self-tests ...
> <7>PM: Resume from disk failed.
> <4>registered taskstats version 1
> <6>Initalizing network drop monitor service
> <4>Freeing unused kernel memory: 5504k freed
> <7>vio_register_driver: driver ibmvscsi registering
> <6>ibmvscsi 30000002: SRP_VERSION: 16.a
> <6>scsi0 : IBM POWER Virtual SCSI Adapter 1.5.8
> <6>ibmvscsi 30000002: partner initialization complete
> <6>ibmvscsi 30000002: host srp version: 16.a, host partition 06-1C12A (1), OS 3, max io 262144
> <6>ibmvscsi 30000002: Client reserve enabled
> <6>ibmvscsi 30000002: sent SRP login
> <6>ibmvscsi 30000002: SRP_LOGIN succeeded
> <5>scsi 0:0:1:0: Direct-Access     AIX      VDASD            0001 PQ: 0 ANSI: 3
> <5>scsi 0:0:2:0: CD-ROM            AIX      VOPTA                 PQ: 0 ANSI: 4
> <6>scsi: waiting for bus probes to complete ...
> <5>sd 0:0:1:0: Attached scsi generic sg0 type 0
> <5>sd 0:0:1:0: [sda] 147324928 512-byte logical blocks: (75.4 GB/70.2 GiB)
> <5>sd 0:0:1:0: [sda] Write Protect is off
> <7>sd 0:0:1:0: [sda] Mode Sense: 17 00 00 08
> <5>sd 0:0:1:0: [sda] Cache data unavailable
> <3>sd 0:0:1:0: [sda] Assuming drive cache: write through
> <4>sr0: scsi-1 drive
> <6>Uniform CD-ROM driver Revision: 3.20
> <7>sr 0:0:2:0: Attached scsi CD-ROM sr0
> <5>sr 0:0:2:0: Attached scsi generic sg1 type 5
> <5>sd 0:0:1:0: [sda] Cache data unavailable
> <3>sd 0:0:1:0: [sda] Assuming drive cache: write through
> <6> sda: sda1 sda2 sda3 sda4 < sda5 sda6 sda7 sda8 >
> <5>sd 0:0:1:0: [sda] Cache data unavailable
> <3>sd 0:0:1:0: [sda] Assuming drive cache: write through
> <5>sd 0:0:1:0: [sda] Attached SCSI disk
> <6>EXT4-fs (sda3): INFO: recovery required on readonly filesystem
> <6>EXT4-fs (sda3): write access will be enabled during recovery
> <6>EXT4-fs (sda3): barriers enabled
> <6>kjournald2 starting: pid 126, dev sda3:8, commit interval 5 seconds
> <6>EXT4-fs (sda3): delayed allocation enabled
> <6>EXT4-fs: file extents enabled
> <6>EXT4-fs: mballoc enabled
> <6>EXT4-fs (sda3): recovery complete
> <6>EXT4-fs (sda3): mounted filesystem with ordered data mode
> <5>type=1404 audit(1249386597.188:2): enforcing=1 old_enforcing=0 auid=4294967295 ses=4294967295
> <7>SELinux: 8192 avtab hash slots, 117789 rules.
> <7>SELinux: 8192 avtab hash slots, 117789 rules.
> <7>SELinux:  8 users, 13 roles, 2653 types, 121 bools, 1 sens, 1024 cats
> <7>SELinux:  74 classes, 117789 rules
> <7>SELinux:  Completing initialization.
> <7>SELinux:  Setting up existing superblocks.
> <7>SELinux: initialized (dev sda3, type ext4), uses xattr
> <7>SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs
> <7>SELinux: initialized (dev selinuxfs, type selinuxfs), uses genfs_contexts
> <7>SELinux: initialized (dev mqueue, type mqueue), uses transition SIDs
> <7>SELinux: initialized (dev hugetlbfs, type hugetlbfs), uses genfs_contexts
> <7>SELinux: initialized (dev devpts, type devpts), uses transition SIDs
> <7>SELinux: initialized (dev inotifyfs, type inotifyfs), uses genfs_contexts
> <7>SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs
> <7>SELinux: initialized (dev anon_inodefs, type anon_inodefs), uses genfs_contexts
> <7>SELinux: initialized (dev pipefs, type pipefs), uses task SIDs
> <7>SELinux: initialized (dev debugfs, type debugfs), uses genfs_contexts
> <7>SELinux: initialized (dev sockfs, type sockfs), uses task SIDs
> <7>SELinux: initialized (dev proc, type proc), uses genfs_contexts
> <7>SELinux: initialized (dev bdev, type bdev), uses genfs_contexts
> <7>SELinux: initialized (dev rootfs, type rootfs), uses genfs_contexts
> <7>SELinux: initialized (dev sysfs, type sysfs), uses genfs_contexts
> <5>type=1403 audit(1249386597.481:3): policy loaded auid=4294967295 ses=4294967295
> <6>udev: starting version 141
> <7>drivers/net/ibmveth.c: ibmveth: IBM i/pSeries Virtual Ethernet Driver 1.03
> <7>vio_register_driver: driver ibmveth registering
> <6>IBM eHEA ethernet device driver (Release EHEA_0101)
> <7>irq: irq 590080 on host null mapped to virtual irq 256
> <6>ehea: eth0: Jumbo frames are enabled
> <6>ehea: eth0 -> logical port id #3
> <6>ehea: eth2: Jumbo frames are enabled
> <6>ehea: eth2 -> logical port id #4
> <6>udev: renamed network interface eth1 to eth3
> <6>udev: renamed network interface eth0_rename to eth1
> <6>device-mapper: multipath: version 1.1.0 loaded
> <6>EXT4-fs (sda3): internal journal on sda3:8
> <6>kjournald starting.  Commit interval 5 seconds
> <6>EXT3 FS on sda2, internal journal
> <6>EXT3-fs: mounted filesystem with writeback data mode.
> <7>SELinux: initialized (dev sda2, type ext3), uses xattr
> <7>SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs
> <7>SELinux: initialized (dev binfmt_misc, type binfmt_misc), uses genfs_contexts
> <6>NET: Registered protocol family 10
> <6>lo: Disabled Privacy Extensions
> <6>RPC: Registered udp transport module.
> <6>RPC: Registered tcp transport module.
> <7>SELinux: initialized (dev rpc_pipefs, type rpc_pipefs), uses genfs_contexts
> <7>irq: irq 779 on host null mapped to virtual irq 267
> <6>ehea: eth2: Physical port up
> <6>ehea: External switch port is backup port
> <7>irq: irq 780 on host null mapped to virtual irq 268
> <7>irq: irq 781 on host null mapped to virtual irq 269
> <6>ehea: eth0: Physical port up
> <6>ehea: External switch port is backup port
> <7>irq: irq 782 on host null mapped to virtual irq 270
> <6>Bluetooth: Core ver 2.15
> <6>NET: Registered protocol family 31
> <6>Bluetooth: HCI device and connection manager initialized
> <6>Bluetooth: HCI socket layer initialized
> <6>Bluetooth: L2CAP ver 2.13
> <6>Bluetooth: L2CAP socket layer initialized
> <6>Bluetooth: BNEP (Ethernet Emulation) ver 1.3
> <6>Bluetooth: BNEP filters: protocol multicast
> <6>Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
> <7>SELinux: initialized (dev nfsd, type nfsd), uses genfs_contexts
> <4>NFSD: Using /var/lib/nfs/v4recovery as the NFSv4 state recovery directory
> <6>NFSD: starting 90-second grace period
> <5>Bridge firewalling registered
> <6>Bluetooth: SCO (Voice Link) ver 0.6
> <6>Bluetooth: SCO socket layer initialized
> <6>virbr0: starting userspace STP failed, starting kernel STP
> <7>SELinux: initialized (dev mqueue, type mqueue), uses transition SIDs
> <7>SELinux: initialized (dev proc, type proc), uses genfs_contexts
> <7>SELinux: initialized (dev mqueue, type mqueue), uses transition SIDs
> <6>lo: Disabled Privacy Extensions
> <7>SELinux: initialized (dev proc, type proc), uses genfs_contexts
> <7>eth0: no IPv6 routers present
> <7>eth2: no IPv6 routers present
> <7>eth1: no IPv6 routers present
> <7>eth3: no IPv6 routers present
> <7>virbr0: no IPv6 routers present
> 0:mon> 
> 

^ permalink raw reply

* Re: 2.6.31-rc5-git2 crash on a idle system.
From: Sachin Sant @ 2009-08-05  9:17 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: neilb, linuxppc-dev, linux-raid
In-Reply-To: <1249421223.18245.36.camel@pasglop>

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

Benjamin Herrenschmidt wrote:
> On Tue, 2009-08-04 at 17:57 +0530, Sachin Sant wrote:
>   
>> I have a power6 blade [IBM,7998-61X] running 2.6.31-rc5-git2
>> kernel (a33a052f19a21d727847391c8c1aff3fb221c472). After some
>> period of inactivity the machine drops into xmon with following
>> traces.
>>     
>
> Looks like code has been overwritten with data. Would be useful
> to try to track down when that happens.
>
> Ben.
2.6.31-rc5-git1 (4905f92ed752d49ebe9cce4fe78a4bc39e710523) works fine
on this box without any problem. So the problem was introduced between
2.6.31-rc5-git1 (4905f92ed752d49ebe9cce4fe78a4bc39e710523) and
2.6.31-rc5-git2 (a33a052f19a21d727847391c8c1aff3fb221c472).

Looking at the changelog all the changes are confined to
drivers/md/ directory ( probably following five commits ). I do have
all the CONFIG_MD* options enabled in my kernel.

449aad3e25358812c43afc60918c5ad3819488e7
70471dafe3390243c598a3165dfb86b8b8b3f4fe
3673f305faf1bc66ead751344f8262ace851ff44
3a981b03f38dc3b8a69b77cbc679e66c1318a44a
ac5e7113e74872928844d00085bd47c988f12728

I will try to find out the exact commit.

Thanks
-Sachin


-- 

---------------------------------
Sachin Sant
IBM Linux Technology Center
India Systems and Technology Labs
Bangalore, India
---------------------------------


[-- Attachment #2: rc5-git2-log --]
[-- Type: text/plain, Size: 19467 bytes --]

[root@mjs22lp1 home]# cpu 0x0: Vector: 700 (Program Check) at [c00000000ffffa90]
    pc: c000000000600000: .flow_cache_new_hashrnd+0x3c/0xcc
    lr: c0000000000c6038: .run_timer_softirq+0x20c/0x2f4
    sp: c00000000ffffd10
   msr: 8000000000089032
  current = 0xc000000000f58b70
  paca    = 0xc0000000010b2400
    pid   = 0, comm = swapper
enter ? for help
[c00000000ffffda0] c0000000000c6038 .run_timer_softirq+0x20c/0x2f4
[c00000000ffffea0] c0000000000be8a0 .__do_softirq+0x174/0x2c8
[c00000000fffff90] c0000000000307b0 .call_do_softirq+0x14/0x24
[c000000001013870] c00000000000ecf8 .do_softirq+0xa0/0x104
[c000000001013910] c0000000000be1d0 .irq_exit+0x74/0xd4
[c000000001013990] c00000000002ce20 .timer_interrupt+0x1cc/0x200
[c000000001013a30] c000000000003728 decrementer_common+0x128/0x180
--- Exception: 901 (Decrementer) at c00000000000ec3c .raw_local_irq_restore+0xc0/0xdc
[c000000001013dc0] c000000000015824 .cpu_idle+0x13c/0x1e0
[c000000001013e60] c000000000009fe8 .rest_init+0x94/0xcc
[c000000001013ee0] c000000000990cf4 .start_kernel+0x484/0x4a8
[c000000001013f90] c000000000008408 .start_here_common+0x2c/0xa4
0:mon> e
cpu 0x0: Vector: 700 (Program Check) at [c00000000ffffa90]
    pc: c000000000600000: .flow_cache_new_hashrnd+0x3c/0xcc
    lr: c0000000000c6038: .run_timer_softirq+0x20c/0x2f4
    sp: c00000000ffffd10
   msr: 8000000000089032
  current = 0xc000000000f58b70
  paca    = 0xc0000000010b2400
    pid   = 0, comm = swapper
0:mon> di c000000000600000 
c000000000600000  00001010      .long 0x1010
c000000000600004  00000008      .long 0x8
c000000000600008  00001013      .long 0x1013
c00000000060000c  0000000f      .long 0xf
c000000000600010  7961626f      rldimi. r1,r11,44,41
c000000000600014  6f740000      xoris   r20,r27,0
c000000000600018  00101600      .long 0x101600
c00000000060001c  00000c00      .long 0xc00
c000000000600020  00000400      .long 0x400
c000000000600024  00101100      .long 0x101100
c000000000600028  000008e9      .long 0x8e9
c00000000060002c  60000000      nop
c000000000600030  e93e8050      ld      r9,-32688(r30)
c000000000600034  7c6507b4      extsw   r5,r3
c000000000600038  78ab4da4      rldicr  r11,r5,9,54
c00000000060003c  396b0040      addi    r11,r11,64
0:mon> r
R00 = c0000000000c6038   R16 = 0000000000000000
R01 = c00000000ffffd10   R17 = 0000000000000100
R02 = c000000001011110   R18 = c000000001059300
R03 = 0000000000000000   R19 = c000000001102f98
R04 = c00000000ffffd60   R20 = c000000001103398
R05 = ffffffffffffffff   R21 = c000000001103798
R06 = 0000000000000700   R22 = c000000001103b98
R07 = 0000000000000001   R23 = 0000000000000000
R08 = 0000000000830000   R24 = c00000000fffc000
R09 = c00000000072f890   R25 = 0000000000000000
R10 = c00000000120fbf8   R26 = 0000000000200200
R11 = c000000000600090   R27 = c00000000ffffe10
R12 = 0000000028000022   R28 = 0000000000000001
R13 = c0000000010b2400   R29 = c0000000010805e8
R14 = 0000000000382800   R30 = c000000000fb4f78
R15 = 0000000000000000   R31 = c00000000ffffd10
pc  = c000000000600000 .flow_cache_new_hashrnd+0x3c/0xcc
lr  = c0000000000c6038 .run_timer_softirq+0x20c/0x2f4
msr = 8000000000089032   cr  = 28000024
ctr = c0000000005fffc4   xer = 0000000000000000   trap =  700
0:mon> dl
<6>Phyp-dump disabled at boot time
<6>Using pSeries machine description
<7>Page orders: linear mapping = 24, virtual = 16, io = 12, vmemmap = 24
<6>Using 1TB segments
<4>Found initrd at 0xc000000002000000:0xc000000002382800
<6>console [udbg0] enabled
<6>Partition configured for 8 cpus.
<6>CPU maps initialized for 2 threads per core
<7> (thread shift is 1)
<4>Starting Linux PPC64 #1 SMP Tue Aug 4 12:15:55 IST 2009
<4>-----------------------------------------------------
<4>ppc64_pft_size                = 0x1a
<4>physicalMemorySize            = 0xa0000000
<4>htab_hash_mask                = 0x7ffff
<4>-----------------------------------------------------
<6>Initializing cgroup subsys cpuset
<6>Initializing cgroup subsys cpu
<5>Linux version 2.6.31-rc5-git2 (root@mjs22lp1) (gcc version 4.4.0 20090307 (Red Hat 4.4.0-0.23) (GCC) ) #1 SMP Tue Aug 4 12:15:55 IST 2009
<4>[boot]0012 Setup Arch
<7>Node 0 Memory: 0x0-0x54000000
<7>Node 1 Memory: 0x54000000-0xa0000000
<4>EEH: No capable adapters found
<6>PPC64 nvram contains 15360 bytes
<7>Using shared processor idle loop
<4>Zone PFN ranges:
<4>  DMA      0x00000000 -> 0x0000a000
<4>  Normal   0x0000a000 -> 0x0000a000
<4>Movable zone start PFN for each node
<4>early_node_map[2] active PFN ranges
<4>    0: 0x00000000 -> 0x00005400
<4>    1: 0x00005400 -> 0x0000a000
<7>On node 0 totalpages: 21504
<7>  DMA zone: 19 pages used for memmap
<7>  DMA zone: 0 pages reserved
<7>  DMA zone: 21485 pages, LIFO batch:1
<7>On node 1 totalpages: 19456
<7>  DMA zone: 17 pages used for memmap
<7>  DMA zone: 0 pages reserved
<7>  DMA zone: 19439 pages, LIFO batch:1
<4>[boot]0015 Setup Done
<4>Built 2 zonelists in Node order, mobility grouping on.  Total pages: 40924
<4>Policy zone: DMA
<5>Kernel command line: ro console=hvc0 root=UUID=9448b379-7842-486c-8bc8-22a1427c4462 
<4>PID hash table entries: 4096 (order: 12, 32768 bytes)
<4>freeing bootmem node 0
<4>freeing bootmem node 1
<6>Memory: 2570560k/2621440k available (15296k kernel code, 50880k reserved, 1152k data, 1488k bss, 5504k init)
<6>SLUB: Genslabs=18, HWalign=128, Order=0-3, MinObjects=0, CPUs=8, Nodes=16
<6>Hierarchical RCU implementation.
<6>NR_IRQS:512
<4>[boot]0020 XICS Init
<4>[boot]0021 XICS Done
<7>pic: no ISA interrupt controller
<7>time_init: decrementer frequency = 512.000000 MHz
<7>time_init: processor frequency   = 4005.000000 MHz
<6>clocksource: timebase mult[7d0000] shift[22] registered
<7>clockevent: decrementer mult[83126e97] shift[32] cpu[0]
<4>Console: colour dummy device 80x25
<6>console handover: boot [udbg0] -> real [hvc0]
<6>allocated 1638400 bytes of page_cgroup
<6>please try 'cgroup_disable=memory' option if you don't want memory cgroups
<6>Security Framework initialized
<6>SELinux:  Initializing.
<7>SELinux:  Starting in permissive mode
<6>Dentry cache hash table entries: 524288 (order: 6, 4194304 bytes)
<6>Inode-cache hash table entries: 262144 (order: 5, 2097152 bytes)
<4>Mount-cache hash table entries: 4096
<6>Initializing cgroup subsys ns
<6>Initializing cgroup subsys cpuacct
<6>Initializing cgroup subsys memory
<6>Initializing cgroup subsys devices
<6>Initializing cgroup subsys freezer
<6>Initializing cgroup subsys net_cls
<6>ftrace: allocating 19543 entries in 8 pages
<7>irq: irq 2 on host null mapped to virtual irq 16
<7>clockevent: decrementer mult[83126e97] shift[32] cpu[1]
<4>Processor 1 found.
<7>clockevent: decrementer mult[83126e97] shift[32] cpu[2]
<4>Processor 2 found.
<7>clockevent: decrementer mult[83126e97] shift[32] cpu[3]
<4>Processor 3 found.
<7>clockevent: decrementer mult[83126e97] shift[32] cpu[4]
<4>Processor 4 found.
<7>clockevent: decrementer mult[83126e97] shift[32] cpu[5]
<4>Processor 5 found.
<7>clockevent: decrementer mult[83126e97] shift[32] cpu[6]
<4>Processor 6 found.
<7>clockevent: decrementer mult[83126e97] shift[32] cpu[7]
<4>Processor 7 found.
<6>Brought up 8 CPUs
<7>Node 0 CPUs: 0-7
<7>Node 1 CPUs:
<7>CPU0 attaching sched-domain:
<7> domain 0: span 0-1 level SIBLING
<7>  groups: 0 1
<7>  domain 1: span 0-7 level CPU
<7>   groups: 0-1 2-3 4-5 6-7
<7>   domain 2: span 0-7 level NODE
<7>    groups: 0-7 (__cpu_power = 4096)
<7>CPU1 attaching sched-domain:
<7> domain 0: span 0-1 level SIBLING
<7>  groups: 1 0
<7>  domain 1: span 0-7 level CPU
<7>   groups: 0-1 2-3 4-5 6-7
<7>   domain 2: span 0-7 level NODE
<7>    groups: 0-7 (__cpu_power = 4096)
<7>CPU2 attaching sched-domain:
<7> domain 0: span 2-3 level SIBLING
<7>  groups: 2 3
<7>  domain 1: span 0-7 level CPU
<7>   groups: 2-3 4-5 6-7 0-1
<7>   domain 2: span 0-7 level NODE
<7>    groups: 0-7 (__cpu_power = 4096)
<7>CPU3 attaching sched-domain:
<7> domain 0: span 2-3 level SIBLING
<7>  groups: 3 2
<7>  domain 1: span 0-7 level CPU
<7>   groups: 2-3 4-5 6-7 0-1
<7>   domain 2: span 0-7 level NODE
<7>    groups: 0-7 (__cpu_power = 4096)
<7>CPU4 attaching sched-domain:
<7> domain 0: span 4-5 level SIBLING
<7>  groups: 4 5
<7>  domain 1: span 0-7 level CPU
<7>   groups: 4-5 6-7 0-1 2-3
<7>   domain 2: span 0-7 level NODE
<7>    groups: 0-7 (__cpu_power = 4096)
<7>CPU5 attaching sched-domain:
<7> domain 0: span 4-5 level SIBLING
<7>  groups: 5 4
<7>  domain 1: span 0-7 level CPU
<7>   groups: 4-5 6-7 0-1 2-3
<7>   domain 2: span 0-7 level NODE
<7>    groups: 0-7 (__cpu_power = 4096)
<7>CPU6 attaching sched-domain:
<7> domain 0: span 6-7 level SIBLING
<7>  groups: 6 7
<7>  domain 1: span 0-7 level CPU
<7>   groups: 6-7 0-1 2-3 4-5
<7>   domain 2: span 0-7 level NODE
<7>    groups: 0-7 (__cpu_power = 4096)
<7>CPU7 attaching sched-domain:
<7> domain 0: span 6-7 level SIBLING
<7>  groups: 7 6
<7>  domain 1: span 0-7 level CPU
<7>   groups: 6-7 0-1 2-3 4-5
<7>   domain 2: span 0-7 level NODE
<7>    groups: 0-7 (__cpu_power = 4096)
<6>regulator: core version 0.5
<6>NET: Registered protocol family 16
<6>IBM eBus Device Driver
<6>POWER6 performance monitor hardware support registered
<6>PCI: Probing PCI hardware
<7>PCI: Probing PCI hardware done
<4>bio: create slab <bio-0> at 0
<5>SCSI subsystem initialized
<7>libata version 3.00 loaded.
<6>usbcore: registered new interface driver usbfs
<6>usbcore: registered new interface driver hub
<6>usbcore: registered new device driver usb
<6>NetLabel: Initializing
<6>NetLabel:  domain hash size = 128
<6>NetLabel:  protocols = UNLABELED CIPSOv4
<6>NetLabel:  unlabeled traffic allowed by default
<7>Switched to high resolution mode on CPU 0
<7>Switched to high resolution mode on CPU 3
<7>Switched to high resolution mode on CPU 4
<7>Switched to high resolution mode on CPU 5
<7>Switched to high resolution mode on CPU 1
<7>Switched to high resolution mode on CPU 6
<7>Switched to high resolution mode on CPU 2
<7>Switched to high resolution mode on CPU 7
<6>NET: Registered protocol family 2
<6>IP route cache hash table entries: 32768 (order: 2, 262144 bytes)
<6>TCP established hash table entries: 131072 (order: 5, 2097152 bytes)
<6>TCP bind hash table entries: 65536 (order: 4, 1048576 bytes)
<6>TCP: Hash tables configured (established 131072 bind 65536)
<6>TCP reno registered
<6>NET: Registered protocol family 1
<6>Trying to unpack rootfs image as initramfs...
<4>Freeing initrd memory: 3594k freed
<7>irq: irq 655360 on host null mapped to virtual irq 17
<7>irq: irq 655362 on host null mapped to virtual irq 18
<6>IOMMU table initialized, virtual merging enabled
<7>irq: irq 655364 on host null mapped to virtual irq 19
<7>irq: irq 655365 on host null mapped to virtual irq 20
<7>irq: irq 589825 on host null mapped to virtual irq 21
<7>RTAS daemon started
<7>RTAS: event: 23, Type: Platform Information Event, Severity: 1
<6>audit: initializing netlink socket (disabled)
<5>type=2000 audit(1249386596.125:1): initialized
<6>HugeTLB registered 16 MB page size, pre-allocated 0 pages
<6>HugeTLB registered 16 GB page size, pre-allocated 0 pages
<5>VFS: Disk quotas dquot_6.5.2
<4>Dquot-cache hash table entries: 8192 (order 0, 65536 bytes)
<6>msgmni has been set to 5024
<7>SELinux:  Registering netfilter hooks
<6>alg: No test for stdrng (krng)
<6>Block layer SCSI generic (bsg) driver version 0.4 loaded (major 252)
<6>io scheduler noop registered
<6>io scheduler anticipatory registered
<6>io scheduler deadline registered
<6>io scheduler cfq registered (default)
<6>pci_hotplug: PCI Hot Plug PCI Core version: 0.5
<6>pciehp: PCI Express Hot Plug Controller Driver version: 0.4
<7>vio_register_driver: driver hvc_console registering
<7>HVSI: registered 0 devices
<6>Linux agpgart interface v0.103
<6>Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
<4>Platform driver 'serial8250' needs updating - please use dev_pm_ops
<6>TX39/49 Serial driver version 1.11
<4>Platform driver 'serial_txx9' needs updating - please use dev_pm_ops
<6>brd: module loaded
<6>loop: module loaded
<6>input: Macintosh mouse button emulation as /devices/virtual/input/input0
<6>Uniform Multi-Platform E-IDE driver
<6>ide-gd driver 1.18
<6>Fixed MDIO Bus: probed
<6>ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
<6>ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
<6>uhci_hcd: USB Universal Host Controller Interface driver
<6>mice: PS/2 mouse device common for all mice
<6>device-mapper: uevent: version 1.0.3
<6>device-mapper: ioctl: 4.15.0-ioctl (2009-04-01) initialised: dm-devel@redhat.com
<6>usbcore: registered new interface driver hiddev
<6>usbcore: registered new interface driver usbhid
<6>usbhid: v2.6:USB HID core driver
<4>nf_conntrack version 0.5.0 (16384 buckets, 65536 max)
<4>CONFIG_NF_CT_ACCT is deprecated and will be removed soon. Please use
<4>nf_conntrack.acct=1 kernel parameter, acct=1 nf_conntrack module option or
<4>sysctl net.netfilter.nf_conntrack_acct=1 to enable it.
<6>ip_tables: (C) 2000-2006 Netfilter Core Team
<6>TCP cubic registered
<6>Initializing XFRM netlink socket
<6>NET: Registered protocol family 17
<7>Running MSI bitmap self-tests ...
<7>PM: Resume from disk failed.
<4>registered taskstats version 1
<6>Initalizing network drop monitor service
<4>Freeing unused kernel memory: 5504k freed
<7>vio_register_driver: driver ibmvscsi registering
<6>ibmvscsi 30000002: SRP_VERSION: 16.a
<6>scsi0 : IBM POWER Virtual SCSI Adapter 1.5.8
<6>ibmvscsi 30000002: partner initialization complete
<6>ibmvscsi 30000002: host srp version: 16.a, host partition 06-1C12A (1), OS 3, max io 262144
<6>ibmvscsi 30000002: Client reserve enabled
<6>ibmvscsi 30000002: sent SRP login
<6>ibmvscsi 30000002: SRP_LOGIN succeeded
<5>scsi 0:0:1:0: Direct-Access     AIX      VDASD            0001 PQ: 0 ANSI: 3
<5>scsi 0:0:2:0: CD-ROM            AIX      VOPTA                 PQ: 0 ANSI: 4
<6>scsi: waiting for bus probes to complete ...
<5>sd 0:0:1:0: Attached scsi generic sg0 type 0
<5>sd 0:0:1:0: [sda] 147324928 512-byte logical blocks: (75.4 GB/70.2 GiB)
<5>sd 0:0:1:0: [sda] Write Protect is off
<7>sd 0:0:1:0: [sda] Mode Sense: 17 00 00 08
<5>sd 0:0:1:0: [sda] Cache data unavailable
<3>sd 0:0:1:0: [sda] Assuming drive cache: write through
<4>sr0: scsi-1 drive
<6>Uniform CD-ROM driver Revision: 3.20
<7>sr 0:0:2:0: Attached scsi CD-ROM sr0
<5>sr 0:0:2:0: Attached scsi generic sg1 type 5
<5>sd 0:0:1:0: [sda] Cache data unavailable
<3>sd 0:0:1:0: [sda] Assuming drive cache: write through
<6> sda: sda1 sda2 sda3 sda4 < sda5 sda6 sda7 sda8 >
<5>sd 0:0:1:0: [sda] Cache data unavailable
<3>sd 0:0:1:0: [sda] Assuming drive cache: write through
<5>sd 0:0:1:0: [sda] Attached SCSI disk
<6>EXT4-fs (sda3): INFO: recovery required on readonly filesystem
<6>EXT4-fs (sda3): write access will be enabled during recovery
<6>EXT4-fs (sda3): barriers enabled
<6>kjournald2 starting: pid 126, dev sda3:8, commit interval 5 seconds
<6>EXT4-fs (sda3): delayed allocation enabled
<6>EXT4-fs: file extents enabled
<6>EXT4-fs: mballoc enabled
<6>EXT4-fs (sda3): recovery complete
<6>EXT4-fs (sda3): mounted filesystem with ordered data mode
<5>type=1404 audit(1249386597.188:2): enforcing=1 old_enforcing=0 auid=4294967295 ses=4294967295
<7>SELinux: 8192 avtab hash slots, 117789 rules.
<7>SELinux: 8192 avtab hash slots, 117789 rules.
<7>SELinux:  8 users, 13 roles, 2653 types, 121 bools, 1 sens, 1024 cats
<7>SELinux:  74 classes, 117789 rules
<7>SELinux:  Completing initialization.
<7>SELinux:  Setting up existing superblocks.
<7>SELinux: initialized (dev sda3, type ext4), uses xattr
<7>SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs
<7>SELinux: initialized (dev selinuxfs, type selinuxfs), uses genfs_contexts
<7>SELinux: initialized (dev mqueue, type mqueue), uses transition SIDs
<7>SELinux: initialized (dev hugetlbfs, type hugetlbfs), uses genfs_contexts
<7>SELinux: initialized (dev devpts, type devpts), uses transition SIDs
<7>SELinux: initialized (dev inotifyfs, type inotifyfs), uses genfs_contexts
<7>SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs
<7>SELinux: initialized (dev anon_inodefs, type anon_inodefs), uses genfs_contexts
<7>SELinux: initialized (dev pipefs, type pipefs), uses task SIDs
<7>SELinux: initialized (dev debugfs, type debugfs), uses genfs_contexts
<7>SELinux: initialized (dev sockfs, type sockfs), uses task SIDs
<7>SELinux: initialized (dev proc, type proc), uses genfs_contexts
<7>SELinux: initialized (dev bdev, type bdev), uses genfs_contexts
<7>SELinux: initialized (dev rootfs, type rootfs), uses genfs_contexts
<7>SELinux: initialized (dev sysfs, type sysfs), uses genfs_contexts
<5>type=1403 audit(1249386597.481:3): policy loaded auid=4294967295 ses=4294967295
<6>udev: starting version 141
<7>drivers/net/ibmveth.c: ibmveth: IBM i/pSeries Virtual Ethernet Driver 1.03
<7>vio_register_driver: driver ibmveth registering
<6>IBM eHEA ethernet device driver (Release EHEA_0101)
<7>irq: irq 590080 on host null mapped to virtual irq 256
<6>ehea: eth0: Jumbo frames are enabled
<6>ehea: eth0 -> logical port id #3
<6>ehea: eth2: Jumbo frames are enabled
<6>ehea: eth2 -> logical port id #4
<6>udev: renamed network interface eth1 to eth3
<6>udev: renamed network interface eth0_rename to eth1
<6>device-mapper: multipath: version 1.1.0 loaded
<6>EXT4-fs (sda3): internal journal on sda3:8
<6>kjournald starting.  Commit interval 5 seconds
<6>EXT3 FS on sda2, internal journal
<6>EXT3-fs: mounted filesystem with writeback data mode.
<7>SELinux: initialized (dev sda2, type ext3), uses xattr
<7>SELinux: initialized (dev tmpfs, type tmpfs), uses transition SIDs
<7>SELinux: initialized (dev binfmt_misc, type binfmt_misc), uses genfs_contexts
<6>NET: Registered protocol family 10
<6>lo: Disabled Privacy Extensions
<6>RPC: Registered udp transport module.
<6>RPC: Registered tcp transport module.
<7>SELinux: initialized (dev rpc_pipefs, type rpc_pipefs), uses genfs_contexts
<7>irq: irq 779 on host null mapped to virtual irq 267
<6>ehea: eth2: Physical port up
<6>ehea: External switch port is backup port
<7>irq: irq 780 on host null mapped to virtual irq 268
<7>irq: irq 781 on host null mapped to virtual irq 269
<6>ehea: eth0: Physical port up
<6>ehea: External switch port is backup port
<7>irq: irq 782 on host null mapped to virtual irq 270
<6>Bluetooth: Core ver 2.15
<6>NET: Registered protocol family 31
<6>Bluetooth: HCI device and connection manager initialized
<6>Bluetooth: HCI socket layer initialized
<6>Bluetooth: L2CAP ver 2.13
<6>Bluetooth: L2CAP socket layer initialized
<6>Bluetooth: BNEP (Ethernet Emulation) ver 1.3
<6>Bluetooth: BNEP filters: protocol multicast
<6>Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
<7>SELinux: initialized (dev nfsd, type nfsd), uses genfs_contexts
<4>NFSD: Using /var/lib/nfs/v4recovery as the NFSv4 state recovery directory
<6>NFSD: starting 90-second grace period
<5>Bridge firewalling registered
<6>Bluetooth: SCO (Voice Link) ver 0.6
<6>Bluetooth: SCO socket layer initialized
<6>virbr0: starting userspace STP failed, starting kernel STP
<7>SELinux: initialized (dev mqueue, type mqueue), uses transition SIDs
<7>SELinux: initialized (dev proc, type proc), uses genfs_contexts
<7>SELinux: initialized (dev mqueue, type mqueue), uses transition SIDs
<6>lo: Disabled Privacy Extensions
<7>SELinux: initialized (dev proc, type proc), uses genfs_contexts
<7>eth0: no IPv6 routers present
<7>eth2: no IPv6 routers present
<7>eth1: no IPv6 routers present
<7>eth3: no IPv6 routers present
<7>virbr0: no IPv6 routers present
0:mon> 


^ permalink raw reply

* RE: Spansion S25FL128-Flash and MTD
From: EXTERNAL Lange Matthias (AA-DGW/ENG1) @ 2009-08-05  8:14 UTC (permalink / raw)
  To: Benjamin Krill; +Cc: linuxppc-dev@ozlabs.org
In-Reply-To: <20090805074501.GN22901@codiert.org>

> Hi,
>
> >                #address-cells =3D <1>;
> >                #size-cells =3D <1>;
> >                rootfs@800000 {
>
> The partition must be called
>       partition@...
>

Thanks, though that didn't solve my problem. The naming seems to be a bug i=
n booting-without-of.txt where the example in section "CFI or JEDEC memory-=
mapped NOR flash" uses "firmware" as the node name.

Regards,
Matthias.

^ permalink raw reply

* Re: Spansion S25FL128-Flash and MTD
From: Benjamin Krill @ 2009-08-05  7:45 UTC (permalink / raw)
  To: EXTERNAL Lange Matthias (AA-DGW/ENG1); +Cc: linuxppc-dev@ozlabs.org
In-Reply-To: <44C5CFA72BC0E242A53B64DC1E67DEB80FB989659B@SI-MBX10.de.bosch.com>

Hi,

>                #address-cells = <1>;
>                #size-cells = <1>;
>                rootfs@800000 {

The partition must be called
	partition@...

>                        label = "rootfs";
>                        reg = <0x800000 0x800000>;
>                };
>        };
>};

cheers
 ben

^ permalink raw reply

* Spansion S25FL128-Flash and MTD
From: EXTERNAL Lange Matthias (AA-DGW/ENG1) @ 2009-08-05  7:16 UTC (permalink / raw)
  To: linuxppc-dev@ozlabs.org

Hi,

I am trying to get a MTD running on my embedded PowerPC board. I am using a=
 Xilinx Virtex4 with an embedded PowerPC 405. In the FPGA there is a Xilinx=
 SPI controller implemented to which a Spansion S25FL128 SPI-flash (16MB) i=
s connected.

The problem is that with my setup the flash chips gets not detected and the=
 MTD partitions won't be setup.

In the kernel config I have configured the following options:

In the device drivers section:
[x] SPI support
        [x] Xilinx SPI controller
[x] Memory Technology Device (MTD) support
        [x] MTD partitioning support
        [x] Flash partition map based on OF description
        RAM/ROM/Flash chip drivers
                [x] Detect non-CFI AMD/JEDEC-compatible flash chips
        Self-contained MTD device drivers
                [x] Support most SPI Flash chips (AT26DF, M25P, W25X, ...)

As filesystem I have configured JFFS2.

In my device tree I have declared the SPI controller and the connected flas=
h as follows:

SPI_Flash: xps-spi@83400000 {
        compatible =3D "xlnx,xps-spi-2.00.b";
        interrupt-parent =3D <&int_ctrl>;
        interrupts =3D < 3 2 >;
        reg =3D < 0x83400000 0x10000 >;
        xlnx,family =3D "virtex4";
        xlnx,fifo-exist =3D <0x0>;
        xlnx,num-offchip-ss-bits =3D <0x1>;
        xlnx,num-ss-bits =3D <0x1>;
        xlnx,sck-ratio =3D <0x20>;
        #address-cells =3D <1>;
        #size-cells =3D <1>;
        nor_flash@0,1000000 {
                compatible =3D "amd,s25sl12800", "jedec-flash";
                reg =3D <0x0 0x1000000>;
                spi-max-frequency =3D <25000000>;
                bank-width =3D <1>;
                device-width =3D <1>;
                #address-cells =3D <1>;
                #size-cells =3D <1>;
                rootfs@800000 {
                        label =3D "rootfs";
                        reg =3D <0x800000 0x800000>;
                };
        };
};

When the kernel boots I can see from the console that the drivers for JFFS2=
 and the SPI controller get successfully loaded:

...
JFFS2 version 2.2. (NAND) (c) 2001-2006 Red Hat, Inc.
...
xilinx-xps-spi 83400000.xps-spi: at 0x83400000 mapped to 0xC9060000, irq=3D=
17
...

While debugging the boot process I couldn't see any calls to jedec_probe() =
resp. m25p_probe() from m25p80.c which to my understanding should be called=
 in result to a successfull match of my compatible property (jedec-flash).

The question is: What am I missing? Is there a problem with my device tree =
definition? What else am I doing wrong?

Any help is appreciated. Regards,
Matthias.

^ permalink raw reply

* [PATCH -v2 1/7] powerpc: remove addr_needs_map in struct dma_mapping_ops
From: FUJITA Tomonori @ 2009-08-05  5:08 UTC (permalink / raw)
  To: linuxppc-dev, benh; +Cc: fujita.tomonori, mingo, linux-kernel, galak
In-Reply-To: <1249448908-18985-1-git-send-email-fujita.tomonori@lab.ntt.co.jp>

This patch adds max_direct_dma_addr to struct dev_archdata to remove
addr_needs_map in struct dma_mapping_ops. It also converts
dma_capable() to use max_direct_dma_addr.

max_direct_dma_addr is initialized in pci_dma_dev_setup_swiotlb(),
called via ppc_md.pci_dma_dev_setup hook.

For further information:
http://marc.info/?t=124719060200001&r=1&w=2

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Becky Bruce <beckyb@kernel.crashing.org>
---
 arch/powerpc/include/asm/device.h          |    3 ++
 arch/powerpc/include/asm/dma-mapping.h     |    8 +++---
 arch/powerpc/include/asm/swiotlb.h         |    5 +--
 arch/powerpc/kernel/dma-swiotlb.c          |   36 +++++++++++----------------
 arch/powerpc/platforms/85xx/mpc8536_ds.c   |    1 +
 arch/powerpc/platforms/85xx/mpc85xx_ds.c   |    1 +
 arch/powerpc/platforms/85xx/mpc85xx_mds.c  |    1 +
 arch/powerpc/platforms/86xx/mpc86xx_hpcn.c |    1 +
 8 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/arch/powerpc/include/asm/device.h b/arch/powerpc/include/asm/device.h
index 7d2277c..0086f8d 100644
--- a/arch/powerpc/include/asm/device.h
+++ b/arch/powerpc/include/asm/device.h
@@ -16,6 +16,9 @@ struct dev_archdata {
 	/* DMA operations on that device */
 	struct dma_mapping_ops	*dma_ops;
 	void			*dma_data;
+#ifdef CONFIG_SWIOTLB
+	dma_addr_t		max_direct_dma_addr;
+#endif
 };
 
 static inline void dev_archdata_set_node(struct dev_archdata *ad,
diff --git a/arch/powerpc/include/asm/dma-mapping.h b/arch/powerpc/include/asm/dma-mapping.h
index 0c34371..1765c37 100644
--- a/arch/powerpc/include/asm/dma-mapping.h
+++ b/arch/powerpc/include/asm/dma-mapping.h
@@ -87,8 +87,6 @@ struct dma_mapping_ops {
 				dma_addr_t dma_address, size_t size,
 				enum dma_data_direction direction,
 				struct dma_attrs *attrs);
-	int		(*addr_needs_map)(struct device *dev, dma_addr_t addr,
-				size_t size);
 #ifdef CONFIG_PPC_NEED_DMA_SYNC_OPS
 	void            (*sync_single_range_for_cpu)(struct device *hwdev,
 				dma_addr_t dma_handle, unsigned long offset,
@@ -426,10 +424,12 @@ static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
 
 static inline bool dma_capable(struct device *dev, dma_addr_t addr, size_t size)
 {
-	struct dma_mapping_ops *ops = get_dma_ops(dev);
+#ifdef CONFIG_SWIOTLB
+	struct dev_archdata *sd = &dev->archdata;
 
-	if (ops->addr_needs_map && ops->addr_needs_map(dev, addr, size))
+	if (sd->max_direct_dma_addr && addr + size > sd->max_direct_dma_addr)
 		return 0;
+#endif
 
 	if (!dev->dma_mask)
 		return 0;
diff --git a/arch/powerpc/include/asm/swiotlb.h b/arch/powerpc/include/asm/swiotlb.h
index 30891d6..31e0e43 100644
--- a/arch/powerpc/include/asm/swiotlb.h
+++ b/arch/powerpc/include/asm/swiotlb.h
@@ -16,12 +16,11 @@
 extern struct dma_mapping_ops swiotlb_dma_ops;
 extern struct dma_mapping_ops swiotlb_pci_dma_ops;
 
-int swiotlb_arch_address_needs_mapping(struct device *, dma_addr_t,
-				       size_t size);
-
 static inline void dma_mark_clean(void *addr, size_t size) {}
 
 extern unsigned int ppc_swiotlb_enable;
 int __init swiotlb_setup_bus_notifier(void);
 
+extern void pci_dma_dev_setup_swiotlb(struct pci_dev *pdev);
+
 #endif /* __ASM_SWIOTLB_H */
diff --git a/arch/powerpc/kernel/dma-swiotlb.c b/arch/powerpc/kernel/dma-swiotlb.c
index e8a57de..c9f6a30 100644
--- a/arch/powerpc/kernel/dma-swiotlb.c
+++ b/arch/powerpc/kernel/dma-swiotlb.c
@@ -25,26 +25,6 @@ int swiotlb __read_mostly;
 unsigned int ppc_swiotlb_enable;
 
 /*
- * Determine if an address is reachable by a pci device, or if we must bounce.
- */
-static int
-swiotlb_pci_addr_needs_map(struct device *hwdev, dma_addr_t addr, size_t size)
-{
-	dma_addr_t max;
-	struct pci_controller *hose;
-	struct pci_dev *pdev = to_pci_dev(hwdev);
-
-	hose = pci_bus_to_host(pdev->bus);
-	max = hose->dma_window_base_cur + hose->dma_window_size;
-
-	/* check that we're within mapped pci window space */
-	if ((addr + size > max) | (addr < hose->dma_window_base_cur))
-		return 1;
-
-	return 0;
-}
-
-/*
  * At the moment, all platforms that use this code only require
  * swiotlb to be used if we're operating on HIGHMEM.  Since
  * we don't ever call anything other than map_sg, unmap_sg,
@@ -73,22 +53,36 @@ struct dma_mapping_ops swiotlb_pci_dma_ops = {
 	.dma_supported = swiotlb_dma_supported,
 	.map_page = swiotlb_map_page,
 	.unmap_page = swiotlb_unmap_page,
-	.addr_needs_map = swiotlb_pci_addr_needs_map,
 	.sync_single_range_for_cpu = swiotlb_sync_single_range_for_cpu,
 	.sync_single_range_for_device = swiotlb_sync_single_range_for_device,
 	.sync_sg_for_cpu = swiotlb_sync_sg_for_cpu,
 	.sync_sg_for_device = swiotlb_sync_sg_for_device
 };
 
+void pci_dma_dev_setup_swiotlb(struct pci_dev *pdev)
+{
+	struct pci_controller *hose;
+	struct dev_archdata *sd;
+
+	hose = pci_bus_to_host(pdev->bus);
+	sd = &pdev->dev.archdata;
+	sd->max_direct_dma_addr =
+		hose->dma_window_base_cur + hose->dma_window_size;
+}
+
 static int ppc_swiotlb_bus_notify(struct notifier_block *nb,
 				  unsigned long action, void *data)
 {
 	struct device *dev = data;
+	struct dev_archdata *sd;
 
 	/* We are only intereted in device addition */
 	if (action != BUS_NOTIFY_ADD_DEVICE)
 		return 0;
 
+	sd = &dev->archdata;
+	sd->max_direct_dma_addr = 0;
+
 	/* May need to bounce if the device can't address all of DRAM */
 	if (dma_get_mask(dev) < lmb_end_of_DRAM())
 		set_dma_ops(dev, &swiotlb_dma_ops);
diff --git a/arch/powerpc/platforms/85xx/mpc8536_ds.c b/arch/powerpc/platforms/85xx/mpc8536_ds.c
index 055ff41..bf052c0 100644
--- a/arch/powerpc/platforms/85xx/mpc8536_ds.c
+++ b/arch/powerpc/platforms/85xx/mpc8536_ds.c
@@ -97,6 +97,7 @@ static void __init mpc8536_ds_setup_arch(void)
 	if (lmb_end_of_DRAM() > max) {
 		ppc_swiotlb_enable = 1;
 		set_pci_dma_ops(&swiotlb_pci_dma_ops);
+		ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
 	}
 #endif
 
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ds.c b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
index 849c0ac..c6f92cc 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_ds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
@@ -193,6 +193,7 @@ static void __init mpc85xx_ds_setup_arch(void)
 	if (lmb_end_of_DRAM() > max) {
 		ppc_swiotlb_enable = 1;
 		set_pci_dma_ops(&swiotlb_pci_dma_ops);
+		ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
 	}
 #endif
 
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_mds.c b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
index bfb3283..e1f82f8 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_mds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
@@ -255,6 +255,7 @@ static void __init mpc85xx_mds_setup_arch(void)
 	if (lmb_end_of_DRAM() > max) {
 		ppc_swiotlb_enable = 1;
 		set_pci_dma_ops(&swiotlb_pci_dma_ops);
+		ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
 	}
 #endif
 }
diff --git a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
index 6632702..8032301 100644
--- a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
+++ b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
@@ -106,6 +106,7 @@ mpc86xx_hpcn_setup_arch(void)
 	if (lmb_end_of_DRAM() > max) {
 		ppc_swiotlb_enable = 1;
 		set_pci_dma_ops(&swiotlb_pci_dma_ops);
+		ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
 	}
 #endif
 }
-- 
1.6.0.6

^ permalink raw reply related

* [PATCH -v2 7/7] powerpc: add CONFIG_DMA_API_DEBUG support
From: FUJITA Tomonori @ 2009-08-05  5:08 UTC (permalink / raw)
  To: linuxppc-dev, benh; +Cc: fujita.tomonori, mingo, linux-kernel, galak
In-Reply-To: <1249448908-18985-1-git-send-email-fujita.tomonori@lab.ntt.co.jp>

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
---
 arch/powerpc/Kconfig                   |    1 +
 arch/powerpc/include/asm/dma-mapping.h |   11 ++++++++++-
 arch/powerpc/kernel/dma.c              |   11 +++++++++++
 3 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index fb3f4ff..4459b78 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -121,6 +121,7 @@ config PPC
 	select HAVE_ARCH_TRACEHOOK
 	select HAVE_LMB
 	select HAVE_DMA_ATTRS
+	select HAVE_DMA_API_DEBUG
 	select USE_GENERIC_SMP_HELPERS if SMP
 	select HAVE_OPROFILE
 	select HAVE_SYSCALL_WRAPPERS if PPC64
diff --git a/arch/powerpc/include/asm/dma-mapping.h b/arch/powerpc/include/asm/dma-mapping.h
index 4bd41b4..cb2ca41 100644
--- a/arch/powerpc/include/asm/dma-mapping.h
+++ b/arch/powerpc/include/asm/dma-mapping.h
@@ -127,9 +127,15 @@ static inline void *dma_alloc_coherent(struct device *dev, size_t size,
 				       dma_addr_t *dma_handle, gfp_t flag)
 {
 	struct dma_map_ops *dma_ops = get_dma_ops(dev);
+	void *cpu_addr;
 
 	BUG_ON(!dma_ops);
-	return dma_ops->alloc_coherent(dev, size, dma_handle, flag);
+
+	cpu_addr = dma_ops->alloc_coherent(dev, size, dma_handle, flag);
+
+	debug_dma_alloc_coherent(dev, size, *dma_handle, cpu_addr);
+
+	return cpu_addr;
 }
 
 static inline void dma_free_coherent(struct device *dev, size_t size,
@@ -138,6 +144,9 @@ static inline void dma_free_coherent(struct device *dev, size_t size,
 	struct dma_map_ops *dma_ops = get_dma_ops(dev);
 
 	BUG_ON(!dma_ops);
+
+	debug_dma_free_coherent(dev, size, cpu_addr, dma_handle);
+
 	dma_ops->free_coherent(dev, size, cpu_addr, dma_handle);
 }
 
diff --git a/arch/powerpc/kernel/dma.c b/arch/powerpc/kernel/dma.c
index 3e8bb9a..c6d730e 100644
--- a/arch/powerpc/kernel/dma.c
+++ b/arch/powerpc/kernel/dma.c
@@ -7,6 +7,7 @@
 
 #include <linux/device.h>
 #include <linux/dma-mapping.h>
+#include <linux/dma-debug.h>
 #include <asm/bug.h>
 #include <asm/abs_addr.h>
 
@@ -156,3 +157,13 @@ struct dma_map_ops dma_direct_ops = {
 #endif
 };
 EXPORT_SYMBOL(dma_direct_ops);
+
+#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
+
+static int __init dma_init(void)
+{
+       dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
+
+       return 0;
+}
+fs_initcall(dma_init);
-- 
1.6.0.6

^ permalink raw reply related

* [PATCH -v2 6/7] powerpc: handle SWIOTLB mapping error properly
From: FUJITA Tomonori @ 2009-08-05  5:08 UTC (permalink / raw)
  To: linuxppc-dev, benh; +Cc: fujita.tomonori, mingo, linux-kernel, galak
In-Reply-To: <1249448908-18985-1-git-send-email-fujita.tomonori@lab.ntt.co.jp>

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
---
 arch/powerpc/include/asm/dma-mapping.h |    5 +++++
 arch/powerpc/kernel/dma-swiotlb.c      |    3 ++-
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/include/asm/dma-mapping.h b/arch/powerpc/include/asm/dma-mapping.h
index 91217e4..4bd41b4 100644
--- a/arch/powerpc/include/asm/dma-mapping.h
+++ b/arch/powerpc/include/asm/dma-mapping.h
@@ -143,6 +143,11 @@ static inline void dma_free_coherent(struct device *dev, size_t size,
 
 static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
 {
+	struct dma_map_ops *dma_ops = get_dma_ops(dev);
+
+	if (dma_ops->mapping_error)
+		return dma_ops->mapping_error(dev, dma_addr);
+
 #ifdef CONFIG_PPC64
 	return (dma_addr == DMA_ERROR_CODE);
 #else
diff --git a/arch/powerpc/kernel/dma-swiotlb.c b/arch/powerpc/kernel/dma-swiotlb.c
index d1143a6..e96cbbd 100644
--- a/arch/powerpc/kernel/dma-swiotlb.c
+++ b/arch/powerpc/kernel/dma-swiotlb.c
@@ -42,7 +42,8 @@ struct dma_map_ops swiotlb_dma_ops = {
 	.sync_single_range_for_cpu = swiotlb_sync_single_range_for_cpu,
 	.sync_single_range_for_device = swiotlb_sync_single_range_for_device,
 	.sync_sg_for_cpu = swiotlb_sync_sg_for_cpu,
-	.sync_sg_for_device = swiotlb_sync_sg_for_device
+	.sync_sg_for_device = swiotlb_sync_sg_for_device,
+	.mapping_error = swiotlb_dma_mapping_error,
 };
 
 void pci_dma_dev_setup_swiotlb(struct pci_dev *pdev)
-- 
1.6.0.6

^ permalink raw reply related

* [PATCH -v2 4/7] powerpc: use dma_map_ops struct
From: FUJITA Tomonori @ 2009-08-05  5:08 UTC (permalink / raw)
  To: linuxppc-dev, benh; +Cc: fujita.tomonori, mingo, linux-kernel, galak
In-Reply-To: <1249448908-18985-1-git-send-email-fujita.tomonori@lab.ntt.co.jp>

This converts uses dma_map_ops struct (in include/linux/dma-mapping.h)
instead of POWERPC homegrown dma_mapping_ops.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Becky Bruce <beckyb@kernel.crashing.org>
---
 arch/powerpc/include/asm/device.h       |    4 +-
 arch/powerpc/include/asm/dma-mapping.h  |   84 ++++++++-----------------------
 arch/powerpc/include/asm/pci.h          |    4 +-
 arch/powerpc/include/asm/swiotlb.h      |    2 +-
 arch/powerpc/kernel/dma-iommu.c         |    2 +-
 arch/powerpc/kernel/dma-swiotlb.c       |    2 +-
 arch/powerpc/kernel/dma.c               |    2 +-
 arch/powerpc/kernel/ibmebus.c           |    2 +-
 arch/powerpc/kernel/pci-common.c        |    6 +-
 arch/powerpc/kernel/vio.c               |    2 +-
 arch/powerpc/platforms/cell/iommu.c     |    2 +-
 arch/powerpc/platforms/ps3/system-bus.c |    4 +-
 12 files changed, 37 insertions(+), 79 deletions(-)

diff --git a/arch/powerpc/include/asm/device.h b/arch/powerpc/include/asm/device.h
index 0086f8d..67fcd7f 100644
--- a/arch/powerpc/include/asm/device.h
+++ b/arch/powerpc/include/asm/device.h
@@ -6,7 +6,7 @@
 #ifndef _ASM_POWERPC_DEVICE_H
 #define _ASM_POWERPC_DEVICE_H
 
-struct dma_mapping_ops;
+struct dma_map_ops;
 struct device_node;
 
 struct dev_archdata {
@@ -14,7 +14,7 @@ struct dev_archdata {
 	struct device_node	*of_node;
 
 	/* DMA operations on that device */
-	struct dma_mapping_ops	*dma_ops;
+	struct dma_map_ops	*dma_ops;
 	void			*dma_data;
 #ifdef CONFIG_SWIOTLB
 	dma_addr_t		max_direct_dma_addr;
diff --git a/arch/powerpc/include/asm/dma-mapping.h b/arch/powerpc/include/asm/dma-mapping.h
index 1765c37..8ca2b51 100644
--- a/arch/powerpc/include/asm/dma-mapping.h
+++ b/arch/powerpc/include/asm/dma-mapping.h
@@ -64,56 +64,14 @@ static inline unsigned long device_to_mask(struct device *dev)
 }
 
 /*
- * DMA operations are abstracted for G5 vs. i/pSeries, PCI vs. VIO
- */
-struct dma_mapping_ops {
-	void *		(*alloc_coherent)(struct device *dev, size_t size,
-				dma_addr_t *dma_handle, gfp_t flag);
-	void		(*free_coherent)(struct device *dev, size_t size,
-				void *vaddr, dma_addr_t dma_handle);
-	int		(*map_sg)(struct device *dev, struct scatterlist *sg,
-				int nents, enum dma_data_direction direction,
-				struct dma_attrs *attrs);
-	void		(*unmap_sg)(struct device *dev, struct scatterlist *sg,
-				int nents, enum dma_data_direction direction,
-				struct dma_attrs *attrs);
-	int		(*dma_supported)(struct device *dev, u64 mask);
-	int		(*set_dma_mask)(struct device *dev, u64 dma_mask);
-	dma_addr_t 	(*map_page)(struct device *dev, struct page *page,
-				unsigned long offset, size_t size,
-				enum dma_data_direction direction,
-				struct dma_attrs *attrs);
-	void		(*unmap_page)(struct device *dev,
-				dma_addr_t dma_address, size_t size,
-				enum dma_data_direction direction,
-				struct dma_attrs *attrs);
-#ifdef CONFIG_PPC_NEED_DMA_SYNC_OPS
-	void            (*sync_single_range_for_cpu)(struct device *hwdev,
-				dma_addr_t dma_handle, unsigned long offset,
-				size_t size,
-				enum dma_data_direction direction);
-	void            (*sync_single_range_for_device)(struct device *hwdev,
-				dma_addr_t dma_handle, unsigned long offset,
-				size_t size,
-				enum dma_data_direction direction);
-	void            (*sync_sg_for_cpu)(struct device *hwdev,
-				struct scatterlist *sg, int nelems,
-				enum dma_data_direction direction);
-	void            (*sync_sg_for_device)(struct device *hwdev,
-				struct scatterlist *sg, int nelems,
-				enum dma_data_direction direction);
-#endif
-};
-
-/*
  * Available generic sets of operations
  */
 #ifdef CONFIG_PPC64
-extern struct dma_mapping_ops dma_iommu_ops;
+extern struct dma_map_ops dma_iommu_ops;
 #endif
-extern struct dma_mapping_ops dma_direct_ops;
+extern struct dma_map_ops dma_direct_ops;
 
-static inline struct dma_mapping_ops *get_dma_ops(struct device *dev)
+static inline struct dma_map_ops *get_dma_ops(struct device *dev)
 {
 	/* We don't handle the NULL dev case for ISA for now. We could
 	 * do it via an out of line call but it is not needed for now. The
@@ -126,14 +84,14 @@ static inline struct dma_mapping_ops *get_dma_ops(struct device *dev)
 	return dev->archdata.dma_ops;
 }
 
-static inline void set_dma_ops(struct device *dev, struct dma_mapping_ops *ops)
+static inline void set_dma_ops(struct device *dev, struct dma_map_ops *ops)
 {
 	dev->archdata.dma_ops = ops;
 }
 
 static inline int dma_supported(struct device *dev, u64 mask)
 {
-	struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
+	struct dma_map_ops *dma_ops = get_dma_ops(dev);
 
 	if (unlikely(dma_ops == NULL))
 		return 0;
@@ -147,7 +105,7 @@ static inline int dma_supported(struct device *dev, u64 mask)
 
 static inline int dma_set_mask(struct device *dev, u64 dma_mask)
 {
-	struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
+	struct dma_map_ops *dma_ops = get_dma_ops(dev);
 
 	if (unlikely(dma_ops == NULL))
 		return -EIO;
@@ -161,7 +119,7 @@ static inline int dma_set_mask(struct device *dev, u64 dma_mask)
 
 /*
  * map_/unmap_single actually call through to map/unmap_page now that all the
- * dma_mapping_ops have been converted over. We just have to get the page and
+ * dma_map_ops have been converted over. We just have to get the page and
  * offset to pass through to map_page
  */
 static inline dma_addr_t dma_map_single_attrs(struct device *dev,
@@ -170,7 +128,7 @@ static inline dma_addr_t dma_map_single_attrs(struct device *dev,
 					      enum dma_data_direction direction,
 					      struct dma_attrs *attrs)
 {
-	struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
+	struct dma_map_ops *dma_ops = get_dma_ops(dev);
 
 	BUG_ON(!dma_ops);
 
@@ -185,7 +143,7 @@ static inline void dma_unmap_single_attrs(struct device *dev,
 					  enum dma_data_direction direction,
 					  struct dma_attrs *attrs)
 {
-	struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
+	struct dma_map_ops *dma_ops = get_dma_ops(dev);
 
 	BUG_ON(!dma_ops);
 
@@ -198,7 +156,7 @@ static inline dma_addr_t dma_map_page_attrs(struct device *dev,
 					    enum dma_data_direction direction,
 					    struct dma_attrs *attrs)
 {
-	struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
+	struct dma_map_ops *dma_ops = get_dma_ops(dev);
 
 	BUG_ON(!dma_ops);
 
@@ -211,7 +169,7 @@ static inline void dma_unmap_page_attrs(struct device *dev,
 					enum dma_data_direction direction,
 					struct dma_attrs *attrs)
 {
-	struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
+	struct dma_map_ops *dma_ops = get_dma_ops(dev);
 
 	BUG_ON(!dma_ops);
 
@@ -222,7 +180,7 @@ static inline int dma_map_sg_attrs(struct device *dev, struct scatterlist *sg,
 				   int nents, enum dma_data_direction direction,
 				   struct dma_attrs *attrs)
 {
-	struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
+	struct dma_map_ops *dma_ops = get_dma_ops(dev);
 
 	BUG_ON(!dma_ops);
 	return dma_ops->map_sg(dev, sg, nents, direction, attrs);
@@ -234,7 +192,7 @@ static inline void dma_unmap_sg_attrs(struct device *dev,
 				      enum dma_data_direction direction,
 				      struct dma_attrs *attrs)
 {
-	struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
+	struct dma_map_ops *dma_ops = get_dma_ops(dev);
 
 	BUG_ON(!dma_ops);
 	dma_ops->unmap_sg(dev, sg, nhwentries, direction, attrs);
@@ -243,7 +201,7 @@ static inline void dma_unmap_sg_attrs(struct device *dev,
 static inline void *dma_alloc_coherent(struct device *dev, size_t size,
 				       dma_addr_t *dma_handle, gfp_t flag)
 {
-	struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
+	struct dma_map_ops *dma_ops = get_dma_ops(dev);
 
 	BUG_ON(!dma_ops);
 	return dma_ops->alloc_coherent(dev, size, dma_handle, flag);
@@ -252,7 +210,7 @@ static inline void *dma_alloc_coherent(struct device *dev, size_t size,
 static inline void dma_free_coherent(struct device *dev, size_t size,
 				     void *cpu_addr, dma_addr_t dma_handle)
 {
-	struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
+	struct dma_map_ops *dma_ops = get_dma_ops(dev);
 
 	BUG_ON(!dma_ops);
 	dma_ops->free_coherent(dev, size, cpu_addr, dma_handle);
@@ -304,7 +262,7 @@ static inline void dma_sync_single_for_cpu(struct device *dev,
 		dma_addr_t dma_handle, size_t size,
 		enum dma_data_direction direction)
 {
-	struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
+	struct dma_map_ops *dma_ops = get_dma_ops(dev);
 
 	BUG_ON(!dma_ops);
 
@@ -317,7 +275,7 @@ static inline void dma_sync_single_for_device(struct device *dev,
 		dma_addr_t dma_handle, size_t size,
 		enum dma_data_direction direction)
 {
-	struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
+	struct dma_map_ops *dma_ops = get_dma_ops(dev);
 
 	BUG_ON(!dma_ops);
 
@@ -330,7 +288,7 @@ static inline void dma_sync_sg_for_cpu(struct device *dev,
 		struct scatterlist *sgl, int nents,
 		enum dma_data_direction direction)
 {
-	struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
+	struct dma_map_ops *dma_ops = get_dma_ops(dev);
 
 	BUG_ON(!dma_ops);
 
@@ -342,7 +300,7 @@ static inline void dma_sync_sg_for_device(struct device *dev,
 		struct scatterlist *sgl, int nents,
 		enum dma_data_direction direction)
 {
-	struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
+	struct dma_map_ops *dma_ops = get_dma_ops(dev);
 
 	BUG_ON(!dma_ops);
 
@@ -354,7 +312,7 @@ static inline void dma_sync_single_range_for_cpu(struct device *dev,
 		dma_addr_t dma_handle, unsigned long offset, size_t size,
 		enum dma_data_direction direction)
 {
-	struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
+	struct dma_map_ops *dma_ops = get_dma_ops(dev);
 
 	BUG_ON(!dma_ops);
 
@@ -367,7 +325,7 @@ static inline void dma_sync_single_range_for_device(struct device *dev,
 		dma_addr_t dma_handle, unsigned long offset, size_t size,
 		enum dma_data_direction direction)
 {
-	struct dma_mapping_ops *dma_ops = get_dma_ops(dev);
+	struct dma_map_ops *dma_ops = get_dma_ops(dev);
 
 	BUG_ON(!dma_ops);
 
diff --git a/arch/powerpc/include/asm/pci.h b/arch/powerpc/include/asm/pci.h
index d9483c5..7ae46d7 100644
--- a/arch/powerpc/include/asm/pci.h
+++ b/arch/powerpc/include/asm/pci.h
@@ -61,8 +61,8 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
 }
 
 #ifdef CONFIG_PCI
-extern void set_pci_dma_ops(struct dma_mapping_ops *dma_ops);
-extern struct dma_mapping_ops *get_pci_dma_ops(void);
+extern void set_pci_dma_ops(struct dma_map_ops *dma_ops);
+extern struct dma_map_ops *get_pci_dma_ops(void);
 #else	/* CONFIG_PCI */
 #define set_pci_dma_ops(d)
 #define get_pci_dma_ops()	NULL
diff --git a/arch/powerpc/include/asm/swiotlb.h b/arch/powerpc/include/asm/swiotlb.h
index 21ce0a3..8979d4c 100644
--- a/arch/powerpc/include/asm/swiotlb.h
+++ b/arch/powerpc/include/asm/swiotlb.h
@@ -13,7 +13,7 @@
 
 #include <linux/swiotlb.h>
 
-extern struct dma_mapping_ops swiotlb_dma_ops;
+extern struct dma_map_ops swiotlb_dma_ops;
 
 static inline void dma_mark_clean(void *addr, size_t size) {}
 
diff --git a/arch/powerpc/kernel/dma-iommu.c b/arch/powerpc/kernel/dma-iommu.c
index 2983ada..87ddb3f 100644
--- a/arch/powerpc/kernel/dma-iommu.c
+++ b/arch/powerpc/kernel/dma-iommu.c
@@ -89,7 +89,7 @@ static int dma_iommu_dma_supported(struct device *dev, u64 mask)
 		return 1;
 }
 
-struct dma_mapping_ops dma_iommu_ops = {
+struct dma_map_ops dma_iommu_ops = {
 	.alloc_coherent	= dma_iommu_alloc_coherent,
 	.free_coherent	= dma_iommu_free_coherent,
 	.map_sg		= dma_iommu_map_sg,
diff --git a/arch/powerpc/kernel/dma-swiotlb.c b/arch/powerpc/kernel/dma-swiotlb.c
index ca141e1..d1143a6 100644
--- a/arch/powerpc/kernel/dma-swiotlb.c
+++ b/arch/powerpc/kernel/dma-swiotlb.c
@@ -31,7 +31,7 @@ unsigned int ppc_swiotlb_enable;
  * map_page, and unmap_page on highmem, use normal dma_ops
  * for everything else.
  */
-struct dma_mapping_ops swiotlb_dma_ops = {
+struct dma_map_ops swiotlb_dma_ops = {
 	.alloc_coherent = dma_direct_alloc_coherent,
 	.free_coherent = dma_direct_free_coherent,
 	.map_sg = swiotlb_map_sg_attrs,
diff --git a/arch/powerpc/kernel/dma.c b/arch/powerpc/kernel/dma.c
index 20a60d6..3e8bb9a 100644
--- a/arch/powerpc/kernel/dma.c
+++ b/arch/powerpc/kernel/dma.c
@@ -140,7 +140,7 @@ static inline void dma_direct_sync_single_range(struct device *dev,
 }
 #endif
 
-struct dma_mapping_ops dma_direct_ops = {
+struct dma_map_ops dma_direct_ops = {
 	.alloc_coherent	= dma_direct_alloc_coherent,
 	.free_coherent	= dma_direct_free_coherent,
 	.map_sg		= dma_direct_map_sg,
diff --git a/arch/powerpc/kernel/ibmebus.c b/arch/powerpc/kernel/ibmebus.c
index 6e3f624..a4c8b38 100644
--- a/arch/powerpc/kernel/ibmebus.c
+++ b/arch/powerpc/kernel/ibmebus.c
@@ -127,7 +127,7 @@ static int ibmebus_dma_supported(struct device *dev, u64 mask)
 	return 1;
 }
 
-static struct dma_mapping_ops ibmebus_dma_ops = {
+static struct dma_map_ops ibmebus_dma_ops = {
 	.alloc_coherent = ibmebus_alloc_coherent,
 	.free_coherent  = ibmebus_free_coherent,
 	.map_sg         = ibmebus_map_sg,
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 5a56e97..7585f1f 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -50,14 +50,14 @@ resource_size_t isa_mem_base;
 unsigned int ppc_pci_flags = 0;
 
 
-static struct dma_mapping_ops *pci_dma_ops = &dma_direct_ops;
+static struct dma_map_ops *pci_dma_ops = &dma_direct_ops;
 
-void set_pci_dma_ops(struct dma_mapping_ops *dma_ops)
+void set_pci_dma_ops(struct dma_map_ops *dma_ops)
 {
 	pci_dma_ops = dma_ops;
 }
 
-struct dma_mapping_ops *get_pci_dma_ops(void)
+struct dma_map_ops *get_pci_dma_ops(void)
 {
 	return pci_dma_ops;
 }
diff --git a/arch/powerpc/kernel/vio.c b/arch/powerpc/kernel/vio.c
index 819e59f..bc7b41e 100644
--- a/arch/powerpc/kernel/vio.c
+++ b/arch/powerpc/kernel/vio.c
@@ -601,7 +601,7 @@ static void vio_dma_iommu_unmap_sg(struct device *dev,
 	vio_cmo_dealloc(viodev, alloc_size);
 }
 
-struct dma_mapping_ops vio_dma_mapping_ops = {
+struct dma_map_ops vio_dma_mapping_ops = {
 	.alloc_coherent = vio_dma_iommu_alloc_coherent,
 	.free_coherent  = vio_dma_iommu_free_coherent,
 	.map_sg         = vio_dma_iommu_map_sg,
diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c
index 5b34fc2..416db17 100644
--- a/arch/powerpc/platforms/cell/iommu.c
+++ b/arch/powerpc/platforms/cell/iommu.c
@@ -642,7 +642,7 @@ static int dma_fixed_dma_supported(struct device *dev, u64 mask)
 
 static int dma_set_mask_and_switch(struct device *dev, u64 dma_mask);
 
-struct dma_mapping_ops dma_iommu_fixed_ops = {
+struct dma_map_ops dma_iommu_fixed_ops = {
 	.alloc_coherent = dma_fixed_alloc_coherent,
 	.free_coherent  = dma_fixed_free_coherent,
 	.map_sg         = dma_fixed_map_sg,
diff --git a/arch/powerpc/platforms/ps3/system-bus.c b/arch/powerpc/platforms/ps3/system-bus.c
index 3f763c5..02ddcc2 100644
--- a/arch/powerpc/platforms/ps3/system-bus.c
+++ b/arch/powerpc/platforms/ps3/system-bus.c
@@ -694,7 +694,7 @@ static int ps3_dma_supported(struct device *_dev, u64 mask)
 	return mask >= DMA_BIT_MASK(32);
 }
 
-static struct dma_mapping_ops ps3_sb_dma_ops = {
+static struct dma_map_ops ps3_sb_dma_ops = {
 	.alloc_coherent = ps3_alloc_coherent,
 	.free_coherent = ps3_free_coherent,
 	.map_sg = ps3_sb_map_sg,
@@ -704,7 +704,7 @@ static struct dma_mapping_ops ps3_sb_dma_ops = {
 	.unmap_page = ps3_unmap_page,
 };
 
-static struct dma_mapping_ops ps3_ioc0_dma_ops = {
+static struct dma_map_ops ps3_ioc0_dma_ops = {
 	.alloc_coherent = ps3_alloc_coherent,
 	.free_coherent = ps3_free_coherent,
 	.map_sg = ps3_ioc0_map_sg,
-- 
1.6.0.6

^ permalink raw reply related

* [PATCH -v2 3/7] add set_dma_mask hook to struct dma_map_ops
From: FUJITA Tomonori @ 2009-08-05  5:08 UTC (permalink / raw)
  To: linuxppc-dev, benh; +Cc: fujita.tomonori, mingo, linux-kernel, galak
In-Reply-To: <1249448908-18985-1-git-send-email-fujita.tomonori@lab.ntt.co.jp>

POWERPC needs this hook. SPARC could use it too.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Becky Bruce <beckyb@kernel.crashing.org>
---
 include/linux/dma-mapping.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index c0f6c3c..91b7618 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -58,6 +58,7 @@ struct dma_map_ops {
 				   enum dma_data_direction dir);
 	int (*mapping_error)(struct device *dev, dma_addr_t dma_addr);
 	int (*dma_supported)(struct device *dev, u64 mask);
+	int (*set_dma_mask)(struct device *dev, u64 mask);
 	int is_phys;
 };
 
-- 
1.6.0.6

^ permalink raw reply related

* [PATCH -v2 5/7] powerpc: use asm-generic/dma-mapping-common.h
From: FUJITA Tomonori @ 2009-08-05  5:08 UTC (permalink / raw)
  To: linuxppc-dev, benh; +Cc: fujita.tomonori, mingo, linux-kernel, galak
In-Reply-To: <1249448908-18985-1-git-send-email-fujita.tomonori@lab.ntt.co.jp>

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Becky Bruce <beckyb@kernel.crashing.org>
---
 arch/powerpc/Kconfig                   |    6 +-
 arch/powerpc/include/asm/dma-mapping.h |  242 +-------------------------------
 2 files changed, 7 insertions(+), 241 deletions(-)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index d00131c..fb3f4ff 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -120,7 +120,7 @@ config PPC
 	select HAVE_KRETPROBES
 	select HAVE_ARCH_TRACEHOOK
 	select HAVE_LMB
-	select HAVE_DMA_ATTRS if PPC64
+	select HAVE_DMA_ATTRS
 	select USE_GENERIC_SMP_HELPERS if SMP
 	select HAVE_OPROFILE
 	select HAVE_SYSCALL_WRAPPERS if PPC64
@@ -307,10 +307,6 @@ config SWIOTLB
 	  platforms where the size of a physical address is larger
 	  than the bus address.  Not all platforms support this.
 
-config PPC_NEED_DMA_SYNC_OPS
-	def_bool y
-	depends on (NOT_COHERENT_CACHE || SWIOTLB)
-
 config HOTPLUG_CPU
 	bool "Support for enabling/disabling CPUs"
 	depends on SMP && HOTPLUG && EXPERIMENTAL && (PPC_PSERIES || PPC_PMAC)
diff --git a/arch/powerpc/include/asm/dma-mapping.h b/arch/powerpc/include/asm/dma-mapping.h
index 8ca2b51..91217e4 100644
--- a/arch/powerpc/include/asm/dma-mapping.h
+++ b/arch/powerpc/include/asm/dma-mapping.h
@@ -14,6 +14,7 @@
 #include <linux/mm.h>
 #include <linux/scatterlist.h>
 #include <linux/dma-attrs.h>
+#include <linux/dma-debug.h>
 #include <asm/io.h>
 #include <asm/swiotlb.h>
 
@@ -89,6 +90,11 @@ static inline void set_dma_ops(struct device *dev, struct dma_map_ops *ops)
 	dev->archdata.dma_ops = ops;
 }
 
+/* this will be removed soon */
+#define flush_write_buffers()
+
+#include <asm-generic/dma-mapping-common.h>
+
 static inline int dma_supported(struct device *dev, u64 mask)
 {
 	struct dma_map_ops *dma_ops = get_dma_ops(dev);
@@ -117,87 +123,6 @@ static inline int dma_set_mask(struct device *dev, u64 dma_mask)
 	return 0;
 }
 
-/*
- * map_/unmap_single actually call through to map/unmap_page now that all the
- * dma_map_ops have been converted over. We just have to get the page and
- * offset to pass through to map_page
- */
-static inline dma_addr_t dma_map_single_attrs(struct device *dev,
-					      void *cpu_addr,
-					      size_t size,
-					      enum dma_data_direction direction,
-					      struct dma_attrs *attrs)
-{
-	struct dma_map_ops *dma_ops = get_dma_ops(dev);
-
-	BUG_ON(!dma_ops);
-
-	return dma_ops->map_page(dev, virt_to_page(cpu_addr),
-				 (unsigned long)cpu_addr % PAGE_SIZE, size,
-				 direction, attrs);
-}
-
-static inline void dma_unmap_single_attrs(struct device *dev,
-					  dma_addr_t dma_addr,
-					  size_t size,
-					  enum dma_data_direction direction,
-					  struct dma_attrs *attrs)
-{
-	struct dma_map_ops *dma_ops = get_dma_ops(dev);
-
-	BUG_ON(!dma_ops);
-
-	dma_ops->unmap_page(dev, dma_addr, size, direction, attrs);
-}
-
-static inline dma_addr_t dma_map_page_attrs(struct device *dev,
-					    struct page *page,
-					    unsigned long offset, size_t size,
-					    enum dma_data_direction direction,
-					    struct dma_attrs *attrs)
-{
-	struct dma_map_ops *dma_ops = get_dma_ops(dev);
-
-	BUG_ON(!dma_ops);
-
-	return dma_ops->map_page(dev, page, offset, size, direction, attrs);
-}
-
-static inline void dma_unmap_page_attrs(struct device *dev,
-					dma_addr_t dma_address,
-					size_t size,
-					enum dma_data_direction direction,
-					struct dma_attrs *attrs)
-{
-	struct dma_map_ops *dma_ops = get_dma_ops(dev);
-
-	BUG_ON(!dma_ops);
-
-	dma_ops->unmap_page(dev, dma_address, size, direction, attrs);
-}
-
-static inline int dma_map_sg_attrs(struct device *dev, struct scatterlist *sg,
-				   int nents, enum dma_data_direction direction,
-				   struct dma_attrs *attrs)
-{
-	struct dma_map_ops *dma_ops = get_dma_ops(dev);
-
-	BUG_ON(!dma_ops);
-	return dma_ops->map_sg(dev, sg, nents, direction, attrs);
-}
-
-static inline void dma_unmap_sg_attrs(struct device *dev,
-				      struct scatterlist *sg,
-				      int nhwentries,
-				      enum dma_data_direction direction,
-				      struct dma_attrs *attrs)
-{
-	struct dma_map_ops *dma_ops = get_dma_ops(dev);
-
-	BUG_ON(!dma_ops);
-	dma_ops->unmap_sg(dev, sg, nhwentries, direction, attrs);
-}
-
 static inline void *dma_alloc_coherent(struct device *dev, size_t size,
 				       dma_addr_t *dma_handle, gfp_t flag)
 {
@@ -216,161 +141,6 @@ static inline void dma_free_coherent(struct device *dev, size_t size,
 	dma_ops->free_coherent(dev, size, cpu_addr, dma_handle);
 }
 
-static inline dma_addr_t dma_map_single(struct device *dev, void *cpu_addr,
-					size_t size,
-					enum dma_data_direction direction)
-{
-	return dma_map_single_attrs(dev, cpu_addr, size, direction, NULL);
-}
-
-static inline void dma_unmap_single(struct device *dev, dma_addr_t dma_addr,
-				    size_t size,
-				    enum dma_data_direction direction)
-{
-	dma_unmap_single_attrs(dev, dma_addr, size, direction, NULL);
-}
-
-static inline dma_addr_t dma_map_page(struct device *dev, struct page *page,
-				      unsigned long offset, size_t size,
-				      enum dma_data_direction direction)
-{
-	return dma_map_page_attrs(dev, page, offset, size, direction, NULL);
-}
-
-static inline void dma_unmap_page(struct device *dev, dma_addr_t dma_address,
-				  size_t size,
-				  enum dma_data_direction direction)
-{
-	dma_unmap_page_attrs(dev, dma_address, size, direction, NULL);
-}
-
-static inline int dma_map_sg(struct device *dev, struct scatterlist *sg,
-			     int nents, enum dma_data_direction direction)
-{
-	return dma_map_sg_attrs(dev, sg, nents, direction, NULL);
-}
-
-static inline void dma_unmap_sg(struct device *dev, struct scatterlist *sg,
-				int nhwentries,
-				enum dma_data_direction direction)
-{
-	dma_unmap_sg_attrs(dev, sg, nhwentries, direction, NULL);
-}
-
-#ifdef CONFIG_PPC_NEED_DMA_SYNC_OPS
-static inline void dma_sync_single_for_cpu(struct device *dev,
-		dma_addr_t dma_handle, size_t size,
-		enum dma_data_direction direction)
-{
-	struct dma_map_ops *dma_ops = get_dma_ops(dev);
-
-	BUG_ON(!dma_ops);
-
-	if (dma_ops->sync_single_range_for_cpu)
-		dma_ops->sync_single_range_for_cpu(dev, dma_handle, 0,
-					   size, direction);
-}
-
-static inline void dma_sync_single_for_device(struct device *dev,
-		dma_addr_t dma_handle, size_t size,
-		enum dma_data_direction direction)
-{
-	struct dma_map_ops *dma_ops = get_dma_ops(dev);
-
-	BUG_ON(!dma_ops);
-
-	if (dma_ops->sync_single_range_for_device)
-		dma_ops->sync_single_range_for_device(dev, dma_handle,
-					      0, size, direction);
-}
-
-static inline void dma_sync_sg_for_cpu(struct device *dev,
-		struct scatterlist *sgl, int nents,
-		enum dma_data_direction direction)
-{
-	struct dma_map_ops *dma_ops = get_dma_ops(dev);
-
-	BUG_ON(!dma_ops);
-
-	if (dma_ops->sync_sg_for_cpu)
-		dma_ops->sync_sg_for_cpu(dev, sgl, nents, direction);
-}
-
-static inline void dma_sync_sg_for_device(struct device *dev,
-		struct scatterlist *sgl, int nents,
-		enum dma_data_direction direction)
-{
-	struct dma_map_ops *dma_ops = get_dma_ops(dev);
-
-	BUG_ON(!dma_ops);
-
-	if (dma_ops->sync_sg_for_device)
-		dma_ops->sync_sg_for_device(dev, sgl, nents, direction);
-}
-
-static inline void dma_sync_single_range_for_cpu(struct device *dev,
-		dma_addr_t dma_handle, unsigned long offset, size_t size,
-		enum dma_data_direction direction)
-{
-	struct dma_map_ops *dma_ops = get_dma_ops(dev);
-
-	BUG_ON(!dma_ops);
-
-	if (dma_ops->sync_single_range_for_cpu)
-		dma_ops->sync_single_range_for_cpu(dev, dma_handle,
-					   offset, size, direction);
-}
-
-static inline void dma_sync_single_range_for_device(struct device *dev,
-		dma_addr_t dma_handle, unsigned long offset, size_t size,
-		enum dma_data_direction direction)
-{
-	struct dma_map_ops *dma_ops = get_dma_ops(dev);
-
-	BUG_ON(!dma_ops);
-
-	if (dma_ops->sync_single_range_for_device)
-		dma_ops->sync_single_range_for_device(dev, dma_handle, offset,
-					      size, direction);
-}
-#else /* CONFIG_PPC_NEED_DMA_SYNC_OPS */
-static inline void dma_sync_single_for_cpu(struct device *dev,
-		dma_addr_t dma_handle, size_t size,
-		enum dma_data_direction direction)
-{
-}
-
-static inline void dma_sync_single_for_device(struct device *dev,
-		dma_addr_t dma_handle, size_t size,
-		enum dma_data_direction direction)
-{
-}
-
-static inline void dma_sync_sg_for_cpu(struct device *dev,
-		struct scatterlist *sgl, int nents,
-		enum dma_data_direction direction)
-{
-}
-
-static inline void dma_sync_sg_for_device(struct device *dev,
-		struct scatterlist *sgl, int nents,
-		enum dma_data_direction direction)
-{
-}
-
-static inline void dma_sync_single_range_for_cpu(struct device *dev,
-		dma_addr_t dma_handle, unsigned long offset, size_t size,
-		enum dma_data_direction direction)
-{
-}
-
-static inline void dma_sync_single_range_for_device(struct device *dev,
-		dma_addr_t dma_handle, unsigned long offset, size_t size,
-		enum dma_data_direction direction)
-{
-}
-#endif
-
 static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
 {
 #ifdef CONFIG_PPC64
-- 
1.6.0.6

^ permalink raw reply related

* [PATCH -v2 0/7] powerpc: use asm-generic/dma-mapping-common.h
From: FUJITA Tomonori @ 2009-08-05  5:08 UTC (permalink / raw)
  To: linuxppc-dev, benh; +Cc: fujita.tomonori, mingo, linux-kernel, galak

This is the second version of the patchset to convert POWERPC to use
asm-generic/dma-mapping-common.h:

http://marc.info/?l=linux-kernel&m=124840628128189&w=2

There are some minor changes since the first version are:

- removed unused CONFIG_PPC_NEED_DMA_SYNC_OPS [5/7] (Becky pointed
  out).

- added Becky's Acked-by

- added two new patches ([6/7] and [7/7]). [6/7] fixes SWIOTLB's
  dma_mapping_error(). [7/7] addes CONFIG_DMA_API_DEBUG support.


This is on the top of my swiotlb cleanup patchset:

http://marc.info/?l=linuxppc-embedded&m=124718920320951&w=2


The above swiotlb patchset was merged in -tip so I think that merging
this patchset via -tip too is the easiest way to handle this patchset.

The patchset also is available via a git tree:

git://git.kernel.org/pub/scm/linux/kernel/git/tomo/linux-2.6-misc.git powerpc


=
 arch/powerpc/Kconfig                       |    7 +-
 arch/powerpc/include/asm/device.h          |    7 +-
 arch/powerpc/include/asm/dma-mapping.h     |  318 +++-------------------------
 arch/powerpc/include/asm/pci.h             |    4 +-
 arch/powerpc/include/asm/swiotlb.h         |    8 +-
 arch/powerpc/kernel/dma-iommu.c            |    2 +-
 arch/powerpc/kernel/dma-swiotlb.c          |   53 ++---
 arch/powerpc/kernel/dma.c                  |   13 +-
 arch/powerpc/kernel/ibmebus.c              |    2 +-
 arch/powerpc/kernel/pci-common.c           |    6 +-
 arch/powerpc/kernel/vio.c                  |    2 +-
 arch/powerpc/platforms/85xx/mpc8536_ds.c   |    3 +-
 arch/powerpc/platforms/85xx/mpc85xx_ds.c   |    3 +-
 arch/powerpc/platforms/85xx/mpc85xx_mds.c  |    3 +-
 arch/powerpc/platforms/86xx/mpc86xx_hpcn.c |    3 +-
 arch/powerpc/platforms/cell/iommu.c        |    2 +-
 arch/powerpc/platforms/ps3/system-bus.c    |    4 +-
 include/linux/dma-mapping.h                |    1 +
 18 files changed, 89 insertions(+), 352 deletions(-)

^ permalink raw reply

* [PATCH -v2 2/7] powerpc: remove swiotlb_pci_dma_ops
From: FUJITA Tomonori @ 2009-08-05  5:08 UTC (permalink / raw)
  To: linuxppc-dev, benh; +Cc: fujita.tomonori, mingo, linux-kernel, galak
In-Reply-To: <1249448908-18985-1-git-send-email-fujita.tomonori@lab.ntt.co.jp>

Now swiotlb_pci_dma_ops is identical to swiotlb_dma_ops; we can use
swiotlb_dma_ops with any devices. This removes swiotlb_pci_dma_ops.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Becky Bruce <beckyb@kernel.crashing.org>
---
 arch/powerpc/include/asm/swiotlb.h         |    1 -
 arch/powerpc/kernel/dma-swiotlb.c          |   14 --------------
 arch/powerpc/platforms/85xx/mpc8536_ds.c   |    2 +-
 arch/powerpc/platforms/85xx/mpc85xx_ds.c   |    2 +-
 arch/powerpc/platforms/85xx/mpc85xx_mds.c  |    2 +-
 arch/powerpc/platforms/86xx/mpc86xx_hpcn.c |    2 +-
 6 files changed, 4 insertions(+), 19 deletions(-)

diff --git a/arch/powerpc/include/asm/swiotlb.h b/arch/powerpc/include/asm/swiotlb.h
index 31e0e43..21ce0a3 100644
--- a/arch/powerpc/include/asm/swiotlb.h
+++ b/arch/powerpc/include/asm/swiotlb.h
@@ -14,7 +14,6 @@
 #include <linux/swiotlb.h>
 
 extern struct dma_mapping_ops swiotlb_dma_ops;
-extern struct dma_mapping_ops swiotlb_pci_dma_ops;
 
 static inline void dma_mark_clean(void *addr, size_t size) {}
 
diff --git a/arch/powerpc/kernel/dma-swiotlb.c b/arch/powerpc/kernel/dma-swiotlb.c
index c9f6a30..ca141e1 100644
--- a/arch/powerpc/kernel/dma-swiotlb.c
+++ b/arch/powerpc/kernel/dma-swiotlb.c
@@ -45,20 +45,6 @@ struct dma_mapping_ops swiotlb_dma_ops = {
 	.sync_sg_for_device = swiotlb_sync_sg_for_device
 };
 
-struct dma_mapping_ops swiotlb_pci_dma_ops = {
-	.alloc_coherent = dma_direct_alloc_coherent,
-	.free_coherent = dma_direct_free_coherent,
-	.map_sg = swiotlb_map_sg_attrs,
-	.unmap_sg = swiotlb_unmap_sg_attrs,
-	.dma_supported = swiotlb_dma_supported,
-	.map_page = swiotlb_map_page,
-	.unmap_page = swiotlb_unmap_page,
-	.sync_single_range_for_cpu = swiotlb_sync_single_range_for_cpu,
-	.sync_single_range_for_device = swiotlb_sync_single_range_for_device,
-	.sync_sg_for_cpu = swiotlb_sync_sg_for_cpu,
-	.sync_sg_for_device = swiotlb_sync_sg_for_device
-};
-
 void pci_dma_dev_setup_swiotlb(struct pci_dev *pdev)
 {
 	struct pci_controller *hose;
diff --git a/arch/powerpc/platforms/85xx/mpc8536_ds.c b/arch/powerpc/platforms/85xx/mpc8536_ds.c
index bf052c0..004b7d3 100644
--- a/arch/powerpc/platforms/85xx/mpc8536_ds.c
+++ b/arch/powerpc/platforms/85xx/mpc8536_ds.c
@@ -96,7 +96,7 @@ static void __init mpc8536_ds_setup_arch(void)
 #ifdef CONFIG_SWIOTLB
 	if (lmb_end_of_DRAM() > max) {
 		ppc_swiotlb_enable = 1;
-		set_pci_dma_ops(&swiotlb_pci_dma_ops);
+		set_pci_dma_ops(&swiotlb_dma_ops);
 		ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
 	}
 #endif
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_ds.c b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
index c6f92cc..544011a 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_ds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_ds.c
@@ -192,7 +192,7 @@ static void __init mpc85xx_ds_setup_arch(void)
 #ifdef CONFIG_SWIOTLB
 	if (lmb_end_of_DRAM() > max) {
 		ppc_swiotlb_enable = 1;
-		set_pci_dma_ops(&swiotlb_pci_dma_ops);
+		set_pci_dma_ops(&swiotlb_dma_ops);
 		ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
 	}
 #endif
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_mds.c b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
index e1f82f8..5ea1b68 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_mds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
@@ -254,7 +254,7 @@ static void __init mpc85xx_mds_setup_arch(void)
 #ifdef CONFIG_SWIOTLB
 	if (lmb_end_of_DRAM() > max) {
 		ppc_swiotlb_enable = 1;
-		set_pci_dma_ops(&swiotlb_pci_dma_ops);
+		set_pci_dma_ops(&swiotlb_dma_ops);
 		ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
 	}
 #endif
diff --git a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
index 8032301..2aa69a6 100644
--- a/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
+++ b/arch/powerpc/platforms/86xx/mpc86xx_hpcn.c
@@ -105,7 +105,7 @@ mpc86xx_hpcn_setup_arch(void)
 #ifdef CONFIG_SWIOTLB
 	if (lmb_end_of_DRAM() > max) {
 		ppc_swiotlb_enable = 1;
-		set_pci_dma_ops(&swiotlb_pci_dma_ops);
+		set_pci_dma_ops(&swiotlb_dma_ops);
 		ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
 	}
 #endif
-- 
1.6.0.6

^ permalink raw reply related

* Re: [PATCH] powerpc/mpc52xx/wdt: Fix 5200 wdt always being used as gpt
From: Grant Likely @ 2009-08-05  4:47 UTC (permalink / raw)
  To: Albrecht Dreß; +Cc: Linux PPC Development, wim
In-Reply-To: <1249325206.3404.1@antares>

On Mon, Aug 3, 2009 at 12:46 PM, Albrecht Dre=DF<albrecht.dress@arcor.de> w=
rote:
> Am 03.08.09 19:50 schrieb(en) Grant Likely:
>>
>> Just about all mpc5200 device trees have the fsl,has-wdt property on GPT=
0
>> even when it isn't used as a watchdog.
>
> Sorry, I do not understand... =A0The file
> Documentation/powerpc/dts-bindings/fsl/mpc5200.txt says
>
> <snip>
> On the mpc5200 and 5200b, GPT0 has a watchdog timer function. =A0If the b=
oard
> design supports the internal wdt, then the device node for GPT0 should
> include the empty property 'fsl,has-wdt'.
> </snip>
>
> I interpreted this as "if you don't want to have the wdt function of gpt0=
,
> remove this property". =A0If this assumption is wrong, how is the kernel
> supposed to decide if a device shall be used as gpt or as wdt?

That just states whether or not the functionality is there.  In fact,
the device can be used as both a WDT and a GPIO pin at the same time.

The kernel should decide how to use it based on what userspace asks it
to do.  If the WDT interface is opened, then it should be used as a
WDT.  If the GPIO interface is opened, then it should be used as a
GPIO (and not disturb the WDT settings).  If the gpt timer API is
called (not yet merged), then it should be used as a timer; but only
if it hasn't already been set up as a WDT.

>
>> The boards using GPT0 as a GPIO or timer will be broken by this patch.
>
> A wdt is a security device which will (IMHO) either not be used as such, =
or
> it is a *must not* be used for something else on a particular board (you =
may
> even want u-boot to activate it, e.g. to detect a hanging boot process). =
=A0In
> both cases, a "tuned" device tree is needed.

There is no property in the current binding that provides that data to
the kernel.  It works for it to be implicit based on how userspace
accesses the device, but if you want added assurance to ensure that
nothing else can use the WDT then you can define a new property to
state that explicitly and inhibit other uses.  That way no older
boards remain broken regardless of how they currently use GPT0

In fact, it probably makes sense to have a property to describe a
timeout value to preload into the WDT at boot time, or respect a
watchdog value already initialized by firmware (so that even if
userspace fails to start the watchdog daemon, the system will still
get reset).

>> I know it is a lot more work, but the correct solution is to merge the G=
PT
>> watchdog driver into the regular GPT driver so that we don't have two de=
vice
>> drivers trying to bind against the same device.
>
> I see the benefit of removing some duplicate code and of having gpio acce=
ss
> in parallel with the wdt, but it wouldn't solve the general confusion abo=
ve!
> =A0Will look into that, though...

I took a look at the code this evening, and it actually shouldn't be
too difficult to rework.  Most of the work would be relocating the
functions in the wdt driver into the gpt driver and wiring it into the
GPT probe/remove functions.

g.

--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply

* [PATCH] powerpc/mm: Fix switch_mmu_context to iterate of the proper list of cpus
From: Kumar Gala @ 2009-08-05  3:33 UTC (permalink / raw)
  To: linuxppc-dev

Introduced a temporary variable into our iterating over the list cpus
that are threads on the same core.  For some reason Ben forgot how for
loops work.

Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
---
 arch/powerpc/mm/mmu_context_nohash.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/mm/mmu_context_nohash.c b/arch/powerpc/mm/mmu_context_nohash.c
index 6e8d2d9..9859dcd 100644
--- a/arch/powerpc/mm/mmu_context_nohash.c
+++ b/arch/powerpc/mm/mmu_context_nohash.c
@@ -190,7 +190,7 @@ static void context_check_map(void) { }
 
 void switch_mmu_context(struct mm_struct *prev, struct mm_struct *next)
 {
-	unsigned int id, cpu = smp_processor_id();
+	unsigned int i, id, cpu = smp_processor_id();
 	unsigned long *map;
 
 	/* No lockless fast path .. yet */
@@ -268,9 +268,10 @@ void switch_mmu_context(struct mm_struct *prev, struct mm_struct *next)
 		local_flush_tlb_mm(next);
 
 		/* XXX This clear should ultimately be part of local_flush_tlb_mm */
-		for (cpu = cpu_first_thread_in_core(cpu);
-		     cpu <= cpu_last_thread_in_core(cpu); cpu++)
-			__clear_bit(id, stale_map[cpu]);
+		for (i = cpu_first_thread_in_core(cpu);
+		     i <= cpu_last_thread_in_core(cpu); i++) {
+			__clear_bit(id, stale_map[i]);
+		}
 	}
 
 	/* Flick the MMU and release lock */
-- 
1.6.0.6

^ permalink raw reply related

* Re: [Patch 2/6] Introduce PPC64 specific Hardware Breakpoint interfaces
From: David Gibson @ 2009-08-05  2:55 UTC (permalink / raw)
  To: K.Prasad
  Cc: Michael Neuling, Benjamin Herrenschmidt, linuxppc-dev, paulus,
	Alan Stern, Roland McGrath
In-Reply-To: <20090803205938.GB3914@in.ibm.com>

On Tue, Aug 04, 2009 at 02:29:38AM +0530, K.Prasad wrote:
> On Fri, Jul 31, 2009 at 04:16:46PM +1000, David Gibson wrote:
> > On Mon, Jul 27, 2009 at 05:43:17AM +0530, K.Prasad wrote:
[snip]
> > > +	/* Verify if dar lies within the address range occupied by the symbol
> > > +	 * being watched. Since we cannot get the symbol size for
> > > +	 * user-space requests we skip this check in that case
> > > +	 */
> > > +	if (is_kernel &&
> > > +	    !((bp->info.address <= dar) &&
> > > +	     (dar <= (bp->info.address + bp->info.symbolsize))))
> > > +		/*
> > > +		 * This exception is triggered not because of a memory access on
> > > +		 * the monitored variable but in the double-word address range
> > > +		 * in which it is contained. We will consume this exception,
> > > +		 * considering it as 'noise'.
> > > +		 */
> > > +		goto out;
> > > +
> > > +	(bp->triggered)(bp, regs);
> > 
> > It bothers me that the trigger function is executed before the
> > trapping instruction, but the SIGTRAP occurs afterwards.  Since
> > they're both responses to the trap, it seems logical to me that they
> > should occur at the same time (from the trapping program's point of
> > view, at least).
> > 
> 
> How about moving the triggered function to the single-step handler code
> for both kernel- and user-space?
> 
> That would make it behave like a trigger-after-execute (and synchronised
> with the signal-delivery timing).

I think that would be an improvement, yes.  I definitely think the
SIGTRAP and the callback function should happen at the same time in
all cases.  Possibly even have the callback function issue the SIGTRAP
rather than special casing that.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

^ permalink raw reply

* Re: [Patch 0/6] [Patch 0/6] PPC64-HWBKPT: Hardware Breakpoint interfaces - ver VIII
From: David Gibson @ 2009-08-05  2:08 UTC (permalink / raw)
  To: K.Prasad
  Cc: Michael Neuling, Benjamin Herrenschmidt, linuxppc-dev, paulus,
	Alan Stern, Roland McGrath
In-Reply-To: <20090803205316.GA3914@in.ibm.com>

On Tue, Aug 04, 2009 at 02:23:16AM +0530, K.Prasad wrote:
> On Fri, Jul 31, 2009 at 04:10:13PM +1000, David Gibson wrote:
> > On Mon, Jul 27, 2009 at 05:41:52AM +0530, K.Prasad wrote:
> 
> <edited>
> 
> > > Reasons
> > > --------
> > > - Signal delivery before execution of instruction requires complex workarounds
> > > - One of the plausible workarounds is a two-pass hw-breakpoint handler which
> > >   delivers the signal after the first pass (with the breakpoints enabled).
> > >   In the second pass, it follows the existing semantics of
> > >   disable_hbp-->enable_ss-->single_step-->disable_ss-->enable_hbp.
> > 
> > Yes, that's the only way I can see to do it.
> > 
> > > - Possibility of nested exceptions is a problem here.
> > 
> > Ok, why?
> > 
> 
> Reason as described in the para below.
> 
> > > - Proper identification of a  second-pass of first exception and a new nested
> > >   exception is difficult. Possibility of stray exceptions due to accesses in
> > >   neighbouring memory regions of the breakpoint address further complicates it.
> 
> To elaborate, consider a case where a user-space address 'x' is
> monitored for read or write, and the following happens (assume the
> existence of the two-pass method for signal delivery).
> 
> - Instruction 'i' attempts to read/write in address 'x'
> - hw-bkpt exception generated (pass I)
> - Signal generated and hw-bkpt exception returns to user-space
> - Signal is handled before 'i' is executed. Handler code reads/writes
>   data in 'x' again. Generates nested exception.
> - hw-breakpoint handler code is unable to distinguish if the new
>   exception is from signal handler (nested) or due to second-pass (as
>   per design above).

Ah, ok, I understand now.  Hrm.  I'll have to think about this.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

^ permalink raw reply

* Re: [PATCH 1/7] spi: Add support for device table matching
From: Anton Vorontsov @ 2009-08-05  1:06 UTC (permalink / raw)
  To: David Brownell
  Cc: linux-kernel, lm-sensors, linuxppc-dev, linux-mtd, Ben Dooks,
	Jean Delvare, Andrew Morton, David Woodhouse
In-Reply-To: <200908031921.23126.david-b@pacbell.net>

On Mon, Aug 03, 2009 at 07:21:22PM -0700, David Brownell wrote:
> On Wednesday 29 July 2009, Ben Dooks wrote:
> > >  struct spi_driver {
> > > +     const struct spi_device_id *id_table;
> > > +     int                     (*probe_id)(struct spi_device *spi,
> > > +                                         const struct spi_device_id *id);
> > 
> > how about leaving it at just probe and have either a call or a field
> > in the device that you can look at to see if this was a new style of
> > call?
> > 
> > >       int                     (*probe)(struct spi_device *spi);
> 
> For the record, if this is going to happen I think the
> appropriate long-term solution is to have probe() take
> the device_id just as it does with other busses.

Just curious. Why you prefer another argument in the probe()
instead of calling some helper function? Most drivers don't
need the "id" argument, so why spend memory and cpu cycles
for it?

-- 
Anton Vorontsov
email: cbouatmailru@gmail.com
irc://irc.freenode.net/bd2

^ permalink raw reply

* Re: BUG in dma-mapping.h:218 // MESH SCSI driver not working
From: Benjamin Herrenschmidt @ 2009-08-05  1:11 UTC (permalink / raw)
  To: FUJITA Tomonori; +Cc: James.Bottomley, linuxppc-dev, linux-scsi, stef.simoens
In-Reply-To: <20090805100424U.fujita.tomonori@lab.ntt.co.jp>

On Wed, 2009-08-05 at 10:04 +0900, FUJITA Tomonori wrote:
> 
> Looks like that READ CAPACITY fails. We use kmalloc'ed buffer for READ
> CAPACITY so I'm not sure about an alignment issue that you mentioned
> in this thread earlier.
> 
> You said your machine with a MESH appears to work. Did you confirm it?
> 
Not yet. It's a fishy machine that needs other patches to get back to
working condition, I haven't had time yet (everybody's sick at home so
I've been mostly off the office and the machine is there).

I'm pretty sure the MESH will have issues though if the DMA buffers
aren't at least 16 (or maybe it's 32) bytes aligned. I don't think it's
a cache alignment issue, I suspect it's an issue with the DBDMA engine
queue on those chips though (it -could- be cache coherency bugs too,
never know with those old Apple home made chipsets).

I remember we had problems in the past with IDENTIFY iirc, which would
work normally as kmalloc() would return something cache line aligned...
until one enabled SLAB debugging.

Cheers,
Ben.

^ 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