All of lore.kernel.org
 help / color / mirror / Atom feed
* (unknown), 
@ 2017-04-03  6:14 Adrian Gillian Bayford
  0 siblings, 0 replies; 2593+ messages in thread
From: Adrian Gillian Bayford @ 2017-04-03  6:14 UTC (permalink / raw)
  To: Recipients

£1.5 Million Has Been Granted To You As A Donation Visit www.bbc.co.uk/news/uk-england-19254228 Sendname Address Phone for more info

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-03  6:14 Adrian Gillian Bayford
  0 siblings, 0 replies; 2593+ messages in thread
From: Adrian Gillian Bayford @ 2017-04-03  6:14 UTC (permalink / raw)
  To: Recipients

£1.5 Million Has Been Granted To You As A Donation Visit www.bbc.co.uk/news/uk-england-19254228 Sendname Address Phone for more info
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-04 19:31 Kristi Nikolla
  0 siblings, 0 replies; 2593+ messages in thread
From: Kristi Nikolla @ 2017-04-04 19:31 UTC (permalink / raw)
  To: ceph-devel

subscribe

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-05 16:35 bunny43200
  0 siblings, 0 replies; 2593+ messages in thread
From: bunny43200 @ 2017-04-05 16:35 UTC (permalink / raw)
  To: linux-leds

[-- Attachment #1: 74850.zip --]
[-- Type: application/zip, Size: 3820 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-05 16:53 dowen
  0 siblings, 0 replies; 2593+ messages in thread
From: dowen @ 2017-04-05 16:53 UTC (permalink / raw)
  To: linux-i2c

[-- Attachment #1: 848830461176929.zip --]
[-- Type: application/zip, Size: 3825 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-05 17:06 kgbok.kezyhumh
  0 siblings, 0 replies; 2593+ messages in thread
From: kgbok.kezyhumh @ 2017-04-05 17:06 UTC (permalink / raw)
  To: linux-pm

[-- Attachment #1: 391771.zip --]
[-- Type: application/zip, Size: 3807 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-05 17:30 sekretariat.mzagorski-40QDpL200RxmR6Xm/wNWPw
  0 siblings, 0 replies; 2593+ messages in thread
From: sekretariat.mzagorski-40QDpL200RxmR6Xm/wNWPw @ 2017-04-05 17:30 UTC (permalink / raw)
  To: linux-tegra-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: 89502610884.zip --]
[-- Type: application/zip, Size: 3836 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-05 18:10 alters
  0 siblings, 0 replies; 2593+ messages in thread
From: alters @ 2017-04-05 18:10 UTC (permalink / raw)
  To: linux-scsi

[-- Attachment #1: 4723.zip --]
[-- Type: application/zip, Size: 3826 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-06  6:03 bendis.michal
  0 siblings, 0 replies; 2593+ messages in thread
From: bendis.michal @ 2017-04-06  6:03 UTC (permalink / raw)
  To: linux-samsung-soc

[-- Attachment #1: 45.zip --]
[-- Type: application/zip, Size: 3824 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-06  8:19 bendis.michal
  0 siblings, 0 replies; 2593+ messages in thread
From: bendis.michal @ 2017-04-06  8:19 UTC (permalink / raw)
  To: linux-samsung-soc

[-- Attachment #1: 11962241.zip --]
[-- Type: application/zip, Size: 3855 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-06 11:45 j.lahoda-aRb0bU7PRFPrBKCeMvbIDA
  0 siblings, 0 replies; 2593+ messages in thread
From: j.lahoda-aRb0bU7PRFPrBKCeMvbIDA @ 2017-04-06 11:45 UTC (permalink / raw)
  To: linux-efi-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: 9.zip --]
[-- Type: application/zip, Size: 25 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-06 13:43 agiva
  0 siblings, 0 replies; 2593+ messages in thread
From: agiva @ 2017-04-06 13:43 UTC (permalink / raw)
  To: linux-crypto

[-- Attachment #1: 84.zip --]
[-- Type: application/zip, Size: 25 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-06 14:05 jacqueline.pike
  0 siblings, 0 replies; 2593+ messages in thread
From: jacqueline.pike @ 2017-04-06 14:05 UTC (permalink / raw)
  To: linux-arch

[-- Attachment #1: 989845647886706.zip --]
[-- Type: application/zip, Size: 25 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-06 19:09 David Buckley
  0 siblings, 0 replies; 2593+ messages in thread
From: David Buckley @ 2017-04-06 19:09 UTC (permalink / raw)
  To: Martin K. Petersen; +Cc: linux-scsi

Martin,

I'm rather surprised nobody else has previously reported this as well,
especially as NetApp hadn't received any reports.  The only probably
explanation I could think of is that EL 7 is still based on a 3.10
kernel so is too old to be affected, and that is likely to be what
most NetApp customers are running.



I've been trying to test some additional kernels to try and narrow the
versions affected, and the change in discard_granularity does not
correspond with discard failing (as you suggested).

With kernel 3.13,  discard works as expected with
discard_granularity=4096 and discard_max_bytes=4194304.

With kernel 3.19, discard stops working completely, with
discard_granularity=4096 and discard_max_bytes=8388608.

Do you think the change in discard_max_bytes could be relevant?  If
that comes from the VPD data it seems odd it would change.

I am wondering if part of the issue is that in my use case, UNMAP and
WRITE SAME zeros result in very different results.  With thin
provisioned LUNs, UNMAP requests result in the blocks being freed and
thus shrinks the real size of the LUN allocation.  If WRITE SAME
requests are used to zero the blocks, they remain allocated as part of
the LUN and thus the real size of the LUN grows to match the allocated
size (effectively thick-provisioning the LUN).  This matches what I am
seeing on kernels with discard not working; running 'fstrim
/lun/mount' results in the LUN growing to its max size.

Thank you again for your help with this!

-David

On Thu, Apr 6, 2017 at 10:34 AM, Martin K. Petersen
<martin.petersen@oracle.com> wrote:
> David Buckley <dbuckley@oreilly.com> writes:
>
> David,
>
>> As I mentioned previously, I'm fairly certain that the issue I'm
>> seeing is due to the fact that while NetApp LUNs are presented as 512B
>> logical/4K physical disks for compatibility, they actually don't
>> support requests smaller than 4K (which makes sense as NetApp LUNs are
>> actually just files allocated on the 4K-block WAFL filesystem).
>
> That may be. But they should still deallocate all the whole 4K blocks
> described by an UNMAP request. Even if head and tail are not aligned.
>
>> Let me know if there's any additional information I can provide. This
>> has resulted in a 2-3x increase in raw disk requirements for some
>> workloads (unfortunately on SSD too), and I'd love to find a solution
>> that doesn't require rolling back to a 3.10 kernel.
>
> I just posted some patches yesterday that will address this (using WRITE
> SAME w/ UNMAP for block zeroing and allowing discards to be sent using
> the UNMAP command, honoring the granularity and alignment suggested by
> the device). That's 4.13 material, though.
>
> The enterprise distros have many customers using NetApp filers. I'm a
> bit puzzled why this is the first we hear of this...
>
> --
> Martin K. Petersen      Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-08 19:20 jbmplupus-Mmb7MZpHnFY
  0 siblings, 0 replies; 2593+ messages in thread
From: jbmplupus-Mmb7MZpHnFY @ 2017-04-08 19:20 UTC (permalink / raw)
  To: linux-man

[-- Attachment #1: 06153.zip --]
[-- Type: application/zip, Size: 3741 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-09  0:27 simon.a.t.hardy
  0 siblings, 0 replies; 2593+ messages in thread
From: simon.a.t.hardy @ 2017-04-09  0:27 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: REPORT_489904035659357_netfilter-devel.zip --]
[-- Type: application/zip, Size: 50091 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-09  2:11 jacqueline.pike
  0 siblings, 0 replies; 2593+ messages in thread
From: jacqueline.pike @ 2017-04-09  2:11 UTC (permalink / raw)
  To: linux-arch

[-- Attachment #1: REPORT_873354716538_linux-arch.zip --]
[-- Type: application/zip, Size: 50091 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-09  6:12 roeper
  0 siblings, 0 replies; 2593+ messages in thread
From: roeper @ 2017-04-09  6:12 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: REPORT_5908227665708_netfilter-devel.zip --]
[-- Type: application/zip, Size: 50091 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-09 14:11 carmen.croonquist
  0 siblings, 0 replies; 2593+ messages in thread
From: carmen.croonquist @ 2017-04-09 14:11 UTC (permalink / raw)
  To: linux-samsung-soc

[-- Attachment #1: 69025526952_linux-samsung-soc.zip --]
[-- Type: application/zip, Size: 3630 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-09 15:30 jha
  0 siblings, 0 replies; 2593+ messages in thread
From: jha @ 2017-04-09 15:30 UTC (permalink / raw)
  To: linux-scsi

[-- Attachment #1: 84128993426851_linux-scsi.zip --]
[-- Type: application/zip, Size: 3600 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-09 20:48 simon.a.t.hardy
  0 siblings, 0 replies; 2593+ messages in thread
From: simon.a.t.hardy @ 2017-04-09 20:48 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: 4_netfilter-devel.zip --]
[-- Type: application/zip, Size: 3639 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-09 21:15 ujagu8185-Re5JQEeQqe8AvxtiuMwx3w
  0 siblings, 0 replies; 2593+ messages in thread
From: ujagu8185-Re5JQEeQqe8AvxtiuMwx3w @ 2017-04-09 21:15 UTC (permalink / raw)
  To: linux-cifs-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: 4326157402_linux-cifs.zip --]
[-- Type: application/zip, Size: 3629 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-09 22:03 zem.uchastok
  0 siblings, 0 replies; 2593+ messages in thread
From: zem.uchastok @ 2017-04-09 22:03 UTC (permalink / raw)
  To: linux-m68k

[-- Attachment #1: 5750824004942_linux-m68k.zip --]
[-- Type: application/zip, Size: 3609 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2017-04-09 22:07 askeeta
  0 siblings, 0 replies; 2593+ messages in thread
From: askeeta @ 2017-04-09 22:07 UTC (permalink / raw)
  To: linux-parisc

[-- Attachment #1: 750388275461_linux-parisc.zip --]
[-- Type: application/zip, Size: 4876 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-10  0:41 amin
  0 siblings, 0 replies; 2593+ messages in thread
From: amin @ 2017-04-10  0:41 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: 0_netfilter-devel.zip --]
[-- Type: application/zip, Size: 3606 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-10  3:30 hp
  0 siblings, 0 replies; 2593+ messages in thread
From: hp @ 2017-04-10  3:30 UTC (permalink / raw)
  To: linux-raid

[-- Attachment #1: 7718637436266_linux-raid.zip --]
[-- Type: application/zip, Size: 3603 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-10  5:46 archerrp
  0 siblings, 0 replies; 2593+ messages in thread
From: archerrp @ 2017-04-10  5:46 UTC (permalink / raw)
  To: linux-crypto

[-- Attachment #1: 3_linux-crypto.zip --]
[-- Type: application/zip, Size: 3600 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-10  6:51 kathleen.gilbert
  0 siblings, 0 replies; 2593+ messages in thread
From: kathleen.gilbert @ 2017-04-10  6:51 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: 9214190934_netfilter-devel.zip --]
[-- Type: application/zip, Size: 3604 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-10  8:37 kkaplanidou
  0 siblings, 0 replies; 2593+ messages in thread
From: kkaplanidou @ 2017-04-10  8:37 UTC (permalink / raw)
  To: linux-scsi

[-- Attachment #1: 81477342108520_linux-scsi.zip --]
[-- Type: application/zip, Size: 2917 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-10 10:18 rueggemann
  0 siblings, 0 replies; 2593+ messages in thread
From: rueggemann @ 2017-04-10 10:18 UTC (permalink / raw)
  To: linux-samsung-soc

[-- Attachment #1: 207_linux-samsung-soc.zip --]
[-- Type: application/zip, Size: 3705 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-10 11:47 office
  0 siblings, 0 replies; 2593+ messages in thread
From: office @ 2017-04-10 11:47 UTC (permalink / raw)
  To: linux-leds

[-- Attachment #1: 1707926450225_linux-leds.zip --]
[-- Type: application/zip, Size: 3714 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-13 15:58 Scott Ellentuch
  0 siblings, 0 replies; 2593+ messages in thread
From: Scott Ellentuch @ 2017-04-13 15:58 UTC (permalink / raw)
  To: linux-raid

for disk in a b c d g h i j k l m n
do

  disklist="${disklist} /dev/sd${disk}1"

done

mdadm --create --verbose /dev/md2 --level=5 --raid=devices=12  ${disklist}

But its telling me :

mdadm: invalid number of raid devices: devices=12


I can't find any definition of a limit anywhere.

Thank you, Tuc

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-15 13:53 smallgroups
  0 siblings, 0 replies; 2593+ messages in thread
From: smallgroups @ 2017-04-15 13:53 UTC (permalink / raw)
  To: linux-crypto

[-- Attachment #1: REPORT_8394710_linux-crypto.zip --]
[-- Type: application/zip, Size: 4989 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-15 14:16 demorton
  0 siblings, 0 replies; 2593+ messages in thread
From: demorton @ 2017-04-15 14:16 UTC (permalink / raw)
  To: linux-scsi

[-- Attachment #1: REPORT_3030392596590_linux-scsi.zip --]
[-- Type: application/zip, Size: 1977 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-15 15:00 jbmplupus-Mmb7MZpHnFY
  0 siblings, 0 replies; 2593+ messages in thread
From: jbmplupus-Mmb7MZpHnFY @ 2017-04-15 15:00 UTC (permalink / raw)
  To: linux-man

[-- Attachment #1: REPORT_28110741209342_linux-man.zip --]
[-- Type: application/zip, Size: 2109 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-16  3:17 resson-epfaOiJH9AY
  0 siblings, 0 replies; 2593+ messages in thread
From: resson-epfaOiJH9AY @ 2017-04-16  3:17 UTC (permalink / raw)
  To: linux-rdma

[-- Attachment #1: EMAIL_89326372545_linux-rdma.zip --]
[-- Type: application/zip, Size: 3776 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-16  3:33 ohnesorge-wiek
  0 siblings, 0 replies; 2593+ messages in thread
From: ohnesorge-wiek @ 2017-04-16  3:33 UTC (permalink / raw)
  To: linux-scsi

[-- Attachment #1: EMAIL_3725766514_linux-scsi.zip --]
[-- Type: application/zip, Size: 3496 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-16  8:21 jha
  0 siblings, 0 replies; 2593+ messages in thread
From: jha @ 2017-04-16  8:21 UTC (permalink / raw)
  To: linux-scsi

[-- Attachment #1: EMAIL_99997_linux-scsi.zip --]
[-- Type: application/zip, Size: 2018 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-16  8:52 geir.nuland
  0 siblings, 0 replies; 2593+ messages in thread
From: geir.nuland @ 2017-04-16  8:52 UTC (permalink / raw)
  To: linux-acpi

[-- Attachment #1: EMAIL_75980237014631_linux-acpi.zip --]
[-- Type: application/zip, Size: 2036 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-16 15:48 redbeardcharters
  0 siblings, 0 replies; 2593+ messages in thread
From: redbeardcharters @ 2017-04-16 15:48 UTC (permalink / raw)
  To: linux-perf-users

[-- Attachment #1: EMAIL_387722751_linux-perf-users.zip --]
[-- Type: application/zip, Size: 1998 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-16 16:31 a.skucha
  0 siblings, 0 replies; 2593+ messages in thread
From: a.skucha @ 2017-04-16 16:31 UTC (permalink / raw)
  To: linux-scsi

[-- Attachment #1: EMAIL_10968724_linux-scsi.zip --]
[-- Type: application/zip, Size: 2011 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-16 16:37 bfoster
  0 siblings, 0 replies; 2593+ messages in thread
From: bfoster @ 2017-04-16 16:37 UTC (permalink / raw)
  To: linux-ext4

[-- Attachment #1: EMAIL_65750003_linux-ext4.zip --]
[-- Type: application/zip, Size: 2002 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2017-04-16 17:41 askeeta
  0 siblings, 0 replies; 2593+ messages in thread
From: askeeta @ 2017-04-16 17:41 UTC (permalink / raw)
  To: linux-parisc

[-- Attachment #1: EMAIL_52728_linux-parisc.zip --]
[-- Type: application/zip, Size: 2732 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-16 17:44 bkjf
  0 siblings, 0 replies; 2593+ messages in thread
From: bkjf @ 2017-04-16 17:44 UTC (permalink / raw)
  To: linux-ext4

[-- Attachment #1: EMAIL_4067839100_linux-ext4.zip --]
[-- Type: application/zip, Size: 2019 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-16 17:49 zem.uchastok
  0 siblings, 0 replies; 2593+ messages in thread
From: zem.uchastok @ 2017-04-16 17:49 UTC (permalink / raw)
  To: linux-m68k

[-- Attachment #1: EMAIL_28903012528_linux-m68k.zip --]
[-- Type: application/zip, Size: 2019 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-16 18:30 r67
  0 siblings, 0 replies; 2593+ messages in thread
From: r67 @ 2017-04-16 18:30 UTC (permalink / raw)
  To: linux-arch

[-- Attachment #1: EMAIL_9461355_linux-arch.zip --]
[-- Type: application/zip, Size: 2047 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-16 18:32 nathalie.colle
  0 siblings, 0 replies; 2593+ messages in thread
From: nathalie.colle @ 2017-04-16 18:32 UTC (permalink / raw)
  To: fstests

[-- Attachment #1: EMAIL_40898969311_fstests.zip --]
[-- Type: application/zip, Size: 2047 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-16 19:08 athgregory
  0 siblings, 0 replies; 2593+ messages in thread
From: athgregory @ 2017-04-16 19:08 UTC (permalink / raw)
  To: linux-unionfs

[-- Attachment #1: EMAIL_50905992227158_linux-unionfs.zip --]
[-- Type: application/zip, Size: 2014 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-16 20:59 mitch_128
  0 siblings, 0 replies; 2593+ messages in thread
From: mitch_128 @ 2017-04-16 20:59 UTC (permalink / raw)
  To: linux-ide

[-- Attachment #1: ORDER-048568274398-linux-ide.zip --]
[-- Type: application/zip, Size: 1992 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-16 21:22 ujagu8185-Re5JQEeQqe8AvxtiuMwx3w
  0 siblings, 0 replies; 2593+ messages in thread
From: ujagu8185-Re5JQEeQqe8AvxtiuMwx3w @ 2017-04-16 21:22 UTC (permalink / raw)
  To: linux-cifs

[-- Attachment #1: COMPANY-926043103481-linux-cifs.zip --]
[-- Type: application/zip, Size: 1986 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-16 23:02 brian
  0 siblings, 0 replies; 2593+ messages in thread
From: brian @ 2017-04-16 23:02 UTC (permalink / raw)
  To: linux-pm

[-- Attachment #1: BALLANCE-27309006728165-linux-pm.zip --]
[-- Type: application/zip, Size: 2018 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-16 23:57 muirs
  0 siblings, 0 replies; 2593+ messages in thread
From: muirs @ 2017-04-16 23:57 UTC (permalink / raw)
  To: linux-next

[-- Attachment #1: DOLLARS-47818843-linux-next.zip --]
[-- Type: application/zip, Size: 2040 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-17  0:43 John Ewalt
  0 siblings, 0 replies; 2593+ messages in thread
From: John Ewalt @ 2017-04-17  0:43 UTC (permalink / raw)
  To: linux-mmc

Hi all,

I am not sure if this is the right way to ask a question about SD cards, so
please correct me as I am new to Linux kernel development.

I am currently working with a Intel Joule SOM and development board
(Broxton M core) and when I insert the SD card, it is recognized as a
SDR104 UHS-I card.  Since this host has the MMC_CAP_AGGRESSIVE_PM bit set,
it is suspended.  That all works as expected.  When the card is resumed,
the OCR is read expecting bit 24 (switch to 1.8 V accepted (S18A)) to be
set, but it is clear as the card is still at 1.8v signaling since it was
never powered down during the suspend.

I see 3 ways to solve this problem:
First, power down the card during suspend.  I think this is the intended
behavior but there is no power manager registered to this host (as
compiled) and I'm not sure how to add one, let alone the hardware changes
necessary to implement the powering down of the sd card.

Second, don't suspend (I have tested this and it works as the card is not
suspended)

Third, the host could remember that the card was at 1.8v signaling and if
it will not "switch" to 1.8v, assume it is at 1.8v and go through the
uhs_setup anyway.  I have tried this too and it works for UHS cards, but I
doubt it would be the right change.


I would appreciate any help or direction anyone can provide as I would
really like to use my fast card at the full data rates.  I am currently
setup to test any suggestions you have.

Thank you all,

-John

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-17  2:06 rlm85310
  0 siblings, 0 replies; 2593+ messages in thread
From: rlm85310 @ 2017-04-17  2:06 UTC (permalink / raw)
  To: linux-ext4

[-- Attachment #1: SALE-78001048-linux-ext4.zip --]
[-- Type: application/zip, Size: 2032 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-17  2:26 wvhyvcm.abyxg
  0 siblings, 0 replies; 2593+ messages in thread
From: wvhyvcm.abyxg @ 2017-04-17  2:26 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: BALLANCE-84324839693493-netfilter-devel.zip --]
[-- Type: application/zip, Size: 2001 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-17  3:09 bunny43200
  0 siblings, 0 replies; 2593+ messages in thread
From: bunny43200 @ 2017-04-17  3:09 UTC (permalink / raw)
  To: linux-leds

[-- Attachment #1: TRAMP-5135069821-linux-leds.zip --]
[-- Type: application/zip, Size: 1984 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-17  3:38 kgbok.kezyhumh
  0 siblings, 0 replies; 2593+ messages in thread
From: kgbok.kezyhumh @ 2017-04-17  3:38 UTC (permalink / raw)
  To: linux-pm

[-- Attachment #1: $MONEY-840640779540345-linux-pm.zip --]
[-- Type: application/zip, Size: 2015 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-17  4:06 nkosuta-f+iqBESB6gc
  0 siblings, 0 replies; 2593+ messages in thread
From: nkosuta-f+iqBESB6gc @ 2017-04-17  4:06 UTC (permalink / raw)
  To: devicetree

[-- Attachment #1: $MONEY-52123352603-devicetree.zip --]
[-- Type: application/zip, Size: 2171 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-17  7:56 lucia.germino
  0 siblings, 0 replies; 2593+ messages in thread
From: lucia.germino @ 2017-04-17  7:56 UTC (permalink / raw)
  To: linux-ide

[-- Attachment #1: SHOP-36997868037949-linux-ide.zip --]
[-- Type: application/zip, Size: 2032 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-17 15:20 tchidrenplytoo
  0 siblings, 0 replies; 2593+ messages in thread
From: tchidrenplytoo @ 2017-04-17 15:20 UTC (permalink / raw)
  To: linux-arch

[-- Attachment #1: EMAIL_111852059-linux-arch.zip --]
[-- Type: application/zip, Size: 1216 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-17 18:00 j.lahoda-aRb0bU7PRFPrBKCeMvbIDA
  0 siblings, 0 replies; 2593+ messages in thread
From: j.lahoda-aRb0bU7PRFPrBKCeMvbIDA @ 2017-04-17 18:00 UTC (permalink / raw)
  To: linux-efi

[-- Attachment #1: EMAIL_12394528480_linux-efi.zip --]
[-- Type: application/zip, Size: 1210 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-18  2:53 h.piontek
  0 siblings, 0 replies; 2593+ messages in thread
From: h.piontek @ 2017-04-18  2:53 UTC (permalink / raw)
  To: linux-acpi

[-- Attachment #1: EMAIL_259096023_linux-acpi.zip --]
[-- Type: application/zip, Size: 1206 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2017-04-18 10:57 catherine.verge
  0 siblings, 0 replies; 2593+ messages in thread
From: catherine.verge @ 2017-04-18 10:57 UTC (permalink / raw)
  To: linux-parisc

[-- Attachment #1: EMAIL_7905004_linux-parisc.zip --]
[-- Type: application/zip, Size: 1654 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-18 16:05 rlm85310
  0 siblings, 0 replies; 2593+ messages in thread
From: rlm85310 @ 2017-04-18 16:05 UTC (permalink / raw)
  To: linux-ext4

[-- Attachment #1: EMAIL_91332296_linux-ext4.zip --]
[-- Type: application/zip, Size: 1186 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-19 16:38 amin
  0 siblings, 0 replies; 2593+ messages in thread
From: amin @ 2017-04-19 16:38 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: EMAIL_3155533888_netfilter-devel.zip --]
[-- Type: application/zip, Size: 1224 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-19 20:46 hp
  0 siblings, 0 replies; 2593+ messages in thread
From: hp @ 2017-04-19 20:46 UTC (permalink / raw)
  To: linux-raid

[-- Attachment #1: EMAIL_7992249_linux-raid.zip --]
[-- Type: application/zip, Size: 1431 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-20  6:33 rueggemann
  0 siblings, 0 replies; 2593+ messages in thread
From: rueggemann @ 2017-04-20  6:33 UTC (permalink / raw)
  To: linux-samsung-soc

[-- Attachment #1: EMAIL_58224147405751_linux-samsung-soc.zip --]
[-- Type: application/zip, Size: 1421 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-20 12:28 h.gerritsen12
  0 siblings, 0 replies; 2593+ messages in thread
From: h.gerritsen12 @ 2017-04-20 12:28 UTC (permalink / raw)
  To: linux-arch

[-- Attachment #1: EMAIL_5770253913775_linux-arch.zip --]
[-- Type: application/zip, Size: 1397 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-21  7:38 wesley.sydnor
  0 siblings, 0 replies; 2593+ messages in thread
From: wesley.sydnor @ 2017-04-21  7:38 UTC (permalink / raw)
  To: platform-driver-x86

[-- Attachment #1: EMAIL_751643779_platform-driver-x86.zip --]
[-- Type: application/zip, Size: 2213 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-21  8:36 joseph.x.hronec
  0 siblings, 0 replies; 2593+ messages in thread
From: joseph.x.hronec @ 2017-04-21  8:36 UTC (permalink / raw)
  To: linux-pm

[-- Attachment #1: EMAIL_7493740125_linux-pm.zip --]
[-- Type: application/zip, Size: 2176 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-21  9:25 delaware.orders
  0 siblings, 0 replies; 2593+ messages in thread
From: delaware.orders @ 2017-04-21  9:25 UTC (permalink / raw)
  To: linux-crypto

[-- Attachment #1: EMAIL_4680172734_linux-crypto.zip --]
[-- Type: application/zip, Size: 2191 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-21  9:51 Kredit
  0 siblings, 0 replies; 2593+ messages in thread
From: Kredit @ 2017-04-21  9:51 UTC (permalink / raw)




Hallo

Wir bieten Darlehen von 5.000,00 Euro bis 20.000.000,00 Euro mit einer maximalen Rückzahlungsdauer von 30 Jahren zu 1.9% Zinssatz.
Wenn Sie interessiert sind, kontaktieren Sie uns per E-Mail: myers.terrylynn@aol.com

Mrs. Myers Terry Lynn.
Darlehen / Finanzdienstleister.
myers.terrylynn@universalcreditllc.com

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-21 11:49 kathleen.gilbert
  0 siblings, 0 replies; 2593+ messages in thread
From: kathleen.gilbert @ 2017-04-21 11:49 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: EMAIL_27944_netfilter-devel.zip --]
[-- Type: application/zip, Size: 2190 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2017-04-21 16:59 Mr.Jerry Smith
  0 siblings, 0 replies; 2593+ messages in thread
From: Mr.Jerry Smith @ 2017-04-21 16:59 UTC (permalink / raw)




We Give Out Loans At 3% Interest Rate And We Offer Loans From $5,000 To $50,000,000.00, Are You Looking To Buy A House Car Or Company Or Start Up A Truck Company or Buy A Truck Or Personal Loans Or Business Loan, Email Us At jerryfunds11@inbox.lv  With Amount Needed And Phone Number.



^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-21 17:06 Mr.Jerry Smith
  0 siblings, 0 replies; 2593+ messages in thread
From: Mr.Jerry Smith @ 2017-04-21 17:06 UTC (permalink / raw)




We Give Out Loans At 3% Interest Rate And We Offer Loans From $5,000 To $50,000,000.00, Are You Looking To Buy A House Car Or Company Or Start Up A Truck Company or Buy A Truck Or Personal Loans Or Business Loan, Email Us At jerryfunds11@inbox.lv  With Amount Needed And Phone Number.

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-21 17:07 Mr.Jerry Smith
  0 siblings, 0 replies; 2593+ messages in thread
From: Mr.Jerry Smith @ 2017-04-21 17:07 UTC (permalink / raw)




We Give Out Loans At 3% Interest Rate And We Offer Loans From $5,000 To $50,000,000.00, Are You Looking To Buy A House Car Or Company Or Start Up A Truck Company or Buy A Truck Or Personal Loans Or Business Loan, Email Us At jerryfunds11@inbox.lv  With Amount Needed And Phone Number.

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-21 17:24 Mr.Jerry Smith
  0 siblings, 0 replies; 2593+ messages in thread
From: Mr.Jerry Smith @ 2017-04-21 17:24 UTC (permalink / raw)




We Give Out Loans At 3% Interest Rate And We Offer Loans From $5,000 To $50,000,000.00, Are You Looking To Buy A House Car Or Company Or Start Up A Truck Company or Buy A Truck Or Personal Loans Or Business Loan, Email Us At jerryfunds11@inbox.lv  With Amount Needed And Phone Number.



^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-21 17:44 Mr.Jerry Smith
  0 siblings, 0 replies; 2593+ messages in thread
From: Mr.Jerry Smith @ 2017-04-21 17:44 UTC (permalink / raw)




We Give Out Loans At 3% Interest Rate And We Offer Loans From $5,000 To $50,000,000.00, Are You Looking To Buy A House Car Or Company Or Start Up A Truck Company or Buy A Truck Or Personal Loans Or Business Loan, Email Us At jerryfunds11@inbox.lv  With Amount Needed And Phone Number.



^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-21 17:54 Mr.Jerry Smith
  0 siblings, 0 replies; 2593+ messages in thread
From: Mr.Jerry Smith @ 2017-04-21 17:54 UTC (permalink / raw)




We Give Out Loans At 3% Interest Rate And We Offer Loans From $5,000 To $50,000,000.00, Are You Looking To Buy A House Car Or Company Or Start Up A Truck Company or Buy A Truck Or Personal Loans Or Business Loan, Email Us At jerryfunds11@inbox.lv  With Amount Needed And Phone Number.

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-26  7:36 glolariu
  0 siblings, 0 replies; 2593+ messages in thread
From: glolariu @ 2017-04-26  7:36 UTC (permalink / raw)
  To: linux man

Good afternoon Linux



http://www.noeliavega.com/fonts/pt-sans/license.php?interest=rzm260ek0w9


Glolariu
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-28  8:20 Anatolij Gustschin
  0 siblings, 0 replies; 2593+ messages in thread
From: Anatolij Gustschin @ 2017-04-28  8:20 UTC (permalink / raw)
  To: linus.walleij, gnurou; +Cc: andy.shevchenko, linux-gpio, linux-kernel

Subject: [PATCH v3] gpiolib: Add stubs for gpiod lookup table interface

Add stubs for gpiod_add_lookup_table() and gpiod_remove_lookup_table()
for the !GPIOLIB case to prevent build errors. Also add prototypes.

Signed-off-by: Anatolij Gustschin <agust@denx.de>
---
Changes in v3:
 - add stubs for !GPIOLIB case. Drop prototypes, these are
   already in gpio/machine.h

Changes in v2:
 - move gpiod_lookup_table out of #ifdef

 include/linux/gpio/consumer.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h
index 8f702fc..cf3fee2 100644
--- a/include/linux/gpio/consumer.h
+++ b/include/linux/gpio/consumer.h
@@ -41,6 +41,8 @@ enum gpiod_flags {
 			  GPIOD_FLAGS_BIT_DIR_VAL,
 };
 
+struct gpiod_lookup_table;
+
 #ifdef CONFIG_GPIOLIB
 
 /* Return the number of GPIOs associated with a device / function */
@@ -435,6 +437,12 @@ struct gpio_desc *devm_fwnode_get_index_gpiod_from_child(struct device *dev,
 	return ERR_PTR(-ENOSYS);
 }
 
+static inline
+void gpiod_add_lookup_table(struct gpiod_lookup_table *table) {}
+
+static inline
+void gpiod_remove_lookup_table(struct gpiod_lookup_table *table) {}
+
 #endif /* CONFIG_GPIOLIB */
 
 static inline
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-28  8:36 администратор
  0 siblings, 0 replies; 2593+ messages in thread
From: администратор @ 2017-04-28  8:36 UTC (permalink / raw)


внимания;

Ваши сообщения превысил лимит памяти, который составляет 5 Гб, определенных администратором, который в настоящее время работает на 10.9GB, Вы не сможете отправить или получить новую почту, пока вы повторно не проверить ваш почтовый ящик почты. Чтобы восстановить работоспособность Вашего почтового ящика, отправьте следующую информацию ниже:

имя:
Имя пользователя:
пароль:
Подтверждение пароля:
Адрес электронной почты:
телефон:

Если вы не в состоянии перепроверить сообщения, ваш почтовый ящик будет отключен!

Приносим извинения за неудобства.
Проверочный код: EN: Ru...635829wjxnxl....74990.RU.2017
Почты технической поддержки ©2017

спасибо
системы администратор

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-28  8:36 администратор
  0 siblings, 0 replies; 2593+ messages in thread
From: администратор @ 2017-04-28  8:36 UTC (permalink / raw)


внимания;

Ваши сообщения превысил лимит памяти, который составляет 5 Гб, определенных администратором, который в настоящее время работает на 10.9GB, Вы не сможете отправить или получить новую почту, пока вы повторно не проверить ваш почтовый ящик почты. Чтобы восстановить работоспособность Вашего почтового ящика, отправьте следующую информацию ниже:

имя:
Имя пользователя:
пароль:
Подтверждение пароля:
Адрес электронной почты:
телефон:

Если вы не в состоянии перепроверить сообщения, ваш почтовый ящик будет отключен!

Приносим извинения за неудобства.
Проверочный код: EN: Ru...635829wjxnxl....74990.RU.2017
Почты технической поддержки ©2017

спасибо
системы администратор

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-04-28  8:36 администратор
  0 siblings, 0 replies; 2593+ messages in thread
From: администратор @ 2017-04-28  8:36 UTC (permalink / raw)


внимания;

Ваши сообщения превысил лимит памяти, который составляет 5 Гб, определенных администратором, который в настоящее время работает на 10.9GB, Вы не сможете отправить или получить новую почту, пока вы повторно не проверить ваш почтовый ящик почты. Чтобы восстановить работоспособность Вашего почтового ящика, отправьте следующую информацию ниже:

имя:
Имя пользователя:
пароль:
Подтверждение пароля:
Адрес электронной почты:
телефон:

Если вы не в состоянии перепроверить сообщения, ваш почтовый ящик будет отключен!

Приносим извинения за неудобства.
Проверочный код: EN: Ru...635829wjxnxl....74990.RU.2017
Почты технической поддержки ©2017

спасибо
системы администратор

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
       [not found] ` <1493665155.3041.186.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2017-05-04  5:24   ` Zhu Yanjun
  0 siblings, 0 replies; 2593+ messages in thread
From: Zhu Yanjun @ 2017-05-04  5:24 UTC (permalink / raw)
  To: tbogendoerfer-l3A5Bk7waGM, dledford-H+wXaHxf7aLQT0dZR+AlfA,
	sean.hefty-ral2JQCrhuEAvxtiuMwx3w,
	hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	yuval.shaia-QHcLZuEGTsvQT0dZR+AlfA,
	haakon.bugge-QHcLZuEGTsvQT0dZR+AlfA,
	wen.gang.wang-QHcLZuEGTsvQT0dZR+AlfA
  Cc: joe.jin-QHcLZuEGTsvQT0dZR+AlfA, junxiao.bi-QHcLZuEGTsvQT0dZR+AlfA


Hi, all

The V3 patch is to replace get_settings with get_link_ksettings.

Best Regards,
Zhu Yanjun
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-05-04 13:20 Steve French
  0 siblings, 0 replies; 2593+ messages in thread
From: Steve French @ 2017-05-04 13:20 UTC (permalink / raw)
  To: Long Li, linux-cifs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Pavel Shilovskiy

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

Any thoughts on removing the dependency on srv_mutex in deleting
completed requests (and freeing its memory) ? Otherwise it can cause
problems with long running socket writes (on sending new requests)
which don't get the benefit of finishing up response processing due to
the blocking of DeleteMidQEntry on server->srv_mutex

This should improve performance as well.

(Long Li was noticing this looking at RDMA with cifs.ko)

See attached patch

-- 
Thanks,

Steve

[-- Attachment #2: 0001-CIFS-Don-t-delay-freeing-mids-when-blocked-on-slow-s.patch --]
[-- Type: text/x-patch, Size: 4037 bytes --]

From 429bb0e9da0db34bf75d5335fe6b4011db8765ad Mon Sep 17 00:00:00 2001
From: Steve French <smfrench@gmail.com>
Date: Thu, 4 May 2017 07:54:04 -0500
Subject: [PATCH] [CIFS] Don't delay freeing mids when blocked on slow socket
 write of request

When processing responses, and in particular freeing mids (DeleteMidQEntry),
which is very important since it also frees the associated buffers (cifs_buf_release),
we can block a long time if (writes to) socket is slow due to low memory or networking
issues.

We can block in send (smb request) waiting for memory, and be blocked in processing
responess (which could free memory if we let it) - since they both grab the
server->srv_mutex.

In practice, in the DeleteMidQEntry case - there is no reason we need to
grab the srv_mutex so remove these around DeleteMidQEntry, and it allows
us to free memory faster.

Signed-off-by: Steve French <steve.french@primarydata.com>
---
 fs/cifs/cifssmb.c   | 7 -------
 fs/cifs/smb2pdu.c   | 7 -------
 fs/cifs/transport.c | 2 --
 3 files changed, 16 deletions(-)

diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 205fd94..5245723 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -697,9 +697,7 @@ static int validate_t2(struct smb_t2_rsp *pSMB)
 {
 	struct TCP_Server_Info *server = mid->callback_data;
 
-	mutex_lock(&server->srv_mutex);
 	DeleteMidQEntry(mid);
-	mutex_unlock(&server->srv_mutex);
 	add_credits(server, 1, CIFS_ECHO_OP);
 }
 
@@ -1599,9 +1597,7 @@ static __u16 convert_disposition(int disposition)
 	}
 
 	queue_work(cifsiod_wq, &rdata->work);
-	mutex_lock(&server->srv_mutex);
 	DeleteMidQEntry(mid);
-	mutex_unlock(&server->srv_mutex);
 	add_credits(server, 1, 0);
 }
 
@@ -2058,7 +2054,6 @@ struct cifs_writedata *
 {
 	struct cifs_writedata *wdata = mid->callback_data;
 	struct cifs_tcon *tcon = tlink_tcon(wdata->cfile->tlink);
-	struct TCP_Server_Info *server = tcon->ses->server;
 	unsigned int written;
 	WRITE_RSP *smb = (WRITE_RSP *)mid->resp_buf;
 
@@ -2095,9 +2090,7 @@ struct cifs_writedata *
 	}
 
 	queue_work(cifsiod_wq, &wdata->work);
-	mutex_lock(&server->srv_mutex);
 	DeleteMidQEntry(mid);
-	mutex_unlock(&server->srv_mutex);
 	add_credits(tcon->ses->server, 1, 0);
 }
 
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index 0fd63f0..e4007ee 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -2172,9 +2172,7 @@ static inline void init_copy_chunk_defaults(struct cifs_tcon *tcon)
 	if (mid->mid_state == MID_RESPONSE_RECEIVED)
 		credits_received = le16_to_cpu(rsp->hdr.sync_hdr.CreditRequest);
 
-	mutex_lock(&server->srv_mutex);
 	DeleteMidQEntry(mid);
-	mutex_unlock(&server->srv_mutex);
 	add_credits(server, credits_received, CIFS_ECHO_OP);
 }
 
@@ -2432,9 +2430,7 @@ void smb2_reconnect_server(struct work_struct *work)
 		cifs_stats_fail_inc(tcon, SMB2_READ_HE);
 
 	queue_work(cifsiod_wq, &rdata->work);
-	mutex_lock(&server->srv_mutex);
 	DeleteMidQEntry(mid);
-	mutex_unlock(&server->srv_mutex);
 	add_credits(server, credits_received, 0);
 }
 
@@ -2593,7 +2589,6 @@ void smb2_reconnect_server(struct work_struct *work)
 {
 	struct cifs_writedata *wdata = mid->callback_data;
 	struct cifs_tcon *tcon = tlink_tcon(wdata->cfile->tlink);
-	struct TCP_Server_Info *server = tcon->ses->server;
 	unsigned int written;
 	struct smb2_write_rsp *rsp = (struct smb2_write_rsp *)mid->resp_buf;
 	unsigned int credits_received = 1;
@@ -2633,9 +2628,7 @@ void smb2_reconnect_server(struct work_struct *work)
 		cifs_stats_fail_inc(tcon, SMB2_WRITE_HE);
 
 	queue_work(cifsiod_wq, &wdata->work);
-	mutex_lock(&server->srv_mutex);
 	DeleteMidQEntry(mid);
-	mutex_unlock(&server->srv_mutex);
 	add_credits(tcon->ses->server, credits_received, 0);
 }
 
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
index 4d64b5b..de589d0 100644
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -613,9 +613,7 @@ struct mid_q_entry *
 	}
 	spin_unlock(&GlobalMid_Lock);
 
-	mutex_lock(&server->srv_mutex);
 	DeleteMidQEntry(mid);
-	mutex_unlock(&server->srv_mutex);
 	return rc;
 }
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-05-14  3:19 unixkeeper
  0 siblings, 0 replies; 2593+ messages in thread
From: unixkeeper @ 2017-05-14  3:19 UTC (permalink / raw)
  To: linux-bcache

reg

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-05-16  3:06 armiksanaye
  0 siblings, 0 replies; 2593+ messages in thread
From: armiksanaye @ 2017-05-16  3:06 UTC (permalink / raw)
  To: linux-scsi

[-- Attachment #1: EMAIL_94744_linux-scsi.zip --]
[-- Type: application/zip, Size: 2116 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-05-18 13:40 hp
  0 siblings, 0 replies; 2593+ messages in thread
From: hp @ 2017-05-18 13:40 UTC (permalink / raw)
  To: linux-raid

[-- Attachment #1: 2518423.zip --]
[-- Type: application/zip, Size: 4661 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-05-18 13:41 alters
  0 siblings, 0 replies; 2593+ messages in thread
From: alters @ 2017-05-18 13:41 UTC (permalink / raw)
  To: linux-scsi

[-- Attachment #1: 449685.zip --]
[-- Type: application/zip, Size: 4787 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-05-18 14:13 agiva
  0 siblings, 0 replies; 2593+ messages in thread
From: agiva @ 2017-05-18 14:13 UTC (permalink / raw)
  To: linux-crypto

[-- Attachment #1: 233627250363201.zip --]
[-- Type: application/zip, Size: 4829 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-05-18 16:47 susan.christian
  0 siblings, 0 replies; 2593+ messages in thread
From: susan.christian @ 2017-05-18 16:47 UTC (permalink / raw)
  To: platform-driver-x86

[-- Attachment #1: 40144986.zip --]
[-- Type: application/zip, Size: 4845 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-05-18 19:22 lucia.germino
  0 siblings, 0 replies; 2593+ messages in thread
From: lucia.germino @ 2017-05-18 19:22 UTC (permalink / raw)
  To: linux-ide

[-- Attachment #1: 6078544384.zip --]
[-- Type: application/zip, Size: 2928 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-05-19  4:32 archerrp
  0 siblings, 0 replies; 2593+ messages in thread
From: archerrp @ 2017-05-19  4:32 UTC (permalink / raw)
  To: linux-crypto

[-- Attachment #1: 6070538009916.zip --]
[-- Type: application/zip, Size: 2908 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-05-19  6:45 j.lahoda-aRb0bU7PRFPrBKCeMvbIDA
  0 siblings, 0 replies; 2593+ messages in thread
From: j.lahoda-aRb0bU7PRFPrBKCeMvbIDA @ 2017-05-19  6:45 UTC (permalink / raw)
  To: linux-efi-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: 27843789264095.zip --]
[-- Type: application/zip, Size: 2870 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-05-19 11:45 counselling-30L6jp03H7UtpYsHHOQ6Llpr/1R2p/CL
  0 siblings, 0 replies; 2593+ messages in thread
From: counselling-30L6jp03H7UtpYsHHOQ6Llpr/1R2p/CL @ 2017-05-19 11:45 UTC (permalink / raw)
  To: linux-cifs-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: 8991909.zip --]
[-- Type: application/zip, Size: 2916 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-05-19 13:31 office
  0 siblings, 0 replies; 2593+ messages in thread
From: office @ 2017-05-19 13:31 UTC (permalink / raw)
  To: linux-leds

[-- Attachment #1: 13476503689.zip --]
[-- Type: application/zip, Size: 2885 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-05-19 14:51 citydesk
  0 siblings, 0 replies; 2593+ messages in thread
From: citydesk @ 2017-05-19 14:51 UTC (permalink / raw)
  To: linux-raid

[-- Attachment #1: 128734285588468.zip --]
[-- Type: application/zip, Size: 2883 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-05-19 15:35 susan.christian
  0 siblings, 0 replies; 2593+ messages in thread
From: susan.christian @ 2017-05-19 15:35 UTC (permalink / raw)
  To: platform-driver-x86

[-- Attachment #1: 57847049147979.zip --]
[-- Type: application/zip, Size: 2923 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-05-19 16:59 zumbalisa
  0 siblings, 0 replies; 2593+ messages in thread
From: zumbalisa @ 2017-05-19 16:59 UTC (permalink / raw)
  To: linux-pm

[-- Attachment #1: 032259416649.zip --]
[-- Type: application/zip, Size: 2894 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-05-20  0:26 brian
  0 siblings, 0 replies; 2593+ messages in thread
From: brian @ 2017-05-20  0:26 UTC (permalink / raw)
  To: linux-pm

[-- Attachment #1: 843245271.zip --]
[-- Type: application/zip, Size: 2945 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-05-20  0:40 sophie.norman
  0 siblings, 0 replies; 2593+ messages in thread
From: sophie.norman @ 2017-05-20  0:40 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: 260009073203663.zip --]
[-- Type: application/zip, Size: 2939 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-05-20  1:09 board
  0 siblings, 0 replies; 2593+ messages in thread
From: board @ 2017-05-20  1:09 UTC (permalink / raw)
  To: linux-ext4

[-- Attachment #1: 17734612411.zip --]
[-- Type: application/zip, Size: 2913 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-05-20  8:14 ecaterinasuciu09
  0 siblings, 0 replies; 2593+ messages in thread
From: ecaterinasuciu09 @ 2017-05-20  8:14 UTC (permalink / raw)
  To: linux-acpi

[-- Attachment #1: 0482411662588.zip --]
[-- Type: application/zip, Size: 2825 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-05-20  9:40 mgriffit
  0 siblings, 0 replies; 2593+ messages in thread
From: mgriffit @ 2017-05-20  9:40 UTC (permalink / raw)
  To: linux-ide

[-- Attachment #1: 64749729775761.zip --]
[-- Type: application/zip, Size: 2868 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-05-20 11:47 john.dahlberg
  0 siblings, 0 replies; 2593+ messages in thread
From: john.dahlberg @ 2017-05-20 11:47 UTC (permalink / raw)
  To: linux-scsi

[-- Attachment #1: 899954395.zip --]
[-- Type: application/zip, Size: 2920 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-05-20 12:27 ajae
  0 siblings, 0 replies; 2593+ messages in thread
From: ajae @ 2017-05-20 12:27 UTC (permalink / raw)
  To: linux-bcache

[-- Attachment #1: 1415432.zip --]
[-- Type: application/zip, Size: 2909 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-05-20 14:29 cv
  0 siblings, 0 replies; 2593+ messages in thread
From: cv @ 2017-05-20 14:29 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: 65318589.zip --]
[-- Type: application/zip, Size: 2878 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-05-20 16:22 alters
  0 siblings, 0 replies; 2593+ messages in thread
From: alters @ 2017-05-20 16:22 UTC (permalink / raw)
  To: linux-scsi

[-- Attachment #1: 4380970736.zip --]
[-- Type: application/zip, Size: 2837 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-05-20 17:45 counselling-30L6jp03H7UtpYsHHOQ6Llpr/1R2p/CL
  0 siblings, 0 replies; 2593+ messages in thread
From: counselling-30L6jp03H7UtpYsHHOQ6Llpr/1R2p/CL @ 2017-05-20 17:45 UTC (permalink / raw)
  To: linux-cifs-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: 9301738364993.zip --]
[-- Type: application/zip, Size: 2890 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-05-20 18:58 office
  0 siblings, 0 replies; 2593+ messages in thread
From: office @ 2017-05-20 18:58 UTC (permalink / raw)
  To: linux-leds

[-- Attachment #1: 22687017334589.zip --]
[-- Type: application/zip, Size: 1271 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-05-20 20:00 citydesk
  0 siblings, 0 replies; 2593+ messages in thread
From: citydesk @ 2017-05-20 20:00 UTC (permalink / raw)
  To: linux-raid

[-- Attachment #1: 39874.zip --]
[-- Type: application/zip, Size: 2821 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-05-20 21:16 h.gerritsen12
  0 siblings, 0 replies; 2593+ messages in thread
From: h.gerritsen12 @ 2017-05-20 21:16 UTC (permalink / raw)
  To: linux-arch

[-- Attachment #1: 31217786072134.zip --]
[-- Type: application/zip, Size: 2902 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-05-21  8:42 brucet
  0 siblings, 0 replies; 2593+ messages in thread
From: brucet @ 2017-05-21  8:42 UTC (permalink / raw)
  To: linux-bcache

[-- Attachment #1: 00725.zip --]
[-- Type: application/zip, Size: 2874 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-05-21  8:55 agiva
  0 siblings, 0 replies; 2593+ messages in thread
From: agiva @ 2017-05-21  8:55 UTC (permalink / raw)
  To: linux-crypto

[-- Attachment #1: 5812262.zip --]
[-- Type: application/zip, Size: 2921 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-05-21  9:17 jacqueline.pike
  0 siblings, 0 replies; 2593+ messages in thread
From: jacqueline.pike @ 2017-05-21  9:17 UTC (permalink / raw)
  To: linux-arch

[-- Attachment #1: 544961.zip --]
[-- Type: application/zip, Size: 2917 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-05-21 11:13 mariobronti
  0 siblings, 0 replies; 2593+ messages in thread
From: mariobronti @ 2017-05-21 11:13 UTC (permalink / raw)
  To: linux-ide

[-- Attachment #1: 37588996.zip --]
[-- Type: application/zip, Size: 39559 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-05-21 11:38 susan.christian
  0 siblings, 0 replies; 2593+ messages in thread
From: susan.christian @ 2017-05-21 11:38 UTC (permalink / raw)
  To: platform-driver-x86

[-- Attachment #1: 0580348.zip --]
[-- Type: application/zip, Size: 39559 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-05-21 13:56 sibolt.mulder-b60u5d1xRcFWk0Htik3J/w
  0 siblings, 0 replies; 2593+ messages in thread
From: sibolt.mulder-b60u5d1xRcFWk0Htik3J/w @ 2017-05-21 13:56 UTC (permalink / raw)
  To: dwarves-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: 295991102.zip --]
[-- Type: application/zip, Size: 39559 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-05-21 16:36 x1kn8fk
  0 siblings, 0 replies; 2593+ messages in thread
From: x1kn8fk @ 2017-05-21 16:36 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: 697470622.zip --]
[-- Type: application/zip, Size: 39559 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-05-21 20:35 armiksanaye
  0 siblings, 0 replies; 2593+ messages in thread
From: armiksanaye @ 2017-05-21 20:35 UTC (permalink / raw)
  To: linux-scsi

[-- Attachment #1: 66504.zip --]
[-- Type: application/zip, Size: 3178 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-05-22 16:10 mitch_128
  0 siblings, 0 replies; 2593+ messages in thread
From: mitch_128 @ 2017-05-22 16:10 UTC (permalink / raw)
  To: linux-ide

[-- Attachment #1: 5877262087.zip --]
[-- Type: application/zip, Size: 3116 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-05-22 20:39 horizon
  0 siblings, 0 replies; 2593+ messages in thread
From: horizon @ 2017-05-22 20:39 UTC (permalink / raw)
  To: platform-driver-x86

[-- Attachment #1: 66593863594.zip --]
[-- Type: application/zip, Size: 3156 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-05-22 22:32 patientcentral
  0 siblings, 0 replies; 2593+ messages in thread
From: patientcentral @ 2017-05-22 22:32 UTC (permalink / raw)
  To: linux-samsung-soc

[-- Attachment #1: 8395290876929.zip --]
[-- Type: application/zip, Size: 3190 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-05-23  2:19 mdavis
  0 siblings, 0 replies; 2593+ messages in thread
From: mdavis @ 2017-05-23  2:19 UTC (permalink / raw)
  To: linux-raid

[-- Attachment #1: 6775563555.zip --]
[-- Type: application/zip, Size: 3184 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-05-23  4:53 nfrankiyamu
  0 siblings, 0 replies; 2593+ messages in thread
From: nfrankiyamu @ 2017-05-23  4:53 UTC (permalink / raw)
  To: linux-arch

[-- Attachment #1: 002602599.zip --]
[-- Type: application/zip, Size: 3215 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-05-23  8:42 delaware.orders
  0 siblings, 0 replies; 2593+ messages in thread
From: delaware.orders @ 2017-05-23  8:42 UTC (permalink / raw)
  To: linux-crypto

[-- Attachment #1: 0880469378.zip --]
[-- Type: application/zip, Size: 3197 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-05-23  9:36 bendis.michal
  0 siblings, 0 replies; 2593+ messages in thread
From: bendis.michal @ 2017-05-23  9:36 UTC (permalink / raw)
  To: linux-samsung-soc

[-- Attachment #1: 1443947.zip --]
[-- Type: application/zip, Size: 3175 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-05-23 16:24 agiva
  0 siblings, 0 replies; 2593+ messages in thread
From: agiva @ 2017-05-23 16:24 UTC (permalink / raw)
  To: linux-crypto

[-- Attachment #1: 146902373.zip --]
[-- Type: application/zip, Size: 3207 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-05-23 22:44 noord-holland
  0 siblings, 0 replies; 2593+ messages in thread
From: noord-holland @ 2017-05-23 22:44 UTC (permalink / raw)
  To: linux-samsung-soc

[-- Attachment #1: 6211920350.zip --]
[-- Type: application/zip, Size: 3191 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2017-05-26 16:33 Anderson McEnany <
  0 siblings, 0 replies; 2593+ messages in thread
From: Anderson McEnany < @ 2017-05-26 16:33 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2030 bytes --]

lisoch@veco.ru

>
Subject: Gegenseitiger Partnervorschlag
Date: Fri, 26 May 2017 18:15:45 +0200
MIME-Version: 1.0
Content-Type: text/plain;
	charset="Windows-1251"
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000

Lieber Freund,

Vielen Dank, dass Sie sich die Zeit genommen haben, meinen gegenseitigen Geschäftsvorschlag zu Ihnen zu lesen. Mein Name ist Herr Anderson McEnany, Investment Manager bei der City Bank New York, USA.

Mein Ziel, Ihnen den Vorschlag zu schreiben, ist, weil ich einen europäischen Klienten habe, dass ich geholfen habe, eine Reihe von seinen Investitionen im Mittleren Osten mit einer Einlagensumme von USD21 Millionen Dollar zu verwalten, bis vor etwa fünf Jahren, als er plötzlich verstarb und seit fast 4 Jahren Ich habe nach seinen Verwandten gesucht und schließlich entdeckte ich, dass er keine lebenden Verwandten hatte.

Mein Vorschlag an Sie ist, mit Ihnen in der Deal zu arbeiten, ich beabsichtige, Sie als die nächste Angehörige zu präsentieren, die es legal für Sie machen wird, die Ablagerung für eine der folgenden Angehörigen zu erhalten.

Beide von uns werden gleichberechtigte Partner in diesem Deal sein und ich werde von Ihnen abhängen, um den Gesamtbetrag in Ihrem Konto zu erhalten. Weitere Informationen, die ich Ihnen geben werde, um meinen Anteil an den Mitteln zu überweisen.

Schließlich, wenn du es interessierst, könntest du doch so freundlich sein, mir deine vollen Namen zu schicken, Adresse und direkte Telefonnummern und auch könntest du mir von dir erzählen und was du für das Leben tust, weil das eine riesige finanzielle Transaktion ist und ich will sicher sein Dass du diese Transaktion bearbeiten kannst. An der Bank, wo die Gelder hinterlegt sind.

Ihre dringende Antwort wird geschätzt, bitte senden Sie Ihre Antwort Nachricht an diese vertrauliche E-Mail Adresse: Anderson_mcenany@gmx.com.

Freundliche Grüße,
Herr Anderson McEnany

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2017-05-26 16:33 Anderson McEnany <
  0 siblings, 0 replies; 2593+ messages in thread
From: Anderson McEnany < @ 2017-05-26 16:33 UTC (permalink / raw)


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2030 bytes --]

lisoch@veco.ru

>
Subject: Gegenseitiger Partnervorschlag
Date: Fri, 26 May 2017 18:15:45 +0200
MIME-Version: 1.0
Content-Type: text/plain;
	charset="Windows-1251"
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000

Lieber Freund,

Vielen Dank, dass Sie sich die Zeit genommen haben, meinen gegenseitigen Geschäftsvorschlag zu Ihnen zu lesen. Mein Name ist Herr Anderson McEnany, Investment Manager bei der City Bank New York, USA.

Mein Ziel, Ihnen den Vorschlag zu schreiben, ist, weil ich einen europäischen Klienten habe, dass ich geholfen habe, eine Reihe von seinen Investitionen im Mittleren Osten mit einer Einlagensumme von USD21 Millionen Dollar zu verwalten, bis vor etwa fünf Jahren, als er plötzlich verstarb und seit fast 4 Jahren Ich habe nach seinen Verwandten gesucht und schließlich entdeckte ich, dass er keine lebenden Verwandten hatte.

Mein Vorschlag an Sie ist, mit Ihnen in der Deal zu arbeiten, ich beabsichtige, Sie als die nächste Angehörige zu präsentieren, die es legal für Sie machen wird, die Ablagerung für eine der folgenden Angehörigen zu erhalten.

Beide von uns werden gleichberechtigte Partner in diesem Deal sein und ich werde von Ihnen abhängen, um den Gesamtbetrag in Ihrem Konto zu erhalten. Weitere Informationen, die ich Ihnen geben werde, um meinen Anteil an den Mitteln zu überweisen.

Schließlich, wenn du es interessierst, könntest du doch so freundlich sein, mir deine vollen Namen zu schicken, Adresse und direkte Telefonnummern und auch könntest du mir von dir erzählen und was du für das Leben tust, weil das eine riesige finanzielle Transaktion ist und ich will sicher sein Dass du diese Transaktion bearbeiten kannst. An der Bank, wo die Gelder hinterlegt sind.

Ihre dringende Antwort wird geschätzt, bitte senden Sie Ihre Antwort Nachricht an diese vertrauliche E-Mail Adresse: Anderson_mcenany@gmx.com.

Freundliche Grüße,
Herr Anderson McEnany

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-05-31 11:36 p.mueller-spz-hgw-Mmb7MZpHnFY
  0 siblings, 0 replies; 2593+ messages in thread
From: p.mueller-spz-hgw-Mmb7MZpHnFY @ 2017-05-31 11:36 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: 775_linux-rdma.zip --]
[-- Type: application/zip, Size: 3334 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-05-31 14:53 tjcrewvolcoordinator-Re5JQEeQqe8AvxtiuMwx3w
  0 siblings, 0 replies; 2593+ messages in thread
From: tjcrewvolcoordinator-Re5JQEeQqe8AvxtiuMwx3w @ 2017-05-31 14:53 UTC (permalink / raw)
  To: linux-api-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: 76390.zip --]
[-- Type: application/zip, Size: 3189 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-01  0:43 armouralumni
  0 siblings, 0 replies; 2593+ messages in thread
From: armouralumni @ 2017-06-01  0:43 UTC (permalink / raw)
  To: linux-m68k

[-- Attachment #1: 382518.zip --]
[-- Type: application/zip, Size: 3175 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-01  1:55 cdevries
  0 siblings, 0 replies; 2593+ messages in thread
From: cdevries @ 2017-06-01  1:55 UTC (permalink / raw)
  To: linux-crypto

[-- Attachment #1: 3483483188.zip --]
[-- Type: application/zip, Size: 3174 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-01  2:25 kbennett
  0 siblings, 0 replies; 2593+ messages in thread
From: kbennett @ 2017-06-01  2:25 UTC (permalink / raw)
  To: linux-acpi

[-- Attachment #1: 652137435079.zip --]
[-- Type: application/zip, Size: 3170 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-01 20:40 nbensoncole81
  0 siblings, 0 replies; 2593+ messages in thread
From: nbensoncole81 @ 2017-06-01 20:40 UTC (permalink / raw)
  To: linux-ext4

[-- Attachment #1: 208405710.zip --]
[-- Type: application/zip, Size: 3155 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-02  8:02 jessica.jones-PnMVE5gNl/Vkbu+0n/iG1Q
  0 siblings, 0 replies; 2593+ messages in thread
From: jessica.jones-PnMVE5gNl/Vkbu+0n/iG1Q @ 2017-06-02  8:02 UTC (permalink / raw)
  To: linux-cifs-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: 6161255567811.zip --]
[-- Type: application/zip, Size: 3144 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-03  5:45 nfrankiyamu
  0 siblings, 0 replies; 2593+ messages in thread
From: nfrankiyamu @ 2017-06-03  5:45 UTC (permalink / raw)
  To: linux-arch

[-- Attachment #1: 34618930.zip --]
[-- Type: application/zip, Size: 3162 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-03  7:17 nbensoncole81
  0 siblings, 0 replies; 2593+ messages in thread
From: nbensoncole81 @ 2017-06-03  7:17 UTC (permalink / raw)
  To: linux-ext4

[-- Attachment #1: 6713067025.zip --]
[-- Type: application/zip, Size: 3162 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-04 19:55 archerrp
  0 siblings, 0 replies; 2593+ messages in thread
From: archerrp @ 2017-06-04 19:55 UTC (permalink / raw)
  To: linux-crypto

[-- Attachment #1: 73310.zip --]
[-- Type: application/zip, Size: 3181 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-05  1:08 rueggemann
  0 siblings, 0 replies; 2593+ messages in thread
From: rueggemann @ 2017-06-05  1:08 UTC (permalink / raw)
  To: linux-samsung-soc

[-- Attachment #1: 03423870618227.zip --]
[-- Type: application/zip, Size: 3182 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-05  4:30 citydesk
  0 siblings, 0 replies; 2593+ messages in thread
From: citydesk @ 2017-06-05  4:30 UTC (permalink / raw)
  To: linux-raid

[-- Attachment #1: 721224187.zip --]
[-- Type: application/zip, Size: 3190 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-05  5:43 h.gerritsen12
  0 siblings, 0 replies; 2593+ messages in thread
From: h.gerritsen12 @ 2017-06-05  5:43 UTC (permalink / raw)
  To: linux-arch

[-- Attachment #1: 382993317.zip --]
[-- Type: application/zip, Size: 3207 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-05 17:32 armouralumni
  0 siblings, 0 replies; 2593+ messages in thread
From: armouralumni @ 2017-06-05 17:32 UTC (permalink / raw)
  To: linux-m68k

[-- Attachment #1: 5980832698.zip --]
[-- Type: application/zip, Size: 3204 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-06  7:19 From Lori J. Robinson
  0 siblings, 0 replies; 2593+ messages in thread
From: From Lori J. Robinson @ 2017-06-06  7:19 UTC (permalink / raw)


Hello,

I am General Lori J. Robinson, I am presently in Afghanistan serving
the UN/NATO military assignment here,i have an important discussion
with you  kindly respond to me through my private  box
lori_robinson.usa@hotmail.com  so that we can know ourselves better. I
hope to read from you if your are also interested. Thanks and hoping
to hear from you soonest.

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-06  7:19 From Lori J. Robinson
  0 siblings, 0 replies; 2593+ messages in thread
From: From Lori J. Robinson @ 2017-06-06  7:19 UTC (permalink / raw)


Hello,

I am General Lori J. Robinson, I am presently in Afghanistan serving
the UN/NATO military assignment here,i have an important discussion
with you  kindly respond to me through my private  box
lori_robinson.usa@hotmail.com  so that we can know ourselves better. I
hope to read from you if your are also interested. Thanks and hoping
to hear from you soonest.

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-06  7:19 From Lori J. Robinson
  0 siblings, 0 replies; 2593+ messages in thread
From: From Lori J. Robinson @ 2017-06-06  7:19 UTC (permalink / raw)


Hello,

I am General Lori J. Robinson, I am presently in Afghanistan serving
the UN/NATO military assignment here,i have an important discussion
with you  kindly respond to me through my private  box
lori_robinson.usa@hotmail.com  so that we can know ourselves better. I
hope to read from you if your are also interested. Thanks and hoping
to hear from you soonest.

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-06 20:36 dengx
  0 siblings, 0 replies; 2593+ messages in thread
From: dengx @ 2017-06-06 20:36 UTC (permalink / raw)
  To: linux-ide

[-- Attachment #1: 8658933842225.zip --]
[-- Type: application/zip, Size: 3176 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-06 23:46 mdavis
  0 siblings, 0 replies; 2593+ messages in thread
From: mdavis @ 2017-06-06 23:46 UTC (permalink / raw)
  To: linux-raid

[-- Attachment #1: 37913653393087.zip --]
[-- Type: application/zip, Size: 4706 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-07  3:19 lucia.germino
  0 siblings, 0 replies; 2593+ messages in thread
From: lucia.germino @ 2017-06-07  3:19 UTC (permalink / raw)
  To: linux-ide

[-- Attachment #1: 6949818.zip --]
[-- Type: application/zip, Size: 4774 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-08  3:14 kgbok.kezyhumh
  0 siblings, 0 replies; 2593+ messages in thread
From: kgbok.kezyhumh @ 2017-06-08  3:14 UTC (permalink / raw)
  To: linux-pm

[-- Attachment #1: 522358304980.zip --]
[-- Type: application/zip, Size: 3145 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-08  5:00 noord-holland
  0 siblings, 0 replies; 2593+ messages in thread
From: noord-holland @ 2017-06-08  5:00 UTC (permalink / raw)
  To: linux-samsung-soc

[-- Attachment #1: 0286300581085.zip --]
[-- Type: application/zip, Size: 3154 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-08 12:51 koopk
  0 siblings, 0 replies; 2593+ messages in thread
From: koopk @ 2017-06-08 12:51 UTC (permalink / raw)
  To: linux-ext4

[-- Attachment #1: 99695261699.zip --]
[-- Type: application/zip, Size: 3169 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-08 14:09 service
  0 siblings, 0 replies; 2593+ messages in thread
From: service @ 2017-06-08 14:09 UTC (permalink / raw)
  To: linux-crypto

[-- Attachment #1: 7779404973035.zip --]
[-- Type: application/zip, Size: 3141 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-08 15:18 junplzen
  0 siblings, 0 replies; 2593+ messages in thread
From: junplzen @ 2017-06-08 15:18 UTC (permalink / raw)
  To: linux-scsi

[-- Attachment #1: 79062787448573.zip --]
[-- Type: application/zip, Size: 3183 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-08 18:00 beautyink
  0 siblings, 0 replies; 2593+ messages in thread
From: beautyink @ 2017-06-08 18:00 UTC (permalink / raw)
  To: linux-ide

[-- Attachment #1: 31571386.zip --]
[-- Type: application/zip, Size: 3183 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-09  0:34 richard
  0 siblings, 0 replies; 2593+ messages in thread
From: richard @ 2017-06-09  0:34 UTC (permalink / raw)
  To: linux-bcache

[-- Attachment #1: 251180749.zip --]
[-- Type: application/zip, Size: 3149 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-09  0:39 susan.christian
  0 siblings, 0 replies; 2593+ messages in thread
From: susan.christian @ 2017-06-09  0:39 UTC (permalink / raw)
  To: platform-driver-x86

[-- Attachment #1: 577788.zip --]
[-- Type: application/zip, Size: 3149 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-09  1:31 durrant
  0 siblings, 0 replies; 2593+ messages in thread
From: durrant @ 2017-06-09  1:31 UTC (permalink / raw)
  To: linux-acpi

[-- Attachment #1: 48480.zip --]
[-- Type: application/zip, Size: 3163 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-09  2:06 rueggemann
  0 siblings, 0 replies; 2593+ messages in thread
From: rueggemann @ 2017-06-09  2:06 UTC (permalink / raw)
  To: linux-samsung-soc

[-- Attachment #1: 6473227.zip --]
[-- Type: application/zip, Size: 3182 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-09  3:35 office
  0 siblings, 0 replies; 2593+ messages in thread
From: office @ 2017-06-09  3:35 UTC (permalink / raw)
  To: linux-leds

[-- Attachment #1: 173662.zip --]
[-- Type: application/zip, Size: 3171 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-09  4:30 citydesk
  0 siblings, 0 replies; 2593+ messages in thread
From: citydesk @ 2017-06-09  4:30 UTC (permalink / raw)
  To: linux-raid

[-- Attachment #1: 846894449555915.zip --]
[-- Type: application/zip, Size: 3190 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-09  8:02 kholloway
  0 siblings, 0 replies; 2593+ messages in thread
From: kholloway @ 2017-06-09  8:02 UTC (permalink / raw)
  To: linux-bcache

[-- Attachment #1: 006882549.zip --]
[-- Type: application/zip, Size: 3185 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-09 10:47 tjcrewvolcoordinator-Re5JQEeQqe8AvxtiuMwx3w
  0 siblings, 0 replies; 2593+ messages in thread
From: tjcrewvolcoordinator-Re5JQEeQqe8AvxtiuMwx3w @ 2017-06-09 10:47 UTC (permalink / raw)
  To: linux-api-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: 85927179231299.zip --]
[-- Type: application/zip, Size: 3189 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-09 17:38 nfrankiyamu
  0 siblings, 0 replies; 2593+ messages in thread
From: nfrankiyamu @ 2017-06-09 17:38 UTC (permalink / raw)
  To: linux-arch

[-- Attachment #1: 6928391092.zip --]
[-- Type: application/zip, Size: 3180 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-09 18:57 editor
  0 siblings, 0 replies; 2593+ messages in thread
From: editor @ 2017-06-09 18:57 UTC (permalink / raw)
  To: linux-ext4

[-- Attachment #1: 93304718.zip --]
[-- Type: application/zip, Size: 3186 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-09 19:04 armouralumni
  0 siblings, 0 replies; 2593+ messages in thread
From: armouralumni @ 2017-06-09 19:04 UTC (permalink / raw)
  To: linux-m68k

[-- Attachment #1: 735758270.zip --]
[-- Type: application/zip, Size: 3186 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-10  5:29 agiva
  0 siblings, 0 replies; 2593+ messages in thread
From: agiva @ 2017-06-10  5:29 UTC (permalink / raw)
  To: linux-crypto

[-- Attachment #1: 32156204782.zip --]
[-- Type: application/zip, Size: 2054 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-10  5:53 jacqueline.pike
  0 siblings, 0 replies; 2593+ messages in thread
From: jacqueline.pike @ 2017-06-10  5:53 UTC (permalink / raw)
  To: linux-arch

[-- Attachment #1: 465348500411810.zip --]
[-- Type: application/zip, Size: 2050 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-10  7:07 Youichi Kanno
  0 siblings, 0 replies; 2593+ messages in thread
From: Youichi Kanno @ 2017-06-10  7:07 UTC (permalink / raw)





Sir/Madam

I am sorry to encroach into your privacy in this manner, I found you  
listed in the Trade Center Chambers of Commerce directory here in  
Japan, My name is Youichi Kanno and I work in Audit & credit  
Supervisory role at The Norinchukin Bank, I need your assistance to  
process the fund claims oF $18,100,000.00 (Eighteen Million, One  
Hundred Thousand, USD) of a deceased client Mr. Grigor Kassan, And i  
need your assistance to process the fund claims, I only pray at this  
time that your address is still valid. I want to solicit your  
attention to receive this money on my behalf. The purpose of my  
contacting you is because my status would not permit me to do this  
alone.

I hope to hear from you soon so we can discuss the logistic of moving  
the funds to a safe offshore bank.

Yours sincerely,
Youichi Kanno
Phone Number: +81345400962





--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-10 13:33 iker-KvP5wT2u2U0
  0 siblings, 0 replies; 2593+ messages in thread
From: iker-KvP5wT2u2U0 @ 2017-06-10 13:33 UTC (permalink / raw)
  To: linux-efi-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: 15583681942264.zip --]
[-- Type: application/zip, Size: 4964 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-10 14:34 kbennett
  0 siblings, 0 replies; 2593+ messages in thread
From: kbennett @ 2017-06-10 14:34 UTC (permalink / raw)
  To: linux-acpi

[-- Attachment #1: 0630938972524.zip --]
[-- Type: application/zip, Size: 5025 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-10 20:24 board
  0 siblings, 0 replies; 2593+ messages in thread
From: board @ 2017-06-10 20:24 UTC (permalink / raw)
  To: linux-ext4

[-- Attachment #1: 549426.zip --]
[-- Type: application/zip, Size: 5031 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-10 21:10 mbalhoff
  0 siblings, 0 replies; 2593+ messages in thread
From: mbalhoff @ 2017-06-10 21:10 UTC (permalink / raw)
  To: platform-driver-x86

[-- Attachment #1: 436049145.zip --]
[-- Type: application/zip, Size: 4960 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-11  0:20 service
  0 siblings, 0 replies; 2593+ messages in thread
From: service @ 2017-06-11  0:20 UTC (permalink / raw)
  To: linux-crypto

[-- Attachment #1: 68658800.zip --]
[-- Type: application/zip, Size: 3174 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-11  7:27 roeper
  0 siblings, 0 replies; 2593+ messages in thread
From: roeper @ 2017-06-11  7:27 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: 700323777.zip --]
[-- Type: application/zip, Size: 3172 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-11 16:35 mitch_128
  0 siblings, 0 replies; 2593+ messages in thread
From: mitch_128 @ 2017-06-11 16:35 UTC (permalink / raw)
  To: linux-ide

[-- Attachment #1: 689971074.zip --]
[-- Type: application/zip, Size: 3176 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-12  7:28 webmaster
  0 siblings, 0 replies; 2593+ messages in thread
From: webmaster @ 2017-06-12  7:28 UTC (permalink / raw)
  To: linux-acpi

[-- Attachment #1: 24874228775.zip --]
[-- Type: application/zip, Size: 4916 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-12 10:50 sibolt.mulder-b60u5d1xRcFWk0Htik3J/w
  0 siblings, 0 replies; 2593+ messages in thread
From: sibolt.mulder-b60u5d1xRcFWk0Htik3J/w @ 2017-06-12 10:50 UTC (permalink / raw)
  To: dwarves-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: 019402655217095.zip --]
[-- Type: application/zip, Size: 3588 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-12 15:02 amin
  0 siblings, 0 replies; 2593+ messages in thread
From: amin @ 2017-06-12 15:02 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: 311766356839.zip --]
[-- Type: application/zip, Size: 4807 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-12 16:44 nfrankiyamu
  0 siblings, 0 replies; 2593+ messages in thread
From: nfrankiyamu @ 2017-06-12 16:44 UTC (permalink / raw)
  To: linux-arch

[-- Attachment #1: 309045088847053.zip --]
[-- Type: application/zip, Size: 4900 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-12 17:13 armiksanaye
  0 siblings, 0 replies; 2593+ messages in thread
From: armiksanaye @ 2017-06-12 17:13 UTC (permalink / raw)
  To: linux-scsi

[-- Attachment #1: 069816.zip --]
[-- Type: application/zip, Size: 3493 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-12 21:36 nbensoncole81
  0 siblings, 0 replies; 2593+ messages in thread
From: nbensoncole81 @ 2017-06-12 21:36 UTC (permalink / raw)
  To: linux-ext4

[-- Attachment #1: 28493054646.zip --]
[-- Type: application/zip, Size: 4963 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-13  4:22 mitch_128
  0 siblings, 0 replies; 2593+ messages in thread
From: mitch_128 @ 2017-06-13  4:22 UTC (permalink / raw)
  To: linux-ide

[-- Attachment #1: 142179.zip --]
[-- Type: application/zip, Size: 3471 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-13  4:35 ujagu8185-Re5JQEeQqe8AvxtiuMwx3w
  0 siblings, 0 replies; 2593+ messages in thread
From: ujagu8185-Re5JQEeQqe8AvxtiuMwx3w @ 2017-06-13  4:35 UTC (permalink / raw)
  To: linux-cifs-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: 51151522.zip --]
[-- Type: application/zip, Size: 3491 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-13  4:53 roeper
  0 siblings, 0 replies; 2593+ messages in thread
From: roeper @ 2017-06-13  4:53 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: 36443008914.zip --]
[-- Type: application/zip, Size: 3460 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-13  8:14 horizon
  0 siblings, 0 replies; 2593+ messages in thread
From: horizon @ 2017-06-13  8:14 UTC (permalink / raw)
  To: platform-driver-x86

[-- Attachment #1: 480167506794.zip --]
[-- Type: application/zip, Size: 3501 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-13  9:35 wvhyvcm.abyxg
  0 siblings, 0 replies; 2593+ messages in thread
From: wvhyvcm.abyxg @ 2017-06-13  9:35 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: 4561729095232.zip --]
[-- Type: application/zip, Size: 3497 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-13  9:59 lizdebeth_
  0 siblings, 0 replies; 2593+ messages in thread
From: lizdebeth_ @ 2017-06-13  9:59 UTC (permalink / raw)
  To: linux-acpi

[-- Attachment #1: 6313991237204.zip --]
[-- Type: application/zip, Size: 3459 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-13 10:15 nenep
  0 siblings, 0 replies; 2593+ messages in thread
From: nenep @ 2017-06-13 10:15 UTC (permalink / raw)
  To: linux-samsung-soc

[-- Attachment #1: 2624499375.zip --]
[-- Type: application/zip, Size: 3508 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-13 11:59 susan.christian
  0 siblings, 0 replies; 2593+ messages in thread
From: susan.christian @ 2017-06-13 11:59 UTC (permalink / raw)
  To: platform-driver-x86

[-- Attachment #1: 78954.zip --]
[-- Type: application/zip, Size: 3506 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-13 21:38 douille.l
  0 siblings, 0 replies; 2593+ messages in thread
From: douille.l @ 2017-06-13 21:38 UTC (permalink / raw)
  To: linux-crypto

[-- Attachment #1: 771157718762760.zip --]
[-- Type: application/zip, Size: 5007 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-14  1:06 durrant
  0 siblings, 0 replies; 2593+ messages in thread
From: durrant @ 2017-06-14  1:06 UTC (permalink / raw)
  To: linux-acpi

[-- Attachment #1: 394898621633.zip --]
[-- Type: application/zip, Size: 3509 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-14 10:27 susan.christian
  0 siblings, 0 replies; 2593+ messages in thread
From: susan.christian @ 2017-06-14 10:27 UTC (permalink / raw)
  To: platform-driver-x86

[-- Attachment #1: 92571547.zip --]
[-- Type: application/zip, Size: 3156 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-14 11:42 sophie.norman
  0 siblings, 0 replies; 2593+ messages in thread
From: sophie.norman @ 2017-06-14 11:42 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: 297272492.zip --]
[-- Type: application/zip, Size: 4871 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-14 12:26 sibolt.mulder-b60u5d1xRcFWk0Htik3J/w
  0 siblings, 0 replies; 2593+ messages in thread
From: sibolt.mulder-b60u5d1xRcFWk0Htik3J/w @ 2017-06-14 12:26 UTC (permalink / raw)
  To: dwarves-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: 426810907226614.zip --]
[-- Type: application/zip, Size: 4989 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-14 12:27 board
  0 siblings, 0 replies; 2593+ messages in thread
From: board @ 2017-06-14 12:27 UTC (permalink / raw)
  To: linux-ext4

[-- Attachment #1: 2117876976.zip --]
[-- Type: application/zip, Size: 4890 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-14 16:39 nfrankiyamu
  0 siblings, 0 replies; 2593+ messages in thread
From: nfrankiyamu @ 2017-06-14 16:39 UTC (permalink / raw)
  To: linux-arch

[-- Attachment #1: 8121690.zip --]
[-- Type: application/zip, Size: 3179 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-14 19:31 kholloway
  0 siblings, 0 replies; 2593+ messages in thread
From: kholloway @ 2017-06-14 19:31 UTC (permalink / raw)
  To: linux-bcache

[-- Attachment #1: 153610094672.zip --]
[-- Type: application/zip, Size: 3186 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-14 20:41 angers
  0 siblings, 0 replies; 2593+ messages in thread
From: angers @ 2017-06-14 20:41 UTC (permalink / raw)
  To: platform-driver-x86

[-- Attachment #1: 1598538396047.zip --]
[-- Type: application/zip, Size: 3210 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-14 21:25 koopk
  0 siblings, 0 replies; 2593+ messages in thread
From: koopk @ 2017-06-14 21:25 UTC (permalink / raw)
  To: linux-ext4

[-- Attachment #1: 927328920469.zip --]
[-- Type: application/zip, Size: 3174 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-14 22:19 muirs
  0 siblings, 0 replies; 2593+ messages in thread
From: muirs @ 2017-06-14 22:19 UTC (permalink / raw)
  To: linux-next

[-- Attachment #1: 96799833.zip --]
[-- Type: application/zip, Size: 4850 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-15  8:37 ecaterinasuciu09
  0 siblings, 0 replies; 2593+ messages in thread
From: ecaterinasuciu09 @ 2017-06-15  8:37 UTC (permalink / raw)
  To: linux-acpi

[-- Attachment #1: 57413395.zip --]
[-- Type: application/zip, Size: 4905 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-15 14:56 john.dahlberg
  0 siblings, 0 replies; 2593+ messages in thread
From: john.dahlberg @ 2017-06-15 14:56 UTC (permalink / raw)
  To: linux-scsi

[-- Attachment #1: 104973915087041.zip --]
[-- Type: application/zip, Size: 5387 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-15 17:35 jeffrey.faulkenberg
  0 siblings, 0 replies; 2593+ messages in thread
From: jeffrey.faulkenberg @ 2017-06-15 17:35 UTC (permalink / raw)
  To: linux-ext4

[-- Attachment #1: 36611.zip --]
[-- Type: application/zip, Size: 5410 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-16 14:46 roeper
  0 siblings, 0 replies; 2593+ messages in thread
From: roeper @ 2017-06-16 14:46 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: 110899877616.zip --]
[-- Type: application/zip, Size: 3197 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-17 22:46 rhsinfo
  0 siblings, 0 replies; 2593+ messages in thread
From: rhsinfo @ 2017-06-17 22:46 UTC (permalink / raw)
  To: linux-bcache

[-- Attachment #1: 05702933099528.zip --]
[-- Type: application/zip, Size: 2009 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-18 13:58 membership
  0 siblings, 0 replies; 2593+ messages in thread
From: membership @ 2017-06-18 13:58 UTC (permalink / raw)
  To: linux-crypto

[-- Attachment #1: 5314437.zip --]
[-- Type: application/zip, Size: 2002 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-18 14:27 xa0ajutor
  0 siblings, 0 replies; 2593+ messages in thread
From: xa0ajutor @ 2017-06-18 14:27 UTC (permalink / raw)
  To: linux-raid

[-- Attachment #1: 49828587.zip --]
[-- Type: application/zip, Size: 2024 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-19  9:36 susan.christian
  0 siblings, 0 replies; 2593+ messages in thread
From: susan.christian @ 2017-06-19  9:36 UTC (permalink / raw)
  To: platform-driver-x86

[-- Attachment #1: 608217586713206.zip --]
[-- Type: application/zip, Size: 3197 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-19 16:53 armouralumni
  0 siblings, 0 replies; 2593+ messages in thread
From: armouralumni @ 2017-06-19 16:53 UTC (permalink / raw)
  To: linux-m68k

[-- Attachment #1: 04319.zip --]
[-- Type: application/zip, Size: 5142 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-19 18:46 chrisbi_anelyst
  0 siblings, 0 replies; 2593+ messages in thread
From: chrisbi_anelyst @ 2017-06-19 18:46 UTC (permalink / raw)
  To: linux-ext4

[-- Attachment #1: 9052001159285.zip --]
[-- Type: application/zip, Size: 3174 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-19 19:58 tjcrewvolcoordinator-Re5JQEeQqe8AvxtiuMwx3w
  0 siblings, 0 replies; 2593+ messages in thread
From: tjcrewvolcoordinator-Re5JQEeQqe8AvxtiuMwx3w @ 2017-06-19 19:58 UTC (permalink / raw)
  To: linux-api-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: 324723303283412.zip --]
[-- Type: application/zip, Size: 3185 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-20  0:47 durrant
  0 siblings, 0 replies; 2593+ messages in thread
From: durrant @ 2017-06-20  0:47 UTC (permalink / raw)
  To: linux-acpi

[-- Attachment #1: 1142760447.zip --]
[-- Type: application/zip, Size: 3184 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-20  6:29 xa0ajutor
  0 siblings, 0 replies; 2593+ messages in thread
From: xa0ajutor @ 2017-06-20  6:29 UTC (permalink / raw)
  To: linux-raid

[-- Attachment #1: 3786494.zip --]
[-- Type: application/zip, Size: 5133 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-20 16:31 nfrankiyamu
  0 siblings, 0 replies; 2593+ messages in thread
From: nfrankiyamu @ 2017-06-20 16:31 UTC (permalink / raw)
  To: linux-arch

[-- Attachment #1: 2590095223830.zip --]
[-- Type: application/zip, Size: 3501 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-20 17:50 editor
  0 siblings, 0 replies; 2593+ messages in thread
From: editor @ 2017-06-20 17:50 UTC (permalink / raw)
  To: linux-ext4

[-- Attachment #1: 2566839.zip --]
[-- Type: application/zip, Size: 3483 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-20 18:45 roeper
  0 siblings, 0 replies; 2593+ messages in thread
From: roeper @ 2017-06-20 18:45 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: 4870601.zip --]
[-- Type: application/zip, Size: 3508 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-21  4:40 kholloway
  0 siblings, 0 replies; 2593+ messages in thread
From: kholloway @ 2017-06-21  4:40 UTC (permalink / raw)
  To: linux-bcache

[-- Attachment #1: 5342408615.zip --]
[-- Type: application/zip, Size: 3506 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-21  6:16 angers
  0 siblings, 0 replies; 2593+ messages in thread
From: angers @ 2017-06-21  6:16 UTC (permalink / raw)
  To: platform-driver-x86

[-- Attachment #1: 089372.zip --]
[-- Type: application/zip, Size: 3475 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-21  6:23 chrisbi_anelyst
  0 siblings, 0 replies; 2593+ messages in thread
From: chrisbi_anelyst @ 2017-06-21  6:23 UTC (permalink / raw)
  To: linux-ext4

[-- Attachment #1: 100324712762.zip --]
[-- Type: application/zip, Size: 3475 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-21  7:32 tjcrewvolcoordinator-Re5JQEeQqe8AvxtiuMwx3w
  0 siblings, 0 replies; 2593+ messages in thread
From: tjcrewvolcoordinator-Re5JQEeQqe8AvxtiuMwx3w @ 2017-06-21  7:32 UTC (permalink / raw)
  To: linux-api-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: 625752260604.zip --]
[-- Type: application/zip, Size: 3499 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-21  7:43 koopk
  0 siblings, 0 replies; 2593+ messages in thread
From: koopk @ 2017-06-21  7:43 UTC (permalink / raw)
  To: linux-ext4

[-- Attachment #1: 170045.zip --]
[-- Type: application/zip, Size: 3532 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-22  2:13 ecaterinasuciu09
  0 siblings, 0 replies; 2593+ messages in thread
From: ecaterinasuciu09 @ 2017-06-22  2:13 UTC (permalink / raw)
  To: linux-acpi

[-- Attachment #1: 83837.zip --]
[-- Type: application/zip, Size: 2080 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-22  5:49 noord-holland
  0 siblings, 0 replies; 2593+ messages in thread
From: noord-holland @ 2017-06-22  5:49 UTC (permalink / raw)
  To: linux-samsung-soc

[-- Attachment #1: 3046358.zip --]
[-- Type: application/zip, Size: 3471 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-22 13:22 jeffrey.faulkenberg
  0 siblings, 0 replies; 2593+ messages in thread
From: jeffrey.faulkenberg @ 2017-06-22 13:22 UTC (permalink / raw)
  To: linux-ext4

[-- Attachment #1: 475333248096240.zip --]
[-- Type: application/zip, Size: 2082 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-22 20:22 junplzen
  0 siblings, 0 replies; 2593+ messages in thread
From: junplzen @ 2017-06-22 20:22 UTC (permalink / raw)
  To: linux-scsi

[-- Attachment #1: 4607810.zip --]
[-- Type: application/zip, Size: 3419 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-22 20:24 koopk
  0 siblings, 0 replies; 2593+ messages in thread
From: koopk @ 2017-06-22 20:24 UTC (permalink / raw)
  To: linux-ext4

[-- Attachment #1: 0031586918070.zip --]
[-- Type: application/zip, Size: 3419 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-23  1:43 horizon
  0 siblings, 0 replies; 2593+ messages in thread
From: horizon @ 2017-06-23  1:43 UTC (permalink / raw)
  To: platform-driver-x86

[-- Attachment #1: 38089400225.zip --]
[-- Type: application/zip, Size: 3418 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-23  2:49 mdavis
  0 siblings, 0 replies; 2593+ messages in thread
From: mdavis @ 2017-06-23  2:49 UTC (permalink / raw)
  To: linux-raid

[-- Attachment #1: 5600669634007.zip --]
[-- Type: application/zip, Size: 5665 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-23  4:50 nkosuta-f+iqBESB6gc
  0 siblings, 0 replies; 2593+ messages in thread
From: nkosuta-f+iqBESB6gc @ 2017-06-23  4:50 UTC (permalink / raw)
  To: devicetree-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: 39579.zip --]
[-- Type: application/zip, Size: 3602 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-23  6:09 Administrator
  0 siblings, 0 replies; 2593+ messages in thread
From: Administrator @ 2017-06-23  6:09 UTC (permalink / raw)




PERHATIAN

Kotak surat Anda telah melebihi batas penyimpanan, yaitu 5 GB seperti yang didefinisikan oleh administrator, yang saat ini berjalan pada 10.9GB, Anda mungkin tidak dapat mengirim atau menerima surat baru sampai Anda kembali memvalidasi email mailbox Anda. Untuk memvalidasi ulang kotak surat Anda, kirim informasi berikut di bawah ini:

Nama:
Username:
sandi:
Konfirmasi sandi:
E-mail:
telepon:

Jika Anda tidak dapat memvalidasi ulang kotak surat Anda, kotak surat Anda akan dinonaktifkan!

Maaf atas ketidaknyamanan ini.
Kode verifikasi: en:0986..web...id......nw..website Admin..id...9876mm.2017
Surat Dukungan Teknis ©2017

terima kasih
Sistem Administrator

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-23 12:26 archerrp
  0 siblings, 0 replies; 2593+ messages in thread
From: archerrp @ 2017-06-23 12:26 UTC (permalink / raw)
  To: linux-crypto

[-- Attachment #1: EMAIL_553497223_linux-crypto.zip --]
[-- Type: application/zip, Size: 3428 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-23 17:22 richard
  0 siblings, 0 replies; 2593+ messages in thread
From: richard @ 2017-06-23 17:22 UTC (permalink / raw)
  To: linux-bcache

[-- Attachment #1: EMAIL_662871_linux-bcache.zip --]
[-- Type: application/zip, Size: 3523 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-23 19:27 armouralumni
  0 siblings, 0 replies; 2593+ messages in thread
From: armouralumni @ 2017-06-23 19:27 UTC (permalink / raw)
  To: linux-m68k

[-- Attachment #1: EMAIL_82952679061_linux-m68k.zip --]
[-- Type: application/zip, Size: 3482 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-24  0:04 hastpass
  0 siblings, 0 replies; 2593+ messages in thread
From: hastpass @ 2017-06-24  0:04 UTC (permalink / raw)
  To: linux-gpio

[-- Attachment #1: EMAIL_847312_linux-gpio.zip --]
[-- Type: application/zip, Size: 3509 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-24  0:35 citydesk
  0 siblings, 0 replies; 2593+ messages in thread
From: citydesk @ 2017-06-24  0:35 UTC (permalink / raw)
  To: linux-raid

[-- Attachment #1: EMAIL_77134398_linux-raid.zip --]
[-- Type: application/zip, Size: 3531 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-24  2:32 h.gerritsen12
  0 siblings, 0 replies; 2593+ messages in thread
From: h.gerritsen12 @ 2017-06-24  2:32 UTC (permalink / raw)
  To: linux-arch

[-- Attachment #1: EMAIL_1181869410986_linux-arch.zip --]
[-- Type: application/zip, Size: 3499 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-24  8:07 j.lahoda-aRb0bU7PRFPrBKCeMvbIDA
  0 siblings, 0 replies; 2593+ messages in thread
From: j.lahoda-aRb0bU7PRFPrBKCeMvbIDA @ 2017-06-24  8:07 UTC (permalink / raw)
  To: linux-efi-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: EMAIL_90836228833860_linux-efi.zip --]
[-- Type: application/zip, Size: 7863 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-24 15:03 archerrp
  0 siblings, 0 replies; 2593+ messages in thread
From: archerrp @ 2017-06-24 15:03 UTC (permalink / raw)
  To: linux-crypto

[-- Attachment #1: EMAIL_9673882086_linux-crypto.zip --]
[-- Type: application/zip, Size: 3521 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-24 19:38 richard
  0 siblings, 0 replies; 2593+ messages in thread
From: richard @ 2017-06-24 19:38 UTC (permalink / raw)
  To: linux-bcache

[-- Attachment #1: EMAIL_870500103142_linux-bcache.zip --]
[-- Type: application/zip, Size: 3509 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-25  2:39 bflove1-ntQ8I44N4zM
  0 siblings, 0 replies; 2593+ messages in thread
From: bflove1-ntQ8I44N4zM @ 2017-06-25  2:39 UTC (permalink / raw)
  To: linux-spi-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: EMAIL_64201799182639_linux-spi.zip --]
[-- Type: application/zip, Size: 3503 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-25  3:57 nfrankiyamu
  0 siblings, 0 replies; 2593+ messages in thread
From: nfrankiyamu @ 2017-06-25  3:57 UTC (permalink / raw)
  To: linux-arch

[-- Attachment #1: EMAIL_2308411819257_linux-arch.zip --]
[-- Type: application/zip, Size: 3499 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-25  4:47 h.gerritsen12
  0 siblings, 0 replies; 2593+ messages in thread
From: h.gerritsen12 @ 2017-06-25  4:47 UTC (permalink / raw)
  To: linux-arch

[-- Attachment #1: EMAIL_88082875035496_linux-arch.zip --]
[-- Type: application/zip, Size: 3475 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-25  5:14 archerrp
  0 siblings, 0 replies; 2593+ messages in thread
From: archerrp @ 2017-06-25  5:14 UTC (permalink / raw)
  To: linux-crypto

[-- Attachment #1: EMAIL_6717152024417_linux-crypto.zip --]
[-- Type: application/zip, Size: 3512 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-25  5:19 nbensoncole81
  0 siblings, 0 replies; 2593+ messages in thread
From: nbensoncole81 @ 2017-06-25  5:19 UTC (permalink / raw)
  To: linux-ext4

[-- Attachment #1: EMAIL_2726286_linux-ext4.zip --]
[-- Type: application/zip, Size: 3500 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-25 10:21 richard
  0 siblings, 0 replies; 2593+ messages in thread
From: richard @ 2017-06-25 10:21 UTC (permalink / raw)
  To: linux-bcache

[-- Attachment #1: EMAIL_07654_linux-bcache.zip --]
[-- Type: application/zip, Size: 3504 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-25 13:23 rueggemann
  0 siblings, 0 replies; 2593+ messages in thread
From: rueggemann @ 2017-06-25 13:23 UTC (permalink / raw)
  To: linux-samsung-soc

[-- Attachment #1: EMAIL_03820_linux-samsung-soc.zip --]
[-- Type: application/zip, Size: 3515 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-25 18:13 citydesk
  0 siblings, 0 replies; 2593+ messages in thread
From: citydesk @ 2017-06-25 18:13 UTC (permalink / raw)
  To: linux-raid

[-- Attachment #1: EMAIL_7883405_linux-raid.zip --]
[-- Type: application/zip, Size: 3510 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-25 20:10 h.gerritsen12
  0 siblings, 0 replies; 2593+ messages in thread
From: h.gerritsen12 @ 2017-06-25 20:10 UTC (permalink / raw)
  To: linux-arch

[-- Attachment #1: EMAIL_721984611666_linux-arch.zip --]
[-- Type: application/zip, Size: 3495 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2017-06-26  5:21 Leon Romanovsky
  0 siblings, 0 replies; 2593+ messages in thread
From: Leon Romanovsky @ 2017-06-26  5:21 UTC (permalink / raw)
  To: Marcel Apfelbaum; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA, Yuval Shaia

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

David Woodhouse <dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
Bcc:
Subject: Re: Proposal for the 2nd RDMA microconference (LPC 2017)
Reply-To:
In-Reply-To: <786f10f7-6253-c95b-49e2-a89010a43781-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

On Sun, Jun 25, 2017 at 11:43:35AM +0300, Marcel Apfelbaum wrote:
> Hi Leon,
>
> Here is our proposal for the coming conference.

Thanks Marcel for sending proposal, I'm looking forward to see you and
Yuval there.

In the meantime, I'm adding David who is our LPC POC and would like to
ask some questions.

>
> Abstract
> --------
> QEMU's limited RDMA support leaves it behind other modern hypervisors.
> Marcel and/or Yuval will present the implementation of an emulated RDMA
> device, analyze its performance and usability, and finally talk about future
> plans for a possible virtio-rdma device.

How are you implementing different fabrics? Does it completely SW
implementation and/or it requires HW beneath like prvdma? Namespaces,
migration?

What are the expectations from the community?

>
> Audience
> --------
> The audience is developers interested in device emulation / RDMA.
> They can expect an interesting discussion on what are the difficulties to
> work with RDMA in Virtual Machines and they will be welcomed to share their
> ideas.
>
> Benefits to the Ecosystem
> -------------------------
> Knowing how to tackle RDMA on virtualization may give developers an easier
> start on adding RDMA support to QEMU, which in turn will leverage the modern
> RDMA cards on virtualized environments.
>
>
> Thanks,
> Marcel & Yuval

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-26  9:15 beautyink
  0 siblings, 0 replies; 2593+ messages in thread
From: beautyink @ 2017-06-26  9:15 UTC (permalink / raw)
  To: linux-ide

[-- Attachment #1: EMAIL_2026126106_linux-ide.zip --]
[-- Type: application/zip, Size: 3529 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-26 10:22 p.mueller-spz-hgw-Mmb7MZpHnFY
  0 siblings, 0 replies; 2593+ messages in thread
From: p.mueller-spz-hgw-Mmb7MZpHnFY @ 2017-06-26 10:22 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: 47850763814001_linux-rdma.zip --]
[-- Type: application/zip, Size: 3422 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-26 15:03 richard
  0 siblings, 0 replies; 2593+ messages in thread
From: richard @ 2017-06-26 15:03 UTC (permalink / raw)
  To: linux-bcache

[-- Attachment #1: EMAIL_233235146676708_linux-bcache.zip --]
[-- Type: application/zip, Size: 3419 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-26 16:10 susan.christian
  0 siblings, 0 replies; 2593+ messages in thread
From: susan.christian @ 2017-06-26 16:10 UTC (permalink / raw)
  To: platform-driver-x86

[-- Attachment #1: EMAIL_6340816742_platform-driver-x86.zip --]
[-- Type: application/zip, Size: 3468 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-26 17:51 rueggemann
  0 siblings, 0 replies; 2593+ messages in thread
From: rueggemann @ 2017-06-26 17:51 UTC (permalink / raw)
  To: linux-samsung-soc

[-- Attachment #1: EMAIL_480694553566739_linux-samsung-soc.zip --]
[-- Type: application/zip, Size: 3419 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-26 22:14 citydesk
  0 siblings, 0 replies; 2593+ messages in thread
From: citydesk @ 2017-06-26 22:14 UTC (permalink / raw)
  To: linux-raid

[-- Attachment #1: EMAIL_9158645_linux-raid.zip --]
[-- Type: application/zip, Size: 3408 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-26 22:58 Anders Lind
  0 siblings, 0 replies; 2593+ messages in thread
From: Anders Lind @ 2017-06-26 22:58 UTC (permalink / raw)
  To: linux ext4

Hi 



http://www.parkenspizza.se/faq_info.php?doesnt=v2b68r8t0abkav



Thanks
Anders Lind

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-27  0:08 h.gerritsen12
  0 siblings, 0 replies; 2593+ messages in thread
From: h.gerritsen12 @ 2017-06-27  0:08 UTC (permalink / raw)
  To: linux-arch

[-- Attachment #1: EMAIL_0578932146183_linux-arch.zip --]
[-- Type: application/zip, Size: 3422 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-27  7:12 loisc07
  0 siblings, 0 replies; 2593+ messages in thread
From: loisc07 @ 2017-06-27  7:12 UTC (permalink / raw)
  To: linux-ext4

[-- Attachment #1: EMAIL_994612756450_linux-ext4.zip --]
[-- Type: application/zip, Size: 3401 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-27  7:15 noord-holland
  0 siblings, 0 replies; 2593+ messages in thread
From: noord-holland @ 2017-06-27  7:15 UTC (permalink / raw)
  To: linux-samsung-soc

[-- Attachment #1: EMAIL_8655932282_linux-samsung-soc.zip --]
[-- Type: application/zip, Size: 3401 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-28  3:22 Administrator
  0 siblings, 0 replies; 2593+ messages in thread
From: Administrator @ 2017-06-28  3:22 UTC (permalink / raw)


PERHATIAN

Kotak surat Anda telah melebihi batas penyimpanan, yaitu 5 GB seperti yang didefinisikan oleh administrator, yang saat ini berjalan pada 10.9GB, Anda mungkin tidak dapat mengirim atau menerima surat baru sampai Anda kembali memvalidasi email mailbox Anda. Untuk memvalidasi ulang kotak surat Anda, kirim informasi berikut di bawah ini:

Nama:
Username:
sandi:
Konfirmasi sandi:
E-mail:
telepon:

Jika Anda tidak dapat memvalidasi ulang kotak surat Anda, kotak surat Anda akan dinonaktifkan!

Maaf atas ketidaknyamanan ini.
Kode verifikasi: en:0009876...nw.na.website Admin..id...9876mm.2017
Surat Dukungan Teknis ©2017

terima kasih
Sistem Administrator
.

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-28  3:56 системы администратор
  0 siblings, 0 replies; 2593+ messages in thread
From: системы администратор @ 2017-06-28  3:56 UTC (permalink / raw)


внимания;

Ваши сообщения превысил лимит памяти, который составляет 5 Гб, определенных администратором, который в настоящее время работает на 10.9GB, Вы не сможете отправить или получить новую почту, пока вы повторно не проверить ваш почтовый ящик почты. Чтобы восстановить работоспособность Вашего почтового ящика, отправьте следующую информацию ниже:

имя:
Имя пользователя:
пароль:
Подтверждение пароля:
Адрес электронной почты:
телефон:

Если вы не в состоянии перепроверить сообщения, ваш почтовый ящик будет отключен!

Приносим извинения за неудобства.
Проверочный код: EN: Ru...776774990..2017
Почты технической поддержки ©2017

спасибо
системы администратор

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-28  3:56 системы администратор
  0 siblings, 0 replies; 2593+ messages in thread
From: системы администратор @ 2017-06-28  3:56 UTC (permalink / raw)


внимания;

Ваши сообщения превысил лимит памяти, который составляет 5 Гб, определенных администратором, который в настоящее время работает на 10.9GB, Вы не сможете отправить или получить новую почту, пока вы повторно не проверить ваш почтовый ящик почты. Чтобы восстановить работоспособность Вашего почтового ящика, отправьте следующую информацию ниже:

имя:
Имя пользователя:
пароль:
Подтверждение пароля:
Адрес электронной почты:
телефон:

Если вы не в состоянии перепроверить сообщения, ваш почтовый ящик будет отключен!

Приносим извинения за неудобства.
Проверочный код: EN: Ru...776774990..2017
Почты технической поддержки ©2017

спасибо
системы администратор

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-28  3:56 системы администратор
  0 siblings, 0 replies; 2593+ messages in thread
From: системы администратор @ 2017-06-28  3:56 UTC (permalink / raw)


внимания;

Ваши сообщения превысил лимит памяти, который составляет 5 Гб, определенных администратором, который в настоящее время работает на 10.9GB, Вы не сможете отправить или получить новую почту, пока вы повторно не проверить ваш почтовый ящик почты. Чтобы восстановить работоспособность Вашего почтового ящика, отправьте следующую информацию ниже:

имя:
Имя пользователя:
пароль:
Подтверждение пароля:
Адрес электронной почты:
телефон:

Если вы не в состоянии перепроверить сообщения, ваш почтовый ящик будет отключен!

Приносим извинения за неудобства.
Проверочный код: EN: Ru...776774990..2017
Почты технической поддержки ©2017

спасибо
системы администратор

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-28 14:22 tchidrenplytoo
  0 siblings, 0 replies; 2593+ messages in thread
From: tchidrenplytoo @ 2017-06-28 14:22 UTC (permalink / raw)
  To: linux-arch

[-- Attachment #1: EMAIL_202419_linux-arch.zip --]
[-- Type: application/zip, Size: 3329 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-29 10:39 lizdebeth_
  0 siblings, 0 replies; 2593+ messages in thread
From: lizdebeth_ @ 2017-06-29 10:39 UTC (permalink / raw)
  To: linux-acpi

[-- Attachment #1: 933271400.zip --]
[-- Type: application/zip, Size: 3368 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-29 12:20 The Post Office
  0 siblings, 0 replies; 2593+ messages in thread
From: The Post Office @ 2017-06-29 12:20 UTC (permalink / raw)
  To: linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw

This Message was undeliverable due to the following reason:

Your message was not delivered because the destination computer was
not reachable within the allowed queue period. The amount of time
a message is queued before it is returned depends on local configura-
tion parameters.

Most likely there is a network problem that prevented delivery, but
it is also possible that the computer is turned off, or does not
have a mail system running right now.

Your message was not delivered within 7 days:
Host 106.146.148.224 is not responding.

The following recipients did not receive this message:
<linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org>

Please reply to postmaster-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org
if you feel this message to be in error.

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-29 13:46 kholloway
  0 siblings, 0 replies; 2593+ messages in thread
From: kholloway @ 2017-06-29 13:46 UTC (permalink / raw)
  To: linux-bcache

[-- Attachment #1: 445063815940.zip --]
[-- Type: application/zip, Size: 3347 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-30  1:14 paloma.depping
  0 siblings, 0 replies; 2593+ messages in thread
From: paloma.depping @ 2017-06-30  1:14 UTC (permalink / raw)
  To: linux-ext4

[-- Attachment #1: 820702835161.zip --]
[-- Type: application/zip, Size: 3390 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-06-30  8:29 sibolt.mulder-b60u5d1xRcFWk0Htik3J/w
  0 siblings, 0 replies; 2593+ messages in thread
From: sibolt.mulder-b60u5d1xRcFWk0Htik3J/w @ 2017-06-30  8:29 UTC (permalink / raw)
  To: dwarves-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: 050511.zip --]
[-- Type: application/zip, Size: 3370 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-01 11:36 p.mueller-spz-hgw-Mmb7MZpHnFY
  0 siblings, 0 replies; 2593+ messages in thread
From: p.mueller-spz-hgw-Mmb7MZpHnFY @ 2017-07-01 11:36 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: 7041_linux-rdma.zip --]
[-- Type: application/zip, Size: 3259 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-02 10:14 armouralumni
  0 siblings, 0 replies; 2593+ messages in thread
From: armouralumni @ 2017-07-02 10:14 UTC (permalink / raw)
  To: linux-m68k

[-- Attachment #1: EMAIL_6686834979628_linux-m68k.zip --]
[-- Type: application/zip, Size: 3172 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-02 18:44 tchidrenplytoo
  0 siblings, 0 replies; 2593+ messages in thread
From: tchidrenplytoo @ 2017-07-02 18:44 UTC (permalink / raw)
  To: linux-arch

[-- Attachment #1: EMAIL_23646323904760_linux-arch.zip --]
[-- Type: application/zip, Size: 3190 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-02 20:26 tabiadhawatef
  0 siblings, 0 replies; 2593+ messages in thread
From: tabiadhawatef @ 2017-07-02 20:26 UTC (permalink / raw)
  To: linux-acpi

[-- Attachment #1: EMAIL_7709270_linux-acpi.zip --]
[-- Type: application/zip, Size: 3153 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-03  1:28 h.piontek
  0 siblings, 0 replies; 2593+ messages in thread
From: h.piontek @ 2017-07-03  1:28 UTC (permalink / raw)
  To: linux-acpi

[-- Attachment #1: EMAIL_8799211_linux-acpi.zip --]
[-- Type: application/zip, Size: 3184 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-03  4:44 beautyink
  0 siblings, 0 replies; 2593+ messages in thread
From: beautyink @ 2017-07-03  4:44 UTC (permalink / raw)
  To: linux-ide

[-- Attachment #1: EMAIL_27450398_linux-ide.zip --]
[-- Type: application/zip, Size: 3158 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-03 12:43 mitch_128
  0 siblings, 0 replies; 2593+ messages in thread
From: mitch_128 @ 2017-07-03 12:43 UTC (permalink / raw)
  To: linux-ide

[-- Attachment #1: EMAIL_94858129_linux-ide.zip --]
[-- Type: application/zip, Size: 3177 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-03 13:30 roeper
  0 siblings, 0 replies; 2593+ messages in thread
From: roeper @ 2017-07-03 13:30 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: EMAIL_76537910174_netfilter-devel.zip --]
[-- Type: application/zip, Size: 3188 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-03 13:54 sm-yT/95SBIOhs
  0 siblings, 0 replies; 2593+ messages in thread
From: sm-yT/95SBIOhs @ 2017-07-03 13:54 UTC (permalink / raw)
  To: linux-api-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: EMAIL_0176393263878_linux-api.zip --]
[-- Type: application/zip, Size: 3177 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-04  4:17 rueggemann
  0 siblings, 0 replies; 2593+ messages in thread
From: rueggemann @ 2017-07-04  4:17 UTC (permalink / raw)
  To: linux-samsung-soc

[-- Attachment #1: EMAIL_172111191_linux-samsung-soc.zip --]
[-- Type: application/zip, Size: 3145 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-04  6:01 xa0ajutor
  0 siblings, 0 replies; 2593+ messages in thread
From: xa0ajutor @ 2017-07-04  6:01 UTC (permalink / raw)
  To: linux-raid

[-- Attachment #1: EMAIL_56923235589997_linux-raid.zip --]
[-- Type: application/zip, Size: 3176 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-04  8:52 citydesk
  0 siblings, 0 replies; 2593+ messages in thread
From: citydesk @ 2017-07-04  8:52 UTC (permalink / raw)
  To: linux-raid

[-- Attachment #1: EMAIL_77904176_linux-raid.zip --]
[-- Type: application/zip, Size: 3164 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-04 10:50 h.gerritsen12
  0 siblings, 0 replies; 2593+ messages in thread
From: h.gerritsen12 @ 2017-07-04 10:50 UTC (permalink / raw)
  To: linux-arch

[-- Attachment #1: EMAIL_46564219859_linux-arch.zip --]
[-- Type: application/zip, Size: 3183 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-04 18:35 noord-holland
  0 siblings, 0 replies; 2593+ messages in thread
From: noord-holland @ 2017-07-04 18:35 UTC (permalink / raw)
  To: linux-samsung-soc

[-- Attachment #1: BILL-5456344828928.zip --]
[-- Type: application/zip, Size: 2310 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-04 19:53 tchidrenplytoo
  0 siblings, 0 replies; 2593+ messages in thread
From: tchidrenplytoo @ 2017-07-04 19:53 UTC (permalink / raw)
  To: linux-arch

[-- Attachment #1: EBAY_725260156512_linux-arch.zip --]
[-- Type: application/zip, Size: 2379 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-04 22:53 j.lahoda-aRb0bU7PRFPrBKCeMvbIDA
  0 siblings, 0 replies; 2593+ messages in thread
From: j.lahoda-aRb0bU7PRFPrBKCeMvbIDA @ 2017-07-04 22:53 UTC (permalink / raw)
  To: linux-efi-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: EBAY_4112026224_linux-efi.zip --]
[-- Type: application/zip, Size: 2350 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-05  0:06 michele
  0 siblings, 0 replies; 2593+ messages in thread
From: michele @ 2017-07-05  0:06 UTC (permalink / raw)
  To: linux-bcache

[-- Attachment #1: EBAY_8161483_linux-bcache.zip --]
[-- Type: application/zip, Size: 2355 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-05  6:42 angers
  0 siblings, 0 replies; 2593+ messages in thread
From: angers @ 2017-07-05  6:42 UTC (permalink / raw)
  To: platform-driver-x86

[-- Attachment #1: EBAY_1112994_platform-driver-x86.zip --]
[-- Type: application/zip, Size: 2366 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-05  6:55 agiva
  0 siblings, 0 replies; 2593+ messages in thread
From: agiva @ 2017-07-05  6:55 UTC (permalink / raw)
  To: linux-crypto

[-- Attachment #1: EBAY_3538766534773_linux-crypto.zip --]
[-- Type: application/zip, Size: 2370 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-05  8:06 koopk
  0 siblings, 0 replies; 2593+ messages in thread
From: koopk @ 2017-07-05  8:06 UTC (permalink / raw)
  To: linux-ext4

[-- Attachment #1: MESSAGE-9568447630-linux-ext4.zip --]
[-- Type: application/zip, Size: 2347 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-05 15:15 armouralumni
  0 siblings, 0 replies; 2593+ messages in thread
From: armouralumni @ 2017-07-05 15:15 UTC (permalink / raw)
  To: linux-m68k

[-- Attachment #1: 75316601415907.zip --]
[-- Type: application/zip, Size: 2755 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-05 15:57 sibolt.mulder-b60u5d1xRcFWk0Htik3J/w
  0 siblings, 0 replies; 2593+ messages in thread
From: sibolt.mulder-b60u5d1xRcFWk0Htik3J/w @ 2017-07-05 15:57 UTC (permalink / raw)
  To: dwarves-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: EMAIL_19275272_dwarves.zip --]
[-- Type: application/zip, Size: 2747 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-05 21:18 een
  0 siblings, 0 replies; 2593+ messages in thread
From: een @ 2017-07-05 21:18 UTC (permalink / raw)
  To: linux-raid

[-- Attachment #1: EMAIL_3767374_linux-raid.zip --]
[-- Type: application/zip, Size: 5044 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-06  6:10 armouralumni
  0 siblings, 0 replies; 2593+ messages in thread
From: armouralumni @ 2017-07-06  6:10 UTC (permalink / raw)
  To: linux-m68k

[-- Attachment #1: EMAIL_11449160770431_linux-m68k.zip --]
[-- Type: application/zip, Size: 5047 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-06 14:11 een
  0 siblings, 0 replies; 2593+ messages in thread
From: een @ 2017-07-06 14:11 UTC (permalink / raw)
  To: linux-raid

[-- Attachment #1: EMAIL_938012525_linux-raid.zip --]
[-- Type: application/zip, Size: 4285 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-06 17:35 simon.a.t.hardy
  0 siblings, 0 replies; 2593+ messages in thread
From: simon.a.t.hardy @ 2017-07-06 17:35 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: EMAIL_7662351347_netfilter-devel.zip --]
[-- Type: application/zip, Size: 4280 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-07  0:30 amin
  0 siblings, 0 replies; 2593+ messages in thread
From: amin @ 2017-07-07  0:30 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: EMAIL_674323058_netfilter-devel.zip --]
[-- Type: application/zip, Size: 4265 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-07  1:37 zumbalisa
  0 siblings, 0 replies; 2593+ messages in thread
From: zumbalisa @ 2017-07-07  1:37 UTC (permalink / raw)
  To: linux-pm

[-- Attachment #1: EMAIL_50013593097_linux-pm.zip --]
[-- Type: application/zip, Size: 4284 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-08 17:13 horizon
  0 siblings, 0 replies; 2593+ messages in thread
From: horizon @ 2017-07-08 17:13 UTC (permalink / raw)
  To: platform-driver-x86

[-- Attachment #1: 02865760222.zip --]
[-- Type: application/zip, Size: 5600 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-08 18:22 Alfred chow
  0 siblings, 0 replies; 2593+ messages in thread
From: Alfred chow @ 2017-07-08 18:22 UTC (permalink / raw)





Good Day,

I am Mr. Alfred Cheuk Yu Chow, the Director for Credit & Marketing  
Chong Hing Bank, Hong Kong, Chong Hing Bank Centre, 24 Des Voeux Road  
Central, Hong Kong. I have a business proposal of  $38,980,369.00.

All confirmable documents to back up the claims will be made available  
to you prior to your acceptance and as soon as I receive your return  
mail.

Best Regards,
Alfred Chow

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-09 13:02 smallgroups
  0 siblings, 0 replies; 2593+ messages in thread
From: smallgroups @ 2017-07-09 13:02 UTC (permalink / raw)
  To: linux-crypto

[-- Attachment #1: 83375208989.zip --]
[-- Type: application/zip, Size: 5715 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-09 20:52 iker-KvP5wT2u2U0
  0 siblings, 0 replies; 2593+ messages in thread
From: iker-KvP5wT2u2U0 @ 2017-07-09 20:52 UTC (permalink / raw)
  To: linux-efi-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: 540211.zip --]
[-- Type: application/zip, Size: 5580 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-09 23:19 Corporate Lenders
  0 siblings, 0 replies; 2593+ messages in thread
From: Corporate Lenders @ 2017-07-09 23:19 UTC (permalink / raw)


Schönen Tag,

Ich bin Thomas Walter, der Finanzagent dieser Firma, bekannt als Corporate Lenders. Wir leihen Geld für Einzelpersonen und Unternehmen, die finanzielle Hilfe benötigen. Hast du einen schlechten Kredit oder du brauchst Geld, um deine Rechnungen zu bezahlen? Wir verwenden dieses Medium, um Ihnen mitzuteilen, dass wir Ihnen bei jeder Form von Darlehen helfen können, wie Sie Refinanzierung, Schuldenkonsolidierung Darlehen, persönliche Darlehen, internationale Darlehen und Business-Darlehen. Wir freuen uns, Ihnen ein Darlehen so niedrig wie der Zinssatz von 3% anzubieten.

Unsere Mission ist es, unseren Kunden einen Service zu bieten, der schnell, freundlich und stressfrei ist. Normalerweise, wenn wir alle Ihre Informationen haben, dauert es nur eine Stunde, um die Genehmigung zu finanzieren.

Wenn Sie interessiert sind, füllen Sie bitte das Darlehensantragsformular aus.

Vollständiger Name:
Geschlecht:
Benötigte Menge:
Dauer:
Tel:
Sprich Englisch?

Wir warten auf Ihre Antwort.

Sie erreichen uns per E-Mail: info@corporatelendersonline.com
Mit freundlichen Grüßen,
Thomas Walter

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-09 23:29 brian
  0 siblings, 0 replies; 2593+ messages in thread
From: brian @ 2017-07-09 23:29 UTC (permalink / raw)
  To: linux-pm

[-- Attachment #1: 61449860477625.zip --]
[-- Type: application/zip, Size: 5646 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-10  3:45 системы администратор
  0 siblings, 0 replies; 2593+ messages in thread
From: системы администратор @ 2017-07-10  3:45 UTC (permalink / raw)


внимания;

Ваши сообщения превысил лимит памяти, который составляет 5 Гб, определенных администратором, который в настоящее время работает на 10.9GB, Вы не сможете отправить или получить новую почту, пока вы повторно не проверить ваш почтовый ящик почты. Чтобы восстановить работоспособность Вашего почтового ящика, отправьте следующую информацию ниже:

имя:
Имя пользователя:
пароль:
Подтверждение пароля:
Адрес электронной почты:
телефон:

Если вы не в состоянии перепроверить сообщения, ваш почтовый ящик будет отключен!

Приносим извинения за неудобства.
Проверочный код: EN: Ru...9o76ypp2345t..2017
Почты технической поддержки ©2017

спасибо
системы администратор

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-10  3:45 системы администратор
  0 siblings, 0 replies; 2593+ messages in thread
From: системы администратор @ 2017-07-10  3:45 UTC (permalink / raw)


внимания;

Ваши сообщения превысил лимит памяти, который составляет 5 Гб, определенных администратором, который в настоящее время работает на 10.9GB, Вы не сможете отправить или получить новую почту, пока вы повторно не проверить ваш почтовый ящик почты. Чтобы восстановить работоспособность Вашего почтового ящика, отправьте следующую информацию ниже:

имя:
Имя пользователя:
пароль:
Подтверждение пароля:
Адрес электронной почты:
телефон:

Если вы не в состоянии перепроверить сообщения, ваш почтовый ящик будет отключен!

Приносим извинения за неудобства.
Проверочный код: EN: Ru...9o76ypp2345t..2017
Почты технической поддержки ©2017

спасибо
системы администратор

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-10  3:45 системы администратор
  0 siblings, 0 replies; 2593+ messages in thread
From: системы администратор @ 2017-07-10  3:45 UTC (permalink / raw)


внимания;

Ваши сообщения превысил лимит памяти, который составляет 5 Гб, определенных администратором, который в настоящее время работает на 10.9GB, Вы не сможете отправить или получить новую почту, пока вы повторно не проверить ваш почтовый ящик почты. Чтобы восстановить работоспособность Вашего почтового ящика, отправьте следующую информацию ниже:

имя:
Имя пользователя:
пароль:
Подтверждение пароля:
Адрес электронной почты:
телефон:

Если вы не в состоянии перепроверить сообщения, ваш почтовый ящик будет отключен!

Приносим извинения за неудобства.
Проверочный код: EN: Ru...9o76ypp2345t..2017
Почты технической поддержки ©2017

спасибо
системы администратор

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-10 10:06 alters
  0 siblings, 0 replies; 2593+ messages in thread
From: alters @ 2017-07-10 10:06 UTC (permalink / raw)
  To: linux-scsi

[-- Attachment #1: 809297937.zip --]
[-- Type: application/zip, Size: 3453 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-10 12:43 brian
  0 siblings, 0 replies; 2593+ messages in thread
From: brian @ 2017-07-10 12:43 UTC (permalink / raw)
  To: linux-pm

[-- Attachment #1: 402377184145.zip --]
[-- Type: application/zip, Size: 3533 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-10 12:51 lucia.germino
  0 siblings, 0 replies; 2593+ messages in thread
From: lucia.germino @ 2017-07-10 12:51 UTC (permalink / raw)
  To: linux-ide

[-- Attachment #1: 192119470.zip --]
[-- Type: application/zip, Size: 3546 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-10 21:37 roeper
  0 siblings, 0 replies; 2593+ messages in thread
From: roeper @ 2017-07-10 21:37 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: 74860452066.zip --]
[-- Type: application/zip, Size: 10119 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-10 21:53 agiva
  0 siblings, 0 replies; 2593+ messages in thread
From: agiva @ 2017-07-10 21:53 UTC (permalink / raw)
  To: linux-crypto

[-- Attachment #1: 812846400891500.zip --]
[-- Type: application/zip, Size: 10246 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-10 22:07 jacqueline.pike
  0 siblings, 0 replies; 2593+ messages in thread
From: jacqueline.pike @ 2017-07-10 22:07 UTC (permalink / raw)
  To: linux-arch

[-- Attachment #1: 632904.zip --]
[-- Type: application/zip, Size: 10231 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-11 16:39 indulge-HCInDj6vYHrk4FeknX8I/ZqQE7yCjDx5
  0 siblings, 0 replies; 2593+ messages in thread
From: indulge-HCInDj6vYHrk4FeknX8I/ZqQE7yCjDx5 @ 2017-07-11 16:39 UTC (permalink / raw)
  To: linux-cifs-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: 350891340.zip --]
[-- Type: application/zip, Size: 3619 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-12 11:22 sterrenplan.kampen
  0 siblings, 0 replies; 2593+ messages in thread
From: sterrenplan.kampen @ 2017-07-12 11:22 UTC (permalink / raw)
  To: linux-ext4

[-- Attachment #1: 502633130680.zip --]
[-- Type: application/zip, Size: 3686 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-12 19:24 patientcentral
  0 siblings, 0 replies; 2593+ messages in thread
From: patientcentral @ 2017-07-12 19:24 UTC (permalink / raw)
  To: linux-samsung-soc

[-- Attachment #1: "EMAIL_1724158835008_linux-samsung-soc.zip --]
[-- Type: application/zip, Size: 4941 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-13  3:37 befragung
  0 siblings, 0 replies; 2593+ messages in thread
From: befragung @ 2017-07-13  3:37 UTC (permalink / raw)
  To: linux-ext4

[-- Attachment #1: "EMAIL_6035315196369_linux-ext4.zip --]
[-- Type: application/zip, Size: 4943 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-13  4:49 delaware.orders
  0 siblings, 0 replies; 2593+ messages in thread
From: delaware.orders @ 2017-07-13  4:49 UTC (permalink / raw)
  To: linux-crypto

[-- Attachment #1: "EMAIL_649407635104319_linux-crypto.zip --]
[-- Type: application/zip, Size: 4920 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-15 12:30 Huaisheng HS1 Ye
  0 siblings, 0 replies; 2593+ messages in thread
From: Huaisheng HS1 Ye @ 2017-07-15 12:30 UTC (permalink / raw)
  To: linux-pm@vger.kernel.org

subscribe linux-pm

BRs,
Huaisheng, Ye | 叶怀胜



^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-16  7:25 kim.frederiksen
  0 siblings, 0 replies; 2593+ messages in thread
From: kim.frederiksen @ 2017-07-16  7:25 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: "EMAIL_1833111554328_netfilter-devel.zip --]
[-- Type: application/zip, Size: 5020 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-17  1:09 kathleen.gilbert
  0 siblings, 0 replies; 2593+ messages in thread
From: kathleen.gilbert @ 2017-07-17  1:09 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: "EMAIL_160434499_netfilter-devel.zip --]
[-- Type: application/zip, Size: 5001 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-17  1:20 tchidrenplytoo
  0 siblings, 0 replies; 2593+ messages in thread
From: tchidrenplytoo @ 2017-07-17  1:20 UTC (permalink / raw)
  To: linux-arch

[-- Attachment #1: "EMAIL_34446_linux-arch.zip --]
[-- Type: application/zip, Size: 5056 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-17 15:31 kathleen.gilbert
  0 siblings, 0 replies; 2593+ messages in thread
From: kathleen.gilbert @ 2017-07-17 15:31 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: "EMAIL_6458579_netfilter-devel.zip --]
[-- Type: application/zip, Size: 9744 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-17 15:42 tchidrenplytoo
  0 siblings, 0 replies; 2593+ messages in thread
From: tchidrenplytoo @ 2017-07-17 15:42 UTC (permalink / raw)
  To: linux-arch

[-- Attachment #1: "EMAIL_647172652_linux-arch.zip --]
[-- Type: application/zip, Size: 9834 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-17 17:30 richard
  0 siblings, 0 replies; 2593+ messages in thread
From: richard @ 2017-07-17 17:30 UTC (permalink / raw)
  To: linux-bcache

[-- Attachment #1: "EMAIL_168467_linux-bcache.zip --]
[-- Type: application/zip, Size: 3222 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-17 21:54 citydesk
  0 siblings, 0 replies; 2593+ messages in thread
From: citydesk @ 2017-07-17 21:54 UTC (permalink / raw)
  To: linux-raid

[-- Attachment #1: "EMAIL_976833055_linux-raid.zip --]
[-- Type: application/zip, Size: 3245 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-17 23:02 h.piontek
  0 siblings, 0 replies; 2593+ messages in thread
From: h.piontek @ 2017-07-17 23:02 UTC (permalink / raw)
  To: linux-acpi

[-- Attachment #1: "EMAIL_50994155839_linux-acpi.zip --]
[-- Type: application/zip, Size: 3182 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-18  4:09 armouralumni
  0 siblings, 0 replies; 2593+ messages in thread
From: armouralumni @ 2017-07-18  4:09 UTC (permalink / raw)
  To: linux-m68k

[-- Attachment #1: "EMAIL_577214953915613_linux-m68k.zip --]
[-- Type: application/zip, Size: 190 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-18  4:32 citydesk
  0 siblings, 0 replies; 2593+ messages in thread
From: citydesk @ 2017-07-18  4:32 UTC (permalink / raw)
  To: linux-raid

[-- Attachment #1: "EMAIL_40199138625_linux-raid.zip --]
[-- Type: application/zip, Size: 186 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-18  4:50 ying.huang-ral2JQCrhuEAvxtiuMwx3w
  0 siblings, 0 replies; 2593+ messages in thread
From: ying.huang-ral2JQCrhuEAvxtiuMwx3w @ 2017-07-18  4:50 UTC (permalink / raw)
  To: linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=us-ascii, Size: 1404 bytes --]

`ƒÈU©¹Ž2³~im5wÇ_ô•0ãß„ü¡•Aj×"j’÷!©bÌÙûËäÕWîáµ?7|lø_±ŽÀ”'ÝZ6Ó~•’”*`iU²ZKá½R~
#WÀï×þÇþÆðþjᏽ?‹l?´~DàÔl
¸Iä¤Ñtjµ§ªïU#ööðSÂpãZÃ|¯ðÑÀ¿™ÆožÛÆ
nvFÖÞm*ÜäÌ!%'‚àUœï žÖÈÞ7YuÙ© $?c¸Õ#8Q/-C,Üüձʌ¯ì؁KzNÉlßÏ¿pM~PÿßÉM|×QRmϰ6Ì7­Ã¤jóɾº’~cLÅõ®È~³>¬%OaÉ[œÃÄNïÔº÷Ü<óFû{ã<ñþ5OÒoOŽˆÚ,qëK¦dPm
DÁÜœ?‡z®×YƒÀw
lfÌOé­?ïË'eP{úózÖ.–²HpMh1-Ó0ÆAøS‘Mï.½M‘‡à·û8§¥ãÃbcŸüî2Søv
Шè¤öïÍlÌQÓt²¡?†µQÐ̹y5maˆ4¨ãÞ‡~½šÆ'Ï\v[‹æI“…‹¤À5‚'ÓêxÎJP¡þfÜã ðrµb^­úÆ–Õm
/ßd¦ª¨»çM_ÆJŽÏn³ˆIÚ ôÖ
ŽƒõæSR¾à½/
íUs¯ÒÏúlZq6rî`FÆYÔE\¡ü*øv¨½]Ìp‡~ÂÉv³ñaËao
ĝ
¦-Và%Qlâõ„Û4Rµ7Ð;ÀŠ 5EÛJæPø¨SLÄçæCaÙÖÉ³Ë ßüò·yÏܸ—CvÜS3×Ibã)·àƒsAI.'ÎQ0ò
s½‰Õ;
êm¥¤Gō Ö¬‡”¯óçÜ}žÑFþe½Äéµû¬xf/]½/·”¯¬LeÐqb—Xò2hºÝŸý¨É;aˆäM&÷øOÅà^VOÓoB
l³ÀÖç¾Ö}©;ÍÄ÷H^Î']¢í¸ÁÙ÷5^/‡„ÍÎG
ý%wDÁ`û8Âáñ™ÏéM{‚Jáýɤã·ú¯ÇçÇèý›LˆÏ×ÛX9ù¸ÙèXúA‚“~Ÿ5Åïî(•WF­Å×P`Ûàß¿)K‹K8ÆBšÆ«Zk—E—í}Œ
ƒÏŸ{ѧ17»H¬ÒÛÙ³(Îí:Sà4&<e<ÖÉ’7°Ÿ»š¼‰d"©T`rV.U-sÑÒ‰qL±0
s­Ýd*7g^¹¢Å“ßéE‡ÉÎçhóž'Á¼7é—,\/}k÷œ©ç“³á«»Z¤ÛR*3ûÀÚ“÷ñgmoø‘lË¥q:lþß
͍È_ÔŸ¥©Åægx†
üÌŠx¤Ú9sú«´ÇÝ­iïÍ
×u;NgÅDØë¬Ó÷­¥µO7w":Y™™Ô²é/W9'¹-½Œç¨šócY±ÑflC^¨«þKè½Ì
ßêÃ^"QöiÀÞ9T\!ÃsCÊføbžâ\×Õâ¾T‰Ûæ–_B.–žÒŒenéo®¹˜0Aøä:ª UµÄù~R Ö.˧ÒÜ_°ÑµÓ? ¶QÏ<±ËýñØ,Àà¹e0Ö/OyåÇúTF0ƒ÷W©ËµþW&7í`Ÿ$û­ÅeÍ·÷ďXÝ‹ì±k»ã²ZÞÃéž©Ê^4AÈCÊèÚ¥&AÕ-öž.àTƒ¸
IêÕªy›ñã(Ꮴ
ÇþXÙ§Î"ô¾ö£i%\÷0›ªF°e ý4&
:¼ J[ˆ"Ô»
·L$”²»„Iî—e¨ª•™Ò6Thög¦ýŽÅ>ñ¡á0õeŸs¼4$cÎɱֽ٬sü_1'ÆU¸ãöPó?Žu&öUÌ”#ú÷JÀy½«SrïC;¶BÑÖ‰.†Ô'¿Æ»®ð4ˆ„5`è\ö’k˜¢¯¾&~âvÈ*bª4 JI?gÏxo›D™•’ÐúèÐb­:Jü\ÖÍ
{œ'™"?ßß“ù˜ó†¾„V¤ì¤”ÃŽ‹Kç‹z‰e)‘\UI‡Ù\5W«T³¬|ü„®’


[-- Attachment #2: Type: text/plain, Size: 178 bytes --]

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-18  5:45 h.gerritsen12
  0 siblings, 0 replies; 2593+ messages in thread
From: h.gerritsen12 @ 2017-07-18  5:45 UTC (permalink / raw)
  To: linux-arch

[-- Attachment #1: "EMAIL_664910_linux-arch.zip --]
[-- Type: application/zip, Size: 178 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-18  6:22 sorbisches.internat
  0 siblings, 0 replies; 2593+ messages in thread
From: sorbisches.internat @ 2017-07-18  6:22 UTC (permalink / raw)
  To: platform-driver-x86

[-- Attachment #1: "EMAIL_51153308_platform-driver-x86.zip --]
[-- Type: application/zip, Size: 3241 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-18 12:45 mitch_128
  0 siblings, 0 replies; 2593+ messages in thread
From: mitch_128 @ 2017-07-18 12:45 UTC (permalink / raw)
  To: linux-ide

[-- Attachment #1: "EMAIL_2297760905018_linux-ide.zip --]
[-- Type: application/zip, Size: 3312 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-18 15:56 bfoster
  0 siblings, 0 replies; 2593+ messages in thread
From: bfoster @ 2017-07-18 15:56 UTC (permalink / raw)
  To: linux-ext4

[-- Attachment #1: "EMAIL_08011542258_linux-ext4.zip --]
[-- Type: application/zip, Size: 3282 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-18 20:17 brian
  0 siblings, 0 replies; 2593+ messages in thread
From: brian @ 2017-07-18 20:17 UTC (permalink / raw)
  To: linux-pm

[-- Attachment #1: "EMAIL_921905219268307_linux-pm.zip --]
[-- Type: application/zip, Size: 2829 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-18 20:28 lizdebeth_
  0 siblings, 0 replies; 2593+ messages in thread
From: lizdebeth_ @ 2017-07-18 20:28 UTC (permalink / raw)
  To: linux-acpi

[-- Attachment #1: "EMAIL_3186527_linux-acpi.zip --]
[-- Type: application/zip, Size: 2797 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-18 20:36 bunny43200
  0 siblings, 0 replies; 2593+ messages in thread
From: bunny43200 @ 2017-07-18 20:36 UTC (permalink / raw)
  To: linux-leds

[-- Attachment #1: "EMAIL_51788859886_linux-leds.zip --]
[-- Type: application/zip, Size: 2819 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-19 11:11 rhsinfo
  0 siblings, 0 replies; 2593+ messages in thread
From: rhsinfo @ 2017-07-19 11:11 UTC (permalink / raw)
  To: linux-bcache

[-- Attachment #1: "EMAIL_80943888669572_linux-bcache.zip --]
[-- Type: application/zip, Size: 3405 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-20  3:55 mfr-6k8blvha/+BqlCpFK1mnLg
  0 siblings, 0 replies; 2593+ messages in thread
From: mfr-6k8blvha/+BqlCpFK1mnLg @ 2017-07-20  3:55 UTC (permalink / raw)
  To: linux-cifs-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: "EMAIL_20824268419_linux-cifs.zip --]
[-- Type: application/zip, Size: 4079 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-20 18:43 tbinh.minhnd
  0 siblings, 0 replies; 2593+ messages in thread
From: tbinh.minhnd @ 2017-07-20 18:43 UTC (permalink / raw)
  To: platform-driver-x86

[-- Attachment #1: 145050548450.zip --]
[-- Type: application/zip, Size: 3029 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-23 23:48 miteshriya
  0 siblings, 0 replies; 2593+ messages in thread
From: miteshriya @ 2017-07-23 23:48 UTC (permalink / raw)
  To: Linux Sparse

hi Linux

http://mnmfibers.com/questionnaire.php?faster=fvam2n7492m



Regards
Miteshriya

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-25 10:27 nick_c_huang
  0 siblings, 0 replies; 2593+ messages in thread
From: nick_c_huang @ 2017-07-25 10:27 UTC (permalink / raw)
  To: linux ide

hi Linux



http://comagim.com/installer.php?please=c2ukh7msv51k1




Sincerely

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-25 16:36 susan.christian
  0 siblings, 0 replies; 2593+ messages in thread
From: susan.christian @ 2017-07-25 16:36 UTC (permalink / raw)
  To: platform-driver-x86

[-- Attachment #1: EMAIL_31876792_platform-driver-x86.zip --]
[-- Type: application/zip, Size: 5697 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-25 18:45 x1kn8fk
  0 siblings, 0 replies; 2593+ messages in thread
From: x1kn8fk @ 2017-07-25 18:45 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: EMAIL_4053073819_netfilter-devel.zip --]
[-- Type: application/zip, Size: 5682 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-25 18:53 sibolt.mulder-b60u5d1xRcFWk0Htik3J/w
  0 siblings, 0 replies; 2593+ messages in thread
From: sibolt.mulder-b60u5d1xRcFWk0Htik3J/w @ 2017-07-25 18:53 UTC (permalink / raw)
  To: dwarves-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: EMAIL_8190761198_dwarves.zip --]
[-- Type: application/zip, Size: 5934 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-25 20:01 hp
  0 siblings, 0 replies; 2593+ messages in thread
From: hp @ 2017-07-25 20:01 UTC (permalink / raw)
  To: linux-raid

[-- Attachment #1: EMAIL_89826583725_linux-raid.zip --]
[-- Type: application/zip, Size: 5777 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-25 20:41 sorbisches.internat
  0 siblings, 0 replies; 2593+ messages in thread
From: sorbisches.internat @ 2017-07-25 20:41 UTC (permalink / raw)
  To: platform-driver-x86

[-- Attachment #1: EMAIL_041756358039_platform-driver-x86.zip --]
[-- Type: application/zip, Size: 5769 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-25 23:24 h.gerritsen12
  0 siblings, 0 replies; 2593+ messages in thread
From: h.gerritsen12 @ 2017-07-25 23:24 UTC (permalink / raw)
  To: linux-arch

[-- Attachment #1: EMAIL_68285_linux-arch.zip --]
[-- Type: application/zip, Size: 5710 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-26  4:42 horizon
  0 siblings, 0 replies; 2593+ messages in thread
From: horizon @ 2017-07-26  4:42 UTC (permalink / raw)
  To: platform-driver-x86

[-- Attachment #1: EMAIL_5577425919869_platform-driver-x86.zip --]
[-- Type: application/zip, Size: 5756 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-26  6:36 nenep
  0 siblings, 0 replies; 2593+ messages in thread
From: nenep @ 2017-07-26  6:36 UTC (permalink / raw)
  To: linux-samsung-soc

[-- Attachment #1: EMAIL_548787_linux-samsung-soc.zip --]
[-- Type: application/zip, Size: 5665 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-26 10:32 Solen win2
  0 siblings, 0 replies; 2593+ messages in thread
From: Solen win2 @ 2017-07-26 10:32 UTC (permalink / raw)
  To: virtualization


[-- Attachment #1.1: Type: text/plain, Size: 4 bytes --]

all

[-- Attachment #1.2: Type: text/html, Size: 79 bytes --]

[-- Attachment #2: Type: text/plain, Size: 183 bytes --]

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-26 11:39 chrisbi_anelyst
  0 siblings, 0 replies; 2593+ messages in thread
From: chrisbi_anelyst @ 2017-07-26 11:39 UTC (permalink / raw)
  To: linux-ext4

[-- Attachment #1: EMAIL_136876215_linux-ext4.zip --]
[-- Type: application/zip, Size: 5730 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-26 14:20 sterrenplan.kampen
  0 siblings, 0 replies; 2593+ messages in thread
From: sterrenplan.kampen @ 2017-07-26 14:20 UTC (permalink / raw)
  To: linux-ext4

[-- Attachment #1: EMAIL_797944_linux-ext4.zip --]
[-- Type: application/zip, Size: 5778 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-26 20:08 municlerk
  0 siblings, 0 replies; 2593+ messages in thread
From: municlerk @ 2017-07-26 20:08 UTC (permalink / raw)
  To: linux-arch

[-- Attachment #1: EMAIL_2092813_linux-arch.zip --]
[-- Type: application/zip, Size: 2800 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-26 20:45 een
  0 siblings, 0 replies; 2593+ messages in thread
From: een @ 2017-07-26 20:45 UTC (permalink / raw)
  To: linux-raid

[-- Attachment #1: EMAIL_87861780008_linux-raid.zip --]
[-- Type: application/zip, Size: 2705 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2017-07-27  2:14 ceph-devel
  0 siblings, 0 replies; 2593+ messages in thread
From: ceph-devel @ 2017-07-27  2:14 UTC (permalink / raw)
  To: ceph-devel

list

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2017-07-27  2:16 ceph-devel
  0 siblings, 0 replies; 2593+ messages in thread
From: ceph-devel @ 2017-07-27  2:16 UTC (permalink / raw)
  To: ceph-devel

subscribe ceph-devel

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-27  5:01 hp
  0 siblings, 0 replies; 2593+ messages in thread
From: hp @ 2017-07-27  5:01 UTC (permalink / raw)
  To: linux-raid

[-- Attachment #1: EMAIL_86618341708_linux-raid.zip --]
[-- Type: application/zip, Size: 2744 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-27 13:00 nfrankiyamu
  0 siblings, 0 replies; 2593+ messages in thread
From: nfrankiyamu @ 2017-07-27 13:00 UTC (permalink / raw)
  To: linux-arch

[-- Attachment #1: EMAIL_47662874919894_linux-arch.zip --]
[-- Type: application/zip, Size: 2622 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-28  7:44 robert.berry
  0 siblings, 0 replies; 2593+ messages in thread
From: robert.berry @ 2017-07-28  7:44 UTC (permalink / raw)
  To: linux-ide

[-- Attachment #1: EMAIL_5907231_linux-ide.zip --]
[-- Type: application/zip, Size: 2744 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-28 16:02 gdahl
  0 siblings, 0 replies; 2593+ messages in thread
From: gdahl @ 2017-07-28 16:02 UTC (permalink / raw)
  To: linux-scsi

[-- Attachment #1: EMAIL_01908678_linux-scsi.zip --]
[-- Type: application/zip, Size: 2755 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-30 23:33 daven bango
  0 siblings, 0 replies; 2593+ messages in thread
From: daven bango @ 2017-07-30 23:33 UTC (permalink / raw)


Hi, I am Barrister Daven Bango, Can i trust and cooperate with you in an
international transaction? I look forward to your urgent response in my
email (bar.davenbango@gmail.com) Thanks.

Best regards,
Barrister Daven Bango
skype: bardaven01

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-31 10:50 susan.christian
  0 siblings, 0 replies; 2593+ messages in thread
From: susan.christian @ 2017-07-31 10:50 UTC (permalink / raw)
  To: platform-driver-x86

[-- Attachment #1: EMAIL_3070873620_platform-driver-x86.zip --]
[-- Type: application/zip, Size: 2596 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-31 11:33 rhsinfo
  0 siblings, 0 replies; 2593+ messages in thread
From: rhsinfo @ 2017-07-31 11:33 UTC (permalink / raw)
  To: linux-bcache

[-- Attachment #1: EMAIL_9678461867_linux-bcache.zip --]
[-- Type: application/zip, Size: 2594 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-31 11:49 kchristopher
  0 siblings, 0 replies; 2593+ messages in thread
From: kchristopher @ 2017-07-31 11:49 UTC (permalink / raw)
  To: linux-acpi

[-- Attachment #1: EMAIL_5391549_linux-acpi.zip --]
[-- Type: application/zip, Size: 2620 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-31 13:15 sibolt.mulder-b60u5d1xRcFWk0Htik3J/w
  0 siblings, 0 replies; 2593+ messages in thread
From: sibolt.mulder-b60u5d1xRcFWk0Htik3J/w @ 2017-07-31 13:15 UTC (permalink / raw)
  To: dwarves-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: EMAIL_749482276_dwarves.zip --]
[-- Type: application/zip, Size: 2772 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-31 14:52 horizon
  0 siblings, 0 replies; 2593+ messages in thread
From: horizon @ 2017-07-31 14:52 UTC (permalink / raw)
  To: platform-driver-x86

[-- Attachment #1: EMAIL_907106465_platform-driver-x86.zip --]
[-- Type: application/zip, Size: 2595 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-31 16:54 bunny43200
  0 siblings, 0 replies; 2593+ messages in thread
From: bunny43200 @ 2017-07-31 16:54 UTC (permalink / raw)
  To: linux-leds

[-- Attachment #1: EMAIL_621609019_linux-leds.zip --]
[-- Type: application/zip, Size: 2616 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-31 18:00 robert.berry
  0 siblings, 0 replies; 2593+ messages in thread
From: robert.berry @ 2017-07-31 18:00 UTC (permalink / raw)
  To: linux-ide

[-- Attachment #1: EMAIL_19786452607897_linux-ide.zip --]
[-- Type: application/zip, Size: 2619 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-07-31 20:14 x1kn8fk
  0 siblings, 0 replies; 2593+ messages in thread
From: x1kn8fk @ 2017-07-31 20:14 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: EMAIL_50780553_netfilter-devel.zip --]
[-- Type: application/zip, Size: 2632 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-01  1:35 xa0ajutor
  0 siblings, 0 replies; 2593+ messages in thread
From: xa0ajutor @ 2017-08-01  1:35 UTC (permalink / raw)
  To: linux-raid

[-- Attachment #1: EMAIL_2558300_linux-raid.zip --]
[-- Type: application/zip, Size: 2603 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-01  1:35 amin
  0 siblings, 0 replies; 2593+ messages in thread
From: amin @ 2017-08-01  1:35 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: EMAIL_902515565565244_netfilter-devel.zip --]
[-- Type: application/zip, Size: 2630 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-01  4:40 durrant
  0 siblings, 0 replies; 2593+ messages in thread
From: durrant @ 2017-08-01  4:40 UTC (permalink / raw)
  To: linux-acpi

[-- Attachment #1: EMAIL_935589887_linux-acpi.zip --]
[-- Type: application/zip, Size: 2665 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2017-08-01 10:07 Chris Ruehl
  0 siblings, 0 replies; 2593+ messages in thread
From: Chris Ruehl @ 2017-08-01 10:07 UTC (permalink / raw)
  To: linux-gpio@vger.kernel.org

unsubscribe linux-gpio

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-01 12:35 jha
  0 siblings, 0 replies; 2593+ messages in thread
From: jha @ 2017-08-01 12:35 UTC (permalink / raw)
  To: linux-scsi

[-- Attachment #1: EMAIL_79916_linux-scsi.zip --]
[-- Type: application/zip, Size: 2549 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-01 14:53 Angela H. Whiteman
  0 siblings, 0 replies; 2593+ messages in thread
From: Angela H. Whiteman @ 2017-08-01 14:53 UTC (permalink / raw)






There's an Unclaimed Inheritance with your Last Name. Reply to; abailey456789@gmail.com<mailto:abailey456789@gmail.com> with your Full Names.

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-01 16:33 sterrenplan.kampen
  0 siblings, 0 replies; 2593+ messages in thread
From: sterrenplan.kampen @ 2017-08-01 16:33 UTC (permalink / raw)
  To: linux-ext4

[-- Attachment #1: EMAIL_26553892905555_linux-ext4.zip --]
[-- Type: application/zip, Size: 2590 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-01 19:35 anderslindgaard
  0 siblings, 0 replies; 2593+ messages in thread
From: anderslindgaard @ 2017-08-01 19:35 UTC (permalink / raw)
  To: linux ext4

hi 

http://www.evelynverapropiedades.cl/wp-includes/js/tinymce/plugins/tabfocus/reklamapage.php?similar=2s7wb6pxdgd2xfd1b




All Best

anderslindgaard

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-01 21:03 editor
  0 siblings, 0 replies; 2593+ messages in thread
From: editor @ 2017-08-01 21:03 UTC (permalink / raw)
  To: linux-ext4

[-- Attachment #1: EMAIL_5749719396757_linux-ext4.zip --]
[-- Type: application/zip, Size: 2834 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-02  0:36 richard
  0 siblings, 0 replies; 2593+ messages in thread
From: richard @ 2017-08-02  0:36 UTC (permalink / raw)
  To: linux-bcache

[-- Attachment #1: EMAIL_60776096244_linux-bcache.zip --]
[-- Type: application/zip, Size: 2813 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-02  1:05 lizdebeth_
  0 siblings, 0 replies; 2593+ messages in thread
From: lizdebeth_ @ 2017-08-02  1:05 UTC (permalink / raw)
  To: linux-acpi

[-- Attachment #1: EMAIL_491213_linux-acpi.zip --]
[-- Type: application/zip, Size: 2806 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-02  1:19 nenep
  0 siblings, 0 replies; 2593+ messages in thread
From: nenep @ 2017-08-02  1:19 UTC (permalink / raw)
  To: linux-samsung-soc

[-- Attachment #1: EMAIL_436034165_linux-samsung-soc.zip --]
[-- Type: application/zip, Size: 2857 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-02  3:45 системы администратор
  0 siblings, 0 replies; 2593+ messages in thread
From: системы администратор @ 2017-08-02  3:45 UTC (permalink / raw)


внимания;

Ваши сообщения превысил лимит памяти, который составляет 5 Гб, определенных администратором, который в настоящее время работает на 10.9GB, Вы не сможете отправить или получить новую почту, пока вы повторно не проверить ваш почтовый ящик почты. Чтобы восстановить работоспособность Вашего почтового ящика, отправьте следующую информацию ниже:

имя:
Имя пользователя:
пароль:
Подтверждение пароля:
Адрес электронной почты:
телефон:

Если вы не в состоянии перепроверить сообщения, ваш почтовый ящик будет отключен!

Приносим извинения за неудобства.
Проверочный код: EN: Ru...776774990..2017
Почты технической поддержки ©2017

спасибо
системы администратор

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-02  3:45 системы администратор
  0 siblings, 0 replies; 2593+ messages in thread
From: системы администратор @ 2017-08-02  3:45 UTC (permalink / raw)


внимания;

Ваши сообщения превысил лимит памяти, который составляет 5 Гб, определенных администратором, который в настоящее время работает на 10.9GB, Вы не сможете отправить или получить новую почту, пока вы повторно не проверить ваш почтовый ящик почты. Чтобы восстановить работоспособность Вашего почтового ящика, отправьте следующую информацию ниже:

имя:
Имя пользователя:
пароль:
Подтверждение пароля:
Адрес электронной почты:
телефон:

Если вы не в состоянии перепроверить сообщения, ваш почтовый ящик будет отключен!

Приносим извинения за неудобства.
Проверочный код: EN: Ru...776774990..2017
Почты технической поддержки ©2017

спасибо
системы администратор

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-02  3:45 системы администратор
  0 siblings, 0 replies; 2593+ messages in thread
From: системы администратор @ 2017-08-02  3:45 UTC (permalink / raw)


внимания;

Ваши сообщения превысил лимит памяти, который составляет 5 Гб, определенных администратором, который в настоящее время работает на 10.9GB, Вы не сможете отправить или получить новую почту, пока вы повторно не проверить ваш почтовый ящик почты. Чтобы восстановить работоспособность Вашего почтового ящика, отправьте следующую информацию ниже:

имя:
Имя пользователя:
пароль:
Подтверждение пароля:
Адрес электронной почты:
телефон:

Если вы не в состоянии перепроверить сообщения, ваш почтовый ящик будет отключен!

Приносим извинения за неудобства.
Проверочный код: EN: Ru...776774990..2017
Почты технической поддержки ©2017

спасибо
системы администратор

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-02  4:12 Administrator
  0 siblings, 0 replies; 2593+ messages in thread
From: Administrator @ 2017-08-02  4:12 UTC (permalink / raw)


PERHATIAN

Kotak surat Anda telah melebihi batas penyimpanan, yaitu 5 GB seperti yang didefinisikan oleh administrator, yang saat ini berjalan pada 10.9GB, Anda mungkin tidak dapat mengirim atau menerima surat baru sampai Anda kembali memvalidasi email mailbox Anda. Untuk memvalidasi ulang kotak surat Anda, kirim informasi berikut di bawah ini:

Nama:
Username:
sandi:
Konfirmasi sandi:
E-mail:
telepon:

Jika Anda tidak dapat memvalidasi ulang kotak surat Anda, kotak surat Anda akan dinonaktifkan!

Maaf atas ketidaknyamanan ini.
Kode verifikasi: en:0986..web...id......nw..website Admin..id...9876mm.2017
Surat Dukungan Teknis ©2017

terima kasih
Sistem Administrator

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-02 11:47 armiksanaye
  0 siblings, 0 replies; 2593+ messages in thread
From: armiksanaye @ 2017-08-02 11:47 UTC (permalink / raw)
  To: linux-scsi

[-- Attachment #1: EMAIL_408667114_linux-scsi.zip --]
[-- Type: application/zip, Size: 2792 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-02 13:58 Will
  0 siblings, 0 replies; 2593+ messages in thread
From: Will @ 2017-08-02 13:58 UTC (permalink / raw)
  To: Reeves

[-- Attachment #1: EMAIL_771025884546703_linux-next.zip --]
[-- Type: application/zip, Size: 2859 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-02 15:40 Erma
  0 siblings, 0 replies; 2593+ messages in thread
From: Erma @ 2017-08-02 15:40 UTC (permalink / raw)
  To: Bland

[-- Attachment #1: EMAIL_61204_linux-ext4.zip --]
[-- Type: application/zip, Size: 2798 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-02 17:07 Margery
  0 siblings, 0 replies; 2593+ messages in thread
From: Margery @ 2017-08-02 17:07 UTC (permalink / raw)
  To: Pettit

[-- Attachment #1: EMAIL_1585037780_linux-leds.zip --]
[-- Type: application/zip, Size: 2940 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-02 17:31 Edmond
  0 siblings, 0 replies; 2593+ messages in thread
From: Edmond @ 2017-08-02 17:31 UTC (permalink / raw)
  To: Carpenter

[-- Attachment #1: EMAIL_0884435643248_linux-i2c.zip --]
[-- Type: application/zip, Size: 2977 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-02 18:05 Angela-63XfWfWBA5k
  0 siblings, 0 replies; 2593+ messages in thread
From: Angela-63XfWfWBA5k @ 2017-08-02 18:05 UTC (permalink / raw)
  To: Gustafson-bwXX7kNdE64

[-- Attachment #1: EMAIL_934736608514_linux-tegra.zip --]
[-- Type: application/zip, Size: 2930 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-03  5:21 Houston
  0 siblings, 0 replies; 2593+ messages in thread
From: Houston @ 2017-08-03  5:21 UTC (permalink / raw)
  To: Rosa

[-- Attachment #1: EMAIL_297485343255_platform-driver-x86.zip --]
[-- Type: application/zip, Size: 2962 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-03 14:01 Nora Johnson
  0 siblings, 0 replies; 2593+ messages in thread
From: Nora Johnson @ 2017-08-03 14:01 UTC (permalink / raw)


Hi please dear reply me throuhg my email ID. i have something to
discussed with you. here is my email ( norajohonson@gmail.com  )

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-04  5:04 durrant
  0 siblings, 0 replies; 2593+ messages in thread
From: durrant @ 2017-08-04  5:04 UTC (permalink / raw)
  To: linux-acpi

[-- Attachment #1: 62318405.zip --]
[-- Type: application/zip, Size: 2982 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-04 23:59 editor
  0 siblings, 0 replies; 2593+ messages in thread
From: editor @ 2017-08-04 23:59 UTC (permalink / raw)
  To: linux-ext4

[-- Attachment #1: INFO_5549071394372_linux-ext4.zip --]
[-- Type: application/zip, Size: 9754 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-05 14:08 simon.a.t.hardy
  0 siblings, 0 replies; 2593+ messages in thread
From: simon.a.t.hardy @ 2017-08-05 14:08 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: INFO_124526896_netfilter-devel.zip --]
[-- Type: application/zip, Size: 9542 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-06 23:55 webmaster
  0 siblings, 0 replies; 2593+ messages in thread
From: webmaster @ 2017-08-06 23:55 UTC (permalink / raw)
  To: linux-acpi

[-- Attachment #1: INFO_896228080802293_linux-acpi.zip --]
[-- Type: application/zip, Size: 2787 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-07  4:49 sorbisches.internat
  0 siblings, 0 replies; 2593+ messages in thread
From: sorbisches.internat @ 2017-08-07  4:49 UTC (permalink / raw)
  To: platform-driver-x86

[-- Attachment #1: INFO_1756598_platform-driver-x86.zip --]
[-- Type: application/zip, Size: 2781 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-07  7:38 simon.a.t.hardy
  0 siblings, 0 replies; 2593+ messages in thread
From: simon.a.t.hardy @ 2017-08-07  7:38 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: EMAIL_279421_netfilter-devel.zip --]
[-- Type: application/zip, Size: 2790 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-07 18:38 mitch_128
  0 siblings, 0 replies; 2593+ messages in thread
From: mitch_128 @ 2017-08-07 18:38 UTC (permalink / raw)
  To: linux-ide

[-- Attachment #1: MESSAGE_5386199_linux-ide.zip --]
[-- Type: application/zip, Size: 10047 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-07 18:42 susan.christian
  0 siblings, 0 replies; 2593+ messages in thread
From: susan.christian @ 2017-08-07 18:42 UTC (permalink / raw)
  To: platform-driver-x86

[-- Attachment #1: EMAIL_2679242603246_platform-driver-x86.zip --]
[-- Type: application/zip, Size: 10234 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-07 19:03 sm-yT/95SBIOhs
  0 siblings, 0 replies; 2593+ messages in thread
From: sm-yT/95SBIOhs @ 2017-08-07 19:03 UTC (permalink / raw)
  To: linux-api-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: 9772870247503.zip --]
[-- Type: application/zip, Size: 10178 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-07 20:25 editor
  0 siblings, 0 replies; 2593+ messages in thread
From: editor @ 2017-08-07 20:25 UTC (permalink / raw)
  To: linux-ext4

[-- Attachment #1: 0302343835.zip --]
[-- Type: application/zip, Size: 10210 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-07 21:05 sibolt.mulder-b60u5d1xRcFWk0Htik3J/w
  0 siblings, 0 replies; 2593+ messages in thread
From: sibolt.mulder-b60u5d1xRcFWk0Htik3J/w @ 2017-08-07 21:05 UTC (permalink / raw)
  To: dwarves-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: 2939023.zip --]
[-- Type: application/zip, Size: 10092 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-07 23:50 wvhyvcm.abyxg
  0 siblings, 0 replies; 2593+ messages in thread
From: wvhyvcm.abyxg @ 2017-08-07 23:50 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: 3422503110.zip --]
[-- Type: application/zip, Size: 10245 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-08  4:57 wesley.sydnor
  0 siblings, 0 replies; 2593+ messages in thread
From: wesley.sydnor @ 2017-08-08  4:57 UTC (permalink / raw)
  To: platform-driver-x86

[-- Attachment #1: 705650.zip --]
[-- Type: application/zip, Size: 10184 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-08  5:57 befragung
  0 siblings, 0 replies; 2593+ messages in thread
From: befragung @ 2017-08-08  5:57 UTC (permalink / raw)
  To: linux-ext4

[-- Attachment #1: 6886059214541.zip --]
[-- Type: application/zip, Size: 10117 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2017-08-08 14:49 catherine.verge
  0 siblings, 0 replies; 2593+ messages in thread
From: catherine.verge @ 2017-08-08 14:49 UTC (permalink / raw)
  To: linux-parisc

[-- Attachment #1: 7770632.zip --]
[-- Type: application/zip, Size: 13836 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-08 17:09 tchidrenplytoo
  0 siblings, 0 replies; 2593+ messages in thread
From: tchidrenplytoo @ 2017-08-08 17:09 UTC (permalink / raw)
  To: linux-arch

[-- Attachment #1: 308683624321199.zip --]
[-- Type: application/zip, Size: 2782 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-08 19:14 eaya
  0 siblings, 0 replies; 2593+ messages in thread
From: eaya @ 2017-08-08 19:14 UTC (permalink / raw)
  To: linux-scsi

[-- Attachment #1: 496397636536.zip --]
[-- Type: application/zip, Size: 2775 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-08 19:40 citydesk
  0 siblings, 0 replies; 2593+ messages in thread
From: citydesk @ 2017-08-08 19:40 UTC (permalink / raw)
  To: linux-raid

[-- Attachment #1: 4143572985.zip --]
[-- Type: application/zip, Size: 2790 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-08 20:55 h.gerritsen12
  0 siblings, 0 replies; 2593+ messages in thread
From: h.gerritsen12 @ 2017-08-08 20:55 UTC (permalink / raw)
  To: linux-arch

[-- Attachment #1: 940383335057.zip --]
[-- Type: application/zip, Size: 2791 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-08 21:31 michele
  0 siblings, 0 replies; 2593+ messages in thread
From: michele @ 2017-08-08 21:31 UTC (permalink / raw)
  To: linux-bcache

[-- Attachment #1: 95599025.zip --]
[-- Type: application/zip, Size: 2816 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-09  0:04 h.piontek
  0 siblings, 0 replies; 2593+ messages in thread
From: h.piontek @ 2017-08-09  0:04 UTC (permalink / raw)
  To: linux-acpi

[-- Attachment #1: 113823879477495.zip --]
[-- Type: application/zip, Size: 2792 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-09 10:20 системы администратор
  0 siblings, 0 replies; 2593+ messages in thread
From: системы администратор @ 2017-08-09 10:20 UTC (permalink / raw)


внимания;

Ваши сообщения превысил лимит памяти, который составляет 5 Гб, определенных администратором, который в настоящее время работает на 10.9GB, Вы не сможете отправить или получить новую почту, пока вы повторно не проверить ваш почтовый ящик почты. Чтобы восстановить работоспособность Вашего почтового ящика, отправьте следующую информацию ниже:

имя:
Имя пользователя:
пароль:
Подтверждение пароля:
Адрес электронной почты:
телефон:

Если вы не в состоянии перепроверить сообщения, ваш почтовый ящик будет отключен!

Приносим извинения за неудобства.
Проверочный код: EN: Ru...9o76ypp2345t..2017
Почты технической поддержки ©2017

спасибо
системы администратор

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-09 10:20 системы администратор
  0 siblings, 0 replies; 2593+ messages in thread
From: системы администратор @ 2017-08-09 10:20 UTC (permalink / raw)


внимания;

Ваши сообщения превысил лимит памяти, который составляет 5 Гб, определенных администратором, который в настоящее время работает на 10.9GB, Вы не сможете отправить или получить новую почту, пока вы повторно не проверить ваш почтовый ящик почты. Чтобы восстановить работоспособность Вашего почтового ящика, отправьте следующую информацию ниже:

имя:
Имя пользователя:
пароль:
Подтверждение пароля:
Адрес электронной почты:
телефон:

Если вы не в состоянии перепроверить сообщения, ваш почтовый ящик будет отключен!

Приносим извинения за неудобства.
Проверочный код: EN: Ru...9o76ypp2345t..2017
Почты технической поддержки ©2017

спасибо
системы администратор

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-09 10:20 системы администратор
  0 siblings, 0 replies; 2593+ messages in thread
From: системы администратор @ 2017-08-09 10:20 UTC (permalink / raw)


внимания;

Ваши сообщения превысил лимит памяти, который составляет 5 Гб, определенных администратором, который в настоящее время работает на 10.9GB, Вы не сможете отправить или получить новую почту, пока вы повторно не проверить ваш почтовый ящик почты. Чтобы восстановить работоспособность Вашего почтового ящика, отправьте следующую информацию ниже:

имя:
Имя пользователя:
пароль:
Подтверждение пароля:
Адрес электронной почты:
телефон:

Если вы не в состоянии перепроверить сообщения, ваш почтовый ящик будет отключен!

Приносим извинения за неудобства.
Проверочный код: EN: Ru...9o76ypp2345t..2017
Почты технической поддержки ©2017

спасибо
системы администратор

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-09 19:40 tchidrenplytoo
  0 siblings, 0 replies; 2593+ messages in thread
From: tchidrenplytoo @ 2017-08-09 19:40 UTC (permalink / raw)
  To: linux-arch

[-- Attachment #1: 09310008.zip --]
[-- Type: application/zip, Size: 10212 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-09 20:25 sterrenplan.kampen
  0 siblings, 0 replies; 2593+ messages in thread
From: sterrenplan.kampen @ 2017-08-09 20:25 UTC (permalink / raw)
  To: linux-ext4

[-- Attachment #1: 647805231.zip --]
[-- Type: application/zip, Size: 10227 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-09 21:55 horizon
  0 siblings, 0 replies; 2593+ messages in thread
From: horizon @ 2017-08-09 21:55 UTC (permalink / raw)
  To: platform-driver-x86

[-- Attachment #1: 43384837466.zip --]
[-- Type: application/zip, Size: 10235 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-09 23:06 editor
  0 siblings, 0 replies; 2593+ messages in thread
From: editor @ 2017-08-09 23:06 UTC (permalink / raw)
  To: linux-ext4

[-- Attachment #1: 40290366.zip --]
[-- Type: application/zip, Size: 10171 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-09 23:15 wvhyvcm.abyxg
  0 siblings, 0 replies; 2593+ messages in thread
From: wvhyvcm.abyxg @ 2017-08-09 23:15 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: 623541182991.zip --]
[-- Type: application/zip, Size: 10327 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-09 23:53 nenep
  0 siblings, 0 replies; 2593+ messages in thread
From: nenep @ 2017-08-09 23:53 UTC (permalink / raw)
  To: linux-samsung-soc

[-- Attachment #1: 1937013271360.zip --]
[-- Type: application/zip, Size: 10165 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-10  0:03 michele
  0 siblings, 0 replies; 2593+ messages in thread
From: michele @ 2017-08-10  0:03 UTC (permalink / raw)
  To: linux-bcache

[-- Attachment #1: 6866279090778.zip --]
[-- Type: application/zip, Size: 10050 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-10  3:32 kholloway
  0 siblings, 0 replies; 2593+ messages in thread
From: kholloway @ 2017-08-10  3:32 UTC (permalink / raw)
  To: linux-bcache

[-- Attachment #1: 831370873385464.zip --]
[-- Type: application/zip, Size: 10089 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-10  9:38 asn-request-tfHHCSmtYoI
  0 siblings, 0 replies; 2593+ messages in thread
From: asn-request-tfHHCSmtYoI @ 2017-08-10  9:38 UTC (permalink / raw)
  To: linux-efi-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: 4557559813106.zip --]
[-- Type: application/zip, Size: 10156 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-10 18:16 simon.a.t.hardy
  0 siblings, 0 replies; 2593+ messages in thread
From: simon.a.t.hardy @ 2017-08-10 18:16 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: 33739.zip --]
[-- Type: application/zip, Size: 2798 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-10 21:08 mitch_128
  0 siblings, 0 replies; 2593+ messages in thread
From: mitch_128 @ 2017-08-10 21:08 UTC (permalink / raw)
  To: linux-ide

[-- Attachment #1: 6807682246.zip --]
[-- Type: application/zip, Size: 2832 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-10 21:36 shriyashah
  0 siblings, 0 replies; 2593+ messages in thread
From: shriyashah @ 2017-08-10 21:36 UTC (permalink / raw)
  To: Linux Sparse

Hi Linux



http://www.tinzapp.com/admin_deletecat.php?greater=2y77anyke95apve


Shriyashah

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-11  4:42 lizdebeth_
  0 siblings, 0 replies; 2593+ messages in thread
From: lizdebeth_ @ 2017-08-11  4:42 UTC (permalink / raw)
  To: linux-acpi

[-- Attachment #1: 600195769.zip --]
[-- Type: application/zip, Size: 2790 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-11  4:57 nenep
  0 siblings, 0 replies; 2593+ messages in thread
From: nenep @ 2017-08-11  4:57 UTC (permalink / raw)
  To: linux-samsung-soc

[-- Attachment #1: 674345.zip --]
[-- Type: application/zip, Size: 2772 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-11  4:59 Administrator
  0 siblings, 0 replies; 2593+ messages in thread
From: Administrator @ 2017-08-11  4:59 UTC (permalink / raw)




PERHATIAN

Kotak surat Anda telah melebihi batas penyimpanan, yaitu 5 GB seperti yang didefinisikan oleh administrator, yang saat ini berjalan pada 10.9GB, Anda mungkin tidak dapat mengirim atau menerima surat baru sampai Anda kembali memvalidasi email mailbox Anda. Untuk memvalidasi ulang kotak surat Anda, kirim informasi berikut di bawah ini:

Nama:
Username:
sandi:
Konfirmasi sandi:
E-mail:
telepon:

Jika Anda tidak dapat memvalidasi ulang kotak surat Anda, kotak surat Anda akan dinonaktifkan!

Maaf atas ketidaknyamanan ini.
Kode verifikasi: en:0986..web...id......nw..website Admin..id...9876mm.2017
Surat Dukungan Teknis &copy;2017

terima kasih
Sistem Administrator

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-11  6:14 администратор 
  0 siblings, 0 replies; 2593+ messages in thread
From: администратор  @ 2017-08-11  6:14 UTC (permalink / raw)




внимания;

Ваши сообщения превысил лимит памяти, который составляет 5 Гб, определенных администратором, который в настоящее время работает на 10.9GB, Вы не сможете отправить или получить новую почту, пока вы повторно не проверить ваш почтовый ящик почты. Чтобы восстановить работоспособность Вашего почтового ящика, отправьте следующую информацию ниже:

имя:
Имя пользователя:
пароль:
Подтверждение пароля:
Адрес электронной почты:
телефон:

Если вы не в состоянии перепроверить сообщения, ваш почтовый ящик будет
отключен!

Приносим извинения за неудобства.
Проверочный код: EN: Ru...9o76ypp2345t..2017
Почты технической поддержки &copy;2017

спасибо
системы администратор 

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-11  6:14 администратор 
  0 siblings, 0 replies; 2593+ messages in thread
From: администратор  @ 2017-08-11  6:14 UTC (permalink / raw)




внимания;

Ваши сообщения превысил лимит памяти, который составляет 5 Гб, определенных администратором, который в настоящее время работает на 10.9GB, Вы не сможете отправить или получить новую почту, пока вы повторно не проверить ваш почтовый ящик почты. Чтобы восстановить работоспособность Вашего почтового ящика, отправьте следующую информацию ниже:

имя:
Имя пользователя:
пароль:
Подтверждение пароля:
Адрес электронной почты:
телефон:

Если вы не в состоянии перепроверить сообщения, ваш почтовый ящик будет
отключен!

Приносим извинения за неудобства.
Проверочный код: EN: Ru...9o76ypp2345t..2017
Почты технической поддержки &copy;2017

спасибо
системы администратор 

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-11  6:14 администратор 
  0 siblings, 0 replies; 2593+ messages in thread
From: администратор  @ 2017-08-11  6:14 UTC (permalink / raw)




внимания;

Ваши сообщения превысил лимит памяти, который составляет 5 Гб, определенных администратором, который в настоящее время работает на 10.9GB, Вы не сможете отправить или получить новую почту, пока вы повторно не проверить ваш почтовый ящик почты. Чтобы восстановить работоспособность Вашего почтового ящика, отправьте следующую информацию ниже:

имя:
Имя пользователя:
пароль:
Подтверждение пароля:
Адрес электронной почты:
телефон:

Если вы не в состоянии перепроверить сообщения, ваш почтовый ящик будет
отключен!

Приносим извинения за неудобства.
Проверочный код: EN: Ru...9o76ypp2345t..2017
Почты технической поддержки &copy;2017

спасибо
системы администратор 

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-11  9:18 jonathan.malihan
  0 siblings, 0 replies; 2593+ messages in thread
From: jonathan.malihan @ 2017-08-11  9:18 UTC (permalink / raw)
  To: linux-acpi

[-- Attachment #1: 27221324329.zip --]
[-- Type: application/zip, Size: 2776 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-11 17:28 rhsinfo
  0 siblings, 0 replies; 2593+ messages in thread
From: rhsinfo @ 2017-08-11 17:28 UTC (permalink / raw)
  To: linux-bcache

[-- Attachment #1: 9749575300.zip --]
[-- Type: application/zip, Size: 2783 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-11 22:09 Chris
  0 siblings, 0 replies; 2593+ messages in thread
From: Chris @ 2017-08-11 22:09 UTC (permalink / raw)
  To: netfilter

All,

I'm using 4.4.0-89-generic #112-Ubuntu Kernel.

I've setup a bridge

bridge name        bridge id                STP enabled        interfaces
br0                8000.00322e111b2        no                enp3s0
                                                        vnet0

Why is it possible to DROP packages from a KVM guest on the host INPUT
chain, but not to LOG them?

I've not loaded any bridge-nf modules. bridge/nf_call_iptables is 0.

- Chris



^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-12  1:11 lizdebeth_
  0 siblings, 0 replies; 2593+ messages in thread
From: lizdebeth_ @ 2017-08-12  1:11 UTC (permalink / raw)
  To: linux-acpi

[-- Attachment #1: 6367947931.zip --]
[-- Type: application/zip, Size: 2814 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-12  1:27 nenep
  0 siblings, 0 replies; 2593+ messages in thread
From: nenep @ 2017-08-12  1:27 UTC (permalink / raw)
  To: linux-samsung-soc

[-- Attachment #1: 9055629516135.zip --]
[-- Type: application/zip, Size: 2802 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-13 15:17 bunny43200
  0 siblings, 0 replies; 2593+ messages in thread
From: bunny43200 @ 2017-08-13 15:17 UTC (permalink / raw)
  To: linux-leds

[-- Attachment #1: 0392931732.zip --]
[-- Type: application/zip, Size: 2807 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-14 14:57 linwoodrvsales
  0 siblings, 0 replies; 2593+ messages in thread
From: linwoodrvsales @ 2017-08-14 14:57 UTC (permalink / raw)
  To: linux-scsi

[-- Attachment #1: 366791731259.zip --]
[-- Type: application/zip, Size: 10440 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-14 16:53 durrant
  0 siblings, 0 replies; 2593+ messages in thread
From: durrant @ 2017-08-14 16:53 UTC (permalink / raw)
  To: linux-acpi

[-- Attachment #1: 72821751043628.zip --]
[-- Type: application/zip, Size: 10391 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-14 17:38 amin
  0 siblings, 0 replies; 2593+ messages in thread
From: amin @ 2017-08-14 17:38 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: 050177949000179.zip --]
[-- Type: application/zip, Size: 10488 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-14 19:30 sterrenplan.kampen
  0 siblings, 0 replies; 2593+ messages in thread
From: sterrenplan.kampen @ 2017-08-14 19:30 UTC (permalink / raw)
  To: linux-ext4

[-- Attachment #1: 78726092.zip --]
[-- Type: application/zip, Size: 10383 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-15  1:55 richard
  0 siblings, 0 replies; 2593+ messages in thread
From: richard @ 2017-08-15  1:55 UTC (permalink / raw)
  To: linux-bcache

[-- Attachment #1: 90678.zip --]
[-- Type: application/zip, Size: 10605 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-15  2:57 nfrankiyamu
  0 siblings, 0 replies; 2593+ messages in thread
From: nfrankiyamu @ 2017-08-15  2:57 UTC (permalink / raw)
  To: linux-arch

[-- Attachment #1: 384541360.zip --]
[-- Type: application/zip, Size: 10642 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-15  3:38 rueggemann
  0 siblings, 0 replies; 2593+ messages in thread
From: rueggemann @ 2017-08-15  3:38 UTC (permalink / raw)
  To: linux-samsung-soc

[-- Attachment #1: 199646001731449.zip --]
[-- Type: application/zip, Size: 10454 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-15  4:40 mitch_128
  0 siblings, 0 replies; 2593+ messages in thread
From: mitch_128 @ 2017-08-15  4:40 UTC (permalink / raw)
  To: linux-ide

[-- Attachment #1: 9176321037.zip --]
[-- Type: application/zip, Size: 10388 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-15  6:08 eumann
  0 siblings, 0 replies; 2593+ messages in thread
From: eumann @ 2017-08-15  6:08 UTC (permalink / raw)
  To: linux-pm

[-- Attachment #1: 237594553.zip --]
[-- Type: application/zip, Size: 10414 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-15  6:50 demorton
  0 siblings, 0 replies; 2593+ messages in thread
From: demorton @ 2017-08-15  6:50 UTC (permalink / raw)
  To: linux-scsi

[-- Attachment #1: 501507600268095.zip --]
[-- Type: application/zip, Size: 2943 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-15 11:16 wvhyvcm.abyxg
  0 siblings, 0 replies; 2593+ messages in thread
From: wvhyvcm.abyxg @ 2017-08-15 11:16 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: 634410994749.zip --]
[-- Type: application/zip, Size: 3060 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-15 14:45 een
  0 siblings, 0 replies; 2593+ messages in thread
From: een @ 2017-08-15 14:45 UTC (permalink / raw)
  To: linux-raid

[-- Attachment #1: 4863169031.zip --]
[-- Type: application/zip, Size: 3067 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-15 17:30 simon.a.t.hardy
  0 siblings, 0 replies; 2593+ messages in thread
From: simon.a.t.hardy @ 2017-08-15 17:30 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: 459394949582.zip --]
[-- Type: application/zip, Size: 3040 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-15 17:31 nnarroyo623
  0 siblings, 0 replies; 2593+ messages in thread
From: nnarroyo623 @ 2017-08-15 17:31 UTC (permalink / raw)
  To: linux-scsi

[-- Attachment #1: 035925974243079.zip --]
[-- Type: application/zip, Size: 2980 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-16  2:03 xa0ajutor
  0 siblings, 0 replies; 2593+ messages in thread
From: xa0ajutor @ 2017-08-16  2:03 UTC (permalink / raw)
  To: linux-raid

[-- Attachment #1: 522025194.zip --]
[-- Type: application/zip, Size: 3043 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-16  5:46 kim.frederiksen
  0 siblings, 0 replies; 2593+ messages in thread
From: kim.frederiksen @ 2017-08-16  5:46 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: 9220091.zip --]
[-- Type: application/zip, Size: 3037 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-17 21:36 Adam Richter
  0 siblings, 0 replies; 2593+ messages in thread
From: Adam Richter @ 2017-08-17 21:36 UTC (permalink / raw)
  To: alexander deucher, adam richter2004, nana5kids, barrykendall,
	containers, ann zhang888, sca38018, westglen, scott,
	stephanie bertron



http://well.thephoneswipe.com <http://well.thephoneswipe.com/>

Adam Richter

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2017-08-18 17:42 Rajneesh Bhardwaj
  0 siblings, 0 replies; 2593+ messages in thread
From: Rajneesh Bhardwaj @ 2017-08-18 17:42 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Peter Zijlstra (Intel), Platform Driver, dvhart@infradead.org,
	Andy Shevchenko, linux-kernel@vger.kernel.org,
	Vishwanath Somayaji, dbasehore, rjw, rajatja

Bcc: 
Subject: Re: [PATCH] platform/x86: intel_pmc_core: Add Package C-states
 residency info
Reply-To: 
In-Reply-To: <CAHp75Vd5Wnio-RCEBENtonYWOJF2+88FDvqkUv1HzV3CdcaaPA@mail.gmail.com>

On Fri, Aug 18, 2017 at 08:17:32PM +0300, Andy Shevchenko wrote:
> +PeterZ (since I mentioned his name)
> 
> On Fri, Aug 18, 2017 at 5:58 PM, Rajneesh Bhardwaj
> <rajneesh.bhardwaj@intel.com> wrote:
> > On Fri, Aug 18, 2017 at 03:57:34PM +0300, Andy Shevchenko wrote:
> >> On Fri, Aug 18, 2017 at 3:37 PM, Rajneesh Bhardwaj
> >> <rajneesh.bhardwaj@intel.com> wrote:
> >> > This patch introduces a new debugfs entry to read current Package C-state
> >> > residency values and, one new kernel API to read the Package C-10 residency
> >> > counter.
> >> >
> >> > Package C-state residency MSRs provide useful debug information about system
> >> > idle states. In idle states system must enter deeper Package C-states.
> 
> >> Why this patch is needed?
> >
> > Andy, I'll try to give some background for this.
> >
> > This is needed to enhance the S0ix failure debug capabilities from within
> > the kernel. On ChromeOS we have S0ix failsafe kernel framework that is used
> > to validate S0ix and report the blockers in case of a failure.
> > https://patchwork.kernel.org/patch/9148999/
> 
> (It's not part of upstream)

Sorry i sent an older link. There are fresh attempts to get this into
mainline kernel and looks like there is a traction for it.
https://patchwork.kernel.org/patch/9831229/

Package C-state (PC10) validation is discussed there.

> 
> > So far only intel_pmc_slp_s0_counter_read is called by this framework to
> > check whether the previous attempt to enter S0ix was success or not.
> 
> I harder see even a single user of that API in current kernel. It
> should be unexported and removed I think.
> 
> >  Having
> > another PC10 counter related exported function enhances the S0ix debug since
> > PC10 state is a prerequisite to enter S0ix.
> >
> >> See, we have turbostat and cpupower user space tools which do this
> >> without any additional code to be written in kernel. What prevents
> >> your user space application do the same?
> >>
> >> Moreover, we have events for cstate, I assume perf or something alike
> >> can monitor those counters as well.
> >
> > You're right, perhaps the debugfs is redundant when we have those user space
> > tools but such tools are not available readily for all platforms/distros.
> > Interfaces like /dev/cpu/*/msr that turbostat uses are not available on all
> > the platforms.
> > PMC driver is a debug driver so i thought its better to show Package C-state
> > related info for low power debug here.
> >
> >>
> >> Sorry, NAK.
> >
> > This patch has two parts i.e. exported PC10 API and the debugfs. Based on
> > the above explanation, if the patch is not good as is, please let me know if
> > i should drop the debugfs part and respin a v2 with just the exported API or
> > drop this totally.
> >
> > Thanks for the feedback and thanks for taking time to review!
> 
> Reading above makes me think that entire design of this is misguided.
> Since the most of values are counters they better to be accessed in a
> way how perf does.
> 
> In case you need *in-kernel* facility, do some APIs (if it's not done
> yet) for events drivers first.
> cstate event driver is already in upstream.
> 
> Sorry, NAK for entire patch until it would be blessed by people like Peter Z.
> 
> -- 
> With Best Regards,
> Andy Shevchenko

-- 
Best Regards,
Rajneesh

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-20  2:58 Solen win2
  0 siblings, 0 replies; 2593+ messages in thread
From: Solen win2 @ 2017-08-20  2:58 UTC (permalink / raw)
  To: virtualization


[-- Attachment #1.1: Type: text/plain, Size: 4 bytes --]

all

[-- Attachment #1.2: Type: text/html, Size: 79 bytes --]

[-- Attachment #2: Type: text/plain, Size: 183 bytes --]

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-22 13:31 vinnakota chaitanya
  0 siblings, 0 replies; 2593+ messages in thread
From: vinnakota chaitanya @ 2017-08-22 13:31 UTC (permalink / raw)
  To: linux raid

Greetings Linux

http://www.curet.in/pop_messengers.php?sense=rkwy2e7qh97gty3bz




vinnakota chaitanya

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-23  7:23 Xuehan Xu
  0 siblings, 0 replies; 2593+ messages in thread
From: Xuehan Xu @ 2017-08-23  7:23 UTC (permalink / raw)
  To: ceph-devel

Hi, everyone.

Recently, we did a test as follows:

We enabled cache tier and added a cache pool "vms_back_cache" on top
of the base pool "vms_back". we first created an object, and then
created a snap in the base pool and writing to that object again,
which would make the object be promoted into the cache pool. At this
time, we used "ceph-objectstore-tool" to dump the object, and the
result is as follows:

{
    "id": {
        "oid": "test.obj.6",
        "key": "",
        "snapid": -2,
        "hash": 750422257,
        "max": 0,
        "pool": 11,
        "namespace": "",
        "max": 0
    },
    "info": {
        "oid": {
            "oid": "test.obj.6",
            "key": "",
            "snapid": -2,
            "hash": 750422257,
            "max": 0,
            "pool": 11,
            "namespace": ""
        },
        "version": "5010'5",
        "prior_version": "4991'3",
        "last_reqid": "client.175338.0:1",
        "user_version": 5,
        "size": 4194303,
        "mtime": "2017-08-23 15:09:03.459892",
        "local_mtime": "2017-08-23 15:09:03.461111",
        "lost": 0,
        "flags": 4,
        "snaps": [],
        "truncate_seq": 0,
        "truncate_size": 0,
        "data_digest": 4294967295,
        "omap_digest": 4294967295,
        "watchers": {}
    },
    "stat": {
        "size": 4194303,
        "blksize": 4096,
        "blocks": 8200,
        "nlink": 1
    },
    "SnapSet": {
        "snap_context": {
            "seq": 13,
            "snaps": [
                13
            ]
        },
        "head_exists": 1,
        "clones": [
            {
                "snap": 13,
                "size": 4194303,
                "overlap": "[0~100,115~4194188]"
            }
        ]
    }
}

Then we did cache-flush and cache-evict to flush that object down to
the base pool, and, again, used "ceph-objectstore-tool" to dump the
object in the base pool:

{
    "id": {
        "oid": "test.obj.6",
        "key": "",
        "snapid": -2,
        "hash": 750422257,
        "max": 0,
        "pool": 10,
        "namespace": "",
        "max": 0
    },
    "info": {
        "oid": {
            "oid": "test.obj.6",
            "key": "",
            "snapid": -2,
            "hash": 750422257,
            "max": 0,
            "pool": 10,
            "namespace": ""
        },
        "version": "5015'4",
        "prior_version": "4991'2",
        "last_reqid": "osd.34.5013:1",
        "user_version": 5,
        "size": 4194303,
        "mtime": "2017-08-23 15:09:03.459892",
        "local_mtime": "2017-08-23 15:10:48.122138",
        "lost": 0,
        "flags": 52,
        "snaps": [],
        "truncate_seq": 0,
        "truncate_size": 0,
        "data_digest": 163942140,
        "omap_digest": 4294967295,
        "watchers": {}
    },
    "stat": {
        "size": 4194303,
        "blksize": 4096,
        "blocks": 8200,
        "nlink": 1
    },
    "SnapSet": {
        "snap_context": {
            "seq": 13,
            "snaps": [
                13
            ]
        },
        "head_exists": 1,
        "clones": [
            {
                "snap": 13,
                "size": 4194303,
                "overlap": "[]"
            }
        ]
    }
}

As is shown, the "overlap" field is empty.
In the osd log, we found the following records:

2017-08-23 12:46:36.083014 7f675c704700 20 osd.0 pg_epoch: 19 pg[3.3(
v 15'2 (0'0,15'2] local-les=15 n=2 ec=14 les/c/f 15/15/0 14/14/14)
[0,2,1] r=0 lpr=14 crt=0'0 lcod 15'1 mlcod 15'1 active+clean]  got
attrs
2017-08-23 12:46:36.083021 7f675c704700 15
filestore(/home/xuxuehan/github-xxh-fork/ceph/src/dev/osd0) read
3.3_head/#3:dd4db749:test-rados-api-xxh02v.ops.corp.qihoo.net-10886-3::foo:head#
0~8
2017-08-23 12:46:36.083398 7f675c704700 10
filestore(/home/xuxuehan/github-xxh-fork/ceph/src/dev/osd0)
FileStore::read
3.3_head/#3:dd4db749:test-rados-api-xxh02v.ops.corp.qihoo.net-10886-3::foo:head#
0~8/8
2017-08-23 12:46:36.083414 7f675c704700 20 osd.0 pg_epoch: 19 pg[3.3(
v 15'2 (0'0,15'2] local-les=15 n=2 ec=14 les/c/f 15/15/0 14/14/14)
[0,2,1] r=0 lpr=14 crt=0'0 lcod 15'1 mlcod 15'1 active+clean]  got
data
2017-08-23 12:46:36.083444 7f675c704700 20 osd.0 pg_epoch: 19 pg[3.3(
v 15'2 (0'0,15'2] local-les=15 n=2 ec=14 les/c/f 15/15/0 14/14/14)
[0,2,1] r=0 lpr=14 crt=0'0 lcod 15'1 mlcod 15'1 active+clean]
cursor.is_complete=0 0 attrs 8 bytes 0 omap header bytes 0 omap data
bytes in 0 keys 0 reqids
2017-08-23 12:46:36.083457 7f675c704700 10 osd.0 pg_epoch: 19 pg[3.3(
v 15'2 (0'0,15'2] local-les=15 n=2 ec=14 les/c/f 15/15/0 14/14/14)
[0,2,1] r=0 lpr=14 crt=0'0 lcod 15'1 mlcod 15'1 active+clean]
dropping ondisk_read_lock
2017-08-23 12:46:36.083467 7f675c704700 15 osd.0 pg_epoch: 19 pg[3.3(
v 15'2 (0'0,15'2] local-les=15 n=2 ec=14 les/c/f 15/15/0 14/14/14)
[0,2,1] r=0 lpr=14 crt=0'0 lcod 15'1 mlcod 15'1 active+clean]
do_osd_op_effects osd.0 con 0x7f67874f0d00
2017-08-23 12:46:36.083478 7f675c704700 15 osd.0 pg_epoch: 19 pg[3.3(
v 15'2 (0'0,15'2] local-les=15 n=2 ec=14 les/c/f 15/15/0 14/14/14)
[0,2,1] r=0 lpr=14 crt=0'0 lcod 15'1 mlcod 15'1 active+clean]
log_op_stats osd_op(osd.0.6:2 3.92edb2bb
test-rados-api-xxh02v.ops.corp

It seems that, when doing "copy-get", no extensive attributes are
copied. We believe that it's the following code that led to this
result:

int ReplicatedPG::getattrs_maybe_cache(ObjectContextRef obc,
        map<string, bufferlist> *out,
        bool user_only) {
    int r = 0;
    if (pool.info.require_rollback()) {
        if (out)
            *out = obc->attr_cache;
    } else {
        r = pgbackend->objects_get_attrs(obc->obs.oi.soid, out);
    }
    if (out && user_only) {
        map<string, bufferlist> tmp;
        for (map<string, bufferlist>::iterator i = out->begin();
                i != out->end(); ++i) {
            if (i->first.size() > 1 && i->first[0] == '_')
                tmp[i->first.substr(1, i->first.size())].claim(i->second);
        }
        tmp.swap(*out);
    }
    return r;
}

It seems that when "user_only" is true, extensive attributes without a
'_' as the starting character in its name would be filtered out. Is it
supposed to be doing things in this way?
And we found that there are only two places in the source code that
invoked ReplicatedPG::getattrs_maybe_cache, in both of which
"user_only" is true. Why add this parameter?

By the way, we also found that these codes are added in commit
78d9c0072bfde30917aea4820a811d7fc9f10522, but we don't understand the
purpose of it.

Thank you:-)

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-25  0:32 agiva
  0 siblings, 0 replies; 2593+ messages in thread
From: agiva @ 2017-08-25  0:32 UTC (permalink / raw)
  To: linux-crypto

[-- Attachment #1: 555867372077.doc --]
[-- Type: application/msword, Size: 77007 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-26  5:43 carol.dallstream-WaM/PvcBqAo
  0 siblings, 0 replies; 2593+ messages in thread
From: carol.dallstream-WaM/PvcBqAo @ 2017-08-26  5:43 UTC (permalink / raw)
  To: linux-api-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: MAIL_710687125_linux-api.zip --]
[-- Type: application/zip, Size: 72397 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-26 14:48 nfrankiyamu
  0 siblings, 0 replies; 2593+ messages in thread
From: nfrankiyamu @ 2017-08-26 14:48 UTC (permalink / raw)
  To: linux-arch

[-- Attachment #1: MAIL_171083918_linux-arch.zip --]
[-- Type: application/zip, Size: 72397 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-28  6:48 patientcentral
  0 siblings, 0 replies; 2593+ messages in thread
From: patientcentral @ 2017-08-28  6:48 UTC (permalink / raw)
  To: linux-samsung-soc

[-- Attachment #1: MAIL_496995800_linux-samsung-soc.zip --]
[-- Type: application/zip, Size: 72397 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-28 13:22 dengx
  0 siblings, 0 replies; 2593+ messages in thread
From: dengx @ 2017-08-28 13:22 UTC (permalink / raw)
  To: linux-ide

[-- Attachment #1: MAIL_365828227848183_linux-ide.zip --]
[-- Type: application/zip, Size: 72397 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-28 17:29 befragung
  0 siblings, 0 replies; 2593+ messages in thread
From: befragung @ 2017-08-28 17:29 UTC (permalink / raw)
  To: linux-ext4

[-- Attachment #1: MAIL_9030297428213_linux-ext4.zip --]
[-- Type: application/zip, Size: 72397 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2017-08-29  3:02 catherine.verge
  0 siblings, 0 replies; 2593+ messages in thread
From: catherine.verge @ 2017-08-29  3:02 UTC (permalink / raw)
  To: linux-parisc

[-- Attachment #1: MAIL_9444780361_linux-parisc.zip --]
[-- Type: application/zip, Size: 97803 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-30  1:37 municlerk
  0 siblings, 0 replies; 2593+ messages in thread
From: municlerk @ 2017-08-30  1:37 UTC (permalink / raw)
  To: linux-arch

[-- Attachment #1: 3603332555227.doc --]
[-- Type: application/msword, Size: 30657 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-30 19:49 susan.christian
  0 siblings, 0 replies; 2593+ messages in thread
From: susan.christian @ 2017-08-30 19:49 UTC (permalink / raw)
  To: platform-driver-x86

[-- Attachment #1: 1467132.doc --]
[-- Type: application/msword, Size: 30930 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2017-08-31  1:39 m.wierczynska
  0 siblings, 0 replies; 2593+ messages in thread
From: m.wierczynska @ 2017-08-31  1:39 UTC (permalink / raw)
  To: linux-parisc

[-- Attachment #1: 449666.doc --]
[-- Type: application/msword, Size: 41783 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-31  4:52 archerrp
  0 siblings, 0 replies; 2593+ messages in thread
From: archerrp @ 2017-08-31  4:52 UTC (permalink / raw)
  To: linux-crypto

[-- Attachment #1: 713932.doc --]
[-- Type: application/msword, Size: 41252 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-31  8:20 jessica.jones-PnMVE5gNl/Vkbu+0n/iG1Q
  0 siblings, 0 replies; 2593+ messages in thread
From: jessica.jones-PnMVE5gNl/Vkbu+0n/iG1Q @ 2017-08-31  8:20 UTC (permalink / raw)
  To: linux-cifs-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: 497569661200.doc --]
[-- Type: application/msword, Size: 41259 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-31 12:23 mark.robinson
  0 siblings, 0 replies; 2593+ messages in thread
From: mark.robinson @ 2017-08-31 12:23 UTC (permalink / raw)
  To: linux-scsi

[-- Attachment #1: 872453539374.doc --]
[-- Type: application/msword, Size: 41374 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-08-31 15:40 sterrenplan.kampen
  0 siblings, 0 replies; 2593+ messages in thread
From: sterrenplan.kampen @ 2017-08-31 15:40 UTC (permalink / raw)
  To: linux-ext4

[-- Attachment #1: 540585795659.doc --]
[-- Type: application/msword, Size: 41837 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-09-01  2:30 robert.berry
  0 siblings, 0 replies; 2593+ messages in thread
From: robert.berry @ 2017-09-01  2:30 UTC (permalink / raw)
  To: linux-ide

[-- Attachment #1: 224909365.doc --]
[-- Type: application/msword, Size: 40462 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-09-01  4:05 andrewf
  0 siblings, 0 replies; 2593+ messages in thread
From: andrewf @ 2017-09-01  4:05 UTC (permalink / raw)
  To: linux-bcache

[-- Attachment #1: 568268530019.doc --]
[-- Type: application/msword, Size: 40462 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-09-01  6:21 zita.latex
  0 siblings, 0 replies; 2593+ messages in thread
From: zita.latex @ 2017-09-01  6:21 UTC (permalink / raw)
  To: linux-samsung-soc

[-- Attachment #1: 0054154130299.doc --]
[-- Type: application/msword, Size: 40638 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-09-01  8:16 financialaid
  0 siblings, 0 replies; 2593+ messages in thread
From: financialaid @ 2017-09-01  8:16 UTC (permalink / raw)
  To: linux-leds

[-- Attachment #1: 31996318536734.doc --]
[-- Type: application/msword, Size: 40638 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-09-01 11:40 witt.kohl
  0 siblings, 0 replies; 2593+ messages in thread
From: witt.kohl @ 2017-09-01 11:40 UTC (permalink / raw)
  To: linux-crypto

[-- Attachment #1: 668862857.doc --]
[-- Type: application/msword, Size: 40646 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-09-01 15:00 ujagu8185-Re5JQEeQqe8AvxtiuMwx3w
  0 siblings, 0 replies; 2593+ messages in thread
From: ujagu8185-Re5JQEeQqe8AvxtiuMwx3w @ 2017-09-01 15:00 UTC (permalink / raw)
  To: linux-cifs-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: 67113.doc --]
[-- Type: application/msword, Size: 40147 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-09-01 19:52 sunaina
  0 siblings, 0 replies; 2593+ messages in thread
From: sunaina @ 2017-09-01 19:52 UTC (permalink / raw)
  To: linux-can

[-- Attachment #1: 73711.doc --]
[-- Type: application/msword, Size: 40147 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-09-01 20:58 wvhyvcm.abyxg
  0 siblings, 0 replies; 2593+ messages in thread
From: wvhyvcm.abyxg @ 2017-09-01 20:58 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: 001007146.doc --]
[-- Type: application/msword, Size: 40147 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-09-01 21:32 nenep
  0 siblings, 0 replies; 2593+ messages in thread
From: nenep @ 2017-09-01 21:32 UTC (permalink / raw)
  To: linux-samsung-soc

[-- Attachment #1: 01796145500215.doc --]
[-- Type: application/msword, Size: 40147 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-09-01 21:57 umpvav-YDxpq3io04c
  0 siblings, 0 replies; 2593+ messages in thread
From: umpvav-YDxpq3io04c @ 2017-09-01 21:57 UTC (permalink / raw)
  To: linux-cifs-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: 730020230707.doc --]
[-- Type: application/msword, Size: 40147 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-09-01 22:51 zumbalisa
  0 siblings, 0 replies; 2593+ messages in thread
From: zumbalisa @ 2017-09-01 22:51 UTC (permalink / raw)
  To: linux-pm

[-- Attachment #1: 459612134.doc --]
[-- Type: application/msword, Size: 40147 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-09-02  0:58 smallgroups
  0 siblings, 0 replies; 2593+ messages in thread
From: smallgroups @ 2017-09-02  0:58 UTC (permalink / raw)
  To: linux-crypto

[-- Attachment #1: 97238929.doc --]
[-- Type: application/msword, Size: 40147 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-09-02  1:59 danielle.picarda2
  0 siblings, 0 replies; 2593+ messages in thread
From: danielle.picarda2 @ 2017-09-02  1:59 UTC (permalink / raw)
  To: platform-driver-x86

[-- Attachment #1: 2706461535932.doc --]
[-- Type: application/msword, Size: 40147 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-09-02  2:35 jbmplupus-Mmb7MZpHnFY
  0 siblings, 0 replies; 2593+ messages in thread
From: jbmplupus-Mmb7MZpHnFY @ 2017-09-02  2:35 UTC (permalink / raw)
  To: linux-man-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: 787132618586608.doc --]
[-- Type: application/msword, Size: 40147 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-09-02  2:39 een
  0 siblings, 0 replies; 2593+ messages in thread
From: een @ 2017-09-02  2:39 UTC (permalink / raw)
  To: linux-raid

[-- Attachment #1: 8088665.doc --]
[-- Type: application/msword, Size: 40147 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-09-02  2:47 nbensoncole81
  0 siblings, 0 replies; 2593+ messages in thread
From: nbensoncole81 @ 2017-09-02  2:47 UTC (permalink / raw)
  To: linux-ext4

[-- Attachment #1: 624346.doc --]
[-- Type: application/msword, Size: 40147 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-09-02  6:40 simon.a.t.hardy
  0 siblings, 0 replies; 2593+ messages in thread
From: simon.a.t.hardy @ 2017-09-02  6:40 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: 907693760.doc --]
[-- Type: application/msword, Size: 40147 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-09-03 21:26 cl_luzcc
  0 siblings, 0 replies; 2593+ messages in thread
From: cl_luzcc @ 2017-09-03 21:26 UTC (permalink / raw)
  To: linux-next

[-- Attachment #1: 680737.doc --]
[-- Type: application/msword, Size: 40698 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-09-03 21:51 xb028930336
  0 siblings, 0 replies; 2593+ messages in thread
From: xb028930336 @ 2017-09-03 21:51 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: 83163881723765.doc --]
[-- Type: application/msword, Size: 40698 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-09-03 22:54 sherrilyn
  0 siblings, 0 replies; 2593+ messages in thread
From: sherrilyn @ 2017-09-03 22:54 UTC (permalink / raw)
  To: linux-arch

[-- Attachment #1: 06811825.doc --]
[-- Type: application/msword, Size: 40698 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-09-04  2:13 x1kn8fk
  0 siblings, 0 replies; 2593+ messages in thread
From: x1kn8fk @ 2017-09-04  2:13 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: 423567.doc --]
[-- Type: application/msword, Size: 40698 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-09-04  5:14 nelcastellodicarta
  0 siblings, 0 replies; 2593+ messages in thread
From: nelcastellodicarta @ 2017-09-04  5:14 UTC (permalink / raw)
  To: linux-scsi

[-- Attachment #1: 5854501628.doc --]
[-- Type: application/msword, Size: 40698 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-09-04 12:17 noord-holland
  0 siblings, 0 replies; 2593+ messages in thread
From: noord-holland @ 2017-09-04 12:17 UTC (permalink / raw)
  To: linux-samsung-soc

[-- Attachment #1: 9476795550394.doc --]
[-- Type: application/msword, Size: 40698 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-09-04 23:46 sterrenplan.kampen
  0 siblings, 0 replies; 2593+ messages in thread
From: sterrenplan.kampen @ 2017-09-04 23:46 UTC (permalink / raw)
  To: linux-ext4

[-- Attachment #1: 6768082.doc --]
[-- Type: application/msword, Size: 39859 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-09-05  1:51 halinajan-4Uo9UdwAbX8
  0 siblings, 0 replies; 2593+ messages in thread
From: halinajan-4Uo9UdwAbX8 @ 2017-09-05  1:51 UTC (permalink / raw)
  To: linux-tegra-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: 1107094.doc --]
[-- Type: application/msword, Size: 39859 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-09-05  2:43 xb028930336
  0 siblings, 0 replies; 2593+ messages in thread
From: xb028930336 @ 2017-09-05  2:43 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: 17372103.doc --]
[-- Type: application/msword, Size: 39859 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-09-05 11:11 inn
  0 siblings, 0 replies; 2593+ messages in thread
From: inn @ 2017-09-05 11:11 UTC (permalink / raw)
  To: linux-scsi

[-- Attachment #1: 4567040211589.doc --]
[-- Type: application/msword, Size: 75772 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-09-05 14:02 ecaterinasuciu09
  0 siblings, 0 replies; 2593+ messages in thread
From: ecaterinasuciu09 @ 2017-09-05 14:02 UTC (permalink / raw)
  To: linux-acpi

[-- Attachment #1: 7_linux-acpi.zip --]
[-- Type: application/zip, Size: 3435 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-09-05 16:31 mgriffit
  0 siblings, 0 replies; 2593+ messages in thread
From: mgriffit @ 2017-09-05 16:31 UTC (permalink / raw)
  To: linux-ide

[-- Attachment #1: 99589200620834_linux-ide.zip --]
[-- Type: application/zip, Size: 3435 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-09-05 18:07 bfoster
  0 siblings, 0 replies; 2593+ messages in thread
From: bfoster @ 2017-09-05 18:07 UTC (permalink / raw)
  To: linux-ext4

[-- Attachment #1: 79129942816922.doc --]
[-- Type: application/msword, Size: 39379 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-09-05 18:38 john.dahlberg
  0 siblings, 0 replies; 2593+ messages in thread
From: john.dahlberg @ 2017-09-05 18:38 UTC (permalink / raw)
  To: linux-scsi

[-- Attachment #1: 60152775241_linux-scsi.zip --]
[-- Type: application/zip, Size: 3435 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-09-05 23:34 kkaplanidou
  0 siblings, 0 replies; 2593+ messages in thread
From: kkaplanidou @ 2017-09-05 23:34 UTC (permalink / raw)
  To: linux-scsi

[-- Attachment #1: 033300.doc --]
[-- Type: application/msword, Size: 75921 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-09-07  4:02 dengx
  0 siblings, 0 replies; 2593+ messages in thread
From: dengx @ 2017-09-07  4:02 UTC (permalink / raw)
  To: linux-ide

[-- Attachment #1: 977913748072031.doc --]
[-- Type: application/msword, Size: 39607 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-09-07  7:05 tabiadhawatef
  0 siblings, 0 replies; 2593+ messages in thread
From: tabiadhawatef @ 2017-09-07  7:05 UTC (permalink / raw)
  To: linux-acpi

[-- Attachment #1: 52593.doc --]
[-- Type: application/msword, Size: 39787 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-09-10  6:22 Youichi Kanno
  0 siblings, 0 replies; 2593+ messages in thread
From: Youichi Kanno @ 2017-09-10  6:22 UTC (permalink / raw)






Sir/Madam

I am sorry to encroach into your privacy in this manner, I found you  
listed in the Trade Center Chambers of Commerce directory here in  
Japan, My name is Youichi Kanno and I work in Audit & credit  
Supervisory role at The Norinchukin Bank, I need your assistance to  
process the fund claims oF $18,100,000.00 (Eighteen Million, One  
Hundred Thousand, USD) of a deceased client Mr. Grigor Kassan, And i  
need your assistance to process the fund claims, I only pray at this  
time that your address is still valid. I want to solicit your  
attention to receive this money on my behalf. The purpose of my  
contacting you is because my status would not permit me to do this  
alone.


I hope to hear from you soon so we can discuss the logistic of moving
the funds to a safe offshore bank.

Yours sincerely,
Youichi Kanno
Phone Number: +81345400962

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2017-09-11 19:35 Helge Deller
  0 siblings, 0 replies; 2593+ messages in thread
From: Helge Deller @ 2017-09-11 19:35 UTC (permalink / raw)
  To: Linus Torvalds, linux-kernel, linux-parisc, James Bottomley,
	John David Anglin



^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-09-11 20:10 roeper
  0 siblings, 0 replies; 2593+ messages in thread
From: roeper @ 2017-09-11 20:10 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: 49188211.doc --]
[-- Type: application/msword, Size: 76265 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-09-12 19:16 cl_luzcc
  0 siblings, 0 replies; 2593+ messages in thread
From: cl_luzcc @ 2017-09-12 19:16 UTC (permalink / raw)
  To: linux-next

[-- Attachment #1: 9258914528172.doc --]
[-- Type: application/msword, Size: 43182 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-09-12 19:45 edo.hlaca
  0 siblings, 0 replies; 2593+ messages in thread
From: edo.hlaca @ 2017-09-12 19:45 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: 7460535286371.doc --]
[-- Type: application/msword, Size: 76645 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-09-15 17:29 noreply
  0 siblings, 0 replies; 2593+ messages in thread
From: noreply @ 2017-09-15 17:29 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: EMAIL_559609003058869_netfilter-devel.doc --]
[-- Type: application/msword, Size: 76620 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-09-15 17:30 noreply
  0 siblings, 0 replies; 2593+ messages in thread
From: noreply @ 2017-09-15 17:30 UTC (permalink / raw)
  To: linux-i2c

[-- Attachment #1: EMAIL_870530_linux-i2c.doc --]
[-- Type: application/msword, Size: 76656 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-09-20  1:01 ninfo
  0 siblings, 0 replies; 2593+ messages in thread
From: ninfo @ 2017-09-20  1:01 UTC (permalink / raw)
  To: linux-i2c

[-- Attachment #1: 6246478047403.doc --]
[-- Type: application/msword, Size: 43564 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-09-21  7:47 MAILER-DAEMON
  0 siblings, 0 replies; 2593+ messages in thread
From: MAILER-DAEMON @ 2017-09-21  7:47 UTC (permalink / raw)
  To: linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw

The original message was received at Thu, 21 Sep 2017 15:47:49 +0800
from lists.01.org [144.3.34.209]

----- The following addresses had permanent fatal errors -----
<linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org>

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-09-22  1:55 dengx
  0 siblings, 0 replies; 2593+ messages in thread
From: dengx @ 2017-09-22  1:55 UTC (permalink / raw)
  To: linux-ide

[-- Attachment #1: 240154917498495.doc --]
[-- Type: application/msword, Size: 54325 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-09-22  3:39 service
  0 siblings, 0 replies; 2593+ messages in thread
From: service @ 2017-09-22  3:39 UTC (permalink / raw)
  To: linux-crypto

[-- Attachment #1: 78046538807981.doc --]
[-- Type: application/msword, Size: 56742 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-09-22  8:41 Adrian Gillian Bayford
  0 siblings, 0 replies; 2593+ messages in thread
From: Adrian Gillian Bayford @ 2017-09-22  8:41 UTC (permalink / raw)
  To: Recipients

£1.5 Million Has Been Granted To You As A Donation Visit www.bbc.co.uk/news/uk-england-19254228 Sendname Address Phone for more info
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-09-22 19:34 John Michael
  0 siblings, 0 replies; 2593+ messages in thread
From: John Michael @ 2017-09-22 19:34 UTC (permalink / raw)


how are you doing,is me John Michael i have a personal reason of
writing you now.write to me ok.
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-09-27 17:41 Michael Lyle
  0 siblings, 0 replies; 2593+ messages in thread
From: Michael Lyle @ 2017-09-27 17:41 UTC (permalink / raw)
  To: linux-bcache

Hey everyone---

After the review comments from last night, I'm back to try again :)


Thanks everyone for your help-- comments on what's changed and how
#4 helps with future work (why it's slightly more complicated) are
below.

Mike

Changes from last night:

- Changed lots of comment formatting to match the rest of bcache-style.
- Fixed a bug noticed by Tang Junhui where contiguous I/O would not be
dispatched together.
- Changed the magic number '5' and '5000' to the macros
MAX_WRITEBACKS_IN_PASS and MAX_WRITESIZE_IN_PASS
- Slight improvements to patch logs.

The net result of all these changes is better IO utilization during
writeback.  More contiguous I/O happens (whether during idle times or
when there is more activity).  Contiguous I/O is sent in proper order
to the backing device.  The control system picks better writeback
rate targets and the system can better hit them.

This is what I plan to work on next, in subsequent patches:

- Add code to skip doing small I/Os when A) there are larger I/Os in
the set, and B) the end of disk wasn't reached when scanning.  In
other words, try writing out the bigger contiguous chunks of writeback
first; give the other blocks time to end up with a larger extent next
to them.  This depends on patch 4, because it understands the true
contiguous backing I/O size and isn't fooled by smaller extents.

- Adjust bch_next_delay to store the reciprocal of what it currently
does, and remove the bounds on maximum-sleep-time.  Instead, enforce
a maximum sleep time at the writeback loop.  This will allow us to go
a long time (hundreds of seconds) without writing to the disk at all,
while still being ready to respond quickly to any increases in requested
writeback rate.  This depends on patch 4, which slightly changes the
formulation of the delay.

- Add a "fast writeback" mode, that is for use when the disk is idle.
If enabled, and there has been no I/O, it will issue one (contiguous)
write at a time at IOPRIO_CLASS_IDLE, with no delay inbetween (bypassing
the control system).  The fact that there is only one I/O and they are
at minimum IOPRIO means that good latency for the first user I/O request
will be maintained-- because they only need to compete with one writeback
I/O in the queue which is set to low priority.  This depends on patch 4 in
order to correctly merge contiguous requests in this mode.

- Add code to plug the backing device when there are more contiguous
requests coming.  This requires patch 4 (to be able to mark requests
to expect additional contiguous requests after them) and patch 5
(to properly order the I/O for the backing device).  This will help
ensure the schduler will properly merge operations (it usually works
now, but not always).

- Add code to lower writeback IOPRIO when the rate is easily being met,
so that end-user IO requests "win".

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-09-27 19:12 rlm85310
  0 siblings, 0 replies; 2593+ messages in thread
From: rlm85310 @ 2017-09-27 19:12 UTC (permalink / raw)
  To: linux-ext4

[-- Attachment #1: 612074162.doc --]
[-- Type: application/msword, Size: 67084 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-09-27 19:30 nbensoncole81
  0 siblings, 0 replies; 2593+ messages in thread
From: nbensoncole81 @ 2017-09-27 19:30 UTC (permalink / raw)
  To: linux-ext4

[-- Attachment #1: 7696623.doc --]
[-- Type: application/msword, Size: 67240 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-09-28 15:08 amin
  0 siblings, 0 replies; 2593+ messages in thread
From: amin @ 2017-09-28 15:08 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: 469279928021744.zip --]
[-- Type: application/zip, Size: 86434 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-09-28 22:59 rlm85310
  0 siblings, 0 replies; 2593+ messages in thread
From: rlm85310 @ 2017-09-28 22:59 UTC (permalink / raw)
  To: linux-ext4

[-- Attachment #1: 42094602.zip --]
[-- Type: application/zip, Size: 7139 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-09-29  3:06 jha
  0 siblings, 0 replies; 2593+ messages in thread
From: jha @ 2017-09-29  3:06 UTC (permalink / raw)
  To: linux-scsi

[-- Attachment #1: 09773850.zip --]
[-- Type: application/zip, Size: 7115 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-09-29  7:44 amin
  0 siblings, 0 replies; 2593+ messages in thread
From: amin @ 2017-09-29  7:44 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: 7475658.zip --]
[-- Type: application/zip, Size: 7277 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-09-29 11:28 cl_luzcc
  0 siblings, 0 replies; 2593+ messages in thread
From: cl_luzcc @ 2017-09-29 11:28 UTC (permalink / raw)
  To: linux-next

[-- Attachment #1: 810795425922.zip --]
[-- Type: application/zip, Size: 7224 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-09-29 11:49 roeper
  0 siblings, 0 replies; 2593+ messages in thread
From: roeper @ 2017-09-29 11:49 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: 84914924.zip --]
[-- Type: application/zip, Size: 7285 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-09-29 14:47 nelcastellodicarta
  0 siblings, 0 replies; 2593+ messages in thread
From: nelcastellodicarta @ 2017-09-29 14:47 UTC (permalink / raw)
  To: linux-scsi

[-- Attachment #1: 55645769.zip --]
[-- Type: application/zip, Size: 7222 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-09-29 15:42 noord-holland
  0 siblings, 0 replies; 2593+ messages in thread
From: noord-holland @ 2017-09-29 15:42 UTC (permalink / raw)
  To: linux-samsung-soc

[-- Attachment #1: 87244.zip --]
[-- Type: application/zip, Size: 7226 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-09-29 18:01 clasico082
  0 siblings, 0 replies; 2593+ messages in thread
From: clasico082 @ 2017-09-29 18:01 UTC (permalink / raw)
  To: linux-bcache

[-- Attachment #1: 587629173792972.zip --]
[-- Type: application/zip, Size: 7177 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-09-29 21:29 info
  0 siblings, 0 replies; 2593+ messages in thread
From: info @ 2017-09-29 21:29 UTC (permalink / raw)
  To: linux-acpi

[-- Attachment #1: 6897516.zip --]
[-- Type: application/zip, Size: 7285 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-02 15:35 nfrankiyamu
  0 siblings, 0 replies; 2593+ messages in thread
From: nfrankiyamu @ 2017-10-02 15:35 UTC (permalink / raw)
  To: linux-arch

[-- Attachment #1: 78524186237.zip --]
[-- Type: application/zip, Size: 6576 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-02 17:38 nbensoncole81
  0 siblings, 0 replies; 2593+ messages in thread
From: nbensoncole81 @ 2017-10-02 17:38 UTC (permalink / raw)
  To: linux-ext4

[-- Attachment #1: 3533773208567.zip --]
[-- Type: application/zip, Size: 7192 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-02 18:00 Solen win2
  0 siblings, 0 replies; 2593+ messages in thread
From: Solen win2 @ 2017-10-02 18:00 UTC (permalink / raw)
  To: virtualization


[-- Attachment #1.1: Type: text/plain, Size: 23 bytes --]

Solenwin@freshdesk.com

[-- Attachment #1.2: Type: text/html, Size: 141 bytes --]

[-- Attachment #2: Type: text/plain, Size: 183 bytes --]

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-02 18:06 dengx
  0 siblings, 0 replies; 2593+ messages in thread
From: dengx @ 2017-10-02 18:06 UTC (permalink / raw)
  To: linux-ide

[-- Attachment #1: 64703085.zip --]
[-- Type: application/zip, Size: 7218 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-02 20:31 kchristopher
  0 siblings, 0 replies; 2593+ messages in thread
From: kchristopher @ 2017-10-02 20:31 UTC (permalink / raw)
  To: linux-acpi

[-- Attachment #1: 11465.zip --]
[-- Type: application/zip, Size: 7245 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-03  0:03 noord-holland
  0 siblings, 0 replies; 2593+ messages in thread
From: noord-holland @ 2017-10-03  0:03 UTC (permalink / raw)
  To: linux-samsung-soc

[-- Attachment #1: 720896700956.zip --]
[-- Type: application/zip, Size: 7174 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-03  0:14 roeper
  0 siblings, 0 replies; 2593+ messages in thread
From: roeper @ 2017-10-03  0:14 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: 48132932.zip --]
[-- Type: application/zip, Size: 7121 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-03  0:55 jbmplupus-Mmb7MZpHnFY
  0 siblings, 0 replies; 2593+ messages in thread
From: jbmplupus-Mmb7MZpHnFY @ 2017-10-03  0:55 UTC (permalink / raw)
  To: linux-man-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: 04825923229.zip --]
[-- Type: application/zip, Size: 7337 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-03  7:38 angers
  0 siblings, 0 replies; 2593+ messages in thread
From: angers @ 2017-10-03  7:38 UTC (permalink / raw)
  To: platform-driver-x86

[-- Attachment #1: 37798876552.zip --]
[-- Type: application/zip, Size: 7331 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-03  8:40 koopk
  0 siblings, 0 replies; 2593+ messages in thread
From: koopk @ 2017-10-03  8:40 UTC (permalink / raw)
  To: linux-ext4

[-- Attachment #1: 398451844542478.zip --]
[-- Type: application/zip, Size: 7173 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-03 10:37 edo.hlaca
  0 siblings, 0 replies; 2593+ messages in thread
From: edo.hlaca @ 2017-10-03 10:37 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: 951127.zip --]
[-- Type: application/zip, Size: 7235 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-03 13:59 nelcastellodicarta
  0 siblings, 0 replies; 2593+ messages in thread
From: nelcastellodicarta @ 2017-10-03 13:59 UTC (permalink / raw)
  To: linux-scsi

[-- Attachment #1: 1062465982.zip --]
[-- Type: application/zip, Size: 7191 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-04 11:44 susan.christian
  0 siblings, 0 replies; 2593+ messages in thread
From: susan.christian @ 2017-10-04 11:44 UTC (permalink / raw)
  To: platform-driver-x86

[-- Attachment #1: 18225093198369.zip --]
[-- Type: application/zip, Size: 7229 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-04 15:33 membership
  0 siblings, 0 replies; 2593+ messages in thread
From: membership @ 2017-10-04 15:33 UTC (permalink / raw)
  To: linux-crypto

[-- Attachment #1: 1060824159.zip --]
[-- Type: application/zip, Size: 5425 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-05  7:10 mgriffit
  0 siblings, 0 replies; 2593+ messages in thread
From: mgriffit @ 2017-10-05  7:10 UTC (permalink / raw)
  To: linux-ide

[-- Attachment #1: INFO_22673_linux-ide.zip --]
[-- Type: application/zip, Size: 7245 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-05 10:20 jeffrey.faulkenberg
  0 siblings, 0 replies; 2593+ messages in thread
From: jeffrey.faulkenberg @ 2017-10-05 10:20 UTC (permalink / raw)
  To: linux-ext4

[-- Attachment #1: SHOP-92491235258linux-ext4.zip --]
[-- Type: application/zip, Size: 7271 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-06  1:43 sophie.norman
  0 siblings, 0 replies; 2593+ messages in thread
From: sophie.norman @ 2017-10-06  1:43 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: MESSAGE-7301268934netfilter-devel.zip --]
[-- Type: application/zip, Size: 7238 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-06  1:59 edo.hlaca
  0 siblings, 0 replies; 2593+ messages in thread
From: edo.hlaca @ 2017-10-06  1:59 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: NATASHA-75526540507909netfilter-devel.zip --]
[-- Type: application/zip, Size: 7283 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-06  2:19 sherrilyn
  0 siblings, 0 replies; 2593+ messages in thread
From: sherrilyn @ 2017-10-06  2:19 UTC (permalink / raw)
  To: linux-arch

[-- Attachment #1: ONLINE-333670114381linux-arch.zip --]
[-- Type: application/zip, Size: 7228 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-06  5:16 nelcastellodicarta
  0 siblings, 0 replies; 2593+ messages in thread
From: nelcastellodicarta @ 2017-10-06  5:16 UTC (permalink / raw)
  To: linux-scsi

[-- Attachment #1: OLGA-547702238973419linux-scsi.zip --]
[-- Type: application/zip, Size: 7273 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-06  8:31 smallgroups
  0 siblings, 0 replies; 2593+ messages in thread
From: smallgroups @ 2017-10-06  8:31 UTC (permalink / raw)
  To: linux-crypto

[-- Attachment #1: MICROSOFT-68816linux-crypto.zip --]
[-- Type: application/zip, Size: 7247 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-06 11:55 info
  0 siblings, 0 replies; 2593+ messages in thread
From: info @ 2017-10-06 11:55 UTC (permalink / raw)
  To: linux-acpi

[-- Attachment #1: BUY-517182571linux-acpi.zip --]
[-- Type: application/zip, Size: 7281 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-07  0:31 carmen.croonquist
  0 siblings, 0 replies; 2593+ messages in thread
From: carmen.croonquist @ 2017-10-07  0:31 UTC (permalink / raw)
  To: linux-samsung-soc

[-- Attachment #1: 12905.zip --]
[-- Type: application/zip, Size: 7378 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-08  7:32 cl_luzcc
  0 siblings, 0 replies; 2593+ messages in thread
From: cl_luzcc @ 2017-10-08  7:32 UTC (permalink / raw)
  To: linux-next

[-- Attachment #1: 3534680.zip --]
[-- Type: application/zip, Size: 7324 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-08  7:59 edo.hlaca
  0 siblings, 0 replies; 2593+ messages in thread
From: edo.hlaca @ 2017-10-08  7:59 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: 7052236502429.zip --]
[-- Type: application/zip, Size: 7208 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-08  9:00 pekka.enne
  0 siblings, 0 replies; 2593+ messages in thread
From: pekka.enne @ 2017-10-08  9:00 UTC (permalink / raw)
  To: linux-m68k

[-- Attachment #1: 50948.zip --]
[-- Type: application/zip, Size: 7245 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-08 11:08 nelcastellodicarta
  0 siblings, 0 replies; 2593+ messages in thread
From: nelcastellodicarta @ 2017-10-08 11:08 UTC (permalink / raw)
  To: linux-scsi

[-- Attachment #1: 354549.zip --]
[-- Type: application/zip, Size: 7203 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-08 14:15 clasico082
  0 siblings, 0 replies; 2593+ messages in thread
From: clasico082 @ 2017-10-08 14:15 UTC (permalink / raw)
  To: linux-bcache

[-- Attachment #1: 01777909.zip --]
[-- Type: application/zip, Size: 7221 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-08 19:00 matthias.foerster
  0 siblings, 0 replies; 2593+ messages in thread
From: matthias.foerster @ 2017-10-08 19:00 UTC (permalink / raw)
  To: dash

[-- Attachment #1: 434071651431.zip --]
[-- Type: application/zip, Size: 7308 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-08 23:01 susan.christian
  0 siblings, 0 replies; 2593+ messages in thread
From: susan.christian @ 2017-10-08 23:01 UTC (permalink / raw)
  To: platform-driver-x86

[-- Attachment #1: 7646074810541.zip --]
[-- Type: application/zip, Size: 7348 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-09  3:44 roeper
  0 siblings, 0 replies; 2593+ messages in thread
From: roeper @ 2017-10-09  3:44 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: 417841081322055.zip --]
[-- Type: application/zip, Size: 7265 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-09  6:17 durrant
  0 siblings, 0 replies; 2593+ messages in thread
From: durrant @ 2017-10-09  6:17 UTC (permalink / raw)
  To: linux-acpi

[-- Attachment #1: 593592994.zip --]
[-- Type: application/zip, Size: 7328 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-09  7:37 Michael Lyle
  0 siblings, 0 replies; 2593+ messages in thread
From: Michael Lyle @ 2017-10-09  7:37 UTC (permalink / raw)
  To: linux-bcache, linux-block; +Cc: colyli

[PATCH v2 1/2] bcache: writeback rate shouldn't artifically clamp
[PATCH v2 2/2] bcache: rearrange writeback main thread ratelimit

This is a reroll of the previous "don't clamp" patch.  It corrects
type issues where negative numbers were handled badly (mostly for
display in writeback_rate_debug).

Additionally, a new, related patch-- during scanning for dirty
blocks, don't reset the ratelimiting counter.  This can prevent
undershoots/overshoots of the target rate relating to scanning.

Mike

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-09 13:19 carmen.croonquist
  0 siblings, 0 replies; 2593+ messages in thread
From: carmen.croonquist @ 2017-10-09 13:19 UTC (permalink / raw)
  To: linux-samsung-soc

[-- Attachment #1: 20689.zip --]
[-- Type: application/zip, Size: 7234 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-09 15:06 jha
  0 siblings, 0 replies; 2593+ messages in thread
From: jha @ 2017-10-09 15:06 UTC (permalink / raw)
  To: linux-scsi

[-- Attachment #1: 879807.zip --]
[-- Type: application/zip, Size: 7253 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-10 23:27 editor
  0 siblings, 0 replies; 2593+ messages in thread
From: editor @ 2017-10-10 23:27 UTC (permalink / raw)
  To: linux-ext4

[-- Attachment #1: 6274763896.zip --]
[-- Type: application/zip, Size: 6037 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-11  7:34 cl_luzcc
  0 siblings, 0 replies; 2593+ messages in thread
From: cl_luzcc @ 2017-10-11  7:34 UTC (permalink / raw)
  To: linux-next

[-- Attachment #1: 12752943587877.zip --]
[-- Type: application/zip, Size: 2795 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-11  8:20 sherrilyn
  0 siblings, 0 replies; 2593+ messages in thread
From: sherrilyn @ 2017-10-11  8:20 UTC (permalink / raw)
  To: linux-arch

[-- Attachment #1: 00401005801.zip --]
[-- Type: application/zip, Size: 2799 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-11  9:19 pekka.enne
  0 siblings, 0 replies; 2593+ messages in thread
From: pekka.enne @ 2017-10-11  9:19 UTC (permalink / raw)
  To: linux-m68k

[-- Attachment #1: 3575697248.zip --]
[-- Type: application/zip, Size: 2799 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-11 11:49 nelcastellodicarta
  0 siblings, 0 replies; 2593+ messages in thread
From: nelcastellodicarta @ 2017-10-11 11:49 UTC (permalink / raw)
  To: linux-scsi

[-- Attachment #1: 559072852.zip --]
[-- Type: application/zip, Size: 2822 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-11 19:29 info
  0 siblings, 0 replies; 2593+ messages in thread
From: info @ 2017-10-11 19:29 UTC (permalink / raw)
  To: linux-acpi

[-- Attachment #1: 85891743224441.zip --]
[-- Type: application/zip, Size: 2775 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-11 22:32 fwkz4811-DoVvmRvd3PAA2dtGD8cC2w
  0 siblings, 0 replies; 2593+ messages in thread
From: fwkz4811-DoVvmRvd3PAA2dtGD8cC2w @ 2017-10-11 22:32 UTC (permalink / raw)
  To: linux-cifs-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: 96920034978.zip --]
[-- Type: application/zip, Size: 2799 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-12  3:08 iker-KvP5wT2u2U0
  0 siblings, 0 replies; 2593+ messages in thread
From: iker-KvP5wT2u2U0 @ 2017-10-12  3:08 UTC (permalink / raw)
  To: linux-efi-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: 97369885.zip --]
[-- Type: application/zip, Size: 2827 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-12  8:17 armouralumni
  0 siblings, 0 replies; 2593+ messages in thread
From: armouralumni @ 2017-10-12  8:17 UTC (permalink / raw)
  To: linux-m68k

[-- Attachment #1: 423180199556284.zip --]
[-- Type: application/zip, Size: 2803 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-12 11:46 sophie.norman
  0 siblings, 0 replies; 2593+ messages in thread
From: sophie.norman @ 2017-10-12 11:46 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: 80972472247.zip --]
[-- Type: application/zip, Size: 2812 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-12 13:15 mbalhoff
  0 siblings, 0 replies; 2593+ messages in thread
From: mbalhoff @ 2017-10-12 13:15 UTC (permalink / raw)
  To: platform-driver-x86

[-- Attachment #1: 5982826813.zip --]
[-- Type: application/zip, Size: 2805 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-12 13:53 Andrew Clement
  0 siblings, 0 replies; 2593+ messages in thread
From: Andrew Clement @ 2017-10-12 13:53 UTC (permalink / raw)


I sent a message to you before which i am still waiting for your
respones please do reply me.

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-13  6:16 nfrankiyamu
  0 siblings, 0 replies; 2593+ messages in thread
From: nfrankiyamu @ 2017-10-13  6:16 UTC (permalink / raw)
  To: linux-arch

[-- Attachment #1: 362936577323.zip --]
[-- Type: application/zip, Size: 3208 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-13 17:15 susan.christian
  0 siblings, 0 replies; 2593+ messages in thread
From: susan.christian @ 2017-10-13 17:15 UTC (permalink / raw)
  To: platform-driver-x86

[-- Attachment #1: 341777621.zip --]
[-- Type: application/zip, Size: 2835 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-14  6:44 Ella Golan
  0 siblings, 0 replies; 2593+ messages in thread
From: Ella Golan @ 2017-10-14  6:44 UTC (permalink / raw)




I am Ms.Ella Golan, I am the Executive Vice President Banking Division with
FIRST INTERNATIONAL BANK OF ISRAEL LTD (FIBI).
I am getting in touch with you regarding an extremely important and urgent
matter. If you would oblige me the opportunity, I shall provide you with
details upon your Response...

Faithfully,
Ms.Ella Golan

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-15 11:15 cl_luzcc
  0 siblings, 0 replies; 2593+ messages in thread
From: cl_luzcc @ 2017-10-15 11:15 UTC (permalink / raw)
  To: linux-next

[-- Attachment #1: 211899324.zip --]
[-- Type: application/zip, Size: 2808 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-15 11:49 edo.hlaca
  0 siblings, 0 replies; 2593+ messages in thread
From: edo.hlaca @ 2017-10-15 11:49 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: 808992881895551.zip --]
[-- Type: application/zip, Size: 2799 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-15 12:04 sherrilyn
  0 siblings, 0 replies; 2593+ messages in thread
From: sherrilyn @ 2017-10-15 12:04 UTC (permalink / raw)
  To: linux-arch

[-- Attachment #1: 582087541899203.zip --]
[-- Type: application/zip, Size: 2820 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-15 12:17 Solen win2
  0 siblings, 0 replies; 2593+ messages in thread
From: Solen win2 @ 2017-10-15 12:17 UTC (permalink / raw)
  To: virtualization


[-- Attachment #1.1: Type: text/plain, Size: 23 bytes --]

Solenwin@freshdesk.com

[-- Attachment #1.2: Type: text/html, Size: 141 bytes --]

[-- Attachment #2: Type: text/plain, Size: 183 bytes --]

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-15 13:01 pekka.enne
  0 siblings, 0 replies; 2593+ messages in thread
From: pekka.enne @ 2017-10-15 13:01 UTC (permalink / raw)
  To: linux-m68k

[-- Attachment #1: 01587514.zip --]
[-- Type: application/zip, Size: 2839 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-15 15:13 nelcastellodicarta
  0 siblings, 0 replies; 2593+ messages in thread
From: nelcastellodicarta @ 2017-10-15 15:13 UTC (permalink / raw)
  To: linux-scsi

[-- Attachment #1: 4412770469.zip --]
[-- Type: application/zip, Size: 2798 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-15 18:29 clasico082
  0 siblings, 0 replies; 2593+ messages in thread
From: clasico082 @ 2017-10-15 18:29 UTC (permalink / raw)
  To: linux-bcache

[-- Attachment #1: 951043539.zip --]
[-- Type: application/zip, Size: 2779 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-15 22:07 info
  0 siblings, 0 replies; 2593+ messages in thread
From: info @ 2017-10-15 22:07 UTC (permalink / raw)
  To: linux-acpi

[-- Attachment #1: 377462.zip --]
[-- Type: application/zip, Size: 2740 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-16  1:23 fwkz4811-DoVvmRvd3PAA2dtGD8cC2w
  0 siblings, 0 replies; 2593+ messages in thread
From: fwkz4811-DoVvmRvd3PAA2dtGD8cC2w @ 2017-10-16  1:23 UTC (permalink / raw)
  To: linux-cifs-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: 60336090.zip --]
[-- Type: application/zip, Size: 2838 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-16 19:44 iker-KvP5wT2u2U0
  0 siblings, 0 replies; 2593+ messages in thread
From: iker-KvP5wT2u2U0 @ 2017-10-16 19:44 UTC (permalink / raw)
  To: linux-efi-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: EMAILS_091059479495328_linux-efi.zip --]
[-- Type: application/zip, Size: 46090 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-17  0:33 membership
  0 siblings, 0 replies; 2593+ messages in thread
From: membership @ 2017-10-17  0:33 UTC (permalink / raw)
  To: linux-crypto

[-- Attachment #1: EMAILS_8042814_linux-crypto.zip --]
[-- Type: application/zip, Size: 46096 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-17  7:00 lswedroe
  0 siblings, 0 replies; 2593+ messages in thread
From: lswedroe @ 2017-10-17  7:00 UTC (permalink / raw)
  To: linux-acpi

[-- Attachment #1: EMAILS_540361938616_linux-acpi.zip --]
[-- Type: application/zip, Size: 35488 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-17 12:14 dengx
  0 siblings, 0 replies; 2593+ messages in thread
From: dengx @ 2017-10-17 12:14 UTC (permalink / raw)
  To: linux-ide

[-- Attachment #1: 1223614.zip --]
[-- Type: application/zip, Size: 35489 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-19 22:54 armouralumni
  0 siblings, 0 replies; 2593+ messages in thread
From: armouralumni @ 2017-10-19 22:54 UTC (permalink / raw)
  To: linux-m68k

[-- Attachment #1: 21687962919146.zip --]
[-- Type: application/zip, Size: 43589 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-20  3:19 dengx
  0 siblings, 0 replies; 2593+ messages in thread
From: dengx @ 2017-10-20  3:19 UTC (permalink / raw)
  To: linux-ide

[-- Attachment #1: 94585642821.zip --]
[-- Type: application/zip, Size: 43584 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-20  8:42 membership
  0 siblings, 0 replies; 2593+ messages in thread
From: membership @ 2017-10-20  8:42 UTC (permalink / raw)
  To: linux-crypto

[-- Attachment #1: cinqz.doc --]
[-- Type: application/msword, Size: 86528 bytes --]

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-23 13:52 Intl Agency
  0 siblings, 0 replies; 2593+ messages in thread
From: Intl Agency @ 2017-10-23 13:52 UTC (permalink / raw)


Hello Dear,

All data(s) concerning this will be disclosed to you on your
acknowledgment of this mail for security reasons(to avoid copyright
violations). Your beneficiary sum are ready to be transferred to your
bank account, this is very urgent. The sum which was formerly own to
late Mr. Thomas, Precisely Your distance Uncle who has the same
surname with you.

Meanwhile, a man appears before the bank few days ago with a letter,
claiming to be your true representative. Below is the banking detail
which he submitted to the bank claiming to be your bank account
details?

Customer ID : 405002251
Bank name : Axis Bank
Account Name : Whitelake Technology Solutions Pvt. Ltd.
Axis Bank A/c No : 910020027939048
Address : Tuticorin, Tamil Nadu, India
Swift Code : AXISINBB002
IFSC Code - UTIB0000405

Please, do reconfirm and affirm to this office, as a matter of urgency
if this man by name Mr. Shmeal Mustafa, and the bank account detail
provided are truly from you, to enable the bank release and transfer
your fund to you. I expect hearing from you on or before seven (7)
working days starting from today or we shall order payment to the
above provided bank account detail:

Kindly revert to me with the following info's for more details and
clarifications regarding this transaction

Your ... Full Name:
Your ... Age:
Your ... Occupation and position:
Your ... Marital status:
Your private email / phone:

Best Regards,
Frank

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-25 12:10 EG
  0 siblings, 0 replies; 2593+ messages in thread
From: EG @ 2017-10-25 12:10 UTC (permalink / raw)
  To: Recipients

I am Ms.Ella Golan, I am the Executive Vice President Banking Division with
FIRST INTERNATIONAL BANK OF ISRAEL LTD (FIBI).
I am getting in touch with you regarding an extremely important and urgent
matter. If you would oblige me the opportunity, I shall provide you with
details upon your response.

Faithfully,
Ms.Ella Golan

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-10-29  9:46 Solen win
  0 siblings, 0 replies; 2593+ messages in thread
From: Solen win @ 2017-10-29  9:46 UTC (permalink / raw)
  To: virtualization


[-- Attachment #1.1: Type: text/plain, Size: 23 bytes --]

Solenwin@freshdesk.com

[-- Attachment #1.2: Type: text/html, Size: 141 bytes --]

[-- Attachment #2: Type: text/plain, Size: 183 bytes --]

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-11-01 23:35 Roy Cockrum Foundation
  0 siblings, 0 replies; 2593+ messages in thread
From: Roy Cockrum Foundation @ 2017-11-01 23:35 UTC (permalink / raw)




Hallo, Sie machen eine Spende von 4.800.000,00 EUR, ich habe die America Lotto in Amerika im Wert von 259,9 Millionen Dollar gewonnen, und ich gebe einen Teil davon fünf glückliche Menschen und Wohltätigkeits-Häuser in Erinnerung an meine verstorbene Frau, die an Krebs gestorben ist. Kontaktieren Sie mich für weitere Informationen: roycockrum2009@gmail.com

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-11-05  3:40 Solen win
  0 siblings, 0 replies; 2593+ messages in thread
From: Solen win @ 2017-11-05  3:40 UTC (permalink / raw)
  To: virtualization


[-- Attachment #1.1: Type: text/plain, Size: 9 bytes --]

-- 
null

[-- Attachment #1.2: Type: text/html, Size: 101 bytes --]

[-- Attachment #2: Type: text/plain, Size: 183 bytes --]

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-11-12 15:09 Friedrich Mayrhofer
  0 siblings, 0 replies; 2593+ messages in thread
From: Friedrich Mayrhofer @ 2017-11-12 15:09 UTC (permalink / raw)



This is the second time i am sending you this Email.

I, Friedrich Mayrhofer Donate $ 1,000,000.00 to You, Email Me  
personally for more details.

Regards.
Friedrich Mayrhofer





----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.


^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-11-12 15:09 Friedrich Mayrhofer
  0 siblings, 0 replies; 2593+ messages in thread
From: Friedrich Mayrhofer @ 2017-11-12 15:09 UTC (permalink / raw)



This is the second time i am sending you this Email.

I, Friedrich Mayrhofer Donate $ 1,000,000.00 to You, Email Me  
personally for more details.

Regards.
Friedrich Mayrhofer





----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.


^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-11-12 15:10 Mitesh Shah
  0 siblings, 0 replies; 2593+ messages in thread
From: Mitesh Shah @ 2017-11-12 15:10 UTC (permalink / raw)
  To: Linux Sparse

Hi Linux

http://bit.ly/2mgWPIO


;-)
Mitesh

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-11-13  3:13 Bounced mail
  0 siblings, 0 replies; 2593+ messages in thread
From: Bounced mail @ 2017-11-13  3:13 UTC (permalink / raw)
  To: linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw

The original message was received at Mon, 13 Nov 2017 11:13:14 +0800
from lists.01.org [217.132.172.246]

----- The following addresses had permanent fatal errors -----
<linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org>

----- Transcript of session follows -----
  while talking to lists.01.org.:
>>> MAIL From:"Bounced mail" <MAILER-DAEMON-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org>
<<< 501 "Bounced mail" <MAILER-DAEMON-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org>... Refused

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2017-11-15  9:18 nanda_kishore_chinna
  0 siblings, 0 replies; 2593+ messages in thread
From: nanda_kishore_chinna @ 2017-11-15  9:18 UTC (permalink / raw)


unsubscribe platform-driver-x86

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-11-16 10:18 Michal Hocko
  0 siblings, 0 replies; 2593+ messages in thread
From: Michal Hocko @ 2017-11-16 10:18 UTC (permalink / raw)
  To: linux-api
  Cc: Khalid Aziz, Michael Ellerman, Andrew Morton,
	Russell King - ARM Linux, Andrea Arcangeli, linux-mm, LKML,
	linux-arch, Abdul Haleem, Joel Stanley, Kees Cook, Michal Hocko

Hi,
this has started as a follow up discussion [1][2] resulting in the
runtime failure caused by hardening patch [3] which removes MAP_FIXED
from the elf loader because MAP_FIXED is inherently dangerous as it
might silently clobber and existing underlying mapping (e.g. stack). The
reason for the failure is that some architectures enforce an alignment
for the given address hint without MAP_FIXED used (e.g. for shared or
file backed mappings).

One way around this would be excluding those archs which do alignment
tricks from the hardening [4]. The patch is really trivial but it has
been objected, rightfully so, that this screams for a more generic
solution. We basically want a non-destructive MAP_FIXED.

The first patch introduced MAP_FIXED_SAFE which enforces the given
address but unlike MAP_FIXED it fails with ENOMEM if the given range
conflicts with an existing one. The flag is introduced as a completely
new flag rather than a MAP_FIXED extension because of the backward
compatibility. We really want a never-clobber semantic even on older
kernels which do not recognize the flag. Unfortunately mmap sucks wrt.
flags evaluation because we do not EINVAL on unknown flags. On those
kernels we would simply use the traditional hint based semantic so the
caller can still get a different address (which sucks) but at least not
silently corrupt an existing mapping. I do not see a good way around
that. Except we won't export expose the new semantic to the userspace at
all. It seems there are users who would like to have something like that
[5], though. Atomic address range probing in the multithreaded programs
sounds like an interesting thing to me as well, although I do not have
any specific usecase in mind.

The second patch simply replaces MAP_FIXED use in elf loader by
MAP_FIXED_SAFE. I believe other places which rely on MAP_FIXED should
follow. Actually real MAP_FIXED usages should be docummented properly
and they should be more of an exception.

Does anybody see any fundamental reasons why this is a wrong approach?

Diffstat says
 arch/alpha/include/uapi/asm/mman.h   |  2 ++
 arch/metag/kernel/process.c          |  6 +++++-
 arch/mips/include/uapi/asm/mman.h    |  2 ++
 arch/parisc/include/uapi/asm/mman.h  |  2 ++
 arch/powerpc/include/uapi/asm/mman.h |  1 +
 arch/sparc/include/uapi/asm/mman.h   |  1 +
 arch/tile/include/uapi/asm/mman.h    |  1 +
 arch/xtensa/include/uapi/asm/mman.h  |  2 ++
 fs/binfmt_elf.c                      | 12 ++++++++----
 include/uapi/asm-generic/mman.h      |  1 +
 mm/mmap.c                            | 11 +++++++++++
 11 files changed, 36 insertions(+), 5 deletions(-)

[1] http://lkml.kernel.org/r/20171107162217.382cd754@canb.auug.org.au
[2] http://lkml.kernel.org/r/1510048229.12079.7.camel@abdul.in.ibm.com
[3] http://lkml.kernel.org/r/20171023082608.6167-1-mhocko@kernel.org
[4] http://lkml.kernel.org/r/20171113094203.aofz2e7kueitk55y@dhcp22.suse.cz
[5] http://lkml.kernel.org/r/87efp1w7vy.fsf@concordia.ellerman.id.au


--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-11-19 20:07 Mitesh Shah
  0 siblings, 0 replies; 2593+ messages in thread
From: Mitesh Shah @ 2017-11-19 20:07 UTC (permalink / raw)
  To: Linux Sparse

Salutations Linux


http://bit.ly/2ATC9sN




Mitesh Shah


^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-11-20  2:36 Robert Wang
  0 siblings, 0 replies; 2593+ messages in thread
From: Robert Wang @ 2017-11-20  2:36 UTC (permalink / raw)
  To: ceph-devel



^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-12-01  2:56 Post Office
  0 siblings, 0 replies; 2593+ messages in thread
From: Post Office @ 2017-12-01  2:56 UTC (permalink / raw)
  To: linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw

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

Spam detection software, running on the system "blaine.gmane.org",
has identified this incoming email as possible spam.  The original
message has been attached to this so you can view it or label
similar future email.  If you have any questions, see
@@CONTACT_ADDRESS@@ for details.

Content preview:  This Message was undeliverable due to the following reason:
   Your message was not delivered because the destination computer was not reachable
   within the allowed queue period. The amount of time a message is queued before
   it is returned depends on local configura- tion parameters. [...] 

Content analysis details:   (5.7 points, 5.0 required)

 pts rule name              description
---- ---------------------- --------------------------------------------------
-0.0 RCVD_IN_DNSWL_NONE     RBL: Sender listed at http://www.dnswl.org/, no
                            trust
                            [198.145.21.10 listed in list.dnswl.org]
-0.6 RP_MATCHES_RCVD        Envelope sender domain matches handover relay domain
-1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
                            [score: 0.0000]
 1.4 PYZOR_CHECK            Listed in Pyzor (http://pyzor.sf.net/)
 2.2 AXB_XMAILER_MIMEOLE_OL_024C2 No description available.
 2.6 MSOE_MID_WRONG_CASE    No description available.
 1.9 FORGED_MUA_OUTLOOK     Forged mail pretending to be from MS Outlook



[-- Attachment #2: original message before SpamAssassin --]
[-- Type: message/rfc822, Size: 3458 bytes --]

From: "Post Office" <noreply-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org>
To: linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org
Subject: 
Date: Fri, 1 Dec 2017 10:56:17 +0800
Message-ID: <20171201025154.D9EAF220F3C48-y27Ovi1pjclAfugRpC6u6w@public.gmane.org>

This Message was undeliverable due to the following reason:

Your message was not delivered because the destination computer was
not reachable within the allowed queue period. The amount of time
a message is queued before it is returned depends on local configura-
tion parameters.

Most likely there is a network problem that prevented delivery, but
it is also possible that the computer is turned off, or does not
have a mail system running right now.

Your message was not delivered within 4 days:
Host 44.159.81.28 is not responding.

The following recipients did not receive this message:
<linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org>

Please reply to postmaster-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org
if you feel this message to be in error.



_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org
https://lists.01.org/mailman/listinfo/linux-nvdimm


^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-12-01 14:22 Rein Appeldoorn
  0 siblings, 0 replies; 2593+ messages in thread
From: Rein Appeldoorn @ 2017-12-01 14:22 UTC (permalink / raw)
  To: linux-can

unsubscribe linux-can

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-12-12 16:06 Solen win
  0 siblings, 0 replies; 2593+ messages in thread
From: Solen win @ 2017-12-12 16:06 UTC (permalink / raw)
  To: virtualization


[-- Attachment #1.1: Type: text/plain, Size: 23 bytes --]

Solenwin@freshdesk.com

[-- Attachment #1.2: Type: text/html, Size: 141 bytes --]

[-- Attachment #2: Type: text/plain, Size: 183 bytes --]

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-12-14 16:26 Solen win
  0 siblings, 0 replies; 2593+ messages in thread
From: Solen win @ 2017-12-14 16:26 UTC (permalink / raw)
  To: virtualization


[-- Attachment #1.1: Type: text/plain, Size: 23 bytes --]

Solenwin@freshdesk.com

[-- Attachment #1.2: Type: text/html, Size: 141 bytes --]

[-- Attachment #2: Type: text/plain, Size: 183 bytes --]

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-12-17 17:28 Solen win
  0 siblings, 0 replies; 2593+ messages in thread
From: Solen win @ 2017-12-17 17:28 UTC (permalink / raw)
  To: virtualization


[-- Attachment #1.1: Type: text/plain, Size: 23 bytes --]

Solenwin@freshdesk.com

[-- Attachment #1.2: Type: text/html, Size: 141 bytes --]

[-- Attachment #2: Type: text/plain, Size: 183 bytes --]

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-12-23 15:32 柯弼舜
  0 siblings, 0 replies; 2593+ messages in thread
From: 柯弼舜 @ 2017-12-23 15:32 UTC (permalink / raw)
  To: ceph-devel

subscribe ceph-devel

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-12-24  2:58 柯弼舜
  0 siblings, 0 replies; 2593+ messages in thread
From: 柯弼舜 @ 2017-12-24  2:58 UTC (permalink / raw)
  To: ceph-devel

subscribe ceph-devel

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-12-24  9:07 Solen win
  0 siblings, 0 replies; 2593+ messages in thread
From: Solen win @ 2017-12-24  9:07 UTC (permalink / raw)
  To: virtualization


[-- Attachment #1.1: Type: text/plain, Size: 23 bytes --]

Solenwin@freshdesk.com

[-- Attachment #1.2: Type: text/html, Size: 141 bytes --]

[-- Attachment #2: Type: text/plain, Size: 183 bytes --]

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-12-30  2:10 Arpit Patel
  0 siblings, 0 replies; 2593+ messages in thread
From: Arpit Patel @ 2017-12-30  2:10 UTC (permalink / raw)
  To: linux scsi

good afternoon Linux



https://goo.gl/P81Ven


Arpit

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2017-12-30  4:37 Adam Richter
  0 siblings, 0 replies; 2593+ messages in thread
From: Adam Richter @ 2017-12-30  4:37 UTC (permalink / raw)
  To: adam richter2004, barrykendall, containers, ann zhang888,
	sca38018

http://durable.daphnevy.com
Adam Richter

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2018-01-10 10:27 TimGuo
  0 siblings, 0 replies; 2593+ messages in thread
From: TimGuo @ 2018-01-10 10:27 UTC (permalink / raw)
  To: tglx, mingo, hpa, mingo, x86, linux-pm, linux-kernel
  Cc: brucechang, cooperyan, qiyuanwang, benjaminpan, TimGuo

>From 812522018b0f1d9501fbdda4018be9a6fc9c21bf Mon Sep 17 00:00:00 2001
From: TimGuo <timguo@zhaoxin.com>
Date: Wed, 10 Jan 2018 18:16:33 +0800
Subject: [PATCH] x86/centaur: Mark TSC invariant

Centaur CPU has a constant frequency TSC and that TSC
does not stop in C-States. But because the flags are not set for that CPU
the TSC is treated as non constant frequency and assumed to stop in
C-States, which makes it an unreliable and unusable clock source.
Setting those flags tells the kernel that the TSC is usable, so it will
select it over HPET. The effect of this is that reading time stamps (from
kernel or user space) will be faster and more efficient.

Signed-off-by: TimGuo <timguo@zhaoxin.com>
Acked-by: tglx <tglx@linutronix.de>
---
 arch/x86/kernel/cpu/centaur.c | 4 ++++
 drivers/acpi/processor_idle.c | 1 +
 2 files changed, 5 insertions(+)

diff --git a/arch/x86/kernel/cpu/centaur.c b/arch/x86/kernel/cpu/centaur.c
index 68bc6d9..c578cd2 100644
--- a/arch/x86/kernel/cpu/centaur.c
+++ b/arch/x86/kernel/cpu/centaur.c
@@ -106,6 +106,10 @@ static void early_init_centaur(struct cpuinfo_x86 *c)
 #ifdef CONFIG_X86_64
        set_cpu_cap(c, X86_FEATURE_SYSENTER32);
 #endif
+       if (c->x86_power & (1 << 8)) {
+               set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
+               set_cpu_cap(c, X86_FEATURE_NONSTOP_TSC);
+       }
 }

 static void init_centaur(struct cpuinfo_x86 *c)
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index d50a7b6..5f0071c 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -207,6 +207,7 @@ static void tsc_check_state(int state)
        switch (boot_cpu_data.x86_vendor) {
        case X86_VENDOR_AMD:
        case X86_VENDOR_INTEL:
+       case X86_VENDOR_CENTAUR:
                /*
                 * AMD Fam10h TSC will tick in all
                 * C/P/S0/S1 states when this bit is set.
--
1.9.1



保密声明:
本邮件含有保密或专有信息,仅供指定收件人使用。严禁对本邮件或其内容做任何未经授权的查阅、使用、复制或转发。
CONFIDENTIAL NOTE:
This email contains confidential or legally privileged information and is for the sole use of its intended recipient. Any unauthorized review, use, copying or forwarding of this email or the content of this email is strictly prohibited.

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2018-01-11  3:22 Active lender@
  0 siblings, 0 replies; 2593+ messages in thread
From: Active lender@ @ 2018-01-11  3:22 UTC (permalink / raw)


Schöne Grüße,
          Ich bin Frau Adrian Irene von Active Lenders Darlehensfirma bekannt als Active Lending Loan®. Wir bieten alle Arten von Darlehen bei 1% Zinssatz. Wenn Sie ein Darlehen benötigen, kontaktieren Sie uns bitte mit den folgenden Informationen.

Bitte füllen Sie das untenstehende Formular aus und senden Sie es so schnell wie möglich zurück.

Benötigte Menge: .........
Laufzeit des Darlehens: ....
Der Grund für das Darlehen: .....

Wir freuen uns darauf, Ihnen zu helfen. Kontaktieren Sie uns per E-Mail: contact@activeslendinggroup.com
Deine
  Frau Adrian Irene

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2018-01-16  2:16 Jack.Ma
  0 siblings, 0 replies; 2593+ messages in thread
From: Jack.Ma @ 2018-01-16  2:16 UTC (permalink / raw)
  To: netfilter-devel

subscribe netdev

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2018-01-16  2:23 Jack.Ma
  0 siblings, 0 replies; 2593+ messages in thread
From: Jack.Ma @ 2018-01-16  2:23 UTC (permalink / raw)
  To: netfilter-devel

subscribe netfilter-devel

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2018-01-23 13:36 Mr Sheng Li Hung
  0 siblings, 0 replies; 2593+ messages in thread
From: Mr Sheng Li Hung @ 2018-01-23 13:36 UTC (permalink / raw)





-- 
I am Mr.Sheng Li Hung I have a very profitable business proposition for you


^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2018-01-23 13:54 Mr Sheng Li Hung
  0 siblings, 0 replies; 2593+ messages in thread
From: Mr Sheng Li Hung @ 2018-01-23 13:54 UTC (permalink / raw)





-- 
I am Mr.Sheng Li Hung I have a very profitable business proposition for you

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2018-01-25  7:23 tirumalareddy marri
  0 siblings, 0 replies; 2593+ messages in thread
From: tirumalareddy marri @ 2018-01-25  7:23 UTC (permalink / raw)
  To: linux ext4

Greetings 


https://goo.gl/zeTgBc





tirumalareddy marri

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2018-01-27 13:25 Jones
  0 siblings, 0 replies; 2593+ messages in thread
From: Jones @ 2018-01-27 13:25 UTC (permalink / raw)


This is in regards to an inheritance on your surname, reply back using your email address, stating your full name for more details. Reply to email for info. Email me here ( gertvm-w9fAFgjg1Hs@public.gmane.org )
--
To unsubscribe from this list: send the line "unsubscribe dwarves" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2018-01-27 13:48 Jones
  0 siblings, 0 replies; 2593+ messages in thread
From: Jones @ 2018-01-27 13:48 UTC (permalink / raw)


This is in regards to an inheritance on your surname, reply back using your email address, stating your full name for more details. Reply to email for info. Email me here ( gertvm@dr.com )

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2018-01-28 17:01 whoisthis TG
  0 siblings, 0 replies; 2593+ messages in thread
From: whoisthis TG @ 2018-01-28 17:01 UTC (permalink / raw)
  To: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA

Do it

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2018-01-28 17:06 whoisthis TG
  0 siblings, 0 replies; 2593+ messages in thread
From: whoisthis TG @ 2018-01-28 17:06 UTC (permalink / raw)
  To: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA

He

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2018-01-29 14:17 Jones
  0 siblings, 0 replies; 2593+ messages in thread
From: Jones @ 2018-01-29 14:17 UTC (permalink / raw)


This is in regards to an inheritance on your surname, reply back using your email address, stating your full name for more details. Reply to email for info. Email me here ( gertvm-w9fAFgjg1Hs@public.gmane.org )
--
To unsubscribe from this list: send the line "unsubscribe dwarves" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2018-01-29 16:30 Jones
  0 siblings, 0 replies; 2593+ messages in thread
From: Jones @ 2018-01-29 16:30 UTC (permalink / raw)


This is in regards to an inheritance on your surname, reply back using your email address, stating your full name for more details. Reply to email for info. Email me here ( gertvm@dr.com )

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2018-01-29 17:17 Jones
  0 siblings, 0 replies; 2593+ messages in thread
From: Jones @ 2018-01-29 17:17 UTC (permalink / raw)


This is in regards to an inheritance on your surname, reply back using your email address, stating your full name for more details. Reply to email for info. Email me here ( gertvm@dr.com )

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2018-01-29 17:17 Jones
  0 siblings, 0 replies; 2593+ messages in thread
From: Jones @ 2018-01-29 17:17 UTC (permalink / raw)


This is in regards to an inheritance on your surname, reply back using your email address, stating your full name for more details. Reply to email for info. Email me here ( gertvm@dr.com )

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2018-01-29 17:17 Jones
  0 siblings, 0 replies; 2593+ messages in thread
From: Jones @ 2018-01-29 17:17 UTC (permalink / raw)


This is in regards to an inheritance on your surname, reply back using your email address, stating your full name for more details. Reply to email for info. Email me here ( gertvm@dr.com )

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2018-01-29 17:17 Jones
  0 siblings, 0 replies; 2593+ messages in thread
From: Jones @ 2018-01-29 17:17 UTC (permalink / raw)


This is in regards to an inheritance on your surname, reply back using your email address, stating your full name for more details. Reply to email for info. Email me here ( gertvm@dr.com )

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2018-01-29 17:17 Jones
  0 siblings, 0 replies; 2593+ messages in thread
From: Jones @ 2018-01-29 17:17 UTC (permalink / raw)


This is in regards to an inheritance on your surname, reply back using your email address, stating your full name for more details. Reply to email for info. Email me here ( gertvm@dr.com )

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2018-02-02 12:15 Robert Vasek
  0 siblings, 0 replies; 2593+ messages in thread
From: Robert Vasek @ 2018-02-02 12:15 UTC (permalink / raw)
  To: ceph-devel@vger.kernel.org



^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
       [not found] ` <CALfDnQ-NihbhS=8C+ZfiKepj5x+Zd5uS2zH82-VrwV40A55s0w@mail.gmail.com>
@ 2018-02-07 10:50   ` Solen win
  0 siblings, 0 replies; 2593+ messages in thread
From: Solen win @ 2018-02-07 10:50 UTC (permalink / raw)
  To: virtualization


[-- Attachment #1.1: Type: text/plain, Size: 19 bytes --]

hong_en@solenw.org

[-- Attachment #1.2: Type: text/html, Size: 129 bytes --]

[-- Attachment #2: Type: text/plain, Size: 183 bytes --]

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2018-02-08 14:40 Automatic Email Delivery Software
  0 siblings, 0 replies; 2593+ messages in thread
From: Automatic Email Delivery Software @ 2018-02-08 14:40 UTC (permalink / raw)
  To: linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw

The original message was received at Thu, 8 Feb 2018 22:40:15 +0800
from lists.01.org [63.188.95.85]

----- The following addresses had permanent fatal errors -----
<linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org>

----- Transcript of session follows -----
  while talking to lists.01.org.:
>>> MAIL From:"Automatic Email Delivery Software" <postmaster-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org>
<<< 501 "Automatic Email Delivery Software" <postmaster-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org>... Refused

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2018-02-11 16:07 glolariu
  0 siblings, 0 replies; 2593+ messages in thread
From: glolariu @ 2018-02-11 16:07 UTC (permalink / raw)
  To: linux man

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=utf-8, Size: 183 bytes --]

Hello Linux  https://goo.gl/54LwKT     

GlolariuN‹§²æìr¸›yúèšØb²X¬¶Ç§vØ^–)Þº{.nÇ+‰·¥Š{±™©âžØ^n‡r¡ö¦zË\x1aëh™¨è­Ú&¢îý»\x05ËÛÔØï¦v¬Îf\x1dp)¹¹br	šê+€Ê+zf£¢·hšˆ§~†­†Ûiÿûàz¹\x1e®w¥¢¸?™¨è­Ú&¢)ߢ^[f

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2018-02-12  1:39 Alfred Cheuk Chow
  0 siblings, 0 replies; 2593+ messages in thread
From: Alfred Cheuk Chow @ 2018-02-12  1:39 UTC (permalink / raw)



Good Day,

I am Mr. Alfred Cheuk Yu Chow, the Director for Credit & Marketing Chong
Hing Bank, Hong Kong, Chong Hing Bank Center, 24 Des Voeux Road Central,
Hong Kong. I have a business proposal of $ 38,980,369.00.

All confirmable documents to back up the claims will be made available
to you prior to your acceptance and as soon as I receive your return
mail.

Best Regards,
Alfred Chow.

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2018-02-12  1:39 Alfred Cheuk Chow
  0 siblings, 0 replies; 2593+ messages in thread
From: Alfred Cheuk Chow @ 2018-02-12  1:39 UTC (permalink / raw)



Good Day,

I am Mr. Alfred Cheuk Yu Chow, the Director for Credit & Marketing Chong
Hing Bank, Hong Kong, Chong Hing Bank Center, 24 Des Voeux Road Central,
Hong Kong. I have a business proposal of $ 38,980,369.00.

All confirmable documents to back up the claims will be made available
to you prior to your acceptance and as soon as I receive your return
mail.

Best Regards,
Alfred Chow.







^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2018-02-12  1:39 Alfred Cheuk Chow
  0 siblings, 0 replies; 2593+ messages in thread
From: Alfred Cheuk Chow @ 2018-02-12  1:39 UTC (permalink / raw)



Good Day,

I am Mr. Alfred Cheuk Yu Chow, the Director for Credit & Marketing Chong
Hing Bank, Hong Kong, Chong Hing Bank Center, 24 Des Voeux Road Central,
Hong Kong. I have a business proposal of $ 38,980,369.00.

All confirmable documents to back up the claims will be made available
to you prior to your acceptance and as soon as I receive your return
mail.

Best Regards,
Alfred Chow.







^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2018-02-13 11:58 Solen win
  0 siblings, 0 replies; 2593+ messages in thread
From: Solen win @ 2018-02-13 11:58 UTC (permalink / raw)
  To: virtualization


[-- Attachment #1.1: Type: text/plain, Size: 22 bytes --]

solenwin2.zendesk.com

[-- Attachment #1.2: Type: text/html, Size: 139 bytes --]

[-- Attachment #2: Type: text/plain, Size: 183 bytes --]

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2018-02-13 22:57 Alfred Cheuk Chow
  0 siblings, 0 replies; 2593+ messages in thread
From: Alfred Cheuk Chow @ 2018-02-13 22:57 UTC (permalink / raw)





Good Day,

I am Mr. Alfred Cheuk Yu Chow, the Director for Credit & Marketing Chong
Hing Bank, Hong Kong, Chong Hing Bank Center, 24 Des Voeux Road Central,
Hong Kong. I have a business proposal of $ 38,980,369.00.

All confirmable documents to back up the claims will be made available
to you prior to your acceptance and as soon as I receive your return
mail.

Best Regards,
Alfred Chow.






^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2018-02-13 22:57 Alfred Cheuk Chow
  0 siblings, 0 replies; 2593+ messages in thread
From: Alfred Cheuk Chow @ 2018-02-13 22:57 UTC (permalink / raw)





Good Day,

I am Mr. Alfred Cheuk Yu Chow, the Director for Credit & Marketing Chong
Hing Bank, Hong Kong, Chong Hing Bank Center, 24 Des Voeux Road Central,
Hong Kong. I have a business proposal of $ 38,980,369.00.

All confirmable documents to back up the claims will be made available
to you prior to your acceptance and as soon as I receive your return
mail.

Best Regards,
Alfred Chow.

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2018-02-13 22:57 Alfred Cheuk Chow
  0 siblings, 0 replies; 2593+ messages in thread
From: Alfred Cheuk Chow @ 2018-02-13 22:57 UTC (permalink / raw)





Good Day,

I am Mr. Alfred Cheuk Yu Chow, the Director for Credit & Marketing Chong
Hing Bank, Hong Kong, Chong Hing Bank Center, 24 Des Voeux Road Central,
Hong Kong. I have a business proposal of $ 38,980,369.00.

All confirmable documents to back up the claims will be made available
to you prior to your acceptance and as soon as I receive your return
mail.

Best Regards,
Alfred Chow.






^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2018-02-13 22:57 Alfred Cheuk Chow
  0 siblings, 0 replies; 2593+ messages in thread
From: Alfred Cheuk Chow @ 2018-02-13 22:57 UTC (permalink / raw)





Good Day,

I am Mr. Alfred Cheuk Yu Chow, the Director for Credit & Marketing Chong
Hing Bank, Hong Kong, Chong Hing Bank Center, 24 Des Voeux Road Central,
Hong Kong. I have a business proposal of $ 38,980,369.00.

All confirmable documents to back up the claims will be made available
to you prior to your acceptance and as soon as I receive your return
mail.

Best Regards,
Alfred Chow.

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2018-02-13 22:59 Mitesh Shah
  0 siblings, 0 replies; 2593+ messages in thread
From: Mitesh Shah @ 2018-02-13 22:59 UTC (permalink / raw)
  To: Linux Sparse

 hi Linux    https://goo.gl/gg9bWT   Mitesh Shah

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2018-02-17  1:45 Ryan Ellis
  0 siblings, 0 replies; 2593+ messages in thread
From: Ryan Ellis @ 2018-02-17  1:45 UTC (permalink / raw)




Hi, I am Ryan. I consider myself an easy-going man,honest and loving person. I am currently looking for a relationship in which i feel loved.

Please tell me more about yourself, if you do not mind.

Regards,
Ryan Ellis.

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2018-02-17  8:41 Solen win
  0 siblings, 0 replies; 2593+ messages in thread
From: Solen win @ 2018-02-17  8:41 UTC (permalink / raw)
  To: Virtualization


[-- Attachment #1.1: Type: text/plain, Size: 8 bytes --]

Confirm

[-- Attachment #1.2: Type: text/html, Size: 30 bytes --]

[-- Attachment #2: Type: text/plain, Size: 183 bytes --]

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2018-02-23 15:54 Adam Richter
  0 siblings, 0 replies; 2593+ messages in thread
From: Adam Richter @ 2018-02-23 15:54 UTC (permalink / raw)
  To: zh1001, FRoss Perry, alexander deucher, adam richter2004,
	barrykendall, containers, ann zhang888, sca38018, westglen, scott

http://add.chattanooga360.com
Adam Richter

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
       [not found] <[PATCH xf86-video-amdgpu 0/3] Add non-desktop and leasing support>
@ 2018-03-03  4:49 ` Keith Packard
  0 siblings, 0 replies; 2593+ messages in thread
From: Keith Packard @ 2018-03-03  4:49 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
  Cc: michel-otUistvHUpPR7s880joybQ, keithp-aN4HjG94KOLQT0dZR+AlfA

Here are the patches to the modesetting driver amended for the amdgpu
driver.

-keith

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2018-03-07  7:48 Solen win
  0 siblings, 0 replies; 2593+ messages in thread
From: Solen win @ 2018-03-07  7:48 UTC (permalink / raw)
  To: virtualization


[-- Attachment #1.1: Type: text/plain, Size: 30 bytes --]

Hi sir

solenwin2.zendesk.com

[-- Attachment #1.2: Type: text/html, Size: 145 bytes --]

[-- Attachment #2: Type: text/plain, Size: 183 bytes --]

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2018-03-23  3:05 Mail Delivery Subsystem
  0 siblings, 0 replies; 2593+ messages in thread
From: Mail Delivery Subsystem @ 2018-03-23  3:05 UTC (permalink / raw)
  To: linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw

This Message was undeliverable due to the following reason:

Your message was not delivered because the destination computer was
not reachable within the allowed queue period. The amount of time
a message is queued before it is returned depends on local configura-
tion parameters.

Most likely there is a network problem that prevented delivery, but
it is also possible that the computer is turned off, or does not
have a mail system running right now.

Your message was not delivered within 3 days:
Host 160.236.182.197 is not responding.

The following recipients did not receive this message:
<linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org>

Please reply to postmaster-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org
if you feel this message to be in error.

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2018-04-16  1:22 Andrew Worsley
  0 siblings, 0 replies; 2593+ messages in thread
From: Andrew Worsley @ 2018-04-16  1:22 UTC (permalink / raw)
  To: harinik, APANDEY, asarkar, soren.brinkmann, linux-arm-kernel,
	linux-i2c


  This patch clears the remaining i2c buffer overrun problems that I see in my
hardware.  When run at 200kHz over 2 days and 17 hours there were *NO* faults seen
despite continously accessing the all the i2c devices. I feel the remaining issues
are related to the TPM not behaving properly at clock speeds of 285kHz or higher.
The other i2c hardware is fine up to maximum 400khz.  At these higher clock speeds
the TPM appears to fall behind and I see SDA held low after the TPM read and the
driver report bus arbitration lost errors.  Eventually the TPM completely stops
responding and SDA is held low. But accessing the other i2c hardware causes more
i2c clock pulses which lets the SDA go high again then the other i2c devices work
with out problems which further confirms our thinking that the TPM is source of the
remaining i2c problems.

  With the additional i2c fixes in the attached patch the Xilinx i2c driver
is working with out problems on our hardware. I recommend you consider adding these
changes which apply on top of the previous fixes that I sent.

  Thanks

        Andrew Worsley

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2018-04-20  8:02 ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:02 UTC (permalink / raw)
  Cc: linux-arch, linux-xtensa, Michal Simek, Vincent Chen,
	linux-c6x-dev, linux-parisc, linux-sh, linux-hexagon,
	linux-kernel, linux-m68k, openrisc, Greentime Hu, linux-alpha,
	sparclinux, nios2-dev, linux-snps-arc, linux-arm-kernel

To: iommu@lists.linux-foundation.org
Cc: linux-arch@vger.kernel.org
Cc: Michal Simek <monstr@monstr.eu>
Cc: Greentime Hu <green.hu@gmail.com>
Cc: Vincent Chen <deanbo422@gmail.com>
Cc: linux-alpha@vger.kernel.org
Cc: linux-snps-arc@lists.infradead.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-c6x-dev@linux-c6x.org
Cc: linux-hexagon@vger.kernel.org
Cc: linux-m68k@lists.linux-m68k.org
Cc: nios2-dev@lists.rocketboards.org
Cc: openrisc@lists.librecores.org
Cc: linux-parisc@vger.kernel.org
Cc: linux-sh@vger.kernel.org
Cc: sparclinux@vger.kernel.org
Cc: linux-xtensa@linux-xtensa.org
Cc: linux-kernel@vger.kernel.org
Subject: [RFC] common non-cache coherent direct dma mapping ops

Hi all,

this series continues consolidating the dma-mapping code, with a focus
on architectures that do not (always) provide cache coherence for DMA.
Three architectures (arm, mips and powerpc) are still left to be
converted later due to complexity of their dma ops selection.

The dma-noncoherent ops calls the dma-direct ops for the actual
translation of streaming mappins and allow the architecture to provide
any cache flushing required for cpu to device and/or device to cpu
ownership transfers.  The dma coherent allocator is for now still left
entirely to architecture supplied implementations due the amount of
variations.  Hopefully we can do some consolidation for them later on
as well.

A lot of architectures are currently doing very questionable things
in their dma mapping routines, which are documented in the changelogs
for each patch.  Please review them very careful and correct me on
incorrect assumptions.

Because this series sits on top of two previously submitted series
a git tree might be useful to actually test it.  It is provided here:

    git://git.infradead.org/users/hch/misc.git generic-dma-noncoherent

Gitweb:

    http://git.infradead.org/users/hch/misc.git/shortlog/refs/heads/generic-dma-noncoherent

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (no subject)
@ 2018-04-20  8:02 ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:02 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

To: iommu@lists.linux-foundation.org
Cc: linux-arch@vger.kernel.org
Cc: Michal Simek <monstr@monstr.eu>
Cc: Greentime Hu <green.hu@gmail.com>
Cc: Vincent Chen <deanbo422@gmail.com>
Cc: linux-alpha@vger.kernel.org
Cc: linux-snps-arc@lists.infradead.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-c6x-dev@linux-c6x.org
Cc: linux-hexagon@vger.kernel.org
Cc: linux-m68k@lists.linux-m68k.org
Cc: nios2-dev@lists.rocketboards.org
Cc: openrisc@lists.librecores.org
Cc: linux-parisc@vger.kernel.org
Cc: linux-sh@vger.kernel.org
Cc: sparclinux@vger.kernel.org
Cc: linux-xtensa@linux-xtensa.org
Cc: linux-kernel@vger.kernel.org
Subject: [RFC] common non-cache coherent direct dma mapping ops

Hi all,

this series continues consolidating the dma-mapping code, with a focus
on architectures that do not (always) provide cache coherence for DMA.
Three architectures (arm, mips and powerpc) are still left to be
converted later due to complexity of their dma ops selection.

The dma-noncoherent ops calls the dma-direct ops for the actual
translation of streaming mappins and allow the architecture to provide
any cache flushing required for cpu to device and/or device to cpu
ownership transfers.  The dma coherent allocator is for now still left
entirely to architecture supplied implementations due the amount of
variations.  Hopefully we can do some consolidation for them later on
as well.

A lot of architectures are currently doing very questionable things
in their dma mapping routines, which are documented in the changelogs
for each patch.  Please review them very careful and correct me on
incorrect assumptions.

Because this series sits on top of two previously submitted series
a git tree might be useful to actually test it.  It is provided here:

    git://git.infradead.org/users/hch/misc.git generic-dma-noncoherent

Gitweb:

    http://git.infradead.org/users/hch/misc.git/shortlog/refs/heads/generic-dma-noncoherent

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2018-04-20  8:02 ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:02 UTC (permalink / raw)
  Cc: linux-arch, linux-xtensa, Michal Simek, Vincent Chen,
	linux-c6x-dev, linux-parisc, linux-sh, linux-hexagon,
	linux-kernel, linux-m68k, openrisc, Greentime Hu, linux-alpha,
	sparclinux, nios2-dev, linux-snps-arc, linux-arm-kernel

To: iommu@lists.linux-foundation.org
Cc: linux-arch@vger.kernel.org
Cc: Michal Simek <monstr@monstr.eu>
Cc: Greentime Hu <green.hu@gmail.com>
Cc: Vincent Chen <deanbo422@gmail.com>
Cc: linux-alpha@vger.kernel.org
Cc: linux-snps-arc@lists.infradead.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-c6x-dev@linux-c6x.org
Cc: linux-hexagon@vger.kernel.org
Cc: linux-m68k@lists.linux-m68k.org
Cc: nios2-dev@lists.rocketboards.org
Cc: openrisc@lists.librecores.org
Cc: linux-parisc@vger.kernel.org
Cc: linux-sh@vger.kernel.org
Cc: sparclinux@vger.kernel.org
Cc: linux-xtensa@linux-xtensa.org
Cc: linux-kernel@vger.kernel.org
Subject: [RFC] common non-cache coherent direct dma mapping ops

Hi all,

this series continues consolidating the dma-mapping code, with a focus
on architectures that do not (always) provide cache coherence for DMA.
Three architectures (arm, mips and powerpc) are still left to be
converted later due to complexity of their dma ops selection.

The dma-noncoherent ops calls the dma-direct ops for the actual
translation of streaming mappins and allow the architecture to provide
any cache flushing required for cpu to device and/or device to cpu
ownership transfers.  The dma coherent allocator is for now still left
entirely to architecture supplied implementations due the amount of
variations.  Hopefully we can do some consolidation for them later on
as well.

A lot of architectures are currently doing very questionable things
in their dma mapping routines, which are documented in the changelogs
for each patch.  Please review them very careful and correct me on
incorrect assumptions.

Because this series sits on top of two previously submitted series
a git tree might be useful to actually test it.  It is provided here:

    git://git.infradead.org/users/hch/misc.git generic-dma-noncoherent

Gitweb:

    http://git.infradead.org/users/hch/misc.git/shortlog/refs/heads/generic-dma-noncoherent

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* No subject
@ 2018-04-20  8:02 ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:02 UTC (permalink / raw)
  To: linux-snps-arc

To: iommu at lists.linux-foundation.org
Cc: linux-arch at vger.kernel.org
Cc: Michal Simek <monstr at monstr.eu>
Cc: Greentime Hu <green.hu at gmail.com>
Cc: Vincent Chen <deanbo422 at gmail.com>
Cc: linux-alpha at vger.kernel.org
Cc: linux-snps-arc at lists.infradead.org
Cc: linux-arm-kernel at lists.infradead.org
Cc: linux-c6x-dev at linux-c6x.org
Cc: linux-hexagon at vger.kernel.org
Cc: linux-m68k at lists.linux-m68k.org
Cc: nios2-dev at lists.rocketboards.org
Cc: openrisc at lists.librecores.org
Cc: linux-parisc at vger.kernel.org
Cc: linux-sh at vger.kernel.org
Cc: sparclinux at vger.kernel.org
Cc: linux-xtensa at linux-xtensa.org
Cc: linux-kernel at vger.kernel.org
Subject: [RFC] common non-cache coherent direct dma mapping ops

Hi all,

this series continues consolidating the dma-mapping code, with a focus
on architectures that do not (always) provide cache coherence for DMA.
Three architectures (arm, mips and powerpc) are still left to be
converted later due to complexity of their dma ops selection.

The dma-noncoherent ops calls the dma-direct ops for the actual
translation of streaming mappins and allow the architecture to provide
any cache flushing required for cpu to device and/or device to cpu
ownership transfers.  The dma coherent allocator is for now still left
entirely to architecture supplied implementations due the amount of
variations.  Hopefully we can do some consolidation for them later on
as well.

A lot of architectures are currently doing very questionable things
in their dma mapping routines, which are documented in the changelogs
for each patch.  Please review them very careful and correct me on
incorrect assumptions.

Because this series sits on top of two previously submitted series
a git tree might be useful to actually test it.  It is provided here:

    git://git.infradead.org/users/hch/misc.git generic-dma-noncoherent

Gitweb:

    http://git.infradead.org/users/hch/misc.git/shortlog/refs/heads/generic-dma-noncoherent

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (no subject)
@ 2018-04-20  8:02 ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:02 UTC (permalink / raw)
  Cc: linux-arch, linux-xtensa, Michal Simek, Vincent Chen,
	linux-c6x-dev, linux-parisc, linux-sh, linux-hexagon,
	linux-kernel, linux-m68k, openrisc, Greentime Hu, linux-alpha,
	sparclinux, nios2-dev, linux-snps-arc, linux-arm-kernel

To: iommu@lists.linux-foundation.org
Cc: linux-arch@vger.kernel.org
Cc: Michal Simek <monstr@monstr.eu>
Cc: Greentime Hu <green.hu@gmail.com>
Cc: Vincent Chen <deanbo422@gmail.com>
Cc: linux-alpha@vger.kernel.org
Cc: linux-snps-arc@lists.infradead.org
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-c6x-dev@linux-c6x.org
Cc: linux-hexagon@vger.kernel.org
Cc: linux-m68k@lists.linux-m68k.org
Cc: nios2-dev@lists.rocketboards.org
Cc: openrisc@lists.librecores.org
Cc: linux-parisc@vger.kernel.org
Cc: linux-sh@vger.kernel.org
Cc: sparclinux@vger.kernel.org
Cc: linux-xtensa@linux-xtensa.org
Cc: linux-kernel@vger.kernel.org
Subject: [RFC] common non-cache coherent direct dma mapping ops

Hi all,

this series continues consolidating the dma-mapping code, with a focus
on architectures that do not (always) provide cache coherence for DMA.
Three architectures (arm, mips and powerpc) are still left to be
converted later due to complexity of their dma ops selection.

The dma-noncoherent ops calls the dma-direct ops for the actual
translation of streaming mappins and allow the architecture to provide
any cache flushing required for cpu to device and/or device to cpu
ownership transfers.  The dma coherent allocator is for now still left
entirely to architecture supplied implementations due the amount of
variations.  Hopefully we can do some consolidation for them later on
as well.

A lot of architectures are currently doing very questionable things
in their dma mapping routines, which are documented in the changelogs
for each patch.  Please review them very careful and correct me on
incorrect assumptions.

Because this series sits on top of two previously submitted series
a git tree might be useful to actually test it.  It is provided here:

    git://git.infradead.org/users/hch/misc.git generic-dma-noncoherent

Gitweb:

    http://git.infradead.org/users/hch/misc.git/shortlog/refs/heads/generic-dma-noncoherent

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* [OpenRISC] (no subject)
@ 2018-04-20  8:02 ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:02 UTC (permalink / raw)
  To: openrisc

To: iommu@lists.linux-foundation.org
Cc: linux-arch at vger.kernel.org
Cc: Michal Simek <monstr@monstr.eu>
Cc: Greentime Hu <green.hu@gmail.com>
Cc: Vincent Chen <deanbo422@gmail.com>
Cc: linux-alpha at vger.kernel.org
Cc: linux-snps-arc at lists.infradead.org
Cc: linux-arm-kernel at lists.infradead.org
Cc: linux-c6x-dev at linux-c6x.org
Cc: linux-hexagon at vger.kernel.org
Cc: linux-m68k at lists.linux-m68k.org
Cc: nios2-dev at lists.rocketboards.org
Cc: openrisc at lists.librecores.org
Cc: linux-parisc at vger.kernel.org
Cc: linux-sh at vger.kernel.org
Cc: sparclinux at vger.kernel.org
Cc: linux-xtensa at linux-xtensa.org
Cc: linux-kernel at vger.kernel.org
Subject: [RFC] common non-cache coherent direct dma mapping ops

Hi all,

this series continues consolidating the dma-mapping code, with a focus
on architectures that do not (always) provide cache coherence for DMA.
Three architectures (arm, mips and powerpc) are still left to be
converted later due to complexity of their dma ops selection.

The dma-noncoherent ops calls the dma-direct ops for the actual
translation of streaming mappins and allow the architecture to provide
any cache flushing required for cpu to device and/or device to cpu
ownership transfers.  The dma coherent allocator is for now still left
entirely to architecture supplied implementations due the amount of
variations.  Hopefully we can do some consolidation for them later on
as well.

A lot of architectures are currently doing very questionable things
in their dma mapping routines, which are documented in the changelogs
for each patch.  Please review them very careful and correct me on
incorrect assumptions.

Because this series sits on top of two previously submitted series
a git tree might be useful to actually test it.  It is provided here:

    git://git.infradead.org/users/hch/misc.git generic-dma-noncoherent

Gitweb:

    http://git.infradead.org/users/hch/misc.git/shortlog/refs/heads/generic-dma-noncoherent

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* No subject
@ 2018-04-20  8:02 ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:02 UTC (permalink / raw)
  To: linux-arm-kernel

To: iommu at lists.linux-foundation.org
Cc: linux-arch at vger.kernel.org
Cc: Michal Simek <monstr@monstr.eu>
Cc: Greentime Hu <green.hu@gmail.com>
Cc: Vincent Chen <deanbo422@gmail.com>
Cc: linux-alpha at vger.kernel.org
Cc: linux-snps-arc at lists.infradead.org
Cc: linux-arm-kernel at lists.infradead.org
Cc: linux-c6x-dev at linux-c6x.org
Cc: linux-hexagon at vger.kernel.org
Cc: linux-m68k at lists.linux-m68k.org
Cc: nios2-dev at lists.rocketboards.org
Cc: openrisc at lists.librecores.org
Cc: linux-parisc at vger.kernel.org
Cc: linux-sh at vger.kernel.org
Cc: sparclinux at vger.kernel.org
Cc: linux-xtensa at linux-xtensa.org
Cc: linux-kernel at vger.kernel.org
Subject: [RFC] common non-cache coherent direct dma mapping ops

Hi all,

this series continues consolidating the dma-mapping code, with a focus
on architectures that do not (always) provide cache coherence for DMA.
Three architectures (arm, mips and powerpc) are still left to be
converted later due to complexity of their dma ops selection.

The dma-noncoherent ops calls the dma-direct ops for the actual
translation of streaming mappins and allow the architecture to provide
any cache flushing required for cpu to device and/or device to cpu
ownership transfers.  The dma coherent allocator is for now still left
entirely to architecture supplied implementations due the amount of
variations.  Hopefully we can do some consolidation for them later on
as well.

A lot of architectures are currently doing very questionable things
in their dma mapping routines, which are documented in the changelogs
for each patch.  Please review them very careful and correct me on
incorrect assumptions.

Because this series sits on top of two previously submitted series
a git tree might be useful to actually test it.  It is provided here:

    git://git.infradead.org/users/hch/misc.git generic-dma-noncoherent

Gitweb:

    http://git.infradead.org/users/hch/misc.git/shortlog/refs/heads/generic-dma-noncoherent

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* [PATCH 01/22] dma-debug: move initialization to common code
  2018-04-20  8:02 ` Christoph Hellwig
                     ` (4 preceding siblings ...)
  (?)
@ 2018-04-20  8:02   ` Christoph Hellwig
  -1 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:02 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Most mainstream architectures are using 65536 entries, so lets stick to
that.  If someone is really desperate to override it that can still be
done through <asm/dma-mapping.h>, but I'd rather see a really good
rationale for that.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/arm/mm/dma-mapping-nommu.c |  9 ---------
 arch/arm/mm/dma-mapping.c       |  9 ---------
 arch/arm64/mm/dma-mapping.c     | 10 ----------
 arch/c6x/kernel/dma.c           | 11 -----------
 arch/ia64/kernel/dma-mapping.c  | 10 ----------
 arch/microblaze/kernel/dma.c    | 11 -----------
 arch/mips/mm/dma-default.c      | 10 ----------
 arch/openrisc/kernel/dma.c      | 11 -----------
 arch/powerpc/kernel/dma.c       |  3 ---
 arch/s390/pci/pci_dma.c         |  9 ---------
 arch/sh/mm/consistent.c         |  9 ---------
 arch/sparc/kernel/Makefile      |  2 --
 arch/sparc/kernel/dma.c         | 13 -------------
 arch/x86/kernel/pci-dma.c       |  4 ----
 arch/xtensa/kernel/pci-dma.c    |  9 ---------
 include/linux/dma-debug.h       |  6 ------
 lib/dma-debug.c                 | 21 ++++++++++++++-------
 17 files changed, 14 insertions(+), 143 deletions(-)
 delete mode 100644 arch/sparc/kernel/dma.c

diff --git a/arch/arm/mm/dma-mapping-nommu.c b/arch/arm/mm/dma-mapping-nommu.c
index 619f24a42d09..f448a0663b10 100644
--- a/arch/arm/mm/dma-mapping-nommu.c
+++ b/arch/arm/mm/dma-mapping-nommu.c
@@ -241,12 +241,3 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
 void arch_teardown_dma_ops(struct device *dev)
 {
 }
-
-#define PREALLOC_DMA_DEBUG_ENTRIES	4096
-
-static int __init dma_debug_do_init(void)
-{
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
-	return 0;
-}
-core_initcall(dma_debug_do_init);
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index 8c398fedbbb6..c26bf83f44ca 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -1165,15 +1165,6 @@ int arm_dma_supported(struct device *dev, u64 mask)
 	return __dma_supported(dev, mask, false);
 }
 
-#define PREALLOC_DMA_DEBUG_ENTRIES	4096
-
-static int __init dma_debug_do_init(void)
-{
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
-	return 0;
-}
-core_initcall(dma_debug_do_init);
-
 #ifdef CONFIG_ARM_DMA_USE_IOMMU
 
 static int __dma_info_to_prot(enum dma_data_direction dir, unsigned long attrs)
diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c
index a96ec0181818..db01f2709842 100644
--- a/arch/arm64/mm/dma-mapping.c
+++ b/arch/arm64/mm/dma-mapping.c
@@ -508,16 +508,6 @@ static int __init arm64_dma_init(void)
 }
 arch_initcall(arm64_dma_init);
 
-#define PREALLOC_DMA_DEBUG_ENTRIES	4096
-
-static int __init dma_debug_do_init(void)
-{
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
-	return 0;
-}
-fs_initcall(dma_debug_do_init);
-
-
 #ifdef CONFIG_IOMMU_DMA
 #include <linux/dma-iommu.h>
 #include <linux/platform_device.h>
diff --git a/arch/c6x/kernel/dma.c b/arch/c6x/kernel/dma.c
index 9fff8be75f58..31e1a9ec3a9c 100644
--- a/arch/c6x/kernel/dma.c
+++ b/arch/c6x/kernel/dma.c
@@ -136,14 +136,3 @@ const struct dma_map_ops c6x_dma_ops = {
 	.sync_sg_for_cpu	= c6x_dma_sync_sg_for_cpu,
 };
 EXPORT_SYMBOL(c6x_dma_ops);
-
-/* Number of entries preallocated for DMA-API debugging */
-#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);
diff --git a/arch/ia64/kernel/dma-mapping.c b/arch/ia64/kernel/dma-mapping.c
index f2d57e66fd86..7a471d8d67d4 100644
--- a/arch/ia64/kernel/dma-mapping.c
+++ b/arch/ia64/kernel/dma-mapping.c
@@ -9,16 +9,6 @@ int iommu_detected __read_mostly;
 const struct dma_map_ops *dma_ops;
 EXPORT_SYMBOL(dma_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);
-
 const struct dma_map_ops *dma_get_ops(struct device *dev)
 {
 	return dma_ops;
diff --git a/arch/microblaze/kernel/dma.c b/arch/microblaze/kernel/dma.c
index c91e8cef98dd..3145e7dc8ab1 100644
--- a/arch/microblaze/kernel/dma.c
+++ b/arch/microblaze/kernel/dma.c
@@ -184,14 +184,3 @@ const struct dma_map_ops dma_nommu_ops = {
 	.sync_sg_for_device	= dma_nommu_sync_sg_for_device,
 };
 EXPORT_SYMBOL(dma_nommu_ops);
-
-/* Number of entries preallocated for DMA-API debugging */
-#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);
diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c
index dcafa43613b6..f9fef0028ca2 100644
--- a/arch/mips/mm/dma-default.c
+++ b/arch/mips/mm/dma-default.c
@@ -402,13 +402,3 @@ static const struct dma_map_ops mips_default_dma_map_ops = {
 
 const struct dma_map_ops *mips_dma_map_ops = &mips_default_dma_map_ops;
 EXPORT_SYMBOL(mips_dma_map_ops);
-
-#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
-
-static int __init mips_dma_init(void)
-{
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
-
-	return 0;
-}
-fs_initcall(mips_dma_init);
diff --git a/arch/openrisc/kernel/dma.c b/arch/openrisc/kernel/dma.c
index a945f00011b4..ec7fd45704d2 100644
--- a/arch/openrisc/kernel/dma.c
+++ b/arch/openrisc/kernel/dma.c
@@ -247,14 +247,3 @@ const struct dma_map_ops or1k_dma_map_ops = {
 	.sync_single_for_device = or1k_sync_single_for_device,
 };
 EXPORT_SYMBOL(or1k_dma_map_ops);
-
-/* Number of entries preallocated for DMA-API debugging */
-#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);
diff --git a/arch/powerpc/kernel/dma.c b/arch/powerpc/kernel/dma.c
index da20569de9d4..138157deeadf 100644
--- a/arch/powerpc/kernel/dma.c
+++ b/arch/powerpc/kernel/dma.c
@@ -309,8 +309,6 @@ int dma_set_coherent_mask(struct device *dev, u64 mask)
 }
 EXPORT_SYMBOL(dma_set_coherent_mask);
 
-#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
-
 int dma_set_mask(struct device *dev, u64 dma_mask)
 {
 	if (ppc_md.dma_set_mask)
@@ -361,7 +359,6 @@ EXPORT_SYMBOL_GPL(dma_get_required_mask);
 
 static int __init dma_init(void)
 {
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
 #ifdef CONFIG_PCI
 	dma_debug_add_bus(&pci_bus_type);
 #endif
diff --git a/arch/s390/pci/pci_dma.c b/arch/s390/pci/pci_dma.c
index 10abf5ed6187..d387a0fbdd7e 100644
--- a/arch/s390/pci/pci_dma.c
+++ b/arch/s390/pci/pci_dma.c
@@ -668,15 +668,6 @@ void zpci_dma_exit(void)
 	kmem_cache_destroy(dma_region_table_cache);
 }
 
-#define PREALLOC_DMA_DEBUG_ENTRIES	(1 << 16)
-
-static int __init dma_debug_do_init(void)
-{
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
-	return 0;
-}
-fs_initcall(dma_debug_do_init);
-
 const struct dma_map_ops s390_pci_dma_ops = {
 	.alloc		= s390_dma_alloc,
 	.free		= s390_dma_free,
diff --git a/arch/sh/mm/consistent.c b/arch/sh/mm/consistent.c
index 6ea3aab508f2..a7bff3f29c2b 100644
--- a/arch/sh/mm/consistent.c
+++ b/arch/sh/mm/consistent.c
@@ -20,18 +20,9 @@
 #include <asm/cacheflush.h>
 #include <asm/addrspace.h>
 
-#define PREALLOC_DMA_DEBUG_ENTRIES	4096
-
 const struct dma_map_ops *dma_ops;
 EXPORT_SYMBOL(dma_ops);
 
-static int __init dma_init(void)
-{
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
-	return 0;
-}
-fs_initcall(dma_init);
-
 void *dma_generic_alloc_coherent(struct device *dev, size_t size,
 				 dma_addr_t *dma_handle, gfp_t gfp,
 				 unsigned long attrs)
diff --git a/arch/sparc/kernel/Makefile b/arch/sparc/kernel/Makefile
index a284662b0e4c..cf8640841b7a 100644
--- a/arch/sparc/kernel/Makefile
+++ b/arch/sparc/kernel/Makefile
@@ -74,8 +74,6 @@ obj-$(CONFIG_SPARC64)	+= pcr.o
 obj-$(CONFIG_SPARC64)	+= nmi.o
 obj-$(CONFIG_SPARC64_SMP) += cpumap.o
 
-obj-y                     += dma.o
-
 obj-$(CONFIG_PCIC_PCI)    += pcic.o
 obj-$(CONFIG_LEON_PCI)    += leon_pci.o
 obj-$(CONFIG_SPARC_GRPCI2)+= leon_pci_grpci2.o
diff --git a/arch/sparc/kernel/dma.c b/arch/sparc/kernel/dma.c
deleted file mode 100644
index f73e7597c971..000000000000
--- a/arch/sparc/kernel/dma.c
+++ /dev/null
@@ -1,13 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-#include <linux/kernel.h>
-#include <linux/dma-mapping.h>
-#include <linux/dma-debug.h>
-
-#define PREALLOC_DMA_DEBUG_ENTRIES       (1 << 15)
-
-static int __init dma_init(void)
-{
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
-	return 0;
-}
-fs_initcall(dma_init);
diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
index 77625b60a510..bcbaa2e8031e 100644
--- a/arch/x86/kernel/pci-dma.c
+++ b/arch/x86/kernel/pci-dma.c
@@ -55,9 +55,6 @@ struct device x86_dma_fallback_dev = {
 };
 EXPORT_SYMBOL(x86_dma_fallback_dev);
 
-/* Number of entries preallocated for DMA-API debugging */
-#define PREALLOC_DMA_DEBUG_ENTRIES       65536
-
 void __init pci_iommu_alloc(void)
 {
 	struct iommu_table_entry *p;
@@ -189,7 +186,6 @@ EXPORT_SYMBOL(arch_dma_supported);
 static int __init pci_iommu_init(void)
 {
 	struct iommu_table_entry *p;
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
 
 #ifdef CONFIG_PCI
 	dma_debug_add_bus(&pci_bus_type);
diff --git a/arch/xtensa/kernel/pci-dma.c b/arch/xtensa/kernel/pci-dma.c
index 732631ce250f..392b4a80ebc2 100644
--- a/arch/xtensa/kernel/pci-dma.c
+++ b/arch/xtensa/kernel/pci-dma.c
@@ -261,12 +261,3 @@ const struct dma_map_ops xtensa_dma_map_ops = {
 	.mapping_error = xtensa_dma_mapping_error,
 };
 EXPORT_SYMBOL(xtensa_dma_map_ops);
-
-#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
-
-static int __init xtensa_dma_init(void)
-{
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
-	return 0;
-}
-fs_initcall(xtensa_dma_init);
diff --git a/include/linux/dma-debug.h b/include/linux/dma-debug.h
index c7d844f09c3a..a785f2507159 100644
--- a/include/linux/dma-debug.h
+++ b/include/linux/dma-debug.h
@@ -30,8 +30,6 @@ struct bus_type;
 
 extern void dma_debug_add_bus(struct bus_type *bus);
 
-extern void dma_debug_init(u32 num_entries);
-
 extern int dma_debug_resize_entries(u32 num_entries);
 
 extern void debug_dma_map_page(struct device *dev, struct page *page,
@@ -100,10 +98,6 @@ static inline void dma_debug_add_bus(struct bus_type *bus)
 {
 }
 
-static inline void dma_debug_init(u32 num_entries)
-{
-}
-
 static inline int dma_debug_resize_entries(u32 num_entries)
 {
 	return 0;
diff --git a/lib/dma-debug.c b/lib/dma-debug.c
index 7f5cdc1e6b29..712a897174e4 100644
--- a/lib/dma-debug.c
+++ b/lib/dma-debug.c
@@ -41,6 +41,11 @@
 #define HASH_FN_SHIFT   13
 #define HASH_FN_MASK    (HASH_SIZE - 1)
 
+/* allow architectures to override this if absolutely required */
+#ifndef PREALLOC_DMA_DEBUG_ENTRIES
+#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
+#endif
+
 enum {
 	dma_debug_single,
 	dma_debug_page,
@@ -1004,18 +1009,16 @@ void dma_debug_add_bus(struct bus_type *bus)
 	bus_register_notifier(bus, nb);
 }
 
-/*
- * Let the architectures decide how many entries should be preallocated.
- */
-void dma_debug_init(u32 num_entries)
+static int dma_debug_init(void)
 {
+	u32 num_entries;
 	int i;
 
 	/* Do not use dma_debug_initialized here, since we really want to be
 	 * called to set dma_debug_initialized
 	 */
 	if (global_disable)
-		return;
+		return 0;
 
 	for (i = 0; i < HASH_SIZE; ++i) {
 		INIT_LIST_HEAD(&dma_entry_hash[i].list);
@@ -1026,17 +1029,19 @@ void dma_debug_init(u32 num_entries)
 		pr_err("DMA-API: error creating debugfs entries - disabling\n");
 		global_disable = true;
 
-		return;
+		return 0;
 	}
 
 	if (req_entries)
 		num_entries = req_entries;
+	else
+		num_entries = PREALLOC_DMA_DEBUG_ENTRIES;
 
 	if (prealloc_memory(num_entries) != 0) {
 		pr_err("DMA-API: debugging out of memory error - disabled\n");
 		global_disable = true;
 
-		return;
+		return 0;
 	}
 
 	nr_total_entries = num_free_entries;
@@ -1044,7 +1049,9 @@ void dma_debug_init(u32 num_entries)
 	dma_debug_initialized = true;
 
 	pr_info("DMA-API: debugging enabled by kernel config\n");
+	return 0;
 }
+core_initcall(dma_debug_init);
 
 static __init int dma_debug_cmdline(char *str)
 {
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 01/22] dma-debug: move initialization to common code
@ 2018-04-20  8:02   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:02 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Most mainstream architectures are using 65536 entries, so lets stick to
that.  If someone is really desperate to override it that can still be
done through <asm/dma-mapping.h>, but I'd rather see a really good
rationale for that.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/arm/mm/dma-mapping-nommu.c |  9 ---------
 arch/arm/mm/dma-mapping.c       |  9 ---------
 arch/arm64/mm/dma-mapping.c     | 10 ----------
 arch/c6x/kernel/dma.c           | 11 -----------
 arch/ia64/kernel/dma-mapping.c  | 10 ----------
 arch/microblaze/kernel/dma.c    | 11 -----------
 arch/mips/mm/dma-default.c      | 10 ----------
 arch/openrisc/kernel/dma.c      | 11 -----------
 arch/powerpc/kernel/dma.c       |  3 ---
 arch/s390/pci/pci_dma.c         |  9 ---------
 arch/sh/mm/consistent.c         |  9 ---------
 arch/sparc/kernel/Makefile      |  2 --
 arch/sparc/kernel/dma.c         | 13 -------------
 arch/x86/kernel/pci-dma.c       |  4 ----
 arch/xtensa/kernel/pci-dma.c    |  9 ---------
 include/linux/dma-debug.h       |  6 ------
 lib/dma-debug.c                 | 21 ++++++++++++++-------
 17 files changed, 14 insertions(+), 143 deletions(-)
 delete mode 100644 arch/sparc/kernel/dma.c

diff --git a/arch/arm/mm/dma-mapping-nommu.c b/arch/arm/mm/dma-mapping-nommu.c
index 619f24a42d09..f448a0663b10 100644
--- a/arch/arm/mm/dma-mapping-nommu.c
+++ b/arch/arm/mm/dma-mapping-nommu.c
@@ -241,12 +241,3 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
 void arch_teardown_dma_ops(struct device *dev)
 {
 }
-
-#define PREALLOC_DMA_DEBUG_ENTRIES	4096
-
-static int __init dma_debug_do_init(void)
-{
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
-	return 0;
-}
-core_initcall(dma_debug_do_init);
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index 8c398fedbbb6..c26bf83f44ca 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -1165,15 +1165,6 @@ int arm_dma_supported(struct device *dev, u64 mask)
 	return __dma_supported(dev, mask, false);
 }
 
-#define PREALLOC_DMA_DEBUG_ENTRIES	4096
-
-static int __init dma_debug_do_init(void)
-{
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
-	return 0;
-}
-core_initcall(dma_debug_do_init);
-
 #ifdef CONFIG_ARM_DMA_USE_IOMMU
 
 static int __dma_info_to_prot(enum dma_data_direction dir, unsigned long attrs)
diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c
index a96ec0181818..db01f2709842 100644
--- a/arch/arm64/mm/dma-mapping.c
+++ b/arch/arm64/mm/dma-mapping.c
@@ -508,16 +508,6 @@ static int __init arm64_dma_init(void)
 }
 arch_initcall(arm64_dma_init);
 
-#define PREALLOC_DMA_DEBUG_ENTRIES	4096
-
-static int __init dma_debug_do_init(void)
-{
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
-	return 0;
-}
-fs_initcall(dma_debug_do_init);
-
-
 #ifdef CONFIG_IOMMU_DMA
 #include <linux/dma-iommu.h>
 #include <linux/platform_device.h>
diff --git a/arch/c6x/kernel/dma.c b/arch/c6x/kernel/dma.c
index 9fff8be75f58..31e1a9ec3a9c 100644
--- a/arch/c6x/kernel/dma.c
+++ b/arch/c6x/kernel/dma.c
@@ -136,14 +136,3 @@ const struct dma_map_ops c6x_dma_ops = {
 	.sync_sg_for_cpu	= c6x_dma_sync_sg_for_cpu,
 };
 EXPORT_SYMBOL(c6x_dma_ops);
-
-/* Number of entries preallocated for DMA-API debugging */
-#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);
diff --git a/arch/ia64/kernel/dma-mapping.c b/arch/ia64/kernel/dma-mapping.c
index f2d57e66fd86..7a471d8d67d4 100644
--- a/arch/ia64/kernel/dma-mapping.c
+++ b/arch/ia64/kernel/dma-mapping.c
@@ -9,16 +9,6 @@ int iommu_detected __read_mostly;
 const struct dma_map_ops *dma_ops;
 EXPORT_SYMBOL(dma_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);
-
 const struct dma_map_ops *dma_get_ops(struct device *dev)
 {
 	return dma_ops;
diff --git a/arch/microblaze/kernel/dma.c b/arch/microblaze/kernel/dma.c
index c91e8cef98dd..3145e7dc8ab1 100644
--- a/arch/microblaze/kernel/dma.c
+++ b/arch/microblaze/kernel/dma.c
@@ -184,14 +184,3 @@ const struct dma_map_ops dma_nommu_ops = {
 	.sync_sg_for_device	= dma_nommu_sync_sg_for_device,
 };
 EXPORT_SYMBOL(dma_nommu_ops);
-
-/* Number of entries preallocated for DMA-API debugging */
-#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);
diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c
index dcafa43613b6..f9fef0028ca2 100644
--- a/arch/mips/mm/dma-default.c
+++ b/arch/mips/mm/dma-default.c
@@ -402,13 +402,3 @@ static const struct dma_map_ops mips_default_dma_map_ops = {
 
 const struct dma_map_ops *mips_dma_map_ops = &mips_default_dma_map_ops;
 EXPORT_SYMBOL(mips_dma_map_ops);
-
-#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
-
-static int __init mips_dma_init(void)
-{
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
-
-	return 0;
-}
-fs_initcall(mips_dma_init);
diff --git a/arch/openrisc/kernel/dma.c b/arch/openrisc/kernel/dma.c
index a945f00011b4..ec7fd45704d2 100644
--- a/arch/openrisc/kernel/dma.c
+++ b/arch/openrisc/kernel/dma.c
@@ -247,14 +247,3 @@ const struct dma_map_ops or1k_dma_map_ops = {
 	.sync_single_for_device = or1k_sync_single_for_device,
 };
 EXPORT_SYMBOL(or1k_dma_map_ops);
-
-/* Number of entries preallocated for DMA-API debugging */
-#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);
diff --git a/arch/powerpc/kernel/dma.c b/arch/powerpc/kernel/dma.c
index da20569de9d4..138157deeadf 100644
--- a/arch/powerpc/kernel/dma.c
+++ b/arch/powerpc/kernel/dma.c
@@ -309,8 +309,6 @@ int dma_set_coherent_mask(struct device *dev, u64 mask)
 }
 EXPORT_SYMBOL(dma_set_coherent_mask);
 
-#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
-
 int dma_set_mask(struct device *dev, u64 dma_mask)
 {
 	if (ppc_md.dma_set_mask)
@@ -361,7 +359,6 @@ EXPORT_SYMBOL_GPL(dma_get_required_mask);
 
 static int __init dma_init(void)
 {
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
 #ifdef CONFIG_PCI
 	dma_debug_add_bus(&pci_bus_type);
 #endif
diff --git a/arch/s390/pci/pci_dma.c b/arch/s390/pci/pci_dma.c
index 10abf5ed6187..d387a0fbdd7e 100644
--- a/arch/s390/pci/pci_dma.c
+++ b/arch/s390/pci/pci_dma.c
@@ -668,15 +668,6 @@ void zpci_dma_exit(void)
 	kmem_cache_destroy(dma_region_table_cache);
 }
 
-#define PREALLOC_DMA_DEBUG_ENTRIES	(1 << 16)
-
-static int __init dma_debug_do_init(void)
-{
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
-	return 0;
-}
-fs_initcall(dma_debug_do_init);
-
 const struct dma_map_ops s390_pci_dma_ops = {
 	.alloc		= s390_dma_alloc,
 	.free		= s390_dma_free,
diff --git a/arch/sh/mm/consistent.c b/arch/sh/mm/consistent.c
index 6ea3aab508f2..a7bff3f29c2b 100644
--- a/arch/sh/mm/consistent.c
+++ b/arch/sh/mm/consistent.c
@@ -20,18 +20,9 @@
 #include <asm/cacheflush.h>
 #include <asm/addrspace.h>
 
-#define PREALLOC_DMA_DEBUG_ENTRIES	4096
-
 const struct dma_map_ops *dma_ops;
 EXPORT_SYMBOL(dma_ops);
 
-static int __init dma_init(void)
-{
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
-	return 0;
-}
-fs_initcall(dma_init);
-
 void *dma_generic_alloc_coherent(struct device *dev, size_t size,
 				 dma_addr_t *dma_handle, gfp_t gfp,
 				 unsigned long attrs)
diff --git a/arch/sparc/kernel/Makefile b/arch/sparc/kernel/Makefile
index a284662b0e4c..cf8640841b7a 100644
--- a/arch/sparc/kernel/Makefile
+++ b/arch/sparc/kernel/Makefile
@@ -74,8 +74,6 @@ obj-$(CONFIG_SPARC64)	+= pcr.o
 obj-$(CONFIG_SPARC64)	+= nmi.o
 obj-$(CONFIG_SPARC64_SMP) += cpumap.o
 
-obj-y                     += dma.o
-
 obj-$(CONFIG_PCIC_PCI)    += pcic.o
 obj-$(CONFIG_LEON_PCI)    += leon_pci.o
 obj-$(CONFIG_SPARC_GRPCI2)+= leon_pci_grpci2.o
diff --git a/arch/sparc/kernel/dma.c b/arch/sparc/kernel/dma.c
deleted file mode 100644
index f73e7597c971..000000000000
--- a/arch/sparc/kernel/dma.c
+++ /dev/null
@@ -1,13 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-#include <linux/kernel.h>
-#include <linux/dma-mapping.h>
-#include <linux/dma-debug.h>
-
-#define PREALLOC_DMA_DEBUG_ENTRIES       (1 << 15)
-
-static int __init dma_init(void)
-{
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
-	return 0;
-}
-fs_initcall(dma_init);
diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
index 77625b60a510..bcbaa2e8031e 100644
--- a/arch/x86/kernel/pci-dma.c
+++ b/arch/x86/kernel/pci-dma.c
@@ -55,9 +55,6 @@ struct device x86_dma_fallback_dev = {
 };
 EXPORT_SYMBOL(x86_dma_fallback_dev);
 
-/* Number of entries preallocated for DMA-API debugging */
-#define PREALLOC_DMA_DEBUG_ENTRIES       65536
-
 void __init pci_iommu_alloc(void)
 {
 	struct iommu_table_entry *p;
@@ -189,7 +186,6 @@ EXPORT_SYMBOL(arch_dma_supported);
 static int __init pci_iommu_init(void)
 {
 	struct iommu_table_entry *p;
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
 
 #ifdef CONFIG_PCI
 	dma_debug_add_bus(&pci_bus_type);
diff --git a/arch/xtensa/kernel/pci-dma.c b/arch/xtensa/kernel/pci-dma.c
index 732631ce250f..392b4a80ebc2 100644
--- a/arch/xtensa/kernel/pci-dma.c
+++ b/arch/xtensa/kernel/pci-dma.c
@@ -261,12 +261,3 @@ const struct dma_map_ops xtensa_dma_map_ops = {
 	.mapping_error = xtensa_dma_mapping_error,
 };
 EXPORT_SYMBOL(xtensa_dma_map_ops);
-
-#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
-
-static int __init xtensa_dma_init(void)
-{
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
-	return 0;
-}
-fs_initcall(xtensa_dma_init);
diff --git a/include/linux/dma-debug.h b/include/linux/dma-debug.h
index c7d844f09c3a..a785f2507159 100644
--- a/include/linux/dma-debug.h
+++ b/include/linux/dma-debug.h
@@ -30,8 +30,6 @@ struct bus_type;
 
 extern void dma_debug_add_bus(struct bus_type *bus);
 
-extern void dma_debug_init(u32 num_entries);
-
 extern int dma_debug_resize_entries(u32 num_entries);
 
 extern void debug_dma_map_page(struct device *dev, struct page *page,
@@ -100,10 +98,6 @@ static inline void dma_debug_add_bus(struct bus_type *bus)
 {
 }
 
-static inline void dma_debug_init(u32 num_entries)
-{
-}
-
 static inline int dma_debug_resize_entries(u32 num_entries)
 {
 	return 0;
diff --git a/lib/dma-debug.c b/lib/dma-debug.c
index 7f5cdc1e6b29..712a897174e4 100644
--- a/lib/dma-debug.c
+++ b/lib/dma-debug.c
@@ -41,6 +41,11 @@
 #define HASH_FN_SHIFT   13
 #define HASH_FN_MASK    (HASH_SIZE - 1)
 
+/* allow architectures to override this if absolutely required */
+#ifndef PREALLOC_DMA_DEBUG_ENTRIES
+#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
+#endif
+
 enum {
 	dma_debug_single,
 	dma_debug_page,
@@ -1004,18 +1009,16 @@ void dma_debug_add_bus(struct bus_type *bus)
 	bus_register_notifier(bus, nb);
 }
 
-/*
- * Let the architectures decide how many entries should be preallocated.
- */
-void dma_debug_init(u32 num_entries)
+static int dma_debug_init(void)
 {
+	u32 num_entries;
 	int i;
 
 	/* Do not use dma_debug_initialized here, since we really want to be
 	 * called to set dma_debug_initialized
 	 */
 	if (global_disable)
-		return;
+		return 0;
 
 	for (i = 0; i < HASH_SIZE; ++i) {
 		INIT_LIST_HEAD(&dma_entry_hash[i].list);
@@ -1026,17 +1029,19 @@ void dma_debug_init(u32 num_entries)
 		pr_err("DMA-API: error creating debugfs entries - disabling\n");
 		global_disable = true;
 
-		return;
+		return 0;
 	}
 
 	if (req_entries)
 		num_entries = req_entries;
+	else
+		num_entries = PREALLOC_DMA_DEBUG_ENTRIES;
 
 	if (prealloc_memory(num_entries) != 0) {
 		pr_err("DMA-API: debugging out of memory error - disabled\n");
 		global_disable = true;
 
-		return;
+		return 0;
 	}
 
 	nr_total_entries = num_free_entries;
@@ -1044,7 +1049,9 @@ void dma_debug_init(u32 num_entries)
 	dma_debug_initialized = true;
 
 	pr_info("DMA-API: debugging enabled by kernel config\n");
+	return 0;
 }
+core_initcall(dma_debug_init);
 
 static __init int dma_debug_cmdline(char *str)
 {
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 01/22] dma-debug: move initialization to common code
@ 2018-04-20  8:02   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:02 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Most mainstream architectures are using 65536 entries, so lets stick to
that.  If someone is really desperate to override it that can still be
done through <asm/dma-mapping.h>, but I'd rather see a really good
rationale for that.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/arm/mm/dma-mapping-nommu.c |  9 ---------
 arch/arm/mm/dma-mapping.c       |  9 ---------
 arch/arm64/mm/dma-mapping.c     | 10 ----------
 arch/c6x/kernel/dma.c           | 11 -----------
 arch/ia64/kernel/dma-mapping.c  | 10 ----------
 arch/microblaze/kernel/dma.c    | 11 -----------
 arch/mips/mm/dma-default.c      | 10 ----------
 arch/openrisc/kernel/dma.c      | 11 -----------
 arch/powerpc/kernel/dma.c       |  3 ---
 arch/s390/pci/pci_dma.c         |  9 ---------
 arch/sh/mm/consistent.c         |  9 ---------
 arch/sparc/kernel/Makefile      |  2 --
 arch/sparc/kernel/dma.c         | 13 -------------
 arch/x86/kernel/pci-dma.c       |  4 ----
 arch/xtensa/kernel/pci-dma.c    |  9 ---------
 include/linux/dma-debug.h       |  6 ------
 lib/dma-debug.c                 | 21 ++++++++++++++-------
 17 files changed, 14 insertions(+), 143 deletions(-)
 delete mode 100644 arch/sparc/kernel/dma.c

diff --git a/arch/arm/mm/dma-mapping-nommu.c b/arch/arm/mm/dma-mapping-nommu.c
index 619f24a42d09..f448a0663b10 100644
--- a/arch/arm/mm/dma-mapping-nommu.c
+++ b/arch/arm/mm/dma-mapping-nommu.c
@@ -241,12 +241,3 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
 void arch_teardown_dma_ops(struct device *dev)
 {
 }
-
-#define PREALLOC_DMA_DEBUG_ENTRIES	4096
-
-static int __init dma_debug_do_init(void)
-{
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
-	return 0;
-}
-core_initcall(dma_debug_do_init);
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index 8c398fedbbb6..c26bf83f44ca 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -1165,15 +1165,6 @@ int arm_dma_supported(struct device *dev, u64 mask)
 	return __dma_supported(dev, mask, false);
 }
 
-#define PREALLOC_DMA_DEBUG_ENTRIES	4096
-
-static int __init dma_debug_do_init(void)
-{
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
-	return 0;
-}
-core_initcall(dma_debug_do_init);
-
 #ifdef CONFIG_ARM_DMA_USE_IOMMU
 
 static int __dma_info_to_prot(enum dma_data_direction dir, unsigned long attrs)
diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c
index a96ec0181818..db01f2709842 100644
--- a/arch/arm64/mm/dma-mapping.c
+++ b/arch/arm64/mm/dma-mapping.c
@@ -508,16 +508,6 @@ static int __init arm64_dma_init(void)
 }
 arch_initcall(arm64_dma_init);
 
-#define PREALLOC_DMA_DEBUG_ENTRIES	4096
-
-static int __init dma_debug_do_init(void)
-{
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
-	return 0;
-}
-fs_initcall(dma_debug_do_init);
-
-
 #ifdef CONFIG_IOMMU_DMA
 #include <linux/dma-iommu.h>
 #include <linux/platform_device.h>
diff --git a/arch/c6x/kernel/dma.c b/arch/c6x/kernel/dma.c
index 9fff8be75f58..31e1a9ec3a9c 100644
--- a/arch/c6x/kernel/dma.c
+++ b/arch/c6x/kernel/dma.c
@@ -136,14 +136,3 @@ const struct dma_map_ops c6x_dma_ops = {
 	.sync_sg_for_cpu	= c6x_dma_sync_sg_for_cpu,
 };
 EXPORT_SYMBOL(c6x_dma_ops);
-
-/* Number of entries preallocated for DMA-API debugging */
-#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);
diff --git a/arch/ia64/kernel/dma-mapping.c b/arch/ia64/kernel/dma-mapping.c
index f2d57e66fd86..7a471d8d67d4 100644
--- a/arch/ia64/kernel/dma-mapping.c
+++ b/arch/ia64/kernel/dma-mapping.c
@@ -9,16 +9,6 @@ int iommu_detected __read_mostly;
 const struct dma_map_ops *dma_ops;
 EXPORT_SYMBOL(dma_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);
-
 const struct dma_map_ops *dma_get_ops(struct device *dev)
 {
 	return dma_ops;
diff --git a/arch/microblaze/kernel/dma.c b/arch/microblaze/kernel/dma.c
index c91e8cef98dd..3145e7dc8ab1 100644
--- a/arch/microblaze/kernel/dma.c
+++ b/arch/microblaze/kernel/dma.c
@@ -184,14 +184,3 @@ const struct dma_map_ops dma_nommu_ops = {
 	.sync_sg_for_device	= dma_nommu_sync_sg_for_device,
 };
 EXPORT_SYMBOL(dma_nommu_ops);
-
-/* Number of entries preallocated for DMA-API debugging */
-#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);
diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c
index dcafa43613b6..f9fef0028ca2 100644
--- a/arch/mips/mm/dma-default.c
+++ b/arch/mips/mm/dma-default.c
@@ -402,13 +402,3 @@ static const struct dma_map_ops mips_default_dma_map_ops = {
 
 const struct dma_map_ops *mips_dma_map_ops = &mips_default_dma_map_ops;
 EXPORT_SYMBOL(mips_dma_map_ops);
-
-#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
-
-static int __init mips_dma_init(void)
-{
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
-
-	return 0;
-}
-fs_initcall(mips_dma_init);
diff --git a/arch/openrisc/kernel/dma.c b/arch/openrisc/kernel/dma.c
index a945f00011b4..ec7fd45704d2 100644
--- a/arch/openrisc/kernel/dma.c
+++ b/arch/openrisc/kernel/dma.c
@@ -247,14 +247,3 @@ const struct dma_map_ops or1k_dma_map_ops = {
 	.sync_single_for_device = or1k_sync_single_for_device,
 };
 EXPORT_SYMBOL(or1k_dma_map_ops);
-
-/* Number of entries preallocated for DMA-API debugging */
-#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);
diff --git a/arch/powerpc/kernel/dma.c b/arch/powerpc/kernel/dma.c
index da20569de9d4..138157deeadf 100644
--- a/arch/powerpc/kernel/dma.c
+++ b/arch/powerpc/kernel/dma.c
@@ -309,8 +309,6 @@ int dma_set_coherent_mask(struct device *dev, u64 mask)
 }
 EXPORT_SYMBOL(dma_set_coherent_mask);
 
-#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
-
 int dma_set_mask(struct device *dev, u64 dma_mask)
 {
 	if (ppc_md.dma_set_mask)
@@ -361,7 +359,6 @@ EXPORT_SYMBOL_GPL(dma_get_required_mask);
 
 static int __init dma_init(void)
 {
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
 #ifdef CONFIG_PCI
 	dma_debug_add_bus(&pci_bus_type);
 #endif
diff --git a/arch/s390/pci/pci_dma.c b/arch/s390/pci/pci_dma.c
index 10abf5ed6187..d387a0fbdd7e 100644
--- a/arch/s390/pci/pci_dma.c
+++ b/arch/s390/pci/pci_dma.c
@@ -668,15 +668,6 @@ void zpci_dma_exit(void)
 	kmem_cache_destroy(dma_region_table_cache);
 }
 
-#define PREALLOC_DMA_DEBUG_ENTRIES	(1 << 16)
-
-static int __init dma_debug_do_init(void)
-{
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
-	return 0;
-}
-fs_initcall(dma_debug_do_init);
-
 const struct dma_map_ops s390_pci_dma_ops = {
 	.alloc		= s390_dma_alloc,
 	.free		= s390_dma_free,
diff --git a/arch/sh/mm/consistent.c b/arch/sh/mm/consistent.c
index 6ea3aab508f2..a7bff3f29c2b 100644
--- a/arch/sh/mm/consistent.c
+++ b/arch/sh/mm/consistent.c
@@ -20,18 +20,9 @@
 #include <asm/cacheflush.h>
 #include <asm/addrspace.h>
 
-#define PREALLOC_DMA_DEBUG_ENTRIES	4096
-
 const struct dma_map_ops *dma_ops;
 EXPORT_SYMBOL(dma_ops);
 
-static int __init dma_init(void)
-{
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
-	return 0;
-}
-fs_initcall(dma_init);
-
 void *dma_generic_alloc_coherent(struct device *dev, size_t size,
 				 dma_addr_t *dma_handle, gfp_t gfp,
 				 unsigned long attrs)
diff --git a/arch/sparc/kernel/Makefile b/arch/sparc/kernel/Makefile
index a284662b0e4c..cf8640841b7a 100644
--- a/arch/sparc/kernel/Makefile
+++ b/arch/sparc/kernel/Makefile
@@ -74,8 +74,6 @@ obj-$(CONFIG_SPARC64)	+= pcr.o
 obj-$(CONFIG_SPARC64)	+= nmi.o
 obj-$(CONFIG_SPARC64_SMP) += cpumap.o
 
-obj-y                     += dma.o
-
 obj-$(CONFIG_PCIC_PCI)    += pcic.o
 obj-$(CONFIG_LEON_PCI)    += leon_pci.o
 obj-$(CONFIG_SPARC_GRPCI2)+= leon_pci_grpci2.o
diff --git a/arch/sparc/kernel/dma.c b/arch/sparc/kernel/dma.c
deleted file mode 100644
index f73e7597c971..000000000000
--- a/arch/sparc/kernel/dma.c
+++ /dev/null
@@ -1,13 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-#include <linux/kernel.h>
-#include <linux/dma-mapping.h>
-#include <linux/dma-debug.h>
-
-#define PREALLOC_DMA_DEBUG_ENTRIES       (1 << 15)
-
-static int __init dma_init(void)
-{
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
-	return 0;
-}
-fs_initcall(dma_init);
diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
index 77625b60a510..bcbaa2e8031e 100644
--- a/arch/x86/kernel/pci-dma.c
+++ b/arch/x86/kernel/pci-dma.c
@@ -55,9 +55,6 @@ struct device x86_dma_fallback_dev = {
 };
 EXPORT_SYMBOL(x86_dma_fallback_dev);
 
-/* Number of entries preallocated for DMA-API debugging */
-#define PREALLOC_DMA_DEBUG_ENTRIES       65536
-
 void __init pci_iommu_alloc(void)
 {
 	struct iommu_table_entry *p;
@@ -189,7 +186,6 @@ EXPORT_SYMBOL(arch_dma_supported);
 static int __init pci_iommu_init(void)
 {
 	struct iommu_table_entry *p;
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
 
 #ifdef CONFIG_PCI
 	dma_debug_add_bus(&pci_bus_type);
diff --git a/arch/xtensa/kernel/pci-dma.c b/arch/xtensa/kernel/pci-dma.c
index 732631ce250f..392b4a80ebc2 100644
--- a/arch/xtensa/kernel/pci-dma.c
+++ b/arch/xtensa/kernel/pci-dma.c
@@ -261,12 +261,3 @@ const struct dma_map_ops xtensa_dma_map_ops = {
 	.mapping_error = xtensa_dma_mapping_error,
 };
 EXPORT_SYMBOL(xtensa_dma_map_ops);
-
-#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
-
-static int __init xtensa_dma_init(void)
-{
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
-	return 0;
-}
-fs_initcall(xtensa_dma_init);
diff --git a/include/linux/dma-debug.h b/include/linux/dma-debug.h
index c7d844f09c3a..a785f2507159 100644
--- a/include/linux/dma-debug.h
+++ b/include/linux/dma-debug.h
@@ -30,8 +30,6 @@ struct bus_type;
 
 extern void dma_debug_add_bus(struct bus_type *bus);
 
-extern void dma_debug_init(u32 num_entries);
-
 extern int dma_debug_resize_entries(u32 num_entries);
 
 extern void debug_dma_map_page(struct device *dev, struct page *page,
@@ -100,10 +98,6 @@ static inline void dma_debug_add_bus(struct bus_type *bus)
 {
 }
 
-static inline void dma_debug_init(u32 num_entries)
-{
-}
-
 static inline int dma_debug_resize_entries(u32 num_entries)
 {
 	return 0;
diff --git a/lib/dma-debug.c b/lib/dma-debug.c
index 7f5cdc1e6b29..712a897174e4 100644
--- a/lib/dma-debug.c
+++ b/lib/dma-debug.c
@@ -41,6 +41,11 @@
 #define HASH_FN_SHIFT   13
 #define HASH_FN_MASK    (HASH_SIZE - 1)
 
+/* allow architectures to override this if absolutely required */
+#ifndef PREALLOC_DMA_DEBUG_ENTRIES
+#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
+#endif
+
 enum {
 	dma_debug_single,
 	dma_debug_page,
@@ -1004,18 +1009,16 @@ void dma_debug_add_bus(struct bus_type *bus)
 	bus_register_notifier(bus, nb);
 }
 
-/*
- * Let the architectures decide how many entries should be preallocated.
- */
-void dma_debug_init(u32 num_entries)
+static int dma_debug_init(void)
 {
+	u32 num_entries;
 	int i;
 
 	/* Do not use dma_debug_initialized here, since we really want to be
 	 * called to set dma_debug_initialized
 	 */
 	if (global_disable)
-		return;
+		return 0;
 
 	for (i = 0; i < HASH_SIZE; ++i) {
 		INIT_LIST_HEAD(&dma_entry_hash[i].list);
@@ -1026,17 +1029,19 @@ void dma_debug_init(u32 num_entries)
 		pr_err("DMA-API: error creating debugfs entries - disabling\n");
 		global_disable = true;
 
-		return;
+		return 0;
 	}
 
 	if (req_entries)
 		num_entries = req_entries;
+	else
+		num_entries = PREALLOC_DMA_DEBUG_ENTRIES;
 
 	if (prealloc_memory(num_entries) != 0) {
 		pr_err("DMA-API: debugging out of memory error - disabled\n");
 		global_disable = true;
 
-		return;
+		return 0;
 	}
 
 	nr_total_entries = num_free_entries;
@@ -1044,7 +1049,9 @@ void dma_debug_init(u32 num_entries)
 	dma_debug_initialized = true;
 
 	pr_info("DMA-API: debugging enabled by kernel config\n");
+	return 0;
 }
+core_initcall(dma_debug_init);
 
 static __init int dma_debug_cmdline(char *str)
 {
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 01/22] dma-debug: move initialization to common code
@ 2018-04-20  8:02   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:02 UTC (permalink / raw)
  To: linux-snps-arc

Most mainstream architectures are using 65536 entries, so lets stick to
that.  If someone is really desperate to override it that can still be
done through <asm/dma-mapping.h>, but I'd rather see a really good
rationale for that.

Signed-off-by: Christoph Hellwig <hch at lst.de>
---
 arch/arm/mm/dma-mapping-nommu.c |  9 ---------
 arch/arm/mm/dma-mapping.c       |  9 ---------
 arch/arm64/mm/dma-mapping.c     | 10 ----------
 arch/c6x/kernel/dma.c           | 11 -----------
 arch/ia64/kernel/dma-mapping.c  | 10 ----------
 arch/microblaze/kernel/dma.c    | 11 -----------
 arch/mips/mm/dma-default.c      | 10 ----------
 arch/openrisc/kernel/dma.c      | 11 -----------
 arch/powerpc/kernel/dma.c       |  3 ---
 arch/s390/pci/pci_dma.c         |  9 ---------
 arch/sh/mm/consistent.c         |  9 ---------
 arch/sparc/kernel/Makefile      |  2 --
 arch/sparc/kernel/dma.c         | 13 -------------
 arch/x86/kernel/pci-dma.c       |  4 ----
 arch/xtensa/kernel/pci-dma.c    |  9 ---------
 include/linux/dma-debug.h       |  6 ------
 lib/dma-debug.c                 | 21 ++++++++++++++-------
 17 files changed, 14 insertions(+), 143 deletions(-)
 delete mode 100644 arch/sparc/kernel/dma.c

diff --git a/arch/arm/mm/dma-mapping-nommu.c b/arch/arm/mm/dma-mapping-nommu.c
index 619f24a42d09..f448a0663b10 100644
--- a/arch/arm/mm/dma-mapping-nommu.c
+++ b/arch/arm/mm/dma-mapping-nommu.c
@@ -241,12 +241,3 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
 void arch_teardown_dma_ops(struct device *dev)
 {
 }
-
-#define PREALLOC_DMA_DEBUG_ENTRIES	4096
-
-static int __init dma_debug_do_init(void)
-{
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
-	return 0;
-}
-core_initcall(dma_debug_do_init);
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index 8c398fedbbb6..c26bf83f44ca 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -1165,15 +1165,6 @@ int arm_dma_supported(struct device *dev, u64 mask)
 	return __dma_supported(dev, mask, false);
 }
 
-#define PREALLOC_DMA_DEBUG_ENTRIES	4096
-
-static int __init dma_debug_do_init(void)
-{
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
-	return 0;
-}
-core_initcall(dma_debug_do_init);
-
 #ifdef CONFIG_ARM_DMA_USE_IOMMU
 
 static int __dma_info_to_prot(enum dma_data_direction dir, unsigned long attrs)
diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c
index a96ec0181818..db01f2709842 100644
--- a/arch/arm64/mm/dma-mapping.c
+++ b/arch/arm64/mm/dma-mapping.c
@@ -508,16 +508,6 @@ static int __init arm64_dma_init(void)
 }
 arch_initcall(arm64_dma_init);
 
-#define PREALLOC_DMA_DEBUG_ENTRIES	4096
-
-static int __init dma_debug_do_init(void)
-{
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
-	return 0;
-}
-fs_initcall(dma_debug_do_init);
-
-
 #ifdef CONFIG_IOMMU_DMA
 #include <linux/dma-iommu.h>
 #include <linux/platform_device.h>
diff --git a/arch/c6x/kernel/dma.c b/arch/c6x/kernel/dma.c
index 9fff8be75f58..31e1a9ec3a9c 100644
--- a/arch/c6x/kernel/dma.c
+++ b/arch/c6x/kernel/dma.c
@@ -136,14 +136,3 @@ const struct dma_map_ops c6x_dma_ops = {
 	.sync_sg_for_cpu	= c6x_dma_sync_sg_for_cpu,
 };
 EXPORT_SYMBOL(c6x_dma_ops);
-
-/* Number of entries preallocated for DMA-API debugging */
-#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);
diff --git a/arch/ia64/kernel/dma-mapping.c b/arch/ia64/kernel/dma-mapping.c
index f2d57e66fd86..7a471d8d67d4 100644
--- a/arch/ia64/kernel/dma-mapping.c
+++ b/arch/ia64/kernel/dma-mapping.c
@@ -9,16 +9,6 @@ int iommu_detected __read_mostly;
 const struct dma_map_ops *dma_ops;
 EXPORT_SYMBOL(dma_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);
-
 const struct dma_map_ops *dma_get_ops(struct device *dev)
 {
 	return dma_ops;
diff --git a/arch/microblaze/kernel/dma.c b/arch/microblaze/kernel/dma.c
index c91e8cef98dd..3145e7dc8ab1 100644
--- a/arch/microblaze/kernel/dma.c
+++ b/arch/microblaze/kernel/dma.c
@@ -184,14 +184,3 @@ const struct dma_map_ops dma_nommu_ops = {
 	.sync_sg_for_device	= dma_nommu_sync_sg_for_device,
 };
 EXPORT_SYMBOL(dma_nommu_ops);
-
-/* Number of entries preallocated for DMA-API debugging */
-#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);
diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c
index dcafa43613b6..f9fef0028ca2 100644
--- a/arch/mips/mm/dma-default.c
+++ b/arch/mips/mm/dma-default.c
@@ -402,13 +402,3 @@ static const struct dma_map_ops mips_default_dma_map_ops = {
 
 const struct dma_map_ops *mips_dma_map_ops = &mips_default_dma_map_ops;
 EXPORT_SYMBOL(mips_dma_map_ops);
-
-#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
-
-static int __init mips_dma_init(void)
-{
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
-
-	return 0;
-}
-fs_initcall(mips_dma_init);
diff --git a/arch/openrisc/kernel/dma.c b/arch/openrisc/kernel/dma.c
index a945f00011b4..ec7fd45704d2 100644
--- a/arch/openrisc/kernel/dma.c
+++ b/arch/openrisc/kernel/dma.c
@@ -247,14 +247,3 @@ const struct dma_map_ops or1k_dma_map_ops = {
 	.sync_single_for_device = or1k_sync_single_for_device,
 };
 EXPORT_SYMBOL(or1k_dma_map_ops);
-
-/* Number of entries preallocated for DMA-API debugging */
-#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);
diff --git a/arch/powerpc/kernel/dma.c b/arch/powerpc/kernel/dma.c
index da20569de9d4..138157deeadf 100644
--- a/arch/powerpc/kernel/dma.c
+++ b/arch/powerpc/kernel/dma.c
@@ -309,8 +309,6 @@ int dma_set_coherent_mask(struct device *dev, u64 mask)
 }
 EXPORT_SYMBOL(dma_set_coherent_mask);
 
-#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
-
 int dma_set_mask(struct device *dev, u64 dma_mask)
 {
 	if (ppc_md.dma_set_mask)
@@ -361,7 +359,6 @@ EXPORT_SYMBOL_GPL(dma_get_required_mask);
 
 static int __init dma_init(void)
 {
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
 #ifdef CONFIG_PCI
 	dma_debug_add_bus(&pci_bus_type);
 #endif
diff --git a/arch/s390/pci/pci_dma.c b/arch/s390/pci/pci_dma.c
index 10abf5ed6187..d387a0fbdd7e 100644
--- a/arch/s390/pci/pci_dma.c
+++ b/arch/s390/pci/pci_dma.c
@@ -668,15 +668,6 @@ void zpci_dma_exit(void)
 	kmem_cache_destroy(dma_region_table_cache);
 }
 
-#define PREALLOC_DMA_DEBUG_ENTRIES	(1 << 16)
-
-static int __init dma_debug_do_init(void)
-{
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
-	return 0;
-}
-fs_initcall(dma_debug_do_init);
-
 const struct dma_map_ops s390_pci_dma_ops = {
 	.alloc		= s390_dma_alloc,
 	.free		= s390_dma_free,
diff --git a/arch/sh/mm/consistent.c b/arch/sh/mm/consistent.c
index 6ea3aab508f2..a7bff3f29c2b 100644
--- a/arch/sh/mm/consistent.c
+++ b/arch/sh/mm/consistent.c
@@ -20,18 +20,9 @@
 #include <asm/cacheflush.h>
 #include <asm/addrspace.h>
 
-#define PREALLOC_DMA_DEBUG_ENTRIES	4096
-
 const struct dma_map_ops *dma_ops;
 EXPORT_SYMBOL(dma_ops);
 
-static int __init dma_init(void)
-{
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
-	return 0;
-}
-fs_initcall(dma_init);
-
 void *dma_generic_alloc_coherent(struct device *dev, size_t size,
 				 dma_addr_t *dma_handle, gfp_t gfp,
 				 unsigned long attrs)
diff --git a/arch/sparc/kernel/Makefile b/arch/sparc/kernel/Makefile
index a284662b0e4c..cf8640841b7a 100644
--- a/arch/sparc/kernel/Makefile
+++ b/arch/sparc/kernel/Makefile
@@ -74,8 +74,6 @@ obj-$(CONFIG_SPARC64)	+= pcr.o
 obj-$(CONFIG_SPARC64)	+= nmi.o
 obj-$(CONFIG_SPARC64_SMP) += cpumap.o
 
-obj-y                     += dma.o
-
 obj-$(CONFIG_PCIC_PCI)    += pcic.o
 obj-$(CONFIG_LEON_PCI)    += leon_pci.o
 obj-$(CONFIG_SPARC_GRPCI2)+= leon_pci_grpci2.o
diff --git a/arch/sparc/kernel/dma.c b/arch/sparc/kernel/dma.c
deleted file mode 100644
index f73e7597c971..000000000000
--- a/arch/sparc/kernel/dma.c
+++ /dev/null
@@ -1,13 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-#include <linux/kernel.h>
-#include <linux/dma-mapping.h>
-#include <linux/dma-debug.h>
-
-#define PREALLOC_DMA_DEBUG_ENTRIES       (1 << 15)
-
-static int __init dma_init(void)
-{
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
-	return 0;
-}
-fs_initcall(dma_init);
diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
index 77625b60a510..bcbaa2e8031e 100644
--- a/arch/x86/kernel/pci-dma.c
+++ b/arch/x86/kernel/pci-dma.c
@@ -55,9 +55,6 @@ struct device x86_dma_fallback_dev = {
 };
 EXPORT_SYMBOL(x86_dma_fallback_dev);
 
-/* Number of entries preallocated for DMA-API debugging */
-#define PREALLOC_DMA_DEBUG_ENTRIES       65536
-
 void __init pci_iommu_alloc(void)
 {
 	struct iommu_table_entry *p;
@@ -189,7 +186,6 @@ EXPORT_SYMBOL(arch_dma_supported);
 static int __init pci_iommu_init(void)
 {
 	struct iommu_table_entry *p;
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
 
 #ifdef CONFIG_PCI
 	dma_debug_add_bus(&pci_bus_type);
diff --git a/arch/xtensa/kernel/pci-dma.c b/arch/xtensa/kernel/pci-dma.c
index 732631ce250f..392b4a80ebc2 100644
--- a/arch/xtensa/kernel/pci-dma.c
+++ b/arch/xtensa/kernel/pci-dma.c
@@ -261,12 +261,3 @@ const struct dma_map_ops xtensa_dma_map_ops = {
 	.mapping_error = xtensa_dma_mapping_error,
 };
 EXPORT_SYMBOL(xtensa_dma_map_ops);
-
-#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
-
-static int __init xtensa_dma_init(void)
-{
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
-	return 0;
-}
-fs_initcall(xtensa_dma_init);
diff --git a/include/linux/dma-debug.h b/include/linux/dma-debug.h
index c7d844f09c3a..a785f2507159 100644
--- a/include/linux/dma-debug.h
+++ b/include/linux/dma-debug.h
@@ -30,8 +30,6 @@ struct bus_type;
 
 extern void dma_debug_add_bus(struct bus_type *bus);
 
-extern void dma_debug_init(u32 num_entries);
-
 extern int dma_debug_resize_entries(u32 num_entries);
 
 extern void debug_dma_map_page(struct device *dev, struct page *page,
@@ -100,10 +98,6 @@ static inline void dma_debug_add_bus(struct bus_type *bus)
 {
 }
 
-static inline void dma_debug_init(u32 num_entries)
-{
-}
-
 static inline int dma_debug_resize_entries(u32 num_entries)
 {
 	return 0;
diff --git a/lib/dma-debug.c b/lib/dma-debug.c
index 7f5cdc1e6b29..712a897174e4 100644
--- a/lib/dma-debug.c
+++ b/lib/dma-debug.c
@@ -41,6 +41,11 @@
 #define HASH_FN_SHIFT   13
 #define HASH_FN_MASK    (HASH_SIZE - 1)
 
+/* allow architectures to override this if absolutely required */
+#ifndef PREALLOC_DMA_DEBUG_ENTRIES
+#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
+#endif
+
 enum {
 	dma_debug_single,
 	dma_debug_page,
@@ -1004,18 +1009,16 @@ void dma_debug_add_bus(struct bus_type *bus)
 	bus_register_notifier(bus, nb);
 }
 
-/*
- * Let the architectures decide how many entries should be preallocated.
- */
-void dma_debug_init(u32 num_entries)
+static int dma_debug_init(void)
 {
+	u32 num_entries;
 	int i;
 
 	/* Do not use dma_debug_initialized here, since we really want to be
 	 * called to set dma_debug_initialized
 	 */
 	if (global_disable)
-		return;
+		return 0;
 
 	for (i = 0; i < HASH_SIZE; ++i) {
 		INIT_LIST_HEAD(&dma_entry_hash[i].list);
@@ -1026,17 +1029,19 @@ void dma_debug_init(u32 num_entries)
 		pr_err("DMA-API: error creating debugfs entries - disabling\n");
 		global_disable = true;
 
-		return;
+		return 0;
 	}
 
 	if (req_entries)
 		num_entries = req_entries;
+	else
+		num_entries = PREALLOC_DMA_DEBUG_ENTRIES;
 
 	if (prealloc_memory(num_entries) != 0) {
 		pr_err("DMA-API: debugging out of memory error - disabled\n");
 		global_disable = true;
 
-		return;
+		return 0;
 	}
 
 	nr_total_entries = num_free_entries;
@@ -1044,7 +1049,9 @@ void dma_debug_init(u32 num_entries)
 	dma_debug_initialized = true;
 
 	pr_info("DMA-API: debugging enabled by kernel config\n");
+	return 0;
 }
+core_initcall(dma_debug_init);
 
 static __init int dma_debug_cmdline(char *str)
 {
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 01/22] dma-debug: move initialization to common code
@ 2018-04-20  8:02   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:02 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Most mainstream architectures are using 65536 entries, so lets stick to
that.  If someone is really desperate to override it that can still be
done through <asm/dma-mapping.h>, but I'd rather see a really good
rationale for that.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/arm/mm/dma-mapping-nommu.c |  9 ---------
 arch/arm/mm/dma-mapping.c       |  9 ---------
 arch/arm64/mm/dma-mapping.c     | 10 ----------
 arch/c6x/kernel/dma.c           | 11 -----------
 arch/ia64/kernel/dma-mapping.c  | 10 ----------
 arch/microblaze/kernel/dma.c    | 11 -----------
 arch/mips/mm/dma-default.c      | 10 ----------
 arch/openrisc/kernel/dma.c      | 11 -----------
 arch/powerpc/kernel/dma.c       |  3 ---
 arch/s390/pci/pci_dma.c         |  9 ---------
 arch/sh/mm/consistent.c         |  9 ---------
 arch/sparc/kernel/Makefile      |  2 --
 arch/sparc/kernel/dma.c         | 13 -------------
 arch/x86/kernel/pci-dma.c       |  4 ----
 arch/xtensa/kernel/pci-dma.c    |  9 ---------
 include/linux/dma-debug.h       |  6 ------
 lib/dma-debug.c                 | 21 ++++++++++++++-------
 17 files changed, 14 insertions(+), 143 deletions(-)
 delete mode 100644 arch/sparc/kernel/dma.c

diff --git a/arch/arm/mm/dma-mapping-nommu.c b/arch/arm/mm/dma-mapping-nommu.c
index 619f24a42d09..f448a0663b10 100644
--- a/arch/arm/mm/dma-mapping-nommu.c
+++ b/arch/arm/mm/dma-mapping-nommu.c
@@ -241,12 +241,3 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
 void arch_teardown_dma_ops(struct device *dev)
 {
 }
-
-#define PREALLOC_DMA_DEBUG_ENTRIES	4096
-
-static int __init dma_debug_do_init(void)
-{
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
-	return 0;
-}
-core_initcall(dma_debug_do_init);
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index 8c398fedbbb6..c26bf83f44ca 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -1165,15 +1165,6 @@ int arm_dma_supported(struct device *dev, u64 mask)
 	return __dma_supported(dev, mask, false);
 }
 
-#define PREALLOC_DMA_DEBUG_ENTRIES	4096
-
-static int __init dma_debug_do_init(void)
-{
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
-	return 0;
-}
-core_initcall(dma_debug_do_init);
-
 #ifdef CONFIG_ARM_DMA_USE_IOMMU
 
 static int __dma_info_to_prot(enum dma_data_direction dir, unsigned long attrs)
diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c
index a96ec0181818..db01f2709842 100644
--- a/arch/arm64/mm/dma-mapping.c
+++ b/arch/arm64/mm/dma-mapping.c
@@ -508,16 +508,6 @@ static int __init arm64_dma_init(void)
 }
 arch_initcall(arm64_dma_init);
 
-#define PREALLOC_DMA_DEBUG_ENTRIES	4096
-
-static int __init dma_debug_do_init(void)
-{
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
-	return 0;
-}
-fs_initcall(dma_debug_do_init);
-
-
 #ifdef CONFIG_IOMMU_DMA
 #include <linux/dma-iommu.h>
 #include <linux/platform_device.h>
diff --git a/arch/c6x/kernel/dma.c b/arch/c6x/kernel/dma.c
index 9fff8be75f58..31e1a9ec3a9c 100644
--- a/arch/c6x/kernel/dma.c
+++ b/arch/c6x/kernel/dma.c
@@ -136,14 +136,3 @@ const struct dma_map_ops c6x_dma_ops = {
 	.sync_sg_for_cpu	= c6x_dma_sync_sg_for_cpu,
 };
 EXPORT_SYMBOL(c6x_dma_ops);
-
-/* Number of entries preallocated for DMA-API debugging */
-#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);
diff --git a/arch/ia64/kernel/dma-mapping.c b/arch/ia64/kernel/dma-mapping.c
index f2d57e66fd86..7a471d8d67d4 100644
--- a/arch/ia64/kernel/dma-mapping.c
+++ b/arch/ia64/kernel/dma-mapping.c
@@ -9,16 +9,6 @@ int iommu_detected __read_mostly;
 const struct dma_map_ops *dma_ops;
 EXPORT_SYMBOL(dma_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);
-
 const struct dma_map_ops *dma_get_ops(struct device *dev)
 {
 	return dma_ops;
diff --git a/arch/microblaze/kernel/dma.c b/arch/microblaze/kernel/dma.c
index c91e8cef98dd..3145e7dc8ab1 100644
--- a/arch/microblaze/kernel/dma.c
+++ b/arch/microblaze/kernel/dma.c
@@ -184,14 +184,3 @@ const struct dma_map_ops dma_nommu_ops = {
 	.sync_sg_for_device	= dma_nommu_sync_sg_for_device,
 };
 EXPORT_SYMBOL(dma_nommu_ops);
-
-/* Number of entries preallocated for DMA-API debugging */
-#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);
diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c
index dcafa43613b6..f9fef0028ca2 100644
--- a/arch/mips/mm/dma-default.c
+++ b/arch/mips/mm/dma-default.c
@@ -402,13 +402,3 @@ static const struct dma_map_ops mips_default_dma_map_ops = {
 
 const struct dma_map_ops *mips_dma_map_ops = &mips_default_dma_map_ops;
 EXPORT_SYMBOL(mips_dma_map_ops);
-
-#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
-
-static int __init mips_dma_init(void)
-{
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
-
-	return 0;
-}
-fs_initcall(mips_dma_init);
diff --git a/arch/openrisc/kernel/dma.c b/arch/openrisc/kernel/dma.c
index a945f00011b4..ec7fd45704d2 100644
--- a/arch/openrisc/kernel/dma.c
+++ b/arch/openrisc/kernel/dma.c
@@ -247,14 +247,3 @@ const struct dma_map_ops or1k_dma_map_ops = {
 	.sync_single_for_device = or1k_sync_single_for_device,
 };
 EXPORT_SYMBOL(or1k_dma_map_ops);
-
-/* Number of entries preallocated for DMA-API debugging */
-#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);
diff --git a/arch/powerpc/kernel/dma.c b/arch/powerpc/kernel/dma.c
index da20569de9d4..138157deeadf 100644
--- a/arch/powerpc/kernel/dma.c
+++ b/arch/powerpc/kernel/dma.c
@@ -309,8 +309,6 @@ int dma_set_coherent_mask(struct device *dev, u64 mask)
 }
 EXPORT_SYMBOL(dma_set_coherent_mask);
 
-#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
-
 int dma_set_mask(struct device *dev, u64 dma_mask)
 {
 	if (ppc_md.dma_set_mask)
@@ -361,7 +359,6 @@ EXPORT_SYMBOL_GPL(dma_get_required_mask);
 
 static int __init dma_init(void)
 {
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
 #ifdef CONFIG_PCI
 	dma_debug_add_bus(&pci_bus_type);
 #endif
diff --git a/arch/s390/pci/pci_dma.c b/arch/s390/pci/pci_dma.c
index 10abf5ed6187..d387a0fbdd7e 100644
--- a/arch/s390/pci/pci_dma.c
+++ b/arch/s390/pci/pci_dma.c
@@ -668,15 +668,6 @@ void zpci_dma_exit(void)
 	kmem_cache_destroy(dma_region_table_cache);
 }
 
-#define PREALLOC_DMA_DEBUG_ENTRIES	(1 << 16)
-
-static int __init dma_debug_do_init(void)
-{
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
-	return 0;
-}
-fs_initcall(dma_debug_do_init);
-
 const struct dma_map_ops s390_pci_dma_ops = {
 	.alloc		= s390_dma_alloc,
 	.free		= s390_dma_free,
diff --git a/arch/sh/mm/consistent.c b/arch/sh/mm/consistent.c
index 6ea3aab508f2..a7bff3f29c2b 100644
--- a/arch/sh/mm/consistent.c
+++ b/arch/sh/mm/consistent.c
@@ -20,18 +20,9 @@
 #include <asm/cacheflush.h>
 #include <asm/addrspace.h>
 
-#define PREALLOC_DMA_DEBUG_ENTRIES	4096
-
 const struct dma_map_ops *dma_ops;
 EXPORT_SYMBOL(dma_ops);
 
-static int __init dma_init(void)
-{
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
-	return 0;
-}
-fs_initcall(dma_init);
-
 void *dma_generic_alloc_coherent(struct device *dev, size_t size,
 				 dma_addr_t *dma_handle, gfp_t gfp,
 				 unsigned long attrs)
diff --git a/arch/sparc/kernel/Makefile b/arch/sparc/kernel/Makefile
index a284662b0e4c..cf8640841b7a 100644
--- a/arch/sparc/kernel/Makefile
+++ b/arch/sparc/kernel/Makefile
@@ -74,8 +74,6 @@ obj-$(CONFIG_SPARC64)	+= pcr.o
 obj-$(CONFIG_SPARC64)	+= nmi.o
 obj-$(CONFIG_SPARC64_SMP) += cpumap.o
 
-obj-y                     += dma.o
-
 obj-$(CONFIG_PCIC_PCI)    += pcic.o
 obj-$(CONFIG_LEON_PCI)    += leon_pci.o
 obj-$(CONFIG_SPARC_GRPCI2)+= leon_pci_grpci2.o
diff --git a/arch/sparc/kernel/dma.c b/arch/sparc/kernel/dma.c
deleted file mode 100644
index f73e7597c971..000000000000
--- a/arch/sparc/kernel/dma.c
+++ /dev/null
@@ -1,13 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-#include <linux/kernel.h>
-#include <linux/dma-mapping.h>
-#include <linux/dma-debug.h>
-
-#define PREALLOC_DMA_DEBUG_ENTRIES       (1 << 15)
-
-static int __init dma_init(void)
-{
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
-	return 0;
-}
-fs_initcall(dma_init);
diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
index 77625b60a510..bcbaa2e8031e 100644
--- a/arch/x86/kernel/pci-dma.c
+++ b/arch/x86/kernel/pci-dma.c
@@ -55,9 +55,6 @@ struct device x86_dma_fallback_dev = {
 };
 EXPORT_SYMBOL(x86_dma_fallback_dev);
 
-/* Number of entries preallocated for DMA-API debugging */
-#define PREALLOC_DMA_DEBUG_ENTRIES       65536
-
 void __init pci_iommu_alloc(void)
 {
 	struct iommu_table_entry *p;
@@ -189,7 +186,6 @@ EXPORT_SYMBOL(arch_dma_supported);
 static int __init pci_iommu_init(void)
 {
 	struct iommu_table_entry *p;
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
 
 #ifdef CONFIG_PCI
 	dma_debug_add_bus(&pci_bus_type);
diff --git a/arch/xtensa/kernel/pci-dma.c b/arch/xtensa/kernel/pci-dma.c
index 732631ce250f..392b4a80ebc2 100644
--- a/arch/xtensa/kernel/pci-dma.c
+++ b/arch/xtensa/kernel/pci-dma.c
@@ -261,12 +261,3 @@ const struct dma_map_ops xtensa_dma_map_ops = {
 	.mapping_error = xtensa_dma_mapping_error,
 };
 EXPORT_SYMBOL(xtensa_dma_map_ops);
-
-#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
-
-static int __init xtensa_dma_init(void)
-{
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
-	return 0;
-}
-fs_initcall(xtensa_dma_init);
diff --git a/include/linux/dma-debug.h b/include/linux/dma-debug.h
index c7d844f09c3a..a785f2507159 100644
--- a/include/linux/dma-debug.h
+++ b/include/linux/dma-debug.h
@@ -30,8 +30,6 @@ struct bus_type;
 
 extern void dma_debug_add_bus(struct bus_type *bus);
 
-extern void dma_debug_init(u32 num_entries);
-
 extern int dma_debug_resize_entries(u32 num_entries);
 
 extern void debug_dma_map_page(struct device *dev, struct page *page,
@@ -100,10 +98,6 @@ static inline void dma_debug_add_bus(struct bus_type *bus)
 {
 }
 
-static inline void dma_debug_init(u32 num_entries)
-{
-}
-
 static inline int dma_debug_resize_entries(u32 num_entries)
 {
 	return 0;
diff --git a/lib/dma-debug.c b/lib/dma-debug.c
index 7f5cdc1e6b29..712a897174e4 100644
--- a/lib/dma-debug.c
+++ b/lib/dma-debug.c
@@ -41,6 +41,11 @@
 #define HASH_FN_SHIFT   13
 #define HASH_FN_MASK    (HASH_SIZE - 1)
 
+/* allow architectures to override this if absolutely required */
+#ifndef PREALLOC_DMA_DEBUG_ENTRIES
+#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
+#endif
+
 enum {
 	dma_debug_single,
 	dma_debug_page,
@@ -1004,18 +1009,16 @@ void dma_debug_add_bus(struct bus_type *bus)
 	bus_register_notifier(bus, nb);
 }
 
-/*
- * Let the architectures decide how many entries should be preallocated.
- */
-void dma_debug_init(u32 num_entries)
+static int dma_debug_init(void)
 {
+	u32 num_entries;
 	int i;
 
 	/* Do not use dma_debug_initialized here, since we really want to be
 	 * called to set dma_debug_initialized
 	 */
 	if (global_disable)
-		return;
+		return 0;
 
 	for (i = 0; i < HASH_SIZE; ++i) {
 		INIT_LIST_HEAD(&dma_entry_hash[i].list);
@@ -1026,17 +1029,19 @@ void dma_debug_init(u32 num_entries)
 		pr_err("DMA-API: error creating debugfs entries - disabling\n");
 		global_disable = true;
 
-		return;
+		return 0;
 	}
 
 	if (req_entries)
 		num_entries = req_entries;
+	else
+		num_entries = PREALLOC_DMA_DEBUG_ENTRIES;
 
 	if (prealloc_memory(num_entries) != 0) {
 		pr_err("DMA-API: debugging out of memory error - disabled\n");
 		global_disable = true;
 
-		return;
+		return 0;
 	}
 
 	nr_total_entries = num_free_entries;
@@ -1044,7 +1049,9 @@ void dma_debug_init(u32 num_entries)
 	dma_debug_initialized = true;
 
 	pr_info("DMA-API: debugging enabled by kernel config\n");
+	return 0;
 }
+core_initcall(dma_debug_init);
 
 static __init int dma_debug_cmdline(char *str)
 {
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [OpenRISC] [PATCH 01/22] dma-debug: move initialization to common code
@ 2018-04-20  8:02   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:02 UTC (permalink / raw)
  To: openrisc

Most mainstream architectures are using 65536 entries, so lets stick to
that.  If someone is really desperate to override it that can still be
done through <asm/dma-mapping.h>, but I'd rather see a really good
rationale for that.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/arm/mm/dma-mapping-nommu.c |  9 ---------
 arch/arm/mm/dma-mapping.c       |  9 ---------
 arch/arm64/mm/dma-mapping.c     | 10 ----------
 arch/c6x/kernel/dma.c           | 11 -----------
 arch/ia64/kernel/dma-mapping.c  | 10 ----------
 arch/microblaze/kernel/dma.c    | 11 -----------
 arch/mips/mm/dma-default.c      | 10 ----------
 arch/openrisc/kernel/dma.c      | 11 -----------
 arch/powerpc/kernel/dma.c       |  3 ---
 arch/s390/pci/pci_dma.c         |  9 ---------
 arch/sh/mm/consistent.c         |  9 ---------
 arch/sparc/kernel/Makefile      |  2 --
 arch/sparc/kernel/dma.c         | 13 -------------
 arch/x86/kernel/pci-dma.c       |  4 ----
 arch/xtensa/kernel/pci-dma.c    |  9 ---------
 include/linux/dma-debug.h       |  6 ------
 lib/dma-debug.c                 | 21 ++++++++++++++-------
 17 files changed, 14 insertions(+), 143 deletions(-)
 delete mode 100644 arch/sparc/kernel/dma.c

diff --git a/arch/arm/mm/dma-mapping-nommu.c b/arch/arm/mm/dma-mapping-nommu.c
index 619f24a42d09..f448a0663b10 100644
--- a/arch/arm/mm/dma-mapping-nommu.c
+++ b/arch/arm/mm/dma-mapping-nommu.c
@@ -241,12 +241,3 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
 void arch_teardown_dma_ops(struct device *dev)
 {
 }
-
-#define PREALLOC_DMA_DEBUG_ENTRIES	4096
-
-static int __init dma_debug_do_init(void)
-{
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
-	return 0;
-}
-core_initcall(dma_debug_do_init);
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index 8c398fedbbb6..c26bf83f44ca 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -1165,15 +1165,6 @@ int arm_dma_supported(struct device *dev, u64 mask)
 	return __dma_supported(dev, mask, false);
 }
 
-#define PREALLOC_DMA_DEBUG_ENTRIES	4096
-
-static int __init dma_debug_do_init(void)
-{
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
-	return 0;
-}
-core_initcall(dma_debug_do_init);
-
 #ifdef CONFIG_ARM_DMA_USE_IOMMU
 
 static int __dma_info_to_prot(enum dma_data_direction dir, unsigned long attrs)
diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c
index a96ec0181818..db01f2709842 100644
--- a/arch/arm64/mm/dma-mapping.c
+++ b/arch/arm64/mm/dma-mapping.c
@@ -508,16 +508,6 @@ static int __init arm64_dma_init(void)
 }
 arch_initcall(arm64_dma_init);
 
-#define PREALLOC_DMA_DEBUG_ENTRIES	4096
-
-static int __init dma_debug_do_init(void)
-{
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
-	return 0;
-}
-fs_initcall(dma_debug_do_init);
-
-
 #ifdef CONFIG_IOMMU_DMA
 #include <linux/dma-iommu.h>
 #include <linux/platform_device.h>
diff --git a/arch/c6x/kernel/dma.c b/arch/c6x/kernel/dma.c
index 9fff8be75f58..31e1a9ec3a9c 100644
--- a/arch/c6x/kernel/dma.c
+++ b/arch/c6x/kernel/dma.c
@@ -136,14 +136,3 @@ const struct dma_map_ops c6x_dma_ops = {
 	.sync_sg_for_cpu	= c6x_dma_sync_sg_for_cpu,
 };
 EXPORT_SYMBOL(c6x_dma_ops);
-
-/* Number of entries preallocated for DMA-API debugging */
-#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);
diff --git a/arch/ia64/kernel/dma-mapping.c b/arch/ia64/kernel/dma-mapping.c
index f2d57e66fd86..7a471d8d67d4 100644
--- a/arch/ia64/kernel/dma-mapping.c
+++ b/arch/ia64/kernel/dma-mapping.c
@@ -9,16 +9,6 @@ int iommu_detected __read_mostly;
 const struct dma_map_ops *dma_ops;
 EXPORT_SYMBOL(dma_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);
-
 const struct dma_map_ops *dma_get_ops(struct device *dev)
 {
 	return dma_ops;
diff --git a/arch/microblaze/kernel/dma.c b/arch/microblaze/kernel/dma.c
index c91e8cef98dd..3145e7dc8ab1 100644
--- a/arch/microblaze/kernel/dma.c
+++ b/arch/microblaze/kernel/dma.c
@@ -184,14 +184,3 @@ const struct dma_map_ops dma_nommu_ops = {
 	.sync_sg_for_device	= dma_nommu_sync_sg_for_device,
 };
 EXPORT_SYMBOL(dma_nommu_ops);
-
-/* Number of entries preallocated for DMA-API debugging */
-#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);
diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c
index dcafa43613b6..f9fef0028ca2 100644
--- a/arch/mips/mm/dma-default.c
+++ b/arch/mips/mm/dma-default.c
@@ -402,13 +402,3 @@ static const struct dma_map_ops mips_default_dma_map_ops = {
 
 const struct dma_map_ops *mips_dma_map_ops = &mips_default_dma_map_ops;
 EXPORT_SYMBOL(mips_dma_map_ops);
-
-#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
-
-static int __init mips_dma_init(void)
-{
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
-
-	return 0;
-}
-fs_initcall(mips_dma_init);
diff --git a/arch/openrisc/kernel/dma.c b/arch/openrisc/kernel/dma.c
index a945f00011b4..ec7fd45704d2 100644
--- a/arch/openrisc/kernel/dma.c
+++ b/arch/openrisc/kernel/dma.c
@@ -247,14 +247,3 @@ const struct dma_map_ops or1k_dma_map_ops = {
 	.sync_single_for_device = or1k_sync_single_for_device,
 };
 EXPORT_SYMBOL(or1k_dma_map_ops);
-
-/* Number of entries preallocated for DMA-API debugging */
-#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);
diff --git a/arch/powerpc/kernel/dma.c b/arch/powerpc/kernel/dma.c
index da20569de9d4..138157deeadf 100644
--- a/arch/powerpc/kernel/dma.c
+++ b/arch/powerpc/kernel/dma.c
@@ -309,8 +309,6 @@ int dma_set_coherent_mask(struct device *dev, u64 mask)
 }
 EXPORT_SYMBOL(dma_set_coherent_mask);
 
-#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
-
 int dma_set_mask(struct device *dev, u64 dma_mask)
 {
 	if (ppc_md.dma_set_mask)
@@ -361,7 +359,6 @@ EXPORT_SYMBOL_GPL(dma_get_required_mask);
 
 static int __init dma_init(void)
 {
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
 #ifdef CONFIG_PCI
 	dma_debug_add_bus(&pci_bus_type);
 #endif
diff --git a/arch/s390/pci/pci_dma.c b/arch/s390/pci/pci_dma.c
index 10abf5ed6187..d387a0fbdd7e 100644
--- a/arch/s390/pci/pci_dma.c
+++ b/arch/s390/pci/pci_dma.c
@@ -668,15 +668,6 @@ void zpci_dma_exit(void)
 	kmem_cache_destroy(dma_region_table_cache);
 }
 
-#define PREALLOC_DMA_DEBUG_ENTRIES	(1 << 16)
-
-static int __init dma_debug_do_init(void)
-{
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
-	return 0;
-}
-fs_initcall(dma_debug_do_init);
-
 const struct dma_map_ops s390_pci_dma_ops = {
 	.alloc		= s390_dma_alloc,
 	.free		= s390_dma_free,
diff --git a/arch/sh/mm/consistent.c b/arch/sh/mm/consistent.c
index 6ea3aab508f2..a7bff3f29c2b 100644
--- a/arch/sh/mm/consistent.c
+++ b/arch/sh/mm/consistent.c
@@ -20,18 +20,9 @@
 #include <asm/cacheflush.h>
 #include <asm/addrspace.h>
 
-#define PREALLOC_DMA_DEBUG_ENTRIES	4096
-
 const struct dma_map_ops *dma_ops;
 EXPORT_SYMBOL(dma_ops);
 
-static int __init dma_init(void)
-{
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
-	return 0;
-}
-fs_initcall(dma_init);
-
 void *dma_generic_alloc_coherent(struct device *dev, size_t size,
 				 dma_addr_t *dma_handle, gfp_t gfp,
 				 unsigned long attrs)
diff --git a/arch/sparc/kernel/Makefile b/arch/sparc/kernel/Makefile
index a284662b0e4c..cf8640841b7a 100644
--- a/arch/sparc/kernel/Makefile
+++ b/arch/sparc/kernel/Makefile
@@ -74,8 +74,6 @@ obj-$(CONFIG_SPARC64)	+= pcr.o
 obj-$(CONFIG_SPARC64)	+= nmi.o
 obj-$(CONFIG_SPARC64_SMP) += cpumap.o
 
-obj-y                     += dma.o
-
 obj-$(CONFIG_PCIC_PCI)    += pcic.o
 obj-$(CONFIG_LEON_PCI)    += leon_pci.o
 obj-$(CONFIG_SPARC_GRPCI2)+= leon_pci_grpci2.o
diff --git a/arch/sparc/kernel/dma.c b/arch/sparc/kernel/dma.c
deleted file mode 100644
index f73e7597c971..000000000000
--- a/arch/sparc/kernel/dma.c
+++ /dev/null
@@ -1,13 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-#include <linux/kernel.h>
-#include <linux/dma-mapping.h>
-#include <linux/dma-debug.h>
-
-#define PREALLOC_DMA_DEBUG_ENTRIES       (1 << 15)
-
-static int __init dma_init(void)
-{
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
-	return 0;
-}
-fs_initcall(dma_init);
diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
index 77625b60a510..bcbaa2e8031e 100644
--- a/arch/x86/kernel/pci-dma.c
+++ b/arch/x86/kernel/pci-dma.c
@@ -55,9 +55,6 @@ struct device x86_dma_fallback_dev = {
 };
 EXPORT_SYMBOL(x86_dma_fallback_dev);
 
-/* Number of entries preallocated for DMA-API debugging */
-#define PREALLOC_DMA_DEBUG_ENTRIES       65536
-
 void __init pci_iommu_alloc(void)
 {
 	struct iommu_table_entry *p;
@@ -189,7 +186,6 @@ EXPORT_SYMBOL(arch_dma_supported);
 static int __init pci_iommu_init(void)
 {
 	struct iommu_table_entry *p;
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
 
 #ifdef CONFIG_PCI
 	dma_debug_add_bus(&pci_bus_type);
diff --git a/arch/xtensa/kernel/pci-dma.c b/arch/xtensa/kernel/pci-dma.c
index 732631ce250f..392b4a80ebc2 100644
--- a/arch/xtensa/kernel/pci-dma.c
+++ b/arch/xtensa/kernel/pci-dma.c
@@ -261,12 +261,3 @@ const struct dma_map_ops xtensa_dma_map_ops = {
 	.mapping_error = xtensa_dma_mapping_error,
 };
 EXPORT_SYMBOL(xtensa_dma_map_ops);
-
-#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
-
-static int __init xtensa_dma_init(void)
-{
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
-	return 0;
-}
-fs_initcall(xtensa_dma_init);
diff --git a/include/linux/dma-debug.h b/include/linux/dma-debug.h
index c7d844f09c3a..a785f2507159 100644
--- a/include/linux/dma-debug.h
+++ b/include/linux/dma-debug.h
@@ -30,8 +30,6 @@ struct bus_type;
 
 extern void dma_debug_add_bus(struct bus_type *bus);
 
-extern void dma_debug_init(u32 num_entries);
-
 extern int dma_debug_resize_entries(u32 num_entries);
 
 extern void debug_dma_map_page(struct device *dev, struct page *page,
@@ -100,10 +98,6 @@ static inline void dma_debug_add_bus(struct bus_type *bus)
 {
 }
 
-static inline void dma_debug_init(u32 num_entries)
-{
-}
-
 static inline int dma_debug_resize_entries(u32 num_entries)
 {
 	return 0;
diff --git a/lib/dma-debug.c b/lib/dma-debug.c
index 7f5cdc1e6b29..712a897174e4 100644
--- a/lib/dma-debug.c
+++ b/lib/dma-debug.c
@@ -41,6 +41,11 @@
 #define HASH_FN_SHIFT   13
 #define HASH_FN_MASK    (HASH_SIZE - 1)
 
+/* allow architectures to override this if absolutely required */
+#ifndef PREALLOC_DMA_DEBUG_ENTRIES
+#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
+#endif
+
 enum {
 	dma_debug_single,
 	dma_debug_page,
@@ -1004,18 +1009,16 @@ void dma_debug_add_bus(struct bus_type *bus)
 	bus_register_notifier(bus, nb);
 }
 
-/*
- * Let the architectures decide how many entries should be preallocated.
- */
-void dma_debug_init(u32 num_entries)
+static int dma_debug_init(void)
 {
+	u32 num_entries;
 	int i;
 
 	/* Do not use dma_debug_initialized here, since we really want to be
 	 * called to set dma_debug_initialized
 	 */
 	if (global_disable)
-		return;
+		return 0;
 
 	for (i = 0; i < HASH_SIZE; ++i) {
 		INIT_LIST_HEAD(&dma_entry_hash[i].list);
@@ -1026,17 +1029,19 @@ void dma_debug_init(u32 num_entries)
 		pr_err("DMA-API: error creating debugfs entries - disabling\n");
 		global_disable = true;
 
-		return;
+		return 0;
 	}
 
 	if (req_entries)
 		num_entries = req_entries;
+	else
+		num_entries = PREALLOC_DMA_DEBUG_ENTRIES;
 
 	if (prealloc_memory(num_entries) != 0) {
 		pr_err("DMA-API: debugging out of memory error - disabled\n");
 		global_disable = true;
 
-		return;
+		return 0;
 	}
 
 	nr_total_entries = num_free_entries;
@@ -1044,7 +1049,9 @@ void dma_debug_init(u32 num_entries)
 	dma_debug_initialized = true;
 
 	pr_info("DMA-API: debugging enabled by kernel config\n");
+	return 0;
 }
+core_initcall(dma_debug_init);
 
 static __init int dma_debug_cmdline(char *str)
 {
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 01/22] dma-debug: move initialization to common code
@ 2018-04-20  8:02   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:02 UTC (permalink / raw)
  To: linux-arm-kernel

Most mainstream architectures are using 65536 entries, so lets stick to
that.  If someone is really desperate to override it that can still be
done through <asm/dma-mapping.h>, but I'd rather see a really good
rationale for that.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/arm/mm/dma-mapping-nommu.c |  9 ---------
 arch/arm/mm/dma-mapping.c       |  9 ---------
 arch/arm64/mm/dma-mapping.c     | 10 ----------
 arch/c6x/kernel/dma.c           | 11 -----------
 arch/ia64/kernel/dma-mapping.c  | 10 ----------
 arch/microblaze/kernel/dma.c    | 11 -----------
 arch/mips/mm/dma-default.c      | 10 ----------
 arch/openrisc/kernel/dma.c      | 11 -----------
 arch/powerpc/kernel/dma.c       |  3 ---
 arch/s390/pci/pci_dma.c         |  9 ---------
 arch/sh/mm/consistent.c         |  9 ---------
 arch/sparc/kernel/Makefile      |  2 --
 arch/sparc/kernel/dma.c         | 13 -------------
 arch/x86/kernel/pci-dma.c       |  4 ----
 arch/xtensa/kernel/pci-dma.c    |  9 ---------
 include/linux/dma-debug.h       |  6 ------
 lib/dma-debug.c                 | 21 ++++++++++++++-------
 17 files changed, 14 insertions(+), 143 deletions(-)
 delete mode 100644 arch/sparc/kernel/dma.c

diff --git a/arch/arm/mm/dma-mapping-nommu.c b/arch/arm/mm/dma-mapping-nommu.c
index 619f24a42d09..f448a0663b10 100644
--- a/arch/arm/mm/dma-mapping-nommu.c
+++ b/arch/arm/mm/dma-mapping-nommu.c
@@ -241,12 +241,3 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
 void arch_teardown_dma_ops(struct device *dev)
 {
 }
-
-#define PREALLOC_DMA_DEBUG_ENTRIES	4096
-
-static int __init dma_debug_do_init(void)
-{
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
-	return 0;
-}
-core_initcall(dma_debug_do_init);
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index 8c398fedbbb6..c26bf83f44ca 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -1165,15 +1165,6 @@ int arm_dma_supported(struct device *dev, u64 mask)
 	return __dma_supported(dev, mask, false);
 }
 
-#define PREALLOC_DMA_DEBUG_ENTRIES	4096
-
-static int __init dma_debug_do_init(void)
-{
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
-	return 0;
-}
-core_initcall(dma_debug_do_init);
-
 #ifdef CONFIG_ARM_DMA_USE_IOMMU
 
 static int __dma_info_to_prot(enum dma_data_direction dir, unsigned long attrs)
diff --git a/arch/arm64/mm/dma-mapping.c b/arch/arm64/mm/dma-mapping.c
index a96ec0181818..db01f2709842 100644
--- a/arch/arm64/mm/dma-mapping.c
+++ b/arch/arm64/mm/dma-mapping.c
@@ -508,16 +508,6 @@ static int __init arm64_dma_init(void)
 }
 arch_initcall(arm64_dma_init);
 
-#define PREALLOC_DMA_DEBUG_ENTRIES	4096
-
-static int __init dma_debug_do_init(void)
-{
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
-	return 0;
-}
-fs_initcall(dma_debug_do_init);
-
-
 #ifdef CONFIG_IOMMU_DMA
 #include <linux/dma-iommu.h>
 #include <linux/platform_device.h>
diff --git a/arch/c6x/kernel/dma.c b/arch/c6x/kernel/dma.c
index 9fff8be75f58..31e1a9ec3a9c 100644
--- a/arch/c6x/kernel/dma.c
+++ b/arch/c6x/kernel/dma.c
@@ -136,14 +136,3 @@ const struct dma_map_ops c6x_dma_ops = {
 	.sync_sg_for_cpu	= c6x_dma_sync_sg_for_cpu,
 };
 EXPORT_SYMBOL(c6x_dma_ops);
-
-/* Number of entries preallocated for DMA-API debugging */
-#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);
diff --git a/arch/ia64/kernel/dma-mapping.c b/arch/ia64/kernel/dma-mapping.c
index f2d57e66fd86..7a471d8d67d4 100644
--- a/arch/ia64/kernel/dma-mapping.c
+++ b/arch/ia64/kernel/dma-mapping.c
@@ -9,16 +9,6 @@ int iommu_detected __read_mostly;
 const struct dma_map_ops *dma_ops;
 EXPORT_SYMBOL(dma_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);
-
 const struct dma_map_ops *dma_get_ops(struct device *dev)
 {
 	return dma_ops;
diff --git a/arch/microblaze/kernel/dma.c b/arch/microblaze/kernel/dma.c
index c91e8cef98dd..3145e7dc8ab1 100644
--- a/arch/microblaze/kernel/dma.c
+++ b/arch/microblaze/kernel/dma.c
@@ -184,14 +184,3 @@ const struct dma_map_ops dma_nommu_ops = {
 	.sync_sg_for_device	= dma_nommu_sync_sg_for_device,
 };
 EXPORT_SYMBOL(dma_nommu_ops);
-
-/* Number of entries preallocated for DMA-API debugging */
-#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);
diff --git a/arch/mips/mm/dma-default.c b/arch/mips/mm/dma-default.c
index dcafa43613b6..f9fef0028ca2 100644
--- a/arch/mips/mm/dma-default.c
+++ b/arch/mips/mm/dma-default.c
@@ -402,13 +402,3 @@ static const struct dma_map_ops mips_default_dma_map_ops = {
 
 const struct dma_map_ops *mips_dma_map_ops = &mips_default_dma_map_ops;
 EXPORT_SYMBOL(mips_dma_map_ops);
-
-#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
-
-static int __init mips_dma_init(void)
-{
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
-
-	return 0;
-}
-fs_initcall(mips_dma_init);
diff --git a/arch/openrisc/kernel/dma.c b/arch/openrisc/kernel/dma.c
index a945f00011b4..ec7fd45704d2 100644
--- a/arch/openrisc/kernel/dma.c
+++ b/arch/openrisc/kernel/dma.c
@@ -247,14 +247,3 @@ const struct dma_map_ops or1k_dma_map_ops = {
 	.sync_single_for_device = or1k_sync_single_for_device,
 };
 EXPORT_SYMBOL(or1k_dma_map_ops);
-
-/* Number of entries preallocated for DMA-API debugging */
-#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);
diff --git a/arch/powerpc/kernel/dma.c b/arch/powerpc/kernel/dma.c
index da20569de9d4..138157deeadf 100644
--- a/arch/powerpc/kernel/dma.c
+++ b/arch/powerpc/kernel/dma.c
@@ -309,8 +309,6 @@ int dma_set_coherent_mask(struct device *dev, u64 mask)
 }
 EXPORT_SYMBOL(dma_set_coherent_mask);
 
-#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
-
 int dma_set_mask(struct device *dev, u64 dma_mask)
 {
 	if (ppc_md.dma_set_mask)
@@ -361,7 +359,6 @@ EXPORT_SYMBOL_GPL(dma_get_required_mask);
 
 static int __init dma_init(void)
 {
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
 #ifdef CONFIG_PCI
 	dma_debug_add_bus(&pci_bus_type);
 #endif
diff --git a/arch/s390/pci/pci_dma.c b/arch/s390/pci/pci_dma.c
index 10abf5ed6187..d387a0fbdd7e 100644
--- a/arch/s390/pci/pci_dma.c
+++ b/arch/s390/pci/pci_dma.c
@@ -668,15 +668,6 @@ void zpci_dma_exit(void)
 	kmem_cache_destroy(dma_region_table_cache);
 }
 
-#define PREALLOC_DMA_DEBUG_ENTRIES	(1 << 16)
-
-static int __init dma_debug_do_init(void)
-{
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
-	return 0;
-}
-fs_initcall(dma_debug_do_init);
-
 const struct dma_map_ops s390_pci_dma_ops = {
 	.alloc		= s390_dma_alloc,
 	.free		= s390_dma_free,
diff --git a/arch/sh/mm/consistent.c b/arch/sh/mm/consistent.c
index 6ea3aab508f2..a7bff3f29c2b 100644
--- a/arch/sh/mm/consistent.c
+++ b/arch/sh/mm/consistent.c
@@ -20,18 +20,9 @@
 #include <asm/cacheflush.h>
 #include <asm/addrspace.h>
 
-#define PREALLOC_DMA_DEBUG_ENTRIES	4096
-
 const struct dma_map_ops *dma_ops;
 EXPORT_SYMBOL(dma_ops);
 
-static int __init dma_init(void)
-{
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
-	return 0;
-}
-fs_initcall(dma_init);
-
 void *dma_generic_alloc_coherent(struct device *dev, size_t size,
 				 dma_addr_t *dma_handle, gfp_t gfp,
 				 unsigned long attrs)
diff --git a/arch/sparc/kernel/Makefile b/arch/sparc/kernel/Makefile
index a284662b0e4c..cf8640841b7a 100644
--- a/arch/sparc/kernel/Makefile
+++ b/arch/sparc/kernel/Makefile
@@ -74,8 +74,6 @@ obj-$(CONFIG_SPARC64)	+= pcr.o
 obj-$(CONFIG_SPARC64)	+= nmi.o
 obj-$(CONFIG_SPARC64_SMP) += cpumap.o
 
-obj-y                     += dma.o
-
 obj-$(CONFIG_PCIC_PCI)    += pcic.o
 obj-$(CONFIG_LEON_PCI)    += leon_pci.o
 obj-$(CONFIG_SPARC_GRPCI2)+= leon_pci_grpci2.o
diff --git a/arch/sparc/kernel/dma.c b/arch/sparc/kernel/dma.c
deleted file mode 100644
index f73e7597c971..000000000000
--- a/arch/sparc/kernel/dma.c
+++ /dev/null
@@ -1,13 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-#include <linux/kernel.h>
-#include <linux/dma-mapping.h>
-#include <linux/dma-debug.h>
-
-#define PREALLOC_DMA_DEBUG_ENTRIES       (1 << 15)
-
-static int __init dma_init(void)
-{
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
-	return 0;
-}
-fs_initcall(dma_init);
diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
index 77625b60a510..bcbaa2e8031e 100644
--- a/arch/x86/kernel/pci-dma.c
+++ b/arch/x86/kernel/pci-dma.c
@@ -55,9 +55,6 @@ struct device x86_dma_fallback_dev = {
 };
 EXPORT_SYMBOL(x86_dma_fallback_dev);
 
-/* Number of entries preallocated for DMA-API debugging */
-#define PREALLOC_DMA_DEBUG_ENTRIES       65536
-
 void __init pci_iommu_alloc(void)
 {
 	struct iommu_table_entry *p;
@@ -189,7 +186,6 @@ EXPORT_SYMBOL(arch_dma_supported);
 static int __init pci_iommu_init(void)
 {
 	struct iommu_table_entry *p;
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
 
 #ifdef CONFIG_PCI
 	dma_debug_add_bus(&pci_bus_type);
diff --git a/arch/xtensa/kernel/pci-dma.c b/arch/xtensa/kernel/pci-dma.c
index 732631ce250f..392b4a80ebc2 100644
--- a/arch/xtensa/kernel/pci-dma.c
+++ b/arch/xtensa/kernel/pci-dma.c
@@ -261,12 +261,3 @@ const struct dma_map_ops xtensa_dma_map_ops = {
 	.mapping_error = xtensa_dma_mapping_error,
 };
 EXPORT_SYMBOL(xtensa_dma_map_ops);
-
-#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
-
-static int __init xtensa_dma_init(void)
-{
-	dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
-	return 0;
-}
-fs_initcall(xtensa_dma_init);
diff --git a/include/linux/dma-debug.h b/include/linux/dma-debug.h
index c7d844f09c3a..a785f2507159 100644
--- a/include/linux/dma-debug.h
+++ b/include/linux/dma-debug.h
@@ -30,8 +30,6 @@ struct bus_type;
 
 extern void dma_debug_add_bus(struct bus_type *bus);
 
-extern void dma_debug_init(u32 num_entries);
-
 extern int dma_debug_resize_entries(u32 num_entries);
 
 extern void debug_dma_map_page(struct device *dev, struct page *page,
@@ -100,10 +98,6 @@ static inline void dma_debug_add_bus(struct bus_type *bus)
 {
 }
 
-static inline void dma_debug_init(u32 num_entries)
-{
-}
-
 static inline int dma_debug_resize_entries(u32 num_entries)
 {
 	return 0;
diff --git a/lib/dma-debug.c b/lib/dma-debug.c
index 7f5cdc1e6b29..712a897174e4 100644
--- a/lib/dma-debug.c
+++ b/lib/dma-debug.c
@@ -41,6 +41,11 @@
 #define HASH_FN_SHIFT   13
 #define HASH_FN_MASK    (HASH_SIZE - 1)
 
+/* allow architectures to override this if absolutely required */
+#ifndef PREALLOC_DMA_DEBUG_ENTRIES
+#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
+#endif
+
 enum {
 	dma_debug_single,
 	dma_debug_page,
@@ -1004,18 +1009,16 @@ void dma_debug_add_bus(struct bus_type *bus)
 	bus_register_notifier(bus, nb);
 }
 
-/*
- * Let the architectures decide how many entries should be preallocated.
- */
-void dma_debug_init(u32 num_entries)
+static int dma_debug_init(void)
 {
+	u32 num_entries;
 	int i;
 
 	/* Do not use dma_debug_initialized here, since we really want to be
 	 * called to set dma_debug_initialized
 	 */
 	if (global_disable)
-		return;
+		return 0;
 
 	for (i = 0; i < HASH_SIZE; ++i) {
 		INIT_LIST_HEAD(&dma_entry_hash[i].list);
@@ -1026,17 +1029,19 @@ void dma_debug_init(u32 num_entries)
 		pr_err("DMA-API: error creating debugfs entries - disabling\n");
 		global_disable = true;
 
-		return;
+		return 0;
 	}
 
 	if (req_entries)
 		num_entries = req_entries;
+	else
+		num_entries = PREALLOC_DMA_DEBUG_ENTRIES;
 
 	if (prealloc_memory(num_entries) != 0) {
 		pr_err("DMA-API: debugging out of memory error - disabled\n");
 		global_disable = true;
 
-		return;
+		return 0;
 	}
 
 	nr_total_entries = num_free_entries;
@@ -1044,7 +1049,9 @@ void dma_debug_init(u32 num_entries)
 	dma_debug_initialized = true;
 
 	pr_info("DMA-API: debugging enabled by kernel config\n");
+	return 0;
 }
+core_initcall(dma_debug_init);
 
 static __init int dma_debug_cmdline(char *str)
 {
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 02/22] dma-mapping: simplify Kconfig dependencies
  2018-04-20  8:02 ` Christoph Hellwig
                     ` (4 preceding siblings ...)
  (?)
@ 2018-04-20  8:02   ` Christoph Hellwig
  -1 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:02 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

ARCH_DMA_ADDR_T_64BIT is always true for 64-bit architectures now, so we
can skip the clause requiring it.  'n' is the default default, so no need
to explicitly state it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 lib/Kconfig | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/lib/Kconfig b/lib/Kconfig
index 01a37920949c..726b0562caa7 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -443,13 +443,11 @@ config IOMMU_HELPER
 
 config DMA_DIRECT_OPS
 	bool
-	depends on HAS_DMA && (!64BIT || ARCH_DMA_ADDR_T_64BIT)
-	default n
+	depends on HAS_DMA
 
 config DMA_VIRT_OPS
 	bool
-	depends on HAS_DMA && (!64BIT || ARCH_DMA_ADDR_T_64BIT)
-	default n
+	depends on HAS_DMA
 
 config ARCH_HAS_SWIOTLB
 	bool
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 02/22] dma-mapping: simplify Kconfig dependencies
@ 2018-04-20  8:02   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:02 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

ARCH_DMA_ADDR_T_64BIT is always true for 64-bit architectures now, so we
can skip the clause requiring it.  'n' is the default default, so no need
to explicitly state it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 lib/Kconfig | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/lib/Kconfig b/lib/Kconfig
index 01a37920949c..726b0562caa7 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -443,13 +443,11 @@ config IOMMU_HELPER
 
 config DMA_DIRECT_OPS
 	bool
-	depends on HAS_DMA && (!64BIT || ARCH_DMA_ADDR_T_64BIT)
-	default n
+	depends on HAS_DMA
 
 config DMA_VIRT_OPS
 	bool
-	depends on HAS_DMA && (!64BIT || ARCH_DMA_ADDR_T_64BIT)
-	default n
+	depends on HAS_DMA
 
 config ARCH_HAS_SWIOTLB
 	bool
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 02/22] dma-mapping: simplify Kconfig dependencies
@ 2018-04-20  8:02   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:02 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

ARCH_DMA_ADDR_T_64BIT is always true for 64-bit architectures now, so we
can skip the clause requiring it.  'n' is the default default, so no need
to explicitly state it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 lib/Kconfig | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/lib/Kconfig b/lib/Kconfig
index 01a37920949c..726b0562caa7 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -443,13 +443,11 @@ config IOMMU_HELPER
 
 config DMA_DIRECT_OPS
 	bool
-	depends on HAS_DMA && (!64BIT || ARCH_DMA_ADDR_T_64BIT)
-	default n
+	depends on HAS_DMA
 
 config DMA_VIRT_OPS
 	bool
-	depends on HAS_DMA && (!64BIT || ARCH_DMA_ADDR_T_64BIT)
-	default n
+	depends on HAS_DMA
 
 config ARCH_HAS_SWIOTLB
 	bool
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 02/22] dma-mapping: simplify Kconfig dependencies
@ 2018-04-20  8:02   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:02 UTC (permalink / raw)
  To: linux-snps-arc

ARCH_DMA_ADDR_T_64BIT is always true for 64-bit architectures now, so we
can skip the clause requiring it.  'n' is the default default, so no need
to explicitly state it.

Signed-off-by: Christoph Hellwig <hch at lst.de>
---
 lib/Kconfig | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/lib/Kconfig b/lib/Kconfig
index 01a37920949c..726b0562caa7 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -443,13 +443,11 @@ config IOMMU_HELPER
 
 config DMA_DIRECT_OPS
 	bool
-	depends on HAS_DMA && (!64BIT || ARCH_DMA_ADDR_T_64BIT)
-	default n
+	depends on HAS_DMA
 
 config DMA_VIRT_OPS
 	bool
-	depends on HAS_DMA && (!64BIT || ARCH_DMA_ADDR_T_64BIT)
-	default n
+	depends on HAS_DMA
 
 config ARCH_HAS_SWIOTLB
 	bool
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 02/22] dma-mapping: simplify Kconfig dependencies
@ 2018-04-20  8:02   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:02 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

ARCH_DMA_ADDR_T_64BIT is always true for 64-bit architectures now, so we
can skip the clause requiring it.  'n' is the default default, so no need
to explicitly state it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 lib/Kconfig | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/lib/Kconfig b/lib/Kconfig
index 01a37920949c..726b0562caa7 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -443,13 +443,11 @@ config IOMMU_HELPER
 
 config DMA_DIRECT_OPS
 	bool
-	depends on HAS_DMA && (!64BIT || ARCH_DMA_ADDR_T_64BIT)
-	default n
+	depends on HAS_DMA
 
 config DMA_VIRT_OPS
 	bool
-	depends on HAS_DMA && (!64BIT || ARCH_DMA_ADDR_T_64BIT)
-	default n
+	depends on HAS_DMA
 
 config ARCH_HAS_SWIOTLB
 	bool
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [OpenRISC] [PATCH 02/22] dma-mapping: simplify Kconfig dependencies
@ 2018-04-20  8:02   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:02 UTC (permalink / raw)
  To: openrisc

ARCH_DMA_ADDR_T_64BIT is always true for 64-bit architectures now, so we
can skip the clause requiring it.  'n' is the default default, so no need
to explicitly state it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 lib/Kconfig | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/lib/Kconfig b/lib/Kconfig
index 01a37920949c..726b0562caa7 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -443,13 +443,11 @@ config IOMMU_HELPER
 
 config DMA_DIRECT_OPS
 	bool
-	depends on HAS_DMA && (!64BIT || ARCH_DMA_ADDR_T_64BIT)
-	default n
+	depends on HAS_DMA
 
 config DMA_VIRT_OPS
 	bool
-	depends on HAS_DMA && (!64BIT || ARCH_DMA_ADDR_T_64BIT)
-	default n
+	depends on HAS_DMA
 
 config ARCH_HAS_SWIOTLB
 	bool
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 02/22] dma-mapping: simplify Kconfig dependencies
@ 2018-04-20  8:02   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:02 UTC (permalink / raw)
  To: linux-arm-kernel

ARCH_DMA_ADDR_T_64BIT is always true for 64-bit architectures now, so we
can skip the clause requiring it.  'n' is the default default, so no need
to explicitly state it.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 lib/Kconfig | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/lib/Kconfig b/lib/Kconfig
index 01a37920949c..726b0562caa7 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -443,13 +443,11 @@ config IOMMU_HELPER
 
 config DMA_DIRECT_OPS
 	bool
-	depends on HAS_DMA && (!64BIT || ARCH_DMA_ADDR_T_64BIT)
-	default n
+	depends on HAS_DMA
 
 config DMA_VIRT_OPS
 	bool
-	depends on HAS_DMA && (!64BIT || ARCH_DMA_ADDR_T_64BIT)
-	default n
+	depends on HAS_DMA
 
 config ARCH_HAS_SWIOTLB
 	bool
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 03/22] dma-mapping: provide a generic dma-noncoherent implementation
  2018-04-20  8:02 ` Christoph Hellwig
                     ` (4 preceding siblings ...)
  (?)
@ 2018-04-20  8:02   ` Christoph Hellwig
  -1 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:02 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Add a new dma_map_ops implementation that uses dma-direct for the
address mapping of streaming mappings, and which requires arch-specific
implemenations of coherent allocate/free.

Architectures have to provide flushing helpers to ownership trasnfers
to the device and/or CPU, and can provide optional implementations of
the coherent mmap functionality, and the cache_flush routines for
non-coherent long term allocations.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 MAINTAINERS                       |   2 +
 include/asm-generic/dma-mapping.h |   9 +++
 include/linux/dma-direct.h        |   7 ++-
 include/linux/dma-mapping.h       |   1 +
 include/linux/dma-noncoherent.h   |  47 ++++++++++++++
 lib/Kconfig                       |  20 ++++++
 lib/Makefile                      |   1 +
 lib/dma-direct.c                  |   8 +--
 lib/dma-noncoherent.c             | 101 ++++++++++++++++++++++++++++++
 9 files changed, 191 insertions(+), 5 deletions(-)
 create mode 100644 include/linux/dma-noncoherent.h
 create mode 100644 lib/dma-noncoherent.c

diff --git a/MAINTAINERS b/MAINTAINERS
index b60179d948bb..bbaf5459d297 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4327,12 +4327,14 @@ W:	http://git.infradead.org/users/hch/dma-mapping.git
 S:	Supported
 F:	lib/dma-debug.c
 F:	lib/dma-direct.c
+F:	lib/dma-noncoherent.c
 F:	lib/dma-virt.c
 F:	drivers/base/dma-mapping.c
 F:	drivers/base/dma-coherent.c
 F:	include/asm-generic/dma-mapping.h
 F:	include/linux/dma-direct.h
 F:	include/linux/dma-mapping.h
+F:	include/linux/dma-noncoherent.h
 
 DME1737 HARDWARE MONITOR DRIVER
 M:	Juerg Haefliger <juergh@gmail.com>
diff --git a/include/asm-generic/dma-mapping.h b/include/asm-generic/dma-mapping.h
index 880a292d792f..ad2868263867 100644
--- a/include/asm-generic/dma-mapping.h
+++ b/include/asm-generic/dma-mapping.h
@@ -4,7 +4,16 @@
 
 static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
 {
+	/*
+	 * Use the non-coherent ops if available.  If an architecture wants a
+	 * more fine-grained selection of operations it will have to implement
+	 * get_arch_dma_ops itself or use the per-device dma_ops.
+	 */
+#ifdef CONFIG_DMA_NONCOHERENT_OPS
+	return &dma_noncoherent_ops;
+#else
 	return &dma_direct_ops;
+#endif
 }
 
 #endif /* _ASM_GENERIC_DMA_MAPPING_H */
diff --git a/include/linux/dma-direct.h b/include/linux/dma-direct.h
index 53ad6a47f513..8d9f33febde5 100644
--- a/include/linux/dma-direct.h
+++ b/include/linux/dma-direct.h
@@ -59,6 +59,11 @@ void *dma_direct_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
 		gfp_t gfp, unsigned long attrs);
 void dma_direct_free(struct device *dev, size_t size, void *cpu_addr,
 		dma_addr_t dma_addr, unsigned long attrs);
+dma_addr_t dma_direct_map_page(struct device *dev, struct page *page,
+		unsigned long offset, size_t size, enum dma_data_direction dir,
+		unsigned long attrs);
+int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl, int nents,
+		enum dma_data_direction dir, unsigned long attrs);
 int dma_direct_supported(struct device *dev, u64 mask);
-
+int dma_direct_mapping_error(struct device *dev, dma_addr_t dma_addr);
 #endif /* _LINUX_DMA_DIRECT_H */
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 25a9a2b04f78..4be070df5fc5 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -136,6 +136,7 @@ struct dma_map_ops {
 };
 
 extern const struct dma_map_ops dma_direct_ops;
+extern const struct dma_map_ops dma_noncoherent_ops;
 extern const struct dma_map_ops dma_virt_ops;
 
 #define DMA_BIT_MASK(n)	(((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
diff --git a/include/linux/dma-noncoherent.h b/include/linux/dma-noncoherent.h
new file mode 100644
index 000000000000..10b2654d549b
--- /dev/null
+++ b/include/linux/dma-noncoherent.h
@@ -0,0 +1,47 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _LINUX_DMA_NONCOHERENT_H
+#define _LINUX_DMA_NONCOHERENT_H 1
+
+#include <linux/dma-mapping.h>
+
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs);
+void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
+		dma_addr_t dma_addr, unsigned long attrs);
+
+#ifdef CONFIG_DMA_NONCOHERENT_MMAP
+int arch_dma_mmap(struct device *dev, struct vm_area_struct *vma,
+		void *cpu_addr, dma_addr_t dma_addr, size_t size,
+		unsigned long attrs);
+#else
+#define arch_dma_mmap NULL
+#endif /* CONFIG_DMA_NONCOHERENT_MMAP */
+
+#ifdef CONFIG_DMA_NONCOHERENT_CACHE_SYNC
+void arch_dma_cache_sync(struct device *dev, void *vaddr, size_t size,
+		enum dma_data_direction direction);
+#else
+#define arch_dma_cache_sync NULL
+#endif /* CONFIG_DMA_NONCOHERENT_CACHE_SYNC */
+
+#ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_DEVICE
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir);
+#else
+static inline void arch_sync_dma_for_device(struct device *dev,
+		phys_addr_t paddr, size_t size, enum dma_data_direction dir)
+{
+}
+#endif /* ARCH_HAS_SYNC_DMA_FOR_DEVICE */
+
+#ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir);
+#else
+static inline void arch_sync_dma_for_cpu(struct device *dev,
+		phys_addr_t paddr, size_t size, enum dma_data_direction dir)
+{
+}
+#endif /* ARCH_HAS_SYNC_DMA_FOR_CPU */
+
+#endif /* _LINUX_DMA_NONCOHERENT_H */
diff --git a/lib/Kconfig b/lib/Kconfig
index 726b0562caa7..ae4bf1d8af11 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -441,10 +441,30 @@ config ARCH_DMA_ADDR_T_64BIT
 config IOMMU_HELPER
 	bool
 
+config ARCH_HAS_SYNC_DMA_FOR_DEVICE
+	bool
+
+config ARCH_HAS_SYNC_DMA_FOR_CPU
+	bool
+	select NEED_DMA_MAP_STATE
+
 config DMA_DIRECT_OPS
 	bool
 	depends on HAS_DMA
 
+config DMA_NONCOHERENT_OPS
+	bool
+	depends on HAS_DMA
+	select DMA_DIRECT_OPS
+
+config DMA_NONCOHERENT_MMAP
+	bool
+	depends on DMA_NONCOHERENT_OPS
+
+config DMA_NONCOHERENT_CACHE_SYNC
+	bool
+	depends on DMA_NONCOHERENT_OPS
+
 config DMA_VIRT_OPS
 	bool
 	depends on HAS_DMA
diff --git a/lib/Makefile b/lib/Makefile
index 94203b5eecd4..9f18c8152281 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -30,6 +30,7 @@ lib-$(CONFIG_PRINTK) += dump_stack.o
 lib-$(CONFIG_MMU) += ioremap.o
 lib-$(CONFIG_SMP) += cpumask.o
 lib-$(CONFIG_DMA_DIRECT_OPS) += dma-direct.o
+lib-$(CONFIG_DMA_NONCOHERENT_OPS) += dma-noncoherent.o
 lib-$(CONFIG_DMA_VIRT_OPS) += dma-virt.o
 
 lib-y	+= kobject.o klist.o
diff --git a/lib/dma-direct.c b/lib/dma-direct.c
index 199ae4cdd28f..9abb93541dfe 100644
--- a/lib/dma-direct.c
+++ b/lib/dma-direct.c
@@ -120,7 +120,7 @@ void dma_direct_free(struct device *dev, size_t size, void *cpu_addr,
 		free_pages((unsigned long)cpu_addr, page_order);
 }
 
-static dma_addr_t dma_direct_map_page(struct device *dev, struct page *page,
+dma_addr_t dma_direct_map_page(struct device *dev, struct page *page,
 		unsigned long offset, size_t size, enum dma_data_direction dir,
 		unsigned long attrs)
 {
@@ -131,8 +131,8 @@ static dma_addr_t dma_direct_map_page(struct device *dev, struct page *page,
 	return dma_addr;
 }
 
-static int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl,
-		int nents, enum dma_data_direction dir, unsigned long attrs)
+int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl, int nents,
+		enum dma_data_direction dir, unsigned long attrs)
 {
 	int i;
 	struct scatterlist *sg;
@@ -167,7 +167,7 @@ int dma_direct_supported(struct device *dev, u64 mask)
 	return 1;
 }
 
-static int dma_direct_mapping_error(struct device *dev, dma_addr_t dma_addr)
+int dma_direct_mapping_error(struct device *dev, dma_addr_t dma_addr)
 {
 	return dma_addr == DIRECT_MAPPING_ERROR;
 }
diff --git a/lib/dma-noncoherent.c b/lib/dma-noncoherent.c
new file mode 100644
index 000000000000..f4b8532c20ac
--- /dev/null
+++ b/lib/dma-noncoherent.c
@@ -0,0 +1,101 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2018 Christoph Hellwig.
+ *
+ * DMA operations that map physical memory directly without providing cache
+ * coherence.
+ */
+#include <linux/export.h>
+#include <linux/mm.h>
+#include <linux/dma-direct.h>
+#include <linux/dma-noncoherent.h>
+#include <linux/scatterlist.h>
+
+static void dma_noncoherent_sync_single_for_device(struct device *dev,
+		dma_addr_t addr, size_t size, enum dma_data_direction dir)
+{
+	arch_sync_dma_for_device(dev, dma_to_phys(dev, addr), size, dir);
+}
+
+static void dma_noncoherent_sync_sg_for_device(struct device *dev,
+		struct scatterlist *sgl, int nents, enum dma_data_direction dir)
+{
+	struct scatterlist *sg;
+	int i;
+
+	for_each_sg(sgl, sg, nents, i)
+		arch_sync_dma_for_device(dev, sg_phys(sg), sg->length, dir);
+}
+
+static dma_addr_t dma_noncoherent_map_page(struct device *dev, struct page *page,
+		unsigned long offset, size_t size, enum dma_data_direction dir,
+		unsigned long attrs)
+{
+	dma_addr_t addr;
+
+	addr = dma_direct_map_page(dev, page, offset, size, dir, attrs);
+	if (!dma_mapping_error(dev, addr) && !(attrs & DMA_ATTR_SKIP_CPU_SYNC))
+		arch_sync_dma_for_device(dev, page_to_phys(page), size, dir);
+	return addr;
+}
+
+static int dma_noncoherent_map_sg(struct device *dev, struct scatterlist *sgl,
+		int nents, enum dma_data_direction dir, unsigned long attrs)
+{
+	nents = dma_direct_map_sg(dev, sgl, nents, dir, attrs);
+	if (nents > 0 && !(attrs & DMA_ATTR_SKIP_CPU_SYNC))
+		dma_noncoherent_sync_sg_for_device(dev, sgl, nents, dir);
+	return nents;
+}
+
+#ifdef CONFIG_DMA_NONCOHERENT_SYNC_FOR_CPU
+static void dma_noncoherent_sync_single_for_cpu(struct device *dev,
+		dma_addr_t addr, size_t size, enum dma_data_direction dir)
+{
+	arch_sync_dma_for_cpu(dev, dma_to_phys(dev, addr), size, dir);
+}
+
+static void dma_noncoherent_sync_sg_for_cpu(struct device *dev,
+		struct scatterlist *sgl, int nents, enum dma_data_direction dir)
+{
+	struct scatterlist *sg;
+	int i;
+
+	for_each_sg(sgl, sg, nents, i)
+		arch_sync_dma_for_cpu(dev, sg_phys(sg), sg->length, dir);
+}
+
+static void dma_noncoherent_unmap_page(struct device *dev, dma_addr_t addr,
+		size_t size, enum dma_data_direction dir, unsigned long attrs)
+{
+	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
+		dma_noncoherent_sync_single_for_cpu(dev, addr, size, dir);
+}
+
+static void dma_noncoherent_unmap_sg(struct device *dev, struct scatterlist *sgl,
+		int nents, enum dma_data_direction dir, unsigned long attrs)
+{
+	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
+		dma_noncoherent_sync_sg_for_cpu(dev, sgl, nents, dir);
+}
+#endif
+
+const struct dma_map_ops dma_noncoherent_ops = {
+	.alloc			= arch_dma_alloc,
+	.free			= arch_dma_free,
+	.mmap			= arch_dma_mmap,
+	.sync_single_for_device	= dma_noncoherent_sync_single_for_device,
+	.sync_sg_for_device	= dma_noncoherent_sync_sg_for_device,
+	.map_page		= dma_noncoherent_map_page,
+	.map_sg			= dma_noncoherent_map_sg,
+#ifdef CONFIG_DMA_NONCOHERENT_SYNC_FOR_CPU
+	.sync_single_for_cpu	= dma_noncoherent_sync_single_for_cpu,
+	.sync_sg_for_cpu	= dma_noncoherent_sync_sg_for_cpu,
+	.unmap_page		= dma_noncoherent_unmap_page,
+	.unmap_sg		= dma_noncoherent_unmap_sg,
+#endif
+	.dma_supported		= dma_direct_supported,
+	.mapping_error		= dma_direct_mapping_error,
+	.cache_sync		= arch_dma_cache_sync,
+};
+EXPORT_SYMBOL(dma_noncoherent_ops);
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 03/22] dma-mapping: provide a generic dma-noncoherent implementation
@ 2018-04-20  8:02   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:02 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Add a new dma_map_ops implementation that uses dma-direct for the
address mapping of streaming mappings, and which requires arch-specific
implemenations of coherent allocate/free.

Architectures have to provide flushing helpers to ownership trasnfers
to the device and/or CPU, and can provide optional implementations of
the coherent mmap functionality, and the cache_flush routines for
non-coherent long term allocations.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 MAINTAINERS                       |   2 +
 include/asm-generic/dma-mapping.h |   9 +++
 include/linux/dma-direct.h        |   7 ++-
 include/linux/dma-mapping.h       |   1 +
 include/linux/dma-noncoherent.h   |  47 ++++++++++++++
 lib/Kconfig                       |  20 ++++++
 lib/Makefile                      |   1 +
 lib/dma-direct.c                  |   8 +--
 lib/dma-noncoherent.c             | 101 ++++++++++++++++++++++++++++++
 9 files changed, 191 insertions(+), 5 deletions(-)
 create mode 100644 include/linux/dma-noncoherent.h
 create mode 100644 lib/dma-noncoherent.c

diff --git a/MAINTAINERS b/MAINTAINERS
index b60179d948bb..bbaf5459d297 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4327,12 +4327,14 @@ W:	http://git.infradead.org/users/hch/dma-mapping.git
 S:	Supported
 F:	lib/dma-debug.c
 F:	lib/dma-direct.c
+F:	lib/dma-noncoherent.c
 F:	lib/dma-virt.c
 F:	drivers/base/dma-mapping.c
 F:	drivers/base/dma-coherent.c
 F:	include/asm-generic/dma-mapping.h
 F:	include/linux/dma-direct.h
 F:	include/linux/dma-mapping.h
+F:	include/linux/dma-noncoherent.h
 
 DME1737 HARDWARE MONITOR DRIVER
 M:	Juerg Haefliger <juergh@gmail.com>
diff --git a/include/asm-generic/dma-mapping.h b/include/asm-generic/dma-mapping.h
index 880a292d792f..ad2868263867 100644
--- a/include/asm-generic/dma-mapping.h
+++ b/include/asm-generic/dma-mapping.h
@@ -4,7 +4,16 @@
 
 static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
 {
+	/*
+	 * Use the non-coherent ops if available.  If an architecture wants a
+	 * more fine-grained selection of operations it will have to implement
+	 * get_arch_dma_ops itself or use the per-device dma_ops.
+	 */
+#ifdef CONFIG_DMA_NONCOHERENT_OPS
+	return &dma_noncoherent_ops;
+#else
 	return &dma_direct_ops;
+#endif
 }
 
 #endif /* _ASM_GENERIC_DMA_MAPPING_H */
diff --git a/include/linux/dma-direct.h b/include/linux/dma-direct.h
index 53ad6a47f513..8d9f33febde5 100644
--- a/include/linux/dma-direct.h
+++ b/include/linux/dma-direct.h
@@ -59,6 +59,11 @@ void *dma_direct_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
 		gfp_t gfp, unsigned long attrs);
 void dma_direct_free(struct device *dev, size_t size, void *cpu_addr,
 		dma_addr_t dma_addr, unsigned long attrs);
+dma_addr_t dma_direct_map_page(struct device *dev, struct page *page,
+		unsigned long offset, size_t size, enum dma_data_direction dir,
+		unsigned long attrs);
+int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl, int nents,
+		enum dma_data_direction dir, unsigned long attrs);
 int dma_direct_supported(struct device *dev, u64 mask);
-
+int dma_direct_mapping_error(struct device *dev, dma_addr_t dma_addr);
 #endif /* _LINUX_DMA_DIRECT_H */
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 25a9a2b04f78..4be070df5fc5 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -136,6 +136,7 @@ struct dma_map_ops {
 };
 
 extern const struct dma_map_ops dma_direct_ops;
+extern const struct dma_map_ops dma_noncoherent_ops;
 extern const struct dma_map_ops dma_virt_ops;
 
 #define DMA_BIT_MASK(n)	(((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
diff --git a/include/linux/dma-noncoherent.h b/include/linux/dma-noncoherent.h
new file mode 100644
index 000000000000..10b2654d549b
--- /dev/null
+++ b/include/linux/dma-noncoherent.h
@@ -0,0 +1,47 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _LINUX_DMA_NONCOHERENT_H
+#define _LINUX_DMA_NONCOHERENT_H 1
+
+#include <linux/dma-mapping.h>
+
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs);
+void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
+		dma_addr_t dma_addr, unsigned long attrs);
+
+#ifdef CONFIG_DMA_NONCOHERENT_MMAP
+int arch_dma_mmap(struct device *dev, struct vm_area_struct *vma,
+		void *cpu_addr, dma_addr_t dma_addr, size_t size,
+		unsigned long attrs);
+#else
+#define arch_dma_mmap NULL
+#endif /* CONFIG_DMA_NONCOHERENT_MMAP */
+
+#ifdef CONFIG_DMA_NONCOHERENT_CACHE_SYNC
+void arch_dma_cache_sync(struct device *dev, void *vaddr, size_t size,
+		enum dma_data_direction direction);
+#else
+#define arch_dma_cache_sync NULL
+#endif /* CONFIG_DMA_NONCOHERENT_CACHE_SYNC */
+
+#ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_DEVICE
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir);
+#else
+static inline void arch_sync_dma_for_device(struct device *dev,
+		phys_addr_t paddr, size_t size, enum dma_data_direction dir)
+{
+}
+#endif /* ARCH_HAS_SYNC_DMA_FOR_DEVICE */
+
+#ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir);
+#else
+static inline void arch_sync_dma_for_cpu(struct device *dev,
+		phys_addr_t paddr, size_t size, enum dma_data_direction dir)
+{
+}
+#endif /* ARCH_HAS_SYNC_DMA_FOR_CPU */
+
+#endif /* _LINUX_DMA_NONCOHERENT_H */
diff --git a/lib/Kconfig b/lib/Kconfig
index 726b0562caa7..ae4bf1d8af11 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -441,10 +441,30 @@ config ARCH_DMA_ADDR_T_64BIT
 config IOMMU_HELPER
 	bool
 
+config ARCH_HAS_SYNC_DMA_FOR_DEVICE
+	bool
+
+config ARCH_HAS_SYNC_DMA_FOR_CPU
+	bool
+	select NEED_DMA_MAP_STATE
+
 config DMA_DIRECT_OPS
 	bool
 	depends on HAS_DMA
 
+config DMA_NONCOHERENT_OPS
+	bool
+	depends on HAS_DMA
+	select DMA_DIRECT_OPS
+
+config DMA_NONCOHERENT_MMAP
+	bool
+	depends on DMA_NONCOHERENT_OPS
+
+config DMA_NONCOHERENT_CACHE_SYNC
+	bool
+	depends on DMA_NONCOHERENT_OPS
+
 config DMA_VIRT_OPS
 	bool
 	depends on HAS_DMA
diff --git a/lib/Makefile b/lib/Makefile
index 94203b5eecd4..9f18c8152281 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -30,6 +30,7 @@ lib-$(CONFIG_PRINTK) += dump_stack.o
 lib-$(CONFIG_MMU) += ioremap.o
 lib-$(CONFIG_SMP) += cpumask.o
 lib-$(CONFIG_DMA_DIRECT_OPS) += dma-direct.o
+lib-$(CONFIG_DMA_NONCOHERENT_OPS) += dma-noncoherent.o
 lib-$(CONFIG_DMA_VIRT_OPS) += dma-virt.o
 
 lib-y	+= kobject.o klist.o
diff --git a/lib/dma-direct.c b/lib/dma-direct.c
index 199ae4cdd28f..9abb93541dfe 100644
--- a/lib/dma-direct.c
+++ b/lib/dma-direct.c
@@ -120,7 +120,7 @@ void dma_direct_free(struct device *dev, size_t size, void *cpu_addr,
 		free_pages((unsigned long)cpu_addr, page_order);
 }
 
-static dma_addr_t dma_direct_map_page(struct device *dev, struct page *page,
+dma_addr_t dma_direct_map_page(struct device *dev, struct page *page,
 		unsigned long offset, size_t size, enum dma_data_direction dir,
 		unsigned long attrs)
 {
@@ -131,8 +131,8 @@ static dma_addr_t dma_direct_map_page(struct device *dev, struct page *page,
 	return dma_addr;
 }
 
-static int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl,
-		int nents, enum dma_data_direction dir, unsigned long attrs)
+int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl, int nents,
+		enum dma_data_direction dir, unsigned long attrs)
 {
 	int i;
 	struct scatterlist *sg;
@@ -167,7 +167,7 @@ int dma_direct_supported(struct device *dev, u64 mask)
 	return 1;
 }
 
-static int dma_direct_mapping_error(struct device *dev, dma_addr_t dma_addr)
+int dma_direct_mapping_error(struct device *dev, dma_addr_t dma_addr)
 {
 	return dma_addr == DIRECT_MAPPING_ERROR;
 }
diff --git a/lib/dma-noncoherent.c b/lib/dma-noncoherent.c
new file mode 100644
index 000000000000..f4b8532c20ac
--- /dev/null
+++ b/lib/dma-noncoherent.c
@@ -0,0 +1,101 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2018 Christoph Hellwig.
+ *
+ * DMA operations that map physical memory directly without providing cache
+ * coherence.
+ */
+#include <linux/export.h>
+#include <linux/mm.h>
+#include <linux/dma-direct.h>
+#include <linux/dma-noncoherent.h>
+#include <linux/scatterlist.h>
+
+static void dma_noncoherent_sync_single_for_device(struct device *dev,
+		dma_addr_t addr, size_t size, enum dma_data_direction dir)
+{
+	arch_sync_dma_for_device(dev, dma_to_phys(dev, addr), size, dir);
+}
+
+static void dma_noncoherent_sync_sg_for_device(struct device *dev,
+		struct scatterlist *sgl, int nents, enum dma_data_direction dir)
+{
+	struct scatterlist *sg;
+	int i;
+
+	for_each_sg(sgl, sg, nents, i)
+		arch_sync_dma_for_device(dev, sg_phys(sg), sg->length, dir);
+}
+
+static dma_addr_t dma_noncoherent_map_page(struct device *dev, struct page *page,
+		unsigned long offset, size_t size, enum dma_data_direction dir,
+		unsigned long attrs)
+{
+	dma_addr_t addr;
+
+	addr = dma_direct_map_page(dev, page, offset, size, dir, attrs);
+	if (!dma_mapping_error(dev, addr) && !(attrs & DMA_ATTR_SKIP_CPU_SYNC))
+		arch_sync_dma_for_device(dev, page_to_phys(page), size, dir);
+	return addr;
+}
+
+static int dma_noncoherent_map_sg(struct device *dev, struct scatterlist *sgl,
+		int nents, enum dma_data_direction dir, unsigned long attrs)
+{
+	nents = dma_direct_map_sg(dev, sgl, nents, dir, attrs);
+	if (nents > 0 && !(attrs & DMA_ATTR_SKIP_CPU_SYNC))
+		dma_noncoherent_sync_sg_for_device(dev, sgl, nents, dir);
+	return nents;
+}
+
+#ifdef CONFIG_DMA_NONCOHERENT_SYNC_FOR_CPU
+static void dma_noncoherent_sync_single_for_cpu(struct device *dev,
+		dma_addr_t addr, size_t size, enum dma_data_direction dir)
+{
+	arch_sync_dma_for_cpu(dev, dma_to_phys(dev, addr), size, dir);
+}
+
+static void dma_noncoherent_sync_sg_for_cpu(struct device *dev,
+		struct scatterlist *sgl, int nents, enum dma_data_direction dir)
+{
+	struct scatterlist *sg;
+	int i;
+
+	for_each_sg(sgl, sg, nents, i)
+		arch_sync_dma_for_cpu(dev, sg_phys(sg), sg->length, dir);
+}
+
+static void dma_noncoherent_unmap_page(struct device *dev, dma_addr_t addr,
+		size_t size, enum dma_data_direction dir, unsigned long attrs)
+{
+	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
+		dma_noncoherent_sync_single_for_cpu(dev, addr, size, dir);
+}
+
+static void dma_noncoherent_unmap_sg(struct device *dev, struct scatterlist *sgl,
+		int nents, enum dma_data_direction dir, unsigned long attrs)
+{
+	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
+		dma_noncoherent_sync_sg_for_cpu(dev, sgl, nents, dir);
+}
+#endif
+
+const struct dma_map_ops dma_noncoherent_ops = {
+	.alloc			= arch_dma_alloc,
+	.free			= arch_dma_free,
+	.mmap			= arch_dma_mmap,
+	.sync_single_for_device	= dma_noncoherent_sync_single_for_device,
+	.sync_sg_for_device	= dma_noncoherent_sync_sg_for_device,
+	.map_page		= dma_noncoherent_map_page,
+	.map_sg			= dma_noncoherent_map_sg,
+#ifdef CONFIG_DMA_NONCOHERENT_SYNC_FOR_CPU
+	.sync_single_for_cpu	= dma_noncoherent_sync_single_for_cpu,
+	.sync_sg_for_cpu	= dma_noncoherent_sync_sg_for_cpu,
+	.unmap_page		= dma_noncoherent_unmap_page,
+	.unmap_sg		= dma_noncoherent_unmap_sg,
+#endif
+	.dma_supported		= dma_direct_supported,
+	.mapping_error		= dma_direct_mapping_error,
+	.cache_sync		= arch_dma_cache_sync,
+};
+EXPORT_SYMBOL(dma_noncoherent_ops);
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 03/22] dma-mapping: provide a generic dma-noncoherent implementation
@ 2018-04-20  8:02   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:02 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Add a new dma_map_ops implementation that uses dma-direct for the
address mapping of streaming mappings, and which requires arch-specific
implemenations of coherent allocate/free.

Architectures have to provide flushing helpers to ownership trasnfers
to the device and/or CPU, and can provide optional implementations of
the coherent mmap functionality, and the cache_flush routines for
non-coherent long term allocations.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 MAINTAINERS                       |   2 +
 include/asm-generic/dma-mapping.h |   9 +++
 include/linux/dma-direct.h        |   7 ++-
 include/linux/dma-mapping.h       |   1 +
 include/linux/dma-noncoherent.h   |  47 ++++++++++++++
 lib/Kconfig                       |  20 ++++++
 lib/Makefile                      |   1 +
 lib/dma-direct.c                  |   8 +--
 lib/dma-noncoherent.c             | 101 ++++++++++++++++++++++++++++++
 9 files changed, 191 insertions(+), 5 deletions(-)
 create mode 100644 include/linux/dma-noncoherent.h
 create mode 100644 lib/dma-noncoherent.c

diff --git a/MAINTAINERS b/MAINTAINERS
index b60179d948bb..bbaf5459d297 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4327,12 +4327,14 @@ W:	http://git.infradead.org/users/hch/dma-mapping.git
 S:	Supported
 F:	lib/dma-debug.c
 F:	lib/dma-direct.c
+F:	lib/dma-noncoherent.c
 F:	lib/dma-virt.c
 F:	drivers/base/dma-mapping.c
 F:	drivers/base/dma-coherent.c
 F:	include/asm-generic/dma-mapping.h
 F:	include/linux/dma-direct.h
 F:	include/linux/dma-mapping.h
+F:	include/linux/dma-noncoherent.h
 
 DME1737 HARDWARE MONITOR DRIVER
 M:	Juerg Haefliger <juergh@gmail.com>
diff --git a/include/asm-generic/dma-mapping.h b/include/asm-generic/dma-mapping.h
index 880a292d792f..ad2868263867 100644
--- a/include/asm-generic/dma-mapping.h
+++ b/include/asm-generic/dma-mapping.h
@@ -4,7 +4,16 @@
 
 static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
 {
+	/*
+	 * Use the non-coherent ops if available.  If an architecture wants a
+	 * more fine-grained selection of operations it will have to implement
+	 * get_arch_dma_ops itself or use the per-device dma_ops.
+	 */
+#ifdef CONFIG_DMA_NONCOHERENT_OPS
+	return &dma_noncoherent_ops;
+#else
 	return &dma_direct_ops;
+#endif
 }
 
 #endif /* _ASM_GENERIC_DMA_MAPPING_H */
diff --git a/include/linux/dma-direct.h b/include/linux/dma-direct.h
index 53ad6a47f513..8d9f33febde5 100644
--- a/include/linux/dma-direct.h
+++ b/include/linux/dma-direct.h
@@ -59,6 +59,11 @@ void *dma_direct_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
 		gfp_t gfp, unsigned long attrs);
 void dma_direct_free(struct device *dev, size_t size, void *cpu_addr,
 		dma_addr_t dma_addr, unsigned long attrs);
+dma_addr_t dma_direct_map_page(struct device *dev, struct page *page,
+		unsigned long offset, size_t size, enum dma_data_direction dir,
+		unsigned long attrs);
+int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl, int nents,
+		enum dma_data_direction dir, unsigned long attrs);
 int dma_direct_supported(struct device *dev, u64 mask);
-
+int dma_direct_mapping_error(struct device *dev, dma_addr_t dma_addr);
 #endif /* _LINUX_DMA_DIRECT_H */
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 25a9a2b04f78..4be070df5fc5 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -136,6 +136,7 @@ struct dma_map_ops {
 };
 
 extern const struct dma_map_ops dma_direct_ops;
+extern const struct dma_map_ops dma_noncoherent_ops;
 extern const struct dma_map_ops dma_virt_ops;
 
 #define DMA_BIT_MASK(n)	(((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
diff --git a/include/linux/dma-noncoherent.h b/include/linux/dma-noncoherent.h
new file mode 100644
index 000000000000..10b2654d549b
--- /dev/null
+++ b/include/linux/dma-noncoherent.h
@@ -0,0 +1,47 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _LINUX_DMA_NONCOHERENT_H
+#define _LINUX_DMA_NONCOHERENT_H 1
+
+#include <linux/dma-mapping.h>
+
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs);
+void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
+		dma_addr_t dma_addr, unsigned long attrs);
+
+#ifdef CONFIG_DMA_NONCOHERENT_MMAP
+int arch_dma_mmap(struct device *dev, struct vm_area_struct *vma,
+		void *cpu_addr, dma_addr_t dma_addr, size_t size,
+		unsigned long attrs);
+#else
+#define arch_dma_mmap NULL
+#endif /* CONFIG_DMA_NONCOHERENT_MMAP */
+
+#ifdef CONFIG_DMA_NONCOHERENT_CACHE_SYNC
+void arch_dma_cache_sync(struct device *dev, void *vaddr, size_t size,
+		enum dma_data_direction direction);
+#else
+#define arch_dma_cache_sync NULL
+#endif /* CONFIG_DMA_NONCOHERENT_CACHE_SYNC */
+
+#ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_DEVICE
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir);
+#else
+static inline void arch_sync_dma_for_device(struct device *dev,
+		phys_addr_t paddr, size_t size, enum dma_data_direction dir)
+{
+}
+#endif /* ARCH_HAS_SYNC_DMA_FOR_DEVICE */
+
+#ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir);
+#else
+static inline void arch_sync_dma_for_cpu(struct device *dev,
+		phys_addr_t paddr, size_t size, enum dma_data_direction dir)
+{
+}
+#endif /* ARCH_HAS_SYNC_DMA_FOR_CPU */
+
+#endif /* _LINUX_DMA_NONCOHERENT_H */
diff --git a/lib/Kconfig b/lib/Kconfig
index 726b0562caa7..ae4bf1d8af11 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -441,10 +441,30 @@ config ARCH_DMA_ADDR_T_64BIT
 config IOMMU_HELPER
 	bool
 
+config ARCH_HAS_SYNC_DMA_FOR_DEVICE
+	bool
+
+config ARCH_HAS_SYNC_DMA_FOR_CPU
+	bool
+	select NEED_DMA_MAP_STATE
+
 config DMA_DIRECT_OPS
 	bool
 	depends on HAS_DMA
 
+config DMA_NONCOHERENT_OPS
+	bool
+	depends on HAS_DMA
+	select DMA_DIRECT_OPS
+
+config DMA_NONCOHERENT_MMAP
+	bool
+	depends on DMA_NONCOHERENT_OPS
+
+config DMA_NONCOHERENT_CACHE_SYNC
+	bool
+	depends on DMA_NONCOHERENT_OPS
+
 config DMA_VIRT_OPS
 	bool
 	depends on HAS_DMA
diff --git a/lib/Makefile b/lib/Makefile
index 94203b5eecd4..9f18c8152281 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -30,6 +30,7 @@ lib-$(CONFIG_PRINTK) += dump_stack.o
 lib-$(CONFIG_MMU) += ioremap.o
 lib-$(CONFIG_SMP) += cpumask.o
 lib-$(CONFIG_DMA_DIRECT_OPS) += dma-direct.o
+lib-$(CONFIG_DMA_NONCOHERENT_OPS) += dma-noncoherent.o
 lib-$(CONFIG_DMA_VIRT_OPS) += dma-virt.o
 
 lib-y	+= kobject.o klist.o
diff --git a/lib/dma-direct.c b/lib/dma-direct.c
index 199ae4cdd28f..9abb93541dfe 100644
--- a/lib/dma-direct.c
+++ b/lib/dma-direct.c
@@ -120,7 +120,7 @@ void dma_direct_free(struct device *dev, size_t size, void *cpu_addr,
 		free_pages((unsigned long)cpu_addr, page_order);
 }
 
-static dma_addr_t dma_direct_map_page(struct device *dev, struct page *page,
+dma_addr_t dma_direct_map_page(struct device *dev, struct page *page,
 		unsigned long offset, size_t size, enum dma_data_direction dir,
 		unsigned long attrs)
 {
@@ -131,8 +131,8 @@ static dma_addr_t dma_direct_map_page(struct device *dev, struct page *page,
 	return dma_addr;
 }
 
-static int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl,
-		int nents, enum dma_data_direction dir, unsigned long attrs)
+int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl, int nents,
+		enum dma_data_direction dir, unsigned long attrs)
 {
 	int i;
 	struct scatterlist *sg;
@@ -167,7 +167,7 @@ int dma_direct_supported(struct device *dev, u64 mask)
 	return 1;
 }
 
-static int dma_direct_mapping_error(struct device *dev, dma_addr_t dma_addr)
+int dma_direct_mapping_error(struct device *dev, dma_addr_t dma_addr)
 {
 	return dma_addr == DIRECT_MAPPING_ERROR;
 }
diff --git a/lib/dma-noncoherent.c b/lib/dma-noncoherent.c
new file mode 100644
index 000000000000..f4b8532c20ac
--- /dev/null
+++ b/lib/dma-noncoherent.c
@@ -0,0 +1,101 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2018 Christoph Hellwig.
+ *
+ * DMA operations that map physical memory directly without providing cache
+ * coherence.
+ */
+#include <linux/export.h>
+#include <linux/mm.h>
+#include <linux/dma-direct.h>
+#include <linux/dma-noncoherent.h>
+#include <linux/scatterlist.h>
+
+static void dma_noncoherent_sync_single_for_device(struct device *dev,
+		dma_addr_t addr, size_t size, enum dma_data_direction dir)
+{
+	arch_sync_dma_for_device(dev, dma_to_phys(dev, addr), size, dir);
+}
+
+static void dma_noncoherent_sync_sg_for_device(struct device *dev,
+		struct scatterlist *sgl, int nents, enum dma_data_direction dir)
+{
+	struct scatterlist *sg;
+	int i;
+
+	for_each_sg(sgl, sg, nents, i)
+		arch_sync_dma_for_device(dev, sg_phys(sg), sg->length, dir);
+}
+
+static dma_addr_t dma_noncoherent_map_page(struct device *dev, struct page *page,
+		unsigned long offset, size_t size, enum dma_data_direction dir,
+		unsigned long attrs)
+{
+	dma_addr_t addr;
+
+	addr = dma_direct_map_page(dev, page, offset, size, dir, attrs);
+	if (!dma_mapping_error(dev, addr) && !(attrs & DMA_ATTR_SKIP_CPU_SYNC))
+		arch_sync_dma_for_device(dev, page_to_phys(page), size, dir);
+	return addr;
+}
+
+static int dma_noncoherent_map_sg(struct device *dev, struct scatterlist *sgl,
+		int nents, enum dma_data_direction dir, unsigned long attrs)
+{
+	nents = dma_direct_map_sg(dev, sgl, nents, dir, attrs);
+	if (nents > 0 && !(attrs & DMA_ATTR_SKIP_CPU_SYNC))
+		dma_noncoherent_sync_sg_for_device(dev, sgl, nents, dir);
+	return nents;
+}
+
+#ifdef CONFIG_DMA_NONCOHERENT_SYNC_FOR_CPU
+static void dma_noncoherent_sync_single_for_cpu(struct device *dev,
+		dma_addr_t addr, size_t size, enum dma_data_direction dir)
+{
+	arch_sync_dma_for_cpu(dev, dma_to_phys(dev, addr), size, dir);
+}
+
+static void dma_noncoherent_sync_sg_for_cpu(struct device *dev,
+		struct scatterlist *sgl, int nents, enum dma_data_direction dir)
+{
+	struct scatterlist *sg;
+	int i;
+
+	for_each_sg(sgl, sg, nents, i)
+		arch_sync_dma_for_cpu(dev, sg_phys(sg), sg->length, dir);
+}
+
+static void dma_noncoherent_unmap_page(struct device *dev, dma_addr_t addr,
+		size_t size, enum dma_data_direction dir, unsigned long attrs)
+{
+	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
+		dma_noncoherent_sync_single_for_cpu(dev, addr, size, dir);
+}
+
+static void dma_noncoherent_unmap_sg(struct device *dev, struct scatterlist *sgl,
+		int nents, enum dma_data_direction dir, unsigned long attrs)
+{
+	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
+		dma_noncoherent_sync_sg_for_cpu(dev, sgl, nents, dir);
+}
+#endif
+
+const struct dma_map_ops dma_noncoherent_ops = {
+	.alloc			= arch_dma_alloc,
+	.free			= arch_dma_free,
+	.mmap			= arch_dma_mmap,
+	.sync_single_for_device	= dma_noncoherent_sync_single_for_device,
+	.sync_sg_for_device	= dma_noncoherent_sync_sg_for_device,
+	.map_page		= dma_noncoherent_map_page,
+	.map_sg			= dma_noncoherent_map_sg,
+#ifdef CONFIG_DMA_NONCOHERENT_SYNC_FOR_CPU
+	.sync_single_for_cpu	= dma_noncoherent_sync_single_for_cpu,
+	.sync_sg_for_cpu	= dma_noncoherent_sync_sg_for_cpu,
+	.unmap_page		= dma_noncoherent_unmap_page,
+	.unmap_sg		= dma_noncoherent_unmap_sg,
+#endif
+	.dma_supported		= dma_direct_supported,
+	.mapping_error		= dma_direct_mapping_error,
+	.cache_sync		= arch_dma_cache_sync,
+};
+EXPORT_SYMBOL(dma_noncoherent_ops);
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 03/22] dma-mapping: provide a generic dma-noncoherent implementation
@ 2018-04-20  8:02   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:02 UTC (permalink / raw)
  To: linux-snps-arc

Add a new dma_map_ops implementation that uses dma-direct for the
address mapping of streaming mappings, and which requires arch-specific
implemenations of coherent allocate/free.

Architectures have to provide flushing helpers to ownership trasnfers
to the device and/or CPU, and can provide optional implementations of
the coherent mmap functionality, and the cache_flush routines for
non-coherent long term allocations.

Signed-off-by: Christoph Hellwig <hch at lst.de>
---
 MAINTAINERS                       |   2 +
 include/asm-generic/dma-mapping.h |   9 +++
 include/linux/dma-direct.h        |   7 ++-
 include/linux/dma-mapping.h       |   1 +
 include/linux/dma-noncoherent.h   |  47 ++++++++++++++
 lib/Kconfig                       |  20 ++++++
 lib/Makefile                      |   1 +
 lib/dma-direct.c                  |   8 +--
 lib/dma-noncoherent.c             | 101 ++++++++++++++++++++++++++++++
 9 files changed, 191 insertions(+), 5 deletions(-)
 create mode 100644 include/linux/dma-noncoherent.h
 create mode 100644 lib/dma-noncoherent.c

diff --git a/MAINTAINERS b/MAINTAINERS
index b60179d948bb..bbaf5459d297 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4327,12 +4327,14 @@ W:	http://git.infradead.org/users/hch/dma-mapping.git
 S:	Supported
 F:	lib/dma-debug.c
 F:	lib/dma-direct.c
+F:	lib/dma-noncoherent.c
 F:	lib/dma-virt.c
 F:	drivers/base/dma-mapping.c
 F:	drivers/base/dma-coherent.c
 F:	include/asm-generic/dma-mapping.h
 F:	include/linux/dma-direct.h
 F:	include/linux/dma-mapping.h
+F:	include/linux/dma-noncoherent.h
 
 DME1737 HARDWARE MONITOR DRIVER
 M:	Juerg Haefliger <juergh at gmail.com>
diff --git a/include/asm-generic/dma-mapping.h b/include/asm-generic/dma-mapping.h
index 880a292d792f..ad2868263867 100644
--- a/include/asm-generic/dma-mapping.h
+++ b/include/asm-generic/dma-mapping.h
@@ -4,7 +4,16 @@
 
 static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
 {
+	/*
+	 * Use the non-coherent ops if available.  If an architecture wants a
+	 * more fine-grained selection of operations it will have to implement
+	 * get_arch_dma_ops itself or use the per-device dma_ops.
+	 */
+#ifdef CONFIG_DMA_NONCOHERENT_OPS
+	return &dma_noncoherent_ops;
+#else
 	return &dma_direct_ops;
+#endif
 }
 
 #endif /* _ASM_GENERIC_DMA_MAPPING_H */
diff --git a/include/linux/dma-direct.h b/include/linux/dma-direct.h
index 53ad6a47f513..8d9f33febde5 100644
--- a/include/linux/dma-direct.h
+++ b/include/linux/dma-direct.h
@@ -59,6 +59,11 @@ void *dma_direct_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
 		gfp_t gfp, unsigned long attrs);
 void dma_direct_free(struct device *dev, size_t size, void *cpu_addr,
 		dma_addr_t dma_addr, unsigned long attrs);
+dma_addr_t dma_direct_map_page(struct device *dev, struct page *page,
+		unsigned long offset, size_t size, enum dma_data_direction dir,
+		unsigned long attrs);
+int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl, int nents,
+		enum dma_data_direction dir, unsigned long attrs);
 int dma_direct_supported(struct device *dev, u64 mask);
-
+int dma_direct_mapping_error(struct device *dev, dma_addr_t dma_addr);
 #endif /* _LINUX_DMA_DIRECT_H */
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 25a9a2b04f78..4be070df5fc5 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -136,6 +136,7 @@ struct dma_map_ops {
 };
 
 extern const struct dma_map_ops dma_direct_ops;
+extern const struct dma_map_ops dma_noncoherent_ops;
 extern const struct dma_map_ops dma_virt_ops;
 
 #define DMA_BIT_MASK(n)	(((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
diff --git a/include/linux/dma-noncoherent.h b/include/linux/dma-noncoherent.h
new file mode 100644
index 000000000000..10b2654d549b
--- /dev/null
+++ b/include/linux/dma-noncoherent.h
@@ -0,0 +1,47 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _LINUX_DMA_NONCOHERENT_H
+#define _LINUX_DMA_NONCOHERENT_H 1
+
+#include <linux/dma-mapping.h>
+
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs);
+void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
+		dma_addr_t dma_addr, unsigned long attrs);
+
+#ifdef CONFIG_DMA_NONCOHERENT_MMAP
+int arch_dma_mmap(struct device *dev, struct vm_area_struct *vma,
+		void *cpu_addr, dma_addr_t dma_addr, size_t size,
+		unsigned long attrs);
+#else
+#define arch_dma_mmap NULL
+#endif /* CONFIG_DMA_NONCOHERENT_MMAP */
+
+#ifdef CONFIG_DMA_NONCOHERENT_CACHE_SYNC
+void arch_dma_cache_sync(struct device *dev, void *vaddr, size_t size,
+		enum dma_data_direction direction);
+#else
+#define arch_dma_cache_sync NULL
+#endif /* CONFIG_DMA_NONCOHERENT_CACHE_SYNC */
+
+#ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_DEVICE
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir);
+#else
+static inline void arch_sync_dma_for_device(struct device *dev,
+		phys_addr_t paddr, size_t size, enum dma_data_direction dir)
+{
+}
+#endif /* ARCH_HAS_SYNC_DMA_FOR_DEVICE */
+
+#ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir);
+#else
+static inline void arch_sync_dma_for_cpu(struct device *dev,
+		phys_addr_t paddr, size_t size, enum dma_data_direction dir)
+{
+}
+#endif /* ARCH_HAS_SYNC_DMA_FOR_CPU */
+
+#endif /* _LINUX_DMA_NONCOHERENT_H */
diff --git a/lib/Kconfig b/lib/Kconfig
index 726b0562caa7..ae4bf1d8af11 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -441,10 +441,30 @@ config ARCH_DMA_ADDR_T_64BIT
 config IOMMU_HELPER
 	bool
 
+config ARCH_HAS_SYNC_DMA_FOR_DEVICE
+	bool
+
+config ARCH_HAS_SYNC_DMA_FOR_CPU
+	bool
+	select NEED_DMA_MAP_STATE
+
 config DMA_DIRECT_OPS
 	bool
 	depends on HAS_DMA
 
+config DMA_NONCOHERENT_OPS
+	bool
+	depends on HAS_DMA
+	select DMA_DIRECT_OPS
+
+config DMA_NONCOHERENT_MMAP
+	bool
+	depends on DMA_NONCOHERENT_OPS
+
+config DMA_NONCOHERENT_CACHE_SYNC
+	bool
+	depends on DMA_NONCOHERENT_OPS
+
 config DMA_VIRT_OPS
 	bool
 	depends on HAS_DMA
diff --git a/lib/Makefile b/lib/Makefile
index 94203b5eecd4..9f18c8152281 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -30,6 +30,7 @@ lib-$(CONFIG_PRINTK) += dump_stack.o
 lib-$(CONFIG_MMU) += ioremap.o
 lib-$(CONFIG_SMP) += cpumask.o
 lib-$(CONFIG_DMA_DIRECT_OPS) += dma-direct.o
+lib-$(CONFIG_DMA_NONCOHERENT_OPS) += dma-noncoherent.o
 lib-$(CONFIG_DMA_VIRT_OPS) += dma-virt.o
 
 lib-y	+= kobject.o klist.o
diff --git a/lib/dma-direct.c b/lib/dma-direct.c
index 199ae4cdd28f..9abb93541dfe 100644
--- a/lib/dma-direct.c
+++ b/lib/dma-direct.c
@@ -120,7 +120,7 @@ void dma_direct_free(struct device *dev, size_t size, void *cpu_addr,
 		free_pages((unsigned long)cpu_addr, page_order);
 }
 
-static dma_addr_t dma_direct_map_page(struct device *dev, struct page *page,
+dma_addr_t dma_direct_map_page(struct device *dev, struct page *page,
 		unsigned long offset, size_t size, enum dma_data_direction dir,
 		unsigned long attrs)
 {
@@ -131,8 +131,8 @@ static dma_addr_t dma_direct_map_page(struct device *dev, struct page *page,
 	return dma_addr;
 }
 
-static int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl,
-		int nents, enum dma_data_direction dir, unsigned long attrs)
+int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl, int nents,
+		enum dma_data_direction dir, unsigned long attrs)
 {
 	int i;
 	struct scatterlist *sg;
@@ -167,7 +167,7 @@ int dma_direct_supported(struct device *dev, u64 mask)
 	return 1;
 }
 
-static int dma_direct_mapping_error(struct device *dev, dma_addr_t dma_addr)
+int dma_direct_mapping_error(struct device *dev, dma_addr_t dma_addr)
 {
 	return dma_addr == DIRECT_MAPPING_ERROR;
 }
diff --git a/lib/dma-noncoherent.c b/lib/dma-noncoherent.c
new file mode 100644
index 000000000000..f4b8532c20ac
--- /dev/null
+++ b/lib/dma-noncoherent.c
@@ -0,0 +1,101 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2018 Christoph Hellwig.
+ *
+ * DMA operations that map physical memory directly without providing cache
+ * coherence.
+ */
+#include <linux/export.h>
+#include <linux/mm.h>
+#include <linux/dma-direct.h>
+#include <linux/dma-noncoherent.h>
+#include <linux/scatterlist.h>
+
+static void dma_noncoherent_sync_single_for_device(struct device *dev,
+		dma_addr_t addr, size_t size, enum dma_data_direction dir)
+{
+	arch_sync_dma_for_device(dev, dma_to_phys(dev, addr), size, dir);
+}
+
+static void dma_noncoherent_sync_sg_for_device(struct device *dev,
+		struct scatterlist *sgl, int nents, enum dma_data_direction dir)
+{
+	struct scatterlist *sg;
+	int i;
+
+	for_each_sg(sgl, sg, nents, i)
+		arch_sync_dma_for_device(dev, sg_phys(sg), sg->length, dir);
+}
+
+static dma_addr_t dma_noncoherent_map_page(struct device *dev, struct page *page,
+		unsigned long offset, size_t size, enum dma_data_direction dir,
+		unsigned long attrs)
+{
+	dma_addr_t addr;
+
+	addr = dma_direct_map_page(dev, page, offset, size, dir, attrs);
+	if (!dma_mapping_error(dev, addr) && !(attrs & DMA_ATTR_SKIP_CPU_SYNC))
+		arch_sync_dma_for_device(dev, page_to_phys(page), size, dir);
+	return addr;
+}
+
+static int dma_noncoherent_map_sg(struct device *dev, struct scatterlist *sgl,
+		int nents, enum dma_data_direction dir, unsigned long attrs)
+{
+	nents = dma_direct_map_sg(dev, sgl, nents, dir, attrs);
+	if (nents > 0 && !(attrs & DMA_ATTR_SKIP_CPU_SYNC))
+		dma_noncoherent_sync_sg_for_device(dev, sgl, nents, dir);
+	return nents;
+}
+
+#ifdef CONFIG_DMA_NONCOHERENT_SYNC_FOR_CPU
+static void dma_noncoherent_sync_single_for_cpu(struct device *dev,
+		dma_addr_t addr, size_t size, enum dma_data_direction dir)
+{
+	arch_sync_dma_for_cpu(dev, dma_to_phys(dev, addr), size, dir);
+}
+
+static void dma_noncoherent_sync_sg_for_cpu(struct device *dev,
+		struct scatterlist *sgl, int nents, enum dma_data_direction dir)
+{
+	struct scatterlist *sg;
+	int i;
+
+	for_each_sg(sgl, sg, nents, i)
+		arch_sync_dma_for_cpu(dev, sg_phys(sg), sg->length, dir);
+}
+
+static void dma_noncoherent_unmap_page(struct device *dev, dma_addr_t addr,
+		size_t size, enum dma_data_direction dir, unsigned long attrs)
+{
+	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
+		dma_noncoherent_sync_single_for_cpu(dev, addr, size, dir);
+}
+
+static void dma_noncoherent_unmap_sg(struct device *dev, struct scatterlist *sgl,
+		int nents, enum dma_data_direction dir, unsigned long attrs)
+{
+	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
+		dma_noncoherent_sync_sg_for_cpu(dev, sgl, nents, dir);
+}
+#endif
+
+const struct dma_map_ops dma_noncoherent_ops = {
+	.alloc			= arch_dma_alloc,
+	.free			= arch_dma_free,
+	.mmap			= arch_dma_mmap,
+	.sync_single_for_device	= dma_noncoherent_sync_single_for_device,
+	.sync_sg_for_device	= dma_noncoherent_sync_sg_for_device,
+	.map_page		= dma_noncoherent_map_page,
+	.map_sg			= dma_noncoherent_map_sg,
+#ifdef CONFIG_DMA_NONCOHERENT_SYNC_FOR_CPU
+	.sync_single_for_cpu	= dma_noncoherent_sync_single_for_cpu,
+	.sync_sg_for_cpu	= dma_noncoherent_sync_sg_for_cpu,
+	.unmap_page		= dma_noncoherent_unmap_page,
+	.unmap_sg		= dma_noncoherent_unmap_sg,
+#endif
+	.dma_supported		= dma_direct_supported,
+	.mapping_error		= dma_direct_mapping_error,
+	.cache_sync		= arch_dma_cache_sync,
+};
+EXPORT_SYMBOL(dma_noncoherent_ops);
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 03/22] dma-mapping: provide a generic dma-noncoherent implementation
@ 2018-04-20  8:02   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:02 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Add a new dma_map_ops implementation that uses dma-direct for the
address mapping of streaming mappings, and which requires arch-specific
implemenations of coherent allocate/free.

Architectures have to provide flushing helpers to ownership trasnfers
to the device and/or CPU, and can provide optional implementations of
the coherent mmap functionality, and the cache_flush routines for
non-coherent long term allocations.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 MAINTAINERS                       |   2 +
 include/asm-generic/dma-mapping.h |   9 +++
 include/linux/dma-direct.h        |   7 ++-
 include/linux/dma-mapping.h       |   1 +
 include/linux/dma-noncoherent.h   |  47 ++++++++++++++
 lib/Kconfig                       |  20 ++++++
 lib/Makefile                      |   1 +
 lib/dma-direct.c                  |   8 +--
 lib/dma-noncoherent.c             | 101 ++++++++++++++++++++++++++++++
 9 files changed, 191 insertions(+), 5 deletions(-)
 create mode 100644 include/linux/dma-noncoherent.h
 create mode 100644 lib/dma-noncoherent.c

diff --git a/MAINTAINERS b/MAINTAINERS
index b60179d948bb..bbaf5459d297 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4327,12 +4327,14 @@ W:	http://git.infradead.org/users/hch/dma-mapping.git
 S:	Supported
 F:	lib/dma-debug.c
 F:	lib/dma-direct.c
+F:	lib/dma-noncoherent.c
 F:	lib/dma-virt.c
 F:	drivers/base/dma-mapping.c
 F:	drivers/base/dma-coherent.c
 F:	include/asm-generic/dma-mapping.h
 F:	include/linux/dma-direct.h
 F:	include/linux/dma-mapping.h
+F:	include/linux/dma-noncoherent.h
 
 DME1737 HARDWARE MONITOR DRIVER
 M:	Juerg Haefliger <juergh@gmail.com>
diff --git a/include/asm-generic/dma-mapping.h b/include/asm-generic/dma-mapping.h
index 880a292d792f..ad2868263867 100644
--- a/include/asm-generic/dma-mapping.h
+++ b/include/asm-generic/dma-mapping.h
@@ -4,7 +4,16 @@
 
 static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
 {
+	/*
+	 * Use the non-coherent ops if available.  If an architecture wants a
+	 * more fine-grained selection of operations it will have to implement
+	 * get_arch_dma_ops itself or use the per-device dma_ops.
+	 */
+#ifdef CONFIG_DMA_NONCOHERENT_OPS
+	return &dma_noncoherent_ops;
+#else
 	return &dma_direct_ops;
+#endif
 }
 
 #endif /* _ASM_GENERIC_DMA_MAPPING_H */
diff --git a/include/linux/dma-direct.h b/include/linux/dma-direct.h
index 53ad6a47f513..8d9f33febde5 100644
--- a/include/linux/dma-direct.h
+++ b/include/linux/dma-direct.h
@@ -59,6 +59,11 @@ void *dma_direct_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
 		gfp_t gfp, unsigned long attrs);
 void dma_direct_free(struct device *dev, size_t size, void *cpu_addr,
 		dma_addr_t dma_addr, unsigned long attrs);
+dma_addr_t dma_direct_map_page(struct device *dev, struct page *page,
+		unsigned long offset, size_t size, enum dma_data_direction dir,
+		unsigned long attrs);
+int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl, int nents,
+		enum dma_data_direction dir, unsigned long attrs);
 int dma_direct_supported(struct device *dev, u64 mask);
-
+int dma_direct_mapping_error(struct device *dev, dma_addr_t dma_addr);
 #endif /* _LINUX_DMA_DIRECT_H */
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 25a9a2b04f78..4be070df5fc5 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -136,6 +136,7 @@ struct dma_map_ops {
 };
 
 extern const struct dma_map_ops dma_direct_ops;
+extern const struct dma_map_ops dma_noncoherent_ops;
 extern const struct dma_map_ops dma_virt_ops;
 
 #define DMA_BIT_MASK(n)	(((n) = 64) ? ~0ULL : ((1ULL<<(n))-1))
diff --git a/include/linux/dma-noncoherent.h b/include/linux/dma-noncoherent.h
new file mode 100644
index 000000000000..10b2654d549b
--- /dev/null
+++ b/include/linux/dma-noncoherent.h
@@ -0,0 +1,47 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _LINUX_DMA_NONCOHERENT_H
+#define _LINUX_DMA_NONCOHERENT_H 1
+
+#include <linux/dma-mapping.h>
+
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs);
+void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
+		dma_addr_t dma_addr, unsigned long attrs);
+
+#ifdef CONFIG_DMA_NONCOHERENT_MMAP
+int arch_dma_mmap(struct device *dev, struct vm_area_struct *vma,
+		void *cpu_addr, dma_addr_t dma_addr, size_t size,
+		unsigned long attrs);
+#else
+#define arch_dma_mmap NULL
+#endif /* CONFIG_DMA_NONCOHERENT_MMAP */
+
+#ifdef CONFIG_DMA_NONCOHERENT_CACHE_SYNC
+void arch_dma_cache_sync(struct device *dev, void *vaddr, size_t size,
+		enum dma_data_direction direction);
+#else
+#define arch_dma_cache_sync NULL
+#endif /* CONFIG_DMA_NONCOHERENT_CACHE_SYNC */
+
+#ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_DEVICE
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir);
+#else
+static inline void arch_sync_dma_for_device(struct device *dev,
+		phys_addr_t paddr, size_t size, enum dma_data_direction dir)
+{
+}
+#endif /* ARCH_HAS_SYNC_DMA_FOR_DEVICE */
+
+#ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir);
+#else
+static inline void arch_sync_dma_for_cpu(struct device *dev,
+		phys_addr_t paddr, size_t size, enum dma_data_direction dir)
+{
+}
+#endif /* ARCH_HAS_SYNC_DMA_FOR_CPU */
+
+#endif /* _LINUX_DMA_NONCOHERENT_H */
diff --git a/lib/Kconfig b/lib/Kconfig
index 726b0562caa7..ae4bf1d8af11 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -441,10 +441,30 @@ config ARCH_DMA_ADDR_T_64BIT
 config IOMMU_HELPER
 	bool
 
+config ARCH_HAS_SYNC_DMA_FOR_DEVICE
+	bool
+
+config ARCH_HAS_SYNC_DMA_FOR_CPU
+	bool
+	select NEED_DMA_MAP_STATE
+
 config DMA_DIRECT_OPS
 	bool
 	depends on HAS_DMA
 
+config DMA_NONCOHERENT_OPS
+	bool
+	depends on HAS_DMA
+	select DMA_DIRECT_OPS
+
+config DMA_NONCOHERENT_MMAP
+	bool
+	depends on DMA_NONCOHERENT_OPS
+
+config DMA_NONCOHERENT_CACHE_SYNC
+	bool
+	depends on DMA_NONCOHERENT_OPS
+
 config DMA_VIRT_OPS
 	bool
 	depends on HAS_DMA
diff --git a/lib/Makefile b/lib/Makefile
index 94203b5eecd4..9f18c8152281 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -30,6 +30,7 @@ lib-$(CONFIG_PRINTK) += dump_stack.o
 lib-$(CONFIG_MMU) += ioremap.o
 lib-$(CONFIG_SMP) += cpumask.o
 lib-$(CONFIG_DMA_DIRECT_OPS) += dma-direct.o
+lib-$(CONFIG_DMA_NONCOHERENT_OPS) += dma-noncoherent.o
 lib-$(CONFIG_DMA_VIRT_OPS) += dma-virt.o
 
 lib-y	+= kobject.o klist.o
diff --git a/lib/dma-direct.c b/lib/dma-direct.c
index 199ae4cdd28f..9abb93541dfe 100644
--- a/lib/dma-direct.c
+++ b/lib/dma-direct.c
@@ -120,7 +120,7 @@ void dma_direct_free(struct device *dev, size_t size, void *cpu_addr,
 		free_pages((unsigned long)cpu_addr, page_order);
 }
 
-static dma_addr_t dma_direct_map_page(struct device *dev, struct page *page,
+dma_addr_t dma_direct_map_page(struct device *dev, struct page *page,
 		unsigned long offset, size_t size, enum dma_data_direction dir,
 		unsigned long attrs)
 {
@@ -131,8 +131,8 @@ static dma_addr_t dma_direct_map_page(struct device *dev, struct page *page,
 	return dma_addr;
 }
 
-static int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl,
-		int nents, enum dma_data_direction dir, unsigned long attrs)
+int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl, int nents,
+		enum dma_data_direction dir, unsigned long attrs)
 {
 	int i;
 	struct scatterlist *sg;
@@ -167,7 +167,7 @@ int dma_direct_supported(struct device *dev, u64 mask)
 	return 1;
 }
 
-static int dma_direct_mapping_error(struct device *dev, dma_addr_t dma_addr)
+int dma_direct_mapping_error(struct device *dev, dma_addr_t dma_addr)
 {
 	return dma_addr = DIRECT_MAPPING_ERROR;
 }
diff --git a/lib/dma-noncoherent.c b/lib/dma-noncoherent.c
new file mode 100644
index 000000000000..f4b8532c20ac
--- /dev/null
+++ b/lib/dma-noncoherent.c
@@ -0,0 +1,101 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2018 Christoph Hellwig.
+ *
+ * DMA operations that map physical memory directly without providing cache
+ * coherence.
+ */
+#include <linux/export.h>
+#include <linux/mm.h>
+#include <linux/dma-direct.h>
+#include <linux/dma-noncoherent.h>
+#include <linux/scatterlist.h>
+
+static void dma_noncoherent_sync_single_for_device(struct device *dev,
+		dma_addr_t addr, size_t size, enum dma_data_direction dir)
+{
+	arch_sync_dma_for_device(dev, dma_to_phys(dev, addr), size, dir);
+}
+
+static void dma_noncoherent_sync_sg_for_device(struct device *dev,
+		struct scatterlist *sgl, int nents, enum dma_data_direction dir)
+{
+	struct scatterlist *sg;
+	int i;
+
+	for_each_sg(sgl, sg, nents, i)
+		arch_sync_dma_for_device(dev, sg_phys(sg), sg->length, dir);
+}
+
+static dma_addr_t dma_noncoherent_map_page(struct device *dev, struct page *page,
+		unsigned long offset, size_t size, enum dma_data_direction dir,
+		unsigned long attrs)
+{
+	dma_addr_t addr;
+
+	addr = dma_direct_map_page(dev, page, offset, size, dir, attrs);
+	if (!dma_mapping_error(dev, addr) && !(attrs & DMA_ATTR_SKIP_CPU_SYNC))
+		arch_sync_dma_for_device(dev, page_to_phys(page), size, dir);
+	return addr;
+}
+
+static int dma_noncoherent_map_sg(struct device *dev, struct scatterlist *sgl,
+		int nents, enum dma_data_direction dir, unsigned long attrs)
+{
+	nents = dma_direct_map_sg(dev, sgl, nents, dir, attrs);
+	if (nents > 0 && !(attrs & DMA_ATTR_SKIP_CPU_SYNC))
+		dma_noncoherent_sync_sg_for_device(dev, sgl, nents, dir);
+	return nents;
+}
+
+#ifdef CONFIG_DMA_NONCOHERENT_SYNC_FOR_CPU
+static void dma_noncoherent_sync_single_for_cpu(struct device *dev,
+		dma_addr_t addr, size_t size, enum dma_data_direction dir)
+{
+	arch_sync_dma_for_cpu(dev, dma_to_phys(dev, addr), size, dir);
+}
+
+static void dma_noncoherent_sync_sg_for_cpu(struct device *dev,
+		struct scatterlist *sgl, int nents, enum dma_data_direction dir)
+{
+	struct scatterlist *sg;
+	int i;
+
+	for_each_sg(sgl, sg, nents, i)
+		arch_sync_dma_for_cpu(dev, sg_phys(sg), sg->length, dir);
+}
+
+static void dma_noncoherent_unmap_page(struct device *dev, dma_addr_t addr,
+		size_t size, enum dma_data_direction dir, unsigned long attrs)
+{
+	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
+		dma_noncoherent_sync_single_for_cpu(dev, addr, size, dir);
+}
+
+static void dma_noncoherent_unmap_sg(struct device *dev, struct scatterlist *sgl,
+		int nents, enum dma_data_direction dir, unsigned long attrs)
+{
+	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
+		dma_noncoherent_sync_sg_for_cpu(dev, sgl, nents, dir);
+}
+#endif
+
+const struct dma_map_ops dma_noncoherent_ops = {
+	.alloc			= arch_dma_alloc,
+	.free			= arch_dma_free,
+	.mmap			= arch_dma_mmap,
+	.sync_single_for_device	= dma_noncoherent_sync_single_for_device,
+	.sync_sg_for_device	= dma_noncoherent_sync_sg_for_device,
+	.map_page		= dma_noncoherent_map_page,
+	.map_sg			= dma_noncoherent_map_sg,
+#ifdef CONFIG_DMA_NONCOHERENT_SYNC_FOR_CPU
+	.sync_single_for_cpu	= dma_noncoherent_sync_single_for_cpu,
+	.sync_sg_for_cpu	= dma_noncoherent_sync_sg_for_cpu,
+	.unmap_page		= dma_noncoherent_unmap_page,
+	.unmap_sg		= dma_noncoherent_unmap_sg,
+#endif
+	.dma_supported		= dma_direct_supported,
+	.mapping_error		= dma_direct_mapping_error,
+	.cache_sync		= arch_dma_cache_sync,
+};
+EXPORT_SYMBOL(dma_noncoherent_ops);
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [OpenRISC] [PATCH 03/22] dma-mapping: provide a generic dma-noncoherent implementation
@ 2018-04-20  8:02   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:02 UTC (permalink / raw)
  To: openrisc

Add a new dma_map_ops implementation that uses dma-direct for the
address mapping of streaming mappings, and which requires arch-specific
implemenations of coherent allocate/free.

Architectures have to provide flushing helpers to ownership trasnfers
to the device and/or CPU, and can provide optional implementations of
the coherent mmap functionality, and the cache_flush routines for
non-coherent long term allocations.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 MAINTAINERS                       |   2 +
 include/asm-generic/dma-mapping.h |   9 +++
 include/linux/dma-direct.h        |   7 ++-
 include/linux/dma-mapping.h       |   1 +
 include/linux/dma-noncoherent.h   |  47 ++++++++++++++
 lib/Kconfig                       |  20 ++++++
 lib/Makefile                      |   1 +
 lib/dma-direct.c                  |   8 +--
 lib/dma-noncoherent.c             | 101 ++++++++++++++++++++++++++++++
 9 files changed, 191 insertions(+), 5 deletions(-)
 create mode 100644 include/linux/dma-noncoherent.h
 create mode 100644 lib/dma-noncoherent.c

diff --git a/MAINTAINERS b/MAINTAINERS
index b60179d948bb..bbaf5459d297 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4327,12 +4327,14 @@ W:	http://git.infradead.org/users/hch/dma-mapping.git
 S:	Supported
 F:	lib/dma-debug.c
 F:	lib/dma-direct.c
+F:	lib/dma-noncoherent.c
 F:	lib/dma-virt.c
 F:	drivers/base/dma-mapping.c
 F:	drivers/base/dma-coherent.c
 F:	include/asm-generic/dma-mapping.h
 F:	include/linux/dma-direct.h
 F:	include/linux/dma-mapping.h
+F:	include/linux/dma-noncoherent.h
 
 DME1737 HARDWARE MONITOR DRIVER
 M:	Juerg Haefliger <juergh@gmail.com>
diff --git a/include/asm-generic/dma-mapping.h b/include/asm-generic/dma-mapping.h
index 880a292d792f..ad2868263867 100644
--- a/include/asm-generic/dma-mapping.h
+++ b/include/asm-generic/dma-mapping.h
@@ -4,7 +4,16 @@
 
 static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
 {
+	/*
+	 * Use the non-coherent ops if available.  If an architecture wants a
+	 * more fine-grained selection of operations it will have to implement
+	 * get_arch_dma_ops itself or use the per-device dma_ops.
+	 */
+#ifdef CONFIG_DMA_NONCOHERENT_OPS
+	return &dma_noncoherent_ops;
+#else
 	return &dma_direct_ops;
+#endif
 }
 
 #endif /* _ASM_GENERIC_DMA_MAPPING_H */
diff --git a/include/linux/dma-direct.h b/include/linux/dma-direct.h
index 53ad6a47f513..8d9f33febde5 100644
--- a/include/linux/dma-direct.h
+++ b/include/linux/dma-direct.h
@@ -59,6 +59,11 @@ void *dma_direct_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
 		gfp_t gfp, unsigned long attrs);
 void dma_direct_free(struct device *dev, size_t size, void *cpu_addr,
 		dma_addr_t dma_addr, unsigned long attrs);
+dma_addr_t dma_direct_map_page(struct device *dev, struct page *page,
+		unsigned long offset, size_t size, enum dma_data_direction dir,
+		unsigned long attrs);
+int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl, int nents,
+		enum dma_data_direction dir, unsigned long attrs);
 int dma_direct_supported(struct device *dev, u64 mask);
-
+int dma_direct_mapping_error(struct device *dev, dma_addr_t dma_addr);
 #endif /* _LINUX_DMA_DIRECT_H */
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 25a9a2b04f78..4be070df5fc5 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -136,6 +136,7 @@ struct dma_map_ops {
 };
 
 extern const struct dma_map_ops dma_direct_ops;
+extern const struct dma_map_ops dma_noncoherent_ops;
 extern const struct dma_map_ops dma_virt_ops;
 
 #define DMA_BIT_MASK(n)	(((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
diff --git a/include/linux/dma-noncoherent.h b/include/linux/dma-noncoherent.h
new file mode 100644
index 000000000000..10b2654d549b
--- /dev/null
+++ b/include/linux/dma-noncoherent.h
@@ -0,0 +1,47 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _LINUX_DMA_NONCOHERENT_H
+#define _LINUX_DMA_NONCOHERENT_H 1
+
+#include <linux/dma-mapping.h>
+
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs);
+void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
+		dma_addr_t dma_addr, unsigned long attrs);
+
+#ifdef CONFIG_DMA_NONCOHERENT_MMAP
+int arch_dma_mmap(struct device *dev, struct vm_area_struct *vma,
+		void *cpu_addr, dma_addr_t dma_addr, size_t size,
+		unsigned long attrs);
+#else
+#define arch_dma_mmap NULL
+#endif /* CONFIG_DMA_NONCOHERENT_MMAP */
+
+#ifdef CONFIG_DMA_NONCOHERENT_CACHE_SYNC
+void arch_dma_cache_sync(struct device *dev, void *vaddr, size_t size,
+		enum dma_data_direction direction);
+#else
+#define arch_dma_cache_sync NULL
+#endif /* CONFIG_DMA_NONCOHERENT_CACHE_SYNC */
+
+#ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_DEVICE
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir);
+#else
+static inline void arch_sync_dma_for_device(struct device *dev,
+		phys_addr_t paddr, size_t size, enum dma_data_direction dir)
+{
+}
+#endif /* ARCH_HAS_SYNC_DMA_FOR_DEVICE */
+
+#ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir);
+#else
+static inline void arch_sync_dma_for_cpu(struct device *dev,
+		phys_addr_t paddr, size_t size, enum dma_data_direction dir)
+{
+}
+#endif /* ARCH_HAS_SYNC_DMA_FOR_CPU */
+
+#endif /* _LINUX_DMA_NONCOHERENT_H */
diff --git a/lib/Kconfig b/lib/Kconfig
index 726b0562caa7..ae4bf1d8af11 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -441,10 +441,30 @@ config ARCH_DMA_ADDR_T_64BIT
 config IOMMU_HELPER
 	bool
 
+config ARCH_HAS_SYNC_DMA_FOR_DEVICE
+	bool
+
+config ARCH_HAS_SYNC_DMA_FOR_CPU
+	bool
+	select NEED_DMA_MAP_STATE
+
 config DMA_DIRECT_OPS
 	bool
 	depends on HAS_DMA
 
+config DMA_NONCOHERENT_OPS
+	bool
+	depends on HAS_DMA
+	select DMA_DIRECT_OPS
+
+config DMA_NONCOHERENT_MMAP
+	bool
+	depends on DMA_NONCOHERENT_OPS
+
+config DMA_NONCOHERENT_CACHE_SYNC
+	bool
+	depends on DMA_NONCOHERENT_OPS
+
 config DMA_VIRT_OPS
 	bool
 	depends on HAS_DMA
diff --git a/lib/Makefile b/lib/Makefile
index 94203b5eecd4..9f18c8152281 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -30,6 +30,7 @@ lib-$(CONFIG_PRINTK) += dump_stack.o
 lib-$(CONFIG_MMU) += ioremap.o
 lib-$(CONFIG_SMP) += cpumask.o
 lib-$(CONFIG_DMA_DIRECT_OPS) += dma-direct.o
+lib-$(CONFIG_DMA_NONCOHERENT_OPS) += dma-noncoherent.o
 lib-$(CONFIG_DMA_VIRT_OPS) += dma-virt.o
 
 lib-y	+= kobject.o klist.o
diff --git a/lib/dma-direct.c b/lib/dma-direct.c
index 199ae4cdd28f..9abb93541dfe 100644
--- a/lib/dma-direct.c
+++ b/lib/dma-direct.c
@@ -120,7 +120,7 @@ void dma_direct_free(struct device *dev, size_t size, void *cpu_addr,
 		free_pages((unsigned long)cpu_addr, page_order);
 }
 
-static dma_addr_t dma_direct_map_page(struct device *dev, struct page *page,
+dma_addr_t dma_direct_map_page(struct device *dev, struct page *page,
 		unsigned long offset, size_t size, enum dma_data_direction dir,
 		unsigned long attrs)
 {
@@ -131,8 +131,8 @@ static dma_addr_t dma_direct_map_page(struct device *dev, struct page *page,
 	return dma_addr;
 }
 
-static int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl,
-		int nents, enum dma_data_direction dir, unsigned long attrs)
+int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl, int nents,
+		enum dma_data_direction dir, unsigned long attrs)
 {
 	int i;
 	struct scatterlist *sg;
@@ -167,7 +167,7 @@ int dma_direct_supported(struct device *dev, u64 mask)
 	return 1;
 }
 
-static int dma_direct_mapping_error(struct device *dev, dma_addr_t dma_addr)
+int dma_direct_mapping_error(struct device *dev, dma_addr_t dma_addr)
 {
 	return dma_addr == DIRECT_MAPPING_ERROR;
 }
diff --git a/lib/dma-noncoherent.c b/lib/dma-noncoherent.c
new file mode 100644
index 000000000000..f4b8532c20ac
--- /dev/null
+++ b/lib/dma-noncoherent.c
@@ -0,0 +1,101 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2018 Christoph Hellwig.
+ *
+ * DMA operations that map physical memory directly without providing cache
+ * coherence.
+ */
+#include <linux/export.h>
+#include <linux/mm.h>
+#include <linux/dma-direct.h>
+#include <linux/dma-noncoherent.h>
+#include <linux/scatterlist.h>
+
+static void dma_noncoherent_sync_single_for_device(struct device *dev,
+		dma_addr_t addr, size_t size, enum dma_data_direction dir)
+{
+	arch_sync_dma_for_device(dev, dma_to_phys(dev, addr), size, dir);
+}
+
+static void dma_noncoherent_sync_sg_for_device(struct device *dev,
+		struct scatterlist *sgl, int nents, enum dma_data_direction dir)
+{
+	struct scatterlist *sg;
+	int i;
+
+	for_each_sg(sgl, sg, nents, i)
+		arch_sync_dma_for_device(dev, sg_phys(sg), sg->length, dir);
+}
+
+static dma_addr_t dma_noncoherent_map_page(struct device *dev, struct page *page,
+		unsigned long offset, size_t size, enum dma_data_direction dir,
+		unsigned long attrs)
+{
+	dma_addr_t addr;
+
+	addr = dma_direct_map_page(dev, page, offset, size, dir, attrs);
+	if (!dma_mapping_error(dev, addr) && !(attrs & DMA_ATTR_SKIP_CPU_SYNC))
+		arch_sync_dma_for_device(dev, page_to_phys(page), size, dir);
+	return addr;
+}
+
+static int dma_noncoherent_map_sg(struct device *dev, struct scatterlist *sgl,
+		int nents, enum dma_data_direction dir, unsigned long attrs)
+{
+	nents = dma_direct_map_sg(dev, sgl, nents, dir, attrs);
+	if (nents > 0 && !(attrs & DMA_ATTR_SKIP_CPU_SYNC))
+		dma_noncoherent_sync_sg_for_device(dev, sgl, nents, dir);
+	return nents;
+}
+
+#ifdef CONFIG_DMA_NONCOHERENT_SYNC_FOR_CPU
+static void dma_noncoherent_sync_single_for_cpu(struct device *dev,
+		dma_addr_t addr, size_t size, enum dma_data_direction dir)
+{
+	arch_sync_dma_for_cpu(dev, dma_to_phys(dev, addr), size, dir);
+}
+
+static void dma_noncoherent_sync_sg_for_cpu(struct device *dev,
+		struct scatterlist *sgl, int nents, enum dma_data_direction dir)
+{
+	struct scatterlist *sg;
+	int i;
+
+	for_each_sg(sgl, sg, nents, i)
+		arch_sync_dma_for_cpu(dev, sg_phys(sg), sg->length, dir);
+}
+
+static void dma_noncoherent_unmap_page(struct device *dev, dma_addr_t addr,
+		size_t size, enum dma_data_direction dir, unsigned long attrs)
+{
+	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
+		dma_noncoherent_sync_single_for_cpu(dev, addr, size, dir);
+}
+
+static void dma_noncoherent_unmap_sg(struct device *dev, struct scatterlist *sgl,
+		int nents, enum dma_data_direction dir, unsigned long attrs)
+{
+	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
+		dma_noncoherent_sync_sg_for_cpu(dev, sgl, nents, dir);
+}
+#endif
+
+const struct dma_map_ops dma_noncoherent_ops = {
+	.alloc			= arch_dma_alloc,
+	.free			= arch_dma_free,
+	.mmap			= arch_dma_mmap,
+	.sync_single_for_device	= dma_noncoherent_sync_single_for_device,
+	.sync_sg_for_device	= dma_noncoherent_sync_sg_for_device,
+	.map_page		= dma_noncoherent_map_page,
+	.map_sg			= dma_noncoherent_map_sg,
+#ifdef CONFIG_DMA_NONCOHERENT_SYNC_FOR_CPU
+	.sync_single_for_cpu	= dma_noncoherent_sync_single_for_cpu,
+	.sync_sg_for_cpu	= dma_noncoherent_sync_sg_for_cpu,
+	.unmap_page		= dma_noncoherent_unmap_page,
+	.unmap_sg		= dma_noncoherent_unmap_sg,
+#endif
+	.dma_supported		= dma_direct_supported,
+	.mapping_error		= dma_direct_mapping_error,
+	.cache_sync		= arch_dma_cache_sync,
+};
+EXPORT_SYMBOL(dma_noncoherent_ops);
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 03/22] dma-mapping: provide a generic dma-noncoherent implementation
@ 2018-04-20  8:02   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:02 UTC (permalink / raw)
  To: linux-arm-kernel

Add a new dma_map_ops implementation that uses dma-direct for the
address mapping of streaming mappings, and which requires arch-specific
implemenations of coherent allocate/free.

Architectures have to provide flushing helpers to ownership trasnfers
to the device and/or CPU, and can provide optional implementations of
the coherent mmap functionality, and the cache_flush routines for
non-coherent long term allocations.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 MAINTAINERS                       |   2 +
 include/asm-generic/dma-mapping.h |   9 +++
 include/linux/dma-direct.h        |   7 ++-
 include/linux/dma-mapping.h       |   1 +
 include/linux/dma-noncoherent.h   |  47 ++++++++++++++
 lib/Kconfig                       |  20 ++++++
 lib/Makefile                      |   1 +
 lib/dma-direct.c                  |   8 +--
 lib/dma-noncoherent.c             | 101 ++++++++++++++++++++++++++++++
 9 files changed, 191 insertions(+), 5 deletions(-)
 create mode 100644 include/linux/dma-noncoherent.h
 create mode 100644 lib/dma-noncoherent.c

diff --git a/MAINTAINERS b/MAINTAINERS
index b60179d948bb..bbaf5459d297 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4327,12 +4327,14 @@ W:	http://git.infradead.org/users/hch/dma-mapping.git
 S:	Supported
 F:	lib/dma-debug.c
 F:	lib/dma-direct.c
+F:	lib/dma-noncoherent.c
 F:	lib/dma-virt.c
 F:	drivers/base/dma-mapping.c
 F:	drivers/base/dma-coherent.c
 F:	include/asm-generic/dma-mapping.h
 F:	include/linux/dma-direct.h
 F:	include/linux/dma-mapping.h
+F:	include/linux/dma-noncoherent.h
 
 DME1737 HARDWARE MONITOR DRIVER
 M:	Juerg Haefliger <juergh@gmail.com>
diff --git a/include/asm-generic/dma-mapping.h b/include/asm-generic/dma-mapping.h
index 880a292d792f..ad2868263867 100644
--- a/include/asm-generic/dma-mapping.h
+++ b/include/asm-generic/dma-mapping.h
@@ -4,7 +4,16 @@
 
 static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
 {
+	/*
+	 * Use the non-coherent ops if available.  If an architecture wants a
+	 * more fine-grained selection of operations it will have to implement
+	 * get_arch_dma_ops itself or use the per-device dma_ops.
+	 */
+#ifdef CONFIG_DMA_NONCOHERENT_OPS
+	return &dma_noncoherent_ops;
+#else
 	return &dma_direct_ops;
+#endif
 }
 
 #endif /* _ASM_GENERIC_DMA_MAPPING_H */
diff --git a/include/linux/dma-direct.h b/include/linux/dma-direct.h
index 53ad6a47f513..8d9f33febde5 100644
--- a/include/linux/dma-direct.h
+++ b/include/linux/dma-direct.h
@@ -59,6 +59,11 @@ void *dma_direct_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
 		gfp_t gfp, unsigned long attrs);
 void dma_direct_free(struct device *dev, size_t size, void *cpu_addr,
 		dma_addr_t dma_addr, unsigned long attrs);
+dma_addr_t dma_direct_map_page(struct device *dev, struct page *page,
+		unsigned long offset, size_t size, enum dma_data_direction dir,
+		unsigned long attrs);
+int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl, int nents,
+		enum dma_data_direction dir, unsigned long attrs);
 int dma_direct_supported(struct device *dev, u64 mask);
-
+int dma_direct_mapping_error(struct device *dev, dma_addr_t dma_addr);
 #endif /* _LINUX_DMA_DIRECT_H */
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index 25a9a2b04f78..4be070df5fc5 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -136,6 +136,7 @@ struct dma_map_ops {
 };
 
 extern const struct dma_map_ops dma_direct_ops;
+extern const struct dma_map_ops dma_noncoherent_ops;
 extern const struct dma_map_ops dma_virt_ops;
 
 #define DMA_BIT_MASK(n)	(((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
diff --git a/include/linux/dma-noncoherent.h b/include/linux/dma-noncoherent.h
new file mode 100644
index 000000000000..10b2654d549b
--- /dev/null
+++ b/include/linux/dma-noncoherent.h
@@ -0,0 +1,47 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef _LINUX_DMA_NONCOHERENT_H
+#define _LINUX_DMA_NONCOHERENT_H 1
+
+#include <linux/dma-mapping.h>
+
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs);
+void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
+		dma_addr_t dma_addr, unsigned long attrs);
+
+#ifdef CONFIG_DMA_NONCOHERENT_MMAP
+int arch_dma_mmap(struct device *dev, struct vm_area_struct *vma,
+		void *cpu_addr, dma_addr_t dma_addr, size_t size,
+		unsigned long attrs);
+#else
+#define arch_dma_mmap NULL
+#endif /* CONFIG_DMA_NONCOHERENT_MMAP */
+
+#ifdef CONFIG_DMA_NONCOHERENT_CACHE_SYNC
+void arch_dma_cache_sync(struct device *dev, void *vaddr, size_t size,
+		enum dma_data_direction direction);
+#else
+#define arch_dma_cache_sync NULL
+#endif /* CONFIG_DMA_NONCOHERENT_CACHE_SYNC */
+
+#ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_DEVICE
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir);
+#else
+static inline void arch_sync_dma_for_device(struct device *dev,
+		phys_addr_t paddr, size_t size, enum dma_data_direction dir)
+{
+}
+#endif /* ARCH_HAS_SYNC_DMA_FOR_DEVICE */
+
+#ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir);
+#else
+static inline void arch_sync_dma_for_cpu(struct device *dev,
+		phys_addr_t paddr, size_t size, enum dma_data_direction dir)
+{
+}
+#endif /* ARCH_HAS_SYNC_DMA_FOR_CPU */
+
+#endif /* _LINUX_DMA_NONCOHERENT_H */
diff --git a/lib/Kconfig b/lib/Kconfig
index 726b0562caa7..ae4bf1d8af11 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -441,10 +441,30 @@ config ARCH_DMA_ADDR_T_64BIT
 config IOMMU_HELPER
 	bool
 
+config ARCH_HAS_SYNC_DMA_FOR_DEVICE
+	bool
+
+config ARCH_HAS_SYNC_DMA_FOR_CPU
+	bool
+	select NEED_DMA_MAP_STATE
+
 config DMA_DIRECT_OPS
 	bool
 	depends on HAS_DMA
 
+config DMA_NONCOHERENT_OPS
+	bool
+	depends on HAS_DMA
+	select DMA_DIRECT_OPS
+
+config DMA_NONCOHERENT_MMAP
+	bool
+	depends on DMA_NONCOHERENT_OPS
+
+config DMA_NONCOHERENT_CACHE_SYNC
+	bool
+	depends on DMA_NONCOHERENT_OPS
+
 config DMA_VIRT_OPS
 	bool
 	depends on HAS_DMA
diff --git a/lib/Makefile b/lib/Makefile
index 94203b5eecd4..9f18c8152281 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -30,6 +30,7 @@ lib-$(CONFIG_PRINTK) += dump_stack.o
 lib-$(CONFIG_MMU) += ioremap.o
 lib-$(CONFIG_SMP) += cpumask.o
 lib-$(CONFIG_DMA_DIRECT_OPS) += dma-direct.o
+lib-$(CONFIG_DMA_NONCOHERENT_OPS) += dma-noncoherent.o
 lib-$(CONFIG_DMA_VIRT_OPS) += dma-virt.o
 
 lib-y	+= kobject.o klist.o
diff --git a/lib/dma-direct.c b/lib/dma-direct.c
index 199ae4cdd28f..9abb93541dfe 100644
--- a/lib/dma-direct.c
+++ b/lib/dma-direct.c
@@ -120,7 +120,7 @@ void dma_direct_free(struct device *dev, size_t size, void *cpu_addr,
 		free_pages((unsigned long)cpu_addr, page_order);
 }
 
-static dma_addr_t dma_direct_map_page(struct device *dev, struct page *page,
+dma_addr_t dma_direct_map_page(struct device *dev, struct page *page,
 		unsigned long offset, size_t size, enum dma_data_direction dir,
 		unsigned long attrs)
 {
@@ -131,8 +131,8 @@ static dma_addr_t dma_direct_map_page(struct device *dev, struct page *page,
 	return dma_addr;
 }
 
-static int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl,
-		int nents, enum dma_data_direction dir, unsigned long attrs)
+int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl, int nents,
+		enum dma_data_direction dir, unsigned long attrs)
 {
 	int i;
 	struct scatterlist *sg;
@@ -167,7 +167,7 @@ int dma_direct_supported(struct device *dev, u64 mask)
 	return 1;
 }
 
-static int dma_direct_mapping_error(struct device *dev, dma_addr_t dma_addr)
+int dma_direct_mapping_error(struct device *dev, dma_addr_t dma_addr)
 {
 	return dma_addr == DIRECT_MAPPING_ERROR;
 }
diff --git a/lib/dma-noncoherent.c b/lib/dma-noncoherent.c
new file mode 100644
index 000000000000..f4b8532c20ac
--- /dev/null
+++ b/lib/dma-noncoherent.c
@@ -0,0 +1,101 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2018 Christoph Hellwig.
+ *
+ * DMA operations that map physical memory directly without providing cache
+ * coherence.
+ */
+#include <linux/export.h>
+#include <linux/mm.h>
+#include <linux/dma-direct.h>
+#include <linux/dma-noncoherent.h>
+#include <linux/scatterlist.h>
+
+static void dma_noncoherent_sync_single_for_device(struct device *dev,
+		dma_addr_t addr, size_t size, enum dma_data_direction dir)
+{
+	arch_sync_dma_for_device(dev, dma_to_phys(dev, addr), size, dir);
+}
+
+static void dma_noncoherent_sync_sg_for_device(struct device *dev,
+		struct scatterlist *sgl, int nents, enum dma_data_direction dir)
+{
+	struct scatterlist *sg;
+	int i;
+
+	for_each_sg(sgl, sg, nents, i)
+		arch_sync_dma_for_device(dev, sg_phys(sg), sg->length, dir);
+}
+
+static dma_addr_t dma_noncoherent_map_page(struct device *dev, struct page *page,
+		unsigned long offset, size_t size, enum dma_data_direction dir,
+		unsigned long attrs)
+{
+	dma_addr_t addr;
+
+	addr = dma_direct_map_page(dev, page, offset, size, dir, attrs);
+	if (!dma_mapping_error(dev, addr) && !(attrs & DMA_ATTR_SKIP_CPU_SYNC))
+		arch_sync_dma_for_device(dev, page_to_phys(page), size, dir);
+	return addr;
+}
+
+static int dma_noncoherent_map_sg(struct device *dev, struct scatterlist *sgl,
+		int nents, enum dma_data_direction dir, unsigned long attrs)
+{
+	nents = dma_direct_map_sg(dev, sgl, nents, dir, attrs);
+	if (nents > 0 && !(attrs & DMA_ATTR_SKIP_CPU_SYNC))
+		dma_noncoherent_sync_sg_for_device(dev, sgl, nents, dir);
+	return nents;
+}
+
+#ifdef CONFIG_DMA_NONCOHERENT_SYNC_FOR_CPU
+static void dma_noncoherent_sync_single_for_cpu(struct device *dev,
+		dma_addr_t addr, size_t size, enum dma_data_direction dir)
+{
+	arch_sync_dma_for_cpu(dev, dma_to_phys(dev, addr), size, dir);
+}
+
+static void dma_noncoherent_sync_sg_for_cpu(struct device *dev,
+		struct scatterlist *sgl, int nents, enum dma_data_direction dir)
+{
+	struct scatterlist *sg;
+	int i;
+
+	for_each_sg(sgl, sg, nents, i)
+		arch_sync_dma_for_cpu(dev, sg_phys(sg), sg->length, dir);
+}
+
+static void dma_noncoherent_unmap_page(struct device *dev, dma_addr_t addr,
+		size_t size, enum dma_data_direction dir, unsigned long attrs)
+{
+	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
+		dma_noncoherent_sync_single_for_cpu(dev, addr, size, dir);
+}
+
+static void dma_noncoherent_unmap_sg(struct device *dev, struct scatterlist *sgl,
+		int nents, enum dma_data_direction dir, unsigned long attrs)
+{
+	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
+		dma_noncoherent_sync_sg_for_cpu(dev, sgl, nents, dir);
+}
+#endif
+
+const struct dma_map_ops dma_noncoherent_ops = {
+	.alloc			= arch_dma_alloc,
+	.free			= arch_dma_free,
+	.mmap			= arch_dma_mmap,
+	.sync_single_for_device	= dma_noncoherent_sync_single_for_device,
+	.sync_sg_for_device	= dma_noncoherent_sync_sg_for_device,
+	.map_page		= dma_noncoherent_map_page,
+	.map_sg			= dma_noncoherent_map_sg,
+#ifdef CONFIG_DMA_NONCOHERENT_SYNC_FOR_CPU
+	.sync_single_for_cpu	= dma_noncoherent_sync_single_for_cpu,
+	.sync_sg_for_cpu	= dma_noncoherent_sync_sg_for_cpu,
+	.unmap_page		= dma_noncoherent_unmap_page,
+	.unmap_sg		= dma_noncoherent_unmap_sg,
+#endif
+	.dma_supported		= dma_direct_supported,
+	.mapping_error		= dma_direct_mapping_error,
+	.cache_sync		= arch_dma_cache_sync,
+};
+EXPORT_SYMBOL(dma_noncoherent_ops);
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 04/22] alpha: use dma_direct_ops for jensen
@ 2018-04-20  8:02   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:02 UTC (permalink / raw)
  Cc: linux-arch, linux-xtensa, Michal Simek, Vincent Chen,
	linux-c6x-dev, linux-parisc, linux-sh, linux-hexagon,
	linux-kernel, linux-m68k, openrisc, Greentime Hu, linux-alpha,
	sparclinux, nios2-dev, linux-snps-arc, linux-arm-kernel

The generic dma_direct implementation does the same thing as the alpha
pci-noop implementation, just with more bells and whistles.  And unlike
the current code it at least has a theoretical chance to actually compile.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/alpha/Kconfig                   |  1 +
 arch/alpha/include/asm/dma-mapping.h |  4 ++++
 arch/alpha/kernel/pci-noop.c         | 33 ----------------------------
 3 files changed, 5 insertions(+), 33 deletions(-)

diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index aa7df1a36fd0..94af0c7f494a 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -204,6 +204,7 @@ config ALPHA_EIGER
 config ALPHA_JENSEN
 	bool "Jensen"
 	depends on BROKEN
+	select DMA_DIRECT_OPS
 	help
 	  DEC PC 150 AXP (aka Jensen): This is a very old Digital system - one
 	  of the first-generation Alpha systems. A number of these systems
diff --git a/arch/alpha/include/asm/dma-mapping.h b/arch/alpha/include/asm/dma-mapping.h
index b78f61f20796..76ce923ecca1 100644
--- a/arch/alpha/include/asm/dma-mapping.h
+++ b/arch/alpha/include/asm/dma-mapping.h
@@ -6,7 +6,11 @@ extern const struct dma_map_ops *dma_ops;
 
 static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
 {
+#ifdef CONFIG_ALPHA_JENSEN
+	return &dma_direct_ops;
+#else
 	return dma_ops;
+#endif
 }
 
 #endif	/* _ALPHA_DMA_MAPPING_H */
diff --git a/arch/alpha/kernel/pci-noop.c b/arch/alpha/kernel/pci-noop.c
index b6ebb65127a8..c7c5879869d3 100644
--- a/arch/alpha/kernel/pci-noop.c
+++ b/arch/alpha/kernel/pci-noop.c
@@ -102,36 +102,3 @@ SYSCALL_DEFINE5(pciconfig_write, unsigned long, bus, unsigned long, dfn,
 	else
 		return -ENODEV;
 }
-
-static void *alpha_noop_alloc_coherent(struct device *dev, size_t size,
-				       dma_addr_t *dma_handle, gfp_t gfp,
-				       unsigned long attrs)
-{
-	void *ret;
-
-	if (!dev || *dev->dma_mask >= 0xffffffffUL)
-		gfp &= ~GFP_DMA;
-	ret = (void *)__get_free_pages(gfp, get_order(size));
-	if (ret) {
-		memset(ret, 0, size);
-		*dma_handle = virt_to_phys(ret);
-	}
-	return ret;
-}
-
-static int alpha_noop_supported(struct device *dev, u64 mask)
-{
-	return mask < 0x00ffffffUL ? 0 : 1;
-}
-
-const struct dma_map_ops alpha_noop_ops = {
-	.alloc			= alpha_noop_alloc_coherent,
-	.free			= dma_noop_free_coherent,
-	.map_page		= dma_noop_map_page,
-	.map_sg			= dma_noop_map_sg,
-	.mapping_error		= dma_noop_mapping_error,
-	.dma_supported		= alpha_noop_supported,
-};
-
-const struct dma_map_ops *dma_ops = &alpha_noop_ops;
-EXPORT_SYMBOL(dma_ops);
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 04/22] alpha: use dma_direct_ops for jensen
@ 2018-04-20  8:02   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:02 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

The generic dma_direct implementation does the same thing as the alpha
pci-noop implementation, just with more bells and whistles.  And unlike
the current code it at least has a theoretical chance to actually compile.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/alpha/Kconfig                   |  1 +
 arch/alpha/include/asm/dma-mapping.h |  4 ++++
 arch/alpha/kernel/pci-noop.c         | 33 ----------------------------
 3 files changed, 5 insertions(+), 33 deletions(-)

diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index aa7df1a36fd0..94af0c7f494a 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -204,6 +204,7 @@ config ALPHA_EIGER
 config ALPHA_JENSEN
 	bool "Jensen"
 	depends on BROKEN
+	select DMA_DIRECT_OPS
 	help
 	  DEC PC 150 AXP (aka Jensen): This is a very old Digital system - one
 	  of the first-generation Alpha systems. A number of these systems
diff --git a/arch/alpha/include/asm/dma-mapping.h b/arch/alpha/include/asm/dma-mapping.h
index b78f61f20796..76ce923ecca1 100644
--- a/arch/alpha/include/asm/dma-mapping.h
+++ b/arch/alpha/include/asm/dma-mapping.h
@@ -6,7 +6,11 @@ extern const struct dma_map_ops *dma_ops;
 
 static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
 {
+#ifdef CONFIG_ALPHA_JENSEN
+	return &dma_direct_ops;
+#else
 	return dma_ops;
+#endif
 }
 
 #endif	/* _ALPHA_DMA_MAPPING_H */
diff --git a/arch/alpha/kernel/pci-noop.c b/arch/alpha/kernel/pci-noop.c
index b6ebb65127a8..c7c5879869d3 100644
--- a/arch/alpha/kernel/pci-noop.c
+++ b/arch/alpha/kernel/pci-noop.c
@@ -102,36 +102,3 @@ SYSCALL_DEFINE5(pciconfig_write, unsigned long, bus, unsigned long, dfn,
 	else
 		return -ENODEV;
 }
-
-static void *alpha_noop_alloc_coherent(struct device *dev, size_t size,
-				       dma_addr_t *dma_handle, gfp_t gfp,
-				       unsigned long attrs)
-{
-	void *ret;
-
-	if (!dev || *dev->dma_mask >= 0xffffffffUL)
-		gfp &= ~GFP_DMA;
-	ret = (void *)__get_free_pages(gfp, get_order(size));
-	if (ret) {
-		memset(ret, 0, size);
-		*dma_handle = virt_to_phys(ret);
-	}
-	return ret;
-}
-
-static int alpha_noop_supported(struct device *dev, u64 mask)
-{
-	return mask < 0x00ffffffUL ? 0 : 1;
-}
-
-const struct dma_map_ops alpha_noop_ops = {
-	.alloc			= alpha_noop_alloc_coherent,
-	.free			= dma_noop_free_coherent,
-	.map_page		= dma_noop_map_page,
-	.map_sg			= dma_noop_map_sg,
-	.mapping_error		= dma_noop_mapping_error,
-	.dma_supported		= alpha_noop_supported,
-};
-
-const struct dma_map_ops *dma_ops = &alpha_noop_ops;
-EXPORT_SYMBOL(dma_ops);
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 04/22] alpha: use dma_direct_ops for jensen
@ 2018-04-20  8:02   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:02 UTC (permalink / raw)
  To: linux-snps-arc

The generic dma_direct implementation does the same thing as the alpha
pci-noop implementation, just with more bells and whistles.  And unlike
the current code it at least has a theoretical chance to actually compile.

Signed-off-by: Christoph Hellwig <hch at lst.de>
---
 arch/alpha/Kconfig                   |  1 +
 arch/alpha/include/asm/dma-mapping.h |  4 ++++
 arch/alpha/kernel/pci-noop.c         | 33 ----------------------------
 3 files changed, 5 insertions(+), 33 deletions(-)

diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index aa7df1a36fd0..94af0c7f494a 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -204,6 +204,7 @@ config ALPHA_EIGER
 config ALPHA_JENSEN
 	bool "Jensen"
 	depends on BROKEN
+	select DMA_DIRECT_OPS
 	help
 	  DEC PC 150 AXP (aka Jensen): This is a very old Digital system - one
 	  of the first-generation Alpha systems. A number of these systems
diff --git a/arch/alpha/include/asm/dma-mapping.h b/arch/alpha/include/asm/dma-mapping.h
index b78f61f20796..76ce923ecca1 100644
--- a/arch/alpha/include/asm/dma-mapping.h
+++ b/arch/alpha/include/asm/dma-mapping.h
@@ -6,7 +6,11 @@ extern const struct dma_map_ops *dma_ops;
 
 static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
 {
+#ifdef CONFIG_ALPHA_JENSEN
+	return &dma_direct_ops;
+#else
 	return dma_ops;
+#endif
 }
 
 #endif	/* _ALPHA_DMA_MAPPING_H */
diff --git a/arch/alpha/kernel/pci-noop.c b/arch/alpha/kernel/pci-noop.c
index b6ebb65127a8..c7c5879869d3 100644
--- a/arch/alpha/kernel/pci-noop.c
+++ b/arch/alpha/kernel/pci-noop.c
@@ -102,36 +102,3 @@ SYSCALL_DEFINE5(pciconfig_write, unsigned long, bus, unsigned long, dfn,
 	else
 		return -ENODEV;
 }
-
-static void *alpha_noop_alloc_coherent(struct device *dev, size_t size,
-				       dma_addr_t *dma_handle, gfp_t gfp,
-				       unsigned long attrs)
-{
-	void *ret;
-
-	if (!dev || *dev->dma_mask >= 0xffffffffUL)
-		gfp &= ~GFP_DMA;
-	ret = (void *)__get_free_pages(gfp, get_order(size));
-	if (ret) {
-		memset(ret, 0, size);
-		*dma_handle = virt_to_phys(ret);
-	}
-	return ret;
-}
-
-static int alpha_noop_supported(struct device *dev, u64 mask)
-{
-	return mask < 0x00ffffffUL ? 0 : 1;
-}
-
-const struct dma_map_ops alpha_noop_ops = {
-	.alloc			= alpha_noop_alloc_coherent,
-	.free			= dma_noop_free_coherent,
-	.map_page		= dma_noop_map_page,
-	.map_sg			= dma_noop_map_sg,
-	.mapping_error		= dma_noop_mapping_error,
-	.dma_supported		= alpha_noop_supported,
-};
-
-const struct dma_map_ops *dma_ops = &alpha_noop_ops;
-EXPORT_SYMBOL(dma_ops);
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 04/22] alpha: use dma_direct_ops for jensen
@ 2018-04-20  8:02   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:02 UTC (permalink / raw)
  Cc: linux-arch, linux-xtensa, Michal Simek, Vincent Chen,
	linux-c6x-dev, linux-parisc, linux-sh, linux-hexagon,
	linux-kernel, linux-m68k, openrisc, Greentime Hu, linux-alpha,
	sparclinux, nios2-dev, linux-snps-arc, linux-arm-kernel

The generic dma_direct implementation does the same thing as the alpha
pci-noop implementation, just with more bells and whistles.  And unlike
the current code it at least has a theoretical chance to actually compile.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/alpha/Kconfig                   |  1 +
 arch/alpha/include/asm/dma-mapping.h |  4 ++++
 arch/alpha/kernel/pci-noop.c         | 33 ----------------------------
 3 files changed, 5 insertions(+), 33 deletions(-)

diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index aa7df1a36fd0..94af0c7f494a 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -204,6 +204,7 @@ config ALPHA_EIGER
 config ALPHA_JENSEN
 	bool "Jensen"
 	depends on BROKEN
+	select DMA_DIRECT_OPS
 	help
 	  DEC PC 150 AXP (aka Jensen): This is a very old Digital system - one
 	  of the first-generation Alpha systems. A number of these systems
diff --git a/arch/alpha/include/asm/dma-mapping.h b/arch/alpha/include/asm/dma-mapping.h
index b78f61f20796..76ce923ecca1 100644
--- a/arch/alpha/include/asm/dma-mapping.h
+++ b/arch/alpha/include/asm/dma-mapping.h
@@ -6,7 +6,11 @@ extern const struct dma_map_ops *dma_ops;
 
 static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
 {
+#ifdef CONFIG_ALPHA_JENSEN
+	return &dma_direct_ops;
+#else
 	return dma_ops;
+#endif
 }
 
 #endif	/* _ALPHA_DMA_MAPPING_H */
diff --git a/arch/alpha/kernel/pci-noop.c b/arch/alpha/kernel/pci-noop.c
index b6ebb65127a8..c7c5879869d3 100644
--- a/arch/alpha/kernel/pci-noop.c
+++ b/arch/alpha/kernel/pci-noop.c
@@ -102,36 +102,3 @@ SYSCALL_DEFINE5(pciconfig_write, unsigned long, bus, unsigned long, dfn,
 	else
 		return -ENODEV;
 }
-
-static void *alpha_noop_alloc_coherent(struct device *dev, size_t size,
-				       dma_addr_t *dma_handle, gfp_t gfp,
-				       unsigned long attrs)
-{
-	void *ret;
-
-	if (!dev || *dev->dma_mask >= 0xffffffffUL)
-		gfp &= ~GFP_DMA;
-	ret = (void *)__get_free_pages(gfp, get_order(size));
-	if (ret) {
-		memset(ret, 0, size);
-		*dma_handle = virt_to_phys(ret);
-	}
-	return ret;
-}
-
-static int alpha_noop_supported(struct device *dev, u64 mask)
-{
-	return mask < 0x00ffffffUL ? 0 : 1;
-}
-
-const struct dma_map_ops alpha_noop_ops = {
-	.alloc			= alpha_noop_alloc_coherent,
-	.free			= dma_noop_free_coherent,
-	.map_page		= dma_noop_map_page,
-	.map_sg			= dma_noop_map_sg,
-	.mapping_error		= dma_noop_mapping_error,
-	.dma_supported		= alpha_noop_supported,
-};
-
-const struct dma_map_ops *dma_ops = &alpha_noop_ops;
-EXPORT_SYMBOL(dma_ops);
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [OpenRISC] [PATCH 04/22] alpha: use dma_direct_ops for jensen
@ 2018-04-20  8:02   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:02 UTC (permalink / raw)
  To: openrisc

The generic dma_direct implementation does the same thing as the alpha
pci-noop implementation, just with more bells and whistles.  And unlike
the current code it at least has a theoretical chance to actually compile.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/alpha/Kconfig                   |  1 +
 arch/alpha/include/asm/dma-mapping.h |  4 ++++
 arch/alpha/kernel/pci-noop.c         | 33 ----------------------------
 3 files changed, 5 insertions(+), 33 deletions(-)

diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index aa7df1a36fd0..94af0c7f494a 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -204,6 +204,7 @@ config ALPHA_EIGER
 config ALPHA_JENSEN
 	bool "Jensen"
 	depends on BROKEN
+	select DMA_DIRECT_OPS
 	help
 	  DEC PC 150 AXP (aka Jensen): This is a very old Digital system - one
 	  of the first-generation Alpha systems. A number of these systems
diff --git a/arch/alpha/include/asm/dma-mapping.h b/arch/alpha/include/asm/dma-mapping.h
index b78f61f20796..76ce923ecca1 100644
--- a/arch/alpha/include/asm/dma-mapping.h
+++ b/arch/alpha/include/asm/dma-mapping.h
@@ -6,7 +6,11 @@ extern const struct dma_map_ops *dma_ops;
 
 static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
 {
+#ifdef CONFIG_ALPHA_JENSEN
+	return &dma_direct_ops;
+#else
 	return dma_ops;
+#endif
 }
 
 #endif	/* _ALPHA_DMA_MAPPING_H */
diff --git a/arch/alpha/kernel/pci-noop.c b/arch/alpha/kernel/pci-noop.c
index b6ebb65127a8..c7c5879869d3 100644
--- a/arch/alpha/kernel/pci-noop.c
+++ b/arch/alpha/kernel/pci-noop.c
@@ -102,36 +102,3 @@ SYSCALL_DEFINE5(pciconfig_write, unsigned long, bus, unsigned long, dfn,
 	else
 		return -ENODEV;
 }
-
-static void *alpha_noop_alloc_coherent(struct device *dev, size_t size,
-				       dma_addr_t *dma_handle, gfp_t gfp,
-				       unsigned long attrs)
-{
-	void *ret;
-
-	if (!dev || *dev->dma_mask >= 0xffffffffUL)
-		gfp &= ~GFP_DMA;
-	ret = (void *)__get_free_pages(gfp, get_order(size));
-	if (ret) {
-		memset(ret, 0, size);
-		*dma_handle = virt_to_phys(ret);
-	}
-	return ret;
-}
-
-static int alpha_noop_supported(struct device *dev, u64 mask)
-{
-	return mask < 0x00ffffffUL ? 0 : 1;
-}
-
-const struct dma_map_ops alpha_noop_ops = {
-	.alloc			= alpha_noop_alloc_coherent,
-	.free			= dma_noop_free_coherent,
-	.map_page		= dma_noop_map_page,
-	.map_sg			= dma_noop_map_sg,
-	.mapping_error		= dma_noop_mapping_error,
-	.dma_supported		= alpha_noop_supported,
-};
-
-const struct dma_map_ops *dma_ops = &alpha_noop_ops;
-EXPORT_SYMBOL(dma_ops);
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 04/22] alpha: use dma_direct_ops for jensen
@ 2018-04-20  8:02   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:02 UTC (permalink / raw)
  To: linux-arm-kernel

The generic dma_direct implementation does the same thing as the alpha
pci-noop implementation, just with more bells and whistles.  And unlike
the current code it at least has a theoretical chance to actually compile.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/alpha/Kconfig                   |  1 +
 arch/alpha/include/asm/dma-mapping.h |  4 ++++
 arch/alpha/kernel/pci-noop.c         | 33 ----------------------------
 3 files changed, 5 insertions(+), 33 deletions(-)

diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index aa7df1a36fd0..94af0c7f494a 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -204,6 +204,7 @@ config ALPHA_EIGER
 config ALPHA_JENSEN
 	bool "Jensen"
 	depends on BROKEN
+	select DMA_DIRECT_OPS
 	help
 	  DEC PC 150 AXP (aka Jensen): This is a very old Digital system - one
 	  of the first-generation Alpha systems. A number of these systems
diff --git a/arch/alpha/include/asm/dma-mapping.h b/arch/alpha/include/asm/dma-mapping.h
index b78f61f20796..76ce923ecca1 100644
--- a/arch/alpha/include/asm/dma-mapping.h
+++ b/arch/alpha/include/asm/dma-mapping.h
@@ -6,7 +6,11 @@ extern const struct dma_map_ops *dma_ops;
 
 static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
 {
+#ifdef CONFIG_ALPHA_JENSEN
+	return &dma_direct_ops;
+#else
 	return dma_ops;
+#endif
 }
 
 #endif	/* _ALPHA_DMA_MAPPING_H */
diff --git a/arch/alpha/kernel/pci-noop.c b/arch/alpha/kernel/pci-noop.c
index b6ebb65127a8..c7c5879869d3 100644
--- a/arch/alpha/kernel/pci-noop.c
+++ b/arch/alpha/kernel/pci-noop.c
@@ -102,36 +102,3 @@ SYSCALL_DEFINE5(pciconfig_write, unsigned long, bus, unsigned long, dfn,
 	else
 		return -ENODEV;
 }
-
-static void *alpha_noop_alloc_coherent(struct device *dev, size_t size,
-				       dma_addr_t *dma_handle, gfp_t gfp,
-				       unsigned long attrs)
-{
-	void *ret;
-
-	if (!dev || *dev->dma_mask >= 0xffffffffUL)
-		gfp &= ~GFP_DMA;
-	ret = (void *)__get_free_pages(gfp, get_order(size));
-	if (ret) {
-		memset(ret, 0, size);
-		*dma_handle = virt_to_phys(ret);
-	}
-	return ret;
-}
-
-static int alpha_noop_supported(struct device *dev, u64 mask)
-{
-	return mask < 0x00ffffffUL ? 0 : 1;
-}
-
-const struct dma_map_ops alpha_noop_ops = {
-	.alloc			= alpha_noop_alloc_coherent,
-	.free			= dma_noop_free_coherent,
-	.map_page		= dma_noop_map_page,
-	.map_sg			= dma_noop_map_sg,
-	.mapping_error		= dma_noop_mapping_error,
-	.dma_supported		= alpha_noop_supported,
-};
-
-const struct dma_map_ops *dma_ops = &alpha_noop_ops;
-EXPORT_SYMBOL(dma_ops);
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 05/22] alpha: simplify get_arch_dma_ops
@ 2018-04-20  8:02   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:02 UTC (permalink / raw)
  Cc: linux-arch, linux-xtensa, Michal Simek, Vincent Chen,
	linux-c6x-dev, linux-parisc, linux-sh, linux-hexagon,
	linux-kernel, linux-m68k, openrisc, Greentime Hu, linux-alpha,
	sparclinux, nios2-dev, linux-snps-arc, linux-arm-kernel

Remove the dma_ops indirection.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/alpha/include/asm/dma-mapping.h | 4 ++--
 arch/alpha/kernel/pci_iommu.c        | 4 +---
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/arch/alpha/include/asm/dma-mapping.h b/arch/alpha/include/asm/dma-mapping.h
index 76ce923ecca1..8beeafd4f68e 100644
--- a/arch/alpha/include/asm/dma-mapping.h
+++ b/arch/alpha/include/asm/dma-mapping.h
@@ -2,14 +2,14 @@
 #ifndef _ALPHA_DMA_MAPPING_H
 #define _ALPHA_DMA_MAPPING_H
 
-extern const struct dma_map_ops *dma_ops;
+extern const struct dma_map_ops alpha_pci_ops;
 
 static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
 {
 #ifdef CONFIG_ALPHA_JENSEN
 	return &dma_direct_ops;
 #else
-	return dma_ops;
+	return &alpha_pci_ops;
 #endif
 }
 
diff --git a/arch/alpha/kernel/pci_iommu.c b/arch/alpha/kernel/pci_iommu.c
index 83b34b9188ea..6923b0d9c1e1 100644
--- a/arch/alpha/kernel/pci_iommu.c
+++ b/arch/alpha/kernel/pci_iommu.c
@@ -950,6 +950,4 @@ const struct dma_map_ops alpha_pci_ops = {
 	.mapping_error		= alpha_pci_mapping_error,
 	.dma_supported		= alpha_pci_supported,
 };
-
-const struct dma_map_ops *dma_ops = &alpha_pci_ops;
-EXPORT_SYMBOL(dma_ops);
+EXPORT_SYMBOL(alpha_pci_ops);
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 05/22] alpha: simplify get_arch_dma_ops
@ 2018-04-20  8:02   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:02 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Remove the dma_ops indirection.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/alpha/include/asm/dma-mapping.h | 4 ++--
 arch/alpha/kernel/pci_iommu.c        | 4 +---
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/arch/alpha/include/asm/dma-mapping.h b/arch/alpha/include/asm/dma-mapping.h
index 76ce923ecca1..8beeafd4f68e 100644
--- a/arch/alpha/include/asm/dma-mapping.h
+++ b/arch/alpha/include/asm/dma-mapping.h
@@ -2,14 +2,14 @@
 #ifndef _ALPHA_DMA_MAPPING_H
 #define _ALPHA_DMA_MAPPING_H
 
-extern const struct dma_map_ops *dma_ops;
+extern const struct dma_map_ops alpha_pci_ops;
 
 static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
 {
 #ifdef CONFIG_ALPHA_JENSEN
 	return &dma_direct_ops;
 #else
-	return dma_ops;
+	return &alpha_pci_ops;
 #endif
 }
 
diff --git a/arch/alpha/kernel/pci_iommu.c b/arch/alpha/kernel/pci_iommu.c
index 83b34b9188ea..6923b0d9c1e1 100644
--- a/arch/alpha/kernel/pci_iommu.c
+++ b/arch/alpha/kernel/pci_iommu.c
@@ -950,6 +950,4 @@ const struct dma_map_ops alpha_pci_ops = {
 	.mapping_error		= alpha_pci_mapping_error,
 	.dma_supported		= alpha_pci_supported,
 };
-
-const struct dma_map_ops *dma_ops = &alpha_pci_ops;
-EXPORT_SYMBOL(dma_ops);
+EXPORT_SYMBOL(alpha_pci_ops);
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 05/22] alpha: simplify get_arch_dma_ops
@ 2018-04-20  8:02   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:02 UTC (permalink / raw)
  To: linux-snps-arc

Remove the dma_ops indirection.

Signed-off-by: Christoph Hellwig <hch at lst.de>
---
 arch/alpha/include/asm/dma-mapping.h | 4 ++--
 arch/alpha/kernel/pci_iommu.c        | 4 +---
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/arch/alpha/include/asm/dma-mapping.h b/arch/alpha/include/asm/dma-mapping.h
index 76ce923ecca1..8beeafd4f68e 100644
--- a/arch/alpha/include/asm/dma-mapping.h
+++ b/arch/alpha/include/asm/dma-mapping.h
@@ -2,14 +2,14 @@
 #ifndef _ALPHA_DMA_MAPPING_H
 #define _ALPHA_DMA_MAPPING_H
 
-extern const struct dma_map_ops *dma_ops;
+extern const struct dma_map_ops alpha_pci_ops;
 
 static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
 {
 #ifdef CONFIG_ALPHA_JENSEN
 	return &dma_direct_ops;
 #else
-	return dma_ops;
+	return &alpha_pci_ops;
 #endif
 }
 
diff --git a/arch/alpha/kernel/pci_iommu.c b/arch/alpha/kernel/pci_iommu.c
index 83b34b9188ea..6923b0d9c1e1 100644
--- a/arch/alpha/kernel/pci_iommu.c
+++ b/arch/alpha/kernel/pci_iommu.c
@@ -950,6 +950,4 @@ const struct dma_map_ops alpha_pci_ops = {
 	.mapping_error		= alpha_pci_mapping_error,
 	.dma_supported		= alpha_pci_supported,
 };
-
-const struct dma_map_ops *dma_ops = &alpha_pci_ops;
-EXPORT_SYMBOL(dma_ops);
+EXPORT_SYMBOL(alpha_pci_ops);
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 05/22] alpha: simplify get_arch_dma_ops
@ 2018-04-20  8:02   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:02 UTC (permalink / raw)
  Cc: linux-arch, linux-xtensa, Michal Simek, Vincent Chen,
	linux-c6x-dev, linux-parisc, linux-sh, linux-hexagon,
	linux-kernel, linux-m68k, openrisc, Greentime Hu, linux-alpha,
	sparclinux, nios2-dev, linux-snps-arc, linux-arm-kernel

Remove the dma_ops indirection.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/alpha/include/asm/dma-mapping.h | 4 ++--
 arch/alpha/kernel/pci_iommu.c        | 4 +---
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/arch/alpha/include/asm/dma-mapping.h b/arch/alpha/include/asm/dma-mapping.h
index 76ce923ecca1..8beeafd4f68e 100644
--- a/arch/alpha/include/asm/dma-mapping.h
+++ b/arch/alpha/include/asm/dma-mapping.h
@@ -2,14 +2,14 @@
 #ifndef _ALPHA_DMA_MAPPING_H
 #define _ALPHA_DMA_MAPPING_H
 
-extern const struct dma_map_ops *dma_ops;
+extern const struct dma_map_ops alpha_pci_ops;
 
 static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
 {
 #ifdef CONFIG_ALPHA_JENSEN
 	return &dma_direct_ops;
 #else
-	return dma_ops;
+	return &alpha_pci_ops;
 #endif
 }
 
diff --git a/arch/alpha/kernel/pci_iommu.c b/arch/alpha/kernel/pci_iommu.c
index 83b34b9188ea..6923b0d9c1e1 100644
--- a/arch/alpha/kernel/pci_iommu.c
+++ b/arch/alpha/kernel/pci_iommu.c
@@ -950,6 +950,4 @@ const struct dma_map_ops alpha_pci_ops = {
 	.mapping_error		= alpha_pci_mapping_error,
 	.dma_supported		= alpha_pci_supported,
 };
-
-const struct dma_map_ops *dma_ops = &alpha_pci_ops;
-EXPORT_SYMBOL(dma_ops);
+EXPORT_SYMBOL(alpha_pci_ops);
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [OpenRISC] [PATCH 05/22] alpha: simplify get_arch_dma_ops
@ 2018-04-20  8:02   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:02 UTC (permalink / raw)
  To: openrisc

Remove the dma_ops indirection.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/alpha/include/asm/dma-mapping.h | 4 ++--
 arch/alpha/kernel/pci_iommu.c        | 4 +---
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/arch/alpha/include/asm/dma-mapping.h b/arch/alpha/include/asm/dma-mapping.h
index 76ce923ecca1..8beeafd4f68e 100644
--- a/arch/alpha/include/asm/dma-mapping.h
+++ b/arch/alpha/include/asm/dma-mapping.h
@@ -2,14 +2,14 @@
 #ifndef _ALPHA_DMA_MAPPING_H
 #define _ALPHA_DMA_MAPPING_H
 
-extern const struct dma_map_ops *dma_ops;
+extern const struct dma_map_ops alpha_pci_ops;
 
 static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
 {
 #ifdef CONFIG_ALPHA_JENSEN
 	return &dma_direct_ops;
 #else
-	return dma_ops;
+	return &alpha_pci_ops;
 #endif
 }
 
diff --git a/arch/alpha/kernel/pci_iommu.c b/arch/alpha/kernel/pci_iommu.c
index 83b34b9188ea..6923b0d9c1e1 100644
--- a/arch/alpha/kernel/pci_iommu.c
+++ b/arch/alpha/kernel/pci_iommu.c
@@ -950,6 +950,4 @@ const struct dma_map_ops alpha_pci_ops = {
 	.mapping_error		= alpha_pci_mapping_error,
 	.dma_supported		= alpha_pci_supported,
 };
-
-const struct dma_map_ops *dma_ops = &alpha_pci_ops;
-EXPORT_SYMBOL(dma_ops);
+EXPORT_SYMBOL(alpha_pci_ops);
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 05/22] alpha: simplify get_arch_dma_ops
@ 2018-04-20  8:02   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:02 UTC (permalink / raw)
  To: linux-arm-kernel

Remove the dma_ops indirection.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/alpha/include/asm/dma-mapping.h | 4 ++--
 arch/alpha/kernel/pci_iommu.c        | 4 +---
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/arch/alpha/include/asm/dma-mapping.h b/arch/alpha/include/asm/dma-mapping.h
index 76ce923ecca1..8beeafd4f68e 100644
--- a/arch/alpha/include/asm/dma-mapping.h
+++ b/arch/alpha/include/asm/dma-mapping.h
@@ -2,14 +2,14 @@
 #ifndef _ALPHA_DMA_MAPPING_H
 #define _ALPHA_DMA_MAPPING_H
 
-extern const struct dma_map_ops *dma_ops;
+extern const struct dma_map_ops alpha_pci_ops;
 
 static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
 {
 #ifdef CONFIG_ALPHA_JENSEN
 	return &dma_direct_ops;
 #else
-	return dma_ops;
+	return &alpha_pci_ops;
 #endif
 }
 
diff --git a/arch/alpha/kernel/pci_iommu.c b/arch/alpha/kernel/pci_iommu.c
index 83b34b9188ea..6923b0d9c1e1 100644
--- a/arch/alpha/kernel/pci_iommu.c
+++ b/arch/alpha/kernel/pci_iommu.c
@@ -950,6 +950,4 @@ const struct dma_map_ops alpha_pci_ops = {
 	.mapping_error		= alpha_pci_mapping_error,
 	.dma_supported		= alpha_pci_supported,
 };
-
-const struct dma_map_ops *dma_ops = &alpha_pci_ops;
-EXPORT_SYMBOL(dma_ops);
+EXPORT_SYMBOL(alpha_pci_ops);
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 06/22] arc: use generic dma_noncoherent_ops
@ 2018-04-20  8:02   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:02 UTC (permalink / raw)
  Cc: linux-arch, linux-xtensa, Michal Simek, Vincent Chen,
	linux-c6x-dev, linux-parisc, linux-sh, linux-hexagon,
	linux-kernel, linux-m68k, openrisc, Greentime Hu, linux-alpha,
	sparclinux, nios2-dev, linux-snps-arc, linux-arm-kernel

Switch to the generic noncoherent direct mapping implementation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/arc/Kconfig                   |   4 +
 arch/arc/include/asm/Kbuild        |   1 +
 arch/arc/include/asm/dma-mapping.h |  21 -----
 arch/arc/mm/dma.c                  | 141 +++--------------------------
 4 files changed, 19 insertions(+), 148 deletions(-)
 delete mode 100644 arch/arc/include/asm/dma-mapping.h

diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index 7498aca4b887..89d47eac18b2 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -9,11 +9,15 @@
 config ARC
 	def_bool y
 	select ARC_TIMERS
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select ARCH_HAS_SG_CHAIN
 	select ARCH_SUPPORTS_ATOMIC_RMW if ARC_HAS_LLSC
 	select BUILDTIME_EXTABLE_SORT
 	select CLONE_BACKWARDS
 	select COMMON_CLK
+	select DMA_NONCOHERENT_OPS
+	select DMA_NONCOHERENT_MMAP
 	select GENERIC_ATOMIC64 if !ISA_ARCV2 || !(ARC_HAS_LL64 && ARC_HAS_LLSC)
 	select GENERIC_CLOCKEVENTS
 	select GENERIC_FIND_FIRST_BIT
diff --git a/arch/arc/include/asm/Kbuild b/arch/arc/include/asm/Kbuild
index 4bd5d4369e05..bbdcb955e18f 100644
--- a/arch/arc/include/asm/Kbuild
+++ b/arch/arc/include/asm/Kbuild
@@ -2,6 +2,7 @@
 generic-y += bugs.h
 generic-y += device.h
 generic-y += div64.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += extable.h
 generic-y += fb.h
diff --git a/arch/arc/include/asm/dma-mapping.h b/arch/arc/include/asm/dma-mapping.h
deleted file mode 100644
index 7a16824bfe98..000000000000
--- a/arch/arc/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * DMA Mapping glue for ARC
- *
- * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#ifndef ASM_ARC_DMA_MAPPING_H
-#define ASM_ARC_DMA_MAPPING_H
-
-extern const struct dma_map_ops arc_dma_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return &arc_dma_ops;
-}
-
-#endif
diff --git a/arch/arc/mm/dma.c b/arch/arc/mm/dma.c
index 1dcc404b5aec..ecfeb5585cc7 100644
--- a/arch/arc/mm/dma.c
+++ b/arch/arc/mm/dma.c
@@ -16,13 +16,12 @@
  * The default DMA address == Phy address which is 0x8000_0000 based.
  */
 
-#include <linux/dma-mapping.h>
+#include <linux/dma-noncoherent.h>
 #include <asm/cache.h>
 #include <asm/cacheflush.h>
 
-
-static void *arc_dma_alloc(struct device *dev, size_t size,
-		dma_addr_t *dma_handle, gfp_t gfp, unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	unsigned long order = get_order(size);
 	struct page *page;
@@ -89,7 +88,7 @@ static void *arc_dma_alloc(struct device *dev, size_t size,
 	return kvaddr;
 }
 
-static void arc_dma_free(struct device *dev, size_t size, void *vaddr,
+void arch_dma_free(struct device *dev, size_t size, void *vaddr,
 		dma_addr_t dma_handle, unsigned long attrs)
 {
 	phys_addr_t paddr = dma_handle;
@@ -105,9 +104,9 @@ static void arc_dma_free(struct device *dev, size_t size, void *vaddr,
 	__free_pages(page, get_order(size));
 }
 
-static int arc_dma_mmap(struct device *dev, struct vm_area_struct *vma,
-			void *cpu_addr, dma_addr_t dma_addr, size_t size,
-			unsigned long attrs)
+int arch_dma_mmap(struct device *dev, struct vm_area_struct *vma,
+		void *cpu_addr, dma_addr_t dma_addr, size_t size,
+		unsigned long attrs)
 {
 	unsigned long user_count = vma_pages(vma);
 	unsigned long count = PAGE_ALIGN(size) >> PAGE_SHIFT;
@@ -135,7 +134,7 @@ static int arc_dma_mmap(struct device *dev, struct vm_area_struct *vma,
  * CPU accesses page via normal paddr, thus needs to explicitly made
  * consistent before each use
  */
-static void _dma_cache_sync(phys_addr_t paddr, size_t size,
+static void _dma_cache_sync(struct device *dev, phys_addr_t paddr size_t size,
 		enum dma_data_direction dir)
 {
 	switch (dir) {
@@ -153,126 +152,14 @@ static void _dma_cache_sync(phys_addr_t paddr, size_t size,
 	}
 }
 
-/*
- * arc_dma_map_page - map a portion of a page for streaming DMA
- *
- * Ensure that any data held in the cache is appropriately discarded
- * or written back.
- *
- * The device owns this memory once this call has completed.  The CPU
- * can regain ownership by calling dma_unmap_page().
- *
- * Note: while it takes struct page as arg, caller can "abuse" it to pass
- * a region larger than PAGE_SIZE, provided it is physically contiguous
- * and this still works correctly
- */
-static dma_addr_t arc_dma_map_page(struct device *dev, struct page *page,
-		unsigned long offset, size_t size, enum dma_data_direction dir,
-		unsigned long attrs)
-{
-	phys_addr_t paddr = page_to_phys(page) + offset;
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		_dma_cache_sync(paddr, size, dir);
-
-	return paddr;
-}
-
-/*
- * arc_dma_unmap_page - unmap a buffer previously mapped through dma_map_page()
- *
- * After this call, reads by the CPU to the buffer are guaranteed to see
- * whatever the device wrote there.
- *
- * Note: historically this routine was not implemented for ARC
- */
-static void arc_dma_unmap_page(struct device *dev, dma_addr_t handle,
-			       size_t size, enum dma_data_direction dir,
-			       unsigned long attrs)
-{
-	phys_addr_t paddr = handle;
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		_dma_cache_sync(paddr, size, dir);
-}
-
-static int arc_dma_map_sg(struct device *dev, struct scatterlist *sg,
-	   int nents, enum dma_data_direction dir, unsigned long attrs)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nents, i)
-		s->dma_address = dma_map_page(dev, sg_page(s), s->offset,
-					       s->length, dir);
-
-	return nents;
-}
-
-static void arc_dma_unmap_sg(struct device *dev, struct scatterlist *sg,
-			     int nents, enum dma_data_direction dir,
-			     unsigned long attrs)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nents, i)
-		arc_dma_unmap_page(dev, sg_dma_address(s), sg_dma_len(s), dir,
-				   attrs);
-}
-
-static void arc_dma_sync_single_for_cpu(struct device *dev,
-		dma_addr_t dma_handle, size_t size, enum dma_data_direction dir)
-{
-	_dma_cache_sync(dma_handle, size, DMA_FROM_DEVICE);
-}
-
-static void arc_dma_sync_single_for_device(struct device *dev,
-		dma_addr_t dma_handle, size_t size, enum dma_data_direction dir)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	_dma_cache_sync(dma_handle, size, DMA_TO_DEVICE);
+	return _dma_cache_sync(dev, paddr, size, dir);
 }
 
-static void arc_dma_sync_sg_for_cpu(struct device *dev,
-		struct scatterlist *sglist, int nelems,
-		enum dma_data_direction dir)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	int i;
-	struct scatterlist *sg;
-
-	for_each_sg(sglist, sg, nelems, i)
-		_dma_cache_sync(sg_phys(sg), sg->length, dir);
+	return _dma_cache_sync(dev, paddr, size, dir);
 }
-
-static void arc_dma_sync_sg_for_device(struct device *dev,
-		struct scatterlist *sglist, int nelems,
-		enum dma_data_direction dir)
-{
-	int i;
-	struct scatterlist *sg;
-
-	for_each_sg(sglist, sg, nelems, i)
-		_dma_cache_sync(sg_phys(sg), sg->length, dir);
-}
-
-static int arc_dma_supported(struct device *dev, u64 dma_mask)
-{
-	/* Support 32 bit DMA mask exclusively */
-	return dma_mask == DMA_BIT_MASK(32);
-}
-
-const struct dma_map_ops arc_dma_ops = {
-	.alloc			= arc_dma_alloc,
-	.free			= arc_dma_free,
-	.mmap			= arc_dma_mmap,
-	.map_page		= arc_dma_map_page,
-	.unmap_page		= arc_dma_unmap_page,
-	.map_sg			= arc_dma_map_sg,
-	.unmap_sg		= arc_dma_unmap_sg,
-	.sync_single_for_device	= arc_dma_sync_single_for_device,
-	.sync_single_for_cpu	= arc_dma_sync_single_for_cpu,
-	.sync_sg_for_cpu	= arc_dma_sync_sg_for_cpu,
-	.sync_sg_for_device	= arc_dma_sync_sg_for_device,
-	.dma_supported		= arc_dma_supported,
-};
-EXPORT_SYMBOL(arc_dma_ops);
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 06/22] arc: use generic dma_noncoherent_ops
@ 2018-04-20  8:02   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:02 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Switch to the generic noncoherent direct mapping implementation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/arc/Kconfig                   |   4 +
 arch/arc/include/asm/Kbuild        |   1 +
 arch/arc/include/asm/dma-mapping.h |  21 -----
 arch/arc/mm/dma.c                  | 141 +++--------------------------
 4 files changed, 19 insertions(+), 148 deletions(-)
 delete mode 100644 arch/arc/include/asm/dma-mapping.h

diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index 7498aca4b887..89d47eac18b2 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -9,11 +9,15 @@
 config ARC
 	def_bool y
 	select ARC_TIMERS
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select ARCH_HAS_SG_CHAIN
 	select ARCH_SUPPORTS_ATOMIC_RMW if ARC_HAS_LLSC
 	select BUILDTIME_EXTABLE_SORT
 	select CLONE_BACKWARDS
 	select COMMON_CLK
+	select DMA_NONCOHERENT_OPS
+	select DMA_NONCOHERENT_MMAP
 	select GENERIC_ATOMIC64 if !ISA_ARCV2 || !(ARC_HAS_LL64 && ARC_HAS_LLSC)
 	select GENERIC_CLOCKEVENTS
 	select GENERIC_FIND_FIRST_BIT
diff --git a/arch/arc/include/asm/Kbuild b/arch/arc/include/asm/Kbuild
index 4bd5d4369e05..bbdcb955e18f 100644
--- a/arch/arc/include/asm/Kbuild
+++ b/arch/arc/include/asm/Kbuild
@@ -2,6 +2,7 @@
 generic-y += bugs.h
 generic-y += device.h
 generic-y += div64.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += extable.h
 generic-y += fb.h
diff --git a/arch/arc/include/asm/dma-mapping.h b/arch/arc/include/asm/dma-mapping.h
deleted file mode 100644
index 7a16824bfe98..000000000000
--- a/arch/arc/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * DMA Mapping glue for ARC
- *
- * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#ifndef ASM_ARC_DMA_MAPPING_H
-#define ASM_ARC_DMA_MAPPING_H
-
-extern const struct dma_map_ops arc_dma_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return &arc_dma_ops;
-}
-
-#endif
diff --git a/arch/arc/mm/dma.c b/arch/arc/mm/dma.c
index 1dcc404b5aec..ecfeb5585cc7 100644
--- a/arch/arc/mm/dma.c
+++ b/arch/arc/mm/dma.c
@@ -16,13 +16,12 @@
  * The default DMA address == Phy address which is 0x8000_0000 based.
  */
 
-#include <linux/dma-mapping.h>
+#include <linux/dma-noncoherent.h>
 #include <asm/cache.h>
 #include <asm/cacheflush.h>
 
-
-static void *arc_dma_alloc(struct device *dev, size_t size,
-		dma_addr_t *dma_handle, gfp_t gfp, unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	unsigned long order = get_order(size);
 	struct page *page;
@@ -89,7 +88,7 @@ static void *arc_dma_alloc(struct device *dev, size_t size,
 	return kvaddr;
 }
 
-static void arc_dma_free(struct device *dev, size_t size, void *vaddr,
+void arch_dma_free(struct device *dev, size_t size, void *vaddr,
 		dma_addr_t dma_handle, unsigned long attrs)
 {
 	phys_addr_t paddr = dma_handle;
@@ -105,9 +104,9 @@ static void arc_dma_free(struct device *dev, size_t size, void *vaddr,
 	__free_pages(page, get_order(size));
 }
 
-static int arc_dma_mmap(struct device *dev, struct vm_area_struct *vma,
-			void *cpu_addr, dma_addr_t dma_addr, size_t size,
-			unsigned long attrs)
+int arch_dma_mmap(struct device *dev, struct vm_area_struct *vma,
+		void *cpu_addr, dma_addr_t dma_addr, size_t size,
+		unsigned long attrs)
 {
 	unsigned long user_count = vma_pages(vma);
 	unsigned long count = PAGE_ALIGN(size) >> PAGE_SHIFT;
@@ -135,7 +134,7 @@ static int arc_dma_mmap(struct device *dev, struct vm_area_struct *vma,
  * CPU accesses page via normal paddr, thus needs to explicitly made
  * consistent before each use
  */
-static void _dma_cache_sync(phys_addr_t paddr, size_t size,
+static void _dma_cache_sync(struct device *dev, phys_addr_t paddr size_t size,
 		enum dma_data_direction dir)
 {
 	switch (dir) {
@@ -153,126 +152,14 @@ static void _dma_cache_sync(phys_addr_t paddr, size_t size,
 	}
 }
 
-/*
- * arc_dma_map_page - map a portion of a page for streaming DMA
- *
- * Ensure that any data held in the cache is appropriately discarded
- * or written back.
- *
- * The device owns this memory once this call has completed.  The CPU
- * can regain ownership by calling dma_unmap_page().
- *
- * Note: while it takes struct page as arg, caller can "abuse" it to pass
- * a region larger than PAGE_SIZE, provided it is physically contiguous
- * and this still works correctly
- */
-static dma_addr_t arc_dma_map_page(struct device *dev, struct page *page,
-		unsigned long offset, size_t size, enum dma_data_direction dir,
-		unsigned long attrs)
-{
-	phys_addr_t paddr = page_to_phys(page) + offset;
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		_dma_cache_sync(paddr, size, dir);
-
-	return paddr;
-}
-
-/*
- * arc_dma_unmap_page - unmap a buffer previously mapped through dma_map_page()
- *
- * After this call, reads by the CPU to the buffer are guaranteed to see
- * whatever the device wrote there.
- *
- * Note: historically this routine was not implemented for ARC
- */
-static void arc_dma_unmap_page(struct device *dev, dma_addr_t handle,
-			       size_t size, enum dma_data_direction dir,
-			       unsigned long attrs)
-{
-	phys_addr_t paddr = handle;
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		_dma_cache_sync(paddr, size, dir);
-}
-
-static int arc_dma_map_sg(struct device *dev, struct scatterlist *sg,
-	   int nents, enum dma_data_direction dir, unsigned long attrs)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nents, i)
-		s->dma_address = dma_map_page(dev, sg_page(s), s->offset,
-					       s->length, dir);
-
-	return nents;
-}
-
-static void arc_dma_unmap_sg(struct device *dev, struct scatterlist *sg,
-			     int nents, enum dma_data_direction dir,
-			     unsigned long attrs)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nents, i)
-		arc_dma_unmap_page(dev, sg_dma_address(s), sg_dma_len(s), dir,
-				   attrs);
-}
-
-static void arc_dma_sync_single_for_cpu(struct device *dev,
-		dma_addr_t dma_handle, size_t size, enum dma_data_direction dir)
-{
-	_dma_cache_sync(dma_handle, size, DMA_FROM_DEVICE);
-}
-
-static void arc_dma_sync_single_for_device(struct device *dev,
-		dma_addr_t dma_handle, size_t size, enum dma_data_direction dir)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	_dma_cache_sync(dma_handle, size, DMA_TO_DEVICE);
+	return _dma_cache_sync(dev, paddr, size, dir);
 }
 
-static void arc_dma_sync_sg_for_cpu(struct device *dev,
-		struct scatterlist *sglist, int nelems,
-		enum dma_data_direction dir)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	int i;
-	struct scatterlist *sg;
-
-	for_each_sg(sglist, sg, nelems, i)
-		_dma_cache_sync(sg_phys(sg), sg->length, dir);
+	return _dma_cache_sync(dev, paddr, size, dir);
 }
-
-static void arc_dma_sync_sg_for_device(struct device *dev,
-		struct scatterlist *sglist, int nelems,
-		enum dma_data_direction dir)
-{
-	int i;
-	struct scatterlist *sg;
-
-	for_each_sg(sglist, sg, nelems, i)
-		_dma_cache_sync(sg_phys(sg), sg->length, dir);
-}
-
-static int arc_dma_supported(struct device *dev, u64 dma_mask)
-{
-	/* Support 32 bit DMA mask exclusively */
-	return dma_mask == DMA_BIT_MASK(32);
-}
-
-const struct dma_map_ops arc_dma_ops = {
-	.alloc			= arc_dma_alloc,
-	.free			= arc_dma_free,
-	.mmap			= arc_dma_mmap,
-	.map_page		= arc_dma_map_page,
-	.unmap_page		= arc_dma_unmap_page,
-	.map_sg			= arc_dma_map_sg,
-	.unmap_sg		= arc_dma_unmap_sg,
-	.sync_single_for_device	= arc_dma_sync_single_for_device,
-	.sync_single_for_cpu	= arc_dma_sync_single_for_cpu,
-	.sync_sg_for_cpu	= arc_dma_sync_sg_for_cpu,
-	.sync_sg_for_device	= arc_dma_sync_sg_for_device,
-	.dma_supported		= arc_dma_supported,
-};
-EXPORT_SYMBOL(arc_dma_ops);
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 06/22] arc: use generic dma_noncoherent_ops
@ 2018-04-20  8:02   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:02 UTC (permalink / raw)
  To: linux-snps-arc

Switch to the generic noncoherent direct mapping implementation.

Signed-off-by: Christoph Hellwig <hch at lst.de>
---
 arch/arc/Kconfig                   |   4 +
 arch/arc/include/asm/Kbuild        |   1 +
 arch/arc/include/asm/dma-mapping.h |  21 -----
 arch/arc/mm/dma.c                  | 141 +++--------------------------
 4 files changed, 19 insertions(+), 148 deletions(-)
 delete mode 100644 arch/arc/include/asm/dma-mapping.h

diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index 7498aca4b887..89d47eac18b2 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -9,11 +9,15 @@
 config ARC
 	def_bool y
 	select ARC_TIMERS
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select ARCH_HAS_SG_CHAIN
 	select ARCH_SUPPORTS_ATOMIC_RMW if ARC_HAS_LLSC
 	select BUILDTIME_EXTABLE_SORT
 	select CLONE_BACKWARDS
 	select COMMON_CLK
+	select DMA_NONCOHERENT_OPS
+	select DMA_NONCOHERENT_MMAP
 	select GENERIC_ATOMIC64 if !ISA_ARCV2 || !(ARC_HAS_LL64 && ARC_HAS_LLSC)
 	select GENERIC_CLOCKEVENTS
 	select GENERIC_FIND_FIRST_BIT
diff --git a/arch/arc/include/asm/Kbuild b/arch/arc/include/asm/Kbuild
index 4bd5d4369e05..bbdcb955e18f 100644
--- a/arch/arc/include/asm/Kbuild
+++ b/arch/arc/include/asm/Kbuild
@@ -2,6 +2,7 @@
 generic-y += bugs.h
 generic-y += device.h
 generic-y += div64.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += extable.h
 generic-y += fb.h
diff --git a/arch/arc/include/asm/dma-mapping.h b/arch/arc/include/asm/dma-mapping.h
deleted file mode 100644
index 7a16824bfe98..000000000000
--- a/arch/arc/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * DMA Mapping glue for ARC
- *
- * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#ifndef ASM_ARC_DMA_MAPPING_H
-#define ASM_ARC_DMA_MAPPING_H
-
-extern const struct dma_map_ops arc_dma_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return &arc_dma_ops;
-}
-
-#endif
diff --git a/arch/arc/mm/dma.c b/arch/arc/mm/dma.c
index 1dcc404b5aec..ecfeb5585cc7 100644
--- a/arch/arc/mm/dma.c
+++ b/arch/arc/mm/dma.c
@@ -16,13 +16,12 @@
  * The default DMA address == Phy address which is 0x8000_0000 based.
  */
 
-#include <linux/dma-mapping.h>
+#include <linux/dma-noncoherent.h>
 #include <asm/cache.h>
 #include <asm/cacheflush.h>
 
-
-static void *arc_dma_alloc(struct device *dev, size_t size,
-		dma_addr_t *dma_handle, gfp_t gfp, unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	unsigned long order = get_order(size);
 	struct page *page;
@@ -89,7 +88,7 @@ static void *arc_dma_alloc(struct device *dev, size_t size,
 	return kvaddr;
 }
 
-static void arc_dma_free(struct device *dev, size_t size, void *vaddr,
+void arch_dma_free(struct device *dev, size_t size, void *vaddr,
 		dma_addr_t dma_handle, unsigned long attrs)
 {
 	phys_addr_t paddr = dma_handle;
@@ -105,9 +104,9 @@ static void arc_dma_free(struct device *dev, size_t size, void *vaddr,
 	__free_pages(page, get_order(size));
 }
 
-static int arc_dma_mmap(struct device *dev, struct vm_area_struct *vma,
-			void *cpu_addr, dma_addr_t dma_addr, size_t size,
-			unsigned long attrs)
+int arch_dma_mmap(struct device *dev, struct vm_area_struct *vma,
+		void *cpu_addr, dma_addr_t dma_addr, size_t size,
+		unsigned long attrs)
 {
 	unsigned long user_count = vma_pages(vma);
 	unsigned long count = PAGE_ALIGN(size) >> PAGE_SHIFT;
@@ -135,7 +134,7 @@ static int arc_dma_mmap(struct device *dev, struct vm_area_struct *vma,
  * CPU accesses page via normal paddr, thus needs to explicitly made
  * consistent before each use
  */
-static void _dma_cache_sync(phys_addr_t paddr, size_t size,
+static void _dma_cache_sync(struct device *dev, phys_addr_t paddr size_t size,
 		enum dma_data_direction dir)
 {
 	switch (dir) {
@@ -153,126 +152,14 @@ static void _dma_cache_sync(phys_addr_t paddr, size_t size,
 	}
 }
 
-/*
- * arc_dma_map_page - map a portion of a page for streaming DMA
- *
- * Ensure that any data held in the cache is appropriately discarded
- * or written back.
- *
- * The device owns this memory once this call has completed.  The CPU
- * can regain ownership by calling dma_unmap_page().
- *
- * Note: while it takes struct page as arg, caller can "abuse" it to pass
- * a region larger than PAGE_SIZE, provided it is physically contiguous
- * and this still works correctly
- */
-static dma_addr_t arc_dma_map_page(struct device *dev, struct page *page,
-		unsigned long offset, size_t size, enum dma_data_direction dir,
-		unsigned long attrs)
-{
-	phys_addr_t paddr = page_to_phys(page) + offset;
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		_dma_cache_sync(paddr, size, dir);
-
-	return paddr;
-}
-
-/*
- * arc_dma_unmap_page - unmap a buffer previously mapped through dma_map_page()
- *
- * After this call, reads by the CPU to the buffer are guaranteed to see
- * whatever the device wrote there.
- *
- * Note: historically this routine was not implemented for ARC
- */
-static void arc_dma_unmap_page(struct device *dev, dma_addr_t handle,
-			       size_t size, enum dma_data_direction dir,
-			       unsigned long attrs)
-{
-	phys_addr_t paddr = handle;
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		_dma_cache_sync(paddr, size, dir);
-}
-
-static int arc_dma_map_sg(struct device *dev, struct scatterlist *sg,
-	   int nents, enum dma_data_direction dir, unsigned long attrs)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nents, i)
-		s->dma_address = dma_map_page(dev, sg_page(s), s->offset,
-					       s->length, dir);
-
-	return nents;
-}
-
-static void arc_dma_unmap_sg(struct device *dev, struct scatterlist *sg,
-			     int nents, enum dma_data_direction dir,
-			     unsigned long attrs)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nents, i)
-		arc_dma_unmap_page(dev, sg_dma_address(s), sg_dma_len(s), dir,
-				   attrs);
-}
-
-static void arc_dma_sync_single_for_cpu(struct device *dev,
-		dma_addr_t dma_handle, size_t size, enum dma_data_direction dir)
-{
-	_dma_cache_sync(dma_handle, size, DMA_FROM_DEVICE);
-}
-
-static void arc_dma_sync_single_for_device(struct device *dev,
-		dma_addr_t dma_handle, size_t size, enum dma_data_direction dir)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	_dma_cache_sync(dma_handle, size, DMA_TO_DEVICE);
+	return _dma_cache_sync(dev, paddr, size, dir);
 }
 
-static void arc_dma_sync_sg_for_cpu(struct device *dev,
-		struct scatterlist *sglist, int nelems,
-		enum dma_data_direction dir)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	int i;
-	struct scatterlist *sg;
-
-	for_each_sg(sglist, sg, nelems, i)
-		_dma_cache_sync(sg_phys(sg), sg->length, dir);
+	return _dma_cache_sync(dev, paddr, size, dir);
 }
-
-static void arc_dma_sync_sg_for_device(struct device *dev,
-		struct scatterlist *sglist, int nelems,
-		enum dma_data_direction dir)
-{
-	int i;
-	struct scatterlist *sg;
-
-	for_each_sg(sglist, sg, nelems, i)
-		_dma_cache_sync(sg_phys(sg), sg->length, dir);
-}
-
-static int arc_dma_supported(struct device *dev, u64 dma_mask)
-{
-	/* Support 32 bit DMA mask exclusively */
-	return dma_mask == DMA_BIT_MASK(32);
-}
-
-const struct dma_map_ops arc_dma_ops = {
-	.alloc			= arc_dma_alloc,
-	.free			= arc_dma_free,
-	.mmap			= arc_dma_mmap,
-	.map_page		= arc_dma_map_page,
-	.unmap_page		= arc_dma_unmap_page,
-	.map_sg			= arc_dma_map_sg,
-	.unmap_sg		= arc_dma_unmap_sg,
-	.sync_single_for_device	= arc_dma_sync_single_for_device,
-	.sync_single_for_cpu	= arc_dma_sync_single_for_cpu,
-	.sync_sg_for_cpu	= arc_dma_sync_sg_for_cpu,
-	.sync_sg_for_device	= arc_dma_sync_sg_for_device,
-	.dma_supported		= arc_dma_supported,
-};
-EXPORT_SYMBOL(arc_dma_ops);
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 06/22] arc: use generic dma_noncoherent_ops
@ 2018-04-20  8:02   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:02 UTC (permalink / raw)
  Cc: linux-arch, linux-xtensa, Michal Simek, Vincent Chen,
	linux-c6x-dev, linux-parisc, linux-sh, linux-hexagon,
	linux-kernel, linux-m68k, openrisc, Greentime Hu, linux-alpha,
	sparclinux, nios2-dev, linux-snps-arc, linux-arm-kernel

Switch to the generic noncoherent direct mapping implementation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/arc/Kconfig                   |   4 +
 arch/arc/include/asm/Kbuild        |   1 +
 arch/arc/include/asm/dma-mapping.h |  21 -----
 arch/arc/mm/dma.c                  | 141 +++--------------------------
 4 files changed, 19 insertions(+), 148 deletions(-)
 delete mode 100644 arch/arc/include/asm/dma-mapping.h

diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index 7498aca4b887..89d47eac18b2 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -9,11 +9,15 @@
 config ARC
 	def_bool y
 	select ARC_TIMERS
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select ARCH_HAS_SG_CHAIN
 	select ARCH_SUPPORTS_ATOMIC_RMW if ARC_HAS_LLSC
 	select BUILDTIME_EXTABLE_SORT
 	select CLONE_BACKWARDS
 	select COMMON_CLK
+	select DMA_NONCOHERENT_OPS
+	select DMA_NONCOHERENT_MMAP
 	select GENERIC_ATOMIC64 if !ISA_ARCV2 || !(ARC_HAS_LL64 && ARC_HAS_LLSC)
 	select GENERIC_CLOCKEVENTS
 	select GENERIC_FIND_FIRST_BIT
diff --git a/arch/arc/include/asm/Kbuild b/arch/arc/include/asm/Kbuild
index 4bd5d4369e05..bbdcb955e18f 100644
--- a/arch/arc/include/asm/Kbuild
+++ b/arch/arc/include/asm/Kbuild
@@ -2,6 +2,7 @@
 generic-y += bugs.h
 generic-y += device.h
 generic-y += div64.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += extable.h
 generic-y += fb.h
diff --git a/arch/arc/include/asm/dma-mapping.h b/arch/arc/include/asm/dma-mapping.h
deleted file mode 100644
index 7a16824bfe98..000000000000
--- a/arch/arc/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * DMA Mapping glue for ARC
- *
- * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#ifndef ASM_ARC_DMA_MAPPING_H
-#define ASM_ARC_DMA_MAPPING_H
-
-extern const struct dma_map_ops arc_dma_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return &arc_dma_ops;
-}
-
-#endif
diff --git a/arch/arc/mm/dma.c b/arch/arc/mm/dma.c
index 1dcc404b5aec..ecfeb5585cc7 100644
--- a/arch/arc/mm/dma.c
+++ b/arch/arc/mm/dma.c
@@ -16,13 +16,12 @@
  * The default DMA address = Phy address which is 0x8000_0000 based.
  */
 
-#include <linux/dma-mapping.h>
+#include <linux/dma-noncoherent.h>
 #include <asm/cache.h>
 #include <asm/cacheflush.h>
 
-
-static void *arc_dma_alloc(struct device *dev, size_t size,
-		dma_addr_t *dma_handle, gfp_t gfp, unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	unsigned long order = get_order(size);
 	struct page *page;
@@ -89,7 +88,7 @@ static void *arc_dma_alloc(struct device *dev, size_t size,
 	return kvaddr;
 }
 
-static void arc_dma_free(struct device *dev, size_t size, void *vaddr,
+void arch_dma_free(struct device *dev, size_t size, void *vaddr,
 		dma_addr_t dma_handle, unsigned long attrs)
 {
 	phys_addr_t paddr = dma_handle;
@@ -105,9 +104,9 @@ static void arc_dma_free(struct device *dev, size_t size, void *vaddr,
 	__free_pages(page, get_order(size));
 }
 
-static int arc_dma_mmap(struct device *dev, struct vm_area_struct *vma,
-			void *cpu_addr, dma_addr_t dma_addr, size_t size,
-			unsigned long attrs)
+int arch_dma_mmap(struct device *dev, struct vm_area_struct *vma,
+		void *cpu_addr, dma_addr_t dma_addr, size_t size,
+		unsigned long attrs)
 {
 	unsigned long user_count = vma_pages(vma);
 	unsigned long count = PAGE_ALIGN(size) >> PAGE_SHIFT;
@@ -135,7 +134,7 @@ static int arc_dma_mmap(struct device *dev, struct vm_area_struct *vma,
  * CPU accesses page via normal paddr, thus needs to explicitly made
  * consistent before each use
  */
-static void _dma_cache_sync(phys_addr_t paddr, size_t size,
+static void _dma_cache_sync(struct device *dev, phys_addr_t paddr size_t size,
 		enum dma_data_direction dir)
 {
 	switch (dir) {
@@ -153,126 +152,14 @@ static void _dma_cache_sync(phys_addr_t paddr, size_t size,
 	}
 }
 
-/*
- * arc_dma_map_page - map a portion of a page for streaming DMA
- *
- * Ensure that any data held in the cache is appropriately discarded
- * or written back.
- *
- * The device owns this memory once this call has completed.  The CPU
- * can regain ownership by calling dma_unmap_page().
- *
- * Note: while it takes struct page as arg, caller can "abuse" it to pass
- * a region larger than PAGE_SIZE, provided it is physically contiguous
- * and this still works correctly
- */
-static dma_addr_t arc_dma_map_page(struct device *dev, struct page *page,
-		unsigned long offset, size_t size, enum dma_data_direction dir,
-		unsigned long attrs)
-{
-	phys_addr_t paddr = page_to_phys(page) + offset;
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		_dma_cache_sync(paddr, size, dir);
-
-	return paddr;
-}
-
-/*
- * arc_dma_unmap_page - unmap a buffer previously mapped through dma_map_page()
- *
- * After this call, reads by the CPU to the buffer are guaranteed to see
- * whatever the device wrote there.
- *
- * Note: historically this routine was not implemented for ARC
- */
-static void arc_dma_unmap_page(struct device *dev, dma_addr_t handle,
-			       size_t size, enum dma_data_direction dir,
-			       unsigned long attrs)
-{
-	phys_addr_t paddr = handle;
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		_dma_cache_sync(paddr, size, dir);
-}
-
-static int arc_dma_map_sg(struct device *dev, struct scatterlist *sg,
-	   int nents, enum dma_data_direction dir, unsigned long attrs)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nents, i)
-		s->dma_address = dma_map_page(dev, sg_page(s), s->offset,
-					       s->length, dir);
-
-	return nents;
-}
-
-static void arc_dma_unmap_sg(struct device *dev, struct scatterlist *sg,
-			     int nents, enum dma_data_direction dir,
-			     unsigned long attrs)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nents, i)
-		arc_dma_unmap_page(dev, sg_dma_address(s), sg_dma_len(s), dir,
-				   attrs);
-}
-
-static void arc_dma_sync_single_for_cpu(struct device *dev,
-		dma_addr_t dma_handle, size_t size, enum dma_data_direction dir)
-{
-	_dma_cache_sync(dma_handle, size, DMA_FROM_DEVICE);
-}
-
-static void arc_dma_sync_single_for_device(struct device *dev,
-		dma_addr_t dma_handle, size_t size, enum dma_data_direction dir)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	_dma_cache_sync(dma_handle, size, DMA_TO_DEVICE);
+	return _dma_cache_sync(dev, paddr, size, dir);
 }
 
-static void arc_dma_sync_sg_for_cpu(struct device *dev,
-		struct scatterlist *sglist, int nelems,
-		enum dma_data_direction dir)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	int i;
-	struct scatterlist *sg;
-
-	for_each_sg(sglist, sg, nelems, i)
-		_dma_cache_sync(sg_phys(sg), sg->length, dir);
+	return _dma_cache_sync(dev, paddr, size, dir);
 }
-
-static void arc_dma_sync_sg_for_device(struct device *dev,
-		struct scatterlist *sglist, int nelems,
-		enum dma_data_direction dir)
-{
-	int i;
-	struct scatterlist *sg;
-
-	for_each_sg(sglist, sg, nelems, i)
-		_dma_cache_sync(sg_phys(sg), sg->length, dir);
-}
-
-static int arc_dma_supported(struct device *dev, u64 dma_mask)
-{
-	/* Support 32 bit DMA mask exclusively */
-	return dma_mask = DMA_BIT_MASK(32);
-}
-
-const struct dma_map_ops arc_dma_ops = {
-	.alloc			= arc_dma_alloc,
-	.free			= arc_dma_free,
-	.mmap			= arc_dma_mmap,
-	.map_page		= arc_dma_map_page,
-	.unmap_page		= arc_dma_unmap_page,
-	.map_sg			= arc_dma_map_sg,
-	.unmap_sg		= arc_dma_unmap_sg,
-	.sync_single_for_device	= arc_dma_sync_single_for_device,
-	.sync_single_for_cpu	= arc_dma_sync_single_for_cpu,
-	.sync_sg_for_cpu	= arc_dma_sync_sg_for_cpu,
-	.sync_sg_for_device	= arc_dma_sync_sg_for_device,
-	.dma_supported		= arc_dma_supported,
-};
-EXPORT_SYMBOL(arc_dma_ops);
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [OpenRISC] [PATCH 06/22] arc: use generic dma_noncoherent_ops
@ 2018-04-20  8:02   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:02 UTC (permalink / raw)
  To: openrisc

Switch to the generic noncoherent direct mapping implementation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/arc/Kconfig                   |   4 +
 arch/arc/include/asm/Kbuild        |   1 +
 arch/arc/include/asm/dma-mapping.h |  21 -----
 arch/arc/mm/dma.c                  | 141 +++--------------------------
 4 files changed, 19 insertions(+), 148 deletions(-)
 delete mode 100644 arch/arc/include/asm/dma-mapping.h

diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index 7498aca4b887..89d47eac18b2 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -9,11 +9,15 @@
 config ARC
 	def_bool y
 	select ARC_TIMERS
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select ARCH_HAS_SG_CHAIN
 	select ARCH_SUPPORTS_ATOMIC_RMW if ARC_HAS_LLSC
 	select BUILDTIME_EXTABLE_SORT
 	select CLONE_BACKWARDS
 	select COMMON_CLK
+	select DMA_NONCOHERENT_OPS
+	select DMA_NONCOHERENT_MMAP
 	select GENERIC_ATOMIC64 if !ISA_ARCV2 || !(ARC_HAS_LL64 && ARC_HAS_LLSC)
 	select GENERIC_CLOCKEVENTS
 	select GENERIC_FIND_FIRST_BIT
diff --git a/arch/arc/include/asm/Kbuild b/arch/arc/include/asm/Kbuild
index 4bd5d4369e05..bbdcb955e18f 100644
--- a/arch/arc/include/asm/Kbuild
+++ b/arch/arc/include/asm/Kbuild
@@ -2,6 +2,7 @@
 generic-y += bugs.h
 generic-y += device.h
 generic-y += div64.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += extable.h
 generic-y += fb.h
diff --git a/arch/arc/include/asm/dma-mapping.h b/arch/arc/include/asm/dma-mapping.h
deleted file mode 100644
index 7a16824bfe98..000000000000
--- a/arch/arc/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * DMA Mapping glue for ARC
- *
- * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#ifndef ASM_ARC_DMA_MAPPING_H
-#define ASM_ARC_DMA_MAPPING_H
-
-extern const struct dma_map_ops arc_dma_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return &arc_dma_ops;
-}
-
-#endif
diff --git a/arch/arc/mm/dma.c b/arch/arc/mm/dma.c
index 1dcc404b5aec..ecfeb5585cc7 100644
--- a/arch/arc/mm/dma.c
+++ b/arch/arc/mm/dma.c
@@ -16,13 +16,12 @@
  * The default DMA address == Phy address which is 0x8000_0000 based.
  */
 
-#include <linux/dma-mapping.h>
+#include <linux/dma-noncoherent.h>
 #include <asm/cache.h>
 #include <asm/cacheflush.h>
 
-
-static void *arc_dma_alloc(struct device *dev, size_t size,
-		dma_addr_t *dma_handle, gfp_t gfp, unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	unsigned long order = get_order(size);
 	struct page *page;
@@ -89,7 +88,7 @@ static void *arc_dma_alloc(struct device *dev, size_t size,
 	return kvaddr;
 }
 
-static void arc_dma_free(struct device *dev, size_t size, void *vaddr,
+void arch_dma_free(struct device *dev, size_t size, void *vaddr,
 		dma_addr_t dma_handle, unsigned long attrs)
 {
 	phys_addr_t paddr = dma_handle;
@@ -105,9 +104,9 @@ static void arc_dma_free(struct device *dev, size_t size, void *vaddr,
 	__free_pages(page, get_order(size));
 }
 
-static int arc_dma_mmap(struct device *dev, struct vm_area_struct *vma,
-			void *cpu_addr, dma_addr_t dma_addr, size_t size,
-			unsigned long attrs)
+int arch_dma_mmap(struct device *dev, struct vm_area_struct *vma,
+		void *cpu_addr, dma_addr_t dma_addr, size_t size,
+		unsigned long attrs)
 {
 	unsigned long user_count = vma_pages(vma);
 	unsigned long count = PAGE_ALIGN(size) >> PAGE_SHIFT;
@@ -135,7 +134,7 @@ static int arc_dma_mmap(struct device *dev, struct vm_area_struct *vma,
  * CPU accesses page via normal paddr, thus needs to explicitly made
  * consistent before each use
  */
-static void _dma_cache_sync(phys_addr_t paddr, size_t size,
+static void _dma_cache_sync(struct device *dev, phys_addr_t paddr size_t size,
 		enum dma_data_direction dir)
 {
 	switch (dir) {
@@ -153,126 +152,14 @@ static void _dma_cache_sync(phys_addr_t paddr, size_t size,
 	}
 }
 
-/*
- * arc_dma_map_page - map a portion of a page for streaming DMA
- *
- * Ensure that any data held in the cache is appropriately discarded
- * or written back.
- *
- * The device owns this memory once this call has completed.  The CPU
- * can regain ownership by calling dma_unmap_page().
- *
- * Note: while it takes struct page as arg, caller can "abuse" it to pass
- * a region larger than PAGE_SIZE, provided it is physically contiguous
- * and this still works correctly
- */
-static dma_addr_t arc_dma_map_page(struct device *dev, struct page *page,
-		unsigned long offset, size_t size, enum dma_data_direction dir,
-		unsigned long attrs)
-{
-	phys_addr_t paddr = page_to_phys(page) + offset;
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		_dma_cache_sync(paddr, size, dir);
-
-	return paddr;
-}
-
-/*
- * arc_dma_unmap_page - unmap a buffer previously mapped through dma_map_page()
- *
- * After this call, reads by the CPU to the buffer are guaranteed to see
- * whatever the device wrote there.
- *
- * Note: historically this routine was not implemented for ARC
- */
-static void arc_dma_unmap_page(struct device *dev, dma_addr_t handle,
-			       size_t size, enum dma_data_direction dir,
-			       unsigned long attrs)
-{
-	phys_addr_t paddr = handle;
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		_dma_cache_sync(paddr, size, dir);
-}
-
-static int arc_dma_map_sg(struct device *dev, struct scatterlist *sg,
-	   int nents, enum dma_data_direction dir, unsigned long attrs)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nents, i)
-		s->dma_address = dma_map_page(dev, sg_page(s), s->offset,
-					       s->length, dir);
-
-	return nents;
-}
-
-static void arc_dma_unmap_sg(struct device *dev, struct scatterlist *sg,
-			     int nents, enum dma_data_direction dir,
-			     unsigned long attrs)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nents, i)
-		arc_dma_unmap_page(dev, sg_dma_address(s), sg_dma_len(s), dir,
-				   attrs);
-}
-
-static void arc_dma_sync_single_for_cpu(struct device *dev,
-		dma_addr_t dma_handle, size_t size, enum dma_data_direction dir)
-{
-	_dma_cache_sync(dma_handle, size, DMA_FROM_DEVICE);
-}
-
-static void arc_dma_sync_single_for_device(struct device *dev,
-		dma_addr_t dma_handle, size_t size, enum dma_data_direction dir)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	_dma_cache_sync(dma_handle, size, DMA_TO_DEVICE);
+	return _dma_cache_sync(dev, paddr, size, dir);
 }
 
-static void arc_dma_sync_sg_for_cpu(struct device *dev,
-		struct scatterlist *sglist, int nelems,
-		enum dma_data_direction dir)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	int i;
-	struct scatterlist *sg;
-
-	for_each_sg(sglist, sg, nelems, i)
-		_dma_cache_sync(sg_phys(sg), sg->length, dir);
+	return _dma_cache_sync(dev, paddr, size, dir);
 }
-
-static void arc_dma_sync_sg_for_device(struct device *dev,
-		struct scatterlist *sglist, int nelems,
-		enum dma_data_direction dir)
-{
-	int i;
-	struct scatterlist *sg;
-
-	for_each_sg(sglist, sg, nelems, i)
-		_dma_cache_sync(sg_phys(sg), sg->length, dir);
-}
-
-static int arc_dma_supported(struct device *dev, u64 dma_mask)
-{
-	/* Support 32 bit DMA mask exclusively */
-	return dma_mask == DMA_BIT_MASK(32);
-}
-
-const struct dma_map_ops arc_dma_ops = {
-	.alloc			= arc_dma_alloc,
-	.free			= arc_dma_free,
-	.mmap			= arc_dma_mmap,
-	.map_page		= arc_dma_map_page,
-	.unmap_page		= arc_dma_unmap_page,
-	.map_sg			= arc_dma_map_sg,
-	.unmap_sg		= arc_dma_unmap_sg,
-	.sync_single_for_device	= arc_dma_sync_single_for_device,
-	.sync_single_for_cpu	= arc_dma_sync_single_for_cpu,
-	.sync_sg_for_cpu	= arc_dma_sync_sg_for_cpu,
-	.sync_sg_for_device	= arc_dma_sync_sg_for_device,
-	.dma_supported		= arc_dma_supported,
-};
-EXPORT_SYMBOL(arc_dma_ops);
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 06/22] arc: use generic dma_noncoherent_ops
@ 2018-04-20  8:02   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:02 UTC (permalink / raw)
  To: linux-arm-kernel

Switch to the generic noncoherent direct mapping implementation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/arc/Kconfig                   |   4 +
 arch/arc/include/asm/Kbuild        |   1 +
 arch/arc/include/asm/dma-mapping.h |  21 -----
 arch/arc/mm/dma.c                  | 141 +++--------------------------
 4 files changed, 19 insertions(+), 148 deletions(-)
 delete mode 100644 arch/arc/include/asm/dma-mapping.h

diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index 7498aca4b887..89d47eac18b2 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -9,11 +9,15 @@
 config ARC
 	def_bool y
 	select ARC_TIMERS
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select ARCH_HAS_SG_CHAIN
 	select ARCH_SUPPORTS_ATOMIC_RMW if ARC_HAS_LLSC
 	select BUILDTIME_EXTABLE_SORT
 	select CLONE_BACKWARDS
 	select COMMON_CLK
+	select DMA_NONCOHERENT_OPS
+	select DMA_NONCOHERENT_MMAP
 	select GENERIC_ATOMIC64 if !ISA_ARCV2 || !(ARC_HAS_LL64 && ARC_HAS_LLSC)
 	select GENERIC_CLOCKEVENTS
 	select GENERIC_FIND_FIRST_BIT
diff --git a/arch/arc/include/asm/Kbuild b/arch/arc/include/asm/Kbuild
index 4bd5d4369e05..bbdcb955e18f 100644
--- a/arch/arc/include/asm/Kbuild
+++ b/arch/arc/include/asm/Kbuild
@@ -2,6 +2,7 @@
 generic-y += bugs.h
 generic-y += device.h
 generic-y += div64.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += extable.h
 generic-y += fb.h
diff --git a/arch/arc/include/asm/dma-mapping.h b/arch/arc/include/asm/dma-mapping.h
deleted file mode 100644
index 7a16824bfe98..000000000000
--- a/arch/arc/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * DMA Mapping glue for ARC
- *
- * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com)
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#ifndef ASM_ARC_DMA_MAPPING_H
-#define ASM_ARC_DMA_MAPPING_H
-
-extern const struct dma_map_ops arc_dma_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return &arc_dma_ops;
-}
-
-#endif
diff --git a/arch/arc/mm/dma.c b/arch/arc/mm/dma.c
index 1dcc404b5aec..ecfeb5585cc7 100644
--- a/arch/arc/mm/dma.c
+++ b/arch/arc/mm/dma.c
@@ -16,13 +16,12 @@
  * The default DMA address == Phy address which is 0x8000_0000 based.
  */
 
-#include <linux/dma-mapping.h>
+#include <linux/dma-noncoherent.h>
 #include <asm/cache.h>
 #include <asm/cacheflush.h>
 
-
-static void *arc_dma_alloc(struct device *dev, size_t size,
-		dma_addr_t *dma_handle, gfp_t gfp, unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	unsigned long order = get_order(size);
 	struct page *page;
@@ -89,7 +88,7 @@ static void *arc_dma_alloc(struct device *dev, size_t size,
 	return kvaddr;
 }
 
-static void arc_dma_free(struct device *dev, size_t size, void *vaddr,
+void arch_dma_free(struct device *dev, size_t size, void *vaddr,
 		dma_addr_t dma_handle, unsigned long attrs)
 {
 	phys_addr_t paddr = dma_handle;
@@ -105,9 +104,9 @@ static void arc_dma_free(struct device *dev, size_t size, void *vaddr,
 	__free_pages(page, get_order(size));
 }
 
-static int arc_dma_mmap(struct device *dev, struct vm_area_struct *vma,
-			void *cpu_addr, dma_addr_t dma_addr, size_t size,
-			unsigned long attrs)
+int arch_dma_mmap(struct device *dev, struct vm_area_struct *vma,
+		void *cpu_addr, dma_addr_t dma_addr, size_t size,
+		unsigned long attrs)
 {
 	unsigned long user_count = vma_pages(vma);
 	unsigned long count = PAGE_ALIGN(size) >> PAGE_SHIFT;
@@ -135,7 +134,7 @@ static int arc_dma_mmap(struct device *dev, struct vm_area_struct *vma,
  * CPU accesses page via normal paddr, thus needs to explicitly made
  * consistent before each use
  */
-static void _dma_cache_sync(phys_addr_t paddr, size_t size,
+static void _dma_cache_sync(struct device *dev, phys_addr_t paddr size_t size,
 		enum dma_data_direction dir)
 {
 	switch (dir) {
@@ -153,126 +152,14 @@ static void _dma_cache_sync(phys_addr_t paddr, size_t size,
 	}
 }
 
-/*
- * arc_dma_map_page - map a portion of a page for streaming DMA
- *
- * Ensure that any data held in the cache is appropriately discarded
- * or written back.
- *
- * The device owns this memory once this call has completed.  The CPU
- * can regain ownership by calling dma_unmap_page().
- *
- * Note: while it takes struct page as arg, caller can "abuse" it to pass
- * a region larger than PAGE_SIZE, provided it is physically contiguous
- * and this still works correctly
- */
-static dma_addr_t arc_dma_map_page(struct device *dev, struct page *page,
-		unsigned long offset, size_t size, enum dma_data_direction dir,
-		unsigned long attrs)
-{
-	phys_addr_t paddr = page_to_phys(page) + offset;
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		_dma_cache_sync(paddr, size, dir);
-
-	return paddr;
-}
-
-/*
- * arc_dma_unmap_page - unmap a buffer previously mapped through dma_map_page()
- *
- * After this call, reads by the CPU to the buffer are guaranteed to see
- * whatever the device wrote there.
- *
- * Note: historically this routine was not implemented for ARC
- */
-static void arc_dma_unmap_page(struct device *dev, dma_addr_t handle,
-			       size_t size, enum dma_data_direction dir,
-			       unsigned long attrs)
-{
-	phys_addr_t paddr = handle;
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		_dma_cache_sync(paddr, size, dir);
-}
-
-static int arc_dma_map_sg(struct device *dev, struct scatterlist *sg,
-	   int nents, enum dma_data_direction dir, unsigned long attrs)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nents, i)
-		s->dma_address = dma_map_page(dev, sg_page(s), s->offset,
-					       s->length, dir);
-
-	return nents;
-}
-
-static void arc_dma_unmap_sg(struct device *dev, struct scatterlist *sg,
-			     int nents, enum dma_data_direction dir,
-			     unsigned long attrs)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nents, i)
-		arc_dma_unmap_page(dev, sg_dma_address(s), sg_dma_len(s), dir,
-				   attrs);
-}
-
-static void arc_dma_sync_single_for_cpu(struct device *dev,
-		dma_addr_t dma_handle, size_t size, enum dma_data_direction dir)
-{
-	_dma_cache_sync(dma_handle, size, DMA_FROM_DEVICE);
-}
-
-static void arc_dma_sync_single_for_device(struct device *dev,
-		dma_addr_t dma_handle, size_t size, enum dma_data_direction dir)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	_dma_cache_sync(dma_handle, size, DMA_TO_DEVICE);
+	return _dma_cache_sync(dev, paddr, size, dir);
 }
 
-static void arc_dma_sync_sg_for_cpu(struct device *dev,
-		struct scatterlist *sglist, int nelems,
-		enum dma_data_direction dir)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	int i;
-	struct scatterlist *sg;
-
-	for_each_sg(sglist, sg, nelems, i)
-		_dma_cache_sync(sg_phys(sg), sg->length, dir);
+	return _dma_cache_sync(dev, paddr, size, dir);
 }
-
-static void arc_dma_sync_sg_for_device(struct device *dev,
-		struct scatterlist *sglist, int nelems,
-		enum dma_data_direction dir)
-{
-	int i;
-	struct scatterlist *sg;
-
-	for_each_sg(sglist, sg, nelems, i)
-		_dma_cache_sync(sg_phys(sg), sg->length, dir);
-}
-
-static int arc_dma_supported(struct device *dev, u64 dma_mask)
-{
-	/* Support 32 bit DMA mask exclusively */
-	return dma_mask == DMA_BIT_MASK(32);
-}
-
-const struct dma_map_ops arc_dma_ops = {
-	.alloc			= arc_dma_alloc,
-	.free			= arc_dma_free,
-	.mmap			= arc_dma_mmap,
-	.map_page		= arc_dma_map_page,
-	.unmap_page		= arc_dma_unmap_page,
-	.map_sg			= arc_dma_map_sg,
-	.unmap_sg		= arc_dma_unmap_sg,
-	.sync_single_for_device	= arc_dma_sync_single_for_device,
-	.sync_single_for_cpu	= arc_dma_sync_single_for_cpu,
-	.sync_sg_for_cpu	= arc_dma_sync_sg_for_cpu,
-	.sync_sg_for_device	= arc_dma_sync_sg_for_device,
-	.dma_supported		= arc_dma_supported,
-};
-EXPORT_SYMBOL(arc_dma_ops);
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 07/22] arm-nommu: use generic dma_noncoherent_ops
  2018-04-20  8:02 ` Christoph Hellwig
                     ` (4 preceding siblings ...)
  (?)
@ 2018-04-20  8:02   ` Christoph Hellwig
  -1 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:02 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Switch to the generic noncoherent direct mapping implementation for
the nommu dma map implementation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/arc/Kconfig                |   1 +
 arch/arm/Kconfig                |   4 +
 arch/arm/mm/dma-mapping-nommu.c | 139 +++++---------------------------
 3 files changed, 23 insertions(+), 121 deletions(-)

diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index 89d47eac18b2..3a492a9aeaad 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -9,6 +9,7 @@
 config ARC
 	def_bool y
 	select ARC_TIMERS
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select ARCH_HAS_SYNC_DMA_FOR_CPU
 	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select ARCH_HAS_SG_CHAIN
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index f91f69174630..eacc45ac4e77 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -12,6 +12,8 @@ config ARM
 	select ARCH_HAS_PHYS_TO_DMA
 	select ARCH_HAS_STRICT_KERNEL_RWX if MMU && !XIP_KERNEL
 	select ARCH_HAS_STRICT_MODULE_RWX if MMU
+	select ARCH_HAS_SYNC_DMA_FOR_CPU if !MMU
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE if !MMU
 	select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
 	select ARCH_HAVE_CUSTOM_GPIO_H
 	select ARCH_HAS_GCOV_PROFILE_ALL
@@ -27,6 +29,8 @@ config ARM
 	select CPU_PM if (SUSPEND || CPU_IDLE)
 	select DCACHE_WORD_ACCESS if HAVE_EFFICIENT_UNALIGNED_ACCESS
 	select DMA_DIRECT_OPS if !MMU
+	select DMA_NONCOHERENT_OPS if !MMU
+	select DMA_NONCOHERENT_MMAP if !MMU
 	select EDAC_SUPPORT
 	select EDAC_ATOMIC_SCRUB
 	select GENERIC_ALLOCATOR
diff --git a/arch/arm/mm/dma-mapping-nommu.c b/arch/arm/mm/dma-mapping-nommu.c
index f448a0663b10..a74ed6632982 100644
--- a/arch/arm/mm/dma-mapping-nommu.c
+++ b/arch/arm/mm/dma-mapping-nommu.c
@@ -12,6 +12,7 @@
 #include <linux/export.h>
 #include <linux/mm.h>
 #include <linux/dma-direct.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/scatterlist.h>
 
 #include <asm/cachetype.h>
@@ -26,18 +27,16 @@
  *   - MMU/MPU is off
  *   - cpu is v7m w/o cache support
  *   - device is coherent
- *  otherwise arm_nommu_dma_ops is used.
+ *  otherwise dma_noncoherent_ops is used.
  *
- *  arm_nommu_dma_ops rely on consistent DMA memory (please, refer to
+ *  dma_noncoherent_ops rely on consistent DMA memory (please, refer to
  *  [1] on how to declare such memory).
  *
  *  [1] Documentation/devicetree/bindings/reserved-memory/reserved-memory.txt
  */
 
-static void *arm_nommu_dma_alloc(struct device *dev, size_t size,
-				 dma_addr_t *dma_handle, gfp_t gfp,
-				 unsigned long attrs)
-
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	void *ret;
 
@@ -65,9 +64,8 @@ static void *arm_nommu_dma_alloc(struct device *dev, size_t size,
 	return ret;
 }
 
-static void arm_nommu_dma_free(struct device *dev, size_t size,
-			       void *cpu_addr, dma_addr_t dma_addr,
-			       unsigned long attrs)
+void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
+		dma_addr_t dma_addr, unsigned long attrs)
 {
 	if (attrs & DMA_ATTR_NON_CONSISTENT) {
 		dma_direct_free(dev, size, cpu_addr, dma_addr, attrs);
@@ -81,9 +79,9 @@ static void arm_nommu_dma_free(struct device *dev, size_t size,
 	return;
 }
 
-static int arm_nommu_dma_mmap(struct device *dev, struct vm_area_struct *vma,
-			      void *cpu_addr, dma_addr_t dma_addr, size_t size,
-			      unsigned long attrs)
+int arch_dma_mmap(struct device *dev, struct vm_area_struct *vma,
+		void *cpu_addr, dma_addr_t dma_addr, size_t size,
+		unsigned long attrs)
 {
 	int ret;
 
@@ -93,9 +91,8 @@ static int arm_nommu_dma_mmap(struct device *dev, struct vm_area_struct *vma,
 	return dma_common_mmap(dev, vma, cpu_addr, dma_addr, size);
 }
 
-
-static void __dma_page_cpu_to_dev(phys_addr_t paddr, size_t size,
-				  enum dma_data_direction dir)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
 	dmac_map_area(__va(paddr), size, dir);
 
@@ -105,8 +102,8 @@ static void __dma_page_cpu_to_dev(phys_addr_t paddr, size_t size,
 		outer_clean_range(paddr, paddr + size);
 }
 
-static void __dma_page_dev_to_cpu(phys_addr_t paddr, size_t size,
-				  enum dma_data_direction dir)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
 	if (dir != DMA_TO_DEVICE) {
 		outer_inv_range(paddr, paddr + size);
@@ -114,110 +111,9 @@ static void __dma_page_dev_to_cpu(phys_addr_t paddr, size_t size,
 	}
 }
 
-static dma_addr_t arm_nommu_dma_map_page(struct device *dev, struct page *page,
-					 unsigned long offset, size_t size,
-					 enum dma_data_direction dir,
-					 unsigned long attrs)
-{
-	dma_addr_t handle = page_to_phys(page) + offset;
-
-	__dma_page_cpu_to_dev(handle, size, dir);
-
-	return handle;
-}
-
-static void arm_nommu_dma_unmap_page(struct device *dev, dma_addr_t handle,
-				     size_t size, enum dma_data_direction dir,
-				     unsigned long attrs)
-{
-	__dma_page_dev_to_cpu(handle, size, dir);
-}
-
-
-static int arm_nommu_dma_map_sg(struct device *dev, struct scatterlist *sgl,
-				int nents, enum dma_data_direction dir,
-				unsigned long attrs)
-{
-	int i;
-	struct scatterlist *sg;
-
-	for_each_sg(sgl, sg, nents, i) {
-		sg_dma_address(sg) = sg_phys(sg);
-		sg_dma_len(sg) = sg->length;
-		__dma_page_cpu_to_dev(sg_dma_address(sg), sg_dma_len(sg), dir);
-	}
-
-	return nents;
-}
-
-static void arm_nommu_dma_unmap_sg(struct device *dev, struct scatterlist *sgl,
-				   int nents, enum dma_data_direction dir,
-				   unsigned long attrs)
-{
-	struct scatterlist *sg;
-	int i;
-
-	for_each_sg(sgl, sg, nents, i)
-		__dma_page_dev_to_cpu(sg_dma_address(sg), sg_dma_len(sg), dir);
-}
-
-static void arm_nommu_dma_sync_single_for_device(struct device *dev,
-		dma_addr_t handle, size_t size, enum dma_data_direction dir)
-{
-	__dma_page_cpu_to_dev(handle, size, dir);
-}
-
-static void arm_nommu_dma_sync_single_for_cpu(struct device *dev,
-		dma_addr_t handle, size_t size, enum dma_data_direction dir)
-{
-	__dma_page_cpu_to_dev(handle, size, dir);
-}
-
-static void arm_nommu_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sgl,
-					     int nents, enum dma_data_direction dir)
-{
-	struct scatterlist *sg;
-	int i;
-
-	for_each_sg(sgl, sg, nents, i)
-		__dma_page_cpu_to_dev(sg_dma_address(sg), sg_dma_len(sg), dir);
-}
-
-static void arm_nommu_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sgl,
-					  int nents, enum dma_data_direction dir)
-{
-	struct scatterlist *sg;
-	int i;
-
-	for_each_sg(sgl, sg, nents, i)
-		__dma_page_dev_to_cpu(sg_dma_address(sg), sg_dma_len(sg), dir);
-}
-
-const struct dma_map_ops arm_nommu_dma_ops = {
-	.alloc			= arm_nommu_dma_alloc,
-	.free			= arm_nommu_dma_free,
-	.mmap			= arm_nommu_dma_mmap,
-	.map_page		= arm_nommu_dma_map_page,
-	.unmap_page		= arm_nommu_dma_unmap_page,
-	.map_sg			= arm_nommu_dma_map_sg,
-	.unmap_sg		= arm_nommu_dma_unmap_sg,
-	.sync_single_for_device	= arm_nommu_dma_sync_single_for_device,
-	.sync_single_for_cpu	= arm_nommu_dma_sync_single_for_cpu,
-	.sync_sg_for_device	= arm_nommu_dma_sync_sg_for_device,
-	.sync_sg_for_cpu	= arm_nommu_dma_sync_sg_for_cpu,
-};
-EXPORT_SYMBOL(arm_nommu_dma_ops);
-
-static const struct dma_map_ops *arm_nommu_get_dma_map_ops(bool coherent)
-{
-	return coherent ? &dma_direct_ops : &arm_nommu_dma_ops;
-}
-
 void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
 			const struct iommu_ops *iommu, bool coherent)
 {
-	const struct dma_map_ops *dma_ops;
-
 	if (IS_ENABLED(CONFIG_CPU_V7M)) {
 		/*
 		 * Cache support for v7m is optional, so can be treated as
@@ -233,9 +129,10 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
 		dev->archdata.dma_coherent = (get_cr() & CR_M) ? coherent : true;
 	}
 
-	dma_ops = arm_nommu_get_dma_map_ops(dev->archdata.dma_coherent);
-
-	set_dma_ops(dev, dma_ops);
+	if (dev->archdata.dma_coherent)
+		set_dma_ops(dev, &dma_direct_ops);
+	else
+		set_dma_ops(dev, &dma_noncoherent_ops);
 }
 
 void arch_teardown_dma_ops(struct device *dev)
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 07/22] arm-nommu: use generic dma_noncoherent_ops
@ 2018-04-20  8:02   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:02 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Switch to the generic noncoherent direct mapping implementation for
the nommu dma map implementation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/arc/Kconfig                |   1 +
 arch/arm/Kconfig                |   4 +
 arch/arm/mm/dma-mapping-nommu.c | 139 +++++---------------------------
 3 files changed, 23 insertions(+), 121 deletions(-)

diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index 89d47eac18b2..3a492a9aeaad 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -9,6 +9,7 @@
 config ARC
 	def_bool y
 	select ARC_TIMERS
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select ARCH_HAS_SYNC_DMA_FOR_CPU
 	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select ARCH_HAS_SG_CHAIN
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index f91f69174630..eacc45ac4e77 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -12,6 +12,8 @@ config ARM
 	select ARCH_HAS_PHYS_TO_DMA
 	select ARCH_HAS_STRICT_KERNEL_RWX if MMU && !XIP_KERNEL
 	select ARCH_HAS_STRICT_MODULE_RWX if MMU
+	select ARCH_HAS_SYNC_DMA_FOR_CPU if !MMU
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE if !MMU
 	select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
 	select ARCH_HAVE_CUSTOM_GPIO_H
 	select ARCH_HAS_GCOV_PROFILE_ALL
@@ -27,6 +29,8 @@ config ARM
 	select CPU_PM if (SUSPEND || CPU_IDLE)
 	select DCACHE_WORD_ACCESS if HAVE_EFFICIENT_UNALIGNED_ACCESS
 	select DMA_DIRECT_OPS if !MMU
+	select DMA_NONCOHERENT_OPS if !MMU
+	select DMA_NONCOHERENT_MMAP if !MMU
 	select EDAC_SUPPORT
 	select EDAC_ATOMIC_SCRUB
 	select GENERIC_ALLOCATOR
diff --git a/arch/arm/mm/dma-mapping-nommu.c b/arch/arm/mm/dma-mapping-nommu.c
index f448a0663b10..a74ed6632982 100644
--- a/arch/arm/mm/dma-mapping-nommu.c
+++ b/arch/arm/mm/dma-mapping-nommu.c
@@ -12,6 +12,7 @@
 #include <linux/export.h>
 #include <linux/mm.h>
 #include <linux/dma-direct.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/scatterlist.h>
 
 #include <asm/cachetype.h>
@@ -26,18 +27,16 @@
  *   - MMU/MPU is off
  *   - cpu is v7m w/o cache support
  *   - device is coherent
- *  otherwise arm_nommu_dma_ops is used.
+ *  otherwise dma_noncoherent_ops is used.
  *
- *  arm_nommu_dma_ops rely on consistent DMA memory (please, refer to
+ *  dma_noncoherent_ops rely on consistent DMA memory (please, refer to
  *  [1] on how to declare such memory).
  *
  *  [1] Documentation/devicetree/bindings/reserved-memory/reserved-memory.txt
  */
 
-static void *arm_nommu_dma_alloc(struct device *dev, size_t size,
-				 dma_addr_t *dma_handle, gfp_t gfp,
-				 unsigned long attrs)
-
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	void *ret;
 
@@ -65,9 +64,8 @@ static void *arm_nommu_dma_alloc(struct device *dev, size_t size,
 	return ret;
 }
 
-static void arm_nommu_dma_free(struct device *dev, size_t size,
-			       void *cpu_addr, dma_addr_t dma_addr,
-			       unsigned long attrs)
+void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
+		dma_addr_t dma_addr, unsigned long attrs)
 {
 	if (attrs & DMA_ATTR_NON_CONSISTENT) {
 		dma_direct_free(dev, size, cpu_addr, dma_addr, attrs);
@@ -81,9 +79,9 @@ static void arm_nommu_dma_free(struct device *dev, size_t size,
 	return;
 }
 
-static int arm_nommu_dma_mmap(struct device *dev, struct vm_area_struct *vma,
-			      void *cpu_addr, dma_addr_t dma_addr, size_t size,
-			      unsigned long attrs)
+int arch_dma_mmap(struct device *dev, struct vm_area_struct *vma,
+		void *cpu_addr, dma_addr_t dma_addr, size_t size,
+		unsigned long attrs)
 {
 	int ret;
 
@@ -93,9 +91,8 @@ static int arm_nommu_dma_mmap(struct device *dev, struct vm_area_struct *vma,
 	return dma_common_mmap(dev, vma, cpu_addr, dma_addr, size);
 }
 
-
-static void __dma_page_cpu_to_dev(phys_addr_t paddr, size_t size,
-				  enum dma_data_direction dir)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
 	dmac_map_area(__va(paddr), size, dir);
 
@@ -105,8 +102,8 @@ static void __dma_page_cpu_to_dev(phys_addr_t paddr, size_t size,
 		outer_clean_range(paddr, paddr + size);
 }
 
-static void __dma_page_dev_to_cpu(phys_addr_t paddr, size_t size,
-				  enum dma_data_direction dir)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
 	if (dir != DMA_TO_DEVICE) {
 		outer_inv_range(paddr, paddr + size);
@@ -114,110 +111,9 @@ static void __dma_page_dev_to_cpu(phys_addr_t paddr, size_t size,
 	}
 }
 
-static dma_addr_t arm_nommu_dma_map_page(struct device *dev, struct page *page,
-					 unsigned long offset, size_t size,
-					 enum dma_data_direction dir,
-					 unsigned long attrs)
-{
-	dma_addr_t handle = page_to_phys(page) + offset;
-
-	__dma_page_cpu_to_dev(handle, size, dir);
-
-	return handle;
-}
-
-static void arm_nommu_dma_unmap_page(struct device *dev, dma_addr_t handle,
-				     size_t size, enum dma_data_direction dir,
-				     unsigned long attrs)
-{
-	__dma_page_dev_to_cpu(handle, size, dir);
-}
-
-
-static int arm_nommu_dma_map_sg(struct device *dev, struct scatterlist *sgl,
-				int nents, enum dma_data_direction dir,
-				unsigned long attrs)
-{
-	int i;
-	struct scatterlist *sg;
-
-	for_each_sg(sgl, sg, nents, i) {
-		sg_dma_address(sg) = sg_phys(sg);
-		sg_dma_len(sg) = sg->length;
-		__dma_page_cpu_to_dev(sg_dma_address(sg), sg_dma_len(sg), dir);
-	}
-
-	return nents;
-}
-
-static void arm_nommu_dma_unmap_sg(struct device *dev, struct scatterlist *sgl,
-				   int nents, enum dma_data_direction dir,
-				   unsigned long attrs)
-{
-	struct scatterlist *sg;
-	int i;
-
-	for_each_sg(sgl, sg, nents, i)
-		__dma_page_dev_to_cpu(sg_dma_address(sg), sg_dma_len(sg), dir);
-}
-
-static void arm_nommu_dma_sync_single_for_device(struct device *dev,
-		dma_addr_t handle, size_t size, enum dma_data_direction dir)
-{
-	__dma_page_cpu_to_dev(handle, size, dir);
-}
-
-static void arm_nommu_dma_sync_single_for_cpu(struct device *dev,
-		dma_addr_t handle, size_t size, enum dma_data_direction dir)
-{
-	__dma_page_cpu_to_dev(handle, size, dir);
-}
-
-static void arm_nommu_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sgl,
-					     int nents, enum dma_data_direction dir)
-{
-	struct scatterlist *sg;
-	int i;
-
-	for_each_sg(sgl, sg, nents, i)
-		__dma_page_cpu_to_dev(sg_dma_address(sg), sg_dma_len(sg), dir);
-}
-
-static void arm_nommu_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sgl,
-					  int nents, enum dma_data_direction dir)
-{
-	struct scatterlist *sg;
-	int i;
-
-	for_each_sg(sgl, sg, nents, i)
-		__dma_page_dev_to_cpu(sg_dma_address(sg), sg_dma_len(sg), dir);
-}
-
-const struct dma_map_ops arm_nommu_dma_ops = {
-	.alloc			= arm_nommu_dma_alloc,
-	.free			= arm_nommu_dma_free,
-	.mmap			= arm_nommu_dma_mmap,
-	.map_page		= arm_nommu_dma_map_page,
-	.unmap_page		= arm_nommu_dma_unmap_page,
-	.map_sg			= arm_nommu_dma_map_sg,
-	.unmap_sg		= arm_nommu_dma_unmap_sg,
-	.sync_single_for_device	= arm_nommu_dma_sync_single_for_device,
-	.sync_single_for_cpu	= arm_nommu_dma_sync_single_for_cpu,
-	.sync_sg_for_device	= arm_nommu_dma_sync_sg_for_device,
-	.sync_sg_for_cpu	= arm_nommu_dma_sync_sg_for_cpu,
-};
-EXPORT_SYMBOL(arm_nommu_dma_ops);
-
-static const struct dma_map_ops *arm_nommu_get_dma_map_ops(bool coherent)
-{
-	return coherent ? &dma_direct_ops : &arm_nommu_dma_ops;
-}
-
 void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
 			const struct iommu_ops *iommu, bool coherent)
 {
-	const struct dma_map_ops *dma_ops;
-
 	if (IS_ENABLED(CONFIG_CPU_V7M)) {
 		/*
 		 * Cache support for v7m is optional, so can be treated as
@@ -233,9 +129,10 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
 		dev->archdata.dma_coherent = (get_cr() & CR_M) ? coherent : true;
 	}
 
-	dma_ops = arm_nommu_get_dma_map_ops(dev->archdata.dma_coherent);
-
-	set_dma_ops(dev, dma_ops);
+	if (dev->archdata.dma_coherent)
+		set_dma_ops(dev, &dma_direct_ops);
+	else
+		set_dma_ops(dev, &dma_noncoherent_ops);
 }
 
 void arch_teardown_dma_ops(struct device *dev)
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 07/22] arm-nommu: use generic dma_noncoherent_ops
@ 2018-04-20  8:02   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:02 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Switch to the generic noncoherent direct mapping implementation for
the nommu dma map implementation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/arc/Kconfig                |   1 +
 arch/arm/Kconfig                |   4 +
 arch/arm/mm/dma-mapping-nommu.c | 139 +++++---------------------------
 3 files changed, 23 insertions(+), 121 deletions(-)

diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index 89d47eac18b2..3a492a9aeaad 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -9,6 +9,7 @@
 config ARC
 	def_bool y
 	select ARC_TIMERS
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select ARCH_HAS_SYNC_DMA_FOR_CPU
 	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select ARCH_HAS_SG_CHAIN
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index f91f69174630..eacc45ac4e77 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -12,6 +12,8 @@ config ARM
 	select ARCH_HAS_PHYS_TO_DMA
 	select ARCH_HAS_STRICT_KERNEL_RWX if MMU && !XIP_KERNEL
 	select ARCH_HAS_STRICT_MODULE_RWX if MMU
+	select ARCH_HAS_SYNC_DMA_FOR_CPU if !MMU
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE if !MMU
 	select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
 	select ARCH_HAVE_CUSTOM_GPIO_H
 	select ARCH_HAS_GCOV_PROFILE_ALL
@@ -27,6 +29,8 @@ config ARM
 	select CPU_PM if (SUSPEND || CPU_IDLE)
 	select DCACHE_WORD_ACCESS if HAVE_EFFICIENT_UNALIGNED_ACCESS
 	select DMA_DIRECT_OPS if !MMU
+	select DMA_NONCOHERENT_OPS if !MMU
+	select DMA_NONCOHERENT_MMAP if !MMU
 	select EDAC_SUPPORT
 	select EDAC_ATOMIC_SCRUB
 	select GENERIC_ALLOCATOR
diff --git a/arch/arm/mm/dma-mapping-nommu.c b/arch/arm/mm/dma-mapping-nommu.c
index f448a0663b10..a74ed6632982 100644
--- a/arch/arm/mm/dma-mapping-nommu.c
+++ b/arch/arm/mm/dma-mapping-nommu.c
@@ -12,6 +12,7 @@
 #include <linux/export.h>
 #include <linux/mm.h>
 #include <linux/dma-direct.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/scatterlist.h>
 
 #include <asm/cachetype.h>
@@ -26,18 +27,16 @@
  *   - MMU/MPU is off
  *   - cpu is v7m w/o cache support
  *   - device is coherent
- *  otherwise arm_nommu_dma_ops is used.
+ *  otherwise dma_noncoherent_ops is used.
  *
- *  arm_nommu_dma_ops rely on consistent DMA memory (please, refer to
+ *  dma_noncoherent_ops rely on consistent DMA memory (please, refer to
  *  [1] on how to declare such memory).
  *
  *  [1] Documentation/devicetree/bindings/reserved-memory/reserved-memory.txt
  */
 
-static void *arm_nommu_dma_alloc(struct device *dev, size_t size,
-				 dma_addr_t *dma_handle, gfp_t gfp,
-				 unsigned long attrs)
-
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	void *ret;
 
@@ -65,9 +64,8 @@ static void *arm_nommu_dma_alloc(struct device *dev, size_t size,
 	return ret;
 }
 
-static void arm_nommu_dma_free(struct device *dev, size_t size,
-			       void *cpu_addr, dma_addr_t dma_addr,
-			       unsigned long attrs)
+void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
+		dma_addr_t dma_addr, unsigned long attrs)
 {
 	if (attrs & DMA_ATTR_NON_CONSISTENT) {
 		dma_direct_free(dev, size, cpu_addr, dma_addr, attrs);
@@ -81,9 +79,9 @@ static void arm_nommu_dma_free(struct device *dev, size_t size,
 	return;
 }
 
-static int arm_nommu_dma_mmap(struct device *dev, struct vm_area_struct *vma,
-			      void *cpu_addr, dma_addr_t dma_addr, size_t size,
-			      unsigned long attrs)
+int arch_dma_mmap(struct device *dev, struct vm_area_struct *vma,
+		void *cpu_addr, dma_addr_t dma_addr, size_t size,
+		unsigned long attrs)
 {
 	int ret;
 
@@ -93,9 +91,8 @@ static int arm_nommu_dma_mmap(struct device *dev, struct vm_area_struct *vma,
 	return dma_common_mmap(dev, vma, cpu_addr, dma_addr, size);
 }
 
-
-static void __dma_page_cpu_to_dev(phys_addr_t paddr, size_t size,
-				  enum dma_data_direction dir)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
 	dmac_map_area(__va(paddr), size, dir);
 
@@ -105,8 +102,8 @@ static void __dma_page_cpu_to_dev(phys_addr_t paddr, size_t size,
 		outer_clean_range(paddr, paddr + size);
 }
 
-static void __dma_page_dev_to_cpu(phys_addr_t paddr, size_t size,
-				  enum dma_data_direction dir)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
 	if (dir != DMA_TO_DEVICE) {
 		outer_inv_range(paddr, paddr + size);
@@ -114,110 +111,9 @@ static void __dma_page_dev_to_cpu(phys_addr_t paddr, size_t size,
 	}
 }
 
-static dma_addr_t arm_nommu_dma_map_page(struct device *dev, struct page *page,
-					 unsigned long offset, size_t size,
-					 enum dma_data_direction dir,
-					 unsigned long attrs)
-{
-	dma_addr_t handle = page_to_phys(page) + offset;
-
-	__dma_page_cpu_to_dev(handle, size, dir);
-
-	return handle;
-}
-
-static void arm_nommu_dma_unmap_page(struct device *dev, dma_addr_t handle,
-				     size_t size, enum dma_data_direction dir,
-				     unsigned long attrs)
-{
-	__dma_page_dev_to_cpu(handle, size, dir);
-}
-
-
-static int arm_nommu_dma_map_sg(struct device *dev, struct scatterlist *sgl,
-				int nents, enum dma_data_direction dir,
-				unsigned long attrs)
-{
-	int i;
-	struct scatterlist *sg;
-
-	for_each_sg(sgl, sg, nents, i) {
-		sg_dma_address(sg) = sg_phys(sg);
-		sg_dma_len(sg) = sg->length;
-		__dma_page_cpu_to_dev(sg_dma_address(sg), sg_dma_len(sg), dir);
-	}
-
-	return nents;
-}
-
-static void arm_nommu_dma_unmap_sg(struct device *dev, struct scatterlist *sgl,
-				   int nents, enum dma_data_direction dir,
-				   unsigned long attrs)
-{
-	struct scatterlist *sg;
-	int i;
-
-	for_each_sg(sgl, sg, nents, i)
-		__dma_page_dev_to_cpu(sg_dma_address(sg), sg_dma_len(sg), dir);
-}
-
-static void arm_nommu_dma_sync_single_for_device(struct device *dev,
-		dma_addr_t handle, size_t size, enum dma_data_direction dir)
-{
-	__dma_page_cpu_to_dev(handle, size, dir);
-}
-
-static void arm_nommu_dma_sync_single_for_cpu(struct device *dev,
-		dma_addr_t handle, size_t size, enum dma_data_direction dir)
-{
-	__dma_page_cpu_to_dev(handle, size, dir);
-}
-
-static void arm_nommu_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sgl,
-					     int nents, enum dma_data_direction dir)
-{
-	struct scatterlist *sg;
-	int i;
-
-	for_each_sg(sgl, sg, nents, i)
-		__dma_page_cpu_to_dev(sg_dma_address(sg), sg_dma_len(sg), dir);
-}
-
-static void arm_nommu_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sgl,
-					  int nents, enum dma_data_direction dir)
-{
-	struct scatterlist *sg;
-	int i;
-
-	for_each_sg(sgl, sg, nents, i)
-		__dma_page_dev_to_cpu(sg_dma_address(sg), sg_dma_len(sg), dir);
-}
-
-const struct dma_map_ops arm_nommu_dma_ops = {
-	.alloc			= arm_nommu_dma_alloc,
-	.free			= arm_nommu_dma_free,
-	.mmap			= arm_nommu_dma_mmap,
-	.map_page		= arm_nommu_dma_map_page,
-	.unmap_page		= arm_nommu_dma_unmap_page,
-	.map_sg			= arm_nommu_dma_map_sg,
-	.unmap_sg		= arm_nommu_dma_unmap_sg,
-	.sync_single_for_device	= arm_nommu_dma_sync_single_for_device,
-	.sync_single_for_cpu	= arm_nommu_dma_sync_single_for_cpu,
-	.sync_sg_for_device	= arm_nommu_dma_sync_sg_for_device,
-	.sync_sg_for_cpu	= arm_nommu_dma_sync_sg_for_cpu,
-};
-EXPORT_SYMBOL(arm_nommu_dma_ops);
-
-static const struct dma_map_ops *arm_nommu_get_dma_map_ops(bool coherent)
-{
-	return coherent ? &dma_direct_ops : &arm_nommu_dma_ops;
-}
-
 void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
 			const struct iommu_ops *iommu, bool coherent)
 {
-	const struct dma_map_ops *dma_ops;
-
 	if (IS_ENABLED(CONFIG_CPU_V7M)) {
 		/*
 		 * Cache support for v7m is optional, so can be treated as
@@ -233,9 +129,10 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
 		dev->archdata.dma_coherent = (get_cr() & CR_M) ? coherent : true;
 	}
 
-	dma_ops = arm_nommu_get_dma_map_ops(dev->archdata.dma_coherent);
-
-	set_dma_ops(dev, dma_ops);
+	if (dev->archdata.dma_coherent)
+		set_dma_ops(dev, &dma_direct_ops);
+	else
+		set_dma_ops(dev, &dma_noncoherent_ops);
 }
 
 void arch_teardown_dma_ops(struct device *dev)
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 07/22] arm-nommu: use generic dma_noncoherent_ops
@ 2018-04-20  8:02   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:02 UTC (permalink / raw)
  To: linux-snps-arc

Switch to the generic noncoherent direct mapping implementation for
the nommu dma map implementation.

Signed-off-by: Christoph Hellwig <hch at lst.de>
---
 arch/arc/Kconfig                |   1 +
 arch/arm/Kconfig                |   4 +
 arch/arm/mm/dma-mapping-nommu.c | 139 +++++---------------------------
 3 files changed, 23 insertions(+), 121 deletions(-)

diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index 89d47eac18b2..3a492a9aeaad 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -9,6 +9,7 @@
 config ARC
 	def_bool y
 	select ARC_TIMERS
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select ARCH_HAS_SYNC_DMA_FOR_CPU
 	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select ARCH_HAS_SG_CHAIN
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index f91f69174630..eacc45ac4e77 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -12,6 +12,8 @@ config ARM
 	select ARCH_HAS_PHYS_TO_DMA
 	select ARCH_HAS_STRICT_KERNEL_RWX if MMU && !XIP_KERNEL
 	select ARCH_HAS_STRICT_MODULE_RWX if MMU
+	select ARCH_HAS_SYNC_DMA_FOR_CPU if !MMU
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE if !MMU
 	select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
 	select ARCH_HAVE_CUSTOM_GPIO_H
 	select ARCH_HAS_GCOV_PROFILE_ALL
@@ -27,6 +29,8 @@ config ARM
 	select CPU_PM if (SUSPEND || CPU_IDLE)
 	select DCACHE_WORD_ACCESS if HAVE_EFFICIENT_UNALIGNED_ACCESS
 	select DMA_DIRECT_OPS if !MMU
+	select DMA_NONCOHERENT_OPS if !MMU
+	select DMA_NONCOHERENT_MMAP if !MMU
 	select EDAC_SUPPORT
 	select EDAC_ATOMIC_SCRUB
 	select GENERIC_ALLOCATOR
diff --git a/arch/arm/mm/dma-mapping-nommu.c b/arch/arm/mm/dma-mapping-nommu.c
index f448a0663b10..a74ed6632982 100644
--- a/arch/arm/mm/dma-mapping-nommu.c
+++ b/arch/arm/mm/dma-mapping-nommu.c
@@ -12,6 +12,7 @@
 #include <linux/export.h>
 #include <linux/mm.h>
 #include <linux/dma-direct.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/scatterlist.h>
 
 #include <asm/cachetype.h>
@@ -26,18 +27,16 @@
  *   - MMU/MPU is off
  *   - cpu is v7m w/o cache support
  *   - device is coherent
- *  otherwise arm_nommu_dma_ops is used.
+ *  otherwise dma_noncoherent_ops is used.
  *
- *  arm_nommu_dma_ops rely on consistent DMA memory (please, refer to
+ *  dma_noncoherent_ops rely on consistent DMA memory (please, refer to
  *  [1] on how to declare such memory).
  *
  *  [1] Documentation/devicetree/bindings/reserved-memory/reserved-memory.txt
  */
 
-static void *arm_nommu_dma_alloc(struct device *dev, size_t size,
-				 dma_addr_t *dma_handle, gfp_t gfp,
-				 unsigned long attrs)
-
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	void *ret;
 
@@ -65,9 +64,8 @@ static void *arm_nommu_dma_alloc(struct device *dev, size_t size,
 	return ret;
 }
 
-static void arm_nommu_dma_free(struct device *dev, size_t size,
-			       void *cpu_addr, dma_addr_t dma_addr,
-			       unsigned long attrs)
+void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
+		dma_addr_t dma_addr, unsigned long attrs)
 {
 	if (attrs & DMA_ATTR_NON_CONSISTENT) {
 		dma_direct_free(dev, size, cpu_addr, dma_addr, attrs);
@@ -81,9 +79,9 @@ static void arm_nommu_dma_free(struct device *dev, size_t size,
 	return;
 }
 
-static int arm_nommu_dma_mmap(struct device *dev, struct vm_area_struct *vma,
-			      void *cpu_addr, dma_addr_t dma_addr, size_t size,
-			      unsigned long attrs)
+int arch_dma_mmap(struct device *dev, struct vm_area_struct *vma,
+		void *cpu_addr, dma_addr_t dma_addr, size_t size,
+		unsigned long attrs)
 {
 	int ret;
 
@@ -93,9 +91,8 @@ static int arm_nommu_dma_mmap(struct device *dev, struct vm_area_struct *vma,
 	return dma_common_mmap(dev, vma, cpu_addr, dma_addr, size);
 }
 
-
-static void __dma_page_cpu_to_dev(phys_addr_t paddr, size_t size,
-				  enum dma_data_direction dir)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
 	dmac_map_area(__va(paddr), size, dir);
 
@@ -105,8 +102,8 @@ static void __dma_page_cpu_to_dev(phys_addr_t paddr, size_t size,
 		outer_clean_range(paddr, paddr + size);
 }
 
-static void __dma_page_dev_to_cpu(phys_addr_t paddr, size_t size,
-				  enum dma_data_direction dir)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
 	if (dir != DMA_TO_DEVICE) {
 		outer_inv_range(paddr, paddr + size);
@@ -114,110 +111,9 @@ static void __dma_page_dev_to_cpu(phys_addr_t paddr, size_t size,
 	}
 }
 
-static dma_addr_t arm_nommu_dma_map_page(struct device *dev, struct page *page,
-					 unsigned long offset, size_t size,
-					 enum dma_data_direction dir,
-					 unsigned long attrs)
-{
-	dma_addr_t handle = page_to_phys(page) + offset;
-
-	__dma_page_cpu_to_dev(handle, size, dir);
-
-	return handle;
-}
-
-static void arm_nommu_dma_unmap_page(struct device *dev, dma_addr_t handle,
-				     size_t size, enum dma_data_direction dir,
-				     unsigned long attrs)
-{
-	__dma_page_dev_to_cpu(handle, size, dir);
-}
-
-
-static int arm_nommu_dma_map_sg(struct device *dev, struct scatterlist *sgl,
-				int nents, enum dma_data_direction dir,
-				unsigned long attrs)
-{
-	int i;
-	struct scatterlist *sg;
-
-	for_each_sg(sgl, sg, nents, i) {
-		sg_dma_address(sg) = sg_phys(sg);
-		sg_dma_len(sg) = sg->length;
-		__dma_page_cpu_to_dev(sg_dma_address(sg), sg_dma_len(sg), dir);
-	}
-
-	return nents;
-}
-
-static void arm_nommu_dma_unmap_sg(struct device *dev, struct scatterlist *sgl,
-				   int nents, enum dma_data_direction dir,
-				   unsigned long attrs)
-{
-	struct scatterlist *sg;
-	int i;
-
-	for_each_sg(sgl, sg, nents, i)
-		__dma_page_dev_to_cpu(sg_dma_address(sg), sg_dma_len(sg), dir);
-}
-
-static void arm_nommu_dma_sync_single_for_device(struct device *dev,
-		dma_addr_t handle, size_t size, enum dma_data_direction dir)
-{
-	__dma_page_cpu_to_dev(handle, size, dir);
-}
-
-static void arm_nommu_dma_sync_single_for_cpu(struct device *dev,
-		dma_addr_t handle, size_t size, enum dma_data_direction dir)
-{
-	__dma_page_cpu_to_dev(handle, size, dir);
-}
-
-static void arm_nommu_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sgl,
-					     int nents, enum dma_data_direction dir)
-{
-	struct scatterlist *sg;
-	int i;
-
-	for_each_sg(sgl, sg, nents, i)
-		__dma_page_cpu_to_dev(sg_dma_address(sg), sg_dma_len(sg), dir);
-}
-
-static void arm_nommu_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sgl,
-					  int nents, enum dma_data_direction dir)
-{
-	struct scatterlist *sg;
-	int i;
-
-	for_each_sg(sgl, sg, nents, i)
-		__dma_page_dev_to_cpu(sg_dma_address(sg), sg_dma_len(sg), dir);
-}
-
-const struct dma_map_ops arm_nommu_dma_ops = {
-	.alloc			= arm_nommu_dma_alloc,
-	.free			= arm_nommu_dma_free,
-	.mmap			= arm_nommu_dma_mmap,
-	.map_page		= arm_nommu_dma_map_page,
-	.unmap_page		= arm_nommu_dma_unmap_page,
-	.map_sg			= arm_nommu_dma_map_sg,
-	.unmap_sg		= arm_nommu_dma_unmap_sg,
-	.sync_single_for_device	= arm_nommu_dma_sync_single_for_device,
-	.sync_single_for_cpu	= arm_nommu_dma_sync_single_for_cpu,
-	.sync_sg_for_device	= arm_nommu_dma_sync_sg_for_device,
-	.sync_sg_for_cpu	= arm_nommu_dma_sync_sg_for_cpu,
-};
-EXPORT_SYMBOL(arm_nommu_dma_ops);
-
-static const struct dma_map_ops *arm_nommu_get_dma_map_ops(bool coherent)
-{
-	return coherent ? &dma_direct_ops : &arm_nommu_dma_ops;
-}
-
 void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
 			const struct iommu_ops *iommu, bool coherent)
 {
-	const struct dma_map_ops *dma_ops;
-
 	if (IS_ENABLED(CONFIG_CPU_V7M)) {
 		/*
 		 * Cache support for v7m is optional, so can be treated as
@@ -233,9 +129,10 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
 		dev->archdata.dma_coherent = (get_cr() & CR_M) ? coherent : true;
 	}
 
-	dma_ops = arm_nommu_get_dma_map_ops(dev->archdata.dma_coherent);
-
-	set_dma_ops(dev, dma_ops);
+	if (dev->archdata.dma_coherent)
+		set_dma_ops(dev, &dma_direct_ops);
+	else
+		set_dma_ops(dev, &dma_noncoherent_ops);
 }
 
 void arch_teardown_dma_ops(struct device *dev)
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 07/22] arm-nommu: use generic dma_noncoherent_ops
@ 2018-04-20  8:02   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:02 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Switch to the generic noncoherent direct mapping implementation for
the nommu dma map implementation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/arc/Kconfig                |   1 +
 arch/arm/Kconfig                |   4 +
 arch/arm/mm/dma-mapping-nommu.c | 139 +++++---------------------------
 3 files changed, 23 insertions(+), 121 deletions(-)

diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index 89d47eac18b2..3a492a9aeaad 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -9,6 +9,7 @@
 config ARC
 	def_bool y
 	select ARC_TIMERS
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select ARCH_HAS_SYNC_DMA_FOR_CPU
 	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select ARCH_HAS_SG_CHAIN
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index f91f69174630..eacc45ac4e77 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -12,6 +12,8 @@ config ARM
 	select ARCH_HAS_PHYS_TO_DMA
 	select ARCH_HAS_STRICT_KERNEL_RWX if MMU && !XIP_KERNEL
 	select ARCH_HAS_STRICT_MODULE_RWX if MMU
+	select ARCH_HAS_SYNC_DMA_FOR_CPU if !MMU
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE if !MMU
 	select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
 	select ARCH_HAVE_CUSTOM_GPIO_H
 	select ARCH_HAS_GCOV_PROFILE_ALL
@@ -27,6 +29,8 @@ config ARM
 	select CPU_PM if (SUSPEND || CPU_IDLE)
 	select DCACHE_WORD_ACCESS if HAVE_EFFICIENT_UNALIGNED_ACCESS
 	select DMA_DIRECT_OPS if !MMU
+	select DMA_NONCOHERENT_OPS if !MMU
+	select DMA_NONCOHERENT_MMAP if !MMU
 	select EDAC_SUPPORT
 	select EDAC_ATOMIC_SCRUB
 	select GENERIC_ALLOCATOR
diff --git a/arch/arm/mm/dma-mapping-nommu.c b/arch/arm/mm/dma-mapping-nommu.c
index f448a0663b10..a74ed6632982 100644
--- a/arch/arm/mm/dma-mapping-nommu.c
+++ b/arch/arm/mm/dma-mapping-nommu.c
@@ -12,6 +12,7 @@
 #include <linux/export.h>
 #include <linux/mm.h>
 #include <linux/dma-direct.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/scatterlist.h>
 
 #include <asm/cachetype.h>
@@ -26,18 +27,16 @@
  *   - MMU/MPU is off
  *   - cpu is v7m w/o cache support
  *   - device is coherent
- *  otherwise arm_nommu_dma_ops is used.
+ *  otherwise dma_noncoherent_ops is used.
  *
- *  arm_nommu_dma_ops rely on consistent DMA memory (please, refer to
+ *  dma_noncoherent_ops rely on consistent DMA memory (please, refer to
  *  [1] on how to declare such memory).
  *
  *  [1] Documentation/devicetree/bindings/reserved-memory/reserved-memory.txt
  */
 
-static void *arm_nommu_dma_alloc(struct device *dev, size_t size,
-				 dma_addr_t *dma_handle, gfp_t gfp,
-				 unsigned long attrs)
-
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	void *ret;
 
@@ -65,9 +64,8 @@ static void *arm_nommu_dma_alloc(struct device *dev, size_t size,
 	return ret;
 }
 
-static void arm_nommu_dma_free(struct device *dev, size_t size,
-			       void *cpu_addr, dma_addr_t dma_addr,
-			       unsigned long attrs)
+void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
+		dma_addr_t dma_addr, unsigned long attrs)
 {
 	if (attrs & DMA_ATTR_NON_CONSISTENT) {
 		dma_direct_free(dev, size, cpu_addr, dma_addr, attrs);
@@ -81,9 +79,9 @@ static void arm_nommu_dma_free(struct device *dev, size_t size,
 	return;
 }
 
-static int arm_nommu_dma_mmap(struct device *dev, struct vm_area_struct *vma,
-			      void *cpu_addr, dma_addr_t dma_addr, size_t size,
-			      unsigned long attrs)
+int arch_dma_mmap(struct device *dev, struct vm_area_struct *vma,
+		void *cpu_addr, dma_addr_t dma_addr, size_t size,
+		unsigned long attrs)
 {
 	int ret;
 
@@ -93,9 +91,8 @@ static int arm_nommu_dma_mmap(struct device *dev, struct vm_area_struct *vma,
 	return dma_common_mmap(dev, vma, cpu_addr, dma_addr, size);
 }
 
-
-static void __dma_page_cpu_to_dev(phys_addr_t paddr, size_t size,
-				  enum dma_data_direction dir)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
 	dmac_map_area(__va(paddr), size, dir);
 
@@ -105,8 +102,8 @@ static void __dma_page_cpu_to_dev(phys_addr_t paddr, size_t size,
 		outer_clean_range(paddr, paddr + size);
 }
 
-static void __dma_page_dev_to_cpu(phys_addr_t paddr, size_t size,
-				  enum dma_data_direction dir)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
 	if (dir != DMA_TO_DEVICE) {
 		outer_inv_range(paddr, paddr + size);
@@ -114,110 +111,9 @@ static void __dma_page_dev_to_cpu(phys_addr_t paddr, size_t size,
 	}
 }
 
-static dma_addr_t arm_nommu_dma_map_page(struct device *dev, struct page *page,
-					 unsigned long offset, size_t size,
-					 enum dma_data_direction dir,
-					 unsigned long attrs)
-{
-	dma_addr_t handle = page_to_phys(page) + offset;
-
-	__dma_page_cpu_to_dev(handle, size, dir);
-
-	return handle;
-}
-
-static void arm_nommu_dma_unmap_page(struct device *dev, dma_addr_t handle,
-				     size_t size, enum dma_data_direction dir,
-				     unsigned long attrs)
-{
-	__dma_page_dev_to_cpu(handle, size, dir);
-}
-
-
-static int arm_nommu_dma_map_sg(struct device *dev, struct scatterlist *sgl,
-				int nents, enum dma_data_direction dir,
-				unsigned long attrs)
-{
-	int i;
-	struct scatterlist *sg;
-
-	for_each_sg(sgl, sg, nents, i) {
-		sg_dma_address(sg) = sg_phys(sg);
-		sg_dma_len(sg) = sg->length;
-		__dma_page_cpu_to_dev(sg_dma_address(sg), sg_dma_len(sg), dir);
-	}
-
-	return nents;
-}
-
-static void arm_nommu_dma_unmap_sg(struct device *dev, struct scatterlist *sgl,
-				   int nents, enum dma_data_direction dir,
-				   unsigned long attrs)
-{
-	struct scatterlist *sg;
-	int i;
-
-	for_each_sg(sgl, sg, nents, i)
-		__dma_page_dev_to_cpu(sg_dma_address(sg), sg_dma_len(sg), dir);
-}
-
-static void arm_nommu_dma_sync_single_for_device(struct device *dev,
-		dma_addr_t handle, size_t size, enum dma_data_direction dir)
-{
-	__dma_page_cpu_to_dev(handle, size, dir);
-}
-
-static void arm_nommu_dma_sync_single_for_cpu(struct device *dev,
-		dma_addr_t handle, size_t size, enum dma_data_direction dir)
-{
-	__dma_page_cpu_to_dev(handle, size, dir);
-}
-
-static void arm_nommu_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sgl,
-					     int nents, enum dma_data_direction dir)
-{
-	struct scatterlist *sg;
-	int i;
-
-	for_each_sg(sgl, sg, nents, i)
-		__dma_page_cpu_to_dev(sg_dma_address(sg), sg_dma_len(sg), dir);
-}
-
-static void arm_nommu_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sgl,
-					  int nents, enum dma_data_direction dir)
-{
-	struct scatterlist *sg;
-	int i;
-
-	for_each_sg(sgl, sg, nents, i)
-		__dma_page_dev_to_cpu(sg_dma_address(sg), sg_dma_len(sg), dir);
-}
-
-const struct dma_map_ops arm_nommu_dma_ops = {
-	.alloc			= arm_nommu_dma_alloc,
-	.free			= arm_nommu_dma_free,
-	.mmap			= arm_nommu_dma_mmap,
-	.map_page		= arm_nommu_dma_map_page,
-	.unmap_page		= arm_nommu_dma_unmap_page,
-	.map_sg			= arm_nommu_dma_map_sg,
-	.unmap_sg		= arm_nommu_dma_unmap_sg,
-	.sync_single_for_device	= arm_nommu_dma_sync_single_for_device,
-	.sync_single_for_cpu	= arm_nommu_dma_sync_single_for_cpu,
-	.sync_sg_for_device	= arm_nommu_dma_sync_sg_for_device,
-	.sync_sg_for_cpu	= arm_nommu_dma_sync_sg_for_cpu,
-};
-EXPORT_SYMBOL(arm_nommu_dma_ops);
-
-static const struct dma_map_ops *arm_nommu_get_dma_map_ops(bool coherent)
-{
-	return coherent ? &dma_direct_ops : &arm_nommu_dma_ops;
-}
-
 void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
 			const struct iommu_ops *iommu, bool coherent)
 {
-	const struct dma_map_ops *dma_ops;
-
 	if (IS_ENABLED(CONFIG_CPU_V7M)) {
 		/*
 		 * Cache support for v7m is optional, so can be treated as
@@ -233,9 +129,10 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
 		dev->archdata.dma_coherent = (get_cr() & CR_M) ? coherent : true;
 	}
 
-	dma_ops = arm_nommu_get_dma_map_ops(dev->archdata.dma_coherent);
-
-	set_dma_ops(dev, dma_ops);
+	if (dev->archdata.dma_coherent)
+		set_dma_ops(dev, &dma_direct_ops);
+	else
+		set_dma_ops(dev, &dma_noncoherent_ops);
 }
 
 void arch_teardown_dma_ops(struct device *dev)
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [OpenRISC] [PATCH 07/22] arm-nommu: use generic dma_noncoherent_ops
@ 2018-04-20  8:02   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:02 UTC (permalink / raw)
  To: openrisc

Switch to the generic noncoherent direct mapping implementation for
the nommu dma map implementation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/arc/Kconfig                |   1 +
 arch/arm/Kconfig                |   4 +
 arch/arm/mm/dma-mapping-nommu.c | 139 +++++---------------------------
 3 files changed, 23 insertions(+), 121 deletions(-)

diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index 89d47eac18b2..3a492a9aeaad 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -9,6 +9,7 @@
 config ARC
 	def_bool y
 	select ARC_TIMERS
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select ARCH_HAS_SYNC_DMA_FOR_CPU
 	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select ARCH_HAS_SG_CHAIN
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index f91f69174630..eacc45ac4e77 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -12,6 +12,8 @@ config ARM
 	select ARCH_HAS_PHYS_TO_DMA
 	select ARCH_HAS_STRICT_KERNEL_RWX if MMU && !XIP_KERNEL
 	select ARCH_HAS_STRICT_MODULE_RWX if MMU
+	select ARCH_HAS_SYNC_DMA_FOR_CPU if !MMU
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE if !MMU
 	select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
 	select ARCH_HAVE_CUSTOM_GPIO_H
 	select ARCH_HAS_GCOV_PROFILE_ALL
@@ -27,6 +29,8 @@ config ARM
 	select CPU_PM if (SUSPEND || CPU_IDLE)
 	select DCACHE_WORD_ACCESS if HAVE_EFFICIENT_UNALIGNED_ACCESS
 	select DMA_DIRECT_OPS if !MMU
+	select DMA_NONCOHERENT_OPS if !MMU
+	select DMA_NONCOHERENT_MMAP if !MMU
 	select EDAC_SUPPORT
 	select EDAC_ATOMIC_SCRUB
 	select GENERIC_ALLOCATOR
diff --git a/arch/arm/mm/dma-mapping-nommu.c b/arch/arm/mm/dma-mapping-nommu.c
index f448a0663b10..a74ed6632982 100644
--- a/arch/arm/mm/dma-mapping-nommu.c
+++ b/arch/arm/mm/dma-mapping-nommu.c
@@ -12,6 +12,7 @@
 #include <linux/export.h>
 #include <linux/mm.h>
 #include <linux/dma-direct.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/scatterlist.h>
 
 #include <asm/cachetype.h>
@@ -26,18 +27,16 @@
  *   - MMU/MPU is off
  *   - cpu is v7m w/o cache support
  *   - device is coherent
- *  otherwise arm_nommu_dma_ops is used.
+ *  otherwise dma_noncoherent_ops is used.
  *
- *  arm_nommu_dma_ops rely on consistent DMA memory (please, refer to
+ *  dma_noncoherent_ops rely on consistent DMA memory (please, refer to
  *  [1] on how to declare such memory).
  *
  *  [1] Documentation/devicetree/bindings/reserved-memory/reserved-memory.txt
  */
 
-static void *arm_nommu_dma_alloc(struct device *dev, size_t size,
-				 dma_addr_t *dma_handle, gfp_t gfp,
-				 unsigned long attrs)
-
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	void *ret;
 
@@ -65,9 +64,8 @@ static void *arm_nommu_dma_alloc(struct device *dev, size_t size,
 	return ret;
 }
 
-static void arm_nommu_dma_free(struct device *dev, size_t size,
-			       void *cpu_addr, dma_addr_t dma_addr,
-			       unsigned long attrs)
+void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
+		dma_addr_t dma_addr, unsigned long attrs)
 {
 	if (attrs & DMA_ATTR_NON_CONSISTENT) {
 		dma_direct_free(dev, size, cpu_addr, dma_addr, attrs);
@@ -81,9 +79,9 @@ static void arm_nommu_dma_free(struct device *dev, size_t size,
 	return;
 }
 
-static int arm_nommu_dma_mmap(struct device *dev, struct vm_area_struct *vma,
-			      void *cpu_addr, dma_addr_t dma_addr, size_t size,
-			      unsigned long attrs)
+int arch_dma_mmap(struct device *dev, struct vm_area_struct *vma,
+		void *cpu_addr, dma_addr_t dma_addr, size_t size,
+		unsigned long attrs)
 {
 	int ret;
 
@@ -93,9 +91,8 @@ static int arm_nommu_dma_mmap(struct device *dev, struct vm_area_struct *vma,
 	return dma_common_mmap(dev, vma, cpu_addr, dma_addr, size);
 }
 
-
-static void __dma_page_cpu_to_dev(phys_addr_t paddr, size_t size,
-				  enum dma_data_direction dir)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
 	dmac_map_area(__va(paddr), size, dir);
 
@@ -105,8 +102,8 @@ static void __dma_page_cpu_to_dev(phys_addr_t paddr, size_t size,
 		outer_clean_range(paddr, paddr + size);
 }
 
-static void __dma_page_dev_to_cpu(phys_addr_t paddr, size_t size,
-				  enum dma_data_direction dir)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
 	if (dir != DMA_TO_DEVICE) {
 		outer_inv_range(paddr, paddr + size);
@@ -114,110 +111,9 @@ static void __dma_page_dev_to_cpu(phys_addr_t paddr, size_t size,
 	}
 }
 
-static dma_addr_t arm_nommu_dma_map_page(struct device *dev, struct page *page,
-					 unsigned long offset, size_t size,
-					 enum dma_data_direction dir,
-					 unsigned long attrs)
-{
-	dma_addr_t handle = page_to_phys(page) + offset;
-
-	__dma_page_cpu_to_dev(handle, size, dir);
-
-	return handle;
-}
-
-static void arm_nommu_dma_unmap_page(struct device *dev, dma_addr_t handle,
-				     size_t size, enum dma_data_direction dir,
-				     unsigned long attrs)
-{
-	__dma_page_dev_to_cpu(handle, size, dir);
-}
-
-
-static int arm_nommu_dma_map_sg(struct device *dev, struct scatterlist *sgl,
-				int nents, enum dma_data_direction dir,
-				unsigned long attrs)
-{
-	int i;
-	struct scatterlist *sg;
-
-	for_each_sg(sgl, sg, nents, i) {
-		sg_dma_address(sg) = sg_phys(sg);
-		sg_dma_len(sg) = sg->length;
-		__dma_page_cpu_to_dev(sg_dma_address(sg), sg_dma_len(sg), dir);
-	}
-
-	return nents;
-}
-
-static void arm_nommu_dma_unmap_sg(struct device *dev, struct scatterlist *sgl,
-				   int nents, enum dma_data_direction dir,
-				   unsigned long attrs)
-{
-	struct scatterlist *sg;
-	int i;
-
-	for_each_sg(sgl, sg, nents, i)
-		__dma_page_dev_to_cpu(sg_dma_address(sg), sg_dma_len(sg), dir);
-}
-
-static void arm_nommu_dma_sync_single_for_device(struct device *dev,
-		dma_addr_t handle, size_t size, enum dma_data_direction dir)
-{
-	__dma_page_cpu_to_dev(handle, size, dir);
-}
-
-static void arm_nommu_dma_sync_single_for_cpu(struct device *dev,
-		dma_addr_t handle, size_t size, enum dma_data_direction dir)
-{
-	__dma_page_cpu_to_dev(handle, size, dir);
-}
-
-static void arm_nommu_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sgl,
-					     int nents, enum dma_data_direction dir)
-{
-	struct scatterlist *sg;
-	int i;
-
-	for_each_sg(sgl, sg, nents, i)
-		__dma_page_cpu_to_dev(sg_dma_address(sg), sg_dma_len(sg), dir);
-}
-
-static void arm_nommu_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sgl,
-					  int nents, enum dma_data_direction dir)
-{
-	struct scatterlist *sg;
-	int i;
-
-	for_each_sg(sgl, sg, nents, i)
-		__dma_page_dev_to_cpu(sg_dma_address(sg), sg_dma_len(sg), dir);
-}
-
-const struct dma_map_ops arm_nommu_dma_ops = {
-	.alloc			= arm_nommu_dma_alloc,
-	.free			= arm_nommu_dma_free,
-	.mmap			= arm_nommu_dma_mmap,
-	.map_page		= arm_nommu_dma_map_page,
-	.unmap_page		= arm_nommu_dma_unmap_page,
-	.map_sg			= arm_nommu_dma_map_sg,
-	.unmap_sg		= arm_nommu_dma_unmap_sg,
-	.sync_single_for_device	= arm_nommu_dma_sync_single_for_device,
-	.sync_single_for_cpu	= arm_nommu_dma_sync_single_for_cpu,
-	.sync_sg_for_device	= arm_nommu_dma_sync_sg_for_device,
-	.sync_sg_for_cpu	= arm_nommu_dma_sync_sg_for_cpu,
-};
-EXPORT_SYMBOL(arm_nommu_dma_ops);
-
-static const struct dma_map_ops *arm_nommu_get_dma_map_ops(bool coherent)
-{
-	return coherent ? &dma_direct_ops : &arm_nommu_dma_ops;
-}
-
 void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
 			const struct iommu_ops *iommu, bool coherent)
 {
-	const struct dma_map_ops *dma_ops;
-
 	if (IS_ENABLED(CONFIG_CPU_V7M)) {
 		/*
 		 * Cache support for v7m is optional, so can be treated as
@@ -233,9 +129,10 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
 		dev->archdata.dma_coherent = (get_cr() & CR_M) ? coherent : true;
 	}
 
-	dma_ops = arm_nommu_get_dma_map_ops(dev->archdata.dma_coherent);
-
-	set_dma_ops(dev, dma_ops);
+	if (dev->archdata.dma_coherent)
+		set_dma_ops(dev, &dma_direct_ops);
+	else
+		set_dma_ops(dev, &dma_noncoherent_ops);
 }
 
 void arch_teardown_dma_ops(struct device *dev)
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 07/22] arm-nommu: use generic dma_noncoherent_ops
@ 2018-04-20  8:02   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:02 UTC (permalink / raw)
  To: linux-arm-kernel

Switch to the generic noncoherent direct mapping implementation for
the nommu dma map implementation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/arc/Kconfig                |   1 +
 arch/arm/Kconfig                |   4 +
 arch/arm/mm/dma-mapping-nommu.c | 139 +++++---------------------------
 3 files changed, 23 insertions(+), 121 deletions(-)

diff --git a/arch/arc/Kconfig b/arch/arc/Kconfig
index 89d47eac18b2..3a492a9aeaad 100644
--- a/arch/arc/Kconfig
+++ b/arch/arc/Kconfig
@@ -9,6 +9,7 @@
 config ARC
 	def_bool y
 	select ARC_TIMERS
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select ARCH_HAS_SYNC_DMA_FOR_CPU
 	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select ARCH_HAS_SG_CHAIN
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index f91f69174630..eacc45ac4e77 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -12,6 +12,8 @@ config ARM
 	select ARCH_HAS_PHYS_TO_DMA
 	select ARCH_HAS_STRICT_KERNEL_RWX if MMU && !XIP_KERNEL
 	select ARCH_HAS_STRICT_MODULE_RWX if MMU
+	select ARCH_HAS_SYNC_DMA_FOR_CPU if !MMU
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE if !MMU
 	select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST
 	select ARCH_HAVE_CUSTOM_GPIO_H
 	select ARCH_HAS_GCOV_PROFILE_ALL
@@ -27,6 +29,8 @@ config ARM
 	select CPU_PM if (SUSPEND || CPU_IDLE)
 	select DCACHE_WORD_ACCESS if HAVE_EFFICIENT_UNALIGNED_ACCESS
 	select DMA_DIRECT_OPS if !MMU
+	select DMA_NONCOHERENT_OPS if !MMU
+	select DMA_NONCOHERENT_MMAP if !MMU
 	select EDAC_SUPPORT
 	select EDAC_ATOMIC_SCRUB
 	select GENERIC_ALLOCATOR
diff --git a/arch/arm/mm/dma-mapping-nommu.c b/arch/arm/mm/dma-mapping-nommu.c
index f448a0663b10..a74ed6632982 100644
--- a/arch/arm/mm/dma-mapping-nommu.c
+++ b/arch/arm/mm/dma-mapping-nommu.c
@@ -12,6 +12,7 @@
 #include <linux/export.h>
 #include <linux/mm.h>
 #include <linux/dma-direct.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/scatterlist.h>
 
 #include <asm/cachetype.h>
@@ -26,18 +27,16 @@
  *   - MMU/MPU is off
  *   - cpu is v7m w/o cache support
  *   - device is coherent
- *  otherwise arm_nommu_dma_ops is used.
+ *  otherwise dma_noncoherent_ops is used.
  *
- *  arm_nommu_dma_ops rely on consistent DMA memory (please, refer to
+ *  dma_noncoherent_ops rely on consistent DMA memory (please, refer to
  *  [1] on how to declare such memory).
  *
  *  [1] Documentation/devicetree/bindings/reserved-memory/reserved-memory.txt
  */
 
-static void *arm_nommu_dma_alloc(struct device *dev, size_t size,
-				 dma_addr_t *dma_handle, gfp_t gfp,
-				 unsigned long attrs)
-
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	void *ret;
 
@@ -65,9 +64,8 @@ static void *arm_nommu_dma_alloc(struct device *dev, size_t size,
 	return ret;
 }
 
-static void arm_nommu_dma_free(struct device *dev, size_t size,
-			       void *cpu_addr, dma_addr_t dma_addr,
-			       unsigned long attrs)
+void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
+		dma_addr_t dma_addr, unsigned long attrs)
 {
 	if (attrs & DMA_ATTR_NON_CONSISTENT) {
 		dma_direct_free(dev, size, cpu_addr, dma_addr, attrs);
@@ -81,9 +79,9 @@ static void arm_nommu_dma_free(struct device *dev, size_t size,
 	return;
 }
 
-static int arm_nommu_dma_mmap(struct device *dev, struct vm_area_struct *vma,
-			      void *cpu_addr, dma_addr_t dma_addr, size_t size,
-			      unsigned long attrs)
+int arch_dma_mmap(struct device *dev, struct vm_area_struct *vma,
+		void *cpu_addr, dma_addr_t dma_addr, size_t size,
+		unsigned long attrs)
 {
 	int ret;
 
@@ -93,9 +91,8 @@ static int arm_nommu_dma_mmap(struct device *dev, struct vm_area_struct *vma,
 	return dma_common_mmap(dev, vma, cpu_addr, dma_addr, size);
 }
 
-
-static void __dma_page_cpu_to_dev(phys_addr_t paddr, size_t size,
-				  enum dma_data_direction dir)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
 	dmac_map_area(__va(paddr), size, dir);
 
@@ -105,8 +102,8 @@ static void __dma_page_cpu_to_dev(phys_addr_t paddr, size_t size,
 		outer_clean_range(paddr, paddr + size);
 }
 
-static void __dma_page_dev_to_cpu(phys_addr_t paddr, size_t size,
-				  enum dma_data_direction dir)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
 	if (dir != DMA_TO_DEVICE) {
 		outer_inv_range(paddr, paddr + size);
@@ -114,110 +111,9 @@ static void __dma_page_dev_to_cpu(phys_addr_t paddr, size_t size,
 	}
 }
 
-static dma_addr_t arm_nommu_dma_map_page(struct device *dev, struct page *page,
-					 unsigned long offset, size_t size,
-					 enum dma_data_direction dir,
-					 unsigned long attrs)
-{
-	dma_addr_t handle = page_to_phys(page) + offset;
-
-	__dma_page_cpu_to_dev(handle, size, dir);
-
-	return handle;
-}
-
-static void arm_nommu_dma_unmap_page(struct device *dev, dma_addr_t handle,
-				     size_t size, enum dma_data_direction dir,
-				     unsigned long attrs)
-{
-	__dma_page_dev_to_cpu(handle, size, dir);
-}
-
-
-static int arm_nommu_dma_map_sg(struct device *dev, struct scatterlist *sgl,
-				int nents, enum dma_data_direction dir,
-				unsigned long attrs)
-{
-	int i;
-	struct scatterlist *sg;
-
-	for_each_sg(sgl, sg, nents, i) {
-		sg_dma_address(sg) = sg_phys(sg);
-		sg_dma_len(sg) = sg->length;
-		__dma_page_cpu_to_dev(sg_dma_address(sg), sg_dma_len(sg), dir);
-	}
-
-	return nents;
-}
-
-static void arm_nommu_dma_unmap_sg(struct device *dev, struct scatterlist *sgl,
-				   int nents, enum dma_data_direction dir,
-				   unsigned long attrs)
-{
-	struct scatterlist *sg;
-	int i;
-
-	for_each_sg(sgl, sg, nents, i)
-		__dma_page_dev_to_cpu(sg_dma_address(sg), sg_dma_len(sg), dir);
-}
-
-static void arm_nommu_dma_sync_single_for_device(struct device *dev,
-		dma_addr_t handle, size_t size, enum dma_data_direction dir)
-{
-	__dma_page_cpu_to_dev(handle, size, dir);
-}
-
-static void arm_nommu_dma_sync_single_for_cpu(struct device *dev,
-		dma_addr_t handle, size_t size, enum dma_data_direction dir)
-{
-	__dma_page_cpu_to_dev(handle, size, dir);
-}
-
-static void arm_nommu_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sgl,
-					     int nents, enum dma_data_direction dir)
-{
-	struct scatterlist *sg;
-	int i;
-
-	for_each_sg(sgl, sg, nents, i)
-		__dma_page_cpu_to_dev(sg_dma_address(sg), sg_dma_len(sg), dir);
-}
-
-static void arm_nommu_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sgl,
-					  int nents, enum dma_data_direction dir)
-{
-	struct scatterlist *sg;
-	int i;
-
-	for_each_sg(sgl, sg, nents, i)
-		__dma_page_dev_to_cpu(sg_dma_address(sg), sg_dma_len(sg), dir);
-}
-
-const struct dma_map_ops arm_nommu_dma_ops = {
-	.alloc			= arm_nommu_dma_alloc,
-	.free			= arm_nommu_dma_free,
-	.mmap			= arm_nommu_dma_mmap,
-	.map_page		= arm_nommu_dma_map_page,
-	.unmap_page		= arm_nommu_dma_unmap_page,
-	.map_sg			= arm_nommu_dma_map_sg,
-	.unmap_sg		= arm_nommu_dma_unmap_sg,
-	.sync_single_for_device	= arm_nommu_dma_sync_single_for_device,
-	.sync_single_for_cpu	= arm_nommu_dma_sync_single_for_cpu,
-	.sync_sg_for_device	= arm_nommu_dma_sync_sg_for_device,
-	.sync_sg_for_cpu	= arm_nommu_dma_sync_sg_for_cpu,
-};
-EXPORT_SYMBOL(arm_nommu_dma_ops);
-
-static const struct dma_map_ops *arm_nommu_get_dma_map_ops(bool coherent)
-{
-	return coherent ? &dma_direct_ops : &arm_nommu_dma_ops;
-}
-
 void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
 			const struct iommu_ops *iommu, bool coherent)
 {
-	const struct dma_map_ops *dma_ops;
-
 	if (IS_ENABLED(CONFIG_CPU_V7M)) {
 		/*
 		 * Cache support for v7m is optional, so can be treated as
@@ -233,9 +129,10 @@ void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
 		dev->archdata.dma_coherent = (get_cr() & CR_M) ? coherent : true;
 	}
 
-	dma_ops = arm_nommu_get_dma_map_ops(dev->archdata.dma_coherent);
-
-	set_dma_ops(dev, dma_ops);
+	if (dev->archdata.dma_coherent)
+		set_dma_ops(dev, &dma_direct_ops);
+	else
+		set_dma_ops(dev, &dma_noncoherent_ops);
 }
 
 void arch_teardown_dma_ops(struct device *dev)
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 08/22] c6x: use generic dma_noncoherent_ops
@ 2018-04-20  8:02   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:02 UTC (permalink / raw)
  Cc: linux-arch, linux-xtensa, Michal Simek, Vincent Chen,
	linux-c6x-dev, linux-parisc, linux-sh, linux-hexagon,
	linux-kernel, linux-m68k, openrisc, Greentime Hu, linux-alpha,
	sparclinux, nios2-dev, linux-snps-arc, linux-arm-kernel

Switch to the generic noncoherent direct mapping implementation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/c6x/Kconfig                   |   3 +
 arch/c6x/include/asm/Kbuild        |   1 +
 arch/c6x/include/asm/dma-mapping.h |  28 ------
 arch/c6x/include/asm/setup.h       |   2 +
 arch/c6x/kernel/Makefile           |   2 +-
 arch/c6x/kernel/dma.c              | 138 -----------------------------
 arch/c6x/mm/dma-coherent.c         |  40 ++++++++-
 7 files changed, 44 insertions(+), 170 deletions(-)
 delete mode 100644 arch/c6x/include/asm/dma-mapping.h
 delete mode 100644 arch/c6x/kernel/dma.c

diff --git a/arch/c6x/Kconfig b/arch/c6x/Kconfig
index c6b4dd1418b4..8d7a3b38810f 100644
--- a/arch/c6x/Kconfig
+++ b/arch/c6x/Kconfig
@@ -6,7 +6,10 @@
 
 config C6X
 	def_bool y
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select CLKDEV_LOOKUP
+	select DMA_NONCOHERENT_OPS
 	select GENERIC_ATOMIC64
 	select GENERIC_IRQ_SHOW
 	select HAVE_ARCH_TRACEHOOK
diff --git a/arch/c6x/include/asm/Kbuild b/arch/c6x/include/asm/Kbuild
index fd4c840de837..434600e47662 100644
--- a/arch/c6x/include/asm/Kbuild
+++ b/arch/c6x/include/asm/Kbuild
@@ -5,6 +5,7 @@ generic-y += current.h
 generic-y += device.h
 generic-y += div64.h
 generic-y += dma.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += exec.h
 generic-y += extable.h
diff --git a/arch/c6x/include/asm/dma-mapping.h b/arch/c6x/include/asm/dma-mapping.h
deleted file mode 100644
index 05daf1038111..000000000000
--- a/arch/c6x/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- *  Port on Texas Instruments TMS320C6x architecture
- *
- *  Copyright (C) 2004, 2009, 2010, 2011 Texas Instruments Incorporated
- *  Author: Aurelien Jacquiot <aurelien.jacquiot@ti.com>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 2 as
- *  published by the Free Software Foundation.
- *
- */
-#ifndef _ASM_C6X_DMA_MAPPING_H
-#define _ASM_C6X_DMA_MAPPING_H
-
-extern const struct dma_map_ops c6x_dma_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return &c6x_dma_ops;
-}
-
-extern void coherent_mem_init(u32 start, u32 size);
-void *c6x_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
-		gfp_t gfp, unsigned long attrs);
-void c6x_dma_free(struct device *dev, size_t size, void *vaddr,
-		dma_addr_t dma_handle, unsigned long attrs);
-
-#endif	/* _ASM_C6X_DMA_MAPPING_H */
diff --git a/arch/c6x/include/asm/setup.h b/arch/c6x/include/asm/setup.h
index 852afb209afb..350f34debb19 100644
--- a/arch/c6x/include/asm/setup.h
+++ b/arch/c6x/include/asm/setup.h
@@ -28,5 +28,7 @@ extern unsigned char c6x_fuse_mac[6];
 extern void machine_init(unsigned long dt_ptr);
 extern void time_init(void);
 
+extern void coherent_mem_init(u32 start, u32 size);
+
 #endif /* !__ASSEMBLY__ */
 #endif /* _ASM_C6X_SETUP_H */
diff --git a/arch/c6x/kernel/Makefile b/arch/c6x/kernel/Makefile
index 02f340d7b8fe..fbe74174de87 100644
--- a/arch/c6x/kernel/Makefile
+++ b/arch/c6x/kernel/Makefile
@@ -8,6 +8,6 @@ extra-y := head.o vmlinux.lds
 obj-y := process.o traps.o irq.o signal.o ptrace.o
 obj-y += setup.o sys_c6x.o time.o devicetree.o
 obj-y += switch_to.o entry.o vectors.o c6x_ksyms.o
-obj-y += soc.o dma.o
+obj-y += soc.o
 
 obj-$(CONFIG_MODULES)           += module.o
diff --git a/arch/c6x/kernel/dma.c b/arch/c6x/kernel/dma.c
deleted file mode 100644
index 31e1a9ec3a9c..000000000000
--- a/arch/c6x/kernel/dma.c
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- *  Copyright (C) 2011 Texas Instruments Incorporated
- *  Author: Mark Salter <msalter@redhat.com>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 2 as
- *  published by the Free Software Foundation.
- */
-#include <linux/module.h>
-#include <linux/dma-mapping.h>
-#include <linux/mm.h>
-#include <linux/mm_types.h>
-#include <linux/scatterlist.h>
-
-#include <asm/cacheflush.h>
-
-static void c6x_dma_sync(dma_addr_t handle, size_t size,
-			 enum dma_data_direction dir)
-{
-	unsigned long paddr = handle;
-
-	BUG_ON(!valid_dma_direction(dir));
-
-	switch (dir) {
-	case DMA_FROM_DEVICE:
-		L2_cache_block_invalidate(paddr, paddr + size);
-		break;
-	case DMA_TO_DEVICE:
-		L2_cache_block_writeback(paddr, paddr + size);
-		break;
-	case DMA_BIDIRECTIONAL:
-		L2_cache_block_writeback_invalidate(paddr, paddr + size);
-		break;
-	default:
-		break;
-	}
-}
-
-static dma_addr_t c6x_dma_map_page(struct device *dev, struct page *page,
-		unsigned long offset, size_t size, enum dma_data_direction dir,
-		unsigned long attrs)
-{
-	dma_addr_t handle = virt_to_phys(page_address(page) + offset);
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		c6x_dma_sync(handle, size, dir);
-
-	return handle;
-}
-
-static void c6x_dma_unmap_page(struct device *dev, dma_addr_t handle,
-		size_t size, enum dma_data_direction dir, unsigned long attrs)
-{
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		c6x_dma_sync(handle, size, dir);
-}
-
-static int c6x_dma_map_sg(struct device *dev, struct scatterlist *sglist,
-		int nents, enum dma_data_direction dir, unsigned long attrs)
-{
-	struct scatterlist *sg;
-	int i;
-
-	for_each_sg(sglist, sg, nents, i) {
-		sg->dma_address = sg_phys(sg);
-		if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-			c6x_dma_sync(sg->dma_address, sg->length, dir);
-	}
-
-	return nents;
-}
-
-static void c6x_dma_unmap_sg(struct device *dev, struct scatterlist *sglist,
-		  int nents, enum dma_data_direction dir, unsigned long attrs)
-{
-	struct scatterlist *sg;
-	int i;
-
-	if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-		return;
-
-	for_each_sg(sglist, sg, nents, i)
-		c6x_dma_sync(sg_dma_address(sg), sg->length, dir);
-}
-
-static void c6x_dma_sync_single_for_cpu(struct device *dev, dma_addr_t handle,
-		size_t size, enum dma_data_direction dir)
-{
-	c6x_dma_sync(handle, size, dir);
-
-}
-
-static void c6x_dma_sync_single_for_device(struct device *dev,
-		dma_addr_t handle, size_t size, enum dma_data_direction dir)
-{
-	c6x_dma_sync(handle, size, dir);
-
-}
-
-static void c6x_dma_sync_sg_for_cpu(struct device *dev,
-		struct scatterlist *sglist, int nents,
-		enum dma_data_direction dir)
-{
-	struct scatterlist *sg;
-	int i;
-
-	for_each_sg(sglist, sg, nents, i)
-		c6x_dma_sync_single_for_cpu(dev, sg_dma_address(sg),
-					sg->length, dir);
-
-}
-
-static void c6x_dma_sync_sg_for_device(struct device *dev,
-		struct scatterlist *sglist, int nents,
-		enum dma_data_direction dir)
-{
-	struct scatterlist *sg;
-	int i;
-
-	for_each_sg(sglist, sg, nents, i)
-		c6x_dma_sync_single_for_device(dev, sg_dma_address(sg),
-					   sg->length, dir);
-
-}
-
-const struct dma_map_ops c6x_dma_ops = {
-	.alloc			= c6x_dma_alloc,
-	.free			= c6x_dma_free,
-	.map_page		= c6x_dma_map_page,
-	.unmap_page		= c6x_dma_unmap_page,
-	.map_sg			= c6x_dma_map_sg,
-	.unmap_sg		= c6x_dma_unmap_sg,
-	.sync_single_for_device	= c6x_dma_sync_single_for_device,
-	.sync_single_for_cpu	= c6x_dma_sync_single_for_cpu,
-	.sync_sg_for_device	= c6x_dma_sync_sg_for_device,
-	.sync_sg_for_cpu	= c6x_dma_sync_sg_for_cpu,
-};
-EXPORT_SYMBOL(c6x_dma_ops);
diff --git a/arch/c6x/mm/dma-coherent.c b/arch/c6x/mm/dma-coherent.c
index 95e38ad27c69..d0a8e0c4b27e 100644
--- a/arch/c6x/mm/dma-coherent.c
+++ b/arch/c6x/mm/dma-coherent.c
@@ -19,10 +19,12 @@
 #include <linux/bitops.h>
 #include <linux/module.h>
 #include <linux/interrupt.h>
-#include <linux/dma-mapping.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/memblock.h>
 
+#include <asm/cacheflush.h>
 #include <asm/page.h>
+#include <asm/setup.h>
 
 /*
  * DMA coherent memory management, can be redefined using the memdma=
@@ -73,7 +75,7 @@ static void __free_dma_pages(u32 addr, int order)
  * Allocate DMA coherent memory space and return both the kernel
  * virtual and DMA address for that space.
  */
-void *c6x_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
 		gfp_t gfp, unsigned long attrs)
 {
 	u32 paddr;
@@ -98,7 +100,7 @@ void *c6x_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
 /*
  * Free DMA coherent memory as defined by the above mapping.
  */
-void c6x_dma_free(struct device *dev, size_t size, void *vaddr,
+void arch_dma_free(struct device *dev, size_t size, void *vaddr,
 		dma_addr_t dma_handle, unsigned long attrs)
 {
 	int order;
@@ -139,3 +141,35 @@ void __init coherent_mem_init(phys_addr_t start, u32 size)
 	dma_bitmap = phys_to_virt(bitmap_phys);
 	memset(dma_bitmap, 0, dma_pages * PAGE_SIZE);
 }
+
+static void c6x_dma_sync(struct device *dev, phys_addr_t paddr, size_t size,
+		enum dma_data_direction dir)
+{
+	BUG_ON(!valid_dma_direction(dir));
+
+	switch (dir) {
+	case DMA_FROM_DEVICE:
+		L2_cache_block_invalidate(paddr, paddr + size);
+		break;
+	case DMA_TO_DEVICE:
+		L2_cache_block_writeback(paddr, paddr + size);
+		break;
+	case DMA_BIDIRECTIONAL:
+		L2_cache_block_writeback_invalidate(paddr, paddr + size);
+		break;
+	default:
+		break;
+	}
+}
+
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
+{
+	return c6x_dma_sync(dev, paddr, size, dir);
+}
+
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
+{
+	return c6x_dma_sync(dev, paddr, size, dir);
+}
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 08/22] c6x: use generic dma_noncoherent_ops
@ 2018-04-20  8:02   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:02 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Switch to the generic noncoherent direct mapping implementation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/c6x/Kconfig                   |   3 +
 arch/c6x/include/asm/Kbuild        |   1 +
 arch/c6x/include/asm/dma-mapping.h |  28 ------
 arch/c6x/include/asm/setup.h       |   2 +
 arch/c6x/kernel/Makefile           |   2 +-
 arch/c6x/kernel/dma.c              | 138 -----------------------------
 arch/c6x/mm/dma-coherent.c         |  40 ++++++++-
 7 files changed, 44 insertions(+), 170 deletions(-)
 delete mode 100644 arch/c6x/include/asm/dma-mapping.h
 delete mode 100644 arch/c6x/kernel/dma.c

diff --git a/arch/c6x/Kconfig b/arch/c6x/Kconfig
index c6b4dd1418b4..8d7a3b38810f 100644
--- a/arch/c6x/Kconfig
+++ b/arch/c6x/Kconfig
@@ -6,7 +6,10 @@
 
 config C6X
 	def_bool y
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select CLKDEV_LOOKUP
+	select DMA_NONCOHERENT_OPS
 	select GENERIC_ATOMIC64
 	select GENERIC_IRQ_SHOW
 	select HAVE_ARCH_TRACEHOOK
diff --git a/arch/c6x/include/asm/Kbuild b/arch/c6x/include/asm/Kbuild
index fd4c840de837..434600e47662 100644
--- a/arch/c6x/include/asm/Kbuild
+++ b/arch/c6x/include/asm/Kbuild
@@ -5,6 +5,7 @@ generic-y += current.h
 generic-y += device.h
 generic-y += div64.h
 generic-y += dma.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += exec.h
 generic-y += extable.h
diff --git a/arch/c6x/include/asm/dma-mapping.h b/arch/c6x/include/asm/dma-mapping.h
deleted file mode 100644
index 05daf1038111..000000000000
--- a/arch/c6x/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- *  Port on Texas Instruments TMS320C6x architecture
- *
- *  Copyright (C) 2004, 2009, 2010, 2011 Texas Instruments Incorporated
- *  Author: Aurelien Jacquiot <aurelien.jacquiot@ti.com>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 2 as
- *  published by the Free Software Foundation.
- *
- */
-#ifndef _ASM_C6X_DMA_MAPPING_H
-#define _ASM_C6X_DMA_MAPPING_H
-
-extern const struct dma_map_ops c6x_dma_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return &c6x_dma_ops;
-}
-
-extern void coherent_mem_init(u32 start, u32 size);
-void *c6x_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
-		gfp_t gfp, unsigned long attrs);
-void c6x_dma_free(struct device *dev, size_t size, void *vaddr,
-		dma_addr_t dma_handle, unsigned long attrs);
-
-#endif	/* _ASM_C6X_DMA_MAPPING_H */
diff --git a/arch/c6x/include/asm/setup.h b/arch/c6x/include/asm/setup.h
index 852afb209afb..350f34debb19 100644
--- a/arch/c6x/include/asm/setup.h
+++ b/arch/c6x/include/asm/setup.h
@@ -28,5 +28,7 @@ extern unsigned char c6x_fuse_mac[6];
 extern void machine_init(unsigned long dt_ptr);
 extern void time_init(void);
 
+extern void coherent_mem_init(u32 start, u32 size);
+
 #endif /* !__ASSEMBLY__ */
 #endif /* _ASM_C6X_SETUP_H */
diff --git a/arch/c6x/kernel/Makefile b/arch/c6x/kernel/Makefile
index 02f340d7b8fe..fbe74174de87 100644
--- a/arch/c6x/kernel/Makefile
+++ b/arch/c6x/kernel/Makefile
@@ -8,6 +8,6 @@ extra-y := head.o vmlinux.lds
 obj-y := process.o traps.o irq.o signal.o ptrace.o
 obj-y += setup.o sys_c6x.o time.o devicetree.o
 obj-y += switch_to.o entry.o vectors.o c6x_ksyms.o
-obj-y += soc.o dma.o
+obj-y += soc.o
 
 obj-$(CONFIG_MODULES)           += module.o
diff --git a/arch/c6x/kernel/dma.c b/arch/c6x/kernel/dma.c
deleted file mode 100644
index 31e1a9ec3a9c..000000000000
--- a/arch/c6x/kernel/dma.c
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- *  Copyright (C) 2011 Texas Instruments Incorporated
- *  Author: Mark Salter <msalter@redhat.com>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 2 as
- *  published by the Free Software Foundation.
- */
-#include <linux/module.h>
-#include <linux/dma-mapping.h>
-#include <linux/mm.h>
-#include <linux/mm_types.h>
-#include <linux/scatterlist.h>
-
-#include <asm/cacheflush.h>
-
-static void c6x_dma_sync(dma_addr_t handle, size_t size,
-			 enum dma_data_direction dir)
-{
-	unsigned long paddr = handle;
-
-	BUG_ON(!valid_dma_direction(dir));
-
-	switch (dir) {
-	case DMA_FROM_DEVICE:
-		L2_cache_block_invalidate(paddr, paddr + size);
-		break;
-	case DMA_TO_DEVICE:
-		L2_cache_block_writeback(paddr, paddr + size);
-		break;
-	case DMA_BIDIRECTIONAL:
-		L2_cache_block_writeback_invalidate(paddr, paddr + size);
-		break;
-	default:
-		break;
-	}
-}
-
-static dma_addr_t c6x_dma_map_page(struct device *dev, struct page *page,
-		unsigned long offset, size_t size, enum dma_data_direction dir,
-		unsigned long attrs)
-{
-	dma_addr_t handle = virt_to_phys(page_address(page) + offset);
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		c6x_dma_sync(handle, size, dir);
-
-	return handle;
-}
-
-static void c6x_dma_unmap_page(struct device *dev, dma_addr_t handle,
-		size_t size, enum dma_data_direction dir, unsigned long attrs)
-{
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		c6x_dma_sync(handle, size, dir);
-}
-
-static int c6x_dma_map_sg(struct device *dev, struct scatterlist *sglist,
-		int nents, enum dma_data_direction dir, unsigned long attrs)
-{
-	struct scatterlist *sg;
-	int i;
-
-	for_each_sg(sglist, sg, nents, i) {
-		sg->dma_address = sg_phys(sg);
-		if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-			c6x_dma_sync(sg->dma_address, sg->length, dir);
-	}
-
-	return nents;
-}
-
-static void c6x_dma_unmap_sg(struct device *dev, struct scatterlist *sglist,
-		  int nents, enum dma_data_direction dir, unsigned long attrs)
-{
-	struct scatterlist *sg;
-	int i;
-
-	if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-		return;
-
-	for_each_sg(sglist, sg, nents, i)
-		c6x_dma_sync(sg_dma_address(sg), sg->length, dir);
-}
-
-static void c6x_dma_sync_single_for_cpu(struct device *dev, dma_addr_t handle,
-		size_t size, enum dma_data_direction dir)
-{
-	c6x_dma_sync(handle, size, dir);
-
-}
-
-static void c6x_dma_sync_single_for_device(struct device *dev,
-		dma_addr_t handle, size_t size, enum dma_data_direction dir)
-{
-	c6x_dma_sync(handle, size, dir);
-
-}
-
-static void c6x_dma_sync_sg_for_cpu(struct device *dev,
-		struct scatterlist *sglist, int nents,
-		enum dma_data_direction dir)
-{
-	struct scatterlist *sg;
-	int i;
-
-	for_each_sg(sglist, sg, nents, i)
-		c6x_dma_sync_single_for_cpu(dev, sg_dma_address(sg),
-					sg->length, dir);
-
-}
-
-static void c6x_dma_sync_sg_for_device(struct device *dev,
-		struct scatterlist *sglist, int nents,
-		enum dma_data_direction dir)
-{
-	struct scatterlist *sg;
-	int i;
-
-	for_each_sg(sglist, sg, nents, i)
-		c6x_dma_sync_single_for_device(dev, sg_dma_address(sg),
-					   sg->length, dir);
-
-}
-
-const struct dma_map_ops c6x_dma_ops = {
-	.alloc			= c6x_dma_alloc,
-	.free			= c6x_dma_free,
-	.map_page		= c6x_dma_map_page,
-	.unmap_page		= c6x_dma_unmap_page,
-	.map_sg			= c6x_dma_map_sg,
-	.unmap_sg		= c6x_dma_unmap_sg,
-	.sync_single_for_device	= c6x_dma_sync_single_for_device,
-	.sync_single_for_cpu	= c6x_dma_sync_single_for_cpu,
-	.sync_sg_for_device	= c6x_dma_sync_sg_for_device,
-	.sync_sg_for_cpu	= c6x_dma_sync_sg_for_cpu,
-};
-EXPORT_SYMBOL(c6x_dma_ops);
diff --git a/arch/c6x/mm/dma-coherent.c b/arch/c6x/mm/dma-coherent.c
index 95e38ad27c69..d0a8e0c4b27e 100644
--- a/arch/c6x/mm/dma-coherent.c
+++ b/arch/c6x/mm/dma-coherent.c
@@ -19,10 +19,12 @@
 #include <linux/bitops.h>
 #include <linux/module.h>
 #include <linux/interrupt.h>
-#include <linux/dma-mapping.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/memblock.h>
 
+#include <asm/cacheflush.h>
 #include <asm/page.h>
+#include <asm/setup.h>
 
 /*
  * DMA coherent memory management, can be redefined using the memdma=
@@ -73,7 +75,7 @@ static void __free_dma_pages(u32 addr, int order)
  * Allocate DMA coherent memory space and return both the kernel
  * virtual and DMA address for that space.
  */
-void *c6x_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
 		gfp_t gfp, unsigned long attrs)
 {
 	u32 paddr;
@@ -98,7 +100,7 @@ void *c6x_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
 /*
  * Free DMA coherent memory as defined by the above mapping.
  */
-void c6x_dma_free(struct device *dev, size_t size, void *vaddr,
+void arch_dma_free(struct device *dev, size_t size, void *vaddr,
 		dma_addr_t dma_handle, unsigned long attrs)
 {
 	int order;
@@ -139,3 +141,35 @@ void __init coherent_mem_init(phys_addr_t start, u32 size)
 	dma_bitmap = phys_to_virt(bitmap_phys);
 	memset(dma_bitmap, 0, dma_pages * PAGE_SIZE);
 }
+
+static void c6x_dma_sync(struct device *dev, phys_addr_t paddr, size_t size,
+		enum dma_data_direction dir)
+{
+	BUG_ON(!valid_dma_direction(dir));
+
+	switch (dir) {
+	case DMA_FROM_DEVICE:
+		L2_cache_block_invalidate(paddr, paddr + size);
+		break;
+	case DMA_TO_DEVICE:
+		L2_cache_block_writeback(paddr, paddr + size);
+		break;
+	case DMA_BIDIRECTIONAL:
+		L2_cache_block_writeback_invalidate(paddr, paddr + size);
+		break;
+	default:
+		break;
+	}
+}
+
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
+{
+	return c6x_dma_sync(dev, paddr, size, dir);
+}
+
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
+{
+	return c6x_dma_sync(dev, paddr, size, dir);
+}
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 08/22] c6x: use generic dma_noncoherent_ops
@ 2018-04-20  8:02   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:02 UTC (permalink / raw)
  To: linux-snps-arc

Switch to the generic noncoherent direct mapping implementation.

Signed-off-by: Christoph Hellwig <hch at lst.de>
---
 arch/c6x/Kconfig                   |   3 +
 arch/c6x/include/asm/Kbuild        |   1 +
 arch/c6x/include/asm/dma-mapping.h |  28 ------
 arch/c6x/include/asm/setup.h       |   2 +
 arch/c6x/kernel/Makefile           |   2 +-
 arch/c6x/kernel/dma.c              | 138 -----------------------------
 arch/c6x/mm/dma-coherent.c         |  40 ++++++++-
 7 files changed, 44 insertions(+), 170 deletions(-)
 delete mode 100644 arch/c6x/include/asm/dma-mapping.h
 delete mode 100644 arch/c6x/kernel/dma.c

diff --git a/arch/c6x/Kconfig b/arch/c6x/Kconfig
index c6b4dd1418b4..8d7a3b38810f 100644
--- a/arch/c6x/Kconfig
+++ b/arch/c6x/Kconfig
@@ -6,7 +6,10 @@
 
 config C6X
 	def_bool y
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select CLKDEV_LOOKUP
+	select DMA_NONCOHERENT_OPS
 	select GENERIC_ATOMIC64
 	select GENERIC_IRQ_SHOW
 	select HAVE_ARCH_TRACEHOOK
diff --git a/arch/c6x/include/asm/Kbuild b/arch/c6x/include/asm/Kbuild
index fd4c840de837..434600e47662 100644
--- a/arch/c6x/include/asm/Kbuild
+++ b/arch/c6x/include/asm/Kbuild
@@ -5,6 +5,7 @@ generic-y += current.h
 generic-y += device.h
 generic-y += div64.h
 generic-y += dma.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += exec.h
 generic-y += extable.h
diff --git a/arch/c6x/include/asm/dma-mapping.h b/arch/c6x/include/asm/dma-mapping.h
deleted file mode 100644
index 05daf1038111..000000000000
--- a/arch/c6x/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- *  Port on Texas Instruments TMS320C6x architecture
- *
- *  Copyright (C) 2004, 2009, 2010, 2011 Texas Instruments Incorporated
- *  Author: Aurelien Jacquiot <aurelien.jacquiot at ti.com>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 2 as
- *  published by the Free Software Foundation.
- *
- */
-#ifndef _ASM_C6X_DMA_MAPPING_H
-#define _ASM_C6X_DMA_MAPPING_H
-
-extern const struct dma_map_ops c6x_dma_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return &c6x_dma_ops;
-}
-
-extern void coherent_mem_init(u32 start, u32 size);
-void *c6x_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
-		gfp_t gfp, unsigned long attrs);
-void c6x_dma_free(struct device *dev, size_t size, void *vaddr,
-		dma_addr_t dma_handle, unsigned long attrs);
-
-#endif	/* _ASM_C6X_DMA_MAPPING_H */
diff --git a/arch/c6x/include/asm/setup.h b/arch/c6x/include/asm/setup.h
index 852afb209afb..350f34debb19 100644
--- a/arch/c6x/include/asm/setup.h
+++ b/arch/c6x/include/asm/setup.h
@@ -28,5 +28,7 @@ extern unsigned char c6x_fuse_mac[6];
 extern void machine_init(unsigned long dt_ptr);
 extern void time_init(void);
 
+extern void coherent_mem_init(u32 start, u32 size);
+
 #endif /* !__ASSEMBLY__ */
 #endif /* _ASM_C6X_SETUP_H */
diff --git a/arch/c6x/kernel/Makefile b/arch/c6x/kernel/Makefile
index 02f340d7b8fe..fbe74174de87 100644
--- a/arch/c6x/kernel/Makefile
+++ b/arch/c6x/kernel/Makefile
@@ -8,6 +8,6 @@ extra-y := head.o vmlinux.lds
 obj-y := process.o traps.o irq.o signal.o ptrace.o
 obj-y += setup.o sys_c6x.o time.o devicetree.o
 obj-y += switch_to.o entry.o vectors.o c6x_ksyms.o
-obj-y += soc.o dma.o
+obj-y += soc.o
 
 obj-$(CONFIG_MODULES)           += module.o
diff --git a/arch/c6x/kernel/dma.c b/arch/c6x/kernel/dma.c
deleted file mode 100644
index 31e1a9ec3a9c..000000000000
--- a/arch/c6x/kernel/dma.c
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- *  Copyright (C) 2011 Texas Instruments Incorporated
- *  Author: Mark Salter <msalter at redhat.com>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 2 as
- *  published by the Free Software Foundation.
- */
-#include <linux/module.h>
-#include <linux/dma-mapping.h>
-#include <linux/mm.h>
-#include <linux/mm_types.h>
-#include <linux/scatterlist.h>
-
-#include <asm/cacheflush.h>
-
-static void c6x_dma_sync(dma_addr_t handle, size_t size,
-			 enum dma_data_direction dir)
-{
-	unsigned long paddr = handle;
-
-	BUG_ON(!valid_dma_direction(dir));
-
-	switch (dir) {
-	case DMA_FROM_DEVICE:
-		L2_cache_block_invalidate(paddr, paddr + size);
-		break;
-	case DMA_TO_DEVICE:
-		L2_cache_block_writeback(paddr, paddr + size);
-		break;
-	case DMA_BIDIRECTIONAL:
-		L2_cache_block_writeback_invalidate(paddr, paddr + size);
-		break;
-	default:
-		break;
-	}
-}
-
-static dma_addr_t c6x_dma_map_page(struct device *dev, struct page *page,
-		unsigned long offset, size_t size, enum dma_data_direction dir,
-		unsigned long attrs)
-{
-	dma_addr_t handle = virt_to_phys(page_address(page) + offset);
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		c6x_dma_sync(handle, size, dir);
-
-	return handle;
-}
-
-static void c6x_dma_unmap_page(struct device *dev, dma_addr_t handle,
-		size_t size, enum dma_data_direction dir, unsigned long attrs)
-{
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		c6x_dma_sync(handle, size, dir);
-}
-
-static int c6x_dma_map_sg(struct device *dev, struct scatterlist *sglist,
-		int nents, enum dma_data_direction dir, unsigned long attrs)
-{
-	struct scatterlist *sg;
-	int i;
-
-	for_each_sg(sglist, sg, nents, i) {
-		sg->dma_address = sg_phys(sg);
-		if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-			c6x_dma_sync(sg->dma_address, sg->length, dir);
-	}
-
-	return nents;
-}
-
-static void c6x_dma_unmap_sg(struct device *dev, struct scatterlist *sglist,
-		  int nents, enum dma_data_direction dir, unsigned long attrs)
-{
-	struct scatterlist *sg;
-	int i;
-
-	if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-		return;
-
-	for_each_sg(sglist, sg, nents, i)
-		c6x_dma_sync(sg_dma_address(sg), sg->length, dir);
-}
-
-static void c6x_dma_sync_single_for_cpu(struct device *dev, dma_addr_t handle,
-		size_t size, enum dma_data_direction dir)
-{
-	c6x_dma_sync(handle, size, dir);
-
-}
-
-static void c6x_dma_sync_single_for_device(struct device *dev,
-		dma_addr_t handle, size_t size, enum dma_data_direction dir)
-{
-	c6x_dma_sync(handle, size, dir);
-
-}
-
-static void c6x_dma_sync_sg_for_cpu(struct device *dev,
-		struct scatterlist *sglist, int nents,
-		enum dma_data_direction dir)
-{
-	struct scatterlist *sg;
-	int i;
-
-	for_each_sg(sglist, sg, nents, i)
-		c6x_dma_sync_single_for_cpu(dev, sg_dma_address(sg),
-					sg->length, dir);
-
-}
-
-static void c6x_dma_sync_sg_for_device(struct device *dev,
-		struct scatterlist *sglist, int nents,
-		enum dma_data_direction dir)
-{
-	struct scatterlist *sg;
-	int i;
-
-	for_each_sg(sglist, sg, nents, i)
-		c6x_dma_sync_single_for_device(dev, sg_dma_address(sg),
-					   sg->length, dir);
-
-}
-
-const struct dma_map_ops c6x_dma_ops = {
-	.alloc			= c6x_dma_alloc,
-	.free			= c6x_dma_free,
-	.map_page		= c6x_dma_map_page,
-	.unmap_page		= c6x_dma_unmap_page,
-	.map_sg			= c6x_dma_map_sg,
-	.unmap_sg		= c6x_dma_unmap_sg,
-	.sync_single_for_device	= c6x_dma_sync_single_for_device,
-	.sync_single_for_cpu	= c6x_dma_sync_single_for_cpu,
-	.sync_sg_for_device	= c6x_dma_sync_sg_for_device,
-	.sync_sg_for_cpu	= c6x_dma_sync_sg_for_cpu,
-};
-EXPORT_SYMBOL(c6x_dma_ops);
diff --git a/arch/c6x/mm/dma-coherent.c b/arch/c6x/mm/dma-coherent.c
index 95e38ad27c69..d0a8e0c4b27e 100644
--- a/arch/c6x/mm/dma-coherent.c
+++ b/arch/c6x/mm/dma-coherent.c
@@ -19,10 +19,12 @@
 #include <linux/bitops.h>
 #include <linux/module.h>
 #include <linux/interrupt.h>
-#include <linux/dma-mapping.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/memblock.h>
 
+#include <asm/cacheflush.h>
 #include <asm/page.h>
+#include <asm/setup.h>
 
 /*
  * DMA coherent memory management, can be redefined using the memdma=
@@ -73,7 +75,7 @@ static void __free_dma_pages(u32 addr, int order)
  * Allocate DMA coherent memory space and return both the kernel
  * virtual and DMA address for that space.
  */
-void *c6x_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
 		gfp_t gfp, unsigned long attrs)
 {
 	u32 paddr;
@@ -98,7 +100,7 @@ void *c6x_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
 /*
  * Free DMA coherent memory as defined by the above mapping.
  */
-void c6x_dma_free(struct device *dev, size_t size, void *vaddr,
+void arch_dma_free(struct device *dev, size_t size, void *vaddr,
 		dma_addr_t dma_handle, unsigned long attrs)
 {
 	int order;
@@ -139,3 +141,35 @@ void __init coherent_mem_init(phys_addr_t start, u32 size)
 	dma_bitmap = phys_to_virt(bitmap_phys);
 	memset(dma_bitmap, 0, dma_pages * PAGE_SIZE);
 }
+
+static void c6x_dma_sync(struct device *dev, phys_addr_t paddr, size_t size,
+		enum dma_data_direction dir)
+{
+	BUG_ON(!valid_dma_direction(dir));
+
+	switch (dir) {
+	case DMA_FROM_DEVICE:
+		L2_cache_block_invalidate(paddr, paddr + size);
+		break;
+	case DMA_TO_DEVICE:
+		L2_cache_block_writeback(paddr, paddr + size);
+		break;
+	case DMA_BIDIRECTIONAL:
+		L2_cache_block_writeback_invalidate(paddr, paddr + size);
+		break;
+	default:
+		break;
+	}
+}
+
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
+{
+	return c6x_dma_sync(dev, paddr, size, dir);
+}
+
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
+{
+	return c6x_dma_sync(dev, paddr, size, dir);
+}
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 08/22] c6x: use generic dma_noncoherent_ops
@ 2018-04-20  8:02   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:02 UTC (permalink / raw)
  Cc: linux-arch, linux-xtensa, Michal Simek, Vincent Chen,
	linux-c6x-dev, linux-parisc, linux-sh, linux-hexagon,
	linux-kernel, linux-m68k, openrisc, Greentime Hu, linux-alpha,
	sparclinux, nios2-dev, linux-snps-arc, linux-arm-kernel

Switch to the generic noncoherent direct mapping implementation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/c6x/Kconfig                   |   3 +
 arch/c6x/include/asm/Kbuild        |   1 +
 arch/c6x/include/asm/dma-mapping.h |  28 ------
 arch/c6x/include/asm/setup.h       |   2 +
 arch/c6x/kernel/Makefile           |   2 +-
 arch/c6x/kernel/dma.c              | 138 -----------------------------
 arch/c6x/mm/dma-coherent.c         |  40 ++++++++-
 7 files changed, 44 insertions(+), 170 deletions(-)
 delete mode 100644 arch/c6x/include/asm/dma-mapping.h
 delete mode 100644 arch/c6x/kernel/dma.c

diff --git a/arch/c6x/Kconfig b/arch/c6x/Kconfig
index c6b4dd1418b4..8d7a3b38810f 100644
--- a/arch/c6x/Kconfig
+++ b/arch/c6x/Kconfig
@@ -6,7 +6,10 @@
 
 config C6X
 	def_bool y
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select CLKDEV_LOOKUP
+	select DMA_NONCOHERENT_OPS
 	select GENERIC_ATOMIC64
 	select GENERIC_IRQ_SHOW
 	select HAVE_ARCH_TRACEHOOK
diff --git a/arch/c6x/include/asm/Kbuild b/arch/c6x/include/asm/Kbuild
index fd4c840de837..434600e47662 100644
--- a/arch/c6x/include/asm/Kbuild
+++ b/arch/c6x/include/asm/Kbuild
@@ -5,6 +5,7 @@ generic-y += current.h
 generic-y += device.h
 generic-y += div64.h
 generic-y += dma.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += exec.h
 generic-y += extable.h
diff --git a/arch/c6x/include/asm/dma-mapping.h b/arch/c6x/include/asm/dma-mapping.h
deleted file mode 100644
index 05daf1038111..000000000000
--- a/arch/c6x/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- *  Port on Texas Instruments TMS320C6x architecture
- *
- *  Copyright (C) 2004, 2009, 2010, 2011 Texas Instruments Incorporated
- *  Author: Aurelien Jacquiot <aurelien.jacquiot@ti.com>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 2 as
- *  published by the Free Software Foundation.
- *
- */
-#ifndef _ASM_C6X_DMA_MAPPING_H
-#define _ASM_C6X_DMA_MAPPING_H
-
-extern const struct dma_map_ops c6x_dma_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return &c6x_dma_ops;
-}
-
-extern void coherent_mem_init(u32 start, u32 size);
-void *c6x_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
-		gfp_t gfp, unsigned long attrs);
-void c6x_dma_free(struct device *dev, size_t size, void *vaddr,
-		dma_addr_t dma_handle, unsigned long attrs);
-
-#endif	/* _ASM_C6X_DMA_MAPPING_H */
diff --git a/arch/c6x/include/asm/setup.h b/arch/c6x/include/asm/setup.h
index 852afb209afb..350f34debb19 100644
--- a/arch/c6x/include/asm/setup.h
+++ b/arch/c6x/include/asm/setup.h
@@ -28,5 +28,7 @@ extern unsigned char c6x_fuse_mac[6];
 extern void machine_init(unsigned long dt_ptr);
 extern void time_init(void);
 
+extern void coherent_mem_init(u32 start, u32 size);
+
 #endif /* !__ASSEMBLY__ */
 #endif /* _ASM_C6X_SETUP_H */
diff --git a/arch/c6x/kernel/Makefile b/arch/c6x/kernel/Makefile
index 02f340d7b8fe..fbe74174de87 100644
--- a/arch/c6x/kernel/Makefile
+++ b/arch/c6x/kernel/Makefile
@@ -8,6 +8,6 @@ extra-y := head.o vmlinux.lds
 obj-y := process.o traps.o irq.o signal.o ptrace.o
 obj-y += setup.o sys_c6x.o time.o devicetree.o
 obj-y += switch_to.o entry.o vectors.o c6x_ksyms.o
-obj-y += soc.o dma.o
+obj-y += soc.o
 
 obj-$(CONFIG_MODULES)           += module.o
diff --git a/arch/c6x/kernel/dma.c b/arch/c6x/kernel/dma.c
deleted file mode 100644
index 31e1a9ec3a9c..000000000000
--- a/arch/c6x/kernel/dma.c
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- *  Copyright (C) 2011 Texas Instruments Incorporated
- *  Author: Mark Salter <msalter@redhat.com>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 2 as
- *  published by the Free Software Foundation.
- */
-#include <linux/module.h>
-#include <linux/dma-mapping.h>
-#include <linux/mm.h>
-#include <linux/mm_types.h>
-#include <linux/scatterlist.h>
-
-#include <asm/cacheflush.h>
-
-static void c6x_dma_sync(dma_addr_t handle, size_t size,
-			 enum dma_data_direction dir)
-{
-	unsigned long paddr = handle;
-
-	BUG_ON(!valid_dma_direction(dir));
-
-	switch (dir) {
-	case DMA_FROM_DEVICE:
-		L2_cache_block_invalidate(paddr, paddr + size);
-		break;
-	case DMA_TO_DEVICE:
-		L2_cache_block_writeback(paddr, paddr + size);
-		break;
-	case DMA_BIDIRECTIONAL:
-		L2_cache_block_writeback_invalidate(paddr, paddr + size);
-		break;
-	default:
-		break;
-	}
-}
-
-static dma_addr_t c6x_dma_map_page(struct device *dev, struct page *page,
-		unsigned long offset, size_t size, enum dma_data_direction dir,
-		unsigned long attrs)
-{
-	dma_addr_t handle = virt_to_phys(page_address(page) + offset);
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		c6x_dma_sync(handle, size, dir);
-
-	return handle;
-}
-
-static void c6x_dma_unmap_page(struct device *dev, dma_addr_t handle,
-		size_t size, enum dma_data_direction dir, unsigned long attrs)
-{
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		c6x_dma_sync(handle, size, dir);
-}
-
-static int c6x_dma_map_sg(struct device *dev, struct scatterlist *sglist,
-		int nents, enum dma_data_direction dir, unsigned long attrs)
-{
-	struct scatterlist *sg;
-	int i;
-
-	for_each_sg(sglist, sg, nents, i) {
-		sg->dma_address = sg_phys(sg);
-		if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-			c6x_dma_sync(sg->dma_address, sg->length, dir);
-	}
-
-	return nents;
-}
-
-static void c6x_dma_unmap_sg(struct device *dev, struct scatterlist *sglist,
-		  int nents, enum dma_data_direction dir, unsigned long attrs)
-{
-	struct scatterlist *sg;
-	int i;
-
-	if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-		return;
-
-	for_each_sg(sglist, sg, nents, i)
-		c6x_dma_sync(sg_dma_address(sg), sg->length, dir);
-}
-
-static void c6x_dma_sync_single_for_cpu(struct device *dev, dma_addr_t handle,
-		size_t size, enum dma_data_direction dir)
-{
-	c6x_dma_sync(handle, size, dir);
-
-}
-
-static void c6x_dma_sync_single_for_device(struct device *dev,
-		dma_addr_t handle, size_t size, enum dma_data_direction dir)
-{
-	c6x_dma_sync(handle, size, dir);
-
-}
-
-static void c6x_dma_sync_sg_for_cpu(struct device *dev,
-		struct scatterlist *sglist, int nents,
-		enum dma_data_direction dir)
-{
-	struct scatterlist *sg;
-	int i;
-
-	for_each_sg(sglist, sg, nents, i)
-		c6x_dma_sync_single_for_cpu(dev, sg_dma_address(sg),
-					sg->length, dir);
-
-}
-
-static void c6x_dma_sync_sg_for_device(struct device *dev,
-		struct scatterlist *sglist, int nents,
-		enum dma_data_direction dir)
-{
-	struct scatterlist *sg;
-	int i;
-
-	for_each_sg(sglist, sg, nents, i)
-		c6x_dma_sync_single_for_device(dev, sg_dma_address(sg),
-					   sg->length, dir);
-
-}
-
-const struct dma_map_ops c6x_dma_ops = {
-	.alloc			= c6x_dma_alloc,
-	.free			= c6x_dma_free,
-	.map_page		= c6x_dma_map_page,
-	.unmap_page		= c6x_dma_unmap_page,
-	.map_sg			= c6x_dma_map_sg,
-	.unmap_sg		= c6x_dma_unmap_sg,
-	.sync_single_for_device	= c6x_dma_sync_single_for_device,
-	.sync_single_for_cpu	= c6x_dma_sync_single_for_cpu,
-	.sync_sg_for_device	= c6x_dma_sync_sg_for_device,
-	.sync_sg_for_cpu	= c6x_dma_sync_sg_for_cpu,
-};
-EXPORT_SYMBOL(c6x_dma_ops);
diff --git a/arch/c6x/mm/dma-coherent.c b/arch/c6x/mm/dma-coherent.c
index 95e38ad27c69..d0a8e0c4b27e 100644
--- a/arch/c6x/mm/dma-coherent.c
+++ b/arch/c6x/mm/dma-coherent.c
@@ -19,10 +19,12 @@
 #include <linux/bitops.h>
 #include <linux/module.h>
 #include <linux/interrupt.h>
-#include <linux/dma-mapping.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/memblock.h>
 
+#include <asm/cacheflush.h>
 #include <asm/page.h>
+#include <asm/setup.h>
 
 /*
  * DMA coherent memory management, can be redefined using the memdma@@ -73,7 +75,7 @@ static void __free_dma_pages(u32 addr, int order)
  * Allocate DMA coherent memory space and return both the kernel
  * virtual and DMA address for that space.
  */
-void *c6x_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
 		gfp_t gfp, unsigned long attrs)
 {
 	u32 paddr;
@@ -98,7 +100,7 @@ void *c6x_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
 /*
  * Free DMA coherent memory as defined by the above mapping.
  */
-void c6x_dma_free(struct device *dev, size_t size, void *vaddr,
+void arch_dma_free(struct device *dev, size_t size, void *vaddr,
 		dma_addr_t dma_handle, unsigned long attrs)
 {
 	int order;
@@ -139,3 +141,35 @@ void __init coherent_mem_init(phys_addr_t start, u32 size)
 	dma_bitmap = phys_to_virt(bitmap_phys);
 	memset(dma_bitmap, 0, dma_pages * PAGE_SIZE);
 }
+
+static void c6x_dma_sync(struct device *dev, phys_addr_t paddr, size_t size,
+		enum dma_data_direction dir)
+{
+	BUG_ON(!valid_dma_direction(dir));
+
+	switch (dir) {
+	case DMA_FROM_DEVICE:
+		L2_cache_block_invalidate(paddr, paddr + size);
+		break;
+	case DMA_TO_DEVICE:
+		L2_cache_block_writeback(paddr, paddr + size);
+		break;
+	case DMA_BIDIRECTIONAL:
+		L2_cache_block_writeback_invalidate(paddr, paddr + size);
+		break;
+	default:
+		break;
+	}
+}
+
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
+{
+	return c6x_dma_sync(dev, paddr, size, dir);
+}
+
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
+{
+	return c6x_dma_sync(dev, paddr, size, dir);
+}
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [OpenRISC] [PATCH 08/22] c6x: use generic dma_noncoherent_ops
@ 2018-04-20  8:02   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:02 UTC (permalink / raw)
  To: openrisc

Switch to the generic noncoherent direct mapping implementation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/c6x/Kconfig                   |   3 +
 arch/c6x/include/asm/Kbuild        |   1 +
 arch/c6x/include/asm/dma-mapping.h |  28 ------
 arch/c6x/include/asm/setup.h       |   2 +
 arch/c6x/kernel/Makefile           |   2 +-
 arch/c6x/kernel/dma.c              | 138 -----------------------------
 arch/c6x/mm/dma-coherent.c         |  40 ++++++++-
 7 files changed, 44 insertions(+), 170 deletions(-)
 delete mode 100644 arch/c6x/include/asm/dma-mapping.h
 delete mode 100644 arch/c6x/kernel/dma.c

diff --git a/arch/c6x/Kconfig b/arch/c6x/Kconfig
index c6b4dd1418b4..8d7a3b38810f 100644
--- a/arch/c6x/Kconfig
+++ b/arch/c6x/Kconfig
@@ -6,7 +6,10 @@
 
 config C6X
 	def_bool y
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select CLKDEV_LOOKUP
+	select DMA_NONCOHERENT_OPS
 	select GENERIC_ATOMIC64
 	select GENERIC_IRQ_SHOW
 	select HAVE_ARCH_TRACEHOOK
diff --git a/arch/c6x/include/asm/Kbuild b/arch/c6x/include/asm/Kbuild
index fd4c840de837..434600e47662 100644
--- a/arch/c6x/include/asm/Kbuild
+++ b/arch/c6x/include/asm/Kbuild
@@ -5,6 +5,7 @@ generic-y += current.h
 generic-y += device.h
 generic-y += div64.h
 generic-y += dma.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += exec.h
 generic-y += extable.h
diff --git a/arch/c6x/include/asm/dma-mapping.h b/arch/c6x/include/asm/dma-mapping.h
deleted file mode 100644
index 05daf1038111..000000000000
--- a/arch/c6x/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- *  Port on Texas Instruments TMS320C6x architecture
- *
- *  Copyright (C) 2004, 2009, 2010, 2011 Texas Instruments Incorporated
- *  Author: Aurelien Jacquiot <aurelien.jacquiot@ti.com>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 2 as
- *  published by the Free Software Foundation.
- *
- */
-#ifndef _ASM_C6X_DMA_MAPPING_H
-#define _ASM_C6X_DMA_MAPPING_H
-
-extern const struct dma_map_ops c6x_dma_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return &c6x_dma_ops;
-}
-
-extern void coherent_mem_init(u32 start, u32 size);
-void *c6x_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
-		gfp_t gfp, unsigned long attrs);
-void c6x_dma_free(struct device *dev, size_t size, void *vaddr,
-		dma_addr_t dma_handle, unsigned long attrs);
-
-#endif	/* _ASM_C6X_DMA_MAPPING_H */
diff --git a/arch/c6x/include/asm/setup.h b/arch/c6x/include/asm/setup.h
index 852afb209afb..350f34debb19 100644
--- a/arch/c6x/include/asm/setup.h
+++ b/arch/c6x/include/asm/setup.h
@@ -28,5 +28,7 @@ extern unsigned char c6x_fuse_mac[6];
 extern void machine_init(unsigned long dt_ptr);
 extern void time_init(void);
 
+extern void coherent_mem_init(u32 start, u32 size);
+
 #endif /* !__ASSEMBLY__ */
 #endif /* _ASM_C6X_SETUP_H */
diff --git a/arch/c6x/kernel/Makefile b/arch/c6x/kernel/Makefile
index 02f340d7b8fe..fbe74174de87 100644
--- a/arch/c6x/kernel/Makefile
+++ b/arch/c6x/kernel/Makefile
@@ -8,6 +8,6 @@ extra-y := head.o vmlinux.lds
 obj-y := process.o traps.o irq.o signal.o ptrace.o
 obj-y += setup.o sys_c6x.o time.o devicetree.o
 obj-y += switch_to.o entry.o vectors.o c6x_ksyms.o
-obj-y += soc.o dma.o
+obj-y += soc.o
 
 obj-$(CONFIG_MODULES)           += module.o
diff --git a/arch/c6x/kernel/dma.c b/arch/c6x/kernel/dma.c
deleted file mode 100644
index 31e1a9ec3a9c..000000000000
--- a/arch/c6x/kernel/dma.c
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- *  Copyright (C) 2011 Texas Instruments Incorporated
- *  Author: Mark Salter <msalter@redhat.com>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 2 as
- *  published by the Free Software Foundation.
- */
-#include <linux/module.h>
-#include <linux/dma-mapping.h>
-#include <linux/mm.h>
-#include <linux/mm_types.h>
-#include <linux/scatterlist.h>
-
-#include <asm/cacheflush.h>
-
-static void c6x_dma_sync(dma_addr_t handle, size_t size,
-			 enum dma_data_direction dir)
-{
-	unsigned long paddr = handle;
-
-	BUG_ON(!valid_dma_direction(dir));
-
-	switch (dir) {
-	case DMA_FROM_DEVICE:
-		L2_cache_block_invalidate(paddr, paddr + size);
-		break;
-	case DMA_TO_DEVICE:
-		L2_cache_block_writeback(paddr, paddr + size);
-		break;
-	case DMA_BIDIRECTIONAL:
-		L2_cache_block_writeback_invalidate(paddr, paddr + size);
-		break;
-	default:
-		break;
-	}
-}
-
-static dma_addr_t c6x_dma_map_page(struct device *dev, struct page *page,
-		unsigned long offset, size_t size, enum dma_data_direction dir,
-		unsigned long attrs)
-{
-	dma_addr_t handle = virt_to_phys(page_address(page) + offset);
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		c6x_dma_sync(handle, size, dir);
-
-	return handle;
-}
-
-static void c6x_dma_unmap_page(struct device *dev, dma_addr_t handle,
-		size_t size, enum dma_data_direction dir, unsigned long attrs)
-{
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		c6x_dma_sync(handle, size, dir);
-}
-
-static int c6x_dma_map_sg(struct device *dev, struct scatterlist *sglist,
-		int nents, enum dma_data_direction dir, unsigned long attrs)
-{
-	struct scatterlist *sg;
-	int i;
-
-	for_each_sg(sglist, sg, nents, i) {
-		sg->dma_address = sg_phys(sg);
-		if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-			c6x_dma_sync(sg->dma_address, sg->length, dir);
-	}
-
-	return nents;
-}
-
-static void c6x_dma_unmap_sg(struct device *dev, struct scatterlist *sglist,
-		  int nents, enum dma_data_direction dir, unsigned long attrs)
-{
-	struct scatterlist *sg;
-	int i;
-
-	if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-		return;
-
-	for_each_sg(sglist, sg, nents, i)
-		c6x_dma_sync(sg_dma_address(sg), sg->length, dir);
-}
-
-static void c6x_dma_sync_single_for_cpu(struct device *dev, dma_addr_t handle,
-		size_t size, enum dma_data_direction dir)
-{
-	c6x_dma_sync(handle, size, dir);
-
-}
-
-static void c6x_dma_sync_single_for_device(struct device *dev,
-		dma_addr_t handle, size_t size, enum dma_data_direction dir)
-{
-	c6x_dma_sync(handle, size, dir);
-
-}
-
-static void c6x_dma_sync_sg_for_cpu(struct device *dev,
-		struct scatterlist *sglist, int nents,
-		enum dma_data_direction dir)
-{
-	struct scatterlist *sg;
-	int i;
-
-	for_each_sg(sglist, sg, nents, i)
-		c6x_dma_sync_single_for_cpu(dev, sg_dma_address(sg),
-					sg->length, dir);
-
-}
-
-static void c6x_dma_sync_sg_for_device(struct device *dev,
-		struct scatterlist *sglist, int nents,
-		enum dma_data_direction dir)
-{
-	struct scatterlist *sg;
-	int i;
-
-	for_each_sg(sglist, sg, nents, i)
-		c6x_dma_sync_single_for_device(dev, sg_dma_address(sg),
-					   sg->length, dir);
-
-}
-
-const struct dma_map_ops c6x_dma_ops = {
-	.alloc			= c6x_dma_alloc,
-	.free			= c6x_dma_free,
-	.map_page		= c6x_dma_map_page,
-	.unmap_page		= c6x_dma_unmap_page,
-	.map_sg			= c6x_dma_map_sg,
-	.unmap_sg		= c6x_dma_unmap_sg,
-	.sync_single_for_device	= c6x_dma_sync_single_for_device,
-	.sync_single_for_cpu	= c6x_dma_sync_single_for_cpu,
-	.sync_sg_for_device	= c6x_dma_sync_sg_for_device,
-	.sync_sg_for_cpu	= c6x_dma_sync_sg_for_cpu,
-};
-EXPORT_SYMBOL(c6x_dma_ops);
diff --git a/arch/c6x/mm/dma-coherent.c b/arch/c6x/mm/dma-coherent.c
index 95e38ad27c69..d0a8e0c4b27e 100644
--- a/arch/c6x/mm/dma-coherent.c
+++ b/arch/c6x/mm/dma-coherent.c
@@ -19,10 +19,12 @@
 #include <linux/bitops.h>
 #include <linux/module.h>
 #include <linux/interrupt.h>
-#include <linux/dma-mapping.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/memblock.h>
 
+#include <asm/cacheflush.h>
 #include <asm/page.h>
+#include <asm/setup.h>
 
 /*
  * DMA coherent memory management, can be redefined using the memdma=
@@ -73,7 +75,7 @@ static void __free_dma_pages(u32 addr, int order)
  * Allocate DMA coherent memory space and return both the kernel
  * virtual and DMA address for that space.
  */
-void *c6x_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
 		gfp_t gfp, unsigned long attrs)
 {
 	u32 paddr;
@@ -98,7 +100,7 @@ void *c6x_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
 /*
  * Free DMA coherent memory as defined by the above mapping.
  */
-void c6x_dma_free(struct device *dev, size_t size, void *vaddr,
+void arch_dma_free(struct device *dev, size_t size, void *vaddr,
 		dma_addr_t dma_handle, unsigned long attrs)
 {
 	int order;
@@ -139,3 +141,35 @@ void __init coherent_mem_init(phys_addr_t start, u32 size)
 	dma_bitmap = phys_to_virt(bitmap_phys);
 	memset(dma_bitmap, 0, dma_pages * PAGE_SIZE);
 }
+
+static void c6x_dma_sync(struct device *dev, phys_addr_t paddr, size_t size,
+		enum dma_data_direction dir)
+{
+	BUG_ON(!valid_dma_direction(dir));
+
+	switch (dir) {
+	case DMA_FROM_DEVICE:
+		L2_cache_block_invalidate(paddr, paddr + size);
+		break;
+	case DMA_TO_DEVICE:
+		L2_cache_block_writeback(paddr, paddr + size);
+		break;
+	case DMA_BIDIRECTIONAL:
+		L2_cache_block_writeback_invalidate(paddr, paddr + size);
+		break;
+	default:
+		break;
+	}
+}
+
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
+{
+	return c6x_dma_sync(dev, paddr, size, dir);
+}
+
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
+{
+	return c6x_dma_sync(dev, paddr, size, dir);
+}
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 08/22] c6x: use generic dma_noncoherent_ops
@ 2018-04-20  8:02   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:02 UTC (permalink / raw)
  To: linux-arm-kernel

Switch to the generic noncoherent direct mapping implementation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/c6x/Kconfig                   |   3 +
 arch/c6x/include/asm/Kbuild        |   1 +
 arch/c6x/include/asm/dma-mapping.h |  28 ------
 arch/c6x/include/asm/setup.h       |   2 +
 arch/c6x/kernel/Makefile           |   2 +-
 arch/c6x/kernel/dma.c              | 138 -----------------------------
 arch/c6x/mm/dma-coherent.c         |  40 ++++++++-
 7 files changed, 44 insertions(+), 170 deletions(-)
 delete mode 100644 arch/c6x/include/asm/dma-mapping.h
 delete mode 100644 arch/c6x/kernel/dma.c

diff --git a/arch/c6x/Kconfig b/arch/c6x/Kconfig
index c6b4dd1418b4..8d7a3b38810f 100644
--- a/arch/c6x/Kconfig
+++ b/arch/c6x/Kconfig
@@ -6,7 +6,10 @@
 
 config C6X
 	def_bool y
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select CLKDEV_LOOKUP
+	select DMA_NONCOHERENT_OPS
 	select GENERIC_ATOMIC64
 	select GENERIC_IRQ_SHOW
 	select HAVE_ARCH_TRACEHOOK
diff --git a/arch/c6x/include/asm/Kbuild b/arch/c6x/include/asm/Kbuild
index fd4c840de837..434600e47662 100644
--- a/arch/c6x/include/asm/Kbuild
+++ b/arch/c6x/include/asm/Kbuild
@@ -5,6 +5,7 @@ generic-y += current.h
 generic-y += device.h
 generic-y += div64.h
 generic-y += dma.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += exec.h
 generic-y += extable.h
diff --git a/arch/c6x/include/asm/dma-mapping.h b/arch/c6x/include/asm/dma-mapping.h
deleted file mode 100644
index 05daf1038111..000000000000
--- a/arch/c6x/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- *  Port on Texas Instruments TMS320C6x architecture
- *
- *  Copyright (C) 2004, 2009, 2010, 2011 Texas Instruments Incorporated
- *  Author: Aurelien Jacquiot <aurelien.jacquiot@ti.com>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 2 as
- *  published by the Free Software Foundation.
- *
- */
-#ifndef _ASM_C6X_DMA_MAPPING_H
-#define _ASM_C6X_DMA_MAPPING_H
-
-extern const struct dma_map_ops c6x_dma_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return &c6x_dma_ops;
-}
-
-extern void coherent_mem_init(u32 start, u32 size);
-void *c6x_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
-		gfp_t gfp, unsigned long attrs);
-void c6x_dma_free(struct device *dev, size_t size, void *vaddr,
-		dma_addr_t dma_handle, unsigned long attrs);
-
-#endif	/* _ASM_C6X_DMA_MAPPING_H */
diff --git a/arch/c6x/include/asm/setup.h b/arch/c6x/include/asm/setup.h
index 852afb209afb..350f34debb19 100644
--- a/arch/c6x/include/asm/setup.h
+++ b/arch/c6x/include/asm/setup.h
@@ -28,5 +28,7 @@ extern unsigned char c6x_fuse_mac[6];
 extern void machine_init(unsigned long dt_ptr);
 extern void time_init(void);
 
+extern void coherent_mem_init(u32 start, u32 size);
+
 #endif /* !__ASSEMBLY__ */
 #endif /* _ASM_C6X_SETUP_H */
diff --git a/arch/c6x/kernel/Makefile b/arch/c6x/kernel/Makefile
index 02f340d7b8fe..fbe74174de87 100644
--- a/arch/c6x/kernel/Makefile
+++ b/arch/c6x/kernel/Makefile
@@ -8,6 +8,6 @@ extra-y := head.o vmlinux.lds
 obj-y := process.o traps.o irq.o signal.o ptrace.o
 obj-y += setup.o sys_c6x.o time.o devicetree.o
 obj-y += switch_to.o entry.o vectors.o c6x_ksyms.o
-obj-y += soc.o dma.o
+obj-y += soc.o
 
 obj-$(CONFIG_MODULES)           += module.o
diff --git a/arch/c6x/kernel/dma.c b/arch/c6x/kernel/dma.c
deleted file mode 100644
index 31e1a9ec3a9c..000000000000
--- a/arch/c6x/kernel/dma.c
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- *  Copyright (C) 2011 Texas Instruments Incorporated
- *  Author: Mark Salter <msalter@redhat.com>
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License version 2 as
- *  published by the Free Software Foundation.
- */
-#include <linux/module.h>
-#include <linux/dma-mapping.h>
-#include <linux/mm.h>
-#include <linux/mm_types.h>
-#include <linux/scatterlist.h>
-
-#include <asm/cacheflush.h>
-
-static void c6x_dma_sync(dma_addr_t handle, size_t size,
-			 enum dma_data_direction dir)
-{
-	unsigned long paddr = handle;
-
-	BUG_ON(!valid_dma_direction(dir));
-
-	switch (dir) {
-	case DMA_FROM_DEVICE:
-		L2_cache_block_invalidate(paddr, paddr + size);
-		break;
-	case DMA_TO_DEVICE:
-		L2_cache_block_writeback(paddr, paddr + size);
-		break;
-	case DMA_BIDIRECTIONAL:
-		L2_cache_block_writeback_invalidate(paddr, paddr + size);
-		break;
-	default:
-		break;
-	}
-}
-
-static dma_addr_t c6x_dma_map_page(struct device *dev, struct page *page,
-		unsigned long offset, size_t size, enum dma_data_direction dir,
-		unsigned long attrs)
-{
-	dma_addr_t handle = virt_to_phys(page_address(page) + offset);
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		c6x_dma_sync(handle, size, dir);
-
-	return handle;
-}
-
-static void c6x_dma_unmap_page(struct device *dev, dma_addr_t handle,
-		size_t size, enum dma_data_direction dir, unsigned long attrs)
-{
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		c6x_dma_sync(handle, size, dir);
-}
-
-static int c6x_dma_map_sg(struct device *dev, struct scatterlist *sglist,
-		int nents, enum dma_data_direction dir, unsigned long attrs)
-{
-	struct scatterlist *sg;
-	int i;
-
-	for_each_sg(sglist, sg, nents, i) {
-		sg->dma_address = sg_phys(sg);
-		if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-			c6x_dma_sync(sg->dma_address, sg->length, dir);
-	}
-
-	return nents;
-}
-
-static void c6x_dma_unmap_sg(struct device *dev, struct scatterlist *sglist,
-		  int nents, enum dma_data_direction dir, unsigned long attrs)
-{
-	struct scatterlist *sg;
-	int i;
-
-	if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-		return;
-
-	for_each_sg(sglist, sg, nents, i)
-		c6x_dma_sync(sg_dma_address(sg), sg->length, dir);
-}
-
-static void c6x_dma_sync_single_for_cpu(struct device *dev, dma_addr_t handle,
-		size_t size, enum dma_data_direction dir)
-{
-	c6x_dma_sync(handle, size, dir);
-
-}
-
-static void c6x_dma_sync_single_for_device(struct device *dev,
-		dma_addr_t handle, size_t size, enum dma_data_direction dir)
-{
-	c6x_dma_sync(handle, size, dir);
-
-}
-
-static void c6x_dma_sync_sg_for_cpu(struct device *dev,
-		struct scatterlist *sglist, int nents,
-		enum dma_data_direction dir)
-{
-	struct scatterlist *sg;
-	int i;
-
-	for_each_sg(sglist, sg, nents, i)
-		c6x_dma_sync_single_for_cpu(dev, sg_dma_address(sg),
-					sg->length, dir);
-
-}
-
-static void c6x_dma_sync_sg_for_device(struct device *dev,
-		struct scatterlist *sglist, int nents,
-		enum dma_data_direction dir)
-{
-	struct scatterlist *sg;
-	int i;
-
-	for_each_sg(sglist, sg, nents, i)
-		c6x_dma_sync_single_for_device(dev, sg_dma_address(sg),
-					   sg->length, dir);
-
-}
-
-const struct dma_map_ops c6x_dma_ops = {
-	.alloc			= c6x_dma_alloc,
-	.free			= c6x_dma_free,
-	.map_page		= c6x_dma_map_page,
-	.unmap_page		= c6x_dma_unmap_page,
-	.map_sg			= c6x_dma_map_sg,
-	.unmap_sg		= c6x_dma_unmap_sg,
-	.sync_single_for_device	= c6x_dma_sync_single_for_device,
-	.sync_single_for_cpu	= c6x_dma_sync_single_for_cpu,
-	.sync_sg_for_device	= c6x_dma_sync_sg_for_device,
-	.sync_sg_for_cpu	= c6x_dma_sync_sg_for_cpu,
-};
-EXPORT_SYMBOL(c6x_dma_ops);
diff --git a/arch/c6x/mm/dma-coherent.c b/arch/c6x/mm/dma-coherent.c
index 95e38ad27c69..d0a8e0c4b27e 100644
--- a/arch/c6x/mm/dma-coherent.c
+++ b/arch/c6x/mm/dma-coherent.c
@@ -19,10 +19,12 @@
 #include <linux/bitops.h>
 #include <linux/module.h>
 #include <linux/interrupt.h>
-#include <linux/dma-mapping.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/memblock.h>
 
+#include <asm/cacheflush.h>
 #include <asm/page.h>
+#include <asm/setup.h>
 
 /*
  * DMA coherent memory management, can be redefined using the memdma=
@@ -73,7 +75,7 @@ static void __free_dma_pages(u32 addr, int order)
  * Allocate DMA coherent memory space and return both the kernel
  * virtual and DMA address for that space.
  */
-void *c6x_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
 		gfp_t gfp, unsigned long attrs)
 {
 	u32 paddr;
@@ -98,7 +100,7 @@ void *c6x_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
 /*
  * Free DMA coherent memory as defined by the above mapping.
  */
-void c6x_dma_free(struct device *dev, size_t size, void *vaddr,
+void arch_dma_free(struct device *dev, size_t size, void *vaddr,
 		dma_addr_t dma_handle, unsigned long attrs)
 {
 	int order;
@@ -139,3 +141,35 @@ void __init coherent_mem_init(phys_addr_t start, u32 size)
 	dma_bitmap = phys_to_virt(bitmap_phys);
 	memset(dma_bitmap, 0, dma_pages * PAGE_SIZE);
 }
+
+static void c6x_dma_sync(struct device *dev, phys_addr_t paddr, size_t size,
+		enum dma_data_direction dir)
+{
+	BUG_ON(!valid_dma_direction(dir));
+
+	switch (dir) {
+	case DMA_FROM_DEVICE:
+		L2_cache_block_invalidate(paddr, paddr + size);
+		break;
+	case DMA_TO_DEVICE:
+		L2_cache_block_writeback(paddr, paddr + size);
+		break;
+	case DMA_BIDIRECTIONAL:
+		L2_cache_block_writeback_invalidate(paddr, paddr + size);
+		break;
+	default:
+		break;
+	}
+}
+
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
+{
+	return c6x_dma_sync(dev, paddr, size, dir);
+}
+
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
+{
+	return c6x_dma_sync(dev, paddr, size, dir);
+}
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 09/22] hexagon: use generic dma_noncoherent_ops
  2018-04-20  8:02 ` Christoph Hellwig
                     ` (4 preceding siblings ...)
  (?)
@ 2018-04-20  8:03   ` Christoph Hellwig
  -1 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Switch to the generic noncoherent direct mapping implementation.

This removes the previous sync_single_for_cpu implementation, which looks
bogus given that no syncing is happening in the similar but more
important unmap_single case.

This adds the previously missing sync_sg_for_device implementation that
matches the pre-existing sync_single_for_device implementation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/hexagon/Kconfig                   |   2 +
 arch/hexagon/include/asm/Kbuild        |   1 +
 arch/hexagon/include/asm/dma-mapping.h |  40 -------
 arch/hexagon/kernel/dma.c              | 143 ++-----------------------
 4 files changed, 11 insertions(+), 175 deletions(-)
 delete mode 100644 arch/hexagon/include/asm/dma-mapping.h

diff --git a/arch/hexagon/Kconfig b/arch/hexagon/Kconfig
index 37adb2003033..bcbdcb32935c 100644
--- a/arch/hexagon/Kconfig
+++ b/arch/hexagon/Kconfig
@@ -4,6 +4,7 @@ comment "Linux Kernel Configuration for Hexagon"
 
 config HEXAGON
 	def_bool y
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select HAVE_OPROFILE
 	# Other pending projects/to-do items.
 	# select HAVE_REGS_AND_STACK_ACCESS_API
@@ -28,6 +29,7 @@ config HEXAGON
 	select GENERIC_CLOCKEVENTS_BROADCAST
 	select MODULES_USE_ELF_RELA
 	select GENERIC_CPU_DEVICES
+	select DMA_NONCOHERENT_OPS
 	---help---
 	  Qualcomm Hexagon is a processor architecture designed for high
 	  performance and low power across a wide variety of applications.
diff --git a/arch/hexagon/include/asm/Kbuild b/arch/hexagon/include/asm/Kbuild
index e9743f689fb8..843a8086e980 100644
--- a/arch/hexagon/include/asm/Kbuild
+++ b/arch/hexagon/include/asm/Kbuild
@@ -5,6 +5,7 @@ generic-y += bugs.h
 generic-y += current.h
 generic-y += device.h
 generic-y += div64.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += extable.h
 generic-y += fb.h
diff --git a/arch/hexagon/include/asm/dma-mapping.h b/arch/hexagon/include/asm/dma-mapping.h
deleted file mode 100644
index 263f6acbfb0f..000000000000
--- a/arch/hexagon/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * DMA operations for the Hexagon architecture
- *
- * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- */
-
-#ifndef _ASM_DMA_MAPPING_H
-#define _ASM_DMA_MAPPING_H
-
-#include <linux/types.h>
-#include <linux/cache.h>
-#include <linux/mm.h>
-#include <linux/scatterlist.h>
-#include <linux/dma-debug.h>
-#include <asm/io.h>
-
-struct device;
-
-extern const struct dma_map_ops *dma_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return dma_ops;
-}
-
-#endif
diff --git a/arch/hexagon/kernel/dma.c b/arch/hexagon/kernel/dma.c
index 77459df34e2e..ffc4ae8e126f 100644
--- a/arch/hexagon/kernel/dma.c
+++ b/arch/hexagon/kernel/dma.c
@@ -18,32 +18,19 @@
  * 02110-1301, USA.
  */
 
-#include <linux/dma-mapping.h>
-#include <linux/dma-direct.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/bootmem.h>
 #include <linux/genalloc.h>
-#include <asm/dma-mapping.h>
 #include <linux/module.h>
 #include <asm/page.h>
 
-#define HEXAGON_MAPPING_ERROR	0
-
-const struct dma_map_ops *dma_ops;
-EXPORT_SYMBOL(dma_ops);
-
-static inline void *dma_addr_to_virt(dma_addr_t dma_addr)
-{
-	return phys_to_virt((unsigned long) dma_addr);
-}
-
 static struct gen_pool *coherent_pool;
 
 
 /* Allocates from a pool of uncached memory that was reserved at boot time */
 
-static void *hexagon_dma_alloc_coherent(struct device *dev, size_t size,
-				 dma_addr_t *dma_addr, gfp_t flag,
-				 unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_addr,
+		gfp_t flag, unsigned long attrs)
 {
 	void *ret;
 
@@ -75,58 +62,17 @@ static void *hexagon_dma_alloc_coherent(struct device *dev, size_t size,
 	return ret;
 }
 
-static void hexagon_free_coherent(struct device *dev, size_t size, void *vaddr,
-				  dma_addr_t dma_addr, unsigned long attrs)
+void arch_dma_free(struct device *dev, size_t size, void *vaddr,
+		dma_addr_t dma_addr, unsigned long attrs)
 {
 	gen_pool_free(coherent_pool, (unsigned long) vaddr, size);
 }
 
-static int check_addr(const char *name, struct device *hwdev,
-		      dma_addr_t bus, size_t size)
-{
-	if (hwdev && hwdev->dma_mask && !dma_capable(hwdev, bus, size)) {
-		if (*hwdev->dma_mask >= DMA_BIT_MASK(32))
-			printk(KERN_ERR
-				"%s: overflow %Lx+%zu of device mask %Lx\n",
-				name, (long long)bus, size,
-				(long long)*hwdev->dma_mask);
-		return 0;
-	}
-	return 1;
-}
-
-static int hexagon_map_sg(struct device *hwdev, struct scatterlist *sg,
-			  int nents, enum dma_data_direction dir,
-			  unsigned long attrs)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	struct scatterlist *s;
-	int i;
-
-	WARN_ON(nents == 0 || sg[0].length == 0);
-
-	for_each_sg(sg, s, nents, i) {
-		s->dma_address = sg_phys(s);
-		if (!check_addr("map_sg", hwdev, s->dma_address, s->length))
-			return 0;
-
-		s->dma_length = s->length;
+	void *addr = phys_to_virt(paddr);
 
-		if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-			continue;
-
-		flush_dcache_range(dma_addr_to_virt(s->dma_address),
-				   dma_addr_to_virt(s->dma_address + s->length));
-	}
-
-	return nents;
-}
-
-/*
- * address is virtual
- */
-static inline void dma_sync(void *addr, size_t size,
-			    enum dma_data_direction dir)
-{
 	switch (dir) {
 	case DMA_TO_DEVICE:
 		hexagon_clean_dcache_range((unsigned long) addr,
@@ -144,76 +90,3 @@ static inline void dma_sync(void *addr, size_t size,
 		BUG();
 	}
 }
-
-/**
- * hexagon_map_page() - maps an address for device DMA
- * @dev:	pointer to DMA device
- * @page:	pointer to page struct of DMA memory
- * @offset:	offset within page
- * @size:	size of memory to map
- * @dir:	transfer direction
- * @attrs:	pointer to DMA attrs (not used)
- *
- * Called to map a memory address to a DMA address prior
- * to accesses to/from device.
- *
- * We don't particularly have many hoops to jump through
- * so far.  Straight translation between phys and virtual.
- *
- * DMA is not cache coherent so sync is necessary; this
- * seems to be a convenient place to do it.
- *
- */
-static dma_addr_t hexagon_map_page(struct device *dev, struct page *page,
-				   unsigned long offset, size_t size,
-				   enum dma_data_direction dir,
-				   unsigned long attrs)
-{
-	dma_addr_t bus = page_to_phys(page) + offset;
-	WARN_ON(size == 0);
-
-	if (!check_addr("map_single", dev, bus, size))
-		return HEXAGON_MAPPING_ERROR;
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		dma_sync(dma_addr_to_virt(bus), size, dir);
-
-	return bus;
-}
-
-static void hexagon_sync_single_for_cpu(struct device *dev,
-					dma_addr_t dma_handle, size_t size,
-					enum dma_data_direction dir)
-{
-	dma_sync(dma_addr_to_virt(dma_handle), size, dir);
-}
-
-static void hexagon_sync_single_for_device(struct device *dev,
-					dma_addr_t dma_handle, size_t size,
-					enum dma_data_direction dir)
-{
-	dma_sync(dma_addr_to_virt(dma_handle), size, dir);
-}
-
-static int hexagon_mapping_error(struct device *dev, dma_addr_t dma_addr)
-{
-	return dma_addr == HEXAGON_MAPPING_ERROR;
-}
-
-const struct dma_map_ops hexagon_dma_ops = {
-	.alloc		= hexagon_dma_alloc_coherent,
-	.free		= hexagon_free_coherent,
-	.map_sg		= hexagon_map_sg,
-	.map_page	= hexagon_map_page,
-	.sync_single_for_cpu = hexagon_sync_single_for_cpu,
-	.sync_single_for_device = hexagon_sync_single_for_device,
-	.mapping_error	= hexagon_mapping_error,
-};
-
-void __init hexagon_dma_init(void)
-{
-	if (dma_ops)
-		return;
-
-	dma_ops = &hexagon_dma_ops;
-}
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 09/22] hexagon: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Switch to the generic noncoherent direct mapping implementation.

This removes the previous sync_single_for_cpu implementation, which looks
bogus given that no syncing is happening in the similar but more
important unmap_single case.

This adds the previously missing sync_sg_for_device implementation that
matches the pre-existing sync_single_for_device implementation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/hexagon/Kconfig                   |   2 +
 arch/hexagon/include/asm/Kbuild        |   1 +
 arch/hexagon/include/asm/dma-mapping.h |  40 -------
 arch/hexagon/kernel/dma.c              | 143 ++-----------------------
 4 files changed, 11 insertions(+), 175 deletions(-)
 delete mode 100644 arch/hexagon/include/asm/dma-mapping.h

diff --git a/arch/hexagon/Kconfig b/arch/hexagon/Kconfig
index 37adb2003033..bcbdcb32935c 100644
--- a/arch/hexagon/Kconfig
+++ b/arch/hexagon/Kconfig
@@ -4,6 +4,7 @@ comment "Linux Kernel Configuration for Hexagon"
 
 config HEXAGON
 	def_bool y
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select HAVE_OPROFILE
 	# Other pending projects/to-do items.
 	# select HAVE_REGS_AND_STACK_ACCESS_API
@@ -28,6 +29,7 @@ config HEXAGON
 	select GENERIC_CLOCKEVENTS_BROADCAST
 	select MODULES_USE_ELF_RELA
 	select GENERIC_CPU_DEVICES
+	select DMA_NONCOHERENT_OPS
 	---help---
 	  Qualcomm Hexagon is a processor architecture designed for high
 	  performance and low power across a wide variety of applications.
diff --git a/arch/hexagon/include/asm/Kbuild b/arch/hexagon/include/asm/Kbuild
index e9743f689fb8..843a8086e980 100644
--- a/arch/hexagon/include/asm/Kbuild
+++ b/arch/hexagon/include/asm/Kbuild
@@ -5,6 +5,7 @@ generic-y += bugs.h
 generic-y += current.h
 generic-y += device.h
 generic-y += div64.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += extable.h
 generic-y += fb.h
diff --git a/arch/hexagon/include/asm/dma-mapping.h b/arch/hexagon/include/asm/dma-mapping.h
deleted file mode 100644
index 263f6acbfb0f..000000000000
--- a/arch/hexagon/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * DMA operations for the Hexagon architecture
- *
- * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- */
-
-#ifndef _ASM_DMA_MAPPING_H
-#define _ASM_DMA_MAPPING_H
-
-#include <linux/types.h>
-#include <linux/cache.h>
-#include <linux/mm.h>
-#include <linux/scatterlist.h>
-#include <linux/dma-debug.h>
-#include <asm/io.h>
-
-struct device;
-
-extern const struct dma_map_ops *dma_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return dma_ops;
-}
-
-#endif
diff --git a/arch/hexagon/kernel/dma.c b/arch/hexagon/kernel/dma.c
index 77459df34e2e..ffc4ae8e126f 100644
--- a/arch/hexagon/kernel/dma.c
+++ b/arch/hexagon/kernel/dma.c
@@ -18,32 +18,19 @@
  * 02110-1301, USA.
  */
 
-#include <linux/dma-mapping.h>
-#include <linux/dma-direct.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/bootmem.h>
 #include <linux/genalloc.h>
-#include <asm/dma-mapping.h>
 #include <linux/module.h>
 #include <asm/page.h>
 
-#define HEXAGON_MAPPING_ERROR	0
-
-const struct dma_map_ops *dma_ops;
-EXPORT_SYMBOL(dma_ops);
-
-static inline void *dma_addr_to_virt(dma_addr_t dma_addr)
-{
-	return phys_to_virt((unsigned long) dma_addr);
-}
-
 static struct gen_pool *coherent_pool;
 
 
 /* Allocates from a pool of uncached memory that was reserved at boot time */
 
-static void *hexagon_dma_alloc_coherent(struct device *dev, size_t size,
-				 dma_addr_t *dma_addr, gfp_t flag,
-				 unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_addr,
+		gfp_t flag, unsigned long attrs)
 {
 	void *ret;
 
@@ -75,58 +62,17 @@ static void *hexagon_dma_alloc_coherent(struct device *dev, size_t size,
 	return ret;
 }
 
-static void hexagon_free_coherent(struct device *dev, size_t size, void *vaddr,
-				  dma_addr_t dma_addr, unsigned long attrs)
+void arch_dma_free(struct device *dev, size_t size, void *vaddr,
+		dma_addr_t dma_addr, unsigned long attrs)
 {
 	gen_pool_free(coherent_pool, (unsigned long) vaddr, size);
 }
 
-static int check_addr(const char *name, struct device *hwdev,
-		      dma_addr_t bus, size_t size)
-{
-	if (hwdev && hwdev->dma_mask && !dma_capable(hwdev, bus, size)) {
-		if (*hwdev->dma_mask >= DMA_BIT_MASK(32))
-			printk(KERN_ERR
-				"%s: overflow %Lx+%zu of device mask %Lx\n",
-				name, (long long)bus, size,
-				(long long)*hwdev->dma_mask);
-		return 0;
-	}
-	return 1;
-}
-
-static int hexagon_map_sg(struct device *hwdev, struct scatterlist *sg,
-			  int nents, enum dma_data_direction dir,
-			  unsigned long attrs)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	struct scatterlist *s;
-	int i;
-
-	WARN_ON(nents == 0 || sg[0].length == 0);
-
-	for_each_sg(sg, s, nents, i) {
-		s->dma_address = sg_phys(s);
-		if (!check_addr("map_sg", hwdev, s->dma_address, s->length))
-			return 0;
-
-		s->dma_length = s->length;
+	void *addr = phys_to_virt(paddr);
 
-		if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-			continue;
-
-		flush_dcache_range(dma_addr_to_virt(s->dma_address),
-				   dma_addr_to_virt(s->dma_address + s->length));
-	}
-
-	return nents;
-}
-
-/*
- * address is virtual
- */
-static inline void dma_sync(void *addr, size_t size,
-			    enum dma_data_direction dir)
-{
 	switch (dir) {
 	case DMA_TO_DEVICE:
 		hexagon_clean_dcache_range((unsigned long) addr,
@@ -144,76 +90,3 @@ static inline void dma_sync(void *addr, size_t size,
 		BUG();
 	}
 }
-
-/**
- * hexagon_map_page() - maps an address for device DMA
- * @dev:	pointer to DMA device
- * @page:	pointer to page struct of DMA memory
- * @offset:	offset within page
- * @size:	size of memory to map
- * @dir:	transfer direction
- * @attrs:	pointer to DMA attrs (not used)
- *
- * Called to map a memory address to a DMA address prior
- * to accesses to/from device.
- *
- * We don't particularly have many hoops to jump through
- * so far.  Straight translation between phys and virtual.
- *
- * DMA is not cache coherent so sync is necessary; this
- * seems to be a convenient place to do it.
- *
- */
-static dma_addr_t hexagon_map_page(struct device *dev, struct page *page,
-				   unsigned long offset, size_t size,
-				   enum dma_data_direction dir,
-				   unsigned long attrs)
-{
-	dma_addr_t bus = page_to_phys(page) + offset;
-	WARN_ON(size == 0);
-
-	if (!check_addr("map_single", dev, bus, size))
-		return HEXAGON_MAPPING_ERROR;
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		dma_sync(dma_addr_to_virt(bus), size, dir);
-
-	return bus;
-}
-
-static void hexagon_sync_single_for_cpu(struct device *dev,
-					dma_addr_t dma_handle, size_t size,
-					enum dma_data_direction dir)
-{
-	dma_sync(dma_addr_to_virt(dma_handle), size, dir);
-}
-
-static void hexagon_sync_single_for_device(struct device *dev,
-					dma_addr_t dma_handle, size_t size,
-					enum dma_data_direction dir)
-{
-	dma_sync(dma_addr_to_virt(dma_handle), size, dir);
-}
-
-static int hexagon_mapping_error(struct device *dev, dma_addr_t dma_addr)
-{
-	return dma_addr == HEXAGON_MAPPING_ERROR;
-}
-
-const struct dma_map_ops hexagon_dma_ops = {
-	.alloc		= hexagon_dma_alloc_coherent,
-	.free		= hexagon_free_coherent,
-	.map_sg		= hexagon_map_sg,
-	.map_page	= hexagon_map_page,
-	.sync_single_for_cpu = hexagon_sync_single_for_cpu,
-	.sync_single_for_device = hexagon_sync_single_for_device,
-	.mapping_error	= hexagon_mapping_error,
-};
-
-void __init hexagon_dma_init(void)
-{
-	if (dma_ops)
-		return;
-
-	dma_ops = &hexagon_dma_ops;
-}
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 09/22] hexagon: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Switch to the generic noncoherent direct mapping implementation.

This removes the previous sync_single_for_cpu implementation, which looks
bogus given that no syncing is happening in the similar but more
important unmap_single case.

This adds the previously missing sync_sg_for_device implementation that
matches the pre-existing sync_single_for_device implementation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/hexagon/Kconfig                   |   2 +
 arch/hexagon/include/asm/Kbuild        |   1 +
 arch/hexagon/include/asm/dma-mapping.h |  40 -------
 arch/hexagon/kernel/dma.c              | 143 ++-----------------------
 4 files changed, 11 insertions(+), 175 deletions(-)
 delete mode 100644 arch/hexagon/include/asm/dma-mapping.h

diff --git a/arch/hexagon/Kconfig b/arch/hexagon/Kconfig
index 37adb2003033..bcbdcb32935c 100644
--- a/arch/hexagon/Kconfig
+++ b/arch/hexagon/Kconfig
@@ -4,6 +4,7 @@ comment "Linux Kernel Configuration for Hexagon"
 
 config HEXAGON
 	def_bool y
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select HAVE_OPROFILE
 	# Other pending projects/to-do items.
 	# select HAVE_REGS_AND_STACK_ACCESS_API
@@ -28,6 +29,7 @@ config HEXAGON
 	select GENERIC_CLOCKEVENTS_BROADCAST
 	select MODULES_USE_ELF_RELA
 	select GENERIC_CPU_DEVICES
+	select DMA_NONCOHERENT_OPS
 	---help---
 	  Qualcomm Hexagon is a processor architecture designed for high
 	  performance and low power across a wide variety of applications.
diff --git a/arch/hexagon/include/asm/Kbuild b/arch/hexagon/include/asm/Kbuild
index e9743f689fb8..843a8086e980 100644
--- a/arch/hexagon/include/asm/Kbuild
+++ b/arch/hexagon/include/asm/Kbuild
@@ -5,6 +5,7 @@ generic-y += bugs.h
 generic-y += current.h
 generic-y += device.h
 generic-y += div64.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += extable.h
 generic-y += fb.h
diff --git a/arch/hexagon/include/asm/dma-mapping.h b/arch/hexagon/include/asm/dma-mapping.h
deleted file mode 100644
index 263f6acbfb0f..000000000000
--- a/arch/hexagon/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * DMA operations for the Hexagon architecture
- *
- * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- */
-
-#ifndef _ASM_DMA_MAPPING_H
-#define _ASM_DMA_MAPPING_H
-
-#include <linux/types.h>
-#include <linux/cache.h>
-#include <linux/mm.h>
-#include <linux/scatterlist.h>
-#include <linux/dma-debug.h>
-#include <asm/io.h>
-
-struct device;
-
-extern const struct dma_map_ops *dma_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return dma_ops;
-}
-
-#endif
diff --git a/arch/hexagon/kernel/dma.c b/arch/hexagon/kernel/dma.c
index 77459df34e2e..ffc4ae8e126f 100644
--- a/arch/hexagon/kernel/dma.c
+++ b/arch/hexagon/kernel/dma.c
@@ -18,32 +18,19 @@
  * 02110-1301, USA.
  */
 
-#include <linux/dma-mapping.h>
-#include <linux/dma-direct.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/bootmem.h>
 #include <linux/genalloc.h>
-#include <asm/dma-mapping.h>
 #include <linux/module.h>
 #include <asm/page.h>
 
-#define HEXAGON_MAPPING_ERROR	0
-
-const struct dma_map_ops *dma_ops;
-EXPORT_SYMBOL(dma_ops);
-
-static inline void *dma_addr_to_virt(dma_addr_t dma_addr)
-{
-	return phys_to_virt((unsigned long) dma_addr);
-}
-
 static struct gen_pool *coherent_pool;
 
 
 /* Allocates from a pool of uncached memory that was reserved at boot time */
 
-static void *hexagon_dma_alloc_coherent(struct device *dev, size_t size,
-				 dma_addr_t *dma_addr, gfp_t flag,
-				 unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_addr,
+		gfp_t flag, unsigned long attrs)
 {
 	void *ret;
 
@@ -75,58 +62,17 @@ static void *hexagon_dma_alloc_coherent(struct device *dev, size_t size,
 	return ret;
 }
 
-static void hexagon_free_coherent(struct device *dev, size_t size, void *vaddr,
-				  dma_addr_t dma_addr, unsigned long attrs)
+void arch_dma_free(struct device *dev, size_t size, void *vaddr,
+		dma_addr_t dma_addr, unsigned long attrs)
 {
 	gen_pool_free(coherent_pool, (unsigned long) vaddr, size);
 }
 
-static int check_addr(const char *name, struct device *hwdev,
-		      dma_addr_t bus, size_t size)
-{
-	if (hwdev && hwdev->dma_mask && !dma_capable(hwdev, bus, size)) {
-		if (*hwdev->dma_mask >= DMA_BIT_MASK(32))
-			printk(KERN_ERR
-				"%s: overflow %Lx+%zu of device mask %Lx\n",
-				name, (long long)bus, size,
-				(long long)*hwdev->dma_mask);
-		return 0;
-	}
-	return 1;
-}
-
-static int hexagon_map_sg(struct device *hwdev, struct scatterlist *sg,
-			  int nents, enum dma_data_direction dir,
-			  unsigned long attrs)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	struct scatterlist *s;
-	int i;
-
-	WARN_ON(nents == 0 || sg[0].length == 0);
-
-	for_each_sg(sg, s, nents, i) {
-		s->dma_address = sg_phys(s);
-		if (!check_addr("map_sg", hwdev, s->dma_address, s->length))
-			return 0;
-
-		s->dma_length = s->length;
+	void *addr = phys_to_virt(paddr);
 
-		if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-			continue;
-
-		flush_dcache_range(dma_addr_to_virt(s->dma_address),
-				   dma_addr_to_virt(s->dma_address + s->length));
-	}
-
-	return nents;
-}
-
-/*
- * address is virtual
- */
-static inline void dma_sync(void *addr, size_t size,
-			    enum dma_data_direction dir)
-{
 	switch (dir) {
 	case DMA_TO_DEVICE:
 		hexagon_clean_dcache_range((unsigned long) addr,
@@ -144,76 +90,3 @@ static inline void dma_sync(void *addr, size_t size,
 		BUG();
 	}
 }
-
-/**
- * hexagon_map_page() - maps an address for device DMA
- * @dev:	pointer to DMA device
- * @page:	pointer to page struct of DMA memory
- * @offset:	offset within page
- * @size:	size of memory to map
- * @dir:	transfer direction
- * @attrs:	pointer to DMA attrs (not used)
- *
- * Called to map a memory address to a DMA address prior
- * to accesses to/from device.
- *
- * We don't particularly have many hoops to jump through
- * so far.  Straight translation between phys and virtual.
- *
- * DMA is not cache coherent so sync is necessary; this
- * seems to be a convenient place to do it.
- *
- */
-static dma_addr_t hexagon_map_page(struct device *dev, struct page *page,
-				   unsigned long offset, size_t size,
-				   enum dma_data_direction dir,
-				   unsigned long attrs)
-{
-	dma_addr_t bus = page_to_phys(page) + offset;
-	WARN_ON(size == 0);
-
-	if (!check_addr("map_single", dev, bus, size))
-		return HEXAGON_MAPPING_ERROR;
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		dma_sync(dma_addr_to_virt(bus), size, dir);
-
-	return bus;
-}
-
-static void hexagon_sync_single_for_cpu(struct device *dev,
-					dma_addr_t dma_handle, size_t size,
-					enum dma_data_direction dir)
-{
-	dma_sync(dma_addr_to_virt(dma_handle), size, dir);
-}
-
-static void hexagon_sync_single_for_device(struct device *dev,
-					dma_addr_t dma_handle, size_t size,
-					enum dma_data_direction dir)
-{
-	dma_sync(dma_addr_to_virt(dma_handle), size, dir);
-}
-
-static int hexagon_mapping_error(struct device *dev, dma_addr_t dma_addr)
-{
-	return dma_addr == HEXAGON_MAPPING_ERROR;
-}
-
-const struct dma_map_ops hexagon_dma_ops = {
-	.alloc		= hexagon_dma_alloc_coherent,
-	.free		= hexagon_free_coherent,
-	.map_sg		= hexagon_map_sg,
-	.map_page	= hexagon_map_page,
-	.sync_single_for_cpu = hexagon_sync_single_for_cpu,
-	.sync_single_for_device = hexagon_sync_single_for_device,
-	.mapping_error	= hexagon_mapping_error,
-};
-
-void __init hexagon_dma_init(void)
-{
-	if (dma_ops)
-		return;
-
-	dma_ops = &hexagon_dma_ops;
-}
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 09/22] hexagon: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  To: linux-snps-arc

Switch to the generic noncoherent direct mapping implementation.

This removes the previous sync_single_for_cpu implementation, which looks
bogus given that no syncing is happening in the similar but more
important unmap_single case.

This adds the previously missing sync_sg_for_device implementation that
matches the pre-existing sync_single_for_device implementation.

Signed-off-by: Christoph Hellwig <hch at lst.de>
---
 arch/hexagon/Kconfig                   |   2 +
 arch/hexagon/include/asm/Kbuild        |   1 +
 arch/hexagon/include/asm/dma-mapping.h |  40 -------
 arch/hexagon/kernel/dma.c              | 143 ++-----------------------
 4 files changed, 11 insertions(+), 175 deletions(-)
 delete mode 100644 arch/hexagon/include/asm/dma-mapping.h

diff --git a/arch/hexagon/Kconfig b/arch/hexagon/Kconfig
index 37adb2003033..bcbdcb32935c 100644
--- a/arch/hexagon/Kconfig
+++ b/arch/hexagon/Kconfig
@@ -4,6 +4,7 @@ comment "Linux Kernel Configuration for Hexagon"
 
 config HEXAGON
 	def_bool y
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select HAVE_OPROFILE
 	# Other pending projects/to-do items.
 	# select HAVE_REGS_AND_STACK_ACCESS_API
@@ -28,6 +29,7 @@ config HEXAGON
 	select GENERIC_CLOCKEVENTS_BROADCAST
 	select MODULES_USE_ELF_RELA
 	select GENERIC_CPU_DEVICES
+	select DMA_NONCOHERENT_OPS
 	---help---
 	  Qualcomm Hexagon is a processor architecture designed for high
 	  performance and low power across a wide variety of applications.
diff --git a/arch/hexagon/include/asm/Kbuild b/arch/hexagon/include/asm/Kbuild
index e9743f689fb8..843a8086e980 100644
--- a/arch/hexagon/include/asm/Kbuild
+++ b/arch/hexagon/include/asm/Kbuild
@@ -5,6 +5,7 @@ generic-y += bugs.h
 generic-y += current.h
 generic-y += device.h
 generic-y += div64.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += extable.h
 generic-y += fb.h
diff --git a/arch/hexagon/include/asm/dma-mapping.h b/arch/hexagon/include/asm/dma-mapping.h
deleted file mode 100644
index 263f6acbfb0f..000000000000
--- a/arch/hexagon/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * DMA operations for the Hexagon architecture
- *
- * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- */
-
-#ifndef _ASM_DMA_MAPPING_H
-#define _ASM_DMA_MAPPING_H
-
-#include <linux/types.h>
-#include <linux/cache.h>
-#include <linux/mm.h>
-#include <linux/scatterlist.h>
-#include <linux/dma-debug.h>
-#include <asm/io.h>
-
-struct device;
-
-extern const struct dma_map_ops *dma_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return dma_ops;
-}
-
-#endif
diff --git a/arch/hexagon/kernel/dma.c b/arch/hexagon/kernel/dma.c
index 77459df34e2e..ffc4ae8e126f 100644
--- a/arch/hexagon/kernel/dma.c
+++ b/arch/hexagon/kernel/dma.c
@@ -18,32 +18,19 @@
  * 02110-1301, USA.
  */
 
-#include <linux/dma-mapping.h>
-#include <linux/dma-direct.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/bootmem.h>
 #include <linux/genalloc.h>
-#include <asm/dma-mapping.h>
 #include <linux/module.h>
 #include <asm/page.h>
 
-#define HEXAGON_MAPPING_ERROR	0
-
-const struct dma_map_ops *dma_ops;
-EXPORT_SYMBOL(dma_ops);
-
-static inline void *dma_addr_to_virt(dma_addr_t dma_addr)
-{
-	return phys_to_virt((unsigned long) dma_addr);
-}
-
 static struct gen_pool *coherent_pool;
 
 
 /* Allocates from a pool of uncached memory that was reserved at boot time */
 
-static void *hexagon_dma_alloc_coherent(struct device *dev, size_t size,
-				 dma_addr_t *dma_addr, gfp_t flag,
-				 unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_addr,
+		gfp_t flag, unsigned long attrs)
 {
 	void *ret;
 
@@ -75,58 +62,17 @@ static void *hexagon_dma_alloc_coherent(struct device *dev, size_t size,
 	return ret;
 }
 
-static void hexagon_free_coherent(struct device *dev, size_t size, void *vaddr,
-				  dma_addr_t dma_addr, unsigned long attrs)
+void arch_dma_free(struct device *dev, size_t size, void *vaddr,
+		dma_addr_t dma_addr, unsigned long attrs)
 {
 	gen_pool_free(coherent_pool, (unsigned long) vaddr, size);
 }
 
-static int check_addr(const char *name, struct device *hwdev,
-		      dma_addr_t bus, size_t size)
-{
-	if (hwdev && hwdev->dma_mask && !dma_capable(hwdev, bus, size)) {
-		if (*hwdev->dma_mask >= DMA_BIT_MASK(32))
-			printk(KERN_ERR
-				"%s: overflow %Lx+%zu of device mask %Lx\n",
-				name, (long long)bus, size,
-				(long long)*hwdev->dma_mask);
-		return 0;
-	}
-	return 1;
-}
-
-static int hexagon_map_sg(struct device *hwdev, struct scatterlist *sg,
-			  int nents, enum dma_data_direction dir,
-			  unsigned long attrs)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	struct scatterlist *s;
-	int i;
-
-	WARN_ON(nents == 0 || sg[0].length == 0);
-
-	for_each_sg(sg, s, nents, i) {
-		s->dma_address = sg_phys(s);
-		if (!check_addr("map_sg", hwdev, s->dma_address, s->length))
-			return 0;
-
-		s->dma_length = s->length;
+	void *addr = phys_to_virt(paddr);
 
-		if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-			continue;
-
-		flush_dcache_range(dma_addr_to_virt(s->dma_address),
-				   dma_addr_to_virt(s->dma_address + s->length));
-	}
-
-	return nents;
-}
-
-/*
- * address is virtual
- */
-static inline void dma_sync(void *addr, size_t size,
-			    enum dma_data_direction dir)
-{
 	switch (dir) {
 	case DMA_TO_DEVICE:
 		hexagon_clean_dcache_range((unsigned long) addr,
@@ -144,76 +90,3 @@ static inline void dma_sync(void *addr, size_t size,
 		BUG();
 	}
 }
-
-/**
- * hexagon_map_page() - maps an address for device DMA
- * @dev:	pointer to DMA device
- * @page:	pointer to page struct of DMA memory
- * @offset:	offset within page
- * @size:	size of memory to map
- * @dir:	transfer direction
- * @attrs:	pointer to DMA attrs (not used)
- *
- * Called to map a memory address to a DMA address prior
- * to accesses to/from device.
- *
- * We don't particularly have many hoops to jump through
- * so far.  Straight translation between phys and virtual.
- *
- * DMA is not cache coherent so sync is necessary; this
- * seems to be a convenient place to do it.
- *
- */
-static dma_addr_t hexagon_map_page(struct device *dev, struct page *page,
-				   unsigned long offset, size_t size,
-				   enum dma_data_direction dir,
-				   unsigned long attrs)
-{
-	dma_addr_t bus = page_to_phys(page) + offset;
-	WARN_ON(size == 0);
-
-	if (!check_addr("map_single", dev, bus, size))
-		return HEXAGON_MAPPING_ERROR;
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		dma_sync(dma_addr_to_virt(bus), size, dir);
-
-	return bus;
-}
-
-static void hexagon_sync_single_for_cpu(struct device *dev,
-					dma_addr_t dma_handle, size_t size,
-					enum dma_data_direction dir)
-{
-	dma_sync(dma_addr_to_virt(dma_handle), size, dir);
-}
-
-static void hexagon_sync_single_for_device(struct device *dev,
-					dma_addr_t dma_handle, size_t size,
-					enum dma_data_direction dir)
-{
-	dma_sync(dma_addr_to_virt(dma_handle), size, dir);
-}
-
-static int hexagon_mapping_error(struct device *dev, dma_addr_t dma_addr)
-{
-	return dma_addr == HEXAGON_MAPPING_ERROR;
-}
-
-const struct dma_map_ops hexagon_dma_ops = {
-	.alloc		= hexagon_dma_alloc_coherent,
-	.free		= hexagon_free_coherent,
-	.map_sg		= hexagon_map_sg,
-	.map_page	= hexagon_map_page,
-	.sync_single_for_cpu = hexagon_sync_single_for_cpu,
-	.sync_single_for_device = hexagon_sync_single_for_device,
-	.mapping_error	= hexagon_mapping_error,
-};
-
-void __init hexagon_dma_init(void)
-{
-	if (dma_ops)
-		return;
-
-	dma_ops = &hexagon_dma_ops;
-}
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 09/22] hexagon: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Switch to the generic noncoherent direct mapping implementation.

This removes the previous sync_single_for_cpu implementation, which looks
bogus given that no syncing is happening in the similar but more
important unmap_single case.

This adds the previously missing sync_sg_for_device implementation that
matches the pre-existing sync_single_for_device implementation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/hexagon/Kconfig                   |   2 +
 arch/hexagon/include/asm/Kbuild        |   1 +
 arch/hexagon/include/asm/dma-mapping.h |  40 -------
 arch/hexagon/kernel/dma.c              | 143 ++-----------------------
 4 files changed, 11 insertions(+), 175 deletions(-)
 delete mode 100644 arch/hexagon/include/asm/dma-mapping.h

diff --git a/arch/hexagon/Kconfig b/arch/hexagon/Kconfig
index 37adb2003033..bcbdcb32935c 100644
--- a/arch/hexagon/Kconfig
+++ b/arch/hexagon/Kconfig
@@ -4,6 +4,7 @@ comment "Linux Kernel Configuration for Hexagon"
 
 config HEXAGON
 	def_bool y
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select HAVE_OPROFILE
 	# Other pending projects/to-do items.
 	# select HAVE_REGS_AND_STACK_ACCESS_API
@@ -28,6 +29,7 @@ config HEXAGON
 	select GENERIC_CLOCKEVENTS_BROADCAST
 	select MODULES_USE_ELF_RELA
 	select GENERIC_CPU_DEVICES
+	select DMA_NONCOHERENT_OPS
 	---help---
 	  Qualcomm Hexagon is a processor architecture designed for high
 	  performance and low power across a wide variety of applications.
diff --git a/arch/hexagon/include/asm/Kbuild b/arch/hexagon/include/asm/Kbuild
index e9743f689fb8..843a8086e980 100644
--- a/arch/hexagon/include/asm/Kbuild
+++ b/arch/hexagon/include/asm/Kbuild
@@ -5,6 +5,7 @@ generic-y += bugs.h
 generic-y += current.h
 generic-y += device.h
 generic-y += div64.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += extable.h
 generic-y += fb.h
diff --git a/arch/hexagon/include/asm/dma-mapping.h b/arch/hexagon/include/asm/dma-mapping.h
deleted file mode 100644
index 263f6acbfb0f..000000000000
--- a/arch/hexagon/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * DMA operations for the Hexagon architecture
- *
- * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- */
-
-#ifndef _ASM_DMA_MAPPING_H
-#define _ASM_DMA_MAPPING_H
-
-#include <linux/types.h>
-#include <linux/cache.h>
-#include <linux/mm.h>
-#include <linux/scatterlist.h>
-#include <linux/dma-debug.h>
-#include <asm/io.h>
-
-struct device;
-
-extern const struct dma_map_ops *dma_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return dma_ops;
-}
-
-#endif
diff --git a/arch/hexagon/kernel/dma.c b/arch/hexagon/kernel/dma.c
index 77459df34e2e..ffc4ae8e126f 100644
--- a/arch/hexagon/kernel/dma.c
+++ b/arch/hexagon/kernel/dma.c
@@ -18,32 +18,19 @@
  * 02110-1301, USA.
  */
 
-#include <linux/dma-mapping.h>
-#include <linux/dma-direct.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/bootmem.h>
 #include <linux/genalloc.h>
-#include <asm/dma-mapping.h>
 #include <linux/module.h>
 #include <asm/page.h>
 
-#define HEXAGON_MAPPING_ERROR	0
-
-const struct dma_map_ops *dma_ops;
-EXPORT_SYMBOL(dma_ops);
-
-static inline void *dma_addr_to_virt(dma_addr_t dma_addr)
-{
-	return phys_to_virt((unsigned long) dma_addr);
-}
-
 static struct gen_pool *coherent_pool;
 
 
 /* Allocates from a pool of uncached memory that was reserved at boot time */
 
-static void *hexagon_dma_alloc_coherent(struct device *dev, size_t size,
-				 dma_addr_t *dma_addr, gfp_t flag,
-				 unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_addr,
+		gfp_t flag, unsigned long attrs)
 {
 	void *ret;
 
@@ -75,58 +62,17 @@ static void *hexagon_dma_alloc_coherent(struct device *dev, size_t size,
 	return ret;
 }
 
-static void hexagon_free_coherent(struct device *dev, size_t size, void *vaddr,
-				  dma_addr_t dma_addr, unsigned long attrs)
+void arch_dma_free(struct device *dev, size_t size, void *vaddr,
+		dma_addr_t dma_addr, unsigned long attrs)
 {
 	gen_pool_free(coherent_pool, (unsigned long) vaddr, size);
 }
 
-static int check_addr(const char *name, struct device *hwdev,
-		      dma_addr_t bus, size_t size)
-{
-	if (hwdev && hwdev->dma_mask && !dma_capable(hwdev, bus, size)) {
-		if (*hwdev->dma_mask >= DMA_BIT_MASK(32))
-			printk(KERN_ERR
-				"%s: overflow %Lx+%zu of device mask %Lx\n",
-				name, (long long)bus, size,
-				(long long)*hwdev->dma_mask);
-		return 0;
-	}
-	return 1;
-}
-
-static int hexagon_map_sg(struct device *hwdev, struct scatterlist *sg,
-			  int nents, enum dma_data_direction dir,
-			  unsigned long attrs)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	struct scatterlist *s;
-	int i;
-
-	WARN_ON(nents = 0 || sg[0].length = 0);
-
-	for_each_sg(sg, s, nents, i) {
-		s->dma_address = sg_phys(s);
-		if (!check_addr("map_sg", hwdev, s->dma_address, s->length))
-			return 0;
-
-		s->dma_length = s->length;
+	void *addr = phys_to_virt(paddr);
 
-		if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-			continue;
-
-		flush_dcache_range(dma_addr_to_virt(s->dma_address),
-				   dma_addr_to_virt(s->dma_address + s->length));
-	}
-
-	return nents;
-}
-
-/*
- * address is virtual
- */
-static inline void dma_sync(void *addr, size_t size,
-			    enum dma_data_direction dir)
-{
 	switch (dir) {
 	case DMA_TO_DEVICE:
 		hexagon_clean_dcache_range((unsigned long) addr,
@@ -144,76 +90,3 @@ static inline void dma_sync(void *addr, size_t size,
 		BUG();
 	}
 }
-
-/**
- * hexagon_map_page() - maps an address for device DMA
- * @dev:	pointer to DMA device
- * @page:	pointer to page struct of DMA memory
- * @offset:	offset within page
- * @size:	size of memory to map
- * @dir:	transfer direction
- * @attrs:	pointer to DMA attrs (not used)
- *
- * Called to map a memory address to a DMA address prior
- * to accesses to/from device.
- *
- * We don't particularly have many hoops to jump through
- * so far.  Straight translation between phys and virtual.
- *
- * DMA is not cache coherent so sync is necessary; this
- * seems to be a convenient place to do it.
- *
- */
-static dma_addr_t hexagon_map_page(struct device *dev, struct page *page,
-				   unsigned long offset, size_t size,
-				   enum dma_data_direction dir,
-				   unsigned long attrs)
-{
-	dma_addr_t bus = page_to_phys(page) + offset;
-	WARN_ON(size = 0);
-
-	if (!check_addr("map_single", dev, bus, size))
-		return HEXAGON_MAPPING_ERROR;
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		dma_sync(dma_addr_to_virt(bus), size, dir);
-
-	return bus;
-}
-
-static void hexagon_sync_single_for_cpu(struct device *dev,
-					dma_addr_t dma_handle, size_t size,
-					enum dma_data_direction dir)
-{
-	dma_sync(dma_addr_to_virt(dma_handle), size, dir);
-}
-
-static void hexagon_sync_single_for_device(struct device *dev,
-					dma_addr_t dma_handle, size_t size,
-					enum dma_data_direction dir)
-{
-	dma_sync(dma_addr_to_virt(dma_handle), size, dir);
-}
-
-static int hexagon_mapping_error(struct device *dev, dma_addr_t dma_addr)
-{
-	return dma_addr = HEXAGON_MAPPING_ERROR;
-}
-
-const struct dma_map_ops hexagon_dma_ops = {
-	.alloc		= hexagon_dma_alloc_coherent,
-	.free		= hexagon_free_coherent,
-	.map_sg		= hexagon_map_sg,
-	.map_page	= hexagon_map_page,
-	.sync_single_for_cpu = hexagon_sync_single_for_cpu,
-	.sync_single_for_device = hexagon_sync_single_for_device,
-	.mapping_error	= hexagon_mapping_error,
-};
-
-void __init hexagon_dma_init(void)
-{
-	if (dma_ops)
-		return;
-
-	dma_ops = &hexagon_dma_ops;
-}
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [OpenRISC] [PATCH 09/22] hexagon: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  To: openrisc

Switch to the generic noncoherent direct mapping implementation.

This removes the previous sync_single_for_cpu implementation, which looks
bogus given that no syncing is happening in the similar but more
important unmap_single case.

This adds the previously missing sync_sg_for_device implementation that
matches the pre-existing sync_single_for_device implementation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/hexagon/Kconfig                   |   2 +
 arch/hexagon/include/asm/Kbuild        |   1 +
 arch/hexagon/include/asm/dma-mapping.h |  40 -------
 arch/hexagon/kernel/dma.c              | 143 ++-----------------------
 4 files changed, 11 insertions(+), 175 deletions(-)
 delete mode 100644 arch/hexagon/include/asm/dma-mapping.h

diff --git a/arch/hexagon/Kconfig b/arch/hexagon/Kconfig
index 37adb2003033..bcbdcb32935c 100644
--- a/arch/hexagon/Kconfig
+++ b/arch/hexagon/Kconfig
@@ -4,6 +4,7 @@ comment "Linux Kernel Configuration for Hexagon"
 
 config HEXAGON
 	def_bool y
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select HAVE_OPROFILE
 	# Other pending projects/to-do items.
 	# select HAVE_REGS_AND_STACK_ACCESS_API
@@ -28,6 +29,7 @@ config HEXAGON
 	select GENERIC_CLOCKEVENTS_BROADCAST
 	select MODULES_USE_ELF_RELA
 	select GENERIC_CPU_DEVICES
+	select DMA_NONCOHERENT_OPS
 	---help---
 	  Qualcomm Hexagon is a processor architecture designed for high
 	  performance and low power across a wide variety of applications.
diff --git a/arch/hexagon/include/asm/Kbuild b/arch/hexagon/include/asm/Kbuild
index e9743f689fb8..843a8086e980 100644
--- a/arch/hexagon/include/asm/Kbuild
+++ b/arch/hexagon/include/asm/Kbuild
@@ -5,6 +5,7 @@ generic-y += bugs.h
 generic-y += current.h
 generic-y += device.h
 generic-y += div64.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += extable.h
 generic-y += fb.h
diff --git a/arch/hexagon/include/asm/dma-mapping.h b/arch/hexagon/include/asm/dma-mapping.h
deleted file mode 100644
index 263f6acbfb0f..000000000000
--- a/arch/hexagon/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * DMA operations for the Hexagon architecture
- *
- * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- */
-
-#ifndef _ASM_DMA_MAPPING_H
-#define _ASM_DMA_MAPPING_H
-
-#include <linux/types.h>
-#include <linux/cache.h>
-#include <linux/mm.h>
-#include <linux/scatterlist.h>
-#include <linux/dma-debug.h>
-#include <asm/io.h>
-
-struct device;
-
-extern const struct dma_map_ops *dma_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return dma_ops;
-}
-
-#endif
diff --git a/arch/hexagon/kernel/dma.c b/arch/hexagon/kernel/dma.c
index 77459df34e2e..ffc4ae8e126f 100644
--- a/arch/hexagon/kernel/dma.c
+++ b/arch/hexagon/kernel/dma.c
@@ -18,32 +18,19 @@
  * 02110-1301, USA.
  */
 
-#include <linux/dma-mapping.h>
-#include <linux/dma-direct.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/bootmem.h>
 #include <linux/genalloc.h>
-#include <asm/dma-mapping.h>
 #include <linux/module.h>
 #include <asm/page.h>
 
-#define HEXAGON_MAPPING_ERROR	0
-
-const struct dma_map_ops *dma_ops;
-EXPORT_SYMBOL(dma_ops);
-
-static inline void *dma_addr_to_virt(dma_addr_t dma_addr)
-{
-	return phys_to_virt((unsigned long) dma_addr);
-}
-
 static struct gen_pool *coherent_pool;
 
 
 /* Allocates from a pool of uncached memory that was reserved at boot time */
 
-static void *hexagon_dma_alloc_coherent(struct device *dev, size_t size,
-				 dma_addr_t *dma_addr, gfp_t flag,
-				 unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_addr,
+		gfp_t flag, unsigned long attrs)
 {
 	void *ret;
 
@@ -75,58 +62,17 @@ static void *hexagon_dma_alloc_coherent(struct device *dev, size_t size,
 	return ret;
 }
 
-static void hexagon_free_coherent(struct device *dev, size_t size, void *vaddr,
-				  dma_addr_t dma_addr, unsigned long attrs)
+void arch_dma_free(struct device *dev, size_t size, void *vaddr,
+		dma_addr_t dma_addr, unsigned long attrs)
 {
 	gen_pool_free(coherent_pool, (unsigned long) vaddr, size);
 }
 
-static int check_addr(const char *name, struct device *hwdev,
-		      dma_addr_t bus, size_t size)
-{
-	if (hwdev && hwdev->dma_mask && !dma_capable(hwdev, bus, size)) {
-		if (*hwdev->dma_mask >= DMA_BIT_MASK(32))
-			printk(KERN_ERR
-				"%s: overflow %Lx+%zu of device mask %Lx\n",
-				name, (long long)bus, size,
-				(long long)*hwdev->dma_mask);
-		return 0;
-	}
-	return 1;
-}
-
-static int hexagon_map_sg(struct device *hwdev, struct scatterlist *sg,
-			  int nents, enum dma_data_direction dir,
-			  unsigned long attrs)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	struct scatterlist *s;
-	int i;
-
-	WARN_ON(nents == 0 || sg[0].length == 0);
-
-	for_each_sg(sg, s, nents, i) {
-		s->dma_address = sg_phys(s);
-		if (!check_addr("map_sg", hwdev, s->dma_address, s->length))
-			return 0;
-
-		s->dma_length = s->length;
+	void *addr = phys_to_virt(paddr);
 
-		if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-			continue;
-
-		flush_dcache_range(dma_addr_to_virt(s->dma_address),
-				   dma_addr_to_virt(s->dma_address + s->length));
-	}
-
-	return nents;
-}
-
-/*
- * address is virtual
- */
-static inline void dma_sync(void *addr, size_t size,
-			    enum dma_data_direction dir)
-{
 	switch (dir) {
 	case DMA_TO_DEVICE:
 		hexagon_clean_dcache_range((unsigned long) addr,
@@ -144,76 +90,3 @@ static inline void dma_sync(void *addr, size_t size,
 		BUG();
 	}
 }
-
-/**
- * hexagon_map_page() - maps an address for device DMA
- * @dev:	pointer to DMA device
- * @page:	pointer to page struct of DMA memory
- * @offset:	offset within page
- * @size:	size of memory to map
- * @dir:	transfer direction
- * @attrs:	pointer to DMA attrs (not used)
- *
- * Called to map a memory address to a DMA address prior
- * to accesses to/from device.
- *
- * We don't particularly have many hoops to jump through
- * so far.  Straight translation between phys and virtual.
- *
- * DMA is not cache coherent so sync is necessary; this
- * seems to be a convenient place to do it.
- *
- */
-static dma_addr_t hexagon_map_page(struct device *dev, struct page *page,
-				   unsigned long offset, size_t size,
-				   enum dma_data_direction dir,
-				   unsigned long attrs)
-{
-	dma_addr_t bus = page_to_phys(page) + offset;
-	WARN_ON(size == 0);
-
-	if (!check_addr("map_single", dev, bus, size))
-		return HEXAGON_MAPPING_ERROR;
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		dma_sync(dma_addr_to_virt(bus), size, dir);
-
-	return bus;
-}
-
-static void hexagon_sync_single_for_cpu(struct device *dev,
-					dma_addr_t dma_handle, size_t size,
-					enum dma_data_direction dir)
-{
-	dma_sync(dma_addr_to_virt(dma_handle), size, dir);
-}
-
-static void hexagon_sync_single_for_device(struct device *dev,
-					dma_addr_t dma_handle, size_t size,
-					enum dma_data_direction dir)
-{
-	dma_sync(dma_addr_to_virt(dma_handle), size, dir);
-}
-
-static int hexagon_mapping_error(struct device *dev, dma_addr_t dma_addr)
-{
-	return dma_addr == HEXAGON_MAPPING_ERROR;
-}
-
-const struct dma_map_ops hexagon_dma_ops = {
-	.alloc		= hexagon_dma_alloc_coherent,
-	.free		= hexagon_free_coherent,
-	.map_sg		= hexagon_map_sg,
-	.map_page	= hexagon_map_page,
-	.sync_single_for_cpu = hexagon_sync_single_for_cpu,
-	.sync_single_for_device = hexagon_sync_single_for_device,
-	.mapping_error	= hexagon_mapping_error,
-};
-
-void __init hexagon_dma_init(void)
-{
-	if (dma_ops)
-		return;
-
-	dma_ops = &hexagon_dma_ops;
-}
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 09/22] hexagon: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  To: linux-arm-kernel

Switch to the generic noncoherent direct mapping implementation.

This removes the previous sync_single_for_cpu implementation, which looks
bogus given that no syncing is happening in the similar but more
important unmap_single case.

This adds the previously missing sync_sg_for_device implementation that
matches the pre-existing sync_single_for_device implementation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/hexagon/Kconfig                   |   2 +
 arch/hexagon/include/asm/Kbuild        |   1 +
 arch/hexagon/include/asm/dma-mapping.h |  40 -------
 arch/hexagon/kernel/dma.c              | 143 ++-----------------------
 4 files changed, 11 insertions(+), 175 deletions(-)
 delete mode 100644 arch/hexagon/include/asm/dma-mapping.h

diff --git a/arch/hexagon/Kconfig b/arch/hexagon/Kconfig
index 37adb2003033..bcbdcb32935c 100644
--- a/arch/hexagon/Kconfig
+++ b/arch/hexagon/Kconfig
@@ -4,6 +4,7 @@ comment "Linux Kernel Configuration for Hexagon"
 
 config HEXAGON
 	def_bool y
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select HAVE_OPROFILE
 	# Other pending projects/to-do items.
 	# select HAVE_REGS_AND_STACK_ACCESS_API
@@ -28,6 +29,7 @@ config HEXAGON
 	select GENERIC_CLOCKEVENTS_BROADCAST
 	select MODULES_USE_ELF_RELA
 	select GENERIC_CPU_DEVICES
+	select DMA_NONCOHERENT_OPS
 	---help---
 	  Qualcomm Hexagon is a processor architecture designed for high
 	  performance and low power across a wide variety of applications.
diff --git a/arch/hexagon/include/asm/Kbuild b/arch/hexagon/include/asm/Kbuild
index e9743f689fb8..843a8086e980 100644
--- a/arch/hexagon/include/asm/Kbuild
+++ b/arch/hexagon/include/asm/Kbuild
@@ -5,6 +5,7 @@ generic-y += bugs.h
 generic-y += current.h
 generic-y += device.h
 generic-y += div64.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += extable.h
 generic-y += fb.h
diff --git a/arch/hexagon/include/asm/dma-mapping.h b/arch/hexagon/include/asm/dma-mapping.h
deleted file mode 100644
index 263f6acbfb0f..000000000000
--- a/arch/hexagon/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * DMA operations for the Hexagon architecture
- *
- * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- */
-
-#ifndef _ASM_DMA_MAPPING_H
-#define _ASM_DMA_MAPPING_H
-
-#include <linux/types.h>
-#include <linux/cache.h>
-#include <linux/mm.h>
-#include <linux/scatterlist.h>
-#include <linux/dma-debug.h>
-#include <asm/io.h>
-
-struct device;
-
-extern const struct dma_map_ops *dma_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return dma_ops;
-}
-
-#endif
diff --git a/arch/hexagon/kernel/dma.c b/arch/hexagon/kernel/dma.c
index 77459df34e2e..ffc4ae8e126f 100644
--- a/arch/hexagon/kernel/dma.c
+++ b/arch/hexagon/kernel/dma.c
@@ -18,32 +18,19 @@
  * 02110-1301, USA.
  */
 
-#include <linux/dma-mapping.h>
-#include <linux/dma-direct.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/bootmem.h>
 #include <linux/genalloc.h>
-#include <asm/dma-mapping.h>
 #include <linux/module.h>
 #include <asm/page.h>
 
-#define HEXAGON_MAPPING_ERROR	0
-
-const struct dma_map_ops *dma_ops;
-EXPORT_SYMBOL(dma_ops);
-
-static inline void *dma_addr_to_virt(dma_addr_t dma_addr)
-{
-	return phys_to_virt((unsigned long) dma_addr);
-}
-
 static struct gen_pool *coherent_pool;
 
 
 /* Allocates from a pool of uncached memory that was reserved at boot time */
 
-static void *hexagon_dma_alloc_coherent(struct device *dev, size_t size,
-				 dma_addr_t *dma_addr, gfp_t flag,
-				 unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_addr,
+		gfp_t flag, unsigned long attrs)
 {
 	void *ret;
 
@@ -75,58 +62,17 @@ static void *hexagon_dma_alloc_coherent(struct device *dev, size_t size,
 	return ret;
 }
 
-static void hexagon_free_coherent(struct device *dev, size_t size, void *vaddr,
-				  dma_addr_t dma_addr, unsigned long attrs)
+void arch_dma_free(struct device *dev, size_t size, void *vaddr,
+		dma_addr_t dma_addr, unsigned long attrs)
 {
 	gen_pool_free(coherent_pool, (unsigned long) vaddr, size);
 }
 
-static int check_addr(const char *name, struct device *hwdev,
-		      dma_addr_t bus, size_t size)
-{
-	if (hwdev && hwdev->dma_mask && !dma_capable(hwdev, bus, size)) {
-		if (*hwdev->dma_mask >= DMA_BIT_MASK(32))
-			printk(KERN_ERR
-				"%s: overflow %Lx+%zu of device mask %Lx\n",
-				name, (long long)bus, size,
-				(long long)*hwdev->dma_mask);
-		return 0;
-	}
-	return 1;
-}
-
-static int hexagon_map_sg(struct device *hwdev, struct scatterlist *sg,
-			  int nents, enum dma_data_direction dir,
-			  unsigned long attrs)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	struct scatterlist *s;
-	int i;
-
-	WARN_ON(nents == 0 || sg[0].length == 0);
-
-	for_each_sg(sg, s, nents, i) {
-		s->dma_address = sg_phys(s);
-		if (!check_addr("map_sg", hwdev, s->dma_address, s->length))
-			return 0;
-
-		s->dma_length = s->length;
+	void *addr = phys_to_virt(paddr);
 
-		if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-			continue;
-
-		flush_dcache_range(dma_addr_to_virt(s->dma_address),
-				   dma_addr_to_virt(s->dma_address + s->length));
-	}
-
-	return nents;
-}
-
-/*
- * address is virtual
- */
-static inline void dma_sync(void *addr, size_t size,
-			    enum dma_data_direction dir)
-{
 	switch (dir) {
 	case DMA_TO_DEVICE:
 		hexagon_clean_dcache_range((unsigned long) addr,
@@ -144,76 +90,3 @@ static inline void dma_sync(void *addr, size_t size,
 		BUG();
 	}
 }
-
-/**
- * hexagon_map_page() - maps an address for device DMA
- * @dev:	pointer to DMA device
- * @page:	pointer to page struct of DMA memory
- * @offset:	offset within page
- * @size:	size of memory to map
- * @dir:	transfer direction
- * @attrs:	pointer to DMA attrs (not used)
- *
- * Called to map a memory address to a DMA address prior
- * to accesses to/from device.
- *
- * We don't particularly have many hoops to jump through
- * so far.  Straight translation between phys and virtual.
- *
- * DMA is not cache coherent so sync is necessary; this
- * seems to be a convenient place to do it.
- *
- */
-static dma_addr_t hexagon_map_page(struct device *dev, struct page *page,
-				   unsigned long offset, size_t size,
-				   enum dma_data_direction dir,
-				   unsigned long attrs)
-{
-	dma_addr_t bus = page_to_phys(page) + offset;
-	WARN_ON(size == 0);
-
-	if (!check_addr("map_single", dev, bus, size))
-		return HEXAGON_MAPPING_ERROR;
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		dma_sync(dma_addr_to_virt(bus), size, dir);
-
-	return bus;
-}
-
-static void hexagon_sync_single_for_cpu(struct device *dev,
-					dma_addr_t dma_handle, size_t size,
-					enum dma_data_direction dir)
-{
-	dma_sync(dma_addr_to_virt(dma_handle), size, dir);
-}
-
-static void hexagon_sync_single_for_device(struct device *dev,
-					dma_addr_t dma_handle, size_t size,
-					enum dma_data_direction dir)
-{
-	dma_sync(dma_addr_to_virt(dma_handle), size, dir);
-}
-
-static int hexagon_mapping_error(struct device *dev, dma_addr_t dma_addr)
-{
-	return dma_addr == HEXAGON_MAPPING_ERROR;
-}
-
-const struct dma_map_ops hexagon_dma_ops = {
-	.alloc		= hexagon_dma_alloc_coherent,
-	.free		= hexagon_free_coherent,
-	.map_sg		= hexagon_map_sg,
-	.map_page	= hexagon_map_page,
-	.sync_single_for_cpu = hexagon_sync_single_for_cpu,
-	.sync_single_for_device = hexagon_sync_single_for_device,
-	.mapping_error	= hexagon_mapping_error,
-};
-
-void __init hexagon_dma_init(void)
-{
-	if (dma_ops)
-		return;
-
-	dma_ops = &hexagon_dma_ops;
-}
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 10/22] m68k: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  Cc: linux-arch, linux-xtensa, Michal Simek, Vincent Chen,
	linux-c6x-dev, linux-parisc, linux-sh, linux-hexagon,
	linux-kernel, linux-m68k, openrisc, Greentime Hu, linux-alpha,
	sparclinux, nios2-dev, linux-snps-arc, linux-arm-kernel

Switch to the generic noncoherent direct mapping implementation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/m68k/Kconfig                   |  2 +
 arch/m68k/include/asm/Kbuild        |  1 +
 arch/m68k/include/asm/dma-mapping.h | 12 -----
 arch/m68k/kernel/dma.c              | 68 ++++-------------------------
 4 files changed, 11 insertions(+), 72 deletions(-)
 delete mode 100644 arch/m68k/include/asm/dma-mapping.h

diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 785612b576f7..3f61327da2d5 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -2,6 +2,7 @@
 config M68K
 	bool
 	default y
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE if HAS_DMA
 	select ARCH_MIGHT_HAVE_PC_PARPORT if ISA
 	select ARCH_NO_COHERENT_DMA_MMAP if !MMU
 	select HAVE_IDE
@@ -24,6 +25,7 @@ config M68K
 	select MODULES_USE_ELF_RELA
 	select OLD_SIGSUSPEND3
 	select OLD_SIGACTION
+	select DMA_NONCOHERENT_OPS if HAS_DMA
 
 config CPU_BIG_ENDIAN
 	def_bool y
diff --git a/arch/m68k/include/asm/Kbuild b/arch/m68k/include/asm/Kbuild
index 88a9d27df1ac..a853c00f1374 100644
--- a/arch/m68k/include/asm/Kbuild
+++ b/arch/m68k/include/asm/Kbuild
@@ -1,5 +1,6 @@
 generic-y += barrier.h
 generic-y += device.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += exec.h
 generic-y += extable.h
diff --git a/arch/m68k/include/asm/dma-mapping.h b/arch/m68k/include/asm/dma-mapping.h
deleted file mode 100644
index e3722ed04fbb..000000000000
--- a/arch/m68k/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,12 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef _M68K_DMA_MAPPING_H
-#define _M68K_DMA_MAPPING_H
-
-extern const struct dma_map_ops m68k_dma_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-        return &m68k_dma_ops;
-}
-
-#endif  /* _M68K_DMA_MAPPING_H */
diff --git a/arch/m68k/kernel/dma.c b/arch/m68k/kernel/dma.c
index c01b9b8f97bf..3d561c577d35 100644
--- a/arch/m68k/kernel/dma.c
+++ b/arch/m68k/kernel/dma.c
@@ -6,7 +6,7 @@
 
 #undef DEBUG
 
-#include <linux/dma-mapping.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/device.h>
 #include <linux/kernel.h>
 #include <linux/scatterlist.h>
@@ -18,7 +18,7 @@
 
 #if defined(CONFIG_MMU) && !defined(CONFIG_COLDFIRE)
 
-static void *m68k_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
 		gfp_t flag, unsigned long attrs)
 {
 	struct page *page, **map;
@@ -61,7 +61,7 @@ static void *m68k_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
 	return addr;
 }
 
-static void m68k_dma_free(struct device *dev, size_t size, void *addr,
+void arch_dma_free(struct device *dev, size_t size, void *addr,
 		dma_addr_t handle, unsigned long attrs)
 {
 	pr_debug("dma_free_coherent: %p, %x\n", addr, handle);
@@ -72,8 +72,8 @@ static void m68k_dma_free(struct device *dev, size_t size, void *addr,
 
 #include <asm/cacheflush.h>
 
-static void *m68k_dma_alloc(struct device *dev, size_t size,
-		dma_addr_t *dma_handle, gfp_t gfp, unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	void *ret;
 
@@ -88,7 +88,7 @@ static void *m68k_dma_alloc(struct device *dev, size_t size,
 	return ret;
 }
 
-static void m68k_dma_free(struct device *dev, size_t size, void *vaddr,
+void arch_dma_free(struct device *dev, size_t size, void *vaddr,
 		dma_addr_t dma_handle, unsigned long attrs)
 {
 	free_pages((unsigned long)vaddr, get_order(size));
@@ -96,8 +96,8 @@ static void m68k_dma_free(struct device *dev, size_t size, void *vaddr,
 
 #endif /* CONFIG_MMU && !CONFIG_COLDFIRE */
 
-static void m68k_dma_sync_single_for_device(struct device *dev,
-		dma_addr_t handle, size_t size, enum dma_data_direction dir)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t handle,
+		size_t size, enum dma_data_direction dir)
 {
 	switch (dir) {
 	case DMA_BIDIRECTIONAL:
@@ -113,55 +113,3 @@ static void m68k_dma_sync_single_for_device(struct device *dev,
 		break;
 	}
 }
-
-static void m68k_dma_sync_sg_for_device(struct device *dev,
-		struct scatterlist *sglist, int nents, enum dma_data_direction dir)
-{
-	int i;
-	struct scatterlist *sg;
-
-	for_each_sg(sglist, sg, nents, i) {
-		dma_sync_single_for_device(dev, sg->dma_address, sg->length,
-					   dir);
-	}
-}
-
-static dma_addr_t m68k_dma_map_page(struct device *dev, struct page *page,
-		unsigned long offset, size_t size, enum dma_data_direction dir,
-		unsigned long attrs)
-{
-	dma_addr_t handle = page_to_phys(page) + offset;
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		dma_sync_single_for_device(dev, handle, size, dir);
-
-	return handle;
-}
-
-static int m68k_dma_map_sg(struct device *dev, struct scatterlist *sglist,
-		int nents, enum dma_data_direction dir, unsigned long attrs)
-{
-	int i;
-	struct scatterlist *sg;
-
-	for_each_sg(sglist, sg, nents, i) {
-		sg->dma_address = sg_phys(sg);
-
-		if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-			continue;
-
-		dma_sync_single_for_device(dev, sg->dma_address, sg->length,
-					   dir);
-	}
-	return nents;
-}
-
-const struct dma_map_ops m68k_dma_ops = {
-	.alloc			= m68k_dma_alloc,
-	.free			= m68k_dma_free,
-	.map_page		= m68k_dma_map_page,
-	.map_sg			= m68k_dma_map_sg,
-	.sync_single_for_device	= m68k_dma_sync_single_for_device,
-	.sync_sg_for_device	= m68k_dma_sync_sg_for_device,
-};
-EXPORT_SYMBOL(m68k_dma_ops);
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 10/22] m68k: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Switch to the generic noncoherent direct mapping implementation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/m68k/Kconfig                   |  2 +
 arch/m68k/include/asm/Kbuild        |  1 +
 arch/m68k/include/asm/dma-mapping.h | 12 -----
 arch/m68k/kernel/dma.c              | 68 ++++-------------------------
 4 files changed, 11 insertions(+), 72 deletions(-)
 delete mode 100644 arch/m68k/include/asm/dma-mapping.h

diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 785612b576f7..3f61327da2d5 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -2,6 +2,7 @@
 config M68K
 	bool
 	default y
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE if HAS_DMA
 	select ARCH_MIGHT_HAVE_PC_PARPORT if ISA
 	select ARCH_NO_COHERENT_DMA_MMAP if !MMU
 	select HAVE_IDE
@@ -24,6 +25,7 @@ config M68K
 	select MODULES_USE_ELF_RELA
 	select OLD_SIGSUSPEND3
 	select OLD_SIGACTION
+	select DMA_NONCOHERENT_OPS if HAS_DMA
 
 config CPU_BIG_ENDIAN
 	def_bool y
diff --git a/arch/m68k/include/asm/Kbuild b/arch/m68k/include/asm/Kbuild
index 88a9d27df1ac..a853c00f1374 100644
--- a/arch/m68k/include/asm/Kbuild
+++ b/arch/m68k/include/asm/Kbuild
@@ -1,5 +1,6 @@
 generic-y += barrier.h
 generic-y += device.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += exec.h
 generic-y += extable.h
diff --git a/arch/m68k/include/asm/dma-mapping.h b/arch/m68k/include/asm/dma-mapping.h
deleted file mode 100644
index e3722ed04fbb..000000000000
--- a/arch/m68k/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,12 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef _M68K_DMA_MAPPING_H
-#define _M68K_DMA_MAPPING_H
-
-extern const struct dma_map_ops m68k_dma_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-        return &m68k_dma_ops;
-}
-
-#endif  /* _M68K_DMA_MAPPING_H */
diff --git a/arch/m68k/kernel/dma.c b/arch/m68k/kernel/dma.c
index c01b9b8f97bf..3d561c577d35 100644
--- a/arch/m68k/kernel/dma.c
+++ b/arch/m68k/kernel/dma.c
@@ -6,7 +6,7 @@
 
 #undef DEBUG
 
-#include <linux/dma-mapping.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/device.h>
 #include <linux/kernel.h>
 #include <linux/scatterlist.h>
@@ -18,7 +18,7 @@
 
 #if defined(CONFIG_MMU) && !defined(CONFIG_COLDFIRE)
 
-static void *m68k_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
 		gfp_t flag, unsigned long attrs)
 {
 	struct page *page, **map;
@@ -61,7 +61,7 @@ static void *m68k_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
 	return addr;
 }
 
-static void m68k_dma_free(struct device *dev, size_t size, void *addr,
+void arch_dma_free(struct device *dev, size_t size, void *addr,
 		dma_addr_t handle, unsigned long attrs)
 {
 	pr_debug("dma_free_coherent: %p, %x\n", addr, handle);
@@ -72,8 +72,8 @@ static void m68k_dma_free(struct device *dev, size_t size, void *addr,
 
 #include <asm/cacheflush.h>
 
-static void *m68k_dma_alloc(struct device *dev, size_t size,
-		dma_addr_t *dma_handle, gfp_t gfp, unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	void *ret;
 
@@ -88,7 +88,7 @@ static void *m68k_dma_alloc(struct device *dev, size_t size,
 	return ret;
 }
 
-static void m68k_dma_free(struct device *dev, size_t size, void *vaddr,
+void arch_dma_free(struct device *dev, size_t size, void *vaddr,
 		dma_addr_t dma_handle, unsigned long attrs)
 {
 	free_pages((unsigned long)vaddr, get_order(size));
@@ -96,8 +96,8 @@ static void m68k_dma_free(struct device *dev, size_t size, void *vaddr,
 
 #endif /* CONFIG_MMU && !CONFIG_COLDFIRE */
 
-static void m68k_dma_sync_single_for_device(struct device *dev,
-		dma_addr_t handle, size_t size, enum dma_data_direction dir)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t handle,
+		size_t size, enum dma_data_direction dir)
 {
 	switch (dir) {
 	case DMA_BIDIRECTIONAL:
@@ -113,55 +113,3 @@ static void m68k_dma_sync_single_for_device(struct device *dev,
 		break;
 	}
 }
-
-static void m68k_dma_sync_sg_for_device(struct device *dev,
-		struct scatterlist *sglist, int nents, enum dma_data_direction dir)
-{
-	int i;
-	struct scatterlist *sg;
-
-	for_each_sg(sglist, sg, nents, i) {
-		dma_sync_single_for_device(dev, sg->dma_address, sg->length,
-					   dir);
-	}
-}
-
-static dma_addr_t m68k_dma_map_page(struct device *dev, struct page *page,
-		unsigned long offset, size_t size, enum dma_data_direction dir,
-		unsigned long attrs)
-{
-	dma_addr_t handle = page_to_phys(page) + offset;
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		dma_sync_single_for_device(dev, handle, size, dir);
-
-	return handle;
-}
-
-static int m68k_dma_map_sg(struct device *dev, struct scatterlist *sglist,
-		int nents, enum dma_data_direction dir, unsigned long attrs)
-{
-	int i;
-	struct scatterlist *sg;
-
-	for_each_sg(sglist, sg, nents, i) {
-		sg->dma_address = sg_phys(sg);
-
-		if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-			continue;
-
-		dma_sync_single_for_device(dev, sg->dma_address, sg->length,
-					   dir);
-	}
-	return nents;
-}
-
-const struct dma_map_ops m68k_dma_ops = {
-	.alloc			= m68k_dma_alloc,
-	.free			= m68k_dma_free,
-	.map_page		= m68k_dma_map_page,
-	.map_sg			= m68k_dma_map_sg,
-	.sync_single_for_device	= m68k_dma_sync_single_for_device,
-	.sync_sg_for_device	= m68k_dma_sync_sg_for_device,
-};
-EXPORT_SYMBOL(m68k_dma_ops);
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 10/22] m68k: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  To: linux-snps-arc

Switch to the generic noncoherent direct mapping implementation.

Signed-off-by: Christoph Hellwig <hch at lst.de>
---
 arch/m68k/Kconfig                   |  2 +
 arch/m68k/include/asm/Kbuild        |  1 +
 arch/m68k/include/asm/dma-mapping.h | 12 -----
 arch/m68k/kernel/dma.c              | 68 ++++-------------------------
 4 files changed, 11 insertions(+), 72 deletions(-)
 delete mode 100644 arch/m68k/include/asm/dma-mapping.h

diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 785612b576f7..3f61327da2d5 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -2,6 +2,7 @@
 config M68K
 	bool
 	default y
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE if HAS_DMA
 	select ARCH_MIGHT_HAVE_PC_PARPORT if ISA
 	select ARCH_NO_COHERENT_DMA_MMAP if !MMU
 	select HAVE_IDE
@@ -24,6 +25,7 @@ config M68K
 	select MODULES_USE_ELF_RELA
 	select OLD_SIGSUSPEND3
 	select OLD_SIGACTION
+	select DMA_NONCOHERENT_OPS if HAS_DMA
 
 config CPU_BIG_ENDIAN
 	def_bool y
diff --git a/arch/m68k/include/asm/Kbuild b/arch/m68k/include/asm/Kbuild
index 88a9d27df1ac..a853c00f1374 100644
--- a/arch/m68k/include/asm/Kbuild
+++ b/arch/m68k/include/asm/Kbuild
@@ -1,5 +1,6 @@
 generic-y += barrier.h
 generic-y += device.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += exec.h
 generic-y += extable.h
diff --git a/arch/m68k/include/asm/dma-mapping.h b/arch/m68k/include/asm/dma-mapping.h
deleted file mode 100644
index e3722ed04fbb..000000000000
--- a/arch/m68k/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,12 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef _M68K_DMA_MAPPING_H
-#define _M68K_DMA_MAPPING_H
-
-extern const struct dma_map_ops m68k_dma_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-        return &m68k_dma_ops;
-}
-
-#endif  /* _M68K_DMA_MAPPING_H */
diff --git a/arch/m68k/kernel/dma.c b/arch/m68k/kernel/dma.c
index c01b9b8f97bf..3d561c577d35 100644
--- a/arch/m68k/kernel/dma.c
+++ b/arch/m68k/kernel/dma.c
@@ -6,7 +6,7 @@
 
 #undef DEBUG
 
-#include <linux/dma-mapping.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/device.h>
 #include <linux/kernel.h>
 #include <linux/scatterlist.h>
@@ -18,7 +18,7 @@
 
 #if defined(CONFIG_MMU) && !defined(CONFIG_COLDFIRE)
 
-static void *m68k_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
 		gfp_t flag, unsigned long attrs)
 {
 	struct page *page, **map;
@@ -61,7 +61,7 @@ static void *m68k_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
 	return addr;
 }
 
-static void m68k_dma_free(struct device *dev, size_t size, void *addr,
+void arch_dma_free(struct device *dev, size_t size, void *addr,
 		dma_addr_t handle, unsigned long attrs)
 {
 	pr_debug("dma_free_coherent: %p, %x\n", addr, handle);
@@ -72,8 +72,8 @@ static void m68k_dma_free(struct device *dev, size_t size, void *addr,
 
 #include <asm/cacheflush.h>
 
-static void *m68k_dma_alloc(struct device *dev, size_t size,
-		dma_addr_t *dma_handle, gfp_t gfp, unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	void *ret;
 
@@ -88,7 +88,7 @@ static void *m68k_dma_alloc(struct device *dev, size_t size,
 	return ret;
 }
 
-static void m68k_dma_free(struct device *dev, size_t size, void *vaddr,
+void arch_dma_free(struct device *dev, size_t size, void *vaddr,
 		dma_addr_t dma_handle, unsigned long attrs)
 {
 	free_pages((unsigned long)vaddr, get_order(size));
@@ -96,8 +96,8 @@ static void m68k_dma_free(struct device *dev, size_t size, void *vaddr,
 
 #endif /* CONFIG_MMU && !CONFIG_COLDFIRE */
 
-static void m68k_dma_sync_single_for_device(struct device *dev,
-		dma_addr_t handle, size_t size, enum dma_data_direction dir)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t handle,
+		size_t size, enum dma_data_direction dir)
 {
 	switch (dir) {
 	case DMA_BIDIRECTIONAL:
@@ -113,55 +113,3 @@ static void m68k_dma_sync_single_for_device(struct device *dev,
 		break;
 	}
 }
-
-static void m68k_dma_sync_sg_for_device(struct device *dev,
-		struct scatterlist *sglist, int nents, enum dma_data_direction dir)
-{
-	int i;
-	struct scatterlist *sg;
-
-	for_each_sg(sglist, sg, nents, i) {
-		dma_sync_single_for_device(dev, sg->dma_address, sg->length,
-					   dir);
-	}
-}
-
-static dma_addr_t m68k_dma_map_page(struct device *dev, struct page *page,
-		unsigned long offset, size_t size, enum dma_data_direction dir,
-		unsigned long attrs)
-{
-	dma_addr_t handle = page_to_phys(page) + offset;
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		dma_sync_single_for_device(dev, handle, size, dir);
-
-	return handle;
-}
-
-static int m68k_dma_map_sg(struct device *dev, struct scatterlist *sglist,
-		int nents, enum dma_data_direction dir, unsigned long attrs)
-{
-	int i;
-	struct scatterlist *sg;
-
-	for_each_sg(sglist, sg, nents, i) {
-		sg->dma_address = sg_phys(sg);
-
-		if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-			continue;
-
-		dma_sync_single_for_device(dev, sg->dma_address, sg->length,
-					   dir);
-	}
-	return nents;
-}
-
-const struct dma_map_ops m68k_dma_ops = {
-	.alloc			= m68k_dma_alloc,
-	.free			= m68k_dma_free,
-	.map_page		= m68k_dma_map_page,
-	.map_sg			= m68k_dma_map_sg,
-	.sync_single_for_device	= m68k_dma_sync_single_for_device,
-	.sync_sg_for_device	= m68k_dma_sync_sg_for_device,
-};
-EXPORT_SYMBOL(m68k_dma_ops);
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 10/22] m68k: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  Cc: linux-arch, linux-xtensa, Michal Simek, Vincent Chen,
	linux-c6x-dev, linux-parisc, linux-sh, linux-hexagon,
	linux-kernel, linux-m68k, openrisc, Greentime Hu, linux-alpha,
	sparclinux, nios2-dev, linux-snps-arc, linux-arm-kernel

Switch to the generic noncoherent direct mapping implementation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/m68k/Kconfig                   |  2 +
 arch/m68k/include/asm/Kbuild        |  1 +
 arch/m68k/include/asm/dma-mapping.h | 12 -----
 arch/m68k/kernel/dma.c              | 68 ++++-------------------------
 4 files changed, 11 insertions(+), 72 deletions(-)
 delete mode 100644 arch/m68k/include/asm/dma-mapping.h

diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 785612b576f7..3f61327da2d5 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -2,6 +2,7 @@
 config M68K
 	bool
 	default y
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE if HAS_DMA
 	select ARCH_MIGHT_HAVE_PC_PARPORT if ISA
 	select ARCH_NO_COHERENT_DMA_MMAP if !MMU
 	select HAVE_IDE
@@ -24,6 +25,7 @@ config M68K
 	select MODULES_USE_ELF_RELA
 	select OLD_SIGSUSPEND3
 	select OLD_SIGACTION
+	select DMA_NONCOHERENT_OPS if HAS_DMA
 
 config CPU_BIG_ENDIAN
 	def_bool y
diff --git a/arch/m68k/include/asm/Kbuild b/arch/m68k/include/asm/Kbuild
index 88a9d27df1ac..a853c00f1374 100644
--- a/arch/m68k/include/asm/Kbuild
+++ b/arch/m68k/include/asm/Kbuild
@@ -1,5 +1,6 @@
 generic-y += barrier.h
 generic-y += device.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += exec.h
 generic-y += extable.h
diff --git a/arch/m68k/include/asm/dma-mapping.h b/arch/m68k/include/asm/dma-mapping.h
deleted file mode 100644
index e3722ed04fbb..000000000000
--- a/arch/m68k/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,12 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef _M68K_DMA_MAPPING_H
-#define _M68K_DMA_MAPPING_H
-
-extern const struct dma_map_ops m68k_dma_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-        return &m68k_dma_ops;
-}
-
-#endif  /* _M68K_DMA_MAPPING_H */
diff --git a/arch/m68k/kernel/dma.c b/arch/m68k/kernel/dma.c
index c01b9b8f97bf..3d561c577d35 100644
--- a/arch/m68k/kernel/dma.c
+++ b/arch/m68k/kernel/dma.c
@@ -6,7 +6,7 @@
 
 #undef DEBUG
 
-#include <linux/dma-mapping.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/device.h>
 #include <linux/kernel.h>
 #include <linux/scatterlist.h>
@@ -18,7 +18,7 @@
 
 #if defined(CONFIG_MMU) && !defined(CONFIG_COLDFIRE)
 
-static void *m68k_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
 		gfp_t flag, unsigned long attrs)
 {
 	struct page *page, **map;
@@ -61,7 +61,7 @@ static void *m68k_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
 	return addr;
 }
 
-static void m68k_dma_free(struct device *dev, size_t size, void *addr,
+void arch_dma_free(struct device *dev, size_t size, void *addr,
 		dma_addr_t handle, unsigned long attrs)
 {
 	pr_debug("dma_free_coherent: %p, %x\n", addr, handle);
@@ -72,8 +72,8 @@ static void m68k_dma_free(struct device *dev, size_t size, void *addr,
 
 #include <asm/cacheflush.h>
 
-static void *m68k_dma_alloc(struct device *dev, size_t size,
-		dma_addr_t *dma_handle, gfp_t gfp, unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	void *ret;
 
@@ -88,7 +88,7 @@ static void *m68k_dma_alloc(struct device *dev, size_t size,
 	return ret;
 }
 
-static void m68k_dma_free(struct device *dev, size_t size, void *vaddr,
+void arch_dma_free(struct device *dev, size_t size, void *vaddr,
 		dma_addr_t dma_handle, unsigned long attrs)
 {
 	free_pages((unsigned long)vaddr, get_order(size));
@@ -96,8 +96,8 @@ static void m68k_dma_free(struct device *dev, size_t size, void *vaddr,
 
 #endif /* CONFIG_MMU && !CONFIG_COLDFIRE */
 
-static void m68k_dma_sync_single_for_device(struct device *dev,
-		dma_addr_t handle, size_t size, enum dma_data_direction dir)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t handle,
+		size_t size, enum dma_data_direction dir)
 {
 	switch (dir) {
 	case DMA_BIDIRECTIONAL:
@@ -113,55 +113,3 @@ static void m68k_dma_sync_single_for_device(struct device *dev,
 		break;
 	}
 }
-
-static void m68k_dma_sync_sg_for_device(struct device *dev,
-		struct scatterlist *sglist, int nents, enum dma_data_direction dir)
-{
-	int i;
-	struct scatterlist *sg;
-
-	for_each_sg(sglist, sg, nents, i) {
-		dma_sync_single_for_device(dev, sg->dma_address, sg->length,
-					   dir);
-	}
-}
-
-static dma_addr_t m68k_dma_map_page(struct device *dev, struct page *page,
-		unsigned long offset, size_t size, enum dma_data_direction dir,
-		unsigned long attrs)
-{
-	dma_addr_t handle = page_to_phys(page) + offset;
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		dma_sync_single_for_device(dev, handle, size, dir);
-
-	return handle;
-}
-
-static int m68k_dma_map_sg(struct device *dev, struct scatterlist *sglist,
-		int nents, enum dma_data_direction dir, unsigned long attrs)
-{
-	int i;
-	struct scatterlist *sg;
-
-	for_each_sg(sglist, sg, nents, i) {
-		sg->dma_address = sg_phys(sg);
-
-		if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-			continue;
-
-		dma_sync_single_for_device(dev, sg->dma_address, sg->length,
-					   dir);
-	}
-	return nents;
-}
-
-const struct dma_map_ops m68k_dma_ops = {
-	.alloc			= m68k_dma_alloc,
-	.free			= m68k_dma_free,
-	.map_page		= m68k_dma_map_page,
-	.map_sg			= m68k_dma_map_sg,
-	.sync_single_for_device	= m68k_dma_sync_single_for_device,
-	.sync_sg_for_device	= m68k_dma_sync_sg_for_device,
-};
-EXPORT_SYMBOL(m68k_dma_ops);
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [OpenRISC] [PATCH 10/22] m68k: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  To: openrisc

Switch to the generic noncoherent direct mapping implementation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/m68k/Kconfig                   |  2 +
 arch/m68k/include/asm/Kbuild        |  1 +
 arch/m68k/include/asm/dma-mapping.h | 12 -----
 arch/m68k/kernel/dma.c              | 68 ++++-------------------------
 4 files changed, 11 insertions(+), 72 deletions(-)
 delete mode 100644 arch/m68k/include/asm/dma-mapping.h

diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 785612b576f7..3f61327da2d5 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -2,6 +2,7 @@
 config M68K
 	bool
 	default y
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE if HAS_DMA
 	select ARCH_MIGHT_HAVE_PC_PARPORT if ISA
 	select ARCH_NO_COHERENT_DMA_MMAP if !MMU
 	select HAVE_IDE
@@ -24,6 +25,7 @@ config M68K
 	select MODULES_USE_ELF_RELA
 	select OLD_SIGSUSPEND3
 	select OLD_SIGACTION
+	select DMA_NONCOHERENT_OPS if HAS_DMA
 
 config CPU_BIG_ENDIAN
 	def_bool y
diff --git a/arch/m68k/include/asm/Kbuild b/arch/m68k/include/asm/Kbuild
index 88a9d27df1ac..a853c00f1374 100644
--- a/arch/m68k/include/asm/Kbuild
+++ b/arch/m68k/include/asm/Kbuild
@@ -1,5 +1,6 @@
 generic-y += barrier.h
 generic-y += device.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += exec.h
 generic-y += extable.h
diff --git a/arch/m68k/include/asm/dma-mapping.h b/arch/m68k/include/asm/dma-mapping.h
deleted file mode 100644
index e3722ed04fbb..000000000000
--- a/arch/m68k/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,12 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef _M68K_DMA_MAPPING_H
-#define _M68K_DMA_MAPPING_H
-
-extern const struct dma_map_ops m68k_dma_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-        return &m68k_dma_ops;
-}
-
-#endif  /* _M68K_DMA_MAPPING_H */
diff --git a/arch/m68k/kernel/dma.c b/arch/m68k/kernel/dma.c
index c01b9b8f97bf..3d561c577d35 100644
--- a/arch/m68k/kernel/dma.c
+++ b/arch/m68k/kernel/dma.c
@@ -6,7 +6,7 @@
 
 #undef DEBUG
 
-#include <linux/dma-mapping.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/device.h>
 #include <linux/kernel.h>
 #include <linux/scatterlist.h>
@@ -18,7 +18,7 @@
 
 #if defined(CONFIG_MMU) && !defined(CONFIG_COLDFIRE)
 
-static void *m68k_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
 		gfp_t flag, unsigned long attrs)
 {
 	struct page *page, **map;
@@ -61,7 +61,7 @@ static void *m68k_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
 	return addr;
 }
 
-static void m68k_dma_free(struct device *dev, size_t size, void *addr,
+void arch_dma_free(struct device *dev, size_t size, void *addr,
 		dma_addr_t handle, unsigned long attrs)
 {
 	pr_debug("dma_free_coherent: %p, %x\n", addr, handle);
@@ -72,8 +72,8 @@ static void m68k_dma_free(struct device *dev, size_t size, void *addr,
 
 #include <asm/cacheflush.h>
 
-static void *m68k_dma_alloc(struct device *dev, size_t size,
-		dma_addr_t *dma_handle, gfp_t gfp, unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	void *ret;
 
@@ -88,7 +88,7 @@ static void *m68k_dma_alloc(struct device *dev, size_t size,
 	return ret;
 }
 
-static void m68k_dma_free(struct device *dev, size_t size, void *vaddr,
+void arch_dma_free(struct device *dev, size_t size, void *vaddr,
 		dma_addr_t dma_handle, unsigned long attrs)
 {
 	free_pages((unsigned long)vaddr, get_order(size));
@@ -96,8 +96,8 @@ static void m68k_dma_free(struct device *dev, size_t size, void *vaddr,
 
 #endif /* CONFIG_MMU && !CONFIG_COLDFIRE */
 
-static void m68k_dma_sync_single_for_device(struct device *dev,
-		dma_addr_t handle, size_t size, enum dma_data_direction dir)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t handle,
+		size_t size, enum dma_data_direction dir)
 {
 	switch (dir) {
 	case DMA_BIDIRECTIONAL:
@@ -113,55 +113,3 @@ static void m68k_dma_sync_single_for_device(struct device *dev,
 		break;
 	}
 }
-
-static void m68k_dma_sync_sg_for_device(struct device *dev,
-		struct scatterlist *sglist, int nents, enum dma_data_direction dir)
-{
-	int i;
-	struct scatterlist *sg;
-
-	for_each_sg(sglist, sg, nents, i) {
-		dma_sync_single_for_device(dev, sg->dma_address, sg->length,
-					   dir);
-	}
-}
-
-static dma_addr_t m68k_dma_map_page(struct device *dev, struct page *page,
-		unsigned long offset, size_t size, enum dma_data_direction dir,
-		unsigned long attrs)
-{
-	dma_addr_t handle = page_to_phys(page) + offset;
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		dma_sync_single_for_device(dev, handle, size, dir);
-
-	return handle;
-}
-
-static int m68k_dma_map_sg(struct device *dev, struct scatterlist *sglist,
-		int nents, enum dma_data_direction dir, unsigned long attrs)
-{
-	int i;
-	struct scatterlist *sg;
-
-	for_each_sg(sglist, sg, nents, i) {
-		sg->dma_address = sg_phys(sg);
-
-		if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-			continue;
-
-		dma_sync_single_for_device(dev, sg->dma_address, sg->length,
-					   dir);
-	}
-	return nents;
-}
-
-const struct dma_map_ops m68k_dma_ops = {
-	.alloc			= m68k_dma_alloc,
-	.free			= m68k_dma_free,
-	.map_page		= m68k_dma_map_page,
-	.map_sg			= m68k_dma_map_sg,
-	.sync_single_for_device	= m68k_dma_sync_single_for_device,
-	.sync_sg_for_device	= m68k_dma_sync_sg_for_device,
-};
-EXPORT_SYMBOL(m68k_dma_ops);
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 10/22] m68k: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  To: linux-arm-kernel

Switch to the generic noncoherent direct mapping implementation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/m68k/Kconfig                   |  2 +
 arch/m68k/include/asm/Kbuild        |  1 +
 arch/m68k/include/asm/dma-mapping.h | 12 -----
 arch/m68k/kernel/dma.c              | 68 ++++-------------------------
 4 files changed, 11 insertions(+), 72 deletions(-)
 delete mode 100644 arch/m68k/include/asm/dma-mapping.h

diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 785612b576f7..3f61327da2d5 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -2,6 +2,7 @@
 config M68K
 	bool
 	default y
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE if HAS_DMA
 	select ARCH_MIGHT_HAVE_PC_PARPORT if ISA
 	select ARCH_NO_COHERENT_DMA_MMAP if !MMU
 	select HAVE_IDE
@@ -24,6 +25,7 @@ config M68K
 	select MODULES_USE_ELF_RELA
 	select OLD_SIGSUSPEND3
 	select OLD_SIGACTION
+	select DMA_NONCOHERENT_OPS if HAS_DMA
 
 config CPU_BIG_ENDIAN
 	def_bool y
diff --git a/arch/m68k/include/asm/Kbuild b/arch/m68k/include/asm/Kbuild
index 88a9d27df1ac..a853c00f1374 100644
--- a/arch/m68k/include/asm/Kbuild
+++ b/arch/m68k/include/asm/Kbuild
@@ -1,5 +1,6 @@
 generic-y += barrier.h
 generic-y += device.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += exec.h
 generic-y += extable.h
diff --git a/arch/m68k/include/asm/dma-mapping.h b/arch/m68k/include/asm/dma-mapping.h
deleted file mode 100644
index e3722ed04fbb..000000000000
--- a/arch/m68k/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,12 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef _M68K_DMA_MAPPING_H
-#define _M68K_DMA_MAPPING_H
-
-extern const struct dma_map_ops m68k_dma_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-        return &m68k_dma_ops;
-}
-
-#endif  /* _M68K_DMA_MAPPING_H */
diff --git a/arch/m68k/kernel/dma.c b/arch/m68k/kernel/dma.c
index c01b9b8f97bf..3d561c577d35 100644
--- a/arch/m68k/kernel/dma.c
+++ b/arch/m68k/kernel/dma.c
@@ -6,7 +6,7 @@
 
 #undef DEBUG
 
-#include <linux/dma-mapping.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/device.h>
 #include <linux/kernel.h>
 #include <linux/scatterlist.h>
@@ -18,7 +18,7 @@
 
 #if defined(CONFIG_MMU) && !defined(CONFIG_COLDFIRE)
 
-static void *m68k_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
 		gfp_t flag, unsigned long attrs)
 {
 	struct page *page, **map;
@@ -61,7 +61,7 @@ static void *m68k_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
 	return addr;
 }
 
-static void m68k_dma_free(struct device *dev, size_t size, void *addr,
+void arch_dma_free(struct device *dev, size_t size, void *addr,
 		dma_addr_t handle, unsigned long attrs)
 {
 	pr_debug("dma_free_coherent: %p, %x\n", addr, handle);
@@ -72,8 +72,8 @@ static void m68k_dma_free(struct device *dev, size_t size, void *addr,
 
 #include <asm/cacheflush.h>
 
-static void *m68k_dma_alloc(struct device *dev, size_t size,
-		dma_addr_t *dma_handle, gfp_t gfp, unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	void *ret;
 
@@ -88,7 +88,7 @@ static void *m68k_dma_alloc(struct device *dev, size_t size,
 	return ret;
 }
 
-static void m68k_dma_free(struct device *dev, size_t size, void *vaddr,
+void arch_dma_free(struct device *dev, size_t size, void *vaddr,
 		dma_addr_t dma_handle, unsigned long attrs)
 {
 	free_pages((unsigned long)vaddr, get_order(size));
@@ -96,8 +96,8 @@ static void m68k_dma_free(struct device *dev, size_t size, void *vaddr,
 
 #endif /* CONFIG_MMU && !CONFIG_COLDFIRE */
 
-static void m68k_dma_sync_single_for_device(struct device *dev,
-		dma_addr_t handle, size_t size, enum dma_data_direction dir)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t handle,
+		size_t size, enum dma_data_direction dir)
 {
 	switch (dir) {
 	case DMA_BIDIRECTIONAL:
@@ -113,55 +113,3 @@ static void m68k_dma_sync_single_for_device(struct device *dev,
 		break;
 	}
 }
-
-static void m68k_dma_sync_sg_for_device(struct device *dev,
-		struct scatterlist *sglist, int nents, enum dma_data_direction dir)
-{
-	int i;
-	struct scatterlist *sg;
-
-	for_each_sg(sglist, sg, nents, i) {
-		dma_sync_single_for_device(dev, sg->dma_address, sg->length,
-					   dir);
-	}
-}
-
-static dma_addr_t m68k_dma_map_page(struct device *dev, struct page *page,
-		unsigned long offset, size_t size, enum dma_data_direction dir,
-		unsigned long attrs)
-{
-	dma_addr_t handle = page_to_phys(page) + offset;
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		dma_sync_single_for_device(dev, handle, size, dir);
-
-	return handle;
-}
-
-static int m68k_dma_map_sg(struct device *dev, struct scatterlist *sglist,
-		int nents, enum dma_data_direction dir, unsigned long attrs)
-{
-	int i;
-	struct scatterlist *sg;
-
-	for_each_sg(sglist, sg, nents, i) {
-		sg->dma_address = sg_phys(sg);
-
-		if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-			continue;
-
-		dma_sync_single_for_device(dev, sg->dma_address, sg->length,
-					   dir);
-	}
-	return nents;
-}
-
-const struct dma_map_ops m68k_dma_ops = {
-	.alloc			= m68k_dma_alloc,
-	.free			= m68k_dma_free,
-	.map_page		= m68k_dma_map_page,
-	.map_sg			= m68k_dma_map_sg,
-	.sync_single_for_device	= m68k_dma_sync_single_for_device,
-	.sync_sg_for_device	= m68k_dma_sync_sg_for_device,
-};
-EXPORT_SYMBOL(m68k_dma_ops);
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 11/22] microblaze: use generic dma_noncoherent_ops
  2018-04-20  8:02 ` Christoph Hellwig
                     ` (4 preceding siblings ...)
  (?)
@ 2018-04-20  8:03   ` Christoph Hellwig
  -1 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Switch to the generic noncoherent direct mapping implementation.

This removes the direction-based optimizations in
sync_{single,sg}_for_{cpu,device} which were marked untestested and
do not match the usually very well tested {un,}map_{single,sg}
implementations.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/microblaze/Kconfig                   |   4 +
 arch/microblaze/include/asm/Kbuild        |   1 +
 arch/microblaze/include/asm/dma-mapping.h |  28 -----
 arch/microblaze/include/asm/pgtable.h     |   2 -
 arch/microblaze/kernel/dma.c              | 144 ++--------------------
 arch/microblaze/mm/consistent.c           |   9 +-
 6 files changed, 22 insertions(+), 166 deletions(-)
 delete mode 100644 arch/microblaze/include/asm/dma-mapping.h

diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig
index 3817a3e2146c..91b9b999eb18 100644
--- a/arch/microblaze/Kconfig
+++ b/arch/microblaze/Kconfig
@@ -1,6 +1,8 @@
 config MICROBLAZE
 	def_bool y
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select ARCH_HAS_GCOV_PROFILE_ALL
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
 	select ARCH_MIGHT_HAVE_PC_PARPORT
 	select ARCH_NO_COHERENT_DMA_MMAP if !MMU
 	select ARCH_WANT_IPC_PARSE_VERSION
@@ -8,6 +10,8 @@ config MICROBLAZE
 	select TIMER_OF
 	select CLONE_BACKWARDS3
 	select COMMON_CLK
+	select DMA_NONCOHERENT_OPS
+	select DMA_NONCOHERENT_MMAP
 	select GENERIC_ATOMIC64
 	select GENERIC_CLOCKEVENTS
 	select GENERIC_CPU_DEVICES
diff --git a/arch/microblaze/include/asm/Kbuild b/arch/microblaze/include/asm/Kbuild
index 3c80a5a308ed..8d3e71f43a3e 100644
--- a/arch/microblaze/include/asm/Kbuild
+++ b/arch/microblaze/include/asm/Kbuild
@@ -4,6 +4,7 @@ generic-y += bug.h
 generic-y += bugs.h
 generic-y += device.h
 generic-y += div64.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += exec.h
 generic-y += extable.h
diff --git a/arch/microblaze/include/asm/dma-mapping.h b/arch/microblaze/include/asm/dma-mapping.h
deleted file mode 100644
index add50c1373bf..000000000000
--- a/arch/microblaze/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Implements the generic device dma API for microblaze and the pci
- *
- * Copyright (C) 2009-2010 Michal Simek <monstr@monstr.eu>
- * Copyright (C) 2009-2010 PetaLogix
- *
- * This file is subject to the terms and conditions of the GNU General
- * Public License. See the file COPYING in the main directory of this
- * archive for more details.
- *
- * This file is base on powerpc and x86 dma-mapping.h versions
- * Copyright (C) 2004 IBM
- */
-
-#ifndef _ASM_MICROBLAZE_DMA_MAPPING_H
-#define _ASM_MICROBLAZE_DMA_MAPPING_H
-
-/*
- * Available generic sets of operations
- */
-extern const struct dma_map_ops dma_nommu_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return &dma_nommu_ops;
-}
-
-#endif	/* _ASM_MICROBLAZE_DMA_MAPPING_H */
diff --git a/arch/microblaze/include/asm/pgtable.h b/arch/microblaze/include/asm/pgtable.h
index e53b8532353c..5174733fb489 100644
--- a/arch/microblaze/include/asm/pgtable.h
+++ b/arch/microblaze/include/asm/pgtable.h
@@ -551,8 +551,6 @@ void __init *early_get_page(void);
 
 extern unsigned long ioremap_bot, ioremap_base;
 
-void *consistent_alloc(gfp_t gfp, size_t size, dma_addr_t *dma_handle);
-void consistent_free(size_t size, void *vaddr);
 void consistent_sync(void *vaddr, size_t size, int direction);
 void consistent_sync_page(struct page *page, unsigned long offset,
 	size_t size, int direction);
diff --git a/arch/microblaze/kernel/dma.c b/arch/microblaze/kernel/dma.c
index 3145e7dc8ab1..71032cf64669 100644
--- a/arch/microblaze/kernel/dma.c
+++ b/arch/microblaze/kernel/dma.c
@@ -8,29 +8,15 @@
  */
 
 #include <linux/device.h>
-#include <linux/dma-mapping.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/gfp.h>
 #include <linux/dma-debug.h>
 #include <linux/export.h>
 #include <linux/bug.h>
 #include <asm/cacheflush.h>
 
-static void *dma_nommu_alloc_coherent(struct device *dev, size_t size,
-				       dma_addr_t *dma_handle, gfp_t flag,
-				       unsigned long attrs)
-{
-	return consistent_alloc(flag, size, dma_handle);
-}
-
-static void dma_nommu_free_coherent(struct device *dev, size_t size,
-				     void *vaddr, dma_addr_t dma_handle,
-				     unsigned long attrs)
-{
-	consistent_free(size, vaddr);
-}
-
-static inline void __dma_sync(unsigned long paddr,
-			      size_t size, enum dma_data_direction direction)
+static void __dma_sync(struct device *dev, phys_addr_t paddr, size_t size,
+		enum dma_data_direction direction)
 {
 	switch (direction) {
 	case DMA_TO_DEVICE:
@@ -45,113 +31,21 @@ static inline void __dma_sync(unsigned long paddr,
 	}
 }
 
-static int dma_nommu_map_sg(struct device *dev, struct scatterlist *sgl,
-			     int nents, enum dma_data_direction direction,
-			     unsigned long attrs)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	struct scatterlist *sg;
-	int i;
-
-	/* FIXME this part of code is untested */
-	for_each_sg(sgl, sg, nents, i) {
-		sg->dma_address = sg_phys(sg);
-
-		if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-			continue;
-
-		__dma_sync(sg_phys(sg), sg->length, direction);
-	}
-
-	return nents;
-}
-
-static inline dma_addr_t dma_nommu_map_page(struct device *dev,
-					     struct page *page,
-					     unsigned long offset,
-					     size_t size,
-					     enum dma_data_direction direction,
-					     unsigned long attrs)
-{
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		__dma_sync(page_to_phys(page) + offset, size, direction);
-	return page_to_phys(page) + offset;
+	__dma_sync(dev, paddr, size, dir);
 }
 
-static inline void dma_nommu_unmap_page(struct device *dev,
-					 dma_addr_t dma_address,
-					 size_t size,
-					 enum dma_data_direction direction,
-					 unsigned long attrs)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-/* There is not necessary to do cache cleanup
- *
- * phys_to_virt is here because in __dma_sync_page is __virt_to_phys and
- * dma_address is physical address
- */
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		__dma_sync(dma_address, size, direction);
+	__dma_sync(dev, paddr, size, dir);
 }
 
-static inline void
-dma_nommu_sync_single_for_cpu(struct device *dev,
-			       dma_addr_t dma_handle, size_t size,
-			       enum dma_data_direction direction)
-{
-	/*
-	 * It's pointless to flush the cache as the memory segment
-	 * is given to the CPU
-	 */
-
-	if (direction == DMA_FROM_DEVICE)
-		__dma_sync(dma_handle, size, direction);
-}
-
-static inline void
-dma_nommu_sync_single_for_device(struct device *dev,
-				  dma_addr_t dma_handle, size_t size,
-				  enum dma_data_direction direction)
-{
-	/*
-	 * It's pointless to invalidate the cache if the device isn't
-	 * supposed to write to the relevant region
-	 */
-
-	if (direction == DMA_TO_DEVICE)
-		__dma_sync(dma_handle, size, direction);
-}
-
-static inline void
-dma_nommu_sync_sg_for_cpu(struct device *dev,
-			   struct scatterlist *sgl, int nents,
-			   enum dma_data_direction direction)
-{
-	struct scatterlist *sg;
-	int i;
-
-	/* FIXME this part of code is untested */
-	if (direction == DMA_FROM_DEVICE)
-		for_each_sg(sgl, sg, nents, i)
-			__dma_sync(sg->dma_address, sg->length, direction);
-}
-
-static inline void
-dma_nommu_sync_sg_for_device(struct device *dev,
-			      struct scatterlist *sgl, int nents,
-			      enum dma_data_direction direction)
-{
-	struct scatterlist *sg;
-	int i;
-
-	/* FIXME this part of code is untested */
-	if (direction == DMA_TO_DEVICE)
-		for_each_sg(sgl, sg, nents, i)
-			__dma_sync(sg->dma_address, sg->length, direction);
-}
-
-static
-int dma_nommu_mmap_coherent(struct device *dev, struct vm_area_struct *vma,
-			     void *cpu_addr, dma_addr_t handle, size_t size,
-			     unsigned long attrs)
+int arch_dma_mmap(struct device *dev, struct vm_area_struct *vma,
+		void *cpu_addr, dma_addr_t handle, size_t size,
+		unsigned long attrs)
 {
 #ifdef CONFIG_MMU
 	unsigned long user_count = vma_pages(vma);
@@ -170,17 +64,3 @@ int dma_nommu_mmap_coherent(struct device *dev, struct vm_area_struct *vma,
 	return -ENXIO;
 #endif
 }
-
-const struct dma_map_ops dma_nommu_ops = {
-	.alloc			= dma_nommu_alloc_coherent,
-	.free			= dma_nommu_free_coherent,
-	.mmap			= dma_nommu_mmap_coherent,
-	.map_sg			= dma_nommu_map_sg,
-	.map_page		= dma_nommu_map_page,
-	.unmap_page		= dma_nommu_unmap_page,
-	.sync_single_for_cpu	= dma_nommu_sync_single_for_cpu,
-	.sync_single_for_device	= dma_nommu_sync_single_for_device,
-	.sync_sg_for_cpu	= dma_nommu_sync_sg_for_cpu,
-	.sync_sg_for_device	= dma_nommu_sync_sg_for_device,
-};
-EXPORT_SYMBOL(dma_nommu_ops);
diff --git a/arch/microblaze/mm/consistent.c b/arch/microblaze/mm/consistent.c
index b06c3a7faf20..b9a9c8c3397b 100644
--- a/arch/microblaze/mm/consistent.c
+++ b/arch/microblaze/mm/consistent.c
@@ -33,6 +33,7 @@
 #include <linux/pci.h>
 #include <linux/interrupt.h>
 #include <linux/gfp.h>
+#include <linux/dma-noncoherent.h>
 
 #include <asm/pgalloc.h>
 #include <linux/io.h>
@@ -59,7 +60,8 @@
  * uncached region.  This will no doubt cause big problems if memory allocated
  * here is not also freed properly. -- JW
  */
-void *consistent_alloc(gfp_t gfp, size_t size, dma_addr_t *dma_handle)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	unsigned long order, vaddr;
 	void *ret;
@@ -154,7 +156,6 @@ void *consistent_alloc(gfp_t gfp, size_t size, dma_addr_t *dma_handle)
 
 	return ret;
 }
-EXPORT_SYMBOL(consistent_alloc);
 
 #ifdef CONFIG_MMU
 static pte_t *consistent_virt_to_pte(void *vaddr)
@@ -178,7 +179,8 @@ unsigned long consistent_virt_to_pfn(void *vaddr)
 /*
  * free page(s) as defined by the above mapping.
  */
-void consistent_free(size_t size, void *vaddr)
+void arch_dma_free(struct device *dev, size_t size, void *vaddr,
+		dma_addr_t dma_addr, unsigned long attrs)
 {
 	struct page *page;
 
@@ -218,7 +220,6 @@ void consistent_free(size_t size, void *vaddr)
 	flush_tlb_all();
 #endif
 }
-EXPORT_SYMBOL(consistent_free);
 
 /*
  * make an area consistent.
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 11/22] microblaze: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Switch to the generic noncoherent direct mapping implementation.

This removes the direction-based optimizations in
sync_{single,sg}_for_{cpu,device} which were marked untestested and
do not match the usually very well tested {un,}map_{single,sg}
implementations.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/microblaze/Kconfig                   |   4 +
 arch/microblaze/include/asm/Kbuild        |   1 +
 arch/microblaze/include/asm/dma-mapping.h |  28 -----
 arch/microblaze/include/asm/pgtable.h     |   2 -
 arch/microblaze/kernel/dma.c              | 144 ++--------------------
 arch/microblaze/mm/consistent.c           |   9 +-
 6 files changed, 22 insertions(+), 166 deletions(-)
 delete mode 100644 arch/microblaze/include/asm/dma-mapping.h

diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig
index 3817a3e2146c..91b9b999eb18 100644
--- a/arch/microblaze/Kconfig
+++ b/arch/microblaze/Kconfig
@@ -1,6 +1,8 @@
 config MICROBLAZE
 	def_bool y
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select ARCH_HAS_GCOV_PROFILE_ALL
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
 	select ARCH_MIGHT_HAVE_PC_PARPORT
 	select ARCH_NO_COHERENT_DMA_MMAP if !MMU
 	select ARCH_WANT_IPC_PARSE_VERSION
@@ -8,6 +10,8 @@ config MICROBLAZE
 	select TIMER_OF
 	select CLONE_BACKWARDS3
 	select COMMON_CLK
+	select DMA_NONCOHERENT_OPS
+	select DMA_NONCOHERENT_MMAP
 	select GENERIC_ATOMIC64
 	select GENERIC_CLOCKEVENTS
 	select GENERIC_CPU_DEVICES
diff --git a/arch/microblaze/include/asm/Kbuild b/arch/microblaze/include/asm/Kbuild
index 3c80a5a308ed..8d3e71f43a3e 100644
--- a/arch/microblaze/include/asm/Kbuild
+++ b/arch/microblaze/include/asm/Kbuild
@@ -4,6 +4,7 @@ generic-y += bug.h
 generic-y += bugs.h
 generic-y += device.h
 generic-y += div64.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += exec.h
 generic-y += extable.h
diff --git a/arch/microblaze/include/asm/dma-mapping.h b/arch/microblaze/include/asm/dma-mapping.h
deleted file mode 100644
index add50c1373bf..000000000000
--- a/arch/microblaze/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Implements the generic device dma API for microblaze and the pci
- *
- * Copyright (C) 2009-2010 Michal Simek <monstr@monstr.eu>
- * Copyright (C) 2009-2010 PetaLogix
- *
- * This file is subject to the terms and conditions of the GNU General
- * Public License. See the file COPYING in the main directory of this
- * archive for more details.
- *
- * This file is base on powerpc and x86 dma-mapping.h versions
- * Copyright (C) 2004 IBM
- */
-
-#ifndef _ASM_MICROBLAZE_DMA_MAPPING_H
-#define _ASM_MICROBLAZE_DMA_MAPPING_H
-
-/*
- * Available generic sets of operations
- */
-extern const struct dma_map_ops dma_nommu_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return &dma_nommu_ops;
-}
-
-#endif	/* _ASM_MICROBLAZE_DMA_MAPPING_H */
diff --git a/arch/microblaze/include/asm/pgtable.h b/arch/microblaze/include/asm/pgtable.h
index e53b8532353c..5174733fb489 100644
--- a/arch/microblaze/include/asm/pgtable.h
+++ b/arch/microblaze/include/asm/pgtable.h
@@ -551,8 +551,6 @@ void __init *early_get_page(void);
 
 extern unsigned long ioremap_bot, ioremap_base;
 
-void *consistent_alloc(gfp_t gfp, size_t size, dma_addr_t *dma_handle);
-void consistent_free(size_t size, void *vaddr);
 void consistent_sync(void *vaddr, size_t size, int direction);
 void consistent_sync_page(struct page *page, unsigned long offset,
 	size_t size, int direction);
diff --git a/arch/microblaze/kernel/dma.c b/arch/microblaze/kernel/dma.c
index 3145e7dc8ab1..71032cf64669 100644
--- a/arch/microblaze/kernel/dma.c
+++ b/arch/microblaze/kernel/dma.c
@@ -8,29 +8,15 @@
  */
 
 #include <linux/device.h>
-#include <linux/dma-mapping.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/gfp.h>
 #include <linux/dma-debug.h>
 #include <linux/export.h>
 #include <linux/bug.h>
 #include <asm/cacheflush.h>
 
-static void *dma_nommu_alloc_coherent(struct device *dev, size_t size,
-				       dma_addr_t *dma_handle, gfp_t flag,
-				       unsigned long attrs)
-{
-	return consistent_alloc(flag, size, dma_handle);
-}
-
-static void dma_nommu_free_coherent(struct device *dev, size_t size,
-				     void *vaddr, dma_addr_t dma_handle,
-				     unsigned long attrs)
-{
-	consistent_free(size, vaddr);
-}
-
-static inline void __dma_sync(unsigned long paddr,
-			      size_t size, enum dma_data_direction direction)
+static void __dma_sync(struct device *dev, phys_addr_t paddr, size_t size,
+		enum dma_data_direction direction)
 {
 	switch (direction) {
 	case DMA_TO_DEVICE:
@@ -45,113 +31,21 @@ static inline void __dma_sync(unsigned long paddr,
 	}
 }
 
-static int dma_nommu_map_sg(struct device *dev, struct scatterlist *sgl,
-			     int nents, enum dma_data_direction direction,
-			     unsigned long attrs)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	struct scatterlist *sg;
-	int i;
-
-	/* FIXME this part of code is untested */
-	for_each_sg(sgl, sg, nents, i) {
-		sg->dma_address = sg_phys(sg);
-
-		if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-			continue;
-
-		__dma_sync(sg_phys(sg), sg->length, direction);
-	}
-
-	return nents;
-}
-
-static inline dma_addr_t dma_nommu_map_page(struct device *dev,
-					     struct page *page,
-					     unsigned long offset,
-					     size_t size,
-					     enum dma_data_direction direction,
-					     unsigned long attrs)
-{
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		__dma_sync(page_to_phys(page) + offset, size, direction);
-	return page_to_phys(page) + offset;
+	__dma_sync(dev, paddr, size, dir);
 }
 
-static inline void dma_nommu_unmap_page(struct device *dev,
-					 dma_addr_t dma_address,
-					 size_t size,
-					 enum dma_data_direction direction,
-					 unsigned long attrs)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-/* There is not necessary to do cache cleanup
- *
- * phys_to_virt is here because in __dma_sync_page is __virt_to_phys and
- * dma_address is physical address
- */
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		__dma_sync(dma_address, size, direction);
+	__dma_sync(dev, paddr, size, dir);
 }
 
-static inline void
-dma_nommu_sync_single_for_cpu(struct device *dev,
-			       dma_addr_t dma_handle, size_t size,
-			       enum dma_data_direction direction)
-{
-	/*
-	 * It's pointless to flush the cache as the memory segment
-	 * is given to the CPU
-	 */
-
-	if (direction == DMA_FROM_DEVICE)
-		__dma_sync(dma_handle, size, direction);
-}
-
-static inline void
-dma_nommu_sync_single_for_device(struct device *dev,
-				  dma_addr_t dma_handle, size_t size,
-				  enum dma_data_direction direction)
-{
-	/*
-	 * It's pointless to invalidate the cache if the device isn't
-	 * supposed to write to the relevant region
-	 */
-
-	if (direction == DMA_TO_DEVICE)
-		__dma_sync(dma_handle, size, direction);
-}
-
-static inline void
-dma_nommu_sync_sg_for_cpu(struct device *dev,
-			   struct scatterlist *sgl, int nents,
-			   enum dma_data_direction direction)
-{
-	struct scatterlist *sg;
-	int i;
-
-	/* FIXME this part of code is untested */
-	if (direction == DMA_FROM_DEVICE)
-		for_each_sg(sgl, sg, nents, i)
-			__dma_sync(sg->dma_address, sg->length, direction);
-}
-
-static inline void
-dma_nommu_sync_sg_for_device(struct device *dev,
-			      struct scatterlist *sgl, int nents,
-			      enum dma_data_direction direction)
-{
-	struct scatterlist *sg;
-	int i;
-
-	/* FIXME this part of code is untested */
-	if (direction == DMA_TO_DEVICE)
-		for_each_sg(sgl, sg, nents, i)
-			__dma_sync(sg->dma_address, sg->length, direction);
-}
-
-static
-int dma_nommu_mmap_coherent(struct device *dev, struct vm_area_struct *vma,
-			     void *cpu_addr, dma_addr_t handle, size_t size,
-			     unsigned long attrs)
+int arch_dma_mmap(struct device *dev, struct vm_area_struct *vma,
+		void *cpu_addr, dma_addr_t handle, size_t size,
+		unsigned long attrs)
 {
 #ifdef CONFIG_MMU
 	unsigned long user_count = vma_pages(vma);
@@ -170,17 +64,3 @@ int dma_nommu_mmap_coherent(struct device *dev, struct vm_area_struct *vma,
 	return -ENXIO;
 #endif
 }
-
-const struct dma_map_ops dma_nommu_ops = {
-	.alloc			= dma_nommu_alloc_coherent,
-	.free			= dma_nommu_free_coherent,
-	.mmap			= dma_nommu_mmap_coherent,
-	.map_sg			= dma_nommu_map_sg,
-	.map_page		= dma_nommu_map_page,
-	.unmap_page		= dma_nommu_unmap_page,
-	.sync_single_for_cpu	= dma_nommu_sync_single_for_cpu,
-	.sync_single_for_device	= dma_nommu_sync_single_for_device,
-	.sync_sg_for_cpu	= dma_nommu_sync_sg_for_cpu,
-	.sync_sg_for_device	= dma_nommu_sync_sg_for_device,
-};
-EXPORT_SYMBOL(dma_nommu_ops);
diff --git a/arch/microblaze/mm/consistent.c b/arch/microblaze/mm/consistent.c
index b06c3a7faf20..b9a9c8c3397b 100644
--- a/arch/microblaze/mm/consistent.c
+++ b/arch/microblaze/mm/consistent.c
@@ -33,6 +33,7 @@
 #include <linux/pci.h>
 #include <linux/interrupt.h>
 #include <linux/gfp.h>
+#include <linux/dma-noncoherent.h>
 
 #include <asm/pgalloc.h>
 #include <linux/io.h>
@@ -59,7 +60,8 @@
  * uncached region.  This will no doubt cause big problems if memory allocated
  * here is not also freed properly. -- JW
  */
-void *consistent_alloc(gfp_t gfp, size_t size, dma_addr_t *dma_handle)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	unsigned long order, vaddr;
 	void *ret;
@@ -154,7 +156,6 @@ void *consistent_alloc(gfp_t gfp, size_t size, dma_addr_t *dma_handle)
 
 	return ret;
 }
-EXPORT_SYMBOL(consistent_alloc);
 
 #ifdef CONFIG_MMU
 static pte_t *consistent_virt_to_pte(void *vaddr)
@@ -178,7 +179,8 @@ unsigned long consistent_virt_to_pfn(void *vaddr)
 /*
  * free page(s) as defined by the above mapping.
  */
-void consistent_free(size_t size, void *vaddr)
+void arch_dma_free(struct device *dev, size_t size, void *vaddr,
+		dma_addr_t dma_addr, unsigned long attrs)
 {
 	struct page *page;
 
@@ -218,7 +220,6 @@ void consistent_free(size_t size, void *vaddr)
 	flush_tlb_all();
 #endif
 }
-EXPORT_SYMBOL(consistent_free);
 
 /*
  * make an area consistent.
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 11/22] microblaze: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Switch to the generic noncoherent direct mapping implementation.

This removes the direction-based optimizations in
sync_{single,sg}_for_{cpu,device} which were marked untestested and
do not match the usually very well tested {un,}map_{single,sg}
implementations.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/microblaze/Kconfig                   |   4 +
 arch/microblaze/include/asm/Kbuild        |   1 +
 arch/microblaze/include/asm/dma-mapping.h |  28 -----
 arch/microblaze/include/asm/pgtable.h     |   2 -
 arch/microblaze/kernel/dma.c              | 144 ++--------------------
 arch/microblaze/mm/consistent.c           |   9 +-
 6 files changed, 22 insertions(+), 166 deletions(-)
 delete mode 100644 arch/microblaze/include/asm/dma-mapping.h

diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig
index 3817a3e2146c..91b9b999eb18 100644
--- a/arch/microblaze/Kconfig
+++ b/arch/microblaze/Kconfig
@@ -1,6 +1,8 @@
 config MICROBLAZE
 	def_bool y
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select ARCH_HAS_GCOV_PROFILE_ALL
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
 	select ARCH_MIGHT_HAVE_PC_PARPORT
 	select ARCH_NO_COHERENT_DMA_MMAP if !MMU
 	select ARCH_WANT_IPC_PARSE_VERSION
@@ -8,6 +10,8 @@ config MICROBLAZE
 	select TIMER_OF
 	select CLONE_BACKWARDS3
 	select COMMON_CLK
+	select DMA_NONCOHERENT_OPS
+	select DMA_NONCOHERENT_MMAP
 	select GENERIC_ATOMIC64
 	select GENERIC_CLOCKEVENTS
 	select GENERIC_CPU_DEVICES
diff --git a/arch/microblaze/include/asm/Kbuild b/arch/microblaze/include/asm/Kbuild
index 3c80a5a308ed..8d3e71f43a3e 100644
--- a/arch/microblaze/include/asm/Kbuild
+++ b/arch/microblaze/include/asm/Kbuild
@@ -4,6 +4,7 @@ generic-y += bug.h
 generic-y += bugs.h
 generic-y += device.h
 generic-y += div64.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += exec.h
 generic-y += extable.h
diff --git a/arch/microblaze/include/asm/dma-mapping.h b/arch/microblaze/include/asm/dma-mapping.h
deleted file mode 100644
index add50c1373bf..000000000000
--- a/arch/microblaze/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Implements the generic device dma API for microblaze and the pci
- *
- * Copyright (C) 2009-2010 Michal Simek <monstr@monstr.eu>
- * Copyright (C) 2009-2010 PetaLogix
- *
- * This file is subject to the terms and conditions of the GNU General
- * Public License. See the file COPYING in the main directory of this
- * archive for more details.
- *
- * This file is base on powerpc and x86 dma-mapping.h versions
- * Copyright (C) 2004 IBM
- */
-
-#ifndef _ASM_MICROBLAZE_DMA_MAPPING_H
-#define _ASM_MICROBLAZE_DMA_MAPPING_H
-
-/*
- * Available generic sets of operations
- */
-extern const struct dma_map_ops dma_nommu_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return &dma_nommu_ops;
-}
-
-#endif	/* _ASM_MICROBLAZE_DMA_MAPPING_H */
diff --git a/arch/microblaze/include/asm/pgtable.h b/arch/microblaze/include/asm/pgtable.h
index e53b8532353c..5174733fb489 100644
--- a/arch/microblaze/include/asm/pgtable.h
+++ b/arch/microblaze/include/asm/pgtable.h
@@ -551,8 +551,6 @@ void __init *early_get_page(void);
 
 extern unsigned long ioremap_bot, ioremap_base;
 
-void *consistent_alloc(gfp_t gfp, size_t size, dma_addr_t *dma_handle);
-void consistent_free(size_t size, void *vaddr);
 void consistent_sync(void *vaddr, size_t size, int direction);
 void consistent_sync_page(struct page *page, unsigned long offset,
 	size_t size, int direction);
diff --git a/arch/microblaze/kernel/dma.c b/arch/microblaze/kernel/dma.c
index 3145e7dc8ab1..71032cf64669 100644
--- a/arch/microblaze/kernel/dma.c
+++ b/arch/microblaze/kernel/dma.c
@@ -8,29 +8,15 @@
  */
 
 #include <linux/device.h>
-#include <linux/dma-mapping.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/gfp.h>
 #include <linux/dma-debug.h>
 #include <linux/export.h>
 #include <linux/bug.h>
 #include <asm/cacheflush.h>
 
-static void *dma_nommu_alloc_coherent(struct device *dev, size_t size,
-				       dma_addr_t *dma_handle, gfp_t flag,
-				       unsigned long attrs)
-{
-	return consistent_alloc(flag, size, dma_handle);
-}
-
-static void dma_nommu_free_coherent(struct device *dev, size_t size,
-				     void *vaddr, dma_addr_t dma_handle,
-				     unsigned long attrs)
-{
-	consistent_free(size, vaddr);
-}
-
-static inline void __dma_sync(unsigned long paddr,
-			      size_t size, enum dma_data_direction direction)
+static void __dma_sync(struct device *dev, phys_addr_t paddr, size_t size,
+		enum dma_data_direction direction)
 {
 	switch (direction) {
 	case DMA_TO_DEVICE:
@@ -45,113 +31,21 @@ static inline void __dma_sync(unsigned long paddr,
 	}
 }
 
-static int dma_nommu_map_sg(struct device *dev, struct scatterlist *sgl,
-			     int nents, enum dma_data_direction direction,
-			     unsigned long attrs)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	struct scatterlist *sg;
-	int i;
-
-	/* FIXME this part of code is untested */
-	for_each_sg(sgl, sg, nents, i) {
-		sg->dma_address = sg_phys(sg);
-
-		if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-			continue;
-
-		__dma_sync(sg_phys(sg), sg->length, direction);
-	}
-
-	return nents;
-}
-
-static inline dma_addr_t dma_nommu_map_page(struct device *dev,
-					     struct page *page,
-					     unsigned long offset,
-					     size_t size,
-					     enum dma_data_direction direction,
-					     unsigned long attrs)
-{
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		__dma_sync(page_to_phys(page) + offset, size, direction);
-	return page_to_phys(page) + offset;
+	__dma_sync(dev, paddr, size, dir);
 }
 
-static inline void dma_nommu_unmap_page(struct device *dev,
-					 dma_addr_t dma_address,
-					 size_t size,
-					 enum dma_data_direction direction,
-					 unsigned long attrs)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-/* There is not necessary to do cache cleanup
- *
- * phys_to_virt is here because in __dma_sync_page is __virt_to_phys and
- * dma_address is physical address
- */
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		__dma_sync(dma_address, size, direction);
+	__dma_sync(dev, paddr, size, dir);
 }
 
-static inline void
-dma_nommu_sync_single_for_cpu(struct device *dev,
-			       dma_addr_t dma_handle, size_t size,
-			       enum dma_data_direction direction)
-{
-	/*
-	 * It's pointless to flush the cache as the memory segment
-	 * is given to the CPU
-	 */
-
-	if (direction == DMA_FROM_DEVICE)
-		__dma_sync(dma_handle, size, direction);
-}
-
-static inline void
-dma_nommu_sync_single_for_device(struct device *dev,
-				  dma_addr_t dma_handle, size_t size,
-				  enum dma_data_direction direction)
-{
-	/*
-	 * It's pointless to invalidate the cache if the device isn't
-	 * supposed to write to the relevant region
-	 */
-
-	if (direction == DMA_TO_DEVICE)
-		__dma_sync(dma_handle, size, direction);
-}
-
-static inline void
-dma_nommu_sync_sg_for_cpu(struct device *dev,
-			   struct scatterlist *sgl, int nents,
-			   enum dma_data_direction direction)
-{
-	struct scatterlist *sg;
-	int i;
-
-	/* FIXME this part of code is untested */
-	if (direction == DMA_FROM_DEVICE)
-		for_each_sg(sgl, sg, nents, i)
-			__dma_sync(sg->dma_address, sg->length, direction);
-}
-
-static inline void
-dma_nommu_sync_sg_for_device(struct device *dev,
-			      struct scatterlist *sgl, int nents,
-			      enum dma_data_direction direction)
-{
-	struct scatterlist *sg;
-	int i;
-
-	/* FIXME this part of code is untested */
-	if (direction == DMA_TO_DEVICE)
-		for_each_sg(sgl, sg, nents, i)
-			__dma_sync(sg->dma_address, sg->length, direction);
-}
-
-static
-int dma_nommu_mmap_coherent(struct device *dev, struct vm_area_struct *vma,
-			     void *cpu_addr, dma_addr_t handle, size_t size,
-			     unsigned long attrs)
+int arch_dma_mmap(struct device *dev, struct vm_area_struct *vma,
+		void *cpu_addr, dma_addr_t handle, size_t size,
+		unsigned long attrs)
 {
 #ifdef CONFIG_MMU
 	unsigned long user_count = vma_pages(vma);
@@ -170,17 +64,3 @@ int dma_nommu_mmap_coherent(struct device *dev, struct vm_area_struct *vma,
 	return -ENXIO;
 #endif
 }
-
-const struct dma_map_ops dma_nommu_ops = {
-	.alloc			= dma_nommu_alloc_coherent,
-	.free			= dma_nommu_free_coherent,
-	.mmap			= dma_nommu_mmap_coherent,
-	.map_sg			= dma_nommu_map_sg,
-	.map_page		= dma_nommu_map_page,
-	.unmap_page		= dma_nommu_unmap_page,
-	.sync_single_for_cpu	= dma_nommu_sync_single_for_cpu,
-	.sync_single_for_device	= dma_nommu_sync_single_for_device,
-	.sync_sg_for_cpu	= dma_nommu_sync_sg_for_cpu,
-	.sync_sg_for_device	= dma_nommu_sync_sg_for_device,
-};
-EXPORT_SYMBOL(dma_nommu_ops);
diff --git a/arch/microblaze/mm/consistent.c b/arch/microblaze/mm/consistent.c
index b06c3a7faf20..b9a9c8c3397b 100644
--- a/arch/microblaze/mm/consistent.c
+++ b/arch/microblaze/mm/consistent.c
@@ -33,6 +33,7 @@
 #include <linux/pci.h>
 #include <linux/interrupt.h>
 #include <linux/gfp.h>
+#include <linux/dma-noncoherent.h>
 
 #include <asm/pgalloc.h>
 #include <linux/io.h>
@@ -59,7 +60,8 @@
  * uncached region.  This will no doubt cause big problems if memory allocated
  * here is not also freed properly. -- JW
  */
-void *consistent_alloc(gfp_t gfp, size_t size, dma_addr_t *dma_handle)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	unsigned long order, vaddr;
 	void *ret;
@@ -154,7 +156,6 @@ void *consistent_alloc(gfp_t gfp, size_t size, dma_addr_t *dma_handle)
 
 	return ret;
 }
-EXPORT_SYMBOL(consistent_alloc);
 
 #ifdef CONFIG_MMU
 static pte_t *consistent_virt_to_pte(void *vaddr)
@@ -178,7 +179,8 @@ unsigned long consistent_virt_to_pfn(void *vaddr)
 /*
  * free page(s) as defined by the above mapping.
  */
-void consistent_free(size_t size, void *vaddr)
+void arch_dma_free(struct device *dev, size_t size, void *vaddr,
+		dma_addr_t dma_addr, unsigned long attrs)
 {
 	struct page *page;
 
@@ -218,7 +220,6 @@ void consistent_free(size_t size, void *vaddr)
 	flush_tlb_all();
 #endif
 }
-EXPORT_SYMBOL(consistent_free);
 
 /*
  * make an area consistent.
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 11/22] microblaze: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  To: linux-snps-arc

Switch to the generic noncoherent direct mapping implementation.

This removes the direction-based optimizations in
sync_{single,sg}_for_{cpu,device} which were marked untestested and
do not match the usually very well tested {un,}map_{single,sg}
implementations.

Signed-off-by: Christoph Hellwig <hch at lst.de>
---
 arch/microblaze/Kconfig                   |   4 +
 arch/microblaze/include/asm/Kbuild        |   1 +
 arch/microblaze/include/asm/dma-mapping.h |  28 -----
 arch/microblaze/include/asm/pgtable.h     |   2 -
 arch/microblaze/kernel/dma.c              | 144 ++--------------------
 arch/microblaze/mm/consistent.c           |   9 +-
 6 files changed, 22 insertions(+), 166 deletions(-)
 delete mode 100644 arch/microblaze/include/asm/dma-mapping.h

diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig
index 3817a3e2146c..91b9b999eb18 100644
--- a/arch/microblaze/Kconfig
+++ b/arch/microblaze/Kconfig
@@ -1,6 +1,8 @@
 config MICROBLAZE
 	def_bool y
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select ARCH_HAS_GCOV_PROFILE_ALL
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
 	select ARCH_MIGHT_HAVE_PC_PARPORT
 	select ARCH_NO_COHERENT_DMA_MMAP if !MMU
 	select ARCH_WANT_IPC_PARSE_VERSION
@@ -8,6 +10,8 @@ config MICROBLAZE
 	select TIMER_OF
 	select CLONE_BACKWARDS3
 	select COMMON_CLK
+	select DMA_NONCOHERENT_OPS
+	select DMA_NONCOHERENT_MMAP
 	select GENERIC_ATOMIC64
 	select GENERIC_CLOCKEVENTS
 	select GENERIC_CPU_DEVICES
diff --git a/arch/microblaze/include/asm/Kbuild b/arch/microblaze/include/asm/Kbuild
index 3c80a5a308ed..8d3e71f43a3e 100644
--- a/arch/microblaze/include/asm/Kbuild
+++ b/arch/microblaze/include/asm/Kbuild
@@ -4,6 +4,7 @@ generic-y += bug.h
 generic-y += bugs.h
 generic-y += device.h
 generic-y += div64.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += exec.h
 generic-y += extable.h
diff --git a/arch/microblaze/include/asm/dma-mapping.h b/arch/microblaze/include/asm/dma-mapping.h
deleted file mode 100644
index add50c1373bf..000000000000
--- a/arch/microblaze/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Implements the generic device dma API for microblaze and the pci
- *
- * Copyright (C) 2009-2010 Michal Simek <monstr at monstr.eu>
- * Copyright (C) 2009-2010 PetaLogix
- *
- * This file is subject to the terms and conditions of the GNU General
- * Public License. See the file COPYING in the main directory of this
- * archive for more details.
- *
- * This file is base on powerpc and x86 dma-mapping.h versions
- * Copyright (C) 2004 IBM
- */
-
-#ifndef _ASM_MICROBLAZE_DMA_MAPPING_H
-#define _ASM_MICROBLAZE_DMA_MAPPING_H
-
-/*
- * Available generic sets of operations
- */
-extern const struct dma_map_ops dma_nommu_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return &dma_nommu_ops;
-}
-
-#endif	/* _ASM_MICROBLAZE_DMA_MAPPING_H */
diff --git a/arch/microblaze/include/asm/pgtable.h b/arch/microblaze/include/asm/pgtable.h
index e53b8532353c..5174733fb489 100644
--- a/arch/microblaze/include/asm/pgtable.h
+++ b/arch/microblaze/include/asm/pgtable.h
@@ -551,8 +551,6 @@ void __init *early_get_page(void);
 
 extern unsigned long ioremap_bot, ioremap_base;
 
-void *consistent_alloc(gfp_t gfp, size_t size, dma_addr_t *dma_handle);
-void consistent_free(size_t size, void *vaddr);
 void consistent_sync(void *vaddr, size_t size, int direction);
 void consistent_sync_page(struct page *page, unsigned long offset,
 	size_t size, int direction);
diff --git a/arch/microblaze/kernel/dma.c b/arch/microblaze/kernel/dma.c
index 3145e7dc8ab1..71032cf64669 100644
--- a/arch/microblaze/kernel/dma.c
+++ b/arch/microblaze/kernel/dma.c
@@ -8,29 +8,15 @@
  */
 
 #include <linux/device.h>
-#include <linux/dma-mapping.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/gfp.h>
 #include <linux/dma-debug.h>
 #include <linux/export.h>
 #include <linux/bug.h>
 #include <asm/cacheflush.h>
 
-static void *dma_nommu_alloc_coherent(struct device *dev, size_t size,
-				       dma_addr_t *dma_handle, gfp_t flag,
-				       unsigned long attrs)
-{
-	return consistent_alloc(flag, size, dma_handle);
-}
-
-static void dma_nommu_free_coherent(struct device *dev, size_t size,
-				     void *vaddr, dma_addr_t dma_handle,
-				     unsigned long attrs)
-{
-	consistent_free(size, vaddr);
-}
-
-static inline void __dma_sync(unsigned long paddr,
-			      size_t size, enum dma_data_direction direction)
+static void __dma_sync(struct device *dev, phys_addr_t paddr, size_t size,
+		enum dma_data_direction direction)
 {
 	switch (direction) {
 	case DMA_TO_DEVICE:
@@ -45,113 +31,21 @@ static inline void __dma_sync(unsigned long paddr,
 	}
 }
 
-static int dma_nommu_map_sg(struct device *dev, struct scatterlist *sgl,
-			     int nents, enum dma_data_direction direction,
-			     unsigned long attrs)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	struct scatterlist *sg;
-	int i;
-
-	/* FIXME this part of code is untested */
-	for_each_sg(sgl, sg, nents, i) {
-		sg->dma_address = sg_phys(sg);
-
-		if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-			continue;
-
-		__dma_sync(sg_phys(sg), sg->length, direction);
-	}
-
-	return nents;
-}
-
-static inline dma_addr_t dma_nommu_map_page(struct device *dev,
-					     struct page *page,
-					     unsigned long offset,
-					     size_t size,
-					     enum dma_data_direction direction,
-					     unsigned long attrs)
-{
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		__dma_sync(page_to_phys(page) + offset, size, direction);
-	return page_to_phys(page) + offset;
+	__dma_sync(dev, paddr, size, dir);
 }
 
-static inline void dma_nommu_unmap_page(struct device *dev,
-					 dma_addr_t dma_address,
-					 size_t size,
-					 enum dma_data_direction direction,
-					 unsigned long attrs)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-/* There is not necessary to do cache cleanup
- *
- * phys_to_virt is here because in __dma_sync_page is __virt_to_phys and
- * dma_address is physical address
- */
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		__dma_sync(dma_address, size, direction);
+	__dma_sync(dev, paddr, size, dir);
 }
 
-static inline void
-dma_nommu_sync_single_for_cpu(struct device *dev,
-			       dma_addr_t dma_handle, size_t size,
-			       enum dma_data_direction direction)
-{
-	/*
-	 * It's pointless to flush the cache as the memory segment
-	 * is given to the CPU
-	 */
-
-	if (direction == DMA_FROM_DEVICE)
-		__dma_sync(dma_handle, size, direction);
-}
-
-static inline void
-dma_nommu_sync_single_for_device(struct device *dev,
-				  dma_addr_t dma_handle, size_t size,
-				  enum dma_data_direction direction)
-{
-	/*
-	 * It's pointless to invalidate the cache if the device isn't
-	 * supposed to write to the relevant region
-	 */
-
-	if (direction == DMA_TO_DEVICE)
-		__dma_sync(dma_handle, size, direction);
-}
-
-static inline void
-dma_nommu_sync_sg_for_cpu(struct device *dev,
-			   struct scatterlist *sgl, int nents,
-			   enum dma_data_direction direction)
-{
-	struct scatterlist *sg;
-	int i;
-
-	/* FIXME this part of code is untested */
-	if (direction == DMA_FROM_DEVICE)
-		for_each_sg(sgl, sg, nents, i)
-			__dma_sync(sg->dma_address, sg->length, direction);
-}
-
-static inline void
-dma_nommu_sync_sg_for_device(struct device *dev,
-			      struct scatterlist *sgl, int nents,
-			      enum dma_data_direction direction)
-{
-	struct scatterlist *sg;
-	int i;
-
-	/* FIXME this part of code is untested */
-	if (direction == DMA_TO_DEVICE)
-		for_each_sg(sgl, sg, nents, i)
-			__dma_sync(sg->dma_address, sg->length, direction);
-}
-
-static
-int dma_nommu_mmap_coherent(struct device *dev, struct vm_area_struct *vma,
-			     void *cpu_addr, dma_addr_t handle, size_t size,
-			     unsigned long attrs)
+int arch_dma_mmap(struct device *dev, struct vm_area_struct *vma,
+		void *cpu_addr, dma_addr_t handle, size_t size,
+		unsigned long attrs)
 {
 #ifdef CONFIG_MMU
 	unsigned long user_count = vma_pages(vma);
@@ -170,17 +64,3 @@ int dma_nommu_mmap_coherent(struct device *dev, struct vm_area_struct *vma,
 	return -ENXIO;
 #endif
 }
-
-const struct dma_map_ops dma_nommu_ops = {
-	.alloc			= dma_nommu_alloc_coherent,
-	.free			= dma_nommu_free_coherent,
-	.mmap			= dma_nommu_mmap_coherent,
-	.map_sg			= dma_nommu_map_sg,
-	.map_page		= dma_nommu_map_page,
-	.unmap_page		= dma_nommu_unmap_page,
-	.sync_single_for_cpu	= dma_nommu_sync_single_for_cpu,
-	.sync_single_for_device	= dma_nommu_sync_single_for_device,
-	.sync_sg_for_cpu	= dma_nommu_sync_sg_for_cpu,
-	.sync_sg_for_device	= dma_nommu_sync_sg_for_device,
-};
-EXPORT_SYMBOL(dma_nommu_ops);
diff --git a/arch/microblaze/mm/consistent.c b/arch/microblaze/mm/consistent.c
index b06c3a7faf20..b9a9c8c3397b 100644
--- a/arch/microblaze/mm/consistent.c
+++ b/arch/microblaze/mm/consistent.c
@@ -33,6 +33,7 @@
 #include <linux/pci.h>
 #include <linux/interrupt.h>
 #include <linux/gfp.h>
+#include <linux/dma-noncoherent.h>
 
 #include <asm/pgalloc.h>
 #include <linux/io.h>
@@ -59,7 +60,8 @@
  * uncached region.  This will no doubt cause big problems if memory allocated
  * here is not also freed properly. -- JW
  */
-void *consistent_alloc(gfp_t gfp, size_t size, dma_addr_t *dma_handle)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	unsigned long order, vaddr;
 	void *ret;
@@ -154,7 +156,6 @@ void *consistent_alloc(gfp_t gfp, size_t size, dma_addr_t *dma_handle)
 
 	return ret;
 }
-EXPORT_SYMBOL(consistent_alloc);
 
 #ifdef CONFIG_MMU
 static pte_t *consistent_virt_to_pte(void *vaddr)
@@ -178,7 +179,8 @@ unsigned long consistent_virt_to_pfn(void *vaddr)
 /*
  * free page(s) as defined by the above mapping.
  */
-void consistent_free(size_t size, void *vaddr)
+void arch_dma_free(struct device *dev, size_t size, void *vaddr,
+		dma_addr_t dma_addr, unsigned long attrs)
 {
 	struct page *page;
 
@@ -218,7 +220,6 @@ void consistent_free(size_t size, void *vaddr)
 	flush_tlb_all();
 #endif
 }
-EXPORT_SYMBOL(consistent_free);
 
 /*
  * make an area consistent.
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 11/22] microblaze: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Switch to the generic noncoherent direct mapping implementation.

This removes the direction-based optimizations in
sync_{single,sg}_for_{cpu,device} which were marked untestested and
do not match the usually very well tested {un,}map_{single,sg}
implementations.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/microblaze/Kconfig                   |   4 +
 arch/microblaze/include/asm/Kbuild        |   1 +
 arch/microblaze/include/asm/dma-mapping.h |  28 -----
 arch/microblaze/include/asm/pgtable.h     |   2 -
 arch/microblaze/kernel/dma.c              | 144 ++--------------------
 arch/microblaze/mm/consistent.c           |   9 +-
 6 files changed, 22 insertions(+), 166 deletions(-)
 delete mode 100644 arch/microblaze/include/asm/dma-mapping.h

diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig
index 3817a3e2146c..91b9b999eb18 100644
--- a/arch/microblaze/Kconfig
+++ b/arch/microblaze/Kconfig
@@ -1,6 +1,8 @@
 config MICROBLAZE
 	def_bool y
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select ARCH_HAS_GCOV_PROFILE_ALL
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
 	select ARCH_MIGHT_HAVE_PC_PARPORT
 	select ARCH_NO_COHERENT_DMA_MMAP if !MMU
 	select ARCH_WANT_IPC_PARSE_VERSION
@@ -8,6 +10,8 @@ config MICROBLAZE
 	select TIMER_OF
 	select CLONE_BACKWARDS3
 	select COMMON_CLK
+	select DMA_NONCOHERENT_OPS
+	select DMA_NONCOHERENT_MMAP
 	select GENERIC_ATOMIC64
 	select GENERIC_CLOCKEVENTS
 	select GENERIC_CPU_DEVICES
diff --git a/arch/microblaze/include/asm/Kbuild b/arch/microblaze/include/asm/Kbuild
index 3c80a5a308ed..8d3e71f43a3e 100644
--- a/arch/microblaze/include/asm/Kbuild
+++ b/arch/microblaze/include/asm/Kbuild
@@ -4,6 +4,7 @@ generic-y += bug.h
 generic-y += bugs.h
 generic-y += device.h
 generic-y += div64.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += exec.h
 generic-y += extable.h
diff --git a/arch/microblaze/include/asm/dma-mapping.h b/arch/microblaze/include/asm/dma-mapping.h
deleted file mode 100644
index add50c1373bf..000000000000
--- a/arch/microblaze/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Implements the generic device dma API for microblaze and the pci
- *
- * Copyright (C) 2009-2010 Michal Simek <monstr@monstr.eu>
- * Copyright (C) 2009-2010 PetaLogix
- *
- * This file is subject to the terms and conditions of the GNU General
- * Public License. See the file COPYING in the main directory of this
- * archive for more details.
- *
- * This file is base on powerpc and x86 dma-mapping.h versions
- * Copyright (C) 2004 IBM
- */
-
-#ifndef _ASM_MICROBLAZE_DMA_MAPPING_H
-#define _ASM_MICROBLAZE_DMA_MAPPING_H
-
-/*
- * Available generic sets of operations
- */
-extern const struct dma_map_ops dma_nommu_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return &dma_nommu_ops;
-}
-
-#endif	/* _ASM_MICROBLAZE_DMA_MAPPING_H */
diff --git a/arch/microblaze/include/asm/pgtable.h b/arch/microblaze/include/asm/pgtable.h
index e53b8532353c..5174733fb489 100644
--- a/arch/microblaze/include/asm/pgtable.h
+++ b/arch/microblaze/include/asm/pgtable.h
@@ -551,8 +551,6 @@ void __init *early_get_page(void);
 
 extern unsigned long ioremap_bot, ioremap_base;
 
-void *consistent_alloc(gfp_t gfp, size_t size, dma_addr_t *dma_handle);
-void consistent_free(size_t size, void *vaddr);
 void consistent_sync(void *vaddr, size_t size, int direction);
 void consistent_sync_page(struct page *page, unsigned long offset,
 	size_t size, int direction);
diff --git a/arch/microblaze/kernel/dma.c b/arch/microblaze/kernel/dma.c
index 3145e7dc8ab1..71032cf64669 100644
--- a/arch/microblaze/kernel/dma.c
+++ b/arch/microblaze/kernel/dma.c
@@ -8,29 +8,15 @@
  */
 
 #include <linux/device.h>
-#include <linux/dma-mapping.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/gfp.h>
 #include <linux/dma-debug.h>
 #include <linux/export.h>
 #include <linux/bug.h>
 #include <asm/cacheflush.h>
 
-static void *dma_nommu_alloc_coherent(struct device *dev, size_t size,
-				       dma_addr_t *dma_handle, gfp_t flag,
-				       unsigned long attrs)
-{
-	return consistent_alloc(flag, size, dma_handle);
-}
-
-static void dma_nommu_free_coherent(struct device *dev, size_t size,
-				     void *vaddr, dma_addr_t dma_handle,
-				     unsigned long attrs)
-{
-	consistent_free(size, vaddr);
-}
-
-static inline void __dma_sync(unsigned long paddr,
-			      size_t size, enum dma_data_direction direction)
+static void __dma_sync(struct device *dev, phys_addr_t paddr, size_t size,
+		enum dma_data_direction direction)
 {
 	switch (direction) {
 	case DMA_TO_DEVICE:
@@ -45,113 +31,21 @@ static inline void __dma_sync(unsigned long paddr,
 	}
 }
 
-static int dma_nommu_map_sg(struct device *dev, struct scatterlist *sgl,
-			     int nents, enum dma_data_direction direction,
-			     unsigned long attrs)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	struct scatterlist *sg;
-	int i;
-
-	/* FIXME this part of code is untested */
-	for_each_sg(sgl, sg, nents, i) {
-		sg->dma_address = sg_phys(sg);
-
-		if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-			continue;
-
-		__dma_sync(sg_phys(sg), sg->length, direction);
-	}
-
-	return nents;
-}
-
-static inline dma_addr_t dma_nommu_map_page(struct device *dev,
-					     struct page *page,
-					     unsigned long offset,
-					     size_t size,
-					     enum dma_data_direction direction,
-					     unsigned long attrs)
-{
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		__dma_sync(page_to_phys(page) + offset, size, direction);
-	return page_to_phys(page) + offset;
+	__dma_sync(dev, paddr, size, dir);
 }
 
-static inline void dma_nommu_unmap_page(struct device *dev,
-					 dma_addr_t dma_address,
-					 size_t size,
-					 enum dma_data_direction direction,
-					 unsigned long attrs)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-/* There is not necessary to do cache cleanup
- *
- * phys_to_virt is here because in __dma_sync_page is __virt_to_phys and
- * dma_address is physical address
- */
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		__dma_sync(dma_address, size, direction);
+	__dma_sync(dev, paddr, size, dir);
 }
 
-static inline void
-dma_nommu_sync_single_for_cpu(struct device *dev,
-			       dma_addr_t dma_handle, size_t size,
-			       enum dma_data_direction direction)
-{
-	/*
-	 * It's pointless to flush the cache as the memory segment
-	 * is given to the CPU
-	 */
-
-	if (direction = DMA_FROM_DEVICE)
-		__dma_sync(dma_handle, size, direction);
-}
-
-static inline void
-dma_nommu_sync_single_for_device(struct device *dev,
-				  dma_addr_t dma_handle, size_t size,
-				  enum dma_data_direction direction)
-{
-	/*
-	 * It's pointless to invalidate the cache if the device isn't
-	 * supposed to write to the relevant region
-	 */
-
-	if (direction = DMA_TO_DEVICE)
-		__dma_sync(dma_handle, size, direction);
-}
-
-static inline void
-dma_nommu_sync_sg_for_cpu(struct device *dev,
-			   struct scatterlist *sgl, int nents,
-			   enum dma_data_direction direction)
-{
-	struct scatterlist *sg;
-	int i;
-
-	/* FIXME this part of code is untested */
-	if (direction = DMA_FROM_DEVICE)
-		for_each_sg(sgl, sg, nents, i)
-			__dma_sync(sg->dma_address, sg->length, direction);
-}
-
-static inline void
-dma_nommu_sync_sg_for_device(struct device *dev,
-			      struct scatterlist *sgl, int nents,
-			      enum dma_data_direction direction)
-{
-	struct scatterlist *sg;
-	int i;
-
-	/* FIXME this part of code is untested */
-	if (direction = DMA_TO_DEVICE)
-		for_each_sg(sgl, sg, nents, i)
-			__dma_sync(sg->dma_address, sg->length, direction);
-}
-
-static
-int dma_nommu_mmap_coherent(struct device *dev, struct vm_area_struct *vma,
-			     void *cpu_addr, dma_addr_t handle, size_t size,
-			     unsigned long attrs)
+int arch_dma_mmap(struct device *dev, struct vm_area_struct *vma,
+		void *cpu_addr, dma_addr_t handle, size_t size,
+		unsigned long attrs)
 {
 #ifdef CONFIG_MMU
 	unsigned long user_count = vma_pages(vma);
@@ -170,17 +64,3 @@ int dma_nommu_mmap_coherent(struct device *dev, struct vm_area_struct *vma,
 	return -ENXIO;
 #endif
 }
-
-const struct dma_map_ops dma_nommu_ops = {
-	.alloc			= dma_nommu_alloc_coherent,
-	.free			= dma_nommu_free_coherent,
-	.mmap			= dma_nommu_mmap_coherent,
-	.map_sg			= dma_nommu_map_sg,
-	.map_page		= dma_nommu_map_page,
-	.unmap_page		= dma_nommu_unmap_page,
-	.sync_single_for_cpu	= dma_nommu_sync_single_for_cpu,
-	.sync_single_for_device	= dma_nommu_sync_single_for_device,
-	.sync_sg_for_cpu	= dma_nommu_sync_sg_for_cpu,
-	.sync_sg_for_device	= dma_nommu_sync_sg_for_device,
-};
-EXPORT_SYMBOL(dma_nommu_ops);
diff --git a/arch/microblaze/mm/consistent.c b/arch/microblaze/mm/consistent.c
index b06c3a7faf20..b9a9c8c3397b 100644
--- a/arch/microblaze/mm/consistent.c
+++ b/arch/microblaze/mm/consistent.c
@@ -33,6 +33,7 @@
 #include <linux/pci.h>
 #include <linux/interrupt.h>
 #include <linux/gfp.h>
+#include <linux/dma-noncoherent.h>
 
 #include <asm/pgalloc.h>
 #include <linux/io.h>
@@ -59,7 +60,8 @@
  * uncached region.  This will no doubt cause big problems if memory allocated
  * here is not also freed properly. -- JW
  */
-void *consistent_alloc(gfp_t gfp, size_t size, dma_addr_t *dma_handle)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	unsigned long order, vaddr;
 	void *ret;
@@ -154,7 +156,6 @@ void *consistent_alloc(gfp_t gfp, size_t size, dma_addr_t *dma_handle)
 
 	return ret;
 }
-EXPORT_SYMBOL(consistent_alloc);
 
 #ifdef CONFIG_MMU
 static pte_t *consistent_virt_to_pte(void *vaddr)
@@ -178,7 +179,8 @@ unsigned long consistent_virt_to_pfn(void *vaddr)
 /*
  * free page(s) as defined by the above mapping.
  */
-void consistent_free(size_t size, void *vaddr)
+void arch_dma_free(struct device *dev, size_t size, void *vaddr,
+		dma_addr_t dma_addr, unsigned long attrs)
 {
 	struct page *page;
 
@@ -218,7 +220,6 @@ void consistent_free(size_t size, void *vaddr)
 	flush_tlb_all();
 #endif
 }
-EXPORT_SYMBOL(consistent_free);
 
 /*
  * make an area consistent.
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [OpenRISC] [PATCH 11/22] microblaze: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  To: openrisc

Switch to the generic noncoherent direct mapping implementation.

This removes the direction-based optimizations in
sync_{single,sg}_for_{cpu,device} which were marked untestested and
do not match the usually very well tested {un,}map_{single,sg}
implementations.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/microblaze/Kconfig                   |   4 +
 arch/microblaze/include/asm/Kbuild        |   1 +
 arch/microblaze/include/asm/dma-mapping.h |  28 -----
 arch/microblaze/include/asm/pgtable.h     |   2 -
 arch/microblaze/kernel/dma.c              | 144 ++--------------------
 arch/microblaze/mm/consistent.c           |   9 +-
 6 files changed, 22 insertions(+), 166 deletions(-)
 delete mode 100644 arch/microblaze/include/asm/dma-mapping.h

diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig
index 3817a3e2146c..91b9b999eb18 100644
--- a/arch/microblaze/Kconfig
+++ b/arch/microblaze/Kconfig
@@ -1,6 +1,8 @@
 config MICROBLAZE
 	def_bool y
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select ARCH_HAS_GCOV_PROFILE_ALL
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
 	select ARCH_MIGHT_HAVE_PC_PARPORT
 	select ARCH_NO_COHERENT_DMA_MMAP if !MMU
 	select ARCH_WANT_IPC_PARSE_VERSION
@@ -8,6 +10,8 @@ config MICROBLAZE
 	select TIMER_OF
 	select CLONE_BACKWARDS3
 	select COMMON_CLK
+	select DMA_NONCOHERENT_OPS
+	select DMA_NONCOHERENT_MMAP
 	select GENERIC_ATOMIC64
 	select GENERIC_CLOCKEVENTS
 	select GENERIC_CPU_DEVICES
diff --git a/arch/microblaze/include/asm/Kbuild b/arch/microblaze/include/asm/Kbuild
index 3c80a5a308ed..8d3e71f43a3e 100644
--- a/arch/microblaze/include/asm/Kbuild
+++ b/arch/microblaze/include/asm/Kbuild
@@ -4,6 +4,7 @@ generic-y += bug.h
 generic-y += bugs.h
 generic-y += device.h
 generic-y += div64.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += exec.h
 generic-y += extable.h
diff --git a/arch/microblaze/include/asm/dma-mapping.h b/arch/microblaze/include/asm/dma-mapping.h
deleted file mode 100644
index add50c1373bf..000000000000
--- a/arch/microblaze/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Implements the generic device dma API for microblaze and the pci
- *
- * Copyright (C) 2009-2010 Michal Simek <monstr@monstr.eu>
- * Copyright (C) 2009-2010 PetaLogix
- *
- * This file is subject to the terms and conditions of the GNU General
- * Public License. See the file COPYING in the main directory of this
- * archive for more details.
- *
- * This file is base on powerpc and x86 dma-mapping.h versions
- * Copyright (C) 2004 IBM
- */
-
-#ifndef _ASM_MICROBLAZE_DMA_MAPPING_H
-#define _ASM_MICROBLAZE_DMA_MAPPING_H
-
-/*
- * Available generic sets of operations
- */
-extern const struct dma_map_ops dma_nommu_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return &dma_nommu_ops;
-}
-
-#endif	/* _ASM_MICROBLAZE_DMA_MAPPING_H */
diff --git a/arch/microblaze/include/asm/pgtable.h b/arch/microblaze/include/asm/pgtable.h
index e53b8532353c..5174733fb489 100644
--- a/arch/microblaze/include/asm/pgtable.h
+++ b/arch/microblaze/include/asm/pgtable.h
@@ -551,8 +551,6 @@ void __init *early_get_page(void);
 
 extern unsigned long ioremap_bot, ioremap_base;
 
-void *consistent_alloc(gfp_t gfp, size_t size, dma_addr_t *dma_handle);
-void consistent_free(size_t size, void *vaddr);
 void consistent_sync(void *vaddr, size_t size, int direction);
 void consistent_sync_page(struct page *page, unsigned long offset,
 	size_t size, int direction);
diff --git a/arch/microblaze/kernel/dma.c b/arch/microblaze/kernel/dma.c
index 3145e7dc8ab1..71032cf64669 100644
--- a/arch/microblaze/kernel/dma.c
+++ b/arch/microblaze/kernel/dma.c
@@ -8,29 +8,15 @@
  */
 
 #include <linux/device.h>
-#include <linux/dma-mapping.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/gfp.h>
 #include <linux/dma-debug.h>
 #include <linux/export.h>
 #include <linux/bug.h>
 #include <asm/cacheflush.h>
 
-static void *dma_nommu_alloc_coherent(struct device *dev, size_t size,
-				       dma_addr_t *dma_handle, gfp_t flag,
-				       unsigned long attrs)
-{
-	return consistent_alloc(flag, size, dma_handle);
-}
-
-static void dma_nommu_free_coherent(struct device *dev, size_t size,
-				     void *vaddr, dma_addr_t dma_handle,
-				     unsigned long attrs)
-{
-	consistent_free(size, vaddr);
-}
-
-static inline void __dma_sync(unsigned long paddr,
-			      size_t size, enum dma_data_direction direction)
+static void __dma_sync(struct device *dev, phys_addr_t paddr, size_t size,
+		enum dma_data_direction direction)
 {
 	switch (direction) {
 	case DMA_TO_DEVICE:
@@ -45,113 +31,21 @@ static inline void __dma_sync(unsigned long paddr,
 	}
 }
 
-static int dma_nommu_map_sg(struct device *dev, struct scatterlist *sgl,
-			     int nents, enum dma_data_direction direction,
-			     unsigned long attrs)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	struct scatterlist *sg;
-	int i;
-
-	/* FIXME this part of code is untested */
-	for_each_sg(sgl, sg, nents, i) {
-		sg->dma_address = sg_phys(sg);
-
-		if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-			continue;
-
-		__dma_sync(sg_phys(sg), sg->length, direction);
-	}
-
-	return nents;
-}
-
-static inline dma_addr_t dma_nommu_map_page(struct device *dev,
-					     struct page *page,
-					     unsigned long offset,
-					     size_t size,
-					     enum dma_data_direction direction,
-					     unsigned long attrs)
-{
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		__dma_sync(page_to_phys(page) + offset, size, direction);
-	return page_to_phys(page) + offset;
+	__dma_sync(dev, paddr, size, dir);
 }
 
-static inline void dma_nommu_unmap_page(struct device *dev,
-					 dma_addr_t dma_address,
-					 size_t size,
-					 enum dma_data_direction direction,
-					 unsigned long attrs)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-/* There is not necessary to do cache cleanup
- *
- * phys_to_virt is here because in __dma_sync_page is __virt_to_phys and
- * dma_address is physical address
- */
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		__dma_sync(dma_address, size, direction);
+	__dma_sync(dev, paddr, size, dir);
 }
 
-static inline void
-dma_nommu_sync_single_for_cpu(struct device *dev,
-			       dma_addr_t dma_handle, size_t size,
-			       enum dma_data_direction direction)
-{
-	/*
-	 * It's pointless to flush the cache as the memory segment
-	 * is given to the CPU
-	 */
-
-	if (direction == DMA_FROM_DEVICE)
-		__dma_sync(dma_handle, size, direction);
-}
-
-static inline void
-dma_nommu_sync_single_for_device(struct device *dev,
-				  dma_addr_t dma_handle, size_t size,
-				  enum dma_data_direction direction)
-{
-	/*
-	 * It's pointless to invalidate the cache if the device isn't
-	 * supposed to write to the relevant region
-	 */
-
-	if (direction == DMA_TO_DEVICE)
-		__dma_sync(dma_handle, size, direction);
-}
-
-static inline void
-dma_nommu_sync_sg_for_cpu(struct device *dev,
-			   struct scatterlist *sgl, int nents,
-			   enum dma_data_direction direction)
-{
-	struct scatterlist *sg;
-	int i;
-
-	/* FIXME this part of code is untested */
-	if (direction == DMA_FROM_DEVICE)
-		for_each_sg(sgl, sg, nents, i)
-			__dma_sync(sg->dma_address, sg->length, direction);
-}
-
-static inline void
-dma_nommu_sync_sg_for_device(struct device *dev,
-			      struct scatterlist *sgl, int nents,
-			      enum dma_data_direction direction)
-{
-	struct scatterlist *sg;
-	int i;
-
-	/* FIXME this part of code is untested */
-	if (direction == DMA_TO_DEVICE)
-		for_each_sg(sgl, sg, nents, i)
-			__dma_sync(sg->dma_address, sg->length, direction);
-}
-
-static
-int dma_nommu_mmap_coherent(struct device *dev, struct vm_area_struct *vma,
-			     void *cpu_addr, dma_addr_t handle, size_t size,
-			     unsigned long attrs)
+int arch_dma_mmap(struct device *dev, struct vm_area_struct *vma,
+		void *cpu_addr, dma_addr_t handle, size_t size,
+		unsigned long attrs)
 {
 #ifdef CONFIG_MMU
 	unsigned long user_count = vma_pages(vma);
@@ -170,17 +64,3 @@ int dma_nommu_mmap_coherent(struct device *dev, struct vm_area_struct *vma,
 	return -ENXIO;
 #endif
 }
-
-const struct dma_map_ops dma_nommu_ops = {
-	.alloc			= dma_nommu_alloc_coherent,
-	.free			= dma_nommu_free_coherent,
-	.mmap			= dma_nommu_mmap_coherent,
-	.map_sg			= dma_nommu_map_sg,
-	.map_page		= dma_nommu_map_page,
-	.unmap_page		= dma_nommu_unmap_page,
-	.sync_single_for_cpu	= dma_nommu_sync_single_for_cpu,
-	.sync_single_for_device	= dma_nommu_sync_single_for_device,
-	.sync_sg_for_cpu	= dma_nommu_sync_sg_for_cpu,
-	.sync_sg_for_device	= dma_nommu_sync_sg_for_device,
-};
-EXPORT_SYMBOL(dma_nommu_ops);
diff --git a/arch/microblaze/mm/consistent.c b/arch/microblaze/mm/consistent.c
index b06c3a7faf20..b9a9c8c3397b 100644
--- a/arch/microblaze/mm/consistent.c
+++ b/arch/microblaze/mm/consistent.c
@@ -33,6 +33,7 @@
 #include <linux/pci.h>
 #include <linux/interrupt.h>
 #include <linux/gfp.h>
+#include <linux/dma-noncoherent.h>
 
 #include <asm/pgalloc.h>
 #include <linux/io.h>
@@ -59,7 +60,8 @@
  * uncached region.  This will no doubt cause big problems if memory allocated
  * here is not also freed properly. -- JW
  */
-void *consistent_alloc(gfp_t gfp, size_t size, dma_addr_t *dma_handle)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	unsigned long order, vaddr;
 	void *ret;
@@ -154,7 +156,6 @@ void *consistent_alloc(gfp_t gfp, size_t size, dma_addr_t *dma_handle)
 
 	return ret;
 }
-EXPORT_SYMBOL(consistent_alloc);
 
 #ifdef CONFIG_MMU
 static pte_t *consistent_virt_to_pte(void *vaddr)
@@ -178,7 +179,8 @@ unsigned long consistent_virt_to_pfn(void *vaddr)
 /*
  * free page(s) as defined by the above mapping.
  */
-void consistent_free(size_t size, void *vaddr)
+void arch_dma_free(struct device *dev, size_t size, void *vaddr,
+		dma_addr_t dma_addr, unsigned long attrs)
 {
 	struct page *page;
 
@@ -218,7 +220,6 @@ void consistent_free(size_t size, void *vaddr)
 	flush_tlb_all();
 #endif
 }
-EXPORT_SYMBOL(consistent_free);
 
 /*
  * make an area consistent.
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 11/22] microblaze: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  To: linux-arm-kernel

Switch to the generic noncoherent direct mapping implementation.

This removes the direction-based optimizations in
sync_{single,sg}_for_{cpu,device} which were marked untestested and
do not match the usually very well tested {un,}map_{single,sg}
implementations.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/microblaze/Kconfig                   |   4 +
 arch/microblaze/include/asm/Kbuild        |   1 +
 arch/microblaze/include/asm/dma-mapping.h |  28 -----
 arch/microblaze/include/asm/pgtable.h     |   2 -
 arch/microblaze/kernel/dma.c              | 144 ++--------------------
 arch/microblaze/mm/consistent.c           |   9 +-
 6 files changed, 22 insertions(+), 166 deletions(-)
 delete mode 100644 arch/microblaze/include/asm/dma-mapping.h

diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig
index 3817a3e2146c..91b9b999eb18 100644
--- a/arch/microblaze/Kconfig
+++ b/arch/microblaze/Kconfig
@@ -1,6 +1,8 @@
 config MICROBLAZE
 	def_bool y
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select ARCH_HAS_GCOV_PROFILE_ALL
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
 	select ARCH_MIGHT_HAVE_PC_PARPORT
 	select ARCH_NO_COHERENT_DMA_MMAP if !MMU
 	select ARCH_WANT_IPC_PARSE_VERSION
@@ -8,6 +10,8 @@ config MICROBLAZE
 	select TIMER_OF
 	select CLONE_BACKWARDS3
 	select COMMON_CLK
+	select DMA_NONCOHERENT_OPS
+	select DMA_NONCOHERENT_MMAP
 	select GENERIC_ATOMIC64
 	select GENERIC_CLOCKEVENTS
 	select GENERIC_CPU_DEVICES
diff --git a/arch/microblaze/include/asm/Kbuild b/arch/microblaze/include/asm/Kbuild
index 3c80a5a308ed..8d3e71f43a3e 100644
--- a/arch/microblaze/include/asm/Kbuild
+++ b/arch/microblaze/include/asm/Kbuild
@@ -4,6 +4,7 @@ generic-y += bug.h
 generic-y += bugs.h
 generic-y += device.h
 generic-y += div64.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += exec.h
 generic-y += extable.h
diff --git a/arch/microblaze/include/asm/dma-mapping.h b/arch/microblaze/include/asm/dma-mapping.h
deleted file mode 100644
index add50c1373bf..000000000000
--- a/arch/microblaze/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Implements the generic device dma API for microblaze and the pci
- *
- * Copyright (C) 2009-2010 Michal Simek <monstr@monstr.eu>
- * Copyright (C) 2009-2010 PetaLogix
- *
- * This file is subject to the terms and conditions of the GNU General
- * Public License. See the file COPYING in the main directory of this
- * archive for more details.
- *
- * This file is base on powerpc and x86 dma-mapping.h versions
- * Copyright (C) 2004 IBM
- */
-
-#ifndef _ASM_MICROBLAZE_DMA_MAPPING_H
-#define _ASM_MICROBLAZE_DMA_MAPPING_H
-
-/*
- * Available generic sets of operations
- */
-extern const struct dma_map_ops dma_nommu_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return &dma_nommu_ops;
-}
-
-#endif	/* _ASM_MICROBLAZE_DMA_MAPPING_H */
diff --git a/arch/microblaze/include/asm/pgtable.h b/arch/microblaze/include/asm/pgtable.h
index e53b8532353c..5174733fb489 100644
--- a/arch/microblaze/include/asm/pgtable.h
+++ b/arch/microblaze/include/asm/pgtable.h
@@ -551,8 +551,6 @@ void __init *early_get_page(void);
 
 extern unsigned long ioremap_bot, ioremap_base;
 
-void *consistent_alloc(gfp_t gfp, size_t size, dma_addr_t *dma_handle);
-void consistent_free(size_t size, void *vaddr);
 void consistent_sync(void *vaddr, size_t size, int direction);
 void consistent_sync_page(struct page *page, unsigned long offset,
 	size_t size, int direction);
diff --git a/arch/microblaze/kernel/dma.c b/arch/microblaze/kernel/dma.c
index 3145e7dc8ab1..71032cf64669 100644
--- a/arch/microblaze/kernel/dma.c
+++ b/arch/microblaze/kernel/dma.c
@@ -8,29 +8,15 @@
  */
 
 #include <linux/device.h>
-#include <linux/dma-mapping.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/gfp.h>
 #include <linux/dma-debug.h>
 #include <linux/export.h>
 #include <linux/bug.h>
 #include <asm/cacheflush.h>
 
-static void *dma_nommu_alloc_coherent(struct device *dev, size_t size,
-				       dma_addr_t *dma_handle, gfp_t flag,
-				       unsigned long attrs)
-{
-	return consistent_alloc(flag, size, dma_handle);
-}
-
-static void dma_nommu_free_coherent(struct device *dev, size_t size,
-				     void *vaddr, dma_addr_t dma_handle,
-				     unsigned long attrs)
-{
-	consistent_free(size, vaddr);
-}
-
-static inline void __dma_sync(unsigned long paddr,
-			      size_t size, enum dma_data_direction direction)
+static void __dma_sync(struct device *dev, phys_addr_t paddr, size_t size,
+		enum dma_data_direction direction)
 {
 	switch (direction) {
 	case DMA_TO_DEVICE:
@@ -45,113 +31,21 @@ static inline void __dma_sync(unsigned long paddr,
 	}
 }
 
-static int dma_nommu_map_sg(struct device *dev, struct scatterlist *sgl,
-			     int nents, enum dma_data_direction direction,
-			     unsigned long attrs)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	struct scatterlist *sg;
-	int i;
-
-	/* FIXME this part of code is untested */
-	for_each_sg(sgl, sg, nents, i) {
-		sg->dma_address = sg_phys(sg);
-
-		if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-			continue;
-
-		__dma_sync(sg_phys(sg), sg->length, direction);
-	}
-
-	return nents;
-}
-
-static inline dma_addr_t dma_nommu_map_page(struct device *dev,
-					     struct page *page,
-					     unsigned long offset,
-					     size_t size,
-					     enum dma_data_direction direction,
-					     unsigned long attrs)
-{
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		__dma_sync(page_to_phys(page) + offset, size, direction);
-	return page_to_phys(page) + offset;
+	__dma_sync(dev, paddr, size, dir);
 }
 
-static inline void dma_nommu_unmap_page(struct device *dev,
-					 dma_addr_t dma_address,
-					 size_t size,
-					 enum dma_data_direction direction,
-					 unsigned long attrs)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-/* There is not necessary to do cache cleanup
- *
- * phys_to_virt is here because in __dma_sync_page is __virt_to_phys and
- * dma_address is physical address
- */
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		__dma_sync(dma_address, size, direction);
+	__dma_sync(dev, paddr, size, dir);
 }
 
-static inline void
-dma_nommu_sync_single_for_cpu(struct device *dev,
-			       dma_addr_t dma_handle, size_t size,
-			       enum dma_data_direction direction)
-{
-	/*
-	 * It's pointless to flush the cache as the memory segment
-	 * is given to the CPU
-	 */
-
-	if (direction == DMA_FROM_DEVICE)
-		__dma_sync(dma_handle, size, direction);
-}
-
-static inline void
-dma_nommu_sync_single_for_device(struct device *dev,
-				  dma_addr_t dma_handle, size_t size,
-				  enum dma_data_direction direction)
-{
-	/*
-	 * It's pointless to invalidate the cache if the device isn't
-	 * supposed to write to the relevant region
-	 */
-
-	if (direction == DMA_TO_DEVICE)
-		__dma_sync(dma_handle, size, direction);
-}
-
-static inline void
-dma_nommu_sync_sg_for_cpu(struct device *dev,
-			   struct scatterlist *sgl, int nents,
-			   enum dma_data_direction direction)
-{
-	struct scatterlist *sg;
-	int i;
-
-	/* FIXME this part of code is untested */
-	if (direction == DMA_FROM_DEVICE)
-		for_each_sg(sgl, sg, nents, i)
-			__dma_sync(sg->dma_address, sg->length, direction);
-}
-
-static inline void
-dma_nommu_sync_sg_for_device(struct device *dev,
-			      struct scatterlist *sgl, int nents,
-			      enum dma_data_direction direction)
-{
-	struct scatterlist *sg;
-	int i;
-
-	/* FIXME this part of code is untested */
-	if (direction == DMA_TO_DEVICE)
-		for_each_sg(sgl, sg, nents, i)
-			__dma_sync(sg->dma_address, sg->length, direction);
-}
-
-static
-int dma_nommu_mmap_coherent(struct device *dev, struct vm_area_struct *vma,
-			     void *cpu_addr, dma_addr_t handle, size_t size,
-			     unsigned long attrs)
+int arch_dma_mmap(struct device *dev, struct vm_area_struct *vma,
+		void *cpu_addr, dma_addr_t handle, size_t size,
+		unsigned long attrs)
 {
 #ifdef CONFIG_MMU
 	unsigned long user_count = vma_pages(vma);
@@ -170,17 +64,3 @@ int dma_nommu_mmap_coherent(struct device *dev, struct vm_area_struct *vma,
 	return -ENXIO;
 #endif
 }
-
-const struct dma_map_ops dma_nommu_ops = {
-	.alloc			= dma_nommu_alloc_coherent,
-	.free			= dma_nommu_free_coherent,
-	.mmap			= dma_nommu_mmap_coherent,
-	.map_sg			= dma_nommu_map_sg,
-	.map_page		= dma_nommu_map_page,
-	.unmap_page		= dma_nommu_unmap_page,
-	.sync_single_for_cpu	= dma_nommu_sync_single_for_cpu,
-	.sync_single_for_device	= dma_nommu_sync_single_for_device,
-	.sync_sg_for_cpu	= dma_nommu_sync_sg_for_cpu,
-	.sync_sg_for_device	= dma_nommu_sync_sg_for_device,
-};
-EXPORT_SYMBOL(dma_nommu_ops);
diff --git a/arch/microblaze/mm/consistent.c b/arch/microblaze/mm/consistent.c
index b06c3a7faf20..b9a9c8c3397b 100644
--- a/arch/microblaze/mm/consistent.c
+++ b/arch/microblaze/mm/consistent.c
@@ -33,6 +33,7 @@
 #include <linux/pci.h>
 #include <linux/interrupt.h>
 #include <linux/gfp.h>
+#include <linux/dma-noncoherent.h>
 
 #include <asm/pgalloc.h>
 #include <linux/io.h>
@@ -59,7 +60,8 @@
  * uncached region.  This will no doubt cause big problems if memory allocated
  * here is not also freed properly. -- JW
  */
-void *consistent_alloc(gfp_t gfp, size_t size, dma_addr_t *dma_handle)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	unsigned long order, vaddr;
 	void *ret;
@@ -154,7 +156,6 @@ void *consistent_alloc(gfp_t gfp, size_t size, dma_addr_t *dma_handle)
 
 	return ret;
 }
-EXPORT_SYMBOL(consistent_alloc);
 
 #ifdef CONFIG_MMU
 static pte_t *consistent_virt_to_pte(void *vaddr)
@@ -178,7 +179,8 @@ unsigned long consistent_virt_to_pfn(void *vaddr)
 /*
  * free page(s) as defined by the above mapping.
  */
-void consistent_free(size_t size, void *vaddr)
+void arch_dma_free(struct device *dev, size_t size, void *vaddr,
+		dma_addr_t dma_addr, unsigned long attrs)
 {
 	struct page *page;
 
@@ -218,7 +220,6 @@ void consistent_free(size_t size, void *vaddr)
 	flush_tlb_all();
 #endif
 }
-EXPORT_SYMBOL(consistent_free);
 
 /*
  * make an area consistent.
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 12/22] microblaze: remove the consistent_sync and consistent_sync_page
  2018-04-20  8:02 ` Christoph Hellwig
                     ` (4 preceding siblings ...)
  (?)
@ 2018-04-20  8:03   ` Christoph Hellwig
  -1 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Both unused.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/microblaze/include/asm/pgtable.h |  3 --
 arch/microblaze/mm/consistent.c       | 45 ---------------------------
 2 files changed, 48 deletions(-)

diff --git a/arch/microblaze/include/asm/pgtable.h b/arch/microblaze/include/asm/pgtable.h
index 5174733fb489..ac6a37bd41ec 100644
--- a/arch/microblaze/include/asm/pgtable.h
+++ b/arch/microblaze/include/asm/pgtable.h
@@ -551,9 +551,6 @@ void __init *early_get_page(void);
 
 extern unsigned long ioremap_bot, ioremap_base;
 
-void consistent_sync(void *vaddr, size_t size, int direction);
-void consistent_sync_page(struct page *page, unsigned long offset,
-	size_t size, int direction);
 unsigned long consistent_virt_to_pfn(void *vaddr);
 
 void setup_memory(void);
diff --git a/arch/microblaze/mm/consistent.c b/arch/microblaze/mm/consistent.c
index b9a9c8c3397b..c9a278ac795a 100644
--- a/arch/microblaze/mm/consistent.c
+++ b/arch/microblaze/mm/consistent.c
@@ -220,48 +220,3 @@ void arch_dma_free(struct device *dev, size_t size, void *vaddr,
 	flush_tlb_all();
 #endif
 }
-
-/*
- * make an area consistent.
- */
-void consistent_sync(void *vaddr, size_t size, int direction)
-{
-	unsigned long start;
-	unsigned long end;
-
-	start = (unsigned long)vaddr;
-
-	/* Convert start address back down to unshadowed memory region */
-#ifdef CONFIG_XILINX_UNCACHED_SHADOW
-	start &= ~UNCACHED_SHADOW_MASK;
-#endif
-	end = start + size;
-
-	switch (direction) {
-	case PCI_DMA_NONE:
-		BUG();
-	case PCI_DMA_FROMDEVICE:	/* invalidate only */
-		invalidate_dcache_range(start, end);
-		break;
-	case PCI_DMA_TODEVICE:		/* writeback only */
-		flush_dcache_range(start, end);
-		break;
-	case PCI_DMA_BIDIRECTIONAL:	/* writeback and invalidate */
-		flush_dcache_range(start, end);
-		break;
-	}
-}
-EXPORT_SYMBOL(consistent_sync);
-
-/*
- * consistent_sync_page makes memory consistent. identical
- * to consistent_sync, but takes a struct page instead of a
- * virtual address
- */
-void consistent_sync_page(struct page *page, unsigned long offset,
-	size_t size, int direction)
-{
-	unsigned long start = (unsigned long)page_address(page) + offset;
-	consistent_sync((void *)start, size, direction);
-}
-EXPORT_SYMBOL(consistent_sync_page);
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 12/22] microblaze: remove the consistent_sync and consistent_sync_page
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Both unused.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/microblaze/include/asm/pgtable.h |  3 --
 arch/microblaze/mm/consistent.c       | 45 ---------------------------
 2 files changed, 48 deletions(-)

diff --git a/arch/microblaze/include/asm/pgtable.h b/arch/microblaze/include/asm/pgtable.h
index 5174733fb489..ac6a37bd41ec 100644
--- a/arch/microblaze/include/asm/pgtable.h
+++ b/arch/microblaze/include/asm/pgtable.h
@@ -551,9 +551,6 @@ void __init *early_get_page(void);
 
 extern unsigned long ioremap_bot, ioremap_base;
 
-void consistent_sync(void *vaddr, size_t size, int direction);
-void consistent_sync_page(struct page *page, unsigned long offset,
-	size_t size, int direction);
 unsigned long consistent_virt_to_pfn(void *vaddr);
 
 void setup_memory(void);
diff --git a/arch/microblaze/mm/consistent.c b/arch/microblaze/mm/consistent.c
index b9a9c8c3397b..c9a278ac795a 100644
--- a/arch/microblaze/mm/consistent.c
+++ b/arch/microblaze/mm/consistent.c
@@ -220,48 +220,3 @@ void arch_dma_free(struct device *dev, size_t size, void *vaddr,
 	flush_tlb_all();
 #endif
 }
-
-/*
- * make an area consistent.
- */
-void consistent_sync(void *vaddr, size_t size, int direction)
-{
-	unsigned long start;
-	unsigned long end;
-
-	start = (unsigned long)vaddr;
-
-	/* Convert start address back down to unshadowed memory region */
-#ifdef CONFIG_XILINX_UNCACHED_SHADOW
-	start &= ~UNCACHED_SHADOW_MASK;
-#endif
-	end = start + size;
-
-	switch (direction) {
-	case PCI_DMA_NONE:
-		BUG();
-	case PCI_DMA_FROMDEVICE:	/* invalidate only */
-		invalidate_dcache_range(start, end);
-		break;
-	case PCI_DMA_TODEVICE:		/* writeback only */
-		flush_dcache_range(start, end);
-		break;
-	case PCI_DMA_BIDIRECTIONAL:	/* writeback and invalidate */
-		flush_dcache_range(start, end);
-		break;
-	}
-}
-EXPORT_SYMBOL(consistent_sync);
-
-/*
- * consistent_sync_page makes memory consistent. identical
- * to consistent_sync, but takes a struct page instead of a
- * virtual address
- */
-void consistent_sync_page(struct page *page, unsigned long offset,
-	size_t size, int direction)
-{
-	unsigned long start = (unsigned long)page_address(page) + offset;
-	consistent_sync((void *)start, size, direction);
-}
-EXPORT_SYMBOL(consistent_sync_page);
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 12/22] microblaze: remove the consistent_sync and consistent_sync_page
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Both unused.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/microblaze/include/asm/pgtable.h |  3 --
 arch/microblaze/mm/consistent.c       | 45 ---------------------------
 2 files changed, 48 deletions(-)

diff --git a/arch/microblaze/include/asm/pgtable.h b/arch/microblaze/include/asm/pgtable.h
index 5174733fb489..ac6a37bd41ec 100644
--- a/arch/microblaze/include/asm/pgtable.h
+++ b/arch/microblaze/include/asm/pgtable.h
@@ -551,9 +551,6 @@ void __init *early_get_page(void);
 
 extern unsigned long ioremap_bot, ioremap_base;
 
-void consistent_sync(void *vaddr, size_t size, int direction);
-void consistent_sync_page(struct page *page, unsigned long offset,
-	size_t size, int direction);
 unsigned long consistent_virt_to_pfn(void *vaddr);
 
 void setup_memory(void);
diff --git a/arch/microblaze/mm/consistent.c b/arch/microblaze/mm/consistent.c
index b9a9c8c3397b..c9a278ac795a 100644
--- a/arch/microblaze/mm/consistent.c
+++ b/arch/microblaze/mm/consistent.c
@@ -220,48 +220,3 @@ void arch_dma_free(struct device *dev, size_t size, void *vaddr,
 	flush_tlb_all();
 #endif
 }
-
-/*
- * make an area consistent.
- */
-void consistent_sync(void *vaddr, size_t size, int direction)
-{
-	unsigned long start;
-	unsigned long end;
-
-	start = (unsigned long)vaddr;
-
-	/* Convert start address back down to unshadowed memory region */
-#ifdef CONFIG_XILINX_UNCACHED_SHADOW
-	start &= ~UNCACHED_SHADOW_MASK;
-#endif
-	end = start + size;
-
-	switch (direction) {
-	case PCI_DMA_NONE:
-		BUG();
-	case PCI_DMA_FROMDEVICE:	/* invalidate only */
-		invalidate_dcache_range(start, end);
-		break;
-	case PCI_DMA_TODEVICE:		/* writeback only */
-		flush_dcache_range(start, end);
-		break;
-	case PCI_DMA_BIDIRECTIONAL:	/* writeback and invalidate */
-		flush_dcache_range(start, end);
-		break;
-	}
-}
-EXPORT_SYMBOL(consistent_sync);
-
-/*
- * consistent_sync_page makes memory consistent. identical
- * to consistent_sync, but takes a struct page instead of a
- * virtual address
- */
-void consistent_sync_page(struct page *page, unsigned long offset,
-	size_t size, int direction)
-{
-	unsigned long start = (unsigned long)page_address(page) + offset;
-	consistent_sync((void *)start, size, direction);
-}
-EXPORT_SYMBOL(consistent_sync_page);
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 12/22] microblaze: remove the consistent_sync and consistent_sync_page
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  To: linux-snps-arc

Both unused.

Signed-off-by: Christoph Hellwig <hch at lst.de>
---
 arch/microblaze/include/asm/pgtable.h |  3 --
 arch/microblaze/mm/consistent.c       | 45 ---------------------------
 2 files changed, 48 deletions(-)

diff --git a/arch/microblaze/include/asm/pgtable.h b/arch/microblaze/include/asm/pgtable.h
index 5174733fb489..ac6a37bd41ec 100644
--- a/arch/microblaze/include/asm/pgtable.h
+++ b/arch/microblaze/include/asm/pgtable.h
@@ -551,9 +551,6 @@ void __init *early_get_page(void);
 
 extern unsigned long ioremap_bot, ioremap_base;
 
-void consistent_sync(void *vaddr, size_t size, int direction);
-void consistent_sync_page(struct page *page, unsigned long offset,
-	size_t size, int direction);
 unsigned long consistent_virt_to_pfn(void *vaddr);
 
 void setup_memory(void);
diff --git a/arch/microblaze/mm/consistent.c b/arch/microblaze/mm/consistent.c
index b9a9c8c3397b..c9a278ac795a 100644
--- a/arch/microblaze/mm/consistent.c
+++ b/arch/microblaze/mm/consistent.c
@@ -220,48 +220,3 @@ void arch_dma_free(struct device *dev, size_t size, void *vaddr,
 	flush_tlb_all();
 #endif
 }
-
-/*
- * make an area consistent.
- */
-void consistent_sync(void *vaddr, size_t size, int direction)
-{
-	unsigned long start;
-	unsigned long end;
-
-	start = (unsigned long)vaddr;
-
-	/* Convert start address back down to unshadowed memory region */
-#ifdef CONFIG_XILINX_UNCACHED_SHADOW
-	start &= ~UNCACHED_SHADOW_MASK;
-#endif
-	end = start + size;
-
-	switch (direction) {
-	case PCI_DMA_NONE:
-		BUG();
-	case PCI_DMA_FROMDEVICE:	/* invalidate only */
-		invalidate_dcache_range(start, end);
-		break;
-	case PCI_DMA_TODEVICE:		/* writeback only */
-		flush_dcache_range(start, end);
-		break;
-	case PCI_DMA_BIDIRECTIONAL:	/* writeback and invalidate */
-		flush_dcache_range(start, end);
-		break;
-	}
-}
-EXPORT_SYMBOL(consistent_sync);
-
-/*
- * consistent_sync_page makes memory consistent. identical
- * to consistent_sync, but takes a struct page instead of a
- * virtual address
- */
-void consistent_sync_page(struct page *page, unsigned long offset,
-	size_t size, int direction)
-{
-	unsigned long start = (unsigned long)page_address(page) + offset;
-	consistent_sync((void *)start, size, direction);
-}
-EXPORT_SYMBOL(consistent_sync_page);
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 12/22] microblaze: remove the consistent_sync and consistent_sync_page
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Both unused.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/microblaze/include/asm/pgtable.h |  3 --
 arch/microblaze/mm/consistent.c       | 45 ---------------------------
 2 files changed, 48 deletions(-)

diff --git a/arch/microblaze/include/asm/pgtable.h b/arch/microblaze/include/asm/pgtable.h
index 5174733fb489..ac6a37bd41ec 100644
--- a/arch/microblaze/include/asm/pgtable.h
+++ b/arch/microblaze/include/asm/pgtable.h
@@ -551,9 +551,6 @@ void __init *early_get_page(void);
 
 extern unsigned long ioremap_bot, ioremap_base;
 
-void consistent_sync(void *vaddr, size_t size, int direction);
-void consistent_sync_page(struct page *page, unsigned long offset,
-	size_t size, int direction);
 unsigned long consistent_virt_to_pfn(void *vaddr);
 
 void setup_memory(void);
diff --git a/arch/microblaze/mm/consistent.c b/arch/microblaze/mm/consistent.c
index b9a9c8c3397b..c9a278ac795a 100644
--- a/arch/microblaze/mm/consistent.c
+++ b/arch/microblaze/mm/consistent.c
@@ -220,48 +220,3 @@ void arch_dma_free(struct device *dev, size_t size, void *vaddr,
 	flush_tlb_all();
 #endif
 }
-
-/*
- * make an area consistent.
- */
-void consistent_sync(void *vaddr, size_t size, int direction)
-{
-	unsigned long start;
-	unsigned long end;
-
-	start = (unsigned long)vaddr;
-
-	/* Convert start address back down to unshadowed memory region */
-#ifdef CONFIG_XILINX_UNCACHED_SHADOW
-	start &= ~UNCACHED_SHADOW_MASK;
-#endif
-	end = start + size;
-
-	switch (direction) {
-	case PCI_DMA_NONE:
-		BUG();
-	case PCI_DMA_FROMDEVICE:	/* invalidate only */
-		invalidate_dcache_range(start, end);
-		break;
-	case PCI_DMA_TODEVICE:		/* writeback only */
-		flush_dcache_range(start, end);
-		break;
-	case PCI_DMA_BIDIRECTIONAL:	/* writeback and invalidate */
-		flush_dcache_range(start, end);
-		break;
-	}
-}
-EXPORT_SYMBOL(consistent_sync);
-
-/*
- * consistent_sync_page makes memory consistent. identical
- * to consistent_sync, but takes a struct page instead of a
- * virtual address
- */
-void consistent_sync_page(struct page *page, unsigned long offset,
-	size_t size, int direction)
-{
-	unsigned long start = (unsigned long)page_address(page) + offset;
-	consistent_sync((void *)start, size, direction);
-}
-EXPORT_SYMBOL(consistent_sync_page);
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [OpenRISC] [PATCH 12/22] microblaze: remove the consistent_sync and consistent_sync_page
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  To: openrisc

Both unused.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/microblaze/include/asm/pgtable.h |  3 --
 arch/microblaze/mm/consistent.c       | 45 ---------------------------
 2 files changed, 48 deletions(-)

diff --git a/arch/microblaze/include/asm/pgtable.h b/arch/microblaze/include/asm/pgtable.h
index 5174733fb489..ac6a37bd41ec 100644
--- a/arch/microblaze/include/asm/pgtable.h
+++ b/arch/microblaze/include/asm/pgtable.h
@@ -551,9 +551,6 @@ void __init *early_get_page(void);
 
 extern unsigned long ioremap_bot, ioremap_base;
 
-void consistent_sync(void *vaddr, size_t size, int direction);
-void consistent_sync_page(struct page *page, unsigned long offset,
-	size_t size, int direction);
 unsigned long consistent_virt_to_pfn(void *vaddr);
 
 void setup_memory(void);
diff --git a/arch/microblaze/mm/consistent.c b/arch/microblaze/mm/consistent.c
index b9a9c8c3397b..c9a278ac795a 100644
--- a/arch/microblaze/mm/consistent.c
+++ b/arch/microblaze/mm/consistent.c
@@ -220,48 +220,3 @@ void arch_dma_free(struct device *dev, size_t size, void *vaddr,
 	flush_tlb_all();
 #endif
 }
-
-/*
- * make an area consistent.
- */
-void consistent_sync(void *vaddr, size_t size, int direction)
-{
-	unsigned long start;
-	unsigned long end;
-
-	start = (unsigned long)vaddr;
-
-	/* Convert start address back down to unshadowed memory region */
-#ifdef CONFIG_XILINX_UNCACHED_SHADOW
-	start &= ~UNCACHED_SHADOW_MASK;
-#endif
-	end = start + size;
-
-	switch (direction) {
-	case PCI_DMA_NONE:
-		BUG();
-	case PCI_DMA_FROMDEVICE:	/* invalidate only */
-		invalidate_dcache_range(start, end);
-		break;
-	case PCI_DMA_TODEVICE:		/* writeback only */
-		flush_dcache_range(start, end);
-		break;
-	case PCI_DMA_BIDIRECTIONAL:	/* writeback and invalidate */
-		flush_dcache_range(start, end);
-		break;
-	}
-}
-EXPORT_SYMBOL(consistent_sync);
-
-/*
- * consistent_sync_page makes memory consistent. identical
- * to consistent_sync, but takes a struct page instead of a
- * virtual address
- */
-void consistent_sync_page(struct page *page, unsigned long offset,
-	size_t size, int direction)
-{
-	unsigned long start = (unsigned long)page_address(page) + offset;
-	consistent_sync((void *)start, size, direction);
-}
-EXPORT_SYMBOL(consistent_sync_page);
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 12/22] microblaze: remove the consistent_sync and consistent_sync_page
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  To: linux-arm-kernel

Both unused.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/microblaze/include/asm/pgtable.h |  3 --
 arch/microblaze/mm/consistent.c       | 45 ---------------------------
 2 files changed, 48 deletions(-)

diff --git a/arch/microblaze/include/asm/pgtable.h b/arch/microblaze/include/asm/pgtable.h
index 5174733fb489..ac6a37bd41ec 100644
--- a/arch/microblaze/include/asm/pgtable.h
+++ b/arch/microblaze/include/asm/pgtable.h
@@ -551,9 +551,6 @@ void __init *early_get_page(void);
 
 extern unsigned long ioremap_bot, ioremap_base;
 
-void consistent_sync(void *vaddr, size_t size, int direction);
-void consistent_sync_page(struct page *page, unsigned long offset,
-	size_t size, int direction);
 unsigned long consistent_virt_to_pfn(void *vaddr);
 
 void setup_memory(void);
diff --git a/arch/microblaze/mm/consistent.c b/arch/microblaze/mm/consistent.c
index b9a9c8c3397b..c9a278ac795a 100644
--- a/arch/microblaze/mm/consistent.c
+++ b/arch/microblaze/mm/consistent.c
@@ -220,48 +220,3 @@ void arch_dma_free(struct device *dev, size_t size, void *vaddr,
 	flush_tlb_all();
 #endif
 }
-
-/*
- * make an area consistent.
- */
-void consistent_sync(void *vaddr, size_t size, int direction)
-{
-	unsigned long start;
-	unsigned long end;
-
-	start = (unsigned long)vaddr;
-
-	/* Convert start address back down to unshadowed memory region */
-#ifdef CONFIG_XILINX_UNCACHED_SHADOW
-	start &= ~UNCACHED_SHADOW_MASK;
-#endif
-	end = start + size;
-
-	switch (direction) {
-	case PCI_DMA_NONE:
-		BUG();
-	case PCI_DMA_FROMDEVICE:	/* invalidate only */
-		invalidate_dcache_range(start, end);
-		break;
-	case PCI_DMA_TODEVICE:		/* writeback only */
-		flush_dcache_range(start, end);
-		break;
-	case PCI_DMA_BIDIRECTIONAL:	/* writeback and invalidate */
-		flush_dcache_range(start, end);
-		break;
-	}
-}
-EXPORT_SYMBOL(consistent_sync);
-
-/*
- * consistent_sync_page makes memory consistent. identical
- * to consistent_sync, but takes a struct page instead of a
- * virtual address
- */
-void consistent_sync_page(struct page *page, unsigned long offset,
-	size_t size, int direction)
-{
-	unsigned long start = (unsigned long)page_address(page) + offset;
-	consistent_sync((void *)start, size, direction);
-}
-EXPORT_SYMBOL(consistent_sync_page);
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 13/22] nds32: use generic dma_noncoherent_ops
  2018-04-20  8:02 ` Christoph Hellwig
                     ` (4 preceding siblings ...)
  (?)
@ 2018-04-20  8:03   ` Christoph Hellwig
  -1 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Switch to the generic noncoherent direct mapping implementation.

This makes sure kmap_atomic_pfn is consistently used for access to
virtual addresses instead of either using the slower plain kmap
or blindly expecting page_address() to work.

This makes sure the cache_sync routines is called in the unmap_sg
case, to match the unmap_single and sync_{single,sg}_to_cpu cases.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/nds32/Kconfig                   |   3 +
 arch/nds32/include/asm/Kbuild        |   1 +
 arch/nds32/include/asm/dma-mapping.h |  14 ---
 arch/nds32/kernel/dma.c              | 182 ++++++---------------------
 4 files changed, 39 insertions(+), 161 deletions(-)
 delete mode 100644 arch/nds32/include/asm/dma-mapping.h

diff --git a/arch/nds32/Kconfig b/arch/nds32/Kconfig
index 249f38d3388f..67d0ac0a989c 100644
--- a/arch/nds32/Kconfig
+++ b/arch/nds32/Kconfig
@@ -5,10 +5,13 @@
 
 config NDS32
         def_bool y
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select ARCH_WANT_FRAME_POINTERS if FTRACE
 	select CLKSRC_MMIO
 	select CLONE_BACKWARDS
 	select COMMON_CLK
+	select DMA_NONCOHERENT_OPS
 	select GENERIC_ATOMIC64
 	select GENERIC_CPU_DEVICES
 	select GENERIC_CLOCKEVENTS
diff --git a/arch/nds32/include/asm/Kbuild b/arch/nds32/include/asm/Kbuild
index 06bdf8167f5a..b3e951f805f8 100644
--- a/arch/nds32/include/asm/Kbuild
+++ b/arch/nds32/include/asm/Kbuild
@@ -13,6 +13,7 @@ generic-y += cputime.h
 generic-y += device.h
 generic-y += div64.h
 generic-y += dma.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += errno.h
 generic-y += exec.h
diff --git a/arch/nds32/include/asm/dma-mapping.h b/arch/nds32/include/asm/dma-mapping.h
deleted file mode 100644
index 2dd47d245c25..000000000000
--- a/arch/nds32/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,14 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-// Copyright (C) 2005-2017 Andes Technology Corporation
-
-#ifndef ASMNDS32_DMA_MAPPING_H
-#define ASMNDS32_DMA_MAPPING_H
-
-extern struct dma_map_ops nds32_dma_ops;
-
-static inline struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return &nds32_dma_ops;
-}
-
-#endif
diff --git a/arch/nds32/kernel/dma.c b/arch/nds32/kernel/dma.c
index d291800fc621..688f1a03dee6 100644
--- a/arch/nds32/kernel/dma.c
+++ b/arch/nds32/kernel/dma.c
@@ -3,17 +3,14 @@
 
 #include <linux/types.h>
 #include <linux/mm.h>
-#include <linux/export.h>
 #include <linux/string.h>
-#include <linux/scatterlist.h>
-#include <linux/dma-mapping.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/io.h>
 #include <linux/cache.h>
 #include <linux/highmem.h>
 #include <linux/slab.h>
 #include <asm/cacheflush.h>
 #include <asm/tlbflush.h>
-#include <asm/dma-mapping.h>
 #include <asm/proc-fns.h>
 
 /*
@@ -22,11 +19,6 @@
 static pte_t *consistent_pte;
 static DEFINE_RAW_SPINLOCK(consistent_lock);
 
-enum master_type {
-	FOR_CPU = 0,
-	FOR_DEVICE = 1,
-};
-
 /*
  * VM region handling support.
  *
@@ -124,10 +116,8 @@ static struct arch_vm_region *vm_region_find(struct arch_vm_region *head,
 	return c;
 }
 
-/* FIXME: attrs is not used. */
-static void *nds32_dma_alloc_coherent(struct device *dev, size_t size,
-				      dma_addr_t * handle, gfp_t gfp,
-				      unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	struct page *page;
 	struct arch_vm_region *c;
@@ -232,8 +222,8 @@ static void *nds32_dma_alloc_coherent(struct device *dev, size_t size,
 	return NULL;
 }
 
-static void nds32_dma_free(struct device *dev, size_t size, void *cpu_addr,
-			   dma_addr_t handle, unsigned long attrs)
+void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
+		dma_addr_t handle, unsigned long attrs)
 {
 	struct arch_vm_region *c;
 	unsigned long flags, addr;
@@ -333,145 +323,43 @@ static int __init consistent_init(void)
 }
 
 core_initcall(consistent_init);
-static void consistent_sync(void *vaddr, size_t size, int direction, int master_type);
-static dma_addr_t nds32_dma_map_page(struct device *dev, struct page *page,
-				     unsigned long offset, size_t size,
-				     enum dma_data_direction dir,
-				     unsigned long attrs)
-{
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		consistent_sync((void *)(page_address(page) + offset), size, dir, FOR_DEVICE);
-	return page_to_phys(page) + offset;
-}
-
-static void nds32_dma_unmap_page(struct device *dev, dma_addr_t handle,
-				 size_t size, enum dma_data_direction dir,
-				 unsigned long attrs)
-{
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		consistent_sync(phys_to_virt(handle), size, dir, FOR_CPU);
-}
 
-/*
- * Make an area consistent for devices.
- */
-static void consistent_sync(void *vaddr, size_t size, int direction, int master_type)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	unsigned long start = (unsigned long)vaddr;
-	unsigned long end = start + size;
-
-	if (master_type == FOR_CPU) {
-		switch (direction) {
-		case DMA_TO_DEVICE:
-			break;
-		case DMA_FROM_DEVICE:
-		case DMA_BIDIRECTIONAL:
-			cpu_dma_inval_range(start, end);
-			break;
-		default:
-			BUG();
-		}
-	} else {
-		/* FOR_DEVICE */
-		switch (direction) {
-		case DMA_FROM_DEVICE:
-			break;
-		case DMA_TO_DEVICE:
-		case DMA_BIDIRECTIONAL:
-			cpu_dma_wb_range(start, end);
-			break;
-		default:
-			BUG();
-		}
+	void *addr = kmap_atomic_pfn(PHYS_PFN(paddr));
+	unsigned long start = (unsigned long)addr;
+
+	switch (direction) {
+	case DMA_FROM_DEVICE:
+		break;
+	case DMA_TO_DEVICE:
+	case DMA_BIDIRECTIONAL:
+		cpu_dma_wb_range(start, start + size);
+		break;
+	default:
+		BUG();
 	}
-}
 
-static int nds32_dma_map_sg(struct device *dev, struct scatterlist *sg,
-			    int nents, enum dma_data_direction dir,
-			    unsigned long attrs)
-{
-	int i;
-
-	for (i = 0; i < nents; i++, sg++) {
-		void *virt;
-		unsigned long pfn;
-		struct page *page = sg_page(sg);
-
-		sg->dma_address = sg_phys(sg);
-		pfn = page_to_pfn(page) + sg->offset / PAGE_SIZE;
-		page = pfn_to_page(pfn);
-		if (PageHighMem(page)) {
-			virt = kmap_atomic(page);
-			consistent_sync(virt, sg->length, dir, FOR_CPU);
-			kunmap_atomic(virt);
-		} else {
-			if (sg->offset > PAGE_SIZE)
-				panic("sg->offset:%08x > PAGE_SIZE\n",
-				      sg->offset);
-			virt = page_address(page) + sg->offset;
-			consistent_sync(virt, sg->length, dir, FOR_CPU);
-		}
-	}
-	return nents;
-}
-
-static void nds32_dma_unmap_sg(struct device *dev, struct scatterlist *sg,
-			       int nhwentries, enum dma_data_direction dir,
-			       unsigned long attrs)
-{
+	kunmap_atomic(addr);
 }
 
-static void
-nds32_dma_sync_single_for_cpu(struct device *dev, dma_addr_t handle,
-			      size_t size, enum dma_data_direction dir)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	consistent_sync((void *)phys_to_virt(handle), size, dir, FOR_CPU);
-}
-
-static void
-nds32_dma_sync_single_for_device(struct device *dev, dma_addr_t handle,
-				 size_t size, enum dma_data_direction dir)
-{
-	consistent_sync((void *)phys_to_virt(handle), size, dir, FOR_DEVICE);
-}
-
-static void
-nds32_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nents,
-			  enum dma_data_direction dir)
-{
-	int i;
-
-	for (i = 0; i < nents; i++, sg++) {
-		char *virt =
-		    page_address((struct page *)sg->page_link) + sg->offset;
-		consistent_sync(virt, sg->length, dir, FOR_CPU);
+	void *addr = kmap_atomic_pfn(PHYS_PFN(paddr));
+	unsigned long start = (unsigned long)addr;
+
+	switch (direction) {
+	case DMA_TO_DEVICE:
+		break;
+	case DMA_FROM_DEVICE:
+	case DMA_BIDIRECTIONAL:
+		cpu_dma_inval_range(start, end);
+		break;
+	default:
+		BUG();
 	}
-}
-
-static void
-nds32_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
-			     int nents, enum dma_data_direction dir)
-{
-	int i;
 
-	for (i = 0; i < nents; i++, sg++) {
-		char *virt =
-		    page_address((struct page *)sg->page_link) + sg->offset;
-		consistent_sync(virt, sg->length, dir, FOR_DEVICE);
-	}
+	kunmap_atomic(addr);
 }
-
-struct dma_map_ops nds32_dma_ops = {
-	.alloc = nds32_dma_alloc_coherent,
-	.free = nds32_dma_free,
-	.map_page = nds32_dma_map_page,
-	.unmap_page = nds32_dma_unmap_page,
-	.map_sg = nds32_dma_map_sg,
-	.unmap_sg = nds32_dma_unmap_sg,
-	.sync_single_for_device = nds32_dma_sync_single_for_device,
-	.sync_single_for_cpu = nds32_dma_sync_single_for_cpu,
-	.sync_sg_for_cpu = nds32_dma_sync_sg_for_cpu,
-	.sync_sg_for_device = nds32_dma_sync_sg_for_device,
-};
-
-EXPORT_SYMBOL(nds32_dma_ops);
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 13/22] nds32: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Switch to the generic noncoherent direct mapping implementation.

This makes sure kmap_atomic_pfn is consistently used for access to
virtual addresses instead of either using the slower plain kmap
or blindly expecting page_address() to work.

This makes sure the cache_sync routines is called in the unmap_sg
case, to match the unmap_single and sync_{single,sg}_to_cpu cases.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/nds32/Kconfig                   |   3 +
 arch/nds32/include/asm/Kbuild        |   1 +
 arch/nds32/include/asm/dma-mapping.h |  14 ---
 arch/nds32/kernel/dma.c              | 182 ++++++---------------------
 4 files changed, 39 insertions(+), 161 deletions(-)
 delete mode 100644 arch/nds32/include/asm/dma-mapping.h

diff --git a/arch/nds32/Kconfig b/arch/nds32/Kconfig
index 249f38d3388f..67d0ac0a989c 100644
--- a/arch/nds32/Kconfig
+++ b/arch/nds32/Kconfig
@@ -5,10 +5,13 @@
 
 config NDS32
         def_bool y
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select ARCH_WANT_FRAME_POINTERS if FTRACE
 	select CLKSRC_MMIO
 	select CLONE_BACKWARDS
 	select COMMON_CLK
+	select DMA_NONCOHERENT_OPS
 	select GENERIC_ATOMIC64
 	select GENERIC_CPU_DEVICES
 	select GENERIC_CLOCKEVENTS
diff --git a/arch/nds32/include/asm/Kbuild b/arch/nds32/include/asm/Kbuild
index 06bdf8167f5a..b3e951f805f8 100644
--- a/arch/nds32/include/asm/Kbuild
+++ b/arch/nds32/include/asm/Kbuild
@@ -13,6 +13,7 @@ generic-y += cputime.h
 generic-y += device.h
 generic-y += div64.h
 generic-y += dma.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += errno.h
 generic-y += exec.h
diff --git a/arch/nds32/include/asm/dma-mapping.h b/arch/nds32/include/asm/dma-mapping.h
deleted file mode 100644
index 2dd47d245c25..000000000000
--- a/arch/nds32/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,14 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-// Copyright (C) 2005-2017 Andes Technology Corporation
-
-#ifndef ASMNDS32_DMA_MAPPING_H
-#define ASMNDS32_DMA_MAPPING_H
-
-extern struct dma_map_ops nds32_dma_ops;
-
-static inline struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return &nds32_dma_ops;
-}
-
-#endif
diff --git a/arch/nds32/kernel/dma.c b/arch/nds32/kernel/dma.c
index d291800fc621..688f1a03dee6 100644
--- a/arch/nds32/kernel/dma.c
+++ b/arch/nds32/kernel/dma.c
@@ -3,17 +3,14 @@
 
 #include <linux/types.h>
 #include <linux/mm.h>
-#include <linux/export.h>
 #include <linux/string.h>
-#include <linux/scatterlist.h>
-#include <linux/dma-mapping.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/io.h>
 #include <linux/cache.h>
 #include <linux/highmem.h>
 #include <linux/slab.h>
 #include <asm/cacheflush.h>
 #include <asm/tlbflush.h>
-#include <asm/dma-mapping.h>
 #include <asm/proc-fns.h>
 
 /*
@@ -22,11 +19,6 @@
 static pte_t *consistent_pte;
 static DEFINE_RAW_SPINLOCK(consistent_lock);
 
-enum master_type {
-	FOR_CPU = 0,
-	FOR_DEVICE = 1,
-};
-
 /*
  * VM region handling support.
  *
@@ -124,10 +116,8 @@ static struct arch_vm_region *vm_region_find(struct arch_vm_region *head,
 	return c;
 }
 
-/* FIXME: attrs is not used. */
-static void *nds32_dma_alloc_coherent(struct device *dev, size_t size,
-				      dma_addr_t * handle, gfp_t gfp,
-				      unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	struct page *page;
 	struct arch_vm_region *c;
@@ -232,8 +222,8 @@ static void *nds32_dma_alloc_coherent(struct device *dev, size_t size,
 	return NULL;
 }
 
-static void nds32_dma_free(struct device *dev, size_t size, void *cpu_addr,
-			   dma_addr_t handle, unsigned long attrs)
+void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
+		dma_addr_t handle, unsigned long attrs)
 {
 	struct arch_vm_region *c;
 	unsigned long flags, addr;
@@ -333,145 +323,43 @@ static int __init consistent_init(void)
 }
 
 core_initcall(consistent_init);
-static void consistent_sync(void *vaddr, size_t size, int direction, int master_type);
-static dma_addr_t nds32_dma_map_page(struct device *dev, struct page *page,
-				     unsigned long offset, size_t size,
-				     enum dma_data_direction dir,
-				     unsigned long attrs)
-{
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		consistent_sync((void *)(page_address(page) + offset), size, dir, FOR_DEVICE);
-	return page_to_phys(page) + offset;
-}
-
-static void nds32_dma_unmap_page(struct device *dev, dma_addr_t handle,
-				 size_t size, enum dma_data_direction dir,
-				 unsigned long attrs)
-{
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		consistent_sync(phys_to_virt(handle), size, dir, FOR_CPU);
-}
 
-/*
- * Make an area consistent for devices.
- */
-static void consistent_sync(void *vaddr, size_t size, int direction, int master_type)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	unsigned long start = (unsigned long)vaddr;
-	unsigned long end = start + size;
-
-	if (master_type == FOR_CPU) {
-		switch (direction) {
-		case DMA_TO_DEVICE:
-			break;
-		case DMA_FROM_DEVICE:
-		case DMA_BIDIRECTIONAL:
-			cpu_dma_inval_range(start, end);
-			break;
-		default:
-			BUG();
-		}
-	} else {
-		/* FOR_DEVICE */
-		switch (direction) {
-		case DMA_FROM_DEVICE:
-			break;
-		case DMA_TO_DEVICE:
-		case DMA_BIDIRECTIONAL:
-			cpu_dma_wb_range(start, end);
-			break;
-		default:
-			BUG();
-		}
+	void *addr = kmap_atomic_pfn(PHYS_PFN(paddr));
+	unsigned long start = (unsigned long)addr;
+
+	switch (direction) {
+	case DMA_FROM_DEVICE:
+		break;
+	case DMA_TO_DEVICE:
+	case DMA_BIDIRECTIONAL:
+		cpu_dma_wb_range(start, start + size);
+		break;
+	default:
+		BUG();
 	}
-}
 
-static int nds32_dma_map_sg(struct device *dev, struct scatterlist *sg,
-			    int nents, enum dma_data_direction dir,
-			    unsigned long attrs)
-{
-	int i;
-
-	for (i = 0; i < nents; i++, sg++) {
-		void *virt;
-		unsigned long pfn;
-		struct page *page = sg_page(sg);
-
-		sg->dma_address = sg_phys(sg);
-		pfn = page_to_pfn(page) + sg->offset / PAGE_SIZE;
-		page = pfn_to_page(pfn);
-		if (PageHighMem(page)) {
-			virt = kmap_atomic(page);
-			consistent_sync(virt, sg->length, dir, FOR_CPU);
-			kunmap_atomic(virt);
-		} else {
-			if (sg->offset > PAGE_SIZE)
-				panic("sg->offset:%08x > PAGE_SIZE\n",
-				      sg->offset);
-			virt = page_address(page) + sg->offset;
-			consistent_sync(virt, sg->length, dir, FOR_CPU);
-		}
-	}
-	return nents;
-}
-
-static void nds32_dma_unmap_sg(struct device *dev, struct scatterlist *sg,
-			       int nhwentries, enum dma_data_direction dir,
-			       unsigned long attrs)
-{
+	kunmap_atomic(addr);
 }
 
-static void
-nds32_dma_sync_single_for_cpu(struct device *dev, dma_addr_t handle,
-			      size_t size, enum dma_data_direction dir)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	consistent_sync((void *)phys_to_virt(handle), size, dir, FOR_CPU);
-}
-
-static void
-nds32_dma_sync_single_for_device(struct device *dev, dma_addr_t handle,
-				 size_t size, enum dma_data_direction dir)
-{
-	consistent_sync((void *)phys_to_virt(handle), size, dir, FOR_DEVICE);
-}
-
-static void
-nds32_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nents,
-			  enum dma_data_direction dir)
-{
-	int i;
-
-	for (i = 0; i < nents; i++, sg++) {
-		char *virt =
-		    page_address((struct page *)sg->page_link) + sg->offset;
-		consistent_sync(virt, sg->length, dir, FOR_CPU);
+	void *addr = kmap_atomic_pfn(PHYS_PFN(paddr));
+	unsigned long start = (unsigned long)addr;
+
+	switch (direction) {
+	case DMA_TO_DEVICE:
+		break;
+	case DMA_FROM_DEVICE:
+	case DMA_BIDIRECTIONAL:
+		cpu_dma_inval_range(start, end);
+		break;
+	default:
+		BUG();
 	}
-}
-
-static void
-nds32_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
-			     int nents, enum dma_data_direction dir)
-{
-	int i;
 
-	for (i = 0; i < nents; i++, sg++) {
-		char *virt =
-		    page_address((struct page *)sg->page_link) + sg->offset;
-		consistent_sync(virt, sg->length, dir, FOR_DEVICE);
-	}
+	kunmap_atomic(addr);
 }
-
-struct dma_map_ops nds32_dma_ops = {
-	.alloc = nds32_dma_alloc_coherent,
-	.free = nds32_dma_free,
-	.map_page = nds32_dma_map_page,
-	.unmap_page = nds32_dma_unmap_page,
-	.map_sg = nds32_dma_map_sg,
-	.unmap_sg = nds32_dma_unmap_sg,
-	.sync_single_for_device = nds32_dma_sync_single_for_device,
-	.sync_single_for_cpu = nds32_dma_sync_single_for_cpu,
-	.sync_sg_for_cpu = nds32_dma_sync_sg_for_cpu,
-	.sync_sg_for_device = nds32_dma_sync_sg_for_device,
-};
-
-EXPORT_SYMBOL(nds32_dma_ops);
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 13/22] nds32: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Switch to the generic noncoherent direct mapping implementation.

This makes sure kmap_atomic_pfn is consistently used for access to
virtual addresses instead of either using the slower plain kmap
or blindly expecting page_address() to work.

This makes sure the cache_sync routines is called in the unmap_sg
case, to match the unmap_single and sync_{single,sg}_to_cpu cases.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/nds32/Kconfig                   |   3 +
 arch/nds32/include/asm/Kbuild        |   1 +
 arch/nds32/include/asm/dma-mapping.h |  14 ---
 arch/nds32/kernel/dma.c              | 182 ++++++---------------------
 4 files changed, 39 insertions(+), 161 deletions(-)
 delete mode 100644 arch/nds32/include/asm/dma-mapping.h

diff --git a/arch/nds32/Kconfig b/arch/nds32/Kconfig
index 249f38d3388f..67d0ac0a989c 100644
--- a/arch/nds32/Kconfig
+++ b/arch/nds32/Kconfig
@@ -5,10 +5,13 @@
 
 config NDS32
         def_bool y
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select ARCH_WANT_FRAME_POINTERS if FTRACE
 	select CLKSRC_MMIO
 	select CLONE_BACKWARDS
 	select COMMON_CLK
+	select DMA_NONCOHERENT_OPS
 	select GENERIC_ATOMIC64
 	select GENERIC_CPU_DEVICES
 	select GENERIC_CLOCKEVENTS
diff --git a/arch/nds32/include/asm/Kbuild b/arch/nds32/include/asm/Kbuild
index 06bdf8167f5a..b3e951f805f8 100644
--- a/arch/nds32/include/asm/Kbuild
+++ b/arch/nds32/include/asm/Kbuild
@@ -13,6 +13,7 @@ generic-y += cputime.h
 generic-y += device.h
 generic-y += div64.h
 generic-y += dma.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += errno.h
 generic-y += exec.h
diff --git a/arch/nds32/include/asm/dma-mapping.h b/arch/nds32/include/asm/dma-mapping.h
deleted file mode 100644
index 2dd47d245c25..000000000000
--- a/arch/nds32/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,14 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-// Copyright (C) 2005-2017 Andes Technology Corporation
-
-#ifndef ASMNDS32_DMA_MAPPING_H
-#define ASMNDS32_DMA_MAPPING_H
-
-extern struct dma_map_ops nds32_dma_ops;
-
-static inline struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return &nds32_dma_ops;
-}
-
-#endif
diff --git a/arch/nds32/kernel/dma.c b/arch/nds32/kernel/dma.c
index d291800fc621..688f1a03dee6 100644
--- a/arch/nds32/kernel/dma.c
+++ b/arch/nds32/kernel/dma.c
@@ -3,17 +3,14 @@
 
 #include <linux/types.h>
 #include <linux/mm.h>
-#include <linux/export.h>
 #include <linux/string.h>
-#include <linux/scatterlist.h>
-#include <linux/dma-mapping.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/io.h>
 #include <linux/cache.h>
 #include <linux/highmem.h>
 #include <linux/slab.h>
 #include <asm/cacheflush.h>
 #include <asm/tlbflush.h>
-#include <asm/dma-mapping.h>
 #include <asm/proc-fns.h>
 
 /*
@@ -22,11 +19,6 @@
 static pte_t *consistent_pte;
 static DEFINE_RAW_SPINLOCK(consistent_lock);
 
-enum master_type {
-	FOR_CPU = 0,
-	FOR_DEVICE = 1,
-};
-
 /*
  * VM region handling support.
  *
@@ -124,10 +116,8 @@ static struct arch_vm_region *vm_region_find(struct arch_vm_region *head,
 	return c;
 }
 
-/* FIXME: attrs is not used. */
-static void *nds32_dma_alloc_coherent(struct device *dev, size_t size,
-				      dma_addr_t * handle, gfp_t gfp,
-				      unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	struct page *page;
 	struct arch_vm_region *c;
@@ -232,8 +222,8 @@ static void *nds32_dma_alloc_coherent(struct device *dev, size_t size,
 	return NULL;
 }
 
-static void nds32_dma_free(struct device *dev, size_t size, void *cpu_addr,
-			   dma_addr_t handle, unsigned long attrs)
+void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
+		dma_addr_t handle, unsigned long attrs)
 {
 	struct arch_vm_region *c;
 	unsigned long flags, addr;
@@ -333,145 +323,43 @@ static int __init consistent_init(void)
 }
 
 core_initcall(consistent_init);
-static void consistent_sync(void *vaddr, size_t size, int direction, int master_type);
-static dma_addr_t nds32_dma_map_page(struct device *dev, struct page *page,
-				     unsigned long offset, size_t size,
-				     enum dma_data_direction dir,
-				     unsigned long attrs)
-{
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		consistent_sync((void *)(page_address(page) + offset), size, dir, FOR_DEVICE);
-	return page_to_phys(page) + offset;
-}
-
-static void nds32_dma_unmap_page(struct device *dev, dma_addr_t handle,
-				 size_t size, enum dma_data_direction dir,
-				 unsigned long attrs)
-{
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		consistent_sync(phys_to_virt(handle), size, dir, FOR_CPU);
-}
 
-/*
- * Make an area consistent for devices.
- */
-static void consistent_sync(void *vaddr, size_t size, int direction, int master_type)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	unsigned long start = (unsigned long)vaddr;
-	unsigned long end = start + size;
-
-	if (master_type == FOR_CPU) {
-		switch (direction) {
-		case DMA_TO_DEVICE:
-			break;
-		case DMA_FROM_DEVICE:
-		case DMA_BIDIRECTIONAL:
-			cpu_dma_inval_range(start, end);
-			break;
-		default:
-			BUG();
-		}
-	} else {
-		/* FOR_DEVICE */
-		switch (direction) {
-		case DMA_FROM_DEVICE:
-			break;
-		case DMA_TO_DEVICE:
-		case DMA_BIDIRECTIONAL:
-			cpu_dma_wb_range(start, end);
-			break;
-		default:
-			BUG();
-		}
+	void *addr = kmap_atomic_pfn(PHYS_PFN(paddr));
+	unsigned long start = (unsigned long)addr;
+
+	switch (direction) {
+	case DMA_FROM_DEVICE:
+		break;
+	case DMA_TO_DEVICE:
+	case DMA_BIDIRECTIONAL:
+		cpu_dma_wb_range(start, start + size);
+		break;
+	default:
+		BUG();
 	}
-}
 
-static int nds32_dma_map_sg(struct device *dev, struct scatterlist *sg,
-			    int nents, enum dma_data_direction dir,
-			    unsigned long attrs)
-{
-	int i;
-
-	for (i = 0; i < nents; i++, sg++) {
-		void *virt;
-		unsigned long pfn;
-		struct page *page = sg_page(sg);
-
-		sg->dma_address = sg_phys(sg);
-		pfn = page_to_pfn(page) + sg->offset / PAGE_SIZE;
-		page = pfn_to_page(pfn);
-		if (PageHighMem(page)) {
-			virt = kmap_atomic(page);
-			consistent_sync(virt, sg->length, dir, FOR_CPU);
-			kunmap_atomic(virt);
-		} else {
-			if (sg->offset > PAGE_SIZE)
-				panic("sg->offset:%08x > PAGE_SIZE\n",
-				      sg->offset);
-			virt = page_address(page) + sg->offset;
-			consistent_sync(virt, sg->length, dir, FOR_CPU);
-		}
-	}
-	return nents;
-}
-
-static void nds32_dma_unmap_sg(struct device *dev, struct scatterlist *sg,
-			       int nhwentries, enum dma_data_direction dir,
-			       unsigned long attrs)
-{
+	kunmap_atomic(addr);
 }
 
-static void
-nds32_dma_sync_single_for_cpu(struct device *dev, dma_addr_t handle,
-			      size_t size, enum dma_data_direction dir)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	consistent_sync((void *)phys_to_virt(handle), size, dir, FOR_CPU);
-}
-
-static void
-nds32_dma_sync_single_for_device(struct device *dev, dma_addr_t handle,
-				 size_t size, enum dma_data_direction dir)
-{
-	consistent_sync((void *)phys_to_virt(handle), size, dir, FOR_DEVICE);
-}
-
-static void
-nds32_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nents,
-			  enum dma_data_direction dir)
-{
-	int i;
-
-	for (i = 0; i < nents; i++, sg++) {
-		char *virt =
-		    page_address((struct page *)sg->page_link) + sg->offset;
-		consistent_sync(virt, sg->length, dir, FOR_CPU);
+	void *addr = kmap_atomic_pfn(PHYS_PFN(paddr));
+	unsigned long start = (unsigned long)addr;
+
+	switch (direction) {
+	case DMA_TO_DEVICE:
+		break;
+	case DMA_FROM_DEVICE:
+	case DMA_BIDIRECTIONAL:
+		cpu_dma_inval_range(start, end);
+		break;
+	default:
+		BUG();
 	}
-}
-
-static void
-nds32_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
-			     int nents, enum dma_data_direction dir)
-{
-	int i;
 
-	for (i = 0; i < nents; i++, sg++) {
-		char *virt =
-		    page_address((struct page *)sg->page_link) + sg->offset;
-		consistent_sync(virt, sg->length, dir, FOR_DEVICE);
-	}
+	kunmap_atomic(addr);
 }
-
-struct dma_map_ops nds32_dma_ops = {
-	.alloc = nds32_dma_alloc_coherent,
-	.free = nds32_dma_free,
-	.map_page = nds32_dma_map_page,
-	.unmap_page = nds32_dma_unmap_page,
-	.map_sg = nds32_dma_map_sg,
-	.unmap_sg = nds32_dma_unmap_sg,
-	.sync_single_for_device = nds32_dma_sync_single_for_device,
-	.sync_single_for_cpu = nds32_dma_sync_single_for_cpu,
-	.sync_sg_for_cpu = nds32_dma_sync_sg_for_cpu,
-	.sync_sg_for_device = nds32_dma_sync_sg_for_device,
-};
-
-EXPORT_SYMBOL(nds32_dma_ops);
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 13/22] nds32: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  To: linux-snps-arc

Switch to the generic noncoherent direct mapping implementation.

This makes sure kmap_atomic_pfn is consistently used for access to
virtual addresses instead of either using the slower plain kmap
or blindly expecting page_address() to work.

This makes sure the cache_sync routines is called in the unmap_sg
case, to match the unmap_single and sync_{single,sg}_to_cpu cases.

Signed-off-by: Christoph Hellwig <hch at lst.de>
---
 arch/nds32/Kconfig                   |   3 +
 arch/nds32/include/asm/Kbuild        |   1 +
 arch/nds32/include/asm/dma-mapping.h |  14 ---
 arch/nds32/kernel/dma.c              | 182 ++++++---------------------
 4 files changed, 39 insertions(+), 161 deletions(-)
 delete mode 100644 arch/nds32/include/asm/dma-mapping.h

diff --git a/arch/nds32/Kconfig b/arch/nds32/Kconfig
index 249f38d3388f..67d0ac0a989c 100644
--- a/arch/nds32/Kconfig
+++ b/arch/nds32/Kconfig
@@ -5,10 +5,13 @@
 
 config NDS32
         def_bool y
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select ARCH_WANT_FRAME_POINTERS if FTRACE
 	select CLKSRC_MMIO
 	select CLONE_BACKWARDS
 	select COMMON_CLK
+	select DMA_NONCOHERENT_OPS
 	select GENERIC_ATOMIC64
 	select GENERIC_CPU_DEVICES
 	select GENERIC_CLOCKEVENTS
diff --git a/arch/nds32/include/asm/Kbuild b/arch/nds32/include/asm/Kbuild
index 06bdf8167f5a..b3e951f805f8 100644
--- a/arch/nds32/include/asm/Kbuild
+++ b/arch/nds32/include/asm/Kbuild
@@ -13,6 +13,7 @@ generic-y += cputime.h
 generic-y += device.h
 generic-y += div64.h
 generic-y += dma.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += errno.h
 generic-y += exec.h
diff --git a/arch/nds32/include/asm/dma-mapping.h b/arch/nds32/include/asm/dma-mapping.h
deleted file mode 100644
index 2dd47d245c25..000000000000
--- a/arch/nds32/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,14 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-// Copyright (C) 2005-2017 Andes Technology Corporation
-
-#ifndef ASMNDS32_DMA_MAPPING_H
-#define ASMNDS32_DMA_MAPPING_H
-
-extern struct dma_map_ops nds32_dma_ops;
-
-static inline struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return &nds32_dma_ops;
-}
-
-#endif
diff --git a/arch/nds32/kernel/dma.c b/arch/nds32/kernel/dma.c
index d291800fc621..688f1a03dee6 100644
--- a/arch/nds32/kernel/dma.c
+++ b/arch/nds32/kernel/dma.c
@@ -3,17 +3,14 @@
 
 #include <linux/types.h>
 #include <linux/mm.h>
-#include <linux/export.h>
 #include <linux/string.h>
-#include <linux/scatterlist.h>
-#include <linux/dma-mapping.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/io.h>
 #include <linux/cache.h>
 #include <linux/highmem.h>
 #include <linux/slab.h>
 #include <asm/cacheflush.h>
 #include <asm/tlbflush.h>
-#include <asm/dma-mapping.h>
 #include <asm/proc-fns.h>
 
 /*
@@ -22,11 +19,6 @@
 static pte_t *consistent_pte;
 static DEFINE_RAW_SPINLOCK(consistent_lock);
 
-enum master_type {
-	FOR_CPU = 0,
-	FOR_DEVICE = 1,
-};
-
 /*
  * VM region handling support.
  *
@@ -124,10 +116,8 @@ static struct arch_vm_region *vm_region_find(struct arch_vm_region *head,
 	return c;
 }
 
-/* FIXME: attrs is not used. */
-static void *nds32_dma_alloc_coherent(struct device *dev, size_t size,
-				      dma_addr_t * handle, gfp_t gfp,
-				      unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	struct page *page;
 	struct arch_vm_region *c;
@@ -232,8 +222,8 @@ static void *nds32_dma_alloc_coherent(struct device *dev, size_t size,
 	return NULL;
 }
 
-static void nds32_dma_free(struct device *dev, size_t size, void *cpu_addr,
-			   dma_addr_t handle, unsigned long attrs)
+void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
+		dma_addr_t handle, unsigned long attrs)
 {
 	struct arch_vm_region *c;
 	unsigned long flags, addr;
@@ -333,145 +323,43 @@ static int __init consistent_init(void)
 }
 
 core_initcall(consistent_init);
-static void consistent_sync(void *vaddr, size_t size, int direction, int master_type);
-static dma_addr_t nds32_dma_map_page(struct device *dev, struct page *page,
-				     unsigned long offset, size_t size,
-				     enum dma_data_direction dir,
-				     unsigned long attrs)
-{
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		consistent_sync((void *)(page_address(page) + offset), size, dir, FOR_DEVICE);
-	return page_to_phys(page) + offset;
-}
-
-static void nds32_dma_unmap_page(struct device *dev, dma_addr_t handle,
-				 size_t size, enum dma_data_direction dir,
-				 unsigned long attrs)
-{
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		consistent_sync(phys_to_virt(handle), size, dir, FOR_CPU);
-}
 
-/*
- * Make an area consistent for devices.
- */
-static void consistent_sync(void *vaddr, size_t size, int direction, int master_type)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	unsigned long start = (unsigned long)vaddr;
-	unsigned long end = start + size;
-
-	if (master_type == FOR_CPU) {
-		switch (direction) {
-		case DMA_TO_DEVICE:
-			break;
-		case DMA_FROM_DEVICE:
-		case DMA_BIDIRECTIONAL:
-			cpu_dma_inval_range(start, end);
-			break;
-		default:
-			BUG();
-		}
-	} else {
-		/* FOR_DEVICE */
-		switch (direction) {
-		case DMA_FROM_DEVICE:
-			break;
-		case DMA_TO_DEVICE:
-		case DMA_BIDIRECTIONAL:
-			cpu_dma_wb_range(start, end);
-			break;
-		default:
-			BUG();
-		}
+	void *addr = kmap_atomic_pfn(PHYS_PFN(paddr));
+	unsigned long start = (unsigned long)addr;
+
+	switch (direction) {
+	case DMA_FROM_DEVICE:
+		break;
+	case DMA_TO_DEVICE:
+	case DMA_BIDIRECTIONAL:
+		cpu_dma_wb_range(start, start + size);
+		break;
+	default:
+		BUG();
 	}
-}
 
-static int nds32_dma_map_sg(struct device *dev, struct scatterlist *sg,
-			    int nents, enum dma_data_direction dir,
-			    unsigned long attrs)
-{
-	int i;
-
-	for (i = 0; i < nents; i++, sg++) {
-		void *virt;
-		unsigned long pfn;
-		struct page *page = sg_page(sg);
-
-		sg->dma_address = sg_phys(sg);
-		pfn = page_to_pfn(page) + sg->offset / PAGE_SIZE;
-		page = pfn_to_page(pfn);
-		if (PageHighMem(page)) {
-			virt = kmap_atomic(page);
-			consistent_sync(virt, sg->length, dir, FOR_CPU);
-			kunmap_atomic(virt);
-		} else {
-			if (sg->offset > PAGE_SIZE)
-				panic("sg->offset:%08x > PAGE_SIZE\n",
-				      sg->offset);
-			virt = page_address(page) + sg->offset;
-			consistent_sync(virt, sg->length, dir, FOR_CPU);
-		}
-	}
-	return nents;
-}
-
-static void nds32_dma_unmap_sg(struct device *dev, struct scatterlist *sg,
-			       int nhwentries, enum dma_data_direction dir,
-			       unsigned long attrs)
-{
+	kunmap_atomic(addr);
 }
 
-static void
-nds32_dma_sync_single_for_cpu(struct device *dev, dma_addr_t handle,
-			      size_t size, enum dma_data_direction dir)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	consistent_sync((void *)phys_to_virt(handle), size, dir, FOR_CPU);
-}
-
-static void
-nds32_dma_sync_single_for_device(struct device *dev, dma_addr_t handle,
-				 size_t size, enum dma_data_direction dir)
-{
-	consistent_sync((void *)phys_to_virt(handle), size, dir, FOR_DEVICE);
-}
-
-static void
-nds32_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nents,
-			  enum dma_data_direction dir)
-{
-	int i;
-
-	for (i = 0; i < nents; i++, sg++) {
-		char *virt =
-		    page_address((struct page *)sg->page_link) + sg->offset;
-		consistent_sync(virt, sg->length, dir, FOR_CPU);
+	void *addr = kmap_atomic_pfn(PHYS_PFN(paddr));
+	unsigned long start = (unsigned long)addr;
+
+	switch (direction) {
+	case DMA_TO_DEVICE:
+		break;
+	case DMA_FROM_DEVICE:
+	case DMA_BIDIRECTIONAL:
+		cpu_dma_inval_range(start, end);
+		break;
+	default:
+		BUG();
 	}
-}
-
-static void
-nds32_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
-			     int nents, enum dma_data_direction dir)
-{
-	int i;
 
-	for (i = 0; i < nents; i++, sg++) {
-		char *virt =
-		    page_address((struct page *)sg->page_link) + sg->offset;
-		consistent_sync(virt, sg->length, dir, FOR_DEVICE);
-	}
+	kunmap_atomic(addr);
 }
-
-struct dma_map_ops nds32_dma_ops = {
-	.alloc = nds32_dma_alloc_coherent,
-	.free = nds32_dma_free,
-	.map_page = nds32_dma_map_page,
-	.unmap_page = nds32_dma_unmap_page,
-	.map_sg = nds32_dma_map_sg,
-	.unmap_sg = nds32_dma_unmap_sg,
-	.sync_single_for_device = nds32_dma_sync_single_for_device,
-	.sync_single_for_cpu = nds32_dma_sync_single_for_cpu,
-	.sync_sg_for_cpu = nds32_dma_sync_sg_for_cpu,
-	.sync_sg_for_device = nds32_dma_sync_sg_for_device,
-};
-
-EXPORT_SYMBOL(nds32_dma_ops);
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 13/22] nds32: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Switch to the generic noncoherent direct mapping implementation.

This makes sure kmap_atomic_pfn is consistently used for access to
virtual addresses instead of either using the slower plain kmap
or blindly expecting page_address() to work.

This makes sure the cache_sync routines is called in the unmap_sg
case, to match the unmap_single and sync_{single,sg}_to_cpu cases.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/nds32/Kconfig                   |   3 +
 arch/nds32/include/asm/Kbuild        |   1 +
 arch/nds32/include/asm/dma-mapping.h |  14 ---
 arch/nds32/kernel/dma.c              | 182 ++++++---------------------
 4 files changed, 39 insertions(+), 161 deletions(-)
 delete mode 100644 arch/nds32/include/asm/dma-mapping.h

diff --git a/arch/nds32/Kconfig b/arch/nds32/Kconfig
index 249f38d3388f..67d0ac0a989c 100644
--- a/arch/nds32/Kconfig
+++ b/arch/nds32/Kconfig
@@ -5,10 +5,13 @@
 
 config NDS32
         def_bool y
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select ARCH_WANT_FRAME_POINTERS if FTRACE
 	select CLKSRC_MMIO
 	select CLONE_BACKWARDS
 	select COMMON_CLK
+	select DMA_NONCOHERENT_OPS
 	select GENERIC_ATOMIC64
 	select GENERIC_CPU_DEVICES
 	select GENERIC_CLOCKEVENTS
diff --git a/arch/nds32/include/asm/Kbuild b/arch/nds32/include/asm/Kbuild
index 06bdf8167f5a..b3e951f805f8 100644
--- a/arch/nds32/include/asm/Kbuild
+++ b/arch/nds32/include/asm/Kbuild
@@ -13,6 +13,7 @@ generic-y += cputime.h
 generic-y += device.h
 generic-y += div64.h
 generic-y += dma.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += errno.h
 generic-y += exec.h
diff --git a/arch/nds32/include/asm/dma-mapping.h b/arch/nds32/include/asm/dma-mapping.h
deleted file mode 100644
index 2dd47d245c25..000000000000
--- a/arch/nds32/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,14 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-// Copyright (C) 2005-2017 Andes Technology Corporation
-
-#ifndef ASMNDS32_DMA_MAPPING_H
-#define ASMNDS32_DMA_MAPPING_H
-
-extern struct dma_map_ops nds32_dma_ops;
-
-static inline struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return &nds32_dma_ops;
-}
-
-#endif
diff --git a/arch/nds32/kernel/dma.c b/arch/nds32/kernel/dma.c
index d291800fc621..688f1a03dee6 100644
--- a/arch/nds32/kernel/dma.c
+++ b/arch/nds32/kernel/dma.c
@@ -3,17 +3,14 @@
 
 #include <linux/types.h>
 #include <linux/mm.h>
-#include <linux/export.h>
 #include <linux/string.h>
-#include <linux/scatterlist.h>
-#include <linux/dma-mapping.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/io.h>
 #include <linux/cache.h>
 #include <linux/highmem.h>
 #include <linux/slab.h>
 #include <asm/cacheflush.h>
 #include <asm/tlbflush.h>
-#include <asm/dma-mapping.h>
 #include <asm/proc-fns.h>
 
 /*
@@ -22,11 +19,6 @@
 static pte_t *consistent_pte;
 static DEFINE_RAW_SPINLOCK(consistent_lock);
 
-enum master_type {
-	FOR_CPU = 0,
-	FOR_DEVICE = 1,
-};
-
 /*
  * VM region handling support.
  *
@@ -124,10 +116,8 @@ static struct arch_vm_region *vm_region_find(struct arch_vm_region *head,
 	return c;
 }
 
-/* FIXME: attrs is not used. */
-static void *nds32_dma_alloc_coherent(struct device *dev, size_t size,
-				      dma_addr_t * handle, gfp_t gfp,
-				      unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	struct page *page;
 	struct arch_vm_region *c;
@@ -232,8 +222,8 @@ static void *nds32_dma_alloc_coherent(struct device *dev, size_t size,
 	return NULL;
 }
 
-static void nds32_dma_free(struct device *dev, size_t size, void *cpu_addr,
-			   dma_addr_t handle, unsigned long attrs)
+void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
+		dma_addr_t handle, unsigned long attrs)
 {
 	struct arch_vm_region *c;
 	unsigned long flags, addr;
@@ -333,145 +323,43 @@ static int __init consistent_init(void)
 }
 
 core_initcall(consistent_init);
-static void consistent_sync(void *vaddr, size_t size, int direction, int master_type);
-static dma_addr_t nds32_dma_map_page(struct device *dev, struct page *page,
-				     unsigned long offset, size_t size,
-				     enum dma_data_direction dir,
-				     unsigned long attrs)
-{
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		consistent_sync((void *)(page_address(page) + offset), size, dir, FOR_DEVICE);
-	return page_to_phys(page) + offset;
-}
-
-static void nds32_dma_unmap_page(struct device *dev, dma_addr_t handle,
-				 size_t size, enum dma_data_direction dir,
-				 unsigned long attrs)
-{
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		consistent_sync(phys_to_virt(handle), size, dir, FOR_CPU);
-}
 
-/*
- * Make an area consistent for devices.
- */
-static void consistent_sync(void *vaddr, size_t size, int direction, int master_type)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	unsigned long start = (unsigned long)vaddr;
-	unsigned long end = start + size;
-
-	if (master_type = FOR_CPU) {
-		switch (direction) {
-		case DMA_TO_DEVICE:
-			break;
-		case DMA_FROM_DEVICE:
-		case DMA_BIDIRECTIONAL:
-			cpu_dma_inval_range(start, end);
-			break;
-		default:
-			BUG();
-		}
-	} else {
-		/* FOR_DEVICE */
-		switch (direction) {
-		case DMA_FROM_DEVICE:
-			break;
-		case DMA_TO_DEVICE:
-		case DMA_BIDIRECTIONAL:
-			cpu_dma_wb_range(start, end);
-			break;
-		default:
-			BUG();
-		}
+	void *addr = kmap_atomic_pfn(PHYS_PFN(paddr));
+	unsigned long start = (unsigned long)addr;
+
+	switch (direction) {
+	case DMA_FROM_DEVICE:
+		break;
+	case DMA_TO_DEVICE:
+	case DMA_BIDIRECTIONAL:
+		cpu_dma_wb_range(start, start + size);
+		break;
+	default:
+		BUG();
 	}
-}
 
-static int nds32_dma_map_sg(struct device *dev, struct scatterlist *sg,
-			    int nents, enum dma_data_direction dir,
-			    unsigned long attrs)
-{
-	int i;
-
-	for (i = 0; i < nents; i++, sg++) {
-		void *virt;
-		unsigned long pfn;
-		struct page *page = sg_page(sg);
-
-		sg->dma_address = sg_phys(sg);
-		pfn = page_to_pfn(page) + sg->offset / PAGE_SIZE;
-		page = pfn_to_page(pfn);
-		if (PageHighMem(page)) {
-			virt = kmap_atomic(page);
-			consistent_sync(virt, sg->length, dir, FOR_CPU);
-			kunmap_atomic(virt);
-		} else {
-			if (sg->offset > PAGE_SIZE)
-				panic("sg->offset:%08x > PAGE_SIZE\n",
-				      sg->offset);
-			virt = page_address(page) + sg->offset;
-			consistent_sync(virt, sg->length, dir, FOR_CPU);
-		}
-	}
-	return nents;
-}
-
-static void nds32_dma_unmap_sg(struct device *dev, struct scatterlist *sg,
-			       int nhwentries, enum dma_data_direction dir,
-			       unsigned long attrs)
-{
+	kunmap_atomic(addr);
 }
 
-static void
-nds32_dma_sync_single_for_cpu(struct device *dev, dma_addr_t handle,
-			      size_t size, enum dma_data_direction dir)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	consistent_sync((void *)phys_to_virt(handle), size, dir, FOR_CPU);
-}
-
-static void
-nds32_dma_sync_single_for_device(struct device *dev, dma_addr_t handle,
-				 size_t size, enum dma_data_direction dir)
-{
-	consistent_sync((void *)phys_to_virt(handle), size, dir, FOR_DEVICE);
-}
-
-static void
-nds32_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nents,
-			  enum dma_data_direction dir)
-{
-	int i;
-
-	for (i = 0; i < nents; i++, sg++) {
-		char *virt -		    page_address((struct page *)sg->page_link) + sg->offset;
-		consistent_sync(virt, sg->length, dir, FOR_CPU);
+	void *addr = kmap_atomic_pfn(PHYS_PFN(paddr));
+	unsigned long start = (unsigned long)addr;
+
+	switch (direction) {
+	case DMA_TO_DEVICE:
+		break;
+	case DMA_FROM_DEVICE:
+	case DMA_BIDIRECTIONAL:
+		cpu_dma_inval_range(start, end);
+		break;
+	default:
+		BUG();
 	}
-}
-
-static void
-nds32_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
-			     int nents, enum dma_data_direction dir)
-{
-	int i;
 
-	for (i = 0; i < nents; i++, sg++) {
-		char *virt -		    page_address((struct page *)sg->page_link) + sg->offset;
-		consistent_sync(virt, sg->length, dir, FOR_DEVICE);
-	}
+	kunmap_atomic(addr);
 }
-
-struct dma_map_ops nds32_dma_ops = {
-	.alloc = nds32_dma_alloc_coherent,
-	.free = nds32_dma_free,
-	.map_page = nds32_dma_map_page,
-	.unmap_page = nds32_dma_unmap_page,
-	.map_sg = nds32_dma_map_sg,
-	.unmap_sg = nds32_dma_unmap_sg,
-	.sync_single_for_device = nds32_dma_sync_single_for_device,
-	.sync_single_for_cpu = nds32_dma_sync_single_for_cpu,
-	.sync_sg_for_cpu = nds32_dma_sync_sg_for_cpu,
-	.sync_sg_for_device = nds32_dma_sync_sg_for_device,
-};
-
-EXPORT_SYMBOL(nds32_dma_ops);
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [OpenRISC] [PATCH 13/22] nds32: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  To: openrisc

Switch to the generic noncoherent direct mapping implementation.

This makes sure kmap_atomic_pfn is consistently used for access to
virtual addresses instead of either using the slower plain kmap
or blindly expecting page_address() to work.

This makes sure the cache_sync routines is called in the unmap_sg
case, to match the unmap_single and sync_{single,sg}_to_cpu cases.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/nds32/Kconfig                   |   3 +
 arch/nds32/include/asm/Kbuild        |   1 +
 arch/nds32/include/asm/dma-mapping.h |  14 ---
 arch/nds32/kernel/dma.c              | 182 ++++++---------------------
 4 files changed, 39 insertions(+), 161 deletions(-)
 delete mode 100644 arch/nds32/include/asm/dma-mapping.h

diff --git a/arch/nds32/Kconfig b/arch/nds32/Kconfig
index 249f38d3388f..67d0ac0a989c 100644
--- a/arch/nds32/Kconfig
+++ b/arch/nds32/Kconfig
@@ -5,10 +5,13 @@
 
 config NDS32
         def_bool y
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select ARCH_WANT_FRAME_POINTERS if FTRACE
 	select CLKSRC_MMIO
 	select CLONE_BACKWARDS
 	select COMMON_CLK
+	select DMA_NONCOHERENT_OPS
 	select GENERIC_ATOMIC64
 	select GENERIC_CPU_DEVICES
 	select GENERIC_CLOCKEVENTS
diff --git a/arch/nds32/include/asm/Kbuild b/arch/nds32/include/asm/Kbuild
index 06bdf8167f5a..b3e951f805f8 100644
--- a/arch/nds32/include/asm/Kbuild
+++ b/arch/nds32/include/asm/Kbuild
@@ -13,6 +13,7 @@ generic-y += cputime.h
 generic-y += device.h
 generic-y += div64.h
 generic-y += dma.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += errno.h
 generic-y += exec.h
diff --git a/arch/nds32/include/asm/dma-mapping.h b/arch/nds32/include/asm/dma-mapping.h
deleted file mode 100644
index 2dd47d245c25..000000000000
--- a/arch/nds32/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,14 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-// Copyright (C) 2005-2017 Andes Technology Corporation
-
-#ifndef ASMNDS32_DMA_MAPPING_H
-#define ASMNDS32_DMA_MAPPING_H
-
-extern struct dma_map_ops nds32_dma_ops;
-
-static inline struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return &nds32_dma_ops;
-}
-
-#endif
diff --git a/arch/nds32/kernel/dma.c b/arch/nds32/kernel/dma.c
index d291800fc621..688f1a03dee6 100644
--- a/arch/nds32/kernel/dma.c
+++ b/arch/nds32/kernel/dma.c
@@ -3,17 +3,14 @@
 
 #include <linux/types.h>
 #include <linux/mm.h>
-#include <linux/export.h>
 #include <linux/string.h>
-#include <linux/scatterlist.h>
-#include <linux/dma-mapping.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/io.h>
 #include <linux/cache.h>
 #include <linux/highmem.h>
 #include <linux/slab.h>
 #include <asm/cacheflush.h>
 #include <asm/tlbflush.h>
-#include <asm/dma-mapping.h>
 #include <asm/proc-fns.h>
 
 /*
@@ -22,11 +19,6 @@
 static pte_t *consistent_pte;
 static DEFINE_RAW_SPINLOCK(consistent_lock);
 
-enum master_type {
-	FOR_CPU = 0,
-	FOR_DEVICE = 1,
-};
-
 /*
  * VM region handling support.
  *
@@ -124,10 +116,8 @@ static struct arch_vm_region *vm_region_find(struct arch_vm_region *head,
 	return c;
 }
 
-/* FIXME: attrs is not used. */
-static void *nds32_dma_alloc_coherent(struct device *dev, size_t size,
-				      dma_addr_t * handle, gfp_t gfp,
-				      unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	struct page *page;
 	struct arch_vm_region *c;
@@ -232,8 +222,8 @@ static void *nds32_dma_alloc_coherent(struct device *dev, size_t size,
 	return NULL;
 }
 
-static void nds32_dma_free(struct device *dev, size_t size, void *cpu_addr,
-			   dma_addr_t handle, unsigned long attrs)
+void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
+		dma_addr_t handle, unsigned long attrs)
 {
 	struct arch_vm_region *c;
 	unsigned long flags, addr;
@@ -333,145 +323,43 @@ static int __init consistent_init(void)
 }
 
 core_initcall(consistent_init);
-static void consistent_sync(void *vaddr, size_t size, int direction, int master_type);
-static dma_addr_t nds32_dma_map_page(struct device *dev, struct page *page,
-				     unsigned long offset, size_t size,
-				     enum dma_data_direction dir,
-				     unsigned long attrs)
-{
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		consistent_sync((void *)(page_address(page) + offset), size, dir, FOR_DEVICE);
-	return page_to_phys(page) + offset;
-}
-
-static void nds32_dma_unmap_page(struct device *dev, dma_addr_t handle,
-				 size_t size, enum dma_data_direction dir,
-				 unsigned long attrs)
-{
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		consistent_sync(phys_to_virt(handle), size, dir, FOR_CPU);
-}
 
-/*
- * Make an area consistent for devices.
- */
-static void consistent_sync(void *vaddr, size_t size, int direction, int master_type)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	unsigned long start = (unsigned long)vaddr;
-	unsigned long end = start + size;
-
-	if (master_type == FOR_CPU) {
-		switch (direction) {
-		case DMA_TO_DEVICE:
-			break;
-		case DMA_FROM_DEVICE:
-		case DMA_BIDIRECTIONAL:
-			cpu_dma_inval_range(start, end);
-			break;
-		default:
-			BUG();
-		}
-	} else {
-		/* FOR_DEVICE */
-		switch (direction) {
-		case DMA_FROM_DEVICE:
-			break;
-		case DMA_TO_DEVICE:
-		case DMA_BIDIRECTIONAL:
-			cpu_dma_wb_range(start, end);
-			break;
-		default:
-			BUG();
-		}
+	void *addr = kmap_atomic_pfn(PHYS_PFN(paddr));
+	unsigned long start = (unsigned long)addr;
+
+	switch (direction) {
+	case DMA_FROM_DEVICE:
+		break;
+	case DMA_TO_DEVICE:
+	case DMA_BIDIRECTIONAL:
+		cpu_dma_wb_range(start, start + size);
+		break;
+	default:
+		BUG();
 	}
-}
 
-static int nds32_dma_map_sg(struct device *dev, struct scatterlist *sg,
-			    int nents, enum dma_data_direction dir,
-			    unsigned long attrs)
-{
-	int i;
-
-	for (i = 0; i < nents; i++, sg++) {
-		void *virt;
-		unsigned long pfn;
-		struct page *page = sg_page(sg);
-
-		sg->dma_address = sg_phys(sg);
-		pfn = page_to_pfn(page) + sg->offset / PAGE_SIZE;
-		page = pfn_to_page(pfn);
-		if (PageHighMem(page)) {
-			virt = kmap_atomic(page);
-			consistent_sync(virt, sg->length, dir, FOR_CPU);
-			kunmap_atomic(virt);
-		} else {
-			if (sg->offset > PAGE_SIZE)
-				panic("sg->offset:%08x > PAGE_SIZE\n",
-				      sg->offset);
-			virt = page_address(page) + sg->offset;
-			consistent_sync(virt, sg->length, dir, FOR_CPU);
-		}
-	}
-	return nents;
-}
-
-static void nds32_dma_unmap_sg(struct device *dev, struct scatterlist *sg,
-			       int nhwentries, enum dma_data_direction dir,
-			       unsigned long attrs)
-{
+	kunmap_atomic(addr);
 }
 
-static void
-nds32_dma_sync_single_for_cpu(struct device *dev, dma_addr_t handle,
-			      size_t size, enum dma_data_direction dir)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	consistent_sync((void *)phys_to_virt(handle), size, dir, FOR_CPU);
-}
-
-static void
-nds32_dma_sync_single_for_device(struct device *dev, dma_addr_t handle,
-				 size_t size, enum dma_data_direction dir)
-{
-	consistent_sync((void *)phys_to_virt(handle), size, dir, FOR_DEVICE);
-}
-
-static void
-nds32_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nents,
-			  enum dma_data_direction dir)
-{
-	int i;
-
-	for (i = 0; i < nents; i++, sg++) {
-		char *virt =
-		    page_address((struct page *)sg->page_link) + sg->offset;
-		consistent_sync(virt, sg->length, dir, FOR_CPU);
+	void *addr = kmap_atomic_pfn(PHYS_PFN(paddr));
+	unsigned long start = (unsigned long)addr;
+
+	switch (direction) {
+	case DMA_TO_DEVICE:
+		break;
+	case DMA_FROM_DEVICE:
+	case DMA_BIDIRECTIONAL:
+		cpu_dma_inval_range(start, end);
+		break;
+	default:
+		BUG();
 	}
-}
-
-static void
-nds32_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
-			     int nents, enum dma_data_direction dir)
-{
-	int i;
 
-	for (i = 0; i < nents; i++, sg++) {
-		char *virt =
-		    page_address((struct page *)sg->page_link) + sg->offset;
-		consistent_sync(virt, sg->length, dir, FOR_DEVICE);
-	}
+	kunmap_atomic(addr);
 }
-
-struct dma_map_ops nds32_dma_ops = {
-	.alloc = nds32_dma_alloc_coherent,
-	.free = nds32_dma_free,
-	.map_page = nds32_dma_map_page,
-	.unmap_page = nds32_dma_unmap_page,
-	.map_sg = nds32_dma_map_sg,
-	.unmap_sg = nds32_dma_unmap_sg,
-	.sync_single_for_device = nds32_dma_sync_single_for_device,
-	.sync_single_for_cpu = nds32_dma_sync_single_for_cpu,
-	.sync_sg_for_cpu = nds32_dma_sync_sg_for_cpu,
-	.sync_sg_for_device = nds32_dma_sync_sg_for_device,
-};
-
-EXPORT_SYMBOL(nds32_dma_ops);
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 13/22] nds32: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  To: linux-arm-kernel

Switch to the generic noncoherent direct mapping implementation.

This makes sure kmap_atomic_pfn is consistently used for access to
virtual addresses instead of either using the slower plain kmap
or blindly expecting page_address() to work.

This makes sure the cache_sync routines is called in the unmap_sg
case, to match the unmap_single and sync_{single,sg}_to_cpu cases.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/nds32/Kconfig                   |   3 +
 arch/nds32/include/asm/Kbuild        |   1 +
 arch/nds32/include/asm/dma-mapping.h |  14 ---
 arch/nds32/kernel/dma.c              | 182 ++++++---------------------
 4 files changed, 39 insertions(+), 161 deletions(-)
 delete mode 100644 arch/nds32/include/asm/dma-mapping.h

diff --git a/arch/nds32/Kconfig b/arch/nds32/Kconfig
index 249f38d3388f..67d0ac0a989c 100644
--- a/arch/nds32/Kconfig
+++ b/arch/nds32/Kconfig
@@ -5,10 +5,13 @@
 
 config NDS32
         def_bool y
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select ARCH_WANT_FRAME_POINTERS if FTRACE
 	select CLKSRC_MMIO
 	select CLONE_BACKWARDS
 	select COMMON_CLK
+	select DMA_NONCOHERENT_OPS
 	select GENERIC_ATOMIC64
 	select GENERIC_CPU_DEVICES
 	select GENERIC_CLOCKEVENTS
diff --git a/arch/nds32/include/asm/Kbuild b/arch/nds32/include/asm/Kbuild
index 06bdf8167f5a..b3e951f805f8 100644
--- a/arch/nds32/include/asm/Kbuild
+++ b/arch/nds32/include/asm/Kbuild
@@ -13,6 +13,7 @@ generic-y += cputime.h
 generic-y += device.h
 generic-y += div64.h
 generic-y += dma.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += errno.h
 generic-y += exec.h
diff --git a/arch/nds32/include/asm/dma-mapping.h b/arch/nds32/include/asm/dma-mapping.h
deleted file mode 100644
index 2dd47d245c25..000000000000
--- a/arch/nds32/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,14 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-// Copyright (C) 2005-2017 Andes Technology Corporation
-
-#ifndef ASMNDS32_DMA_MAPPING_H
-#define ASMNDS32_DMA_MAPPING_H
-
-extern struct dma_map_ops nds32_dma_ops;
-
-static inline struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return &nds32_dma_ops;
-}
-
-#endif
diff --git a/arch/nds32/kernel/dma.c b/arch/nds32/kernel/dma.c
index d291800fc621..688f1a03dee6 100644
--- a/arch/nds32/kernel/dma.c
+++ b/arch/nds32/kernel/dma.c
@@ -3,17 +3,14 @@
 
 #include <linux/types.h>
 #include <linux/mm.h>
-#include <linux/export.h>
 #include <linux/string.h>
-#include <linux/scatterlist.h>
-#include <linux/dma-mapping.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/io.h>
 #include <linux/cache.h>
 #include <linux/highmem.h>
 #include <linux/slab.h>
 #include <asm/cacheflush.h>
 #include <asm/tlbflush.h>
-#include <asm/dma-mapping.h>
 #include <asm/proc-fns.h>
 
 /*
@@ -22,11 +19,6 @@
 static pte_t *consistent_pte;
 static DEFINE_RAW_SPINLOCK(consistent_lock);
 
-enum master_type {
-	FOR_CPU = 0,
-	FOR_DEVICE = 1,
-};
-
 /*
  * VM region handling support.
  *
@@ -124,10 +116,8 @@ static struct arch_vm_region *vm_region_find(struct arch_vm_region *head,
 	return c;
 }
 
-/* FIXME: attrs is not used. */
-static void *nds32_dma_alloc_coherent(struct device *dev, size_t size,
-				      dma_addr_t * handle, gfp_t gfp,
-				      unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	struct page *page;
 	struct arch_vm_region *c;
@@ -232,8 +222,8 @@ static void *nds32_dma_alloc_coherent(struct device *dev, size_t size,
 	return NULL;
 }
 
-static void nds32_dma_free(struct device *dev, size_t size, void *cpu_addr,
-			   dma_addr_t handle, unsigned long attrs)
+void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
+		dma_addr_t handle, unsigned long attrs)
 {
 	struct arch_vm_region *c;
 	unsigned long flags, addr;
@@ -333,145 +323,43 @@ static int __init consistent_init(void)
 }
 
 core_initcall(consistent_init);
-static void consistent_sync(void *vaddr, size_t size, int direction, int master_type);
-static dma_addr_t nds32_dma_map_page(struct device *dev, struct page *page,
-				     unsigned long offset, size_t size,
-				     enum dma_data_direction dir,
-				     unsigned long attrs)
-{
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		consistent_sync((void *)(page_address(page) + offset), size, dir, FOR_DEVICE);
-	return page_to_phys(page) + offset;
-}
-
-static void nds32_dma_unmap_page(struct device *dev, dma_addr_t handle,
-				 size_t size, enum dma_data_direction dir,
-				 unsigned long attrs)
-{
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		consistent_sync(phys_to_virt(handle), size, dir, FOR_CPU);
-}
 
-/*
- * Make an area consistent for devices.
- */
-static void consistent_sync(void *vaddr, size_t size, int direction, int master_type)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	unsigned long start = (unsigned long)vaddr;
-	unsigned long end = start + size;
-
-	if (master_type == FOR_CPU) {
-		switch (direction) {
-		case DMA_TO_DEVICE:
-			break;
-		case DMA_FROM_DEVICE:
-		case DMA_BIDIRECTIONAL:
-			cpu_dma_inval_range(start, end);
-			break;
-		default:
-			BUG();
-		}
-	} else {
-		/* FOR_DEVICE */
-		switch (direction) {
-		case DMA_FROM_DEVICE:
-			break;
-		case DMA_TO_DEVICE:
-		case DMA_BIDIRECTIONAL:
-			cpu_dma_wb_range(start, end);
-			break;
-		default:
-			BUG();
-		}
+	void *addr = kmap_atomic_pfn(PHYS_PFN(paddr));
+	unsigned long start = (unsigned long)addr;
+
+	switch (direction) {
+	case DMA_FROM_DEVICE:
+		break;
+	case DMA_TO_DEVICE:
+	case DMA_BIDIRECTIONAL:
+		cpu_dma_wb_range(start, start + size);
+		break;
+	default:
+		BUG();
 	}
-}
 
-static int nds32_dma_map_sg(struct device *dev, struct scatterlist *sg,
-			    int nents, enum dma_data_direction dir,
-			    unsigned long attrs)
-{
-	int i;
-
-	for (i = 0; i < nents; i++, sg++) {
-		void *virt;
-		unsigned long pfn;
-		struct page *page = sg_page(sg);
-
-		sg->dma_address = sg_phys(sg);
-		pfn = page_to_pfn(page) + sg->offset / PAGE_SIZE;
-		page = pfn_to_page(pfn);
-		if (PageHighMem(page)) {
-			virt = kmap_atomic(page);
-			consistent_sync(virt, sg->length, dir, FOR_CPU);
-			kunmap_atomic(virt);
-		} else {
-			if (sg->offset > PAGE_SIZE)
-				panic("sg->offset:%08x > PAGE_SIZE\n",
-				      sg->offset);
-			virt = page_address(page) + sg->offset;
-			consistent_sync(virt, sg->length, dir, FOR_CPU);
-		}
-	}
-	return nents;
-}
-
-static void nds32_dma_unmap_sg(struct device *dev, struct scatterlist *sg,
-			       int nhwentries, enum dma_data_direction dir,
-			       unsigned long attrs)
-{
+	kunmap_atomic(addr);
 }
 
-static void
-nds32_dma_sync_single_for_cpu(struct device *dev, dma_addr_t handle,
-			      size_t size, enum dma_data_direction dir)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	consistent_sync((void *)phys_to_virt(handle), size, dir, FOR_CPU);
-}
-
-static void
-nds32_dma_sync_single_for_device(struct device *dev, dma_addr_t handle,
-				 size_t size, enum dma_data_direction dir)
-{
-	consistent_sync((void *)phys_to_virt(handle), size, dir, FOR_DEVICE);
-}
-
-static void
-nds32_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nents,
-			  enum dma_data_direction dir)
-{
-	int i;
-
-	for (i = 0; i < nents; i++, sg++) {
-		char *virt =
-		    page_address((struct page *)sg->page_link) + sg->offset;
-		consistent_sync(virt, sg->length, dir, FOR_CPU);
+	void *addr = kmap_atomic_pfn(PHYS_PFN(paddr));
+	unsigned long start = (unsigned long)addr;
+
+	switch (direction) {
+	case DMA_TO_DEVICE:
+		break;
+	case DMA_FROM_DEVICE:
+	case DMA_BIDIRECTIONAL:
+		cpu_dma_inval_range(start, end);
+		break;
+	default:
+		BUG();
 	}
-}
-
-static void
-nds32_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
-			     int nents, enum dma_data_direction dir)
-{
-	int i;
 
-	for (i = 0; i < nents; i++, sg++) {
-		char *virt =
-		    page_address((struct page *)sg->page_link) + sg->offset;
-		consistent_sync(virt, sg->length, dir, FOR_DEVICE);
-	}
+	kunmap_atomic(addr);
 }
-
-struct dma_map_ops nds32_dma_ops = {
-	.alloc = nds32_dma_alloc_coherent,
-	.free = nds32_dma_free,
-	.map_page = nds32_dma_map_page,
-	.unmap_page = nds32_dma_unmap_page,
-	.map_sg = nds32_dma_map_sg,
-	.unmap_sg = nds32_dma_unmap_sg,
-	.sync_single_for_device = nds32_dma_sync_single_for_device,
-	.sync_single_for_cpu = nds32_dma_sync_single_for_cpu,
-	.sync_sg_for_cpu = nds32_dma_sync_sg_for_cpu,
-	.sync_sg_for_device = nds32_dma_sync_sg_for_device,
-};
-
-EXPORT_SYMBOL(nds32_dma_ops);
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 14/22] nios2: use generic dma_noncoherent_ops
  2018-04-20  8:02 ` Christoph Hellwig
                     ` (4 preceding siblings ...)
  (?)
@ 2018-04-20  8:03   ` Christoph Hellwig
  -1 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Switch to the generic noncoherent direct mapping implementation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/nios2/Kconfig                   |   3 +
 arch/nios2/include/asm/Kbuild        |   1 +
 arch/nios2/include/asm/dma-mapping.h |  20 ----
 arch/nios2/mm/dma-mapping.c          | 139 +++------------------------
 4 files changed, 17 insertions(+), 146 deletions(-)
 delete mode 100644 arch/nios2/include/asm/dma-mapping.h

diff --git a/arch/nios2/Kconfig b/arch/nios2/Kconfig
index 3d4ec88f1db1..92035042cf62 100644
--- a/arch/nios2/Kconfig
+++ b/arch/nios2/Kconfig
@@ -1,6 +1,9 @@
 # SPDX-License-Identifier: GPL-2.0
 config NIOS2
 	def_bool y
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
+	select DMA_NONCOHERENT_OPS
 	select TIMER_OF
 	select GENERIC_ATOMIC64
 	select GENERIC_CLOCKEVENTS
diff --git a/arch/nios2/include/asm/Kbuild b/arch/nios2/include/asm/Kbuild
index d232da2cbb38..24f6ee1ee69b 100644
--- a/arch/nios2/include/asm/Kbuild
+++ b/arch/nios2/include/asm/Kbuild
@@ -8,6 +8,7 @@ generic-y += current.h
 generic-y += device.h
 generic-y += div64.h
 generic-y += dma.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += exec.h
 generic-y += extable.h
diff --git a/arch/nios2/include/asm/dma-mapping.h b/arch/nios2/include/asm/dma-mapping.h
deleted file mode 100644
index 6ceb92251da0..000000000000
--- a/arch/nios2/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch>
- * Copyright (C) 2009 Wind River Systems Inc
- *
- * This file is subject to the terms and conditions of the GNU General
- * Public License.  See the file COPYING in the main directory of this
- * archive for more details.
- */
-
-#ifndef _ASM_NIOS2_DMA_MAPPING_H
-#define _ASM_NIOS2_DMA_MAPPING_H
-
-extern const struct dma_map_ops nios2_dma_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return &nios2_dma_ops;
-}
-
-#endif /* _ASM_NIOS2_DMA_MAPPING_H */
diff --git a/arch/nios2/mm/dma-mapping.c b/arch/nios2/mm/dma-mapping.c
index 4be815519dd4..4af9e5b5ba1c 100644
--- a/arch/nios2/mm/dma-mapping.c
+++ b/arch/nios2/mm/dma-mapping.c
@@ -12,18 +12,18 @@
 
 #include <linux/types.h>
 #include <linux/mm.h>
-#include <linux/export.h>
 #include <linux/string.h>
-#include <linux/scatterlist.h>
 #include <linux/dma-mapping.h>
 #include <linux/io.h>
 #include <linux/cache.h>
 #include <asm/cacheflush.h>
 
-static inline void __dma_sync_for_device(void *vaddr, size_t size,
-			      enum dma_data_direction direction)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	switch (direction) {
+	void *vaddr = phys_to_virt(paddr);
+
+	switch (dir) {
 	case DMA_FROM_DEVICE:
 		invalidate_dcache_range((unsigned long)vaddr,
 			(unsigned long)(vaddr + size));
@@ -42,10 +42,12 @@ static inline void __dma_sync_for_device(void *vaddr, size_t size,
 	}
 }
 
-static inline void __dma_sync_for_cpu(void *vaddr, size_t size,
-			      enum dma_data_direction direction)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	switch (direction) {
+	void *vaddr = phys_to_virt(paddr);
+
+	switch (dir) {
 	case DMA_BIDIRECTIONAL:
 	case DMA_FROM_DEVICE:
 		invalidate_dcache_range((unsigned long)vaddr,
@@ -58,8 +60,8 @@ static inline void __dma_sync_for_cpu(void *vaddr, size_t size,
 	}
 }
 
-static void *nios2_dma_alloc(struct device *dev, size_t size,
-		dma_addr_t *dma_handle, gfp_t gfp, unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	void *ret;
 
@@ -80,125 +82,10 @@ static void *nios2_dma_alloc(struct device *dev, size_t size,
 	return ret;
 }
 
-static void nios2_dma_free(struct device *dev, size_t size, void *vaddr,
+void arch_dma_free(struct device *dev, size_t size, void *vaddr,
 		dma_addr_t dma_handle, unsigned long attrs)
 {
 	unsigned long addr = (unsigned long) CAC_ADDR((unsigned long) vaddr);
 
 	free_pages(addr, get_order(size));
 }
-
-static int nios2_dma_map_sg(struct device *dev, struct scatterlist *sg,
-		int nents, enum dma_data_direction direction,
-		unsigned long attrs)
-{
-	int i;
-
-	for_each_sg(sg, sg, nents, i) {
-		void *addr = sg_virt(sg);
-
-		if (!addr)
-			continue;
-
-		sg->dma_address = sg_phys(sg);
-
-		if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-			continue;
-
-		__dma_sync_for_device(addr, sg->length, direction);
-	}
-
-	return nents;
-}
-
-static dma_addr_t nios2_dma_map_page(struct device *dev, struct page *page,
-			unsigned long offset, size_t size,
-			enum dma_data_direction direction,
-			unsigned long attrs)
-{
-	void *addr = page_address(page) + offset;
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		__dma_sync_for_device(addr, size, direction);
-
-	return page_to_phys(page) + offset;
-}
-
-static void nios2_dma_unmap_page(struct device *dev, dma_addr_t dma_address,
-		size_t size, enum dma_data_direction direction,
-		unsigned long attrs)
-{
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		__dma_sync_for_cpu(phys_to_virt(dma_address), size, direction);
-}
-
-static void nios2_dma_unmap_sg(struct device *dev, struct scatterlist *sg,
-		int nhwentries, enum dma_data_direction direction,
-		unsigned long attrs)
-{
-	void *addr;
-	int i;
-
-	if (direction == DMA_TO_DEVICE)
-		return;
-
-	if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-		return;
-
-	for_each_sg(sg, sg, nhwentries, i) {
-		addr = sg_virt(sg);
-		if (addr)
-			__dma_sync_for_cpu(addr, sg->length, direction);
-	}
-}
-
-static void nios2_dma_sync_single_for_cpu(struct device *dev,
-		dma_addr_t dma_handle, size_t size,
-		enum dma_data_direction direction)
-{
-	__dma_sync_for_cpu(phys_to_virt(dma_handle), size, direction);
-}
-
-static void nios2_dma_sync_single_for_device(struct device *dev,
-		dma_addr_t dma_handle, size_t size,
-		enum dma_data_direction direction)
-{
-	__dma_sync_for_device(phys_to_virt(dma_handle), size, direction);
-}
-
-static void nios2_dma_sync_sg_for_cpu(struct device *dev,
-		struct scatterlist *sg, int nelems,
-		enum dma_data_direction direction)
-{
-	int i;
-
-	/* Make sure that gcc doesn't leave the empty loop body.  */
-	for_each_sg(sg, sg, nelems, i)
-		__dma_sync_for_cpu(sg_virt(sg), sg->length, direction);
-}
-
-static void nios2_dma_sync_sg_for_device(struct device *dev,
-		struct scatterlist *sg, int nelems,
-		enum dma_data_direction direction)
-{
-	int i;
-
-	/* Make sure that gcc doesn't leave the empty loop body.  */
-	for_each_sg(sg, sg, nelems, i)
-		__dma_sync_for_device(sg_virt(sg), sg->length, direction);
-
-}
-
-const struct dma_map_ops nios2_dma_ops = {
-	.alloc			= nios2_dma_alloc,
-	.free			= nios2_dma_free,
-	.map_page		= nios2_dma_map_page,
-	.unmap_page		= nios2_dma_unmap_page,
-	.map_sg			= nios2_dma_map_sg,
-	.unmap_sg		= nios2_dma_unmap_sg,
-	.sync_single_for_device	= nios2_dma_sync_single_for_device,
-	.sync_single_for_cpu	= nios2_dma_sync_single_for_cpu,
-	.sync_sg_for_cpu	= nios2_dma_sync_sg_for_cpu,
-	.sync_sg_for_device	= nios2_dma_sync_sg_for_device,
-};
-EXPORT_SYMBOL(nios2_dma_ops);
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 14/22] nios2: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Switch to the generic noncoherent direct mapping implementation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/nios2/Kconfig                   |   3 +
 arch/nios2/include/asm/Kbuild        |   1 +
 arch/nios2/include/asm/dma-mapping.h |  20 ----
 arch/nios2/mm/dma-mapping.c          | 139 +++------------------------
 4 files changed, 17 insertions(+), 146 deletions(-)
 delete mode 100644 arch/nios2/include/asm/dma-mapping.h

diff --git a/arch/nios2/Kconfig b/arch/nios2/Kconfig
index 3d4ec88f1db1..92035042cf62 100644
--- a/arch/nios2/Kconfig
+++ b/arch/nios2/Kconfig
@@ -1,6 +1,9 @@
 # SPDX-License-Identifier: GPL-2.0
 config NIOS2
 	def_bool y
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
+	select DMA_NONCOHERENT_OPS
 	select TIMER_OF
 	select GENERIC_ATOMIC64
 	select GENERIC_CLOCKEVENTS
diff --git a/arch/nios2/include/asm/Kbuild b/arch/nios2/include/asm/Kbuild
index d232da2cbb38..24f6ee1ee69b 100644
--- a/arch/nios2/include/asm/Kbuild
+++ b/arch/nios2/include/asm/Kbuild
@@ -8,6 +8,7 @@ generic-y += current.h
 generic-y += device.h
 generic-y += div64.h
 generic-y += dma.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += exec.h
 generic-y += extable.h
diff --git a/arch/nios2/include/asm/dma-mapping.h b/arch/nios2/include/asm/dma-mapping.h
deleted file mode 100644
index 6ceb92251da0..000000000000
--- a/arch/nios2/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch>
- * Copyright (C) 2009 Wind River Systems Inc
- *
- * This file is subject to the terms and conditions of the GNU General
- * Public License.  See the file COPYING in the main directory of this
- * archive for more details.
- */
-
-#ifndef _ASM_NIOS2_DMA_MAPPING_H
-#define _ASM_NIOS2_DMA_MAPPING_H
-
-extern const struct dma_map_ops nios2_dma_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return &nios2_dma_ops;
-}
-
-#endif /* _ASM_NIOS2_DMA_MAPPING_H */
diff --git a/arch/nios2/mm/dma-mapping.c b/arch/nios2/mm/dma-mapping.c
index 4be815519dd4..4af9e5b5ba1c 100644
--- a/arch/nios2/mm/dma-mapping.c
+++ b/arch/nios2/mm/dma-mapping.c
@@ -12,18 +12,18 @@
 
 #include <linux/types.h>
 #include <linux/mm.h>
-#include <linux/export.h>
 #include <linux/string.h>
-#include <linux/scatterlist.h>
 #include <linux/dma-mapping.h>
 #include <linux/io.h>
 #include <linux/cache.h>
 #include <asm/cacheflush.h>
 
-static inline void __dma_sync_for_device(void *vaddr, size_t size,
-			      enum dma_data_direction direction)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	switch (direction) {
+	void *vaddr = phys_to_virt(paddr);
+
+	switch (dir) {
 	case DMA_FROM_DEVICE:
 		invalidate_dcache_range((unsigned long)vaddr,
 			(unsigned long)(vaddr + size));
@@ -42,10 +42,12 @@ static inline void __dma_sync_for_device(void *vaddr, size_t size,
 	}
 }
 
-static inline void __dma_sync_for_cpu(void *vaddr, size_t size,
-			      enum dma_data_direction direction)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	switch (direction) {
+	void *vaddr = phys_to_virt(paddr);
+
+	switch (dir) {
 	case DMA_BIDIRECTIONAL:
 	case DMA_FROM_DEVICE:
 		invalidate_dcache_range((unsigned long)vaddr,
@@ -58,8 +60,8 @@ static inline void __dma_sync_for_cpu(void *vaddr, size_t size,
 	}
 }
 
-static void *nios2_dma_alloc(struct device *dev, size_t size,
-		dma_addr_t *dma_handle, gfp_t gfp, unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	void *ret;
 
@@ -80,125 +82,10 @@ static void *nios2_dma_alloc(struct device *dev, size_t size,
 	return ret;
 }
 
-static void nios2_dma_free(struct device *dev, size_t size, void *vaddr,
+void arch_dma_free(struct device *dev, size_t size, void *vaddr,
 		dma_addr_t dma_handle, unsigned long attrs)
 {
 	unsigned long addr = (unsigned long) CAC_ADDR((unsigned long) vaddr);
 
 	free_pages(addr, get_order(size));
 }
-
-static int nios2_dma_map_sg(struct device *dev, struct scatterlist *sg,
-		int nents, enum dma_data_direction direction,
-		unsigned long attrs)
-{
-	int i;
-
-	for_each_sg(sg, sg, nents, i) {
-		void *addr = sg_virt(sg);
-
-		if (!addr)
-			continue;
-
-		sg->dma_address = sg_phys(sg);
-
-		if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-			continue;
-
-		__dma_sync_for_device(addr, sg->length, direction);
-	}
-
-	return nents;
-}
-
-static dma_addr_t nios2_dma_map_page(struct device *dev, struct page *page,
-			unsigned long offset, size_t size,
-			enum dma_data_direction direction,
-			unsigned long attrs)
-{
-	void *addr = page_address(page) + offset;
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		__dma_sync_for_device(addr, size, direction);
-
-	return page_to_phys(page) + offset;
-}
-
-static void nios2_dma_unmap_page(struct device *dev, dma_addr_t dma_address,
-		size_t size, enum dma_data_direction direction,
-		unsigned long attrs)
-{
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		__dma_sync_for_cpu(phys_to_virt(dma_address), size, direction);
-}
-
-static void nios2_dma_unmap_sg(struct device *dev, struct scatterlist *sg,
-		int nhwentries, enum dma_data_direction direction,
-		unsigned long attrs)
-{
-	void *addr;
-	int i;
-
-	if (direction == DMA_TO_DEVICE)
-		return;
-
-	if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-		return;
-
-	for_each_sg(sg, sg, nhwentries, i) {
-		addr = sg_virt(sg);
-		if (addr)
-			__dma_sync_for_cpu(addr, sg->length, direction);
-	}
-}
-
-static void nios2_dma_sync_single_for_cpu(struct device *dev,
-		dma_addr_t dma_handle, size_t size,
-		enum dma_data_direction direction)
-{
-	__dma_sync_for_cpu(phys_to_virt(dma_handle), size, direction);
-}
-
-static void nios2_dma_sync_single_for_device(struct device *dev,
-		dma_addr_t dma_handle, size_t size,
-		enum dma_data_direction direction)
-{
-	__dma_sync_for_device(phys_to_virt(dma_handle), size, direction);
-}
-
-static void nios2_dma_sync_sg_for_cpu(struct device *dev,
-		struct scatterlist *sg, int nelems,
-		enum dma_data_direction direction)
-{
-	int i;
-
-	/* Make sure that gcc doesn't leave the empty loop body.  */
-	for_each_sg(sg, sg, nelems, i)
-		__dma_sync_for_cpu(sg_virt(sg), sg->length, direction);
-}
-
-static void nios2_dma_sync_sg_for_device(struct device *dev,
-		struct scatterlist *sg, int nelems,
-		enum dma_data_direction direction)
-{
-	int i;
-
-	/* Make sure that gcc doesn't leave the empty loop body.  */
-	for_each_sg(sg, sg, nelems, i)
-		__dma_sync_for_device(sg_virt(sg), sg->length, direction);
-
-}
-
-const struct dma_map_ops nios2_dma_ops = {
-	.alloc			= nios2_dma_alloc,
-	.free			= nios2_dma_free,
-	.map_page		= nios2_dma_map_page,
-	.unmap_page		= nios2_dma_unmap_page,
-	.map_sg			= nios2_dma_map_sg,
-	.unmap_sg		= nios2_dma_unmap_sg,
-	.sync_single_for_device	= nios2_dma_sync_single_for_device,
-	.sync_single_for_cpu	= nios2_dma_sync_single_for_cpu,
-	.sync_sg_for_cpu	= nios2_dma_sync_sg_for_cpu,
-	.sync_sg_for_device	= nios2_dma_sync_sg_for_device,
-};
-EXPORT_SYMBOL(nios2_dma_ops);
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 14/22] nios2: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Switch to the generic noncoherent direct mapping implementation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/nios2/Kconfig                   |   3 +
 arch/nios2/include/asm/Kbuild        |   1 +
 arch/nios2/include/asm/dma-mapping.h |  20 ----
 arch/nios2/mm/dma-mapping.c          | 139 +++------------------------
 4 files changed, 17 insertions(+), 146 deletions(-)
 delete mode 100644 arch/nios2/include/asm/dma-mapping.h

diff --git a/arch/nios2/Kconfig b/arch/nios2/Kconfig
index 3d4ec88f1db1..92035042cf62 100644
--- a/arch/nios2/Kconfig
+++ b/arch/nios2/Kconfig
@@ -1,6 +1,9 @@
 # SPDX-License-Identifier: GPL-2.0
 config NIOS2
 	def_bool y
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
+	select DMA_NONCOHERENT_OPS
 	select TIMER_OF
 	select GENERIC_ATOMIC64
 	select GENERIC_CLOCKEVENTS
diff --git a/arch/nios2/include/asm/Kbuild b/arch/nios2/include/asm/Kbuild
index d232da2cbb38..24f6ee1ee69b 100644
--- a/arch/nios2/include/asm/Kbuild
+++ b/arch/nios2/include/asm/Kbuild
@@ -8,6 +8,7 @@ generic-y += current.h
 generic-y += device.h
 generic-y += div64.h
 generic-y += dma.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += exec.h
 generic-y += extable.h
diff --git a/arch/nios2/include/asm/dma-mapping.h b/arch/nios2/include/asm/dma-mapping.h
deleted file mode 100644
index 6ceb92251da0..000000000000
--- a/arch/nios2/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch>
- * Copyright (C) 2009 Wind River Systems Inc
- *
- * This file is subject to the terms and conditions of the GNU General
- * Public License.  See the file COPYING in the main directory of this
- * archive for more details.
- */
-
-#ifndef _ASM_NIOS2_DMA_MAPPING_H
-#define _ASM_NIOS2_DMA_MAPPING_H
-
-extern const struct dma_map_ops nios2_dma_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return &nios2_dma_ops;
-}
-
-#endif /* _ASM_NIOS2_DMA_MAPPING_H */
diff --git a/arch/nios2/mm/dma-mapping.c b/arch/nios2/mm/dma-mapping.c
index 4be815519dd4..4af9e5b5ba1c 100644
--- a/arch/nios2/mm/dma-mapping.c
+++ b/arch/nios2/mm/dma-mapping.c
@@ -12,18 +12,18 @@
 
 #include <linux/types.h>
 #include <linux/mm.h>
-#include <linux/export.h>
 #include <linux/string.h>
-#include <linux/scatterlist.h>
 #include <linux/dma-mapping.h>
 #include <linux/io.h>
 #include <linux/cache.h>
 #include <asm/cacheflush.h>
 
-static inline void __dma_sync_for_device(void *vaddr, size_t size,
-			      enum dma_data_direction direction)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	switch (direction) {
+	void *vaddr = phys_to_virt(paddr);
+
+	switch (dir) {
 	case DMA_FROM_DEVICE:
 		invalidate_dcache_range((unsigned long)vaddr,
 			(unsigned long)(vaddr + size));
@@ -42,10 +42,12 @@ static inline void __dma_sync_for_device(void *vaddr, size_t size,
 	}
 }
 
-static inline void __dma_sync_for_cpu(void *vaddr, size_t size,
-			      enum dma_data_direction direction)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	switch (direction) {
+	void *vaddr = phys_to_virt(paddr);
+
+	switch (dir) {
 	case DMA_BIDIRECTIONAL:
 	case DMA_FROM_DEVICE:
 		invalidate_dcache_range((unsigned long)vaddr,
@@ -58,8 +60,8 @@ static inline void __dma_sync_for_cpu(void *vaddr, size_t size,
 	}
 }
 
-static void *nios2_dma_alloc(struct device *dev, size_t size,
-		dma_addr_t *dma_handle, gfp_t gfp, unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	void *ret;
 
@@ -80,125 +82,10 @@ static void *nios2_dma_alloc(struct device *dev, size_t size,
 	return ret;
 }
 
-static void nios2_dma_free(struct device *dev, size_t size, void *vaddr,
+void arch_dma_free(struct device *dev, size_t size, void *vaddr,
 		dma_addr_t dma_handle, unsigned long attrs)
 {
 	unsigned long addr = (unsigned long) CAC_ADDR((unsigned long) vaddr);
 
 	free_pages(addr, get_order(size));
 }
-
-static int nios2_dma_map_sg(struct device *dev, struct scatterlist *sg,
-		int nents, enum dma_data_direction direction,
-		unsigned long attrs)
-{
-	int i;
-
-	for_each_sg(sg, sg, nents, i) {
-		void *addr = sg_virt(sg);
-
-		if (!addr)
-			continue;
-
-		sg->dma_address = sg_phys(sg);
-
-		if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-			continue;
-
-		__dma_sync_for_device(addr, sg->length, direction);
-	}
-
-	return nents;
-}
-
-static dma_addr_t nios2_dma_map_page(struct device *dev, struct page *page,
-			unsigned long offset, size_t size,
-			enum dma_data_direction direction,
-			unsigned long attrs)
-{
-	void *addr = page_address(page) + offset;
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		__dma_sync_for_device(addr, size, direction);
-
-	return page_to_phys(page) + offset;
-}
-
-static void nios2_dma_unmap_page(struct device *dev, dma_addr_t dma_address,
-		size_t size, enum dma_data_direction direction,
-		unsigned long attrs)
-{
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		__dma_sync_for_cpu(phys_to_virt(dma_address), size, direction);
-}
-
-static void nios2_dma_unmap_sg(struct device *dev, struct scatterlist *sg,
-		int nhwentries, enum dma_data_direction direction,
-		unsigned long attrs)
-{
-	void *addr;
-	int i;
-
-	if (direction == DMA_TO_DEVICE)
-		return;
-
-	if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-		return;
-
-	for_each_sg(sg, sg, nhwentries, i) {
-		addr = sg_virt(sg);
-		if (addr)
-			__dma_sync_for_cpu(addr, sg->length, direction);
-	}
-}
-
-static void nios2_dma_sync_single_for_cpu(struct device *dev,
-		dma_addr_t dma_handle, size_t size,
-		enum dma_data_direction direction)
-{
-	__dma_sync_for_cpu(phys_to_virt(dma_handle), size, direction);
-}
-
-static void nios2_dma_sync_single_for_device(struct device *dev,
-		dma_addr_t dma_handle, size_t size,
-		enum dma_data_direction direction)
-{
-	__dma_sync_for_device(phys_to_virt(dma_handle), size, direction);
-}
-
-static void nios2_dma_sync_sg_for_cpu(struct device *dev,
-		struct scatterlist *sg, int nelems,
-		enum dma_data_direction direction)
-{
-	int i;
-
-	/* Make sure that gcc doesn't leave the empty loop body.  */
-	for_each_sg(sg, sg, nelems, i)
-		__dma_sync_for_cpu(sg_virt(sg), sg->length, direction);
-}
-
-static void nios2_dma_sync_sg_for_device(struct device *dev,
-		struct scatterlist *sg, int nelems,
-		enum dma_data_direction direction)
-{
-	int i;
-
-	/* Make sure that gcc doesn't leave the empty loop body.  */
-	for_each_sg(sg, sg, nelems, i)
-		__dma_sync_for_device(sg_virt(sg), sg->length, direction);
-
-}
-
-const struct dma_map_ops nios2_dma_ops = {
-	.alloc			= nios2_dma_alloc,
-	.free			= nios2_dma_free,
-	.map_page		= nios2_dma_map_page,
-	.unmap_page		= nios2_dma_unmap_page,
-	.map_sg			= nios2_dma_map_sg,
-	.unmap_sg		= nios2_dma_unmap_sg,
-	.sync_single_for_device	= nios2_dma_sync_single_for_device,
-	.sync_single_for_cpu	= nios2_dma_sync_single_for_cpu,
-	.sync_sg_for_cpu	= nios2_dma_sync_sg_for_cpu,
-	.sync_sg_for_device	= nios2_dma_sync_sg_for_device,
-};
-EXPORT_SYMBOL(nios2_dma_ops);
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 14/22] nios2: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  To: linux-snps-arc

Switch to the generic noncoherent direct mapping implementation.

Signed-off-by: Christoph Hellwig <hch at lst.de>
---
 arch/nios2/Kconfig                   |   3 +
 arch/nios2/include/asm/Kbuild        |   1 +
 arch/nios2/include/asm/dma-mapping.h |  20 ----
 arch/nios2/mm/dma-mapping.c          | 139 +++------------------------
 4 files changed, 17 insertions(+), 146 deletions(-)
 delete mode 100644 arch/nios2/include/asm/dma-mapping.h

diff --git a/arch/nios2/Kconfig b/arch/nios2/Kconfig
index 3d4ec88f1db1..92035042cf62 100644
--- a/arch/nios2/Kconfig
+++ b/arch/nios2/Kconfig
@@ -1,6 +1,9 @@
 # SPDX-License-Identifier: GPL-2.0
 config NIOS2
 	def_bool y
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
+	select DMA_NONCOHERENT_OPS
 	select TIMER_OF
 	select GENERIC_ATOMIC64
 	select GENERIC_CLOCKEVENTS
diff --git a/arch/nios2/include/asm/Kbuild b/arch/nios2/include/asm/Kbuild
index d232da2cbb38..24f6ee1ee69b 100644
--- a/arch/nios2/include/asm/Kbuild
+++ b/arch/nios2/include/asm/Kbuild
@@ -8,6 +8,7 @@ generic-y += current.h
 generic-y += device.h
 generic-y += div64.h
 generic-y += dma.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += exec.h
 generic-y += extable.h
diff --git a/arch/nios2/include/asm/dma-mapping.h b/arch/nios2/include/asm/dma-mapping.h
deleted file mode 100644
index 6ceb92251da0..000000000000
--- a/arch/nios2/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (C) 2011 Tobias Klauser <tklauser at distanz.ch>
- * Copyright (C) 2009 Wind River Systems Inc
- *
- * This file is subject to the terms and conditions of the GNU General
- * Public License.  See the file COPYING in the main directory of this
- * archive for more details.
- */
-
-#ifndef _ASM_NIOS2_DMA_MAPPING_H
-#define _ASM_NIOS2_DMA_MAPPING_H
-
-extern const struct dma_map_ops nios2_dma_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return &nios2_dma_ops;
-}
-
-#endif /* _ASM_NIOS2_DMA_MAPPING_H */
diff --git a/arch/nios2/mm/dma-mapping.c b/arch/nios2/mm/dma-mapping.c
index 4be815519dd4..4af9e5b5ba1c 100644
--- a/arch/nios2/mm/dma-mapping.c
+++ b/arch/nios2/mm/dma-mapping.c
@@ -12,18 +12,18 @@
 
 #include <linux/types.h>
 #include <linux/mm.h>
-#include <linux/export.h>
 #include <linux/string.h>
-#include <linux/scatterlist.h>
 #include <linux/dma-mapping.h>
 #include <linux/io.h>
 #include <linux/cache.h>
 #include <asm/cacheflush.h>
 
-static inline void __dma_sync_for_device(void *vaddr, size_t size,
-			      enum dma_data_direction direction)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	switch (direction) {
+	void *vaddr = phys_to_virt(paddr);
+
+	switch (dir) {
 	case DMA_FROM_DEVICE:
 		invalidate_dcache_range((unsigned long)vaddr,
 			(unsigned long)(vaddr + size));
@@ -42,10 +42,12 @@ static inline void __dma_sync_for_device(void *vaddr, size_t size,
 	}
 }
 
-static inline void __dma_sync_for_cpu(void *vaddr, size_t size,
-			      enum dma_data_direction direction)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	switch (direction) {
+	void *vaddr = phys_to_virt(paddr);
+
+	switch (dir) {
 	case DMA_BIDIRECTIONAL:
 	case DMA_FROM_DEVICE:
 		invalidate_dcache_range((unsigned long)vaddr,
@@ -58,8 +60,8 @@ static inline void __dma_sync_for_cpu(void *vaddr, size_t size,
 	}
 }
 
-static void *nios2_dma_alloc(struct device *dev, size_t size,
-		dma_addr_t *dma_handle, gfp_t gfp, unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	void *ret;
 
@@ -80,125 +82,10 @@ static void *nios2_dma_alloc(struct device *dev, size_t size,
 	return ret;
 }
 
-static void nios2_dma_free(struct device *dev, size_t size, void *vaddr,
+void arch_dma_free(struct device *dev, size_t size, void *vaddr,
 		dma_addr_t dma_handle, unsigned long attrs)
 {
 	unsigned long addr = (unsigned long) CAC_ADDR((unsigned long) vaddr);
 
 	free_pages(addr, get_order(size));
 }
-
-static int nios2_dma_map_sg(struct device *dev, struct scatterlist *sg,
-		int nents, enum dma_data_direction direction,
-		unsigned long attrs)
-{
-	int i;
-
-	for_each_sg(sg, sg, nents, i) {
-		void *addr = sg_virt(sg);
-
-		if (!addr)
-			continue;
-
-		sg->dma_address = sg_phys(sg);
-
-		if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-			continue;
-
-		__dma_sync_for_device(addr, sg->length, direction);
-	}
-
-	return nents;
-}
-
-static dma_addr_t nios2_dma_map_page(struct device *dev, struct page *page,
-			unsigned long offset, size_t size,
-			enum dma_data_direction direction,
-			unsigned long attrs)
-{
-	void *addr = page_address(page) + offset;
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		__dma_sync_for_device(addr, size, direction);
-
-	return page_to_phys(page) + offset;
-}
-
-static void nios2_dma_unmap_page(struct device *dev, dma_addr_t dma_address,
-		size_t size, enum dma_data_direction direction,
-		unsigned long attrs)
-{
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		__dma_sync_for_cpu(phys_to_virt(dma_address), size, direction);
-}
-
-static void nios2_dma_unmap_sg(struct device *dev, struct scatterlist *sg,
-		int nhwentries, enum dma_data_direction direction,
-		unsigned long attrs)
-{
-	void *addr;
-	int i;
-
-	if (direction == DMA_TO_DEVICE)
-		return;
-
-	if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-		return;
-
-	for_each_sg(sg, sg, nhwentries, i) {
-		addr = sg_virt(sg);
-		if (addr)
-			__dma_sync_for_cpu(addr, sg->length, direction);
-	}
-}
-
-static void nios2_dma_sync_single_for_cpu(struct device *dev,
-		dma_addr_t dma_handle, size_t size,
-		enum dma_data_direction direction)
-{
-	__dma_sync_for_cpu(phys_to_virt(dma_handle), size, direction);
-}
-
-static void nios2_dma_sync_single_for_device(struct device *dev,
-		dma_addr_t dma_handle, size_t size,
-		enum dma_data_direction direction)
-{
-	__dma_sync_for_device(phys_to_virt(dma_handle), size, direction);
-}
-
-static void nios2_dma_sync_sg_for_cpu(struct device *dev,
-		struct scatterlist *sg, int nelems,
-		enum dma_data_direction direction)
-{
-	int i;
-
-	/* Make sure that gcc doesn't leave the empty loop body.  */
-	for_each_sg(sg, sg, nelems, i)
-		__dma_sync_for_cpu(sg_virt(sg), sg->length, direction);
-}
-
-static void nios2_dma_sync_sg_for_device(struct device *dev,
-		struct scatterlist *sg, int nelems,
-		enum dma_data_direction direction)
-{
-	int i;
-
-	/* Make sure that gcc doesn't leave the empty loop body.  */
-	for_each_sg(sg, sg, nelems, i)
-		__dma_sync_for_device(sg_virt(sg), sg->length, direction);
-
-}
-
-const struct dma_map_ops nios2_dma_ops = {
-	.alloc			= nios2_dma_alloc,
-	.free			= nios2_dma_free,
-	.map_page		= nios2_dma_map_page,
-	.unmap_page		= nios2_dma_unmap_page,
-	.map_sg			= nios2_dma_map_sg,
-	.unmap_sg		= nios2_dma_unmap_sg,
-	.sync_single_for_device	= nios2_dma_sync_single_for_device,
-	.sync_single_for_cpu	= nios2_dma_sync_single_for_cpu,
-	.sync_sg_for_cpu	= nios2_dma_sync_sg_for_cpu,
-	.sync_sg_for_device	= nios2_dma_sync_sg_for_device,
-};
-EXPORT_SYMBOL(nios2_dma_ops);
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 14/22] nios2: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Switch to the generic noncoherent direct mapping implementation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/nios2/Kconfig                   |   3 +
 arch/nios2/include/asm/Kbuild        |   1 +
 arch/nios2/include/asm/dma-mapping.h |  20 ----
 arch/nios2/mm/dma-mapping.c          | 139 +++------------------------
 4 files changed, 17 insertions(+), 146 deletions(-)
 delete mode 100644 arch/nios2/include/asm/dma-mapping.h

diff --git a/arch/nios2/Kconfig b/arch/nios2/Kconfig
index 3d4ec88f1db1..92035042cf62 100644
--- a/arch/nios2/Kconfig
+++ b/arch/nios2/Kconfig
@@ -1,6 +1,9 @@
 # SPDX-License-Identifier: GPL-2.0
 config NIOS2
 	def_bool y
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
+	select DMA_NONCOHERENT_OPS
 	select TIMER_OF
 	select GENERIC_ATOMIC64
 	select GENERIC_CLOCKEVENTS
diff --git a/arch/nios2/include/asm/Kbuild b/arch/nios2/include/asm/Kbuild
index d232da2cbb38..24f6ee1ee69b 100644
--- a/arch/nios2/include/asm/Kbuild
+++ b/arch/nios2/include/asm/Kbuild
@@ -8,6 +8,7 @@ generic-y += current.h
 generic-y += device.h
 generic-y += div64.h
 generic-y += dma.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += exec.h
 generic-y += extable.h
diff --git a/arch/nios2/include/asm/dma-mapping.h b/arch/nios2/include/asm/dma-mapping.h
deleted file mode 100644
index 6ceb92251da0..000000000000
--- a/arch/nios2/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch>
- * Copyright (C) 2009 Wind River Systems Inc
- *
- * This file is subject to the terms and conditions of the GNU General
- * Public License.  See the file COPYING in the main directory of this
- * archive for more details.
- */
-
-#ifndef _ASM_NIOS2_DMA_MAPPING_H
-#define _ASM_NIOS2_DMA_MAPPING_H
-
-extern const struct dma_map_ops nios2_dma_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return &nios2_dma_ops;
-}
-
-#endif /* _ASM_NIOS2_DMA_MAPPING_H */
diff --git a/arch/nios2/mm/dma-mapping.c b/arch/nios2/mm/dma-mapping.c
index 4be815519dd4..4af9e5b5ba1c 100644
--- a/arch/nios2/mm/dma-mapping.c
+++ b/arch/nios2/mm/dma-mapping.c
@@ -12,18 +12,18 @@
 
 #include <linux/types.h>
 #include <linux/mm.h>
-#include <linux/export.h>
 #include <linux/string.h>
-#include <linux/scatterlist.h>
 #include <linux/dma-mapping.h>
 #include <linux/io.h>
 #include <linux/cache.h>
 #include <asm/cacheflush.h>
 
-static inline void __dma_sync_for_device(void *vaddr, size_t size,
-			      enum dma_data_direction direction)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	switch (direction) {
+	void *vaddr = phys_to_virt(paddr);
+
+	switch (dir) {
 	case DMA_FROM_DEVICE:
 		invalidate_dcache_range((unsigned long)vaddr,
 			(unsigned long)(vaddr + size));
@@ -42,10 +42,12 @@ static inline void __dma_sync_for_device(void *vaddr, size_t size,
 	}
 }
 
-static inline void __dma_sync_for_cpu(void *vaddr, size_t size,
-			      enum dma_data_direction direction)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	switch (direction) {
+	void *vaddr = phys_to_virt(paddr);
+
+	switch (dir) {
 	case DMA_BIDIRECTIONAL:
 	case DMA_FROM_DEVICE:
 		invalidate_dcache_range((unsigned long)vaddr,
@@ -58,8 +60,8 @@ static inline void __dma_sync_for_cpu(void *vaddr, size_t size,
 	}
 }
 
-static void *nios2_dma_alloc(struct device *dev, size_t size,
-		dma_addr_t *dma_handle, gfp_t gfp, unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	void *ret;
 
@@ -80,125 +82,10 @@ static void *nios2_dma_alloc(struct device *dev, size_t size,
 	return ret;
 }
 
-static void nios2_dma_free(struct device *dev, size_t size, void *vaddr,
+void arch_dma_free(struct device *dev, size_t size, void *vaddr,
 		dma_addr_t dma_handle, unsigned long attrs)
 {
 	unsigned long addr = (unsigned long) CAC_ADDR((unsigned long) vaddr);
 
 	free_pages(addr, get_order(size));
 }
-
-static int nios2_dma_map_sg(struct device *dev, struct scatterlist *sg,
-		int nents, enum dma_data_direction direction,
-		unsigned long attrs)
-{
-	int i;
-
-	for_each_sg(sg, sg, nents, i) {
-		void *addr = sg_virt(sg);
-
-		if (!addr)
-			continue;
-
-		sg->dma_address = sg_phys(sg);
-
-		if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-			continue;
-
-		__dma_sync_for_device(addr, sg->length, direction);
-	}
-
-	return nents;
-}
-
-static dma_addr_t nios2_dma_map_page(struct device *dev, struct page *page,
-			unsigned long offset, size_t size,
-			enum dma_data_direction direction,
-			unsigned long attrs)
-{
-	void *addr = page_address(page) + offset;
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		__dma_sync_for_device(addr, size, direction);
-
-	return page_to_phys(page) + offset;
-}
-
-static void nios2_dma_unmap_page(struct device *dev, dma_addr_t dma_address,
-		size_t size, enum dma_data_direction direction,
-		unsigned long attrs)
-{
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		__dma_sync_for_cpu(phys_to_virt(dma_address), size, direction);
-}
-
-static void nios2_dma_unmap_sg(struct device *dev, struct scatterlist *sg,
-		int nhwentries, enum dma_data_direction direction,
-		unsigned long attrs)
-{
-	void *addr;
-	int i;
-
-	if (direction = DMA_TO_DEVICE)
-		return;
-
-	if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-		return;
-
-	for_each_sg(sg, sg, nhwentries, i) {
-		addr = sg_virt(sg);
-		if (addr)
-			__dma_sync_for_cpu(addr, sg->length, direction);
-	}
-}
-
-static void nios2_dma_sync_single_for_cpu(struct device *dev,
-		dma_addr_t dma_handle, size_t size,
-		enum dma_data_direction direction)
-{
-	__dma_sync_for_cpu(phys_to_virt(dma_handle), size, direction);
-}
-
-static void nios2_dma_sync_single_for_device(struct device *dev,
-		dma_addr_t dma_handle, size_t size,
-		enum dma_data_direction direction)
-{
-	__dma_sync_for_device(phys_to_virt(dma_handle), size, direction);
-}
-
-static void nios2_dma_sync_sg_for_cpu(struct device *dev,
-		struct scatterlist *sg, int nelems,
-		enum dma_data_direction direction)
-{
-	int i;
-
-	/* Make sure that gcc doesn't leave the empty loop body.  */
-	for_each_sg(sg, sg, nelems, i)
-		__dma_sync_for_cpu(sg_virt(sg), sg->length, direction);
-}
-
-static void nios2_dma_sync_sg_for_device(struct device *dev,
-		struct scatterlist *sg, int nelems,
-		enum dma_data_direction direction)
-{
-	int i;
-
-	/* Make sure that gcc doesn't leave the empty loop body.  */
-	for_each_sg(sg, sg, nelems, i)
-		__dma_sync_for_device(sg_virt(sg), sg->length, direction);
-
-}
-
-const struct dma_map_ops nios2_dma_ops = {
-	.alloc			= nios2_dma_alloc,
-	.free			= nios2_dma_free,
-	.map_page		= nios2_dma_map_page,
-	.unmap_page		= nios2_dma_unmap_page,
-	.map_sg			= nios2_dma_map_sg,
-	.unmap_sg		= nios2_dma_unmap_sg,
-	.sync_single_for_device	= nios2_dma_sync_single_for_device,
-	.sync_single_for_cpu	= nios2_dma_sync_single_for_cpu,
-	.sync_sg_for_cpu	= nios2_dma_sync_sg_for_cpu,
-	.sync_sg_for_device	= nios2_dma_sync_sg_for_device,
-};
-EXPORT_SYMBOL(nios2_dma_ops);
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [OpenRISC] [PATCH 14/22] nios2: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  To: openrisc

Switch to the generic noncoherent direct mapping implementation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/nios2/Kconfig                   |   3 +
 arch/nios2/include/asm/Kbuild        |   1 +
 arch/nios2/include/asm/dma-mapping.h |  20 ----
 arch/nios2/mm/dma-mapping.c          | 139 +++------------------------
 4 files changed, 17 insertions(+), 146 deletions(-)
 delete mode 100644 arch/nios2/include/asm/dma-mapping.h

diff --git a/arch/nios2/Kconfig b/arch/nios2/Kconfig
index 3d4ec88f1db1..92035042cf62 100644
--- a/arch/nios2/Kconfig
+++ b/arch/nios2/Kconfig
@@ -1,6 +1,9 @@
 # SPDX-License-Identifier: GPL-2.0
 config NIOS2
 	def_bool y
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
+	select DMA_NONCOHERENT_OPS
 	select TIMER_OF
 	select GENERIC_ATOMIC64
 	select GENERIC_CLOCKEVENTS
diff --git a/arch/nios2/include/asm/Kbuild b/arch/nios2/include/asm/Kbuild
index d232da2cbb38..24f6ee1ee69b 100644
--- a/arch/nios2/include/asm/Kbuild
+++ b/arch/nios2/include/asm/Kbuild
@@ -8,6 +8,7 @@ generic-y += current.h
 generic-y += device.h
 generic-y += div64.h
 generic-y += dma.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += exec.h
 generic-y += extable.h
diff --git a/arch/nios2/include/asm/dma-mapping.h b/arch/nios2/include/asm/dma-mapping.h
deleted file mode 100644
index 6ceb92251da0..000000000000
--- a/arch/nios2/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch>
- * Copyright (C) 2009 Wind River Systems Inc
- *
- * This file is subject to the terms and conditions of the GNU General
- * Public License.  See the file COPYING in the main directory of this
- * archive for more details.
- */
-
-#ifndef _ASM_NIOS2_DMA_MAPPING_H
-#define _ASM_NIOS2_DMA_MAPPING_H
-
-extern const struct dma_map_ops nios2_dma_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return &nios2_dma_ops;
-}
-
-#endif /* _ASM_NIOS2_DMA_MAPPING_H */
diff --git a/arch/nios2/mm/dma-mapping.c b/arch/nios2/mm/dma-mapping.c
index 4be815519dd4..4af9e5b5ba1c 100644
--- a/arch/nios2/mm/dma-mapping.c
+++ b/arch/nios2/mm/dma-mapping.c
@@ -12,18 +12,18 @@
 
 #include <linux/types.h>
 #include <linux/mm.h>
-#include <linux/export.h>
 #include <linux/string.h>
-#include <linux/scatterlist.h>
 #include <linux/dma-mapping.h>
 #include <linux/io.h>
 #include <linux/cache.h>
 #include <asm/cacheflush.h>
 
-static inline void __dma_sync_for_device(void *vaddr, size_t size,
-			      enum dma_data_direction direction)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	switch (direction) {
+	void *vaddr = phys_to_virt(paddr);
+
+	switch (dir) {
 	case DMA_FROM_DEVICE:
 		invalidate_dcache_range((unsigned long)vaddr,
 			(unsigned long)(vaddr + size));
@@ -42,10 +42,12 @@ static inline void __dma_sync_for_device(void *vaddr, size_t size,
 	}
 }
 
-static inline void __dma_sync_for_cpu(void *vaddr, size_t size,
-			      enum dma_data_direction direction)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	switch (direction) {
+	void *vaddr = phys_to_virt(paddr);
+
+	switch (dir) {
 	case DMA_BIDIRECTIONAL:
 	case DMA_FROM_DEVICE:
 		invalidate_dcache_range((unsigned long)vaddr,
@@ -58,8 +60,8 @@ static inline void __dma_sync_for_cpu(void *vaddr, size_t size,
 	}
 }
 
-static void *nios2_dma_alloc(struct device *dev, size_t size,
-		dma_addr_t *dma_handle, gfp_t gfp, unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	void *ret;
 
@@ -80,125 +82,10 @@ static void *nios2_dma_alloc(struct device *dev, size_t size,
 	return ret;
 }
 
-static void nios2_dma_free(struct device *dev, size_t size, void *vaddr,
+void arch_dma_free(struct device *dev, size_t size, void *vaddr,
 		dma_addr_t dma_handle, unsigned long attrs)
 {
 	unsigned long addr = (unsigned long) CAC_ADDR((unsigned long) vaddr);
 
 	free_pages(addr, get_order(size));
 }
-
-static int nios2_dma_map_sg(struct device *dev, struct scatterlist *sg,
-		int nents, enum dma_data_direction direction,
-		unsigned long attrs)
-{
-	int i;
-
-	for_each_sg(sg, sg, nents, i) {
-		void *addr = sg_virt(sg);
-
-		if (!addr)
-			continue;
-
-		sg->dma_address = sg_phys(sg);
-
-		if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-			continue;
-
-		__dma_sync_for_device(addr, sg->length, direction);
-	}
-
-	return nents;
-}
-
-static dma_addr_t nios2_dma_map_page(struct device *dev, struct page *page,
-			unsigned long offset, size_t size,
-			enum dma_data_direction direction,
-			unsigned long attrs)
-{
-	void *addr = page_address(page) + offset;
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		__dma_sync_for_device(addr, size, direction);
-
-	return page_to_phys(page) + offset;
-}
-
-static void nios2_dma_unmap_page(struct device *dev, dma_addr_t dma_address,
-		size_t size, enum dma_data_direction direction,
-		unsigned long attrs)
-{
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		__dma_sync_for_cpu(phys_to_virt(dma_address), size, direction);
-}
-
-static void nios2_dma_unmap_sg(struct device *dev, struct scatterlist *sg,
-		int nhwentries, enum dma_data_direction direction,
-		unsigned long attrs)
-{
-	void *addr;
-	int i;
-
-	if (direction == DMA_TO_DEVICE)
-		return;
-
-	if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-		return;
-
-	for_each_sg(sg, sg, nhwentries, i) {
-		addr = sg_virt(sg);
-		if (addr)
-			__dma_sync_for_cpu(addr, sg->length, direction);
-	}
-}
-
-static void nios2_dma_sync_single_for_cpu(struct device *dev,
-		dma_addr_t dma_handle, size_t size,
-		enum dma_data_direction direction)
-{
-	__dma_sync_for_cpu(phys_to_virt(dma_handle), size, direction);
-}
-
-static void nios2_dma_sync_single_for_device(struct device *dev,
-		dma_addr_t dma_handle, size_t size,
-		enum dma_data_direction direction)
-{
-	__dma_sync_for_device(phys_to_virt(dma_handle), size, direction);
-}
-
-static void nios2_dma_sync_sg_for_cpu(struct device *dev,
-		struct scatterlist *sg, int nelems,
-		enum dma_data_direction direction)
-{
-	int i;
-
-	/* Make sure that gcc doesn't leave the empty loop body.  */
-	for_each_sg(sg, sg, nelems, i)
-		__dma_sync_for_cpu(sg_virt(sg), sg->length, direction);
-}
-
-static void nios2_dma_sync_sg_for_device(struct device *dev,
-		struct scatterlist *sg, int nelems,
-		enum dma_data_direction direction)
-{
-	int i;
-
-	/* Make sure that gcc doesn't leave the empty loop body.  */
-	for_each_sg(sg, sg, nelems, i)
-		__dma_sync_for_device(sg_virt(sg), sg->length, direction);
-
-}
-
-const struct dma_map_ops nios2_dma_ops = {
-	.alloc			= nios2_dma_alloc,
-	.free			= nios2_dma_free,
-	.map_page		= nios2_dma_map_page,
-	.unmap_page		= nios2_dma_unmap_page,
-	.map_sg			= nios2_dma_map_sg,
-	.unmap_sg		= nios2_dma_unmap_sg,
-	.sync_single_for_device	= nios2_dma_sync_single_for_device,
-	.sync_single_for_cpu	= nios2_dma_sync_single_for_cpu,
-	.sync_sg_for_cpu	= nios2_dma_sync_sg_for_cpu,
-	.sync_sg_for_device	= nios2_dma_sync_sg_for_device,
-};
-EXPORT_SYMBOL(nios2_dma_ops);
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 14/22] nios2: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  To: linux-arm-kernel

Switch to the generic noncoherent direct mapping implementation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/nios2/Kconfig                   |   3 +
 arch/nios2/include/asm/Kbuild        |   1 +
 arch/nios2/include/asm/dma-mapping.h |  20 ----
 arch/nios2/mm/dma-mapping.c          | 139 +++------------------------
 4 files changed, 17 insertions(+), 146 deletions(-)
 delete mode 100644 arch/nios2/include/asm/dma-mapping.h

diff --git a/arch/nios2/Kconfig b/arch/nios2/Kconfig
index 3d4ec88f1db1..92035042cf62 100644
--- a/arch/nios2/Kconfig
+++ b/arch/nios2/Kconfig
@@ -1,6 +1,9 @@
 # SPDX-License-Identifier: GPL-2.0
 config NIOS2
 	def_bool y
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
+	select DMA_NONCOHERENT_OPS
 	select TIMER_OF
 	select GENERIC_ATOMIC64
 	select GENERIC_CLOCKEVENTS
diff --git a/arch/nios2/include/asm/Kbuild b/arch/nios2/include/asm/Kbuild
index d232da2cbb38..24f6ee1ee69b 100644
--- a/arch/nios2/include/asm/Kbuild
+++ b/arch/nios2/include/asm/Kbuild
@@ -8,6 +8,7 @@ generic-y += current.h
 generic-y += device.h
 generic-y += div64.h
 generic-y += dma.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += exec.h
 generic-y += extable.h
diff --git a/arch/nios2/include/asm/dma-mapping.h b/arch/nios2/include/asm/dma-mapping.h
deleted file mode 100644
index 6ceb92251da0..000000000000
--- a/arch/nios2/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch>
- * Copyright (C) 2009 Wind River Systems Inc
- *
- * This file is subject to the terms and conditions of the GNU General
- * Public License.  See the file COPYING in the main directory of this
- * archive for more details.
- */
-
-#ifndef _ASM_NIOS2_DMA_MAPPING_H
-#define _ASM_NIOS2_DMA_MAPPING_H
-
-extern const struct dma_map_ops nios2_dma_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return &nios2_dma_ops;
-}
-
-#endif /* _ASM_NIOS2_DMA_MAPPING_H */
diff --git a/arch/nios2/mm/dma-mapping.c b/arch/nios2/mm/dma-mapping.c
index 4be815519dd4..4af9e5b5ba1c 100644
--- a/arch/nios2/mm/dma-mapping.c
+++ b/arch/nios2/mm/dma-mapping.c
@@ -12,18 +12,18 @@
 
 #include <linux/types.h>
 #include <linux/mm.h>
-#include <linux/export.h>
 #include <linux/string.h>
-#include <linux/scatterlist.h>
 #include <linux/dma-mapping.h>
 #include <linux/io.h>
 #include <linux/cache.h>
 #include <asm/cacheflush.h>
 
-static inline void __dma_sync_for_device(void *vaddr, size_t size,
-			      enum dma_data_direction direction)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	switch (direction) {
+	void *vaddr = phys_to_virt(paddr);
+
+	switch (dir) {
 	case DMA_FROM_DEVICE:
 		invalidate_dcache_range((unsigned long)vaddr,
 			(unsigned long)(vaddr + size));
@@ -42,10 +42,12 @@ static inline void __dma_sync_for_device(void *vaddr, size_t size,
 	}
 }
 
-static inline void __dma_sync_for_cpu(void *vaddr, size_t size,
-			      enum dma_data_direction direction)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	switch (direction) {
+	void *vaddr = phys_to_virt(paddr);
+
+	switch (dir) {
 	case DMA_BIDIRECTIONAL:
 	case DMA_FROM_DEVICE:
 		invalidate_dcache_range((unsigned long)vaddr,
@@ -58,8 +60,8 @@ static inline void __dma_sync_for_cpu(void *vaddr, size_t size,
 	}
 }
 
-static void *nios2_dma_alloc(struct device *dev, size_t size,
-		dma_addr_t *dma_handle, gfp_t gfp, unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	void *ret;
 
@@ -80,125 +82,10 @@ static void *nios2_dma_alloc(struct device *dev, size_t size,
 	return ret;
 }
 
-static void nios2_dma_free(struct device *dev, size_t size, void *vaddr,
+void arch_dma_free(struct device *dev, size_t size, void *vaddr,
 		dma_addr_t dma_handle, unsigned long attrs)
 {
 	unsigned long addr = (unsigned long) CAC_ADDR((unsigned long) vaddr);
 
 	free_pages(addr, get_order(size));
 }
-
-static int nios2_dma_map_sg(struct device *dev, struct scatterlist *sg,
-		int nents, enum dma_data_direction direction,
-		unsigned long attrs)
-{
-	int i;
-
-	for_each_sg(sg, sg, nents, i) {
-		void *addr = sg_virt(sg);
-
-		if (!addr)
-			continue;
-
-		sg->dma_address = sg_phys(sg);
-
-		if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-			continue;
-
-		__dma_sync_for_device(addr, sg->length, direction);
-	}
-
-	return nents;
-}
-
-static dma_addr_t nios2_dma_map_page(struct device *dev, struct page *page,
-			unsigned long offset, size_t size,
-			enum dma_data_direction direction,
-			unsigned long attrs)
-{
-	void *addr = page_address(page) + offset;
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		__dma_sync_for_device(addr, size, direction);
-
-	return page_to_phys(page) + offset;
-}
-
-static void nios2_dma_unmap_page(struct device *dev, dma_addr_t dma_address,
-		size_t size, enum dma_data_direction direction,
-		unsigned long attrs)
-{
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		__dma_sync_for_cpu(phys_to_virt(dma_address), size, direction);
-}
-
-static void nios2_dma_unmap_sg(struct device *dev, struct scatterlist *sg,
-		int nhwentries, enum dma_data_direction direction,
-		unsigned long attrs)
-{
-	void *addr;
-	int i;
-
-	if (direction == DMA_TO_DEVICE)
-		return;
-
-	if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-		return;
-
-	for_each_sg(sg, sg, nhwentries, i) {
-		addr = sg_virt(sg);
-		if (addr)
-			__dma_sync_for_cpu(addr, sg->length, direction);
-	}
-}
-
-static void nios2_dma_sync_single_for_cpu(struct device *dev,
-		dma_addr_t dma_handle, size_t size,
-		enum dma_data_direction direction)
-{
-	__dma_sync_for_cpu(phys_to_virt(dma_handle), size, direction);
-}
-
-static void nios2_dma_sync_single_for_device(struct device *dev,
-		dma_addr_t dma_handle, size_t size,
-		enum dma_data_direction direction)
-{
-	__dma_sync_for_device(phys_to_virt(dma_handle), size, direction);
-}
-
-static void nios2_dma_sync_sg_for_cpu(struct device *dev,
-		struct scatterlist *sg, int nelems,
-		enum dma_data_direction direction)
-{
-	int i;
-
-	/* Make sure that gcc doesn't leave the empty loop body.  */
-	for_each_sg(sg, sg, nelems, i)
-		__dma_sync_for_cpu(sg_virt(sg), sg->length, direction);
-}
-
-static void nios2_dma_sync_sg_for_device(struct device *dev,
-		struct scatterlist *sg, int nelems,
-		enum dma_data_direction direction)
-{
-	int i;
-
-	/* Make sure that gcc doesn't leave the empty loop body.  */
-	for_each_sg(sg, sg, nelems, i)
-		__dma_sync_for_device(sg_virt(sg), sg->length, direction);
-
-}
-
-const struct dma_map_ops nios2_dma_ops = {
-	.alloc			= nios2_dma_alloc,
-	.free			= nios2_dma_free,
-	.map_page		= nios2_dma_map_page,
-	.unmap_page		= nios2_dma_unmap_page,
-	.map_sg			= nios2_dma_map_sg,
-	.unmap_sg		= nios2_dma_unmap_sg,
-	.sync_single_for_device	= nios2_dma_sync_single_for_device,
-	.sync_single_for_cpu	= nios2_dma_sync_single_for_cpu,
-	.sync_sg_for_cpu	= nios2_dma_sync_sg_for_cpu,
-	.sync_sg_for_device	= nios2_dma_sync_sg_for_device,
-};
-EXPORT_SYMBOL(nios2_dma_ops);
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 15/22] openrisc: use generic dma_noncoherent_ops
  2018-04-20  8:02 ` Christoph Hellwig
                     ` (4 preceding siblings ...)
  (?)
@ 2018-04-20  8:03   ` Christoph Hellwig
  -1 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Switch to the generic noncoherent direct mapping implementation.

Fix sync_single_for_device to do the same cache coherency operations as
the more tested map_single path, as both should transfer ownership to
the device.

Remove the sync_single_for_cpu implementation as no cache coherency
operations are used in the more commonly used unmap_single case, both
of which transfer ownership to the CPU.

Implement the missing sync_sg_for_device operation, matching the cache
coherency operations in sync_single_for_device and map_{single,sg}.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/openrisc/Kconfig                   |   2 +
 arch/openrisc/include/asm/Kbuild        |   1 +
 arch/openrisc/include/asm/dma-mapping.h |  35 --------
 arch/openrisc/kernel/dma.c              | 109 +++---------------------
 4 files changed, 13 insertions(+), 134 deletions(-)
 delete mode 100644 arch/openrisc/include/asm/dma-mapping.h

diff --git a/arch/openrisc/Kconfig b/arch/openrisc/Kconfig
index 9ecad05bfc73..65e3c574c9d3 100644
--- a/arch/openrisc/Kconfig
+++ b/arch/openrisc/Kconfig
@@ -6,6 +6,8 @@
 
 config OPENRISC
 	def_bool y
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
+	select DMA_NONCOHERENT_OPS
 	select OF
 	select OF_EARLY_FLATTREE
 	select IRQ_DOMAIN
diff --git a/arch/openrisc/include/asm/Kbuild b/arch/openrisc/include/asm/Kbuild
index f05c722a21f8..e663a996b612 100644
--- a/arch/openrisc/include/asm/Kbuild
+++ b/arch/openrisc/include/asm/Kbuild
@@ -6,6 +6,7 @@ generic-y += current.h
 generic-y += device.h
 generic-y += div64.h
 generic-y += dma.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += exec.h
 generic-y += extable.h
diff --git a/arch/openrisc/include/asm/dma-mapping.h b/arch/openrisc/include/asm/dma-mapping.h
deleted file mode 100644
index e212a1f0b6d2..000000000000
--- a/arch/openrisc/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * OpenRISC Linux
- *
- * Linux architectural port borrowing liberally from similar works of
- * others.  All original copyrights apply as per the original source
- * declaration.
- *
- * OpenRISC implementation:
- * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- */
-
-#ifndef __ASM_OPENRISC_DMA_MAPPING_H
-#define __ASM_OPENRISC_DMA_MAPPING_H
-
-/*
- * See Documentation/DMA-API-HOWTO.txt and
- * Documentation/DMA-API.txt for documentation.
- */
-
-#include <linux/dma-debug.h>
-#include <linux/dma-mapping.h>
-
-extern const struct dma_map_ops or1k_dma_map_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return &or1k_dma_map_ops;
-}
-
-#endif	/* __ASM_OPENRISC_DMA_MAPPING_H */
diff --git a/arch/openrisc/kernel/dma.c b/arch/openrisc/kernel/dma.c
index ec7fd45704d2..cce99405edf4 100644
--- a/arch/openrisc/kernel/dma.c
+++ b/arch/openrisc/kernel/dma.c
@@ -19,9 +19,7 @@
  * the only thing implemented properly.  The rest need looking into...
  */
 
-#include <linux/dma-mapping.h>
-#include <linux/dma-debug.h>
-#include <linux/export.h>
+#include <linux/dma-noncoherent.h>
 
 #include <asm/cpuinfo.h>
 #include <asm/spr_defs.h>
@@ -80,10 +78,9 @@ page_clear_nocache(pte_t *pte, unsigned long addr,
  * is being ignored for now; uncached but write-combined memory is a
  * missing feature of the OR1K.
  */
-static void *
-or1k_dma_alloc(struct device *dev, size_t size,
-	       dma_addr_t *dma_handle, gfp_t gfp,
-	       unsigned long attrs)
+void *
+arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	unsigned long va;
 	void *page;
@@ -115,9 +112,9 @@ or1k_dma_alloc(struct device *dev, size_t size,
 	return (void *)va;
 }
 
-static void
-or1k_dma_free(struct device *dev, size_t size, void *vaddr,
-	      dma_addr_t dma_handle, unsigned long attrs)
+void
+arch_dma_free(struct device *dev, size_t size, void *vaddr,
+		dma_addr_t dma_handle, unsigned long attrs)
 {
 	unsigned long va = (unsigned long)vaddr;
 	struct mm_walk walk = {
@@ -133,18 +130,11 @@ or1k_dma_free(struct device *dev, size_t size, void *vaddr,
 	free_pages_exact(vaddr, size);
 }
 
-static dma_addr_t
-or1k_map_page(struct device *dev, struct page *page,
-	      unsigned long offset, size_t size,
-	      enum dma_data_direction dir,
-	      unsigned long attrs)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t addr, size_t size,
+		enum dma_data_direction dir)
 {
-	unsigned long cl;
-	dma_addr_t addr = page_to_phys(page) + offset;
 	struct cpuinfo_or1k *cpuinfo = &cpuinfo_or1k[smp_processor_id()];
-
-	if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-		return addr;
+	unsigned long cl;
 
 	switch (dir) {
 	case DMA_TO_DEVICE:
@@ -167,83 +157,4 @@ or1k_map_page(struct device *dev, struct page *page,
 		 */
 		break;
 	}
-
-	return addr;
 }
-
-static void
-or1k_unmap_page(struct device *dev, dma_addr_t dma_handle,
-		size_t size, enum dma_data_direction dir,
-		unsigned long attrs)
-{
-	/* Nothing special to do here... */
-}
-
-static int
-or1k_map_sg(struct device *dev, struct scatterlist *sg,
-	    int nents, enum dma_data_direction dir,
-	    unsigned long attrs)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nents, i) {
-		s->dma_address = or1k_map_page(dev, sg_page(s), s->offset,
-					       s->length, dir, 0);
-	}
-
-	return nents;
-}
-
-static void
-or1k_unmap_sg(struct device *dev, struct scatterlist *sg,
-	      int nents, enum dma_data_direction dir,
-	      unsigned long attrs)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nents, i) {
-		or1k_unmap_page(dev, sg_dma_address(s), sg_dma_len(s), dir, 0);
-	}
-}
-
-static void
-or1k_sync_single_for_cpu(struct device *dev,
-			 dma_addr_t dma_handle, size_t size,
-			 enum dma_data_direction dir)
-{
-	unsigned long cl;
-	dma_addr_t addr = dma_handle;
-	struct cpuinfo_or1k *cpuinfo = &cpuinfo_or1k[smp_processor_id()];
-
-	/* Invalidate the dcache for the requested range */
-	for (cl = addr; cl < addr + size; cl += cpuinfo->dcache_block_size)
-		mtspr(SPR_DCBIR, cl);
-}
-
-static void
-or1k_sync_single_for_device(struct device *dev,
-			    dma_addr_t dma_handle, size_t size,
-			    enum dma_data_direction dir)
-{
-	unsigned long cl;
-	dma_addr_t addr = dma_handle;
-	struct cpuinfo_or1k *cpuinfo = &cpuinfo_or1k[smp_processor_id()];
-
-	/* Flush the dcache for the requested range */
-	for (cl = addr; cl < addr + size; cl += cpuinfo->dcache_block_size)
-		mtspr(SPR_DCBFR, cl);
-}
-
-const struct dma_map_ops or1k_dma_map_ops = {
-	.alloc = or1k_dma_alloc,
-	.free = or1k_dma_free,
-	.map_page = or1k_map_page,
-	.unmap_page = or1k_unmap_page,
-	.map_sg = or1k_map_sg,
-	.unmap_sg = or1k_unmap_sg,
-	.sync_single_for_cpu = or1k_sync_single_for_cpu,
-	.sync_single_for_device = or1k_sync_single_for_device,
-};
-EXPORT_SYMBOL(or1k_dma_map_ops);
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 15/22] openrisc: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Switch to the generic noncoherent direct mapping implementation.

Fix sync_single_for_device to do the same cache coherency operations as
the more tested map_single path, as both should transfer ownership to
the device.

Remove the sync_single_for_cpu implementation as no cache coherency
operations are used in the more commonly used unmap_single case, both
of which transfer ownership to the CPU.

Implement the missing sync_sg_for_device operation, matching the cache
coherency operations in sync_single_for_device and map_{single,sg}.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/openrisc/Kconfig                   |   2 +
 arch/openrisc/include/asm/Kbuild        |   1 +
 arch/openrisc/include/asm/dma-mapping.h |  35 --------
 arch/openrisc/kernel/dma.c              | 109 +++---------------------
 4 files changed, 13 insertions(+), 134 deletions(-)
 delete mode 100644 arch/openrisc/include/asm/dma-mapping.h

diff --git a/arch/openrisc/Kconfig b/arch/openrisc/Kconfig
index 9ecad05bfc73..65e3c574c9d3 100644
--- a/arch/openrisc/Kconfig
+++ b/arch/openrisc/Kconfig
@@ -6,6 +6,8 @@
 
 config OPENRISC
 	def_bool y
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
+	select DMA_NONCOHERENT_OPS
 	select OF
 	select OF_EARLY_FLATTREE
 	select IRQ_DOMAIN
diff --git a/arch/openrisc/include/asm/Kbuild b/arch/openrisc/include/asm/Kbuild
index f05c722a21f8..e663a996b612 100644
--- a/arch/openrisc/include/asm/Kbuild
+++ b/arch/openrisc/include/asm/Kbuild
@@ -6,6 +6,7 @@ generic-y += current.h
 generic-y += device.h
 generic-y += div64.h
 generic-y += dma.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += exec.h
 generic-y += extable.h
diff --git a/arch/openrisc/include/asm/dma-mapping.h b/arch/openrisc/include/asm/dma-mapping.h
deleted file mode 100644
index e212a1f0b6d2..000000000000
--- a/arch/openrisc/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * OpenRISC Linux
- *
- * Linux architectural port borrowing liberally from similar works of
- * others.  All original copyrights apply as per the original source
- * declaration.
- *
- * OpenRISC implementation:
- * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- */
-
-#ifndef __ASM_OPENRISC_DMA_MAPPING_H
-#define __ASM_OPENRISC_DMA_MAPPING_H
-
-/*
- * See Documentation/DMA-API-HOWTO.txt and
- * Documentation/DMA-API.txt for documentation.
- */
-
-#include <linux/dma-debug.h>
-#include <linux/dma-mapping.h>
-
-extern const struct dma_map_ops or1k_dma_map_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return &or1k_dma_map_ops;
-}
-
-#endif	/* __ASM_OPENRISC_DMA_MAPPING_H */
diff --git a/arch/openrisc/kernel/dma.c b/arch/openrisc/kernel/dma.c
index ec7fd45704d2..cce99405edf4 100644
--- a/arch/openrisc/kernel/dma.c
+++ b/arch/openrisc/kernel/dma.c
@@ -19,9 +19,7 @@
  * the only thing implemented properly.  The rest need looking into...
  */
 
-#include <linux/dma-mapping.h>
-#include <linux/dma-debug.h>
-#include <linux/export.h>
+#include <linux/dma-noncoherent.h>
 
 #include <asm/cpuinfo.h>
 #include <asm/spr_defs.h>
@@ -80,10 +78,9 @@ page_clear_nocache(pte_t *pte, unsigned long addr,
  * is being ignored for now; uncached but write-combined memory is a
  * missing feature of the OR1K.
  */
-static void *
-or1k_dma_alloc(struct device *dev, size_t size,
-	       dma_addr_t *dma_handle, gfp_t gfp,
-	       unsigned long attrs)
+void *
+arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	unsigned long va;
 	void *page;
@@ -115,9 +112,9 @@ or1k_dma_alloc(struct device *dev, size_t size,
 	return (void *)va;
 }
 
-static void
-or1k_dma_free(struct device *dev, size_t size, void *vaddr,
-	      dma_addr_t dma_handle, unsigned long attrs)
+void
+arch_dma_free(struct device *dev, size_t size, void *vaddr,
+		dma_addr_t dma_handle, unsigned long attrs)
 {
 	unsigned long va = (unsigned long)vaddr;
 	struct mm_walk walk = {
@@ -133,18 +130,11 @@ or1k_dma_free(struct device *dev, size_t size, void *vaddr,
 	free_pages_exact(vaddr, size);
 }
 
-static dma_addr_t
-or1k_map_page(struct device *dev, struct page *page,
-	      unsigned long offset, size_t size,
-	      enum dma_data_direction dir,
-	      unsigned long attrs)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t addr, size_t size,
+		enum dma_data_direction dir)
 {
-	unsigned long cl;
-	dma_addr_t addr = page_to_phys(page) + offset;
 	struct cpuinfo_or1k *cpuinfo = &cpuinfo_or1k[smp_processor_id()];
-
-	if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-		return addr;
+	unsigned long cl;
 
 	switch (dir) {
 	case DMA_TO_DEVICE:
@@ -167,83 +157,4 @@ or1k_map_page(struct device *dev, struct page *page,
 		 */
 		break;
 	}
-
-	return addr;
 }
-
-static void
-or1k_unmap_page(struct device *dev, dma_addr_t dma_handle,
-		size_t size, enum dma_data_direction dir,
-		unsigned long attrs)
-{
-	/* Nothing special to do here... */
-}
-
-static int
-or1k_map_sg(struct device *dev, struct scatterlist *sg,
-	    int nents, enum dma_data_direction dir,
-	    unsigned long attrs)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nents, i) {
-		s->dma_address = or1k_map_page(dev, sg_page(s), s->offset,
-					       s->length, dir, 0);
-	}
-
-	return nents;
-}
-
-static void
-or1k_unmap_sg(struct device *dev, struct scatterlist *sg,
-	      int nents, enum dma_data_direction dir,
-	      unsigned long attrs)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nents, i) {
-		or1k_unmap_page(dev, sg_dma_address(s), sg_dma_len(s), dir, 0);
-	}
-}
-
-static void
-or1k_sync_single_for_cpu(struct device *dev,
-			 dma_addr_t dma_handle, size_t size,
-			 enum dma_data_direction dir)
-{
-	unsigned long cl;
-	dma_addr_t addr = dma_handle;
-	struct cpuinfo_or1k *cpuinfo = &cpuinfo_or1k[smp_processor_id()];
-
-	/* Invalidate the dcache for the requested range */
-	for (cl = addr; cl < addr + size; cl += cpuinfo->dcache_block_size)
-		mtspr(SPR_DCBIR, cl);
-}
-
-static void
-or1k_sync_single_for_device(struct device *dev,
-			    dma_addr_t dma_handle, size_t size,
-			    enum dma_data_direction dir)
-{
-	unsigned long cl;
-	dma_addr_t addr = dma_handle;
-	struct cpuinfo_or1k *cpuinfo = &cpuinfo_or1k[smp_processor_id()];
-
-	/* Flush the dcache for the requested range */
-	for (cl = addr; cl < addr + size; cl += cpuinfo->dcache_block_size)
-		mtspr(SPR_DCBFR, cl);
-}
-
-const struct dma_map_ops or1k_dma_map_ops = {
-	.alloc = or1k_dma_alloc,
-	.free = or1k_dma_free,
-	.map_page = or1k_map_page,
-	.unmap_page = or1k_unmap_page,
-	.map_sg = or1k_map_sg,
-	.unmap_sg = or1k_unmap_sg,
-	.sync_single_for_cpu = or1k_sync_single_for_cpu,
-	.sync_single_for_device = or1k_sync_single_for_device,
-};
-EXPORT_SYMBOL(or1k_dma_map_ops);
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 15/22] openrisc: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Switch to the generic noncoherent direct mapping implementation.

Fix sync_single_for_device to do the same cache coherency operations as
the more tested map_single path, as both should transfer ownership to
the device.

Remove the sync_single_for_cpu implementation as no cache coherency
operations are used in the more commonly used unmap_single case, both
of which transfer ownership to the CPU.

Implement the missing sync_sg_for_device operation, matching the cache
coherency operations in sync_single_for_device and map_{single,sg}.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/openrisc/Kconfig                   |   2 +
 arch/openrisc/include/asm/Kbuild        |   1 +
 arch/openrisc/include/asm/dma-mapping.h |  35 --------
 arch/openrisc/kernel/dma.c              | 109 +++---------------------
 4 files changed, 13 insertions(+), 134 deletions(-)
 delete mode 100644 arch/openrisc/include/asm/dma-mapping.h

diff --git a/arch/openrisc/Kconfig b/arch/openrisc/Kconfig
index 9ecad05bfc73..65e3c574c9d3 100644
--- a/arch/openrisc/Kconfig
+++ b/arch/openrisc/Kconfig
@@ -6,6 +6,8 @@
 
 config OPENRISC
 	def_bool y
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
+	select DMA_NONCOHERENT_OPS
 	select OF
 	select OF_EARLY_FLATTREE
 	select IRQ_DOMAIN
diff --git a/arch/openrisc/include/asm/Kbuild b/arch/openrisc/include/asm/Kbuild
index f05c722a21f8..e663a996b612 100644
--- a/arch/openrisc/include/asm/Kbuild
+++ b/arch/openrisc/include/asm/Kbuild
@@ -6,6 +6,7 @@ generic-y += current.h
 generic-y += device.h
 generic-y += div64.h
 generic-y += dma.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += exec.h
 generic-y += extable.h
diff --git a/arch/openrisc/include/asm/dma-mapping.h b/arch/openrisc/include/asm/dma-mapping.h
deleted file mode 100644
index e212a1f0b6d2..000000000000
--- a/arch/openrisc/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * OpenRISC Linux
- *
- * Linux architectural port borrowing liberally from similar works of
- * others.  All original copyrights apply as per the original source
- * declaration.
- *
- * OpenRISC implementation:
- * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- */
-
-#ifndef __ASM_OPENRISC_DMA_MAPPING_H
-#define __ASM_OPENRISC_DMA_MAPPING_H
-
-/*
- * See Documentation/DMA-API-HOWTO.txt and
- * Documentation/DMA-API.txt for documentation.
- */
-
-#include <linux/dma-debug.h>
-#include <linux/dma-mapping.h>
-
-extern const struct dma_map_ops or1k_dma_map_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return &or1k_dma_map_ops;
-}
-
-#endif	/* __ASM_OPENRISC_DMA_MAPPING_H */
diff --git a/arch/openrisc/kernel/dma.c b/arch/openrisc/kernel/dma.c
index ec7fd45704d2..cce99405edf4 100644
--- a/arch/openrisc/kernel/dma.c
+++ b/arch/openrisc/kernel/dma.c
@@ -19,9 +19,7 @@
  * the only thing implemented properly.  The rest need looking into...
  */
 
-#include <linux/dma-mapping.h>
-#include <linux/dma-debug.h>
-#include <linux/export.h>
+#include <linux/dma-noncoherent.h>
 
 #include <asm/cpuinfo.h>
 #include <asm/spr_defs.h>
@@ -80,10 +78,9 @@ page_clear_nocache(pte_t *pte, unsigned long addr,
  * is being ignored for now; uncached but write-combined memory is a
  * missing feature of the OR1K.
  */
-static void *
-or1k_dma_alloc(struct device *dev, size_t size,
-	       dma_addr_t *dma_handle, gfp_t gfp,
-	       unsigned long attrs)
+void *
+arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	unsigned long va;
 	void *page;
@@ -115,9 +112,9 @@ or1k_dma_alloc(struct device *dev, size_t size,
 	return (void *)va;
 }
 
-static void
-or1k_dma_free(struct device *dev, size_t size, void *vaddr,
-	      dma_addr_t dma_handle, unsigned long attrs)
+void
+arch_dma_free(struct device *dev, size_t size, void *vaddr,
+		dma_addr_t dma_handle, unsigned long attrs)
 {
 	unsigned long va = (unsigned long)vaddr;
 	struct mm_walk walk = {
@@ -133,18 +130,11 @@ or1k_dma_free(struct device *dev, size_t size, void *vaddr,
 	free_pages_exact(vaddr, size);
 }
 
-static dma_addr_t
-or1k_map_page(struct device *dev, struct page *page,
-	      unsigned long offset, size_t size,
-	      enum dma_data_direction dir,
-	      unsigned long attrs)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t addr, size_t size,
+		enum dma_data_direction dir)
 {
-	unsigned long cl;
-	dma_addr_t addr = page_to_phys(page) + offset;
 	struct cpuinfo_or1k *cpuinfo = &cpuinfo_or1k[smp_processor_id()];
-
-	if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-		return addr;
+	unsigned long cl;
 
 	switch (dir) {
 	case DMA_TO_DEVICE:
@@ -167,83 +157,4 @@ or1k_map_page(struct device *dev, struct page *page,
 		 */
 		break;
 	}
-
-	return addr;
 }
-
-static void
-or1k_unmap_page(struct device *dev, dma_addr_t dma_handle,
-		size_t size, enum dma_data_direction dir,
-		unsigned long attrs)
-{
-	/* Nothing special to do here... */
-}
-
-static int
-or1k_map_sg(struct device *dev, struct scatterlist *sg,
-	    int nents, enum dma_data_direction dir,
-	    unsigned long attrs)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nents, i) {
-		s->dma_address = or1k_map_page(dev, sg_page(s), s->offset,
-					       s->length, dir, 0);
-	}
-
-	return nents;
-}
-
-static void
-or1k_unmap_sg(struct device *dev, struct scatterlist *sg,
-	      int nents, enum dma_data_direction dir,
-	      unsigned long attrs)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nents, i) {
-		or1k_unmap_page(dev, sg_dma_address(s), sg_dma_len(s), dir, 0);
-	}
-}
-
-static void
-or1k_sync_single_for_cpu(struct device *dev,
-			 dma_addr_t dma_handle, size_t size,
-			 enum dma_data_direction dir)
-{
-	unsigned long cl;
-	dma_addr_t addr = dma_handle;
-	struct cpuinfo_or1k *cpuinfo = &cpuinfo_or1k[smp_processor_id()];
-
-	/* Invalidate the dcache for the requested range */
-	for (cl = addr; cl < addr + size; cl += cpuinfo->dcache_block_size)
-		mtspr(SPR_DCBIR, cl);
-}
-
-static void
-or1k_sync_single_for_device(struct device *dev,
-			    dma_addr_t dma_handle, size_t size,
-			    enum dma_data_direction dir)
-{
-	unsigned long cl;
-	dma_addr_t addr = dma_handle;
-	struct cpuinfo_or1k *cpuinfo = &cpuinfo_or1k[smp_processor_id()];
-
-	/* Flush the dcache for the requested range */
-	for (cl = addr; cl < addr + size; cl += cpuinfo->dcache_block_size)
-		mtspr(SPR_DCBFR, cl);
-}
-
-const struct dma_map_ops or1k_dma_map_ops = {
-	.alloc = or1k_dma_alloc,
-	.free = or1k_dma_free,
-	.map_page = or1k_map_page,
-	.unmap_page = or1k_unmap_page,
-	.map_sg = or1k_map_sg,
-	.unmap_sg = or1k_unmap_sg,
-	.sync_single_for_cpu = or1k_sync_single_for_cpu,
-	.sync_single_for_device = or1k_sync_single_for_device,
-};
-EXPORT_SYMBOL(or1k_dma_map_ops);
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 15/22] openrisc: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  To: linux-snps-arc

Switch to the generic noncoherent direct mapping implementation.

Fix sync_single_for_device to do the same cache coherency operations as
the more tested map_single path, as both should transfer ownership to
the device.

Remove the sync_single_for_cpu implementation as no cache coherency
operations are used in the more commonly used unmap_single case, both
of which transfer ownership to the CPU.

Implement the missing sync_sg_for_device operation, matching the cache
coherency operations in sync_single_for_device and map_{single,sg}.

Signed-off-by: Christoph Hellwig <hch at lst.de>
---
 arch/openrisc/Kconfig                   |   2 +
 arch/openrisc/include/asm/Kbuild        |   1 +
 arch/openrisc/include/asm/dma-mapping.h |  35 --------
 arch/openrisc/kernel/dma.c              | 109 +++---------------------
 4 files changed, 13 insertions(+), 134 deletions(-)
 delete mode 100644 arch/openrisc/include/asm/dma-mapping.h

diff --git a/arch/openrisc/Kconfig b/arch/openrisc/Kconfig
index 9ecad05bfc73..65e3c574c9d3 100644
--- a/arch/openrisc/Kconfig
+++ b/arch/openrisc/Kconfig
@@ -6,6 +6,8 @@
 
 config OPENRISC
 	def_bool y
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
+	select DMA_NONCOHERENT_OPS
 	select OF
 	select OF_EARLY_FLATTREE
 	select IRQ_DOMAIN
diff --git a/arch/openrisc/include/asm/Kbuild b/arch/openrisc/include/asm/Kbuild
index f05c722a21f8..e663a996b612 100644
--- a/arch/openrisc/include/asm/Kbuild
+++ b/arch/openrisc/include/asm/Kbuild
@@ -6,6 +6,7 @@ generic-y += current.h
 generic-y += device.h
 generic-y += div64.h
 generic-y += dma.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += exec.h
 generic-y += extable.h
diff --git a/arch/openrisc/include/asm/dma-mapping.h b/arch/openrisc/include/asm/dma-mapping.h
deleted file mode 100644
index e212a1f0b6d2..000000000000
--- a/arch/openrisc/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * OpenRISC Linux
- *
- * Linux architectural port borrowing liberally from similar works of
- * others.  All original copyrights apply as per the original source
- * declaration.
- *
- * OpenRISC implementation:
- * Copyright (C) 2010-2011 Jonas Bonn <jonas at southpole.se>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- */
-
-#ifndef __ASM_OPENRISC_DMA_MAPPING_H
-#define __ASM_OPENRISC_DMA_MAPPING_H
-
-/*
- * See Documentation/DMA-API-HOWTO.txt and
- * Documentation/DMA-API.txt for documentation.
- */
-
-#include <linux/dma-debug.h>
-#include <linux/dma-mapping.h>
-
-extern const struct dma_map_ops or1k_dma_map_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return &or1k_dma_map_ops;
-}
-
-#endif	/* __ASM_OPENRISC_DMA_MAPPING_H */
diff --git a/arch/openrisc/kernel/dma.c b/arch/openrisc/kernel/dma.c
index ec7fd45704d2..cce99405edf4 100644
--- a/arch/openrisc/kernel/dma.c
+++ b/arch/openrisc/kernel/dma.c
@@ -19,9 +19,7 @@
  * the only thing implemented properly.  The rest need looking into...
  */
 
-#include <linux/dma-mapping.h>
-#include <linux/dma-debug.h>
-#include <linux/export.h>
+#include <linux/dma-noncoherent.h>
 
 #include <asm/cpuinfo.h>
 #include <asm/spr_defs.h>
@@ -80,10 +78,9 @@ page_clear_nocache(pte_t *pte, unsigned long addr,
  * is being ignored for now; uncached but write-combined memory is a
  * missing feature of the OR1K.
  */
-static void *
-or1k_dma_alloc(struct device *dev, size_t size,
-	       dma_addr_t *dma_handle, gfp_t gfp,
-	       unsigned long attrs)
+void *
+arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	unsigned long va;
 	void *page;
@@ -115,9 +112,9 @@ or1k_dma_alloc(struct device *dev, size_t size,
 	return (void *)va;
 }
 
-static void
-or1k_dma_free(struct device *dev, size_t size, void *vaddr,
-	      dma_addr_t dma_handle, unsigned long attrs)
+void
+arch_dma_free(struct device *dev, size_t size, void *vaddr,
+		dma_addr_t dma_handle, unsigned long attrs)
 {
 	unsigned long va = (unsigned long)vaddr;
 	struct mm_walk walk = {
@@ -133,18 +130,11 @@ or1k_dma_free(struct device *dev, size_t size, void *vaddr,
 	free_pages_exact(vaddr, size);
 }
 
-static dma_addr_t
-or1k_map_page(struct device *dev, struct page *page,
-	      unsigned long offset, size_t size,
-	      enum dma_data_direction dir,
-	      unsigned long attrs)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t addr, size_t size,
+		enum dma_data_direction dir)
 {
-	unsigned long cl;
-	dma_addr_t addr = page_to_phys(page) + offset;
 	struct cpuinfo_or1k *cpuinfo = &cpuinfo_or1k[smp_processor_id()];
-
-	if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-		return addr;
+	unsigned long cl;
 
 	switch (dir) {
 	case DMA_TO_DEVICE:
@@ -167,83 +157,4 @@ or1k_map_page(struct device *dev, struct page *page,
 		 */
 		break;
 	}
-
-	return addr;
 }
-
-static void
-or1k_unmap_page(struct device *dev, dma_addr_t dma_handle,
-		size_t size, enum dma_data_direction dir,
-		unsigned long attrs)
-{
-	/* Nothing special to do here... */
-}
-
-static int
-or1k_map_sg(struct device *dev, struct scatterlist *sg,
-	    int nents, enum dma_data_direction dir,
-	    unsigned long attrs)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nents, i) {
-		s->dma_address = or1k_map_page(dev, sg_page(s), s->offset,
-					       s->length, dir, 0);
-	}
-
-	return nents;
-}
-
-static void
-or1k_unmap_sg(struct device *dev, struct scatterlist *sg,
-	      int nents, enum dma_data_direction dir,
-	      unsigned long attrs)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nents, i) {
-		or1k_unmap_page(dev, sg_dma_address(s), sg_dma_len(s), dir, 0);
-	}
-}
-
-static void
-or1k_sync_single_for_cpu(struct device *dev,
-			 dma_addr_t dma_handle, size_t size,
-			 enum dma_data_direction dir)
-{
-	unsigned long cl;
-	dma_addr_t addr = dma_handle;
-	struct cpuinfo_or1k *cpuinfo = &cpuinfo_or1k[smp_processor_id()];
-
-	/* Invalidate the dcache for the requested range */
-	for (cl = addr; cl < addr + size; cl += cpuinfo->dcache_block_size)
-		mtspr(SPR_DCBIR, cl);
-}
-
-static void
-or1k_sync_single_for_device(struct device *dev,
-			    dma_addr_t dma_handle, size_t size,
-			    enum dma_data_direction dir)
-{
-	unsigned long cl;
-	dma_addr_t addr = dma_handle;
-	struct cpuinfo_or1k *cpuinfo = &cpuinfo_or1k[smp_processor_id()];
-
-	/* Flush the dcache for the requested range */
-	for (cl = addr; cl < addr + size; cl += cpuinfo->dcache_block_size)
-		mtspr(SPR_DCBFR, cl);
-}
-
-const struct dma_map_ops or1k_dma_map_ops = {
-	.alloc = or1k_dma_alloc,
-	.free = or1k_dma_free,
-	.map_page = or1k_map_page,
-	.unmap_page = or1k_unmap_page,
-	.map_sg = or1k_map_sg,
-	.unmap_sg = or1k_unmap_sg,
-	.sync_single_for_cpu = or1k_sync_single_for_cpu,
-	.sync_single_for_device = or1k_sync_single_for_device,
-};
-EXPORT_SYMBOL(or1k_dma_map_ops);
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 15/22] openrisc: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Switch to the generic noncoherent direct mapping implementation.

Fix sync_single_for_device to do the same cache coherency operations as
the more tested map_single path, as both should transfer ownership to
the device.

Remove the sync_single_for_cpu implementation as no cache coherency
operations are used in the more commonly used unmap_single case, both
of which transfer ownership to the CPU.

Implement the missing sync_sg_for_device operation, matching the cache
coherency operations in sync_single_for_device and map_{single,sg}.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/openrisc/Kconfig                   |   2 +
 arch/openrisc/include/asm/Kbuild        |   1 +
 arch/openrisc/include/asm/dma-mapping.h |  35 --------
 arch/openrisc/kernel/dma.c              | 109 +++---------------------
 4 files changed, 13 insertions(+), 134 deletions(-)
 delete mode 100644 arch/openrisc/include/asm/dma-mapping.h

diff --git a/arch/openrisc/Kconfig b/arch/openrisc/Kconfig
index 9ecad05bfc73..65e3c574c9d3 100644
--- a/arch/openrisc/Kconfig
+++ b/arch/openrisc/Kconfig
@@ -6,6 +6,8 @@
 
 config OPENRISC
 	def_bool y
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
+	select DMA_NONCOHERENT_OPS
 	select OF
 	select OF_EARLY_FLATTREE
 	select IRQ_DOMAIN
diff --git a/arch/openrisc/include/asm/Kbuild b/arch/openrisc/include/asm/Kbuild
index f05c722a21f8..e663a996b612 100644
--- a/arch/openrisc/include/asm/Kbuild
+++ b/arch/openrisc/include/asm/Kbuild
@@ -6,6 +6,7 @@ generic-y += current.h
 generic-y += device.h
 generic-y += div64.h
 generic-y += dma.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += exec.h
 generic-y += extable.h
diff --git a/arch/openrisc/include/asm/dma-mapping.h b/arch/openrisc/include/asm/dma-mapping.h
deleted file mode 100644
index e212a1f0b6d2..000000000000
--- a/arch/openrisc/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * OpenRISC Linux
- *
- * Linux architectural port borrowing liberally from similar works of
- * others.  All original copyrights apply as per the original source
- * declaration.
- *
- * OpenRISC implementation:
- * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- */
-
-#ifndef __ASM_OPENRISC_DMA_MAPPING_H
-#define __ASM_OPENRISC_DMA_MAPPING_H
-
-/*
- * See Documentation/DMA-API-HOWTO.txt and
- * Documentation/DMA-API.txt for documentation.
- */
-
-#include <linux/dma-debug.h>
-#include <linux/dma-mapping.h>
-
-extern const struct dma_map_ops or1k_dma_map_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return &or1k_dma_map_ops;
-}
-
-#endif	/* __ASM_OPENRISC_DMA_MAPPING_H */
diff --git a/arch/openrisc/kernel/dma.c b/arch/openrisc/kernel/dma.c
index ec7fd45704d2..cce99405edf4 100644
--- a/arch/openrisc/kernel/dma.c
+++ b/arch/openrisc/kernel/dma.c
@@ -19,9 +19,7 @@
  * the only thing implemented properly.  The rest need looking into...
  */
 
-#include <linux/dma-mapping.h>
-#include <linux/dma-debug.h>
-#include <linux/export.h>
+#include <linux/dma-noncoherent.h>
 
 #include <asm/cpuinfo.h>
 #include <asm/spr_defs.h>
@@ -80,10 +78,9 @@ page_clear_nocache(pte_t *pte, unsigned long addr,
  * is being ignored for now; uncached but write-combined memory is a
  * missing feature of the OR1K.
  */
-static void *
-or1k_dma_alloc(struct device *dev, size_t size,
-	       dma_addr_t *dma_handle, gfp_t gfp,
-	       unsigned long attrs)
+void *
+arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	unsigned long va;
 	void *page;
@@ -115,9 +112,9 @@ or1k_dma_alloc(struct device *dev, size_t size,
 	return (void *)va;
 }
 
-static void
-or1k_dma_free(struct device *dev, size_t size, void *vaddr,
-	      dma_addr_t dma_handle, unsigned long attrs)
+void
+arch_dma_free(struct device *dev, size_t size, void *vaddr,
+		dma_addr_t dma_handle, unsigned long attrs)
 {
 	unsigned long va = (unsigned long)vaddr;
 	struct mm_walk walk = {
@@ -133,18 +130,11 @@ or1k_dma_free(struct device *dev, size_t size, void *vaddr,
 	free_pages_exact(vaddr, size);
 }
 
-static dma_addr_t
-or1k_map_page(struct device *dev, struct page *page,
-	      unsigned long offset, size_t size,
-	      enum dma_data_direction dir,
-	      unsigned long attrs)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t addr, size_t size,
+		enum dma_data_direction dir)
 {
-	unsigned long cl;
-	dma_addr_t addr = page_to_phys(page) + offset;
 	struct cpuinfo_or1k *cpuinfo = &cpuinfo_or1k[smp_processor_id()];
-
-	if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-		return addr;
+	unsigned long cl;
 
 	switch (dir) {
 	case DMA_TO_DEVICE:
@@ -167,83 +157,4 @@ or1k_map_page(struct device *dev, struct page *page,
 		 */
 		break;
 	}
-
-	return addr;
 }
-
-static void
-or1k_unmap_page(struct device *dev, dma_addr_t dma_handle,
-		size_t size, enum dma_data_direction dir,
-		unsigned long attrs)
-{
-	/* Nothing special to do here... */
-}
-
-static int
-or1k_map_sg(struct device *dev, struct scatterlist *sg,
-	    int nents, enum dma_data_direction dir,
-	    unsigned long attrs)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nents, i) {
-		s->dma_address = or1k_map_page(dev, sg_page(s), s->offset,
-					       s->length, dir, 0);
-	}
-
-	return nents;
-}
-
-static void
-or1k_unmap_sg(struct device *dev, struct scatterlist *sg,
-	      int nents, enum dma_data_direction dir,
-	      unsigned long attrs)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nents, i) {
-		or1k_unmap_page(dev, sg_dma_address(s), sg_dma_len(s), dir, 0);
-	}
-}
-
-static void
-or1k_sync_single_for_cpu(struct device *dev,
-			 dma_addr_t dma_handle, size_t size,
-			 enum dma_data_direction dir)
-{
-	unsigned long cl;
-	dma_addr_t addr = dma_handle;
-	struct cpuinfo_or1k *cpuinfo = &cpuinfo_or1k[smp_processor_id()];
-
-	/* Invalidate the dcache for the requested range */
-	for (cl = addr; cl < addr + size; cl += cpuinfo->dcache_block_size)
-		mtspr(SPR_DCBIR, cl);
-}
-
-static void
-or1k_sync_single_for_device(struct device *dev,
-			    dma_addr_t dma_handle, size_t size,
-			    enum dma_data_direction dir)
-{
-	unsigned long cl;
-	dma_addr_t addr = dma_handle;
-	struct cpuinfo_or1k *cpuinfo = &cpuinfo_or1k[smp_processor_id()];
-
-	/* Flush the dcache for the requested range */
-	for (cl = addr; cl < addr + size; cl += cpuinfo->dcache_block_size)
-		mtspr(SPR_DCBFR, cl);
-}
-
-const struct dma_map_ops or1k_dma_map_ops = {
-	.alloc = or1k_dma_alloc,
-	.free = or1k_dma_free,
-	.map_page = or1k_map_page,
-	.unmap_page = or1k_unmap_page,
-	.map_sg = or1k_map_sg,
-	.unmap_sg = or1k_unmap_sg,
-	.sync_single_for_cpu = or1k_sync_single_for_cpu,
-	.sync_single_for_device = or1k_sync_single_for_device,
-};
-EXPORT_SYMBOL(or1k_dma_map_ops);
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [OpenRISC] [PATCH 15/22] openrisc: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  To: openrisc

Switch to the generic noncoherent direct mapping implementation.

Fix sync_single_for_device to do the same cache coherency operations as
the more tested map_single path, as both should transfer ownership to
the device.

Remove the sync_single_for_cpu implementation as no cache coherency
operations are used in the more commonly used unmap_single case, both
of which transfer ownership to the CPU.

Implement the missing sync_sg_for_device operation, matching the cache
coherency operations in sync_single_for_device and map_{single,sg}.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/openrisc/Kconfig                   |   2 +
 arch/openrisc/include/asm/Kbuild        |   1 +
 arch/openrisc/include/asm/dma-mapping.h |  35 --------
 arch/openrisc/kernel/dma.c              | 109 +++---------------------
 4 files changed, 13 insertions(+), 134 deletions(-)
 delete mode 100644 arch/openrisc/include/asm/dma-mapping.h

diff --git a/arch/openrisc/Kconfig b/arch/openrisc/Kconfig
index 9ecad05bfc73..65e3c574c9d3 100644
--- a/arch/openrisc/Kconfig
+++ b/arch/openrisc/Kconfig
@@ -6,6 +6,8 @@
 
 config OPENRISC
 	def_bool y
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
+	select DMA_NONCOHERENT_OPS
 	select OF
 	select OF_EARLY_FLATTREE
 	select IRQ_DOMAIN
diff --git a/arch/openrisc/include/asm/Kbuild b/arch/openrisc/include/asm/Kbuild
index f05c722a21f8..e663a996b612 100644
--- a/arch/openrisc/include/asm/Kbuild
+++ b/arch/openrisc/include/asm/Kbuild
@@ -6,6 +6,7 @@ generic-y += current.h
 generic-y += device.h
 generic-y += div64.h
 generic-y += dma.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += exec.h
 generic-y += extable.h
diff --git a/arch/openrisc/include/asm/dma-mapping.h b/arch/openrisc/include/asm/dma-mapping.h
deleted file mode 100644
index e212a1f0b6d2..000000000000
--- a/arch/openrisc/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * OpenRISC Linux
- *
- * Linux architectural port borrowing liberally from similar works of
- * others.  All original copyrights apply as per the original source
- * declaration.
- *
- * OpenRISC implementation:
- * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- */
-
-#ifndef __ASM_OPENRISC_DMA_MAPPING_H
-#define __ASM_OPENRISC_DMA_MAPPING_H
-
-/*
- * See Documentation/DMA-API-HOWTO.txt and
- * Documentation/DMA-API.txt for documentation.
- */
-
-#include <linux/dma-debug.h>
-#include <linux/dma-mapping.h>
-
-extern const struct dma_map_ops or1k_dma_map_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return &or1k_dma_map_ops;
-}
-
-#endif	/* __ASM_OPENRISC_DMA_MAPPING_H */
diff --git a/arch/openrisc/kernel/dma.c b/arch/openrisc/kernel/dma.c
index ec7fd45704d2..cce99405edf4 100644
--- a/arch/openrisc/kernel/dma.c
+++ b/arch/openrisc/kernel/dma.c
@@ -19,9 +19,7 @@
  * the only thing implemented properly.  The rest need looking into...
  */
 
-#include <linux/dma-mapping.h>
-#include <linux/dma-debug.h>
-#include <linux/export.h>
+#include <linux/dma-noncoherent.h>
 
 #include <asm/cpuinfo.h>
 #include <asm/spr_defs.h>
@@ -80,10 +78,9 @@ page_clear_nocache(pte_t *pte, unsigned long addr,
  * is being ignored for now; uncached but write-combined memory is a
  * missing feature of the OR1K.
  */
-static void *
-or1k_dma_alloc(struct device *dev, size_t size,
-	       dma_addr_t *dma_handle, gfp_t gfp,
-	       unsigned long attrs)
+void *
+arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	unsigned long va;
 	void *page;
@@ -115,9 +112,9 @@ or1k_dma_alloc(struct device *dev, size_t size,
 	return (void *)va;
 }
 
-static void
-or1k_dma_free(struct device *dev, size_t size, void *vaddr,
-	      dma_addr_t dma_handle, unsigned long attrs)
+void
+arch_dma_free(struct device *dev, size_t size, void *vaddr,
+		dma_addr_t dma_handle, unsigned long attrs)
 {
 	unsigned long va = (unsigned long)vaddr;
 	struct mm_walk walk = {
@@ -133,18 +130,11 @@ or1k_dma_free(struct device *dev, size_t size, void *vaddr,
 	free_pages_exact(vaddr, size);
 }
 
-static dma_addr_t
-or1k_map_page(struct device *dev, struct page *page,
-	      unsigned long offset, size_t size,
-	      enum dma_data_direction dir,
-	      unsigned long attrs)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t addr, size_t size,
+		enum dma_data_direction dir)
 {
-	unsigned long cl;
-	dma_addr_t addr = page_to_phys(page) + offset;
 	struct cpuinfo_or1k *cpuinfo = &cpuinfo_or1k[smp_processor_id()];
-
-	if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-		return addr;
+	unsigned long cl;
 
 	switch (dir) {
 	case DMA_TO_DEVICE:
@@ -167,83 +157,4 @@ or1k_map_page(struct device *dev, struct page *page,
 		 */
 		break;
 	}
-
-	return addr;
 }
-
-static void
-or1k_unmap_page(struct device *dev, dma_addr_t dma_handle,
-		size_t size, enum dma_data_direction dir,
-		unsigned long attrs)
-{
-	/* Nothing special to do here... */
-}
-
-static int
-or1k_map_sg(struct device *dev, struct scatterlist *sg,
-	    int nents, enum dma_data_direction dir,
-	    unsigned long attrs)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nents, i) {
-		s->dma_address = or1k_map_page(dev, sg_page(s), s->offset,
-					       s->length, dir, 0);
-	}
-
-	return nents;
-}
-
-static void
-or1k_unmap_sg(struct device *dev, struct scatterlist *sg,
-	      int nents, enum dma_data_direction dir,
-	      unsigned long attrs)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nents, i) {
-		or1k_unmap_page(dev, sg_dma_address(s), sg_dma_len(s), dir, 0);
-	}
-}
-
-static void
-or1k_sync_single_for_cpu(struct device *dev,
-			 dma_addr_t dma_handle, size_t size,
-			 enum dma_data_direction dir)
-{
-	unsigned long cl;
-	dma_addr_t addr = dma_handle;
-	struct cpuinfo_or1k *cpuinfo = &cpuinfo_or1k[smp_processor_id()];
-
-	/* Invalidate the dcache for the requested range */
-	for (cl = addr; cl < addr + size; cl += cpuinfo->dcache_block_size)
-		mtspr(SPR_DCBIR, cl);
-}
-
-static void
-or1k_sync_single_for_device(struct device *dev,
-			    dma_addr_t dma_handle, size_t size,
-			    enum dma_data_direction dir)
-{
-	unsigned long cl;
-	dma_addr_t addr = dma_handle;
-	struct cpuinfo_or1k *cpuinfo = &cpuinfo_or1k[smp_processor_id()];
-
-	/* Flush the dcache for the requested range */
-	for (cl = addr; cl < addr + size; cl += cpuinfo->dcache_block_size)
-		mtspr(SPR_DCBFR, cl);
-}
-
-const struct dma_map_ops or1k_dma_map_ops = {
-	.alloc = or1k_dma_alloc,
-	.free = or1k_dma_free,
-	.map_page = or1k_map_page,
-	.unmap_page = or1k_unmap_page,
-	.map_sg = or1k_map_sg,
-	.unmap_sg = or1k_unmap_sg,
-	.sync_single_for_cpu = or1k_sync_single_for_cpu,
-	.sync_single_for_device = or1k_sync_single_for_device,
-};
-EXPORT_SYMBOL(or1k_dma_map_ops);
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 15/22] openrisc: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  To: linux-arm-kernel

Switch to the generic noncoherent direct mapping implementation.

Fix sync_single_for_device to do the same cache coherency operations as
the more tested map_single path, as both should transfer ownership to
the device.

Remove the sync_single_for_cpu implementation as no cache coherency
operations are used in the more commonly used unmap_single case, both
of which transfer ownership to the CPU.

Implement the missing sync_sg_for_device operation, matching the cache
coherency operations in sync_single_for_device and map_{single,sg}.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/openrisc/Kconfig                   |   2 +
 arch/openrisc/include/asm/Kbuild        |   1 +
 arch/openrisc/include/asm/dma-mapping.h |  35 --------
 arch/openrisc/kernel/dma.c              | 109 +++---------------------
 4 files changed, 13 insertions(+), 134 deletions(-)
 delete mode 100644 arch/openrisc/include/asm/dma-mapping.h

diff --git a/arch/openrisc/Kconfig b/arch/openrisc/Kconfig
index 9ecad05bfc73..65e3c574c9d3 100644
--- a/arch/openrisc/Kconfig
+++ b/arch/openrisc/Kconfig
@@ -6,6 +6,8 @@
 
 config OPENRISC
 	def_bool y
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
+	select DMA_NONCOHERENT_OPS
 	select OF
 	select OF_EARLY_FLATTREE
 	select IRQ_DOMAIN
diff --git a/arch/openrisc/include/asm/Kbuild b/arch/openrisc/include/asm/Kbuild
index f05c722a21f8..e663a996b612 100644
--- a/arch/openrisc/include/asm/Kbuild
+++ b/arch/openrisc/include/asm/Kbuild
@@ -6,6 +6,7 @@ generic-y += current.h
 generic-y += device.h
 generic-y += div64.h
 generic-y += dma.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += exec.h
 generic-y += extable.h
diff --git a/arch/openrisc/include/asm/dma-mapping.h b/arch/openrisc/include/asm/dma-mapping.h
deleted file mode 100644
index e212a1f0b6d2..000000000000
--- a/arch/openrisc/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * OpenRISC Linux
- *
- * Linux architectural port borrowing liberally from similar works of
- * others.  All original copyrights apply as per the original source
- * declaration.
- *
- * OpenRISC implementation:
- * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- */
-
-#ifndef __ASM_OPENRISC_DMA_MAPPING_H
-#define __ASM_OPENRISC_DMA_MAPPING_H
-
-/*
- * See Documentation/DMA-API-HOWTO.txt and
- * Documentation/DMA-API.txt for documentation.
- */
-
-#include <linux/dma-debug.h>
-#include <linux/dma-mapping.h>
-
-extern const struct dma_map_ops or1k_dma_map_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return &or1k_dma_map_ops;
-}
-
-#endif	/* __ASM_OPENRISC_DMA_MAPPING_H */
diff --git a/arch/openrisc/kernel/dma.c b/arch/openrisc/kernel/dma.c
index ec7fd45704d2..cce99405edf4 100644
--- a/arch/openrisc/kernel/dma.c
+++ b/arch/openrisc/kernel/dma.c
@@ -19,9 +19,7 @@
  * the only thing implemented properly.  The rest need looking into...
  */
 
-#include <linux/dma-mapping.h>
-#include <linux/dma-debug.h>
-#include <linux/export.h>
+#include <linux/dma-noncoherent.h>
 
 #include <asm/cpuinfo.h>
 #include <asm/spr_defs.h>
@@ -80,10 +78,9 @@ page_clear_nocache(pte_t *pte, unsigned long addr,
  * is being ignored for now; uncached but write-combined memory is a
  * missing feature of the OR1K.
  */
-static void *
-or1k_dma_alloc(struct device *dev, size_t size,
-	       dma_addr_t *dma_handle, gfp_t gfp,
-	       unsigned long attrs)
+void *
+arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	unsigned long va;
 	void *page;
@@ -115,9 +112,9 @@ or1k_dma_alloc(struct device *dev, size_t size,
 	return (void *)va;
 }
 
-static void
-or1k_dma_free(struct device *dev, size_t size, void *vaddr,
-	      dma_addr_t dma_handle, unsigned long attrs)
+void
+arch_dma_free(struct device *dev, size_t size, void *vaddr,
+		dma_addr_t dma_handle, unsigned long attrs)
 {
 	unsigned long va = (unsigned long)vaddr;
 	struct mm_walk walk = {
@@ -133,18 +130,11 @@ or1k_dma_free(struct device *dev, size_t size, void *vaddr,
 	free_pages_exact(vaddr, size);
 }
 
-static dma_addr_t
-or1k_map_page(struct device *dev, struct page *page,
-	      unsigned long offset, size_t size,
-	      enum dma_data_direction dir,
-	      unsigned long attrs)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t addr, size_t size,
+		enum dma_data_direction dir)
 {
-	unsigned long cl;
-	dma_addr_t addr = page_to_phys(page) + offset;
 	struct cpuinfo_or1k *cpuinfo = &cpuinfo_or1k[smp_processor_id()];
-
-	if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-		return addr;
+	unsigned long cl;
 
 	switch (dir) {
 	case DMA_TO_DEVICE:
@@ -167,83 +157,4 @@ or1k_map_page(struct device *dev, struct page *page,
 		 */
 		break;
 	}
-
-	return addr;
 }
-
-static void
-or1k_unmap_page(struct device *dev, dma_addr_t dma_handle,
-		size_t size, enum dma_data_direction dir,
-		unsigned long attrs)
-{
-	/* Nothing special to do here... */
-}
-
-static int
-or1k_map_sg(struct device *dev, struct scatterlist *sg,
-	    int nents, enum dma_data_direction dir,
-	    unsigned long attrs)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nents, i) {
-		s->dma_address = or1k_map_page(dev, sg_page(s), s->offset,
-					       s->length, dir, 0);
-	}
-
-	return nents;
-}
-
-static void
-or1k_unmap_sg(struct device *dev, struct scatterlist *sg,
-	      int nents, enum dma_data_direction dir,
-	      unsigned long attrs)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nents, i) {
-		or1k_unmap_page(dev, sg_dma_address(s), sg_dma_len(s), dir, 0);
-	}
-}
-
-static void
-or1k_sync_single_for_cpu(struct device *dev,
-			 dma_addr_t dma_handle, size_t size,
-			 enum dma_data_direction dir)
-{
-	unsigned long cl;
-	dma_addr_t addr = dma_handle;
-	struct cpuinfo_or1k *cpuinfo = &cpuinfo_or1k[smp_processor_id()];
-
-	/* Invalidate the dcache for the requested range */
-	for (cl = addr; cl < addr + size; cl += cpuinfo->dcache_block_size)
-		mtspr(SPR_DCBIR, cl);
-}
-
-static void
-or1k_sync_single_for_device(struct device *dev,
-			    dma_addr_t dma_handle, size_t size,
-			    enum dma_data_direction dir)
-{
-	unsigned long cl;
-	dma_addr_t addr = dma_handle;
-	struct cpuinfo_or1k *cpuinfo = &cpuinfo_or1k[smp_processor_id()];
-
-	/* Flush the dcache for the requested range */
-	for (cl = addr; cl < addr + size; cl += cpuinfo->dcache_block_size)
-		mtspr(SPR_DCBFR, cl);
-}
-
-const struct dma_map_ops or1k_dma_map_ops = {
-	.alloc = or1k_dma_alloc,
-	.free = or1k_dma_free,
-	.map_page = or1k_map_page,
-	.unmap_page = or1k_unmap_page,
-	.map_sg = or1k_map_sg,
-	.unmap_sg = or1k_unmap_sg,
-	.sync_single_for_cpu = or1k_sync_single_for_cpu,
-	.sync_single_for_device = or1k_sync_single_for_device,
-};
-EXPORT_SYMBOL(or1k_dma_map_ops);
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 16/22] sh: simplify get_arch_dma_ops
  2018-04-20  8:02 ` Christoph Hellwig
                     ` (4 preceding siblings ...)
  (?)
@ 2018-04-20  8:03   ` Christoph Hellwig
  -1 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Remove the indirection through the dma_ops variable, and just return
nommu_dma_ops directly from get_arch_dma_ops.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/sh/include/asm/dma-mapping.h |  5 ++---
 arch/sh/kernel/dma-nommu.c        |  8 +-------
 arch/sh/mm/consistent.c           |  3 ---
 arch/sh/mm/init.c                 | 10 ----------
 4 files changed, 3 insertions(+), 23 deletions(-)

diff --git a/arch/sh/include/asm/dma-mapping.h b/arch/sh/include/asm/dma-mapping.h
index 41167931e5d9..149e71f95be7 100644
--- a/arch/sh/include/asm/dma-mapping.h
+++ b/arch/sh/include/asm/dma-mapping.h
@@ -2,12 +2,11 @@
 #ifndef __ASM_SH_DMA_MAPPING_H
 #define __ASM_SH_DMA_MAPPING_H
 
-extern const struct dma_map_ops *dma_ops;
-extern void no_iommu_init(void);
+extern const struct dma_map_ops nommu_dma_ops;
 
 static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
 {
-	return dma_ops;
+	return &nommu_dma_ops;
 }
 
 extern void *dma_generic_alloc_coherent(struct device *dev, size_t size,
diff --git a/arch/sh/kernel/dma-nommu.c b/arch/sh/kernel/dma-nommu.c
index 2077cfe73cc6..c0fff676e2e4 100644
--- a/arch/sh/kernel/dma-nommu.c
+++ b/arch/sh/kernel/dma-nommu.c
@@ -76,10 +76,4 @@ const struct dma_map_ops nommu_dma_ops = {
 	.sync_sg_for_device	= nommu_sync_sg_for_device,
 #endif
 };
-
-void __init no_iommu_init(void)
-{
-	if (dma_ops)
-		return;
-	dma_ops = &nommu_dma_ops;
-}
+EXPORT_SYMBOL(nommu_dma_ops);
diff --git a/arch/sh/mm/consistent.c b/arch/sh/mm/consistent.c
index a7bff3f29c2b..af2f28572119 100644
--- a/arch/sh/mm/consistent.c
+++ b/arch/sh/mm/consistent.c
@@ -20,9 +20,6 @@
 #include <asm/cacheflush.h>
 #include <asm/addrspace.h>
 
-const struct dma_map_ops *dma_ops;
-EXPORT_SYMBOL(dma_ops);
-
 void *dma_generic_alloc_coherent(struct device *dev, size_t size,
 				 dma_addr_t *dma_handle, gfp_t gfp,
 				 unsigned long attrs)
diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c
index ce0bbaa7e404..32e09f03e6bf 100644
--- a/arch/sh/mm/init.c
+++ b/arch/sh/mm/init.c
@@ -395,22 +395,12 @@ void __init paging_init(void)
 	free_area_init_nodes(max_zone_pfns);
 }
 
-/*
- * Early initialization for any I/O MMUs we might have.
- */
-static void __init iommu_init(void)
-{
-	no_iommu_init();
-}
-
 unsigned int mem_init_done = 0;
 
 void __init mem_init(void)
 {
 	pg_data_t *pgdat;
 
-	iommu_init();
-
 	high_memory = NULL;
 	for_each_online_pgdat(pgdat)
 		high_memory = max_t(void *, high_memory,
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 16/22] sh: simplify get_arch_dma_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Remove the indirection through the dma_ops variable, and just return
nommu_dma_ops directly from get_arch_dma_ops.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/sh/include/asm/dma-mapping.h |  5 ++---
 arch/sh/kernel/dma-nommu.c        |  8 +-------
 arch/sh/mm/consistent.c           |  3 ---
 arch/sh/mm/init.c                 | 10 ----------
 4 files changed, 3 insertions(+), 23 deletions(-)

diff --git a/arch/sh/include/asm/dma-mapping.h b/arch/sh/include/asm/dma-mapping.h
index 41167931e5d9..149e71f95be7 100644
--- a/arch/sh/include/asm/dma-mapping.h
+++ b/arch/sh/include/asm/dma-mapping.h
@@ -2,12 +2,11 @@
 #ifndef __ASM_SH_DMA_MAPPING_H
 #define __ASM_SH_DMA_MAPPING_H
 
-extern const struct dma_map_ops *dma_ops;
-extern void no_iommu_init(void);
+extern const struct dma_map_ops nommu_dma_ops;
 
 static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
 {
-	return dma_ops;
+	return &nommu_dma_ops;
 }
 
 extern void *dma_generic_alloc_coherent(struct device *dev, size_t size,
diff --git a/arch/sh/kernel/dma-nommu.c b/arch/sh/kernel/dma-nommu.c
index 2077cfe73cc6..c0fff676e2e4 100644
--- a/arch/sh/kernel/dma-nommu.c
+++ b/arch/sh/kernel/dma-nommu.c
@@ -76,10 +76,4 @@ const struct dma_map_ops nommu_dma_ops = {
 	.sync_sg_for_device	= nommu_sync_sg_for_device,
 #endif
 };
-
-void __init no_iommu_init(void)
-{
-	if (dma_ops)
-		return;
-	dma_ops = &nommu_dma_ops;
-}
+EXPORT_SYMBOL(nommu_dma_ops);
diff --git a/arch/sh/mm/consistent.c b/arch/sh/mm/consistent.c
index a7bff3f29c2b..af2f28572119 100644
--- a/arch/sh/mm/consistent.c
+++ b/arch/sh/mm/consistent.c
@@ -20,9 +20,6 @@
 #include <asm/cacheflush.h>
 #include <asm/addrspace.h>
 
-const struct dma_map_ops *dma_ops;
-EXPORT_SYMBOL(dma_ops);
-
 void *dma_generic_alloc_coherent(struct device *dev, size_t size,
 				 dma_addr_t *dma_handle, gfp_t gfp,
 				 unsigned long attrs)
diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c
index ce0bbaa7e404..32e09f03e6bf 100644
--- a/arch/sh/mm/init.c
+++ b/arch/sh/mm/init.c
@@ -395,22 +395,12 @@ void __init paging_init(void)
 	free_area_init_nodes(max_zone_pfns);
 }
 
-/*
- * Early initialization for any I/O MMUs we might have.
- */
-static void __init iommu_init(void)
-{
-	no_iommu_init();
-}
-
 unsigned int mem_init_done = 0;
 
 void __init mem_init(void)
 {
 	pg_data_t *pgdat;
 
-	iommu_init();
-
 	high_memory = NULL;
 	for_each_online_pgdat(pgdat)
 		high_memory = max_t(void *, high_memory,
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 16/22] sh: simplify get_arch_dma_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Remove the indirection through the dma_ops variable, and just return
nommu_dma_ops directly from get_arch_dma_ops.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/sh/include/asm/dma-mapping.h |  5 ++---
 arch/sh/kernel/dma-nommu.c        |  8 +-------
 arch/sh/mm/consistent.c           |  3 ---
 arch/sh/mm/init.c                 | 10 ----------
 4 files changed, 3 insertions(+), 23 deletions(-)

diff --git a/arch/sh/include/asm/dma-mapping.h b/arch/sh/include/asm/dma-mapping.h
index 41167931e5d9..149e71f95be7 100644
--- a/arch/sh/include/asm/dma-mapping.h
+++ b/arch/sh/include/asm/dma-mapping.h
@@ -2,12 +2,11 @@
 #ifndef __ASM_SH_DMA_MAPPING_H
 #define __ASM_SH_DMA_MAPPING_H
 
-extern const struct dma_map_ops *dma_ops;
-extern void no_iommu_init(void);
+extern const struct dma_map_ops nommu_dma_ops;
 
 static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
 {
-	return dma_ops;
+	return &nommu_dma_ops;
 }
 
 extern void *dma_generic_alloc_coherent(struct device *dev, size_t size,
diff --git a/arch/sh/kernel/dma-nommu.c b/arch/sh/kernel/dma-nommu.c
index 2077cfe73cc6..c0fff676e2e4 100644
--- a/arch/sh/kernel/dma-nommu.c
+++ b/arch/sh/kernel/dma-nommu.c
@@ -76,10 +76,4 @@ const struct dma_map_ops nommu_dma_ops = {
 	.sync_sg_for_device	= nommu_sync_sg_for_device,
 #endif
 };
-
-void __init no_iommu_init(void)
-{
-	if (dma_ops)
-		return;
-	dma_ops = &nommu_dma_ops;
-}
+EXPORT_SYMBOL(nommu_dma_ops);
diff --git a/arch/sh/mm/consistent.c b/arch/sh/mm/consistent.c
index a7bff3f29c2b..af2f28572119 100644
--- a/arch/sh/mm/consistent.c
+++ b/arch/sh/mm/consistent.c
@@ -20,9 +20,6 @@
 #include <asm/cacheflush.h>
 #include <asm/addrspace.h>
 
-const struct dma_map_ops *dma_ops;
-EXPORT_SYMBOL(dma_ops);
-
 void *dma_generic_alloc_coherent(struct device *dev, size_t size,
 				 dma_addr_t *dma_handle, gfp_t gfp,
 				 unsigned long attrs)
diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c
index ce0bbaa7e404..32e09f03e6bf 100644
--- a/arch/sh/mm/init.c
+++ b/arch/sh/mm/init.c
@@ -395,22 +395,12 @@ void __init paging_init(void)
 	free_area_init_nodes(max_zone_pfns);
 }
 
-/*
- * Early initialization for any I/O MMUs we might have.
- */
-static void __init iommu_init(void)
-{
-	no_iommu_init();
-}
-
 unsigned int mem_init_done = 0;
 
 void __init mem_init(void)
 {
 	pg_data_t *pgdat;
 
-	iommu_init();
-
 	high_memory = NULL;
 	for_each_online_pgdat(pgdat)
 		high_memory = max_t(void *, high_memory,
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 16/22] sh: simplify get_arch_dma_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  To: linux-snps-arc

Remove the indirection through the dma_ops variable, and just return
nommu_dma_ops directly from get_arch_dma_ops.

Signed-off-by: Christoph Hellwig <hch at lst.de>
---
 arch/sh/include/asm/dma-mapping.h |  5 ++---
 arch/sh/kernel/dma-nommu.c        |  8 +-------
 arch/sh/mm/consistent.c           |  3 ---
 arch/sh/mm/init.c                 | 10 ----------
 4 files changed, 3 insertions(+), 23 deletions(-)

diff --git a/arch/sh/include/asm/dma-mapping.h b/arch/sh/include/asm/dma-mapping.h
index 41167931e5d9..149e71f95be7 100644
--- a/arch/sh/include/asm/dma-mapping.h
+++ b/arch/sh/include/asm/dma-mapping.h
@@ -2,12 +2,11 @@
 #ifndef __ASM_SH_DMA_MAPPING_H
 #define __ASM_SH_DMA_MAPPING_H
 
-extern const struct dma_map_ops *dma_ops;
-extern void no_iommu_init(void);
+extern const struct dma_map_ops nommu_dma_ops;
 
 static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
 {
-	return dma_ops;
+	return &nommu_dma_ops;
 }
 
 extern void *dma_generic_alloc_coherent(struct device *dev, size_t size,
diff --git a/arch/sh/kernel/dma-nommu.c b/arch/sh/kernel/dma-nommu.c
index 2077cfe73cc6..c0fff676e2e4 100644
--- a/arch/sh/kernel/dma-nommu.c
+++ b/arch/sh/kernel/dma-nommu.c
@@ -76,10 +76,4 @@ const struct dma_map_ops nommu_dma_ops = {
 	.sync_sg_for_device	= nommu_sync_sg_for_device,
 #endif
 };
-
-void __init no_iommu_init(void)
-{
-	if (dma_ops)
-		return;
-	dma_ops = &nommu_dma_ops;
-}
+EXPORT_SYMBOL(nommu_dma_ops);
diff --git a/arch/sh/mm/consistent.c b/arch/sh/mm/consistent.c
index a7bff3f29c2b..af2f28572119 100644
--- a/arch/sh/mm/consistent.c
+++ b/arch/sh/mm/consistent.c
@@ -20,9 +20,6 @@
 #include <asm/cacheflush.h>
 #include <asm/addrspace.h>
 
-const struct dma_map_ops *dma_ops;
-EXPORT_SYMBOL(dma_ops);
-
 void *dma_generic_alloc_coherent(struct device *dev, size_t size,
 				 dma_addr_t *dma_handle, gfp_t gfp,
 				 unsigned long attrs)
diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c
index ce0bbaa7e404..32e09f03e6bf 100644
--- a/arch/sh/mm/init.c
+++ b/arch/sh/mm/init.c
@@ -395,22 +395,12 @@ void __init paging_init(void)
 	free_area_init_nodes(max_zone_pfns);
 }
 
-/*
- * Early initialization for any I/O MMUs we might have.
- */
-static void __init iommu_init(void)
-{
-	no_iommu_init();
-}
-
 unsigned int mem_init_done = 0;
 
 void __init mem_init(void)
 {
 	pg_data_t *pgdat;
 
-	iommu_init();
-
 	high_memory = NULL;
 	for_each_online_pgdat(pgdat)
 		high_memory = max_t(void *, high_memory,
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 16/22] sh: simplify get_arch_dma_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Remove the indirection through the dma_ops variable, and just return
nommu_dma_ops directly from get_arch_dma_ops.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/sh/include/asm/dma-mapping.h |  5 ++---
 arch/sh/kernel/dma-nommu.c        |  8 +-------
 arch/sh/mm/consistent.c           |  3 ---
 arch/sh/mm/init.c                 | 10 ----------
 4 files changed, 3 insertions(+), 23 deletions(-)

diff --git a/arch/sh/include/asm/dma-mapping.h b/arch/sh/include/asm/dma-mapping.h
index 41167931e5d9..149e71f95be7 100644
--- a/arch/sh/include/asm/dma-mapping.h
+++ b/arch/sh/include/asm/dma-mapping.h
@@ -2,12 +2,11 @@
 #ifndef __ASM_SH_DMA_MAPPING_H
 #define __ASM_SH_DMA_MAPPING_H
 
-extern const struct dma_map_ops *dma_ops;
-extern void no_iommu_init(void);
+extern const struct dma_map_ops nommu_dma_ops;
 
 static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
 {
-	return dma_ops;
+	return &nommu_dma_ops;
 }
 
 extern void *dma_generic_alloc_coherent(struct device *dev, size_t size,
diff --git a/arch/sh/kernel/dma-nommu.c b/arch/sh/kernel/dma-nommu.c
index 2077cfe73cc6..c0fff676e2e4 100644
--- a/arch/sh/kernel/dma-nommu.c
+++ b/arch/sh/kernel/dma-nommu.c
@@ -76,10 +76,4 @@ const struct dma_map_ops nommu_dma_ops = {
 	.sync_sg_for_device	= nommu_sync_sg_for_device,
 #endif
 };
-
-void __init no_iommu_init(void)
-{
-	if (dma_ops)
-		return;
-	dma_ops = &nommu_dma_ops;
-}
+EXPORT_SYMBOL(nommu_dma_ops);
diff --git a/arch/sh/mm/consistent.c b/arch/sh/mm/consistent.c
index a7bff3f29c2b..af2f28572119 100644
--- a/arch/sh/mm/consistent.c
+++ b/arch/sh/mm/consistent.c
@@ -20,9 +20,6 @@
 #include <asm/cacheflush.h>
 #include <asm/addrspace.h>
 
-const struct dma_map_ops *dma_ops;
-EXPORT_SYMBOL(dma_ops);
-
 void *dma_generic_alloc_coherent(struct device *dev, size_t size,
 				 dma_addr_t *dma_handle, gfp_t gfp,
 				 unsigned long attrs)
diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c
index ce0bbaa7e404..32e09f03e6bf 100644
--- a/arch/sh/mm/init.c
+++ b/arch/sh/mm/init.c
@@ -395,22 +395,12 @@ void __init paging_init(void)
 	free_area_init_nodes(max_zone_pfns);
 }
 
-/*
- * Early initialization for any I/O MMUs we might have.
- */
-static void __init iommu_init(void)
-{
-	no_iommu_init();
-}
-
 unsigned int mem_init_done = 0;
 
 void __init mem_init(void)
 {
 	pg_data_t *pgdat;
 
-	iommu_init();
-
 	high_memory = NULL;
 	for_each_online_pgdat(pgdat)
 		high_memory = max_t(void *, high_memory,
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [OpenRISC] [PATCH 16/22] sh: simplify get_arch_dma_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  To: openrisc

Remove the indirection through the dma_ops variable, and just return
nommu_dma_ops directly from get_arch_dma_ops.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/sh/include/asm/dma-mapping.h |  5 ++---
 arch/sh/kernel/dma-nommu.c        |  8 +-------
 arch/sh/mm/consistent.c           |  3 ---
 arch/sh/mm/init.c                 | 10 ----------
 4 files changed, 3 insertions(+), 23 deletions(-)

diff --git a/arch/sh/include/asm/dma-mapping.h b/arch/sh/include/asm/dma-mapping.h
index 41167931e5d9..149e71f95be7 100644
--- a/arch/sh/include/asm/dma-mapping.h
+++ b/arch/sh/include/asm/dma-mapping.h
@@ -2,12 +2,11 @@
 #ifndef __ASM_SH_DMA_MAPPING_H
 #define __ASM_SH_DMA_MAPPING_H
 
-extern const struct dma_map_ops *dma_ops;
-extern void no_iommu_init(void);
+extern const struct dma_map_ops nommu_dma_ops;
 
 static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
 {
-	return dma_ops;
+	return &nommu_dma_ops;
 }
 
 extern void *dma_generic_alloc_coherent(struct device *dev, size_t size,
diff --git a/arch/sh/kernel/dma-nommu.c b/arch/sh/kernel/dma-nommu.c
index 2077cfe73cc6..c0fff676e2e4 100644
--- a/arch/sh/kernel/dma-nommu.c
+++ b/arch/sh/kernel/dma-nommu.c
@@ -76,10 +76,4 @@ const struct dma_map_ops nommu_dma_ops = {
 	.sync_sg_for_device	= nommu_sync_sg_for_device,
 #endif
 };
-
-void __init no_iommu_init(void)
-{
-	if (dma_ops)
-		return;
-	dma_ops = &nommu_dma_ops;
-}
+EXPORT_SYMBOL(nommu_dma_ops);
diff --git a/arch/sh/mm/consistent.c b/arch/sh/mm/consistent.c
index a7bff3f29c2b..af2f28572119 100644
--- a/arch/sh/mm/consistent.c
+++ b/arch/sh/mm/consistent.c
@@ -20,9 +20,6 @@
 #include <asm/cacheflush.h>
 #include <asm/addrspace.h>
 
-const struct dma_map_ops *dma_ops;
-EXPORT_SYMBOL(dma_ops);
-
 void *dma_generic_alloc_coherent(struct device *dev, size_t size,
 				 dma_addr_t *dma_handle, gfp_t gfp,
 				 unsigned long attrs)
diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c
index ce0bbaa7e404..32e09f03e6bf 100644
--- a/arch/sh/mm/init.c
+++ b/arch/sh/mm/init.c
@@ -395,22 +395,12 @@ void __init paging_init(void)
 	free_area_init_nodes(max_zone_pfns);
 }
 
-/*
- * Early initialization for any I/O MMUs we might have.
- */
-static void __init iommu_init(void)
-{
-	no_iommu_init();
-}
-
 unsigned int mem_init_done = 0;
 
 void __init mem_init(void)
 {
 	pg_data_t *pgdat;
 
-	iommu_init();
-
 	high_memory = NULL;
 	for_each_online_pgdat(pgdat)
 		high_memory = max_t(void *, high_memory,
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 16/22] sh: simplify get_arch_dma_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  To: linux-arm-kernel

Remove the indirection through the dma_ops variable, and just return
nommu_dma_ops directly from get_arch_dma_ops.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/sh/include/asm/dma-mapping.h |  5 ++---
 arch/sh/kernel/dma-nommu.c        |  8 +-------
 arch/sh/mm/consistent.c           |  3 ---
 arch/sh/mm/init.c                 | 10 ----------
 4 files changed, 3 insertions(+), 23 deletions(-)

diff --git a/arch/sh/include/asm/dma-mapping.h b/arch/sh/include/asm/dma-mapping.h
index 41167931e5d9..149e71f95be7 100644
--- a/arch/sh/include/asm/dma-mapping.h
+++ b/arch/sh/include/asm/dma-mapping.h
@@ -2,12 +2,11 @@
 #ifndef __ASM_SH_DMA_MAPPING_H
 #define __ASM_SH_DMA_MAPPING_H
 
-extern const struct dma_map_ops *dma_ops;
-extern void no_iommu_init(void);
+extern const struct dma_map_ops nommu_dma_ops;
 
 static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
 {
-	return dma_ops;
+	return &nommu_dma_ops;
 }
 
 extern void *dma_generic_alloc_coherent(struct device *dev, size_t size,
diff --git a/arch/sh/kernel/dma-nommu.c b/arch/sh/kernel/dma-nommu.c
index 2077cfe73cc6..c0fff676e2e4 100644
--- a/arch/sh/kernel/dma-nommu.c
+++ b/arch/sh/kernel/dma-nommu.c
@@ -76,10 +76,4 @@ const struct dma_map_ops nommu_dma_ops = {
 	.sync_sg_for_device	= nommu_sync_sg_for_device,
 #endif
 };
-
-void __init no_iommu_init(void)
-{
-	if (dma_ops)
-		return;
-	dma_ops = &nommu_dma_ops;
-}
+EXPORT_SYMBOL(nommu_dma_ops);
diff --git a/arch/sh/mm/consistent.c b/arch/sh/mm/consistent.c
index a7bff3f29c2b..af2f28572119 100644
--- a/arch/sh/mm/consistent.c
+++ b/arch/sh/mm/consistent.c
@@ -20,9 +20,6 @@
 #include <asm/cacheflush.h>
 #include <asm/addrspace.h>
 
-const struct dma_map_ops *dma_ops;
-EXPORT_SYMBOL(dma_ops);
-
 void *dma_generic_alloc_coherent(struct device *dev, size_t size,
 				 dma_addr_t *dma_handle, gfp_t gfp,
 				 unsigned long attrs)
diff --git a/arch/sh/mm/init.c b/arch/sh/mm/init.c
index ce0bbaa7e404..32e09f03e6bf 100644
--- a/arch/sh/mm/init.c
+++ b/arch/sh/mm/init.c
@@ -395,22 +395,12 @@ void __init paging_init(void)
 	free_area_init_nodes(max_zone_pfns);
 }
 
-/*
- * Early initialization for any I/O MMUs we might have.
- */
-static void __init iommu_init(void)
-{
-	no_iommu_init();
-}
-
 unsigned int mem_init_done = 0;
 
 void __init mem_init(void)
 {
 	pg_data_t *pgdat;
 
-	iommu_init();
-
 	high_memory = NULL;
 	for_each_online_pgdat(pgdat)
 		high_memory = max_t(void *, high_memory,
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 17/22] sh: introduce a sh_cacheop_vaddr helper
  2018-04-20  8:02 ` Christoph Hellwig
                     ` (4 preceding siblings ...)
  (?)
@ 2018-04-20  8:03   ` Christoph Hellwig
  -1 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

And use it in the maple bus code to avoid a dma API dependency.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/sh/include/asm/cacheflush.h | 7 +++++++
 arch/sh/mm/consistent.c          | 5 +----
 drivers/sh/maple/maple.c         | 7 ++++---
 3 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/arch/sh/include/asm/cacheflush.h b/arch/sh/include/asm/cacheflush.h
index d103ab5a4e4b..b932e42ef028 100644
--- a/arch/sh/include/asm/cacheflush.h
+++ b/arch/sh/include/asm/cacheflush.h
@@ -101,5 +101,12 @@ void kunmap_coherent(void *kvaddr);
 
 void cpu_cache_init(void);
 
+static inline void *sh_cacheop_vaddr(void *vaddr)
+{
+	if (__in_29bit_mode())
+		vaddr = (void *)CAC_ADDR((unsigned long)vaddr);
+	return vaddr;
+}
+
 #endif /* __KERNEL__ */
 #endif /* __ASM_SH_CACHEFLUSH_H */
diff --git a/arch/sh/mm/consistent.c b/arch/sh/mm/consistent.c
index af2f28572119..516d481525e1 100644
--- a/arch/sh/mm/consistent.c
+++ b/arch/sh/mm/consistent.c
@@ -69,10 +69,7 @@ void dma_generic_free_coherent(struct device *dev, size_t size,
 void sh_sync_dma_for_device(void *vaddr, size_t size,
 		    enum dma_data_direction direction)
 {
-	void *addr;
-
-	addr = __in_29bit_mode() ?
-	       (void *)CAC_ADDR((unsigned long)vaddr) : vaddr;
+	void *addr = sh_cacheop_vaddr(vaddr);
 
 	switch (direction) {
 	case DMA_FROM_DEVICE:		/* invalidate only */
diff --git a/drivers/sh/maple/maple.c b/drivers/sh/maple/maple.c
index 7525039d812c..c9c354bd713a 100644
--- a/drivers/sh/maple/maple.c
+++ b/drivers/sh/maple/maple.c
@@ -300,8 +300,8 @@ static void maple_send(void)
 	mutex_unlock(&maple_wlist_lock);
 	if (maple_packets > 0) {
 		for (i = 0; i < (1 << MAPLE_DMA_PAGES); i++)
-			sh_sync_dma_for_device(maple_sendbuf + i * PAGE_SIZE,
-				       PAGE_SIZE, DMA_BIDIRECTIONAL);
+			__flush_purge_region(maple_sendbuf + i * PAGE_SIZE,
+					PAGE_SIZE);
 	}
 
 finish:
@@ -642,7 +642,8 @@ static void maple_dma_handler(struct work_struct *work)
 		list_for_each_entry_safe(mq, nmq, &maple_sentq, list) {
 			mdev = mq->dev;
 			recvbuf = mq->recvbuf->buf;
-			sh_sync_dma_for_device(recvbuf, 0x400, DMA_FROM_DEVICE);
+			__flush_invalidate_region(sh_cacheop_vaddr(recvbuf),
+					0x400);
 			code = recvbuf[0];
 			kfree(mq->sendbuf);
 			list_del_init(&mq->list);
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 17/22] sh: introduce a sh_cacheop_vaddr helper
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

And use it in the maple bus code to avoid a dma API dependency.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/sh/include/asm/cacheflush.h | 7 +++++++
 arch/sh/mm/consistent.c          | 5 +----
 drivers/sh/maple/maple.c         | 7 ++++---
 3 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/arch/sh/include/asm/cacheflush.h b/arch/sh/include/asm/cacheflush.h
index d103ab5a4e4b..b932e42ef028 100644
--- a/arch/sh/include/asm/cacheflush.h
+++ b/arch/sh/include/asm/cacheflush.h
@@ -101,5 +101,12 @@ void kunmap_coherent(void *kvaddr);
 
 void cpu_cache_init(void);
 
+static inline void *sh_cacheop_vaddr(void *vaddr)
+{
+	if (__in_29bit_mode())
+		vaddr = (void *)CAC_ADDR((unsigned long)vaddr);
+	return vaddr;
+}
+
 #endif /* __KERNEL__ */
 #endif /* __ASM_SH_CACHEFLUSH_H */
diff --git a/arch/sh/mm/consistent.c b/arch/sh/mm/consistent.c
index af2f28572119..516d481525e1 100644
--- a/arch/sh/mm/consistent.c
+++ b/arch/sh/mm/consistent.c
@@ -69,10 +69,7 @@ void dma_generic_free_coherent(struct device *dev, size_t size,
 void sh_sync_dma_for_device(void *vaddr, size_t size,
 		    enum dma_data_direction direction)
 {
-	void *addr;
-
-	addr = __in_29bit_mode() ?
-	       (void *)CAC_ADDR((unsigned long)vaddr) : vaddr;
+	void *addr = sh_cacheop_vaddr(vaddr);
 
 	switch (direction) {
 	case DMA_FROM_DEVICE:		/* invalidate only */
diff --git a/drivers/sh/maple/maple.c b/drivers/sh/maple/maple.c
index 7525039d812c..c9c354bd713a 100644
--- a/drivers/sh/maple/maple.c
+++ b/drivers/sh/maple/maple.c
@@ -300,8 +300,8 @@ static void maple_send(void)
 	mutex_unlock(&maple_wlist_lock);
 	if (maple_packets > 0) {
 		for (i = 0; i < (1 << MAPLE_DMA_PAGES); i++)
-			sh_sync_dma_for_device(maple_sendbuf + i * PAGE_SIZE,
-				       PAGE_SIZE, DMA_BIDIRECTIONAL);
+			__flush_purge_region(maple_sendbuf + i * PAGE_SIZE,
+					PAGE_SIZE);
 	}
 
 finish:
@@ -642,7 +642,8 @@ static void maple_dma_handler(struct work_struct *work)
 		list_for_each_entry_safe(mq, nmq, &maple_sentq, list) {
 			mdev = mq->dev;
 			recvbuf = mq->recvbuf->buf;
-			sh_sync_dma_for_device(recvbuf, 0x400, DMA_FROM_DEVICE);
+			__flush_invalidate_region(sh_cacheop_vaddr(recvbuf),
+					0x400);
 			code = recvbuf[0];
 			kfree(mq->sendbuf);
 			list_del_init(&mq->list);
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 17/22] sh: introduce a sh_cacheop_vaddr helper
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

And use it in the maple bus code to avoid a dma API dependency.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/sh/include/asm/cacheflush.h | 7 +++++++
 arch/sh/mm/consistent.c          | 5 +----
 drivers/sh/maple/maple.c         | 7 ++++---
 3 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/arch/sh/include/asm/cacheflush.h b/arch/sh/include/asm/cacheflush.h
index d103ab5a4e4b..b932e42ef028 100644
--- a/arch/sh/include/asm/cacheflush.h
+++ b/arch/sh/include/asm/cacheflush.h
@@ -101,5 +101,12 @@ void kunmap_coherent(void *kvaddr);
 
 void cpu_cache_init(void);
 
+static inline void *sh_cacheop_vaddr(void *vaddr)
+{
+	if (__in_29bit_mode())
+		vaddr = (void *)CAC_ADDR((unsigned long)vaddr);
+	return vaddr;
+}
+
 #endif /* __KERNEL__ */
 #endif /* __ASM_SH_CACHEFLUSH_H */
diff --git a/arch/sh/mm/consistent.c b/arch/sh/mm/consistent.c
index af2f28572119..516d481525e1 100644
--- a/arch/sh/mm/consistent.c
+++ b/arch/sh/mm/consistent.c
@@ -69,10 +69,7 @@ void dma_generic_free_coherent(struct device *dev, size_t size,
 void sh_sync_dma_for_device(void *vaddr, size_t size,
 		    enum dma_data_direction direction)
 {
-	void *addr;
-
-	addr = __in_29bit_mode() ?
-	       (void *)CAC_ADDR((unsigned long)vaddr) : vaddr;
+	void *addr = sh_cacheop_vaddr(vaddr);
 
 	switch (direction) {
 	case DMA_FROM_DEVICE:		/* invalidate only */
diff --git a/drivers/sh/maple/maple.c b/drivers/sh/maple/maple.c
index 7525039d812c..c9c354bd713a 100644
--- a/drivers/sh/maple/maple.c
+++ b/drivers/sh/maple/maple.c
@@ -300,8 +300,8 @@ static void maple_send(void)
 	mutex_unlock(&maple_wlist_lock);
 	if (maple_packets > 0) {
 		for (i = 0; i < (1 << MAPLE_DMA_PAGES); i++)
-			sh_sync_dma_for_device(maple_sendbuf + i * PAGE_SIZE,
-				       PAGE_SIZE, DMA_BIDIRECTIONAL);
+			__flush_purge_region(maple_sendbuf + i * PAGE_SIZE,
+					PAGE_SIZE);
 	}
 
 finish:
@@ -642,7 +642,8 @@ static void maple_dma_handler(struct work_struct *work)
 		list_for_each_entry_safe(mq, nmq, &maple_sentq, list) {
 			mdev = mq->dev;
 			recvbuf = mq->recvbuf->buf;
-			sh_sync_dma_for_device(recvbuf, 0x400, DMA_FROM_DEVICE);
+			__flush_invalidate_region(sh_cacheop_vaddr(recvbuf),
+					0x400);
 			code = recvbuf[0];
 			kfree(mq->sendbuf);
 			list_del_init(&mq->list);
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 17/22] sh: introduce a sh_cacheop_vaddr helper
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  To: linux-snps-arc

And use it in the maple bus code to avoid a dma API dependency.

Signed-off-by: Christoph Hellwig <hch at lst.de>
---
 arch/sh/include/asm/cacheflush.h | 7 +++++++
 arch/sh/mm/consistent.c          | 5 +----
 drivers/sh/maple/maple.c         | 7 ++++---
 3 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/arch/sh/include/asm/cacheflush.h b/arch/sh/include/asm/cacheflush.h
index d103ab5a4e4b..b932e42ef028 100644
--- a/arch/sh/include/asm/cacheflush.h
+++ b/arch/sh/include/asm/cacheflush.h
@@ -101,5 +101,12 @@ void kunmap_coherent(void *kvaddr);
 
 void cpu_cache_init(void);
 
+static inline void *sh_cacheop_vaddr(void *vaddr)
+{
+	if (__in_29bit_mode())
+		vaddr = (void *)CAC_ADDR((unsigned long)vaddr);
+	return vaddr;
+}
+
 #endif /* __KERNEL__ */
 #endif /* __ASM_SH_CACHEFLUSH_H */
diff --git a/arch/sh/mm/consistent.c b/arch/sh/mm/consistent.c
index af2f28572119..516d481525e1 100644
--- a/arch/sh/mm/consistent.c
+++ b/arch/sh/mm/consistent.c
@@ -69,10 +69,7 @@ void dma_generic_free_coherent(struct device *dev, size_t size,
 void sh_sync_dma_for_device(void *vaddr, size_t size,
 		    enum dma_data_direction direction)
 {
-	void *addr;
-
-	addr = __in_29bit_mode() ?
-	       (void *)CAC_ADDR((unsigned long)vaddr) : vaddr;
+	void *addr = sh_cacheop_vaddr(vaddr);
 
 	switch (direction) {
 	case DMA_FROM_DEVICE:		/* invalidate only */
diff --git a/drivers/sh/maple/maple.c b/drivers/sh/maple/maple.c
index 7525039d812c..c9c354bd713a 100644
--- a/drivers/sh/maple/maple.c
+++ b/drivers/sh/maple/maple.c
@@ -300,8 +300,8 @@ static void maple_send(void)
 	mutex_unlock(&maple_wlist_lock);
 	if (maple_packets > 0) {
 		for (i = 0; i < (1 << MAPLE_DMA_PAGES); i++)
-			sh_sync_dma_for_device(maple_sendbuf + i * PAGE_SIZE,
-				       PAGE_SIZE, DMA_BIDIRECTIONAL);
+			__flush_purge_region(maple_sendbuf + i * PAGE_SIZE,
+					PAGE_SIZE);
 	}
 
 finish:
@@ -642,7 +642,8 @@ static void maple_dma_handler(struct work_struct *work)
 		list_for_each_entry_safe(mq, nmq, &maple_sentq, list) {
 			mdev = mq->dev;
 			recvbuf = mq->recvbuf->buf;
-			sh_sync_dma_for_device(recvbuf, 0x400, DMA_FROM_DEVICE);
+			__flush_invalidate_region(sh_cacheop_vaddr(recvbuf),
+					0x400);
 			code = recvbuf[0];
 			kfree(mq->sendbuf);
 			list_del_init(&mq->list);
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 17/22] sh: introduce a sh_cacheop_vaddr helper
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

And use it in the maple bus code to avoid a dma API dependency.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/sh/include/asm/cacheflush.h | 7 +++++++
 arch/sh/mm/consistent.c          | 5 +----
 drivers/sh/maple/maple.c         | 7 ++++---
 3 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/arch/sh/include/asm/cacheflush.h b/arch/sh/include/asm/cacheflush.h
index d103ab5a4e4b..b932e42ef028 100644
--- a/arch/sh/include/asm/cacheflush.h
+++ b/arch/sh/include/asm/cacheflush.h
@@ -101,5 +101,12 @@ void kunmap_coherent(void *kvaddr);
 
 void cpu_cache_init(void);
 
+static inline void *sh_cacheop_vaddr(void *vaddr)
+{
+	if (__in_29bit_mode())
+		vaddr = (void *)CAC_ADDR((unsigned long)vaddr);
+	return vaddr;
+}
+
 #endif /* __KERNEL__ */
 #endif /* __ASM_SH_CACHEFLUSH_H */
diff --git a/arch/sh/mm/consistent.c b/arch/sh/mm/consistent.c
index af2f28572119..516d481525e1 100644
--- a/arch/sh/mm/consistent.c
+++ b/arch/sh/mm/consistent.c
@@ -69,10 +69,7 @@ void dma_generic_free_coherent(struct device *dev, size_t size,
 void sh_sync_dma_for_device(void *vaddr, size_t size,
 		    enum dma_data_direction direction)
 {
-	void *addr;
-
-	addr = __in_29bit_mode() ?
-	       (void *)CAC_ADDR((unsigned long)vaddr) : vaddr;
+	void *addr = sh_cacheop_vaddr(vaddr);
 
 	switch (direction) {
 	case DMA_FROM_DEVICE:		/* invalidate only */
diff --git a/drivers/sh/maple/maple.c b/drivers/sh/maple/maple.c
index 7525039d812c..c9c354bd713a 100644
--- a/drivers/sh/maple/maple.c
+++ b/drivers/sh/maple/maple.c
@@ -300,8 +300,8 @@ static void maple_send(void)
 	mutex_unlock(&maple_wlist_lock);
 	if (maple_packets > 0) {
 		for (i = 0; i < (1 << MAPLE_DMA_PAGES); i++)
-			sh_sync_dma_for_device(maple_sendbuf + i * PAGE_SIZE,
-				       PAGE_SIZE, DMA_BIDIRECTIONAL);
+			__flush_purge_region(maple_sendbuf + i * PAGE_SIZE,
+					PAGE_SIZE);
 	}
 
 finish:
@@ -642,7 +642,8 @@ static void maple_dma_handler(struct work_struct *work)
 		list_for_each_entry_safe(mq, nmq, &maple_sentq, list) {
 			mdev = mq->dev;
 			recvbuf = mq->recvbuf->buf;
-			sh_sync_dma_for_device(recvbuf, 0x400, DMA_FROM_DEVICE);
+			__flush_invalidate_region(sh_cacheop_vaddr(recvbuf),
+					0x400);
 			code = recvbuf[0];
 			kfree(mq->sendbuf);
 			list_del_init(&mq->list);
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [OpenRISC] [PATCH 17/22] sh: introduce a sh_cacheop_vaddr helper
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  To: openrisc

And use it in the maple bus code to avoid a dma API dependency.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/sh/include/asm/cacheflush.h | 7 +++++++
 arch/sh/mm/consistent.c          | 5 +----
 drivers/sh/maple/maple.c         | 7 ++++---
 3 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/arch/sh/include/asm/cacheflush.h b/arch/sh/include/asm/cacheflush.h
index d103ab5a4e4b..b932e42ef028 100644
--- a/arch/sh/include/asm/cacheflush.h
+++ b/arch/sh/include/asm/cacheflush.h
@@ -101,5 +101,12 @@ void kunmap_coherent(void *kvaddr);
 
 void cpu_cache_init(void);
 
+static inline void *sh_cacheop_vaddr(void *vaddr)
+{
+	if (__in_29bit_mode())
+		vaddr = (void *)CAC_ADDR((unsigned long)vaddr);
+	return vaddr;
+}
+
 #endif /* __KERNEL__ */
 #endif /* __ASM_SH_CACHEFLUSH_H */
diff --git a/arch/sh/mm/consistent.c b/arch/sh/mm/consistent.c
index af2f28572119..516d481525e1 100644
--- a/arch/sh/mm/consistent.c
+++ b/arch/sh/mm/consistent.c
@@ -69,10 +69,7 @@ void dma_generic_free_coherent(struct device *dev, size_t size,
 void sh_sync_dma_for_device(void *vaddr, size_t size,
 		    enum dma_data_direction direction)
 {
-	void *addr;
-
-	addr = __in_29bit_mode() ?
-	       (void *)CAC_ADDR((unsigned long)vaddr) : vaddr;
+	void *addr = sh_cacheop_vaddr(vaddr);
 
 	switch (direction) {
 	case DMA_FROM_DEVICE:		/* invalidate only */
diff --git a/drivers/sh/maple/maple.c b/drivers/sh/maple/maple.c
index 7525039d812c..c9c354bd713a 100644
--- a/drivers/sh/maple/maple.c
+++ b/drivers/sh/maple/maple.c
@@ -300,8 +300,8 @@ static void maple_send(void)
 	mutex_unlock(&maple_wlist_lock);
 	if (maple_packets > 0) {
 		for (i = 0; i < (1 << MAPLE_DMA_PAGES); i++)
-			sh_sync_dma_for_device(maple_sendbuf + i * PAGE_SIZE,
-				       PAGE_SIZE, DMA_BIDIRECTIONAL);
+			__flush_purge_region(maple_sendbuf + i * PAGE_SIZE,
+					PAGE_SIZE);
 	}
 
 finish:
@@ -642,7 +642,8 @@ static void maple_dma_handler(struct work_struct *work)
 		list_for_each_entry_safe(mq, nmq, &maple_sentq, list) {
 			mdev = mq->dev;
 			recvbuf = mq->recvbuf->buf;
-			sh_sync_dma_for_device(recvbuf, 0x400, DMA_FROM_DEVICE);
+			__flush_invalidate_region(sh_cacheop_vaddr(recvbuf),
+					0x400);
 			code = recvbuf[0];
 			kfree(mq->sendbuf);
 			list_del_init(&mq->list);
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 17/22] sh: introduce a sh_cacheop_vaddr helper
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  To: linux-arm-kernel

And use it in the maple bus code to avoid a dma API dependency.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/sh/include/asm/cacheflush.h | 7 +++++++
 arch/sh/mm/consistent.c          | 5 +----
 drivers/sh/maple/maple.c         | 7 ++++---
 3 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/arch/sh/include/asm/cacheflush.h b/arch/sh/include/asm/cacheflush.h
index d103ab5a4e4b..b932e42ef028 100644
--- a/arch/sh/include/asm/cacheflush.h
+++ b/arch/sh/include/asm/cacheflush.h
@@ -101,5 +101,12 @@ void kunmap_coherent(void *kvaddr);
 
 void cpu_cache_init(void);
 
+static inline void *sh_cacheop_vaddr(void *vaddr)
+{
+	if (__in_29bit_mode())
+		vaddr = (void *)CAC_ADDR((unsigned long)vaddr);
+	return vaddr;
+}
+
 #endif /* __KERNEL__ */
 #endif /* __ASM_SH_CACHEFLUSH_H */
diff --git a/arch/sh/mm/consistent.c b/arch/sh/mm/consistent.c
index af2f28572119..516d481525e1 100644
--- a/arch/sh/mm/consistent.c
+++ b/arch/sh/mm/consistent.c
@@ -69,10 +69,7 @@ void dma_generic_free_coherent(struct device *dev, size_t size,
 void sh_sync_dma_for_device(void *vaddr, size_t size,
 		    enum dma_data_direction direction)
 {
-	void *addr;
-
-	addr = __in_29bit_mode() ?
-	       (void *)CAC_ADDR((unsigned long)vaddr) : vaddr;
+	void *addr = sh_cacheop_vaddr(vaddr);
 
 	switch (direction) {
 	case DMA_FROM_DEVICE:		/* invalidate only */
diff --git a/drivers/sh/maple/maple.c b/drivers/sh/maple/maple.c
index 7525039d812c..c9c354bd713a 100644
--- a/drivers/sh/maple/maple.c
+++ b/drivers/sh/maple/maple.c
@@ -300,8 +300,8 @@ static void maple_send(void)
 	mutex_unlock(&maple_wlist_lock);
 	if (maple_packets > 0) {
 		for (i = 0; i < (1 << MAPLE_DMA_PAGES); i++)
-			sh_sync_dma_for_device(maple_sendbuf + i * PAGE_SIZE,
-				       PAGE_SIZE, DMA_BIDIRECTIONAL);
+			__flush_purge_region(maple_sendbuf + i * PAGE_SIZE,
+					PAGE_SIZE);
 	}
 
 finish:
@@ -642,7 +642,8 @@ static void maple_dma_handler(struct work_struct *work)
 		list_for_each_entry_safe(mq, nmq, &maple_sentq, list) {
 			mdev = mq->dev;
 			recvbuf = mq->recvbuf->buf;
-			sh_sync_dma_for_device(recvbuf, 0x400, DMA_FROM_DEVICE);
+			__flush_invalidate_region(sh_cacheop_vaddr(recvbuf),
+					0x400);
 			code = recvbuf[0];
 			kfree(mq->sendbuf);
 			list_del_init(&mq->list);
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 18/22] sh: use dma_direct_ops for the CONFIG_DMA_COHERENT case
  2018-04-20  8:02 ` Christoph Hellwig
                     ` (4 preceding siblings ...)
  (?)
@ 2018-04-20  8:03   ` Christoph Hellwig
  -1 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

This is a slight change in behavior as we avoid the detour through the
virtual mapping for the coherent allocator, but if this CPU really is
coherent that should be the right thing to do.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/sh/Kconfig                   | 1 +
 arch/sh/include/asm/dma-mapping.h | 4 ++++
 arch/sh/kernel/Makefile           | 4 ++--
 arch/sh/kernel/dma-nommu.c        | 4 ----
 4 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 9417f70e008e..23e7432302b0 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -158,6 +158,7 @@ config SWAP_IO_SPACE
 	bool
 
 config DMA_COHERENT
+	select DMA_DIRECT_OPS
 	bool
 
 config DMA_NONCOHERENT
diff --git a/arch/sh/include/asm/dma-mapping.h b/arch/sh/include/asm/dma-mapping.h
index 149e71f95be7..1ebc6a4eb1c5 100644
--- a/arch/sh/include/asm/dma-mapping.h
+++ b/arch/sh/include/asm/dma-mapping.h
@@ -6,7 +6,11 @@ extern const struct dma_map_ops nommu_dma_ops;
 
 static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
 {
+#ifdef CONFIG_DMA_NONCOHERENT
 	return &nommu_dma_ops;
+#else
+	return &dma_direct_ops;
+#endif
 }
 
 extern void *dma_generic_alloc_coherent(struct device *dev, size_t size,
diff --git a/arch/sh/kernel/Makefile b/arch/sh/kernel/Makefile
index dc80041f7363..cb5f1bfb52de 100644
--- a/arch/sh/kernel/Makefile
+++ b/arch/sh/kernel/Makefile
@@ -12,7 +12,7 @@ endif
 
 CFLAGS_REMOVE_return_address.o = -pg
 
-obj-y	:= debugtraps.o dma-nommu.o dumpstack.o 		\
+obj-y	:= debugtraps.o dumpstack.o 		\
 	   idle.o io.o irq.o irq_$(BITS).o kdebugfs.o			\
 	   machvec.o nmi_debug.o process.o				\
 	   process_$(BITS).o ptrace.o ptrace_$(BITS).o			\
@@ -45,7 +45,7 @@ obj-$(CONFIG_DUMP_CODE)		+= disassemble.o
 obj-$(CONFIG_HIBERNATION)	+= swsusp.o
 obj-$(CONFIG_DWARF_UNWINDER)	+= dwarf.o
 obj-$(CONFIG_PERF_EVENTS)	+= perf_event.o perf_callchain.o
-
+obj-$(CONFIG_DMA_NONCOHERENT)	+= dma-nommu.o
 obj-$(CONFIG_HAVE_HW_BREAKPOINT)		+= hw_breakpoint.o
 
 ccflags-y := -Werror
diff --git a/arch/sh/kernel/dma-nommu.c b/arch/sh/kernel/dma-nommu.c
index c0fff676e2e4..442922a9f8c0 100644
--- a/arch/sh/kernel/dma-nommu.c
+++ b/arch/sh/kernel/dma-nommu.c
@@ -48,7 +48,6 @@ static int nommu_map_sg(struct device *dev, struct scatterlist *sg,
 	return nents;
 }
 
-#ifdef CONFIG_DMA_NONCOHERENT
 static void nommu_sync_single_for_device(struct device *dev, dma_addr_t addr,
 			      size_t size, enum dma_data_direction dir)
 {
@@ -64,16 +63,13 @@ static void nommu_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
 	for_each_sg(sg, s, nelems, i)
 		sh_sync_dma_for_device(sg_virt(s), s->length, dir);
 }
-#endif
 
 const struct dma_map_ops nommu_dma_ops = {
 	.alloc			= dma_generic_alloc_coherent,
 	.free			= dma_generic_free_coherent,
 	.map_page		= nommu_map_page,
 	.map_sg			= nommu_map_sg,
-#ifdef CONFIG_DMA_NONCOHERENT
 	.sync_single_for_device	= nommu_sync_single_for_device,
 	.sync_sg_for_device	= nommu_sync_sg_for_device,
-#endif
 };
 EXPORT_SYMBOL(nommu_dma_ops);
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 18/22] sh: use dma_direct_ops for the CONFIG_DMA_COHERENT case
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

This is a slight change in behavior as we avoid the detour through the
virtual mapping for the coherent allocator, but if this CPU really is
coherent that should be the right thing to do.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/sh/Kconfig                   | 1 +
 arch/sh/include/asm/dma-mapping.h | 4 ++++
 arch/sh/kernel/Makefile           | 4 ++--
 arch/sh/kernel/dma-nommu.c        | 4 ----
 4 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 9417f70e008e..23e7432302b0 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -158,6 +158,7 @@ config SWAP_IO_SPACE
 	bool
 
 config DMA_COHERENT
+	select DMA_DIRECT_OPS
 	bool
 
 config DMA_NONCOHERENT
diff --git a/arch/sh/include/asm/dma-mapping.h b/arch/sh/include/asm/dma-mapping.h
index 149e71f95be7..1ebc6a4eb1c5 100644
--- a/arch/sh/include/asm/dma-mapping.h
+++ b/arch/sh/include/asm/dma-mapping.h
@@ -6,7 +6,11 @@ extern const struct dma_map_ops nommu_dma_ops;
 
 static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
 {
+#ifdef CONFIG_DMA_NONCOHERENT
 	return &nommu_dma_ops;
+#else
+	return &dma_direct_ops;
+#endif
 }
 
 extern void *dma_generic_alloc_coherent(struct device *dev, size_t size,
diff --git a/arch/sh/kernel/Makefile b/arch/sh/kernel/Makefile
index dc80041f7363..cb5f1bfb52de 100644
--- a/arch/sh/kernel/Makefile
+++ b/arch/sh/kernel/Makefile
@@ -12,7 +12,7 @@ endif
 
 CFLAGS_REMOVE_return_address.o = -pg
 
-obj-y	:= debugtraps.o dma-nommu.o dumpstack.o 		\
+obj-y	:= debugtraps.o dumpstack.o 		\
 	   idle.o io.o irq.o irq_$(BITS).o kdebugfs.o			\
 	   machvec.o nmi_debug.o process.o				\
 	   process_$(BITS).o ptrace.o ptrace_$(BITS).o			\
@@ -45,7 +45,7 @@ obj-$(CONFIG_DUMP_CODE)		+= disassemble.o
 obj-$(CONFIG_HIBERNATION)	+= swsusp.o
 obj-$(CONFIG_DWARF_UNWINDER)	+= dwarf.o
 obj-$(CONFIG_PERF_EVENTS)	+= perf_event.o perf_callchain.o
-
+obj-$(CONFIG_DMA_NONCOHERENT)	+= dma-nommu.o
 obj-$(CONFIG_HAVE_HW_BREAKPOINT)		+= hw_breakpoint.o
 
 ccflags-y := -Werror
diff --git a/arch/sh/kernel/dma-nommu.c b/arch/sh/kernel/dma-nommu.c
index c0fff676e2e4..442922a9f8c0 100644
--- a/arch/sh/kernel/dma-nommu.c
+++ b/arch/sh/kernel/dma-nommu.c
@@ -48,7 +48,6 @@ static int nommu_map_sg(struct device *dev, struct scatterlist *sg,
 	return nents;
 }
 
-#ifdef CONFIG_DMA_NONCOHERENT
 static void nommu_sync_single_for_device(struct device *dev, dma_addr_t addr,
 			      size_t size, enum dma_data_direction dir)
 {
@@ -64,16 +63,13 @@ static void nommu_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
 	for_each_sg(sg, s, nelems, i)
 		sh_sync_dma_for_device(sg_virt(s), s->length, dir);
 }
-#endif
 
 const struct dma_map_ops nommu_dma_ops = {
 	.alloc			= dma_generic_alloc_coherent,
 	.free			= dma_generic_free_coherent,
 	.map_page		= nommu_map_page,
 	.map_sg			= nommu_map_sg,
-#ifdef CONFIG_DMA_NONCOHERENT
 	.sync_single_for_device	= nommu_sync_single_for_device,
 	.sync_sg_for_device	= nommu_sync_sg_for_device,
-#endif
 };
 EXPORT_SYMBOL(nommu_dma_ops);
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 18/22] sh: use dma_direct_ops for the CONFIG_DMA_COHERENT case
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

This is a slight change in behavior as we avoid the detour through the
virtual mapping for the coherent allocator, but if this CPU really is
coherent that should be the right thing to do.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/sh/Kconfig                   | 1 +
 arch/sh/include/asm/dma-mapping.h | 4 ++++
 arch/sh/kernel/Makefile           | 4 ++--
 arch/sh/kernel/dma-nommu.c        | 4 ----
 4 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 9417f70e008e..23e7432302b0 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -158,6 +158,7 @@ config SWAP_IO_SPACE
 	bool
 
 config DMA_COHERENT
+	select DMA_DIRECT_OPS
 	bool
 
 config DMA_NONCOHERENT
diff --git a/arch/sh/include/asm/dma-mapping.h b/arch/sh/include/asm/dma-mapping.h
index 149e71f95be7..1ebc6a4eb1c5 100644
--- a/arch/sh/include/asm/dma-mapping.h
+++ b/arch/sh/include/asm/dma-mapping.h
@@ -6,7 +6,11 @@ extern const struct dma_map_ops nommu_dma_ops;
 
 static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
 {
+#ifdef CONFIG_DMA_NONCOHERENT
 	return &nommu_dma_ops;
+#else
+	return &dma_direct_ops;
+#endif
 }
 
 extern void *dma_generic_alloc_coherent(struct device *dev, size_t size,
diff --git a/arch/sh/kernel/Makefile b/arch/sh/kernel/Makefile
index dc80041f7363..cb5f1bfb52de 100644
--- a/arch/sh/kernel/Makefile
+++ b/arch/sh/kernel/Makefile
@@ -12,7 +12,7 @@ endif
 
 CFLAGS_REMOVE_return_address.o = -pg
 
-obj-y	:= debugtraps.o dma-nommu.o dumpstack.o 		\
+obj-y	:= debugtraps.o dumpstack.o 		\
 	   idle.o io.o irq.o irq_$(BITS).o kdebugfs.o			\
 	   machvec.o nmi_debug.o process.o				\
 	   process_$(BITS).o ptrace.o ptrace_$(BITS).o			\
@@ -45,7 +45,7 @@ obj-$(CONFIG_DUMP_CODE)		+= disassemble.o
 obj-$(CONFIG_HIBERNATION)	+= swsusp.o
 obj-$(CONFIG_DWARF_UNWINDER)	+= dwarf.o
 obj-$(CONFIG_PERF_EVENTS)	+= perf_event.o perf_callchain.o
-
+obj-$(CONFIG_DMA_NONCOHERENT)	+= dma-nommu.o
 obj-$(CONFIG_HAVE_HW_BREAKPOINT)		+= hw_breakpoint.o
 
 ccflags-y := -Werror
diff --git a/arch/sh/kernel/dma-nommu.c b/arch/sh/kernel/dma-nommu.c
index c0fff676e2e4..442922a9f8c0 100644
--- a/arch/sh/kernel/dma-nommu.c
+++ b/arch/sh/kernel/dma-nommu.c
@@ -48,7 +48,6 @@ static int nommu_map_sg(struct device *dev, struct scatterlist *sg,
 	return nents;
 }
 
-#ifdef CONFIG_DMA_NONCOHERENT
 static void nommu_sync_single_for_device(struct device *dev, dma_addr_t addr,
 			      size_t size, enum dma_data_direction dir)
 {
@@ -64,16 +63,13 @@ static void nommu_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
 	for_each_sg(sg, s, nelems, i)
 		sh_sync_dma_for_device(sg_virt(s), s->length, dir);
 }
-#endif
 
 const struct dma_map_ops nommu_dma_ops = {
 	.alloc			= dma_generic_alloc_coherent,
 	.free			= dma_generic_free_coherent,
 	.map_page		= nommu_map_page,
 	.map_sg			= nommu_map_sg,
-#ifdef CONFIG_DMA_NONCOHERENT
 	.sync_single_for_device	= nommu_sync_single_for_device,
 	.sync_sg_for_device	= nommu_sync_sg_for_device,
-#endif
 };
 EXPORT_SYMBOL(nommu_dma_ops);
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 18/22] sh: use dma_direct_ops for the CONFIG_DMA_COHERENT case
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  To: linux-snps-arc

This is a slight change in behavior as we avoid the detour through the
virtual mapping for the coherent allocator, but if this CPU really is
coherent that should be the right thing to do.

Signed-off-by: Christoph Hellwig <hch at lst.de>
---
 arch/sh/Kconfig                   | 1 +
 arch/sh/include/asm/dma-mapping.h | 4 ++++
 arch/sh/kernel/Makefile           | 4 ++--
 arch/sh/kernel/dma-nommu.c        | 4 ----
 4 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 9417f70e008e..23e7432302b0 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -158,6 +158,7 @@ config SWAP_IO_SPACE
 	bool
 
 config DMA_COHERENT
+	select DMA_DIRECT_OPS
 	bool
 
 config DMA_NONCOHERENT
diff --git a/arch/sh/include/asm/dma-mapping.h b/arch/sh/include/asm/dma-mapping.h
index 149e71f95be7..1ebc6a4eb1c5 100644
--- a/arch/sh/include/asm/dma-mapping.h
+++ b/arch/sh/include/asm/dma-mapping.h
@@ -6,7 +6,11 @@ extern const struct dma_map_ops nommu_dma_ops;
 
 static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
 {
+#ifdef CONFIG_DMA_NONCOHERENT
 	return &nommu_dma_ops;
+#else
+	return &dma_direct_ops;
+#endif
 }
 
 extern void *dma_generic_alloc_coherent(struct device *dev, size_t size,
diff --git a/arch/sh/kernel/Makefile b/arch/sh/kernel/Makefile
index dc80041f7363..cb5f1bfb52de 100644
--- a/arch/sh/kernel/Makefile
+++ b/arch/sh/kernel/Makefile
@@ -12,7 +12,7 @@ endif
 
 CFLAGS_REMOVE_return_address.o = -pg
 
-obj-y	:= debugtraps.o dma-nommu.o dumpstack.o 		\
+obj-y	:= debugtraps.o dumpstack.o 		\
 	   idle.o io.o irq.o irq_$(BITS).o kdebugfs.o			\
 	   machvec.o nmi_debug.o process.o				\
 	   process_$(BITS).o ptrace.o ptrace_$(BITS).o			\
@@ -45,7 +45,7 @@ obj-$(CONFIG_DUMP_CODE)		+= disassemble.o
 obj-$(CONFIG_HIBERNATION)	+= swsusp.o
 obj-$(CONFIG_DWARF_UNWINDER)	+= dwarf.o
 obj-$(CONFIG_PERF_EVENTS)	+= perf_event.o perf_callchain.o
-
+obj-$(CONFIG_DMA_NONCOHERENT)	+= dma-nommu.o
 obj-$(CONFIG_HAVE_HW_BREAKPOINT)		+= hw_breakpoint.o
 
 ccflags-y := -Werror
diff --git a/arch/sh/kernel/dma-nommu.c b/arch/sh/kernel/dma-nommu.c
index c0fff676e2e4..442922a9f8c0 100644
--- a/arch/sh/kernel/dma-nommu.c
+++ b/arch/sh/kernel/dma-nommu.c
@@ -48,7 +48,6 @@ static int nommu_map_sg(struct device *dev, struct scatterlist *sg,
 	return nents;
 }
 
-#ifdef CONFIG_DMA_NONCOHERENT
 static void nommu_sync_single_for_device(struct device *dev, dma_addr_t addr,
 			      size_t size, enum dma_data_direction dir)
 {
@@ -64,16 +63,13 @@ static void nommu_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
 	for_each_sg(sg, s, nelems, i)
 		sh_sync_dma_for_device(sg_virt(s), s->length, dir);
 }
-#endif
 
 const struct dma_map_ops nommu_dma_ops = {
 	.alloc			= dma_generic_alloc_coherent,
 	.free			= dma_generic_free_coherent,
 	.map_page		= nommu_map_page,
 	.map_sg			= nommu_map_sg,
-#ifdef CONFIG_DMA_NONCOHERENT
 	.sync_single_for_device	= nommu_sync_single_for_device,
 	.sync_sg_for_device	= nommu_sync_sg_for_device,
-#endif
 };
 EXPORT_SYMBOL(nommu_dma_ops);
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 18/22] sh: use dma_direct_ops for the CONFIG_DMA_COHERENT case
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

This is a slight change in behavior as we avoid the detour through the
virtual mapping for the coherent allocator, but if this CPU really is
coherent that should be the right thing to do.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/sh/Kconfig                   | 1 +
 arch/sh/include/asm/dma-mapping.h | 4 ++++
 arch/sh/kernel/Makefile           | 4 ++--
 arch/sh/kernel/dma-nommu.c        | 4 ----
 4 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 9417f70e008e..23e7432302b0 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -158,6 +158,7 @@ config SWAP_IO_SPACE
 	bool
 
 config DMA_COHERENT
+	select DMA_DIRECT_OPS
 	bool
 
 config DMA_NONCOHERENT
diff --git a/arch/sh/include/asm/dma-mapping.h b/arch/sh/include/asm/dma-mapping.h
index 149e71f95be7..1ebc6a4eb1c5 100644
--- a/arch/sh/include/asm/dma-mapping.h
+++ b/arch/sh/include/asm/dma-mapping.h
@@ -6,7 +6,11 @@ extern const struct dma_map_ops nommu_dma_ops;
 
 static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
 {
+#ifdef CONFIG_DMA_NONCOHERENT
 	return &nommu_dma_ops;
+#else
+	return &dma_direct_ops;
+#endif
 }
 
 extern void *dma_generic_alloc_coherent(struct device *dev, size_t size,
diff --git a/arch/sh/kernel/Makefile b/arch/sh/kernel/Makefile
index dc80041f7363..cb5f1bfb52de 100644
--- a/arch/sh/kernel/Makefile
+++ b/arch/sh/kernel/Makefile
@@ -12,7 +12,7 @@ endif
 
 CFLAGS_REMOVE_return_address.o = -pg
 
-obj-y	:= debugtraps.o dma-nommu.o dumpstack.o 		\
+obj-y	:= debugtraps.o dumpstack.o 		\
 	   idle.o io.o irq.o irq_$(BITS).o kdebugfs.o			\
 	   machvec.o nmi_debug.o process.o				\
 	   process_$(BITS).o ptrace.o ptrace_$(BITS).o			\
@@ -45,7 +45,7 @@ obj-$(CONFIG_DUMP_CODE)		+= disassemble.o
 obj-$(CONFIG_HIBERNATION)	+= swsusp.o
 obj-$(CONFIG_DWARF_UNWINDER)	+= dwarf.o
 obj-$(CONFIG_PERF_EVENTS)	+= perf_event.o perf_callchain.o
-
+obj-$(CONFIG_DMA_NONCOHERENT)	+= dma-nommu.o
 obj-$(CONFIG_HAVE_HW_BREAKPOINT)		+= hw_breakpoint.o
 
 ccflags-y := -Werror
diff --git a/arch/sh/kernel/dma-nommu.c b/arch/sh/kernel/dma-nommu.c
index c0fff676e2e4..442922a9f8c0 100644
--- a/arch/sh/kernel/dma-nommu.c
+++ b/arch/sh/kernel/dma-nommu.c
@@ -48,7 +48,6 @@ static int nommu_map_sg(struct device *dev, struct scatterlist *sg,
 	return nents;
 }
 
-#ifdef CONFIG_DMA_NONCOHERENT
 static void nommu_sync_single_for_device(struct device *dev, dma_addr_t addr,
 			      size_t size, enum dma_data_direction dir)
 {
@@ -64,16 +63,13 @@ static void nommu_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
 	for_each_sg(sg, s, nelems, i)
 		sh_sync_dma_for_device(sg_virt(s), s->length, dir);
 }
-#endif
 
 const struct dma_map_ops nommu_dma_ops = {
 	.alloc			= dma_generic_alloc_coherent,
 	.free			= dma_generic_free_coherent,
 	.map_page		= nommu_map_page,
 	.map_sg			= nommu_map_sg,
-#ifdef CONFIG_DMA_NONCOHERENT
 	.sync_single_for_device	= nommu_sync_single_for_device,
 	.sync_sg_for_device	= nommu_sync_sg_for_device,
-#endif
 };
 EXPORT_SYMBOL(nommu_dma_ops);
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [OpenRISC] [PATCH 18/22] sh: use dma_direct_ops for the CONFIG_DMA_COHERENT case
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  To: openrisc

This is a slight change in behavior as we avoid the detour through the
virtual mapping for the coherent allocator, but if this CPU really is
coherent that should be the right thing to do.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/sh/Kconfig                   | 1 +
 arch/sh/include/asm/dma-mapping.h | 4 ++++
 arch/sh/kernel/Makefile           | 4 ++--
 arch/sh/kernel/dma-nommu.c        | 4 ----
 4 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 9417f70e008e..23e7432302b0 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -158,6 +158,7 @@ config SWAP_IO_SPACE
 	bool
 
 config DMA_COHERENT
+	select DMA_DIRECT_OPS
 	bool
 
 config DMA_NONCOHERENT
diff --git a/arch/sh/include/asm/dma-mapping.h b/arch/sh/include/asm/dma-mapping.h
index 149e71f95be7..1ebc6a4eb1c5 100644
--- a/arch/sh/include/asm/dma-mapping.h
+++ b/arch/sh/include/asm/dma-mapping.h
@@ -6,7 +6,11 @@ extern const struct dma_map_ops nommu_dma_ops;
 
 static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
 {
+#ifdef CONFIG_DMA_NONCOHERENT
 	return &nommu_dma_ops;
+#else
+	return &dma_direct_ops;
+#endif
 }
 
 extern void *dma_generic_alloc_coherent(struct device *dev, size_t size,
diff --git a/arch/sh/kernel/Makefile b/arch/sh/kernel/Makefile
index dc80041f7363..cb5f1bfb52de 100644
--- a/arch/sh/kernel/Makefile
+++ b/arch/sh/kernel/Makefile
@@ -12,7 +12,7 @@ endif
 
 CFLAGS_REMOVE_return_address.o = -pg
 
-obj-y	:= debugtraps.o dma-nommu.o dumpstack.o 		\
+obj-y	:= debugtraps.o dumpstack.o 		\
 	   idle.o io.o irq.o irq_$(BITS).o kdebugfs.o			\
 	   machvec.o nmi_debug.o process.o				\
 	   process_$(BITS).o ptrace.o ptrace_$(BITS).o			\
@@ -45,7 +45,7 @@ obj-$(CONFIG_DUMP_CODE)		+= disassemble.o
 obj-$(CONFIG_HIBERNATION)	+= swsusp.o
 obj-$(CONFIG_DWARF_UNWINDER)	+= dwarf.o
 obj-$(CONFIG_PERF_EVENTS)	+= perf_event.o perf_callchain.o
-
+obj-$(CONFIG_DMA_NONCOHERENT)	+= dma-nommu.o
 obj-$(CONFIG_HAVE_HW_BREAKPOINT)		+= hw_breakpoint.o
 
 ccflags-y := -Werror
diff --git a/arch/sh/kernel/dma-nommu.c b/arch/sh/kernel/dma-nommu.c
index c0fff676e2e4..442922a9f8c0 100644
--- a/arch/sh/kernel/dma-nommu.c
+++ b/arch/sh/kernel/dma-nommu.c
@@ -48,7 +48,6 @@ static int nommu_map_sg(struct device *dev, struct scatterlist *sg,
 	return nents;
 }
 
-#ifdef CONFIG_DMA_NONCOHERENT
 static void nommu_sync_single_for_device(struct device *dev, dma_addr_t addr,
 			      size_t size, enum dma_data_direction dir)
 {
@@ -64,16 +63,13 @@ static void nommu_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
 	for_each_sg(sg, s, nelems, i)
 		sh_sync_dma_for_device(sg_virt(s), s->length, dir);
 }
-#endif
 
 const struct dma_map_ops nommu_dma_ops = {
 	.alloc			= dma_generic_alloc_coherent,
 	.free			= dma_generic_free_coherent,
 	.map_page		= nommu_map_page,
 	.map_sg			= nommu_map_sg,
-#ifdef CONFIG_DMA_NONCOHERENT
 	.sync_single_for_device	= nommu_sync_single_for_device,
 	.sync_sg_for_device	= nommu_sync_sg_for_device,
-#endif
 };
 EXPORT_SYMBOL(nommu_dma_ops);
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 18/22] sh: use dma_direct_ops for the CONFIG_DMA_COHERENT case
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  To: linux-arm-kernel

This is a slight change in behavior as we avoid the detour through the
virtual mapping for the coherent allocator, but if this CPU really is
coherent that should be the right thing to do.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/sh/Kconfig                   | 1 +
 arch/sh/include/asm/dma-mapping.h | 4 ++++
 arch/sh/kernel/Makefile           | 4 ++--
 arch/sh/kernel/dma-nommu.c        | 4 ----
 4 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 9417f70e008e..23e7432302b0 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -158,6 +158,7 @@ config SWAP_IO_SPACE
 	bool
 
 config DMA_COHERENT
+	select DMA_DIRECT_OPS
 	bool
 
 config DMA_NONCOHERENT
diff --git a/arch/sh/include/asm/dma-mapping.h b/arch/sh/include/asm/dma-mapping.h
index 149e71f95be7..1ebc6a4eb1c5 100644
--- a/arch/sh/include/asm/dma-mapping.h
+++ b/arch/sh/include/asm/dma-mapping.h
@@ -6,7 +6,11 @@ extern const struct dma_map_ops nommu_dma_ops;
 
 static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
 {
+#ifdef CONFIG_DMA_NONCOHERENT
 	return &nommu_dma_ops;
+#else
+	return &dma_direct_ops;
+#endif
 }
 
 extern void *dma_generic_alloc_coherent(struct device *dev, size_t size,
diff --git a/arch/sh/kernel/Makefile b/arch/sh/kernel/Makefile
index dc80041f7363..cb5f1bfb52de 100644
--- a/arch/sh/kernel/Makefile
+++ b/arch/sh/kernel/Makefile
@@ -12,7 +12,7 @@ endif
 
 CFLAGS_REMOVE_return_address.o = -pg
 
-obj-y	:= debugtraps.o dma-nommu.o dumpstack.o 		\
+obj-y	:= debugtraps.o dumpstack.o 		\
 	   idle.o io.o irq.o irq_$(BITS).o kdebugfs.o			\
 	   machvec.o nmi_debug.o process.o				\
 	   process_$(BITS).o ptrace.o ptrace_$(BITS).o			\
@@ -45,7 +45,7 @@ obj-$(CONFIG_DUMP_CODE)		+= disassemble.o
 obj-$(CONFIG_HIBERNATION)	+= swsusp.o
 obj-$(CONFIG_DWARF_UNWINDER)	+= dwarf.o
 obj-$(CONFIG_PERF_EVENTS)	+= perf_event.o perf_callchain.o
-
+obj-$(CONFIG_DMA_NONCOHERENT)	+= dma-nommu.o
 obj-$(CONFIG_HAVE_HW_BREAKPOINT)		+= hw_breakpoint.o
 
 ccflags-y := -Werror
diff --git a/arch/sh/kernel/dma-nommu.c b/arch/sh/kernel/dma-nommu.c
index c0fff676e2e4..442922a9f8c0 100644
--- a/arch/sh/kernel/dma-nommu.c
+++ b/arch/sh/kernel/dma-nommu.c
@@ -48,7 +48,6 @@ static int nommu_map_sg(struct device *dev, struct scatterlist *sg,
 	return nents;
 }
 
-#ifdef CONFIG_DMA_NONCOHERENT
 static void nommu_sync_single_for_device(struct device *dev, dma_addr_t addr,
 			      size_t size, enum dma_data_direction dir)
 {
@@ -64,16 +63,13 @@ static void nommu_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
 	for_each_sg(sg, s, nelems, i)
 		sh_sync_dma_for_device(sg_virt(s), s->length, dir);
 }
-#endif
 
 const struct dma_map_ops nommu_dma_ops = {
 	.alloc			= dma_generic_alloc_coherent,
 	.free			= dma_generic_free_coherent,
 	.map_page		= nommu_map_page,
 	.map_sg			= nommu_map_sg,
-#ifdef CONFIG_DMA_NONCOHERENT
 	.sync_single_for_device	= nommu_sync_single_for_device,
 	.sync_sg_for_device	= nommu_sync_sg_for_device,
-#endif
 };
 EXPORT_SYMBOL(nommu_dma_ops);
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 19/22] sh: use generic dma_noncoherent_ops
  2018-04-20  8:02 ` Christoph Hellwig
                     ` (4 preceding siblings ...)
  (?)
@ 2018-04-20  8:03   ` Christoph Hellwig
  -1 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Switch to the generic noncoherent direct mapping implementation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/sh/Kconfig                   |  3 +-
 arch/sh/include/asm/Kbuild        |  1 +
 arch/sh/include/asm/dma-mapping.h | 26 -----------
 arch/sh/kernel/Makefile           |  1 -
 arch/sh/kernel/dma-nommu.c        | 75 -------------------------------
 arch/sh/mm/consistent.c           | 24 +++++-----
 6 files changed, 13 insertions(+), 117 deletions(-)
 delete mode 100644 arch/sh/include/asm/dma-mapping.h
 delete mode 100644 arch/sh/kernel/dma-nommu.c

diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 23e7432302b0..23ed245407b1 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -50,7 +50,6 @@ config SUPERH
 	select HAVE_ARCH_AUDITSYSCALL
 	select HAVE_FUTEX_CMPXCHG if FUTEX
 	select HAVE_NMI
-	select NEED_DMA_MAP_STATE
 	select NEED_SG_DMA_LENGTH
 
 	help
@@ -163,6 +162,8 @@ config DMA_COHERENT
 
 config DMA_NONCOHERENT
 	def_bool !DMA_COHERENT
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
+	select DMA_NONCOHERENT_OPS
 
 config PGTABLE_LEVELS
 	default 3 if X2TLB
diff --git a/arch/sh/include/asm/Kbuild b/arch/sh/include/asm/Kbuild
index 1efcce74997b..50f7e878ea1b 100644
--- a/arch/sh/include/asm/Kbuild
+++ b/arch/sh/include/asm/Kbuild
@@ -1,6 +1,7 @@
 generic-y += current.h
 generic-y += delay.h
 generic-y += div64.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += exec.h
 generic-y += irq_regs.h
diff --git a/arch/sh/include/asm/dma-mapping.h b/arch/sh/include/asm/dma-mapping.h
deleted file mode 100644
index 1ebc6a4eb1c5..000000000000
--- a/arch/sh/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef __ASM_SH_DMA_MAPPING_H
-#define __ASM_SH_DMA_MAPPING_H
-
-extern const struct dma_map_ops nommu_dma_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-#ifdef CONFIG_DMA_NONCOHERENT
-	return &nommu_dma_ops;
-#else
-	return &dma_direct_ops;
-#endif
-}
-
-extern void *dma_generic_alloc_coherent(struct device *dev, size_t size,
-					dma_addr_t *dma_addr, gfp_t flag,
-					unsigned long attrs);
-extern void dma_generic_free_coherent(struct device *dev, size_t size,
-				      void *vaddr, dma_addr_t dma_handle,
-				      unsigned long attrs);
-
-void sh_sync_dma_for_device(void *vaddr, size_t size,
-	    enum dma_data_direction dir);
-
-#endif /* __ASM_SH_DMA_MAPPING_H */
diff --git a/arch/sh/kernel/Makefile b/arch/sh/kernel/Makefile
index cb5f1bfb52de..985106e13614 100644
--- a/arch/sh/kernel/Makefile
+++ b/arch/sh/kernel/Makefile
@@ -45,7 +45,6 @@ obj-$(CONFIG_DUMP_CODE)		+= disassemble.o
 obj-$(CONFIG_HIBERNATION)	+= swsusp.o
 obj-$(CONFIG_DWARF_UNWINDER)	+= dwarf.o
 obj-$(CONFIG_PERF_EVENTS)	+= perf_event.o perf_callchain.o
-obj-$(CONFIG_DMA_NONCOHERENT)	+= dma-nommu.o
 obj-$(CONFIG_HAVE_HW_BREAKPOINT)		+= hw_breakpoint.o
 
 ccflags-y := -Werror
diff --git a/arch/sh/kernel/dma-nommu.c b/arch/sh/kernel/dma-nommu.c
deleted file mode 100644
index 442922a9f8c0..000000000000
--- a/arch/sh/kernel/dma-nommu.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * DMA mapping support for platforms lacking IOMMUs.
- *
- * Copyright (C) 2009  Paul Mundt
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- */
-#include <linux/dma-mapping.h>
-#include <linux/io.h>
-#include <asm/cacheflush.h>
-
-static dma_addr_t nommu_map_page(struct device *dev, struct page *page,
-				 unsigned long offset, size_t size,
-				 enum dma_data_direction dir,
-				 unsigned long attrs)
-{
-	dma_addr_t addr = page_to_phys(page) + offset;
-
-	WARN_ON(size == 0);
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		sh_sync_dma_for_device(page_address(page) + offset, size, dir);
-
-	return addr;
-}
-
-static int nommu_map_sg(struct device *dev, struct scatterlist *sg,
-			int nents, enum dma_data_direction dir,
-			unsigned long attrs)
-{
-	struct scatterlist *s;
-	int i;
-
-	WARN_ON(nents == 0 || sg[0].length == 0);
-
-	for_each_sg(sg, s, nents, i) {
-		BUG_ON(!sg_page(s));
-
-		if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-			sh_sync_dma_for_device(sg_virt(s), s->length, dir);
-
-		s->dma_address = sg_phys(s);
-		s->dma_length = s->length;
-	}
-
-	return nents;
-}
-
-static void nommu_sync_single_for_device(struct device *dev, dma_addr_t addr,
-			      size_t size, enum dma_data_direction dir)
-{
-	sh_sync_dma_for_device(phys_to_virt(addr), size, dir);
-}
-
-static void nommu_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
-			  int nelems, enum dma_data_direction dir)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nelems, i)
-		sh_sync_dma_for_device(sg_virt(s), s->length, dir);
-}
-
-const struct dma_map_ops nommu_dma_ops = {
-	.alloc			= dma_generic_alloc_coherent,
-	.free			= dma_generic_free_coherent,
-	.map_page		= nommu_map_page,
-	.map_sg			= nommu_map_sg,
-	.sync_single_for_device	= nommu_sync_single_for_device,
-	.sync_sg_for_device	= nommu_sync_sg_for_device,
-};
-EXPORT_SYMBOL(nommu_dma_ops);
diff --git a/arch/sh/mm/consistent.c b/arch/sh/mm/consistent.c
index 516d481525e1..aaeeb74fdcc3 100644
--- a/arch/sh/mm/consistent.c
+++ b/arch/sh/mm/consistent.c
@@ -12,17 +12,15 @@
 #include <linux/mm.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
-#include <linux/dma-mapping.h>
-#include <linux/dma-debug.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/io.h>
 #include <linux/module.h>
 #include <linux/gfp.h>
 #include <asm/cacheflush.h>
 #include <asm/addrspace.h>
 
-void *dma_generic_alloc_coherent(struct device *dev, size_t size,
-				 dma_addr_t *dma_handle, gfp_t gfp,
-				 unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	void *ret, *ret_nocache;
 	int order = get_order(size);
@@ -37,7 +35,7 @@ void *dma_generic_alloc_coherent(struct device *dev, size_t size,
 	 * Pages from the page allocator may have data present in
 	 * cache. So flush the cache before using uncached memory.
 	 */
-	sh_sync_dma_for_device(ret, size, DMA_BIDIRECTIONAL);
+	__flush_purge_region(sh_cacheop_vaddr(ret), size);
 
 	ret_nocache = (void __force *)ioremap_nocache(virt_to_phys(ret), size);
 	if (!ret_nocache) {
@@ -52,9 +50,8 @@ void *dma_generic_alloc_coherent(struct device *dev, size_t size,
 	return ret_nocache;
 }
 
-void dma_generic_free_coherent(struct device *dev, size_t size,
-			       void *vaddr, dma_addr_t dma_handle,
-			       unsigned long attrs)
+void arch_dma_free(struct device *dev, size_t size, void *vaddr,
+		dma_addr_t dma_handle, unsigned long attrs)
 {
 	int order = get_order(size);
 	unsigned long pfn = dma_handle >> PAGE_SHIFT;
@@ -66,12 +63,12 @@ void dma_generic_free_coherent(struct device *dev, size_t size,
 	iounmap(vaddr);
 }
 
-void sh_sync_dma_for_device(void *vaddr, size_t size,
-		    enum dma_data_direction direction)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	void *addr = sh_cacheop_vaddr(vaddr);
+	void *addr = sh_cacheop_vaddr(phys_to_virt(paddr));
 
-	switch (direction) {
+	switch (dir) {
 	case DMA_FROM_DEVICE:		/* invalidate only */
 		__flush_invalidate_region(addr, size);
 		break;
@@ -85,7 +82,6 @@ void sh_sync_dma_for_device(void *vaddr, size_t size,
 		BUG();
 	}
 }
-EXPORT_SYMBOL(sh_sync_dma_for_device);
 
 static int __init memchunk_setup(char *str)
 {
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 19/22] sh: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Switch to the generic noncoherent direct mapping implementation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/sh/Kconfig                   |  3 +-
 arch/sh/include/asm/Kbuild        |  1 +
 arch/sh/include/asm/dma-mapping.h | 26 -----------
 arch/sh/kernel/Makefile           |  1 -
 arch/sh/kernel/dma-nommu.c        | 75 -------------------------------
 arch/sh/mm/consistent.c           | 24 +++++-----
 6 files changed, 13 insertions(+), 117 deletions(-)
 delete mode 100644 arch/sh/include/asm/dma-mapping.h
 delete mode 100644 arch/sh/kernel/dma-nommu.c

diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 23e7432302b0..23ed245407b1 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -50,7 +50,6 @@ config SUPERH
 	select HAVE_ARCH_AUDITSYSCALL
 	select HAVE_FUTEX_CMPXCHG if FUTEX
 	select HAVE_NMI
-	select NEED_DMA_MAP_STATE
 	select NEED_SG_DMA_LENGTH
 
 	help
@@ -163,6 +162,8 @@ config DMA_COHERENT
 
 config DMA_NONCOHERENT
 	def_bool !DMA_COHERENT
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
+	select DMA_NONCOHERENT_OPS
 
 config PGTABLE_LEVELS
 	default 3 if X2TLB
diff --git a/arch/sh/include/asm/Kbuild b/arch/sh/include/asm/Kbuild
index 1efcce74997b..50f7e878ea1b 100644
--- a/arch/sh/include/asm/Kbuild
+++ b/arch/sh/include/asm/Kbuild
@@ -1,6 +1,7 @@
 generic-y += current.h
 generic-y += delay.h
 generic-y += div64.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += exec.h
 generic-y += irq_regs.h
diff --git a/arch/sh/include/asm/dma-mapping.h b/arch/sh/include/asm/dma-mapping.h
deleted file mode 100644
index 1ebc6a4eb1c5..000000000000
--- a/arch/sh/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef __ASM_SH_DMA_MAPPING_H
-#define __ASM_SH_DMA_MAPPING_H
-
-extern const struct dma_map_ops nommu_dma_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-#ifdef CONFIG_DMA_NONCOHERENT
-	return &nommu_dma_ops;
-#else
-	return &dma_direct_ops;
-#endif
-}
-
-extern void *dma_generic_alloc_coherent(struct device *dev, size_t size,
-					dma_addr_t *dma_addr, gfp_t flag,
-					unsigned long attrs);
-extern void dma_generic_free_coherent(struct device *dev, size_t size,
-				      void *vaddr, dma_addr_t dma_handle,
-				      unsigned long attrs);
-
-void sh_sync_dma_for_device(void *vaddr, size_t size,
-	    enum dma_data_direction dir);
-
-#endif /* __ASM_SH_DMA_MAPPING_H */
diff --git a/arch/sh/kernel/Makefile b/arch/sh/kernel/Makefile
index cb5f1bfb52de..985106e13614 100644
--- a/arch/sh/kernel/Makefile
+++ b/arch/sh/kernel/Makefile
@@ -45,7 +45,6 @@ obj-$(CONFIG_DUMP_CODE)		+= disassemble.o
 obj-$(CONFIG_HIBERNATION)	+= swsusp.o
 obj-$(CONFIG_DWARF_UNWINDER)	+= dwarf.o
 obj-$(CONFIG_PERF_EVENTS)	+= perf_event.o perf_callchain.o
-obj-$(CONFIG_DMA_NONCOHERENT)	+= dma-nommu.o
 obj-$(CONFIG_HAVE_HW_BREAKPOINT)		+= hw_breakpoint.o
 
 ccflags-y := -Werror
diff --git a/arch/sh/kernel/dma-nommu.c b/arch/sh/kernel/dma-nommu.c
deleted file mode 100644
index 442922a9f8c0..000000000000
--- a/arch/sh/kernel/dma-nommu.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * DMA mapping support for platforms lacking IOMMUs.
- *
- * Copyright (C) 2009  Paul Mundt
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- */
-#include <linux/dma-mapping.h>
-#include <linux/io.h>
-#include <asm/cacheflush.h>
-
-static dma_addr_t nommu_map_page(struct device *dev, struct page *page,
-				 unsigned long offset, size_t size,
-				 enum dma_data_direction dir,
-				 unsigned long attrs)
-{
-	dma_addr_t addr = page_to_phys(page) + offset;
-
-	WARN_ON(size == 0);
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		sh_sync_dma_for_device(page_address(page) + offset, size, dir);
-
-	return addr;
-}
-
-static int nommu_map_sg(struct device *dev, struct scatterlist *sg,
-			int nents, enum dma_data_direction dir,
-			unsigned long attrs)
-{
-	struct scatterlist *s;
-	int i;
-
-	WARN_ON(nents == 0 || sg[0].length == 0);
-
-	for_each_sg(sg, s, nents, i) {
-		BUG_ON(!sg_page(s));
-
-		if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-			sh_sync_dma_for_device(sg_virt(s), s->length, dir);
-
-		s->dma_address = sg_phys(s);
-		s->dma_length = s->length;
-	}
-
-	return nents;
-}
-
-static void nommu_sync_single_for_device(struct device *dev, dma_addr_t addr,
-			      size_t size, enum dma_data_direction dir)
-{
-	sh_sync_dma_for_device(phys_to_virt(addr), size, dir);
-}
-
-static void nommu_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
-			  int nelems, enum dma_data_direction dir)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nelems, i)
-		sh_sync_dma_for_device(sg_virt(s), s->length, dir);
-}
-
-const struct dma_map_ops nommu_dma_ops = {
-	.alloc			= dma_generic_alloc_coherent,
-	.free			= dma_generic_free_coherent,
-	.map_page		= nommu_map_page,
-	.map_sg			= nommu_map_sg,
-	.sync_single_for_device	= nommu_sync_single_for_device,
-	.sync_sg_for_device	= nommu_sync_sg_for_device,
-};
-EXPORT_SYMBOL(nommu_dma_ops);
diff --git a/arch/sh/mm/consistent.c b/arch/sh/mm/consistent.c
index 516d481525e1..aaeeb74fdcc3 100644
--- a/arch/sh/mm/consistent.c
+++ b/arch/sh/mm/consistent.c
@@ -12,17 +12,15 @@
 #include <linux/mm.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
-#include <linux/dma-mapping.h>
-#include <linux/dma-debug.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/io.h>
 #include <linux/module.h>
 #include <linux/gfp.h>
 #include <asm/cacheflush.h>
 #include <asm/addrspace.h>
 
-void *dma_generic_alloc_coherent(struct device *dev, size_t size,
-				 dma_addr_t *dma_handle, gfp_t gfp,
-				 unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	void *ret, *ret_nocache;
 	int order = get_order(size);
@@ -37,7 +35,7 @@ void *dma_generic_alloc_coherent(struct device *dev, size_t size,
 	 * Pages from the page allocator may have data present in
 	 * cache. So flush the cache before using uncached memory.
 	 */
-	sh_sync_dma_for_device(ret, size, DMA_BIDIRECTIONAL);
+	__flush_purge_region(sh_cacheop_vaddr(ret), size);
 
 	ret_nocache = (void __force *)ioremap_nocache(virt_to_phys(ret), size);
 	if (!ret_nocache) {
@@ -52,9 +50,8 @@ void *dma_generic_alloc_coherent(struct device *dev, size_t size,
 	return ret_nocache;
 }
 
-void dma_generic_free_coherent(struct device *dev, size_t size,
-			       void *vaddr, dma_addr_t dma_handle,
-			       unsigned long attrs)
+void arch_dma_free(struct device *dev, size_t size, void *vaddr,
+		dma_addr_t dma_handle, unsigned long attrs)
 {
 	int order = get_order(size);
 	unsigned long pfn = dma_handle >> PAGE_SHIFT;
@@ -66,12 +63,12 @@ void dma_generic_free_coherent(struct device *dev, size_t size,
 	iounmap(vaddr);
 }
 
-void sh_sync_dma_for_device(void *vaddr, size_t size,
-		    enum dma_data_direction direction)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	void *addr = sh_cacheop_vaddr(vaddr);
+	void *addr = sh_cacheop_vaddr(phys_to_virt(paddr));
 
-	switch (direction) {
+	switch (dir) {
 	case DMA_FROM_DEVICE:		/* invalidate only */
 		__flush_invalidate_region(addr, size);
 		break;
@@ -85,7 +82,6 @@ void sh_sync_dma_for_device(void *vaddr, size_t size,
 		BUG();
 	}
 }
-EXPORT_SYMBOL(sh_sync_dma_for_device);
 
 static int __init memchunk_setup(char *str)
 {
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 19/22] sh: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Switch to the generic noncoherent direct mapping implementation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/sh/Kconfig                   |  3 +-
 arch/sh/include/asm/Kbuild        |  1 +
 arch/sh/include/asm/dma-mapping.h | 26 -----------
 arch/sh/kernel/Makefile           |  1 -
 arch/sh/kernel/dma-nommu.c        | 75 -------------------------------
 arch/sh/mm/consistent.c           | 24 +++++-----
 6 files changed, 13 insertions(+), 117 deletions(-)
 delete mode 100644 arch/sh/include/asm/dma-mapping.h
 delete mode 100644 arch/sh/kernel/dma-nommu.c

diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 23e7432302b0..23ed245407b1 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -50,7 +50,6 @@ config SUPERH
 	select HAVE_ARCH_AUDITSYSCALL
 	select HAVE_FUTEX_CMPXCHG if FUTEX
 	select HAVE_NMI
-	select NEED_DMA_MAP_STATE
 	select NEED_SG_DMA_LENGTH
 
 	help
@@ -163,6 +162,8 @@ config DMA_COHERENT
 
 config DMA_NONCOHERENT
 	def_bool !DMA_COHERENT
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
+	select DMA_NONCOHERENT_OPS
 
 config PGTABLE_LEVELS
 	default 3 if X2TLB
diff --git a/arch/sh/include/asm/Kbuild b/arch/sh/include/asm/Kbuild
index 1efcce74997b..50f7e878ea1b 100644
--- a/arch/sh/include/asm/Kbuild
+++ b/arch/sh/include/asm/Kbuild
@@ -1,6 +1,7 @@
 generic-y += current.h
 generic-y += delay.h
 generic-y += div64.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += exec.h
 generic-y += irq_regs.h
diff --git a/arch/sh/include/asm/dma-mapping.h b/arch/sh/include/asm/dma-mapping.h
deleted file mode 100644
index 1ebc6a4eb1c5..000000000000
--- a/arch/sh/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef __ASM_SH_DMA_MAPPING_H
-#define __ASM_SH_DMA_MAPPING_H
-
-extern const struct dma_map_ops nommu_dma_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-#ifdef CONFIG_DMA_NONCOHERENT
-	return &nommu_dma_ops;
-#else
-	return &dma_direct_ops;
-#endif
-}
-
-extern void *dma_generic_alloc_coherent(struct device *dev, size_t size,
-					dma_addr_t *dma_addr, gfp_t flag,
-					unsigned long attrs);
-extern void dma_generic_free_coherent(struct device *dev, size_t size,
-				      void *vaddr, dma_addr_t dma_handle,
-				      unsigned long attrs);
-
-void sh_sync_dma_for_device(void *vaddr, size_t size,
-	    enum dma_data_direction dir);
-
-#endif /* __ASM_SH_DMA_MAPPING_H */
diff --git a/arch/sh/kernel/Makefile b/arch/sh/kernel/Makefile
index cb5f1bfb52de..985106e13614 100644
--- a/arch/sh/kernel/Makefile
+++ b/arch/sh/kernel/Makefile
@@ -45,7 +45,6 @@ obj-$(CONFIG_DUMP_CODE)		+= disassemble.o
 obj-$(CONFIG_HIBERNATION)	+= swsusp.o
 obj-$(CONFIG_DWARF_UNWINDER)	+= dwarf.o
 obj-$(CONFIG_PERF_EVENTS)	+= perf_event.o perf_callchain.o
-obj-$(CONFIG_DMA_NONCOHERENT)	+= dma-nommu.o
 obj-$(CONFIG_HAVE_HW_BREAKPOINT)		+= hw_breakpoint.o
 
 ccflags-y := -Werror
diff --git a/arch/sh/kernel/dma-nommu.c b/arch/sh/kernel/dma-nommu.c
deleted file mode 100644
index 442922a9f8c0..000000000000
--- a/arch/sh/kernel/dma-nommu.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * DMA mapping support for platforms lacking IOMMUs.
- *
- * Copyright (C) 2009  Paul Mundt
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- */
-#include <linux/dma-mapping.h>
-#include <linux/io.h>
-#include <asm/cacheflush.h>
-
-static dma_addr_t nommu_map_page(struct device *dev, struct page *page,
-				 unsigned long offset, size_t size,
-				 enum dma_data_direction dir,
-				 unsigned long attrs)
-{
-	dma_addr_t addr = page_to_phys(page) + offset;
-
-	WARN_ON(size == 0);
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		sh_sync_dma_for_device(page_address(page) + offset, size, dir);
-
-	return addr;
-}
-
-static int nommu_map_sg(struct device *dev, struct scatterlist *sg,
-			int nents, enum dma_data_direction dir,
-			unsigned long attrs)
-{
-	struct scatterlist *s;
-	int i;
-
-	WARN_ON(nents == 0 || sg[0].length == 0);
-
-	for_each_sg(sg, s, nents, i) {
-		BUG_ON(!sg_page(s));
-
-		if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-			sh_sync_dma_for_device(sg_virt(s), s->length, dir);
-
-		s->dma_address = sg_phys(s);
-		s->dma_length = s->length;
-	}
-
-	return nents;
-}
-
-static void nommu_sync_single_for_device(struct device *dev, dma_addr_t addr,
-			      size_t size, enum dma_data_direction dir)
-{
-	sh_sync_dma_for_device(phys_to_virt(addr), size, dir);
-}
-
-static void nommu_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
-			  int nelems, enum dma_data_direction dir)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nelems, i)
-		sh_sync_dma_for_device(sg_virt(s), s->length, dir);
-}
-
-const struct dma_map_ops nommu_dma_ops = {
-	.alloc			= dma_generic_alloc_coherent,
-	.free			= dma_generic_free_coherent,
-	.map_page		= nommu_map_page,
-	.map_sg			= nommu_map_sg,
-	.sync_single_for_device	= nommu_sync_single_for_device,
-	.sync_sg_for_device	= nommu_sync_sg_for_device,
-};
-EXPORT_SYMBOL(nommu_dma_ops);
diff --git a/arch/sh/mm/consistent.c b/arch/sh/mm/consistent.c
index 516d481525e1..aaeeb74fdcc3 100644
--- a/arch/sh/mm/consistent.c
+++ b/arch/sh/mm/consistent.c
@@ -12,17 +12,15 @@
 #include <linux/mm.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
-#include <linux/dma-mapping.h>
-#include <linux/dma-debug.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/io.h>
 #include <linux/module.h>
 #include <linux/gfp.h>
 #include <asm/cacheflush.h>
 #include <asm/addrspace.h>
 
-void *dma_generic_alloc_coherent(struct device *dev, size_t size,
-				 dma_addr_t *dma_handle, gfp_t gfp,
-				 unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	void *ret, *ret_nocache;
 	int order = get_order(size);
@@ -37,7 +35,7 @@ void *dma_generic_alloc_coherent(struct device *dev, size_t size,
 	 * Pages from the page allocator may have data present in
 	 * cache. So flush the cache before using uncached memory.
 	 */
-	sh_sync_dma_for_device(ret, size, DMA_BIDIRECTIONAL);
+	__flush_purge_region(sh_cacheop_vaddr(ret), size);
 
 	ret_nocache = (void __force *)ioremap_nocache(virt_to_phys(ret), size);
 	if (!ret_nocache) {
@@ -52,9 +50,8 @@ void *dma_generic_alloc_coherent(struct device *dev, size_t size,
 	return ret_nocache;
 }
 
-void dma_generic_free_coherent(struct device *dev, size_t size,
-			       void *vaddr, dma_addr_t dma_handle,
-			       unsigned long attrs)
+void arch_dma_free(struct device *dev, size_t size, void *vaddr,
+		dma_addr_t dma_handle, unsigned long attrs)
 {
 	int order = get_order(size);
 	unsigned long pfn = dma_handle >> PAGE_SHIFT;
@@ -66,12 +63,12 @@ void dma_generic_free_coherent(struct device *dev, size_t size,
 	iounmap(vaddr);
 }
 
-void sh_sync_dma_for_device(void *vaddr, size_t size,
-		    enum dma_data_direction direction)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	void *addr = sh_cacheop_vaddr(vaddr);
+	void *addr = sh_cacheop_vaddr(phys_to_virt(paddr));
 
-	switch (direction) {
+	switch (dir) {
 	case DMA_FROM_DEVICE:		/* invalidate only */
 		__flush_invalidate_region(addr, size);
 		break;
@@ -85,7 +82,6 @@ void sh_sync_dma_for_device(void *vaddr, size_t size,
 		BUG();
 	}
 }
-EXPORT_SYMBOL(sh_sync_dma_for_device);
 
 static int __init memchunk_setup(char *str)
 {
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 19/22] sh: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  To: linux-snps-arc

Switch to the generic noncoherent direct mapping implementation.

Signed-off-by: Christoph Hellwig <hch at lst.de>
---
 arch/sh/Kconfig                   |  3 +-
 arch/sh/include/asm/Kbuild        |  1 +
 arch/sh/include/asm/dma-mapping.h | 26 -----------
 arch/sh/kernel/Makefile           |  1 -
 arch/sh/kernel/dma-nommu.c        | 75 -------------------------------
 arch/sh/mm/consistent.c           | 24 +++++-----
 6 files changed, 13 insertions(+), 117 deletions(-)
 delete mode 100644 arch/sh/include/asm/dma-mapping.h
 delete mode 100644 arch/sh/kernel/dma-nommu.c

diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 23e7432302b0..23ed245407b1 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -50,7 +50,6 @@ config SUPERH
 	select HAVE_ARCH_AUDITSYSCALL
 	select HAVE_FUTEX_CMPXCHG if FUTEX
 	select HAVE_NMI
-	select NEED_DMA_MAP_STATE
 	select NEED_SG_DMA_LENGTH
 
 	help
@@ -163,6 +162,8 @@ config DMA_COHERENT
 
 config DMA_NONCOHERENT
 	def_bool !DMA_COHERENT
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
+	select DMA_NONCOHERENT_OPS
 
 config PGTABLE_LEVELS
 	default 3 if X2TLB
diff --git a/arch/sh/include/asm/Kbuild b/arch/sh/include/asm/Kbuild
index 1efcce74997b..50f7e878ea1b 100644
--- a/arch/sh/include/asm/Kbuild
+++ b/arch/sh/include/asm/Kbuild
@@ -1,6 +1,7 @@
 generic-y += current.h
 generic-y += delay.h
 generic-y += div64.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += exec.h
 generic-y += irq_regs.h
diff --git a/arch/sh/include/asm/dma-mapping.h b/arch/sh/include/asm/dma-mapping.h
deleted file mode 100644
index 1ebc6a4eb1c5..000000000000
--- a/arch/sh/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef __ASM_SH_DMA_MAPPING_H
-#define __ASM_SH_DMA_MAPPING_H
-
-extern const struct dma_map_ops nommu_dma_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-#ifdef CONFIG_DMA_NONCOHERENT
-	return &nommu_dma_ops;
-#else
-	return &dma_direct_ops;
-#endif
-}
-
-extern void *dma_generic_alloc_coherent(struct device *dev, size_t size,
-					dma_addr_t *dma_addr, gfp_t flag,
-					unsigned long attrs);
-extern void dma_generic_free_coherent(struct device *dev, size_t size,
-				      void *vaddr, dma_addr_t dma_handle,
-				      unsigned long attrs);
-
-void sh_sync_dma_for_device(void *vaddr, size_t size,
-	    enum dma_data_direction dir);
-
-#endif /* __ASM_SH_DMA_MAPPING_H */
diff --git a/arch/sh/kernel/Makefile b/arch/sh/kernel/Makefile
index cb5f1bfb52de..985106e13614 100644
--- a/arch/sh/kernel/Makefile
+++ b/arch/sh/kernel/Makefile
@@ -45,7 +45,6 @@ obj-$(CONFIG_DUMP_CODE)		+= disassemble.o
 obj-$(CONFIG_HIBERNATION)	+= swsusp.o
 obj-$(CONFIG_DWARF_UNWINDER)	+= dwarf.o
 obj-$(CONFIG_PERF_EVENTS)	+= perf_event.o perf_callchain.o
-obj-$(CONFIG_DMA_NONCOHERENT)	+= dma-nommu.o
 obj-$(CONFIG_HAVE_HW_BREAKPOINT)		+= hw_breakpoint.o
 
 ccflags-y := -Werror
diff --git a/arch/sh/kernel/dma-nommu.c b/arch/sh/kernel/dma-nommu.c
deleted file mode 100644
index 442922a9f8c0..000000000000
--- a/arch/sh/kernel/dma-nommu.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * DMA mapping support for platforms lacking IOMMUs.
- *
- * Copyright (C) 2009  Paul Mundt
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- */
-#include <linux/dma-mapping.h>
-#include <linux/io.h>
-#include <asm/cacheflush.h>
-
-static dma_addr_t nommu_map_page(struct device *dev, struct page *page,
-				 unsigned long offset, size_t size,
-				 enum dma_data_direction dir,
-				 unsigned long attrs)
-{
-	dma_addr_t addr = page_to_phys(page) + offset;
-
-	WARN_ON(size == 0);
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		sh_sync_dma_for_device(page_address(page) + offset, size, dir);
-
-	return addr;
-}
-
-static int nommu_map_sg(struct device *dev, struct scatterlist *sg,
-			int nents, enum dma_data_direction dir,
-			unsigned long attrs)
-{
-	struct scatterlist *s;
-	int i;
-
-	WARN_ON(nents == 0 || sg[0].length == 0);
-
-	for_each_sg(sg, s, nents, i) {
-		BUG_ON(!sg_page(s));
-
-		if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-			sh_sync_dma_for_device(sg_virt(s), s->length, dir);
-
-		s->dma_address = sg_phys(s);
-		s->dma_length = s->length;
-	}
-
-	return nents;
-}
-
-static void nommu_sync_single_for_device(struct device *dev, dma_addr_t addr,
-			      size_t size, enum dma_data_direction dir)
-{
-	sh_sync_dma_for_device(phys_to_virt(addr), size, dir);
-}
-
-static void nommu_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
-			  int nelems, enum dma_data_direction dir)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nelems, i)
-		sh_sync_dma_for_device(sg_virt(s), s->length, dir);
-}
-
-const struct dma_map_ops nommu_dma_ops = {
-	.alloc			= dma_generic_alloc_coherent,
-	.free			= dma_generic_free_coherent,
-	.map_page		= nommu_map_page,
-	.map_sg			= nommu_map_sg,
-	.sync_single_for_device	= nommu_sync_single_for_device,
-	.sync_sg_for_device	= nommu_sync_sg_for_device,
-};
-EXPORT_SYMBOL(nommu_dma_ops);
diff --git a/arch/sh/mm/consistent.c b/arch/sh/mm/consistent.c
index 516d481525e1..aaeeb74fdcc3 100644
--- a/arch/sh/mm/consistent.c
+++ b/arch/sh/mm/consistent.c
@@ -12,17 +12,15 @@
 #include <linux/mm.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
-#include <linux/dma-mapping.h>
-#include <linux/dma-debug.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/io.h>
 #include <linux/module.h>
 #include <linux/gfp.h>
 #include <asm/cacheflush.h>
 #include <asm/addrspace.h>
 
-void *dma_generic_alloc_coherent(struct device *dev, size_t size,
-				 dma_addr_t *dma_handle, gfp_t gfp,
-				 unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	void *ret, *ret_nocache;
 	int order = get_order(size);
@@ -37,7 +35,7 @@ void *dma_generic_alloc_coherent(struct device *dev, size_t size,
 	 * Pages from the page allocator may have data present in
 	 * cache. So flush the cache before using uncached memory.
 	 */
-	sh_sync_dma_for_device(ret, size, DMA_BIDIRECTIONAL);
+	__flush_purge_region(sh_cacheop_vaddr(ret), size);
 
 	ret_nocache = (void __force *)ioremap_nocache(virt_to_phys(ret), size);
 	if (!ret_nocache) {
@@ -52,9 +50,8 @@ void *dma_generic_alloc_coherent(struct device *dev, size_t size,
 	return ret_nocache;
 }
 
-void dma_generic_free_coherent(struct device *dev, size_t size,
-			       void *vaddr, dma_addr_t dma_handle,
-			       unsigned long attrs)
+void arch_dma_free(struct device *dev, size_t size, void *vaddr,
+		dma_addr_t dma_handle, unsigned long attrs)
 {
 	int order = get_order(size);
 	unsigned long pfn = dma_handle >> PAGE_SHIFT;
@@ -66,12 +63,12 @@ void dma_generic_free_coherent(struct device *dev, size_t size,
 	iounmap(vaddr);
 }
 
-void sh_sync_dma_for_device(void *vaddr, size_t size,
-		    enum dma_data_direction direction)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	void *addr = sh_cacheop_vaddr(vaddr);
+	void *addr = sh_cacheop_vaddr(phys_to_virt(paddr));
 
-	switch (direction) {
+	switch (dir) {
 	case DMA_FROM_DEVICE:		/* invalidate only */
 		__flush_invalidate_region(addr, size);
 		break;
@@ -85,7 +82,6 @@ void sh_sync_dma_for_device(void *vaddr, size_t size,
 		BUG();
 	}
 }
-EXPORT_SYMBOL(sh_sync_dma_for_device);
 
 static int __init memchunk_setup(char *str)
 {
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 19/22] sh: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Switch to the generic noncoherent direct mapping implementation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/sh/Kconfig                   |  3 +-
 arch/sh/include/asm/Kbuild        |  1 +
 arch/sh/include/asm/dma-mapping.h | 26 -----------
 arch/sh/kernel/Makefile           |  1 -
 arch/sh/kernel/dma-nommu.c        | 75 -------------------------------
 arch/sh/mm/consistent.c           | 24 +++++-----
 6 files changed, 13 insertions(+), 117 deletions(-)
 delete mode 100644 arch/sh/include/asm/dma-mapping.h
 delete mode 100644 arch/sh/kernel/dma-nommu.c

diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 23e7432302b0..23ed245407b1 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -50,7 +50,6 @@ config SUPERH
 	select HAVE_ARCH_AUDITSYSCALL
 	select HAVE_FUTEX_CMPXCHG if FUTEX
 	select HAVE_NMI
-	select NEED_DMA_MAP_STATE
 	select NEED_SG_DMA_LENGTH
 
 	help
@@ -163,6 +162,8 @@ config DMA_COHERENT
 
 config DMA_NONCOHERENT
 	def_bool !DMA_COHERENT
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
+	select DMA_NONCOHERENT_OPS
 
 config PGTABLE_LEVELS
 	default 3 if X2TLB
diff --git a/arch/sh/include/asm/Kbuild b/arch/sh/include/asm/Kbuild
index 1efcce74997b..50f7e878ea1b 100644
--- a/arch/sh/include/asm/Kbuild
+++ b/arch/sh/include/asm/Kbuild
@@ -1,6 +1,7 @@
 generic-y += current.h
 generic-y += delay.h
 generic-y += div64.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += exec.h
 generic-y += irq_regs.h
diff --git a/arch/sh/include/asm/dma-mapping.h b/arch/sh/include/asm/dma-mapping.h
deleted file mode 100644
index 1ebc6a4eb1c5..000000000000
--- a/arch/sh/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef __ASM_SH_DMA_MAPPING_H
-#define __ASM_SH_DMA_MAPPING_H
-
-extern const struct dma_map_ops nommu_dma_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-#ifdef CONFIG_DMA_NONCOHERENT
-	return &nommu_dma_ops;
-#else
-	return &dma_direct_ops;
-#endif
-}
-
-extern void *dma_generic_alloc_coherent(struct device *dev, size_t size,
-					dma_addr_t *dma_addr, gfp_t flag,
-					unsigned long attrs);
-extern void dma_generic_free_coherent(struct device *dev, size_t size,
-				      void *vaddr, dma_addr_t dma_handle,
-				      unsigned long attrs);
-
-void sh_sync_dma_for_device(void *vaddr, size_t size,
-	    enum dma_data_direction dir);
-
-#endif /* __ASM_SH_DMA_MAPPING_H */
diff --git a/arch/sh/kernel/Makefile b/arch/sh/kernel/Makefile
index cb5f1bfb52de..985106e13614 100644
--- a/arch/sh/kernel/Makefile
+++ b/arch/sh/kernel/Makefile
@@ -45,7 +45,6 @@ obj-$(CONFIG_DUMP_CODE)		+= disassemble.o
 obj-$(CONFIG_HIBERNATION)	+= swsusp.o
 obj-$(CONFIG_DWARF_UNWINDER)	+= dwarf.o
 obj-$(CONFIG_PERF_EVENTS)	+= perf_event.o perf_callchain.o
-obj-$(CONFIG_DMA_NONCOHERENT)	+= dma-nommu.o
 obj-$(CONFIG_HAVE_HW_BREAKPOINT)		+= hw_breakpoint.o
 
 ccflags-y := -Werror
diff --git a/arch/sh/kernel/dma-nommu.c b/arch/sh/kernel/dma-nommu.c
deleted file mode 100644
index 442922a9f8c0..000000000000
--- a/arch/sh/kernel/dma-nommu.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * DMA mapping support for platforms lacking IOMMUs.
- *
- * Copyright (C) 2009  Paul Mundt
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- */
-#include <linux/dma-mapping.h>
-#include <linux/io.h>
-#include <asm/cacheflush.h>
-
-static dma_addr_t nommu_map_page(struct device *dev, struct page *page,
-				 unsigned long offset, size_t size,
-				 enum dma_data_direction dir,
-				 unsigned long attrs)
-{
-	dma_addr_t addr = page_to_phys(page) + offset;
-
-	WARN_ON(size = 0);
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		sh_sync_dma_for_device(page_address(page) + offset, size, dir);
-
-	return addr;
-}
-
-static int nommu_map_sg(struct device *dev, struct scatterlist *sg,
-			int nents, enum dma_data_direction dir,
-			unsigned long attrs)
-{
-	struct scatterlist *s;
-	int i;
-
-	WARN_ON(nents = 0 || sg[0].length = 0);
-
-	for_each_sg(sg, s, nents, i) {
-		BUG_ON(!sg_page(s));
-
-		if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-			sh_sync_dma_for_device(sg_virt(s), s->length, dir);
-
-		s->dma_address = sg_phys(s);
-		s->dma_length = s->length;
-	}
-
-	return nents;
-}
-
-static void nommu_sync_single_for_device(struct device *dev, dma_addr_t addr,
-			      size_t size, enum dma_data_direction dir)
-{
-	sh_sync_dma_for_device(phys_to_virt(addr), size, dir);
-}
-
-static void nommu_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
-			  int nelems, enum dma_data_direction dir)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nelems, i)
-		sh_sync_dma_for_device(sg_virt(s), s->length, dir);
-}
-
-const struct dma_map_ops nommu_dma_ops = {
-	.alloc			= dma_generic_alloc_coherent,
-	.free			= dma_generic_free_coherent,
-	.map_page		= nommu_map_page,
-	.map_sg			= nommu_map_sg,
-	.sync_single_for_device	= nommu_sync_single_for_device,
-	.sync_sg_for_device	= nommu_sync_sg_for_device,
-};
-EXPORT_SYMBOL(nommu_dma_ops);
diff --git a/arch/sh/mm/consistent.c b/arch/sh/mm/consistent.c
index 516d481525e1..aaeeb74fdcc3 100644
--- a/arch/sh/mm/consistent.c
+++ b/arch/sh/mm/consistent.c
@@ -12,17 +12,15 @@
 #include <linux/mm.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
-#include <linux/dma-mapping.h>
-#include <linux/dma-debug.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/io.h>
 #include <linux/module.h>
 #include <linux/gfp.h>
 #include <asm/cacheflush.h>
 #include <asm/addrspace.h>
 
-void *dma_generic_alloc_coherent(struct device *dev, size_t size,
-				 dma_addr_t *dma_handle, gfp_t gfp,
-				 unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	void *ret, *ret_nocache;
 	int order = get_order(size);
@@ -37,7 +35,7 @@ void *dma_generic_alloc_coherent(struct device *dev, size_t size,
 	 * Pages from the page allocator may have data present in
 	 * cache. So flush the cache before using uncached memory.
 	 */
-	sh_sync_dma_for_device(ret, size, DMA_BIDIRECTIONAL);
+	__flush_purge_region(sh_cacheop_vaddr(ret), size);
 
 	ret_nocache = (void __force *)ioremap_nocache(virt_to_phys(ret), size);
 	if (!ret_nocache) {
@@ -52,9 +50,8 @@ void *dma_generic_alloc_coherent(struct device *dev, size_t size,
 	return ret_nocache;
 }
 
-void dma_generic_free_coherent(struct device *dev, size_t size,
-			       void *vaddr, dma_addr_t dma_handle,
-			       unsigned long attrs)
+void arch_dma_free(struct device *dev, size_t size, void *vaddr,
+		dma_addr_t dma_handle, unsigned long attrs)
 {
 	int order = get_order(size);
 	unsigned long pfn = dma_handle >> PAGE_SHIFT;
@@ -66,12 +63,12 @@ void dma_generic_free_coherent(struct device *dev, size_t size,
 	iounmap(vaddr);
 }
 
-void sh_sync_dma_for_device(void *vaddr, size_t size,
-		    enum dma_data_direction direction)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	void *addr = sh_cacheop_vaddr(vaddr);
+	void *addr = sh_cacheop_vaddr(phys_to_virt(paddr));
 
-	switch (direction) {
+	switch (dir) {
 	case DMA_FROM_DEVICE:		/* invalidate only */
 		__flush_invalidate_region(addr, size);
 		break;
@@ -85,7 +82,6 @@ void sh_sync_dma_for_device(void *vaddr, size_t size,
 		BUG();
 	}
 }
-EXPORT_SYMBOL(sh_sync_dma_for_device);
 
 static int __init memchunk_setup(char *str)
 {
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [OpenRISC] [PATCH 19/22] sh: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  To: openrisc

Switch to the generic noncoherent direct mapping implementation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/sh/Kconfig                   |  3 +-
 arch/sh/include/asm/Kbuild        |  1 +
 arch/sh/include/asm/dma-mapping.h | 26 -----------
 arch/sh/kernel/Makefile           |  1 -
 arch/sh/kernel/dma-nommu.c        | 75 -------------------------------
 arch/sh/mm/consistent.c           | 24 +++++-----
 6 files changed, 13 insertions(+), 117 deletions(-)
 delete mode 100644 arch/sh/include/asm/dma-mapping.h
 delete mode 100644 arch/sh/kernel/dma-nommu.c

diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 23e7432302b0..23ed245407b1 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -50,7 +50,6 @@ config SUPERH
 	select HAVE_ARCH_AUDITSYSCALL
 	select HAVE_FUTEX_CMPXCHG if FUTEX
 	select HAVE_NMI
-	select NEED_DMA_MAP_STATE
 	select NEED_SG_DMA_LENGTH
 
 	help
@@ -163,6 +162,8 @@ config DMA_COHERENT
 
 config DMA_NONCOHERENT
 	def_bool !DMA_COHERENT
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
+	select DMA_NONCOHERENT_OPS
 
 config PGTABLE_LEVELS
 	default 3 if X2TLB
diff --git a/arch/sh/include/asm/Kbuild b/arch/sh/include/asm/Kbuild
index 1efcce74997b..50f7e878ea1b 100644
--- a/arch/sh/include/asm/Kbuild
+++ b/arch/sh/include/asm/Kbuild
@@ -1,6 +1,7 @@
 generic-y += current.h
 generic-y += delay.h
 generic-y += div64.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += exec.h
 generic-y += irq_regs.h
diff --git a/arch/sh/include/asm/dma-mapping.h b/arch/sh/include/asm/dma-mapping.h
deleted file mode 100644
index 1ebc6a4eb1c5..000000000000
--- a/arch/sh/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef __ASM_SH_DMA_MAPPING_H
-#define __ASM_SH_DMA_MAPPING_H
-
-extern const struct dma_map_ops nommu_dma_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-#ifdef CONFIG_DMA_NONCOHERENT
-	return &nommu_dma_ops;
-#else
-	return &dma_direct_ops;
-#endif
-}
-
-extern void *dma_generic_alloc_coherent(struct device *dev, size_t size,
-					dma_addr_t *dma_addr, gfp_t flag,
-					unsigned long attrs);
-extern void dma_generic_free_coherent(struct device *dev, size_t size,
-				      void *vaddr, dma_addr_t dma_handle,
-				      unsigned long attrs);
-
-void sh_sync_dma_for_device(void *vaddr, size_t size,
-	    enum dma_data_direction dir);
-
-#endif /* __ASM_SH_DMA_MAPPING_H */
diff --git a/arch/sh/kernel/Makefile b/arch/sh/kernel/Makefile
index cb5f1bfb52de..985106e13614 100644
--- a/arch/sh/kernel/Makefile
+++ b/arch/sh/kernel/Makefile
@@ -45,7 +45,6 @@ obj-$(CONFIG_DUMP_CODE)		+= disassemble.o
 obj-$(CONFIG_HIBERNATION)	+= swsusp.o
 obj-$(CONFIG_DWARF_UNWINDER)	+= dwarf.o
 obj-$(CONFIG_PERF_EVENTS)	+= perf_event.o perf_callchain.o
-obj-$(CONFIG_DMA_NONCOHERENT)	+= dma-nommu.o
 obj-$(CONFIG_HAVE_HW_BREAKPOINT)		+= hw_breakpoint.o
 
 ccflags-y := -Werror
diff --git a/arch/sh/kernel/dma-nommu.c b/arch/sh/kernel/dma-nommu.c
deleted file mode 100644
index 442922a9f8c0..000000000000
--- a/arch/sh/kernel/dma-nommu.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * DMA mapping support for platforms lacking IOMMUs.
- *
- * Copyright (C) 2009  Paul Mundt
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- */
-#include <linux/dma-mapping.h>
-#include <linux/io.h>
-#include <asm/cacheflush.h>
-
-static dma_addr_t nommu_map_page(struct device *dev, struct page *page,
-				 unsigned long offset, size_t size,
-				 enum dma_data_direction dir,
-				 unsigned long attrs)
-{
-	dma_addr_t addr = page_to_phys(page) + offset;
-
-	WARN_ON(size == 0);
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		sh_sync_dma_for_device(page_address(page) + offset, size, dir);
-
-	return addr;
-}
-
-static int nommu_map_sg(struct device *dev, struct scatterlist *sg,
-			int nents, enum dma_data_direction dir,
-			unsigned long attrs)
-{
-	struct scatterlist *s;
-	int i;
-
-	WARN_ON(nents == 0 || sg[0].length == 0);
-
-	for_each_sg(sg, s, nents, i) {
-		BUG_ON(!sg_page(s));
-
-		if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-			sh_sync_dma_for_device(sg_virt(s), s->length, dir);
-
-		s->dma_address = sg_phys(s);
-		s->dma_length = s->length;
-	}
-
-	return nents;
-}
-
-static void nommu_sync_single_for_device(struct device *dev, dma_addr_t addr,
-			      size_t size, enum dma_data_direction dir)
-{
-	sh_sync_dma_for_device(phys_to_virt(addr), size, dir);
-}
-
-static void nommu_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
-			  int nelems, enum dma_data_direction dir)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nelems, i)
-		sh_sync_dma_for_device(sg_virt(s), s->length, dir);
-}
-
-const struct dma_map_ops nommu_dma_ops = {
-	.alloc			= dma_generic_alloc_coherent,
-	.free			= dma_generic_free_coherent,
-	.map_page		= nommu_map_page,
-	.map_sg			= nommu_map_sg,
-	.sync_single_for_device	= nommu_sync_single_for_device,
-	.sync_sg_for_device	= nommu_sync_sg_for_device,
-};
-EXPORT_SYMBOL(nommu_dma_ops);
diff --git a/arch/sh/mm/consistent.c b/arch/sh/mm/consistent.c
index 516d481525e1..aaeeb74fdcc3 100644
--- a/arch/sh/mm/consistent.c
+++ b/arch/sh/mm/consistent.c
@@ -12,17 +12,15 @@
 #include <linux/mm.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
-#include <linux/dma-mapping.h>
-#include <linux/dma-debug.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/io.h>
 #include <linux/module.h>
 #include <linux/gfp.h>
 #include <asm/cacheflush.h>
 #include <asm/addrspace.h>
 
-void *dma_generic_alloc_coherent(struct device *dev, size_t size,
-				 dma_addr_t *dma_handle, gfp_t gfp,
-				 unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	void *ret, *ret_nocache;
 	int order = get_order(size);
@@ -37,7 +35,7 @@ void *dma_generic_alloc_coherent(struct device *dev, size_t size,
 	 * Pages from the page allocator may have data present in
 	 * cache. So flush the cache before using uncached memory.
 	 */
-	sh_sync_dma_for_device(ret, size, DMA_BIDIRECTIONAL);
+	__flush_purge_region(sh_cacheop_vaddr(ret), size);
 
 	ret_nocache = (void __force *)ioremap_nocache(virt_to_phys(ret), size);
 	if (!ret_nocache) {
@@ -52,9 +50,8 @@ void *dma_generic_alloc_coherent(struct device *dev, size_t size,
 	return ret_nocache;
 }
 
-void dma_generic_free_coherent(struct device *dev, size_t size,
-			       void *vaddr, dma_addr_t dma_handle,
-			       unsigned long attrs)
+void arch_dma_free(struct device *dev, size_t size, void *vaddr,
+		dma_addr_t dma_handle, unsigned long attrs)
 {
 	int order = get_order(size);
 	unsigned long pfn = dma_handle >> PAGE_SHIFT;
@@ -66,12 +63,12 @@ void dma_generic_free_coherent(struct device *dev, size_t size,
 	iounmap(vaddr);
 }
 
-void sh_sync_dma_for_device(void *vaddr, size_t size,
-		    enum dma_data_direction direction)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	void *addr = sh_cacheop_vaddr(vaddr);
+	void *addr = sh_cacheop_vaddr(phys_to_virt(paddr));
 
-	switch (direction) {
+	switch (dir) {
 	case DMA_FROM_DEVICE:		/* invalidate only */
 		__flush_invalidate_region(addr, size);
 		break;
@@ -85,7 +82,6 @@ void sh_sync_dma_for_device(void *vaddr, size_t size,
 		BUG();
 	}
 }
-EXPORT_SYMBOL(sh_sync_dma_for_device);
 
 static int __init memchunk_setup(char *str)
 {
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 19/22] sh: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  To: linux-arm-kernel

Switch to the generic noncoherent direct mapping implementation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/sh/Kconfig                   |  3 +-
 arch/sh/include/asm/Kbuild        |  1 +
 arch/sh/include/asm/dma-mapping.h | 26 -----------
 arch/sh/kernel/Makefile           |  1 -
 arch/sh/kernel/dma-nommu.c        | 75 -------------------------------
 arch/sh/mm/consistent.c           | 24 +++++-----
 6 files changed, 13 insertions(+), 117 deletions(-)
 delete mode 100644 arch/sh/include/asm/dma-mapping.h
 delete mode 100644 arch/sh/kernel/dma-nommu.c

diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 23e7432302b0..23ed245407b1 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -50,7 +50,6 @@ config SUPERH
 	select HAVE_ARCH_AUDITSYSCALL
 	select HAVE_FUTEX_CMPXCHG if FUTEX
 	select HAVE_NMI
-	select NEED_DMA_MAP_STATE
 	select NEED_SG_DMA_LENGTH
 
 	help
@@ -163,6 +162,8 @@ config DMA_COHERENT
 
 config DMA_NONCOHERENT
 	def_bool !DMA_COHERENT
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
+	select DMA_NONCOHERENT_OPS
 
 config PGTABLE_LEVELS
 	default 3 if X2TLB
diff --git a/arch/sh/include/asm/Kbuild b/arch/sh/include/asm/Kbuild
index 1efcce74997b..50f7e878ea1b 100644
--- a/arch/sh/include/asm/Kbuild
+++ b/arch/sh/include/asm/Kbuild
@@ -1,6 +1,7 @@
 generic-y += current.h
 generic-y += delay.h
 generic-y += div64.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += exec.h
 generic-y += irq_regs.h
diff --git a/arch/sh/include/asm/dma-mapping.h b/arch/sh/include/asm/dma-mapping.h
deleted file mode 100644
index 1ebc6a4eb1c5..000000000000
--- a/arch/sh/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 */
-#ifndef __ASM_SH_DMA_MAPPING_H
-#define __ASM_SH_DMA_MAPPING_H
-
-extern const struct dma_map_ops nommu_dma_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-#ifdef CONFIG_DMA_NONCOHERENT
-	return &nommu_dma_ops;
-#else
-	return &dma_direct_ops;
-#endif
-}
-
-extern void *dma_generic_alloc_coherent(struct device *dev, size_t size,
-					dma_addr_t *dma_addr, gfp_t flag,
-					unsigned long attrs);
-extern void dma_generic_free_coherent(struct device *dev, size_t size,
-				      void *vaddr, dma_addr_t dma_handle,
-				      unsigned long attrs);
-
-void sh_sync_dma_for_device(void *vaddr, size_t size,
-	    enum dma_data_direction dir);
-
-#endif /* __ASM_SH_DMA_MAPPING_H */
diff --git a/arch/sh/kernel/Makefile b/arch/sh/kernel/Makefile
index cb5f1bfb52de..985106e13614 100644
--- a/arch/sh/kernel/Makefile
+++ b/arch/sh/kernel/Makefile
@@ -45,7 +45,6 @@ obj-$(CONFIG_DUMP_CODE)		+= disassemble.o
 obj-$(CONFIG_HIBERNATION)	+= swsusp.o
 obj-$(CONFIG_DWARF_UNWINDER)	+= dwarf.o
 obj-$(CONFIG_PERF_EVENTS)	+= perf_event.o perf_callchain.o
-obj-$(CONFIG_DMA_NONCOHERENT)	+= dma-nommu.o
 obj-$(CONFIG_HAVE_HW_BREAKPOINT)		+= hw_breakpoint.o
 
 ccflags-y := -Werror
diff --git a/arch/sh/kernel/dma-nommu.c b/arch/sh/kernel/dma-nommu.c
deleted file mode 100644
index 442922a9f8c0..000000000000
--- a/arch/sh/kernel/dma-nommu.c
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * DMA mapping support for platforms lacking IOMMUs.
- *
- * Copyright (C) 2009  Paul Mundt
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- */
-#include <linux/dma-mapping.h>
-#include <linux/io.h>
-#include <asm/cacheflush.h>
-
-static dma_addr_t nommu_map_page(struct device *dev, struct page *page,
-				 unsigned long offset, size_t size,
-				 enum dma_data_direction dir,
-				 unsigned long attrs)
-{
-	dma_addr_t addr = page_to_phys(page) + offset;
-
-	WARN_ON(size == 0);
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		sh_sync_dma_for_device(page_address(page) + offset, size, dir);
-
-	return addr;
-}
-
-static int nommu_map_sg(struct device *dev, struct scatterlist *sg,
-			int nents, enum dma_data_direction dir,
-			unsigned long attrs)
-{
-	struct scatterlist *s;
-	int i;
-
-	WARN_ON(nents == 0 || sg[0].length == 0);
-
-	for_each_sg(sg, s, nents, i) {
-		BUG_ON(!sg_page(s));
-
-		if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-			sh_sync_dma_for_device(sg_virt(s), s->length, dir);
-
-		s->dma_address = sg_phys(s);
-		s->dma_length = s->length;
-	}
-
-	return nents;
-}
-
-static void nommu_sync_single_for_device(struct device *dev, dma_addr_t addr,
-			      size_t size, enum dma_data_direction dir)
-{
-	sh_sync_dma_for_device(phys_to_virt(addr), size, dir);
-}
-
-static void nommu_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
-			  int nelems, enum dma_data_direction dir)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nelems, i)
-		sh_sync_dma_for_device(sg_virt(s), s->length, dir);
-}
-
-const struct dma_map_ops nommu_dma_ops = {
-	.alloc			= dma_generic_alloc_coherent,
-	.free			= dma_generic_free_coherent,
-	.map_page		= nommu_map_page,
-	.map_sg			= nommu_map_sg,
-	.sync_single_for_device	= nommu_sync_single_for_device,
-	.sync_sg_for_device	= nommu_sync_sg_for_device,
-};
-EXPORT_SYMBOL(nommu_dma_ops);
diff --git a/arch/sh/mm/consistent.c b/arch/sh/mm/consistent.c
index 516d481525e1..aaeeb74fdcc3 100644
--- a/arch/sh/mm/consistent.c
+++ b/arch/sh/mm/consistent.c
@@ -12,17 +12,15 @@
 #include <linux/mm.h>
 #include <linux/init.h>
 #include <linux/platform_device.h>
-#include <linux/dma-mapping.h>
-#include <linux/dma-debug.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/io.h>
 #include <linux/module.h>
 #include <linux/gfp.h>
 #include <asm/cacheflush.h>
 #include <asm/addrspace.h>
 
-void *dma_generic_alloc_coherent(struct device *dev, size_t size,
-				 dma_addr_t *dma_handle, gfp_t gfp,
-				 unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	void *ret, *ret_nocache;
 	int order = get_order(size);
@@ -37,7 +35,7 @@ void *dma_generic_alloc_coherent(struct device *dev, size_t size,
 	 * Pages from the page allocator may have data present in
 	 * cache. So flush the cache before using uncached memory.
 	 */
-	sh_sync_dma_for_device(ret, size, DMA_BIDIRECTIONAL);
+	__flush_purge_region(sh_cacheop_vaddr(ret), size);
 
 	ret_nocache = (void __force *)ioremap_nocache(virt_to_phys(ret), size);
 	if (!ret_nocache) {
@@ -52,9 +50,8 @@ void *dma_generic_alloc_coherent(struct device *dev, size_t size,
 	return ret_nocache;
 }
 
-void dma_generic_free_coherent(struct device *dev, size_t size,
-			       void *vaddr, dma_addr_t dma_handle,
-			       unsigned long attrs)
+void arch_dma_free(struct device *dev, size_t size, void *vaddr,
+		dma_addr_t dma_handle, unsigned long attrs)
 {
 	int order = get_order(size);
 	unsigned long pfn = dma_handle >> PAGE_SHIFT;
@@ -66,12 +63,12 @@ void dma_generic_free_coherent(struct device *dev, size_t size,
 	iounmap(vaddr);
 }
 
-void sh_sync_dma_for_device(void *vaddr, size_t size,
-		    enum dma_data_direction direction)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	void *addr = sh_cacheop_vaddr(vaddr);
+	void *addr = sh_cacheop_vaddr(phys_to_virt(paddr));
 
-	switch (direction) {
+	switch (dir) {
 	case DMA_FROM_DEVICE:		/* invalidate only */
 		__flush_invalidate_region(addr, size);
 		break;
@@ -85,7 +82,6 @@ void sh_sync_dma_for_device(void *vaddr, size_t size,
 		BUG();
 	}
 }
-EXPORT_SYMBOL(sh_sync_dma_for_device);
 
 static int __init memchunk_setup(char *str)
 {
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 20/22] xtensa: use generic dma_noncoherent_ops
  2018-04-20  8:02 ` Christoph Hellwig
                     ` (4 preceding siblings ...)
  (?)
@ 2018-04-20  8:03   ` Christoph Hellwig
  -1 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Switch to the generic noncoherent direct mapping implementation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/xtensa/Kconfig                   |   3 +
 arch/xtensa/include/asm/Kbuild        |   1 +
 arch/xtensa/include/asm/dma-mapping.h |  26 ------
 arch/xtensa/kernel/pci-dma.c          | 130 +++-----------------------
 4 files changed, 19 insertions(+), 141 deletions(-)
 delete mode 100644 arch/xtensa/include/asm/dma-mapping.h

diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
index c921e8bccdc8..6035845f30a7 100644
--- a/arch/xtensa/Kconfig
+++ b/arch/xtensa/Kconfig
@@ -5,11 +5,14 @@ config ZONE_DMA
 config XTENSA
 	def_bool y
 	select ARCH_NO_COHERENT_DMA_MMAP if !MMU
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select ARCH_WANT_FRAME_POINTERS
 	select ARCH_WANT_IPC_PARSE_VERSION
 	select BUILDTIME_EXTABLE_SORT
 	select CLONE_BACKWARDS
 	select COMMON_CLK
+	select DMA_NONCOHERENT_OPS
 	select GENERIC_ATOMIC64
 	select GENERIC_CLOCKEVENTS
 	select GENERIC_IRQ_SHOW
diff --git a/arch/xtensa/include/asm/Kbuild b/arch/xtensa/include/asm/Kbuild
index 436b20337168..a8d6cd3bee4b 100644
--- a/arch/xtensa/include/asm/Kbuild
+++ b/arch/xtensa/include/asm/Kbuild
@@ -2,6 +2,7 @@ generic-y += bug.h
 generic-y += device.h
 generic-y += div64.h
 generic-y += dma-contiguous.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += exec.h
 generic-y += extable.h
diff --git a/arch/xtensa/include/asm/dma-mapping.h b/arch/xtensa/include/asm/dma-mapping.h
deleted file mode 100644
index 44098800dad7..000000000000
--- a/arch/xtensa/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 2003 - 2005 Tensilica Inc.
- * Copyright (C) 2015 Cadence Design Systems Inc.
- */
-
-#ifndef _XTENSA_DMA_MAPPING_H
-#define _XTENSA_DMA_MAPPING_H
-
-#include <asm/cache.h>
-#include <asm/io.h>
-
-#include <linux/mm.h>
-#include <linux/scatterlist.h>
-
-extern const struct dma_map_ops xtensa_dma_map_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return &xtensa_dma_map_ops;
-}
-
-#endif	/* _XTENSA_DMA_MAPPING_H */
diff --git a/arch/xtensa/kernel/pci-dma.c b/arch/xtensa/kernel/pci-dma.c
index 392b4a80ebc2..a83d60e92908 100644
--- a/arch/xtensa/kernel/pci-dma.c
+++ b/arch/xtensa/kernel/pci-dma.c
@@ -16,26 +16,24 @@
  */
 
 #include <linux/dma-contiguous.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/dma-direct.h>
 #include <linux/gfp.h>
 #include <linux/highmem.h>
 #include <linux/mm.h>
-#include <linux/module.h>
-#include <linux/pci.h>
-#include <linux/string.h>
 #include <linux/types.h>
 #include <asm/cacheflush.h>
 #include <asm/io.h>
 
-static void do_cache_op(dma_addr_t dma_handle, size_t size,
+static void do_cache_op(phys_addr_t paddr, size_t size,
 			void (*fn)(unsigned long, unsigned long))
 {
-	unsigned long off = dma_handle & (PAGE_SIZE - 1);
-	unsigned long pfn = PFN_DOWN(dma_handle);
+	unsigned long off = paddr & (PAGE_SIZE - 1);
+	unsigned long pfn = PFN_DOWN(paddr);
 	struct page *page = pfn_to_page(pfn);
 
 	if (!PageHighMem(page))
-		fn((unsigned long)bus_to_virt(dma_handle), size);
+		fn((unsigned long)phys_to_virt(paddr), size);
 	else
 		while (size > 0) {
 			size_t sz = min_t(size_t, size, PAGE_SIZE - off);
@@ -49,14 +47,13 @@ static void do_cache_op(dma_addr_t dma_handle, size_t size,
 		}
 }
 
-static void xtensa_sync_single_for_cpu(struct device *dev,
-				       dma_addr_t dma_handle, size_t size,
-				       enum dma_data_direction dir)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
 	switch (dir) {
 	case DMA_BIDIRECTIONAL:
 	case DMA_FROM_DEVICE:
-		do_cache_op(dma_handle, size, __invalidate_dcache_range);
+		do_cache_op(paddr, size, __invalidate_dcache_range);
 		break;
 
 	case DMA_NONE:
@@ -68,15 +65,14 @@ static void xtensa_sync_single_for_cpu(struct device *dev,
 	}
 }
 
-static void xtensa_sync_single_for_device(struct device *dev,
-					  dma_addr_t dma_handle, size_t size,
-					  enum dma_data_direction dir)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
 	switch (dir) {
 	case DMA_BIDIRECTIONAL:
 	case DMA_TO_DEVICE:
 		if (XCHAL_DCACHE_IS_WRITEBACK)
-			do_cache_op(dma_handle, size, __flush_dcache_range);
+			do_cache_op(paddr, size, __flush_dcache_range);
 		break;
 
 	case DMA_NONE:
@@ -88,40 +84,13 @@ static void xtensa_sync_single_for_device(struct device *dev,
 	}
 }
 
-static void xtensa_sync_sg_for_cpu(struct device *dev,
-				   struct scatterlist *sg, int nents,
-				   enum dma_data_direction dir)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nents, i) {
-		xtensa_sync_single_for_cpu(dev, sg_dma_address(s),
-					   sg_dma_len(s), dir);
-	}
-}
-
-static void xtensa_sync_sg_for_device(struct device *dev,
-				      struct scatterlist *sg, int nents,
-				      enum dma_data_direction dir)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nents, i) {
-		xtensa_sync_single_for_device(dev, sg_dma_address(s),
-					      sg_dma_len(s), dir);
-	}
-}
-
 /*
  * Note: We assume that the full memory space is always mapped to 'kseg'
  *	 Otherwise we have to use page attributes (not implemented).
  */
 
-static void *xtensa_dma_alloc(struct device *dev, size_t size,
-			      dma_addr_t *handle, gfp_t flag,
-			      unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
+		gfp_t flag, unsigned long attrs)
 {
 	unsigned long ret;
 	unsigned long uncached;
@@ -171,8 +140,8 @@ static void *xtensa_dma_alloc(struct device *dev, size_t size,
 	return (void *)uncached;
 }
 
-static void xtensa_dma_free(struct device *dev, size_t size, void *vaddr,
-			    dma_addr_t dma_handle, unsigned long attrs)
+void arch_dma_free(struct device *dev, size_t size, void *vaddr,
+		dma_addr_t dma_handle, unsigned long attrs)
 {
 	unsigned long count = PAGE_ALIGN(size) >> PAGE_SHIFT;
 	unsigned long addr = (unsigned long)vaddr;
@@ -192,72 +161,3 @@ static void xtensa_dma_free(struct device *dev, size_t size, void *vaddr,
 	if (!dma_release_from_contiguous(dev, page, count))
 		__free_pages(page, get_order(size));
 }
-
-static dma_addr_t xtensa_map_page(struct device *dev, struct page *page,
-				  unsigned long offset, size_t size,
-				  enum dma_data_direction dir,
-				  unsigned long attrs)
-{
-	dma_addr_t dma_handle = page_to_phys(page) + offset;
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		xtensa_sync_single_for_device(dev, dma_handle, size, dir);
-
-	return dma_handle;
-}
-
-static void xtensa_unmap_page(struct device *dev, dma_addr_t dma_handle,
-			      size_t size, enum dma_data_direction dir,
-			      unsigned long attrs)
-{
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		xtensa_sync_single_for_cpu(dev, dma_handle, size, dir);
-}
-
-static int xtensa_map_sg(struct device *dev, struct scatterlist *sg,
-			 int nents, enum dma_data_direction dir,
-			 unsigned long attrs)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nents, i) {
-		s->dma_address = xtensa_map_page(dev, sg_page(s), s->offset,
-						 s->length, dir, attrs);
-	}
-	return nents;
-}
-
-static void xtensa_unmap_sg(struct device *dev,
-			    struct scatterlist *sg, int nents,
-			    enum dma_data_direction dir,
-			    unsigned long attrs)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nents, i) {
-		xtensa_unmap_page(dev, sg_dma_address(s),
-				  sg_dma_len(s), dir, attrs);
-	}
-}
-
-int xtensa_dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
-{
-	return 0;
-}
-
-const struct dma_map_ops xtensa_dma_map_ops = {
-	.alloc = xtensa_dma_alloc,
-	.free = xtensa_dma_free,
-	.map_page = xtensa_map_page,
-	.unmap_page = xtensa_unmap_page,
-	.map_sg = xtensa_map_sg,
-	.unmap_sg = xtensa_unmap_sg,
-	.sync_single_for_cpu = xtensa_sync_single_for_cpu,
-	.sync_single_for_device = xtensa_sync_single_for_device,
-	.sync_sg_for_cpu = xtensa_sync_sg_for_cpu,
-	.sync_sg_for_device = xtensa_sync_sg_for_device,
-	.mapping_error = xtensa_dma_mapping_error,
-};
-EXPORT_SYMBOL(xtensa_dma_map_ops);
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 20/22] xtensa: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Switch to the generic noncoherent direct mapping implementation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/xtensa/Kconfig                   |   3 +
 arch/xtensa/include/asm/Kbuild        |   1 +
 arch/xtensa/include/asm/dma-mapping.h |  26 ------
 arch/xtensa/kernel/pci-dma.c          | 130 +++-----------------------
 4 files changed, 19 insertions(+), 141 deletions(-)
 delete mode 100644 arch/xtensa/include/asm/dma-mapping.h

diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
index c921e8bccdc8..6035845f30a7 100644
--- a/arch/xtensa/Kconfig
+++ b/arch/xtensa/Kconfig
@@ -5,11 +5,14 @@ config ZONE_DMA
 config XTENSA
 	def_bool y
 	select ARCH_NO_COHERENT_DMA_MMAP if !MMU
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select ARCH_WANT_FRAME_POINTERS
 	select ARCH_WANT_IPC_PARSE_VERSION
 	select BUILDTIME_EXTABLE_SORT
 	select CLONE_BACKWARDS
 	select COMMON_CLK
+	select DMA_NONCOHERENT_OPS
 	select GENERIC_ATOMIC64
 	select GENERIC_CLOCKEVENTS
 	select GENERIC_IRQ_SHOW
diff --git a/arch/xtensa/include/asm/Kbuild b/arch/xtensa/include/asm/Kbuild
index 436b20337168..a8d6cd3bee4b 100644
--- a/arch/xtensa/include/asm/Kbuild
+++ b/arch/xtensa/include/asm/Kbuild
@@ -2,6 +2,7 @@ generic-y += bug.h
 generic-y += device.h
 generic-y += div64.h
 generic-y += dma-contiguous.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += exec.h
 generic-y += extable.h
diff --git a/arch/xtensa/include/asm/dma-mapping.h b/arch/xtensa/include/asm/dma-mapping.h
deleted file mode 100644
index 44098800dad7..000000000000
--- a/arch/xtensa/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 2003 - 2005 Tensilica Inc.
- * Copyright (C) 2015 Cadence Design Systems Inc.
- */
-
-#ifndef _XTENSA_DMA_MAPPING_H
-#define _XTENSA_DMA_MAPPING_H
-
-#include <asm/cache.h>
-#include <asm/io.h>
-
-#include <linux/mm.h>
-#include <linux/scatterlist.h>
-
-extern const struct dma_map_ops xtensa_dma_map_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return &xtensa_dma_map_ops;
-}
-
-#endif	/* _XTENSA_DMA_MAPPING_H */
diff --git a/arch/xtensa/kernel/pci-dma.c b/arch/xtensa/kernel/pci-dma.c
index 392b4a80ebc2..a83d60e92908 100644
--- a/arch/xtensa/kernel/pci-dma.c
+++ b/arch/xtensa/kernel/pci-dma.c
@@ -16,26 +16,24 @@
  */
 
 #include <linux/dma-contiguous.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/dma-direct.h>
 #include <linux/gfp.h>
 #include <linux/highmem.h>
 #include <linux/mm.h>
-#include <linux/module.h>
-#include <linux/pci.h>
-#include <linux/string.h>
 #include <linux/types.h>
 #include <asm/cacheflush.h>
 #include <asm/io.h>
 
-static void do_cache_op(dma_addr_t dma_handle, size_t size,
+static void do_cache_op(phys_addr_t paddr, size_t size,
 			void (*fn)(unsigned long, unsigned long))
 {
-	unsigned long off = dma_handle & (PAGE_SIZE - 1);
-	unsigned long pfn = PFN_DOWN(dma_handle);
+	unsigned long off = paddr & (PAGE_SIZE - 1);
+	unsigned long pfn = PFN_DOWN(paddr);
 	struct page *page = pfn_to_page(pfn);
 
 	if (!PageHighMem(page))
-		fn((unsigned long)bus_to_virt(dma_handle), size);
+		fn((unsigned long)phys_to_virt(paddr), size);
 	else
 		while (size > 0) {
 			size_t sz = min_t(size_t, size, PAGE_SIZE - off);
@@ -49,14 +47,13 @@ static void do_cache_op(dma_addr_t dma_handle, size_t size,
 		}
 }
 
-static void xtensa_sync_single_for_cpu(struct device *dev,
-				       dma_addr_t dma_handle, size_t size,
-				       enum dma_data_direction dir)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
 	switch (dir) {
 	case DMA_BIDIRECTIONAL:
 	case DMA_FROM_DEVICE:
-		do_cache_op(dma_handle, size, __invalidate_dcache_range);
+		do_cache_op(paddr, size, __invalidate_dcache_range);
 		break;
 
 	case DMA_NONE:
@@ -68,15 +65,14 @@ static void xtensa_sync_single_for_cpu(struct device *dev,
 	}
 }
 
-static void xtensa_sync_single_for_device(struct device *dev,
-					  dma_addr_t dma_handle, size_t size,
-					  enum dma_data_direction dir)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
 	switch (dir) {
 	case DMA_BIDIRECTIONAL:
 	case DMA_TO_DEVICE:
 		if (XCHAL_DCACHE_IS_WRITEBACK)
-			do_cache_op(dma_handle, size, __flush_dcache_range);
+			do_cache_op(paddr, size, __flush_dcache_range);
 		break;
 
 	case DMA_NONE:
@@ -88,40 +84,13 @@ static void xtensa_sync_single_for_device(struct device *dev,
 	}
 }
 
-static void xtensa_sync_sg_for_cpu(struct device *dev,
-				   struct scatterlist *sg, int nents,
-				   enum dma_data_direction dir)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nents, i) {
-		xtensa_sync_single_for_cpu(dev, sg_dma_address(s),
-					   sg_dma_len(s), dir);
-	}
-}
-
-static void xtensa_sync_sg_for_device(struct device *dev,
-				      struct scatterlist *sg, int nents,
-				      enum dma_data_direction dir)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nents, i) {
-		xtensa_sync_single_for_device(dev, sg_dma_address(s),
-					      sg_dma_len(s), dir);
-	}
-}
-
 /*
  * Note: We assume that the full memory space is always mapped to 'kseg'
  *	 Otherwise we have to use page attributes (not implemented).
  */
 
-static void *xtensa_dma_alloc(struct device *dev, size_t size,
-			      dma_addr_t *handle, gfp_t flag,
-			      unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
+		gfp_t flag, unsigned long attrs)
 {
 	unsigned long ret;
 	unsigned long uncached;
@@ -171,8 +140,8 @@ static void *xtensa_dma_alloc(struct device *dev, size_t size,
 	return (void *)uncached;
 }
 
-static void xtensa_dma_free(struct device *dev, size_t size, void *vaddr,
-			    dma_addr_t dma_handle, unsigned long attrs)
+void arch_dma_free(struct device *dev, size_t size, void *vaddr,
+		dma_addr_t dma_handle, unsigned long attrs)
 {
 	unsigned long count = PAGE_ALIGN(size) >> PAGE_SHIFT;
 	unsigned long addr = (unsigned long)vaddr;
@@ -192,72 +161,3 @@ static void xtensa_dma_free(struct device *dev, size_t size, void *vaddr,
 	if (!dma_release_from_contiguous(dev, page, count))
 		__free_pages(page, get_order(size));
 }
-
-static dma_addr_t xtensa_map_page(struct device *dev, struct page *page,
-				  unsigned long offset, size_t size,
-				  enum dma_data_direction dir,
-				  unsigned long attrs)
-{
-	dma_addr_t dma_handle = page_to_phys(page) + offset;
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		xtensa_sync_single_for_device(dev, dma_handle, size, dir);
-
-	return dma_handle;
-}
-
-static void xtensa_unmap_page(struct device *dev, dma_addr_t dma_handle,
-			      size_t size, enum dma_data_direction dir,
-			      unsigned long attrs)
-{
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		xtensa_sync_single_for_cpu(dev, dma_handle, size, dir);
-}
-
-static int xtensa_map_sg(struct device *dev, struct scatterlist *sg,
-			 int nents, enum dma_data_direction dir,
-			 unsigned long attrs)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nents, i) {
-		s->dma_address = xtensa_map_page(dev, sg_page(s), s->offset,
-						 s->length, dir, attrs);
-	}
-	return nents;
-}
-
-static void xtensa_unmap_sg(struct device *dev,
-			    struct scatterlist *sg, int nents,
-			    enum dma_data_direction dir,
-			    unsigned long attrs)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nents, i) {
-		xtensa_unmap_page(dev, sg_dma_address(s),
-				  sg_dma_len(s), dir, attrs);
-	}
-}
-
-int xtensa_dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
-{
-	return 0;
-}
-
-const struct dma_map_ops xtensa_dma_map_ops = {
-	.alloc = xtensa_dma_alloc,
-	.free = xtensa_dma_free,
-	.map_page = xtensa_map_page,
-	.unmap_page = xtensa_unmap_page,
-	.map_sg = xtensa_map_sg,
-	.unmap_sg = xtensa_unmap_sg,
-	.sync_single_for_cpu = xtensa_sync_single_for_cpu,
-	.sync_single_for_device = xtensa_sync_single_for_device,
-	.sync_sg_for_cpu = xtensa_sync_sg_for_cpu,
-	.sync_sg_for_device = xtensa_sync_sg_for_device,
-	.mapping_error = xtensa_dma_mapping_error,
-};
-EXPORT_SYMBOL(xtensa_dma_map_ops);
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 20/22] xtensa: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Switch to the generic noncoherent direct mapping implementation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/xtensa/Kconfig                   |   3 +
 arch/xtensa/include/asm/Kbuild        |   1 +
 arch/xtensa/include/asm/dma-mapping.h |  26 ------
 arch/xtensa/kernel/pci-dma.c          | 130 +++-----------------------
 4 files changed, 19 insertions(+), 141 deletions(-)
 delete mode 100644 arch/xtensa/include/asm/dma-mapping.h

diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
index c921e8bccdc8..6035845f30a7 100644
--- a/arch/xtensa/Kconfig
+++ b/arch/xtensa/Kconfig
@@ -5,11 +5,14 @@ config ZONE_DMA
 config XTENSA
 	def_bool y
 	select ARCH_NO_COHERENT_DMA_MMAP if !MMU
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select ARCH_WANT_FRAME_POINTERS
 	select ARCH_WANT_IPC_PARSE_VERSION
 	select BUILDTIME_EXTABLE_SORT
 	select CLONE_BACKWARDS
 	select COMMON_CLK
+	select DMA_NONCOHERENT_OPS
 	select GENERIC_ATOMIC64
 	select GENERIC_CLOCKEVENTS
 	select GENERIC_IRQ_SHOW
diff --git a/arch/xtensa/include/asm/Kbuild b/arch/xtensa/include/asm/Kbuild
index 436b20337168..a8d6cd3bee4b 100644
--- a/arch/xtensa/include/asm/Kbuild
+++ b/arch/xtensa/include/asm/Kbuild
@@ -2,6 +2,7 @@ generic-y += bug.h
 generic-y += device.h
 generic-y += div64.h
 generic-y += dma-contiguous.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += exec.h
 generic-y += extable.h
diff --git a/arch/xtensa/include/asm/dma-mapping.h b/arch/xtensa/include/asm/dma-mapping.h
deleted file mode 100644
index 44098800dad7..000000000000
--- a/arch/xtensa/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 2003 - 2005 Tensilica Inc.
- * Copyright (C) 2015 Cadence Design Systems Inc.
- */
-
-#ifndef _XTENSA_DMA_MAPPING_H
-#define _XTENSA_DMA_MAPPING_H
-
-#include <asm/cache.h>
-#include <asm/io.h>
-
-#include <linux/mm.h>
-#include <linux/scatterlist.h>
-
-extern const struct dma_map_ops xtensa_dma_map_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return &xtensa_dma_map_ops;
-}
-
-#endif	/* _XTENSA_DMA_MAPPING_H */
diff --git a/arch/xtensa/kernel/pci-dma.c b/arch/xtensa/kernel/pci-dma.c
index 392b4a80ebc2..a83d60e92908 100644
--- a/arch/xtensa/kernel/pci-dma.c
+++ b/arch/xtensa/kernel/pci-dma.c
@@ -16,26 +16,24 @@
  */
 
 #include <linux/dma-contiguous.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/dma-direct.h>
 #include <linux/gfp.h>
 #include <linux/highmem.h>
 #include <linux/mm.h>
-#include <linux/module.h>
-#include <linux/pci.h>
-#include <linux/string.h>
 #include <linux/types.h>
 #include <asm/cacheflush.h>
 #include <asm/io.h>
 
-static void do_cache_op(dma_addr_t dma_handle, size_t size,
+static void do_cache_op(phys_addr_t paddr, size_t size,
 			void (*fn)(unsigned long, unsigned long))
 {
-	unsigned long off = dma_handle & (PAGE_SIZE - 1);
-	unsigned long pfn = PFN_DOWN(dma_handle);
+	unsigned long off = paddr & (PAGE_SIZE - 1);
+	unsigned long pfn = PFN_DOWN(paddr);
 	struct page *page = pfn_to_page(pfn);
 
 	if (!PageHighMem(page))
-		fn((unsigned long)bus_to_virt(dma_handle), size);
+		fn((unsigned long)phys_to_virt(paddr), size);
 	else
 		while (size > 0) {
 			size_t sz = min_t(size_t, size, PAGE_SIZE - off);
@@ -49,14 +47,13 @@ static void do_cache_op(dma_addr_t dma_handle, size_t size,
 		}
 }
 
-static void xtensa_sync_single_for_cpu(struct device *dev,
-				       dma_addr_t dma_handle, size_t size,
-				       enum dma_data_direction dir)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
 	switch (dir) {
 	case DMA_BIDIRECTIONAL:
 	case DMA_FROM_DEVICE:
-		do_cache_op(dma_handle, size, __invalidate_dcache_range);
+		do_cache_op(paddr, size, __invalidate_dcache_range);
 		break;
 
 	case DMA_NONE:
@@ -68,15 +65,14 @@ static void xtensa_sync_single_for_cpu(struct device *dev,
 	}
 }
 
-static void xtensa_sync_single_for_device(struct device *dev,
-					  dma_addr_t dma_handle, size_t size,
-					  enum dma_data_direction dir)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
 	switch (dir) {
 	case DMA_BIDIRECTIONAL:
 	case DMA_TO_DEVICE:
 		if (XCHAL_DCACHE_IS_WRITEBACK)
-			do_cache_op(dma_handle, size, __flush_dcache_range);
+			do_cache_op(paddr, size, __flush_dcache_range);
 		break;
 
 	case DMA_NONE:
@@ -88,40 +84,13 @@ static void xtensa_sync_single_for_device(struct device *dev,
 	}
 }
 
-static void xtensa_sync_sg_for_cpu(struct device *dev,
-				   struct scatterlist *sg, int nents,
-				   enum dma_data_direction dir)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nents, i) {
-		xtensa_sync_single_for_cpu(dev, sg_dma_address(s),
-					   sg_dma_len(s), dir);
-	}
-}
-
-static void xtensa_sync_sg_for_device(struct device *dev,
-				      struct scatterlist *sg, int nents,
-				      enum dma_data_direction dir)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nents, i) {
-		xtensa_sync_single_for_device(dev, sg_dma_address(s),
-					      sg_dma_len(s), dir);
-	}
-}
-
 /*
  * Note: We assume that the full memory space is always mapped to 'kseg'
  *	 Otherwise we have to use page attributes (not implemented).
  */
 
-static void *xtensa_dma_alloc(struct device *dev, size_t size,
-			      dma_addr_t *handle, gfp_t flag,
-			      unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
+		gfp_t flag, unsigned long attrs)
 {
 	unsigned long ret;
 	unsigned long uncached;
@@ -171,8 +140,8 @@ static void *xtensa_dma_alloc(struct device *dev, size_t size,
 	return (void *)uncached;
 }
 
-static void xtensa_dma_free(struct device *dev, size_t size, void *vaddr,
-			    dma_addr_t dma_handle, unsigned long attrs)
+void arch_dma_free(struct device *dev, size_t size, void *vaddr,
+		dma_addr_t dma_handle, unsigned long attrs)
 {
 	unsigned long count = PAGE_ALIGN(size) >> PAGE_SHIFT;
 	unsigned long addr = (unsigned long)vaddr;
@@ -192,72 +161,3 @@ static void xtensa_dma_free(struct device *dev, size_t size, void *vaddr,
 	if (!dma_release_from_contiguous(dev, page, count))
 		__free_pages(page, get_order(size));
 }
-
-static dma_addr_t xtensa_map_page(struct device *dev, struct page *page,
-				  unsigned long offset, size_t size,
-				  enum dma_data_direction dir,
-				  unsigned long attrs)
-{
-	dma_addr_t dma_handle = page_to_phys(page) + offset;
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		xtensa_sync_single_for_device(dev, dma_handle, size, dir);
-
-	return dma_handle;
-}
-
-static void xtensa_unmap_page(struct device *dev, dma_addr_t dma_handle,
-			      size_t size, enum dma_data_direction dir,
-			      unsigned long attrs)
-{
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		xtensa_sync_single_for_cpu(dev, dma_handle, size, dir);
-}
-
-static int xtensa_map_sg(struct device *dev, struct scatterlist *sg,
-			 int nents, enum dma_data_direction dir,
-			 unsigned long attrs)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nents, i) {
-		s->dma_address = xtensa_map_page(dev, sg_page(s), s->offset,
-						 s->length, dir, attrs);
-	}
-	return nents;
-}
-
-static void xtensa_unmap_sg(struct device *dev,
-			    struct scatterlist *sg, int nents,
-			    enum dma_data_direction dir,
-			    unsigned long attrs)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nents, i) {
-		xtensa_unmap_page(dev, sg_dma_address(s),
-				  sg_dma_len(s), dir, attrs);
-	}
-}
-
-int xtensa_dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
-{
-	return 0;
-}
-
-const struct dma_map_ops xtensa_dma_map_ops = {
-	.alloc = xtensa_dma_alloc,
-	.free = xtensa_dma_free,
-	.map_page = xtensa_map_page,
-	.unmap_page = xtensa_unmap_page,
-	.map_sg = xtensa_map_sg,
-	.unmap_sg = xtensa_unmap_sg,
-	.sync_single_for_cpu = xtensa_sync_single_for_cpu,
-	.sync_single_for_device = xtensa_sync_single_for_device,
-	.sync_sg_for_cpu = xtensa_sync_sg_for_cpu,
-	.sync_sg_for_device = xtensa_sync_sg_for_device,
-	.mapping_error = xtensa_dma_mapping_error,
-};
-EXPORT_SYMBOL(xtensa_dma_map_ops);
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 20/22] xtensa: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  To: linux-snps-arc

Switch to the generic noncoherent direct mapping implementation.

Signed-off-by: Christoph Hellwig <hch at lst.de>
---
 arch/xtensa/Kconfig                   |   3 +
 arch/xtensa/include/asm/Kbuild        |   1 +
 arch/xtensa/include/asm/dma-mapping.h |  26 ------
 arch/xtensa/kernel/pci-dma.c          | 130 +++-----------------------
 4 files changed, 19 insertions(+), 141 deletions(-)
 delete mode 100644 arch/xtensa/include/asm/dma-mapping.h

diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
index c921e8bccdc8..6035845f30a7 100644
--- a/arch/xtensa/Kconfig
+++ b/arch/xtensa/Kconfig
@@ -5,11 +5,14 @@ config ZONE_DMA
 config XTENSA
 	def_bool y
 	select ARCH_NO_COHERENT_DMA_MMAP if !MMU
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select ARCH_WANT_FRAME_POINTERS
 	select ARCH_WANT_IPC_PARSE_VERSION
 	select BUILDTIME_EXTABLE_SORT
 	select CLONE_BACKWARDS
 	select COMMON_CLK
+	select DMA_NONCOHERENT_OPS
 	select GENERIC_ATOMIC64
 	select GENERIC_CLOCKEVENTS
 	select GENERIC_IRQ_SHOW
diff --git a/arch/xtensa/include/asm/Kbuild b/arch/xtensa/include/asm/Kbuild
index 436b20337168..a8d6cd3bee4b 100644
--- a/arch/xtensa/include/asm/Kbuild
+++ b/arch/xtensa/include/asm/Kbuild
@@ -2,6 +2,7 @@ generic-y += bug.h
 generic-y += device.h
 generic-y += div64.h
 generic-y += dma-contiguous.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += exec.h
 generic-y += extable.h
diff --git a/arch/xtensa/include/asm/dma-mapping.h b/arch/xtensa/include/asm/dma-mapping.h
deleted file mode 100644
index 44098800dad7..000000000000
--- a/arch/xtensa/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 2003 - 2005 Tensilica Inc.
- * Copyright (C) 2015 Cadence Design Systems Inc.
- */
-
-#ifndef _XTENSA_DMA_MAPPING_H
-#define _XTENSA_DMA_MAPPING_H
-
-#include <asm/cache.h>
-#include <asm/io.h>
-
-#include <linux/mm.h>
-#include <linux/scatterlist.h>
-
-extern const struct dma_map_ops xtensa_dma_map_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return &xtensa_dma_map_ops;
-}
-
-#endif	/* _XTENSA_DMA_MAPPING_H */
diff --git a/arch/xtensa/kernel/pci-dma.c b/arch/xtensa/kernel/pci-dma.c
index 392b4a80ebc2..a83d60e92908 100644
--- a/arch/xtensa/kernel/pci-dma.c
+++ b/arch/xtensa/kernel/pci-dma.c
@@ -16,26 +16,24 @@
  */
 
 #include <linux/dma-contiguous.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/dma-direct.h>
 #include <linux/gfp.h>
 #include <linux/highmem.h>
 #include <linux/mm.h>
-#include <linux/module.h>
-#include <linux/pci.h>
-#include <linux/string.h>
 #include <linux/types.h>
 #include <asm/cacheflush.h>
 #include <asm/io.h>
 
-static void do_cache_op(dma_addr_t dma_handle, size_t size,
+static void do_cache_op(phys_addr_t paddr, size_t size,
 			void (*fn)(unsigned long, unsigned long))
 {
-	unsigned long off = dma_handle & (PAGE_SIZE - 1);
-	unsigned long pfn = PFN_DOWN(dma_handle);
+	unsigned long off = paddr & (PAGE_SIZE - 1);
+	unsigned long pfn = PFN_DOWN(paddr);
 	struct page *page = pfn_to_page(pfn);
 
 	if (!PageHighMem(page))
-		fn((unsigned long)bus_to_virt(dma_handle), size);
+		fn((unsigned long)phys_to_virt(paddr), size);
 	else
 		while (size > 0) {
 			size_t sz = min_t(size_t, size, PAGE_SIZE - off);
@@ -49,14 +47,13 @@ static void do_cache_op(dma_addr_t dma_handle, size_t size,
 		}
 }
 
-static void xtensa_sync_single_for_cpu(struct device *dev,
-				       dma_addr_t dma_handle, size_t size,
-				       enum dma_data_direction dir)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
 	switch (dir) {
 	case DMA_BIDIRECTIONAL:
 	case DMA_FROM_DEVICE:
-		do_cache_op(dma_handle, size, __invalidate_dcache_range);
+		do_cache_op(paddr, size, __invalidate_dcache_range);
 		break;
 
 	case DMA_NONE:
@@ -68,15 +65,14 @@ static void xtensa_sync_single_for_cpu(struct device *dev,
 	}
 }
 
-static void xtensa_sync_single_for_device(struct device *dev,
-					  dma_addr_t dma_handle, size_t size,
-					  enum dma_data_direction dir)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
 	switch (dir) {
 	case DMA_BIDIRECTIONAL:
 	case DMA_TO_DEVICE:
 		if (XCHAL_DCACHE_IS_WRITEBACK)
-			do_cache_op(dma_handle, size, __flush_dcache_range);
+			do_cache_op(paddr, size, __flush_dcache_range);
 		break;
 
 	case DMA_NONE:
@@ -88,40 +84,13 @@ static void xtensa_sync_single_for_device(struct device *dev,
 	}
 }
 
-static void xtensa_sync_sg_for_cpu(struct device *dev,
-				   struct scatterlist *sg, int nents,
-				   enum dma_data_direction dir)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nents, i) {
-		xtensa_sync_single_for_cpu(dev, sg_dma_address(s),
-					   sg_dma_len(s), dir);
-	}
-}
-
-static void xtensa_sync_sg_for_device(struct device *dev,
-				      struct scatterlist *sg, int nents,
-				      enum dma_data_direction dir)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nents, i) {
-		xtensa_sync_single_for_device(dev, sg_dma_address(s),
-					      sg_dma_len(s), dir);
-	}
-}
-
 /*
  * Note: We assume that the full memory space is always mapped to 'kseg'
  *	 Otherwise we have to use page attributes (not implemented).
  */
 
-static void *xtensa_dma_alloc(struct device *dev, size_t size,
-			      dma_addr_t *handle, gfp_t flag,
-			      unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
+		gfp_t flag, unsigned long attrs)
 {
 	unsigned long ret;
 	unsigned long uncached;
@@ -171,8 +140,8 @@ static void *xtensa_dma_alloc(struct device *dev, size_t size,
 	return (void *)uncached;
 }
 
-static void xtensa_dma_free(struct device *dev, size_t size, void *vaddr,
-			    dma_addr_t dma_handle, unsigned long attrs)
+void arch_dma_free(struct device *dev, size_t size, void *vaddr,
+		dma_addr_t dma_handle, unsigned long attrs)
 {
 	unsigned long count = PAGE_ALIGN(size) >> PAGE_SHIFT;
 	unsigned long addr = (unsigned long)vaddr;
@@ -192,72 +161,3 @@ static void xtensa_dma_free(struct device *dev, size_t size, void *vaddr,
 	if (!dma_release_from_contiguous(dev, page, count))
 		__free_pages(page, get_order(size));
 }
-
-static dma_addr_t xtensa_map_page(struct device *dev, struct page *page,
-				  unsigned long offset, size_t size,
-				  enum dma_data_direction dir,
-				  unsigned long attrs)
-{
-	dma_addr_t dma_handle = page_to_phys(page) + offset;
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		xtensa_sync_single_for_device(dev, dma_handle, size, dir);
-
-	return dma_handle;
-}
-
-static void xtensa_unmap_page(struct device *dev, dma_addr_t dma_handle,
-			      size_t size, enum dma_data_direction dir,
-			      unsigned long attrs)
-{
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		xtensa_sync_single_for_cpu(dev, dma_handle, size, dir);
-}
-
-static int xtensa_map_sg(struct device *dev, struct scatterlist *sg,
-			 int nents, enum dma_data_direction dir,
-			 unsigned long attrs)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nents, i) {
-		s->dma_address = xtensa_map_page(dev, sg_page(s), s->offset,
-						 s->length, dir, attrs);
-	}
-	return nents;
-}
-
-static void xtensa_unmap_sg(struct device *dev,
-			    struct scatterlist *sg, int nents,
-			    enum dma_data_direction dir,
-			    unsigned long attrs)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nents, i) {
-		xtensa_unmap_page(dev, sg_dma_address(s),
-				  sg_dma_len(s), dir, attrs);
-	}
-}
-
-int xtensa_dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
-{
-	return 0;
-}
-
-const struct dma_map_ops xtensa_dma_map_ops = {
-	.alloc = xtensa_dma_alloc,
-	.free = xtensa_dma_free,
-	.map_page = xtensa_map_page,
-	.unmap_page = xtensa_unmap_page,
-	.map_sg = xtensa_map_sg,
-	.unmap_sg = xtensa_unmap_sg,
-	.sync_single_for_cpu = xtensa_sync_single_for_cpu,
-	.sync_single_for_device = xtensa_sync_single_for_device,
-	.sync_sg_for_cpu = xtensa_sync_sg_for_cpu,
-	.sync_sg_for_device = xtensa_sync_sg_for_device,
-	.mapping_error = xtensa_dma_mapping_error,
-};
-EXPORT_SYMBOL(xtensa_dma_map_ops);
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 20/22] xtensa: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Switch to the generic noncoherent direct mapping implementation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/xtensa/Kconfig                   |   3 +
 arch/xtensa/include/asm/Kbuild        |   1 +
 arch/xtensa/include/asm/dma-mapping.h |  26 ------
 arch/xtensa/kernel/pci-dma.c          | 130 +++-----------------------
 4 files changed, 19 insertions(+), 141 deletions(-)
 delete mode 100644 arch/xtensa/include/asm/dma-mapping.h

diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
index c921e8bccdc8..6035845f30a7 100644
--- a/arch/xtensa/Kconfig
+++ b/arch/xtensa/Kconfig
@@ -5,11 +5,14 @@ config ZONE_DMA
 config XTENSA
 	def_bool y
 	select ARCH_NO_COHERENT_DMA_MMAP if !MMU
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select ARCH_WANT_FRAME_POINTERS
 	select ARCH_WANT_IPC_PARSE_VERSION
 	select BUILDTIME_EXTABLE_SORT
 	select CLONE_BACKWARDS
 	select COMMON_CLK
+	select DMA_NONCOHERENT_OPS
 	select GENERIC_ATOMIC64
 	select GENERIC_CLOCKEVENTS
 	select GENERIC_IRQ_SHOW
diff --git a/arch/xtensa/include/asm/Kbuild b/arch/xtensa/include/asm/Kbuild
index 436b20337168..a8d6cd3bee4b 100644
--- a/arch/xtensa/include/asm/Kbuild
+++ b/arch/xtensa/include/asm/Kbuild
@@ -2,6 +2,7 @@ generic-y += bug.h
 generic-y += device.h
 generic-y += div64.h
 generic-y += dma-contiguous.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += exec.h
 generic-y += extable.h
diff --git a/arch/xtensa/include/asm/dma-mapping.h b/arch/xtensa/include/asm/dma-mapping.h
deleted file mode 100644
index 44098800dad7..000000000000
--- a/arch/xtensa/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 2003 - 2005 Tensilica Inc.
- * Copyright (C) 2015 Cadence Design Systems Inc.
- */
-
-#ifndef _XTENSA_DMA_MAPPING_H
-#define _XTENSA_DMA_MAPPING_H
-
-#include <asm/cache.h>
-#include <asm/io.h>
-
-#include <linux/mm.h>
-#include <linux/scatterlist.h>
-
-extern const struct dma_map_ops xtensa_dma_map_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return &xtensa_dma_map_ops;
-}
-
-#endif	/* _XTENSA_DMA_MAPPING_H */
diff --git a/arch/xtensa/kernel/pci-dma.c b/arch/xtensa/kernel/pci-dma.c
index 392b4a80ebc2..a83d60e92908 100644
--- a/arch/xtensa/kernel/pci-dma.c
+++ b/arch/xtensa/kernel/pci-dma.c
@@ -16,26 +16,24 @@
  */
 
 #include <linux/dma-contiguous.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/dma-direct.h>
 #include <linux/gfp.h>
 #include <linux/highmem.h>
 #include <linux/mm.h>
-#include <linux/module.h>
-#include <linux/pci.h>
-#include <linux/string.h>
 #include <linux/types.h>
 #include <asm/cacheflush.h>
 #include <asm/io.h>
 
-static void do_cache_op(dma_addr_t dma_handle, size_t size,
+static void do_cache_op(phys_addr_t paddr, size_t size,
 			void (*fn)(unsigned long, unsigned long))
 {
-	unsigned long off = dma_handle & (PAGE_SIZE - 1);
-	unsigned long pfn = PFN_DOWN(dma_handle);
+	unsigned long off = paddr & (PAGE_SIZE - 1);
+	unsigned long pfn = PFN_DOWN(paddr);
 	struct page *page = pfn_to_page(pfn);
 
 	if (!PageHighMem(page))
-		fn((unsigned long)bus_to_virt(dma_handle), size);
+		fn((unsigned long)phys_to_virt(paddr), size);
 	else
 		while (size > 0) {
 			size_t sz = min_t(size_t, size, PAGE_SIZE - off);
@@ -49,14 +47,13 @@ static void do_cache_op(dma_addr_t dma_handle, size_t size,
 		}
 }
 
-static void xtensa_sync_single_for_cpu(struct device *dev,
-				       dma_addr_t dma_handle, size_t size,
-				       enum dma_data_direction dir)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
 	switch (dir) {
 	case DMA_BIDIRECTIONAL:
 	case DMA_FROM_DEVICE:
-		do_cache_op(dma_handle, size, __invalidate_dcache_range);
+		do_cache_op(paddr, size, __invalidate_dcache_range);
 		break;
 
 	case DMA_NONE:
@@ -68,15 +65,14 @@ static void xtensa_sync_single_for_cpu(struct device *dev,
 	}
 }
 
-static void xtensa_sync_single_for_device(struct device *dev,
-					  dma_addr_t dma_handle, size_t size,
-					  enum dma_data_direction dir)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
 	switch (dir) {
 	case DMA_BIDIRECTIONAL:
 	case DMA_TO_DEVICE:
 		if (XCHAL_DCACHE_IS_WRITEBACK)
-			do_cache_op(dma_handle, size, __flush_dcache_range);
+			do_cache_op(paddr, size, __flush_dcache_range);
 		break;
 
 	case DMA_NONE:
@@ -88,40 +84,13 @@ static void xtensa_sync_single_for_device(struct device *dev,
 	}
 }
 
-static void xtensa_sync_sg_for_cpu(struct device *dev,
-				   struct scatterlist *sg, int nents,
-				   enum dma_data_direction dir)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nents, i) {
-		xtensa_sync_single_for_cpu(dev, sg_dma_address(s),
-					   sg_dma_len(s), dir);
-	}
-}
-
-static void xtensa_sync_sg_for_device(struct device *dev,
-				      struct scatterlist *sg, int nents,
-				      enum dma_data_direction dir)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nents, i) {
-		xtensa_sync_single_for_device(dev, sg_dma_address(s),
-					      sg_dma_len(s), dir);
-	}
-}
-
 /*
  * Note: We assume that the full memory space is always mapped to 'kseg'
  *	 Otherwise we have to use page attributes (not implemented).
  */
 
-static void *xtensa_dma_alloc(struct device *dev, size_t size,
-			      dma_addr_t *handle, gfp_t flag,
-			      unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
+		gfp_t flag, unsigned long attrs)
 {
 	unsigned long ret;
 	unsigned long uncached;
@@ -171,8 +140,8 @@ static void *xtensa_dma_alloc(struct device *dev, size_t size,
 	return (void *)uncached;
 }
 
-static void xtensa_dma_free(struct device *dev, size_t size, void *vaddr,
-			    dma_addr_t dma_handle, unsigned long attrs)
+void arch_dma_free(struct device *dev, size_t size, void *vaddr,
+		dma_addr_t dma_handle, unsigned long attrs)
 {
 	unsigned long count = PAGE_ALIGN(size) >> PAGE_SHIFT;
 	unsigned long addr = (unsigned long)vaddr;
@@ -192,72 +161,3 @@ static void xtensa_dma_free(struct device *dev, size_t size, void *vaddr,
 	if (!dma_release_from_contiguous(dev, page, count))
 		__free_pages(page, get_order(size));
 }
-
-static dma_addr_t xtensa_map_page(struct device *dev, struct page *page,
-				  unsigned long offset, size_t size,
-				  enum dma_data_direction dir,
-				  unsigned long attrs)
-{
-	dma_addr_t dma_handle = page_to_phys(page) + offset;
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		xtensa_sync_single_for_device(dev, dma_handle, size, dir);
-
-	return dma_handle;
-}
-
-static void xtensa_unmap_page(struct device *dev, dma_addr_t dma_handle,
-			      size_t size, enum dma_data_direction dir,
-			      unsigned long attrs)
-{
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		xtensa_sync_single_for_cpu(dev, dma_handle, size, dir);
-}
-
-static int xtensa_map_sg(struct device *dev, struct scatterlist *sg,
-			 int nents, enum dma_data_direction dir,
-			 unsigned long attrs)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nents, i) {
-		s->dma_address = xtensa_map_page(dev, sg_page(s), s->offset,
-						 s->length, dir, attrs);
-	}
-	return nents;
-}
-
-static void xtensa_unmap_sg(struct device *dev,
-			    struct scatterlist *sg, int nents,
-			    enum dma_data_direction dir,
-			    unsigned long attrs)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nents, i) {
-		xtensa_unmap_page(dev, sg_dma_address(s),
-				  sg_dma_len(s), dir, attrs);
-	}
-}
-
-int xtensa_dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
-{
-	return 0;
-}
-
-const struct dma_map_ops xtensa_dma_map_ops = {
-	.alloc = xtensa_dma_alloc,
-	.free = xtensa_dma_free,
-	.map_page = xtensa_map_page,
-	.unmap_page = xtensa_unmap_page,
-	.map_sg = xtensa_map_sg,
-	.unmap_sg = xtensa_unmap_sg,
-	.sync_single_for_cpu = xtensa_sync_single_for_cpu,
-	.sync_single_for_device = xtensa_sync_single_for_device,
-	.sync_sg_for_cpu = xtensa_sync_sg_for_cpu,
-	.sync_sg_for_device = xtensa_sync_sg_for_device,
-	.mapping_error = xtensa_dma_mapping_error,
-};
-EXPORT_SYMBOL(xtensa_dma_map_ops);
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [OpenRISC] [PATCH 20/22] xtensa: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  To: openrisc

Switch to the generic noncoherent direct mapping implementation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/xtensa/Kconfig                   |   3 +
 arch/xtensa/include/asm/Kbuild        |   1 +
 arch/xtensa/include/asm/dma-mapping.h |  26 ------
 arch/xtensa/kernel/pci-dma.c          | 130 +++-----------------------
 4 files changed, 19 insertions(+), 141 deletions(-)
 delete mode 100644 arch/xtensa/include/asm/dma-mapping.h

diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
index c921e8bccdc8..6035845f30a7 100644
--- a/arch/xtensa/Kconfig
+++ b/arch/xtensa/Kconfig
@@ -5,11 +5,14 @@ config ZONE_DMA
 config XTENSA
 	def_bool y
 	select ARCH_NO_COHERENT_DMA_MMAP if !MMU
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select ARCH_WANT_FRAME_POINTERS
 	select ARCH_WANT_IPC_PARSE_VERSION
 	select BUILDTIME_EXTABLE_SORT
 	select CLONE_BACKWARDS
 	select COMMON_CLK
+	select DMA_NONCOHERENT_OPS
 	select GENERIC_ATOMIC64
 	select GENERIC_CLOCKEVENTS
 	select GENERIC_IRQ_SHOW
diff --git a/arch/xtensa/include/asm/Kbuild b/arch/xtensa/include/asm/Kbuild
index 436b20337168..a8d6cd3bee4b 100644
--- a/arch/xtensa/include/asm/Kbuild
+++ b/arch/xtensa/include/asm/Kbuild
@@ -2,6 +2,7 @@ generic-y += bug.h
 generic-y += device.h
 generic-y += div64.h
 generic-y += dma-contiguous.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += exec.h
 generic-y += extable.h
diff --git a/arch/xtensa/include/asm/dma-mapping.h b/arch/xtensa/include/asm/dma-mapping.h
deleted file mode 100644
index 44098800dad7..000000000000
--- a/arch/xtensa/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 2003 - 2005 Tensilica Inc.
- * Copyright (C) 2015 Cadence Design Systems Inc.
- */
-
-#ifndef _XTENSA_DMA_MAPPING_H
-#define _XTENSA_DMA_MAPPING_H
-
-#include <asm/cache.h>
-#include <asm/io.h>
-
-#include <linux/mm.h>
-#include <linux/scatterlist.h>
-
-extern const struct dma_map_ops xtensa_dma_map_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return &xtensa_dma_map_ops;
-}
-
-#endif	/* _XTENSA_DMA_MAPPING_H */
diff --git a/arch/xtensa/kernel/pci-dma.c b/arch/xtensa/kernel/pci-dma.c
index 392b4a80ebc2..a83d60e92908 100644
--- a/arch/xtensa/kernel/pci-dma.c
+++ b/arch/xtensa/kernel/pci-dma.c
@@ -16,26 +16,24 @@
  */
 
 #include <linux/dma-contiguous.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/dma-direct.h>
 #include <linux/gfp.h>
 #include <linux/highmem.h>
 #include <linux/mm.h>
-#include <linux/module.h>
-#include <linux/pci.h>
-#include <linux/string.h>
 #include <linux/types.h>
 #include <asm/cacheflush.h>
 #include <asm/io.h>
 
-static void do_cache_op(dma_addr_t dma_handle, size_t size,
+static void do_cache_op(phys_addr_t paddr, size_t size,
 			void (*fn)(unsigned long, unsigned long))
 {
-	unsigned long off = dma_handle & (PAGE_SIZE - 1);
-	unsigned long pfn = PFN_DOWN(dma_handle);
+	unsigned long off = paddr & (PAGE_SIZE - 1);
+	unsigned long pfn = PFN_DOWN(paddr);
 	struct page *page = pfn_to_page(pfn);
 
 	if (!PageHighMem(page))
-		fn((unsigned long)bus_to_virt(dma_handle), size);
+		fn((unsigned long)phys_to_virt(paddr), size);
 	else
 		while (size > 0) {
 			size_t sz = min_t(size_t, size, PAGE_SIZE - off);
@@ -49,14 +47,13 @@ static void do_cache_op(dma_addr_t dma_handle, size_t size,
 		}
 }
 
-static void xtensa_sync_single_for_cpu(struct device *dev,
-				       dma_addr_t dma_handle, size_t size,
-				       enum dma_data_direction dir)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
 	switch (dir) {
 	case DMA_BIDIRECTIONAL:
 	case DMA_FROM_DEVICE:
-		do_cache_op(dma_handle, size, __invalidate_dcache_range);
+		do_cache_op(paddr, size, __invalidate_dcache_range);
 		break;
 
 	case DMA_NONE:
@@ -68,15 +65,14 @@ static void xtensa_sync_single_for_cpu(struct device *dev,
 	}
 }
 
-static void xtensa_sync_single_for_device(struct device *dev,
-					  dma_addr_t dma_handle, size_t size,
-					  enum dma_data_direction dir)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
 	switch (dir) {
 	case DMA_BIDIRECTIONAL:
 	case DMA_TO_DEVICE:
 		if (XCHAL_DCACHE_IS_WRITEBACK)
-			do_cache_op(dma_handle, size, __flush_dcache_range);
+			do_cache_op(paddr, size, __flush_dcache_range);
 		break;
 
 	case DMA_NONE:
@@ -88,40 +84,13 @@ static void xtensa_sync_single_for_device(struct device *dev,
 	}
 }
 
-static void xtensa_sync_sg_for_cpu(struct device *dev,
-				   struct scatterlist *sg, int nents,
-				   enum dma_data_direction dir)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nents, i) {
-		xtensa_sync_single_for_cpu(dev, sg_dma_address(s),
-					   sg_dma_len(s), dir);
-	}
-}
-
-static void xtensa_sync_sg_for_device(struct device *dev,
-				      struct scatterlist *sg, int nents,
-				      enum dma_data_direction dir)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nents, i) {
-		xtensa_sync_single_for_device(dev, sg_dma_address(s),
-					      sg_dma_len(s), dir);
-	}
-}
-
 /*
  * Note: We assume that the full memory space is always mapped to 'kseg'
  *	 Otherwise we have to use page attributes (not implemented).
  */
 
-static void *xtensa_dma_alloc(struct device *dev, size_t size,
-			      dma_addr_t *handle, gfp_t flag,
-			      unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
+		gfp_t flag, unsigned long attrs)
 {
 	unsigned long ret;
 	unsigned long uncached;
@@ -171,8 +140,8 @@ static void *xtensa_dma_alloc(struct device *dev, size_t size,
 	return (void *)uncached;
 }
 
-static void xtensa_dma_free(struct device *dev, size_t size, void *vaddr,
-			    dma_addr_t dma_handle, unsigned long attrs)
+void arch_dma_free(struct device *dev, size_t size, void *vaddr,
+		dma_addr_t dma_handle, unsigned long attrs)
 {
 	unsigned long count = PAGE_ALIGN(size) >> PAGE_SHIFT;
 	unsigned long addr = (unsigned long)vaddr;
@@ -192,72 +161,3 @@ static void xtensa_dma_free(struct device *dev, size_t size, void *vaddr,
 	if (!dma_release_from_contiguous(dev, page, count))
 		__free_pages(page, get_order(size));
 }
-
-static dma_addr_t xtensa_map_page(struct device *dev, struct page *page,
-				  unsigned long offset, size_t size,
-				  enum dma_data_direction dir,
-				  unsigned long attrs)
-{
-	dma_addr_t dma_handle = page_to_phys(page) + offset;
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		xtensa_sync_single_for_device(dev, dma_handle, size, dir);
-
-	return dma_handle;
-}
-
-static void xtensa_unmap_page(struct device *dev, dma_addr_t dma_handle,
-			      size_t size, enum dma_data_direction dir,
-			      unsigned long attrs)
-{
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		xtensa_sync_single_for_cpu(dev, dma_handle, size, dir);
-}
-
-static int xtensa_map_sg(struct device *dev, struct scatterlist *sg,
-			 int nents, enum dma_data_direction dir,
-			 unsigned long attrs)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nents, i) {
-		s->dma_address = xtensa_map_page(dev, sg_page(s), s->offset,
-						 s->length, dir, attrs);
-	}
-	return nents;
-}
-
-static void xtensa_unmap_sg(struct device *dev,
-			    struct scatterlist *sg, int nents,
-			    enum dma_data_direction dir,
-			    unsigned long attrs)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nents, i) {
-		xtensa_unmap_page(dev, sg_dma_address(s),
-				  sg_dma_len(s), dir, attrs);
-	}
-}
-
-int xtensa_dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
-{
-	return 0;
-}
-
-const struct dma_map_ops xtensa_dma_map_ops = {
-	.alloc = xtensa_dma_alloc,
-	.free = xtensa_dma_free,
-	.map_page = xtensa_map_page,
-	.unmap_page = xtensa_unmap_page,
-	.map_sg = xtensa_map_sg,
-	.unmap_sg = xtensa_unmap_sg,
-	.sync_single_for_cpu = xtensa_sync_single_for_cpu,
-	.sync_single_for_device = xtensa_sync_single_for_device,
-	.sync_sg_for_cpu = xtensa_sync_sg_for_cpu,
-	.sync_sg_for_device = xtensa_sync_sg_for_device,
-	.mapping_error = xtensa_dma_mapping_error,
-};
-EXPORT_SYMBOL(xtensa_dma_map_ops);
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 20/22] xtensa: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  To: linux-arm-kernel

Switch to the generic noncoherent direct mapping implementation.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/xtensa/Kconfig                   |   3 +
 arch/xtensa/include/asm/Kbuild        |   1 +
 arch/xtensa/include/asm/dma-mapping.h |  26 ------
 arch/xtensa/kernel/pci-dma.c          | 130 +++-----------------------
 4 files changed, 19 insertions(+), 141 deletions(-)
 delete mode 100644 arch/xtensa/include/asm/dma-mapping.h

diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
index c921e8bccdc8..6035845f30a7 100644
--- a/arch/xtensa/Kconfig
+++ b/arch/xtensa/Kconfig
@@ -5,11 +5,14 @@ config ZONE_DMA
 config XTENSA
 	def_bool y
 	select ARCH_NO_COHERENT_DMA_MMAP if !MMU
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select ARCH_WANT_FRAME_POINTERS
 	select ARCH_WANT_IPC_PARSE_VERSION
 	select BUILDTIME_EXTABLE_SORT
 	select CLONE_BACKWARDS
 	select COMMON_CLK
+	select DMA_NONCOHERENT_OPS
 	select GENERIC_ATOMIC64
 	select GENERIC_CLOCKEVENTS
 	select GENERIC_IRQ_SHOW
diff --git a/arch/xtensa/include/asm/Kbuild b/arch/xtensa/include/asm/Kbuild
index 436b20337168..a8d6cd3bee4b 100644
--- a/arch/xtensa/include/asm/Kbuild
+++ b/arch/xtensa/include/asm/Kbuild
@@ -2,6 +2,7 @@ generic-y += bug.h
 generic-y += device.h
 generic-y += div64.h
 generic-y += dma-contiguous.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += exec.h
 generic-y += extable.h
diff --git a/arch/xtensa/include/asm/dma-mapping.h b/arch/xtensa/include/asm/dma-mapping.h
deleted file mode 100644
index 44098800dad7..000000000000
--- a/arch/xtensa/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 2003 - 2005 Tensilica Inc.
- * Copyright (C) 2015 Cadence Design Systems Inc.
- */
-
-#ifndef _XTENSA_DMA_MAPPING_H
-#define _XTENSA_DMA_MAPPING_H
-
-#include <asm/cache.h>
-#include <asm/io.h>
-
-#include <linux/mm.h>
-#include <linux/scatterlist.h>
-
-extern const struct dma_map_ops xtensa_dma_map_ops;
-
-static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return &xtensa_dma_map_ops;
-}
-
-#endif	/* _XTENSA_DMA_MAPPING_H */
diff --git a/arch/xtensa/kernel/pci-dma.c b/arch/xtensa/kernel/pci-dma.c
index 392b4a80ebc2..a83d60e92908 100644
--- a/arch/xtensa/kernel/pci-dma.c
+++ b/arch/xtensa/kernel/pci-dma.c
@@ -16,26 +16,24 @@
  */
 
 #include <linux/dma-contiguous.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/dma-direct.h>
 #include <linux/gfp.h>
 #include <linux/highmem.h>
 #include <linux/mm.h>
-#include <linux/module.h>
-#include <linux/pci.h>
-#include <linux/string.h>
 #include <linux/types.h>
 #include <asm/cacheflush.h>
 #include <asm/io.h>
 
-static void do_cache_op(dma_addr_t dma_handle, size_t size,
+static void do_cache_op(phys_addr_t paddr, size_t size,
 			void (*fn)(unsigned long, unsigned long))
 {
-	unsigned long off = dma_handle & (PAGE_SIZE - 1);
-	unsigned long pfn = PFN_DOWN(dma_handle);
+	unsigned long off = paddr & (PAGE_SIZE - 1);
+	unsigned long pfn = PFN_DOWN(paddr);
 	struct page *page = pfn_to_page(pfn);
 
 	if (!PageHighMem(page))
-		fn((unsigned long)bus_to_virt(dma_handle), size);
+		fn((unsigned long)phys_to_virt(paddr), size);
 	else
 		while (size > 0) {
 			size_t sz = min_t(size_t, size, PAGE_SIZE - off);
@@ -49,14 +47,13 @@ static void do_cache_op(dma_addr_t dma_handle, size_t size,
 		}
 }
 
-static void xtensa_sync_single_for_cpu(struct device *dev,
-				       dma_addr_t dma_handle, size_t size,
-				       enum dma_data_direction dir)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
 	switch (dir) {
 	case DMA_BIDIRECTIONAL:
 	case DMA_FROM_DEVICE:
-		do_cache_op(dma_handle, size, __invalidate_dcache_range);
+		do_cache_op(paddr, size, __invalidate_dcache_range);
 		break;
 
 	case DMA_NONE:
@@ -68,15 +65,14 @@ static void xtensa_sync_single_for_cpu(struct device *dev,
 	}
 }
 
-static void xtensa_sync_single_for_device(struct device *dev,
-					  dma_addr_t dma_handle, size_t size,
-					  enum dma_data_direction dir)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
 	switch (dir) {
 	case DMA_BIDIRECTIONAL:
 	case DMA_TO_DEVICE:
 		if (XCHAL_DCACHE_IS_WRITEBACK)
-			do_cache_op(dma_handle, size, __flush_dcache_range);
+			do_cache_op(paddr, size, __flush_dcache_range);
 		break;
 
 	case DMA_NONE:
@@ -88,40 +84,13 @@ static void xtensa_sync_single_for_device(struct device *dev,
 	}
 }
 
-static void xtensa_sync_sg_for_cpu(struct device *dev,
-				   struct scatterlist *sg, int nents,
-				   enum dma_data_direction dir)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nents, i) {
-		xtensa_sync_single_for_cpu(dev, sg_dma_address(s),
-					   sg_dma_len(s), dir);
-	}
-}
-
-static void xtensa_sync_sg_for_device(struct device *dev,
-				      struct scatterlist *sg, int nents,
-				      enum dma_data_direction dir)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nents, i) {
-		xtensa_sync_single_for_device(dev, sg_dma_address(s),
-					      sg_dma_len(s), dir);
-	}
-}
-
 /*
  * Note: We assume that the full memory space is always mapped to 'kseg'
  *	 Otherwise we have to use page attributes (not implemented).
  */
 
-static void *xtensa_dma_alloc(struct device *dev, size_t size,
-			      dma_addr_t *handle, gfp_t flag,
-			      unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
+		gfp_t flag, unsigned long attrs)
 {
 	unsigned long ret;
 	unsigned long uncached;
@@ -171,8 +140,8 @@ static void *xtensa_dma_alloc(struct device *dev, size_t size,
 	return (void *)uncached;
 }
 
-static void xtensa_dma_free(struct device *dev, size_t size, void *vaddr,
-			    dma_addr_t dma_handle, unsigned long attrs)
+void arch_dma_free(struct device *dev, size_t size, void *vaddr,
+		dma_addr_t dma_handle, unsigned long attrs)
 {
 	unsigned long count = PAGE_ALIGN(size) >> PAGE_SHIFT;
 	unsigned long addr = (unsigned long)vaddr;
@@ -192,72 +161,3 @@ static void xtensa_dma_free(struct device *dev, size_t size, void *vaddr,
 	if (!dma_release_from_contiguous(dev, page, count))
 		__free_pages(page, get_order(size));
 }
-
-static dma_addr_t xtensa_map_page(struct device *dev, struct page *page,
-				  unsigned long offset, size_t size,
-				  enum dma_data_direction dir,
-				  unsigned long attrs)
-{
-	dma_addr_t dma_handle = page_to_phys(page) + offset;
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		xtensa_sync_single_for_device(dev, dma_handle, size, dir);
-
-	return dma_handle;
-}
-
-static void xtensa_unmap_page(struct device *dev, dma_addr_t dma_handle,
-			      size_t size, enum dma_data_direction dir,
-			      unsigned long attrs)
-{
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		xtensa_sync_single_for_cpu(dev, dma_handle, size, dir);
-}
-
-static int xtensa_map_sg(struct device *dev, struct scatterlist *sg,
-			 int nents, enum dma_data_direction dir,
-			 unsigned long attrs)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nents, i) {
-		s->dma_address = xtensa_map_page(dev, sg_page(s), s->offset,
-						 s->length, dir, attrs);
-	}
-	return nents;
-}
-
-static void xtensa_unmap_sg(struct device *dev,
-			    struct scatterlist *sg, int nents,
-			    enum dma_data_direction dir,
-			    unsigned long attrs)
-{
-	struct scatterlist *s;
-	int i;
-
-	for_each_sg(sg, s, nents, i) {
-		xtensa_unmap_page(dev, sg_dma_address(s),
-				  sg_dma_len(s), dir, attrs);
-	}
-}
-
-int xtensa_dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
-{
-	return 0;
-}
-
-const struct dma_map_ops xtensa_dma_map_ops = {
-	.alloc = xtensa_dma_alloc,
-	.free = xtensa_dma_free,
-	.map_page = xtensa_map_page,
-	.unmap_page = xtensa_unmap_page,
-	.map_sg = xtensa_map_sg,
-	.unmap_sg = xtensa_unmap_sg,
-	.sync_single_for_cpu = xtensa_sync_single_for_cpu,
-	.sync_single_for_device = xtensa_sync_single_for_device,
-	.sync_sg_for_cpu = xtensa_sync_sg_for_cpu,
-	.sync_sg_for_device = xtensa_sync_sg_for_device,
-	.mapping_error = xtensa_dma_mapping_error,
-};
-EXPORT_SYMBOL(xtensa_dma_map_ops);
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 21/22] sparc: use generic dma_noncoherent_ops
  2018-04-20  8:02 ` Christoph Hellwig
                     ` (4 preceding siblings ...)
  (?)
@ 2018-04-20  8:03   ` Christoph Hellwig
  -1 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Switch to the generic noncoherent direct mapping implementation.

This removes the previous sync_single_for_device implementation, which
looks bogus given that no syncing is happening in the similar but more
important map_single case.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/sparc/Kconfig                   |   2 +
 arch/sparc/include/asm/dma-mapping.h |   5 +-
 arch/sparc/kernel/ioport.c           | 151 ++-------------------------
 3 files changed, 14 insertions(+), 144 deletions(-)

diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index c1cfc17eb504..5680eece3014 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -49,6 +49,8 @@ config SPARC
 
 config SPARC32
 	def_bool !64BIT
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
+	select DMA_NONCOHERENT_OPS
 	select GENERIC_ATOMIC64
 	select CLZ_TAB
 	select HAVE_UID16
diff --git a/arch/sparc/include/asm/dma-mapping.h b/arch/sparc/include/asm/dma-mapping.h
index 12ae33daf52f..e17566376934 100644
--- a/arch/sparc/include/asm/dma-mapping.h
+++ b/arch/sparc/include/asm/dma-mapping.h
@@ -7,7 +7,6 @@
 #include <linux/dma-debug.h>
 
 extern const struct dma_map_ops *dma_ops;
-extern const struct dma_map_ops pci32_dma_ops;
 
 extern struct bus_type pci_bus_type;
 
@@ -15,11 +14,11 @@ static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
 {
 #ifdef CONFIG_SPARC_LEON
 	if (sparc_cpu_model == sparc_leon)
-		return &pci32_dma_ops;
+		return &dma_noncoherent_ops;
 #endif
 #if defined(CONFIG_SPARC32) && defined(CONFIG_PCI)
 	if (bus == &pci_bus_type)
-		return &pci32_dma_ops;
+		return &dma_noncoherent_ops;
 #endif
 	return dma_ops;
 }
diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c
index 3bcef9ce74df..7954512c42e7 100644
--- a/arch/sparc/kernel/ioport.c
+++ b/arch/sparc/kernel/ioport.c
@@ -38,6 +38,7 @@
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
 #include <linux/scatterlist.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/of_device.h>
 
 #include <asm/io.h>
@@ -434,9 +435,8 @@ arch_initcall(sparc_register_ioport);
 /* Allocate and map kernel buffer using consistent mode DMA for a device.
  * hwdev should be valid struct pci_dev pointer for PCI devices.
  */
-static void *pci32_alloc_coherent(struct device *dev, size_t len,
-				  dma_addr_t *pba, gfp_t gfp,
-				  unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t len, dma_addr_t *pba, gfp_t gfp,
+		unsigned long attrs)
 {
 	unsigned long len_total = PAGE_ALIGN(len);
 	void *va;
@@ -488,8 +488,8 @@ static void *pci32_alloc_coherent(struct device *dev, size_t len,
  * References to the memory and mappings associated with cpu_addr/dma_addr
  * past this call are illegal.
  */
-static void pci32_free_coherent(struct device *dev, size_t n, void *p,
-				dma_addr_t ba, unsigned long attrs)
+void arch_dma_free(struct device *dev, size_t n, void *p, dma_addr_t ba,
+		unsigned long attrs)
 {
 	struct resource *res;
 
@@ -519,146 +519,15 @@ static void pci32_free_coherent(struct device *dev, size_t n, void *p,
 	free_pages((unsigned long)phys_to_virt(ba), get_order(n));
 }
 
-/*
- * Same as pci_map_single, but with pages.
- */
-static dma_addr_t pci32_map_page(struct device *dev, struct page *page,
-				 unsigned long offset, size_t size,
-				 enum dma_data_direction dir,
-				 unsigned long attrs)
-{
-	/* IIep is write-through, not flushing. */
-	return page_to_phys(page) + offset;
-}
-
-static void pci32_unmap_page(struct device *dev, dma_addr_t ba, size_t size,
-			     enum dma_data_direction dir, unsigned long attrs)
-{
-	if (dir != PCI_DMA_TODEVICE && !(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		dma_make_coherent(ba, PAGE_ALIGN(size));
-}
-
-/* Map a set of buffers described by scatterlist in streaming
- * mode for DMA.  This is the scatter-gather version of the
- * above pci_map_single interface.  Here the scatter gather list
- * elements are each tagged with the appropriate dma address
- * and length.  They are obtained via sg_dma_{address,length}(SG).
- *
- * NOTE: An implementation may be able to use a smaller number of
- *       DMA address/length pairs than there are SG table elements.
- *       (for example via virtual mapping capabilities)
- *       The routine returns the number of addr/length pairs actually
- *       used, at most nents.
- *
- * Device ownership issues as mentioned above for pci_map_single are
- * the same here.
- */
-static int pci32_map_sg(struct device *device, struct scatterlist *sgl,
-			int nents, enum dma_data_direction dir,
-			unsigned long attrs)
-{
-	struct scatterlist *sg;
-	int n;
-
-	/* IIep is write-through, not flushing. */
-	for_each_sg(sgl, sg, nents, n) {
-		sg->dma_address = sg_phys(sg);
-		sg->dma_length = sg->length;
-	}
-	return nents;
-}
-
-/* Unmap a set of streaming mode DMA translations.
- * Again, cpu read rules concerning calls here are the same as for
- * pci_unmap_single() above.
- */
-static void pci32_unmap_sg(struct device *dev, struct scatterlist *sgl,
-			   int nents, enum dma_data_direction dir,
-			   unsigned long attrs)
-{
-	struct scatterlist *sg;
-	int n;
-
-	if (dir != PCI_DMA_TODEVICE && !(attrs & DMA_ATTR_SKIP_CPU_SYNC)) {
-		for_each_sg(sgl, sg, nents, n) {
-			dma_make_coherent(sg_phys(sg), PAGE_ALIGN(sg->length));
-		}
-	}
-}
+/* IIep is write-through, not flushing on cpu to device transfer. */
 
-/* Make physical memory consistent for a single
- * streaming mode DMA translation before or after a transfer.
- *
- * If you perform a pci_map_single() but wish to interrogate the
- * buffer using the cpu, yet do not wish to teardown the PCI dma
- * mapping, you must call this function before doing so.  At the
- * next point you give the PCI dma address back to the card, you
- * must first perform a pci_dma_sync_for_device, and then the
- * device again owns the buffer.
- */
-static void pci32_sync_single_for_cpu(struct device *dev, dma_addr_t ba,
-				      size_t size, enum dma_data_direction dir)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	if (dir != PCI_DMA_TODEVICE) {
-		dma_make_coherent(ba, PAGE_ALIGN(size));
-	}
-}
-
-static void pci32_sync_single_for_device(struct device *dev, dma_addr_t ba,
-					 size_t size, enum dma_data_direction dir)
-{
-	if (dir != PCI_DMA_TODEVICE) {
-		dma_make_coherent(ba, PAGE_ALIGN(size));
-	}
+	if (dir != PCI_DMA_TODEVICE)
+		dma_make_coherent(paddr, PAGE_ALIGN(size));
 }
 
-/* Make physical memory consistent for a set of streaming
- * mode DMA translations after a transfer.
- *
- * The same as pci_dma_sync_single_* but for a scatter-gather list,
- * same rules and usage.
- */
-static void pci32_sync_sg_for_cpu(struct device *dev, struct scatterlist *sgl,
-				  int nents, enum dma_data_direction dir)
-{
-	struct scatterlist *sg;
-	int n;
-
-	if (dir != PCI_DMA_TODEVICE) {
-		for_each_sg(sgl, sg, nents, n) {
-			dma_make_coherent(sg_phys(sg), PAGE_ALIGN(sg->length));
-		}
-	}
-}
-
-static void pci32_sync_sg_for_device(struct device *device, struct scatterlist *sgl,
-				     int nents, enum dma_data_direction dir)
-{
-	struct scatterlist *sg;
-	int n;
-
-	if (dir != PCI_DMA_TODEVICE) {
-		for_each_sg(sgl, sg, nents, n) {
-			dma_make_coherent(sg_phys(sg), PAGE_ALIGN(sg->length));
-		}
-	}
-}
-
-/* note: leon re-uses pci32_dma_ops */
-const struct dma_map_ops pci32_dma_ops = {
-	.alloc			= pci32_alloc_coherent,
-	.free			= pci32_free_coherent,
-	.map_page		= pci32_map_page,
-	.unmap_page		= pci32_unmap_page,
-	.map_sg			= pci32_map_sg,
-	.unmap_sg		= pci32_unmap_sg,
-	.sync_single_for_cpu	= pci32_sync_single_for_cpu,
-	.sync_single_for_device	= pci32_sync_single_for_device,
-	.sync_sg_for_cpu	= pci32_sync_sg_for_cpu,
-	.sync_sg_for_device	= pci32_sync_sg_for_device,
-};
-EXPORT_SYMBOL(pci32_dma_ops);
-
 const struct dma_map_ops *dma_ops = &sbus_dma_ops;
 EXPORT_SYMBOL(dma_ops);
 
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 21/22] sparc: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Switch to the generic noncoherent direct mapping implementation.

This removes the previous sync_single_for_device implementation, which
looks bogus given that no syncing is happening in the similar but more
important map_single case.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/sparc/Kconfig                   |   2 +
 arch/sparc/include/asm/dma-mapping.h |   5 +-
 arch/sparc/kernel/ioport.c           | 151 ++-------------------------
 3 files changed, 14 insertions(+), 144 deletions(-)

diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index c1cfc17eb504..5680eece3014 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -49,6 +49,8 @@ config SPARC
 
 config SPARC32
 	def_bool !64BIT
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
+	select DMA_NONCOHERENT_OPS
 	select GENERIC_ATOMIC64
 	select CLZ_TAB
 	select HAVE_UID16
diff --git a/arch/sparc/include/asm/dma-mapping.h b/arch/sparc/include/asm/dma-mapping.h
index 12ae33daf52f..e17566376934 100644
--- a/arch/sparc/include/asm/dma-mapping.h
+++ b/arch/sparc/include/asm/dma-mapping.h
@@ -7,7 +7,6 @@
 #include <linux/dma-debug.h>
 
 extern const struct dma_map_ops *dma_ops;
-extern const struct dma_map_ops pci32_dma_ops;
 
 extern struct bus_type pci_bus_type;
 
@@ -15,11 +14,11 @@ static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
 {
 #ifdef CONFIG_SPARC_LEON
 	if (sparc_cpu_model == sparc_leon)
-		return &pci32_dma_ops;
+		return &dma_noncoherent_ops;
 #endif
 #if defined(CONFIG_SPARC32) && defined(CONFIG_PCI)
 	if (bus == &pci_bus_type)
-		return &pci32_dma_ops;
+		return &dma_noncoherent_ops;
 #endif
 	return dma_ops;
 }
diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c
index 3bcef9ce74df..7954512c42e7 100644
--- a/arch/sparc/kernel/ioport.c
+++ b/arch/sparc/kernel/ioport.c
@@ -38,6 +38,7 @@
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
 #include <linux/scatterlist.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/of_device.h>
 
 #include <asm/io.h>
@@ -434,9 +435,8 @@ arch_initcall(sparc_register_ioport);
 /* Allocate and map kernel buffer using consistent mode DMA for a device.
  * hwdev should be valid struct pci_dev pointer for PCI devices.
  */
-static void *pci32_alloc_coherent(struct device *dev, size_t len,
-				  dma_addr_t *pba, gfp_t gfp,
-				  unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t len, dma_addr_t *pba, gfp_t gfp,
+		unsigned long attrs)
 {
 	unsigned long len_total = PAGE_ALIGN(len);
 	void *va;
@@ -488,8 +488,8 @@ static void *pci32_alloc_coherent(struct device *dev, size_t len,
  * References to the memory and mappings associated with cpu_addr/dma_addr
  * past this call are illegal.
  */
-static void pci32_free_coherent(struct device *dev, size_t n, void *p,
-				dma_addr_t ba, unsigned long attrs)
+void arch_dma_free(struct device *dev, size_t n, void *p, dma_addr_t ba,
+		unsigned long attrs)
 {
 	struct resource *res;
 
@@ -519,146 +519,15 @@ static void pci32_free_coherent(struct device *dev, size_t n, void *p,
 	free_pages((unsigned long)phys_to_virt(ba), get_order(n));
 }
 
-/*
- * Same as pci_map_single, but with pages.
- */
-static dma_addr_t pci32_map_page(struct device *dev, struct page *page,
-				 unsigned long offset, size_t size,
-				 enum dma_data_direction dir,
-				 unsigned long attrs)
-{
-	/* IIep is write-through, not flushing. */
-	return page_to_phys(page) + offset;
-}
-
-static void pci32_unmap_page(struct device *dev, dma_addr_t ba, size_t size,
-			     enum dma_data_direction dir, unsigned long attrs)
-{
-	if (dir != PCI_DMA_TODEVICE && !(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		dma_make_coherent(ba, PAGE_ALIGN(size));
-}
-
-/* Map a set of buffers described by scatterlist in streaming
- * mode for DMA.  This is the scatter-gather version of the
- * above pci_map_single interface.  Here the scatter gather list
- * elements are each tagged with the appropriate dma address
- * and length.  They are obtained via sg_dma_{address,length}(SG).
- *
- * NOTE: An implementation may be able to use a smaller number of
- *       DMA address/length pairs than there are SG table elements.
- *       (for example via virtual mapping capabilities)
- *       The routine returns the number of addr/length pairs actually
- *       used, at most nents.
- *
- * Device ownership issues as mentioned above for pci_map_single are
- * the same here.
- */
-static int pci32_map_sg(struct device *device, struct scatterlist *sgl,
-			int nents, enum dma_data_direction dir,
-			unsigned long attrs)
-{
-	struct scatterlist *sg;
-	int n;
-
-	/* IIep is write-through, not flushing. */
-	for_each_sg(sgl, sg, nents, n) {
-		sg->dma_address = sg_phys(sg);
-		sg->dma_length = sg->length;
-	}
-	return nents;
-}
-
-/* Unmap a set of streaming mode DMA translations.
- * Again, cpu read rules concerning calls here are the same as for
- * pci_unmap_single() above.
- */
-static void pci32_unmap_sg(struct device *dev, struct scatterlist *sgl,
-			   int nents, enum dma_data_direction dir,
-			   unsigned long attrs)
-{
-	struct scatterlist *sg;
-	int n;
-
-	if (dir != PCI_DMA_TODEVICE && !(attrs & DMA_ATTR_SKIP_CPU_SYNC)) {
-		for_each_sg(sgl, sg, nents, n) {
-			dma_make_coherent(sg_phys(sg), PAGE_ALIGN(sg->length));
-		}
-	}
-}
+/* IIep is write-through, not flushing on cpu to device transfer. */
 
-/* Make physical memory consistent for a single
- * streaming mode DMA translation before or after a transfer.
- *
- * If you perform a pci_map_single() but wish to interrogate the
- * buffer using the cpu, yet do not wish to teardown the PCI dma
- * mapping, you must call this function before doing so.  At the
- * next point you give the PCI dma address back to the card, you
- * must first perform a pci_dma_sync_for_device, and then the
- * device again owns the buffer.
- */
-static void pci32_sync_single_for_cpu(struct device *dev, dma_addr_t ba,
-				      size_t size, enum dma_data_direction dir)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	if (dir != PCI_DMA_TODEVICE) {
-		dma_make_coherent(ba, PAGE_ALIGN(size));
-	}
-}
-
-static void pci32_sync_single_for_device(struct device *dev, dma_addr_t ba,
-					 size_t size, enum dma_data_direction dir)
-{
-	if (dir != PCI_DMA_TODEVICE) {
-		dma_make_coherent(ba, PAGE_ALIGN(size));
-	}
+	if (dir != PCI_DMA_TODEVICE)
+		dma_make_coherent(paddr, PAGE_ALIGN(size));
 }
 
-/* Make physical memory consistent for a set of streaming
- * mode DMA translations after a transfer.
- *
- * The same as pci_dma_sync_single_* but for a scatter-gather list,
- * same rules and usage.
- */
-static void pci32_sync_sg_for_cpu(struct device *dev, struct scatterlist *sgl,
-				  int nents, enum dma_data_direction dir)
-{
-	struct scatterlist *sg;
-	int n;
-
-	if (dir != PCI_DMA_TODEVICE) {
-		for_each_sg(sgl, sg, nents, n) {
-			dma_make_coherent(sg_phys(sg), PAGE_ALIGN(sg->length));
-		}
-	}
-}
-
-static void pci32_sync_sg_for_device(struct device *device, struct scatterlist *sgl,
-				     int nents, enum dma_data_direction dir)
-{
-	struct scatterlist *sg;
-	int n;
-
-	if (dir != PCI_DMA_TODEVICE) {
-		for_each_sg(sgl, sg, nents, n) {
-			dma_make_coherent(sg_phys(sg), PAGE_ALIGN(sg->length));
-		}
-	}
-}
-
-/* note: leon re-uses pci32_dma_ops */
-const struct dma_map_ops pci32_dma_ops = {
-	.alloc			= pci32_alloc_coherent,
-	.free			= pci32_free_coherent,
-	.map_page		= pci32_map_page,
-	.unmap_page		= pci32_unmap_page,
-	.map_sg			= pci32_map_sg,
-	.unmap_sg		= pci32_unmap_sg,
-	.sync_single_for_cpu	= pci32_sync_single_for_cpu,
-	.sync_single_for_device	= pci32_sync_single_for_device,
-	.sync_sg_for_cpu	= pci32_sync_sg_for_cpu,
-	.sync_sg_for_device	= pci32_sync_sg_for_device,
-};
-EXPORT_SYMBOL(pci32_dma_ops);
-
 const struct dma_map_ops *dma_ops = &sbus_dma_ops;
 EXPORT_SYMBOL(dma_ops);
 
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 21/22] sparc: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Switch to the generic noncoherent direct mapping implementation.

This removes the previous sync_single_for_device implementation, which
looks bogus given that no syncing is happening in the similar but more
important map_single case.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/sparc/Kconfig                   |   2 +
 arch/sparc/include/asm/dma-mapping.h |   5 +-
 arch/sparc/kernel/ioport.c           | 151 ++-------------------------
 3 files changed, 14 insertions(+), 144 deletions(-)

diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index c1cfc17eb504..5680eece3014 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -49,6 +49,8 @@ config SPARC
 
 config SPARC32
 	def_bool !64BIT
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
+	select DMA_NONCOHERENT_OPS
 	select GENERIC_ATOMIC64
 	select CLZ_TAB
 	select HAVE_UID16
diff --git a/arch/sparc/include/asm/dma-mapping.h b/arch/sparc/include/asm/dma-mapping.h
index 12ae33daf52f..e17566376934 100644
--- a/arch/sparc/include/asm/dma-mapping.h
+++ b/arch/sparc/include/asm/dma-mapping.h
@@ -7,7 +7,6 @@
 #include <linux/dma-debug.h>
 
 extern const struct dma_map_ops *dma_ops;
-extern const struct dma_map_ops pci32_dma_ops;
 
 extern struct bus_type pci_bus_type;
 
@@ -15,11 +14,11 @@ static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
 {
 #ifdef CONFIG_SPARC_LEON
 	if (sparc_cpu_model == sparc_leon)
-		return &pci32_dma_ops;
+		return &dma_noncoherent_ops;
 #endif
 #if defined(CONFIG_SPARC32) && defined(CONFIG_PCI)
 	if (bus == &pci_bus_type)
-		return &pci32_dma_ops;
+		return &dma_noncoherent_ops;
 #endif
 	return dma_ops;
 }
diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c
index 3bcef9ce74df..7954512c42e7 100644
--- a/arch/sparc/kernel/ioport.c
+++ b/arch/sparc/kernel/ioport.c
@@ -38,6 +38,7 @@
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
 #include <linux/scatterlist.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/of_device.h>
 
 #include <asm/io.h>
@@ -434,9 +435,8 @@ arch_initcall(sparc_register_ioport);
 /* Allocate and map kernel buffer using consistent mode DMA for a device.
  * hwdev should be valid struct pci_dev pointer for PCI devices.
  */
-static void *pci32_alloc_coherent(struct device *dev, size_t len,
-				  dma_addr_t *pba, gfp_t gfp,
-				  unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t len, dma_addr_t *pba, gfp_t gfp,
+		unsigned long attrs)
 {
 	unsigned long len_total = PAGE_ALIGN(len);
 	void *va;
@@ -488,8 +488,8 @@ static void *pci32_alloc_coherent(struct device *dev, size_t len,
  * References to the memory and mappings associated with cpu_addr/dma_addr
  * past this call are illegal.
  */
-static void pci32_free_coherent(struct device *dev, size_t n, void *p,
-				dma_addr_t ba, unsigned long attrs)
+void arch_dma_free(struct device *dev, size_t n, void *p, dma_addr_t ba,
+		unsigned long attrs)
 {
 	struct resource *res;
 
@@ -519,146 +519,15 @@ static void pci32_free_coherent(struct device *dev, size_t n, void *p,
 	free_pages((unsigned long)phys_to_virt(ba), get_order(n));
 }
 
-/*
- * Same as pci_map_single, but with pages.
- */
-static dma_addr_t pci32_map_page(struct device *dev, struct page *page,
-				 unsigned long offset, size_t size,
-				 enum dma_data_direction dir,
-				 unsigned long attrs)
-{
-	/* IIep is write-through, not flushing. */
-	return page_to_phys(page) + offset;
-}
-
-static void pci32_unmap_page(struct device *dev, dma_addr_t ba, size_t size,
-			     enum dma_data_direction dir, unsigned long attrs)
-{
-	if (dir != PCI_DMA_TODEVICE && !(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		dma_make_coherent(ba, PAGE_ALIGN(size));
-}
-
-/* Map a set of buffers described by scatterlist in streaming
- * mode for DMA.  This is the scatter-gather version of the
- * above pci_map_single interface.  Here the scatter gather list
- * elements are each tagged with the appropriate dma address
- * and length.  They are obtained via sg_dma_{address,length}(SG).
- *
- * NOTE: An implementation may be able to use a smaller number of
- *       DMA address/length pairs than there are SG table elements.
- *       (for example via virtual mapping capabilities)
- *       The routine returns the number of addr/length pairs actually
- *       used, at most nents.
- *
- * Device ownership issues as mentioned above for pci_map_single are
- * the same here.
- */
-static int pci32_map_sg(struct device *device, struct scatterlist *sgl,
-			int nents, enum dma_data_direction dir,
-			unsigned long attrs)
-{
-	struct scatterlist *sg;
-	int n;
-
-	/* IIep is write-through, not flushing. */
-	for_each_sg(sgl, sg, nents, n) {
-		sg->dma_address = sg_phys(sg);
-		sg->dma_length = sg->length;
-	}
-	return nents;
-}
-
-/* Unmap a set of streaming mode DMA translations.
- * Again, cpu read rules concerning calls here are the same as for
- * pci_unmap_single() above.
- */
-static void pci32_unmap_sg(struct device *dev, struct scatterlist *sgl,
-			   int nents, enum dma_data_direction dir,
-			   unsigned long attrs)
-{
-	struct scatterlist *sg;
-	int n;
-
-	if (dir != PCI_DMA_TODEVICE && !(attrs & DMA_ATTR_SKIP_CPU_SYNC)) {
-		for_each_sg(sgl, sg, nents, n) {
-			dma_make_coherent(sg_phys(sg), PAGE_ALIGN(sg->length));
-		}
-	}
-}
+/* IIep is write-through, not flushing on cpu to device transfer. */
 
-/* Make physical memory consistent for a single
- * streaming mode DMA translation before or after a transfer.
- *
- * If you perform a pci_map_single() but wish to interrogate the
- * buffer using the cpu, yet do not wish to teardown the PCI dma
- * mapping, you must call this function before doing so.  At the
- * next point you give the PCI dma address back to the card, you
- * must first perform a pci_dma_sync_for_device, and then the
- * device again owns the buffer.
- */
-static void pci32_sync_single_for_cpu(struct device *dev, dma_addr_t ba,
-				      size_t size, enum dma_data_direction dir)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	if (dir != PCI_DMA_TODEVICE) {
-		dma_make_coherent(ba, PAGE_ALIGN(size));
-	}
-}
-
-static void pci32_sync_single_for_device(struct device *dev, dma_addr_t ba,
-					 size_t size, enum dma_data_direction dir)
-{
-	if (dir != PCI_DMA_TODEVICE) {
-		dma_make_coherent(ba, PAGE_ALIGN(size));
-	}
+	if (dir != PCI_DMA_TODEVICE)
+		dma_make_coherent(paddr, PAGE_ALIGN(size));
 }
 
-/* Make physical memory consistent for a set of streaming
- * mode DMA translations after a transfer.
- *
- * The same as pci_dma_sync_single_* but for a scatter-gather list,
- * same rules and usage.
- */
-static void pci32_sync_sg_for_cpu(struct device *dev, struct scatterlist *sgl,
-				  int nents, enum dma_data_direction dir)
-{
-	struct scatterlist *sg;
-	int n;
-
-	if (dir != PCI_DMA_TODEVICE) {
-		for_each_sg(sgl, sg, nents, n) {
-			dma_make_coherent(sg_phys(sg), PAGE_ALIGN(sg->length));
-		}
-	}
-}
-
-static void pci32_sync_sg_for_device(struct device *device, struct scatterlist *sgl,
-				     int nents, enum dma_data_direction dir)
-{
-	struct scatterlist *sg;
-	int n;
-
-	if (dir != PCI_DMA_TODEVICE) {
-		for_each_sg(sgl, sg, nents, n) {
-			dma_make_coherent(sg_phys(sg), PAGE_ALIGN(sg->length));
-		}
-	}
-}
-
-/* note: leon re-uses pci32_dma_ops */
-const struct dma_map_ops pci32_dma_ops = {
-	.alloc			= pci32_alloc_coherent,
-	.free			= pci32_free_coherent,
-	.map_page		= pci32_map_page,
-	.unmap_page		= pci32_unmap_page,
-	.map_sg			= pci32_map_sg,
-	.unmap_sg		= pci32_unmap_sg,
-	.sync_single_for_cpu	= pci32_sync_single_for_cpu,
-	.sync_single_for_device	= pci32_sync_single_for_device,
-	.sync_sg_for_cpu	= pci32_sync_sg_for_cpu,
-	.sync_sg_for_device	= pci32_sync_sg_for_device,
-};
-EXPORT_SYMBOL(pci32_dma_ops);
-
 const struct dma_map_ops *dma_ops = &sbus_dma_ops;
 EXPORT_SYMBOL(dma_ops);
 
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 21/22] sparc: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  To: linux-snps-arc

Switch to the generic noncoherent direct mapping implementation.

This removes the previous sync_single_for_device implementation, which
looks bogus given that no syncing is happening in the similar but more
important map_single case.

Signed-off-by: Christoph Hellwig <hch at lst.de>
---
 arch/sparc/Kconfig                   |   2 +
 arch/sparc/include/asm/dma-mapping.h |   5 +-
 arch/sparc/kernel/ioport.c           | 151 ++-------------------------
 3 files changed, 14 insertions(+), 144 deletions(-)

diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index c1cfc17eb504..5680eece3014 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -49,6 +49,8 @@ config SPARC
 
 config SPARC32
 	def_bool !64BIT
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
+	select DMA_NONCOHERENT_OPS
 	select GENERIC_ATOMIC64
 	select CLZ_TAB
 	select HAVE_UID16
diff --git a/arch/sparc/include/asm/dma-mapping.h b/arch/sparc/include/asm/dma-mapping.h
index 12ae33daf52f..e17566376934 100644
--- a/arch/sparc/include/asm/dma-mapping.h
+++ b/arch/sparc/include/asm/dma-mapping.h
@@ -7,7 +7,6 @@
 #include <linux/dma-debug.h>
 
 extern const struct dma_map_ops *dma_ops;
-extern const struct dma_map_ops pci32_dma_ops;
 
 extern struct bus_type pci_bus_type;
 
@@ -15,11 +14,11 @@ static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
 {
 #ifdef CONFIG_SPARC_LEON
 	if (sparc_cpu_model == sparc_leon)
-		return &pci32_dma_ops;
+		return &dma_noncoherent_ops;
 #endif
 #if defined(CONFIG_SPARC32) && defined(CONFIG_PCI)
 	if (bus == &pci_bus_type)
-		return &pci32_dma_ops;
+		return &dma_noncoherent_ops;
 #endif
 	return dma_ops;
 }
diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c
index 3bcef9ce74df..7954512c42e7 100644
--- a/arch/sparc/kernel/ioport.c
+++ b/arch/sparc/kernel/ioport.c
@@ -38,6 +38,7 @@
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
 #include <linux/scatterlist.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/of_device.h>
 
 #include <asm/io.h>
@@ -434,9 +435,8 @@ arch_initcall(sparc_register_ioport);
 /* Allocate and map kernel buffer using consistent mode DMA for a device.
  * hwdev should be valid struct pci_dev pointer for PCI devices.
  */
-static void *pci32_alloc_coherent(struct device *dev, size_t len,
-				  dma_addr_t *pba, gfp_t gfp,
-				  unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t len, dma_addr_t *pba, gfp_t gfp,
+		unsigned long attrs)
 {
 	unsigned long len_total = PAGE_ALIGN(len);
 	void *va;
@@ -488,8 +488,8 @@ static void *pci32_alloc_coherent(struct device *dev, size_t len,
  * References to the memory and mappings associated with cpu_addr/dma_addr
  * past this call are illegal.
  */
-static void pci32_free_coherent(struct device *dev, size_t n, void *p,
-				dma_addr_t ba, unsigned long attrs)
+void arch_dma_free(struct device *dev, size_t n, void *p, dma_addr_t ba,
+		unsigned long attrs)
 {
 	struct resource *res;
 
@@ -519,146 +519,15 @@ static void pci32_free_coherent(struct device *dev, size_t n, void *p,
 	free_pages((unsigned long)phys_to_virt(ba), get_order(n));
 }
 
-/*
- * Same as pci_map_single, but with pages.
- */
-static dma_addr_t pci32_map_page(struct device *dev, struct page *page,
-				 unsigned long offset, size_t size,
-				 enum dma_data_direction dir,
-				 unsigned long attrs)
-{
-	/* IIep is write-through, not flushing. */
-	return page_to_phys(page) + offset;
-}
-
-static void pci32_unmap_page(struct device *dev, dma_addr_t ba, size_t size,
-			     enum dma_data_direction dir, unsigned long attrs)
-{
-	if (dir != PCI_DMA_TODEVICE && !(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		dma_make_coherent(ba, PAGE_ALIGN(size));
-}
-
-/* Map a set of buffers described by scatterlist in streaming
- * mode for DMA.  This is the scatter-gather version of the
- * above pci_map_single interface.  Here the scatter gather list
- * elements are each tagged with the appropriate dma address
- * and length.  They are obtained via sg_dma_{address,length}(SG).
- *
- * NOTE: An implementation may be able to use a smaller number of
- *       DMA address/length pairs than there are SG table elements.
- *       (for example via virtual mapping capabilities)
- *       The routine returns the number of addr/length pairs actually
- *       used, at most nents.
- *
- * Device ownership issues as mentioned above for pci_map_single are
- * the same here.
- */
-static int pci32_map_sg(struct device *device, struct scatterlist *sgl,
-			int nents, enum dma_data_direction dir,
-			unsigned long attrs)
-{
-	struct scatterlist *sg;
-	int n;
-
-	/* IIep is write-through, not flushing. */
-	for_each_sg(sgl, sg, nents, n) {
-		sg->dma_address = sg_phys(sg);
-		sg->dma_length = sg->length;
-	}
-	return nents;
-}
-
-/* Unmap a set of streaming mode DMA translations.
- * Again, cpu read rules concerning calls here are the same as for
- * pci_unmap_single() above.
- */
-static void pci32_unmap_sg(struct device *dev, struct scatterlist *sgl,
-			   int nents, enum dma_data_direction dir,
-			   unsigned long attrs)
-{
-	struct scatterlist *sg;
-	int n;
-
-	if (dir != PCI_DMA_TODEVICE && !(attrs & DMA_ATTR_SKIP_CPU_SYNC)) {
-		for_each_sg(sgl, sg, nents, n) {
-			dma_make_coherent(sg_phys(sg), PAGE_ALIGN(sg->length));
-		}
-	}
-}
+/* IIep is write-through, not flushing on cpu to device transfer. */
 
-/* Make physical memory consistent for a single
- * streaming mode DMA translation before or after a transfer.
- *
- * If you perform a pci_map_single() but wish to interrogate the
- * buffer using the cpu, yet do not wish to teardown the PCI dma
- * mapping, you must call this function before doing so.  At the
- * next point you give the PCI dma address back to the card, you
- * must first perform a pci_dma_sync_for_device, and then the
- * device again owns the buffer.
- */
-static void pci32_sync_single_for_cpu(struct device *dev, dma_addr_t ba,
-				      size_t size, enum dma_data_direction dir)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	if (dir != PCI_DMA_TODEVICE) {
-		dma_make_coherent(ba, PAGE_ALIGN(size));
-	}
-}
-
-static void pci32_sync_single_for_device(struct device *dev, dma_addr_t ba,
-					 size_t size, enum dma_data_direction dir)
-{
-	if (dir != PCI_DMA_TODEVICE) {
-		dma_make_coherent(ba, PAGE_ALIGN(size));
-	}
+	if (dir != PCI_DMA_TODEVICE)
+		dma_make_coherent(paddr, PAGE_ALIGN(size));
 }
 
-/* Make physical memory consistent for a set of streaming
- * mode DMA translations after a transfer.
- *
- * The same as pci_dma_sync_single_* but for a scatter-gather list,
- * same rules and usage.
- */
-static void pci32_sync_sg_for_cpu(struct device *dev, struct scatterlist *sgl,
-				  int nents, enum dma_data_direction dir)
-{
-	struct scatterlist *sg;
-	int n;
-
-	if (dir != PCI_DMA_TODEVICE) {
-		for_each_sg(sgl, sg, nents, n) {
-			dma_make_coherent(sg_phys(sg), PAGE_ALIGN(sg->length));
-		}
-	}
-}
-
-static void pci32_sync_sg_for_device(struct device *device, struct scatterlist *sgl,
-				     int nents, enum dma_data_direction dir)
-{
-	struct scatterlist *sg;
-	int n;
-
-	if (dir != PCI_DMA_TODEVICE) {
-		for_each_sg(sgl, sg, nents, n) {
-			dma_make_coherent(sg_phys(sg), PAGE_ALIGN(sg->length));
-		}
-	}
-}
-
-/* note: leon re-uses pci32_dma_ops */
-const struct dma_map_ops pci32_dma_ops = {
-	.alloc			= pci32_alloc_coherent,
-	.free			= pci32_free_coherent,
-	.map_page		= pci32_map_page,
-	.unmap_page		= pci32_unmap_page,
-	.map_sg			= pci32_map_sg,
-	.unmap_sg		= pci32_unmap_sg,
-	.sync_single_for_cpu	= pci32_sync_single_for_cpu,
-	.sync_single_for_device	= pci32_sync_single_for_device,
-	.sync_sg_for_cpu	= pci32_sync_sg_for_cpu,
-	.sync_sg_for_device	= pci32_sync_sg_for_device,
-};
-EXPORT_SYMBOL(pci32_dma_ops);
-
 const struct dma_map_ops *dma_ops = &sbus_dma_ops;
 EXPORT_SYMBOL(dma_ops);
 
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 21/22] sparc: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Switch to the generic noncoherent direct mapping implementation.

This removes the previous sync_single_for_device implementation, which
looks bogus given that no syncing is happening in the similar but more
important map_single case.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/sparc/Kconfig                   |   2 +
 arch/sparc/include/asm/dma-mapping.h |   5 +-
 arch/sparc/kernel/ioport.c           | 151 ++-------------------------
 3 files changed, 14 insertions(+), 144 deletions(-)

diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index c1cfc17eb504..5680eece3014 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -49,6 +49,8 @@ config SPARC
 
 config SPARC32
 	def_bool !64BIT
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
+	select DMA_NONCOHERENT_OPS
 	select GENERIC_ATOMIC64
 	select CLZ_TAB
 	select HAVE_UID16
diff --git a/arch/sparc/include/asm/dma-mapping.h b/arch/sparc/include/asm/dma-mapping.h
index 12ae33daf52f..e17566376934 100644
--- a/arch/sparc/include/asm/dma-mapping.h
+++ b/arch/sparc/include/asm/dma-mapping.h
@@ -7,7 +7,6 @@
 #include <linux/dma-debug.h>
 
 extern const struct dma_map_ops *dma_ops;
-extern const struct dma_map_ops pci32_dma_ops;
 
 extern struct bus_type pci_bus_type;
 
@@ -15,11 +14,11 @@ static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
 {
 #ifdef CONFIG_SPARC_LEON
 	if (sparc_cpu_model = sparc_leon)
-		return &pci32_dma_ops;
+		return &dma_noncoherent_ops;
 #endif
 #if defined(CONFIG_SPARC32) && defined(CONFIG_PCI)
 	if (bus = &pci_bus_type)
-		return &pci32_dma_ops;
+		return &dma_noncoherent_ops;
 #endif
 	return dma_ops;
 }
diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c
index 3bcef9ce74df..7954512c42e7 100644
--- a/arch/sparc/kernel/ioport.c
+++ b/arch/sparc/kernel/ioport.c
@@ -38,6 +38,7 @@
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
 #include <linux/scatterlist.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/of_device.h>
 
 #include <asm/io.h>
@@ -434,9 +435,8 @@ arch_initcall(sparc_register_ioport);
 /* Allocate and map kernel buffer using consistent mode DMA for a device.
  * hwdev should be valid struct pci_dev pointer for PCI devices.
  */
-static void *pci32_alloc_coherent(struct device *dev, size_t len,
-				  dma_addr_t *pba, gfp_t gfp,
-				  unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t len, dma_addr_t *pba, gfp_t gfp,
+		unsigned long attrs)
 {
 	unsigned long len_total = PAGE_ALIGN(len);
 	void *va;
@@ -488,8 +488,8 @@ static void *pci32_alloc_coherent(struct device *dev, size_t len,
  * References to the memory and mappings associated with cpu_addr/dma_addr
  * past this call are illegal.
  */
-static void pci32_free_coherent(struct device *dev, size_t n, void *p,
-				dma_addr_t ba, unsigned long attrs)
+void arch_dma_free(struct device *dev, size_t n, void *p, dma_addr_t ba,
+		unsigned long attrs)
 {
 	struct resource *res;
 
@@ -519,146 +519,15 @@ static void pci32_free_coherent(struct device *dev, size_t n, void *p,
 	free_pages((unsigned long)phys_to_virt(ba), get_order(n));
 }
 
-/*
- * Same as pci_map_single, but with pages.
- */
-static dma_addr_t pci32_map_page(struct device *dev, struct page *page,
-				 unsigned long offset, size_t size,
-				 enum dma_data_direction dir,
-				 unsigned long attrs)
-{
-	/* IIep is write-through, not flushing. */
-	return page_to_phys(page) + offset;
-}
-
-static void pci32_unmap_page(struct device *dev, dma_addr_t ba, size_t size,
-			     enum dma_data_direction dir, unsigned long attrs)
-{
-	if (dir != PCI_DMA_TODEVICE && !(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		dma_make_coherent(ba, PAGE_ALIGN(size));
-}
-
-/* Map a set of buffers described by scatterlist in streaming
- * mode for DMA.  This is the scatter-gather version of the
- * above pci_map_single interface.  Here the scatter gather list
- * elements are each tagged with the appropriate dma address
- * and length.  They are obtained via sg_dma_{address,length}(SG).
- *
- * NOTE: An implementation may be able to use a smaller number of
- *       DMA address/length pairs than there are SG table elements.
- *       (for example via virtual mapping capabilities)
- *       The routine returns the number of addr/length pairs actually
- *       used, at most nents.
- *
- * Device ownership issues as mentioned above for pci_map_single are
- * the same here.
- */
-static int pci32_map_sg(struct device *device, struct scatterlist *sgl,
-			int nents, enum dma_data_direction dir,
-			unsigned long attrs)
-{
-	struct scatterlist *sg;
-	int n;
-
-	/* IIep is write-through, not flushing. */
-	for_each_sg(sgl, sg, nents, n) {
-		sg->dma_address = sg_phys(sg);
-		sg->dma_length = sg->length;
-	}
-	return nents;
-}
-
-/* Unmap a set of streaming mode DMA translations.
- * Again, cpu read rules concerning calls here are the same as for
- * pci_unmap_single() above.
- */
-static void pci32_unmap_sg(struct device *dev, struct scatterlist *sgl,
-			   int nents, enum dma_data_direction dir,
-			   unsigned long attrs)
-{
-	struct scatterlist *sg;
-	int n;
-
-	if (dir != PCI_DMA_TODEVICE && !(attrs & DMA_ATTR_SKIP_CPU_SYNC)) {
-		for_each_sg(sgl, sg, nents, n) {
-			dma_make_coherent(sg_phys(sg), PAGE_ALIGN(sg->length));
-		}
-	}
-}
+/* IIep is write-through, not flushing on cpu to device transfer. */
 
-/* Make physical memory consistent for a single
- * streaming mode DMA translation before or after a transfer.
- *
- * If you perform a pci_map_single() but wish to interrogate the
- * buffer using the cpu, yet do not wish to teardown the PCI dma
- * mapping, you must call this function before doing so.  At the
- * next point you give the PCI dma address back to the card, you
- * must first perform a pci_dma_sync_for_device, and then the
- * device again owns the buffer.
- */
-static void pci32_sync_single_for_cpu(struct device *dev, dma_addr_t ba,
-				      size_t size, enum dma_data_direction dir)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	if (dir != PCI_DMA_TODEVICE) {
-		dma_make_coherent(ba, PAGE_ALIGN(size));
-	}
-}
-
-static void pci32_sync_single_for_device(struct device *dev, dma_addr_t ba,
-					 size_t size, enum dma_data_direction dir)
-{
-	if (dir != PCI_DMA_TODEVICE) {
-		dma_make_coherent(ba, PAGE_ALIGN(size));
-	}
+	if (dir != PCI_DMA_TODEVICE)
+		dma_make_coherent(paddr, PAGE_ALIGN(size));
 }
 
-/* Make physical memory consistent for a set of streaming
- * mode DMA translations after a transfer.
- *
- * The same as pci_dma_sync_single_* but for a scatter-gather list,
- * same rules and usage.
- */
-static void pci32_sync_sg_for_cpu(struct device *dev, struct scatterlist *sgl,
-				  int nents, enum dma_data_direction dir)
-{
-	struct scatterlist *sg;
-	int n;
-
-	if (dir != PCI_DMA_TODEVICE) {
-		for_each_sg(sgl, sg, nents, n) {
-			dma_make_coherent(sg_phys(sg), PAGE_ALIGN(sg->length));
-		}
-	}
-}
-
-static void pci32_sync_sg_for_device(struct device *device, struct scatterlist *sgl,
-				     int nents, enum dma_data_direction dir)
-{
-	struct scatterlist *sg;
-	int n;
-
-	if (dir != PCI_DMA_TODEVICE) {
-		for_each_sg(sgl, sg, nents, n) {
-			dma_make_coherent(sg_phys(sg), PAGE_ALIGN(sg->length));
-		}
-	}
-}
-
-/* note: leon re-uses pci32_dma_ops */
-const struct dma_map_ops pci32_dma_ops = {
-	.alloc			= pci32_alloc_coherent,
-	.free			= pci32_free_coherent,
-	.map_page		= pci32_map_page,
-	.unmap_page		= pci32_unmap_page,
-	.map_sg			= pci32_map_sg,
-	.unmap_sg		= pci32_unmap_sg,
-	.sync_single_for_cpu	= pci32_sync_single_for_cpu,
-	.sync_single_for_device	= pci32_sync_single_for_device,
-	.sync_sg_for_cpu	= pci32_sync_sg_for_cpu,
-	.sync_sg_for_device	= pci32_sync_sg_for_device,
-};
-EXPORT_SYMBOL(pci32_dma_ops);
-
 const struct dma_map_ops *dma_ops = &sbus_dma_ops;
 EXPORT_SYMBOL(dma_ops);
 
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [OpenRISC] [PATCH 21/22] sparc: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  To: openrisc

Switch to the generic noncoherent direct mapping implementation.

This removes the previous sync_single_for_device implementation, which
looks bogus given that no syncing is happening in the similar but more
important map_single case.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/sparc/Kconfig                   |   2 +
 arch/sparc/include/asm/dma-mapping.h |   5 +-
 arch/sparc/kernel/ioport.c           | 151 ++-------------------------
 3 files changed, 14 insertions(+), 144 deletions(-)

diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index c1cfc17eb504..5680eece3014 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -49,6 +49,8 @@ config SPARC
 
 config SPARC32
 	def_bool !64BIT
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
+	select DMA_NONCOHERENT_OPS
 	select GENERIC_ATOMIC64
 	select CLZ_TAB
 	select HAVE_UID16
diff --git a/arch/sparc/include/asm/dma-mapping.h b/arch/sparc/include/asm/dma-mapping.h
index 12ae33daf52f..e17566376934 100644
--- a/arch/sparc/include/asm/dma-mapping.h
+++ b/arch/sparc/include/asm/dma-mapping.h
@@ -7,7 +7,6 @@
 #include <linux/dma-debug.h>
 
 extern const struct dma_map_ops *dma_ops;
-extern const struct dma_map_ops pci32_dma_ops;
 
 extern struct bus_type pci_bus_type;
 
@@ -15,11 +14,11 @@ static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
 {
 #ifdef CONFIG_SPARC_LEON
 	if (sparc_cpu_model == sparc_leon)
-		return &pci32_dma_ops;
+		return &dma_noncoherent_ops;
 #endif
 #if defined(CONFIG_SPARC32) && defined(CONFIG_PCI)
 	if (bus == &pci_bus_type)
-		return &pci32_dma_ops;
+		return &dma_noncoherent_ops;
 #endif
 	return dma_ops;
 }
diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c
index 3bcef9ce74df..7954512c42e7 100644
--- a/arch/sparc/kernel/ioport.c
+++ b/arch/sparc/kernel/ioport.c
@@ -38,6 +38,7 @@
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
 #include <linux/scatterlist.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/of_device.h>
 
 #include <asm/io.h>
@@ -434,9 +435,8 @@ arch_initcall(sparc_register_ioport);
 /* Allocate and map kernel buffer using consistent mode DMA for a device.
  * hwdev should be valid struct pci_dev pointer for PCI devices.
  */
-static void *pci32_alloc_coherent(struct device *dev, size_t len,
-				  dma_addr_t *pba, gfp_t gfp,
-				  unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t len, dma_addr_t *pba, gfp_t gfp,
+		unsigned long attrs)
 {
 	unsigned long len_total = PAGE_ALIGN(len);
 	void *va;
@@ -488,8 +488,8 @@ static void *pci32_alloc_coherent(struct device *dev, size_t len,
  * References to the memory and mappings associated with cpu_addr/dma_addr
  * past this call are illegal.
  */
-static void pci32_free_coherent(struct device *dev, size_t n, void *p,
-				dma_addr_t ba, unsigned long attrs)
+void arch_dma_free(struct device *dev, size_t n, void *p, dma_addr_t ba,
+		unsigned long attrs)
 {
 	struct resource *res;
 
@@ -519,146 +519,15 @@ static void pci32_free_coherent(struct device *dev, size_t n, void *p,
 	free_pages((unsigned long)phys_to_virt(ba), get_order(n));
 }
 
-/*
- * Same as pci_map_single, but with pages.
- */
-static dma_addr_t pci32_map_page(struct device *dev, struct page *page,
-				 unsigned long offset, size_t size,
-				 enum dma_data_direction dir,
-				 unsigned long attrs)
-{
-	/* IIep is write-through, not flushing. */
-	return page_to_phys(page) + offset;
-}
-
-static void pci32_unmap_page(struct device *dev, dma_addr_t ba, size_t size,
-			     enum dma_data_direction dir, unsigned long attrs)
-{
-	if (dir != PCI_DMA_TODEVICE && !(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		dma_make_coherent(ba, PAGE_ALIGN(size));
-}
-
-/* Map a set of buffers described by scatterlist in streaming
- * mode for DMA.  This is the scatter-gather version of the
- * above pci_map_single interface.  Here the scatter gather list
- * elements are each tagged with the appropriate dma address
- * and length.  They are obtained via sg_dma_{address,length}(SG).
- *
- * NOTE: An implementation may be able to use a smaller number of
- *       DMA address/length pairs than there are SG table elements.
- *       (for example via virtual mapping capabilities)
- *       The routine returns the number of addr/length pairs actually
- *       used, at most nents.
- *
- * Device ownership issues as mentioned above for pci_map_single are
- * the same here.
- */
-static int pci32_map_sg(struct device *device, struct scatterlist *sgl,
-			int nents, enum dma_data_direction dir,
-			unsigned long attrs)
-{
-	struct scatterlist *sg;
-	int n;
-
-	/* IIep is write-through, not flushing. */
-	for_each_sg(sgl, sg, nents, n) {
-		sg->dma_address = sg_phys(sg);
-		sg->dma_length = sg->length;
-	}
-	return nents;
-}
-
-/* Unmap a set of streaming mode DMA translations.
- * Again, cpu read rules concerning calls here are the same as for
- * pci_unmap_single() above.
- */
-static void pci32_unmap_sg(struct device *dev, struct scatterlist *sgl,
-			   int nents, enum dma_data_direction dir,
-			   unsigned long attrs)
-{
-	struct scatterlist *sg;
-	int n;
-
-	if (dir != PCI_DMA_TODEVICE && !(attrs & DMA_ATTR_SKIP_CPU_SYNC)) {
-		for_each_sg(sgl, sg, nents, n) {
-			dma_make_coherent(sg_phys(sg), PAGE_ALIGN(sg->length));
-		}
-	}
-}
+/* IIep is write-through, not flushing on cpu to device transfer. */
 
-/* Make physical memory consistent for a single
- * streaming mode DMA translation before or after a transfer.
- *
- * If you perform a pci_map_single() but wish to interrogate the
- * buffer using the cpu, yet do not wish to teardown the PCI dma
- * mapping, you must call this function before doing so.  At the
- * next point you give the PCI dma address back to the card, you
- * must first perform a pci_dma_sync_for_device, and then the
- * device again owns the buffer.
- */
-static void pci32_sync_single_for_cpu(struct device *dev, dma_addr_t ba,
-				      size_t size, enum dma_data_direction dir)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	if (dir != PCI_DMA_TODEVICE) {
-		dma_make_coherent(ba, PAGE_ALIGN(size));
-	}
-}
-
-static void pci32_sync_single_for_device(struct device *dev, dma_addr_t ba,
-					 size_t size, enum dma_data_direction dir)
-{
-	if (dir != PCI_DMA_TODEVICE) {
-		dma_make_coherent(ba, PAGE_ALIGN(size));
-	}
+	if (dir != PCI_DMA_TODEVICE)
+		dma_make_coherent(paddr, PAGE_ALIGN(size));
 }
 
-/* Make physical memory consistent for a set of streaming
- * mode DMA translations after a transfer.
- *
- * The same as pci_dma_sync_single_* but for a scatter-gather list,
- * same rules and usage.
- */
-static void pci32_sync_sg_for_cpu(struct device *dev, struct scatterlist *sgl,
-				  int nents, enum dma_data_direction dir)
-{
-	struct scatterlist *sg;
-	int n;
-
-	if (dir != PCI_DMA_TODEVICE) {
-		for_each_sg(sgl, sg, nents, n) {
-			dma_make_coherent(sg_phys(sg), PAGE_ALIGN(sg->length));
-		}
-	}
-}
-
-static void pci32_sync_sg_for_device(struct device *device, struct scatterlist *sgl,
-				     int nents, enum dma_data_direction dir)
-{
-	struct scatterlist *sg;
-	int n;
-
-	if (dir != PCI_DMA_TODEVICE) {
-		for_each_sg(sgl, sg, nents, n) {
-			dma_make_coherent(sg_phys(sg), PAGE_ALIGN(sg->length));
-		}
-	}
-}
-
-/* note: leon re-uses pci32_dma_ops */
-const struct dma_map_ops pci32_dma_ops = {
-	.alloc			= pci32_alloc_coherent,
-	.free			= pci32_free_coherent,
-	.map_page		= pci32_map_page,
-	.unmap_page		= pci32_unmap_page,
-	.map_sg			= pci32_map_sg,
-	.unmap_sg		= pci32_unmap_sg,
-	.sync_single_for_cpu	= pci32_sync_single_for_cpu,
-	.sync_single_for_device	= pci32_sync_single_for_device,
-	.sync_sg_for_cpu	= pci32_sync_sg_for_cpu,
-	.sync_sg_for_device	= pci32_sync_sg_for_device,
-};
-EXPORT_SYMBOL(pci32_dma_ops);
-
 const struct dma_map_ops *dma_ops = &sbus_dma_ops;
 EXPORT_SYMBOL(dma_ops);
 
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 21/22] sparc: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  To: linux-arm-kernel

Switch to the generic noncoherent direct mapping implementation.

This removes the previous sync_single_for_device implementation, which
looks bogus given that no syncing is happening in the similar but more
important map_single case.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/sparc/Kconfig                   |   2 +
 arch/sparc/include/asm/dma-mapping.h |   5 +-
 arch/sparc/kernel/ioport.c           | 151 ++-------------------------
 3 files changed, 14 insertions(+), 144 deletions(-)

diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index c1cfc17eb504..5680eece3014 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -49,6 +49,8 @@ config SPARC
 
 config SPARC32
 	def_bool !64BIT
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
+	select DMA_NONCOHERENT_OPS
 	select GENERIC_ATOMIC64
 	select CLZ_TAB
 	select HAVE_UID16
diff --git a/arch/sparc/include/asm/dma-mapping.h b/arch/sparc/include/asm/dma-mapping.h
index 12ae33daf52f..e17566376934 100644
--- a/arch/sparc/include/asm/dma-mapping.h
+++ b/arch/sparc/include/asm/dma-mapping.h
@@ -7,7 +7,6 @@
 #include <linux/dma-debug.h>
 
 extern const struct dma_map_ops *dma_ops;
-extern const struct dma_map_ops pci32_dma_ops;
 
 extern struct bus_type pci_bus_type;
 
@@ -15,11 +14,11 @@ static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
 {
 #ifdef CONFIG_SPARC_LEON
 	if (sparc_cpu_model == sparc_leon)
-		return &pci32_dma_ops;
+		return &dma_noncoherent_ops;
 #endif
 #if defined(CONFIG_SPARC32) && defined(CONFIG_PCI)
 	if (bus == &pci_bus_type)
-		return &pci32_dma_ops;
+		return &dma_noncoherent_ops;
 #endif
 	return dma_ops;
 }
diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c
index 3bcef9ce74df..7954512c42e7 100644
--- a/arch/sparc/kernel/ioport.c
+++ b/arch/sparc/kernel/ioport.c
@@ -38,6 +38,7 @@
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
 #include <linux/scatterlist.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/of_device.h>
 
 #include <asm/io.h>
@@ -434,9 +435,8 @@ arch_initcall(sparc_register_ioport);
 /* Allocate and map kernel buffer using consistent mode DMA for a device.
  * hwdev should be valid struct pci_dev pointer for PCI devices.
  */
-static void *pci32_alloc_coherent(struct device *dev, size_t len,
-				  dma_addr_t *pba, gfp_t gfp,
-				  unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t len, dma_addr_t *pba, gfp_t gfp,
+		unsigned long attrs)
 {
 	unsigned long len_total = PAGE_ALIGN(len);
 	void *va;
@@ -488,8 +488,8 @@ static void *pci32_alloc_coherent(struct device *dev, size_t len,
  * References to the memory and mappings associated with cpu_addr/dma_addr
  * past this call are illegal.
  */
-static void pci32_free_coherent(struct device *dev, size_t n, void *p,
-				dma_addr_t ba, unsigned long attrs)
+void arch_dma_free(struct device *dev, size_t n, void *p, dma_addr_t ba,
+		unsigned long attrs)
 {
 	struct resource *res;
 
@@ -519,146 +519,15 @@ static void pci32_free_coherent(struct device *dev, size_t n, void *p,
 	free_pages((unsigned long)phys_to_virt(ba), get_order(n));
 }
 
-/*
- * Same as pci_map_single, but with pages.
- */
-static dma_addr_t pci32_map_page(struct device *dev, struct page *page,
-				 unsigned long offset, size_t size,
-				 enum dma_data_direction dir,
-				 unsigned long attrs)
-{
-	/* IIep is write-through, not flushing. */
-	return page_to_phys(page) + offset;
-}
-
-static void pci32_unmap_page(struct device *dev, dma_addr_t ba, size_t size,
-			     enum dma_data_direction dir, unsigned long attrs)
-{
-	if (dir != PCI_DMA_TODEVICE && !(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		dma_make_coherent(ba, PAGE_ALIGN(size));
-}
-
-/* Map a set of buffers described by scatterlist in streaming
- * mode for DMA.  This is the scatter-gather version of the
- * above pci_map_single interface.  Here the scatter gather list
- * elements are each tagged with the appropriate dma address
- * and length.  They are obtained via sg_dma_{address,length}(SG).
- *
- * NOTE: An implementation may be able to use a smaller number of
- *       DMA address/length pairs than there are SG table elements.
- *       (for example via virtual mapping capabilities)
- *       The routine returns the number of addr/length pairs actually
- *       used, at most nents.
- *
- * Device ownership issues as mentioned above for pci_map_single are
- * the same here.
- */
-static int pci32_map_sg(struct device *device, struct scatterlist *sgl,
-			int nents, enum dma_data_direction dir,
-			unsigned long attrs)
-{
-	struct scatterlist *sg;
-	int n;
-
-	/* IIep is write-through, not flushing. */
-	for_each_sg(sgl, sg, nents, n) {
-		sg->dma_address = sg_phys(sg);
-		sg->dma_length = sg->length;
-	}
-	return nents;
-}
-
-/* Unmap a set of streaming mode DMA translations.
- * Again, cpu read rules concerning calls here are the same as for
- * pci_unmap_single() above.
- */
-static void pci32_unmap_sg(struct device *dev, struct scatterlist *sgl,
-			   int nents, enum dma_data_direction dir,
-			   unsigned long attrs)
-{
-	struct scatterlist *sg;
-	int n;
-
-	if (dir != PCI_DMA_TODEVICE && !(attrs & DMA_ATTR_SKIP_CPU_SYNC)) {
-		for_each_sg(sgl, sg, nents, n) {
-			dma_make_coherent(sg_phys(sg), PAGE_ALIGN(sg->length));
-		}
-	}
-}
+/* IIep is write-through, not flushing on cpu to device transfer. */
 
-/* Make physical memory consistent for a single
- * streaming mode DMA translation before or after a transfer.
- *
- * If you perform a pci_map_single() but wish to interrogate the
- * buffer using the cpu, yet do not wish to teardown the PCI dma
- * mapping, you must call this function before doing so.  At the
- * next point you give the PCI dma address back to the card, you
- * must first perform a pci_dma_sync_for_device, and then the
- * device again owns the buffer.
- */
-static void pci32_sync_single_for_cpu(struct device *dev, dma_addr_t ba,
-				      size_t size, enum dma_data_direction dir)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	if (dir != PCI_DMA_TODEVICE) {
-		dma_make_coherent(ba, PAGE_ALIGN(size));
-	}
-}
-
-static void pci32_sync_single_for_device(struct device *dev, dma_addr_t ba,
-					 size_t size, enum dma_data_direction dir)
-{
-	if (dir != PCI_DMA_TODEVICE) {
-		dma_make_coherent(ba, PAGE_ALIGN(size));
-	}
+	if (dir != PCI_DMA_TODEVICE)
+		dma_make_coherent(paddr, PAGE_ALIGN(size));
 }
 
-/* Make physical memory consistent for a set of streaming
- * mode DMA translations after a transfer.
- *
- * The same as pci_dma_sync_single_* but for a scatter-gather list,
- * same rules and usage.
- */
-static void pci32_sync_sg_for_cpu(struct device *dev, struct scatterlist *sgl,
-				  int nents, enum dma_data_direction dir)
-{
-	struct scatterlist *sg;
-	int n;
-
-	if (dir != PCI_DMA_TODEVICE) {
-		for_each_sg(sgl, sg, nents, n) {
-			dma_make_coherent(sg_phys(sg), PAGE_ALIGN(sg->length));
-		}
-	}
-}
-
-static void pci32_sync_sg_for_device(struct device *device, struct scatterlist *sgl,
-				     int nents, enum dma_data_direction dir)
-{
-	struct scatterlist *sg;
-	int n;
-
-	if (dir != PCI_DMA_TODEVICE) {
-		for_each_sg(sgl, sg, nents, n) {
-			dma_make_coherent(sg_phys(sg), PAGE_ALIGN(sg->length));
-		}
-	}
-}
-
-/* note: leon re-uses pci32_dma_ops */
-const struct dma_map_ops pci32_dma_ops = {
-	.alloc			= pci32_alloc_coherent,
-	.free			= pci32_free_coherent,
-	.map_page		= pci32_map_page,
-	.unmap_page		= pci32_unmap_page,
-	.map_sg			= pci32_map_sg,
-	.unmap_sg		= pci32_unmap_sg,
-	.sync_single_for_cpu	= pci32_sync_single_for_cpu,
-	.sync_single_for_device	= pci32_sync_single_for_device,
-	.sync_sg_for_cpu	= pci32_sync_sg_for_cpu,
-	.sync_sg_for_device	= pci32_sync_sg_for_device,
-};
-EXPORT_SYMBOL(pci32_dma_ops);
-
 const struct dma_map_ops *dma_ops = &sbus_dma_ops;
 EXPORT_SYMBOL(dma_ops);
 
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 22/22] parisc: use generic dma_noncoherent_ops
  2018-04-20  8:02 ` Christoph Hellwig
                     ` (4 preceding siblings ...)
  (?)
@ 2018-04-20  8:03   ` Christoph Hellwig
  -1 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Switch to the generic noncoherent direct mapping implementation.

Parisc previously had two different non-coherent dma ops implementation
that just different in the way coherent allocations were handled or not
handled.  The different behavior is not selected at runtime in the
arch_dma_alloc and arch_dma_free routines.  The non-coherent allocation
in the pcx cases now uses the dma_direct helpers that are a little more
sophisticated and used by a lot of other architectures.

Fix sync_single_for_cpu to do skip the cache flush unless the transfer
is to the device to match the more tested unmap_single path which should
have the same cache coherency implications.

This also now consistenly uses flush_kernel_dcache_range for cache
flushing while previously some of the SG based operations used
flush_kernel_vmap_range instead.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/parisc/Kconfig                   |   4 +
 arch/parisc/include/asm/dma-mapping.h |   5 -
 arch/parisc/kernel/pci-dma.c          | 181 ++++----------------------
 arch/parisc/kernel/setup.c            |   8 +-
 arch/parisc/mm/init.c                 |  11 +-
 5 files changed, 35 insertions(+), 174 deletions(-)

diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index 47047f0cbe35..80166a1cbcb7 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -188,6 +188,10 @@ config PA20
 config PA11
 	def_bool y
 	depends on PA7000 || PA7100LC || PA7200 || PA7300LC
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
+	select DMA_NONCOHERENT_OPS
+	select DMA_NONCOHERENT_CACHE_SYNC
 
 config PREFETCH
 	def_bool y
diff --git a/arch/parisc/include/asm/dma-mapping.h b/arch/parisc/include/asm/dma-mapping.h
index 01e1fc057c83..44a9f97194aa 100644
--- a/arch/parisc/include/asm/dma-mapping.h
+++ b/arch/parisc/include/asm/dma-mapping.h
@@ -21,11 +21,6 @@
 ** flush/purge and allocate "regular" cacheable pages for everything.
 */
 
-#ifdef CONFIG_PA11
-extern const struct dma_map_ops pcxl_dma_ops;
-extern const struct dma_map_ops pcx_dma_ops;
-#endif
-
 extern const struct dma_map_ops *hppa_dma_ops;
 
 static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
diff --git a/arch/parisc/kernel/pci-dma.c b/arch/parisc/kernel/pci-dma.c
index 91bc0cac03a1..235e2e53959e 100644
--- a/arch/parisc/kernel/pci-dma.c
+++ b/arch/parisc/kernel/pci-dma.c
@@ -21,13 +21,12 @@
 #include <linux/init.h>
 #include <linux/gfp.h>
 #include <linux/mm.h>
-#include <linux/pci.h>
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
 #include <linux/string.h>
 #include <linux/types.h>
-#include <linux/scatterlist.h>
-#include <linux/export.h>
+#include <linux/dma-direct.h>
+#include <linux/dma-noncoherent.h>
 
 #include <asm/cacheflush.h>
 #include <asm/dma.h>    /* for DMA_CHUNK_SIZE */
@@ -447,178 +446,48 @@ static void pa11_dma_free(struct device *dev, size_t size, void *vaddr,
 	free_pages((unsigned long)__va(dma_handle), order);
 }
 
-static dma_addr_t pa11_dma_map_page(struct device *dev, struct page *page,
-		unsigned long offset, size_t size,
-		enum dma_data_direction direction, unsigned long attrs)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	void *addr = page_address(page) + offset;
-	BUG_ON(direction == DMA_NONE);
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		flush_kernel_dcache_range((unsigned long) addr, size);
-
-	return virt_to_phys(addr);
+	flush_kernel_dcache_range((unsigned long)phys_to_virt(paddr), size);
 }
 
-static void pa11_dma_unmap_page(struct device *dev, dma_addr_t dma_handle,
-		size_t size, enum dma_data_direction direction,
-		unsigned long attrs)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	BUG_ON(direction == DMA_NONE);
-
-	if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-		return;
-
-	if (direction == DMA_TO_DEVICE)
+	if (dir == DMA_TO_DEVICE)
 		return;
 
 	/*
-	 * For PCI_DMA_FROMDEVICE this flush is not necessary for the
+	 * For DMA_FROM_DEVICE this flush is not necessary for the
 	 * simple map/unmap case. However, it IS necessary if if
-	 * pci_dma_sync_single_* has been called and the buffer reused.
+	 * dma_sync_single_* has been called and the buffer reused.
 	 */
 
-	flush_kernel_dcache_range((unsigned long) phys_to_virt(dma_handle), size);
-}
-
-static int pa11_dma_map_sg(struct device *dev, struct scatterlist *sglist,
-		int nents, enum dma_data_direction direction,
-		unsigned long attrs)
-{
-	int i;
-	struct scatterlist *sg;
-
-	BUG_ON(direction == DMA_NONE);
-
-	for_each_sg(sglist, sg, nents, i) {
-		unsigned long vaddr = (unsigned long)sg_virt(sg);
-
-		sg_dma_address(sg) = (dma_addr_t) virt_to_phys(vaddr);
-		sg_dma_len(sg) = sg->length;
-
-		if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-			continue;
-
-		flush_kernel_dcache_range(vaddr, sg->length);
-	}
-	return nents;
+	flush_kernel_dcache_range((unsigned long)phys_to_virt(paddr), size);
 }
 
-static void pa11_dma_unmap_sg(struct device *dev, struct scatterlist *sglist,
-		int nents, enum dma_data_direction direction,
-		unsigned long attrs)
-{
-	int i;
-	struct scatterlist *sg;
-
-	BUG_ON(direction == DMA_NONE);
-
-	if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-		return;
-
-	if (direction == DMA_TO_DEVICE)
-		return;
-
-	/* once we do combining we'll need to use phys_to_virt(sg_dma_address(sglist)) */
-
-	for_each_sg(sglist, sg, nents, i)
-		flush_kernel_vmap_range(sg_virt(sg), sg->length);
-}
-
-static void pa11_dma_sync_single_for_cpu(struct device *dev,
-		dma_addr_t dma_handle, size_t size,
-		enum dma_data_direction direction)
-{
-	BUG_ON(direction == DMA_NONE);
-
-	flush_kernel_dcache_range((unsigned long) phys_to_virt(dma_handle),
-			size);
-}
-
-static void pa11_dma_sync_single_for_device(struct device *dev,
-		dma_addr_t dma_handle, size_t size,
-		enum dma_data_direction direction)
-{
-	BUG_ON(direction == DMA_NONE);
-
-	flush_kernel_dcache_range((unsigned long) phys_to_virt(dma_handle),
-			size);
-}
-
-static void pa11_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sglist, int nents, enum dma_data_direction direction)
-{
-	int i;
-	struct scatterlist *sg;
-
-	/* once we do combining we'll need to use phys_to_virt(sg_dma_address(sglist)) */
-
-	for_each_sg(sglist, sg, nents, i)
-		flush_kernel_vmap_range(sg_virt(sg), sg->length);
-}
-
-static void pa11_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sglist, int nents, enum dma_data_direction direction)
-{
-	int i;
-	struct scatterlist *sg;
-
-	/* once we do combining we'll need to use phys_to_virt(sg_dma_address(sglist)) */
-
-	for_each_sg(sglist, sg, nents, i)
-		flush_kernel_vmap_range(sg_virt(sg), sg->length);
-}
-
-static void pa11_dma_cache_sync(struct device *dev, void *vaddr, size_t size,
+void arch_dma_cache_sync(struct device *dev, void *vaddr, size_t size,
 	       enum dma_data_direction direction)
 {
 	flush_kernel_dcache_range((unsigned long)vaddr, size);
 }
 
-const struct dma_map_ops pcxl_dma_ops = {
-	.alloc =		pa11_dma_alloc,
-	.free =			pa11_dma_free,
-	.map_page =		pa11_dma_map_page,
-	.unmap_page =		pa11_dma_unmap_page,
-	.map_sg =		pa11_dma_map_sg,
-	.unmap_sg =		pa11_dma_unmap_sg,
-	.sync_single_for_cpu =	pa11_dma_sync_single_for_cpu,
-	.sync_single_for_device = pa11_dma_sync_single_for_device,
-	.sync_sg_for_cpu =	pa11_dma_sync_sg_for_cpu,
-	.sync_sg_for_device =	pa11_dma_sync_sg_for_device,
-	.cache_sync =		pa11_dma_cache_sync,
-};
-
-static void *pcx_dma_alloc(struct device *dev, size_t size,
-		dma_addr_t *dma_handle, gfp_t flag, unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs)
 {
-	void *addr;
-
-	if ((attrs & DMA_ATTR_NON_CONSISTENT) == 0)
-		return NULL;
-
-	addr = (void *)__get_free_pages(flag, get_order(size));
-	if (addr)
-		*dma_handle = (dma_addr_t)virt_to_phys(addr);
-
-	return addr;
+	if (boot_cpu_data.cpu_type == pcxl2 || boot_cpu_data.cpu_type == pcxl)
+		return pa11_dma_alloc(dev, size, dma_handle, gfp, attrs);
+	if (attrs & DMA_ATTR_NON_CONSISTENT)
+		return dma_direct_alloc(dev, size, dma_handle, gfp, attrs);
+	return NULL;
 }
 
-static void pcx_dma_free(struct device *dev, size_t size, void *vaddr,
-		dma_addr_t iova, unsigned long attrs)
+void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
+		dma_addr_t dma_addr, unsigned long attrs)
 {
-	free_pages((unsigned long)vaddr, get_order(size));
-	return;
+	if (boot_cpu_data.cpu_type == pcxl2 || boot_cpu_data.cpu_type == pcxl)
+		pa11_dma_free(dev, size, cpu_addr, dma_addr, attrs);
+	else
+		dma_direct_free(dev, size, cpu_addr, dma_addr, attrs);
 }
-
-const struct dma_map_ops pcx_dma_ops = {
-	.alloc =		pcx_dma_alloc,
-	.free =			pcx_dma_free,
-	.map_page =		pa11_dma_map_page,
-	.unmap_page =		pa11_dma_unmap_page,
-	.map_sg =		pa11_dma_map_sg,
-	.unmap_sg =		pa11_dma_unmap_sg,
-	.sync_single_for_cpu =	pa11_dma_sync_single_for_cpu,
-	.sync_single_for_device = pa11_dma_sync_single_for_device,
-	.sync_sg_for_cpu =	pa11_dma_sync_sg_for_cpu,
-	.sync_sg_for_device =	pa11_dma_sync_sg_for_device,
-	.cache_sync =		pa11_dma_cache_sync,
-};
diff --git a/arch/parisc/kernel/setup.c b/arch/parisc/kernel/setup.c
index 8d3a7b80ac42..4e87c35c22b7 100644
--- a/arch/parisc/kernel/setup.c
+++ b/arch/parisc/kernel/setup.c
@@ -97,14 +97,12 @@ void __init dma_ops_init(void)
 		panic(	"PA-RISC Linux currently only supports machines that conform to\n"
 			"the PA-RISC 1.1 or 2.0 architecture specification.\n");
 
-	case pcxs:
-	case pcxt:
-		hppa_dma_ops = &pcx_dma_ops;
-		break;
 	case pcxl2:
 		pa7300lc_init();
 	case pcxl: /* falls through */
-		hppa_dma_ops = &pcxl_dma_ops;
+	case pcxs:
+	case pcxt:
+		hppa_dma_ops = &dma_noncoherent_ops;
 		break;
 	default:
 		break;
diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
index cab32ee824d2..4ad91c28ecbe 100644
--- a/arch/parisc/mm/init.c
+++ b/arch/parisc/mm/init.c
@@ -19,7 +19,6 @@
 #include <linux/gfp.h>
 #include <linux/delay.h>
 #include <linux/init.h>
-#include <linux/pci.h>		/* for hppa_dma_ops and pcxl_dma_ops */
 #include <linux/initrd.h>
 #include <linux/swap.h>
 #include <linux/unistd.h>
@@ -616,17 +615,13 @@ void __init mem_init(void)
 	free_all_bootmem();
 
 #ifdef CONFIG_PA11
-	if (hppa_dma_ops == &pcxl_dma_ops) {
+	if (boot_cpu_data.cpu_type == pcxl2 || boot_cpu_data.cpu_type == pcxl) {
 		pcxl_dma_start = (unsigned long)SET_MAP_OFFSET(MAP_START);
 		parisc_vmalloc_start = SET_MAP_OFFSET(pcxl_dma_start
 						+ PCXL_DMA_MAP_SIZE);
-	} else {
-		pcxl_dma_start = 0;
-		parisc_vmalloc_start = SET_MAP_OFFSET(MAP_START);
-	}
-#else
-	parisc_vmalloc_start = SET_MAP_OFFSET(MAP_START);
+	} else
 #endif
+		parisc_vmalloc_start = SET_MAP_OFFSET(MAP_START);
 
 	mem_init_print_info(NULL);
 
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 22/22] parisc: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Switch to the generic noncoherent direct mapping implementation.

Parisc previously had two different non-coherent dma ops implementation
that just different in the way coherent allocations were handled or not
handled.  The different behavior is not selected at runtime in the
arch_dma_alloc and arch_dma_free routines.  The non-coherent allocation
in the pcx cases now uses the dma_direct helpers that are a little more
sophisticated and used by a lot of other architectures.

Fix sync_single_for_cpu to do skip the cache flush unless the transfer
is to the device to match the more tested unmap_single path which should
have the same cache coherency implications.

This also now consistenly uses flush_kernel_dcache_range for cache
flushing while previously some of the SG based operations used
flush_kernel_vmap_range instead.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/parisc/Kconfig                   |   4 +
 arch/parisc/include/asm/dma-mapping.h |   5 -
 arch/parisc/kernel/pci-dma.c          | 181 ++++----------------------
 arch/parisc/kernel/setup.c            |   8 +-
 arch/parisc/mm/init.c                 |  11 +-
 5 files changed, 35 insertions(+), 174 deletions(-)

diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index 47047f0cbe35..80166a1cbcb7 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -188,6 +188,10 @@ config PA20
 config PA11
 	def_bool y
 	depends on PA7000 || PA7100LC || PA7200 || PA7300LC
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
+	select DMA_NONCOHERENT_OPS
+	select DMA_NONCOHERENT_CACHE_SYNC
 
 config PREFETCH
 	def_bool y
diff --git a/arch/parisc/include/asm/dma-mapping.h b/arch/parisc/include/asm/dma-mapping.h
index 01e1fc057c83..44a9f97194aa 100644
--- a/arch/parisc/include/asm/dma-mapping.h
+++ b/arch/parisc/include/asm/dma-mapping.h
@@ -21,11 +21,6 @@
 ** flush/purge and allocate "regular" cacheable pages for everything.
 */
 
-#ifdef CONFIG_PA11
-extern const struct dma_map_ops pcxl_dma_ops;
-extern const struct dma_map_ops pcx_dma_ops;
-#endif
-
 extern const struct dma_map_ops *hppa_dma_ops;
 
 static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
diff --git a/arch/parisc/kernel/pci-dma.c b/arch/parisc/kernel/pci-dma.c
index 91bc0cac03a1..235e2e53959e 100644
--- a/arch/parisc/kernel/pci-dma.c
+++ b/arch/parisc/kernel/pci-dma.c
@@ -21,13 +21,12 @@
 #include <linux/init.h>
 #include <linux/gfp.h>
 #include <linux/mm.h>
-#include <linux/pci.h>
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
 #include <linux/string.h>
 #include <linux/types.h>
-#include <linux/scatterlist.h>
-#include <linux/export.h>
+#include <linux/dma-direct.h>
+#include <linux/dma-noncoherent.h>
 
 #include <asm/cacheflush.h>
 #include <asm/dma.h>    /* for DMA_CHUNK_SIZE */
@@ -447,178 +446,48 @@ static void pa11_dma_free(struct device *dev, size_t size, void *vaddr,
 	free_pages((unsigned long)__va(dma_handle), order);
 }
 
-static dma_addr_t pa11_dma_map_page(struct device *dev, struct page *page,
-		unsigned long offset, size_t size,
-		enum dma_data_direction direction, unsigned long attrs)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	void *addr = page_address(page) + offset;
-	BUG_ON(direction == DMA_NONE);
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		flush_kernel_dcache_range((unsigned long) addr, size);
-
-	return virt_to_phys(addr);
+	flush_kernel_dcache_range((unsigned long)phys_to_virt(paddr), size);
 }
 
-static void pa11_dma_unmap_page(struct device *dev, dma_addr_t dma_handle,
-		size_t size, enum dma_data_direction direction,
-		unsigned long attrs)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	BUG_ON(direction == DMA_NONE);
-
-	if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-		return;
-
-	if (direction == DMA_TO_DEVICE)
+	if (dir == DMA_TO_DEVICE)
 		return;
 
 	/*
-	 * For PCI_DMA_FROMDEVICE this flush is not necessary for the
+	 * For DMA_FROM_DEVICE this flush is not necessary for the
 	 * simple map/unmap case. However, it IS necessary if if
-	 * pci_dma_sync_single_* has been called and the buffer reused.
+	 * dma_sync_single_* has been called and the buffer reused.
 	 */
 
-	flush_kernel_dcache_range((unsigned long) phys_to_virt(dma_handle), size);
-}
-
-static int pa11_dma_map_sg(struct device *dev, struct scatterlist *sglist,
-		int nents, enum dma_data_direction direction,
-		unsigned long attrs)
-{
-	int i;
-	struct scatterlist *sg;
-
-	BUG_ON(direction == DMA_NONE);
-
-	for_each_sg(sglist, sg, nents, i) {
-		unsigned long vaddr = (unsigned long)sg_virt(sg);
-
-		sg_dma_address(sg) = (dma_addr_t) virt_to_phys(vaddr);
-		sg_dma_len(sg) = sg->length;
-
-		if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-			continue;
-
-		flush_kernel_dcache_range(vaddr, sg->length);
-	}
-	return nents;
+	flush_kernel_dcache_range((unsigned long)phys_to_virt(paddr), size);
 }
 
-static void pa11_dma_unmap_sg(struct device *dev, struct scatterlist *sglist,
-		int nents, enum dma_data_direction direction,
-		unsigned long attrs)
-{
-	int i;
-	struct scatterlist *sg;
-
-	BUG_ON(direction == DMA_NONE);
-
-	if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-		return;
-
-	if (direction == DMA_TO_DEVICE)
-		return;
-
-	/* once we do combining we'll need to use phys_to_virt(sg_dma_address(sglist)) */
-
-	for_each_sg(sglist, sg, nents, i)
-		flush_kernel_vmap_range(sg_virt(sg), sg->length);
-}
-
-static void pa11_dma_sync_single_for_cpu(struct device *dev,
-		dma_addr_t dma_handle, size_t size,
-		enum dma_data_direction direction)
-{
-	BUG_ON(direction == DMA_NONE);
-
-	flush_kernel_dcache_range((unsigned long) phys_to_virt(dma_handle),
-			size);
-}
-
-static void pa11_dma_sync_single_for_device(struct device *dev,
-		dma_addr_t dma_handle, size_t size,
-		enum dma_data_direction direction)
-{
-	BUG_ON(direction == DMA_NONE);
-
-	flush_kernel_dcache_range((unsigned long) phys_to_virt(dma_handle),
-			size);
-}
-
-static void pa11_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sglist, int nents, enum dma_data_direction direction)
-{
-	int i;
-	struct scatterlist *sg;
-
-	/* once we do combining we'll need to use phys_to_virt(sg_dma_address(sglist)) */
-
-	for_each_sg(sglist, sg, nents, i)
-		flush_kernel_vmap_range(sg_virt(sg), sg->length);
-}
-
-static void pa11_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sglist, int nents, enum dma_data_direction direction)
-{
-	int i;
-	struct scatterlist *sg;
-
-	/* once we do combining we'll need to use phys_to_virt(sg_dma_address(sglist)) */
-
-	for_each_sg(sglist, sg, nents, i)
-		flush_kernel_vmap_range(sg_virt(sg), sg->length);
-}
-
-static void pa11_dma_cache_sync(struct device *dev, void *vaddr, size_t size,
+void arch_dma_cache_sync(struct device *dev, void *vaddr, size_t size,
 	       enum dma_data_direction direction)
 {
 	flush_kernel_dcache_range((unsigned long)vaddr, size);
 }
 
-const struct dma_map_ops pcxl_dma_ops = {
-	.alloc =		pa11_dma_alloc,
-	.free =			pa11_dma_free,
-	.map_page =		pa11_dma_map_page,
-	.unmap_page =		pa11_dma_unmap_page,
-	.map_sg =		pa11_dma_map_sg,
-	.unmap_sg =		pa11_dma_unmap_sg,
-	.sync_single_for_cpu =	pa11_dma_sync_single_for_cpu,
-	.sync_single_for_device = pa11_dma_sync_single_for_device,
-	.sync_sg_for_cpu =	pa11_dma_sync_sg_for_cpu,
-	.sync_sg_for_device =	pa11_dma_sync_sg_for_device,
-	.cache_sync =		pa11_dma_cache_sync,
-};
-
-static void *pcx_dma_alloc(struct device *dev, size_t size,
-		dma_addr_t *dma_handle, gfp_t flag, unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs)
 {
-	void *addr;
-
-	if ((attrs & DMA_ATTR_NON_CONSISTENT) == 0)
-		return NULL;
-
-	addr = (void *)__get_free_pages(flag, get_order(size));
-	if (addr)
-		*dma_handle = (dma_addr_t)virt_to_phys(addr);
-
-	return addr;
+	if (boot_cpu_data.cpu_type == pcxl2 || boot_cpu_data.cpu_type == pcxl)
+		return pa11_dma_alloc(dev, size, dma_handle, gfp, attrs);
+	if (attrs & DMA_ATTR_NON_CONSISTENT)
+		return dma_direct_alloc(dev, size, dma_handle, gfp, attrs);
+	return NULL;
 }
 
-static void pcx_dma_free(struct device *dev, size_t size, void *vaddr,
-		dma_addr_t iova, unsigned long attrs)
+void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
+		dma_addr_t dma_addr, unsigned long attrs)
 {
-	free_pages((unsigned long)vaddr, get_order(size));
-	return;
+	if (boot_cpu_data.cpu_type == pcxl2 || boot_cpu_data.cpu_type == pcxl)
+		pa11_dma_free(dev, size, cpu_addr, dma_addr, attrs);
+	else
+		dma_direct_free(dev, size, cpu_addr, dma_addr, attrs);
 }
-
-const struct dma_map_ops pcx_dma_ops = {
-	.alloc =		pcx_dma_alloc,
-	.free =			pcx_dma_free,
-	.map_page =		pa11_dma_map_page,
-	.unmap_page =		pa11_dma_unmap_page,
-	.map_sg =		pa11_dma_map_sg,
-	.unmap_sg =		pa11_dma_unmap_sg,
-	.sync_single_for_cpu =	pa11_dma_sync_single_for_cpu,
-	.sync_single_for_device = pa11_dma_sync_single_for_device,
-	.sync_sg_for_cpu =	pa11_dma_sync_sg_for_cpu,
-	.sync_sg_for_device =	pa11_dma_sync_sg_for_device,
-	.cache_sync =		pa11_dma_cache_sync,
-};
diff --git a/arch/parisc/kernel/setup.c b/arch/parisc/kernel/setup.c
index 8d3a7b80ac42..4e87c35c22b7 100644
--- a/arch/parisc/kernel/setup.c
+++ b/arch/parisc/kernel/setup.c
@@ -97,14 +97,12 @@ void __init dma_ops_init(void)
 		panic(	"PA-RISC Linux currently only supports machines that conform to\n"
 			"the PA-RISC 1.1 or 2.0 architecture specification.\n");
 
-	case pcxs:
-	case pcxt:
-		hppa_dma_ops = &pcx_dma_ops;
-		break;
 	case pcxl2:
 		pa7300lc_init();
 	case pcxl: /* falls through */
-		hppa_dma_ops = &pcxl_dma_ops;
+	case pcxs:
+	case pcxt:
+		hppa_dma_ops = &dma_noncoherent_ops;
 		break;
 	default:
 		break;
diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
index cab32ee824d2..4ad91c28ecbe 100644
--- a/arch/parisc/mm/init.c
+++ b/arch/parisc/mm/init.c
@@ -19,7 +19,6 @@
 #include <linux/gfp.h>
 #include <linux/delay.h>
 #include <linux/init.h>
-#include <linux/pci.h>		/* for hppa_dma_ops and pcxl_dma_ops */
 #include <linux/initrd.h>
 #include <linux/swap.h>
 #include <linux/unistd.h>
@@ -616,17 +615,13 @@ void __init mem_init(void)
 	free_all_bootmem();
 
 #ifdef CONFIG_PA11
-	if (hppa_dma_ops == &pcxl_dma_ops) {
+	if (boot_cpu_data.cpu_type == pcxl2 || boot_cpu_data.cpu_type == pcxl) {
 		pcxl_dma_start = (unsigned long)SET_MAP_OFFSET(MAP_START);
 		parisc_vmalloc_start = SET_MAP_OFFSET(pcxl_dma_start
 						+ PCXL_DMA_MAP_SIZE);
-	} else {
-		pcxl_dma_start = 0;
-		parisc_vmalloc_start = SET_MAP_OFFSET(MAP_START);
-	}
-#else
-	parisc_vmalloc_start = SET_MAP_OFFSET(MAP_START);
+	} else
 #endif
+		parisc_vmalloc_start = SET_MAP_OFFSET(MAP_START);
 
 	mem_init_print_info(NULL);
 
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 22/22] parisc: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Switch to the generic noncoherent direct mapping implementation.

Parisc previously had two different non-coherent dma ops implementation
that just different in the way coherent allocations were handled or not
handled.  The different behavior is not selected at runtime in the
arch_dma_alloc and arch_dma_free routines.  The non-coherent allocation
in the pcx cases now uses the dma_direct helpers that are a little more
sophisticated and used by a lot of other architectures.

Fix sync_single_for_cpu to do skip the cache flush unless the transfer
is to the device to match the more tested unmap_single path which should
have the same cache coherency implications.

This also now consistenly uses flush_kernel_dcache_range for cache
flushing while previously some of the SG based operations used
flush_kernel_vmap_range instead.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/parisc/Kconfig                   |   4 +
 arch/parisc/include/asm/dma-mapping.h |   5 -
 arch/parisc/kernel/pci-dma.c          | 181 ++++----------------------
 arch/parisc/kernel/setup.c            |   8 +-
 arch/parisc/mm/init.c                 |  11 +-
 5 files changed, 35 insertions(+), 174 deletions(-)

diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index 47047f0cbe35..80166a1cbcb7 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -188,6 +188,10 @@ config PA20
 config PA11
 	def_bool y
 	depends on PA7000 || PA7100LC || PA7200 || PA7300LC
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
+	select DMA_NONCOHERENT_OPS
+	select DMA_NONCOHERENT_CACHE_SYNC
 
 config PREFETCH
 	def_bool y
diff --git a/arch/parisc/include/asm/dma-mapping.h b/arch/parisc/include/asm/dma-mapping.h
index 01e1fc057c83..44a9f97194aa 100644
--- a/arch/parisc/include/asm/dma-mapping.h
+++ b/arch/parisc/include/asm/dma-mapping.h
@@ -21,11 +21,6 @@
 ** flush/purge and allocate "regular" cacheable pages for everything.
 */
 
-#ifdef CONFIG_PA11
-extern const struct dma_map_ops pcxl_dma_ops;
-extern const struct dma_map_ops pcx_dma_ops;
-#endif
-
 extern const struct dma_map_ops *hppa_dma_ops;
 
 static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
diff --git a/arch/parisc/kernel/pci-dma.c b/arch/parisc/kernel/pci-dma.c
index 91bc0cac03a1..235e2e53959e 100644
--- a/arch/parisc/kernel/pci-dma.c
+++ b/arch/parisc/kernel/pci-dma.c
@@ -21,13 +21,12 @@
 #include <linux/init.h>
 #include <linux/gfp.h>
 #include <linux/mm.h>
-#include <linux/pci.h>
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
 #include <linux/string.h>
 #include <linux/types.h>
-#include <linux/scatterlist.h>
-#include <linux/export.h>
+#include <linux/dma-direct.h>
+#include <linux/dma-noncoherent.h>
 
 #include <asm/cacheflush.h>
 #include <asm/dma.h>    /* for DMA_CHUNK_SIZE */
@@ -447,178 +446,48 @@ static void pa11_dma_free(struct device *dev, size_t size, void *vaddr,
 	free_pages((unsigned long)__va(dma_handle), order);
 }
 
-static dma_addr_t pa11_dma_map_page(struct device *dev, struct page *page,
-		unsigned long offset, size_t size,
-		enum dma_data_direction direction, unsigned long attrs)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	void *addr = page_address(page) + offset;
-	BUG_ON(direction == DMA_NONE);
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		flush_kernel_dcache_range((unsigned long) addr, size);
-
-	return virt_to_phys(addr);
+	flush_kernel_dcache_range((unsigned long)phys_to_virt(paddr), size);
 }
 
-static void pa11_dma_unmap_page(struct device *dev, dma_addr_t dma_handle,
-		size_t size, enum dma_data_direction direction,
-		unsigned long attrs)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	BUG_ON(direction == DMA_NONE);
-
-	if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-		return;
-
-	if (direction == DMA_TO_DEVICE)
+	if (dir == DMA_TO_DEVICE)
 		return;
 
 	/*
-	 * For PCI_DMA_FROMDEVICE this flush is not necessary for the
+	 * For DMA_FROM_DEVICE this flush is not necessary for the
 	 * simple map/unmap case. However, it IS necessary if if
-	 * pci_dma_sync_single_* has been called and the buffer reused.
+	 * dma_sync_single_* has been called and the buffer reused.
 	 */
 
-	flush_kernel_dcache_range((unsigned long) phys_to_virt(dma_handle), size);
-}
-
-static int pa11_dma_map_sg(struct device *dev, struct scatterlist *sglist,
-		int nents, enum dma_data_direction direction,
-		unsigned long attrs)
-{
-	int i;
-	struct scatterlist *sg;
-
-	BUG_ON(direction == DMA_NONE);
-
-	for_each_sg(sglist, sg, nents, i) {
-		unsigned long vaddr = (unsigned long)sg_virt(sg);
-
-		sg_dma_address(sg) = (dma_addr_t) virt_to_phys(vaddr);
-		sg_dma_len(sg) = sg->length;
-
-		if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-			continue;
-
-		flush_kernel_dcache_range(vaddr, sg->length);
-	}
-	return nents;
+	flush_kernel_dcache_range((unsigned long)phys_to_virt(paddr), size);
 }
 
-static void pa11_dma_unmap_sg(struct device *dev, struct scatterlist *sglist,
-		int nents, enum dma_data_direction direction,
-		unsigned long attrs)
-{
-	int i;
-	struct scatterlist *sg;
-
-	BUG_ON(direction == DMA_NONE);
-
-	if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-		return;
-
-	if (direction == DMA_TO_DEVICE)
-		return;
-
-	/* once we do combining we'll need to use phys_to_virt(sg_dma_address(sglist)) */
-
-	for_each_sg(sglist, sg, nents, i)
-		flush_kernel_vmap_range(sg_virt(sg), sg->length);
-}
-
-static void pa11_dma_sync_single_for_cpu(struct device *dev,
-		dma_addr_t dma_handle, size_t size,
-		enum dma_data_direction direction)
-{
-	BUG_ON(direction == DMA_NONE);
-
-	flush_kernel_dcache_range((unsigned long) phys_to_virt(dma_handle),
-			size);
-}
-
-static void pa11_dma_sync_single_for_device(struct device *dev,
-		dma_addr_t dma_handle, size_t size,
-		enum dma_data_direction direction)
-{
-	BUG_ON(direction == DMA_NONE);
-
-	flush_kernel_dcache_range((unsigned long) phys_to_virt(dma_handle),
-			size);
-}
-
-static void pa11_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sglist, int nents, enum dma_data_direction direction)
-{
-	int i;
-	struct scatterlist *sg;
-
-	/* once we do combining we'll need to use phys_to_virt(sg_dma_address(sglist)) */
-
-	for_each_sg(sglist, sg, nents, i)
-		flush_kernel_vmap_range(sg_virt(sg), sg->length);
-}
-
-static void pa11_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sglist, int nents, enum dma_data_direction direction)
-{
-	int i;
-	struct scatterlist *sg;
-
-	/* once we do combining we'll need to use phys_to_virt(sg_dma_address(sglist)) */
-
-	for_each_sg(sglist, sg, nents, i)
-		flush_kernel_vmap_range(sg_virt(sg), sg->length);
-}
-
-static void pa11_dma_cache_sync(struct device *dev, void *vaddr, size_t size,
+void arch_dma_cache_sync(struct device *dev, void *vaddr, size_t size,
 	       enum dma_data_direction direction)
 {
 	flush_kernel_dcache_range((unsigned long)vaddr, size);
 }
 
-const struct dma_map_ops pcxl_dma_ops = {
-	.alloc =		pa11_dma_alloc,
-	.free =			pa11_dma_free,
-	.map_page =		pa11_dma_map_page,
-	.unmap_page =		pa11_dma_unmap_page,
-	.map_sg =		pa11_dma_map_sg,
-	.unmap_sg =		pa11_dma_unmap_sg,
-	.sync_single_for_cpu =	pa11_dma_sync_single_for_cpu,
-	.sync_single_for_device = pa11_dma_sync_single_for_device,
-	.sync_sg_for_cpu =	pa11_dma_sync_sg_for_cpu,
-	.sync_sg_for_device =	pa11_dma_sync_sg_for_device,
-	.cache_sync =		pa11_dma_cache_sync,
-};
-
-static void *pcx_dma_alloc(struct device *dev, size_t size,
-		dma_addr_t *dma_handle, gfp_t flag, unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs)
 {
-	void *addr;
-
-	if ((attrs & DMA_ATTR_NON_CONSISTENT) == 0)
-		return NULL;
-
-	addr = (void *)__get_free_pages(flag, get_order(size));
-	if (addr)
-		*dma_handle = (dma_addr_t)virt_to_phys(addr);
-
-	return addr;
+	if (boot_cpu_data.cpu_type == pcxl2 || boot_cpu_data.cpu_type == pcxl)
+		return pa11_dma_alloc(dev, size, dma_handle, gfp, attrs);
+	if (attrs & DMA_ATTR_NON_CONSISTENT)
+		return dma_direct_alloc(dev, size, dma_handle, gfp, attrs);
+	return NULL;
 }
 
-static void pcx_dma_free(struct device *dev, size_t size, void *vaddr,
-		dma_addr_t iova, unsigned long attrs)
+void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
+		dma_addr_t dma_addr, unsigned long attrs)
 {
-	free_pages((unsigned long)vaddr, get_order(size));
-	return;
+	if (boot_cpu_data.cpu_type == pcxl2 || boot_cpu_data.cpu_type == pcxl)
+		pa11_dma_free(dev, size, cpu_addr, dma_addr, attrs);
+	else
+		dma_direct_free(dev, size, cpu_addr, dma_addr, attrs);
 }
-
-const struct dma_map_ops pcx_dma_ops = {
-	.alloc =		pcx_dma_alloc,
-	.free =			pcx_dma_free,
-	.map_page =		pa11_dma_map_page,
-	.unmap_page =		pa11_dma_unmap_page,
-	.map_sg =		pa11_dma_map_sg,
-	.unmap_sg =		pa11_dma_unmap_sg,
-	.sync_single_for_cpu =	pa11_dma_sync_single_for_cpu,
-	.sync_single_for_device = pa11_dma_sync_single_for_device,
-	.sync_sg_for_cpu =	pa11_dma_sync_sg_for_cpu,
-	.sync_sg_for_device =	pa11_dma_sync_sg_for_device,
-	.cache_sync =		pa11_dma_cache_sync,
-};
diff --git a/arch/parisc/kernel/setup.c b/arch/parisc/kernel/setup.c
index 8d3a7b80ac42..4e87c35c22b7 100644
--- a/arch/parisc/kernel/setup.c
+++ b/arch/parisc/kernel/setup.c
@@ -97,14 +97,12 @@ void __init dma_ops_init(void)
 		panic(	"PA-RISC Linux currently only supports machines that conform to\n"
 			"the PA-RISC 1.1 or 2.0 architecture specification.\n");
 
-	case pcxs:
-	case pcxt:
-		hppa_dma_ops = &pcx_dma_ops;
-		break;
 	case pcxl2:
 		pa7300lc_init();
 	case pcxl: /* falls through */
-		hppa_dma_ops = &pcxl_dma_ops;
+	case pcxs:
+	case pcxt:
+		hppa_dma_ops = &dma_noncoherent_ops;
 		break;
 	default:
 		break;
diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
index cab32ee824d2..4ad91c28ecbe 100644
--- a/arch/parisc/mm/init.c
+++ b/arch/parisc/mm/init.c
@@ -19,7 +19,6 @@
 #include <linux/gfp.h>
 #include <linux/delay.h>
 #include <linux/init.h>
-#include <linux/pci.h>		/* for hppa_dma_ops and pcxl_dma_ops */
 #include <linux/initrd.h>
 #include <linux/swap.h>
 #include <linux/unistd.h>
@@ -616,17 +615,13 @@ void __init mem_init(void)
 	free_all_bootmem();
 
 #ifdef CONFIG_PA11
-	if (hppa_dma_ops == &pcxl_dma_ops) {
+	if (boot_cpu_data.cpu_type == pcxl2 || boot_cpu_data.cpu_type == pcxl) {
 		pcxl_dma_start = (unsigned long)SET_MAP_OFFSET(MAP_START);
 		parisc_vmalloc_start = SET_MAP_OFFSET(pcxl_dma_start
 						+ PCXL_DMA_MAP_SIZE);
-	} else {
-		pcxl_dma_start = 0;
-		parisc_vmalloc_start = SET_MAP_OFFSET(MAP_START);
-	}
-#else
-	parisc_vmalloc_start = SET_MAP_OFFSET(MAP_START);
+	} else
 #endif
+		parisc_vmalloc_start = SET_MAP_OFFSET(MAP_START);
 
 	mem_init_print_info(NULL);
 
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 22/22] parisc: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  To: linux-snps-arc

Switch to the generic noncoherent direct mapping implementation.

Parisc previously had two different non-coherent dma ops implementation
that just different in the way coherent allocations were handled or not
handled.  The different behavior is not selected at runtime in the
arch_dma_alloc and arch_dma_free routines.  The non-coherent allocation
in the pcx cases now uses the dma_direct helpers that are a little more
sophisticated and used by a lot of other architectures.

Fix sync_single_for_cpu to do skip the cache flush unless the transfer
is to the device to match the more tested unmap_single path which should
have the same cache coherency implications.

This also now consistenly uses flush_kernel_dcache_range for cache
flushing while previously some of the SG based operations used
flush_kernel_vmap_range instead.

Signed-off-by: Christoph Hellwig <hch at lst.de>
---
 arch/parisc/Kconfig                   |   4 +
 arch/parisc/include/asm/dma-mapping.h |   5 -
 arch/parisc/kernel/pci-dma.c          | 181 ++++----------------------
 arch/parisc/kernel/setup.c            |   8 +-
 arch/parisc/mm/init.c                 |  11 +-
 5 files changed, 35 insertions(+), 174 deletions(-)

diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index 47047f0cbe35..80166a1cbcb7 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -188,6 +188,10 @@ config PA20
 config PA11
 	def_bool y
 	depends on PA7000 || PA7100LC || PA7200 || PA7300LC
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
+	select DMA_NONCOHERENT_OPS
+	select DMA_NONCOHERENT_CACHE_SYNC
 
 config PREFETCH
 	def_bool y
diff --git a/arch/parisc/include/asm/dma-mapping.h b/arch/parisc/include/asm/dma-mapping.h
index 01e1fc057c83..44a9f97194aa 100644
--- a/arch/parisc/include/asm/dma-mapping.h
+++ b/arch/parisc/include/asm/dma-mapping.h
@@ -21,11 +21,6 @@
 ** flush/purge and allocate "regular" cacheable pages for everything.
 */
 
-#ifdef CONFIG_PA11
-extern const struct dma_map_ops pcxl_dma_ops;
-extern const struct dma_map_ops pcx_dma_ops;
-#endif
-
 extern const struct dma_map_ops *hppa_dma_ops;
 
 static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
diff --git a/arch/parisc/kernel/pci-dma.c b/arch/parisc/kernel/pci-dma.c
index 91bc0cac03a1..235e2e53959e 100644
--- a/arch/parisc/kernel/pci-dma.c
+++ b/arch/parisc/kernel/pci-dma.c
@@ -21,13 +21,12 @@
 #include <linux/init.h>
 #include <linux/gfp.h>
 #include <linux/mm.h>
-#include <linux/pci.h>
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
 #include <linux/string.h>
 #include <linux/types.h>
-#include <linux/scatterlist.h>
-#include <linux/export.h>
+#include <linux/dma-direct.h>
+#include <linux/dma-noncoherent.h>
 
 #include <asm/cacheflush.h>
 #include <asm/dma.h>    /* for DMA_CHUNK_SIZE */
@@ -447,178 +446,48 @@ static void pa11_dma_free(struct device *dev, size_t size, void *vaddr,
 	free_pages((unsigned long)__va(dma_handle), order);
 }
 
-static dma_addr_t pa11_dma_map_page(struct device *dev, struct page *page,
-		unsigned long offset, size_t size,
-		enum dma_data_direction direction, unsigned long attrs)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	void *addr = page_address(page) + offset;
-	BUG_ON(direction == DMA_NONE);
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		flush_kernel_dcache_range((unsigned long) addr, size);
-
-	return virt_to_phys(addr);
+	flush_kernel_dcache_range((unsigned long)phys_to_virt(paddr), size);
 }
 
-static void pa11_dma_unmap_page(struct device *dev, dma_addr_t dma_handle,
-		size_t size, enum dma_data_direction direction,
-		unsigned long attrs)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	BUG_ON(direction == DMA_NONE);
-
-	if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-		return;
-
-	if (direction == DMA_TO_DEVICE)
+	if (dir == DMA_TO_DEVICE)
 		return;
 
 	/*
-	 * For PCI_DMA_FROMDEVICE this flush is not necessary for the
+	 * For DMA_FROM_DEVICE this flush is not necessary for the
 	 * simple map/unmap case. However, it IS necessary if if
-	 * pci_dma_sync_single_* has been called and the buffer reused.
+	 * dma_sync_single_* has been called and the buffer reused.
 	 */
 
-	flush_kernel_dcache_range((unsigned long) phys_to_virt(dma_handle), size);
-}
-
-static int pa11_dma_map_sg(struct device *dev, struct scatterlist *sglist,
-		int nents, enum dma_data_direction direction,
-		unsigned long attrs)
-{
-	int i;
-	struct scatterlist *sg;
-
-	BUG_ON(direction == DMA_NONE);
-
-	for_each_sg(sglist, sg, nents, i) {
-		unsigned long vaddr = (unsigned long)sg_virt(sg);
-
-		sg_dma_address(sg) = (dma_addr_t) virt_to_phys(vaddr);
-		sg_dma_len(sg) = sg->length;
-
-		if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-			continue;
-
-		flush_kernel_dcache_range(vaddr, sg->length);
-	}
-	return nents;
+	flush_kernel_dcache_range((unsigned long)phys_to_virt(paddr), size);
 }
 
-static void pa11_dma_unmap_sg(struct device *dev, struct scatterlist *sglist,
-		int nents, enum dma_data_direction direction,
-		unsigned long attrs)
-{
-	int i;
-	struct scatterlist *sg;
-
-	BUG_ON(direction == DMA_NONE);
-
-	if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-		return;
-
-	if (direction == DMA_TO_DEVICE)
-		return;
-
-	/* once we do combining we'll need to use phys_to_virt(sg_dma_address(sglist)) */
-
-	for_each_sg(sglist, sg, nents, i)
-		flush_kernel_vmap_range(sg_virt(sg), sg->length);
-}
-
-static void pa11_dma_sync_single_for_cpu(struct device *dev,
-		dma_addr_t dma_handle, size_t size,
-		enum dma_data_direction direction)
-{
-	BUG_ON(direction == DMA_NONE);
-
-	flush_kernel_dcache_range((unsigned long) phys_to_virt(dma_handle),
-			size);
-}
-
-static void pa11_dma_sync_single_for_device(struct device *dev,
-		dma_addr_t dma_handle, size_t size,
-		enum dma_data_direction direction)
-{
-	BUG_ON(direction == DMA_NONE);
-
-	flush_kernel_dcache_range((unsigned long) phys_to_virt(dma_handle),
-			size);
-}
-
-static void pa11_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sglist, int nents, enum dma_data_direction direction)
-{
-	int i;
-	struct scatterlist *sg;
-
-	/* once we do combining we'll need to use phys_to_virt(sg_dma_address(sglist)) */
-
-	for_each_sg(sglist, sg, nents, i)
-		flush_kernel_vmap_range(sg_virt(sg), sg->length);
-}
-
-static void pa11_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sglist, int nents, enum dma_data_direction direction)
-{
-	int i;
-	struct scatterlist *sg;
-
-	/* once we do combining we'll need to use phys_to_virt(sg_dma_address(sglist)) */
-
-	for_each_sg(sglist, sg, nents, i)
-		flush_kernel_vmap_range(sg_virt(sg), sg->length);
-}
-
-static void pa11_dma_cache_sync(struct device *dev, void *vaddr, size_t size,
+void arch_dma_cache_sync(struct device *dev, void *vaddr, size_t size,
 	       enum dma_data_direction direction)
 {
 	flush_kernel_dcache_range((unsigned long)vaddr, size);
 }
 
-const struct dma_map_ops pcxl_dma_ops = {
-	.alloc =		pa11_dma_alloc,
-	.free =			pa11_dma_free,
-	.map_page =		pa11_dma_map_page,
-	.unmap_page =		pa11_dma_unmap_page,
-	.map_sg =		pa11_dma_map_sg,
-	.unmap_sg =		pa11_dma_unmap_sg,
-	.sync_single_for_cpu =	pa11_dma_sync_single_for_cpu,
-	.sync_single_for_device = pa11_dma_sync_single_for_device,
-	.sync_sg_for_cpu =	pa11_dma_sync_sg_for_cpu,
-	.sync_sg_for_device =	pa11_dma_sync_sg_for_device,
-	.cache_sync =		pa11_dma_cache_sync,
-};
-
-static void *pcx_dma_alloc(struct device *dev, size_t size,
-		dma_addr_t *dma_handle, gfp_t flag, unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs)
 {
-	void *addr;
-
-	if ((attrs & DMA_ATTR_NON_CONSISTENT) == 0)
-		return NULL;
-
-	addr = (void *)__get_free_pages(flag, get_order(size));
-	if (addr)
-		*dma_handle = (dma_addr_t)virt_to_phys(addr);
-
-	return addr;
+	if (boot_cpu_data.cpu_type == pcxl2 || boot_cpu_data.cpu_type == pcxl)
+		return pa11_dma_alloc(dev, size, dma_handle, gfp, attrs);
+	if (attrs & DMA_ATTR_NON_CONSISTENT)
+		return dma_direct_alloc(dev, size, dma_handle, gfp, attrs);
+	return NULL;
 }
 
-static void pcx_dma_free(struct device *dev, size_t size, void *vaddr,
-		dma_addr_t iova, unsigned long attrs)
+void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
+		dma_addr_t dma_addr, unsigned long attrs)
 {
-	free_pages((unsigned long)vaddr, get_order(size));
-	return;
+	if (boot_cpu_data.cpu_type == pcxl2 || boot_cpu_data.cpu_type == pcxl)
+		pa11_dma_free(dev, size, cpu_addr, dma_addr, attrs);
+	else
+		dma_direct_free(dev, size, cpu_addr, dma_addr, attrs);
 }
-
-const struct dma_map_ops pcx_dma_ops = {
-	.alloc =		pcx_dma_alloc,
-	.free =			pcx_dma_free,
-	.map_page =		pa11_dma_map_page,
-	.unmap_page =		pa11_dma_unmap_page,
-	.map_sg =		pa11_dma_map_sg,
-	.unmap_sg =		pa11_dma_unmap_sg,
-	.sync_single_for_cpu =	pa11_dma_sync_single_for_cpu,
-	.sync_single_for_device = pa11_dma_sync_single_for_device,
-	.sync_sg_for_cpu =	pa11_dma_sync_sg_for_cpu,
-	.sync_sg_for_device =	pa11_dma_sync_sg_for_device,
-	.cache_sync =		pa11_dma_cache_sync,
-};
diff --git a/arch/parisc/kernel/setup.c b/arch/parisc/kernel/setup.c
index 8d3a7b80ac42..4e87c35c22b7 100644
--- a/arch/parisc/kernel/setup.c
+++ b/arch/parisc/kernel/setup.c
@@ -97,14 +97,12 @@ void __init dma_ops_init(void)
 		panic(	"PA-RISC Linux currently only supports machines that conform to\n"
 			"the PA-RISC 1.1 or 2.0 architecture specification.\n");
 
-	case pcxs:
-	case pcxt:
-		hppa_dma_ops = &pcx_dma_ops;
-		break;
 	case pcxl2:
 		pa7300lc_init();
 	case pcxl: /* falls through */
-		hppa_dma_ops = &pcxl_dma_ops;
+	case pcxs:
+	case pcxt:
+		hppa_dma_ops = &dma_noncoherent_ops;
 		break;
 	default:
 		break;
diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
index cab32ee824d2..4ad91c28ecbe 100644
--- a/arch/parisc/mm/init.c
+++ b/arch/parisc/mm/init.c
@@ -19,7 +19,6 @@
 #include <linux/gfp.h>
 #include <linux/delay.h>
 #include <linux/init.h>
-#include <linux/pci.h>		/* for hppa_dma_ops and pcxl_dma_ops */
 #include <linux/initrd.h>
 #include <linux/swap.h>
 #include <linux/unistd.h>
@@ -616,17 +615,13 @@ void __init mem_init(void)
 	free_all_bootmem();
 
 #ifdef CONFIG_PA11
-	if (hppa_dma_ops == &pcxl_dma_ops) {
+	if (boot_cpu_data.cpu_type == pcxl2 || boot_cpu_data.cpu_type == pcxl) {
 		pcxl_dma_start = (unsigned long)SET_MAP_OFFSET(MAP_START);
 		parisc_vmalloc_start = SET_MAP_OFFSET(pcxl_dma_start
 						+ PCXL_DMA_MAP_SIZE);
-	} else {
-		pcxl_dma_start = 0;
-		parisc_vmalloc_start = SET_MAP_OFFSET(MAP_START);
-	}
-#else
-	parisc_vmalloc_start = SET_MAP_OFFSET(MAP_START);
+	} else
 #endif
+		parisc_vmalloc_start = SET_MAP_OFFSET(MAP_START);
 
 	mem_init_print_info(NULL);
 
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 22/22] parisc: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

Switch to the generic noncoherent direct mapping implementation.

Parisc previously had two different non-coherent dma ops implementation
that just different in the way coherent allocations were handled or not
handled.  The different behavior is not selected at runtime in the
arch_dma_alloc and arch_dma_free routines.  The non-coherent allocation
in the pcx cases now uses the dma_direct helpers that are a little more
sophisticated and used by a lot of other architectures.

Fix sync_single_for_cpu to do skip the cache flush unless the transfer
is to the device to match the more tested unmap_single path which should
have the same cache coherency implications.

This also now consistenly uses flush_kernel_dcache_range for cache
flushing while previously some of the SG based operations used
flush_kernel_vmap_range instead.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/parisc/Kconfig                   |   4 +
 arch/parisc/include/asm/dma-mapping.h |   5 -
 arch/parisc/kernel/pci-dma.c          | 181 ++++----------------------
 arch/parisc/kernel/setup.c            |   8 +-
 arch/parisc/mm/init.c                 |  11 +-
 5 files changed, 35 insertions(+), 174 deletions(-)

diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index 47047f0cbe35..80166a1cbcb7 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -188,6 +188,10 @@ config PA20
 config PA11
 	def_bool y
 	depends on PA7000 || PA7100LC || PA7200 || PA7300LC
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
+	select DMA_NONCOHERENT_OPS
+	select DMA_NONCOHERENT_CACHE_SYNC
 
 config PREFETCH
 	def_bool y
diff --git a/arch/parisc/include/asm/dma-mapping.h b/arch/parisc/include/asm/dma-mapping.h
index 01e1fc057c83..44a9f97194aa 100644
--- a/arch/parisc/include/asm/dma-mapping.h
+++ b/arch/parisc/include/asm/dma-mapping.h
@@ -21,11 +21,6 @@
 ** flush/purge and allocate "regular" cacheable pages for everything.
 */
 
-#ifdef CONFIG_PA11
-extern const struct dma_map_ops pcxl_dma_ops;
-extern const struct dma_map_ops pcx_dma_ops;
-#endif
-
 extern const struct dma_map_ops *hppa_dma_ops;
 
 static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
diff --git a/arch/parisc/kernel/pci-dma.c b/arch/parisc/kernel/pci-dma.c
index 91bc0cac03a1..235e2e53959e 100644
--- a/arch/parisc/kernel/pci-dma.c
+++ b/arch/parisc/kernel/pci-dma.c
@@ -21,13 +21,12 @@
 #include <linux/init.h>
 #include <linux/gfp.h>
 #include <linux/mm.h>
-#include <linux/pci.h>
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
 #include <linux/string.h>
 #include <linux/types.h>
-#include <linux/scatterlist.h>
-#include <linux/export.h>
+#include <linux/dma-direct.h>
+#include <linux/dma-noncoherent.h>
 
 #include <asm/cacheflush.h>
 #include <asm/dma.h>    /* for DMA_CHUNK_SIZE */
@@ -447,178 +446,48 @@ static void pa11_dma_free(struct device *dev, size_t size, void *vaddr,
 	free_pages((unsigned long)__va(dma_handle), order);
 }
 
-static dma_addr_t pa11_dma_map_page(struct device *dev, struct page *page,
-		unsigned long offset, size_t size,
-		enum dma_data_direction direction, unsigned long attrs)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	void *addr = page_address(page) + offset;
-	BUG_ON(direction = DMA_NONE);
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		flush_kernel_dcache_range((unsigned long) addr, size);
-
-	return virt_to_phys(addr);
+	flush_kernel_dcache_range((unsigned long)phys_to_virt(paddr), size);
 }
 
-static void pa11_dma_unmap_page(struct device *dev, dma_addr_t dma_handle,
-		size_t size, enum dma_data_direction direction,
-		unsigned long attrs)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	BUG_ON(direction = DMA_NONE);
-
-	if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-		return;
-
-	if (direction = DMA_TO_DEVICE)
+	if (dir = DMA_TO_DEVICE)
 		return;
 
 	/*
-	 * For PCI_DMA_FROMDEVICE this flush is not necessary for the
+	 * For DMA_FROM_DEVICE this flush is not necessary for the
 	 * simple map/unmap case. However, it IS necessary if if
-	 * pci_dma_sync_single_* has been called and the buffer reused.
+	 * dma_sync_single_* has been called and the buffer reused.
 	 */
 
-	flush_kernel_dcache_range((unsigned long) phys_to_virt(dma_handle), size);
-}
-
-static int pa11_dma_map_sg(struct device *dev, struct scatterlist *sglist,
-		int nents, enum dma_data_direction direction,
-		unsigned long attrs)
-{
-	int i;
-	struct scatterlist *sg;
-
-	BUG_ON(direction = DMA_NONE);
-
-	for_each_sg(sglist, sg, nents, i) {
-		unsigned long vaddr = (unsigned long)sg_virt(sg);
-
-		sg_dma_address(sg) = (dma_addr_t) virt_to_phys(vaddr);
-		sg_dma_len(sg) = sg->length;
-
-		if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-			continue;
-
-		flush_kernel_dcache_range(vaddr, sg->length);
-	}
-	return nents;
+	flush_kernel_dcache_range((unsigned long)phys_to_virt(paddr), size);
 }
 
-static void pa11_dma_unmap_sg(struct device *dev, struct scatterlist *sglist,
-		int nents, enum dma_data_direction direction,
-		unsigned long attrs)
-{
-	int i;
-	struct scatterlist *sg;
-
-	BUG_ON(direction = DMA_NONE);
-
-	if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-		return;
-
-	if (direction = DMA_TO_DEVICE)
-		return;
-
-	/* once we do combining we'll need to use phys_to_virt(sg_dma_address(sglist)) */
-
-	for_each_sg(sglist, sg, nents, i)
-		flush_kernel_vmap_range(sg_virt(sg), sg->length);
-}
-
-static void pa11_dma_sync_single_for_cpu(struct device *dev,
-		dma_addr_t dma_handle, size_t size,
-		enum dma_data_direction direction)
-{
-	BUG_ON(direction = DMA_NONE);
-
-	flush_kernel_dcache_range((unsigned long) phys_to_virt(dma_handle),
-			size);
-}
-
-static void pa11_dma_sync_single_for_device(struct device *dev,
-		dma_addr_t dma_handle, size_t size,
-		enum dma_data_direction direction)
-{
-	BUG_ON(direction = DMA_NONE);
-
-	flush_kernel_dcache_range((unsigned long) phys_to_virt(dma_handle),
-			size);
-}
-
-static void pa11_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sglist, int nents, enum dma_data_direction direction)
-{
-	int i;
-	struct scatterlist *sg;
-
-	/* once we do combining we'll need to use phys_to_virt(sg_dma_address(sglist)) */
-
-	for_each_sg(sglist, sg, nents, i)
-		flush_kernel_vmap_range(sg_virt(sg), sg->length);
-}
-
-static void pa11_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sglist, int nents, enum dma_data_direction direction)
-{
-	int i;
-	struct scatterlist *sg;
-
-	/* once we do combining we'll need to use phys_to_virt(sg_dma_address(sglist)) */
-
-	for_each_sg(sglist, sg, nents, i)
-		flush_kernel_vmap_range(sg_virt(sg), sg->length);
-}
-
-static void pa11_dma_cache_sync(struct device *dev, void *vaddr, size_t size,
+void arch_dma_cache_sync(struct device *dev, void *vaddr, size_t size,
 	       enum dma_data_direction direction)
 {
 	flush_kernel_dcache_range((unsigned long)vaddr, size);
 }
 
-const struct dma_map_ops pcxl_dma_ops = {
-	.alloc =		pa11_dma_alloc,
-	.free =			pa11_dma_free,
-	.map_page =		pa11_dma_map_page,
-	.unmap_page =		pa11_dma_unmap_page,
-	.map_sg =		pa11_dma_map_sg,
-	.unmap_sg =		pa11_dma_unmap_sg,
-	.sync_single_for_cpu =	pa11_dma_sync_single_for_cpu,
-	.sync_single_for_device = pa11_dma_sync_single_for_device,
-	.sync_sg_for_cpu =	pa11_dma_sync_sg_for_cpu,
-	.sync_sg_for_device =	pa11_dma_sync_sg_for_device,
-	.cache_sync =		pa11_dma_cache_sync,
-};
-
-static void *pcx_dma_alloc(struct device *dev, size_t size,
-		dma_addr_t *dma_handle, gfp_t flag, unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs)
 {
-	void *addr;
-
-	if ((attrs & DMA_ATTR_NON_CONSISTENT) = 0)
-		return NULL;
-
-	addr = (void *)__get_free_pages(flag, get_order(size));
-	if (addr)
-		*dma_handle = (dma_addr_t)virt_to_phys(addr);
-
-	return addr;
+	if (boot_cpu_data.cpu_type = pcxl2 || boot_cpu_data.cpu_type = pcxl)
+		return pa11_dma_alloc(dev, size, dma_handle, gfp, attrs);
+	if (attrs & DMA_ATTR_NON_CONSISTENT)
+		return dma_direct_alloc(dev, size, dma_handle, gfp, attrs);
+	return NULL;
 }
 
-static void pcx_dma_free(struct device *dev, size_t size, void *vaddr,
-		dma_addr_t iova, unsigned long attrs)
+void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
+		dma_addr_t dma_addr, unsigned long attrs)
 {
-	free_pages((unsigned long)vaddr, get_order(size));
-	return;
+	if (boot_cpu_data.cpu_type = pcxl2 || boot_cpu_data.cpu_type = pcxl)
+		pa11_dma_free(dev, size, cpu_addr, dma_addr, attrs);
+	else
+		dma_direct_free(dev, size, cpu_addr, dma_addr, attrs);
 }
-
-const struct dma_map_ops pcx_dma_ops = {
-	.alloc =		pcx_dma_alloc,
-	.free =			pcx_dma_free,
-	.map_page =		pa11_dma_map_page,
-	.unmap_page =		pa11_dma_unmap_page,
-	.map_sg =		pa11_dma_map_sg,
-	.unmap_sg =		pa11_dma_unmap_sg,
-	.sync_single_for_cpu =	pa11_dma_sync_single_for_cpu,
-	.sync_single_for_device = pa11_dma_sync_single_for_device,
-	.sync_sg_for_cpu =	pa11_dma_sync_sg_for_cpu,
-	.sync_sg_for_device =	pa11_dma_sync_sg_for_device,
-	.cache_sync =		pa11_dma_cache_sync,
-};
diff --git a/arch/parisc/kernel/setup.c b/arch/parisc/kernel/setup.c
index 8d3a7b80ac42..4e87c35c22b7 100644
--- a/arch/parisc/kernel/setup.c
+++ b/arch/parisc/kernel/setup.c
@@ -97,14 +97,12 @@ void __init dma_ops_init(void)
 		panic(	"PA-RISC Linux currently only supports machines that conform to\n"
 			"the PA-RISC 1.1 or 2.0 architecture specification.\n");
 
-	case pcxs:
-	case pcxt:
-		hppa_dma_ops = &pcx_dma_ops;
-		break;
 	case pcxl2:
 		pa7300lc_init();
 	case pcxl: /* falls through */
-		hppa_dma_ops = &pcxl_dma_ops;
+	case pcxs:
+	case pcxt:
+		hppa_dma_ops = &dma_noncoherent_ops;
 		break;
 	default:
 		break;
diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
index cab32ee824d2..4ad91c28ecbe 100644
--- a/arch/parisc/mm/init.c
+++ b/arch/parisc/mm/init.c
@@ -19,7 +19,6 @@
 #include <linux/gfp.h>
 #include <linux/delay.h>
 #include <linux/init.h>
-#include <linux/pci.h>		/* for hppa_dma_ops and pcxl_dma_ops */
 #include <linux/initrd.h>
 #include <linux/swap.h>
 #include <linux/unistd.h>
@@ -616,17 +615,13 @@ void __init mem_init(void)
 	free_all_bootmem();
 
 #ifdef CONFIG_PA11
-	if (hppa_dma_ops = &pcxl_dma_ops) {
+	if (boot_cpu_data.cpu_type = pcxl2 || boot_cpu_data.cpu_type = pcxl) {
 		pcxl_dma_start = (unsigned long)SET_MAP_OFFSET(MAP_START);
 		parisc_vmalloc_start = SET_MAP_OFFSET(pcxl_dma_start
 						+ PCXL_DMA_MAP_SIZE);
-	} else {
-		pcxl_dma_start = 0;
-		parisc_vmalloc_start = SET_MAP_OFFSET(MAP_START);
-	}
-#else
-	parisc_vmalloc_start = SET_MAP_OFFSET(MAP_START);
+	} else
 #endif
+		parisc_vmalloc_start = SET_MAP_OFFSET(MAP_START);
 
 	mem_init_print_info(NULL);
 
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [OpenRISC] [PATCH 22/22] parisc: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  To: openrisc

Switch to the generic noncoherent direct mapping implementation.

Parisc previously had two different non-coherent dma ops implementation
that just different in the way coherent allocations were handled or not
handled.  The different behavior is not selected at runtime in the
arch_dma_alloc and arch_dma_free routines.  The non-coherent allocation
in the pcx cases now uses the dma_direct helpers that are a little more
sophisticated and used by a lot of other architectures.

Fix sync_single_for_cpu to do skip the cache flush unless the transfer
is to the device to match the more tested unmap_single path which should
have the same cache coherency implications.

This also now consistenly uses flush_kernel_dcache_range for cache
flushing while previously some of the SG based operations used
flush_kernel_vmap_range instead.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/parisc/Kconfig                   |   4 +
 arch/parisc/include/asm/dma-mapping.h |   5 -
 arch/parisc/kernel/pci-dma.c          | 181 ++++----------------------
 arch/parisc/kernel/setup.c            |   8 +-
 arch/parisc/mm/init.c                 |  11 +-
 5 files changed, 35 insertions(+), 174 deletions(-)

diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index 47047f0cbe35..80166a1cbcb7 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -188,6 +188,10 @@ config PA20
 config PA11
 	def_bool y
 	depends on PA7000 || PA7100LC || PA7200 || PA7300LC
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
+	select DMA_NONCOHERENT_OPS
+	select DMA_NONCOHERENT_CACHE_SYNC
 
 config PREFETCH
 	def_bool y
diff --git a/arch/parisc/include/asm/dma-mapping.h b/arch/parisc/include/asm/dma-mapping.h
index 01e1fc057c83..44a9f97194aa 100644
--- a/arch/parisc/include/asm/dma-mapping.h
+++ b/arch/parisc/include/asm/dma-mapping.h
@@ -21,11 +21,6 @@
 ** flush/purge and allocate "regular" cacheable pages for everything.
 */
 
-#ifdef CONFIG_PA11
-extern const struct dma_map_ops pcxl_dma_ops;
-extern const struct dma_map_ops pcx_dma_ops;
-#endif
-
 extern const struct dma_map_ops *hppa_dma_ops;
 
 static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
diff --git a/arch/parisc/kernel/pci-dma.c b/arch/parisc/kernel/pci-dma.c
index 91bc0cac03a1..235e2e53959e 100644
--- a/arch/parisc/kernel/pci-dma.c
+++ b/arch/parisc/kernel/pci-dma.c
@@ -21,13 +21,12 @@
 #include <linux/init.h>
 #include <linux/gfp.h>
 #include <linux/mm.h>
-#include <linux/pci.h>
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
 #include <linux/string.h>
 #include <linux/types.h>
-#include <linux/scatterlist.h>
-#include <linux/export.h>
+#include <linux/dma-direct.h>
+#include <linux/dma-noncoherent.h>
 
 #include <asm/cacheflush.h>
 #include <asm/dma.h>    /* for DMA_CHUNK_SIZE */
@@ -447,178 +446,48 @@ static void pa11_dma_free(struct device *dev, size_t size, void *vaddr,
 	free_pages((unsigned long)__va(dma_handle), order);
 }
 
-static dma_addr_t pa11_dma_map_page(struct device *dev, struct page *page,
-		unsigned long offset, size_t size,
-		enum dma_data_direction direction, unsigned long attrs)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	void *addr = page_address(page) + offset;
-	BUG_ON(direction == DMA_NONE);
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		flush_kernel_dcache_range((unsigned long) addr, size);
-
-	return virt_to_phys(addr);
+	flush_kernel_dcache_range((unsigned long)phys_to_virt(paddr), size);
 }
 
-static void pa11_dma_unmap_page(struct device *dev, dma_addr_t dma_handle,
-		size_t size, enum dma_data_direction direction,
-		unsigned long attrs)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	BUG_ON(direction == DMA_NONE);
-
-	if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-		return;
-
-	if (direction == DMA_TO_DEVICE)
+	if (dir == DMA_TO_DEVICE)
 		return;
 
 	/*
-	 * For PCI_DMA_FROMDEVICE this flush is not necessary for the
+	 * For DMA_FROM_DEVICE this flush is not necessary for the
 	 * simple map/unmap case. However, it IS necessary if if
-	 * pci_dma_sync_single_* has been called and the buffer reused.
+	 * dma_sync_single_* has been called and the buffer reused.
 	 */
 
-	flush_kernel_dcache_range((unsigned long) phys_to_virt(dma_handle), size);
-}
-
-static int pa11_dma_map_sg(struct device *dev, struct scatterlist *sglist,
-		int nents, enum dma_data_direction direction,
-		unsigned long attrs)
-{
-	int i;
-	struct scatterlist *sg;
-
-	BUG_ON(direction == DMA_NONE);
-
-	for_each_sg(sglist, sg, nents, i) {
-		unsigned long vaddr = (unsigned long)sg_virt(sg);
-
-		sg_dma_address(sg) = (dma_addr_t) virt_to_phys(vaddr);
-		sg_dma_len(sg) = sg->length;
-
-		if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-			continue;
-
-		flush_kernel_dcache_range(vaddr, sg->length);
-	}
-	return nents;
+	flush_kernel_dcache_range((unsigned long)phys_to_virt(paddr), size);
 }
 
-static void pa11_dma_unmap_sg(struct device *dev, struct scatterlist *sglist,
-		int nents, enum dma_data_direction direction,
-		unsigned long attrs)
-{
-	int i;
-	struct scatterlist *sg;
-
-	BUG_ON(direction == DMA_NONE);
-
-	if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-		return;
-
-	if (direction == DMA_TO_DEVICE)
-		return;
-
-	/* once we do combining we'll need to use phys_to_virt(sg_dma_address(sglist)) */
-
-	for_each_sg(sglist, sg, nents, i)
-		flush_kernel_vmap_range(sg_virt(sg), sg->length);
-}
-
-static void pa11_dma_sync_single_for_cpu(struct device *dev,
-		dma_addr_t dma_handle, size_t size,
-		enum dma_data_direction direction)
-{
-	BUG_ON(direction == DMA_NONE);
-
-	flush_kernel_dcache_range((unsigned long) phys_to_virt(dma_handle),
-			size);
-}
-
-static void pa11_dma_sync_single_for_device(struct device *dev,
-		dma_addr_t dma_handle, size_t size,
-		enum dma_data_direction direction)
-{
-	BUG_ON(direction == DMA_NONE);
-
-	flush_kernel_dcache_range((unsigned long) phys_to_virt(dma_handle),
-			size);
-}
-
-static void pa11_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sglist, int nents, enum dma_data_direction direction)
-{
-	int i;
-	struct scatterlist *sg;
-
-	/* once we do combining we'll need to use phys_to_virt(sg_dma_address(sglist)) */
-
-	for_each_sg(sglist, sg, nents, i)
-		flush_kernel_vmap_range(sg_virt(sg), sg->length);
-}
-
-static void pa11_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sglist, int nents, enum dma_data_direction direction)
-{
-	int i;
-	struct scatterlist *sg;
-
-	/* once we do combining we'll need to use phys_to_virt(sg_dma_address(sglist)) */
-
-	for_each_sg(sglist, sg, nents, i)
-		flush_kernel_vmap_range(sg_virt(sg), sg->length);
-}
-
-static void pa11_dma_cache_sync(struct device *dev, void *vaddr, size_t size,
+void arch_dma_cache_sync(struct device *dev, void *vaddr, size_t size,
 	       enum dma_data_direction direction)
 {
 	flush_kernel_dcache_range((unsigned long)vaddr, size);
 }
 
-const struct dma_map_ops pcxl_dma_ops = {
-	.alloc =		pa11_dma_alloc,
-	.free =			pa11_dma_free,
-	.map_page =		pa11_dma_map_page,
-	.unmap_page =		pa11_dma_unmap_page,
-	.map_sg =		pa11_dma_map_sg,
-	.unmap_sg =		pa11_dma_unmap_sg,
-	.sync_single_for_cpu =	pa11_dma_sync_single_for_cpu,
-	.sync_single_for_device = pa11_dma_sync_single_for_device,
-	.sync_sg_for_cpu =	pa11_dma_sync_sg_for_cpu,
-	.sync_sg_for_device =	pa11_dma_sync_sg_for_device,
-	.cache_sync =		pa11_dma_cache_sync,
-};
-
-static void *pcx_dma_alloc(struct device *dev, size_t size,
-		dma_addr_t *dma_handle, gfp_t flag, unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs)
 {
-	void *addr;
-
-	if ((attrs & DMA_ATTR_NON_CONSISTENT) == 0)
-		return NULL;
-
-	addr = (void *)__get_free_pages(flag, get_order(size));
-	if (addr)
-		*dma_handle = (dma_addr_t)virt_to_phys(addr);
-
-	return addr;
+	if (boot_cpu_data.cpu_type == pcxl2 || boot_cpu_data.cpu_type == pcxl)
+		return pa11_dma_alloc(dev, size, dma_handle, gfp, attrs);
+	if (attrs & DMA_ATTR_NON_CONSISTENT)
+		return dma_direct_alloc(dev, size, dma_handle, gfp, attrs);
+	return NULL;
 }
 
-static void pcx_dma_free(struct device *dev, size_t size, void *vaddr,
-		dma_addr_t iova, unsigned long attrs)
+void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
+		dma_addr_t dma_addr, unsigned long attrs)
 {
-	free_pages((unsigned long)vaddr, get_order(size));
-	return;
+	if (boot_cpu_data.cpu_type == pcxl2 || boot_cpu_data.cpu_type == pcxl)
+		pa11_dma_free(dev, size, cpu_addr, dma_addr, attrs);
+	else
+		dma_direct_free(dev, size, cpu_addr, dma_addr, attrs);
 }
-
-const struct dma_map_ops pcx_dma_ops = {
-	.alloc =		pcx_dma_alloc,
-	.free =			pcx_dma_free,
-	.map_page =		pa11_dma_map_page,
-	.unmap_page =		pa11_dma_unmap_page,
-	.map_sg =		pa11_dma_map_sg,
-	.unmap_sg =		pa11_dma_unmap_sg,
-	.sync_single_for_cpu =	pa11_dma_sync_single_for_cpu,
-	.sync_single_for_device = pa11_dma_sync_single_for_device,
-	.sync_sg_for_cpu =	pa11_dma_sync_sg_for_cpu,
-	.sync_sg_for_device =	pa11_dma_sync_sg_for_device,
-	.cache_sync =		pa11_dma_cache_sync,
-};
diff --git a/arch/parisc/kernel/setup.c b/arch/parisc/kernel/setup.c
index 8d3a7b80ac42..4e87c35c22b7 100644
--- a/arch/parisc/kernel/setup.c
+++ b/arch/parisc/kernel/setup.c
@@ -97,14 +97,12 @@ void __init dma_ops_init(void)
 		panic(	"PA-RISC Linux currently only supports machines that conform to\n"
 			"the PA-RISC 1.1 or 2.0 architecture specification.\n");
 
-	case pcxs:
-	case pcxt:
-		hppa_dma_ops = &pcx_dma_ops;
-		break;
 	case pcxl2:
 		pa7300lc_init();
 	case pcxl: /* falls through */
-		hppa_dma_ops = &pcxl_dma_ops;
+	case pcxs:
+	case pcxt:
+		hppa_dma_ops = &dma_noncoherent_ops;
 		break;
 	default:
 		break;
diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
index cab32ee824d2..4ad91c28ecbe 100644
--- a/arch/parisc/mm/init.c
+++ b/arch/parisc/mm/init.c
@@ -19,7 +19,6 @@
 #include <linux/gfp.h>
 #include <linux/delay.h>
 #include <linux/init.h>
-#include <linux/pci.h>		/* for hppa_dma_ops and pcxl_dma_ops */
 #include <linux/initrd.h>
 #include <linux/swap.h>
 #include <linux/unistd.h>
@@ -616,17 +615,13 @@ void __init mem_init(void)
 	free_all_bootmem();
 
 #ifdef CONFIG_PA11
-	if (hppa_dma_ops == &pcxl_dma_ops) {
+	if (boot_cpu_data.cpu_type == pcxl2 || boot_cpu_data.cpu_type == pcxl) {
 		pcxl_dma_start = (unsigned long)SET_MAP_OFFSET(MAP_START);
 		parisc_vmalloc_start = SET_MAP_OFFSET(pcxl_dma_start
 						+ PCXL_DMA_MAP_SIZE);
-	} else {
-		pcxl_dma_start = 0;
-		parisc_vmalloc_start = SET_MAP_OFFSET(MAP_START);
-	}
-#else
-	parisc_vmalloc_start = SET_MAP_OFFSET(MAP_START);
+	} else
 #endif
+		parisc_vmalloc_start = SET_MAP_OFFSET(MAP_START);
 
 	mem_init_print_info(NULL);
 
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 22/22] parisc: use generic dma_noncoherent_ops
@ 2018-04-20  8:03   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-20  8:03 UTC (permalink / raw)
  To: linux-arm-kernel

Switch to the generic noncoherent direct mapping implementation.

Parisc previously had two different non-coherent dma ops implementation
that just different in the way coherent allocations were handled or not
handled.  The different behavior is not selected at runtime in the
arch_dma_alloc and arch_dma_free routines.  The non-coherent allocation
in the pcx cases now uses the dma_direct helpers that are a little more
sophisticated and used by a lot of other architectures.

Fix sync_single_for_cpu to do skip the cache flush unless the transfer
is to the device to match the more tested unmap_single path which should
have the same cache coherency implications.

This also now consistenly uses flush_kernel_dcache_range for cache
flushing while previously some of the SG based operations used
flush_kernel_vmap_range instead.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/parisc/Kconfig                   |   4 +
 arch/parisc/include/asm/dma-mapping.h |   5 -
 arch/parisc/kernel/pci-dma.c          | 181 ++++----------------------
 arch/parisc/kernel/setup.c            |   8 +-
 arch/parisc/mm/init.c                 |  11 +-
 5 files changed, 35 insertions(+), 174 deletions(-)

diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index 47047f0cbe35..80166a1cbcb7 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -188,6 +188,10 @@ config PA20
 config PA11
 	def_bool y
 	depends on PA7000 || PA7100LC || PA7200 || PA7300LC
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
+	select DMA_NONCOHERENT_OPS
+	select DMA_NONCOHERENT_CACHE_SYNC
 
 config PREFETCH
 	def_bool y
diff --git a/arch/parisc/include/asm/dma-mapping.h b/arch/parisc/include/asm/dma-mapping.h
index 01e1fc057c83..44a9f97194aa 100644
--- a/arch/parisc/include/asm/dma-mapping.h
+++ b/arch/parisc/include/asm/dma-mapping.h
@@ -21,11 +21,6 @@
 ** flush/purge and allocate "regular" cacheable pages for everything.
 */
 
-#ifdef CONFIG_PA11
-extern const struct dma_map_ops pcxl_dma_ops;
-extern const struct dma_map_ops pcx_dma_ops;
-#endif
-
 extern const struct dma_map_ops *hppa_dma_ops;
 
 static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
diff --git a/arch/parisc/kernel/pci-dma.c b/arch/parisc/kernel/pci-dma.c
index 91bc0cac03a1..235e2e53959e 100644
--- a/arch/parisc/kernel/pci-dma.c
+++ b/arch/parisc/kernel/pci-dma.c
@@ -21,13 +21,12 @@
 #include <linux/init.h>
 #include <linux/gfp.h>
 #include <linux/mm.h>
-#include <linux/pci.h>
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
 #include <linux/string.h>
 #include <linux/types.h>
-#include <linux/scatterlist.h>
-#include <linux/export.h>
+#include <linux/dma-direct.h>
+#include <linux/dma-noncoherent.h>
 
 #include <asm/cacheflush.h>
 #include <asm/dma.h>    /* for DMA_CHUNK_SIZE */
@@ -447,178 +446,48 @@ static void pa11_dma_free(struct device *dev, size_t size, void *vaddr,
 	free_pages((unsigned long)__va(dma_handle), order);
 }
 
-static dma_addr_t pa11_dma_map_page(struct device *dev, struct page *page,
-		unsigned long offset, size_t size,
-		enum dma_data_direction direction, unsigned long attrs)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	void *addr = page_address(page) + offset;
-	BUG_ON(direction == DMA_NONE);
-
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		flush_kernel_dcache_range((unsigned long) addr, size);
-
-	return virt_to_phys(addr);
+	flush_kernel_dcache_range((unsigned long)phys_to_virt(paddr), size);
 }
 
-static void pa11_dma_unmap_page(struct device *dev, dma_addr_t dma_handle,
-		size_t size, enum dma_data_direction direction,
-		unsigned long attrs)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	BUG_ON(direction == DMA_NONE);
-
-	if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-		return;
-
-	if (direction == DMA_TO_DEVICE)
+	if (dir == DMA_TO_DEVICE)
 		return;
 
 	/*
-	 * For PCI_DMA_FROMDEVICE this flush is not necessary for the
+	 * For DMA_FROM_DEVICE this flush is not necessary for the
 	 * simple map/unmap case. However, it IS necessary if if
-	 * pci_dma_sync_single_* has been called and the buffer reused.
+	 * dma_sync_single_* has been called and the buffer reused.
 	 */
 
-	flush_kernel_dcache_range((unsigned long) phys_to_virt(dma_handle), size);
-}
-
-static int pa11_dma_map_sg(struct device *dev, struct scatterlist *sglist,
-		int nents, enum dma_data_direction direction,
-		unsigned long attrs)
-{
-	int i;
-	struct scatterlist *sg;
-
-	BUG_ON(direction == DMA_NONE);
-
-	for_each_sg(sglist, sg, nents, i) {
-		unsigned long vaddr = (unsigned long)sg_virt(sg);
-
-		sg_dma_address(sg) = (dma_addr_t) virt_to_phys(vaddr);
-		sg_dma_len(sg) = sg->length;
-
-		if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-			continue;
-
-		flush_kernel_dcache_range(vaddr, sg->length);
-	}
-	return nents;
+	flush_kernel_dcache_range((unsigned long)phys_to_virt(paddr), size);
 }
 
-static void pa11_dma_unmap_sg(struct device *dev, struct scatterlist *sglist,
-		int nents, enum dma_data_direction direction,
-		unsigned long attrs)
-{
-	int i;
-	struct scatterlist *sg;
-
-	BUG_ON(direction == DMA_NONE);
-
-	if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
-		return;
-
-	if (direction == DMA_TO_DEVICE)
-		return;
-
-	/* once we do combining we'll need to use phys_to_virt(sg_dma_address(sglist)) */
-
-	for_each_sg(sglist, sg, nents, i)
-		flush_kernel_vmap_range(sg_virt(sg), sg->length);
-}
-
-static void pa11_dma_sync_single_for_cpu(struct device *dev,
-		dma_addr_t dma_handle, size_t size,
-		enum dma_data_direction direction)
-{
-	BUG_ON(direction == DMA_NONE);
-
-	flush_kernel_dcache_range((unsigned long) phys_to_virt(dma_handle),
-			size);
-}
-
-static void pa11_dma_sync_single_for_device(struct device *dev,
-		dma_addr_t dma_handle, size_t size,
-		enum dma_data_direction direction)
-{
-	BUG_ON(direction == DMA_NONE);
-
-	flush_kernel_dcache_range((unsigned long) phys_to_virt(dma_handle),
-			size);
-}
-
-static void pa11_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sglist, int nents, enum dma_data_direction direction)
-{
-	int i;
-	struct scatterlist *sg;
-
-	/* once we do combining we'll need to use phys_to_virt(sg_dma_address(sglist)) */
-
-	for_each_sg(sglist, sg, nents, i)
-		flush_kernel_vmap_range(sg_virt(sg), sg->length);
-}
-
-static void pa11_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sglist, int nents, enum dma_data_direction direction)
-{
-	int i;
-	struct scatterlist *sg;
-
-	/* once we do combining we'll need to use phys_to_virt(sg_dma_address(sglist)) */
-
-	for_each_sg(sglist, sg, nents, i)
-		flush_kernel_vmap_range(sg_virt(sg), sg->length);
-}
-
-static void pa11_dma_cache_sync(struct device *dev, void *vaddr, size_t size,
+void arch_dma_cache_sync(struct device *dev, void *vaddr, size_t size,
 	       enum dma_data_direction direction)
 {
 	flush_kernel_dcache_range((unsigned long)vaddr, size);
 }
 
-const struct dma_map_ops pcxl_dma_ops = {
-	.alloc =		pa11_dma_alloc,
-	.free =			pa11_dma_free,
-	.map_page =		pa11_dma_map_page,
-	.unmap_page =		pa11_dma_unmap_page,
-	.map_sg =		pa11_dma_map_sg,
-	.unmap_sg =		pa11_dma_unmap_sg,
-	.sync_single_for_cpu =	pa11_dma_sync_single_for_cpu,
-	.sync_single_for_device = pa11_dma_sync_single_for_device,
-	.sync_sg_for_cpu =	pa11_dma_sync_sg_for_cpu,
-	.sync_sg_for_device =	pa11_dma_sync_sg_for_device,
-	.cache_sync =		pa11_dma_cache_sync,
-};
-
-static void *pcx_dma_alloc(struct device *dev, size_t size,
-		dma_addr_t *dma_handle, gfp_t flag, unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
+		gfp_t gfp, unsigned long attrs)
 {
-	void *addr;
-
-	if ((attrs & DMA_ATTR_NON_CONSISTENT) == 0)
-		return NULL;
-
-	addr = (void *)__get_free_pages(flag, get_order(size));
-	if (addr)
-		*dma_handle = (dma_addr_t)virt_to_phys(addr);
-
-	return addr;
+	if (boot_cpu_data.cpu_type == pcxl2 || boot_cpu_data.cpu_type == pcxl)
+		return pa11_dma_alloc(dev, size, dma_handle, gfp, attrs);
+	if (attrs & DMA_ATTR_NON_CONSISTENT)
+		return dma_direct_alloc(dev, size, dma_handle, gfp, attrs);
+	return NULL;
 }
 
-static void pcx_dma_free(struct device *dev, size_t size, void *vaddr,
-		dma_addr_t iova, unsigned long attrs)
+void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
+		dma_addr_t dma_addr, unsigned long attrs)
 {
-	free_pages((unsigned long)vaddr, get_order(size));
-	return;
+	if (boot_cpu_data.cpu_type == pcxl2 || boot_cpu_data.cpu_type == pcxl)
+		pa11_dma_free(dev, size, cpu_addr, dma_addr, attrs);
+	else
+		dma_direct_free(dev, size, cpu_addr, dma_addr, attrs);
 }
-
-const struct dma_map_ops pcx_dma_ops = {
-	.alloc =		pcx_dma_alloc,
-	.free =			pcx_dma_free,
-	.map_page =		pa11_dma_map_page,
-	.unmap_page =		pa11_dma_unmap_page,
-	.map_sg =		pa11_dma_map_sg,
-	.unmap_sg =		pa11_dma_unmap_sg,
-	.sync_single_for_cpu =	pa11_dma_sync_single_for_cpu,
-	.sync_single_for_device = pa11_dma_sync_single_for_device,
-	.sync_sg_for_cpu =	pa11_dma_sync_sg_for_cpu,
-	.sync_sg_for_device =	pa11_dma_sync_sg_for_device,
-	.cache_sync =		pa11_dma_cache_sync,
-};
diff --git a/arch/parisc/kernel/setup.c b/arch/parisc/kernel/setup.c
index 8d3a7b80ac42..4e87c35c22b7 100644
--- a/arch/parisc/kernel/setup.c
+++ b/arch/parisc/kernel/setup.c
@@ -97,14 +97,12 @@ void __init dma_ops_init(void)
 		panic(	"PA-RISC Linux currently only supports machines that conform to\n"
 			"the PA-RISC 1.1 or 2.0 architecture specification.\n");
 
-	case pcxs:
-	case pcxt:
-		hppa_dma_ops = &pcx_dma_ops;
-		break;
 	case pcxl2:
 		pa7300lc_init();
 	case pcxl: /* falls through */
-		hppa_dma_ops = &pcxl_dma_ops;
+	case pcxs:
+	case pcxt:
+		hppa_dma_ops = &dma_noncoherent_ops;
 		break;
 	default:
 		break;
diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
index cab32ee824d2..4ad91c28ecbe 100644
--- a/arch/parisc/mm/init.c
+++ b/arch/parisc/mm/init.c
@@ -19,7 +19,6 @@
 #include <linux/gfp.h>
 #include <linux/delay.h>
 #include <linux/init.h>
-#include <linux/pci.h>		/* for hppa_dma_ops and pcxl_dma_ops */
 #include <linux/initrd.h>
 #include <linux/swap.h>
 #include <linux/unistd.h>
@@ -616,17 +615,13 @@ void __init mem_init(void)
 	free_all_bootmem();
 
 #ifdef CONFIG_PA11
-	if (hppa_dma_ops == &pcxl_dma_ops) {
+	if (boot_cpu_data.cpu_type == pcxl2 || boot_cpu_data.cpu_type == pcxl) {
 		pcxl_dma_start = (unsigned long)SET_MAP_OFFSET(MAP_START);
 		parisc_vmalloc_start = SET_MAP_OFFSET(pcxl_dma_start
 						+ PCXL_DMA_MAP_SIZE);
-	} else {
-		pcxl_dma_start = 0;
-		parisc_vmalloc_start = SET_MAP_OFFSET(MAP_START);
-	}
-#else
-	parisc_vmalloc_start = SET_MAP_OFFSET(MAP_START);
+	} else
 #endif
+		parisc_vmalloc_start = SET_MAP_OFFSET(MAP_START);
 
 	mem_init_print_info(NULL);
 
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* Re: [PATCH 01/22] dma-debug: move initialization to common code
  2018-04-20  8:02   ` Christoph Hellwig
                       ` (2 preceding siblings ...)
  (?)
@ 2018-04-20 10:23     ` Robin Murphy
  -1 siblings, 0 replies; 2593+ messages in thread
From: Robin Murphy @ 2018-04-20 10:23 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-arch, linux-xtensa, Michal Simek, Vincent Chen,
	linux-c6x-dev, linux-parisc, linux-sh, linux-hexagon,
	linux-kernel, linux-m68k, openrisc, Greentime Hu, linux-alpha,
	sparclinux, nios2-dev, linux-snps-arc, linux-arm-kernel

Hi Christoph,

Nice cleanup! Looks good overall, just a couple of nits.

On 20/04/18 09:02, Christoph Hellwig wrote:
[...]
> diff --git a/lib/dma-debug.c b/lib/dma-debug.c
> index 7f5cdc1e6b29..712a897174e4 100644
> --- a/lib/dma-debug.c
> +++ b/lib/dma-debug.c
> @@ -41,6 +41,11 @@
>   #define HASH_FN_SHIFT   13
>   #define HASH_FN_MASK    (HASH_SIZE - 1)
>   
> +/* allow architectures to override this if absolutely required */
> +#ifndef PREALLOC_DMA_DEBUG_ENTRIES
> +#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
> +#endif
> +
>   enum {
>   	dma_debug_single,
>   	dma_debug_page,
> @@ -1004,18 +1009,16 @@ void dma_debug_add_bus(struct bus_type *bus)
>   	bus_register_notifier(bus, nb);
>   }
>   
> -/*
> - * Let the architectures decide how many entries should be preallocated.
> - */
> -void dma_debug_init(u32 num_entries)
> +static int dma_debug_init(void)
>   {
> +	u32 num_entries;

Maybe initialise it to PREALLOC_DMA_DEBUG_ENTRIES?

>   	int i;
>   
>   	/* Do not use dma_debug_initialized here, since we really want to be
>   	 * called to set dma_debug_initialized
>   	 */
>   	if (global_disable)
> -		return;
> +		return 0;
>   
>   	for (i = 0; i < HASH_SIZE; ++i) {
>   		INIT_LIST_HEAD(&dma_entry_hash[i].list);
> @@ -1026,17 +1029,19 @@ void dma_debug_init(u32 num_entries)
>   		pr_err("DMA-API: error creating debugfs entries - disabling\n");
>   		global_disable = true;
>   
> -		return;
> +		return 0;
>   	}
>   
>   	if (req_entries)
>   		num_entries = req_entries;
> +	else
> +		num_entries = PREALLOC_DMA_DEBUG_ENTRIES;
>   
>   	if (prealloc_memory(num_entries) != 0) {
>   		pr_err("DMA-API: debugging out of memory error - disabled\n");
>   		global_disable = true;
>   
> -		return;
> +		return 0;
>   	}
>   
>   	nr_total_entries = num_free_entries;
> @@ -1044,7 +1049,9 @@ void dma_debug_init(u32 num_entries)
>   	dma_debug_initialized = true;
>   
>   	pr_info("DMA-API: debugging enabled by kernel config\n");
> +	return 0;
>   }
> +core_initcall(dma_debug_init);

I think it's worth noting that for most users this now happens much 
earlier than before. In general that's probably good (e.g. on arm64 it 
should prevent false-positives from the Arm SMMU drivers under ACPI), 
and I can't imagine it's high-risk, but it is a behaviour change.

Robin.

>   
>   static __init int dma_debug_cmdline(char *str)
>   {
> 

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* [PATCH 01/22] dma-debug: move initialization to common code
@ 2018-04-20 10:23     ` Robin Murphy
  0 siblings, 0 replies; 2593+ messages in thread
From: Robin Murphy @ 2018-04-20 10:23 UTC (permalink / raw)
  To: linux-snps-arc

Hi Christoph,

Nice cleanup! Looks good overall, just a couple of nits.

On 20/04/18 09:02, Christoph Hellwig wrote:
[...]
> diff --git a/lib/dma-debug.c b/lib/dma-debug.c
> index 7f5cdc1e6b29..712a897174e4 100644
> --- a/lib/dma-debug.c
> +++ b/lib/dma-debug.c
> @@ -41,6 +41,11 @@
>   #define HASH_FN_SHIFT   13
>   #define HASH_FN_MASK    (HASH_SIZE - 1)
>   
> +/* allow architectures to override this if absolutely required */
> +#ifndef PREALLOC_DMA_DEBUG_ENTRIES
> +#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
> +#endif
> +
>   enum {
>   	dma_debug_single,
>   	dma_debug_page,
> @@ -1004,18 +1009,16 @@ void dma_debug_add_bus(struct bus_type *bus)
>   	bus_register_notifier(bus, nb);
>   }
>   
> -/*
> - * Let the architectures decide how many entries should be preallocated.
> - */
> -void dma_debug_init(u32 num_entries)
> +static int dma_debug_init(void)
>   {
> +	u32 num_entries;

Maybe initialise it to PREALLOC_DMA_DEBUG_ENTRIES?

>   	int i;
>   
>   	/* Do not use dma_debug_initialized here, since we really want to be
>   	 * called to set dma_debug_initialized
>   	 */
>   	if (global_disable)
> -		return;
> +		return 0;
>   
>   	for (i = 0; i < HASH_SIZE; ++i) {
>   		INIT_LIST_HEAD(&dma_entry_hash[i].list);
> @@ -1026,17 +1029,19 @@ void dma_debug_init(u32 num_entries)
>   		pr_err("DMA-API: error creating debugfs entries - disabling\n");
>   		global_disable = true;
>   
> -		return;
> +		return 0;
>   	}
>   
>   	if (req_entries)
>   		num_entries = req_entries;
> +	else
> +		num_entries = PREALLOC_DMA_DEBUG_ENTRIES;
>   
>   	if (prealloc_memory(num_entries) != 0) {
>   		pr_err("DMA-API: debugging out of memory error - disabled\n");
>   		global_disable = true;
>   
> -		return;
> +		return 0;
>   	}
>   
>   	nr_total_entries = num_free_entries;
> @@ -1044,7 +1049,9 @@ void dma_debug_init(u32 num_entries)
>   	dma_debug_initialized = true;
>   
>   	pr_info("DMA-API: debugging enabled by kernel config\n");
> +	return 0;
>   }
> +core_initcall(dma_debug_init);

I think it's worth noting that for most users this now happens much 
earlier than before. In general that's probably good (e.g. on arm64 it 
should prevent false-positives from the Arm SMMU drivers under ACPI), 
and I can't imagine it's high-risk, but it is a behaviour change.

Robin.

>   
>   static __init int dma_debug_cmdline(char *str)
>   {
> 

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* Re: [PATCH 01/22] dma-debug: move initialization to common code
@ 2018-04-20 10:23     ` Robin Murphy
  0 siblings, 0 replies; 2593+ messages in thread
From: Robin Murphy @ 2018-04-20 10:23 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-arch, linux-xtensa, Michal Simek, Vincent Chen,
	linux-c6x-dev, linux-parisc, linux-sh, linux-hexagon,
	linux-kernel, linux-m68k, openrisc, Greentime Hu, linux-alpha,
	sparclinux, nios2-dev, linux-snps-arc, linux-arm-kernel

Hi Christoph,

Nice cleanup! Looks good overall, just a couple of nits.

On 20/04/18 09:02, Christoph Hellwig wrote:
[...]
> diff --git a/lib/dma-debug.c b/lib/dma-debug.c
> index 7f5cdc1e6b29..712a897174e4 100644
> --- a/lib/dma-debug.c
> +++ b/lib/dma-debug.c
> @@ -41,6 +41,11 @@
>   #define HASH_FN_SHIFT   13
>   #define HASH_FN_MASK    (HASH_SIZE - 1)
>   
> +/* allow architectures to override this if absolutely required */
> +#ifndef PREALLOC_DMA_DEBUG_ENTRIES
> +#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
> +#endif
> +
>   enum {
>   	dma_debug_single,
>   	dma_debug_page,
> @@ -1004,18 +1009,16 @@ void dma_debug_add_bus(struct bus_type *bus)
>   	bus_register_notifier(bus, nb);
>   }
>   
> -/*
> - * Let the architectures decide how many entries should be preallocated.
> - */
> -void dma_debug_init(u32 num_entries)
> +static int dma_debug_init(void)
>   {
> +	u32 num_entries;

Maybe initialise it to PREALLOC_DMA_DEBUG_ENTRIES?

>   	int i;
>   
>   	/* Do not use dma_debug_initialized here, since we really want to be
>   	 * called to set dma_debug_initialized
>   	 */
>   	if (global_disable)
> -		return;
> +		return 0;
>   
>   	for (i = 0; i < HASH_SIZE; ++i) {
>   		INIT_LIST_HEAD(&dma_entry_hash[i].list);
> @@ -1026,17 +1029,19 @@ void dma_debug_init(u32 num_entries)
>   		pr_err("DMA-API: error creating debugfs entries - disabling\n");
>   		global_disable = true;
>   
> -		return;
> +		return 0;
>   	}
>   
>   	if (req_entries)
>   		num_entries = req_entries;
> +	else
> +		num_entries = PREALLOC_DMA_DEBUG_ENTRIES;
>   
>   	if (prealloc_memory(num_entries) != 0) {
>   		pr_err("DMA-API: debugging out of memory error - disabled\n");
>   		global_disable = true;
>   
> -		return;
> +		return 0;
>   	}
>   
>   	nr_total_entries = num_free_entries;
> @@ -1044,7 +1049,9 @@ void dma_debug_init(u32 num_entries)
>   	dma_debug_initialized = true;
>   
>   	pr_info("DMA-API: debugging enabled by kernel config\n");
> +	return 0;
>   }
> +core_initcall(dma_debug_init);

I think it's worth noting that for most users this now happens much 
earlier than before. In general that's probably good (e.g. on arm64 it 
should prevent false-positives from the Arm SMMU drivers under ACPI), 
and I can't imagine it's high-risk, but it is a behaviour change.

Robin.

>   
>   static __init int dma_debug_cmdline(char *str)
>   {
> 

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* [OpenRISC] [PATCH 01/22] dma-debug: move initialization to common code
@ 2018-04-20 10:23     ` Robin Murphy
  0 siblings, 0 replies; 2593+ messages in thread
From: Robin Murphy @ 2018-04-20 10:23 UTC (permalink / raw)
  To: openrisc

Hi Christoph,

Nice cleanup! Looks good overall, just a couple of nits.

On 20/04/18 09:02, Christoph Hellwig wrote:
[...]
> diff --git a/lib/dma-debug.c b/lib/dma-debug.c
> index 7f5cdc1e6b29..712a897174e4 100644
> --- a/lib/dma-debug.c
> +++ b/lib/dma-debug.c
> @@ -41,6 +41,11 @@
>   #define HASH_FN_SHIFT   13
>   #define HASH_FN_MASK    (HASH_SIZE - 1)
>   
> +/* allow architectures to override this if absolutely required */
> +#ifndef PREALLOC_DMA_DEBUG_ENTRIES
> +#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
> +#endif
> +
>   enum {
>   	dma_debug_single,
>   	dma_debug_page,
> @@ -1004,18 +1009,16 @@ void dma_debug_add_bus(struct bus_type *bus)
>   	bus_register_notifier(bus, nb);
>   }
>   
> -/*
> - * Let the architectures decide how many entries should be preallocated.
> - */
> -void dma_debug_init(u32 num_entries)
> +static int dma_debug_init(void)
>   {
> +	u32 num_entries;

Maybe initialise it to PREALLOC_DMA_DEBUG_ENTRIES?

>   	int i;
>   
>   	/* Do not use dma_debug_initialized here, since we really want to be
>   	 * called to set dma_debug_initialized
>   	 */
>   	if (global_disable)
> -		return;
> +		return 0;
>   
>   	for (i = 0; i < HASH_SIZE; ++i) {
>   		INIT_LIST_HEAD(&dma_entry_hash[i].list);
> @@ -1026,17 +1029,19 @@ void dma_debug_init(u32 num_entries)
>   		pr_err("DMA-API: error creating debugfs entries - disabling\n");
>   		global_disable = true;
>   
> -		return;
> +		return 0;
>   	}
>   
>   	if (req_entries)
>   		num_entries = req_entries;
> +	else
> +		num_entries = PREALLOC_DMA_DEBUG_ENTRIES;
>   
>   	if (prealloc_memory(num_entries) != 0) {
>   		pr_err("DMA-API: debugging out of memory error - disabled\n");
>   		global_disable = true;
>   
> -		return;
> +		return 0;
>   	}
>   
>   	nr_total_entries = num_free_entries;
> @@ -1044,7 +1049,9 @@ void dma_debug_init(u32 num_entries)
>   	dma_debug_initialized = true;
>   
>   	pr_info("DMA-API: debugging enabled by kernel config\n");
> +	return 0;
>   }
> +core_initcall(dma_debug_init);

I think it's worth noting that for most users this now happens much 
earlier than before. In general that's probably good (e.g. on arm64 it 
should prevent false-positives from the Arm SMMU drivers under ACPI), 
and I can't imagine it's high-risk, but it is a behaviour change.

Robin.

>   
>   static __init int dma_debug_cmdline(char *str)
>   {
> 

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* [PATCH 01/22] dma-debug: move initialization to common code
@ 2018-04-20 10:23     ` Robin Murphy
  0 siblings, 0 replies; 2593+ messages in thread
From: Robin Murphy @ 2018-04-20 10:23 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Christoph,

Nice cleanup! Looks good overall, just a couple of nits.

On 20/04/18 09:02, Christoph Hellwig wrote:
[...]
> diff --git a/lib/dma-debug.c b/lib/dma-debug.c
> index 7f5cdc1e6b29..712a897174e4 100644
> --- a/lib/dma-debug.c
> +++ b/lib/dma-debug.c
> @@ -41,6 +41,11 @@
>   #define HASH_FN_SHIFT   13
>   #define HASH_FN_MASK    (HASH_SIZE - 1)
>   
> +/* allow architectures to override this if absolutely required */
> +#ifndef PREALLOC_DMA_DEBUG_ENTRIES
> +#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 16)
> +#endif
> +
>   enum {
>   	dma_debug_single,
>   	dma_debug_page,
> @@ -1004,18 +1009,16 @@ void dma_debug_add_bus(struct bus_type *bus)
>   	bus_register_notifier(bus, nb);
>   }
>   
> -/*
> - * Let the architectures decide how many entries should be preallocated.
> - */
> -void dma_debug_init(u32 num_entries)
> +static int dma_debug_init(void)
>   {
> +	u32 num_entries;

Maybe initialise it to PREALLOC_DMA_DEBUG_ENTRIES?

>   	int i;
>   
>   	/* Do not use dma_debug_initialized here, since we really want to be
>   	 * called to set dma_debug_initialized
>   	 */
>   	if (global_disable)
> -		return;
> +		return 0;
>   
>   	for (i = 0; i < HASH_SIZE; ++i) {
>   		INIT_LIST_HEAD(&dma_entry_hash[i].list);
> @@ -1026,17 +1029,19 @@ void dma_debug_init(u32 num_entries)
>   		pr_err("DMA-API: error creating debugfs entries - disabling\n");
>   		global_disable = true;
>   
> -		return;
> +		return 0;
>   	}
>   
>   	if (req_entries)
>   		num_entries = req_entries;
> +	else
> +		num_entries = PREALLOC_DMA_DEBUG_ENTRIES;
>   
>   	if (prealloc_memory(num_entries) != 0) {
>   		pr_err("DMA-API: debugging out of memory error - disabled\n");
>   		global_disable = true;
>   
> -		return;
> +		return 0;
>   	}
>   
>   	nr_total_entries = num_free_entries;
> @@ -1044,7 +1049,9 @@ void dma_debug_init(u32 num_entries)
>   	dma_debug_initialized = true;
>   
>   	pr_info("DMA-API: debugging enabled by kernel config\n");
> +	return 0;
>   }
> +core_initcall(dma_debug_init);

I think it's worth noting that for most users this now happens much 
earlier than before. In general that's probably good (e.g. on arm64 it 
should prevent false-positives from the Arm SMMU drivers under ACPI), 
and I can't imagine it's high-risk, but it is a behaviour change.

Robin.

>   
>   static __init int dma_debug_cmdline(char *str)
>   {
> 

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* Re: [PATCH 22/22] parisc: use generic dma_noncoherent_ops
@ 2018-04-21 17:43     ` Helge Deller
  0 siblings, 0 replies; 2593+ messages in thread
From: Helge Deller @ 2018-04-21 17:43 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-arch, Michal Simek, Vincent Chen, linux-c6x-dev,
	linux-parisc, linux-sh, linux-hexagon, linux-kernel, linux-m68k,
	openrisc, Greentime Hu, linux-alpha, sparclinux, nios2-dev,
	linux-snps-arc, linux-arm-kernel

On 20.04.2018 10:03, Christoph Hellwig wrote:
> Switch to the generic noncoherent direct mapping implementation.
> 
> Parisc previously had two different non-coherent dma ops implementation
> that just different in the way coherent allocations were handled or not
> handled.  The different behavior is not selected at runtime in the
> arch_dma_alloc and arch_dma_free routines.  The non-coherent allocation
> in the pcx cases now uses the dma_direct helpers that are a little more
> sophisticated and used by a lot of other architectures.
> 
> Fix sync_single_for_cpu to do skip the cache flush unless the transfer
> is to the device to match the more tested unmap_single path which should
> have the same cache coherency implications.
> 
> This also now consistenly uses flush_kernel_dcache_range for cache
> flushing while previously some of the SG based operations used
> flush_kernel_vmap_range instead.


This patch breaks a 32bit kernel on a B160L machine (PA7300LC CPU, "pcxl2").
After applying this patch series the lasi82956 network driver works unreliable. 
NIC gets IP, but ping doesn't work.
See drivers/net/ethernet/i825xx/lasi_82596.c, it uses dma*sync() functions.

Helge

 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  arch/parisc/Kconfig                   |   4 +
>  arch/parisc/include/asm/dma-mapping.h |   5 -
>  arch/parisc/kernel/pci-dma.c          | 181 ++++----------------------
>  arch/parisc/kernel/setup.c            |   8 +-
>  arch/parisc/mm/init.c                 |  11 +-
>  5 files changed, 35 insertions(+), 174 deletions(-)
> 
> diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
> index 47047f0cbe35..80166a1cbcb7 100644
> --- a/arch/parisc/Kconfig
> +++ b/arch/parisc/Kconfig
> @@ -188,6 +188,10 @@ config PA20
>  config PA11
>  	def_bool y
>  	depends on PA7000 || PA7100LC || PA7200 || PA7300LC
> +	select ARCH_HAS_SYNC_DMA_FOR_CPU
> +	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
> +	select DMA_NONCOHERENT_OPS
> +	select DMA_NONCOHERENT_CACHE_SYNC
>  
>  config PREFETCH
>  	def_bool y
> diff --git a/arch/parisc/include/asm/dma-mapping.h b/arch/parisc/include/asm/dma-mapping.h
> index 01e1fc057c83..44a9f97194aa 100644
> --- a/arch/parisc/include/asm/dma-mapping.h
> +++ b/arch/parisc/include/asm/dma-mapping.h
> @@ -21,11 +21,6 @@
>  ** flush/purge and allocate "regular" cacheable pages for everything.
>  */
>  
> -#ifdef CONFIG_PA11
> -extern const struct dma_map_ops pcxl_dma_ops;
> -extern const struct dma_map_ops pcx_dma_ops;
> -#endif
> -
>  extern const struct dma_map_ops *hppa_dma_ops;
>  
>  static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
> diff --git a/arch/parisc/kernel/pci-dma.c b/arch/parisc/kernel/pci-dma.c
> index 91bc0cac03a1..235e2e53959e 100644
> --- a/arch/parisc/kernel/pci-dma.c
> +++ b/arch/parisc/kernel/pci-dma.c
> @@ -21,13 +21,12 @@
>  #include <linux/init.h>
>  #include <linux/gfp.h>
>  #include <linux/mm.h>
> -#include <linux/pci.h>
>  #include <linux/proc_fs.h>
>  #include <linux/seq_file.h>
>  #include <linux/string.h>
>  #include <linux/types.h>
> -#include <linux/scatterlist.h>
> -#include <linux/export.h>
> +#include <linux/dma-direct.h>
> +#include <linux/dma-noncoherent.h>
>  
>  #include <asm/cacheflush.h>
>  #include <asm/dma.h>    /* for DMA_CHUNK_SIZE */
> @@ -447,178 +446,48 @@ static void pa11_dma_free(struct device *dev, size_t size, void *vaddr,
>  	free_pages((unsigned long)__va(dma_handle), order);
>  }
>  
> -static dma_addr_t pa11_dma_map_page(struct device *dev, struct page *page,
> -		unsigned long offset, size_t size,
> -		enum dma_data_direction direction, unsigned long attrs)
> +void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
> +		size_t size, enum dma_data_direction dir)
>  {
> -	void *addr = page_address(page) + offset;
> -	BUG_ON(direction == DMA_NONE);
> -
> -	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
> -		flush_kernel_dcache_range((unsigned long) addr, size);
> -
> -	return virt_to_phys(addr);
> +	flush_kernel_dcache_range((unsigned long)phys_to_virt(paddr), size);
>  }
>  
> -static void pa11_dma_unmap_page(struct device *dev, dma_addr_t dma_handle,
> -		size_t size, enum dma_data_direction direction,
> -		unsigned long attrs)
> +void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
> +		size_t size, enum dma_data_direction dir)
>  {
> -	BUG_ON(direction == DMA_NONE);
> -
> -	if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
> -		return;
> -
> -	if (direction == DMA_TO_DEVICE)
> +	if (dir == DMA_TO_DEVICE)
>  		return;
>  
>  	/*
> -	 * For PCI_DMA_FROMDEVICE this flush is not necessary for the
> +	 * For DMA_FROM_DEVICE this flush is not necessary for the
>  	 * simple map/unmap case. However, it IS necessary if if
> -	 * pci_dma_sync_single_* has been called and the buffer reused.
> +	 * dma_sync_single_* has been called and the buffer reused.
>  	 */
>  
> -	flush_kernel_dcache_range((unsigned long) phys_to_virt(dma_handle), size);
> -}
> -
> -static int pa11_dma_map_sg(struct device *dev, struct scatterlist *sglist,
> -		int nents, enum dma_data_direction direction,
> -		unsigned long attrs)
> -{
> -	int i;
> -	struct scatterlist *sg;
> -
> -	BUG_ON(direction == DMA_NONE);
> -
> -	for_each_sg(sglist, sg, nents, i) {
> -		unsigned long vaddr = (unsigned long)sg_virt(sg);
> -
> -		sg_dma_address(sg) = (dma_addr_t) virt_to_phys(vaddr);
> -		sg_dma_len(sg) = sg->length;
> -
> -		if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
> -			continue;
> -
> -		flush_kernel_dcache_range(vaddr, sg->length);
> -	}
> -	return nents;
> +	flush_kernel_dcache_range((unsigned long)phys_to_virt(paddr), size);
>  }
>  
> -static void pa11_dma_unmap_sg(struct device *dev, struct scatterlist *sglist,
> -		int nents, enum dma_data_direction direction,
> -		unsigned long attrs)
> -{
> -	int i;
> -	struct scatterlist *sg;
> -
> -	BUG_ON(direction == DMA_NONE);
> -
> -	if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
> -		return;
> -
> -	if (direction == DMA_TO_DEVICE)
> -		return;
> -
> -	/* once we do combining we'll need to use phys_to_virt(sg_dma_address(sglist)) */
> -
> -	for_each_sg(sglist, sg, nents, i)
> -		flush_kernel_vmap_range(sg_virt(sg), sg->length);
> -}
> -
> -static void pa11_dma_sync_single_for_cpu(struct device *dev,
> -		dma_addr_t dma_handle, size_t size,
> -		enum dma_data_direction direction)
> -{
> -	BUG_ON(direction == DMA_NONE);
> -
> -	flush_kernel_dcache_range((unsigned long) phys_to_virt(dma_handle),
> -			size);
> -}
> -
> -static void pa11_dma_sync_single_for_device(struct device *dev,
> -		dma_addr_t dma_handle, size_t size,
> -		enum dma_data_direction direction)
> -{
> -	BUG_ON(direction == DMA_NONE);
> -
> -	flush_kernel_dcache_range((unsigned long) phys_to_virt(dma_handle),
> -			size);
> -}
> -
> -static void pa11_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sglist, int nents, enum dma_data_direction direction)
> -{
> -	int i;
> -	struct scatterlist *sg;
> -
> -	/* once we do combining we'll need to use phys_to_virt(sg_dma_address(sglist)) */
> -
> -	for_each_sg(sglist, sg, nents, i)
> -		flush_kernel_vmap_range(sg_virt(sg), sg->length);
> -}
> -
> -static void pa11_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sglist, int nents, enum dma_data_direction direction)
> -{
> -	int i;
> -	struct scatterlist *sg;
> -
> -	/* once we do combining we'll need to use phys_to_virt(sg_dma_address(sglist)) */
> -
> -	for_each_sg(sglist, sg, nents, i)
> -		flush_kernel_vmap_range(sg_virt(sg), sg->length);
> -}
> -
> -static void pa11_dma_cache_sync(struct device *dev, void *vaddr, size_t size,
> +void arch_dma_cache_sync(struct device *dev, void *vaddr, size_t size,
>  	       enum dma_data_direction direction)
>  {
>  	flush_kernel_dcache_range((unsigned long)vaddr, size);
>  }
>  
> -const struct dma_map_ops pcxl_dma_ops = {
> -	.alloc =		pa11_dma_alloc,
> -	.free =			pa11_dma_free,
> -	.map_page =		pa11_dma_map_page,
> -	.unmap_page =		pa11_dma_unmap_page,
> -	.map_sg =		pa11_dma_map_sg,
> -	.unmap_sg =		pa11_dma_unmap_sg,
> -	.sync_single_for_cpu =	pa11_dma_sync_single_for_cpu,
> -	.sync_single_for_device = pa11_dma_sync_single_for_device,
> -	.sync_sg_for_cpu =	pa11_dma_sync_sg_for_cpu,
> -	.sync_sg_for_device =	pa11_dma_sync_sg_for_device,
> -	.cache_sync =		pa11_dma_cache_sync,
> -};
> -
> -static void *pcx_dma_alloc(struct device *dev, size_t size,
> -		dma_addr_t *dma_handle, gfp_t flag, unsigned long attrs)
> +void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
> +		gfp_t gfp, unsigned long attrs)
>  {
> -	void *addr;
> -
> -	if ((attrs & DMA_ATTR_NON_CONSISTENT) == 0)
> -		return NULL;
> -
> -	addr = (void *)__get_free_pages(flag, get_order(size));
> -	if (addr)
> -		*dma_handle = (dma_addr_t)virt_to_phys(addr);
> -
> -	return addr;
> +	if (boot_cpu_data.cpu_type == pcxl2 || boot_cpu_data.cpu_type == pcxl)
> +		return pa11_dma_alloc(dev, size, dma_handle, gfp, attrs);
> +	if (attrs & DMA_ATTR_NON_CONSISTENT)
> +		return dma_direct_alloc(dev, size, dma_handle, gfp, attrs);
> +	return NULL;
>  }
>  
> -static void pcx_dma_free(struct device *dev, size_t size, void *vaddr,
> -		dma_addr_t iova, unsigned long attrs)
> +void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
> +		dma_addr_t dma_addr, unsigned long attrs)
>  {
> -	free_pages((unsigned long)vaddr, get_order(size));
> -	return;
> +	if (boot_cpu_data.cpu_type == pcxl2 || boot_cpu_data.cpu_type == pcxl)
> +		pa11_dma_free(dev, size, cpu_addr, dma_addr, attrs);
> +	else
> +		dma_direct_free(dev, size, cpu_addr, dma_addr, attrs);
>  }
> -
> -const struct dma_map_ops pcx_dma_ops = {
> -	.alloc =		pcx_dma_alloc,
> -	.free =			pcx_dma_free,
> -	.map_page =		pa11_dma_map_page,
> -	.unmap_page =		pa11_dma_unmap_page,
> -	.map_sg =		pa11_dma_map_sg,
> -	.unmap_sg =		pa11_dma_unmap_sg,
> -	.sync_single_for_cpu =	pa11_dma_sync_single_for_cpu,
> -	.sync_single_for_device = pa11_dma_sync_single_for_device,
> -	.sync_sg_for_cpu =	pa11_dma_sync_sg_for_cpu,
> -	.sync_sg_for_device =	pa11_dma_sync_sg_for_device,
> -	.cache_sync =		pa11_dma_cache_sync,
> -};
> diff --git a/arch/parisc/kernel/setup.c b/arch/parisc/kernel/setup.c
> index 8d3a7b80ac42..4e87c35c22b7 100644
> --- a/arch/parisc/kernel/setup.c
> +++ b/arch/parisc/kernel/setup.c
> @@ -97,14 +97,12 @@ void __init dma_ops_init(void)
>  		panic(	"PA-RISC Linux currently only supports machines that conform to\n"
>  			"the PA-RISC 1.1 or 2.0 architecture specification.\n");
>  
> -	case pcxs:
> -	case pcxt:
> -		hppa_dma_ops = &pcx_dma_ops;
> -		break;
>  	case pcxl2:
>  		pa7300lc_init();
>  	case pcxl: /* falls through */
> -		hppa_dma_ops = &pcxl_dma_ops;
> +	case pcxs:
> +	case pcxt:
> +		hppa_dma_ops = &dma_noncoherent_ops;
>  		break;
>  	default:
>  		break;
> diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
> index cab32ee824d2..4ad91c28ecbe 100644
> --- a/arch/parisc/mm/init.c
> +++ b/arch/parisc/mm/init.c
> @@ -19,7 +19,6 @@
>  #include <linux/gfp.h>
>  #include <linux/delay.h>
>  #include <linux/init.h>
> -#include <linux/pci.h>		/* for hppa_dma_ops and pcxl_dma_ops */
>  #include <linux/initrd.h>
>  #include <linux/swap.h>
>  #include <linux/unistd.h>
> @@ -616,17 +615,13 @@ void __init mem_init(void)
>  	free_all_bootmem();
>  
>  #ifdef CONFIG_PA11
> -	if (hppa_dma_ops == &pcxl_dma_ops) {
> +	if (boot_cpu_data.cpu_type == pcxl2 || boot_cpu_data.cpu_type == pcxl) {
>  		pcxl_dma_start = (unsigned long)SET_MAP_OFFSET(MAP_START);
>  		parisc_vmalloc_start = SET_MAP_OFFSET(pcxl_dma_start
>  						+ PCXL_DMA_MAP_SIZE);
> -	} else {
> -		pcxl_dma_start = 0;
> -		parisc_vmalloc_start = SET_MAP_OFFSET(MAP_START);
> -	}
> -#else
> -	parisc_vmalloc_start = SET_MAP_OFFSET(MAP_START);
> +	} else
>  #endif
> +		parisc_vmalloc_start = SET_MAP_OFFSET(MAP_START);
>  
>  	mem_init_print_info(NULL);
>  
> 

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* Re: [PATCH 22/22] parisc: use generic dma_noncoherent_ops
@ 2018-04-21 17:43     ` Helge Deller
  0 siblings, 0 replies; 2593+ messages in thread
From: Helge Deller @ 2018-04-21 17:43 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-kernel

On 20.04.2018 10:03, Christoph Hellwig wrote:
> Switch to the generic noncoherent direct mapping implementation.
> 
> Parisc previously had two different non-coherent dma ops implementation
> that just different in the way coherent allocations were handled or not
> handled.  The different behavior is not selected at runtime in the
> arch_dma_alloc and arch_dma_free routines.  The non-coherent allocation
> in the pcx cases now uses the dma_direct helpers that are a little more
> sophisticated and used by a lot of other architectures.
> 
> Fix sync_single_for_cpu to do skip the cache flush unless the transfer
> is to the device to match the more tested unmap_single path which should
> have the same cache coherency implications.
> 
> This also now consistenly uses flush_kernel_dcache_range for cache
> flushing while previously some of the SG based operations used
> flush_kernel_vmap_range instead.


This patch breaks a 32bit kernel on a B160L machine (PA7300LC CPU, "pcxl2").
After applying this patch series the lasi82956 network driver works unreliable. 
NIC gets IP, but ping doesn't work.
See drivers/net/ethernet/i825xx/lasi_82596.c, it uses dma*sync() functions.

Helge

 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  arch/parisc/Kconfig                   |   4 +
>  arch/parisc/include/asm/dma-mapping.h |   5 -
>  arch/parisc/kernel/pci-dma.c          | 181 ++++----------------------
>  arch/parisc/kernel/setup.c            |   8 +-
>  arch/parisc/mm/init.c                 |  11 +-
>  5 files changed, 35 insertions(+), 174 deletions(-)
> 
> diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
> index 47047f0cbe35..80166a1cbcb7 100644
> --- a/arch/parisc/Kconfig
> +++ b/arch/parisc/Kconfig
> @@ -188,6 +188,10 @@ config PA20
>  config PA11
>  	def_bool y
>  	depends on PA7000 || PA7100LC || PA7200 || PA7300LC
> +	select ARCH_HAS_SYNC_DMA_FOR_CPU
> +	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
> +	select DMA_NONCOHERENT_OPS
> +	select DMA_NONCOHERENT_CACHE_SYNC
>  
>  config PREFETCH
>  	def_bool y
> diff --git a/arch/parisc/include/asm/dma-mapping.h b/arch/parisc/include/asm/dma-mapping.h
> index 01e1fc057c83..44a9f97194aa 100644
> --- a/arch/parisc/include/asm/dma-mapping.h
> +++ b/arch/parisc/include/asm/dma-mapping.h
> @@ -21,11 +21,6 @@
>  ** flush/purge and allocate "regular" cacheable pages for everything.
>  */
>  
> -#ifdef CONFIG_PA11
> -extern const struct dma_map_ops pcxl_dma_ops;
> -extern const struct dma_map_ops pcx_dma_ops;
> -#endif
> -
>  extern const struct dma_map_ops *hppa_dma_ops;
>  
>  static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
> diff --git a/arch/parisc/kernel/pci-dma.c b/arch/parisc/kernel/pci-dma.c
> index 91bc0cac03a1..235e2e53959e 100644
> --- a/arch/parisc/kernel/pci-dma.c
> +++ b/arch/parisc/kernel/pci-dma.c
> @@ -21,13 +21,12 @@
>  #include <linux/init.h>
>  #include <linux/gfp.h>
>  #include <linux/mm.h>
> -#include <linux/pci.h>
>  #include <linux/proc_fs.h>
>  #include <linux/seq_file.h>
>  #include <linux/string.h>
>  #include <linux/types.h>
> -#include <linux/scatterlist.h>
> -#include <linux/export.h>
> +#include <linux/dma-direct.h>
> +#include <linux/dma-noncoherent.h>
>  
>  #include <asm/cacheflush.h>
>  #include <asm/dma.h>    /* for DMA_CHUNK_SIZE */
> @@ -447,178 +446,48 @@ static void pa11_dma_free(struct device *dev, size_t size, void *vaddr,
>  	free_pages((unsigned long)__va(dma_handle), order);
>  }
>  
> -static dma_addr_t pa11_dma_map_page(struct device *dev, struct page *page,
> -		unsigned long offset, size_t size,
> -		enum dma_data_direction direction, unsigned long attrs)
> +void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
> +		size_t size, enum dma_data_direction dir)
>  {
> -	void *addr = page_address(page) + offset;
> -	BUG_ON(direction == DMA_NONE);
> -
> -	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
> -		flush_kernel_dcache_range((unsigned long) addr, size);
> -
> -	return virt_to_phys(addr);
> +	flush_kernel_dcache_range((unsigned long)phys_to_virt(paddr), size);
>  }
>  
> -static void pa11_dma_unmap_page(struct device *dev, dma_addr_t dma_handle,
> -		size_t size, enum dma_data_direction direction,
> -		unsigned long attrs)
> +void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
> +		size_t size, enum dma_data_direction dir)
>  {
> -	BUG_ON(direction == DMA_NONE);
> -
> -	if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
> -		return;
> -
> -	if (direction == DMA_TO_DEVICE)
> +	if (dir == DMA_TO_DEVICE)
>  		return;
>  
>  	/*
> -	 * For PCI_DMA_FROMDEVICE this flush is not necessary for the
> +	 * For DMA_FROM_DEVICE this flush is not necessary for the
>  	 * simple map/unmap case. However, it IS necessary if if
> -	 * pci_dma_sync_single_* has been called and the buffer reused.
> +	 * dma_sync_single_* has been called and the buffer reused.
>  	 */
>  
> -	flush_kernel_dcache_range((unsigned long) phys_to_virt(dma_handle), size);
> -}
> -
> -static int pa11_dma_map_sg(struct device *dev, struct scatterlist *sglist,
> -		int nents, enum dma_data_direction direction,
> -		unsigned long attrs)
> -{
> -	int i;
> -	struct scatterlist *sg;
> -
> -	BUG_ON(direction == DMA_NONE);
> -
> -	for_each_sg(sglist, sg, nents, i) {
> -		unsigned long vaddr = (unsigned long)sg_virt(sg);
> -
> -		sg_dma_address(sg) = (dma_addr_t) virt_to_phys(vaddr);
> -		sg_dma_len(sg) = sg->length;
> -
> -		if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
> -			continue;
> -
> -		flush_kernel_dcache_range(vaddr, sg->length);
> -	}
> -	return nents;
> +	flush_kernel_dcache_range((unsigned long)phys_to_virt(paddr), size);
>  }
>  
> -static void pa11_dma_unmap_sg(struct device *dev, struct scatterlist *sglist,
> -		int nents, enum dma_data_direction direction,
> -		unsigned long attrs)
> -{
> -	int i;
> -	struct scatterlist *sg;
> -
> -	BUG_ON(direction == DMA_NONE);
> -
> -	if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
> -		return;
> -
> -	if (direction == DMA_TO_DEVICE)
> -		return;
> -
> -	/* once we do combining we'll need to use phys_to_virt(sg_dma_address(sglist)) */
> -
> -	for_each_sg(sglist, sg, nents, i)
> -		flush_kernel_vmap_range(sg_virt(sg), sg->length);
> -}
> -
> -static void pa11_dma_sync_single_for_cpu(struct device *dev,
> -		dma_addr_t dma_handle, size_t size,
> -		enum dma_data_direction direction)
> -{
> -	BUG_ON(direction == DMA_NONE);
> -
> -	flush_kernel_dcache_range((unsigned long) phys_to_virt(dma_handle),
> -			size);
> -}
> -
> -static void pa11_dma_sync_single_for_device(struct device *dev,
> -		dma_addr_t dma_handle, size_t size,
> -		enum dma_data_direction direction)
> -{
> -	BUG_ON(direction == DMA_NONE);
> -
> -	flush_kernel_dcache_range((unsigned long) phys_to_virt(dma_handle),
> -			size);
> -}
> -
> -static void pa11_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sglist, int nents, enum dma_data_direction direction)
> -{
> -	int i;
> -	struct scatterlist *sg;
> -
> -	/* once we do combining we'll need to use phys_to_virt(sg_dma_address(sglist)) */
> -
> -	for_each_sg(sglist, sg, nents, i)
> -		flush_kernel_vmap_range(sg_virt(sg), sg->length);
> -}
> -
> -static void pa11_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sglist, int nents, enum dma_data_direction direction)
> -{
> -	int i;
> -	struct scatterlist *sg;
> -
> -	/* once we do combining we'll need to use phys_to_virt(sg_dma_address(sglist)) */
> -
> -	for_each_sg(sglist, sg, nents, i)
> -		flush_kernel_vmap_range(sg_virt(sg), sg->length);
> -}
> -
> -static void pa11_dma_cache_sync(struct device *dev, void *vaddr, size_t size,
> +void arch_dma_cache_sync(struct device *dev, void *vaddr, size_t size,
>  	       enum dma_data_direction direction)
>  {
>  	flush_kernel_dcache_range((unsigned long)vaddr, size);
>  }
>  
> -const struct dma_map_ops pcxl_dma_ops = {
> -	.alloc =		pa11_dma_alloc,
> -	.free =			pa11_dma_free,
> -	.map_page =		pa11_dma_map_page,
> -	.unmap_page =		pa11_dma_unmap_page,
> -	.map_sg =		pa11_dma_map_sg,
> -	.unmap_sg =		pa11_dma_unmap_sg,
> -	.sync_single_for_cpu =	pa11_dma_sync_single_for_cpu,
> -	.sync_single_for_device = pa11_dma_sync_single_for_device,
> -	.sync_sg_for_cpu =	pa11_dma_sync_sg_for_cpu,
> -	.sync_sg_for_device =	pa11_dma_sync_sg_for_device,
> -	.cache_sync =		pa11_dma_cache_sync,
> -};
> -
> -static void *pcx_dma_alloc(struct device *dev, size_t size,
> -		dma_addr_t *dma_handle, gfp_t flag, unsigned long attrs)
> +void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
> +		gfp_t gfp, unsigned long attrs)
>  {
> -	void *addr;
> -
> -	if ((attrs & DMA_ATTR_NON_CONSISTENT) == 0)
> -		return NULL;
> -
> -	addr = (void *)__get_free_pages(flag, get_order(size));
> -	if (addr)
> -		*dma_handle = (dma_addr_t)virt_to_phys(addr);
> -
> -	return addr;
> +	if (boot_cpu_data.cpu_type == pcxl2 || boot_cpu_data.cpu_type == pcxl)
> +		return pa11_dma_alloc(dev, size, dma_handle, gfp, attrs);
> +	if (attrs & DMA_ATTR_NON_CONSISTENT)
> +		return dma_direct_alloc(dev, size, dma_handle, gfp, attrs);
> +	return NULL;
>  }
>  
> -static void pcx_dma_free(struct device *dev, size_t size, void *vaddr,
> -		dma_addr_t iova, unsigned long attrs)
> +void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
> +		dma_addr_t dma_addr, unsigned long attrs)
>  {
> -	free_pages((unsigned long)vaddr, get_order(size));
> -	return;
> +	if (boot_cpu_data.cpu_type == pcxl2 || boot_cpu_data.cpu_type == pcxl)
> +		pa11_dma_free(dev, size, cpu_addr, dma_addr, attrs);
> +	else
> +		dma_direct_free(dev, size, cpu_addr, dma_addr, attrs);
>  }
> -
> -const struct dma_map_ops pcx_dma_ops = {
> -	.alloc =		pcx_dma_alloc,
> -	.free =			pcx_dma_free,
> -	.map_page =		pa11_dma_map_page,
> -	.unmap_page =		pa11_dma_unmap_page,
> -	.map_sg =		pa11_dma_map_sg,
> -	.unmap_sg =		pa11_dma_unmap_sg,
> -	.sync_single_for_cpu =	pa11_dma_sync_single_for_cpu,
> -	.sync_single_for_device = pa11_dma_sync_single_for_device,
> -	.sync_sg_for_cpu =	pa11_dma_sync_sg_for_cpu,
> -	.sync_sg_for_device =	pa11_dma_sync_sg_for_device,
> -	.cache_sync =		pa11_dma_cache_sync,
> -};
> diff --git a/arch/parisc/kernel/setup.c b/arch/parisc/kernel/setup.c
> index 8d3a7b80ac42..4e87c35c22b7 100644
> --- a/arch/parisc/kernel/setup.c
> +++ b/arch/parisc/kernel/setup.c
> @@ -97,14 +97,12 @@ void __init dma_ops_init(void)
>  		panic(	"PA-RISC Linux currently only supports machines that conform to\n"
>  			"the PA-RISC 1.1 or 2.0 architecture specification.\n");
>  
> -	case pcxs:
> -	case pcxt:
> -		hppa_dma_ops = &pcx_dma_ops;
> -		break;
>  	case pcxl2:
>  		pa7300lc_init();
>  	case pcxl: /* falls through */
> -		hppa_dma_ops = &pcxl_dma_ops;
> +	case pcxs:
> +	case pcxt:
> +		hppa_dma_ops = &dma_noncoherent_ops;
>  		break;
>  	default:
>  		break;
> diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
> index cab32ee824d2..4ad91c28ecbe 100644
> --- a/arch/parisc/mm/init.c
> +++ b/arch/parisc/mm/init.c
> @@ -19,7 +19,6 @@
>  #include <linux/gfp.h>
>  #include <linux/delay.h>
>  #include <linux/init.h>
> -#include <linux/pci.h>		/* for hppa_dma_ops and pcxl_dma_ops */
>  #include <linux/initrd.h>
>  #include <linux/swap.h>
>  #include <linux/unistd.h>
> @@ -616,17 +615,13 @@ void __init mem_init(void)
>  	free_all_bootmem();
>  
>  #ifdef CONFIG_PA11
> -	if (hppa_dma_ops == &pcxl_dma_ops) {
> +	if (boot_cpu_data.cpu_type == pcxl2 || boot_cpu_data.cpu_type == pcxl) {
>  		pcxl_dma_start = (unsigned long)SET_MAP_OFFSET(MAP_START);
>  		parisc_vmalloc_start = SET_MAP_OFFSET(pcxl_dma_start
>  						+ PCXL_DMA_MAP_SIZE);
> -	} else {
> -		pcxl_dma_start = 0;
> -		parisc_vmalloc_start = SET_MAP_OFFSET(MAP_START);
> -	}
> -#else
> -	parisc_vmalloc_start = SET_MAP_OFFSET(MAP_START);
> +	} else
>  #endif
> +		parisc_vmalloc_start = SET_MAP_OFFSET(MAP_START);
>  
>  	mem_init_print_info(NULL);
>  
> 

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* [PATCH 22/22] parisc: use generic dma_noncoherent_ops
@ 2018-04-21 17:43     ` Helge Deller
  0 siblings, 0 replies; 2593+ messages in thread
From: Helge Deller @ 2018-04-21 17:43 UTC (permalink / raw)
  To: linux-snps-arc

On 20.04.2018 10:03, Christoph Hellwig wrote:
> Switch to the generic noncoherent direct mapping implementation.
> 
> Parisc previously had two different non-coherent dma ops implementation
> that just different in the way coherent allocations were handled or not
> handled.  The different behavior is not selected at runtime in the
> arch_dma_alloc and arch_dma_free routines.  The non-coherent allocation
> in the pcx cases now uses the dma_direct helpers that are a little more
> sophisticated and used by a lot of other architectures.
> 
> Fix sync_single_for_cpu to do skip the cache flush unless the transfer
> is to the device to match the more tested unmap_single path which should
> have the same cache coherency implications.
> 
> This also now consistenly uses flush_kernel_dcache_range for cache
> flushing while previously some of the SG based operations used
> flush_kernel_vmap_range instead.


This patch breaks a 32bit kernel on a B160L machine (PA7300LC CPU, "pcxl2").
After applying this patch series the lasi82956 network driver works unreliable. 
NIC gets IP, but ping doesn't work.
See drivers/net/ethernet/i825xx/lasi_82596.c, it uses dma*sync() functions.

Helge

 
> Signed-off-by: Christoph Hellwig <hch at lst.de>
> ---
>  arch/parisc/Kconfig                   |   4 +
>  arch/parisc/include/asm/dma-mapping.h |   5 -
>  arch/parisc/kernel/pci-dma.c          | 181 ++++----------------------
>  arch/parisc/kernel/setup.c            |   8 +-
>  arch/parisc/mm/init.c                 |  11 +-
>  5 files changed, 35 insertions(+), 174 deletions(-)
> 
> diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
> index 47047f0cbe35..80166a1cbcb7 100644
> --- a/arch/parisc/Kconfig
> +++ b/arch/parisc/Kconfig
> @@ -188,6 +188,10 @@ config PA20
>  config PA11
>  	def_bool y
>  	depends on PA7000 || PA7100LC || PA7200 || PA7300LC
> +	select ARCH_HAS_SYNC_DMA_FOR_CPU
> +	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
> +	select DMA_NONCOHERENT_OPS
> +	select DMA_NONCOHERENT_CACHE_SYNC
>  
>  config PREFETCH
>  	def_bool y
> diff --git a/arch/parisc/include/asm/dma-mapping.h b/arch/parisc/include/asm/dma-mapping.h
> index 01e1fc057c83..44a9f97194aa 100644
> --- a/arch/parisc/include/asm/dma-mapping.h
> +++ b/arch/parisc/include/asm/dma-mapping.h
> @@ -21,11 +21,6 @@
>  ** flush/purge and allocate "regular" cacheable pages for everything.
>  */
>  
> -#ifdef CONFIG_PA11
> -extern const struct dma_map_ops pcxl_dma_ops;
> -extern const struct dma_map_ops pcx_dma_ops;
> -#endif
> -
>  extern const struct dma_map_ops *hppa_dma_ops;
>  
>  static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
> diff --git a/arch/parisc/kernel/pci-dma.c b/arch/parisc/kernel/pci-dma.c
> index 91bc0cac03a1..235e2e53959e 100644
> --- a/arch/parisc/kernel/pci-dma.c
> +++ b/arch/parisc/kernel/pci-dma.c
> @@ -21,13 +21,12 @@
>  #include <linux/init.h>
>  #include <linux/gfp.h>
>  #include <linux/mm.h>
> -#include <linux/pci.h>
>  #include <linux/proc_fs.h>
>  #include <linux/seq_file.h>
>  #include <linux/string.h>
>  #include <linux/types.h>
> -#include <linux/scatterlist.h>
> -#include <linux/export.h>
> +#include <linux/dma-direct.h>
> +#include <linux/dma-noncoherent.h>
>  
>  #include <asm/cacheflush.h>
>  #include <asm/dma.h>    /* for DMA_CHUNK_SIZE */
> @@ -447,178 +446,48 @@ static void pa11_dma_free(struct device *dev, size_t size, void *vaddr,
>  	free_pages((unsigned long)__va(dma_handle), order);
>  }
>  
> -static dma_addr_t pa11_dma_map_page(struct device *dev, struct page *page,
> -		unsigned long offset, size_t size,
> -		enum dma_data_direction direction, unsigned long attrs)
> +void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
> +		size_t size, enum dma_data_direction dir)
>  {
> -	void *addr = page_address(page) + offset;
> -	BUG_ON(direction == DMA_NONE);
> -
> -	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
> -		flush_kernel_dcache_range((unsigned long) addr, size);
> -
> -	return virt_to_phys(addr);
> +	flush_kernel_dcache_range((unsigned long)phys_to_virt(paddr), size);
>  }
>  
> -static void pa11_dma_unmap_page(struct device *dev, dma_addr_t dma_handle,
> -		size_t size, enum dma_data_direction direction,
> -		unsigned long attrs)
> +void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
> +		size_t size, enum dma_data_direction dir)
>  {
> -	BUG_ON(direction == DMA_NONE);
> -
> -	if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
> -		return;
> -
> -	if (direction == DMA_TO_DEVICE)
> +	if (dir == DMA_TO_DEVICE)
>  		return;
>  
>  	/*
> -	 * For PCI_DMA_FROMDEVICE this flush is not necessary for the
> +	 * For DMA_FROM_DEVICE this flush is not necessary for the
>  	 * simple map/unmap case. However, it IS necessary if if
> -	 * pci_dma_sync_single_* has been called and the buffer reused.
> +	 * dma_sync_single_* has been called and the buffer reused.
>  	 */
>  
> -	flush_kernel_dcache_range((unsigned long) phys_to_virt(dma_handle), size);
> -}
> -
> -static int pa11_dma_map_sg(struct device *dev, struct scatterlist *sglist,
> -		int nents, enum dma_data_direction direction,
> -		unsigned long attrs)
> -{
> -	int i;
> -	struct scatterlist *sg;
> -
> -	BUG_ON(direction == DMA_NONE);
> -
> -	for_each_sg(sglist, sg, nents, i) {
> -		unsigned long vaddr = (unsigned long)sg_virt(sg);
> -
> -		sg_dma_address(sg) = (dma_addr_t) virt_to_phys(vaddr);
> -		sg_dma_len(sg) = sg->length;
> -
> -		if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
> -			continue;
> -
> -		flush_kernel_dcache_range(vaddr, sg->length);
> -	}
> -	return nents;
> +	flush_kernel_dcache_range((unsigned long)phys_to_virt(paddr), size);
>  }
>  
> -static void pa11_dma_unmap_sg(struct device *dev, struct scatterlist *sglist,
> -		int nents, enum dma_data_direction direction,
> -		unsigned long attrs)
> -{
> -	int i;
> -	struct scatterlist *sg;
> -
> -	BUG_ON(direction == DMA_NONE);
> -
> -	if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
> -		return;
> -
> -	if (direction == DMA_TO_DEVICE)
> -		return;
> -
> -	/* once we do combining we'll need to use phys_to_virt(sg_dma_address(sglist)) */
> -
> -	for_each_sg(sglist, sg, nents, i)
> -		flush_kernel_vmap_range(sg_virt(sg), sg->length);
> -}
> -
> -static void pa11_dma_sync_single_for_cpu(struct device *dev,
> -		dma_addr_t dma_handle, size_t size,
> -		enum dma_data_direction direction)
> -{
> -	BUG_ON(direction == DMA_NONE);
> -
> -	flush_kernel_dcache_range((unsigned long) phys_to_virt(dma_handle),
> -			size);
> -}
> -
> -static void pa11_dma_sync_single_for_device(struct device *dev,
> -		dma_addr_t dma_handle, size_t size,
> -		enum dma_data_direction direction)
> -{
> -	BUG_ON(direction == DMA_NONE);
> -
> -	flush_kernel_dcache_range((unsigned long) phys_to_virt(dma_handle),
> -			size);
> -}
> -
> -static void pa11_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sglist, int nents, enum dma_data_direction direction)
> -{
> -	int i;
> -	struct scatterlist *sg;
> -
> -	/* once we do combining we'll need to use phys_to_virt(sg_dma_address(sglist)) */
> -
> -	for_each_sg(sglist, sg, nents, i)
> -		flush_kernel_vmap_range(sg_virt(sg), sg->length);
> -}
> -
> -static void pa11_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sglist, int nents, enum dma_data_direction direction)
> -{
> -	int i;
> -	struct scatterlist *sg;
> -
> -	/* once we do combining we'll need to use phys_to_virt(sg_dma_address(sglist)) */
> -
> -	for_each_sg(sglist, sg, nents, i)
> -		flush_kernel_vmap_range(sg_virt(sg), sg->length);
> -}
> -
> -static void pa11_dma_cache_sync(struct device *dev, void *vaddr, size_t size,
> +void arch_dma_cache_sync(struct device *dev, void *vaddr, size_t size,
>  	       enum dma_data_direction direction)
>  {
>  	flush_kernel_dcache_range((unsigned long)vaddr, size);
>  }
>  
> -const struct dma_map_ops pcxl_dma_ops = {
> -	.alloc =		pa11_dma_alloc,
> -	.free =			pa11_dma_free,
> -	.map_page =		pa11_dma_map_page,
> -	.unmap_page =		pa11_dma_unmap_page,
> -	.map_sg =		pa11_dma_map_sg,
> -	.unmap_sg =		pa11_dma_unmap_sg,
> -	.sync_single_for_cpu =	pa11_dma_sync_single_for_cpu,
> -	.sync_single_for_device = pa11_dma_sync_single_for_device,
> -	.sync_sg_for_cpu =	pa11_dma_sync_sg_for_cpu,
> -	.sync_sg_for_device =	pa11_dma_sync_sg_for_device,
> -	.cache_sync =		pa11_dma_cache_sync,
> -};
> -
> -static void *pcx_dma_alloc(struct device *dev, size_t size,
> -		dma_addr_t *dma_handle, gfp_t flag, unsigned long attrs)
> +void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
> +		gfp_t gfp, unsigned long attrs)
>  {
> -	void *addr;
> -
> -	if ((attrs & DMA_ATTR_NON_CONSISTENT) == 0)
> -		return NULL;
> -
> -	addr = (void *)__get_free_pages(flag, get_order(size));
> -	if (addr)
> -		*dma_handle = (dma_addr_t)virt_to_phys(addr);
> -
> -	return addr;
> +	if (boot_cpu_data.cpu_type == pcxl2 || boot_cpu_data.cpu_type == pcxl)
> +		return pa11_dma_alloc(dev, size, dma_handle, gfp, attrs);
> +	if (attrs & DMA_ATTR_NON_CONSISTENT)
> +		return dma_direct_alloc(dev, size, dma_handle, gfp, attrs);
> +	return NULL;
>  }
>  
> -static void pcx_dma_free(struct device *dev, size_t size, void *vaddr,
> -		dma_addr_t iova, unsigned long attrs)
> +void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
> +		dma_addr_t dma_addr, unsigned long attrs)
>  {
> -	free_pages((unsigned long)vaddr, get_order(size));
> -	return;
> +	if (boot_cpu_data.cpu_type == pcxl2 || boot_cpu_data.cpu_type == pcxl)
> +		pa11_dma_free(dev, size, cpu_addr, dma_addr, attrs);
> +	else
> +		dma_direct_free(dev, size, cpu_addr, dma_addr, attrs);
>  }
> -
> -const struct dma_map_ops pcx_dma_ops = {
> -	.alloc =		pcx_dma_alloc,
> -	.free =			pcx_dma_free,
> -	.map_page =		pa11_dma_map_page,
> -	.unmap_page =		pa11_dma_unmap_page,
> -	.map_sg =		pa11_dma_map_sg,
> -	.unmap_sg =		pa11_dma_unmap_sg,
> -	.sync_single_for_cpu =	pa11_dma_sync_single_for_cpu,
> -	.sync_single_for_device = pa11_dma_sync_single_for_device,
> -	.sync_sg_for_cpu =	pa11_dma_sync_sg_for_cpu,
> -	.sync_sg_for_device =	pa11_dma_sync_sg_for_device,
> -	.cache_sync =		pa11_dma_cache_sync,
> -};
> diff --git a/arch/parisc/kernel/setup.c b/arch/parisc/kernel/setup.c
> index 8d3a7b80ac42..4e87c35c22b7 100644
> --- a/arch/parisc/kernel/setup.c
> +++ b/arch/parisc/kernel/setup.c
> @@ -97,14 +97,12 @@ void __init dma_ops_init(void)
>  		panic(	"PA-RISC Linux currently only supports machines that conform to\n"
>  			"the PA-RISC 1.1 or 2.0 architecture specification.\n");
>  
> -	case pcxs:
> -	case pcxt:
> -		hppa_dma_ops = &pcx_dma_ops;
> -		break;
>  	case pcxl2:
>  		pa7300lc_init();
>  	case pcxl: /* falls through */
> -		hppa_dma_ops = &pcxl_dma_ops;
> +	case pcxs:
> +	case pcxt:
> +		hppa_dma_ops = &dma_noncoherent_ops;
>  		break;
>  	default:
>  		break;
> diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
> index cab32ee824d2..4ad91c28ecbe 100644
> --- a/arch/parisc/mm/init.c
> +++ b/arch/parisc/mm/init.c
> @@ -19,7 +19,6 @@
>  #include <linux/gfp.h>
>  #include <linux/delay.h>
>  #include <linux/init.h>
> -#include <linux/pci.h>		/* for hppa_dma_ops and pcxl_dma_ops */
>  #include <linux/initrd.h>
>  #include <linux/swap.h>
>  #include <linux/unistd.h>
> @@ -616,17 +615,13 @@ void __init mem_init(void)
>  	free_all_bootmem();
>  
>  #ifdef CONFIG_PA11
> -	if (hppa_dma_ops == &pcxl_dma_ops) {
> +	if (boot_cpu_data.cpu_type == pcxl2 || boot_cpu_data.cpu_type == pcxl) {
>  		pcxl_dma_start = (unsigned long)SET_MAP_OFFSET(MAP_START);
>  		parisc_vmalloc_start = SET_MAP_OFFSET(pcxl_dma_start
>  						+ PCXL_DMA_MAP_SIZE);
> -	} else {
> -		pcxl_dma_start = 0;
> -		parisc_vmalloc_start = SET_MAP_OFFSET(MAP_START);
> -	}
> -#else
> -	parisc_vmalloc_start = SET_MAP_OFFSET(MAP_START);
> +	} else
>  #endif
> +		parisc_vmalloc_start = SET_MAP_OFFSET(MAP_START);
>  
>  	mem_init_print_info(NULL);
>  
> 

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* Re: [PATCH 22/22] parisc: use generic dma_noncoherent_ops
@ 2018-04-21 17:43     ` Helge Deller
  0 siblings, 0 replies; 2593+ messages in thread
From: Helge Deller @ 2018-04-21 17:43 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-arch, Michal Simek, Vincent Chen, linux-c6x-dev,
	linux-parisc, linux-sh, linux-hexagon, linux-kernel, linux-m68k,
	openrisc, Greentime Hu, linux-alpha, sparclinux, nios2-dev,
	linux-snps-arc, linux-arm-kernel

On 20.04.2018 10:03, Christoph Hellwig wrote:
> Switch to the generic noncoherent direct mapping implementation.
> 
> Parisc previously had two different non-coherent dma ops implementation
> that just different in the way coherent allocations were handled or not
> handled.  The different behavior is not selected at runtime in the
> arch_dma_alloc and arch_dma_free routines.  The non-coherent allocation
> in the pcx cases now uses the dma_direct helpers that are a little more
> sophisticated and used by a lot of other architectures.
> 
> Fix sync_single_for_cpu to do skip the cache flush unless the transfer
> is to the device to match the more tested unmap_single path which should
> have the same cache coherency implications.
> 
> This also now consistenly uses flush_kernel_dcache_range for cache
> flushing while previously some of the SG based operations used
> flush_kernel_vmap_range instead.


This patch breaks a 32bit kernel on a B160L machine (PA7300LC CPU, "pcxl2").
After applying this patch series the lasi82956 network driver works unreliable. 
NIC gets IP, but ping doesn't work.
See drivers/net/ethernet/i825xx/lasi_82596.c, it uses dma*sync() functions.

Helge

 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  arch/parisc/Kconfig                   |   4 +
>  arch/parisc/include/asm/dma-mapping.h |   5 -
>  arch/parisc/kernel/pci-dma.c          | 181 ++++----------------------
>  arch/parisc/kernel/setup.c            |   8 +-
>  arch/parisc/mm/init.c                 |  11 +-
>  5 files changed, 35 insertions(+), 174 deletions(-)
> 
> diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
> index 47047f0cbe35..80166a1cbcb7 100644
> --- a/arch/parisc/Kconfig
> +++ b/arch/parisc/Kconfig
> @@ -188,6 +188,10 @@ config PA20
>  config PA11
>  	def_bool y
>  	depends on PA7000 || PA7100LC || PA7200 || PA7300LC
> +	select ARCH_HAS_SYNC_DMA_FOR_CPU
> +	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
> +	select DMA_NONCOHERENT_OPS
> +	select DMA_NONCOHERENT_CACHE_SYNC
>  
>  config PREFETCH
>  	def_bool y
> diff --git a/arch/parisc/include/asm/dma-mapping.h b/arch/parisc/include/asm/dma-mapping.h
> index 01e1fc057c83..44a9f97194aa 100644
> --- a/arch/parisc/include/asm/dma-mapping.h
> +++ b/arch/parisc/include/asm/dma-mapping.h
> @@ -21,11 +21,6 @@
>  ** flush/purge and allocate "regular" cacheable pages for everything.
>  */
>  
> -#ifdef CONFIG_PA11
> -extern const struct dma_map_ops pcxl_dma_ops;
> -extern const struct dma_map_ops pcx_dma_ops;
> -#endif
> -
>  extern const struct dma_map_ops *hppa_dma_ops;
>  
>  static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
> diff --git a/arch/parisc/kernel/pci-dma.c b/arch/parisc/kernel/pci-dma.c
> index 91bc0cac03a1..235e2e53959e 100644
> --- a/arch/parisc/kernel/pci-dma.c
> +++ b/arch/parisc/kernel/pci-dma.c
> @@ -21,13 +21,12 @@
>  #include <linux/init.h>
>  #include <linux/gfp.h>
>  #include <linux/mm.h>
> -#include <linux/pci.h>
>  #include <linux/proc_fs.h>
>  #include <linux/seq_file.h>
>  #include <linux/string.h>
>  #include <linux/types.h>
> -#include <linux/scatterlist.h>
> -#include <linux/export.h>
> +#include <linux/dma-direct.h>
> +#include <linux/dma-noncoherent.h>
>  
>  #include <asm/cacheflush.h>
>  #include <asm/dma.h>    /* for DMA_CHUNK_SIZE */
> @@ -447,178 +446,48 @@ static void pa11_dma_free(struct device *dev, size_t size, void *vaddr,
>  	free_pages((unsigned long)__va(dma_handle), order);
>  }
>  
> -static dma_addr_t pa11_dma_map_page(struct device *dev, struct page *page,
> -		unsigned long offset, size_t size,
> -		enum dma_data_direction direction, unsigned long attrs)
> +void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
> +		size_t size, enum dma_data_direction dir)
>  {
> -	void *addr = page_address(page) + offset;
> -	BUG_ON(direction = DMA_NONE);
> -
> -	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
> -		flush_kernel_dcache_range((unsigned long) addr, size);
> -
> -	return virt_to_phys(addr);
> +	flush_kernel_dcache_range((unsigned long)phys_to_virt(paddr), size);
>  }
>  
> -static void pa11_dma_unmap_page(struct device *dev, dma_addr_t dma_handle,
> -		size_t size, enum dma_data_direction direction,
> -		unsigned long attrs)
> +void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
> +		size_t size, enum dma_data_direction dir)
>  {
> -	BUG_ON(direction = DMA_NONE);
> -
> -	if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
> -		return;
> -
> -	if (direction = DMA_TO_DEVICE)
> +	if (dir = DMA_TO_DEVICE)
>  		return;
>  
>  	/*
> -	 * For PCI_DMA_FROMDEVICE this flush is not necessary for the
> +	 * For DMA_FROM_DEVICE this flush is not necessary for the
>  	 * simple map/unmap case. However, it IS necessary if if
> -	 * pci_dma_sync_single_* has been called and the buffer reused.
> +	 * dma_sync_single_* has been called and the buffer reused.
>  	 */
>  
> -	flush_kernel_dcache_range((unsigned long) phys_to_virt(dma_handle), size);
> -}
> -
> -static int pa11_dma_map_sg(struct device *dev, struct scatterlist *sglist,
> -		int nents, enum dma_data_direction direction,
> -		unsigned long attrs)
> -{
> -	int i;
> -	struct scatterlist *sg;
> -
> -	BUG_ON(direction = DMA_NONE);
> -
> -	for_each_sg(sglist, sg, nents, i) {
> -		unsigned long vaddr = (unsigned long)sg_virt(sg);
> -
> -		sg_dma_address(sg) = (dma_addr_t) virt_to_phys(vaddr);
> -		sg_dma_len(sg) = sg->length;
> -
> -		if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
> -			continue;
> -
> -		flush_kernel_dcache_range(vaddr, sg->length);
> -	}
> -	return nents;
> +	flush_kernel_dcache_range((unsigned long)phys_to_virt(paddr), size);
>  }
>  
> -static void pa11_dma_unmap_sg(struct device *dev, struct scatterlist *sglist,
> -		int nents, enum dma_data_direction direction,
> -		unsigned long attrs)
> -{
> -	int i;
> -	struct scatterlist *sg;
> -
> -	BUG_ON(direction = DMA_NONE);
> -
> -	if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
> -		return;
> -
> -	if (direction = DMA_TO_DEVICE)
> -		return;
> -
> -	/* once we do combining we'll need to use phys_to_virt(sg_dma_address(sglist)) */
> -
> -	for_each_sg(sglist, sg, nents, i)
> -		flush_kernel_vmap_range(sg_virt(sg), sg->length);
> -}
> -
> -static void pa11_dma_sync_single_for_cpu(struct device *dev,
> -		dma_addr_t dma_handle, size_t size,
> -		enum dma_data_direction direction)
> -{
> -	BUG_ON(direction = DMA_NONE);
> -
> -	flush_kernel_dcache_range((unsigned long) phys_to_virt(dma_handle),
> -			size);
> -}
> -
> -static void pa11_dma_sync_single_for_device(struct device *dev,
> -		dma_addr_t dma_handle, size_t size,
> -		enum dma_data_direction direction)
> -{
> -	BUG_ON(direction = DMA_NONE);
> -
> -	flush_kernel_dcache_range((unsigned long) phys_to_virt(dma_handle),
> -			size);
> -}
> -
> -static void pa11_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sglist, int nents, enum dma_data_direction direction)
> -{
> -	int i;
> -	struct scatterlist *sg;
> -
> -	/* once we do combining we'll need to use phys_to_virt(sg_dma_address(sglist)) */
> -
> -	for_each_sg(sglist, sg, nents, i)
> -		flush_kernel_vmap_range(sg_virt(sg), sg->length);
> -}
> -
> -static void pa11_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sglist, int nents, enum dma_data_direction direction)
> -{
> -	int i;
> -	struct scatterlist *sg;
> -
> -	/* once we do combining we'll need to use phys_to_virt(sg_dma_address(sglist)) */
> -
> -	for_each_sg(sglist, sg, nents, i)
> -		flush_kernel_vmap_range(sg_virt(sg), sg->length);
> -}
> -
> -static void pa11_dma_cache_sync(struct device *dev, void *vaddr, size_t size,
> +void arch_dma_cache_sync(struct device *dev, void *vaddr, size_t size,
>  	       enum dma_data_direction direction)
>  {
>  	flush_kernel_dcache_range((unsigned long)vaddr, size);
>  }
>  
> -const struct dma_map_ops pcxl_dma_ops = {
> -	.alloc =		pa11_dma_alloc,
> -	.free =			pa11_dma_free,
> -	.map_page =		pa11_dma_map_page,
> -	.unmap_page =		pa11_dma_unmap_page,
> -	.map_sg =		pa11_dma_map_sg,
> -	.unmap_sg =		pa11_dma_unmap_sg,
> -	.sync_single_for_cpu =	pa11_dma_sync_single_for_cpu,
> -	.sync_single_for_device = pa11_dma_sync_single_for_device,
> -	.sync_sg_for_cpu =	pa11_dma_sync_sg_for_cpu,
> -	.sync_sg_for_device =	pa11_dma_sync_sg_for_device,
> -	.cache_sync =		pa11_dma_cache_sync,
> -};
> -
> -static void *pcx_dma_alloc(struct device *dev, size_t size,
> -		dma_addr_t *dma_handle, gfp_t flag, unsigned long attrs)
> +void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
> +		gfp_t gfp, unsigned long attrs)
>  {
> -	void *addr;
> -
> -	if ((attrs & DMA_ATTR_NON_CONSISTENT) = 0)
> -		return NULL;
> -
> -	addr = (void *)__get_free_pages(flag, get_order(size));
> -	if (addr)
> -		*dma_handle = (dma_addr_t)virt_to_phys(addr);
> -
> -	return addr;
> +	if (boot_cpu_data.cpu_type = pcxl2 || boot_cpu_data.cpu_type = pcxl)
> +		return pa11_dma_alloc(dev, size, dma_handle, gfp, attrs);
> +	if (attrs & DMA_ATTR_NON_CONSISTENT)
> +		return dma_direct_alloc(dev, size, dma_handle, gfp, attrs);
> +	return NULL;
>  }
>  
> -static void pcx_dma_free(struct device *dev, size_t size, void *vaddr,
> -		dma_addr_t iova, unsigned long attrs)
> +void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
> +		dma_addr_t dma_addr, unsigned long attrs)
>  {
> -	free_pages((unsigned long)vaddr, get_order(size));
> -	return;
> +	if (boot_cpu_data.cpu_type = pcxl2 || boot_cpu_data.cpu_type = pcxl)
> +		pa11_dma_free(dev, size, cpu_addr, dma_addr, attrs);
> +	else
> +		dma_direct_free(dev, size, cpu_addr, dma_addr, attrs);
>  }
> -
> -const struct dma_map_ops pcx_dma_ops = {
> -	.alloc =		pcx_dma_alloc,
> -	.free =			pcx_dma_free,
> -	.map_page =		pa11_dma_map_page,
> -	.unmap_page =		pa11_dma_unmap_page,
> -	.map_sg =		pa11_dma_map_sg,
> -	.unmap_sg =		pa11_dma_unmap_sg,
> -	.sync_single_for_cpu =	pa11_dma_sync_single_for_cpu,
> -	.sync_single_for_device = pa11_dma_sync_single_for_device,
> -	.sync_sg_for_cpu =	pa11_dma_sync_sg_for_cpu,
> -	.sync_sg_for_device =	pa11_dma_sync_sg_for_device,
> -	.cache_sync =		pa11_dma_cache_sync,
> -};
> diff --git a/arch/parisc/kernel/setup.c b/arch/parisc/kernel/setup.c
> index 8d3a7b80ac42..4e87c35c22b7 100644
> --- a/arch/parisc/kernel/setup.c
> +++ b/arch/parisc/kernel/setup.c
> @@ -97,14 +97,12 @@ void __init dma_ops_init(void)
>  		panic(	"PA-RISC Linux currently only supports machines that conform to\n"
>  			"the PA-RISC 1.1 or 2.0 architecture specification.\n");
>  
> -	case pcxs:
> -	case pcxt:
> -		hppa_dma_ops = &pcx_dma_ops;
> -		break;
>  	case pcxl2:
>  		pa7300lc_init();
>  	case pcxl: /* falls through */
> -		hppa_dma_ops = &pcxl_dma_ops;
> +	case pcxs:
> +	case pcxt:
> +		hppa_dma_ops = &dma_noncoherent_ops;
>  		break;
>  	default:
>  		break;
> diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
> index cab32ee824d2..4ad91c28ecbe 100644
> --- a/arch/parisc/mm/init.c
> +++ b/arch/parisc/mm/init.c
> @@ -19,7 +19,6 @@
>  #include <linux/gfp.h>
>  #include <linux/delay.h>
>  #include <linux/init.h>
> -#include <linux/pci.h>		/* for hppa_dma_ops and pcxl_dma_ops */
>  #include <linux/initrd.h>
>  #include <linux/swap.h>
>  #include <linux/unistd.h>
> @@ -616,17 +615,13 @@ void __init mem_init(void)
>  	free_all_bootmem();
>  
>  #ifdef CONFIG_PA11
> -	if (hppa_dma_ops = &pcxl_dma_ops) {
> +	if (boot_cpu_data.cpu_type = pcxl2 || boot_cpu_data.cpu_type = pcxl) {
>  		pcxl_dma_start = (unsigned long)SET_MAP_OFFSET(MAP_START);
>  		parisc_vmalloc_start = SET_MAP_OFFSET(pcxl_dma_start
>  						+ PCXL_DMA_MAP_SIZE);
> -	} else {
> -		pcxl_dma_start = 0;
> -		parisc_vmalloc_start = SET_MAP_OFFSET(MAP_START);
> -	}
> -#else
> -	parisc_vmalloc_start = SET_MAP_OFFSET(MAP_START);
> +	} else
>  #endif
> +		parisc_vmalloc_start = SET_MAP_OFFSET(MAP_START);
>  
>  	mem_init_print_info(NULL);
>  
> 


^ permalink raw reply	[flat|nested] 2593+ messages in thread

* [OpenRISC] [PATCH 22/22] parisc: use generic dma_noncoherent_ops
@ 2018-04-21 17:43     ` Helge Deller
  0 siblings, 0 replies; 2593+ messages in thread
From: Helge Deller @ 2018-04-21 17:43 UTC (permalink / raw)
  To: openrisc

On 20.04.2018 10:03, Christoph Hellwig wrote:
> Switch to the generic noncoherent direct mapping implementation.
> 
> Parisc previously had two different non-coherent dma ops implementation
> that just different in the way coherent allocations were handled or not
> handled.  The different behavior is not selected at runtime in the
> arch_dma_alloc and arch_dma_free routines.  The non-coherent allocation
> in the pcx cases now uses the dma_direct helpers that are a little more
> sophisticated and used by a lot of other architectures.
> 
> Fix sync_single_for_cpu to do skip the cache flush unless the transfer
> is to the device to match the more tested unmap_single path which should
> have the same cache coherency implications.
> 
> This also now consistenly uses flush_kernel_dcache_range for cache
> flushing while previously some of the SG based operations used
> flush_kernel_vmap_range instead.


This patch breaks a 32bit kernel on a B160L machine (PA7300LC CPU, "pcxl2").
After applying this patch series the lasi82956 network driver works unreliable. 
NIC gets IP, but ping doesn't work.
See drivers/net/ethernet/i825xx/lasi_82596.c, it uses dma*sync() functions.

Helge

 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  arch/parisc/Kconfig                   |   4 +
>  arch/parisc/include/asm/dma-mapping.h |   5 -
>  arch/parisc/kernel/pci-dma.c          | 181 ++++----------------------
>  arch/parisc/kernel/setup.c            |   8 +-
>  arch/parisc/mm/init.c                 |  11 +-
>  5 files changed, 35 insertions(+), 174 deletions(-)
> 
> diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
> index 47047f0cbe35..80166a1cbcb7 100644
> --- a/arch/parisc/Kconfig
> +++ b/arch/parisc/Kconfig
> @@ -188,6 +188,10 @@ config PA20
>  config PA11
>  	def_bool y
>  	depends on PA7000 || PA7100LC || PA7200 || PA7300LC
> +	select ARCH_HAS_SYNC_DMA_FOR_CPU
> +	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
> +	select DMA_NONCOHERENT_OPS
> +	select DMA_NONCOHERENT_CACHE_SYNC
>  
>  config PREFETCH
>  	def_bool y
> diff --git a/arch/parisc/include/asm/dma-mapping.h b/arch/parisc/include/asm/dma-mapping.h
> index 01e1fc057c83..44a9f97194aa 100644
> --- a/arch/parisc/include/asm/dma-mapping.h
> +++ b/arch/parisc/include/asm/dma-mapping.h
> @@ -21,11 +21,6 @@
>  ** flush/purge and allocate "regular" cacheable pages for everything.
>  */
>  
> -#ifdef CONFIG_PA11
> -extern const struct dma_map_ops pcxl_dma_ops;
> -extern const struct dma_map_ops pcx_dma_ops;
> -#endif
> -
>  extern const struct dma_map_ops *hppa_dma_ops;
>  
>  static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
> diff --git a/arch/parisc/kernel/pci-dma.c b/arch/parisc/kernel/pci-dma.c
> index 91bc0cac03a1..235e2e53959e 100644
> --- a/arch/parisc/kernel/pci-dma.c
> +++ b/arch/parisc/kernel/pci-dma.c
> @@ -21,13 +21,12 @@
>  #include <linux/init.h>
>  #include <linux/gfp.h>
>  #include <linux/mm.h>
> -#include <linux/pci.h>
>  #include <linux/proc_fs.h>
>  #include <linux/seq_file.h>
>  #include <linux/string.h>
>  #include <linux/types.h>
> -#include <linux/scatterlist.h>
> -#include <linux/export.h>
> +#include <linux/dma-direct.h>
> +#include <linux/dma-noncoherent.h>
>  
>  #include <asm/cacheflush.h>
>  #include <asm/dma.h>    /* for DMA_CHUNK_SIZE */
> @@ -447,178 +446,48 @@ static void pa11_dma_free(struct device *dev, size_t size, void *vaddr,
>  	free_pages((unsigned long)__va(dma_handle), order);
>  }
>  
> -static dma_addr_t pa11_dma_map_page(struct device *dev, struct page *page,
> -		unsigned long offset, size_t size,
> -		enum dma_data_direction direction, unsigned long attrs)
> +void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
> +		size_t size, enum dma_data_direction dir)
>  {
> -	void *addr = page_address(page) + offset;
> -	BUG_ON(direction == DMA_NONE);
> -
> -	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
> -		flush_kernel_dcache_range((unsigned long) addr, size);
> -
> -	return virt_to_phys(addr);
> +	flush_kernel_dcache_range((unsigned long)phys_to_virt(paddr), size);
>  }
>  
> -static void pa11_dma_unmap_page(struct device *dev, dma_addr_t dma_handle,
> -		size_t size, enum dma_data_direction direction,
> -		unsigned long attrs)
> +void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
> +		size_t size, enum dma_data_direction dir)
>  {
> -	BUG_ON(direction == DMA_NONE);
> -
> -	if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
> -		return;
> -
> -	if (direction == DMA_TO_DEVICE)
> +	if (dir == DMA_TO_DEVICE)
>  		return;
>  
>  	/*
> -	 * For PCI_DMA_FROMDEVICE this flush is not necessary for the
> +	 * For DMA_FROM_DEVICE this flush is not necessary for the
>  	 * simple map/unmap case. However, it IS necessary if if
> -	 * pci_dma_sync_single_* has been called and the buffer reused.
> +	 * dma_sync_single_* has been called and the buffer reused.
>  	 */
>  
> -	flush_kernel_dcache_range((unsigned long) phys_to_virt(dma_handle), size);
> -}
> -
> -static int pa11_dma_map_sg(struct device *dev, struct scatterlist *sglist,
> -		int nents, enum dma_data_direction direction,
> -		unsigned long attrs)
> -{
> -	int i;
> -	struct scatterlist *sg;
> -
> -	BUG_ON(direction == DMA_NONE);
> -
> -	for_each_sg(sglist, sg, nents, i) {
> -		unsigned long vaddr = (unsigned long)sg_virt(sg);
> -
> -		sg_dma_address(sg) = (dma_addr_t) virt_to_phys(vaddr);
> -		sg_dma_len(sg) = sg->length;
> -
> -		if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
> -			continue;
> -
> -		flush_kernel_dcache_range(vaddr, sg->length);
> -	}
> -	return nents;
> +	flush_kernel_dcache_range((unsigned long)phys_to_virt(paddr), size);
>  }
>  
> -static void pa11_dma_unmap_sg(struct device *dev, struct scatterlist *sglist,
> -		int nents, enum dma_data_direction direction,
> -		unsigned long attrs)
> -{
> -	int i;
> -	struct scatterlist *sg;
> -
> -	BUG_ON(direction == DMA_NONE);
> -
> -	if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
> -		return;
> -
> -	if (direction == DMA_TO_DEVICE)
> -		return;
> -
> -	/* once we do combining we'll need to use phys_to_virt(sg_dma_address(sglist)) */
> -
> -	for_each_sg(sglist, sg, nents, i)
> -		flush_kernel_vmap_range(sg_virt(sg), sg->length);
> -}
> -
> -static void pa11_dma_sync_single_for_cpu(struct device *dev,
> -		dma_addr_t dma_handle, size_t size,
> -		enum dma_data_direction direction)
> -{
> -	BUG_ON(direction == DMA_NONE);
> -
> -	flush_kernel_dcache_range((unsigned long) phys_to_virt(dma_handle),
> -			size);
> -}
> -
> -static void pa11_dma_sync_single_for_device(struct device *dev,
> -		dma_addr_t dma_handle, size_t size,
> -		enum dma_data_direction direction)
> -{
> -	BUG_ON(direction == DMA_NONE);
> -
> -	flush_kernel_dcache_range((unsigned long) phys_to_virt(dma_handle),
> -			size);
> -}
> -
> -static void pa11_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sglist, int nents, enum dma_data_direction direction)
> -{
> -	int i;
> -	struct scatterlist *sg;
> -
> -	/* once we do combining we'll need to use phys_to_virt(sg_dma_address(sglist)) */
> -
> -	for_each_sg(sglist, sg, nents, i)
> -		flush_kernel_vmap_range(sg_virt(sg), sg->length);
> -}
> -
> -static void pa11_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sglist, int nents, enum dma_data_direction direction)
> -{
> -	int i;
> -	struct scatterlist *sg;
> -
> -	/* once we do combining we'll need to use phys_to_virt(sg_dma_address(sglist)) */
> -
> -	for_each_sg(sglist, sg, nents, i)
> -		flush_kernel_vmap_range(sg_virt(sg), sg->length);
> -}
> -
> -static void pa11_dma_cache_sync(struct device *dev, void *vaddr, size_t size,
> +void arch_dma_cache_sync(struct device *dev, void *vaddr, size_t size,
>  	       enum dma_data_direction direction)
>  {
>  	flush_kernel_dcache_range((unsigned long)vaddr, size);
>  }
>  
> -const struct dma_map_ops pcxl_dma_ops = {
> -	.alloc =		pa11_dma_alloc,
> -	.free =			pa11_dma_free,
> -	.map_page =		pa11_dma_map_page,
> -	.unmap_page =		pa11_dma_unmap_page,
> -	.map_sg =		pa11_dma_map_sg,
> -	.unmap_sg =		pa11_dma_unmap_sg,
> -	.sync_single_for_cpu =	pa11_dma_sync_single_for_cpu,
> -	.sync_single_for_device = pa11_dma_sync_single_for_device,
> -	.sync_sg_for_cpu =	pa11_dma_sync_sg_for_cpu,
> -	.sync_sg_for_device =	pa11_dma_sync_sg_for_device,
> -	.cache_sync =		pa11_dma_cache_sync,
> -};
> -
> -static void *pcx_dma_alloc(struct device *dev, size_t size,
> -		dma_addr_t *dma_handle, gfp_t flag, unsigned long attrs)
> +void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
> +		gfp_t gfp, unsigned long attrs)
>  {
> -	void *addr;
> -
> -	if ((attrs & DMA_ATTR_NON_CONSISTENT) == 0)
> -		return NULL;
> -
> -	addr = (void *)__get_free_pages(flag, get_order(size));
> -	if (addr)
> -		*dma_handle = (dma_addr_t)virt_to_phys(addr);
> -
> -	return addr;
> +	if (boot_cpu_data.cpu_type == pcxl2 || boot_cpu_data.cpu_type == pcxl)
> +		return pa11_dma_alloc(dev, size, dma_handle, gfp, attrs);
> +	if (attrs & DMA_ATTR_NON_CONSISTENT)
> +		return dma_direct_alloc(dev, size, dma_handle, gfp, attrs);
> +	return NULL;
>  }
>  
> -static void pcx_dma_free(struct device *dev, size_t size, void *vaddr,
> -		dma_addr_t iova, unsigned long attrs)
> +void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
> +		dma_addr_t dma_addr, unsigned long attrs)
>  {
> -	free_pages((unsigned long)vaddr, get_order(size));
> -	return;
> +	if (boot_cpu_data.cpu_type == pcxl2 || boot_cpu_data.cpu_type == pcxl)
> +		pa11_dma_free(dev, size, cpu_addr, dma_addr, attrs);
> +	else
> +		dma_direct_free(dev, size, cpu_addr, dma_addr, attrs);
>  }
> -
> -const struct dma_map_ops pcx_dma_ops = {
> -	.alloc =		pcx_dma_alloc,
> -	.free =			pcx_dma_free,
> -	.map_page =		pa11_dma_map_page,
> -	.unmap_page =		pa11_dma_unmap_page,
> -	.map_sg =		pa11_dma_map_sg,
> -	.unmap_sg =		pa11_dma_unmap_sg,
> -	.sync_single_for_cpu =	pa11_dma_sync_single_for_cpu,
> -	.sync_single_for_device = pa11_dma_sync_single_for_device,
> -	.sync_sg_for_cpu =	pa11_dma_sync_sg_for_cpu,
> -	.sync_sg_for_device =	pa11_dma_sync_sg_for_device,
> -	.cache_sync =		pa11_dma_cache_sync,
> -};
> diff --git a/arch/parisc/kernel/setup.c b/arch/parisc/kernel/setup.c
> index 8d3a7b80ac42..4e87c35c22b7 100644
> --- a/arch/parisc/kernel/setup.c
> +++ b/arch/parisc/kernel/setup.c
> @@ -97,14 +97,12 @@ void __init dma_ops_init(void)
>  		panic(	"PA-RISC Linux currently only supports machines that conform to\n"
>  			"the PA-RISC 1.1 or 2.0 architecture specification.\n");
>  
> -	case pcxs:
> -	case pcxt:
> -		hppa_dma_ops = &pcx_dma_ops;
> -		break;
>  	case pcxl2:
>  		pa7300lc_init();
>  	case pcxl: /* falls through */
> -		hppa_dma_ops = &pcxl_dma_ops;
> +	case pcxs:
> +	case pcxt:
> +		hppa_dma_ops = &dma_noncoherent_ops;
>  		break;
>  	default:
>  		break;
> diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
> index cab32ee824d2..4ad91c28ecbe 100644
> --- a/arch/parisc/mm/init.c
> +++ b/arch/parisc/mm/init.c
> @@ -19,7 +19,6 @@
>  #include <linux/gfp.h>
>  #include <linux/delay.h>
>  #include <linux/init.h>
> -#include <linux/pci.h>		/* for hppa_dma_ops and pcxl_dma_ops */
>  #include <linux/initrd.h>
>  #include <linux/swap.h>
>  #include <linux/unistd.h>
> @@ -616,17 +615,13 @@ void __init mem_init(void)
>  	free_all_bootmem();
>  
>  #ifdef CONFIG_PA11
> -	if (hppa_dma_ops == &pcxl_dma_ops) {
> +	if (boot_cpu_data.cpu_type == pcxl2 || boot_cpu_data.cpu_type == pcxl) {
>  		pcxl_dma_start = (unsigned long)SET_MAP_OFFSET(MAP_START);
>  		parisc_vmalloc_start = SET_MAP_OFFSET(pcxl_dma_start
>  						+ PCXL_DMA_MAP_SIZE);
> -	} else {
> -		pcxl_dma_start = 0;
> -		parisc_vmalloc_start = SET_MAP_OFFSET(MAP_START);
> -	}
> -#else
> -	parisc_vmalloc_start = SET_MAP_OFFSET(MAP_START);
> +	} else
>  #endif
> +		parisc_vmalloc_start = SET_MAP_OFFSET(MAP_START);
>  
>  	mem_init_print_info(NULL);
>  
> 


^ permalink raw reply	[flat|nested] 2593+ messages in thread

* [PATCH 22/22] parisc: use generic dma_noncoherent_ops
@ 2018-04-21 17:43     ` Helge Deller
  0 siblings, 0 replies; 2593+ messages in thread
From: Helge Deller @ 2018-04-21 17:43 UTC (permalink / raw)
  To: linux-arm-kernel

On 20.04.2018 10:03, Christoph Hellwig wrote:
> Switch to the generic noncoherent direct mapping implementation.
> 
> Parisc previously had two different non-coherent dma ops implementation
> that just different in the way coherent allocations were handled or not
> handled.  The different behavior is not selected at runtime in the
> arch_dma_alloc and arch_dma_free routines.  The non-coherent allocation
> in the pcx cases now uses the dma_direct helpers that are a little more
> sophisticated and used by a lot of other architectures.
> 
> Fix sync_single_for_cpu to do skip the cache flush unless the transfer
> is to the device to match the more tested unmap_single path which should
> have the same cache coherency implications.
> 
> This also now consistenly uses flush_kernel_dcache_range for cache
> flushing while previously some of the SG based operations used
> flush_kernel_vmap_range instead.


This patch breaks a 32bit kernel on a B160L machine (PA7300LC CPU, "pcxl2").
After applying this patch series the lasi82956 network driver works unreliable. 
NIC gets IP, but ping doesn't work.
See drivers/net/ethernet/i825xx/lasi_82596.c, it uses dma*sync() functions.

Helge

 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  arch/parisc/Kconfig                   |   4 +
>  arch/parisc/include/asm/dma-mapping.h |   5 -
>  arch/parisc/kernel/pci-dma.c          | 181 ++++----------------------
>  arch/parisc/kernel/setup.c            |   8 +-
>  arch/parisc/mm/init.c                 |  11 +-
>  5 files changed, 35 insertions(+), 174 deletions(-)
> 
> diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
> index 47047f0cbe35..80166a1cbcb7 100644
> --- a/arch/parisc/Kconfig
> +++ b/arch/parisc/Kconfig
> @@ -188,6 +188,10 @@ config PA20
>  config PA11
>  	def_bool y
>  	depends on PA7000 || PA7100LC || PA7200 || PA7300LC
> +	select ARCH_HAS_SYNC_DMA_FOR_CPU
> +	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
> +	select DMA_NONCOHERENT_OPS
> +	select DMA_NONCOHERENT_CACHE_SYNC
>  
>  config PREFETCH
>  	def_bool y
> diff --git a/arch/parisc/include/asm/dma-mapping.h b/arch/parisc/include/asm/dma-mapping.h
> index 01e1fc057c83..44a9f97194aa 100644
> --- a/arch/parisc/include/asm/dma-mapping.h
> +++ b/arch/parisc/include/asm/dma-mapping.h
> @@ -21,11 +21,6 @@
>  ** flush/purge and allocate "regular" cacheable pages for everything.
>  */
>  
> -#ifdef CONFIG_PA11
> -extern const struct dma_map_ops pcxl_dma_ops;
> -extern const struct dma_map_ops pcx_dma_ops;
> -#endif
> -
>  extern const struct dma_map_ops *hppa_dma_ops;
>  
>  static inline const struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
> diff --git a/arch/parisc/kernel/pci-dma.c b/arch/parisc/kernel/pci-dma.c
> index 91bc0cac03a1..235e2e53959e 100644
> --- a/arch/parisc/kernel/pci-dma.c
> +++ b/arch/parisc/kernel/pci-dma.c
> @@ -21,13 +21,12 @@
>  #include <linux/init.h>
>  #include <linux/gfp.h>
>  #include <linux/mm.h>
> -#include <linux/pci.h>
>  #include <linux/proc_fs.h>
>  #include <linux/seq_file.h>
>  #include <linux/string.h>
>  #include <linux/types.h>
> -#include <linux/scatterlist.h>
> -#include <linux/export.h>
> +#include <linux/dma-direct.h>
> +#include <linux/dma-noncoherent.h>
>  
>  #include <asm/cacheflush.h>
>  #include <asm/dma.h>    /* for DMA_CHUNK_SIZE */
> @@ -447,178 +446,48 @@ static void pa11_dma_free(struct device *dev, size_t size, void *vaddr,
>  	free_pages((unsigned long)__va(dma_handle), order);
>  }
>  
> -static dma_addr_t pa11_dma_map_page(struct device *dev, struct page *page,
> -		unsigned long offset, size_t size,
> -		enum dma_data_direction direction, unsigned long attrs)
> +void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
> +		size_t size, enum dma_data_direction dir)
>  {
> -	void *addr = page_address(page) + offset;
> -	BUG_ON(direction == DMA_NONE);
> -
> -	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
> -		flush_kernel_dcache_range((unsigned long) addr, size);
> -
> -	return virt_to_phys(addr);
> +	flush_kernel_dcache_range((unsigned long)phys_to_virt(paddr), size);
>  }
>  
> -static void pa11_dma_unmap_page(struct device *dev, dma_addr_t dma_handle,
> -		size_t size, enum dma_data_direction direction,
> -		unsigned long attrs)
> +void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
> +		size_t size, enum dma_data_direction dir)
>  {
> -	BUG_ON(direction == DMA_NONE);
> -
> -	if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
> -		return;
> -
> -	if (direction == DMA_TO_DEVICE)
> +	if (dir == DMA_TO_DEVICE)
>  		return;
>  
>  	/*
> -	 * For PCI_DMA_FROMDEVICE this flush is not necessary for the
> +	 * For DMA_FROM_DEVICE this flush is not necessary for the
>  	 * simple map/unmap case. However, it IS necessary if if
> -	 * pci_dma_sync_single_* has been called and the buffer reused.
> +	 * dma_sync_single_* has been called and the buffer reused.
>  	 */
>  
> -	flush_kernel_dcache_range((unsigned long) phys_to_virt(dma_handle), size);
> -}
> -
> -static int pa11_dma_map_sg(struct device *dev, struct scatterlist *sglist,
> -		int nents, enum dma_data_direction direction,
> -		unsigned long attrs)
> -{
> -	int i;
> -	struct scatterlist *sg;
> -
> -	BUG_ON(direction == DMA_NONE);
> -
> -	for_each_sg(sglist, sg, nents, i) {
> -		unsigned long vaddr = (unsigned long)sg_virt(sg);
> -
> -		sg_dma_address(sg) = (dma_addr_t) virt_to_phys(vaddr);
> -		sg_dma_len(sg) = sg->length;
> -
> -		if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
> -			continue;
> -
> -		flush_kernel_dcache_range(vaddr, sg->length);
> -	}
> -	return nents;
> +	flush_kernel_dcache_range((unsigned long)phys_to_virt(paddr), size);
>  }
>  
> -static void pa11_dma_unmap_sg(struct device *dev, struct scatterlist *sglist,
> -		int nents, enum dma_data_direction direction,
> -		unsigned long attrs)
> -{
> -	int i;
> -	struct scatterlist *sg;
> -
> -	BUG_ON(direction == DMA_NONE);
> -
> -	if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
> -		return;
> -
> -	if (direction == DMA_TO_DEVICE)
> -		return;
> -
> -	/* once we do combining we'll need to use phys_to_virt(sg_dma_address(sglist)) */
> -
> -	for_each_sg(sglist, sg, nents, i)
> -		flush_kernel_vmap_range(sg_virt(sg), sg->length);
> -}
> -
> -static void pa11_dma_sync_single_for_cpu(struct device *dev,
> -		dma_addr_t dma_handle, size_t size,
> -		enum dma_data_direction direction)
> -{
> -	BUG_ON(direction == DMA_NONE);
> -
> -	flush_kernel_dcache_range((unsigned long) phys_to_virt(dma_handle),
> -			size);
> -}
> -
> -static void pa11_dma_sync_single_for_device(struct device *dev,
> -		dma_addr_t dma_handle, size_t size,
> -		enum dma_data_direction direction)
> -{
> -	BUG_ON(direction == DMA_NONE);
> -
> -	flush_kernel_dcache_range((unsigned long) phys_to_virt(dma_handle),
> -			size);
> -}
> -
> -static void pa11_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sglist, int nents, enum dma_data_direction direction)
> -{
> -	int i;
> -	struct scatterlist *sg;
> -
> -	/* once we do combining we'll need to use phys_to_virt(sg_dma_address(sglist)) */
> -
> -	for_each_sg(sglist, sg, nents, i)
> -		flush_kernel_vmap_range(sg_virt(sg), sg->length);
> -}
> -
> -static void pa11_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sglist, int nents, enum dma_data_direction direction)
> -{
> -	int i;
> -	struct scatterlist *sg;
> -
> -	/* once we do combining we'll need to use phys_to_virt(sg_dma_address(sglist)) */
> -
> -	for_each_sg(sglist, sg, nents, i)
> -		flush_kernel_vmap_range(sg_virt(sg), sg->length);
> -}
> -
> -static void pa11_dma_cache_sync(struct device *dev, void *vaddr, size_t size,
> +void arch_dma_cache_sync(struct device *dev, void *vaddr, size_t size,
>  	       enum dma_data_direction direction)
>  {
>  	flush_kernel_dcache_range((unsigned long)vaddr, size);
>  }
>  
> -const struct dma_map_ops pcxl_dma_ops = {
> -	.alloc =		pa11_dma_alloc,
> -	.free =			pa11_dma_free,
> -	.map_page =		pa11_dma_map_page,
> -	.unmap_page =		pa11_dma_unmap_page,
> -	.map_sg =		pa11_dma_map_sg,
> -	.unmap_sg =		pa11_dma_unmap_sg,
> -	.sync_single_for_cpu =	pa11_dma_sync_single_for_cpu,
> -	.sync_single_for_device = pa11_dma_sync_single_for_device,
> -	.sync_sg_for_cpu =	pa11_dma_sync_sg_for_cpu,
> -	.sync_sg_for_device =	pa11_dma_sync_sg_for_device,
> -	.cache_sync =		pa11_dma_cache_sync,
> -};
> -
> -static void *pcx_dma_alloc(struct device *dev, size_t size,
> -		dma_addr_t *dma_handle, gfp_t flag, unsigned long attrs)
> +void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *dma_handle,
> +		gfp_t gfp, unsigned long attrs)
>  {
> -	void *addr;
> -
> -	if ((attrs & DMA_ATTR_NON_CONSISTENT) == 0)
> -		return NULL;
> -
> -	addr = (void *)__get_free_pages(flag, get_order(size));
> -	if (addr)
> -		*dma_handle = (dma_addr_t)virt_to_phys(addr);
> -
> -	return addr;
> +	if (boot_cpu_data.cpu_type == pcxl2 || boot_cpu_data.cpu_type == pcxl)
> +		return pa11_dma_alloc(dev, size, dma_handle, gfp, attrs);
> +	if (attrs & DMA_ATTR_NON_CONSISTENT)
> +		return dma_direct_alloc(dev, size, dma_handle, gfp, attrs);
> +	return NULL;
>  }
>  
> -static void pcx_dma_free(struct device *dev, size_t size, void *vaddr,
> -		dma_addr_t iova, unsigned long attrs)
> +void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
> +		dma_addr_t dma_addr, unsigned long attrs)
>  {
> -	free_pages((unsigned long)vaddr, get_order(size));
> -	return;
> +	if (boot_cpu_data.cpu_type == pcxl2 || boot_cpu_data.cpu_type == pcxl)
> +		pa11_dma_free(dev, size, cpu_addr, dma_addr, attrs);
> +	else
> +		dma_direct_free(dev, size, cpu_addr, dma_addr, attrs);
>  }
> -
> -const struct dma_map_ops pcx_dma_ops = {
> -	.alloc =		pcx_dma_alloc,
> -	.free =			pcx_dma_free,
> -	.map_page =		pa11_dma_map_page,
> -	.unmap_page =		pa11_dma_unmap_page,
> -	.map_sg =		pa11_dma_map_sg,
> -	.unmap_sg =		pa11_dma_unmap_sg,
> -	.sync_single_for_cpu =	pa11_dma_sync_single_for_cpu,
> -	.sync_single_for_device = pa11_dma_sync_single_for_device,
> -	.sync_sg_for_cpu =	pa11_dma_sync_sg_for_cpu,
> -	.sync_sg_for_device =	pa11_dma_sync_sg_for_device,
> -	.cache_sync =		pa11_dma_cache_sync,
> -};
> diff --git a/arch/parisc/kernel/setup.c b/arch/parisc/kernel/setup.c
> index 8d3a7b80ac42..4e87c35c22b7 100644
> --- a/arch/parisc/kernel/setup.c
> +++ b/arch/parisc/kernel/setup.c
> @@ -97,14 +97,12 @@ void __init dma_ops_init(void)
>  		panic(	"PA-RISC Linux currently only supports machines that conform to\n"
>  			"the PA-RISC 1.1 or 2.0 architecture specification.\n");
>  
> -	case pcxs:
> -	case pcxt:
> -		hppa_dma_ops = &pcx_dma_ops;
> -		break;
>  	case pcxl2:
>  		pa7300lc_init();
>  	case pcxl: /* falls through */
> -		hppa_dma_ops = &pcxl_dma_ops;
> +	case pcxs:
> +	case pcxt:
> +		hppa_dma_ops = &dma_noncoherent_ops;
>  		break;
>  	default:
>  		break;
> diff --git a/arch/parisc/mm/init.c b/arch/parisc/mm/init.c
> index cab32ee824d2..4ad91c28ecbe 100644
> --- a/arch/parisc/mm/init.c
> +++ b/arch/parisc/mm/init.c
> @@ -19,7 +19,6 @@
>  #include <linux/gfp.h>
>  #include <linux/delay.h>
>  #include <linux/init.h>
> -#include <linux/pci.h>		/* for hppa_dma_ops and pcxl_dma_ops */
>  #include <linux/initrd.h>
>  #include <linux/swap.h>
>  #include <linux/unistd.h>
> @@ -616,17 +615,13 @@ void __init mem_init(void)
>  	free_all_bootmem();
>  
>  #ifdef CONFIG_PA11
> -	if (hppa_dma_ops == &pcxl_dma_ops) {
> +	if (boot_cpu_data.cpu_type == pcxl2 || boot_cpu_data.cpu_type == pcxl) {
>  		pcxl_dma_start = (unsigned long)SET_MAP_OFFSET(MAP_START);
>  		parisc_vmalloc_start = SET_MAP_OFFSET(pcxl_dma_start
>  						+ PCXL_DMA_MAP_SIZE);
> -	} else {
> -		pcxl_dma_start = 0;
> -		parisc_vmalloc_start = SET_MAP_OFFSET(MAP_START);
> -	}
> -#else
> -	parisc_vmalloc_start = SET_MAP_OFFSET(MAP_START);
> +	} else
>  #endif
> +		parisc_vmalloc_start = SET_MAP_OFFSET(MAP_START);
>  
>  	mem_init_print_info(NULL);
>  
> 

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* Re: [PATCH 22/22] parisc: use generic dma_noncoherent_ops
  2018-04-20  8:03   ` Christoph Hellwig
                       ` (2 preceding siblings ...)
  (?)
@ 2018-04-21 21:42     ` James Bottomley
  -1 siblings, 0 replies; 2593+ messages in thread
From: James Bottomley @ 2018-04-21 21:42 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

On Fri, 2018-04-20 at 10:03 +0200, Christoph Hellwig wrote:
> diff --git a/arch/parisc/kernel/setup.c b/arch/parisc/kernel/setup.c
> index 8d3a7b80ac42..4e87c35c22b7 100644
> --- a/arch/parisc/kernel/setup.c
> +++ b/arch/parisc/kernel/setup.c
> @@ -97,14 +97,12 @@ void __init dma_ops_init(void)
>  		panic(	"PA-RISC Linux currently only supports
> machines that conform to\n"
>  			"the PA-RISC 1.1 or 2.0 architecture
> specification.\n");
>  
> -	case pcxs:
> -	case pcxt:
> -		hppa_dma_ops = &pcx_dma_ops;
> -		break;
>  	case pcxl2:
>  		pa7300lc_init();
>  	case pcxl: /* falls through */
> -		hppa_dma_ops = &pcxl_dma_ops;
> +	case pcxs:
> +	case pcxt:
> +		hppa_dma_ops = &dma_noncoherent_ops;
>  		break;
>  	default:
>  		break;

Well, this is wrong: you just made every 32 bit parisc system
unnecessarily use non-coherent.  We actually only have a small small
set of non-coherent systems.  The pxcs and pcxt systems (which are
about 99% of the user base) can use coherent dma ops.  The problem
seems to be in your new world you only have one dma_noncoherent_ops
pointer ... we definitely need two on parisc, so whether
arch_dma_cache_sync is present or not needs to be dynamic not config
defined.

James


^ permalink raw reply	[flat|nested] 2593+ messages in thread

* [PATCH 22/22] parisc: use generic dma_noncoherent_ops
@ 2018-04-21 21:42     ` James Bottomley
  0 siblings, 0 replies; 2593+ messages in thread
From: James Bottomley @ 2018-04-21 21:42 UTC (permalink / raw)
  To: linux-snps-arc

On Fri, 2018-04-20@10:03 +0200, Christoph Hellwig wrote:
> diff --git a/arch/parisc/kernel/setup.c b/arch/parisc/kernel/setup.c
> index 8d3a7b80ac42..4e87c35c22b7 100644
> --- a/arch/parisc/kernel/setup.c
> +++ b/arch/parisc/kernel/setup.c
> @@ -97,14 +97,12 @@ void __init dma_ops_init(void)
> ?		panic(	"PA-RISC Linux currently only supports
> machines that conform to\n"
> ?			"the PA-RISC 1.1 or 2.0 architecture
> specification.\n");
> ?
> -	case pcxs:
> -	case pcxt:
> -		hppa_dma_ops = &pcx_dma_ops;
> -		break;
> ?	case pcxl2:
> ?		pa7300lc_init();
> ?	case pcxl: /* falls through */
> -		hppa_dma_ops = &pcxl_dma_ops;
> +	case pcxs:
> +	case pcxt:
> +		hppa_dma_ops = &dma_noncoherent_ops;
> ?		break;
> ?	default:
> ?		break;

Well, this is wrong: you just made every 32 bit parisc system
unnecessarily use non-coherent.  We actually only have a small small
set of non-coherent systems.  The pxcs and pcxt systems (which are
about 99% of the user base) can use coherent dma ops.  The problem
seems to be in your new world you only have one dma_noncoherent_ops
pointer ... we definitely need two on parisc, so whether
arch_dma_cache_sync is present or not needs to be dynamic not config
defined.

James

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* Re: [PATCH 22/22] parisc: use generic dma_noncoherent_ops
@ 2018-04-21 21:42     ` James Bottomley
  0 siblings, 0 replies; 2593+ messages in thread
From: James Bottomley @ 2018-04-21 21:42 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, linux-kernel

On Fri, 2018-04-20 at 10:03 +0200, Christoph Hellwig wrote:
> diff --git a/arch/parisc/kernel/setup.c b/arch/parisc/kernel/setup.c
> index 8d3a7b80ac42..4e87c35c22b7 100644
> --- a/arch/parisc/kernel/setup.c
> +++ b/arch/parisc/kernel/setup.c
> @@ -97,14 +97,12 @@ void __init dma_ops_init(void)
>  		panic(	"PA-RISC Linux currently only supports
> machines that conform to\n"
>  			"the PA-RISC 1.1 or 2.0 architecture
> specification.\n");
>  
> -	case pcxs:
> -	case pcxt:
> -		hppa_dma_ops = &pcx_dma_ops;
> -		break;
>  	case pcxl2:
>  		pa7300lc_init();
>  	case pcxl: /* falls through */
> -		hppa_dma_ops = &pcxl_dma_ops;
> +	case pcxs:
> +	case pcxt:
> +		hppa_dma_ops = &dma_noncoherent_ops;
>  		break;
>  	default:
>  		break;

Well, this is wrong: you just made every 32 bit parisc system
unnecessarily use non-coherent.  We actually only have a small small
set of non-coherent systems.  The pxcs and pcxt systems (which are
about 99% of the user base) can use coherent dma ops.  The problem
seems to be in your new world you only have one dma_noncoherent_ops
pointer ... we definitely need two on parisc, so whether
arch_dma_cache_sync is present or not needs to be dynamic not config
defined.

James


^ permalink raw reply	[flat|nested] 2593+ messages in thread

* [OpenRISC] [PATCH 22/22] parisc: use generic dma_noncoherent_ops
@ 2018-04-21 21:42     ` James Bottomley
  0 siblings, 0 replies; 2593+ messages in thread
From: James Bottomley @ 2018-04-21 21:42 UTC (permalink / raw)
  To: openrisc

On Fri, 2018-04-20 at 10:03 +0200, Christoph Hellwig wrote:
> diff --git a/arch/parisc/kernel/setup.c b/arch/parisc/kernel/setup.c
> index 8d3a7b80ac42..4e87c35c22b7 100644
> --- a/arch/parisc/kernel/setup.c
> +++ b/arch/parisc/kernel/setup.c
> @@ -97,14 +97,12 @@ void __init dma_ops_init(void)
>  		panic(	"PA-RISC Linux currently only supports
> machines that conform to\n"
>  			"the PA-RISC 1.1 or 2.0 architecture
> specification.\n");
>  
> -	case pcxs:
> -	case pcxt:
> -		hppa_dma_ops = &pcx_dma_ops;
> -		break;
>  	case pcxl2:
>  		pa7300lc_init();
>  	case pcxl: /* falls through */
> -		hppa_dma_ops = &pcxl_dma_ops;
> +	case pcxs:
> +	case pcxt:
> +		hppa_dma_ops = &dma_noncoherent_ops;
>  		break;
>  	default:
>  		break;

Well, this is wrong: you just made every 32 bit parisc system
unnecessarily use non-coherent.  We actually only have a small small
set of non-coherent systems.  The pxcs and pcxt systems (which are
about 99% of the user base) can use coherent dma ops.  The problem
seems to be in your new world you only have one dma_noncoherent_ops
pointer ... we definitely need two on parisc, so whether
arch_dma_cache_sync is present or not needs to be dynamic not config
defined.

James


^ permalink raw reply	[flat|nested] 2593+ messages in thread

* [PATCH 22/22] parisc: use generic dma_noncoherent_ops
@ 2018-04-21 21:42     ` James Bottomley
  0 siblings, 0 replies; 2593+ messages in thread
From: James Bottomley @ 2018-04-21 21:42 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, 2018-04-20 at 10:03 +0200, Christoph Hellwig wrote:
> diff --git a/arch/parisc/kernel/setup.c b/arch/parisc/kernel/setup.c
> index 8d3a7b80ac42..4e87c35c22b7 100644
> --- a/arch/parisc/kernel/setup.c
> +++ b/arch/parisc/kernel/setup.c
> @@ -97,14 +97,12 @@ void __init dma_ops_init(void)
> ?		panic(	"PA-RISC Linux currently only supports
> machines that conform to\n"
> ?			"the PA-RISC 1.1 or 2.0 architecture
> specification.\n");
> ?
> -	case pcxs:
> -	case pcxt:
> -		hppa_dma_ops = &pcx_dma_ops;
> -		break;
> ?	case pcxl2:
> ?		pa7300lc_init();
> ?	case pcxl: /* falls through */
> -		hppa_dma_ops = &pcxl_dma_ops;
> +	case pcxs:
> +	case pcxt:
> +		hppa_dma_ops = &dma_noncoherent_ops;
> ?		break;
> ?	default:
> ?		break;

Well, this is wrong: you just made every 32 bit parisc system
unnecessarily use non-coherent.  We actually only have a small small
set of non-coherent systems.  The pxcs and pcxt systems (which are
about 99% of the user base) can use coherent dma ops.  The problem
seems to be in your new world you only have one dma_noncoherent_ops
pointer ... we definitely need two on parisc, so whether
arch_dma_cache_sync is present or not needs to be dynamic not config
defined.

James

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* Re: [PATCH 22/22] parisc: use generic dma_noncoherent_ops
  2018-04-21 17:43     ` Helge Deller
                         ` (2 preceding siblings ...)
  (?)
@ 2018-04-21 21:52       ` James Bottomley
  -1 siblings, 0 replies; 2593+ messages in thread
From: James Bottomley @ 2018-04-21 21:52 UTC (permalink / raw)
  To: Helge Deller, Christoph Hellwig
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-kernel

On Sat, 2018-04-21 at 19:43 +0200, Helge Deller wrote:
> On 20.04.2018 10:03, Christoph Hellwig wrote:
> > Switch to the generic noncoherent direct mapping implementation.
> > 
> > Parisc previously had two different non-coherent dma ops
> > implementation that just different in the way coherent allocations
> > were handled or not handled.  The different behavior is not
> > selected at runtime in the arch_dma_alloc and arch_dma_free
> > routines.  The non-coherent allocation in the pcx cases now uses
> > the dma_direct helpers that are a little more sophisticated and
> > used by a lot of other architectures.
> > 
> > Fix sync_single_for_cpu to do skip the cache flush unless the
> > transfer is to the device to match the more tested unmap_single
> > path which should have the same cache coherency implications.
> > 
> > This also now consistenly uses flush_kernel_dcache_range for cache
> > flushing while previously some of the SG based operations used
> > flush_kernel_vmap_range instead.
> 
> 
> This patch breaks a 32bit kernel on a B160L machine (PA7300LC CPU,
> "pcxl2"). After applying this patch series the lasi82956 network
> driver works unreliable.  NIC gets IP, but ping doesn't work.
> See drivers/net/ethernet/i825xx/lasi_82596.c, it uses dma*sync()
> functions.

That's actually a weird result.  The 32 bit machines have two cases:
those that can make uncached memory by setting the U bit (and thus
don't need the sync operations in the lasi and D700 drivers) and those
that can't.  The latter is basically only the old 700 series.  The B180
is in the class of can set pages to uncached, so it sounds like
something in our uncached memory allocation for dma areas is failing
after this patch set.

I still have an old 700 in my box of curiosities, so I can try to dust
it off and plug it back in when I get home to see what it makes of the
series when it gets fixed.

James

James


^ permalink raw reply	[flat|nested] 2593+ messages in thread

* [PATCH 22/22] parisc: use generic dma_noncoherent_ops
@ 2018-04-21 21:52       ` James Bottomley
  0 siblings, 0 replies; 2593+ messages in thread
From: James Bottomley @ 2018-04-21 21:52 UTC (permalink / raw)
  To: linux-snps-arc

On Sat, 2018-04-21@19:43 +0200, Helge Deller wrote:
> On 20.04.2018 10:03, Christoph Hellwig wrote:
> > Switch to the generic noncoherent direct mapping implementation.
> > 
> > Parisc previously had two different non-coherent dma ops
> > implementation that just different in the way coherent allocations
> > were handled or not handled.??The different behavior is not
> > selected at runtime in the arch_dma_alloc and arch_dma_free
> > routines.??The non-coherent allocation in the pcx cases now uses
> > the dma_direct helpers that are a little more sophisticated and
> > used by a lot of other architectures.
> > 
> > Fix sync_single_for_cpu to do skip the cache flush unless the
> > transfer is to the device to match the more tested unmap_single
> > path which should have the same cache coherency implications.
> > 
> > This also now consistenly uses flush_kernel_dcache_range for cache
> > flushing while previously some of the SG based operations used
> > flush_kernel_vmap_range instead.
> 
> 
> This patch breaks a 32bit kernel on a B160L machine (PA7300LC CPU,
> "pcxl2"). After applying this patch series the lasi82956 network
> driver works unreliable.? NIC gets IP, but ping doesn't work.
> See drivers/net/ethernet/i825xx/lasi_82596.c, it uses dma*sync()
> functions.

That's actually a weird result.  The 32 bit machines have two cases:
those that can make uncached memory by setting the U bit (and thus
don't need the sync operations in the lasi and D700 drivers) and those
that can't.  The latter is basically only the old 700 series.  The B180
is in the class of can set pages to uncached, so it sounds like
something in our uncached memory allocation for dma areas is failing
after this patch set.

I still have an old 700 in my box of curiosities, so I can try to dust
it off and plug it back in when I get home to see what it makes of the
series when it gets fixed.

James

James

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* Re: [PATCH 22/22] parisc: use generic dma_noncoherent_ops
@ 2018-04-21 21:52       ` James Bottomley
  0 siblings, 0 replies; 2593+ messages in thread
From: James Bottomley @ 2018-04-21 21:52 UTC (permalink / raw)
  To: Helge Deller, Christoph Hellwig
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-kernel

On Sat, 2018-04-21 at 19:43 +0200, Helge Deller wrote:
> On 20.04.2018 10:03, Christoph Hellwig wrote:
> > Switch to the generic noncoherent direct mapping implementation.
> > 
> > Parisc previously had two different non-coherent dma ops
> > implementation that just different in the way coherent allocations
> > were handled or not handled.  The different behavior is not
> > selected at runtime in the arch_dma_alloc and arch_dma_free
> > routines.  The non-coherent allocation in the pcx cases now uses
> > the dma_direct helpers that are a little more sophisticated and
> > used by a lot of other architectures.
> > 
> > Fix sync_single_for_cpu to do skip the cache flush unless the
> > transfer is to the device to match the more tested unmap_single
> > path which should have the same cache coherency implications.
> > 
> > This also now consistenly uses flush_kernel_dcache_range for cache
> > flushing while previously some of the SG based operations used
> > flush_kernel_vmap_range instead.
> 
> 
> This patch breaks a 32bit kernel on a B160L machine (PA7300LC CPU,
> "pcxl2"). After applying this patch series the lasi82956 network
> driver works unreliable.  NIC gets IP, but ping doesn't work.
> See drivers/net/ethernet/i825xx/lasi_82596.c, it uses dma*sync()
> functions.

That's actually a weird result.  The 32 bit machines have two cases:
those that can make uncached memory by setting the U bit (and thus
don't need the sync operations in the lasi and D700 drivers) and those
that can't.  The latter is basically only the old 700 series.  The B180
is in the class of can set pages to uncached, so it sounds like
something in our uncached memory allocation for dma areas is failing
after this patch set.

I still have an old 700 in my box of curiosities, so I can try to dust
it off and plug it back in when I get home to see what it makes of the
series when it gets fixed.

James

James


^ permalink raw reply	[flat|nested] 2593+ messages in thread

* [OpenRISC] [PATCH 22/22] parisc: use generic dma_noncoherent_ops
@ 2018-04-21 21:52       ` James Bottomley
  0 siblings, 0 replies; 2593+ messages in thread
From: James Bottomley @ 2018-04-21 21:52 UTC (permalink / raw)
  To: openrisc

On Sat, 2018-04-21 at 19:43 +0200, Helge Deller wrote:
> On 20.04.2018 10:03, Christoph Hellwig wrote:
> > Switch to the generic noncoherent direct mapping implementation.
> > 
> > Parisc previously had two different non-coherent dma ops
> > implementation that just different in the way coherent allocations
> > were handled or not handled.  The different behavior is not
> > selected at runtime in the arch_dma_alloc and arch_dma_free
> > routines.  The non-coherent allocation in the pcx cases now uses
> > the dma_direct helpers that are a little more sophisticated and
> > used by a lot of other architectures.
> > 
> > Fix sync_single_for_cpu to do skip the cache flush unless the
> > transfer is to the device to match the more tested unmap_single
> > path which should have the same cache coherency implications.
> > 
> > This also now consistenly uses flush_kernel_dcache_range for cache
> > flushing while previously some of the SG based operations used
> > flush_kernel_vmap_range instead.
> 
> 
> This patch breaks a 32bit kernel on a B160L machine (PA7300LC CPU,
> "pcxl2"). After applying this patch series the lasi82956 network
> driver works unreliable.  NIC gets IP, but ping doesn't work.
> See drivers/net/ethernet/i825xx/lasi_82596.c, it uses dma*sync()
> functions.

That's actually a weird result.  The 32 bit machines have two cases:
those that can make uncached memory by setting the U bit (and thus
don't need the sync operations in the lasi and D700 drivers) and those
that can't.  The latter is basically only the old 700 series.  The B180
is in the class of can set pages to uncached, so it sounds like
something in our uncached memory allocation for dma areas is failing
after this patch set.

I still have an old 700 in my box of curiosities, so I can try to dust
it off and plug it back in when I get home to see what it makes of the
series when it gets fixed.

James

James


^ permalink raw reply	[flat|nested] 2593+ messages in thread

* [PATCH 22/22] parisc: use generic dma_noncoherent_ops
@ 2018-04-21 21:52       ` James Bottomley
  0 siblings, 0 replies; 2593+ messages in thread
From: James Bottomley @ 2018-04-21 21:52 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, 2018-04-21 at 19:43 +0200, Helge Deller wrote:
> On 20.04.2018 10:03, Christoph Hellwig wrote:
> > Switch to the generic noncoherent direct mapping implementation.
> > 
> > Parisc previously had two different non-coherent dma ops
> > implementation that just different in the way coherent allocations
> > were handled or not handled.??The different behavior is not
> > selected at runtime in the arch_dma_alloc and arch_dma_free
> > routines.??The non-coherent allocation in the pcx cases now uses
> > the dma_direct helpers that are a little more sophisticated and
> > used by a lot of other architectures.
> > 
> > Fix sync_single_for_cpu to do skip the cache flush unless the
> > transfer is to the device to match the more tested unmap_single
> > path which should have the same cache coherency implications.
> > 
> > This also now consistenly uses flush_kernel_dcache_range for cache
> > flushing while previously some of the SG based operations used
> > flush_kernel_vmap_range instead.
> 
> 
> This patch breaks a 32bit kernel on a B160L machine (PA7300LC CPU,
> "pcxl2"). After applying this patch series the lasi82956 network
> driver works unreliable.? NIC gets IP, but ping doesn't work.
> See drivers/net/ethernet/i825xx/lasi_82596.c, it uses dma*sync()
> functions.

That's actually a weird result.  The 32 bit machines have two cases:
those that can make uncached memory by setting the U bit (and thus
don't need the sync operations in the lasi and D700 drivers) and those
that can't.  The latter is basically only the old 700 series.  The B180
is in the class of can set pages to uncached, so it sounds like
something in our uncached memory allocation for dma areas is failing
after this patch set.

I still have an old 700 in my box of curiosities, so I can try to dust
it off and plug it back in when I get home to see what it makes of the
series when it gets fixed.

James

James

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* Re: [PATCH 13/22] nds32: use generic dma_noncoherent_ops
  2018-04-20  8:03   ` Christoph Hellwig
                       ` (2 preceding siblings ...)
  (?)
@ 2018-04-23  6:49     ` Greentime Hu
  -1 siblings, 0 replies; 2593+ messages in thread
From: Greentime Hu @ 2018-04-23  6:49 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-arch, Michal Simek, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, Linux Kernel Mailing List

2018-04-20 16:03 GMT+08:00 Christoph Hellwig <hch@lst.de>:
> Switch to the generic noncoherent direct mapping implementation.
>
> This makes sure kmap_atomic_pfn is consistently used for access to
> virtual addresses instead of either using the slower plain kmap
> or blindly expecting page_address() to work.
>
> This makes sure the cache_sync routines is called in the unmap_sg
> case, to match the unmap_single and sync_{single,sg}_to_cpu cases.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  arch/nds32/Kconfig                   |   3 +
>  arch/nds32/include/asm/Kbuild        |   1 +
>  arch/nds32/include/asm/dma-mapping.h |  14 ---
>  arch/nds32/kernel/dma.c              | 182 ++++++---------------------
>  4 files changed, 39 insertions(+), 161 deletions(-)
>  delete mode 100644 arch/nds32/include/asm/dma-mapping.h
>
> diff --git a/arch/nds32/Kconfig b/arch/nds32/Kconfig
> index 249f38d3388f..67d0ac0a989c 100644
> --- a/arch/nds32/Kconfig
> +++ b/arch/nds32/Kconfig
> @@ -5,10 +5,13 @@
>
>  config NDS32
>          def_bool y
> +       select ARCH_HAS_SYNC_DMA_FOR_CPU
> +       select ARCH_HAS_SYNC_DMA_FOR_DEVICE
>         select ARCH_WANT_FRAME_POINTERS if FTRACE
>         select CLKSRC_MMIO
>         select CLONE_BACKWARDS
>         select COMMON_CLK
> +       select DMA_NONCOHERENT_OPS
>         select GENERIC_ATOMIC64
>         select GENERIC_CPU_DEVICES
>         select GENERIC_CLOCKEVENTS
> diff --git a/arch/nds32/include/asm/Kbuild b/arch/nds32/include/asm/Kbuild
> index 06bdf8167f5a..b3e951f805f8 100644
> --- a/arch/nds32/include/asm/Kbuild
> +++ b/arch/nds32/include/asm/Kbuild
> @@ -13,6 +13,7 @@ generic-y += cputime.h
>  generic-y += device.h
>  generic-y += div64.h
>  generic-y += dma.h
> +generic-y += dma-mapping.h
>  generic-y += emergency-restart.h
>  generic-y += errno.h
>  generic-y += exec.h
> diff --git a/arch/nds32/include/asm/dma-mapping.h b/arch/nds32/include/asm/dma-mapping.h
> deleted file mode 100644
> index 2dd47d245c25..000000000000
> --- a/arch/nds32/include/asm/dma-mapping.h
> +++ /dev/null
> @@ -1,14 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0
> -// Copyright (C) 2005-2017 Andes Technology Corporation
> -
> -#ifndef ASMNDS32_DMA_MAPPING_H
> -#define ASMNDS32_DMA_MAPPING_H
> -
> -extern struct dma_map_ops nds32_dma_ops;
> -
> -static inline struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
> -{
> -       return &nds32_dma_ops;
> -}
> -
> -#endif
> diff --git a/arch/nds32/kernel/dma.c b/arch/nds32/kernel/dma.c
> index d291800fc621..688f1a03dee6 100644
> --- a/arch/nds32/kernel/dma.c
> +++ b/arch/nds32/kernel/dma.c
> @@ -3,17 +3,14 @@
>
>  #include <linux/types.h>
>  #include <linux/mm.h>
> -#include <linux/export.h>
>  #include <linux/string.h>
> -#include <linux/scatterlist.h>
> -#include <linux/dma-mapping.h>
> +#include <linux/dma-noncoherent.h>
>  #include <linux/io.h>
>  #include <linux/cache.h>
>  #include <linux/highmem.h>
>  #include <linux/slab.h>
>  #include <asm/cacheflush.h>
>  #include <asm/tlbflush.h>
> -#include <asm/dma-mapping.h>
>  #include <asm/proc-fns.h>
>
>  /*
> @@ -22,11 +19,6 @@
>  static pte_t *consistent_pte;
>  static DEFINE_RAW_SPINLOCK(consistent_lock);
>
> -enum master_type {
> -       FOR_CPU = 0,
> -       FOR_DEVICE = 1,
> -};
> -
>  /*
>   * VM region handling support.
>   *
> @@ -124,10 +116,8 @@ static struct arch_vm_region *vm_region_find(struct arch_vm_region *head,
>         return c;
>  }
>
> -/* FIXME: attrs is not used. */
> -static void *nds32_dma_alloc_coherent(struct device *dev, size_t size,
> -                                     dma_addr_t * handle, gfp_t gfp,
> -                                     unsigned long attrs)
> +void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
> +               gfp_t gfp, unsigned long attrs)
>  {
>         struct page *page;
>         struct arch_vm_region *c;
> @@ -232,8 +222,8 @@ static void *nds32_dma_alloc_coherent(struct device *dev, size_t size,
>         return NULL;
>  }
>
> -static void nds32_dma_free(struct device *dev, size_t size, void *cpu_addr,
> -                          dma_addr_t handle, unsigned long attrs)
> +void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
> +               dma_addr_t handle, unsigned long attrs)
>  {
>         struct arch_vm_region *c;
>         unsigned long flags, addr;
> @@ -333,145 +323,43 @@ static int __init consistent_init(void)
>  }
>
>  core_initcall(consistent_init);
> -static void consistent_sync(void *vaddr, size_t size, int direction, int master_type);
> -static dma_addr_t nds32_dma_map_page(struct device *dev, struct page *page,
> -                                    unsigned long offset, size_t size,
> -                                    enum dma_data_direction dir,
> -                                    unsigned long attrs)
> -{
> -       if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
> -               consistent_sync((void *)(page_address(page) + offset), size, dir, FOR_DEVICE);
> -       return page_to_phys(page) + offset;
> -}
> -
> -static void nds32_dma_unmap_page(struct device *dev, dma_addr_t handle,
> -                                size_t size, enum dma_data_direction dir,
> -                                unsigned long attrs)
> -{
> -       if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
> -               consistent_sync(phys_to_virt(handle), size, dir, FOR_CPU);
> -}
>
> -/*
> - * Make an area consistent for devices.
> - */
> -static void consistent_sync(void *vaddr, size_t size, int direction, int master_type)
> +void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
> +               size_t size, enum dma_data_direction dir)
>  {
> -       unsigned long start = (unsigned long)vaddr;
> -       unsigned long end = start + size;
> -
> -       if (master_type == FOR_CPU) {
> -               switch (direction) {
> -               case DMA_TO_DEVICE:
> -                       break;
> -               case DMA_FROM_DEVICE:
> -               case DMA_BIDIRECTIONAL:
> -                       cpu_dma_inval_range(start, end);
> -                       break;
> -               default:
> -                       BUG();
> -               }
> -       } else {
> -               /* FOR_DEVICE */
> -               switch (direction) {
> -               case DMA_FROM_DEVICE:
> -                       break;
> -               case DMA_TO_DEVICE:
> -               case DMA_BIDIRECTIONAL:
> -                       cpu_dma_wb_range(start, end);
> -                       break;
> -               default:
> -                       BUG();
> -               }
> +       void *addr = kmap_atomic_pfn(PHYS_PFN(paddr));
> +       unsigned long start = (unsigned long)addr;
> +
> +       switch (direction) {
> +       case DMA_FROM_DEVICE:
> +               break;
> +       case DMA_TO_DEVICE:
> +       case DMA_BIDIRECTIONAL:
> +               cpu_dma_wb_range(start, start + size);
> +               break;
> +       default:
> +               BUG();
>         }
> -}
>
> -static int nds32_dma_map_sg(struct device *dev, struct scatterlist *sg,
> -                           int nents, enum dma_data_direction dir,
> -                           unsigned long attrs)
> -{
> -       int i;
> -
> -       for (i = 0; i < nents; i++, sg++) {
> -               void *virt;
> -               unsigned long pfn;
> -               struct page *page = sg_page(sg);
> -
> -               sg->dma_address = sg_phys(sg);
> -               pfn = page_to_pfn(page) + sg->offset / PAGE_SIZE;
> -               page = pfn_to_page(pfn);
> -               if (PageHighMem(page)) {
> -                       virt = kmap_atomic(page);
> -                       consistent_sync(virt, sg->length, dir, FOR_CPU);
> -                       kunmap_atomic(virt);
> -               } else {
> -                       if (sg->offset > PAGE_SIZE)
> -                               panic("sg->offset:%08x > PAGE_SIZE\n",
> -                                     sg->offset);
> -                       virt = page_address(page) + sg->offset;
> -                       consistent_sync(virt, sg->length, dir, FOR_CPU);
> -               }
> -       }
> -       return nents;
> -}
> -
> -static void nds32_dma_unmap_sg(struct device *dev, struct scatterlist *sg,
> -                              int nhwentries, enum dma_data_direction dir,
> -                              unsigned long attrs)
> -{
> +       kunmap_atomic(addr);
>  }
>
> -static void
> -nds32_dma_sync_single_for_cpu(struct device *dev, dma_addr_t handle,
> -                             size_t size, enum dma_data_direction dir)
> +void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
> +               size_t size, enum dma_data_direction dir)
>  {
> -       consistent_sync((void *)phys_to_virt(handle), size, dir, FOR_CPU);
> -}
> -
> -static void
> -nds32_dma_sync_single_for_device(struct device *dev, dma_addr_t handle,
> -                                size_t size, enum dma_data_direction dir)
> -{
> -       consistent_sync((void *)phys_to_virt(handle), size, dir, FOR_DEVICE);
> -}
> -
> -static void
> -nds32_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nents,
> -                         enum dma_data_direction dir)
> -{
> -       int i;
> -
> -       for (i = 0; i < nents; i++, sg++) {
> -               char *virt =
> -                   page_address((struct page *)sg->page_link) + sg->offset;
> -               consistent_sync(virt, sg->length, dir, FOR_CPU);
> +       void *addr = kmap_atomic_pfn(PHYS_PFN(paddr));
> +       unsigned long start = (unsigned long)addr;
> +
> +       switch (direction) {
> +       case DMA_TO_DEVICE:
> +               break;
> +       case DMA_FROM_DEVICE:
> +       case DMA_BIDIRECTIONAL:
> +               cpu_dma_inval_range(start, end);
> +               break;
> +       default:
> +               BUG();
>         }

  CC      arch/nds32/kernel/dma.o
arch/nds32/kernel/dma.c: In function 'arch_sync_dma_for_device':
arch/nds32/kernel/dma.c:333:10: error: 'direction' undeclared (first
use in this function)
  switch (direction) {
          ^~~~~~~~~
arch/nds32/kernel/dma.c:333:10: note: each undeclared identifier is
reported only once for each function it appears in
arch/nds32/kernel/dma.c: In function 'arch_sync_dma_for_cpu':
arch/nds32/kernel/dma.c:353:10: error: 'direction' undeclared (first
use in this function)
  switch (direction) {
          ^~~~~~~~~
arch/nds32/kernel/dma.c:358:30: error: 'end' undeclared (first use in
this function)
   cpu_dma_inval_range(start, end);
                              ^~~
make[1]: *** [arch/nds32/kernel/dma.o] Error 1
make: *** [arch/nds32/kernel] Error 2

After this building error, the ftmac100.c driver is broken. Not sure
what happened.

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* [PATCH 13/22] nds32: use generic dma_noncoherent_ops
@ 2018-04-23  6:49     ` Greentime Hu
  0 siblings, 0 replies; 2593+ messages in thread
From: Greentime Hu @ 2018-04-23  6:49 UTC (permalink / raw)
  To: linux-snps-arc

2018-04-20 16:03 GMT+08:00 Christoph Hellwig <hch at lst.de>:
> Switch to the generic noncoherent direct mapping implementation.
>
> This makes sure kmap_atomic_pfn is consistently used for access to
> virtual addresses instead of either using the slower plain kmap
> or blindly expecting page_address() to work.
>
> This makes sure the cache_sync routines is called in the unmap_sg
> case, to match the unmap_single and sync_{single,sg}_to_cpu cases.
>
> Signed-off-by: Christoph Hellwig <hch at lst.de>
> ---
>  arch/nds32/Kconfig                   |   3 +
>  arch/nds32/include/asm/Kbuild        |   1 +
>  arch/nds32/include/asm/dma-mapping.h |  14 ---
>  arch/nds32/kernel/dma.c              | 182 ++++++---------------------
>  4 files changed, 39 insertions(+), 161 deletions(-)
>  delete mode 100644 arch/nds32/include/asm/dma-mapping.h
>
> diff --git a/arch/nds32/Kconfig b/arch/nds32/Kconfig
> index 249f38d3388f..67d0ac0a989c 100644
> --- a/arch/nds32/Kconfig
> +++ b/arch/nds32/Kconfig
> @@ -5,10 +5,13 @@
>
>  config NDS32
>          def_bool y
> +       select ARCH_HAS_SYNC_DMA_FOR_CPU
> +       select ARCH_HAS_SYNC_DMA_FOR_DEVICE
>         select ARCH_WANT_FRAME_POINTERS if FTRACE
>         select CLKSRC_MMIO
>         select CLONE_BACKWARDS
>         select COMMON_CLK
> +       select DMA_NONCOHERENT_OPS
>         select GENERIC_ATOMIC64
>         select GENERIC_CPU_DEVICES
>         select GENERIC_CLOCKEVENTS
> diff --git a/arch/nds32/include/asm/Kbuild b/arch/nds32/include/asm/Kbuild
> index 06bdf8167f5a..b3e951f805f8 100644
> --- a/arch/nds32/include/asm/Kbuild
> +++ b/arch/nds32/include/asm/Kbuild
> @@ -13,6 +13,7 @@ generic-y += cputime.h
>  generic-y += device.h
>  generic-y += div64.h
>  generic-y += dma.h
> +generic-y += dma-mapping.h
>  generic-y += emergency-restart.h
>  generic-y += errno.h
>  generic-y += exec.h
> diff --git a/arch/nds32/include/asm/dma-mapping.h b/arch/nds32/include/asm/dma-mapping.h
> deleted file mode 100644
> index 2dd47d245c25..000000000000
> --- a/arch/nds32/include/asm/dma-mapping.h
> +++ /dev/null
> @@ -1,14 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0
> -// Copyright (C) 2005-2017 Andes Technology Corporation
> -
> -#ifndef ASMNDS32_DMA_MAPPING_H
> -#define ASMNDS32_DMA_MAPPING_H
> -
> -extern struct dma_map_ops nds32_dma_ops;
> -
> -static inline struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
> -{
> -       return &nds32_dma_ops;
> -}
> -
> -#endif
> diff --git a/arch/nds32/kernel/dma.c b/arch/nds32/kernel/dma.c
> index d291800fc621..688f1a03dee6 100644
> --- a/arch/nds32/kernel/dma.c
> +++ b/arch/nds32/kernel/dma.c
> @@ -3,17 +3,14 @@
>
>  #include <linux/types.h>
>  #include <linux/mm.h>
> -#include <linux/export.h>
>  #include <linux/string.h>
> -#include <linux/scatterlist.h>
> -#include <linux/dma-mapping.h>
> +#include <linux/dma-noncoherent.h>
>  #include <linux/io.h>
>  #include <linux/cache.h>
>  #include <linux/highmem.h>
>  #include <linux/slab.h>
>  #include <asm/cacheflush.h>
>  #include <asm/tlbflush.h>
> -#include <asm/dma-mapping.h>
>  #include <asm/proc-fns.h>
>
>  /*
> @@ -22,11 +19,6 @@
>  static pte_t *consistent_pte;
>  static DEFINE_RAW_SPINLOCK(consistent_lock);
>
> -enum master_type {
> -       FOR_CPU = 0,
> -       FOR_DEVICE = 1,
> -};
> -
>  /*
>   * VM region handling support.
>   *
> @@ -124,10 +116,8 @@ static struct arch_vm_region *vm_region_find(struct arch_vm_region *head,
>         return c;
>  }
>
> -/* FIXME: attrs is not used. */
> -static void *nds32_dma_alloc_coherent(struct device *dev, size_t size,
> -                                     dma_addr_t * handle, gfp_t gfp,
> -                                     unsigned long attrs)
> +void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
> +               gfp_t gfp, unsigned long attrs)
>  {
>         struct page *page;
>         struct arch_vm_region *c;
> @@ -232,8 +222,8 @@ static void *nds32_dma_alloc_coherent(struct device *dev, size_t size,
>         return NULL;
>  }
>
> -static void nds32_dma_free(struct device *dev, size_t size, void *cpu_addr,
> -                          dma_addr_t handle, unsigned long attrs)
> +void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
> +               dma_addr_t handle, unsigned long attrs)
>  {
>         struct arch_vm_region *c;
>         unsigned long flags, addr;
> @@ -333,145 +323,43 @@ static int __init consistent_init(void)
>  }
>
>  core_initcall(consistent_init);
> -static void consistent_sync(void *vaddr, size_t size, int direction, int master_type);
> -static dma_addr_t nds32_dma_map_page(struct device *dev, struct page *page,
> -                                    unsigned long offset, size_t size,
> -                                    enum dma_data_direction dir,
> -                                    unsigned long attrs)
> -{
> -       if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
> -               consistent_sync((void *)(page_address(page) + offset), size, dir, FOR_DEVICE);
> -       return page_to_phys(page) + offset;
> -}
> -
> -static void nds32_dma_unmap_page(struct device *dev, dma_addr_t handle,
> -                                size_t size, enum dma_data_direction dir,
> -                                unsigned long attrs)
> -{
> -       if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
> -               consistent_sync(phys_to_virt(handle), size, dir, FOR_CPU);
> -}
>
> -/*
> - * Make an area consistent for devices.
> - */
> -static void consistent_sync(void *vaddr, size_t size, int direction, int master_type)
> +void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
> +               size_t size, enum dma_data_direction dir)
>  {
> -       unsigned long start = (unsigned long)vaddr;
> -       unsigned long end = start + size;
> -
> -       if (master_type == FOR_CPU) {
> -               switch (direction) {
> -               case DMA_TO_DEVICE:
> -                       break;
> -               case DMA_FROM_DEVICE:
> -               case DMA_BIDIRECTIONAL:
> -                       cpu_dma_inval_range(start, end);
> -                       break;
> -               default:
> -                       BUG();
> -               }
> -       } else {
> -               /* FOR_DEVICE */
> -               switch (direction) {
> -               case DMA_FROM_DEVICE:
> -                       break;
> -               case DMA_TO_DEVICE:
> -               case DMA_BIDIRECTIONAL:
> -                       cpu_dma_wb_range(start, end);
> -                       break;
> -               default:
> -                       BUG();
> -               }
> +       void *addr = kmap_atomic_pfn(PHYS_PFN(paddr));
> +       unsigned long start = (unsigned long)addr;
> +
> +       switch (direction) {
> +       case DMA_FROM_DEVICE:
> +               break;
> +       case DMA_TO_DEVICE:
> +       case DMA_BIDIRECTIONAL:
> +               cpu_dma_wb_range(start, start + size);
> +               break;
> +       default:
> +               BUG();
>         }
> -}
>
> -static int nds32_dma_map_sg(struct device *dev, struct scatterlist *sg,
> -                           int nents, enum dma_data_direction dir,
> -                           unsigned long attrs)
> -{
> -       int i;
> -
> -       for (i = 0; i < nents; i++, sg++) {
> -               void *virt;
> -               unsigned long pfn;
> -               struct page *page = sg_page(sg);
> -
> -               sg->dma_address = sg_phys(sg);
> -               pfn = page_to_pfn(page) + sg->offset / PAGE_SIZE;
> -               page = pfn_to_page(pfn);
> -               if (PageHighMem(page)) {
> -                       virt = kmap_atomic(page);
> -                       consistent_sync(virt, sg->length, dir, FOR_CPU);
> -                       kunmap_atomic(virt);
> -               } else {
> -                       if (sg->offset > PAGE_SIZE)
> -                               panic("sg->offset:%08x > PAGE_SIZE\n",
> -                                     sg->offset);
> -                       virt = page_address(page) + sg->offset;
> -                       consistent_sync(virt, sg->length, dir, FOR_CPU);
> -               }
> -       }
> -       return nents;
> -}
> -
> -static void nds32_dma_unmap_sg(struct device *dev, struct scatterlist *sg,
> -                              int nhwentries, enum dma_data_direction dir,
> -                              unsigned long attrs)
> -{
> +       kunmap_atomic(addr);
>  }
>
> -static void
> -nds32_dma_sync_single_for_cpu(struct device *dev, dma_addr_t handle,
> -                             size_t size, enum dma_data_direction dir)
> +void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
> +               size_t size, enum dma_data_direction dir)
>  {
> -       consistent_sync((void *)phys_to_virt(handle), size, dir, FOR_CPU);
> -}
> -
> -static void
> -nds32_dma_sync_single_for_device(struct device *dev, dma_addr_t handle,
> -                                size_t size, enum dma_data_direction dir)
> -{
> -       consistent_sync((void *)phys_to_virt(handle), size, dir, FOR_DEVICE);
> -}
> -
> -static void
> -nds32_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nents,
> -                         enum dma_data_direction dir)
> -{
> -       int i;
> -
> -       for (i = 0; i < nents; i++, sg++) {
> -               char *virt =
> -                   page_address((struct page *)sg->page_link) + sg->offset;
> -               consistent_sync(virt, sg->length, dir, FOR_CPU);
> +       void *addr = kmap_atomic_pfn(PHYS_PFN(paddr));
> +       unsigned long start = (unsigned long)addr;
> +
> +       switch (direction) {
> +       case DMA_TO_DEVICE:
> +               break;
> +       case DMA_FROM_DEVICE:
> +       case DMA_BIDIRECTIONAL:
> +               cpu_dma_inval_range(start, end);
> +               break;
> +       default:
> +               BUG();
>         }

  CC      arch/nds32/kernel/dma.o
arch/nds32/kernel/dma.c: In function 'arch_sync_dma_for_device':
arch/nds32/kernel/dma.c:333:10: error: 'direction' undeclared (first
use in this function)
  switch (direction) {
          ^~~~~~~~~
arch/nds32/kernel/dma.c:333:10: note: each undeclared identifier is
reported only once for each function it appears in
arch/nds32/kernel/dma.c: In function 'arch_sync_dma_for_cpu':
arch/nds32/kernel/dma.c:353:10: error: 'direction' undeclared (first
use in this function)
  switch (direction) {
          ^~~~~~~~~
arch/nds32/kernel/dma.c:358:30: error: 'end' undeclared (first use in
this function)
   cpu_dma_inval_range(start, end);
                              ^~~
make[1]: *** [arch/nds32/kernel/dma.o] Error 1
make: *** [arch/nds32/kernel] Error 2

After this building error, the ftmac100.c driver is broken. Not sure
what happened.

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* Re: [PATCH 13/22] nds32: use generic dma_noncoherent_ops
@ 2018-04-23  6:49     ` Greentime Hu
  0 siblings, 0 replies; 2593+ messages in thread
From: Greentime Hu @ 2018-04-23  6:49 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-arch, Michal Simek, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, Linux Kernel Mailing List

2018-04-20 16:03 GMT+08:00 Christoph Hellwig <hch@lst.de>:
> Switch to the generic noncoherent direct mapping implementation.
>
> This makes sure kmap_atomic_pfn is consistently used for access to
> virtual addresses instead of either using the slower plain kmap
> or blindly expecting page_address() to work.
>
> This makes sure the cache_sync routines is called in the unmap_sg
> case, to match the unmap_single and sync_{single,sg}_to_cpu cases.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  arch/nds32/Kconfig                   |   3 +
>  arch/nds32/include/asm/Kbuild        |   1 +
>  arch/nds32/include/asm/dma-mapping.h |  14 ---
>  arch/nds32/kernel/dma.c              | 182 ++++++---------------------
>  4 files changed, 39 insertions(+), 161 deletions(-)
>  delete mode 100644 arch/nds32/include/asm/dma-mapping.h
>
> diff --git a/arch/nds32/Kconfig b/arch/nds32/Kconfig
> index 249f38d3388f..67d0ac0a989c 100644
> --- a/arch/nds32/Kconfig
> +++ b/arch/nds32/Kconfig
> @@ -5,10 +5,13 @@
>
>  config NDS32
>          def_bool y
> +       select ARCH_HAS_SYNC_DMA_FOR_CPU
> +       select ARCH_HAS_SYNC_DMA_FOR_DEVICE
>         select ARCH_WANT_FRAME_POINTERS if FTRACE
>         select CLKSRC_MMIO
>         select CLONE_BACKWARDS
>         select COMMON_CLK
> +       select DMA_NONCOHERENT_OPS
>         select GENERIC_ATOMIC64
>         select GENERIC_CPU_DEVICES
>         select GENERIC_CLOCKEVENTS
> diff --git a/arch/nds32/include/asm/Kbuild b/arch/nds32/include/asm/Kbuild
> index 06bdf8167f5a..b3e951f805f8 100644
> --- a/arch/nds32/include/asm/Kbuild
> +++ b/arch/nds32/include/asm/Kbuild
> @@ -13,6 +13,7 @@ generic-y += cputime.h
>  generic-y += device.h
>  generic-y += div64.h
>  generic-y += dma.h
> +generic-y += dma-mapping.h
>  generic-y += emergency-restart.h
>  generic-y += errno.h
>  generic-y += exec.h
> diff --git a/arch/nds32/include/asm/dma-mapping.h b/arch/nds32/include/asm/dma-mapping.h
> deleted file mode 100644
> index 2dd47d245c25..000000000000
> --- a/arch/nds32/include/asm/dma-mapping.h
> +++ /dev/null
> @@ -1,14 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0
> -// Copyright (C) 2005-2017 Andes Technology Corporation
> -
> -#ifndef ASMNDS32_DMA_MAPPING_H
> -#define ASMNDS32_DMA_MAPPING_H
> -
> -extern struct dma_map_ops nds32_dma_ops;
> -
> -static inline struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
> -{
> -       return &nds32_dma_ops;
> -}
> -
> -#endif
> diff --git a/arch/nds32/kernel/dma.c b/arch/nds32/kernel/dma.c
> index d291800fc621..688f1a03dee6 100644
> --- a/arch/nds32/kernel/dma.c
> +++ b/arch/nds32/kernel/dma.c
> @@ -3,17 +3,14 @@
>
>  #include <linux/types.h>
>  #include <linux/mm.h>
> -#include <linux/export.h>
>  #include <linux/string.h>
> -#include <linux/scatterlist.h>
> -#include <linux/dma-mapping.h>
> +#include <linux/dma-noncoherent.h>
>  #include <linux/io.h>
>  #include <linux/cache.h>
>  #include <linux/highmem.h>
>  #include <linux/slab.h>
>  #include <asm/cacheflush.h>
>  #include <asm/tlbflush.h>
> -#include <asm/dma-mapping.h>
>  #include <asm/proc-fns.h>
>
>  /*
> @@ -22,11 +19,6 @@
>  static pte_t *consistent_pte;
>  static DEFINE_RAW_SPINLOCK(consistent_lock);
>
> -enum master_type {
> -       FOR_CPU = 0,
> -       FOR_DEVICE = 1,
> -};
> -
>  /*
>   * VM region handling support.
>   *
> @@ -124,10 +116,8 @@ static struct arch_vm_region *vm_region_find(struct arch_vm_region *head,
>         return c;
>  }
>
> -/* FIXME: attrs is not used. */
> -static void *nds32_dma_alloc_coherent(struct device *dev, size_t size,
> -                                     dma_addr_t * handle, gfp_t gfp,
> -                                     unsigned long attrs)
> +void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
> +               gfp_t gfp, unsigned long attrs)
>  {
>         struct page *page;
>         struct arch_vm_region *c;
> @@ -232,8 +222,8 @@ static void *nds32_dma_alloc_coherent(struct device *dev, size_t size,
>         return NULL;
>  }
>
> -static void nds32_dma_free(struct device *dev, size_t size, void *cpu_addr,
> -                          dma_addr_t handle, unsigned long attrs)
> +void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
> +               dma_addr_t handle, unsigned long attrs)
>  {
>         struct arch_vm_region *c;
>         unsigned long flags, addr;
> @@ -333,145 +323,43 @@ static int __init consistent_init(void)
>  }
>
>  core_initcall(consistent_init);
> -static void consistent_sync(void *vaddr, size_t size, int direction, int master_type);
> -static dma_addr_t nds32_dma_map_page(struct device *dev, struct page *page,
> -                                    unsigned long offset, size_t size,
> -                                    enum dma_data_direction dir,
> -                                    unsigned long attrs)
> -{
> -       if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
> -               consistent_sync((void *)(page_address(page) + offset), size, dir, FOR_DEVICE);
> -       return page_to_phys(page) + offset;
> -}
> -
> -static void nds32_dma_unmap_page(struct device *dev, dma_addr_t handle,
> -                                size_t size, enum dma_data_direction dir,
> -                                unsigned long attrs)
> -{
> -       if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
> -               consistent_sync(phys_to_virt(handle), size, dir, FOR_CPU);
> -}
>
> -/*
> - * Make an area consistent for devices.
> - */
> -static void consistent_sync(void *vaddr, size_t size, int direction, int master_type)
> +void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
> +               size_t size, enum dma_data_direction dir)
>  {
> -       unsigned long start = (unsigned long)vaddr;
> -       unsigned long end = start + size;
> -
> -       if (master_type = FOR_CPU) {
> -               switch (direction) {
> -               case DMA_TO_DEVICE:
> -                       break;
> -               case DMA_FROM_DEVICE:
> -               case DMA_BIDIRECTIONAL:
> -                       cpu_dma_inval_range(start, end);
> -                       break;
> -               default:
> -                       BUG();
> -               }
> -       } else {
> -               /* FOR_DEVICE */
> -               switch (direction) {
> -               case DMA_FROM_DEVICE:
> -                       break;
> -               case DMA_TO_DEVICE:
> -               case DMA_BIDIRECTIONAL:
> -                       cpu_dma_wb_range(start, end);
> -                       break;
> -               default:
> -                       BUG();
> -               }
> +       void *addr = kmap_atomic_pfn(PHYS_PFN(paddr));
> +       unsigned long start = (unsigned long)addr;
> +
> +       switch (direction) {
> +       case DMA_FROM_DEVICE:
> +               break;
> +       case DMA_TO_DEVICE:
> +       case DMA_BIDIRECTIONAL:
> +               cpu_dma_wb_range(start, start + size);
> +               break;
> +       default:
> +               BUG();
>         }
> -}
>
> -static int nds32_dma_map_sg(struct device *dev, struct scatterlist *sg,
> -                           int nents, enum dma_data_direction dir,
> -                           unsigned long attrs)
> -{
> -       int i;
> -
> -       for (i = 0; i < nents; i++, sg++) {
> -               void *virt;
> -               unsigned long pfn;
> -               struct page *page = sg_page(sg);
> -
> -               sg->dma_address = sg_phys(sg);
> -               pfn = page_to_pfn(page) + sg->offset / PAGE_SIZE;
> -               page = pfn_to_page(pfn);
> -               if (PageHighMem(page)) {
> -                       virt = kmap_atomic(page);
> -                       consistent_sync(virt, sg->length, dir, FOR_CPU);
> -                       kunmap_atomic(virt);
> -               } else {
> -                       if (sg->offset > PAGE_SIZE)
> -                               panic("sg->offset:%08x > PAGE_SIZE\n",
> -                                     sg->offset);
> -                       virt = page_address(page) + sg->offset;
> -                       consistent_sync(virt, sg->length, dir, FOR_CPU);
> -               }
> -       }
> -       return nents;
> -}
> -
> -static void nds32_dma_unmap_sg(struct device *dev, struct scatterlist *sg,
> -                              int nhwentries, enum dma_data_direction dir,
> -                              unsigned long attrs)
> -{
> +       kunmap_atomic(addr);
>  }
>
> -static void
> -nds32_dma_sync_single_for_cpu(struct device *dev, dma_addr_t handle,
> -                             size_t size, enum dma_data_direction dir)
> +void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
> +               size_t size, enum dma_data_direction dir)
>  {
> -       consistent_sync((void *)phys_to_virt(handle), size, dir, FOR_CPU);
> -}
> -
> -static void
> -nds32_dma_sync_single_for_device(struct device *dev, dma_addr_t handle,
> -                                size_t size, enum dma_data_direction dir)
> -{
> -       consistent_sync((void *)phys_to_virt(handle), size, dir, FOR_DEVICE);
> -}
> -
> -static void
> -nds32_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nents,
> -                         enum dma_data_direction dir)
> -{
> -       int i;
> -
> -       for (i = 0; i < nents; i++, sg++) {
> -               char *virt > -                   page_address((struct page *)sg->page_link) + sg->offset;
> -               consistent_sync(virt, sg->length, dir, FOR_CPU);
> +       void *addr = kmap_atomic_pfn(PHYS_PFN(paddr));
> +       unsigned long start = (unsigned long)addr;
> +
> +       switch (direction) {
> +       case DMA_TO_DEVICE:
> +               break;
> +       case DMA_FROM_DEVICE:
> +       case DMA_BIDIRECTIONAL:
> +               cpu_dma_inval_range(start, end);
> +               break;
> +       default:
> +               BUG();
>         }

  CC      arch/nds32/kernel/dma.o
arch/nds32/kernel/dma.c: In function 'arch_sync_dma_for_device':
arch/nds32/kernel/dma.c:333:10: error: 'direction' undeclared (first
use in this function)
  switch (direction) {
          ^~~~~~~~~
arch/nds32/kernel/dma.c:333:10: note: each undeclared identifier is
reported only once for each function it appears in
arch/nds32/kernel/dma.c: In function 'arch_sync_dma_for_cpu':
arch/nds32/kernel/dma.c:353:10: error: 'direction' undeclared (first
use in this function)
  switch (direction) {
          ^~~~~~~~~
arch/nds32/kernel/dma.c:358:30: error: 'end' undeclared (first use in
this function)
   cpu_dma_inval_range(start, end);
                              ^~~
make[1]: *** [arch/nds32/kernel/dma.o] Error 1
make: *** [arch/nds32/kernel] Error 2

After this building error, the ftmac100.c driver is broken. Not sure
what happened.

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* [OpenRISC] [PATCH 13/22] nds32: use generic dma_noncoherent_ops
@ 2018-04-23  6:49     ` Greentime Hu
  0 siblings, 0 replies; 2593+ messages in thread
From: Greentime Hu @ 2018-04-23  6:49 UTC (permalink / raw)
  To: openrisc

2018-04-20 16:03 GMT+08:00 Christoph Hellwig <hch@lst.de>:
> Switch to the generic noncoherent direct mapping implementation.
>
> This makes sure kmap_atomic_pfn is consistently used for access to
> virtual addresses instead of either using the slower plain kmap
> or blindly expecting page_address() to work.
>
> This makes sure the cache_sync routines is called in the unmap_sg
> case, to match the unmap_single and sync_{single,sg}_to_cpu cases.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  arch/nds32/Kconfig                   |   3 +
>  arch/nds32/include/asm/Kbuild        |   1 +
>  arch/nds32/include/asm/dma-mapping.h |  14 ---
>  arch/nds32/kernel/dma.c              | 182 ++++++---------------------
>  4 files changed, 39 insertions(+), 161 deletions(-)
>  delete mode 100644 arch/nds32/include/asm/dma-mapping.h
>
> diff --git a/arch/nds32/Kconfig b/arch/nds32/Kconfig
> index 249f38d3388f..67d0ac0a989c 100644
> --- a/arch/nds32/Kconfig
> +++ b/arch/nds32/Kconfig
> @@ -5,10 +5,13 @@
>
>  config NDS32
>          def_bool y
> +       select ARCH_HAS_SYNC_DMA_FOR_CPU
> +       select ARCH_HAS_SYNC_DMA_FOR_DEVICE
>         select ARCH_WANT_FRAME_POINTERS if FTRACE
>         select CLKSRC_MMIO
>         select CLONE_BACKWARDS
>         select COMMON_CLK
> +       select DMA_NONCOHERENT_OPS
>         select GENERIC_ATOMIC64
>         select GENERIC_CPU_DEVICES
>         select GENERIC_CLOCKEVENTS
> diff --git a/arch/nds32/include/asm/Kbuild b/arch/nds32/include/asm/Kbuild
> index 06bdf8167f5a..b3e951f805f8 100644
> --- a/arch/nds32/include/asm/Kbuild
> +++ b/arch/nds32/include/asm/Kbuild
> @@ -13,6 +13,7 @@ generic-y += cputime.h
>  generic-y += device.h
>  generic-y += div64.h
>  generic-y += dma.h
> +generic-y += dma-mapping.h
>  generic-y += emergency-restart.h
>  generic-y += errno.h
>  generic-y += exec.h
> diff --git a/arch/nds32/include/asm/dma-mapping.h b/arch/nds32/include/asm/dma-mapping.h
> deleted file mode 100644
> index 2dd47d245c25..000000000000
> --- a/arch/nds32/include/asm/dma-mapping.h
> +++ /dev/null
> @@ -1,14 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0
> -// Copyright (C) 2005-2017 Andes Technology Corporation
> -
> -#ifndef ASMNDS32_DMA_MAPPING_H
> -#define ASMNDS32_DMA_MAPPING_H
> -
> -extern struct dma_map_ops nds32_dma_ops;
> -
> -static inline struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
> -{
> -       return &nds32_dma_ops;
> -}
> -
> -#endif
> diff --git a/arch/nds32/kernel/dma.c b/arch/nds32/kernel/dma.c
> index d291800fc621..688f1a03dee6 100644
> --- a/arch/nds32/kernel/dma.c
> +++ b/arch/nds32/kernel/dma.c
> @@ -3,17 +3,14 @@
>
>  #include <linux/types.h>
>  #include <linux/mm.h>
> -#include <linux/export.h>
>  #include <linux/string.h>
> -#include <linux/scatterlist.h>
> -#include <linux/dma-mapping.h>
> +#include <linux/dma-noncoherent.h>
>  #include <linux/io.h>
>  #include <linux/cache.h>
>  #include <linux/highmem.h>
>  #include <linux/slab.h>
>  #include <asm/cacheflush.h>
>  #include <asm/tlbflush.h>
> -#include <asm/dma-mapping.h>
>  #include <asm/proc-fns.h>
>
>  /*
> @@ -22,11 +19,6 @@
>  static pte_t *consistent_pte;
>  static DEFINE_RAW_SPINLOCK(consistent_lock);
>
> -enum master_type {
> -       FOR_CPU = 0,
> -       FOR_DEVICE = 1,
> -};
> -
>  /*
>   * VM region handling support.
>   *
> @@ -124,10 +116,8 @@ static struct arch_vm_region *vm_region_find(struct arch_vm_region *head,
>         return c;
>  }
>
> -/* FIXME: attrs is not used. */
> -static void *nds32_dma_alloc_coherent(struct device *dev, size_t size,
> -                                     dma_addr_t * handle, gfp_t gfp,
> -                                     unsigned long attrs)
> +void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
> +               gfp_t gfp, unsigned long attrs)
>  {
>         struct page *page;
>         struct arch_vm_region *c;
> @@ -232,8 +222,8 @@ static void *nds32_dma_alloc_coherent(struct device *dev, size_t size,
>         return NULL;
>  }
>
> -static void nds32_dma_free(struct device *dev, size_t size, void *cpu_addr,
> -                          dma_addr_t handle, unsigned long attrs)
> +void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
> +               dma_addr_t handle, unsigned long attrs)
>  {
>         struct arch_vm_region *c;
>         unsigned long flags, addr;
> @@ -333,145 +323,43 @@ static int __init consistent_init(void)
>  }
>
>  core_initcall(consistent_init);
> -static void consistent_sync(void *vaddr, size_t size, int direction, int master_type);
> -static dma_addr_t nds32_dma_map_page(struct device *dev, struct page *page,
> -                                    unsigned long offset, size_t size,
> -                                    enum dma_data_direction dir,
> -                                    unsigned long attrs)
> -{
> -       if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
> -               consistent_sync((void *)(page_address(page) + offset), size, dir, FOR_DEVICE);
> -       return page_to_phys(page) + offset;
> -}
> -
> -static void nds32_dma_unmap_page(struct device *dev, dma_addr_t handle,
> -                                size_t size, enum dma_data_direction dir,
> -                                unsigned long attrs)
> -{
> -       if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
> -               consistent_sync(phys_to_virt(handle), size, dir, FOR_CPU);
> -}
>
> -/*
> - * Make an area consistent for devices.
> - */
> -static void consistent_sync(void *vaddr, size_t size, int direction, int master_type)
> +void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
> +               size_t size, enum dma_data_direction dir)
>  {
> -       unsigned long start = (unsigned long)vaddr;
> -       unsigned long end = start + size;
> -
> -       if (master_type == FOR_CPU) {
> -               switch (direction) {
> -               case DMA_TO_DEVICE:
> -                       break;
> -               case DMA_FROM_DEVICE:
> -               case DMA_BIDIRECTIONAL:
> -                       cpu_dma_inval_range(start, end);
> -                       break;
> -               default:
> -                       BUG();
> -               }
> -       } else {
> -               /* FOR_DEVICE */
> -               switch (direction) {
> -               case DMA_FROM_DEVICE:
> -                       break;
> -               case DMA_TO_DEVICE:
> -               case DMA_BIDIRECTIONAL:
> -                       cpu_dma_wb_range(start, end);
> -                       break;
> -               default:
> -                       BUG();
> -               }
> +       void *addr = kmap_atomic_pfn(PHYS_PFN(paddr));
> +       unsigned long start = (unsigned long)addr;
> +
> +       switch (direction) {
> +       case DMA_FROM_DEVICE:
> +               break;
> +       case DMA_TO_DEVICE:
> +       case DMA_BIDIRECTIONAL:
> +               cpu_dma_wb_range(start, start + size);
> +               break;
> +       default:
> +               BUG();
>         }
> -}
>
> -static int nds32_dma_map_sg(struct device *dev, struct scatterlist *sg,
> -                           int nents, enum dma_data_direction dir,
> -                           unsigned long attrs)
> -{
> -       int i;
> -
> -       for (i = 0; i < nents; i++, sg++) {
> -               void *virt;
> -               unsigned long pfn;
> -               struct page *page = sg_page(sg);
> -
> -               sg->dma_address = sg_phys(sg);
> -               pfn = page_to_pfn(page) + sg->offset / PAGE_SIZE;
> -               page = pfn_to_page(pfn);
> -               if (PageHighMem(page)) {
> -                       virt = kmap_atomic(page);
> -                       consistent_sync(virt, sg->length, dir, FOR_CPU);
> -                       kunmap_atomic(virt);
> -               } else {
> -                       if (sg->offset > PAGE_SIZE)
> -                               panic("sg->offset:%08x > PAGE_SIZE\n",
> -                                     sg->offset);
> -                       virt = page_address(page) + sg->offset;
> -                       consistent_sync(virt, sg->length, dir, FOR_CPU);
> -               }
> -       }
> -       return nents;
> -}
> -
> -static void nds32_dma_unmap_sg(struct device *dev, struct scatterlist *sg,
> -                              int nhwentries, enum dma_data_direction dir,
> -                              unsigned long attrs)
> -{
> +       kunmap_atomic(addr);
>  }
>
> -static void
> -nds32_dma_sync_single_for_cpu(struct device *dev, dma_addr_t handle,
> -                             size_t size, enum dma_data_direction dir)
> +void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
> +               size_t size, enum dma_data_direction dir)
>  {
> -       consistent_sync((void *)phys_to_virt(handle), size, dir, FOR_CPU);
> -}
> -
> -static void
> -nds32_dma_sync_single_for_device(struct device *dev, dma_addr_t handle,
> -                                size_t size, enum dma_data_direction dir)
> -{
> -       consistent_sync((void *)phys_to_virt(handle), size, dir, FOR_DEVICE);
> -}
> -
> -static void
> -nds32_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nents,
> -                         enum dma_data_direction dir)
> -{
> -       int i;
> -
> -       for (i = 0; i < nents; i++, sg++) {
> -               char *virt =
> -                   page_address((struct page *)sg->page_link) + sg->offset;
> -               consistent_sync(virt, sg->length, dir, FOR_CPU);
> +       void *addr = kmap_atomic_pfn(PHYS_PFN(paddr));
> +       unsigned long start = (unsigned long)addr;
> +
> +       switch (direction) {
> +       case DMA_TO_DEVICE:
> +               break;
> +       case DMA_FROM_DEVICE:
> +       case DMA_BIDIRECTIONAL:
> +               cpu_dma_inval_range(start, end);
> +               break;
> +       default:
> +               BUG();
>         }

  CC      arch/nds32/kernel/dma.o
arch/nds32/kernel/dma.c: In function 'arch_sync_dma_for_device':
arch/nds32/kernel/dma.c:333:10: error: 'direction' undeclared (first
use in this function)
  switch (direction) {
          ^~~~~~~~~
arch/nds32/kernel/dma.c:333:10: note: each undeclared identifier is
reported only once for each function it appears in
arch/nds32/kernel/dma.c: In function 'arch_sync_dma_for_cpu':
arch/nds32/kernel/dma.c:353:10: error: 'direction' undeclared (first
use in this function)
  switch (direction) {
          ^~~~~~~~~
arch/nds32/kernel/dma.c:358:30: error: 'end' undeclared (first use in
this function)
   cpu_dma_inval_range(start, end);
                              ^~~
make[1]: *** [arch/nds32/kernel/dma.o] Error 1
make: *** [arch/nds32/kernel] Error 2

After this building error, the ftmac100.c driver is broken. Not sure
what happened.

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* [PATCH 13/22] nds32: use generic dma_noncoherent_ops
@ 2018-04-23  6:49     ` Greentime Hu
  0 siblings, 0 replies; 2593+ messages in thread
From: Greentime Hu @ 2018-04-23  6:49 UTC (permalink / raw)
  To: linux-arm-kernel

2018-04-20 16:03 GMT+08:00 Christoph Hellwig <hch@lst.de>:
> Switch to the generic noncoherent direct mapping implementation.
>
> This makes sure kmap_atomic_pfn is consistently used for access to
> virtual addresses instead of either using the slower plain kmap
> or blindly expecting page_address() to work.
>
> This makes sure the cache_sync routines is called in the unmap_sg
> case, to match the unmap_single and sync_{single,sg}_to_cpu cases.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  arch/nds32/Kconfig                   |   3 +
>  arch/nds32/include/asm/Kbuild        |   1 +
>  arch/nds32/include/asm/dma-mapping.h |  14 ---
>  arch/nds32/kernel/dma.c              | 182 ++++++---------------------
>  4 files changed, 39 insertions(+), 161 deletions(-)
>  delete mode 100644 arch/nds32/include/asm/dma-mapping.h
>
> diff --git a/arch/nds32/Kconfig b/arch/nds32/Kconfig
> index 249f38d3388f..67d0ac0a989c 100644
> --- a/arch/nds32/Kconfig
> +++ b/arch/nds32/Kconfig
> @@ -5,10 +5,13 @@
>
>  config NDS32
>          def_bool y
> +       select ARCH_HAS_SYNC_DMA_FOR_CPU
> +       select ARCH_HAS_SYNC_DMA_FOR_DEVICE
>         select ARCH_WANT_FRAME_POINTERS if FTRACE
>         select CLKSRC_MMIO
>         select CLONE_BACKWARDS
>         select COMMON_CLK
> +       select DMA_NONCOHERENT_OPS
>         select GENERIC_ATOMIC64
>         select GENERIC_CPU_DEVICES
>         select GENERIC_CLOCKEVENTS
> diff --git a/arch/nds32/include/asm/Kbuild b/arch/nds32/include/asm/Kbuild
> index 06bdf8167f5a..b3e951f805f8 100644
> --- a/arch/nds32/include/asm/Kbuild
> +++ b/arch/nds32/include/asm/Kbuild
> @@ -13,6 +13,7 @@ generic-y += cputime.h
>  generic-y += device.h
>  generic-y += div64.h
>  generic-y += dma.h
> +generic-y += dma-mapping.h
>  generic-y += emergency-restart.h
>  generic-y += errno.h
>  generic-y += exec.h
> diff --git a/arch/nds32/include/asm/dma-mapping.h b/arch/nds32/include/asm/dma-mapping.h
> deleted file mode 100644
> index 2dd47d245c25..000000000000
> --- a/arch/nds32/include/asm/dma-mapping.h
> +++ /dev/null
> @@ -1,14 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0
> -// Copyright (C) 2005-2017 Andes Technology Corporation
> -
> -#ifndef ASMNDS32_DMA_MAPPING_H
> -#define ASMNDS32_DMA_MAPPING_H
> -
> -extern struct dma_map_ops nds32_dma_ops;
> -
> -static inline struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
> -{
> -       return &nds32_dma_ops;
> -}
> -
> -#endif
> diff --git a/arch/nds32/kernel/dma.c b/arch/nds32/kernel/dma.c
> index d291800fc621..688f1a03dee6 100644
> --- a/arch/nds32/kernel/dma.c
> +++ b/arch/nds32/kernel/dma.c
> @@ -3,17 +3,14 @@
>
>  #include <linux/types.h>
>  #include <linux/mm.h>
> -#include <linux/export.h>
>  #include <linux/string.h>
> -#include <linux/scatterlist.h>
> -#include <linux/dma-mapping.h>
> +#include <linux/dma-noncoherent.h>
>  #include <linux/io.h>
>  #include <linux/cache.h>
>  #include <linux/highmem.h>
>  #include <linux/slab.h>
>  #include <asm/cacheflush.h>
>  #include <asm/tlbflush.h>
> -#include <asm/dma-mapping.h>
>  #include <asm/proc-fns.h>
>
>  /*
> @@ -22,11 +19,6 @@
>  static pte_t *consistent_pte;
>  static DEFINE_RAW_SPINLOCK(consistent_lock);
>
> -enum master_type {
> -       FOR_CPU = 0,
> -       FOR_DEVICE = 1,
> -};
> -
>  /*
>   * VM region handling support.
>   *
> @@ -124,10 +116,8 @@ static struct arch_vm_region *vm_region_find(struct arch_vm_region *head,
>         return c;
>  }
>
> -/* FIXME: attrs is not used. */
> -static void *nds32_dma_alloc_coherent(struct device *dev, size_t size,
> -                                     dma_addr_t * handle, gfp_t gfp,
> -                                     unsigned long attrs)
> +void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
> +               gfp_t gfp, unsigned long attrs)
>  {
>         struct page *page;
>         struct arch_vm_region *c;
> @@ -232,8 +222,8 @@ static void *nds32_dma_alloc_coherent(struct device *dev, size_t size,
>         return NULL;
>  }
>
> -static void nds32_dma_free(struct device *dev, size_t size, void *cpu_addr,
> -                          dma_addr_t handle, unsigned long attrs)
> +void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
> +               dma_addr_t handle, unsigned long attrs)
>  {
>         struct arch_vm_region *c;
>         unsigned long flags, addr;
> @@ -333,145 +323,43 @@ static int __init consistent_init(void)
>  }
>
>  core_initcall(consistent_init);
> -static void consistent_sync(void *vaddr, size_t size, int direction, int master_type);
> -static dma_addr_t nds32_dma_map_page(struct device *dev, struct page *page,
> -                                    unsigned long offset, size_t size,
> -                                    enum dma_data_direction dir,
> -                                    unsigned long attrs)
> -{
> -       if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
> -               consistent_sync((void *)(page_address(page) + offset), size, dir, FOR_DEVICE);
> -       return page_to_phys(page) + offset;
> -}
> -
> -static void nds32_dma_unmap_page(struct device *dev, dma_addr_t handle,
> -                                size_t size, enum dma_data_direction dir,
> -                                unsigned long attrs)
> -{
> -       if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
> -               consistent_sync(phys_to_virt(handle), size, dir, FOR_CPU);
> -}
>
> -/*
> - * Make an area consistent for devices.
> - */
> -static void consistent_sync(void *vaddr, size_t size, int direction, int master_type)
> +void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
> +               size_t size, enum dma_data_direction dir)
>  {
> -       unsigned long start = (unsigned long)vaddr;
> -       unsigned long end = start + size;
> -
> -       if (master_type == FOR_CPU) {
> -               switch (direction) {
> -               case DMA_TO_DEVICE:
> -                       break;
> -               case DMA_FROM_DEVICE:
> -               case DMA_BIDIRECTIONAL:
> -                       cpu_dma_inval_range(start, end);
> -                       break;
> -               default:
> -                       BUG();
> -               }
> -       } else {
> -               /* FOR_DEVICE */
> -               switch (direction) {
> -               case DMA_FROM_DEVICE:
> -                       break;
> -               case DMA_TO_DEVICE:
> -               case DMA_BIDIRECTIONAL:
> -                       cpu_dma_wb_range(start, end);
> -                       break;
> -               default:
> -                       BUG();
> -               }
> +       void *addr = kmap_atomic_pfn(PHYS_PFN(paddr));
> +       unsigned long start = (unsigned long)addr;
> +
> +       switch (direction) {
> +       case DMA_FROM_DEVICE:
> +               break;
> +       case DMA_TO_DEVICE:
> +       case DMA_BIDIRECTIONAL:
> +               cpu_dma_wb_range(start, start + size);
> +               break;
> +       default:
> +               BUG();
>         }
> -}
>
> -static int nds32_dma_map_sg(struct device *dev, struct scatterlist *sg,
> -                           int nents, enum dma_data_direction dir,
> -                           unsigned long attrs)
> -{
> -       int i;
> -
> -       for (i = 0; i < nents; i++, sg++) {
> -               void *virt;
> -               unsigned long pfn;
> -               struct page *page = sg_page(sg);
> -
> -               sg->dma_address = sg_phys(sg);
> -               pfn = page_to_pfn(page) + sg->offset / PAGE_SIZE;
> -               page = pfn_to_page(pfn);
> -               if (PageHighMem(page)) {
> -                       virt = kmap_atomic(page);
> -                       consistent_sync(virt, sg->length, dir, FOR_CPU);
> -                       kunmap_atomic(virt);
> -               } else {
> -                       if (sg->offset > PAGE_SIZE)
> -                               panic("sg->offset:%08x > PAGE_SIZE\n",
> -                                     sg->offset);
> -                       virt = page_address(page) + sg->offset;
> -                       consistent_sync(virt, sg->length, dir, FOR_CPU);
> -               }
> -       }
> -       return nents;
> -}
> -
> -static void nds32_dma_unmap_sg(struct device *dev, struct scatterlist *sg,
> -                              int nhwentries, enum dma_data_direction dir,
> -                              unsigned long attrs)
> -{
> +       kunmap_atomic(addr);
>  }
>
> -static void
> -nds32_dma_sync_single_for_cpu(struct device *dev, dma_addr_t handle,
> -                             size_t size, enum dma_data_direction dir)
> +void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
> +               size_t size, enum dma_data_direction dir)
>  {
> -       consistent_sync((void *)phys_to_virt(handle), size, dir, FOR_CPU);
> -}
> -
> -static void
> -nds32_dma_sync_single_for_device(struct device *dev, dma_addr_t handle,
> -                                size_t size, enum dma_data_direction dir)
> -{
> -       consistent_sync((void *)phys_to_virt(handle), size, dir, FOR_DEVICE);
> -}
> -
> -static void
> -nds32_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nents,
> -                         enum dma_data_direction dir)
> -{
> -       int i;
> -
> -       for (i = 0; i < nents; i++, sg++) {
> -               char *virt =
> -                   page_address((struct page *)sg->page_link) + sg->offset;
> -               consistent_sync(virt, sg->length, dir, FOR_CPU);
> +       void *addr = kmap_atomic_pfn(PHYS_PFN(paddr));
> +       unsigned long start = (unsigned long)addr;
> +
> +       switch (direction) {
> +       case DMA_TO_DEVICE:
> +               break;
> +       case DMA_FROM_DEVICE:
> +       case DMA_BIDIRECTIONAL:
> +               cpu_dma_inval_range(start, end);
> +               break;
> +       default:
> +               BUG();
>         }

  CC      arch/nds32/kernel/dma.o
arch/nds32/kernel/dma.c: In function 'arch_sync_dma_for_device':
arch/nds32/kernel/dma.c:333:10: error: 'direction' undeclared (first
use in this function)
  switch (direction) {
          ^~~~~~~~~
arch/nds32/kernel/dma.c:333:10: note: each undeclared identifier is
reported only once for each function it appears in
arch/nds32/kernel/dma.c: In function 'arch_sync_dma_for_cpu':
arch/nds32/kernel/dma.c:353:10: error: 'direction' undeclared (first
use in this function)
  switch (direction) {
          ^~~~~~~~~
arch/nds32/kernel/dma.c:358:30: error: 'end' undeclared (first use in
this function)
   cpu_dma_inval_range(start, end);
                              ^~~
make[1]: *** [arch/nds32/kernel/dma.o] Error 1
make: *** [arch/nds32/kernel] Error 2

After this building error, the ftmac100.c driver is broken. Not sure
what happened.

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* Re: [PATCH 13/22] nds32: use generic dma_noncoherent_ops
  2018-04-23  6:49     ` Greentime Hu
                       ` (3 preceding siblings ...)
  (?)
@ 2018-04-23  8:09     ` Michael Schmitz
  2018-04-23 11:03       ` Greentime Hu
  -1 siblings, 1 reply; 2593+ messages in thread
From: Michael Schmitz @ 2018-04-23  8:09 UTC (permalink / raw)
  To: Greentime Hu, Christoph Hellwig; +Cc: linux-arch

Hi

Am 23.04.2018 um 18:49 schrieb Greentime Hu:
> 2018-04-20 16:03 GMT+08:00 Christoph Hellwig <hch@lst.de>:
>> Switch to the generic noncoherent direct mapping implementation.
>>
>> This makes sure kmap_atomic_pfn is consistently used for access to
>> virtual addresses instead of either using the slower plain kmap
>> or blindly expecting page_address() to work.
>>
>> This makes sure the cache_sync routines is called in the unmap_sg
>> case, to match the unmap_single and sync_{single,sg}_to_cpu cases.
>>
>> Signed-off-by: Christoph Hellwig <hch@lst.de>
> 
>   CC      arch/nds32/kernel/dma.o
> arch/nds32/kernel/dma.c: In function 'arch_sync_dma_for_device':
> arch/nds32/kernel/dma.c:333:10: error: 'direction' undeclared (first
> use in this function)
>   switch (direction) {
>           ^~~~~~~~~
> arch/nds32/kernel/dma.c:333:10: note: each undeclared identifier is
> reported only once for each function it appears in
> arch/nds32/kernel/dma.c: In function 'arch_sync_dma_for_cpu':
> arch/nds32/kernel/dma.c:353:10: error: 'direction' undeclared (first
> use in this function)
>   switch (direction) {
>           ^~~~~~~~~
> arch/nds32/kernel/dma.c:358:30: error: 'end' undeclared (first use in
> this function)
>    cpu_dma_inval_range(start, end);
>                               ^~~
> make[1]: *** [arch/nds32/kernel/dma.o] Error 1
> make: *** [arch/nds32/kernel] Error 2
> 
> After this building error, the ftmac100.c driver is broken. Not sure
> what happened.

Christoph used 'direction' as in the original consistent_sync(), but the
parameter is now named 'dir' in the new function. Changing

+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+               size_t size, enum dma_data_direction dir)

to

+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+               size_t size, enum dma_data_direction direction)

(or using 'dir' in place of 'direction' in the switch clauses) should
fix that.

Christoph also forgot to declare and assign 'end'. Adding back the

unsigned long end = start + size;

after

+       unsigned long start = (unsigned long)addr;

should fix the second error.

If your ftmac100 driver relies on the DMA API, it wouldn't be expected
to work if kernel and module views of the DMA API disagree.

HTH,

	Michael

> --
> To unsubscribe from this list: send the line "unsubscribe linux-m68k" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* Re: [PATCH 13/22] nds32: use generic dma_noncoherent_ops
  2018-04-23  8:09     ` Michael Schmitz
@ 2018-04-23 11:03       ` Greentime Hu
  0 siblings, 0 replies; 2593+ messages in thread
From: Greentime Hu @ 2018-04-23 11:03 UTC (permalink / raw)
  To: Michael Schmitz; +Cc: Christoph Hellwig, linux-arch

2018-04-23 16:09 GMT+08:00 Michael Schmitz <schmitzmic@gmail.com>:
> Hi
>
> Am 23.04.2018 um 18:49 schrieb Greentime Hu:
>> 2018-04-20 16:03 GMT+08:00 Christoph Hellwig <hch@lst.de>:
>>> Switch to the generic noncoherent direct mapping implementation.
>>>
>>> This makes sure kmap_atomic_pfn is consistently used for access to
>>> virtual addresses instead of either using the slower plain kmap
>>> or blindly expecting page_address() to work.
>>>
>>> This makes sure the cache_sync routines is called in the unmap_sg
>>> case, to match the unmap_single and sync_{single,sg}_to_cpu cases.
>>>
>>> Signed-off-by: Christoph Hellwig <hch@lst.de>
>>
>>   CC      arch/nds32/kernel/dma.o
>> arch/nds32/kernel/dma.c: In function 'arch_sync_dma_for_device':
>> arch/nds32/kernel/dma.c:333:10: error: 'direction' undeclared (first
>> use in this function)
>>   switch (direction) {
>>           ^~~~~~~~~
>> arch/nds32/kernel/dma.c:333:10: note: each undeclared identifier is
>> reported only once for each function it appears in
>> arch/nds32/kernel/dma.c: In function 'arch_sync_dma_for_cpu':
>> arch/nds32/kernel/dma.c:353:10: error: 'direction' undeclared (first
>> use in this function)
>>   switch (direction) {
>>           ^~~~~~~~~
>> arch/nds32/kernel/dma.c:358:30: error: 'end' undeclared (first use in
>> this function)
>>    cpu_dma_inval_range(start, end);
>>                               ^~~
>> make[1]: *** [arch/nds32/kernel/dma.o] Error 1
>> make: *** [arch/nds32/kernel] Error 2
>>
>> After this building error, the ftmac100.c driver is broken. Not sure
>> what happened.
>
> Christoph used 'direction' as in the original consistent_sync(), but the
> parameter is now named 'dir' in the new function. Changing
>
> +void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
> +               size_t size, enum dma_data_direction dir)
>
> to
>
> +void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
> +               size_t size, enum dma_data_direction direction)
>
> (or using 'dir' in place of 'direction' in the switch clauses) should
> fix that.
>
> Christoph also forgot to declare and assign 'end'. Adding back the
>
> unsigned long end = start + size;
>
> after
>
> +       unsigned long start = (unsigned long)addr;
>
> should fix the second error.
>
> If your ftmac100 driver relies on the DMA API, it wouldn't be expected
> to work if kernel and module views of the DMA API disagree.
>
> HTH,
>
>         Michael
>

Hi, Micchael:

Thank you for helping fixing this build error.
What I mean before is that I fixed this build error just like what you
did and I built-in the ftmac100 driver as default in defconfig.
However the dhcpc failed, it works in Linux 4.17-rc1. I am still
debugging it. I use ftmac100 to test because it's the only driver I
can use for now and which will use DMA.

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* Re: [PATCH 01/22] dma-debug: move initialization to common code
  2018-04-20 10:23     ` Robin Murphy
                         ` (2 preceding siblings ...)
  (?)
@ 2018-04-24  7:35       ` Christoph Hellwig
  -1 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-24  7:35 UTC (permalink / raw)
  To: Robin Murphy
  Cc: Christoph Hellwig, linux-arch, linux-xtensa, Michal Simek,
	Vincent Chen, linux-c6x-dev, linux-parisc, linux-sh,
	linux-hexagon, linux-kernel, linux-m68k, openrisc, Greentime Hu,
	linux-alpha, sparclinux, nios2-dev, linux-snps-arc,
	linux-arm-kernel

On Fri, Apr 20, 2018 at 11:23:43AM +0100, Robin Murphy wrote:
>> -void dma_debug_init(u32 num_entries)
>> +static int dma_debug_init(void)
>>   {
>> +	u32 num_entries;
>
> Maybe initialise it to PREALLOC_DMA_DEBUG_ENTRIES?

We initialize it down in an if/else clause which seems a little more clear
to me, at the cost of two extra lines of code.  But I suspect I should
just go a little further and merge the global req_entries and the local
num_entries into a single variable with a better name.

>> +core_initcall(dma_debug_init);
>
> I think it's worth noting that for most users this now happens much earlier 
> than before. In general that's probably good (e.g. on arm64 it should 
> prevent false-positives from the Arm SMMU drivers under ACPI), and I can't 
> imagine it's high-risk, but it is a behaviour change.

I'll mention this in the changelog, thanks!

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* [PATCH 01/22] dma-debug: move initialization to common code
@ 2018-04-24  7:35       ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-24  7:35 UTC (permalink / raw)
  To: linux-snps-arc

On Fri, Apr 20, 2018@11:23:43AM +0100, Robin Murphy wrote:
>> -void dma_debug_init(u32 num_entries)
>> +static int dma_debug_init(void)
>>   {
>> +	u32 num_entries;
>
> Maybe initialise it to PREALLOC_DMA_DEBUG_ENTRIES?

We initialize it down in an if/else clause which seems a little more clear
to me, at the cost of two extra lines of code.  But I suspect I should
just go a little further and merge the global req_entries and the local
num_entries into a single variable with a better name.

>> +core_initcall(dma_debug_init);
>
> I think it's worth noting that for most users this now happens much earlier 
> than before. In general that's probably good (e.g. on arm64 it should 
> prevent false-positives from the Arm SMMU drivers under ACPI), and I can't 
> imagine it's high-risk, but it is a behaviour change.

I'll mention this in the changelog, thanks!

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* Re: [PATCH 01/22] dma-debug: move initialization to common code
@ 2018-04-24  7:35       ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-24  7:35 UTC (permalink / raw)
  To: Robin Murphy
  Cc: Christoph Hellwig, linux-arch, linux-xtensa, Michal Simek,
	Vincent Chen, linux-c6x-dev, linux-parisc, linux-sh,
	linux-hexagon, linux-kernel, linux-m68k, openrisc, Greentime Hu,
	linux-alpha, sparclinux, nios2-dev, linux-snps-arc,
	linux-arm-kernel

On Fri, Apr 20, 2018 at 11:23:43AM +0100, Robin Murphy wrote:
>> -void dma_debug_init(u32 num_entries)
>> +static int dma_debug_init(void)
>>   {
>> +	u32 num_entries;
>
> Maybe initialise it to PREALLOC_DMA_DEBUG_ENTRIES?

We initialize it down in an if/else clause which seems a little more clear
to me, at the cost of two extra lines of code.  But I suspect I should
just go a little further and merge the global req_entries and the local
num_entries into a single variable with a better name.

>> +core_initcall(dma_debug_init);
>
> I think it's worth noting that for most users this now happens much earlier 
> than before. In general that's probably good (e.g. on arm64 it should 
> prevent false-positives from the Arm SMMU drivers under ACPI), and I can't 
> imagine it's high-risk, but it is a behaviour change.

I'll mention this in the changelog, thanks!

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* [OpenRISC] [PATCH 01/22] dma-debug: move initialization to common code
@ 2018-04-24  7:35       ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-24  7:35 UTC (permalink / raw)
  To: openrisc

On Fri, Apr 20, 2018 at 11:23:43AM +0100, Robin Murphy wrote:
>> -void dma_debug_init(u32 num_entries)
>> +static int dma_debug_init(void)
>>   {
>> +	u32 num_entries;
>
> Maybe initialise it to PREALLOC_DMA_DEBUG_ENTRIES?

We initialize it down in an if/else clause which seems a little more clear
to me, at the cost of two extra lines of code.  But I suspect I should
just go a little further and merge the global req_entries and the local
num_entries into a single variable with a better name.

>> +core_initcall(dma_debug_init);
>
> I think it's worth noting that for most users this now happens much earlier 
> than before. In general that's probably good (e.g. on arm64 it should 
> prevent false-positives from the Arm SMMU drivers under ACPI), and I can't 
> imagine it's high-risk, but it is a behaviour change.

I'll mention this in the changelog, thanks!

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* [PATCH 01/22] dma-debug: move initialization to common code
@ 2018-04-24  7:35       ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-24  7:35 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Apr 20, 2018 at 11:23:43AM +0100, Robin Murphy wrote:
>> -void dma_debug_init(u32 num_entries)
>> +static int dma_debug_init(void)
>>   {
>> +	u32 num_entries;
>
> Maybe initialise it to PREALLOC_DMA_DEBUG_ENTRIES?

We initialize it down in an if/else clause which seems a little more clear
to me, at the cost of two extra lines of code.  But I suspect I should
just go a little further and merge the global req_entries and the local
num_entries into a single variable with a better name.

>> +core_initcall(dma_debug_init);
>
> I think it's worth noting that for most users this now happens much earlier 
> than before. In general that's probably good (e.g. on arm64 it should 
> prevent false-positives from the Arm SMMU drivers under ACPI), and I can't 
> imagine it's high-risk, but it is a behaviour change.

I'll mention this in the changelog, thanks!

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* Re: [PATCH 22/22] parisc: use generic dma_noncoherent_ops
  2018-04-21 21:42     ` James Bottomley
                         ` (2 preceding siblings ...)
  (?)
@ 2018-04-24  8:20       ` Christoph Hellwig
  -1 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-24  8:20 UTC (permalink / raw)
  To: James Bottomley
  Cc: Christoph Hellwig, linux-arch, Michal Simek, Greentime Hu,
	Vincent Chen, linux-alpha, linux-snps-arc, linux-arm-kernel,
	linux-c6x-dev, linux-hexagon, linux-m68k, nios2-dev, openrisc,
	linux-parisc, linux-sh, sparclinux, linux-xtensa, linux-kernel

On Sat, Apr 21, 2018 at 10:42:47PM +0100, James Bottomley wrote:
> Well, this is wrong: you just made every 32 bit parisc system
> unnecessarily use non-coherent.  We actually only have a small small
> set of non-coherent systems.  The pxcs and pcxt systems (which are
> about 99% of the user base) can use coherent dma ops.  The problem
> seems to be in your new world you only have one dma_noncoherent_ops
> pointer ... we definitely need two on parisc, so whether
> arch_dma_cache_sync is present or not needs to be dynamic not config
> defined.

The changelog explicitly mentions merging the two noncoherent
implementations, they only differ in the alloc and free callsbacks,
and we now runtime switch between them.  Before the pcxs and pcxt
cases used pcx_dma_ops, and pcxl and pxcl2 used pcxl_dma_ops, now
all four use dma_noncoherent_ops and arch_dma_alloc/arch_dma_free
branch out to different behavior.

Both pcx_dma_ops and pcxl_dma_ops do define the cache_sync
method in the existing code, so that isn't the issue.

I'll take a deeper look at what sort of behavior change might have
been introduced.

> 
> James
---end quoted text---

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* [PATCH 22/22] parisc: use generic dma_noncoherent_ops
@ 2018-04-24  8:20       ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-24  8:20 UTC (permalink / raw)
  To: linux-snps-arc

On Sat, Apr 21, 2018@10:42:47PM +0100, James Bottomley wrote:
> Well, this is wrong: you just made every 32 bit parisc system
> unnecessarily use non-coherent.  We actually only have a small small
> set of non-coherent systems.  The pxcs and pcxt systems (which are
> about 99% of the user base) can use coherent dma ops.  The problem
> seems to be in your new world you only have one dma_noncoherent_ops
> pointer ... we definitely need two on parisc, so whether
> arch_dma_cache_sync is present or not needs to be dynamic not config
> defined.

The changelog explicitly mentions merging the two noncoherent
implementations, they only differ in the alloc and free callsbacks,
and we now runtime switch between them.  Before the pcxs and pcxt
cases used pcx_dma_ops, and pcxl and pxcl2 used pcxl_dma_ops, now
all four use dma_noncoherent_ops and arch_dma_alloc/arch_dma_free
branch out to different behavior.

Both pcx_dma_ops and pcxl_dma_ops do define the cache_sync
method in the existing code, so that isn't the issue.

I'll take a deeper look at what sort of behavior change might have
been introduced.

> 
> James
---end quoted text---

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* Re: [PATCH 22/22] parisc: use generic dma_noncoherent_ops
@ 2018-04-24  8:20       ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-24  8:20 UTC (permalink / raw)
  To: James Bottomley
  Cc: Christoph Hellwig, linux-arch, Michal Simek, Greentime Hu,
	Vincent Chen, linux-alpha, linux-snps-arc, linux-arm-kernel,
	linux-c6x-dev, linux-hexagon, linux-m68k, nios2-dev, openrisc,
	linux-parisc, linux-sh, sparclinux, linux-xtensa, linux-kernel

On Sat, Apr 21, 2018 at 10:42:47PM +0100, James Bottomley wrote:
> Well, this is wrong: you just made every 32 bit parisc system
> unnecessarily use non-coherent.  We actually only have a small small
> set of non-coherent systems.  The pxcs and pcxt systems (which are
> about 99% of the user base) can use coherent dma ops.  The problem
> seems to be in your new world you only have one dma_noncoherent_ops
> pointer ... we definitely need two on parisc, so whether
> arch_dma_cache_sync is present or not needs to be dynamic not config
> defined.

The changelog explicitly mentions merging the two noncoherent
implementations, they only differ in the alloc and free callsbacks,
and we now runtime switch between them.  Before the pcxs and pcxt
cases used pcx_dma_ops, and pcxl and pxcl2 used pcxl_dma_ops, now
all four use dma_noncoherent_ops and arch_dma_alloc/arch_dma_free
branch out to different behavior.

Both pcx_dma_ops and pcxl_dma_ops do define the cache_sync
method in the existing code, so that isn't the issue.

I'll take a deeper look at what sort of behavior change might have
been introduced.

> 
> James
---end quoted text---

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* [OpenRISC] [PATCH 22/22] parisc: use generic dma_noncoherent_ops
@ 2018-04-24  8:20       ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-24  8:20 UTC (permalink / raw)
  To: openrisc

On Sat, Apr 21, 2018 at 10:42:47PM +0100, James Bottomley wrote:
> Well, this is wrong: you just made every 32 bit parisc system
> unnecessarily use non-coherent.  We actually only have a small small
> set of non-coherent systems.  The pxcs and pcxt systems (which are
> about 99% of the user base) can use coherent dma ops.  The problem
> seems to be in your new world you only have one dma_noncoherent_ops
> pointer ... we definitely need two on parisc, so whether
> arch_dma_cache_sync is present or not needs to be dynamic not config
> defined.

The changelog explicitly mentions merging the two noncoherent
implementations, they only differ in the alloc and free callsbacks,
and we now runtime switch between them.  Before the pcxs and pcxt
cases used pcx_dma_ops, and pcxl and pxcl2 used pcxl_dma_ops, now
all four use dma_noncoherent_ops and arch_dma_alloc/arch_dma_free
branch out to different behavior.

Both pcx_dma_ops and pcxl_dma_ops do define the cache_sync
method in the existing code, so that isn't the issue.

I'll take a deeper look at what sort of behavior change might have
been introduced.

> 
> James
---end quoted text---

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* [PATCH 22/22] parisc: use generic dma_noncoherent_ops
@ 2018-04-24  8:20       ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-24  8:20 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, Apr 21, 2018 at 10:42:47PM +0100, James Bottomley wrote:
> Well, this is wrong: you just made every 32 bit parisc system
> unnecessarily use non-coherent.  We actually only have a small small
> set of non-coherent systems.  The pxcs and pcxt systems (which are
> about 99% of the user base) can use coherent dma ops.  The problem
> seems to be in your new world you only have one dma_noncoherent_ops
> pointer ... we definitely need two on parisc, so whether
> arch_dma_cache_sync is present or not needs to be dynamic not config
> defined.

The changelog explicitly mentions merging the two noncoherent
implementations, they only differ in the alloc and free callsbacks,
and we now runtime switch between them.  Before the pcxs and pcxt
cases used pcx_dma_ops, and pcxl and pxcl2 used pcxl_dma_ops, now
all four use dma_noncoherent_ops and arch_dma_alloc/arch_dma_free
branch out to different behavior.

Both pcx_dma_ops and pcxl_dma_ops do define the cache_sync
method in the existing code, so that isn't the issue.

I'll take a deeper look at what sort of behavior change might have
been introduced.

> 
> James
---end quoted text---

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* Re: [PATCH 13/22] nds32: use generic dma_noncoherent_ops
  2018-04-23  6:49     ` Greentime Hu
                         ` (2 preceding siblings ...)
  (?)
@ 2018-04-24 19:16       ` Christoph Hellwig
  -1 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-24 19:16 UTC (permalink / raw)
  To: Greentime Hu
  Cc: Christoph Hellwig, linux-arch, Michal Simek, Vincent Chen,
	linux-alpha, linux-snps-arc, linux-arm-kernel, linux-c6x-dev,
	linux-hexagon, linux-m68k, nios2-dev, openrisc, linux-parisc,
	linux-sh, sparclinux, linux-xtensa, Linux Kernel Mailing List

Hi Greentime,

thanks for testing the patch!

It looks like nds32 doesn't have a buildbot yet, so this code didn't
even get syntax checkin, sorry.

Below is the incremental fixes based on this thread.

Can you check if my tree works if you just revert the
"nds32: use generic dma_noncoherent_ops" commit?

diff --git a/arch/nds32/kernel/dma.c b/arch/nds32/kernel/dma.c
index 688f1a03dee6..48018275e7f4 100644
--- a/arch/nds32/kernel/dma.c
+++ b/arch/nds32/kernel/dma.c
@@ -330,7 +330,7 @@ void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
 	void *addr = kmap_atomic_pfn(PHYS_PFN(paddr));
 	unsigned long start = (unsigned long)addr;
 
-	switch (direction) {
+	switch (dir) {
 	case DMA_FROM_DEVICE:
 		break;
 	case DMA_TO_DEVICE:
@@ -350,12 +350,12 @@ void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
 	void *addr = kmap_atomic_pfn(PHYS_PFN(paddr));
 	unsigned long start = (unsigned long)addr;
 
-	switch (direction) {
+	switch (dir) {
 	case DMA_TO_DEVICE:
 		break;
 	case DMA_FROM_DEVICE:
 	case DMA_BIDIRECTIONAL:
-		cpu_dma_inval_range(start, end);
+		cpu_dma_inval_range(start, start + size);
 		break;
 	default:
 		BUG();

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 13/22] nds32: use generic dma_noncoherent_ops
@ 2018-04-24 19:16       ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-24 19:16 UTC (permalink / raw)
  To: linux-snps-arc

Hi Greentime,

thanks for testing the patch!

It looks like nds32 doesn't have a buildbot yet, so this code didn't
even get syntax checkin, sorry.

Below is the incremental fixes based on this thread.

Can you check if my tree works if you just revert the
"nds32: use generic dma_noncoherent_ops" commit?

diff --git a/arch/nds32/kernel/dma.c b/arch/nds32/kernel/dma.c
index 688f1a03dee6..48018275e7f4 100644
--- a/arch/nds32/kernel/dma.c
+++ b/arch/nds32/kernel/dma.c
@@ -330,7 +330,7 @@ void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
 	void *addr = kmap_atomic_pfn(PHYS_PFN(paddr));
 	unsigned long start = (unsigned long)addr;
 
-	switch (direction) {
+	switch (dir) {
 	case DMA_FROM_DEVICE:
 		break;
 	case DMA_TO_DEVICE:
@@ -350,12 +350,12 @@ void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
 	void *addr = kmap_atomic_pfn(PHYS_PFN(paddr));
 	unsigned long start = (unsigned long)addr;
 
-	switch (direction) {
+	switch (dir) {
 	case DMA_TO_DEVICE:
 		break;
 	case DMA_FROM_DEVICE:
 	case DMA_BIDIRECTIONAL:
-		cpu_dma_inval_range(start, end);
+		cpu_dma_inval_range(start, start + size);
 		break;
 	default:
 		BUG();

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* Re: [PATCH 13/22] nds32: use generic dma_noncoherent_ops
@ 2018-04-24 19:16       ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-24 19:16 UTC (permalink / raw)
  To: Greentime Hu
  Cc: Christoph Hellwig, linux-arch, Michal Simek, Vincent Chen,
	linux-alpha, linux-snps-arc, linux-arm-kernel, linux-c6x-dev,
	linux-hexagon, linux-m68k, nios2-dev, openrisc, linux-parisc,
	linux-sh, sparclinux, linux-xtensa, Linux Kernel Mailing List

Hi Greentime,

thanks for testing the patch!

It looks like nds32 doesn't have a buildbot yet, so this code didn't
even get syntax checkin, sorry.

Below is the incremental fixes based on this thread.

Can you check if my tree works if you just revert the
"nds32: use generic dma_noncoherent_ops" commit?

diff --git a/arch/nds32/kernel/dma.c b/arch/nds32/kernel/dma.c
index 688f1a03dee6..48018275e7f4 100644
--- a/arch/nds32/kernel/dma.c
+++ b/arch/nds32/kernel/dma.c
@@ -330,7 +330,7 @@ void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
 	void *addr = kmap_atomic_pfn(PHYS_PFN(paddr));
 	unsigned long start = (unsigned long)addr;
 
-	switch (direction) {
+	switch (dir) {
 	case DMA_FROM_DEVICE:
 		break;
 	case DMA_TO_DEVICE:
@@ -350,12 +350,12 @@ void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
 	void *addr = kmap_atomic_pfn(PHYS_PFN(paddr));
 	unsigned long start = (unsigned long)addr;
 
-	switch (direction) {
+	switch (dir) {
 	case DMA_TO_DEVICE:
 		break;
 	case DMA_FROM_DEVICE:
 	case DMA_BIDIRECTIONAL:
-		cpu_dma_inval_range(start, end);
+		cpu_dma_inval_range(start, start + size);
 		break;
 	default:
 		BUG();

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [OpenRISC] [PATCH 13/22] nds32: use generic dma_noncoherent_ops
@ 2018-04-24 19:16       ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-24 19:16 UTC (permalink / raw)
  To: openrisc

Hi Greentime,

thanks for testing the patch!

It looks like nds32 doesn't have a buildbot yet, so this code didn't
even get syntax checkin, sorry.

Below is the incremental fixes based on this thread.

Can you check if my tree works if you just revert the
"nds32: use generic dma_noncoherent_ops" commit?

diff --git a/arch/nds32/kernel/dma.c b/arch/nds32/kernel/dma.c
index 688f1a03dee6..48018275e7f4 100644
--- a/arch/nds32/kernel/dma.c
+++ b/arch/nds32/kernel/dma.c
@@ -330,7 +330,7 @@ void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
 	void *addr = kmap_atomic_pfn(PHYS_PFN(paddr));
 	unsigned long start = (unsigned long)addr;
 
-	switch (direction) {
+	switch (dir) {
 	case DMA_FROM_DEVICE:
 		break;
 	case DMA_TO_DEVICE:
@@ -350,12 +350,12 @@ void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
 	void *addr = kmap_atomic_pfn(PHYS_PFN(paddr));
 	unsigned long start = (unsigned long)addr;
 
-	switch (direction) {
+	switch (dir) {
 	case DMA_TO_DEVICE:
 		break;
 	case DMA_FROM_DEVICE:
 	case DMA_BIDIRECTIONAL:
-		cpu_dma_inval_range(start, end);
+		cpu_dma_inval_range(start, start + size);
 		break;
 	default:
 		BUG();

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 13/22] nds32: use generic dma_noncoherent_ops
@ 2018-04-24 19:16       ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-24 19:16 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Greentime,

thanks for testing the patch!

It looks like nds32 doesn't have a buildbot yet, so this code didn't
even get syntax checkin, sorry.

Below is the incremental fixes based on this thread.

Can you check if my tree works if you just revert the
"nds32: use generic dma_noncoherent_ops" commit?

diff --git a/arch/nds32/kernel/dma.c b/arch/nds32/kernel/dma.c
index 688f1a03dee6..48018275e7f4 100644
--- a/arch/nds32/kernel/dma.c
+++ b/arch/nds32/kernel/dma.c
@@ -330,7 +330,7 @@ void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
 	void *addr = kmap_atomic_pfn(PHYS_PFN(paddr));
 	unsigned long start = (unsigned long)addr;
 
-	switch (direction) {
+	switch (dir) {
 	case DMA_FROM_DEVICE:
 		break;
 	case DMA_TO_DEVICE:
@@ -350,12 +350,12 @@ void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
 	void *addr = kmap_atomic_pfn(PHYS_PFN(paddr));
 	unsigned long start = (unsigned long)addr;
 
-	switch (direction) {
+	switch (dir) {
 	case DMA_TO_DEVICE:
 		break;
 	case DMA_FROM_DEVICE:
 	case DMA_BIDIRECTIONAL:
-		cpu_dma_inval_range(start, end);
+		cpu_dma_inval_range(start, start + size);
 		break;
 	default:
 		BUG();

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* Re: [PATCH 13/22] nds32: use generic dma_noncoherent_ops
  2018-04-24 19:16       ` Christoph Hellwig
                           ` (2 preceding siblings ...)
  (?)
@ 2018-04-25  1:43         ` Greentime Hu
  -1 siblings, 0 replies; 2593+ messages in thread
From: Greentime Hu @ 2018-04-25  1:43 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-arch, Michal Simek, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, Linux Kernel Mailing List

2018-04-25 3:16 GMT+08:00 Christoph Hellwig <hch@lst.de>:
> Hi Greentime,
>
> thanks for testing the patch!
>
> It looks like nds32 doesn't have a buildbot yet, so this code didn't
> even get syntax checkin, sorry.
>
> Below is the incremental fixes based on this thread.
>
> Can you check if my tree works if you just revert the
> "nds32: use generic dma_noncoherent_ops" commit?
>
> diff --git a/arch/nds32/kernel/dma.c b/arch/nds32/kernel/dma.c
> index 688f1a03dee6..48018275e7f4 100644
> --- a/arch/nds32/kernel/dma.c
> +++ b/arch/nds32/kernel/dma.c
> @@ -330,7 +330,7 @@ void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
>         void *addr = kmap_atomic_pfn(PHYS_PFN(paddr));
>         unsigned long start = (unsigned long)addr;
>
> -       switch (direction) {
> +       switch (dir) {
>         case DMA_FROM_DEVICE:
>                 break;
>         case DMA_TO_DEVICE:
> @@ -350,12 +350,12 @@ void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
>         void *addr = kmap_atomic_pfn(PHYS_PFN(paddr));
>         unsigned long start = (unsigned long)addr;
>
> -       switch (direction) {
> +       switch (dir) {
>         case DMA_TO_DEVICE:
>                 break;
>         case DMA_FROM_DEVICE:
>         case DMA_BIDIRECTIONAL:
> -               cpu_dma_inval_range(start, end);
> +               cpu_dma_inval_range(start, start + size);
>                 break;
>         default:
>                 BUG();

Hi Crhistoph,

The ftmac100 works if I revert this commit.

commit de46b9ba5298aafc47284735a4f21baa8e4ed4b7
Author: Greentime Hu <greentime@andestech.com>
Date:   Wed Apr 25 09:33:51 2018 +0800

    Revert "nds32: use generic dma_noncoherent_ops"

    This reverts commit 0489ce952072e7542456e0d962437062916ce0df.

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* [PATCH 13/22] nds32: use generic dma_noncoherent_ops
@ 2018-04-25  1:43         ` Greentime Hu
  0 siblings, 0 replies; 2593+ messages in thread
From: Greentime Hu @ 2018-04-25  1:43 UTC (permalink / raw)
  To: linux-snps-arc

2018-04-25 3:16 GMT+08:00 Christoph Hellwig <hch at lst.de>:
> Hi Greentime,
>
> thanks for testing the patch!
>
> It looks like nds32 doesn't have a buildbot yet, so this code didn't
> even get syntax checkin, sorry.
>
> Below is the incremental fixes based on this thread.
>
> Can you check if my tree works if you just revert the
> "nds32: use generic dma_noncoherent_ops" commit?
>
> diff --git a/arch/nds32/kernel/dma.c b/arch/nds32/kernel/dma.c
> index 688f1a03dee6..48018275e7f4 100644
> --- a/arch/nds32/kernel/dma.c
> +++ b/arch/nds32/kernel/dma.c
> @@ -330,7 +330,7 @@ void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
>         void *addr = kmap_atomic_pfn(PHYS_PFN(paddr));
>         unsigned long start = (unsigned long)addr;
>
> -       switch (direction) {
> +       switch (dir) {
>         case DMA_FROM_DEVICE:
>                 break;
>         case DMA_TO_DEVICE:
> @@ -350,12 +350,12 @@ void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
>         void *addr = kmap_atomic_pfn(PHYS_PFN(paddr));
>         unsigned long start = (unsigned long)addr;
>
> -       switch (direction) {
> +       switch (dir) {
>         case DMA_TO_DEVICE:
>                 break;
>         case DMA_FROM_DEVICE:
>         case DMA_BIDIRECTIONAL:
> -               cpu_dma_inval_range(start, end);
> +               cpu_dma_inval_range(start, start + size);
>                 break;
>         default:
>                 BUG();

Hi Crhistoph,

The ftmac100 works if I revert this commit.

commit de46b9ba5298aafc47284735a4f21baa8e4ed4b7
Author: Greentime Hu <greentime at andestech.com>
Date:   Wed Apr 25 09:33:51 2018 +0800

    Revert "nds32: use generic dma_noncoherent_ops"

    This reverts commit 0489ce952072e7542456e0d962437062916ce0df.

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* Re: [PATCH 13/22] nds32: use generic dma_noncoherent_ops
@ 2018-04-25  1:43         ` Greentime Hu
  0 siblings, 0 replies; 2593+ messages in thread
From: Greentime Hu @ 2018-04-25  1:43 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-arch, Michal Simek, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, Linux Kernel Mailing List

2018-04-25 3:16 GMT+08:00 Christoph Hellwig <hch@lst.de>:
> Hi Greentime,
>
> thanks for testing the patch!
>
> It looks like nds32 doesn't have a buildbot yet, so this code didn't
> even get syntax checkin, sorry.
>
> Below is the incremental fixes based on this thread.
>
> Can you check if my tree works if you just revert the
> "nds32: use generic dma_noncoherent_ops" commit?
>
> diff --git a/arch/nds32/kernel/dma.c b/arch/nds32/kernel/dma.c
> index 688f1a03dee6..48018275e7f4 100644
> --- a/arch/nds32/kernel/dma.c
> +++ b/arch/nds32/kernel/dma.c
> @@ -330,7 +330,7 @@ void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
>         void *addr = kmap_atomic_pfn(PHYS_PFN(paddr));
>         unsigned long start = (unsigned long)addr;
>
> -       switch (direction) {
> +       switch (dir) {
>         case DMA_FROM_DEVICE:
>                 break;
>         case DMA_TO_DEVICE:
> @@ -350,12 +350,12 @@ void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
>         void *addr = kmap_atomic_pfn(PHYS_PFN(paddr));
>         unsigned long start = (unsigned long)addr;
>
> -       switch (direction) {
> +       switch (dir) {
>         case DMA_TO_DEVICE:
>                 break;
>         case DMA_FROM_DEVICE:
>         case DMA_BIDIRECTIONAL:
> -               cpu_dma_inval_range(start, end);
> +               cpu_dma_inval_range(start, start + size);
>                 break;
>         default:
>                 BUG();

Hi Crhistoph,

The ftmac100 works if I revert this commit.

commit de46b9ba5298aafc47284735a4f21baa8e4ed4b7
Author: Greentime Hu <greentime@andestech.com>
Date:   Wed Apr 25 09:33:51 2018 +0800

    Revert "nds32: use generic dma_noncoherent_ops"

    This reverts commit 0489ce952072e7542456e0d962437062916ce0df.

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* [OpenRISC] [PATCH 13/22] nds32: use generic dma_noncoherent_ops
@ 2018-04-25  1:43         ` Greentime Hu
  0 siblings, 0 replies; 2593+ messages in thread
From: Greentime Hu @ 2018-04-25  1:43 UTC (permalink / raw)
  To: openrisc

2018-04-25 3:16 GMT+08:00 Christoph Hellwig <hch@lst.de>:
> Hi Greentime,
>
> thanks for testing the patch!
>
> It looks like nds32 doesn't have a buildbot yet, so this code didn't
> even get syntax checkin, sorry.
>
> Below is the incremental fixes based on this thread.
>
> Can you check if my tree works if you just revert the
> "nds32: use generic dma_noncoherent_ops" commit?
>
> diff --git a/arch/nds32/kernel/dma.c b/arch/nds32/kernel/dma.c
> index 688f1a03dee6..48018275e7f4 100644
> --- a/arch/nds32/kernel/dma.c
> +++ b/arch/nds32/kernel/dma.c
> @@ -330,7 +330,7 @@ void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
>         void *addr = kmap_atomic_pfn(PHYS_PFN(paddr));
>         unsigned long start = (unsigned long)addr;
>
> -       switch (direction) {
> +       switch (dir) {
>         case DMA_FROM_DEVICE:
>                 break;
>         case DMA_TO_DEVICE:
> @@ -350,12 +350,12 @@ void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
>         void *addr = kmap_atomic_pfn(PHYS_PFN(paddr));
>         unsigned long start = (unsigned long)addr;
>
> -       switch (direction) {
> +       switch (dir) {
>         case DMA_TO_DEVICE:
>                 break;
>         case DMA_FROM_DEVICE:
>         case DMA_BIDIRECTIONAL:
> -               cpu_dma_inval_range(start, end);
> +               cpu_dma_inval_range(start, start + size);
>                 break;
>         default:
>                 BUG();

Hi Crhistoph,

The ftmac100 works if I revert this commit.

commit de46b9ba5298aafc47284735a4f21baa8e4ed4b7
Author: Greentime Hu <greentime@andestech.com>
Date:   Wed Apr 25 09:33:51 2018 +0800

    Revert "nds32: use generic dma_noncoherent_ops"

    This reverts commit 0489ce952072e7542456e0d962437062916ce0df.

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* [PATCH 13/22] nds32: use generic dma_noncoherent_ops
@ 2018-04-25  1:43         ` Greentime Hu
  0 siblings, 0 replies; 2593+ messages in thread
From: Greentime Hu @ 2018-04-25  1:43 UTC (permalink / raw)
  To: linux-arm-kernel

2018-04-25 3:16 GMT+08:00 Christoph Hellwig <hch@lst.de>:
> Hi Greentime,
>
> thanks for testing the patch!
>
> It looks like nds32 doesn't have a buildbot yet, so this code didn't
> even get syntax checkin, sorry.
>
> Below is the incremental fixes based on this thread.
>
> Can you check if my tree works if you just revert the
> "nds32: use generic dma_noncoherent_ops" commit?
>
> diff --git a/arch/nds32/kernel/dma.c b/arch/nds32/kernel/dma.c
> index 688f1a03dee6..48018275e7f4 100644
> --- a/arch/nds32/kernel/dma.c
> +++ b/arch/nds32/kernel/dma.c
> @@ -330,7 +330,7 @@ void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
>         void *addr = kmap_atomic_pfn(PHYS_PFN(paddr));
>         unsigned long start = (unsigned long)addr;
>
> -       switch (direction) {
> +       switch (dir) {
>         case DMA_FROM_DEVICE:
>                 break;
>         case DMA_TO_DEVICE:
> @@ -350,12 +350,12 @@ void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
>         void *addr = kmap_atomic_pfn(PHYS_PFN(paddr));
>         unsigned long start = (unsigned long)addr;
>
> -       switch (direction) {
> +       switch (dir) {
>         case DMA_TO_DEVICE:
>                 break;
>         case DMA_FROM_DEVICE:
>         case DMA_BIDIRECTIONAL:
> -               cpu_dma_inval_range(start, end);
> +               cpu_dma_inval_range(start, start + size);
>                 break;
>         default:
>                 BUG();

Hi Crhistoph,

The ftmac100 works if I revert this commit.

commit de46b9ba5298aafc47284735a4f21baa8e4ed4b7
Author: Greentime Hu <greentime@andestech.com>
Date:   Wed Apr 25 09:33:51 2018 +0800

    Revert "nds32: use generic dma_noncoherent_ops"

    This reverts commit 0489ce952072e7542456e0d962437062916ce0df.

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* Re: [PATCH 13/22] nds32: use generic dma_noncoherent_ops
@ 2018-04-25  6:40           ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-25  6:40 UTC (permalink / raw)
  To: Greentime Hu
  Cc: Christoph Hellwig, linux-arch, Michal Simek, Vincent Chen,
	linux-alpha, linux-snps-arc, linux-arm-kernel, linux-c6x-dev,
	linux-hexagon, linux-m68k, nios2-dev, openrisc, linux-parisc,
	linux-sh, sparclinux, linux-xtensa, Linux Kernel Mailing List

On Wed, Apr 25, 2018 at 09:43:43AM +0800, Greentime Hu wrote:
> Hi Crhistoph,
> 
> The ftmac100 works if I revert this commit.

Thanks.  ftmac100 only use dma_map_page, which in the old nds32 code
is just doing a plain page_address and never kmaps.  Can you apply
the patch below on the tree with the origin "nds32: use generic
dma_noncoherent_ops" reverted?  This always just uses page_address,
although that, just like the original code is broken if you actually
have highmem that needs to be mapped:

---
From 1dc5d1cae4cd7b9ce03d0e2943364ed4cca938d7 Mon Sep 17 00:00:00 2001
From: Christoph Hellwig <hch@lst.de>
Date: Mon, 16 Apr 2018 19:20:30 +0200
Subject: nds32: use generic dma_noncoherent_ops

Switch to the generic noncoherent direct mapping implementation.

This makes sure the cache_sync routines is called in the unmap_sg
case, to match the unmap_single and sync_{single,sg}_to_cpu cases.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/nds32/Kconfig                   |   3 +
 arch/nds32/include/asm/Kbuild        |   1 +
 arch/nds32/include/asm/dma-mapping.h |  14 ---
 arch/nds32/kernel/dma.c              | 182 +++++----------------------
 4 files changed, 37 insertions(+), 163 deletions(-)
 delete mode 100644 arch/nds32/include/asm/dma-mapping.h

diff --git a/arch/nds32/Kconfig b/arch/nds32/Kconfig
index 249f38d3388f..67d0ac0a989c 100644
--- a/arch/nds32/Kconfig
+++ b/arch/nds32/Kconfig
@@ -5,10 +5,13 @@
 
 config NDS32
         def_bool y
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select ARCH_WANT_FRAME_POINTERS if FTRACE
 	select CLKSRC_MMIO
 	select CLONE_BACKWARDS
 	select COMMON_CLK
+	select DMA_NONCOHERENT_OPS
 	select GENERIC_ATOMIC64
 	select GENERIC_CPU_DEVICES
 	select GENERIC_CLOCKEVENTS
diff --git a/arch/nds32/include/asm/Kbuild b/arch/nds32/include/asm/Kbuild
index 06bdf8167f5a..b3e951f805f8 100644
--- a/arch/nds32/include/asm/Kbuild
+++ b/arch/nds32/include/asm/Kbuild
@@ -13,6 +13,7 @@ generic-y += cputime.h
 generic-y += device.h
 generic-y += div64.h
 generic-y += dma.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += errno.h
 generic-y += exec.h
diff --git a/arch/nds32/include/asm/dma-mapping.h b/arch/nds32/include/asm/dma-mapping.h
deleted file mode 100644
index 2dd47d245c25..000000000000
--- a/arch/nds32/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,14 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-// Copyright (C) 2005-2017 Andes Technology Corporation
-
-#ifndef ASMNDS32_DMA_MAPPING_H
-#define ASMNDS32_DMA_MAPPING_H
-
-extern struct dma_map_ops nds32_dma_ops;
-
-static inline struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return &nds32_dma_ops;
-}
-
-#endif
diff --git a/arch/nds32/kernel/dma.c b/arch/nds32/kernel/dma.c
index d291800fc621..78311a1e6fd1 100644
--- a/arch/nds32/kernel/dma.c
+++ b/arch/nds32/kernel/dma.c
@@ -3,17 +3,14 @@
 
 #include <linux/types.h>
 #include <linux/mm.h>
-#include <linux/export.h>
 #include <linux/string.h>
-#include <linux/scatterlist.h>
-#include <linux/dma-mapping.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/io.h>
 #include <linux/cache.h>
 #include <linux/highmem.h>
 #include <linux/slab.h>
 #include <asm/cacheflush.h>
 #include <asm/tlbflush.h>
-#include <asm/dma-mapping.h>
 #include <asm/proc-fns.h>
 
 /*
@@ -22,11 +19,6 @@
 static pte_t *consistent_pte;
 static DEFINE_RAW_SPINLOCK(consistent_lock);
 
-enum master_type {
-	FOR_CPU = 0,
-	FOR_DEVICE = 1,
-};
-
 /*
  * VM region handling support.
  *
@@ -124,10 +116,8 @@ static struct arch_vm_region *vm_region_find(struct arch_vm_region *head,
 	return c;
 }
 
-/* FIXME: attrs is not used. */
-static void *nds32_dma_alloc_coherent(struct device *dev, size_t size,
-				      dma_addr_t * handle, gfp_t gfp,
-				      unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	struct page *page;
 	struct arch_vm_region *c;
@@ -232,8 +222,8 @@ static void *nds32_dma_alloc_coherent(struct device *dev, size_t size,
 	return NULL;
 }
 
-static void nds32_dma_free(struct device *dev, size_t size, void *cpu_addr,
-			   dma_addr_t handle, unsigned long attrs)
+void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
+		dma_addr_t handle, unsigned long attrs)
 {
 	struct arch_vm_region *c;
 	unsigned long flags, addr;
@@ -333,145 +323,39 @@ static int __init consistent_init(void)
 }
 
 core_initcall(consistent_init);
-static void consistent_sync(void *vaddr, size_t size, int direction, int master_type);
-static dma_addr_t nds32_dma_map_page(struct device *dev, struct page *page,
-				     unsigned long offset, size_t size,
-				     enum dma_data_direction dir,
-				     unsigned long attrs)
-{
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		consistent_sync((void *)(page_address(page) + offset), size, dir, FOR_DEVICE);
-	return page_to_phys(page) + offset;
-}
 
-static void nds32_dma_unmap_page(struct device *dev, dma_addr_t handle,
-				 size_t size, enum dma_data_direction dir,
-				 unsigned long attrs)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		consistent_sync(phys_to_virt(handle), size, dir, FOR_CPU);
-}
-
-/*
- * Make an area consistent for devices.
- */
-static void consistent_sync(void *vaddr, size_t size, int direction, int master_type)
-{
-	unsigned long start = (unsigned long)vaddr;
-	unsigned long end = start + size;
-
-	if (master_type == FOR_CPU) {
-		switch (direction) {
-		case DMA_TO_DEVICE:
-			break;
-		case DMA_FROM_DEVICE:
-		case DMA_BIDIRECTIONAL:
-			cpu_dma_inval_range(start, end);
-			break;
-		default:
-			BUG();
-		}
-	} else {
-		/* FOR_DEVICE */
-		switch (direction) {
-		case DMA_FROM_DEVICE:
-			break;
-		case DMA_TO_DEVICE:
-		case DMA_BIDIRECTIONAL:
-			cpu_dma_wb_range(start, end);
-			break;
-		default:
-			BUG();
-		}
+	void *addr = phys_to_virt(paddr);
+	unsigned long start = (unsigned long)addr;
+
+	switch (dir) {
+	case DMA_FROM_DEVICE:
+		break;
+	case DMA_TO_DEVICE:
+	case DMA_BIDIRECTIONAL:
+		cpu_dma_wb_range(start, start + size);
+		break;
+	default:
+		BUG();
 	}
 }
 
-static int nds32_dma_map_sg(struct device *dev, struct scatterlist *sg,
-			    int nents, enum dma_data_direction dir,
-			    unsigned long attrs)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	int i;
-
-	for (i = 0; i < nents; i++, sg++) {
-		void *virt;
-		unsigned long pfn;
-		struct page *page = sg_page(sg);
-
-		sg->dma_address = sg_phys(sg);
-		pfn = page_to_pfn(page) + sg->offset / PAGE_SIZE;
-		page = pfn_to_page(pfn);
-		if (PageHighMem(page)) {
-			virt = kmap_atomic(page);
-			consistent_sync(virt, sg->length, dir, FOR_CPU);
-			kunmap_atomic(virt);
-		} else {
-			if (sg->offset > PAGE_SIZE)
-				panic("sg->offset:%08x > PAGE_SIZE\n",
-				      sg->offset);
-			virt = page_address(page) + sg->offset;
-			consistent_sync(virt, sg->length, dir, FOR_CPU);
-		}
+	void *addr = phys_to_virt(paddr);
+	unsigned long start = (unsigned long)addr;
+
+	switch (dir) {
+	case DMA_TO_DEVICE:
+		break;
+	case DMA_FROM_DEVICE:
+	case DMA_BIDIRECTIONAL:
+		cpu_dma_inval_range(start, start + size);
+		break;
+	default:
+		BUG();
 	}
-	return nents;
 }
-
-static void nds32_dma_unmap_sg(struct device *dev, struct scatterlist *sg,
-			       int nhwentries, enum dma_data_direction dir,
-			       unsigned long attrs)
-{
-}
-
-static void
-nds32_dma_sync_single_for_cpu(struct device *dev, dma_addr_t handle,
-			      size_t size, enum dma_data_direction dir)
-{
-	consistent_sync((void *)phys_to_virt(handle), size, dir, FOR_CPU);
-}
-
-static void
-nds32_dma_sync_single_for_device(struct device *dev, dma_addr_t handle,
-				 size_t size, enum dma_data_direction dir)
-{
-	consistent_sync((void *)phys_to_virt(handle), size, dir, FOR_DEVICE);
-}
-
-static void
-nds32_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nents,
-			  enum dma_data_direction dir)
-{
-	int i;
-
-	for (i = 0; i < nents; i++, sg++) {
-		char *virt =
-		    page_address((struct page *)sg->page_link) + sg->offset;
-		consistent_sync(virt, sg->length, dir, FOR_CPU);
-	}
-}
-
-static void
-nds32_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
-			     int nents, enum dma_data_direction dir)
-{
-	int i;
-
-	for (i = 0; i < nents; i++, sg++) {
-		char *virt =
-		    page_address((struct page *)sg->page_link) + sg->offset;
-		consistent_sync(virt, sg->length, dir, FOR_DEVICE);
-	}
-}
-
-struct dma_map_ops nds32_dma_ops = {
-	.alloc = nds32_dma_alloc_coherent,
-	.free = nds32_dma_free,
-	.map_page = nds32_dma_map_page,
-	.unmap_page = nds32_dma_unmap_page,
-	.map_sg = nds32_dma_map_sg,
-	.unmap_sg = nds32_dma_unmap_sg,
-	.sync_single_for_device = nds32_dma_sync_single_for_device,
-	.sync_single_for_cpu = nds32_dma_sync_single_for_cpu,
-	.sync_sg_for_cpu = nds32_dma_sync_sg_for_cpu,
-	.sync_sg_for_device = nds32_dma_sync_sg_for_device,
-};
-
-EXPORT_SYMBOL(nds32_dma_ops);
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* Re: [PATCH 13/22] nds32: use generic dma_noncoherent_ops
@ 2018-04-25  6:40           ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-25  6:40 UTC (permalink / raw)
  To: Greentime Hu
  Cc: Christoph Hellwig, linux-arch, Michal Simek, Vincent Chen,
	linux-alpha, linux-snps-arc, linux-arm-kernel, linux-c6x-dev,
	linux-hexagon, linux-m68k, nios2-dev, openrisc, linux-parisc,
	linux-sh, sparclinux, linux-xtensa, Linux Kernel Mailing List

On Wed, Apr 25, 2018 at 09:43:43AM +0800, Greentime Hu wrote:
> Hi Crhistoph,
> 
> The ftmac100 works if I revert this commit.

Thanks.  ftmac100 only use dma_map_page, which in the old nds32 code
is just doing a plain page_address and never kmaps.  Can you apply
the patch below on the tree with the origin "nds32: use generic
dma_noncoherent_ops" reverted?  This always just uses page_address,
although that, just like the original code is broken if you actually
have highmem that needs to be mapped:

---

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* Re: [PATCH 13/22] nds32: use generic dma_noncoherent_ops
@ 2018-04-25  6:40           ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-25  6:40 UTC (permalink / raw)
  To: Greentime Hu
  Cc: Christoph Hellwig, linux-arch, Michal Simek, Vincent Chen,
	linux-alpha, linux-snps-arc, linux-arm-kernel, linux-c6x-dev,
	linux-hexagon, linux-m68k, nios2-dev, openrisc, linux-parisc,
	linux-sh, sparclinux, linux-xtensa, Linux Kernel Mailing List

On Wed, Apr 25, 2018 at 09:43:43AM +0800, Greentime Hu wrote:
> Hi Crhistoph,
> 
> The ftmac100 works if I revert this commit.

Thanks.  ftmac100 only use dma_map_page, which in the old nds32 code
is just doing a plain page_address and never kmaps.  Can you apply
the patch below on the tree with the origin "nds32: use generic
dma_noncoherent_ops" reverted?  This always just uses page_address,
although that, just like the original code is broken if you actually
have highmem that needs to be mapped:

---
>From 1dc5d1cae4cd7b9ce03d0e2943364ed4cca938d7 Mon Sep 17 00:00:00 2001
From: Christoph Hellwig <hch@lst.de>
Date: Mon, 16 Apr 2018 19:20:30 +0200
Subject: nds32: use generic dma_noncoherent_ops

Switch to the generic noncoherent direct mapping implementation.

This makes sure the cache_sync routines is called in the unmap_sg
case, to match the unmap_single and sync_{single,sg}_to_cpu cases.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/nds32/Kconfig                   |   3 +
 arch/nds32/include/asm/Kbuild        |   1 +
 arch/nds32/include/asm/dma-mapping.h |  14 ---
 arch/nds32/kernel/dma.c              | 182 +++++----------------------
 4 files changed, 37 insertions(+), 163 deletions(-)
 delete mode 100644 arch/nds32/include/asm/dma-mapping.h

diff --git a/arch/nds32/Kconfig b/arch/nds32/Kconfig
index 249f38d3388f..67d0ac0a989c 100644
--- a/arch/nds32/Kconfig
+++ b/arch/nds32/Kconfig
@@ -5,10 +5,13 @@
 
 config NDS32
         def_bool y
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select ARCH_WANT_FRAME_POINTERS if FTRACE
 	select CLKSRC_MMIO
 	select CLONE_BACKWARDS
 	select COMMON_CLK
+	select DMA_NONCOHERENT_OPS
 	select GENERIC_ATOMIC64
 	select GENERIC_CPU_DEVICES
 	select GENERIC_CLOCKEVENTS
diff --git a/arch/nds32/include/asm/Kbuild b/arch/nds32/include/asm/Kbuild
index 06bdf8167f5a..b3e951f805f8 100644
--- a/arch/nds32/include/asm/Kbuild
+++ b/arch/nds32/include/asm/Kbuild
@@ -13,6 +13,7 @@ generic-y += cputime.h
 generic-y += device.h
 generic-y += div64.h
 generic-y += dma.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += errno.h
 generic-y += exec.h
diff --git a/arch/nds32/include/asm/dma-mapping.h b/arch/nds32/include/asm/dma-mapping.h
deleted file mode 100644
index 2dd47d245c25..000000000000
--- a/arch/nds32/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,14 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-// Copyright (C) 2005-2017 Andes Technology Corporation
-
-#ifndef ASMNDS32_DMA_MAPPING_H
-#define ASMNDS32_DMA_MAPPING_H
-
-extern struct dma_map_ops nds32_dma_ops;
-
-static inline struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return &nds32_dma_ops;
-}
-
-#endif
diff --git a/arch/nds32/kernel/dma.c b/arch/nds32/kernel/dma.c
index d291800fc621..78311a1e6fd1 100644
--- a/arch/nds32/kernel/dma.c
+++ b/arch/nds32/kernel/dma.c
@@ -3,17 +3,14 @@
 
 #include <linux/types.h>
 #include <linux/mm.h>
-#include <linux/export.h>
 #include <linux/string.h>
-#include <linux/scatterlist.h>
-#include <linux/dma-mapping.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/io.h>
 #include <linux/cache.h>
 #include <linux/highmem.h>
 #include <linux/slab.h>
 #include <asm/cacheflush.h>
 #include <asm/tlbflush.h>
-#include <asm/dma-mapping.h>
 #include <asm/proc-fns.h>
 
 /*
@@ -22,11 +19,6 @@
 static pte_t *consistent_pte;
 static DEFINE_RAW_SPINLOCK(consistent_lock);
 
-enum master_type {
-	FOR_CPU = 0,
-	FOR_DEVICE = 1,
-};
-
 /*
  * VM region handling support.
  *
@@ -124,10 +116,8 @@ static struct arch_vm_region *vm_region_find(struct arch_vm_region *head,
 	return c;
 }
 
-/* FIXME: attrs is not used. */
-static void *nds32_dma_alloc_coherent(struct device *dev, size_t size,
-				      dma_addr_t * handle, gfp_t gfp,
-				      unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	struct page *page;
 	struct arch_vm_region *c;
@@ -232,8 +222,8 @@ static void *nds32_dma_alloc_coherent(struct device *dev, size_t size,
 	return NULL;
 }
 
-static void nds32_dma_free(struct device *dev, size_t size, void *cpu_addr,
-			   dma_addr_t handle, unsigned long attrs)
+void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
+		dma_addr_t handle, unsigned long attrs)
 {
 	struct arch_vm_region *c;
 	unsigned long flags, addr;
@@ -333,145 +323,39 @@ static int __init consistent_init(void)
 }
 
 core_initcall(consistent_init);
-static void consistent_sync(void *vaddr, size_t size, int direction, int master_type);
-static dma_addr_t nds32_dma_map_page(struct device *dev, struct page *page,
-				     unsigned long offset, size_t size,
-				     enum dma_data_direction dir,
-				     unsigned long attrs)
-{
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		consistent_sync((void *)(page_address(page) + offset), size, dir, FOR_DEVICE);
-	return page_to_phys(page) + offset;
-}
 
-static void nds32_dma_unmap_page(struct device *dev, dma_addr_t handle,
-				 size_t size, enum dma_data_direction dir,
-				 unsigned long attrs)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		consistent_sync(phys_to_virt(handle), size, dir, FOR_CPU);
-}
-
-/*
- * Make an area consistent for devices.
- */
-static void consistent_sync(void *vaddr, size_t size, int direction, int master_type)
-{
-	unsigned long start = (unsigned long)vaddr;
-	unsigned long end = start + size;
-
-	if (master_type == FOR_CPU) {
-		switch (direction) {
-		case DMA_TO_DEVICE:
-			break;
-		case DMA_FROM_DEVICE:
-		case DMA_BIDIRECTIONAL:
-			cpu_dma_inval_range(start, end);
-			break;
-		default:
-			BUG();
-		}
-	} else {
-		/* FOR_DEVICE */
-		switch (direction) {
-		case DMA_FROM_DEVICE:
-			break;
-		case DMA_TO_DEVICE:
-		case DMA_BIDIRECTIONAL:
-			cpu_dma_wb_range(start, end);
-			break;
-		default:
-			BUG();
-		}
+	void *addr = phys_to_virt(paddr);
+	unsigned long start = (unsigned long)addr;
+
+	switch (dir) {
+	case DMA_FROM_DEVICE:
+		break;
+	case DMA_TO_DEVICE:
+	case DMA_BIDIRECTIONAL:
+		cpu_dma_wb_range(start, start + size);
+		break;
+	default:
+		BUG();
 	}
 }
 
-static int nds32_dma_map_sg(struct device *dev, struct scatterlist *sg,
-			    int nents, enum dma_data_direction dir,
-			    unsigned long attrs)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	int i;
-
-	for (i = 0; i < nents; i++, sg++) {
-		void *virt;
-		unsigned long pfn;
-		struct page *page = sg_page(sg);
-
-		sg->dma_address = sg_phys(sg);
-		pfn = page_to_pfn(page) + sg->offset / PAGE_SIZE;
-		page = pfn_to_page(pfn);
-		if (PageHighMem(page)) {
-			virt = kmap_atomic(page);
-			consistent_sync(virt, sg->length, dir, FOR_CPU);
-			kunmap_atomic(virt);
-		} else {
-			if (sg->offset > PAGE_SIZE)
-				panic("sg->offset:%08x > PAGE_SIZE\n",
-				      sg->offset);
-			virt = page_address(page) + sg->offset;
-			consistent_sync(virt, sg->length, dir, FOR_CPU);
-		}
+	void *addr = phys_to_virt(paddr);
+	unsigned long start = (unsigned long)addr;
+
+	switch (dir) {
+	case DMA_TO_DEVICE:
+		break;
+	case DMA_FROM_DEVICE:
+	case DMA_BIDIRECTIONAL:
+		cpu_dma_inval_range(start, start + size);
+		break;
+	default:
+		BUG();
 	}
-	return nents;
 }
-
-static void nds32_dma_unmap_sg(struct device *dev, struct scatterlist *sg,
-			       int nhwentries, enum dma_data_direction dir,
-			       unsigned long attrs)
-{
-}
-
-static void
-nds32_dma_sync_single_for_cpu(struct device *dev, dma_addr_t handle,
-			      size_t size, enum dma_data_direction dir)
-{
-	consistent_sync((void *)phys_to_virt(handle), size, dir, FOR_CPU);
-}
-
-static void
-nds32_dma_sync_single_for_device(struct device *dev, dma_addr_t handle,
-				 size_t size, enum dma_data_direction dir)
-{
-	consistent_sync((void *)phys_to_virt(handle), size, dir, FOR_DEVICE);
-}
-
-static void
-nds32_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nents,
-			  enum dma_data_direction dir)
-{
-	int i;
-
-	for (i = 0; i < nents; i++, sg++) {
-		char *virt =
-		    page_address((struct page *)sg->page_link) + sg->offset;
-		consistent_sync(virt, sg->length, dir, FOR_CPU);
-	}
-}
-
-static void
-nds32_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
-			     int nents, enum dma_data_direction dir)
-{
-	int i;
-
-	for (i = 0; i < nents; i++, sg++) {
-		char *virt =
-		    page_address((struct page *)sg->page_link) + sg->offset;
-		consistent_sync(virt, sg->length, dir, FOR_DEVICE);
-	}
-}
-
-struct dma_map_ops nds32_dma_ops = {
-	.alloc = nds32_dma_alloc_coherent,
-	.free = nds32_dma_free,
-	.map_page = nds32_dma_map_page,
-	.unmap_page = nds32_dma_unmap_page,
-	.map_sg = nds32_dma_map_sg,
-	.unmap_sg = nds32_dma_unmap_sg,
-	.sync_single_for_device = nds32_dma_sync_single_for_device,
-	.sync_single_for_cpu = nds32_dma_sync_single_for_cpu,
-	.sync_sg_for_cpu = nds32_dma_sync_sg_for_cpu,
-	.sync_sg_for_device = nds32_dma_sync_sg_for_device,
-};
-
-EXPORT_SYMBOL(nds32_dma_ops);
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 13/22] nds32: use generic dma_noncoherent_ops
@ 2018-04-25  6:40           ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-25  6:40 UTC (permalink / raw)
  To: linux-snps-arc

On Wed, Apr 25, 2018@09:43:43AM +0800, Greentime Hu wrote:
> Hi Crhistoph,
> 
> The ftmac100 works if I revert this commit.

Thanks.  ftmac100 only use dma_map_page, which in the old nds32 code
is just doing a plain page_address and never kmaps.  Can you apply
the patch below on the tree with the origin "nds32: use generic
dma_noncoherent_ops" reverted?  This always just uses page_address,
although that, just like the original code is broken if you actually
have highmem that needs to be mapped:

---
>From 1dc5d1cae4cd7b9ce03d0e2943364ed4cca938d7 Mon Sep 17 00:00:00 2001
From: Christoph Hellwig <hch@lst.de>
Date: Mon, 16 Apr 2018 19:20:30 +0200
Subject: nds32: use generic dma_noncoherent_ops

Switch to the generic noncoherent direct mapping implementation.

This makes sure the cache_sync routines is called in the unmap_sg
case, to match the unmap_single and sync_{single,sg}_to_cpu cases.

Signed-off-by: Christoph Hellwig <hch at lst.de>
---
 arch/nds32/Kconfig                   |   3 +
 arch/nds32/include/asm/Kbuild        |   1 +
 arch/nds32/include/asm/dma-mapping.h |  14 ---
 arch/nds32/kernel/dma.c              | 182 +++++----------------------
 4 files changed, 37 insertions(+), 163 deletions(-)
 delete mode 100644 arch/nds32/include/asm/dma-mapping.h

diff --git a/arch/nds32/Kconfig b/arch/nds32/Kconfig
index 249f38d3388f..67d0ac0a989c 100644
--- a/arch/nds32/Kconfig
+++ b/arch/nds32/Kconfig
@@ -5,10 +5,13 @@
 
 config NDS32
         def_bool y
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select ARCH_WANT_FRAME_POINTERS if FTRACE
 	select CLKSRC_MMIO
 	select CLONE_BACKWARDS
 	select COMMON_CLK
+	select DMA_NONCOHERENT_OPS
 	select GENERIC_ATOMIC64
 	select GENERIC_CPU_DEVICES
 	select GENERIC_CLOCKEVENTS
diff --git a/arch/nds32/include/asm/Kbuild b/arch/nds32/include/asm/Kbuild
index 06bdf8167f5a..b3e951f805f8 100644
--- a/arch/nds32/include/asm/Kbuild
+++ b/arch/nds32/include/asm/Kbuild
@@ -13,6 +13,7 @@ generic-y += cputime.h
 generic-y += device.h
 generic-y += div64.h
 generic-y += dma.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += errno.h
 generic-y += exec.h
diff --git a/arch/nds32/include/asm/dma-mapping.h b/arch/nds32/include/asm/dma-mapping.h
deleted file mode 100644
index 2dd47d245c25..000000000000
--- a/arch/nds32/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,14 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-// Copyright (C) 2005-2017 Andes Technology Corporation
-
-#ifndef ASMNDS32_DMA_MAPPING_H
-#define ASMNDS32_DMA_MAPPING_H
-
-extern struct dma_map_ops nds32_dma_ops;
-
-static inline struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return &nds32_dma_ops;
-}
-
-#endif
diff --git a/arch/nds32/kernel/dma.c b/arch/nds32/kernel/dma.c
index d291800fc621..78311a1e6fd1 100644
--- a/arch/nds32/kernel/dma.c
+++ b/arch/nds32/kernel/dma.c
@@ -3,17 +3,14 @@
 
 #include <linux/types.h>
 #include <linux/mm.h>
-#include <linux/export.h>
 #include <linux/string.h>
-#include <linux/scatterlist.h>
-#include <linux/dma-mapping.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/io.h>
 #include <linux/cache.h>
 #include <linux/highmem.h>
 #include <linux/slab.h>
 #include <asm/cacheflush.h>
 #include <asm/tlbflush.h>
-#include <asm/dma-mapping.h>
 #include <asm/proc-fns.h>
 
 /*
@@ -22,11 +19,6 @@
 static pte_t *consistent_pte;
 static DEFINE_RAW_SPINLOCK(consistent_lock);
 
-enum master_type {
-	FOR_CPU = 0,
-	FOR_DEVICE = 1,
-};
-
 /*
  * VM region handling support.
  *
@@ -124,10 +116,8 @@ static struct arch_vm_region *vm_region_find(struct arch_vm_region *head,
 	return c;
 }
 
-/* FIXME: attrs is not used. */
-static void *nds32_dma_alloc_coherent(struct device *dev, size_t size,
-				      dma_addr_t * handle, gfp_t gfp,
-				      unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	struct page *page;
 	struct arch_vm_region *c;
@@ -232,8 +222,8 @@ static void *nds32_dma_alloc_coherent(struct device *dev, size_t size,
 	return NULL;
 }
 
-static void nds32_dma_free(struct device *dev, size_t size, void *cpu_addr,
-			   dma_addr_t handle, unsigned long attrs)
+void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
+		dma_addr_t handle, unsigned long attrs)
 {
 	struct arch_vm_region *c;
 	unsigned long flags, addr;
@@ -333,145 +323,39 @@ static int __init consistent_init(void)
 }
 
 core_initcall(consistent_init);
-static void consistent_sync(void *vaddr, size_t size, int direction, int master_type);
-static dma_addr_t nds32_dma_map_page(struct device *dev, struct page *page,
-				     unsigned long offset, size_t size,
-				     enum dma_data_direction dir,
-				     unsigned long attrs)
-{
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		consistent_sync((void *)(page_address(page) + offset), size, dir, FOR_DEVICE);
-	return page_to_phys(page) + offset;
-}
 
-static void nds32_dma_unmap_page(struct device *dev, dma_addr_t handle,
-				 size_t size, enum dma_data_direction dir,
-				 unsigned long attrs)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		consistent_sync(phys_to_virt(handle), size, dir, FOR_CPU);
-}
-
-/*
- * Make an area consistent for devices.
- */
-static void consistent_sync(void *vaddr, size_t size, int direction, int master_type)
-{
-	unsigned long start = (unsigned long)vaddr;
-	unsigned long end = start + size;
-
-	if (master_type == FOR_CPU) {
-		switch (direction) {
-		case DMA_TO_DEVICE:
-			break;
-		case DMA_FROM_DEVICE:
-		case DMA_BIDIRECTIONAL:
-			cpu_dma_inval_range(start, end);
-			break;
-		default:
-			BUG();
-		}
-	} else {
-		/* FOR_DEVICE */
-		switch (direction) {
-		case DMA_FROM_DEVICE:
-			break;
-		case DMA_TO_DEVICE:
-		case DMA_BIDIRECTIONAL:
-			cpu_dma_wb_range(start, end);
-			break;
-		default:
-			BUG();
-		}
+	void *addr = phys_to_virt(paddr);
+	unsigned long start = (unsigned long)addr;
+
+	switch (dir) {
+	case DMA_FROM_DEVICE:
+		break;
+	case DMA_TO_DEVICE:
+	case DMA_BIDIRECTIONAL:
+		cpu_dma_wb_range(start, start + size);
+		break;
+	default:
+		BUG();
 	}
 }
 
-static int nds32_dma_map_sg(struct device *dev, struct scatterlist *sg,
-			    int nents, enum dma_data_direction dir,
-			    unsigned long attrs)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	int i;
-
-	for (i = 0; i < nents; i++, sg++) {
-		void *virt;
-		unsigned long pfn;
-		struct page *page = sg_page(sg);
-
-		sg->dma_address = sg_phys(sg);
-		pfn = page_to_pfn(page) + sg->offset / PAGE_SIZE;
-		page = pfn_to_page(pfn);
-		if (PageHighMem(page)) {
-			virt = kmap_atomic(page);
-			consistent_sync(virt, sg->length, dir, FOR_CPU);
-			kunmap_atomic(virt);
-		} else {
-			if (sg->offset > PAGE_SIZE)
-				panic("sg->offset:%08x > PAGE_SIZE\n",
-				      sg->offset);
-			virt = page_address(page) + sg->offset;
-			consistent_sync(virt, sg->length, dir, FOR_CPU);
-		}
+	void *addr = phys_to_virt(paddr);
+	unsigned long start = (unsigned long)addr;
+
+	switch (dir) {
+	case DMA_TO_DEVICE:
+		break;
+	case DMA_FROM_DEVICE:
+	case DMA_BIDIRECTIONAL:
+		cpu_dma_inval_range(start, start + size);
+		break;
+	default:
+		BUG();
 	}
-	return nents;
 }
-
-static void nds32_dma_unmap_sg(struct device *dev, struct scatterlist *sg,
-			       int nhwentries, enum dma_data_direction dir,
-			       unsigned long attrs)
-{
-}
-
-static void
-nds32_dma_sync_single_for_cpu(struct device *dev, dma_addr_t handle,
-			      size_t size, enum dma_data_direction dir)
-{
-	consistent_sync((void *)phys_to_virt(handle), size, dir, FOR_CPU);
-}
-
-static void
-nds32_dma_sync_single_for_device(struct device *dev, dma_addr_t handle,
-				 size_t size, enum dma_data_direction dir)
-{
-	consistent_sync((void *)phys_to_virt(handle), size, dir, FOR_DEVICE);
-}
-
-static void
-nds32_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nents,
-			  enum dma_data_direction dir)
-{
-	int i;
-
-	for (i = 0; i < nents; i++, sg++) {
-		char *virt =
-		    page_address((struct page *)sg->page_link) + sg->offset;
-		consistent_sync(virt, sg->length, dir, FOR_CPU);
-	}
-}
-
-static void
-nds32_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
-			     int nents, enum dma_data_direction dir)
-{
-	int i;
-
-	for (i = 0; i < nents; i++, sg++) {
-		char *virt =
-		    page_address((struct page *)sg->page_link) + sg->offset;
-		consistent_sync(virt, sg->length, dir, FOR_DEVICE);
-	}
-}
-
-struct dma_map_ops nds32_dma_ops = {
-	.alloc = nds32_dma_alloc_coherent,
-	.free = nds32_dma_free,
-	.map_page = nds32_dma_map_page,
-	.unmap_page = nds32_dma_unmap_page,
-	.map_sg = nds32_dma_map_sg,
-	.unmap_sg = nds32_dma_unmap_sg,
-	.sync_single_for_device = nds32_dma_sync_single_for_device,
-	.sync_single_for_cpu = nds32_dma_sync_single_for_cpu,
-	.sync_sg_for_cpu = nds32_dma_sync_sg_for_cpu,
-	.sync_sg_for_device = nds32_dma_sync_sg_for_device,
-};
-
-EXPORT_SYMBOL(nds32_dma_ops);
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* Re: [PATCH 13/22] nds32: use generic dma_noncoherent_ops
@ 2018-04-25  6:40           ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-25  6:40 UTC (permalink / raw)
  To: Greentime Hu
  Cc: Christoph Hellwig, linux-arch, Michal Simek, Vincent Chen,
	linux-alpha, linux-snps-arc, linux-arm-kernel, linux-c6x-dev,
	linux-hexagon, linux-m68k, nios2-dev, openrisc, linux-parisc,
	linux-sh, sparclinux, linux-xtensa, Linux Kernel Mailing List

On Wed, Apr 25, 2018 at 09:43:43AM +0800, Greentime Hu wrote:
> Hi Crhistoph,
> 
> The ftmac100 works if I revert this commit.

Thanks.  ftmac100 only use dma_map_page, which in the old nds32 code
is just doing a plain page_address and never kmaps.  Can you apply
the patch below on the tree with the origin "nds32: use generic
dma_noncoherent_ops" reverted?  This always just uses page_address,
although that, just like the original code is broken if you actually
have highmem that needs to be mapped:

---
From 1dc5d1cae4cd7b9ce03d0e2943364ed4cca938d7 Mon Sep 17 00:00:00 2001
From: Christoph Hellwig <hch@lst.de>
Date: Mon, 16 Apr 2018 19:20:30 +0200
Subject: nds32: use generic dma_noncoherent_ops

Switch to the generic noncoherent direct mapping implementation.

This makes sure the cache_sync routines is called in the unmap_sg
case, to match the unmap_single and sync_{single,sg}_to_cpu cases.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/nds32/Kconfig                   |   3 +
 arch/nds32/include/asm/Kbuild        |   1 +
 arch/nds32/include/asm/dma-mapping.h |  14 ---
 arch/nds32/kernel/dma.c              | 182 +++++----------------------
 4 files changed, 37 insertions(+), 163 deletions(-)
 delete mode 100644 arch/nds32/include/asm/dma-mapping.h

diff --git a/arch/nds32/Kconfig b/arch/nds32/Kconfig
index 249f38d3388f..67d0ac0a989c 100644
--- a/arch/nds32/Kconfig
+++ b/arch/nds32/Kconfig
@@ -5,10 +5,13 @@
 
 config NDS32
         def_bool y
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select ARCH_WANT_FRAME_POINTERS if FTRACE
 	select CLKSRC_MMIO
 	select CLONE_BACKWARDS
 	select COMMON_CLK
+	select DMA_NONCOHERENT_OPS
 	select GENERIC_ATOMIC64
 	select GENERIC_CPU_DEVICES
 	select GENERIC_CLOCKEVENTS
diff --git a/arch/nds32/include/asm/Kbuild b/arch/nds32/include/asm/Kbuild
index 06bdf8167f5a..b3e951f805f8 100644
--- a/arch/nds32/include/asm/Kbuild
+++ b/arch/nds32/include/asm/Kbuild
@@ -13,6 +13,7 @@ generic-y += cputime.h
 generic-y += device.h
 generic-y += div64.h
 generic-y += dma.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += errno.h
 generic-y += exec.h
diff --git a/arch/nds32/include/asm/dma-mapping.h b/arch/nds32/include/asm/dma-mapping.h
deleted file mode 100644
index 2dd47d245c25..000000000000
--- a/arch/nds32/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,14 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-// Copyright (C) 2005-2017 Andes Technology Corporation
-
-#ifndef ASMNDS32_DMA_MAPPING_H
-#define ASMNDS32_DMA_MAPPING_H
-
-extern struct dma_map_ops nds32_dma_ops;
-
-static inline struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return &nds32_dma_ops;
-}
-
-#endif
diff --git a/arch/nds32/kernel/dma.c b/arch/nds32/kernel/dma.c
index d291800fc621..78311a1e6fd1 100644
--- a/arch/nds32/kernel/dma.c
+++ b/arch/nds32/kernel/dma.c
@@ -3,17 +3,14 @@
 
 #include <linux/types.h>
 #include <linux/mm.h>
-#include <linux/export.h>
 #include <linux/string.h>
-#include <linux/scatterlist.h>
-#include <linux/dma-mapping.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/io.h>
 #include <linux/cache.h>
 #include <linux/highmem.h>
 #include <linux/slab.h>
 #include <asm/cacheflush.h>
 #include <asm/tlbflush.h>
-#include <asm/dma-mapping.h>
 #include <asm/proc-fns.h>
 
 /*
@@ -22,11 +19,6 @@
 static pte_t *consistent_pte;
 static DEFINE_RAW_SPINLOCK(consistent_lock);
 
-enum master_type {
-	FOR_CPU = 0,
-	FOR_DEVICE = 1,
-};
-
 /*
  * VM region handling support.
  *
@@ -124,10 +116,8 @@ static struct arch_vm_region *vm_region_find(struct arch_vm_region *head,
 	return c;
 }
 
-/* FIXME: attrs is not used. */
-static void *nds32_dma_alloc_coherent(struct device *dev, size_t size,
-				      dma_addr_t * handle, gfp_t gfp,
-				      unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	struct page *page;
 	struct arch_vm_region *c;
@@ -232,8 +222,8 @@ static void *nds32_dma_alloc_coherent(struct device *dev, size_t size,
 	return NULL;
 }
 
-static void nds32_dma_free(struct device *dev, size_t size, void *cpu_addr,
-			   dma_addr_t handle, unsigned long attrs)
+void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
+		dma_addr_t handle, unsigned long attrs)
 {
 	struct arch_vm_region *c;
 	unsigned long flags, addr;
@@ -333,145 +323,39 @@ static int __init consistent_init(void)
 }
 
 core_initcall(consistent_init);
-static void consistent_sync(void *vaddr, size_t size, int direction, int master_type);
-static dma_addr_t nds32_dma_map_page(struct device *dev, struct page *page,
-				     unsigned long offset, size_t size,
-				     enum dma_data_direction dir,
-				     unsigned long attrs)
-{
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		consistent_sync((void *)(page_address(page) + offset), size, dir, FOR_DEVICE);
-	return page_to_phys(page) + offset;
-}
 
-static void nds32_dma_unmap_page(struct device *dev, dma_addr_t handle,
-				 size_t size, enum dma_data_direction dir,
-				 unsigned long attrs)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		consistent_sync(phys_to_virt(handle), size, dir, FOR_CPU);
-}
-
-/*
- * Make an area consistent for devices.
- */
-static void consistent_sync(void *vaddr, size_t size, int direction, int master_type)
-{
-	unsigned long start = (unsigned long)vaddr;
-	unsigned long end = start + size;
-
-	if (master_type = FOR_CPU) {
-		switch (direction) {
-		case DMA_TO_DEVICE:
-			break;
-		case DMA_FROM_DEVICE:
-		case DMA_BIDIRECTIONAL:
-			cpu_dma_inval_range(start, end);
-			break;
-		default:
-			BUG();
-		}
-	} else {
-		/* FOR_DEVICE */
-		switch (direction) {
-		case DMA_FROM_DEVICE:
-			break;
-		case DMA_TO_DEVICE:
-		case DMA_BIDIRECTIONAL:
-			cpu_dma_wb_range(start, end);
-			break;
-		default:
-			BUG();
-		}
+	void *addr = phys_to_virt(paddr);
+	unsigned long start = (unsigned long)addr;
+
+	switch (dir) {
+	case DMA_FROM_DEVICE:
+		break;
+	case DMA_TO_DEVICE:
+	case DMA_BIDIRECTIONAL:
+		cpu_dma_wb_range(start, start + size);
+		break;
+	default:
+		BUG();
 	}
 }
 
-static int nds32_dma_map_sg(struct device *dev, struct scatterlist *sg,
-			    int nents, enum dma_data_direction dir,
-			    unsigned long attrs)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	int i;
-
-	for (i = 0; i < nents; i++, sg++) {
-		void *virt;
-		unsigned long pfn;
-		struct page *page = sg_page(sg);
-
-		sg->dma_address = sg_phys(sg);
-		pfn = page_to_pfn(page) + sg->offset / PAGE_SIZE;
-		page = pfn_to_page(pfn);
-		if (PageHighMem(page)) {
-			virt = kmap_atomic(page);
-			consistent_sync(virt, sg->length, dir, FOR_CPU);
-			kunmap_atomic(virt);
-		} else {
-			if (sg->offset > PAGE_SIZE)
-				panic("sg->offset:%08x > PAGE_SIZE\n",
-				      sg->offset);
-			virt = page_address(page) + sg->offset;
-			consistent_sync(virt, sg->length, dir, FOR_CPU);
-		}
+	void *addr = phys_to_virt(paddr);
+	unsigned long start = (unsigned long)addr;
+
+	switch (dir) {
+	case DMA_TO_DEVICE:
+		break;
+	case DMA_FROM_DEVICE:
+	case DMA_BIDIRECTIONAL:
+		cpu_dma_inval_range(start, start + size);
+		break;
+	default:
+		BUG();
 	}
-	return nents;
 }
-
-static void nds32_dma_unmap_sg(struct device *dev, struct scatterlist *sg,
-			       int nhwentries, enum dma_data_direction dir,
-			       unsigned long attrs)
-{
-}
-
-static void
-nds32_dma_sync_single_for_cpu(struct device *dev, dma_addr_t handle,
-			      size_t size, enum dma_data_direction dir)
-{
-	consistent_sync((void *)phys_to_virt(handle), size, dir, FOR_CPU);
-}
-
-static void
-nds32_dma_sync_single_for_device(struct device *dev, dma_addr_t handle,
-				 size_t size, enum dma_data_direction dir)
-{
-	consistent_sync((void *)phys_to_virt(handle), size, dir, FOR_DEVICE);
-}
-
-static void
-nds32_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nents,
-			  enum dma_data_direction dir)
-{
-	int i;
-
-	for (i = 0; i < nents; i++, sg++) {
-		char *virt -		    page_address((struct page *)sg->page_link) + sg->offset;
-		consistent_sync(virt, sg->length, dir, FOR_CPU);
-	}
-}
-
-static void
-nds32_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
-			     int nents, enum dma_data_direction dir)
-{
-	int i;
-
-	for (i = 0; i < nents; i++, sg++) {
-		char *virt -		    page_address((struct page *)sg->page_link) + sg->offset;
-		consistent_sync(virt, sg->length, dir, FOR_DEVICE);
-	}
-}
-
-struct dma_map_ops nds32_dma_ops = {
-	.alloc = nds32_dma_alloc_coherent,
-	.free = nds32_dma_free,
-	.map_page = nds32_dma_map_page,
-	.unmap_page = nds32_dma_unmap_page,
-	.map_sg = nds32_dma_map_sg,
-	.unmap_sg = nds32_dma_unmap_sg,
-	.sync_single_for_device = nds32_dma_sync_single_for_device,
-	.sync_single_for_cpu = nds32_dma_sync_single_for_cpu,
-	.sync_sg_for_cpu = nds32_dma_sync_sg_for_cpu,
-	.sync_sg_for_device = nds32_dma_sync_sg_for_device,
-};
-
-EXPORT_SYMBOL(nds32_dma_ops);
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [OpenRISC] [PATCH 13/22] nds32: use generic dma_noncoherent_ops
@ 2018-04-25  6:40           ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-25  6:40 UTC (permalink / raw)
  To: openrisc

On Wed, Apr 25, 2018 at 09:43:43AM +0800, Greentime Hu wrote:
> Hi Crhistoph,
> 
> The ftmac100 works if I revert this commit.

Thanks.  ftmac100 only use dma_map_page, which in the old nds32 code
is just doing a plain page_address and never kmaps.  Can you apply
the patch below on the tree with the origin "nds32: use generic
dma_noncoherent_ops" reverted?  This always just uses page_address,
although that, just like the original code is broken if you actually
have highmem that needs to be mapped:

---
From 1dc5d1cae4cd7b9ce03d0e2943364ed4cca938d7 Mon Sep 17 00:00:00 2001
From: Christoph Hellwig <hch@lst.de>
Date: Mon, 16 Apr 2018 19:20:30 +0200
Subject: nds32: use generic dma_noncoherent_ops

Switch to the generic noncoherent direct mapping implementation.

This makes sure the cache_sync routines is called in the unmap_sg
case, to match the unmap_single and sync_{single,sg}_to_cpu cases.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/nds32/Kconfig                   |   3 +
 arch/nds32/include/asm/Kbuild        |   1 +
 arch/nds32/include/asm/dma-mapping.h |  14 ---
 arch/nds32/kernel/dma.c              | 182 +++++----------------------
 4 files changed, 37 insertions(+), 163 deletions(-)
 delete mode 100644 arch/nds32/include/asm/dma-mapping.h

diff --git a/arch/nds32/Kconfig b/arch/nds32/Kconfig
index 249f38d3388f..67d0ac0a989c 100644
--- a/arch/nds32/Kconfig
+++ b/arch/nds32/Kconfig
@@ -5,10 +5,13 @@
 
 config NDS32
         def_bool y
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select ARCH_WANT_FRAME_POINTERS if FTRACE
 	select CLKSRC_MMIO
 	select CLONE_BACKWARDS
 	select COMMON_CLK
+	select DMA_NONCOHERENT_OPS
 	select GENERIC_ATOMIC64
 	select GENERIC_CPU_DEVICES
 	select GENERIC_CLOCKEVENTS
diff --git a/arch/nds32/include/asm/Kbuild b/arch/nds32/include/asm/Kbuild
index 06bdf8167f5a..b3e951f805f8 100644
--- a/arch/nds32/include/asm/Kbuild
+++ b/arch/nds32/include/asm/Kbuild
@@ -13,6 +13,7 @@ generic-y += cputime.h
 generic-y += device.h
 generic-y += div64.h
 generic-y += dma.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += errno.h
 generic-y += exec.h
diff --git a/arch/nds32/include/asm/dma-mapping.h b/arch/nds32/include/asm/dma-mapping.h
deleted file mode 100644
index 2dd47d245c25..000000000000
--- a/arch/nds32/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,14 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-// Copyright (C) 2005-2017 Andes Technology Corporation
-
-#ifndef ASMNDS32_DMA_MAPPING_H
-#define ASMNDS32_DMA_MAPPING_H
-
-extern struct dma_map_ops nds32_dma_ops;
-
-static inline struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return &nds32_dma_ops;
-}
-
-#endif
diff --git a/arch/nds32/kernel/dma.c b/arch/nds32/kernel/dma.c
index d291800fc621..78311a1e6fd1 100644
--- a/arch/nds32/kernel/dma.c
+++ b/arch/nds32/kernel/dma.c
@@ -3,17 +3,14 @@
 
 #include <linux/types.h>
 #include <linux/mm.h>
-#include <linux/export.h>
 #include <linux/string.h>
-#include <linux/scatterlist.h>
-#include <linux/dma-mapping.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/io.h>
 #include <linux/cache.h>
 #include <linux/highmem.h>
 #include <linux/slab.h>
 #include <asm/cacheflush.h>
 #include <asm/tlbflush.h>
-#include <asm/dma-mapping.h>
 #include <asm/proc-fns.h>
 
 /*
@@ -22,11 +19,6 @@
 static pte_t *consistent_pte;
 static DEFINE_RAW_SPINLOCK(consistent_lock);
 
-enum master_type {
-	FOR_CPU = 0,
-	FOR_DEVICE = 1,
-};
-
 /*
  * VM region handling support.
  *
@@ -124,10 +116,8 @@ static struct arch_vm_region *vm_region_find(struct arch_vm_region *head,
 	return c;
 }
 
-/* FIXME: attrs is not used. */
-static void *nds32_dma_alloc_coherent(struct device *dev, size_t size,
-				      dma_addr_t * handle, gfp_t gfp,
-				      unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	struct page *page;
 	struct arch_vm_region *c;
@@ -232,8 +222,8 @@ static void *nds32_dma_alloc_coherent(struct device *dev, size_t size,
 	return NULL;
 }
 
-static void nds32_dma_free(struct device *dev, size_t size, void *cpu_addr,
-			   dma_addr_t handle, unsigned long attrs)
+void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
+		dma_addr_t handle, unsigned long attrs)
 {
 	struct arch_vm_region *c;
 	unsigned long flags, addr;
@@ -333,145 +323,39 @@ static int __init consistent_init(void)
 }
 
 core_initcall(consistent_init);
-static void consistent_sync(void *vaddr, size_t size, int direction, int master_type);
-static dma_addr_t nds32_dma_map_page(struct device *dev, struct page *page,
-				     unsigned long offset, size_t size,
-				     enum dma_data_direction dir,
-				     unsigned long attrs)
-{
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		consistent_sync((void *)(page_address(page) + offset), size, dir, FOR_DEVICE);
-	return page_to_phys(page) + offset;
-}
 
-static void nds32_dma_unmap_page(struct device *dev, dma_addr_t handle,
-				 size_t size, enum dma_data_direction dir,
-				 unsigned long attrs)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		consistent_sync(phys_to_virt(handle), size, dir, FOR_CPU);
-}
-
-/*
- * Make an area consistent for devices.
- */
-static void consistent_sync(void *vaddr, size_t size, int direction, int master_type)
-{
-	unsigned long start = (unsigned long)vaddr;
-	unsigned long end = start + size;
-
-	if (master_type == FOR_CPU) {
-		switch (direction) {
-		case DMA_TO_DEVICE:
-			break;
-		case DMA_FROM_DEVICE:
-		case DMA_BIDIRECTIONAL:
-			cpu_dma_inval_range(start, end);
-			break;
-		default:
-			BUG();
-		}
-	} else {
-		/* FOR_DEVICE */
-		switch (direction) {
-		case DMA_FROM_DEVICE:
-			break;
-		case DMA_TO_DEVICE:
-		case DMA_BIDIRECTIONAL:
-			cpu_dma_wb_range(start, end);
-			break;
-		default:
-			BUG();
-		}
+	void *addr = phys_to_virt(paddr);
+	unsigned long start = (unsigned long)addr;
+
+	switch (dir) {
+	case DMA_FROM_DEVICE:
+		break;
+	case DMA_TO_DEVICE:
+	case DMA_BIDIRECTIONAL:
+		cpu_dma_wb_range(start, start + size);
+		break;
+	default:
+		BUG();
 	}
 }
 
-static int nds32_dma_map_sg(struct device *dev, struct scatterlist *sg,
-			    int nents, enum dma_data_direction dir,
-			    unsigned long attrs)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	int i;
-
-	for (i = 0; i < nents; i++, sg++) {
-		void *virt;
-		unsigned long pfn;
-		struct page *page = sg_page(sg);
-
-		sg->dma_address = sg_phys(sg);
-		pfn = page_to_pfn(page) + sg->offset / PAGE_SIZE;
-		page = pfn_to_page(pfn);
-		if (PageHighMem(page)) {
-			virt = kmap_atomic(page);
-			consistent_sync(virt, sg->length, dir, FOR_CPU);
-			kunmap_atomic(virt);
-		} else {
-			if (sg->offset > PAGE_SIZE)
-				panic("sg->offset:%08x > PAGE_SIZE\n",
-				      sg->offset);
-			virt = page_address(page) + sg->offset;
-			consistent_sync(virt, sg->length, dir, FOR_CPU);
-		}
+	void *addr = phys_to_virt(paddr);
+	unsigned long start = (unsigned long)addr;
+
+	switch (dir) {
+	case DMA_TO_DEVICE:
+		break;
+	case DMA_FROM_DEVICE:
+	case DMA_BIDIRECTIONAL:
+		cpu_dma_inval_range(start, start + size);
+		break;
+	default:
+		BUG();
 	}
-	return nents;
 }
-
-static void nds32_dma_unmap_sg(struct device *dev, struct scatterlist *sg,
-			       int nhwentries, enum dma_data_direction dir,
-			       unsigned long attrs)
-{
-}
-
-static void
-nds32_dma_sync_single_for_cpu(struct device *dev, dma_addr_t handle,
-			      size_t size, enum dma_data_direction dir)
-{
-	consistent_sync((void *)phys_to_virt(handle), size, dir, FOR_CPU);
-}
-
-static void
-nds32_dma_sync_single_for_device(struct device *dev, dma_addr_t handle,
-				 size_t size, enum dma_data_direction dir)
-{
-	consistent_sync((void *)phys_to_virt(handle), size, dir, FOR_DEVICE);
-}
-
-static void
-nds32_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nents,
-			  enum dma_data_direction dir)
-{
-	int i;
-
-	for (i = 0; i < nents; i++, sg++) {
-		char *virt =
-		    page_address((struct page *)sg->page_link) + sg->offset;
-		consistent_sync(virt, sg->length, dir, FOR_CPU);
-	}
-}
-
-static void
-nds32_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
-			     int nents, enum dma_data_direction dir)
-{
-	int i;
-
-	for (i = 0; i < nents; i++, sg++) {
-		char *virt =
-		    page_address((struct page *)sg->page_link) + sg->offset;
-		consistent_sync(virt, sg->length, dir, FOR_DEVICE);
-	}
-}
-
-struct dma_map_ops nds32_dma_ops = {
-	.alloc = nds32_dma_alloc_coherent,
-	.free = nds32_dma_free,
-	.map_page = nds32_dma_map_page,
-	.unmap_page = nds32_dma_unmap_page,
-	.map_sg = nds32_dma_map_sg,
-	.unmap_sg = nds32_dma_unmap_sg,
-	.sync_single_for_device = nds32_dma_sync_single_for_device,
-	.sync_single_for_cpu = nds32_dma_sync_single_for_cpu,
-	.sync_sg_for_cpu = nds32_dma_sync_sg_for_cpu,
-	.sync_sg_for_device = nds32_dma_sync_sg_for_device,
-};
-
-EXPORT_SYMBOL(nds32_dma_ops);
-- 
2.17.0


^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 13/22] nds32: use generic dma_noncoherent_ops
@ 2018-04-25  6:40           ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-25  6:40 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Apr 25, 2018 at 09:43:43AM +0800, Greentime Hu wrote:
> Hi Crhistoph,
> 
> The ftmac100 works if I revert this commit.

Thanks.  ftmac100 only use dma_map_page, which in the old nds32 code
is just doing a plain page_address and never kmaps.  Can you apply
the patch below on the tree with the origin "nds32: use generic
dma_noncoherent_ops" reverted?  This always just uses page_address,
although that, just like the original code is broken if you actually
have highmem that needs to be mapped:

---
>From 1dc5d1cae4cd7b9ce03d0e2943364ed4cca938d7 Mon Sep 17 00:00:00 2001
From: Christoph Hellwig <hch@lst.de>
Date: Mon, 16 Apr 2018 19:20:30 +0200
Subject: nds32: use generic dma_noncoherent_ops

Switch to the generic noncoherent direct mapping implementation.

This makes sure the cache_sync routines is called in the unmap_sg
case, to match the unmap_single and sync_{single,sg}_to_cpu cases.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 arch/nds32/Kconfig                   |   3 +
 arch/nds32/include/asm/Kbuild        |   1 +
 arch/nds32/include/asm/dma-mapping.h |  14 ---
 arch/nds32/kernel/dma.c              | 182 +++++----------------------
 4 files changed, 37 insertions(+), 163 deletions(-)
 delete mode 100644 arch/nds32/include/asm/dma-mapping.h

diff --git a/arch/nds32/Kconfig b/arch/nds32/Kconfig
index 249f38d3388f..67d0ac0a989c 100644
--- a/arch/nds32/Kconfig
+++ b/arch/nds32/Kconfig
@@ -5,10 +5,13 @@
 
 config NDS32
         def_bool y
+	select ARCH_HAS_SYNC_DMA_FOR_CPU
+	select ARCH_HAS_SYNC_DMA_FOR_DEVICE
 	select ARCH_WANT_FRAME_POINTERS if FTRACE
 	select CLKSRC_MMIO
 	select CLONE_BACKWARDS
 	select COMMON_CLK
+	select DMA_NONCOHERENT_OPS
 	select GENERIC_ATOMIC64
 	select GENERIC_CPU_DEVICES
 	select GENERIC_CLOCKEVENTS
diff --git a/arch/nds32/include/asm/Kbuild b/arch/nds32/include/asm/Kbuild
index 06bdf8167f5a..b3e951f805f8 100644
--- a/arch/nds32/include/asm/Kbuild
+++ b/arch/nds32/include/asm/Kbuild
@@ -13,6 +13,7 @@ generic-y += cputime.h
 generic-y += device.h
 generic-y += div64.h
 generic-y += dma.h
+generic-y += dma-mapping.h
 generic-y += emergency-restart.h
 generic-y += errno.h
 generic-y += exec.h
diff --git a/arch/nds32/include/asm/dma-mapping.h b/arch/nds32/include/asm/dma-mapping.h
deleted file mode 100644
index 2dd47d245c25..000000000000
--- a/arch/nds32/include/asm/dma-mapping.h
+++ /dev/null
@@ -1,14 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-// Copyright (C) 2005-2017 Andes Technology Corporation
-
-#ifndef ASMNDS32_DMA_MAPPING_H
-#define ASMNDS32_DMA_MAPPING_H
-
-extern struct dma_map_ops nds32_dma_ops;
-
-static inline struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
-{
-	return &nds32_dma_ops;
-}
-
-#endif
diff --git a/arch/nds32/kernel/dma.c b/arch/nds32/kernel/dma.c
index d291800fc621..78311a1e6fd1 100644
--- a/arch/nds32/kernel/dma.c
+++ b/arch/nds32/kernel/dma.c
@@ -3,17 +3,14 @@
 
 #include <linux/types.h>
 #include <linux/mm.h>
-#include <linux/export.h>
 #include <linux/string.h>
-#include <linux/scatterlist.h>
-#include <linux/dma-mapping.h>
+#include <linux/dma-noncoherent.h>
 #include <linux/io.h>
 #include <linux/cache.h>
 #include <linux/highmem.h>
 #include <linux/slab.h>
 #include <asm/cacheflush.h>
 #include <asm/tlbflush.h>
-#include <asm/dma-mapping.h>
 #include <asm/proc-fns.h>
 
 /*
@@ -22,11 +19,6 @@
 static pte_t *consistent_pte;
 static DEFINE_RAW_SPINLOCK(consistent_lock);
 
-enum master_type {
-	FOR_CPU = 0,
-	FOR_DEVICE = 1,
-};
-
 /*
  * VM region handling support.
  *
@@ -124,10 +116,8 @@ static struct arch_vm_region *vm_region_find(struct arch_vm_region *head,
 	return c;
 }
 
-/* FIXME: attrs is not used. */
-static void *nds32_dma_alloc_coherent(struct device *dev, size_t size,
-				      dma_addr_t * handle, gfp_t gfp,
-				      unsigned long attrs)
+void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
+		gfp_t gfp, unsigned long attrs)
 {
 	struct page *page;
 	struct arch_vm_region *c;
@@ -232,8 +222,8 @@ static void *nds32_dma_alloc_coherent(struct device *dev, size_t size,
 	return NULL;
 }
 
-static void nds32_dma_free(struct device *dev, size_t size, void *cpu_addr,
-			   dma_addr_t handle, unsigned long attrs)
+void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
+		dma_addr_t handle, unsigned long attrs)
 {
 	struct arch_vm_region *c;
 	unsigned long flags, addr;
@@ -333,145 +323,39 @@ static int __init consistent_init(void)
 }
 
 core_initcall(consistent_init);
-static void consistent_sync(void *vaddr, size_t size, int direction, int master_type);
-static dma_addr_t nds32_dma_map_page(struct device *dev, struct page *page,
-				     unsigned long offset, size_t size,
-				     enum dma_data_direction dir,
-				     unsigned long attrs)
-{
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		consistent_sync((void *)(page_address(page) + offset), size, dir, FOR_DEVICE);
-	return page_to_phys(page) + offset;
-}
 
-static void nds32_dma_unmap_page(struct device *dev, dma_addr_t handle,
-				 size_t size, enum dma_data_direction dir,
-				 unsigned long attrs)
+void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
-		consistent_sync(phys_to_virt(handle), size, dir, FOR_CPU);
-}
-
-/*
- * Make an area consistent for devices.
- */
-static void consistent_sync(void *vaddr, size_t size, int direction, int master_type)
-{
-	unsigned long start = (unsigned long)vaddr;
-	unsigned long end = start + size;
-
-	if (master_type == FOR_CPU) {
-		switch (direction) {
-		case DMA_TO_DEVICE:
-			break;
-		case DMA_FROM_DEVICE:
-		case DMA_BIDIRECTIONAL:
-			cpu_dma_inval_range(start, end);
-			break;
-		default:
-			BUG();
-		}
-	} else {
-		/* FOR_DEVICE */
-		switch (direction) {
-		case DMA_FROM_DEVICE:
-			break;
-		case DMA_TO_DEVICE:
-		case DMA_BIDIRECTIONAL:
-			cpu_dma_wb_range(start, end);
-			break;
-		default:
-			BUG();
-		}
+	void *addr = phys_to_virt(paddr);
+	unsigned long start = (unsigned long)addr;
+
+	switch (dir) {
+	case DMA_FROM_DEVICE:
+		break;
+	case DMA_TO_DEVICE:
+	case DMA_BIDIRECTIONAL:
+		cpu_dma_wb_range(start, start + size);
+		break;
+	default:
+		BUG();
 	}
 }
 
-static int nds32_dma_map_sg(struct device *dev, struct scatterlist *sg,
-			    int nents, enum dma_data_direction dir,
-			    unsigned long attrs)
+void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
+		size_t size, enum dma_data_direction dir)
 {
-	int i;
-
-	for (i = 0; i < nents; i++, sg++) {
-		void *virt;
-		unsigned long pfn;
-		struct page *page = sg_page(sg);
-
-		sg->dma_address = sg_phys(sg);
-		pfn = page_to_pfn(page) + sg->offset / PAGE_SIZE;
-		page = pfn_to_page(pfn);
-		if (PageHighMem(page)) {
-			virt = kmap_atomic(page);
-			consistent_sync(virt, sg->length, dir, FOR_CPU);
-			kunmap_atomic(virt);
-		} else {
-			if (sg->offset > PAGE_SIZE)
-				panic("sg->offset:%08x > PAGE_SIZE\n",
-				      sg->offset);
-			virt = page_address(page) + sg->offset;
-			consistent_sync(virt, sg->length, dir, FOR_CPU);
-		}
+	void *addr = phys_to_virt(paddr);
+	unsigned long start = (unsigned long)addr;
+
+	switch (dir) {
+	case DMA_TO_DEVICE:
+		break;
+	case DMA_FROM_DEVICE:
+	case DMA_BIDIRECTIONAL:
+		cpu_dma_inval_range(start, start + size);
+		break;
+	default:
+		BUG();
 	}
-	return nents;
 }
-
-static void nds32_dma_unmap_sg(struct device *dev, struct scatterlist *sg,
-			       int nhwentries, enum dma_data_direction dir,
-			       unsigned long attrs)
-{
-}
-
-static void
-nds32_dma_sync_single_for_cpu(struct device *dev, dma_addr_t handle,
-			      size_t size, enum dma_data_direction dir)
-{
-	consistent_sync((void *)phys_to_virt(handle), size, dir, FOR_CPU);
-}
-
-static void
-nds32_dma_sync_single_for_device(struct device *dev, dma_addr_t handle,
-				 size_t size, enum dma_data_direction dir)
-{
-	consistent_sync((void *)phys_to_virt(handle), size, dir, FOR_DEVICE);
-}
-
-static void
-nds32_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nents,
-			  enum dma_data_direction dir)
-{
-	int i;
-
-	for (i = 0; i < nents; i++, sg++) {
-		char *virt =
-		    page_address((struct page *)sg->page_link) + sg->offset;
-		consistent_sync(virt, sg->length, dir, FOR_CPU);
-	}
-}
-
-static void
-nds32_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
-			     int nents, enum dma_data_direction dir)
-{
-	int i;
-
-	for (i = 0; i < nents; i++, sg++) {
-		char *virt =
-		    page_address((struct page *)sg->page_link) + sg->offset;
-		consistent_sync(virt, sg->length, dir, FOR_DEVICE);
-	}
-}
-
-struct dma_map_ops nds32_dma_ops = {
-	.alloc = nds32_dma_alloc_coherent,
-	.free = nds32_dma_free,
-	.map_page = nds32_dma_map_page,
-	.unmap_page = nds32_dma_unmap_page,
-	.map_sg = nds32_dma_map_sg,
-	.unmap_sg = nds32_dma_unmap_sg,
-	.sync_single_for_device = nds32_dma_sync_single_for_device,
-	.sync_single_for_cpu = nds32_dma_sync_single_for_cpu,
-	.sync_sg_for_cpu = nds32_dma_sync_sg_for_cpu,
-	.sync_sg_for_device = nds32_dma_sync_sg_for_device,
-};
-
-EXPORT_SYMBOL(nds32_dma_ops);
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* Re: [PATCH 22/22] parisc: use generic dma_noncoherent_ops
  2018-04-21 17:43     ` Helge Deller
                         ` (2 preceding siblings ...)
  (?)
@ 2018-04-25  7:21       ` Christoph Hellwig
  -1 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-25  7:21 UTC (permalink / raw)
  To: Helge Deller
  Cc: Christoph Hellwig, linux-arch, Michal Simek, Greentime Hu,
	Vincent Chen, linux-alpha, linux-snps-arc, linux-arm-kernel,
	linux-c6x-dev, linux-hexagon, linux-m68k, nios2-dev, openrisc,
	linux-parisc, linux-sh, sparclinux, linux-kernel

On Sat, Apr 21, 2018 at 07:43:46PM +0200, Helge Deller wrote:
> This patch breaks a 32bit kernel on a B160L machine (PA7300LC CPU, "pcxl2").
> After applying this patch series the lasi82956 network driver works unreliable. 
> NIC gets IP, but ping doesn't work.
> See drivers/net/ethernet/i825xx/lasi_82596.c, it uses dma*sync() functions.

Just to confirm:  Without the series it is known to actually work?

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* [PATCH 22/22] parisc: use generic dma_noncoherent_ops
@ 2018-04-25  7:21       ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-25  7:21 UTC (permalink / raw)
  To: linux-snps-arc

On Sat, Apr 21, 2018@07:43:46PM +0200, Helge Deller wrote:
> This patch breaks a 32bit kernel on a B160L machine (PA7300LC CPU, "pcxl2").
> After applying this patch series the lasi82956 network driver works unreliable. 
> NIC gets IP, but ping doesn't work.
> See drivers/net/ethernet/i825xx/lasi_82596.c, it uses dma*sync() functions.

Just to confirm:  Without the series it is known to actually work?

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* Re: [PATCH 22/22] parisc: use generic dma_noncoherent_ops
@ 2018-04-25  7:21       ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-25  7:21 UTC (permalink / raw)
  To: Helge Deller
  Cc: Christoph Hellwig, linux-arch, Michal Simek, Greentime Hu,
	Vincent Chen, linux-alpha, linux-snps-arc, linux-arm-kernel,
	linux-c6x-dev, linux-hexagon, linux-m68k, nios2-dev, openrisc,
	linux-parisc, linux-sh, sparclinux, linux-kernel

On Sat, Apr 21, 2018 at 07:43:46PM +0200, Helge Deller wrote:
> This patch breaks a 32bit kernel on a B160L machine (PA7300LC CPU, "pcxl2").
> After applying this patch series the lasi82956 network driver works unreliable. 
> NIC gets IP, but ping doesn't work.
> See drivers/net/ethernet/i825xx/lasi_82596.c, it uses dma*sync() functions.

Just to confirm:  Without the series it is known to actually work?

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* [OpenRISC] [PATCH 22/22] parisc: use generic dma_noncoherent_ops
@ 2018-04-25  7:21       ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-25  7:21 UTC (permalink / raw)
  To: openrisc

On Sat, Apr 21, 2018 at 07:43:46PM +0200, Helge Deller wrote:
> This patch breaks a 32bit kernel on a B160L machine (PA7300LC CPU, "pcxl2").
> After applying this patch series the lasi82956 network driver works unreliable. 
> NIC gets IP, but ping doesn't work.
> See drivers/net/ethernet/i825xx/lasi_82596.c, it uses dma*sync() functions.

Just to confirm:  Without the series it is known to actually work?

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* [PATCH 22/22] parisc: use generic dma_noncoherent_ops
@ 2018-04-25  7:21       ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-25  7:21 UTC (permalink / raw)
  To: linux-arm-kernel

On Sat, Apr 21, 2018 at 07:43:46PM +0200, Helge Deller wrote:
> This patch breaks a 32bit kernel on a B160L machine (PA7300LC CPU, "pcxl2").
> After applying this patch series the lasi82956 network driver works unreliable. 
> NIC gets IP, but ping doesn't work.
> See drivers/net/ethernet/i825xx/lasi_82596.c, it uses dma*sync() functions.

Just to confirm:  Without the series it is known to actually work?

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* Re: [PATCH 06/22] arc: use generic dma_noncoherent_ops
@ 2018-04-25 11:17     ` Alexey Brodkin
  0 siblings, 0 replies; 2593+ messages in thread
From: Alexey Brodkin @ 2018-04-25 11:17 UTC (permalink / raw)
  To: hch@lst.de
  Cc: linux-arch@vger.kernel.org, linux-xtensa@linux-xtensa.org,
	monstr@monstr.eu, linux-snps-arc@lists.infradead.org,
	linux-c6x-dev@linux-c6x.org, linux-parisc@vger.kernel.org,
	linux-sh@vger.kernel.org, linux-hexagon@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org,
	openrisc@lists.librecores.org, green.hu@gmail.com,
	linux-alpha@vger.kernel.org, sparclinux@vger.kernel.org,
	"nios2-dev@lists.rocketboards.org" <nios>

Hi Christoph,

On Fri, 2018-04-20 at 10:02 +0200, Christoph Hellwig wrote:
> Switch to the generic noncoherent direct mapping implementation.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  arch/arc/Kconfig                   |   4 +
>  arch/arc/include/asm/Kbuild        |   1 +
>  arch/arc/include/asm/dma-mapping.h |  21 -----
>  arch/arc/mm/dma.c                  | 141 +++--------------------------
>  4 files changed, 19 insertions(+), 148 deletions(-)
>  delete mode 100644 arch/arc/include/asm/dma-mapping.h
> 

[snip]

> @@ -135,7 +134,7 @@ static int arc_dma_mmap(struct device *dev, struct vm_area_struct *vma,
>   * CPU accesses page via normal paddr, thus needs to explicitly made
>   * consistent before each use
>   */
> -static void _dma_cache_sync(phys_addr_t paddr, size_t size,
> +static void _dma_cache_sync(struct device *dev, phys_addr_t paddr size_t size,
>  		enum dma_data_direction dir)

Seems like there's a missing comma:
----------------------------------->8------------------------------------
--- a/arch/arc/mm/dma.c
+++ b/arch/arc/mm/dma.c
@@ -134,7 +134,7 @@ int arch_dma_mmap(struct device *dev, struct vm_area_struct *vma,
  * CPU accesses page via normal paddr, thus needs to explicitly made
  * consistent before each use
  */
-static void _dma_cache_sync(struct device *dev, phys_addr_t paddr size_t size,
+static void _dma_cache_sync(struct device *dev, phys_addr_t paddr, size_t size,
                enum dma_data_direction dir)
 {
        switch (dir) {
----------------------------------->8------------------------------------

Which is actually strange as I would expect ARC code to be built by bots.

Anyways with above fix I do see problems with both USB and Ethernet controllers
on ARC HSDK board.
----------------------------------->8------------------------------------
usb 1-1: new high-speed USB device number 2 using ehci-platform
usb 1-1: device descriptor read/64, error -32
usb 1-1: device descriptor read/64, error -32
usb 1-1: new high-speed USB device number 3 using ehci-platform
usb 1-1: device descriptor read/64, error -32
usb 1-1: device descriptor read/64, error -32
usb usb1-port1: attempt power cycle
usb 1-1: new high-speed USB device number 4 using ehci-platform
usb 1-1: device not accepting address 4, error -32
usb 1-1: new high-speed USB device number 5 using ehci-platform
usb 1-1: device not accepting address 5, error -32

...

# wget ftp://ftp.denx.de/pub/u-boot/u-boot-1.0.0.tar.bz2
Connecting to ftp.denx.de (81.169.202.6:21)
wget: can't connect to remote host (81.169.202.6): No route to host
----------------------------------->8------------------------------------

Will all patches from the series reverted (i.e. with
your base-line) all issues go away.

I'll need to spend more time on checking what's actually wrong.

-Alexey

P.S. Note to my ARC colleagues - it's required to disable IO Coherency
to get DMA ops really used, it could be obviously done with:
----------------------------------->8------------------------------------
--- a/arch/arc/mm/cache.c
+++ b/arch/arc/mm/cache.c
@@ -27,7 +27,7 @@
 
 static int l2_line_sz;
 static int ioc_exists;
-int slc_enable = 1, ioc_enable = 1;
+int slc_enable = 1, ioc_enable = 0;
 unsigned long perip_base = ARC_UNCACHED_ADDR_SPACE; /* legacy value for boot */
 unsigned long perip_end = 0xFFFFFFFF; /* legacy value */
----------------------------------->8------------------------------------

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* Re: [PATCH 06/22] arc: use generic dma_noncoherent_ops
@ 2018-04-25 11:17     ` Alexey Brodkin
  0 siblings, 0 replies; 2593+ messages in thread
From: Alexey Brodkin @ 2018-04-25 11:17 UTC (permalink / raw)
  To: hch@lst.de
  Cc: deanbo422@gmail.com, linux-sh@vger.kernel.org,
	linux-kernel@vger.kernel.org, nios2-dev@lists.rocketboards.org,
	linux-xtensa@linux-xtensa.org, linux-m68k@lists.linux-m68k.org,
	linux-alpha@vger.kernel.org, linux-hexagon@vger.kernel.org,
	linux-snps-arc@lists.infradead.org, green.hu@gmail.com,
	openrisc@lists.librecores.org,
	linux-arm-kernel@lists.infradead.org, monstr@monstr.eu,
	linux-parisc@vger.kernel.org, linux-c6x-dev@linux-c6x.org,
	linux-arch@vger.kernel.org, sparclinux@vger.kernel.org

Hi Christoph,

On Fri, 2018-04-20 at 10:02 +0200, Christoph Hellwig wrote:
> Switch to the generic noncoherent direct mapping implementation.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  arch/arc/Kconfig                   |   4 +
>  arch/arc/include/asm/Kbuild        |   1 +
>  arch/arc/include/asm/dma-mapping.h |  21 -----
>  arch/arc/mm/dma.c                  | 141 +++--------------------------
>  4 files changed, 19 insertions(+), 148 deletions(-)
>  delete mode 100644 arch/arc/include/asm/dma-mapping.h
> 

[snip]

> @@ -135,7 +134,7 @@ static int arc_dma_mmap(struct device *dev, struct vm_area_struct *vma,
>   * CPU accesses page via normal paddr, thus needs to explicitly made
>   * consistent before each use
>   */
> -static void _dma_cache_sync(phys_addr_t paddr, size_t size,
> +static void _dma_cache_sync(struct device *dev, phys_addr_t paddr size_t size,
>  		enum dma_data_direction dir)

Seems like there's a missing comma:
----------------------------------->8------------------------------------
--- a/arch/arc/mm/dma.c
+++ b/arch/arc/mm/dma.c
@@ -134,7 +134,7 @@ int arch_dma_mmap(struct device *dev, struct vm_area_struct *vma,
  * CPU accesses page via normal paddr, thus needs to explicitly made
  * consistent before each use
  */
-static void _dma_cache_sync(struct device *dev, phys_addr_t paddr size_t size,
+static void _dma_cache_sync(struct device *dev, phys_addr_t paddr, size_t size,
                enum dma_data_direction dir)
 {
        switch (dir) {
----------------------------------->8------------------------------------

Which is actually strange as I would expect ARC code to be built by bots.

Anyways with above fix I do see problems with both USB and Ethernet controllers
on ARC HSDK board.
----------------------------------->8------------------------------------
usb 1-1: new high-speed USB device number 2 using ehci-platform
usb 1-1: device descriptor read/64, error -32
usb 1-1: device descriptor read/64, error -32
usb 1-1: new high-speed USB device number 3 using ehci-platform
usb 1-1: device descriptor read/64, error -32
usb 1-1: device descriptor read/64, error -32
usb usb1-port1: attempt power cycle
usb 1-1: new high-speed USB device number 4 using ehci-platform
usb 1-1: device not accepting address 4, error -32
usb 1-1: new high-speed USB device number 5 using ehci-platform
usb 1-1: device not accepting address 5, error -32

...

# wget ftp://ftp.denx.de/pub/u-boot/u-boot-1.0.0.tar.bz2
Connecting to ftp.denx.de (81.169.202.6:21)
wget: can't connect to remote host (81.169.202.6): No route to host
----------------------------------->8------------------------------------

Will all patches from the series reverted (i.e. with
your base-line) all issues go away.

I'll need to spend more time on checking what's actually wrong.

-Alexey

P.S. Note to my ARC colleagues - it's required to disable IO Coherency
to get DMA ops really used, it could be obviously done with:
----------------------------------->8------------------------------------
--- a/arch/arc/mm/cache.c
+++ b/arch/arc/mm/cache.c
@@ -27,7 +27,7 @@
 
 static int l2_line_sz;
 static int ioc_exists;
-int slc_enable = 1, ioc_enable = 1;
+int slc_enable = 1, ioc_enable = 0;
 unsigned long perip_base = ARC_UNCACHED_ADDR_SPACE; /* legacy value for boot */
 unsigned long perip_end = 0xFFFFFFFF; /* legacy value */
----------------------------------->8------------------------------------

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* Re: [PATCH 06/22] arc: use generic dma_noncoherent_ops
@ 2018-04-25 11:17     ` Alexey Brodkin
  0 siblings, 0 replies; 2593+ messages in thread
From: Alexey Brodkin @ 2018-04-25 11:17 UTC (permalink / raw)
  To: hch@lst.de
  Cc: linux-arch@vger.kernel.org, linux-xtensa@linux-xtensa.org,
	monstr@monstr.eu, linux-snps-arc@lists.infradead.org,
	linux-c6x-dev@linux-c6x.org, linux-parisc@vger.kernel.org,
	linux-sh@vger.kernel.org, linux-hexagon@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org,
	openrisc@lists.librecores.org, green.hu@gmail.com,
	linux-alpha@vger.kernel.org, sparclinux@vger.kernel.org,
	"nios2-dev@lists.rocketboards.org" <nios

Hi Christoph,

On Fri, 2018-04-20 at 10:02 +0200, Christoph Hellwig wrote:
> Switch to the generic noncoherent direct mapping implementation.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  arch/arc/Kconfig                   |   4 +
>  arch/arc/include/asm/Kbuild        |   1 +
>  arch/arc/include/asm/dma-mapping.h |  21 -----
>  arch/arc/mm/dma.c                  | 141 +++--------------------------
>  4 files changed, 19 insertions(+), 148 deletions(-)
>  delete mode 100644 arch/arc/include/asm/dma-mapping.h
> 

[snip]

> @@ -135,7 +134,7 @@ static int arc_dma_mmap(struct device *dev, struct vm_area_struct *vma,
>   * CPU accesses page via normal paddr, thus needs to explicitly made
>   * consistent before each use
>   */
> -static void _dma_cache_sync(phys_addr_t paddr, size_t size,
> +static void _dma_cache_sync(struct device *dev, phys_addr_t paddr size_t size,
>  		enum dma_data_direction dir)

Seems like there's a missing comma:
----------------------------------->8------------------------------------
--- a/arch/arc/mm/dma.c
+++ b/arch/arc/mm/dma.c
@@ -134,7 +134,7 @@ int arch_dma_mmap(struct device *dev, struct vm_area_struct *vma,
  * CPU accesses page via normal paddr, thus needs to explicitly made
  * consistent before each use
  */
-static void _dma_cache_sync(struct device *dev, phys_addr_t paddr size_t size,
+static void _dma_cache_sync(struct device *dev, phys_addr_t paddr, size_t size,
                enum dma_data_direction dir)
 {
        switch (dir) {
----------------------------------->8------------------------------------

Which is actually strange as I would expect ARC code to be built by bots.

Anyways with above fix I do see problems with both USB and Ethernet controllers
on ARC HSDK board.
----------------------------------->8------------------------------------
usb 1-1: new high-speed USB device number 2 using ehci-platform
usb 1-1: device descriptor read/64, error -32
usb 1-1: device descriptor read/64, error -32
usb 1-1: new high-speed USB device number 3 using ehci-platform
usb 1-1: device descriptor read/64, error -32
usb 1-1: device descriptor read/64, error -32
usb usb1-port1: attempt power cycle
usb 1-1: new high-speed USB device number 4 using ehci-platform
usb 1-1: device not accepting address 4, error -32
usb 1-1: new high-speed USB device number 5 using ehci-platform
usb 1-1: device not accepting address 5, error -32

...

# wget ftp://ftp.denx.de/pub/u-boot/u-boot-1.0.0.tar.bz2
Connecting to ftp.denx.de (81.169.202.6:21)
wget: can't connect to remote host (81.169.202.6): No route to host
----------------------------------->8------------------------------------

Will all patches from the series reverted (i.e. with
your base-line) all issues go away.

I'll need to spend more time on checking what's actually wrong.

-Alexey

P.S. Note to my ARC colleagues - it's required to disable IO Coherency
to get DMA ops really used, it could be obviously done with:
----------------------------------->8------------------------------------
--- a/arch/arc/mm/cache.c
+++ b/arch/arc/mm/cache.c
@@ -27,7 +27,7 @@
 
 static int l2_line_sz;
 static int ioc_exists;
-int slc_enable = 1, ioc_enable = 1;
+int slc_enable = 1, ioc_enable = 0;
 unsigned long perip_base = ARC_UNCACHED_ADDR_SPACE; /* legacy value for boot */
 unsigned long perip_end = 0xFFFFFFFF; /* legacy value */
----------------------------------->8------------------------------------

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* [PATCH 06/22] arc: use generic dma_noncoherent_ops
@ 2018-04-25 11:17     ` Alexey Brodkin
  0 siblings, 0 replies; 2593+ messages in thread
From: Alexey Brodkin @ 2018-04-25 11:17 UTC (permalink / raw)
  To: linux-snps-arc

Hi Christoph,

On Fri, 2018-04-20@10:02 +0200, Christoph Hellwig wrote:
> Switch to the generic noncoherent direct mapping implementation.
> 
> Signed-off-by: Christoph Hellwig <hch at lst.de>
> ---
>  arch/arc/Kconfig                   |   4 +
>  arch/arc/include/asm/Kbuild        |   1 +
>  arch/arc/include/asm/dma-mapping.h |  21 -----
>  arch/arc/mm/dma.c                  | 141 +++--------------------------
>  4 files changed, 19 insertions(+), 148 deletions(-)
>  delete mode 100644 arch/arc/include/asm/dma-mapping.h
> 

[snip]

> @@ -135,7 +134,7 @@ static int arc_dma_mmap(struct device *dev, struct vm_area_struct *vma,
>   * CPU accesses page via normal paddr, thus needs to explicitly made
>   * consistent before each use
>   */
> -static void _dma_cache_sync(phys_addr_t paddr, size_t size,
> +static void _dma_cache_sync(struct device *dev, phys_addr_t paddr size_t size,
>  		enum dma_data_direction dir)

Seems like there's a missing comma:
----------------------------------->8------------------------------------
--- a/arch/arc/mm/dma.c
+++ b/arch/arc/mm/dma.c
@@ -134,7 +134,7 @@ int arch_dma_mmap(struct device *dev, struct vm_area_struct *vma,
  * CPU accesses page via normal paddr, thus needs to explicitly made
  * consistent before each use
  */
-static void _dma_cache_sync(struct device *dev, phys_addr_t paddr size_t size,
+static void _dma_cache_sync(struct device *dev, phys_addr_t paddr, size_t size,
                enum dma_data_direction dir)
 {
        switch (dir) {
----------------------------------->8------------------------------------

Which is actually strange as I would expect ARC code to be built by bots.

Anyways with above fix I do see problems with both USB and Ethernet controllers
on ARC HSDK board.
----------------------------------->8------------------------------------
usb 1-1: new high-speed USB device number 2 using ehci-platform
usb 1-1: device descriptor read/64, error -32
usb 1-1: device descriptor read/64, error -32
usb 1-1: new high-speed USB device number 3 using ehci-platform
usb 1-1: device descriptor read/64, error -32
usb 1-1: device descriptor read/64, error -32
usb usb1-port1: attempt power cycle
usb 1-1: new high-speed USB device number 4 using ehci-platform
usb 1-1: device not accepting address 4, error -32
usb 1-1: new high-speed USB device number 5 using ehci-platform
usb 1-1: device not accepting address 5, error -32

...

# wget ftp://ftp.denx.de/pub/u-boot/u-boot-1.0.0.tar.bz2
Connecting to ftp.denx.de (81.169.202.6:21)
wget: can't connect to remote host (81.169.202.6): No route to host
----------------------------------->8------------------------------------

Will all patches from the series reverted (i.e. with
your base-line) all issues go away.

I'll need to spend more time on checking what's actually wrong.

-Alexey

P.S. Note to my ARC colleagues - it's required to disable IO Coherency
to get DMA ops really used, it could be obviously done with:
----------------------------------->8------------------------------------
--- a/arch/arc/mm/cache.c
+++ b/arch/arc/mm/cache.c
@@ -27,7 +27,7 @@
 
 static int l2_line_sz;
 static int ioc_exists;
-int slc_enable = 1, ioc_enable = 1;
+int slc_enable = 1, ioc_enable = 0;
 unsigned long perip_base = ARC_UNCACHED_ADDR_SPACE; /* legacy value for boot */
 unsigned long perip_end = 0xFFFFFFFF; /* legacy value */
----------------------------------->8------------------------------------

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* Re: [PATCH 06/22] arc: use generic dma_noncoherent_ops
@ 2018-04-25 11:17     ` Alexey Brodkin
  0 siblings, 0 replies; 2593+ messages in thread
From: Alexey Brodkin @ 2018-04-25 11:17 UTC (permalink / raw)
  To: hch@lst.de
  Cc: linux-arch@vger.kernel.org, linux-xtensa@linux-xtensa.org,
	monstr@monstr.eu, linux-snps-arc@lists.infradead.org,
	linux-c6x-dev@linux-c6x.org, linux-parisc@vger.kernel.org,
	linux-sh@vger.kernel.org, linux-hexagon@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-m68k@lists.linux-m68k.org,
	openrisc@lists.librecores.org, green.hu@gmail.com,
	linux-alpha@vger.kernel.org, sparclinux@vger.kernel.org,
	"nios2-dev@lists.rocketboards.org" <nios>

SGkgQ2hyaXN0b3BoLA0KDQpPbiBGcmksIDIwMTgtMDQtMjAgYXQgMTA6MDIgKzAyMDAsIENocmlz
dG9waCBIZWxsd2lnIHdyb3RlOg0KPiBTd2l0Y2ggdG8gdGhlIGdlbmVyaWMgbm9uY29oZXJlbnQg
ZGlyZWN0IG1hcHBpbmcgaW1wbGVtZW50YXRpb24uDQo+IA0KPiBTaWduZWQtb2ZmLWJ5OiBDaHJp
c3RvcGggSGVsbHdpZyA8aGNoQGxzdC5kZT4NCj4gLS0tDQo+ICBhcmNoL2FyYy9LY29uZmlnICAg
ICAgICAgICAgICAgICAgIHwgICA0ICsNCj4gIGFyY2gvYXJjL2luY2x1ZGUvYXNtL0tidWlsZCAg
ICAgICAgfCAgIDEgKw0KPiAgYXJjaC9hcmMvaW5jbHVkZS9hc20vZG1hLW1hcHBpbmcuaCB8ICAy
MSAtLS0tLQ0KPiAgYXJjaC9hcmMvbW0vZG1hLmMgICAgICAgICAgICAgICAgICB8IDE0MSArKyst
LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KPiAgNCBmaWxlcyBjaGFuZ2VkLCAxOSBpbnNlcnRp
b25zKCspLCAxNDggZGVsZXRpb25zKC0pDQo+ICBkZWxldGUgbW9kZSAxMDA2NDQgYXJjaC9hcmMv
aW5jbHVkZS9hc20vZG1hLW1hcHBpbmcuaA0KPiANCg0KW3NuaXBdDQoNCj4gQEAgLTEzNSw3ICsx
MzQsNyBAQCBzdGF0aWMgaW50IGFyY19kbWFfbW1hcChzdHJ1Y3QgZGV2aWNlICpkZXYsIHN0cnVj
dCB2bV9hcmVhX3N0cnVjdCAqdm1hLA0KPiAgICogQ1BVIGFjY2Vzc2VzIHBhZ2UgdmlhIG5vcm1h
bCBwYWRkciwgdGh1cyBuZWVkcyB0byBleHBsaWNpdGx5IG1hZGUNCj4gICAqIGNvbnNpc3RlbnQg
YmVmb3JlIGVhY2ggdXNlDQo+ICAgKi8NCj4gLXN0YXRpYyB2b2lkIF9kbWFfY2FjaGVfc3luYyhw
aHlzX2FkZHJfdCBwYWRkciwgc2l6ZV90IHNpemUsDQo+ICtzdGF0aWMgdm9pZCBfZG1hX2NhY2hl
X3N5bmMoc3RydWN0IGRldmljZSAqZGV2LCBwaHlzX2FkZHJfdCBwYWRkciBzaXplX3Qgc2l6ZSwN
Cj4gIAkJZW51bSBkbWFfZGF0YV9kaXJlY3Rpb24gZGlyKQ0KDQpTZWVtcyBsaWtlIHRoZXJlJ3Mg
YSBtaXNzaW5nIGNvbW1hOg0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0+OC0t
LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KLS0tIGEvYXJjaC9hcmMvbW0vZG1h
LmMNCisrKyBiL2FyY2gvYXJjL21tL2RtYS5jDQpAQCAtMTM0LDcgKzEzNCw3IEBAIGludCBhcmNo
X2RtYV9tbWFwKHN0cnVjdCBkZXZpY2UgKmRldiwgc3RydWN0IHZtX2FyZWFfc3RydWN0ICp2bWEs
DQogICogQ1BVIGFjY2Vzc2VzIHBhZ2UgdmlhIG5vcm1hbCBwYWRkciwgdGh1cyBuZWVkcyB0byBl
eHBsaWNpdGx5IG1hZGUNCiAgKiBjb25zaXN0ZW50IGJlZm9yZSBlYWNoIHVzZQ0KICAqLw0KLXN0
YXRpYyB2b2lkIF9kbWFfY2FjaGVfc3luYyhzdHJ1Y3QgZGV2aWNlICpkZXYsIHBoeXNfYWRkcl90
IHBhZGRyIHNpemVfdCBzaXplLA0KK3N0YXRpYyB2b2lkIF9kbWFfY2FjaGVfc3luYyhzdHJ1Y3Qg
ZGV2aWNlICpkZXYsIHBoeXNfYWRkcl90IHBhZGRyLCBzaXplX3Qgc2l6ZSwNCiAgICAgICAgICAg
ICAgICBlbnVtIGRtYV9kYXRhX2RpcmVjdGlvbiBkaXIpDQogew0KICAgICAgICBzd2l0Y2ggKGRp
cikgew0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0+OC0tLS0tLS0tLS0tLS0t
LS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KDQpXaGljaCBpcyBhY3R1YWxseSBzdHJhbmdlIGFzIEkg
d291bGQgZXhwZWN0IEFSQyBjb2RlIHRvIGJlIGJ1aWx0IGJ5IGJvdHMuDQoNCkFueXdheXMgd2l0
aCBhYm92ZSBmaXggSSBkbyBzZWUgcHJvYmxlbXMgd2l0aCBib3RoIFVTQiBhbmQgRXRoZXJuZXQg
Y29udHJvbGxlcnMNCm9uIEFSQyBIU0RLIGJvYXJkLg0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t
LS0tLS0tLS0tLS0+OC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KdXNiIDEt
MTogbmV3IGhpZ2gtc3BlZWQgVVNCIGRldmljZSBudW1iZXIgMiB1c2luZyBlaGNpLXBsYXRmb3Jt
DQp1c2IgMS0xOiBkZXZpY2UgZGVzY3JpcHRvciByZWFkLzY0LCBlcnJvciAtMzINCnVzYiAxLTE6
IGRldmljZSBkZXNjcmlwdG9yIHJlYWQvNjQsIGVycm9yIC0zMg0KdXNiIDEtMTogbmV3IGhpZ2gt
c3BlZWQgVVNCIGRldmljZSBudW1iZXIgMyB1c2luZyBlaGNpLXBsYXRmb3JtDQp1c2IgMS0xOiBk
ZXZpY2UgZGVzY3JpcHRvciByZWFkLzY0LCBlcnJvciAtMzINCnVzYiAxLTE6IGRldmljZSBkZXNj
cmlwdG9yIHJlYWQvNjQsIGVycm9yIC0zMg0KdXNiIHVzYjEtcG9ydDE6IGF0dGVtcHQgcG93ZXIg
Y3ljbGUNCnVzYiAxLTE6IG5ldyBoaWdoLXNwZWVkIFVTQiBkZXZpY2UgbnVtYmVyIDQgdXNpbmcg
ZWhjaS1wbGF0Zm9ybQ0KdXNiIDEtMTogZGV2aWNlIG5vdCBhY2NlcHRpbmcgYWRkcmVzcyA0LCBl
cnJvciAtMzINCnVzYiAxLTE6IG5ldyBoaWdoLXNwZWVkIFVTQiBkZXZpY2UgbnVtYmVyIDUgdXNp
bmcgZWhjaS1wbGF0Zm9ybQ0KdXNiIDEtMTogZGV2aWNlIG5vdCBhY2NlcHRpbmcgYWRkcmVzcyA1
LCBlcnJvciAtMzINCg0KLi4uDQoNCiMgd2dldCBmdHA6Ly9mdHAuZGVueC5kZS9wdWIvdS1ib290
L3UtYm9vdC0xLjAuMC50YXIuYnoyDQpDb25uZWN0aW5nIHRvIGZ0cC5kZW54LmRlICg4MS4xNjku
MjAyLjY6MjEpDQp3Z2V0OiBjYW4ndCBjb25uZWN0IHRvIHJlbW90ZSBob3N0ICg4MS4xNjkuMjAy
LjYpOiBObyByb3V0ZSB0byBob3N0DQotLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t
LT44LS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tDQoNCldpbGwgYWxsIHBhdGNo
ZXMgZnJvbSB0aGUgc2VyaWVzIHJldmVydGVkIChpLmUuIHdpdGgNCnlvdXIgYmFzZS1saW5lKSBh
bGwgaXNzdWVzIGdvIGF3YXkuDQoNCkknbGwgbmVlZCB0byBzcGVuZCBtb3JlIHRpbWUgb24gY2hl
Y2tpbmcgd2hhdCdzIGFjdHVhbGx5IHdyb25nLg0KDQotQWxleGV5DQoNClAuUy4gTm90ZSB0byBt
eSBBUkMgY29sbGVhZ3VlcyAtIGl0J3MgcmVxdWlyZWQgdG8gZGlzYWJsZSBJTyBDb2hlcmVuY3kN
CnRvIGdldCBETUEgb3BzIHJlYWxseSB1c2VkLCBpdCBjb3VsZCBiZSBvYnZpb3VzbHkgZG9uZSB3
aXRoOg0KLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0+OC0tLS0tLS0tLS0tLS0t
LS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KLS0tIGEvYXJjaC9hcmMvbW0vY2FjaGUuYw0KKysrIGIv
YXJjaC9hcmMvbW0vY2FjaGUuYw0KQEAgLTI3LDcgKzI3LDcgQEANCiANCiBzdGF0aWMgaW50IGwy
X2xpbmVfc3o7DQogc3RhdGljIGludCBpb2NfZXhpc3RzOw0KLWludCBzbGNfZW5hYmxlID0gMSwg
aW9jX2VuYWJsZSA9IDE7DQoraW50IHNsY19lbmFibGUgPSAxLCBpb2NfZW5hYmxlID0gMDsNCiB1
bnNpZ25lZCBsb25nIHBlcmlwX2Jhc2UgPSBBUkNfVU5DQUNIRURfQUREUl9TUEFDRTsgLyogbGVn
YWN5IHZhbHVlIGZvciBib290ICovDQogdW5zaWduZWQgbG9uZyBwZXJpcF9lbmQgPSAweEZGRkZG
RkZGOyAvKiBsZWdhY3kgdmFsdWUgKi8NCi0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0t
LS0tPjgtLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0tLS0NCg=

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* [PATCH 06/22] arc: use generic dma_noncoherent_ops
@ 2018-04-25 11:17     ` Alexey Brodkin
  0 siblings, 0 replies; 2593+ messages in thread
From: Alexey Brodkin @ 2018-04-25 11:17 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Christoph,

On Fri, 2018-04-20 at 10:02 +0200, Christoph Hellwig wrote:
> Switch to the generic noncoherent direct mapping implementation.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  arch/arc/Kconfig                   |   4 +
>  arch/arc/include/asm/Kbuild        |   1 +
>  arch/arc/include/asm/dma-mapping.h |  21 -----
>  arch/arc/mm/dma.c                  | 141 +++--------------------------
>  4 files changed, 19 insertions(+), 148 deletions(-)
>  delete mode 100644 arch/arc/include/asm/dma-mapping.h
> 

[snip]

> @@ -135,7 +134,7 @@ static int arc_dma_mmap(struct device *dev, struct vm_area_struct *vma,
>   * CPU accesses page via normal paddr, thus needs to explicitly made
>   * consistent before each use
>   */
> -static void _dma_cache_sync(phys_addr_t paddr, size_t size,
> +static void _dma_cache_sync(struct device *dev, phys_addr_t paddr size_t size,
>  		enum dma_data_direction dir)

Seems like there's a missing comma:
----------------------------------->8------------------------------------
--- a/arch/arc/mm/dma.c
+++ b/arch/arc/mm/dma.c
@@ -134,7 +134,7 @@ int arch_dma_mmap(struct device *dev, struct vm_area_struct *vma,
  * CPU accesses page via normal paddr, thus needs to explicitly made
  * consistent before each use
  */
-static void _dma_cache_sync(struct device *dev, phys_addr_t paddr size_t size,
+static void _dma_cache_sync(struct device *dev, phys_addr_t paddr, size_t size,
                enum dma_data_direction dir)
 {
        switch (dir) {
----------------------------------->8------------------------------------

Which is actually strange as I would expect ARC code to be built by bots.

Anyways with above fix I do see problems with both USB and Ethernet controllers
on ARC HSDK board.
----------------------------------->8------------------------------------
usb 1-1: new high-speed USB device number 2 using ehci-platform
usb 1-1: device descriptor read/64, error -32
usb 1-1: device descriptor read/64, error -32
usb 1-1: new high-speed USB device number 3 using ehci-platform
usb 1-1: device descriptor read/64, error -32
usb 1-1: device descriptor read/64, error -32
usb usb1-port1: attempt power cycle
usb 1-1: new high-speed USB device number 4 using ehci-platform
usb 1-1: device not accepting address 4, error -32
usb 1-1: new high-speed USB device number 5 using ehci-platform
usb 1-1: device not accepting address 5, error -32

...

# wget ftp://ftp.denx.de/pub/u-boot/u-boot-1.0.0.tar.bz2
Connecting to ftp.denx.de (81.169.202.6:21)
wget: can't connect to remote host (81.169.202.6): No route to host
----------------------------------->8------------------------------------

Will all patches from the series reverted (i.e. with
your base-line) all issues go away.

I'll need to spend more time on checking what's actually wrong.

-Alexey

P.S. Note to my ARC colleagues - it's required to disable IO Coherency
to get DMA ops really used, it could be obviously done with:
----------------------------------->8------------------------------------
--- a/arch/arc/mm/cache.c
+++ b/arch/arc/mm/cache.c
@@ -27,7 +27,7 @@
 
 static int l2_line_sz;
 static int ioc_exists;
-int slc_enable = 1, ioc_enable = 1;
+int slc_enable = 1, ioc_enable = 0;
 unsigned long perip_base = ARC_UNCACHED_ADDR_SPACE; /* legacy value for boot */
 unsigned long perip_end = 0xFFFFFFFF; /* legacy value */
----------------------------------->8------------------------------------

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* Re: [PATCH 13/22] nds32: use generic dma_noncoherent_ops
  2018-04-25  6:40           ` Christoph Hellwig
                               ` (2 preceding siblings ...)
  (?)
@ 2018-04-25 12:25             ` Greentime Hu
  -1 siblings, 0 replies; 2593+ messages in thread
From: Greentime Hu @ 2018-04-25 12:25 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-arch, Michal Simek, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, Linux Kernel Mailing List

2018-04-25 14:40 GMT+08:00 Christoph Hellwig <hch@lst.de>:
> On Wed, Apr 25, 2018 at 09:43:43AM +0800, Greentime Hu wrote:
>> Hi Crhistoph,
>>
>> The ftmac100 works if I revert this commit.
>
> Thanks.  ftmac100 only use dma_map_page, which in the old nds32 code
> is just doing a plain page_address and never kmaps.  Can you apply
> the patch below on the tree with the origin "nds32: use generic
> dma_noncoherent_ops" reverted?  This always just uses page_address,
> although that, just like the original code is broken if you actually
> have highmem that needs to be mapped:
>

Hi, Christoph,

It still failed.

> ---
> From 1dc5d1cae4cd7b9ce03d0e2943364ed4cca938d7 Mon Sep 17 00:00:00 2001
> From: Christoph Hellwig <hch@lst.de>
> Date: Mon, 16 Apr 2018 19:20:30 +0200
> Subject: nds32: use generic dma_noncoherent_ops
>
> Switch to the generic noncoherent direct mapping implementation.
>
> This makes sure the cache_sync routines is called in the unmap_sg
> case, to match the unmap_single and sync_{single,sg}_to_cpu cases.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  arch/nds32/Kconfig                   |   3 +
>  arch/nds32/include/asm/Kbuild        |   1 +
>  arch/nds32/include/asm/dma-mapping.h |  14 ---
>  arch/nds32/kernel/dma.c              | 182 +++++----------------------
>  4 files changed, 37 insertions(+), 163 deletions(-)
>  delete mode 100644 arch/nds32/include/asm/dma-mapping.h
>
> diff --git a/arch/nds32/Kconfig b/arch/nds32/Kconfig
> index 249f38d3388f..67d0ac0a989c 100644
> --- a/arch/nds32/Kconfig
> +++ b/arch/nds32/Kconfig
> @@ -5,10 +5,13 @@
>
>  config NDS32
>          def_bool y
> +       select ARCH_HAS_SYNC_DMA_FOR_CPU
> +       select ARCH_HAS_SYNC_DMA_FOR_DEVICE
>         select ARCH_WANT_FRAME_POINTERS if FTRACE
>         select CLKSRC_MMIO
>         select CLONE_BACKWARDS
>         select COMMON_CLK
> +       select DMA_NONCOHERENT_OPS
>         select GENERIC_ATOMIC64
>         select GENERIC_CPU_DEVICES
>         select GENERIC_CLOCKEVENTS
> diff --git a/arch/nds32/include/asm/Kbuild b/arch/nds32/include/asm/Kbuild
> index 06bdf8167f5a..b3e951f805f8 100644
> --- a/arch/nds32/include/asm/Kbuild
> +++ b/arch/nds32/include/asm/Kbuild
> @@ -13,6 +13,7 @@ generic-y += cputime.h
>  generic-y += device.h
>  generic-y += div64.h
>  generic-y += dma.h
> +generic-y += dma-mapping.h
>  generic-y += emergency-restart.h
>  generic-y += errno.h
>  generic-y += exec.h
> diff --git a/arch/nds32/include/asm/dma-mapping.h b/arch/nds32/include/asm/dma-mapping.h
> deleted file mode 100644
> index 2dd47d245c25..000000000000
> --- a/arch/nds32/include/asm/dma-mapping.h
> +++ /dev/null
> @@ -1,14 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0
> -// Copyright (C) 2005-2017 Andes Technology Corporation
> -
> -#ifndef ASMNDS32_DMA_MAPPING_H
> -#define ASMNDS32_DMA_MAPPING_H
> -
> -extern struct dma_map_ops nds32_dma_ops;
> -
> -static inline struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
> -{
> -       return &nds32_dma_ops;
> -}
> -
> -#endif
> diff --git a/arch/nds32/kernel/dma.c b/arch/nds32/kernel/dma.c
> index d291800fc621..78311a1e6fd1 100644
> --- a/arch/nds32/kernel/dma.c
> +++ b/arch/nds32/kernel/dma.c
> @@ -3,17 +3,14 @@
>
>  #include <linux/types.h>
>  #include <linux/mm.h>
> -#include <linux/export.h>
>  #include <linux/string.h>
> -#include <linux/scatterlist.h>
> -#include <linux/dma-mapping.h>
> +#include <linux/dma-noncoherent.h>
>  #include <linux/io.h>
>  #include <linux/cache.h>
>  #include <linux/highmem.h>
>  #include <linux/slab.h>
>  #include <asm/cacheflush.h>
>  #include <asm/tlbflush.h>
> -#include <asm/dma-mapping.h>
>  #include <asm/proc-fns.h>
>
>  /*
> @@ -22,11 +19,6 @@
>  static pte_t *consistent_pte;
>  static DEFINE_RAW_SPINLOCK(consistent_lock);
>
> -enum master_type {
> -       FOR_CPU = 0,
> -       FOR_DEVICE = 1,
> -};
> -
>  /*
>   * VM region handling support.
>   *
> @@ -124,10 +116,8 @@ static struct arch_vm_region *vm_region_find(struct arch_vm_region *head,
>         return c;
>  }
>
> -/* FIXME: attrs is not used. */
> -static void *nds32_dma_alloc_coherent(struct device *dev, size_t size,
> -                                     dma_addr_t * handle, gfp_t gfp,
> -                                     unsigned long attrs)
> +void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
> +               gfp_t gfp, unsigned long attrs)
>  {
>         struct page *page;
>         struct arch_vm_region *c;
> @@ -232,8 +222,8 @@ static void *nds32_dma_alloc_coherent(struct device *dev, size_t size,
>         return NULL;
>  }
>
> -static void nds32_dma_free(struct device *dev, size_t size, void *cpu_addr,
> -                          dma_addr_t handle, unsigned long attrs)
> +void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
> +               dma_addr_t handle, unsigned long attrs)
>  {
>         struct arch_vm_region *c;
>         unsigned long flags, addr;
> @@ -333,145 +323,39 @@ static int __init consistent_init(void)
>  }
>
>  core_initcall(consistent_init);
> -static void consistent_sync(void *vaddr, size_t size, int direction, int master_type);
> -static dma_addr_t nds32_dma_map_page(struct device *dev, struct page *page,
> -                                    unsigned long offset, size_t size,
> -                                    enum dma_data_direction dir,
> -                                    unsigned long attrs)
> -{
> -       if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
> -               consistent_sync((void *)(page_address(page) + offset), size, dir, FOR_DEVICE);
> -       return page_to_phys(page) + offset;
> -}
>
> -static void nds32_dma_unmap_page(struct device *dev, dma_addr_t handle,
> -                                size_t size, enum dma_data_direction dir,
> -                                unsigned long attrs)
> +void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
> +               size_t size, enum dma_data_direction dir)
>  {
> -       if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
> -               consistent_sync(phys_to_virt(handle), size, dir, FOR_CPU);
> -}
> -
> -/*
> - * Make an area consistent for devices.
> - */
> -static void consistent_sync(void *vaddr, size_t size, int direction, int master_type)
> -{
> -       unsigned long start = (unsigned long)vaddr;
> -       unsigned long end = start + size;
> -
> -       if (master_type == FOR_CPU) {
> -               switch (direction) {
> -               case DMA_TO_DEVICE:
> -                       break;
> -               case DMA_FROM_DEVICE:
> -               case DMA_BIDIRECTIONAL:
> -                       cpu_dma_inval_range(start, end);
> -                       break;
> -               default:
> -                       BUG();
> -               }
> -       } else {
> -               /* FOR_DEVICE */
> -               switch (direction) {
> -               case DMA_FROM_DEVICE:
> -                       break;
> -               case DMA_TO_DEVICE:
> -               case DMA_BIDIRECTIONAL:
> -                       cpu_dma_wb_range(start, end);
> -                       break;
> -               default:
> -                       BUG();
> -               }
> +       void *addr = phys_to_virt(paddr);
> +       unsigned long start = (unsigned long)addr;
> +
> +       switch (dir) {
> +       case DMA_FROM_DEVICE:
> +               break;
> +       case DMA_TO_DEVICE:
> +       case DMA_BIDIRECTIONAL:
> +               cpu_dma_wb_range(start, start + size);
> +               break;
> +       default:
> +               BUG();
>         }
>  }
>
> -static int nds32_dma_map_sg(struct device *dev, struct scatterlist *sg,
> -                           int nents, enum dma_data_direction dir,
> -                           unsigned long attrs)
> +void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
> +               size_t size, enum dma_data_direction dir)
>  {
> -       int i;
> -
> -       for (i = 0; i < nents; i++, sg++) {
> -               void *virt;
> -               unsigned long pfn;
> -               struct page *page = sg_page(sg);
> -
> -               sg->dma_address = sg_phys(sg);
> -               pfn = page_to_pfn(page) + sg->offset / PAGE_SIZE;
> -               page = pfn_to_page(pfn);
> -               if (PageHighMem(page)) {
> -                       virt = kmap_atomic(page);
> -                       consistent_sync(virt, sg->length, dir, FOR_CPU);
> -                       kunmap_atomic(virt);
> -               } else {
> -                       if (sg->offset > PAGE_SIZE)
> -                               panic("sg->offset:%08x > PAGE_SIZE\n",
> -                                     sg->offset);
> -                       virt = page_address(page) + sg->offset;
> -                       consistent_sync(virt, sg->length, dir, FOR_CPU);
> -               }
> +       void *addr = phys_to_virt(paddr);
> +       unsigned long start = (unsigned long)addr;
> +
> +       switch (dir) {
> +       case DMA_TO_DEVICE:
> +               break;
> +       case DMA_FROM_DEVICE:
> +       case DMA_BIDIRECTIONAL:
> +               cpu_dma_inval_range(start, start + size);
> +               break;
> +       default:
> +               BUG();
>         }
> -       return nents;
>  }
> -
> -static void nds32_dma_unmap_sg(struct device *dev, struct scatterlist *sg,
> -                              int nhwentries, enum dma_data_direction dir,
> -                              unsigned long attrs)
> -{
> -}
> -
> -static void
> -nds32_dma_sync_single_for_cpu(struct device *dev, dma_addr_t handle,
> -                             size_t size, enum dma_data_direction dir)
> -{
> -       consistent_sync((void *)phys_to_virt(handle), size, dir, FOR_CPU);
> -}
> -
> -static void
> -nds32_dma_sync_single_for_device(struct device *dev, dma_addr_t handle,
> -                                size_t size, enum dma_data_direction dir)
> -{
> -       consistent_sync((void *)phys_to_virt(handle), size, dir, FOR_DEVICE);
> -}
> -
> -static void
> -nds32_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nents,
> -                         enum dma_data_direction dir)
> -{
> -       int i;
> -
> -       for (i = 0; i < nents; i++, sg++) {
> -               char *virt =
> -                   page_address((struct page *)sg->page_link) + sg->offset;
> -               consistent_sync(virt, sg->length, dir, FOR_CPU);
> -       }
> -}
> -
> -static void
> -nds32_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
> -                            int nents, enum dma_data_direction dir)
> -{
> -       int i;
> -
> -       for (i = 0; i < nents; i++, sg++) {
> -               char *virt =
> -                   page_address((struct page *)sg->page_link) + sg->offset;
> -               consistent_sync(virt, sg->length, dir, FOR_DEVICE);
> -       }
> -}
> -
> -struct dma_map_ops nds32_dma_ops = {
> -       .alloc = nds32_dma_alloc_coherent,
> -       .free = nds32_dma_free,
> -       .map_page = nds32_dma_map_page,
> -       .unmap_page = nds32_dma_unmap_page,
> -       .map_sg = nds32_dma_map_sg,
> -       .unmap_sg = nds32_dma_unmap_sg,
> -       .sync_single_for_device = nds32_dma_sync_single_for_device,
> -       .sync_single_for_cpu = nds32_dma_sync_single_for_cpu,
> -       .sync_sg_for_cpu = nds32_dma_sync_sg_for_cpu,
> -       .sync_sg_for_device = nds32_dma_sync_sg_for_device,
> -};
> -
> -EXPORT_SYMBOL(nds32_dma_ops);
> --
> 2.17.0
>

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* [PATCH 13/22] nds32: use generic dma_noncoherent_ops
@ 2018-04-25 12:25             ` Greentime Hu
  0 siblings, 0 replies; 2593+ messages in thread
From: Greentime Hu @ 2018-04-25 12:25 UTC (permalink / raw)
  To: linux-snps-arc

2018-04-25 14:40 GMT+08:00 Christoph Hellwig <hch at lst.de>:
> On Wed, Apr 25, 2018@09:43:43AM +0800, Greentime Hu wrote:
>> Hi Crhistoph,
>>
>> The ftmac100 works if I revert this commit.
>
> Thanks.  ftmac100 only use dma_map_page, which in the old nds32 code
> is just doing a plain page_address and never kmaps.  Can you apply
> the patch below on the tree with the origin "nds32: use generic
> dma_noncoherent_ops" reverted?  This always just uses page_address,
> although that, just like the original code is broken if you actually
> have highmem that needs to be mapped:
>

Hi, Christoph,

It still failed.

> ---
> From 1dc5d1cae4cd7b9ce03d0e2943364ed4cca938d7 Mon Sep 17 00:00:00 2001
> From: Christoph Hellwig <hch at lst.de>
> Date: Mon, 16 Apr 2018 19:20:30 +0200
> Subject: nds32: use generic dma_noncoherent_ops
>
> Switch to the generic noncoherent direct mapping implementation.
>
> This makes sure the cache_sync routines is called in the unmap_sg
> case, to match the unmap_single and sync_{single,sg}_to_cpu cases.
>
> Signed-off-by: Christoph Hellwig <hch at lst.de>
> ---
>  arch/nds32/Kconfig                   |   3 +
>  arch/nds32/include/asm/Kbuild        |   1 +
>  arch/nds32/include/asm/dma-mapping.h |  14 ---
>  arch/nds32/kernel/dma.c              | 182 +++++----------------------
>  4 files changed, 37 insertions(+), 163 deletions(-)
>  delete mode 100644 arch/nds32/include/asm/dma-mapping.h
>
> diff --git a/arch/nds32/Kconfig b/arch/nds32/Kconfig
> index 249f38d3388f..67d0ac0a989c 100644
> --- a/arch/nds32/Kconfig
> +++ b/arch/nds32/Kconfig
> @@ -5,10 +5,13 @@
>
>  config NDS32
>          def_bool y
> +       select ARCH_HAS_SYNC_DMA_FOR_CPU
> +       select ARCH_HAS_SYNC_DMA_FOR_DEVICE
>         select ARCH_WANT_FRAME_POINTERS if FTRACE
>         select CLKSRC_MMIO
>         select CLONE_BACKWARDS
>         select COMMON_CLK
> +       select DMA_NONCOHERENT_OPS
>         select GENERIC_ATOMIC64
>         select GENERIC_CPU_DEVICES
>         select GENERIC_CLOCKEVENTS
> diff --git a/arch/nds32/include/asm/Kbuild b/arch/nds32/include/asm/Kbuild
> index 06bdf8167f5a..b3e951f805f8 100644
> --- a/arch/nds32/include/asm/Kbuild
> +++ b/arch/nds32/include/asm/Kbuild
> @@ -13,6 +13,7 @@ generic-y += cputime.h
>  generic-y += device.h
>  generic-y += div64.h
>  generic-y += dma.h
> +generic-y += dma-mapping.h
>  generic-y += emergency-restart.h
>  generic-y += errno.h
>  generic-y += exec.h
> diff --git a/arch/nds32/include/asm/dma-mapping.h b/arch/nds32/include/asm/dma-mapping.h
> deleted file mode 100644
> index 2dd47d245c25..000000000000
> --- a/arch/nds32/include/asm/dma-mapping.h
> +++ /dev/null
> @@ -1,14 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0
> -// Copyright (C) 2005-2017 Andes Technology Corporation
> -
> -#ifndef ASMNDS32_DMA_MAPPING_H
> -#define ASMNDS32_DMA_MAPPING_H
> -
> -extern struct dma_map_ops nds32_dma_ops;
> -
> -static inline struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
> -{
> -       return &nds32_dma_ops;
> -}
> -
> -#endif
> diff --git a/arch/nds32/kernel/dma.c b/arch/nds32/kernel/dma.c
> index d291800fc621..78311a1e6fd1 100644
> --- a/arch/nds32/kernel/dma.c
> +++ b/arch/nds32/kernel/dma.c
> @@ -3,17 +3,14 @@
>
>  #include <linux/types.h>
>  #include <linux/mm.h>
> -#include <linux/export.h>
>  #include <linux/string.h>
> -#include <linux/scatterlist.h>
> -#include <linux/dma-mapping.h>
> +#include <linux/dma-noncoherent.h>
>  #include <linux/io.h>
>  #include <linux/cache.h>
>  #include <linux/highmem.h>
>  #include <linux/slab.h>
>  #include <asm/cacheflush.h>
>  #include <asm/tlbflush.h>
> -#include <asm/dma-mapping.h>
>  #include <asm/proc-fns.h>
>
>  /*
> @@ -22,11 +19,6 @@
>  static pte_t *consistent_pte;
>  static DEFINE_RAW_SPINLOCK(consistent_lock);
>
> -enum master_type {
> -       FOR_CPU = 0,
> -       FOR_DEVICE = 1,
> -};
> -
>  /*
>   * VM region handling support.
>   *
> @@ -124,10 +116,8 @@ static struct arch_vm_region *vm_region_find(struct arch_vm_region *head,
>         return c;
>  }
>
> -/* FIXME: attrs is not used. */
> -static void *nds32_dma_alloc_coherent(struct device *dev, size_t size,
> -                                     dma_addr_t * handle, gfp_t gfp,
> -                                     unsigned long attrs)
> +void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
> +               gfp_t gfp, unsigned long attrs)
>  {
>         struct page *page;
>         struct arch_vm_region *c;
> @@ -232,8 +222,8 @@ static void *nds32_dma_alloc_coherent(struct device *dev, size_t size,
>         return NULL;
>  }
>
> -static void nds32_dma_free(struct device *dev, size_t size, void *cpu_addr,
> -                          dma_addr_t handle, unsigned long attrs)
> +void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
> +               dma_addr_t handle, unsigned long attrs)
>  {
>         struct arch_vm_region *c;
>         unsigned long flags, addr;
> @@ -333,145 +323,39 @@ static int __init consistent_init(void)
>  }
>
>  core_initcall(consistent_init);
> -static void consistent_sync(void *vaddr, size_t size, int direction, int master_type);
> -static dma_addr_t nds32_dma_map_page(struct device *dev, struct page *page,
> -                                    unsigned long offset, size_t size,
> -                                    enum dma_data_direction dir,
> -                                    unsigned long attrs)
> -{
> -       if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
> -               consistent_sync((void *)(page_address(page) + offset), size, dir, FOR_DEVICE);
> -       return page_to_phys(page) + offset;
> -}
>
> -static void nds32_dma_unmap_page(struct device *dev, dma_addr_t handle,
> -                                size_t size, enum dma_data_direction dir,
> -                                unsigned long attrs)
> +void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
> +               size_t size, enum dma_data_direction dir)
>  {
> -       if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
> -               consistent_sync(phys_to_virt(handle), size, dir, FOR_CPU);
> -}
> -
> -/*
> - * Make an area consistent for devices.
> - */
> -static void consistent_sync(void *vaddr, size_t size, int direction, int master_type)
> -{
> -       unsigned long start = (unsigned long)vaddr;
> -       unsigned long end = start + size;
> -
> -       if (master_type == FOR_CPU) {
> -               switch (direction) {
> -               case DMA_TO_DEVICE:
> -                       break;
> -               case DMA_FROM_DEVICE:
> -               case DMA_BIDIRECTIONAL:
> -                       cpu_dma_inval_range(start, end);
> -                       break;
> -               default:
> -                       BUG();
> -               }
> -       } else {
> -               /* FOR_DEVICE */
> -               switch (direction) {
> -               case DMA_FROM_DEVICE:
> -                       break;
> -               case DMA_TO_DEVICE:
> -               case DMA_BIDIRECTIONAL:
> -                       cpu_dma_wb_range(start, end);
> -                       break;
> -               default:
> -                       BUG();
> -               }
> +       void *addr = phys_to_virt(paddr);
> +       unsigned long start = (unsigned long)addr;
> +
> +       switch (dir) {
> +       case DMA_FROM_DEVICE:
> +               break;
> +       case DMA_TO_DEVICE:
> +       case DMA_BIDIRECTIONAL:
> +               cpu_dma_wb_range(start, start + size);
> +               break;
> +       default:
> +               BUG();
>         }
>  }
>
> -static int nds32_dma_map_sg(struct device *dev, struct scatterlist *sg,
> -                           int nents, enum dma_data_direction dir,
> -                           unsigned long attrs)
> +void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
> +               size_t size, enum dma_data_direction dir)
>  {
> -       int i;
> -
> -       for (i = 0; i < nents; i++, sg++) {
> -               void *virt;
> -               unsigned long pfn;
> -               struct page *page = sg_page(sg);
> -
> -               sg->dma_address = sg_phys(sg);
> -               pfn = page_to_pfn(page) + sg->offset / PAGE_SIZE;
> -               page = pfn_to_page(pfn);
> -               if (PageHighMem(page)) {
> -                       virt = kmap_atomic(page);
> -                       consistent_sync(virt, sg->length, dir, FOR_CPU);
> -                       kunmap_atomic(virt);
> -               } else {
> -                       if (sg->offset > PAGE_SIZE)
> -                               panic("sg->offset:%08x > PAGE_SIZE\n",
> -                                     sg->offset);
> -                       virt = page_address(page) + sg->offset;
> -                       consistent_sync(virt, sg->length, dir, FOR_CPU);
> -               }
> +       void *addr = phys_to_virt(paddr);
> +       unsigned long start = (unsigned long)addr;
> +
> +       switch (dir) {
> +       case DMA_TO_DEVICE:
> +               break;
> +       case DMA_FROM_DEVICE:
> +       case DMA_BIDIRECTIONAL:
> +               cpu_dma_inval_range(start, start + size);
> +               break;
> +       default:
> +               BUG();
>         }
> -       return nents;
>  }
> -
> -static void nds32_dma_unmap_sg(struct device *dev, struct scatterlist *sg,
> -                              int nhwentries, enum dma_data_direction dir,
> -                              unsigned long attrs)
> -{
> -}
> -
> -static void
> -nds32_dma_sync_single_for_cpu(struct device *dev, dma_addr_t handle,
> -                             size_t size, enum dma_data_direction dir)
> -{
> -       consistent_sync((void *)phys_to_virt(handle), size, dir, FOR_CPU);
> -}
> -
> -static void
> -nds32_dma_sync_single_for_device(struct device *dev, dma_addr_t handle,
> -                                size_t size, enum dma_data_direction dir)
> -{
> -       consistent_sync((void *)phys_to_virt(handle), size, dir, FOR_DEVICE);
> -}
> -
> -static void
> -nds32_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nents,
> -                         enum dma_data_direction dir)
> -{
> -       int i;
> -
> -       for (i = 0; i < nents; i++, sg++) {
> -               char *virt =
> -                   page_address((struct page *)sg->page_link) + sg->offset;
> -               consistent_sync(virt, sg->length, dir, FOR_CPU);
> -       }
> -}
> -
> -static void
> -nds32_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
> -                            int nents, enum dma_data_direction dir)
> -{
> -       int i;
> -
> -       for (i = 0; i < nents; i++, sg++) {
> -               char *virt =
> -                   page_address((struct page *)sg->page_link) + sg->offset;
> -               consistent_sync(virt, sg->length, dir, FOR_DEVICE);
> -       }
> -}
> -
> -struct dma_map_ops nds32_dma_ops = {
> -       .alloc = nds32_dma_alloc_coherent,
> -       .free = nds32_dma_free,
> -       .map_page = nds32_dma_map_page,
> -       .unmap_page = nds32_dma_unmap_page,
> -       .map_sg = nds32_dma_map_sg,
> -       .unmap_sg = nds32_dma_unmap_sg,
> -       .sync_single_for_device = nds32_dma_sync_single_for_device,
> -       .sync_single_for_cpu = nds32_dma_sync_single_for_cpu,
> -       .sync_sg_for_cpu = nds32_dma_sync_sg_for_cpu,
> -       .sync_sg_for_device = nds32_dma_sync_sg_for_device,
> -};
> -
> -EXPORT_SYMBOL(nds32_dma_ops);
> --
> 2.17.0
>

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* Re: [PATCH 13/22] nds32: use generic dma_noncoherent_ops
@ 2018-04-25 12:25             ` Greentime Hu
  0 siblings, 0 replies; 2593+ messages in thread
From: Greentime Hu @ 2018-04-25 12:25 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-arch, Michal Simek, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, Linux Kernel Mailing List

2018-04-25 14:40 GMT+08:00 Christoph Hellwig <hch@lst.de>:
> On Wed, Apr 25, 2018 at 09:43:43AM +0800, Greentime Hu wrote:
>> Hi Crhistoph,
>>
>> The ftmac100 works if I revert this commit.
>
> Thanks.  ftmac100 only use dma_map_page, which in the old nds32 code
> is just doing a plain page_address and never kmaps.  Can you apply
> the patch below on the tree with the origin "nds32: use generic
> dma_noncoherent_ops" reverted?  This always just uses page_address,
> although that, just like the original code is broken if you actually
> have highmem that needs to be mapped:
>

Hi, Christoph,

It still failed.

> ---
> From 1dc5d1cae4cd7b9ce03d0e2943364ed4cca938d7 Mon Sep 17 00:00:00 2001
> From: Christoph Hellwig <hch@lst.de>
> Date: Mon, 16 Apr 2018 19:20:30 +0200
> Subject: nds32: use generic dma_noncoherent_ops
>
> Switch to the generic noncoherent direct mapping implementation.
>
> This makes sure the cache_sync routines is called in the unmap_sg
> case, to match the unmap_single and sync_{single,sg}_to_cpu cases.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  arch/nds32/Kconfig                   |   3 +
>  arch/nds32/include/asm/Kbuild        |   1 +
>  arch/nds32/include/asm/dma-mapping.h |  14 ---
>  arch/nds32/kernel/dma.c              | 182 +++++----------------------
>  4 files changed, 37 insertions(+), 163 deletions(-)
>  delete mode 100644 arch/nds32/include/asm/dma-mapping.h
>
> diff --git a/arch/nds32/Kconfig b/arch/nds32/Kconfig
> index 249f38d3388f..67d0ac0a989c 100644
> --- a/arch/nds32/Kconfig
> +++ b/arch/nds32/Kconfig
> @@ -5,10 +5,13 @@
>
>  config NDS32
>          def_bool y
> +       select ARCH_HAS_SYNC_DMA_FOR_CPU
> +       select ARCH_HAS_SYNC_DMA_FOR_DEVICE
>         select ARCH_WANT_FRAME_POINTERS if FTRACE
>         select CLKSRC_MMIO
>         select CLONE_BACKWARDS
>         select COMMON_CLK
> +       select DMA_NONCOHERENT_OPS
>         select GENERIC_ATOMIC64
>         select GENERIC_CPU_DEVICES
>         select GENERIC_CLOCKEVENTS
> diff --git a/arch/nds32/include/asm/Kbuild b/arch/nds32/include/asm/Kbuild
> index 06bdf8167f5a..b3e951f805f8 100644
> --- a/arch/nds32/include/asm/Kbuild
> +++ b/arch/nds32/include/asm/Kbuild
> @@ -13,6 +13,7 @@ generic-y += cputime.h
>  generic-y += device.h
>  generic-y += div64.h
>  generic-y += dma.h
> +generic-y += dma-mapping.h
>  generic-y += emergency-restart.h
>  generic-y += errno.h
>  generic-y += exec.h
> diff --git a/arch/nds32/include/asm/dma-mapping.h b/arch/nds32/include/asm/dma-mapping.h
> deleted file mode 100644
> index 2dd47d245c25..000000000000
> --- a/arch/nds32/include/asm/dma-mapping.h
> +++ /dev/null
> @@ -1,14 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0
> -// Copyright (C) 2005-2017 Andes Technology Corporation
> -
> -#ifndef ASMNDS32_DMA_MAPPING_H
> -#define ASMNDS32_DMA_MAPPING_H
> -
> -extern struct dma_map_ops nds32_dma_ops;
> -
> -static inline struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
> -{
> -       return &nds32_dma_ops;
> -}
> -
> -#endif
> diff --git a/arch/nds32/kernel/dma.c b/arch/nds32/kernel/dma.c
> index d291800fc621..78311a1e6fd1 100644
> --- a/arch/nds32/kernel/dma.c
> +++ b/arch/nds32/kernel/dma.c
> @@ -3,17 +3,14 @@
>
>  #include <linux/types.h>
>  #include <linux/mm.h>
> -#include <linux/export.h>
>  #include <linux/string.h>
> -#include <linux/scatterlist.h>
> -#include <linux/dma-mapping.h>
> +#include <linux/dma-noncoherent.h>
>  #include <linux/io.h>
>  #include <linux/cache.h>
>  #include <linux/highmem.h>
>  #include <linux/slab.h>
>  #include <asm/cacheflush.h>
>  #include <asm/tlbflush.h>
> -#include <asm/dma-mapping.h>
>  #include <asm/proc-fns.h>
>
>  /*
> @@ -22,11 +19,6 @@
>  static pte_t *consistent_pte;
>  static DEFINE_RAW_SPINLOCK(consistent_lock);
>
> -enum master_type {
> -       FOR_CPU = 0,
> -       FOR_DEVICE = 1,
> -};
> -
>  /*
>   * VM region handling support.
>   *
> @@ -124,10 +116,8 @@ static struct arch_vm_region *vm_region_find(struct arch_vm_region *head,
>         return c;
>  }
>
> -/* FIXME: attrs is not used. */
> -static void *nds32_dma_alloc_coherent(struct device *dev, size_t size,
> -                                     dma_addr_t * handle, gfp_t gfp,
> -                                     unsigned long attrs)
> +void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
> +               gfp_t gfp, unsigned long attrs)
>  {
>         struct page *page;
>         struct arch_vm_region *c;
> @@ -232,8 +222,8 @@ static void *nds32_dma_alloc_coherent(struct device *dev, size_t size,
>         return NULL;
>  }
>
> -static void nds32_dma_free(struct device *dev, size_t size, void *cpu_addr,
> -                          dma_addr_t handle, unsigned long attrs)
> +void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
> +               dma_addr_t handle, unsigned long attrs)
>  {
>         struct arch_vm_region *c;
>         unsigned long flags, addr;
> @@ -333,145 +323,39 @@ static int __init consistent_init(void)
>  }
>
>  core_initcall(consistent_init);
> -static void consistent_sync(void *vaddr, size_t size, int direction, int master_type);
> -static dma_addr_t nds32_dma_map_page(struct device *dev, struct page *page,
> -                                    unsigned long offset, size_t size,
> -                                    enum dma_data_direction dir,
> -                                    unsigned long attrs)
> -{
> -       if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
> -               consistent_sync((void *)(page_address(page) + offset), size, dir, FOR_DEVICE);
> -       return page_to_phys(page) + offset;
> -}
>
> -static void nds32_dma_unmap_page(struct device *dev, dma_addr_t handle,
> -                                size_t size, enum dma_data_direction dir,
> -                                unsigned long attrs)
> +void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
> +               size_t size, enum dma_data_direction dir)
>  {
> -       if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
> -               consistent_sync(phys_to_virt(handle), size, dir, FOR_CPU);
> -}
> -
> -/*
> - * Make an area consistent for devices.
> - */
> -static void consistent_sync(void *vaddr, size_t size, int direction, int master_type)
> -{
> -       unsigned long start = (unsigned long)vaddr;
> -       unsigned long end = start + size;
> -
> -       if (master_type = FOR_CPU) {
> -               switch (direction) {
> -               case DMA_TO_DEVICE:
> -                       break;
> -               case DMA_FROM_DEVICE:
> -               case DMA_BIDIRECTIONAL:
> -                       cpu_dma_inval_range(start, end);
> -                       break;
> -               default:
> -                       BUG();
> -               }
> -       } else {
> -               /* FOR_DEVICE */
> -               switch (direction) {
> -               case DMA_FROM_DEVICE:
> -                       break;
> -               case DMA_TO_DEVICE:
> -               case DMA_BIDIRECTIONAL:
> -                       cpu_dma_wb_range(start, end);
> -                       break;
> -               default:
> -                       BUG();
> -               }
> +       void *addr = phys_to_virt(paddr);
> +       unsigned long start = (unsigned long)addr;
> +
> +       switch (dir) {
> +       case DMA_FROM_DEVICE:
> +               break;
> +       case DMA_TO_DEVICE:
> +       case DMA_BIDIRECTIONAL:
> +               cpu_dma_wb_range(start, start + size);
> +               break;
> +       default:
> +               BUG();
>         }
>  }
>
> -static int nds32_dma_map_sg(struct device *dev, struct scatterlist *sg,
> -                           int nents, enum dma_data_direction dir,
> -                           unsigned long attrs)
> +void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
> +               size_t size, enum dma_data_direction dir)
>  {
> -       int i;
> -
> -       for (i = 0; i < nents; i++, sg++) {
> -               void *virt;
> -               unsigned long pfn;
> -               struct page *page = sg_page(sg);
> -
> -               sg->dma_address = sg_phys(sg);
> -               pfn = page_to_pfn(page) + sg->offset / PAGE_SIZE;
> -               page = pfn_to_page(pfn);
> -               if (PageHighMem(page)) {
> -                       virt = kmap_atomic(page);
> -                       consistent_sync(virt, sg->length, dir, FOR_CPU);
> -                       kunmap_atomic(virt);
> -               } else {
> -                       if (sg->offset > PAGE_SIZE)
> -                               panic("sg->offset:%08x > PAGE_SIZE\n",
> -                                     sg->offset);
> -                       virt = page_address(page) + sg->offset;
> -                       consistent_sync(virt, sg->length, dir, FOR_CPU);
> -               }
> +       void *addr = phys_to_virt(paddr);
> +       unsigned long start = (unsigned long)addr;
> +
> +       switch (dir) {
> +       case DMA_TO_DEVICE:
> +               break;
> +       case DMA_FROM_DEVICE:
> +       case DMA_BIDIRECTIONAL:
> +               cpu_dma_inval_range(start, start + size);
> +               break;
> +       default:
> +               BUG();
>         }
> -       return nents;
>  }
> -
> -static void nds32_dma_unmap_sg(struct device *dev, struct scatterlist *sg,
> -                              int nhwentries, enum dma_data_direction dir,
> -                              unsigned long attrs)
> -{
> -}
> -
> -static void
> -nds32_dma_sync_single_for_cpu(struct device *dev, dma_addr_t handle,
> -                             size_t size, enum dma_data_direction dir)
> -{
> -       consistent_sync((void *)phys_to_virt(handle), size, dir, FOR_CPU);
> -}
> -
> -static void
> -nds32_dma_sync_single_for_device(struct device *dev, dma_addr_t handle,
> -                                size_t size, enum dma_data_direction dir)
> -{
> -       consistent_sync((void *)phys_to_virt(handle), size, dir, FOR_DEVICE);
> -}
> -
> -static void
> -nds32_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nents,
> -                         enum dma_data_direction dir)
> -{
> -       int i;
> -
> -       for (i = 0; i < nents; i++, sg++) {
> -               char *virt > -                   page_address((struct page *)sg->page_link) + sg->offset;
> -               consistent_sync(virt, sg->length, dir, FOR_CPU);
> -       }
> -}
> -
> -static void
> -nds32_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
> -                            int nents, enum dma_data_direction dir)
> -{
> -       int i;
> -
> -       for (i = 0; i < nents; i++, sg++) {
> -               char *virt > -                   page_address((struct page *)sg->page_link) + sg->offset;
> -               consistent_sync(virt, sg->length, dir, FOR_DEVICE);
> -       }
> -}
> -
> -struct dma_map_ops nds32_dma_ops = {
> -       .alloc = nds32_dma_alloc_coherent,
> -       .free = nds32_dma_free,
> -       .map_page = nds32_dma_map_page,
> -       .unmap_page = nds32_dma_unmap_page,
> -       .map_sg = nds32_dma_map_sg,
> -       .unmap_sg = nds32_dma_unmap_sg,
> -       .sync_single_for_device = nds32_dma_sync_single_for_device,
> -       .sync_single_for_cpu = nds32_dma_sync_single_for_cpu,
> -       .sync_sg_for_cpu = nds32_dma_sync_sg_for_cpu,
> -       .sync_sg_for_device = nds32_dma_sync_sg_for_device,
> -};
> -
> -EXPORT_SYMBOL(nds32_dma_ops);
> --
> 2.17.0
>

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* [OpenRISC] [PATCH 13/22] nds32: use generic dma_noncoherent_ops
@ 2018-04-25 12:25             ` Greentime Hu
  0 siblings, 0 replies; 2593+ messages in thread
From: Greentime Hu @ 2018-04-25 12:25 UTC (permalink / raw)
  To: openrisc

2018-04-25 14:40 GMT+08:00 Christoph Hellwig <hch@lst.de>:
> On Wed, Apr 25, 2018 at 09:43:43AM +0800, Greentime Hu wrote:
>> Hi Crhistoph,
>>
>> The ftmac100 works if I revert this commit.
>
> Thanks.  ftmac100 only use dma_map_page, which in the old nds32 code
> is just doing a plain page_address and never kmaps.  Can you apply
> the patch below on the tree with the origin "nds32: use generic
> dma_noncoherent_ops" reverted?  This always just uses page_address,
> although that, just like the original code is broken if you actually
> have highmem that needs to be mapped:
>

Hi, Christoph,

It still failed.

> ---
> From 1dc5d1cae4cd7b9ce03d0e2943364ed4cca938d7 Mon Sep 17 00:00:00 2001
> From: Christoph Hellwig <hch@lst.de>
> Date: Mon, 16 Apr 2018 19:20:30 +0200
> Subject: nds32: use generic dma_noncoherent_ops
>
> Switch to the generic noncoherent direct mapping implementation.
>
> This makes sure the cache_sync routines is called in the unmap_sg
> case, to match the unmap_single and sync_{single,sg}_to_cpu cases.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  arch/nds32/Kconfig                   |   3 +
>  arch/nds32/include/asm/Kbuild        |   1 +
>  arch/nds32/include/asm/dma-mapping.h |  14 ---
>  arch/nds32/kernel/dma.c              | 182 +++++----------------------
>  4 files changed, 37 insertions(+), 163 deletions(-)
>  delete mode 100644 arch/nds32/include/asm/dma-mapping.h
>
> diff --git a/arch/nds32/Kconfig b/arch/nds32/Kconfig
> index 249f38d3388f..67d0ac0a989c 100644
> --- a/arch/nds32/Kconfig
> +++ b/arch/nds32/Kconfig
> @@ -5,10 +5,13 @@
>
>  config NDS32
>          def_bool y
> +       select ARCH_HAS_SYNC_DMA_FOR_CPU
> +       select ARCH_HAS_SYNC_DMA_FOR_DEVICE
>         select ARCH_WANT_FRAME_POINTERS if FTRACE
>         select CLKSRC_MMIO
>         select CLONE_BACKWARDS
>         select COMMON_CLK
> +       select DMA_NONCOHERENT_OPS
>         select GENERIC_ATOMIC64
>         select GENERIC_CPU_DEVICES
>         select GENERIC_CLOCKEVENTS
> diff --git a/arch/nds32/include/asm/Kbuild b/arch/nds32/include/asm/Kbuild
> index 06bdf8167f5a..b3e951f805f8 100644
> --- a/arch/nds32/include/asm/Kbuild
> +++ b/arch/nds32/include/asm/Kbuild
> @@ -13,6 +13,7 @@ generic-y += cputime.h
>  generic-y += device.h
>  generic-y += div64.h
>  generic-y += dma.h
> +generic-y += dma-mapping.h
>  generic-y += emergency-restart.h
>  generic-y += errno.h
>  generic-y += exec.h
> diff --git a/arch/nds32/include/asm/dma-mapping.h b/arch/nds32/include/asm/dma-mapping.h
> deleted file mode 100644
> index 2dd47d245c25..000000000000
> --- a/arch/nds32/include/asm/dma-mapping.h
> +++ /dev/null
> @@ -1,14 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0
> -// Copyright (C) 2005-2017 Andes Technology Corporation
> -
> -#ifndef ASMNDS32_DMA_MAPPING_H
> -#define ASMNDS32_DMA_MAPPING_H
> -
> -extern struct dma_map_ops nds32_dma_ops;
> -
> -static inline struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
> -{
> -       return &nds32_dma_ops;
> -}
> -
> -#endif
> diff --git a/arch/nds32/kernel/dma.c b/arch/nds32/kernel/dma.c
> index d291800fc621..78311a1e6fd1 100644
> --- a/arch/nds32/kernel/dma.c
> +++ b/arch/nds32/kernel/dma.c
> @@ -3,17 +3,14 @@
>
>  #include <linux/types.h>
>  #include <linux/mm.h>
> -#include <linux/export.h>
>  #include <linux/string.h>
> -#include <linux/scatterlist.h>
> -#include <linux/dma-mapping.h>
> +#include <linux/dma-noncoherent.h>
>  #include <linux/io.h>
>  #include <linux/cache.h>
>  #include <linux/highmem.h>
>  #include <linux/slab.h>
>  #include <asm/cacheflush.h>
>  #include <asm/tlbflush.h>
> -#include <asm/dma-mapping.h>
>  #include <asm/proc-fns.h>
>
>  /*
> @@ -22,11 +19,6 @@
>  static pte_t *consistent_pte;
>  static DEFINE_RAW_SPINLOCK(consistent_lock);
>
> -enum master_type {
> -       FOR_CPU = 0,
> -       FOR_DEVICE = 1,
> -};
> -
>  /*
>   * VM region handling support.
>   *
> @@ -124,10 +116,8 @@ static struct arch_vm_region *vm_region_find(struct arch_vm_region *head,
>         return c;
>  }
>
> -/* FIXME: attrs is not used. */
> -static void *nds32_dma_alloc_coherent(struct device *dev, size_t size,
> -                                     dma_addr_t * handle, gfp_t gfp,
> -                                     unsigned long attrs)
> +void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
> +               gfp_t gfp, unsigned long attrs)
>  {
>         struct page *page;
>         struct arch_vm_region *c;
> @@ -232,8 +222,8 @@ static void *nds32_dma_alloc_coherent(struct device *dev, size_t size,
>         return NULL;
>  }
>
> -static void nds32_dma_free(struct device *dev, size_t size, void *cpu_addr,
> -                          dma_addr_t handle, unsigned long attrs)
> +void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
> +               dma_addr_t handle, unsigned long attrs)
>  {
>         struct arch_vm_region *c;
>         unsigned long flags, addr;
> @@ -333,145 +323,39 @@ static int __init consistent_init(void)
>  }
>
>  core_initcall(consistent_init);
> -static void consistent_sync(void *vaddr, size_t size, int direction, int master_type);
> -static dma_addr_t nds32_dma_map_page(struct device *dev, struct page *page,
> -                                    unsigned long offset, size_t size,
> -                                    enum dma_data_direction dir,
> -                                    unsigned long attrs)
> -{
> -       if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
> -               consistent_sync((void *)(page_address(page) + offset), size, dir, FOR_DEVICE);
> -       return page_to_phys(page) + offset;
> -}
>
> -static void nds32_dma_unmap_page(struct device *dev, dma_addr_t handle,
> -                                size_t size, enum dma_data_direction dir,
> -                                unsigned long attrs)
> +void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
> +               size_t size, enum dma_data_direction dir)
>  {
> -       if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
> -               consistent_sync(phys_to_virt(handle), size, dir, FOR_CPU);
> -}
> -
> -/*
> - * Make an area consistent for devices.
> - */
> -static void consistent_sync(void *vaddr, size_t size, int direction, int master_type)
> -{
> -       unsigned long start = (unsigned long)vaddr;
> -       unsigned long end = start + size;
> -
> -       if (master_type == FOR_CPU) {
> -               switch (direction) {
> -               case DMA_TO_DEVICE:
> -                       break;
> -               case DMA_FROM_DEVICE:
> -               case DMA_BIDIRECTIONAL:
> -                       cpu_dma_inval_range(start, end);
> -                       break;
> -               default:
> -                       BUG();
> -               }
> -       } else {
> -               /* FOR_DEVICE */
> -               switch (direction) {
> -               case DMA_FROM_DEVICE:
> -                       break;
> -               case DMA_TO_DEVICE:
> -               case DMA_BIDIRECTIONAL:
> -                       cpu_dma_wb_range(start, end);
> -                       break;
> -               default:
> -                       BUG();
> -               }
> +       void *addr = phys_to_virt(paddr);
> +       unsigned long start = (unsigned long)addr;
> +
> +       switch (dir) {
> +       case DMA_FROM_DEVICE:
> +               break;
> +       case DMA_TO_DEVICE:
> +       case DMA_BIDIRECTIONAL:
> +               cpu_dma_wb_range(start, start + size);
> +               break;
> +       default:
> +               BUG();
>         }
>  }
>
> -static int nds32_dma_map_sg(struct device *dev, struct scatterlist *sg,
> -                           int nents, enum dma_data_direction dir,
> -                           unsigned long attrs)
> +void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
> +               size_t size, enum dma_data_direction dir)
>  {
> -       int i;
> -
> -       for (i = 0; i < nents; i++, sg++) {
> -               void *virt;
> -               unsigned long pfn;
> -               struct page *page = sg_page(sg);
> -
> -               sg->dma_address = sg_phys(sg);
> -               pfn = page_to_pfn(page) + sg->offset / PAGE_SIZE;
> -               page = pfn_to_page(pfn);
> -               if (PageHighMem(page)) {
> -                       virt = kmap_atomic(page);
> -                       consistent_sync(virt, sg->length, dir, FOR_CPU);
> -                       kunmap_atomic(virt);
> -               } else {
> -                       if (sg->offset > PAGE_SIZE)
> -                               panic("sg->offset:%08x > PAGE_SIZE\n",
> -                                     sg->offset);
> -                       virt = page_address(page) + sg->offset;
> -                       consistent_sync(virt, sg->length, dir, FOR_CPU);
> -               }
> +       void *addr = phys_to_virt(paddr);
> +       unsigned long start = (unsigned long)addr;
> +
> +       switch (dir) {
> +       case DMA_TO_DEVICE:
> +               break;
> +       case DMA_FROM_DEVICE:
> +       case DMA_BIDIRECTIONAL:
> +               cpu_dma_inval_range(start, start + size);
> +               break;
> +       default:
> +               BUG();
>         }
> -       return nents;
>  }
> -
> -static void nds32_dma_unmap_sg(struct device *dev, struct scatterlist *sg,
> -                              int nhwentries, enum dma_data_direction dir,
> -                              unsigned long attrs)
> -{
> -}
> -
> -static void
> -nds32_dma_sync_single_for_cpu(struct device *dev, dma_addr_t handle,
> -                             size_t size, enum dma_data_direction dir)
> -{
> -       consistent_sync((void *)phys_to_virt(handle), size, dir, FOR_CPU);
> -}
> -
> -static void
> -nds32_dma_sync_single_for_device(struct device *dev, dma_addr_t handle,
> -                                size_t size, enum dma_data_direction dir)
> -{
> -       consistent_sync((void *)phys_to_virt(handle), size, dir, FOR_DEVICE);
> -}
> -
> -static void
> -nds32_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nents,
> -                         enum dma_data_direction dir)
> -{
> -       int i;
> -
> -       for (i = 0; i < nents; i++, sg++) {
> -               char *virt =
> -                   page_address((struct page *)sg->page_link) + sg->offset;
> -               consistent_sync(virt, sg->length, dir, FOR_CPU);
> -       }
> -}
> -
> -static void
> -nds32_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
> -                            int nents, enum dma_data_direction dir)
> -{
> -       int i;
> -
> -       for (i = 0; i < nents; i++, sg++) {
> -               char *virt =
> -                   page_address((struct page *)sg->page_link) + sg->offset;
> -               consistent_sync(virt, sg->length, dir, FOR_DEVICE);
> -       }
> -}
> -
> -struct dma_map_ops nds32_dma_ops = {
> -       .alloc = nds32_dma_alloc_coherent,
> -       .free = nds32_dma_free,
> -       .map_page = nds32_dma_map_page,
> -       .unmap_page = nds32_dma_unmap_page,
> -       .map_sg = nds32_dma_map_sg,
> -       .unmap_sg = nds32_dma_unmap_sg,
> -       .sync_single_for_device = nds32_dma_sync_single_for_device,
> -       .sync_single_for_cpu = nds32_dma_sync_single_for_cpu,
> -       .sync_sg_for_cpu = nds32_dma_sync_sg_for_cpu,
> -       .sync_sg_for_device = nds32_dma_sync_sg_for_device,
> -};
> -
> -EXPORT_SYMBOL(nds32_dma_ops);
> --
> 2.17.0
>

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* [PATCH 13/22] nds32: use generic dma_noncoherent_ops
@ 2018-04-25 12:25             ` Greentime Hu
  0 siblings, 0 replies; 2593+ messages in thread
From: Greentime Hu @ 2018-04-25 12:25 UTC (permalink / raw)
  To: linux-arm-kernel

2018-04-25 14:40 GMT+08:00 Christoph Hellwig <hch@lst.de>:
> On Wed, Apr 25, 2018 at 09:43:43AM +0800, Greentime Hu wrote:
>> Hi Crhistoph,
>>
>> The ftmac100 works if I revert this commit.
>
> Thanks.  ftmac100 only use dma_map_page, which in the old nds32 code
> is just doing a plain page_address and never kmaps.  Can you apply
> the patch below on the tree with the origin "nds32: use generic
> dma_noncoherent_ops" reverted?  This always just uses page_address,
> although that, just like the original code is broken if you actually
> have highmem that needs to be mapped:
>

Hi, Christoph,

It still failed.

> ---
> From 1dc5d1cae4cd7b9ce03d0e2943364ed4cca938d7 Mon Sep 17 00:00:00 2001
> From: Christoph Hellwig <hch@lst.de>
> Date: Mon, 16 Apr 2018 19:20:30 +0200
> Subject: nds32: use generic dma_noncoherent_ops
>
> Switch to the generic noncoherent direct mapping implementation.
>
> This makes sure the cache_sync routines is called in the unmap_sg
> case, to match the unmap_single and sync_{single,sg}_to_cpu cases.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  arch/nds32/Kconfig                   |   3 +
>  arch/nds32/include/asm/Kbuild        |   1 +
>  arch/nds32/include/asm/dma-mapping.h |  14 ---
>  arch/nds32/kernel/dma.c              | 182 +++++----------------------
>  4 files changed, 37 insertions(+), 163 deletions(-)
>  delete mode 100644 arch/nds32/include/asm/dma-mapping.h
>
> diff --git a/arch/nds32/Kconfig b/arch/nds32/Kconfig
> index 249f38d3388f..67d0ac0a989c 100644
> --- a/arch/nds32/Kconfig
> +++ b/arch/nds32/Kconfig
> @@ -5,10 +5,13 @@
>
>  config NDS32
>          def_bool y
> +       select ARCH_HAS_SYNC_DMA_FOR_CPU
> +       select ARCH_HAS_SYNC_DMA_FOR_DEVICE
>         select ARCH_WANT_FRAME_POINTERS if FTRACE
>         select CLKSRC_MMIO
>         select CLONE_BACKWARDS
>         select COMMON_CLK
> +       select DMA_NONCOHERENT_OPS
>         select GENERIC_ATOMIC64
>         select GENERIC_CPU_DEVICES
>         select GENERIC_CLOCKEVENTS
> diff --git a/arch/nds32/include/asm/Kbuild b/arch/nds32/include/asm/Kbuild
> index 06bdf8167f5a..b3e951f805f8 100644
> --- a/arch/nds32/include/asm/Kbuild
> +++ b/arch/nds32/include/asm/Kbuild
> @@ -13,6 +13,7 @@ generic-y += cputime.h
>  generic-y += device.h
>  generic-y += div64.h
>  generic-y += dma.h
> +generic-y += dma-mapping.h
>  generic-y += emergency-restart.h
>  generic-y += errno.h
>  generic-y += exec.h
> diff --git a/arch/nds32/include/asm/dma-mapping.h b/arch/nds32/include/asm/dma-mapping.h
> deleted file mode 100644
> index 2dd47d245c25..000000000000
> --- a/arch/nds32/include/asm/dma-mapping.h
> +++ /dev/null
> @@ -1,14 +0,0 @@
> -// SPDX-License-Identifier: GPL-2.0
> -// Copyright (C) 2005-2017 Andes Technology Corporation
> -
> -#ifndef ASMNDS32_DMA_MAPPING_H
> -#define ASMNDS32_DMA_MAPPING_H
> -
> -extern struct dma_map_ops nds32_dma_ops;
> -
> -static inline struct dma_map_ops *get_arch_dma_ops(struct bus_type *bus)
> -{
> -       return &nds32_dma_ops;
> -}
> -
> -#endif
> diff --git a/arch/nds32/kernel/dma.c b/arch/nds32/kernel/dma.c
> index d291800fc621..78311a1e6fd1 100644
> --- a/arch/nds32/kernel/dma.c
> +++ b/arch/nds32/kernel/dma.c
> @@ -3,17 +3,14 @@
>
>  #include <linux/types.h>
>  #include <linux/mm.h>
> -#include <linux/export.h>
>  #include <linux/string.h>
> -#include <linux/scatterlist.h>
> -#include <linux/dma-mapping.h>
> +#include <linux/dma-noncoherent.h>
>  #include <linux/io.h>
>  #include <linux/cache.h>
>  #include <linux/highmem.h>
>  #include <linux/slab.h>
>  #include <asm/cacheflush.h>
>  #include <asm/tlbflush.h>
> -#include <asm/dma-mapping.h>
>  #include <asm/proc-fns.h>
>
>  /*
> @@ -22,11 +19,6 @@
>  static pte_t *consistent_pte;
>  static DEFINE_RAW_SPINLOCK(consistent_lock);
>
> -enum master_type {
> -       FOR_CPU = 0,
> -       FOR_DEVICE = 1,
> -};
> -
>  /*
>   * VM region handling support.
>   *
> @@ -124,10 +116,8 @@ static struct arch_vm_region *vm_region_find(struct arch_vm_region *head,
>         return c;
>  }
>
> -/* FIXME: attrs is not used. */
> -static void *nds32_dma_alloc_coherent(struct device *dev, size_t size,
> -                                     dma_addr_t * handle, gfp_t gfp,
> -                                     unsigned long attrs)
> +void *arch_dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
> +               gfp_t gfp, unsigned long attrs)
>  {
>         struct page *page;
>         struct arch_vm_region *c;
> @@ -232,8 +222,8 @@ static void *nds32_dma_alloc_coherent(struct device *dev, size_t size,
>         return NULL;
>  }
>
> -static void nds32_dma_free(struct device *dev, size_t size, void *cpu_addr,
> -                          dma_addr_t handle, unsigned long attrs)
> +void arch_dma_free(struct device *dev, size_t size, void *cpu_addr,
> +               dma_addr_t handle, unsigned long attrs)
>  {
>         struct arch_vm_region *c;
>         unsigned long flags, addr;
> @@ -333,145 +323,39 @@ static int __init consistent_init(void)
>  }
>
>  core_initcall(consistent_init);
> -static void consistent_sync(void *vaddr, size_t size, int direction, int master_type);
> -static dma_addr_t nds32_dma_map_page(struct device *dev, struct page *page,
> -                                    unsigned long offset, size_t size,
> -                                    enum dma_data_direction dir,
> -                                    unsigned long attrs)
> -{
> -       if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
> -               consistent_sync((void *)(page_address(page) + offset), size, dir, FOR_DEVICE);
> -       return page_to_phys(page) + offset;
> -}
>
> -static void nds32_dma_unmap_page(struct device *dev, dma_addr_t handle,
> -                                size_t size, enum dma_data_direction dir,
> -                                unsigned long attrs)
> +void arch_sync_dma_for_device(struct device *dev, phys_addr_t paddr,
> +               size_t size, enum dma_data_direction dir)
>  {
> -       if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
> -               consistent_sync(phys_to_virt(handle), size, dir, FOR_CPU);
> -}
> -
> -/*
> - * Make an area consistent for devices.
> - */
> -static void consistent_sync(void *vaddr, size_t size, int direction, int master_type)
> -{
> -       unsigned long start = (unsigned long)vaddr;
> -       unsigned long end = start + size;
> -
> -       if (master_type == FOR_CPU) {
> -               switch (direction) {
> -               case DMA_TO_DEVICE:
> -                       break;
> -               case DMA_FROM_DEVICE:
> -               case DMA_BIDIRECTIONAL:
> -                       cpu_dma_inval_range(start, end);
> -                       break;
> -               default:
> -                       BUG();
> -               }
> -       } else {
> -               /* FOR_DEVICE */
> -               switch (direction) {
> -               case DMA_FROM_DEVICE:
> -                       break;
> -               case DMA_TO_DEVICE:
> -               case DMA_BIDIRECTIONAL:
> -                       cpu_dma_wb_range(start, end);
> -                       break;
> -               default:
> -                       BUG();
> -               }
> +       void *addr = phys_to_virt(paddr);
> +       unsigned long start = (unsigned long)addr;
> +
> +       switch (dir) {
> +       case DMA_FROM_DEVICE:
> +               break;
> +       case DMA_TO_DEVICE:
> +       case DMA_BIDIRECTIONAL:
> +               cpu_dma_wb_range(start, start + size);
> +               break;
> +       default:
> +               BUG();
>         }
>  }
>
> -static int nds32_dma_map_sg(struct device *dev, struct scatterlist *sg,
> -                           int nents, enum dma_data_direction dir,
> -                           unsigned long attrs)
> +void arch_sync_dma_for_cpu(struct device *dev, phys_addr_t paddr,
> +               size_t size, enum dma_data_direction dir)
>  {
> -       int i;
> -
> -       for (i = 0; i < nents; i++, sg++) {
> -               void *virt;
> -               unsigned long pfn;
> -               struct page *page = sg_page(sg);
> -
> -               sg->dma_address = sg_phys(sg);
> -               pfn = page_to_pfn(page) + sg->offset / PAGE_SIZE;
> -               page = pfn_to_page(pfn);
> -               if (PageHighMem(page)) {
> -                       virt = kmap_atomic(page);
> -                       consistent_sync(virt, sg->length, dir, FOR_CPU);
> -                       kunmap_atomic(virt);
> -               } else {
> -                       if (sg->offset > PAGE_SIZE)
> -                               panic("sg->offset:%08x > PAGE_SIZE\n",
> -                                     sg->offset);
> -                       virt = page_address(page) + sg->offset;
> -                       consistent_sync(virt, sg->length, dir, FOR_CPU);
> -               }
> +       void *addr = phys_to_virt(paddr);
> +       unsigned long start = (unsigned long)addr;
> +
> +       switch (dir) {
> +       case DMA_TO_DEVICE:
> +               break;
> +       case DMA_FROM_DEVICE:
> +       case DMA_BIDIRECTIONAL:
> +               cpu_dma_inval_range(start, start + size);
> +               break;
> +       default:
> +               BUG();
>         }
> -       return nents;
>  }
> -
> -static void nds32_dma_unmap_sg(struct device *dev, struct scatterlist *sg,
> -                              int nhwentries, enum dma_data_direction dir,
> -                              unsigned long attrs)
> -{
> -}
> -
> -static void
> -nds32_dma_sync_single_for_cpu(struct device *dev, dma_addr_t handle,
> -                             size_t size, enum dma_data_direction dir)
> -{
> -       consistent_sync((void *)phys_to_virt(handle), size, dir, FOR_CPU);
> -}
> -
> -static void
> -nds32_dma_sync_single_for_device(struct device *dev, dma_addr_t handle,
> -                                size_t size, enum dma_data_direction dir)
> -{
> -       consistent_sync((void *)phys_to_virt(handle), size, dir, FOR_DEVICE);
> -}
> -
> -static void
> -nds32_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nents,
> -                         enum dma_data_direction dir)
> -{
> -       int i;
> -
> -       for (i = 0; i < nents; i++, sg++) {
> -               char *virt =
> -                   page_address((struct page *)sg->page_link) + sg->offset;
> -               consistent_sync(virt, sg->length, dir, FOR_CPU);
> -       }
> -}
> -
> -static void
> -nds32_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
> -                            int nents, enum dma_data_direction dir)
> -{
> -       int i;
> -
> -       for (i = 0; i < nents; i++, sg++) {
> -               char *virt =
> -                   page_address((struct page *)sg->page_link) + sg->offset;
> -               consistent_sync(virt, sg->length, dir, FOR_DEVICE);
> -       }
> -}
> -
> -struct dma_map_ops nds32_dma_ops = {
> -       .alloc = nds32_dma_alloc_coherent,
> -       .free = nds32_dma_free,
> -       .map_page = nds32_dma_map_page,
> -       .unmap_page = nds32_dma_unmap_page,
> -       .map_sg = nds32_dma_map_sg,
> -       .unmap_sg = nds32_dma_unmap_sg,
> -       .sync_single_for_device = nds32_dma_sync_single_for_device,
> -       .sync_single_for_cpu = nds32_dma_sync_single_for_cpu,
> -       .sync_sg_for_cpu = nds32_dma_sync_sg_for_cpu,
> -       .sync_sg_for_device = nds32_dma_sync_sg_for_device,
> -};
> -
> -EXPORT_SYMBOL(nds32_dma_ops);
> --
> 2.17.0
>

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* Re: [PATCH 22/22] parisc: use generic dma_noncoherent_ops
@ 2018-04-25 21:07         ` Helge Deller
  0 siblings, 0 replies; 2593+ messages in thread
From: Helge Deller @ 2018-04-25 21:07 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-arch, Michal Simek, Vincent Chen, linux-c6x-dev,
	linux-parisc, linux-sh, linux-hexagon, linux-kernel, linux-m68k,
	openrisc, Greentime Hu, linux-alpha, sparclinux, nios2-dev,
	linux-snps-arc, linux-arm-kernel

On 25.04.2018 09:21, Christoph Hellwig wrote:
> On Sat, Apr 21, 2018 at 07:43:46PM +0200, Helge Deller wrote:
>> This patch breaks a 32bit kernel on a B160L machine (PA7300LC CPU, "pcxl2").
>> After applying this patch series the lasi82956 network driver works unreliable. 
>> NIC gets IP, but ping doesn't work.
>> See drivers/net/ethernet/i825xx/lasi_82596.c, it uses dma*sync() functions.
> 
> Just to confirm:  Without the series it is known to actually work?

Yes.
I reverted this series from my tree, rebuilt, and then the issue was gone.
I won't be able to test again earlier than next week.

Helge

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* Re: [PATCH 22/22] parisc: use generic dma_noncoherent_ops
@ 2018-04-25 21:07         ` Helge Deller
  0 siblings, 0 replies; 2593+ messages in thread
From: Helge Deller @ 2018-04-25 21:07 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-arch, Michal Simek, Greentime Hu, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-kernel

On 25.04.2018 09:21, Christoph Hellwig wrote:
> On Sat, Apr 21, 2018 at 07:43:46PM +0200, Helge Deller wrote:
>> This patch breaks a 32bit kernel on a B160L machine (PA7300LC CPU, "pcxl2").
>> After applying this patch series the lasi82956 network driver works unreliable. 
>> NIC gets IP, but ping doesn't work.
>> See drivers/net/ethernet/i825xx/lasi_82596.c, it uses dma*sync() functions.
> 
> Just to confirm:  Without the series it is known to actually work?

Yes.
I reverted this series from my tree, rebuilt, and then the issue was gone.
I won't be able to test again earlier than next week.

Helge

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* [PATCH 22/22] parisc: use generic dma_noncoherent_ops
@ 2018-04-25 21:07         ` Helge Deller
  0 siblings, 0 replies; 2593+ messages in thread
From: Helge Deller @ 2018-04-25 21:07 UTC (permalink / raw)
  To: linux-snps-arc

On 25.04.2018 09:21, Christoph Hellwig wrote:
> On Sat, Apr 21, 2018@07:43:46PM +0200, Helge Deller wrote:
>> This patch breaks a 32bit kernel on a B160L machine (PA7300LC CPU, "pcxl2").
>> After applying this patch series the lasi82956 network driver works unreliable. 
>> NIC gets IP, but ping doesn't work.
>> See drivers/net/ethernet/i825xx/lasi_82596.c, it uses dma*sync() functions.
> 
> Just to confirm:  Without the series it is known to actually work?

Yes.
I reverted this series from my tree, rebuilt, and then the issue was gone.
I won't be able to test again earlier than next week.

Helge

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* Re: [PATCH 22/22] parisc: use generic dma_noncoherent_ops
@ 2018-04-25 21:07         ` Helge Deller
  0 siblings, 0 replies; 2593+ messages in thread
From: Helge Deller @ 2018-04-25 21:07 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-arch, Michal Simek, Vincent Chen, linux-c6x-dev,
	linux-parisc, linux-sh, linux-hexagon, linux-kernel, linux-m68k,
	openrisc, Greentime Hu, linux-alpha, sparclinux, nios2-dev,
	linux-snps-arc, linux-arm-kernel

On 25.04.2018 09:21, Christoph Hellwig wrote:
> On Sat, Apr 21, 2018 at 07:43:46PM +0200, Helge Deller wrote:
>> This patch breaks a 32bit kernel on a B160L machine (PA7300LC CPU, "pcxl2").
>> After applying this patch series the lasi82956 network driver works unreliable. 
>> NIC gets IP, but ping doesn't work.
>> See drivers/net/ethernet/i825xx/lasi_82596.c, it uses dma*sync() functions.
> 
> Just to confirm:  Without the series it is known to actually work?

Yes.
I reverted this series from my tree, rebuilt, and then the issue was gone.
I won't be able to test again earlier than next week.

Helge

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* [OpenRISC] [PATCH 22/22] parisc: use generic dma_noncoherent_ops
@ 2018-04-25 21:07         ` Helge Deller
  0 siblings, 0 replies; 2593+ messages in thread
From: Helge Deller @ 2018-04-25 21:07 UTC (permalink / raw)
  To: openrisc

On 25.04.2018 09:21, Christoph Hellwig wrote:
> On Sat, Apr 21, 2018 at 07:43:46PM +0200, Helge Deller wrote:
>> This patch breaks a 32bit kernel on a B160L machine (PA7300LC CPU, "pcxl2").
>> After applying this patch series the lasi82956 network driver works unreliable. 
>> NIC gets IP, but ping doesn't work.
>> See drivers/net/ethernet/i825xx/lasi_82596.c, it uses dma*sync() functions.
> 
> Just to confirm:  Without the series it is known to actually work?

Yes.
I reverted this series from my tree, rebuilt, and then the issue was gone.
I won't be able to test again earlier than next week.

Helge

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* [PATCH 22/22] parisc: use generic dma_noncoherent_ops
@ 2018-04-25 21:07         ` Helge Deller
  0 siblings, 0 replies; 2593+ messages in thread
From: Helge Deller @ 2018-04-25 21:07 UTC (permalink / raw)
  To: linux-arm-kernel

On 25.04.2018 09:21, Christoph Hellwig wrote:
> On Sat, Apr 21, 2018 at 07:43:46PM +0200, Helge Deller wrote:
>> This patch breaks a 32bit kernel on a B160L machine (PA7300LC CPU, "pcxl2").
>> After applying this patch series the lasi82956 network driver works unreliable. 
>> NIC gets IP, but ping doesn't work.
>> See drivers/net/ethernet/i825xx/lasi_82596.c, it uses dma*sync() functions.
> 
> Just to confirm:  Without the series it is known to actually work?

Yes.
I reverted this series from my tree, rebuilt, and then the issue was gone.
I won't be able to test again earlier than next week.

Helge

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* Re: [PATCH 13/22] nds32: use generic dma_noncoherent_ops
  2018-04-25 12:25             ` Greentime Hu
                                 ` (2 preceding siblings ...)
  (?)
@ 2018-04-26  6:42               ` Christoph Hellwig
  -1 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-26  6:42 UTC (permalink / raw)
  To: Greentime Hu
  Cc: Christoph Hellwig, linux-arch, Michal Simek, Vincent Chen,
	linux-alpha, linux-snps-arc, linux-arm-kernel, linux-c6x-dev,
	linux-hexagon, linux-m68k, nios2-dev, openrisc, linux-parisc,
	linux-sh, sparclinux, linux-xtensa, Linux Kernel Mailing List

Can you try this patch ontop of either the new or original one?

---
diff --git a/lib/dma-noncoherent.c b/lib/dma-noncoherent.c
index f4b8532c20ac..a2c192b3508d 100644
--- a/lib/dma-noncoherent.c
+++ b/lib/dma-noncoherent.c
@@ -48,7 +48,7 @@ static int dma_noncoherent_map_sg(struct device *dev, struct scatterlist *sgl,
 	return nents;
 }
 
-#ifdef CONFIG_DMA_NONCOHERENT_SYNC_FOR_CPU
+#ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU
 static void dma_noncoherent_sync_single_for_cpu(struct device *dev,
 		dma_addr_t addr, size_t size, enum dma_data_direction dir)
 {
@@ -88,7 +88,7 @@ const struct dma_map_ops dma_noncoherent_ops = {
 	.sync_sg_for_device	= dma_noncoherent_sync_sg_for_device,
 	.map_page		= dma_noncoherent_map_page,
 	.map_sg			= dma_noncoherent_map_sg,
-#ifdef CONFIG_DMA_NONCOHERENT_SYNC_FOR_CPU
+#ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU
 	.sync_single_for_cpu	= dma_noncoherent_sync_single_for_cpu,
 	.sync_sg_for_cpu	= dma_noncoherent_sync_sg_for_cpu,
 	.unmap_page		= dma_noncoherent_unmap_page,

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 13/22] nds32: use generic dma_noncoherent_ops
@ 2018-04-26  6:42               ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-26  6:42 UTC (permalink / raw)
  To: linux-snps-arc

Can you try this patch ontop of either the new or original one?

---
diff --git a/lib/dma-noncoherent.c b/lib/dma-noncoherent.c
index f4b8532c20ac..a2c192b3508d 100644
--- a/lib/dma-noncoherent.c
+++ b/lib/dma-noncoherent.c
@@ -48,7 +48,7 @@ static int dma_noncoherent_map_sg(struct device *dev, struct scatterlist *sgl,
 	return nents;
 }
 
-#ifdef CONFIG_DMA_NONCOHERENT_SYNC_FOR_CPU
+#ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU
 static void dma_noncoherent_sync_single_for_cpu(struct device *dev,
 		dma_addr_t addr, size_t size, enum dma_data_direction dir)
 {
@@ -88,7 +88,7 @@ const struct dma_map_ops dma_noncoherent_ops = {
 	.sync_sg_for_device	= dma_noncoherent_sync_sg_for_device,
 	.map_page		= dma_noncoherent_map_page,
 	.map_sg			= dma_noncoherent_map_sg,
-#ifdef CONFIG_DMA_NONCOHERENT_SYNC_FOR_CPU
+#ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU
 	.sync_single_for_cpu	= dma_noncoherent_sync_single_for_cpu,
 	.sync_sg_for_cpu	= dma_noncoherent_sync_sg_for_cpu,
 	.unmap_page		= dma_noncoherent_unmap_page,

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* Re: [PATCH 13/22] nds32: use generic dma_noncoherent_ops
@ 2018-04-26  6:42               ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-26  6:42 UTC (permalink / raw)
  To: Greentime Hu
  Cc: Christoph Hellwig, linux-arch, Michal Simek, Vincent Chen,
	linux-alpha, linux-snps-arc, linux-arm-kernel, linux-c6x-dev,
	linux-hexagon, linux-m68k, nios2-dev, openrisc, linux-parisc,
	linux-sh, sparclinux, linux-xtensa, Linux Kernel Mailing List

Can you try this patch ontop of either the new or original one?

---
diff --git a/lib/dma-noncoherent.c b/lib/dma-noncoherent.c
index f4b8532c20ac..a2c192b3508d 100644
--- a/lib/dma-noncoherent.c
+++ b/lib/dma-noncoherent.c
@@ -48,7 +48,7 @@ static int dma_noncoherent_map_sg(struct device *dev, struct scatterlist *sgl,
 	return nents;
 }
 
-#ifdef CONFIG_DMA_NONCOHERENT_SYNC_FOR_CPU
+#ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU
 static void dma_noncoherent_sync_single_for_cpu(struct device *dev,
 		dma_addr_t addr, size_t size, enum dma_data_direction dir)
 {
@@ -88,7 +88,7 @@ const struct dma_map_ops dma_noncoherent_ops = {
 	.sync_sg_for_device	= dma_noncoherent_sync_sg_for_device,
 	.map_page		= dma_noncoherent_map_page,
 	.map_sg			= dma_noncoherent_map_sg,
-#ifdef CONFIG_DMA_NONCOHERENT_SYNC_FOR_CPU
+#ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU
 	.sync_single_for_cpu	= dma_noncoherent_sync_single_for_cpu,
 	.sync_sg_for_cpu	= dma_noncoherent_sync_sg_for_cpu,
 	.unmap_page		= dma_noncoherent_unmap_page,

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [OpenRISC] [PATCH 13/22] nds32: use generic dma_noncoherent_ops
@ 2018-04-26  6:42               ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-26  6:42 UTC (permalink / raw)
  To: openrisc

Can you try this patch ontop of either the new or original one?

---
diff --git a/lib/dma-noncoherent.c b/lib/dma-noncoherent.c
index f4b8532c20ac..a2c192b3508d 100644
--- a/lib/dma-noncoherent.c
+++ b/lib/dma-noncoherent.c
@@ -48,7 +48,7 @@ static int dma_noncoherent_map_sg(struct device *dev, struct scatterlist *sgl,
 	return nents;
 }
 
-#ifdef CONFIG_DMA_NONCOHERENT_SYNC_FOR_CPU
+#ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU
 static void dma_noncoherent_sync_single_for_cpu(struct device *dev,
 		dma_addr_t addr, size_t size, enum dma_data_direction dir)
 {
@@ -88,7 +88,7 @@ const struct dma_map_ops dma_noncoherent_ops = {
 	.sync_sg_for_device	= dma_noncoherent_sync_sg_for_device,
 	.map_page		= dma_noncoherent_map_page,
 	.map_sg			= dma_noncoherent_map_sg,
-#ifdef CONFIG_DMA_NONCOHERENT_SYNC_FOR_CPU
+#ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU
 	.sync_single_for_cpu	= dma_noncoherent_sync_single_for_cpu,
 	.sync_sg_for_cpu	= dma_noncoherent_sync_sg_for_cpu,
 	.unmap_page		= dma_noncoherent_unmap_page,

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 13/22] nds32: use generic dma_noncoherent_ops
@ 2018-04-26  6:42               ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-26  6:42 UTC (permalink / raw)
  To: linux-arm-kernel

Can you try this patch ontop of either the new or original one?

---
diff --git a/lib/dma-noncoherent.c b/lib/dma-noncoherent.c
index f4b8532c20ac..a2c192b3508d 100644
--- a/lib/dma-noncoherent.c
+++ b/lib/dma-noncoherent.c
@@ -48,7 +48,7 @@ static int dma_noncoherent_map_sg(struct device *dev, struct scatterlist *sgl,
 	return nents;
 }
 
-#ifdef CONFIG_DMA_NONCOHERENT_SYNC_FOR_CPU
+#ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU
 static void dma_noncoherent_sync_single_for_cpu(struct device *dev,
 		dma_addr_t addr, size_t size, enum dma_data_direction dir)
 {
@@ -88,7 +88,7 @@ const struct dma_map_ops dma_noncoherent_ops = {
 	.sync_sg_for_device	= dma_noncoherent_sync_sg_for_device,
 	.map_page		= dma_noncoherent_map_page,
 	.map_sg			= dma_noncoherent_map_sg,
-#ifdef CONFIG_DMA_NONCOHERENT_SYNC_FOR_CPU
+#ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU
 	.sync_single_for_cpu	= dma_noncoherent_sync_single_for_cpu,
 	.sync_sg_for_cpu	= dma_noncoherent_sync_sg_for_cpu,
 	.unmap_page		= dma_noncoherent_unmap_page,

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* Re: [PATCH 06/22] arc: use generic dma_noncoherent_ops
@ 2018-04-26  6:45       ` hch
  0 siblings, 0 replies; 2593+ messages in thread
From: hch @ 2018-04-26  6:45 UTC (permalink / raw)
  To: Alexey Brodkin
  Cc: hch@lst.de, deanbo422@gmail.com, linux-sh@vger.kernel.org,
	linux-kernel@vger.kernel.org, nios2-dev@lists.rocketboards.org,
	linux-xtensa@linux-xtensa.org, linux-m68k@lists.linux-m68k.org,
	linux-alpha@vger.kernel.org, linux-hexagon@vger.kernel.org,
	linux-snps-arc@lists.infradead.org, green.hu@gmail.com,
	openrisc@lists.librecores.org,
	linux-arm-kernel@lists.infradead.org

On Wed, Apr 25, 2018 at 11:17:01AM +0000, Alexey Brodkin wrote:
> Which is actually strange as I would expect ARC code to be built by bots.

I don't think I got any notification.  Thank for the fixes!

I think I found the bug, based on the fact that so far all tests for
architectures that also need a cache op for device to cpu transitions
failed.  I did a stupid typo when changing kconfig symbols, so please
try the patch below.

>  
>  static int l2_line_sz;
>  static int ioc_exists;
> -int slc_enable = 1, ioc_enable = 1;
> +int slc_enable = 1, ioc_enable = 0;

Hmm.  It seems if ioc_enable is 0 we should simply be using
dma_direct_ops on arc, but that is a different discussion.

---
diff --git a/lib/dma-noncoherent.c b/lib/dma-noncoherent.c
index f4b8532c20ac..a2c192b3508d 100644
--- a/lib/dma-noncoherent.c
+++ b/lib/dma-noncoherent.c
@@ -48,7 +48,7 @@ static int dma_noncoherent_map_sg(struct device *dev, struct scatterlist *sgl,
 	return nents;
 }
 
-#ifdef CONFIG_DMA_NONCOHERENT_SYNC_FOR_CPU
+#ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU
 static void dma_noncoherent_sync_single_for_cpu(struct device *dev,
 		dma_addr_t addr, size_t size, enum dma_data_direction dir)
 {
@@ -88,7 +88,7 @@ const struct dma_map_ops dma_noncoherent_ops = {
 	.sync_sg_for_device	= dma_noncoherent_sync_sg_for_device,
 	.map_page		= dma_noncoherent_map_page,
 	.map_sg			= dma_noncoherent_map_sg,
-#ifdef CONFIG_DMA_NONCOHERENT_SYNC_FOR_CPU
+#ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU
 	.sync_single_for_cpu	= dma_noncoherent_sync_single_for_cpu,
 	.sync_sg_for_cpu	= dma_noncoherent_sync_sg_for_cpu,
 	.unmap_page		= dma_noncoherent_unmap_page,

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* Re: [PATCH 06/22] arc: use generic dma_noncoherent_ops
@ 2018-04-26  6:45       ` hch
  0 siblings, 0 replies; 2593+ messages in thread
From: hch @ 2018-04-26  6:45 UTC (permalink / raw)
  To: Alexey Brodkin
  Cc: hch@lst.de, deanbo422@gmail.com, linux-sh@vger.kernel.org,
	linux-kernel@vger.kernel.org, nios2-dev@lists.rocketboards.org,
	linux-xtensa@linux-xtensa.org, linux-m68k@lists.linux-m68k.org,
	linux-alpha@vger.kernel.org, linux-hexagon@vger.kernel.org,
	linux-snps-arc@lists.infradead.org, green.hu@gmail.com,
	openrisc@lists.librecores.org,
	linux-arm-kernel@lists.infradead.org, monstr@monstr.eu,
	linux-parisc@vger.kernel.org, linux-c6x-dev@linux-c6x.org,
	linux-arch@vger.kernel.org, sparclinux@vger.kernel.org

On Wed, Apr 25, 2018 at 11:17:01AM +0000, Alexey Brodkin wrote:
> Which is actually strange as I would expect ARC code to be built by bots.

I don't think I got any notification.  Thank for the fixes!

I think I found the bug, based on the fact that so far all tests for
architectures that also need a cache op for device to cpu transitions
failed.  I did a stupid typo when changing kconfig symbols, so please
try the patch below.

>  
>  static int l2_line_sz;
>  static int ioc_exists;
> -int slc_enable = 1, ioc_enable = 1;
> +int slc_enable = 1, ioc_enable = 0;

Hmm.  It seems if ioc_enable is 0 we should simply be using
dma_direct_ops on arc, but that is a different discussion.

---
diff --git a/lib/dma-noncoherent.c b/lib/dma-noncoherent.c
index f4b8532c20ac..a2c192b3508d 100644
--- a/lib/dma-noncoherent.c
+++ b/lib/dma-noncoherent.c
@@ -48,7 +48,7 @@ static int dma_noncoherent_map_sg(struct device *dev, struct scatterlist *sgl,
 	return nents;
 }
 
-#ifdef CONFIG_DMA_NONCOHERENT_SYNC_FOR_CPU
+#ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU
 static void dma_noncoherent_sync_single_for_cpu(struct device *dev,
 		dma_addr_t addr, size_t size, enum dma_data_direction dir)
 {
@@ -88,7 +88,7 @@ const struct dma_map_ops dma_noncoherent_ops = {
 	.sync_sg_for_device	= dma_noncoherent_sync_sg_for_device,
 	.map_page		= dma_noncoherent_map_page,
 	.map_sg			= dma_noncoherent_map_sg,
-#ifdef CONFIG_DMA_NONCOHERENT_SYNC_FOR_CPU
+#ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU
 	.sync_single_for_cpu	= dma_noncoherent_sync_single_for_cpu,
 	.sync_sg_for_cpu	= dma_noncoherent_sync_sg_for_cpu,
 	.unmap_page		= dma_noncoherent_unmap_page,

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* Re: [PATCH 06/22] arc: use generic dma_noncoherent_ops
@ 2018-04-26  6:45       ` hch
  0 siblings, 0 replies; 2593+ messages in thread
From: hch @ 2018-04-26  6:45 UTC (permalink / raw)
  To: Alexey Brodkin
  Cc: hch@lst.de, deanbo422@gmail.com, linux-sh@vger.kernel.org,
	linux-kernel@vger.kernel.org, nios2-dev@lists.rocketboards.org,
	linux-xtensa@linux-xtensa.org, linux-m68k@lists.linux-m68k.org,
	linux-alpha@vger.kernel.org, linux-hexagon@vger.kernel.org,
	linux-snps-arc@lists.infradead.org, green.hu@gmail.com,
	openrisc@lists.librecores.org,
	linux-arm-kernel@lists.infradead.org

On Wed, Apr 25, 2018 at 11:17:01AM +0000, Alexey Brodkin wrote:
> Which is actually strange as I would expect ARC code to be built by bots.

I don't think I got any notification.  Thank for the fixes!

I think I found the bug, based on the fact that so far all tests for
architectures that also need a cache op for device to cpu transitions
failed.  I did a stupid typo when changing kconfig symbols, so please
try the patch below.

>  
>  static int l2_line_sz;
>  static int ioc_exists;
> -int slc_enable = 1, ioc_enable = 1;
> +int slc_enable = 1, ioc_enable = 0;

Hmm.  It seems if ioc_enable is 0 we should simply be using
dma_direct_ops on arc, but that is a different discussion.

---
diff --git a/lib/dma-noncoherent.c b/lib/dma-noncoherent.c
index f4b8532c20ac..a2c192b3508d 100644
--- a/lib/dma-noncoherent.c
+++ b/lib/dma-noncoherent.c
@@ -48,7 +48,7 @@ static int dma_noncoherent_map_sg(struct device *dev, struct scatterlist *sgl,
 	return nents;
 }
 
-#ifdef CONFIG_DMA_NONCOHERENT_SYNC_FOR_CPU
+#ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU
 static void dma_noncoherent_sync_single_for_cpu(struct device *dev,
 		dma_addr_t addr, size_t size, enum dma_data_direction dir)
 {
@@ -88,7 +88,7 @@ const struct dma_map_ops dma_noncoherent_ops = {
 	.sync_sg_for_device	= dma_noncoherent_sync_sg_for_device,
 	.map_page		= dma_noncoherent_map_page,
 	.map_sg			= dma_noncoherent_map_sg,
-#ifdef CONFIG_DMA_NONCOHERENT_SYNC_FOR_CPU
+#ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU
 	.sync_single_for_cpu	= dma_noncoherent_sync_single_for_cpu,
 	.sync_sg_for_cpu	= dma_noncoherent_sync_sg_for_cpu,
 	.unmap_page		= dma_noncoherent_unmap_page,

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 06/22] arc: use generic dma_noncoherent_ops
@ 2018-04-26  6:45       ` hch
  0 siblings, 0 replies; 2593+ messages in thread
From: hch @ 2018-04-26  6:45 UTC (permalink / raw)
  To: linux-snps-arc

On Wed, Apr 25, 2018@11:17:01AM +0000, Alexey Brodkin wrote:
> Which is actually strange as I would expect ARC code to be built by bots.

I don't think I got any notification.  Thank for the fixes!

I think I found the bug, based on the fact that so far all tests for
architectures that also need a cache op for device to cpu transitions
failed.  I did a stupid typo when changing kconfig symbols, so please
try the patch below.

>  
>  static int l2_line_sz;
>  static int ioc_exists;
> -int slc_enable = 1, ioc_enable = 1;
> +int slc_enable = 1, ioc_enable = 0;

Hmm.  It seems if ioc_enable is 0 we should simply be using
dma_direct_ops on arc, but that is a different discussion.

---
diff --git a/lib/dma-noncoherent.c b/lib/dma-noncoherent.c
index f4b8532c20ac..a2c192b3508d 100644
--- a/lib/dma-noncoherent.c
+++ b/lib/dma-noncoherent.c
@@ -48,7 +48,7 @@ static int dma_noncoherent_map_sg(struct device *dev, struct scatterlist *sgl,
 	return nents;
 }
 
-#ifdef CONFIG_DMA_NONCOHERENT_SYNC_FOR_CPU
+#ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU
 static void dma_noncoherent_sync_single_for_cpu(struct device *dev,
 		dma_addr_t addr, size_t size, enum dma_data_direction dir)
 {
@@ -88,7 +88,7 @@ const struct dma_map_ops dma_noncoherent_ops = {
 	.sync_sg_for_device	= dma_noncoherent_sync_sg_for_device,
 	.map_page		= dma_noncoherent_map_page,
 	.map_sg			= dma_noncoherent_map_sg,
-#ifdef CONFIG_DMA_NONCOHERENT_SYNC_FOR_CPU
+#ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU
 	.sync_single_for_cpu	= dma_noncoherent_sync_single_for_cpu,
 	.sync_sg_for_cpu	= dma_noncoherent_sync_sg_for_cpu,
 	.unmap_page		= dma_noncoherent_unmap_page,

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* Re: [PATCH 06/22] arc: use generic dma_noncoherent_ops
@ 2018-04-26  6:45       ` hch
  0 siblings, 0 replies; 2593+ messages in thread
From: hch @ 2018-04-26  6:45 UTC (permalink / raw)
  To: Alexey Brodkin
  Cc: hch@lst.de, deanbo422@gmail.com, linux-sh@vger.kernel.org,
	linux-kernel@vger.kernel.org, nios2-dev@lists.rocketboards.org,
	linux-xtensa@linux-xtensa.org, linux-m68k@lists.linux-m68k.org,
	linux-alpha@vger.kernel.org, linux-hexagon@vger.kernel.org,
	linux-snps-arc@lists.infradead.org, green.hu@gmail.com,
	openrisc@lists.librecores.org,
	linux-arm-kernel@lists.infradead.org

On Wed, Apr 25, 2018 at 11:17:01AM +0000, Alexey Brodkin wrote:
> Which is actually strange as I would expect ARC code to be built by bots.

I don't think I got any notification.  Thank for the fixes!

I think I found the bug, based on the fact that so far all tests for
architectures that also need a cache op for device to cpu transitions
failed.  I did a stupid typo when changing kconfig symbols, so please
try the patch below.

>  
>  static int l2_line_sz;
>  static int ioc_exists;
> -int slc_enable = 1, ioc_enable = 1;
> +int slc_enable = 1, ioc_enable = 0;

Hmm.  It seems if ioc_enable is 0 we should simply be using
dma_direct_ops on arc, but that is a different discussion.

---
diff --git a/lib/dma-noncoherent.c b/lib/dma-noncoherent.c
index f4b8532c20ac..a2c192b3508d 100644
--- a/lib/dma-noncoherent.c
+++ b/lib/dma-noncoherent.c
@@ -48,7 +48,7 @@ static int dma_noncoherent_map_sg(struct device *dev, struct scatterlist *sgl,
 	return nents;
 }
 
-#ifdef CONFIG_DMA_NONCOHERENT_SYNC_FOR_CPU
+#ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU
 static void dma_noncoherent_sync_single_for_cpu(struct device *dev,
 		dma_addr_t addr, size_t size, enum dma_data_direction dir)
 {
@@ -88,7 +88,7 @@ const struct dma_map_ops dma_noncoherent_ops = {
 	.sync_sg_for_device	= dma_noncoherent_sync_sg_for_device,
 	.map_page		= dma_noncoherent_map_page,
 	.map_sg			= dma_noncoherent_map_sg,
-#ifdef CONFIG_DMA_NONCOHERENT_SYNC_FOR_CPU
+#ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU
 	.sync_single_for_cpu	= dma_noncoherent_sync_single_for_cpu,
 	.sync_sg_for_cpu	= dma_noncoherent_sync_sg_for_cpu,
 	.unmap_page		= dma_noncoherent_unmap_page,

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [OpenRISC] [PATCH 06/22] arc: use generic dma_noncoherent_ops
@ 2018-04-26  6:45       ` hch
  0 siblings, 0 replies; 2593+ messages in thread
From: hch @ 2018-04-26  6:45 UTC (permalink / raw)
  To: openrisc

On Wed, Apr 25, 2018 at 11:17:01AM +0000, Alexey Brodkin wrote:
> Which is actually strange as I would expect ARC code to be built by bots.

I don't think I got any notification.  Thank for the fixes!

I think I found the bug, based on the fact that so far all tests for
architectures that also need a cache op for device to cpu transitions
failed.  I did a stupid typo when changing kconfig symbols, so please
try the patch below.

>  
>  static int l2_line_sz;
>  static int ioc_exists;
> -int slc_enable = 1, ioc_enable = 1;
> +int slc_enable = 1, ioc_enable = 0;

Hmm.  It seems if ioc_enable is 0 we should simply be using
dma_direct_ops on arc, but that is a different discussion.

---
diff --git a/lib/dma-noncoherent.c b/lib/dma-noncoherent.c
index f4b8532c20ac..a2c192b3508d 100644
--- a/lib/dma-noncoherent.c
+++ b/lib/dma-noncoherent.c
@@ -48,7 +48,7 @@ static int dma_noncoherent_map_sg(struct device *dev, struct scatterlist *sgl,
 	return nents;
 }
 
-#ifdef CONFIG_DMA_NONCOHERENT_SYNC_FOR_CPU
+#ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU
 static void dma_noncoherent_sync_single_for_cpu(struct device *dev,
 		dma_addr_t addr, size_t size, enum dma_data_direction dir)
 {
@@ -88,7 +88,7 @@ const struct dma_map_ops dma_noncoherent_ops = {
 	.sync_sg_for_device	= dma_noncoherent_sync_sg_for_device,
 	.map_page		= dma_noncoherent_map_page,
 	.map_sg			= dma_noncoherent_map_sg,
-#ifdef CONFIG_DMA_NONCOHERENT_SYNC_FOR_CPU
+#ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU
 	.sync_single_for_cpu	= dma_noncoherent_sync_single_for_cpu,
 	.sync_sg_for_cpu	= dma_noncoherent_sync_sg_for_cpu,
 	.unmap_page		= dma_noncoherent_unmap_page,

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* [PATCH 06/22] arc: use generic dma_noncoherent_ops
@ 2018-04-26  6:45       ` hch
  0 siblings, 0 replies; 2593+ messages in thread
From: hch at lst.de @ 2018-04-26  6:45 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Apr 25, 2018 at 11:17:01AM +0000, Alexey Brodkin wrote:
> Which is actually strange as I would expect ARC code to be built by bots.

I don't think I got any notification.  Thank for the fixes!

I think I found the bug, based on the fact that so far all tests for
architectures that also need a cache op for device to cpu transitions
failed.  I did a stupid typo when changing kconfig symbols, so please
try the patch below.

>  
>  static int l2_line_sz;
>  static int ioc_exists;
> -int slc_enable = 1, ioc_enable = 1;
> +int slc_enable = 1, ioc_enable = 0;

Hmm.  It seems if ioc_enable is 0 we should simply be using
dma_direct_ops on arc, but that is a different discussion.

---
diff --git a/lib/dma-noncoherent.c b/lib/dma-noncoherent.c
index f4b8532c20ac..a2c192b3508d 100644
--- a/lib/dma-noncoherent.c
+++ b/lib/dma-noncoherent.c
@@ -48,7 +48,7 @@ static int dma_noncoherent_map_sg(struct device *dev, struct scatterlist *sgl,
 	return nents;
 }
 
-#ifdef CONFIG_DMA_NONCOHERENT_SYNC_FOR_CPU
+#ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU
 static void dma_noncoherent_sync_single_for_cpu(struct device *dev,
 		dma_addr_t addr, size_t size, enum dma_data_direction dir)
 {
@@ -88,7 +88,7 @@ const struct dma_map_ops dma_noncoherent_ops = {
 	.sync_sg_for_device	= dma_noncoherent_sync_sg_for_device,
 	.map_page		= dma_noncoherent_map_page,
 	.map_sg			= dma_noncoherent_map_sg,
-#ifdef CONFIG_DMA_NONCOHERENT_SYNC_FOR_CPU
+#ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU
 	.sync_single_for_cpu	= dma_noncoherent_sync_single_for_cpu,
 	.sync_sg_for_cpu	= dma_noncoherent_sync_sg_for_cpu,
 	.unmap_page		= dma_noncoherent_unmap_page,

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* Re: [PATCH 13/22] nds32: use generic dma_noncoherent_ops
  2018-04-26  6:42               ` Christoph Hellwig
                                   ` (2 preceding siblings ...)
  (?)
@ 2018-04-26  8:06                 ` Greentime Hu
  -1 siblings, 0 replies; 2593+ messages in thread
From: Greentime Hu @ 2018-04-26  8:06 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-arch, Michal Simek, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, Linux Kernel Mailing List

2018-04-26 14:42 GMT+08:00 Christoph Hellwig <hch@lst.de>:
> Can you try this patch ontop of either the new or original one?
>
> ---
> diff --git a/lib/dma-noncoherent.c b/lib/dma-noncoherent.c
> index f4b8532c20ac..a2c192b3508d 100644
> --- a/lib/dma-noncoherent.c
> +++ b/lib/dma-noncoherent.c
> @@ -48,7 +48,7 @@ static int dma_noncoherent_map_sg(struct device *dev, struct scatterlist *sgl,
>         return nents;
>  }
>
> -#ifdef CONFIG_DMA_NONCOHERENT_SYNC_FOR_CPU
> +#ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU
>  static void dma_noncoherent_sync_single_for_cpu(struct device *dev,
>                 dma_addr_t addr, size_t size, enum dma_data_direction dir)
>  {
> @@ -88,7 +88,7 @@ const struct dma_map_ops dma_noncoherent_ops = {
>         .sync_sg_for_device     = dma_noncoherent_sync_sg_for_device,
>         .map_page               = dma_noncoherent_map_page,
>         .map_sg                 = dma_noncoherent_map_sg,
> -#ifdef CONFIG_DMA_NONCOHERENT_SYNC_FOR_CPU
> +#ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU
>         .sync_single_for_cpu    = dma_noncoherent_sync_single_for_cpu,
>         .sync_sg_for_cpu        = dma_noncoherent_sync_sg_for_cpu,
>         .unmap_page             = dma_noncoherent_unmap_page,

It works!!!

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* [PATCH 13/22] nds32: use generic dma_noncoherent_ops
@ 2018-04-26  8:06                 ` Greentime Hu
  0 siblings, 0 replies; 2593+ messages in thread
From: Greentime Hu @ 2018-04-26  8:06 UTC (permalink / raw)
  To: linux-snps-arc

2018-04-26 14:42 GMT+08:00 Christoph Hellwig <hch at lst.de>:
> Can you try this patch ontop of either the new or original one?
>
> ---
> diff --git a/lib/dma-noncoherent.c b/lib/dma-noncoherent.c
> index f4b8532c20ac..a2c192b3508d 100644
> --- a/lib/dma-noncoherent.c
> +++ b/lib/dma-noncoherent.c
> @@ -48,7 +48,7 @@ static int dma_noncoherent_map_sg(struct device *dev, struct scatterlist *sgl,
>         return nents;
>  }
>
> -#ifdef CONFIG_DMA_NONCOHERENT_SYNC_FOR_CPU
> +#ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU
>  static void dma_noncoherent_sync_single_for_cpu(struct device *dev,
>                 dma_addr_t addr, size_t size, enum dma_data_direction dir)
>  {
> @@ -88,7 +88,7 @@ const struct dma_map_ops dma_noncoherent_ops = {
>         .sync_sg_for_device     = dma_noncoherent_sync_sg_for_device,
>         .map_page               = dma_noncoherent_map_page,
>         .map_sg                 = dma_noncoherent_map_sg,
> -#ifdef CONFIG_DMA_NONCOHERENT_SYNC_FOR_CPU
> +#ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU
>         .sync_single_for_cpu    = dma_noncoherent_sync_single_for_cpu,
>         .sync_sg_for_cpu        = dma_noncoherent_sync_sg_for_cpu,
>         .unmap_page             = dma_noncoherent_unmap_page,

It works!!!

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* Re: [PATCH 13/22] nds32: use generic dma_noncoherent_ops
@ 2018-04-26  8:06                 ` Greentime Hu
  0 siblings, 0 replies; 2593+ messages in thread
From: Greentime Hu @ 2018-04-26  8:06 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-arch, Michal Simek, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, Linux Kernel Mailing List

2018-04-26 14:42 GMT+08:00 Christoph Hellwig <hch@lst.de>:
> Can you try this patch ontop of either the new or original one?
>
> ---
> diff --git a/lib/dma-noncoherent.c b/lib/dma-noncoherent.c
> index f4b8532c20ac..a2c192b3508d 100644
> --- a/lib/dma-noncoherent.c
> +++ b/lib/dma-noncoherent.c
> @@ -48,7 +48,7 @@ static int dma_noncoherent_map_sg(struct device *dev, struct scatterlist *sgl,
>         return nents;
>  }
>
> -#ifdef CONFIG_DMA_NONCOHERENT_SYNC_FOR_CPU
> +#ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU
>  static void dma_noncoherent_sync_single_for_cpu(struct device *dev,
>                 dma_addr_t addr, size_t size, enum dma_data_direction dir)
>  {
> @@ -88,7 +88,7 @@ const struct dma_map_ops dma_noncoherent_ops = {
>         .sync_sg_for_device     = dma_noncoherent_sync_sg_for_device,
>         .map_page               = dma_noncoherent_map_page,
>         .map_sg                 = dma_noncoherent_map_sg,
> -#ifdef CONFIG_DMA_NONCOHERENT_SYNC_FOR_CPU
> +#ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU
>         .sync_single_for_cpu    = dma_noncoherent_sync_single_for_cpu,
>         .sync_sg_for_cpu        = dma_noncoherent_sync_sg_for_cpu,
>         .unmap_page             = dma_noncoherent_unmap_page,

It works!!!

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* [OpenRISC] [PATCH 13/22] nds32: use generic dma_noncoherent_ops
@ 2018-04-26  8:06                 ` Greentime Hu
  0 siblings, 0 replies; 2593+ messages in thread
From: Greentime Hu @ 2018-04-26  8:06 UTC (permalink / raw)
  To: openrisc

2018-04-26 14:42 GMT+08:00 Christoph Hellwig <hch@lst.de>:
> Can you try this patch ontop of either the new or original one?
>
> ---
> diff --git a/lib/dma-noncoherent.c b/lib/dma-noncoherent.c
> index f4b8532c20ac..a2c192b3508d 100644
> --- a/lib/dma-noncoherent.c
> +++ b/lib/dma-noncoherent.c
> @@ -48,7 +48,7 @@ static int dma_noncoherent_map_sg(struct device *dev, struct scatterlist *sgl,
>         return nents;
>  }
>
> -#ifdef CONFIG_DMA_NONCOHERENT_SYNC_FOR_CPU
> +#ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU
>  static void dma_noncoherent_sync_single_for_cpu(struct device *dev,
>                 dma_addr_t addr, size_t size, enum dma_data_direction dir)
>  {
> @@ -88,7 +88,7 @@ const struct dma_map_ops dma_noncoherent_ops = {
>         .sync_sg_for_device     = dma_noncoherent_sync_sg_for_device,
>         .map_page               = dma_noncoherent_map_page,
>         .map_sg                 = dma_noncoherent_map_sg,
> -#ifdef CONFIG_DMA_NONCOHERENT_SYNC_FOR_CPU
> +#ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU
>         .sync_single_for_cpu    = dma_noncoherent_sync_single_for_cpu,
>         .sync_sg_for_cpu        = dma_noncoherent_sync_sg_for_cpu,
>         .unmap_page             = dma_noncoherent_unmap_page,

It works!!!

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* [PATCH 13/22] nds32: use generic dma_noncoherent_ops
@ 2018-04-26  8:06                 ` Greentime Hu
  0 siblings, 0 replies; 2593+ messages in thread
From: Greentime Hu @ 2018-04-26  8:06 UTC (permalink / raw)
  To: linux-arm-kernel

2018-04-26 14:42 GMT+08:00 Christoph Hellwig <hch@lst.de>:
> Can you try this patch ontop of either the new or original one?
>
> ---
> diff --git a/lib/dma-noncoherent.c b/lib/dma-noncoherent.c
> index f4b8532c20ac..a2c192b3508d 100644
> --- a/lib/dma-noncoherent.c
> +++ b/lib/dma-noncoherent.c
> @@ -48,7 +48,7 @@ static int dma_noncoherent_map_sg(struct device *dev, struct scatterlist *sgl,
>         return nents;
>  }
>
> -#ifdef CONFIG_DMA_NONCOHERENT_SYNC_FOR_CPU
> +#ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU
>  static void dma_noncoherent_sync_single_for_cpu(struct device *dev,
>                 dma_addr_t addr, size_t size, enum dma_data_direction dir)
>  {
> @@ -88,7 +88,7 @@ const struct dma_map_ops dma_noncoherent_ops = {
>         .sync_sg_for_device     = dma_noncoherent_sync_sg_for_device,
>         .map_page               = dma_noncoherent_map_page,
>         .map_sg                 = dma_noncoherent_map_sg,
> -#ifdef CONFIG_DMA_NONCOHERENT_SYNC_FOR_CPU
> +#ifdef CONFIG_ARCH_HAS_SYNC_DMA_FOR_CPU
>         .sync_single_for_cpu    = dma_noncoherent_sync_single_for_cpu,
>         .sync_sg_for_cpu        = dma_noncoherent_sync_sg_for_cpu,
>         .unmap_page             = dma_noncoherent_unmap_page,

It works!!!

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* Re: [PATCH 13/22] nds32: use generic dma_noncoherent_ops
  2018-04-26  8:06                 ` Greentime Hu
                                     ` (2 preceding siblings ...)
  (?)
@ 2018-04-26  8:24                   ` Christoph Hellwig
  -1 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-26  8:24 UTC (permalink / raw)
  To: Greentime Hu
  Cc: Christoph Hellwig, linux-arch, Michal Simek, Vincent Chen,
	linux-alpha, linux-snps-arc, linux-arm-kernel, linux-c6x-dev,
	linux-hexagon, linux-m68k, nios2-dev, openrisc, linux-parisc,
	linux-sh, sparclinux, linux-xtensa, Linux Kernel Mailing List

On Thu, Apr 26, 2018 at 04:06:34PM +0800, Greentime Hu wrote:
> It works!!!

Thanks!

Can you retest the updated tree here with all the fixes and give me
your Tested-by: for the generic and nds32 patches?

git://git.infradead.org/users/hch/misc.git generic-dma-noncoherent

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* [PATCH 13/22] nds32: use generic dma_noncoherent_ops
@ 2018-04-26  8:24                   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-26  8:24 UTC (permalink / raw)
  To: linux-snps-arc

On Thu, Apr 26, 2018@04:06:34PM +0800, Greentime Hu wrote:
> It works!!!

Thanks!

Can you retest the updated tree here with all the fixes and give me
your Tested-by: for the generic and nds32 patches?

git://git.infradead.org/users/hch/misc.git generic-dma-noncoherent

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* Re: [PATCH 13/22] nds32: use generic dma_noncoherent_ops
@ 2018-04-26  8:24                   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-26  8:24 UTC (permalink / raw)
  To: Greentime Hu
  Cc: Christoph Hellwig, linux-arch, Michal Simek, Vincent Chen,
	linux-alpha, linux-snps-arc, linux-arm-kernel, linux-c6x-dev,
	linux-hexagon, linux-m68k, nios2-dev, openrisc, linux-parisc,
	linux-sh, sparclinux, linux-xtensa, Linux Kernel Mailing List

On Thu, Apr 26, 2018 at 04:06:34PM +0800, Greentime Hu wrote:
> It works!!!

Thanks!

Can you retest the updated tree here with all the fixes and give me
your Tested-by: for the generic and nds32 patches?

git://git.infradead.org/users/hch/misc.git generic-dma-noncoherent

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* [OpenRISC] [PATCH 13/22] nds32: use generic dma_noncoherent_ops
@ 2018-04-26  8:24                   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-26  8:24 UTC (permalink / raw)
  To: openrisc

On Thu, Apr 26, 2018 at 04:06:34PM +0800, Greentime Hu wrote:
> It works!!!

Thanks!

Can you retest the updated tree here with all the fixes and give me
your Tested-by: for the generic and nds32 patches?

git://git.infradead.org/users/hch/misc.git generic-dma-noncoherent

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* [PATCH 13/22] nds32: use generic dma_noncoherent_ops
@ 2018-04-26  8:24                   ` Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-04-26  8:24 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Apr 26, 2018 at 04:06:34PM +0800, Greentime Hu wrote:
> It works!!!

Thanks!

Can you retest the updated tree here with all the fixes and give me
your Tested-by: for the generic and nds32 patches?

git://git.infradead.org/users/hch/misc.git generic-dma-noncoherent

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* Re: [PATCH 06/22] arc: use generic dma_noncoherent_ops
@ 2018-04-26  8:25         ` hch
  0 siblings, 0 replies; 2593+ messages in thread
From: hch @ 2018-04-26  8:25 UTC (permalink / raw)
  To: Alexey Brodkin
  Cc: hch@lst.de, deanbo422@gmail.com, linux-sh@vger.kernel.org,
	linux-kernel@vger.kernel.org, nios2-dev@lists.rocketboards.org,
	linux-xtensa@linux-xtensa.org, linux-m68k@lists.linux-m68k.org,
	linux-alpha@vger.kernel.org, linux-hexagon@vger.kernel.org,
	linux-snps-arc@lists.infradead.org, green.hu@gmail.com,
	openrisc@lists.librecores.org,
	linux-arm-kernel@lists.infradead.org

On Thu, Apr 26, 2018 at 08:45:00AM +0200, hch@lst.de wrote:
> On Wed, Apr 25, 2018 at 11:17:01AM +0000, Alexey Brodkin wrote:
> > Which is actually strange as I would expect ARC code to be built by bots.
> 
> I don't think I got any notification.  Thank for the fixes!
> 
> I think I found the bug, based on the fact that so far all tests for
> architectures that also need a cache op for device to cpu transitions
> failed.  I did a stupid typo when changing kconfig symbols, so please
> try the patch below.

Confirmed to work for nds32, so here is a git tree with the core, arc
and nds32 fixes folded in, feel free to test that one:

git://git.infradead.org/users/hch/misc.git generic-dma-noncoherent

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* Re: [PATCH 06/22] arc: use generic dma_noncoherent_ops
@ 2018-04-26  8:25         ` hch
  0 siblings, 0 replies; 2593+ messages in thread
From: hch @ 2018-04-26  8:25 UTC (permalink / raw)
  To: Alexey Brodkin
  Cc: hch@lst.de, deanbo422@gmail.com, linux-sh@vger.kernel.org,
	linux-kernel@vger.kernel.org, nios2-dev@lists.rocketboards.org,
	linux-xtensa@linux-xtensa.org, linux-m68k@lists.linux-m68k.org,
	linux-alpha@vger.kernel.org, linux-hexagon@vger.kernel.org,
	linux-snps-arc@lists.infradead.org, green.hu@gmail.com,
	openrisc@lists.librecores.org,
	linux-arm-kernel@lists.infradead.org, monstr@monstr.eu,
	linux-parisc@vger.kernel.org, linux-c6x-dev@linux-c6x.org,
	linux-arch@vger.kernel.org, sparclinux@vger.kernel.org

On Thu, Apr 26, 2018 at 08:45:00AM +0200, hch@lst.de wrote:
> On Wed, Apr 25, 2018 at 11:17:01AM +0000, Alexey Brodkin wrote:
> > Which is actually strange as I would expect ARC code to be built by bots.
> 
> I don't think I got any notification.  Thank for the fixes!
> 
> I think I found the bug, based on the fact that so far all tests for
> architectures that also need a cache op for device to cpu transitions
> failed.  I did a stupid typo when changing kconfig symbols, so please
> try the patch below.

Confirmed to work for nds32, so here is a git tree with the core, arc
and nds32 fixes folded in, feel free to test that one:

git://git.infradead.org/users/hch/misc.git generic-dma-noncoherent

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* Re: [PATCH 06/22] arc: use generic dma_noncoherent_ops
@ 2018-04-26  8:25         ` hch
  0 siblings, 0 replies; 2593+ messages in thread
From: hch @ 2018-04-26  8:25 UTC (permalink / raw)
  To: Alexey Brodkin
  Cc: hch@lst.de, deanbo422@gmail.com, linux-sh@vger.kernel.org,
	linux-kernel@vger.kernel.org, nios2-dev@lists.rocketboards.org,
	linux-xtensa@linux-xtensa.org, linux-m68k@lists.linux-m68k.org,
	linux-alpha@vger.kernel.org, linux-hexagon@vger.kernel.org,
	linux-snps-arc@lists.infradead.org, green.hu@gmail.com,
	openrisc@lists.librecores.org,
	linux-arm-kernel@lists.infradead.org

On Thu, Apr 26, 2018 at 08:45:00AM +0200, hch@lst.de wrote:
> On Wed, Apr 25, 2018 at 11:17:01AM +0000, Alexey Brodkin wrote:
> > Which is actually strange as I would expect ARC code to be built by bots.
> 
> I don't think I got any notification.  Thank for the fixes!
> 
> I think I found the bug, based on the fact that so far all tests for
> architectures that also need a cache op for device to cpu transitions
> failed.  I did a stupid typo when changing kconfig symbols, so please
> try the patch below.

Confirmed to work for nds32, so here is a git tree with the core, arc
and nds32 fixes folded in, feel free to test that one:

git://git.infradead.org/users/hch/misc.git generic-dma-noncoherent

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* [PATCH 06/22] arc: use generic dma_noncoherent_ops
@ 2018-04-26  8:25         ` hch
  0 siblings, 0 replies; 2593+ messages in thread
From: hch @ 2018-04-26  8:25 UTC (permalink / raw)
  To: linux-snps-arc

On Thu, Apr 26, 2018@08:45:00AM +0200, hch@lst.de wrote:
> On Wed, Apr 25, 2018@11:17:01AM +0000, Alexey Brodkin wrote:
> > Which is actually strange as I would expect ARC code to be built by bots.
> 
> I don't think I got any notification.  Thank for the fixes!
> 
> I think I found the bug, based on the fact that so far all tests for
> architectures that also need a cache op for device to cpu transitions
> failed.  I did a stupid typo when changing kconfig symbols, so please
> try the patch below.

Confirmed to work for nds32, so here is a git tree with the core, arc
and nds32 fixes folded in, feel free to test that one:

git://git.infradead.org/users/hch/misc.git generic-dma-noncoherent

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* Re: [PATCH 06/22] arc: use generic dma_noncoherent_ops
@ 2018-04-26  8:25         ` hch
  0 siblings, 0 replies; 2593+ messages in thread
From: hch @ 2018-04-26  8:25 UTC (permalink / raw)
  To: Alexey Brodkin
  Cc: hch@lst.de, deanbo422@gmail.com, linux-sh@vger.kernel.org,
	linux-kernel@vger.kernel.org, nios2-dev@lists.rocketboards.org,
	linux-xtensa@linux-xtensa.org, linux-m68k@lists.linux-m68k.org,
	linux-alpha@vger.kernel.org, linux-hexagon@vger.kernel.org,
	linux-snps-arc@lists.infradead.org, green.hu@gmail.com,
	openrisc@lists.librecores.org,
	linux-arm-kernel@lists.infradead.org

On Thu, Apr 26, 2018 at 08:45:00AM +0200, hch@lst.de wrote:
> On Wed, Apr 25, 2018 at 11:17:01AM +0000, Alexey Brodkin wrote:
> > Which is actually strange as I would expect ARC code to be built by bots.
> 
> I don't think I got any notification.  Thank for the fixes!
> 
> I think I found the bug, based on the fact that so far all tests for
> architectures that also need a cache op for device to cpu transitions
> failed.  I did a stupid typo when changing kconfig symbols, so please
> try the patch below.

Confirmed to work for nds32, so here is a git tree with the core, arc
and nds32 fixes folded in, feel free to test that one:

git://git.infradead.org/users/hch/misc.git generic-dma-noncoherent

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* [OpenRISC] [PATCH 06/22] arc: use generic dma_noncoherent_ops
@ 2018-04-26  8:25         ` hch
  0 siblings, 0 replies; 2593+ messages in thread
From: hch @ 2018-04-26  8:25 UTC (permalink / raw)
  To: openrisc

On Thu, Apr 26, 2018 at 08:45:00AM +0200, hch at lst.de wrote:
> On Wed, Apr 25, 2018 at 11:17:01AM +0000, Alexey Brodkin wrote:
> > Which is actually strange as I would expect ARC code to be built by bots.
> 
> I don't think I got any notification.  Thank for the fixes!
> 
> I think I found the bug, based on the fact that so far all tests for
> architectures that also need a cache op for device to cpu transitions
> failed.  I did a stupid typo when changing kconfig symbols, so please
> try the patch below.

Confirmed to work for nds32, so here is a git tree with the core, arc
and nds32 fixes folded in, feel free to test that one:

git://git.infradead.org/users/hch/misc.git generic-dma-noncoherent

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* [PATCH 06/22] arc: use generic dma_noncoherent_ops
@ 2018-04-26  8:25         ` hch
  0 siblings, 0 replies; 2593+ messages in thread
From: hch at lst.de @ 2018-04-26  8:25 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Apr 26, 2018 at 08:45:00AM +0200, hch at lst.de wrote:
> On Wed, Apr 25, 2018 at 11:17:01AM +0000, Alexey Brodkin wrote:
> > Which is actually strange as I would expect ARC code to be built by bots.
> 
> I don't think I got any notification.  Thank for the fixes!
> 
> I think I found the bug, based on the fact that so far all tests for
> architectures that also need a cache op for device to cpu transitions
> failed.  I did a stupid typo when changing kconfig symbols, so please
> try the patch below.

Confirmed to work for nds32, so here is a git tree with the core, arc
and nds32 fixes folded in, feel free to test that one:

git://git.infradead.org/users/hch/misc.git generic-dma-noncoherent

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* Re: [PATCH 13/22] nds32: use generic dma_noncoherent_ops
  2018-04-26  8:24                   ` Christoph Hellwig
                                       ` (2 preceding siblings ...)
  (?)
@ 2018-04-26  9:39                     ` Greentime Hu
  -1 siblings, 0 replies; 2593+ messages in thread
From: Greentime Hu @ 2018-04-26  9:39 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-arch, Michal Simek, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, Linux Kernel Mailing List

2018-04-26 16:24 GMT+08:00 Christoph Hellwig <hch@lst.de>:
> On Thu, Apr 26, 2018 at 04:06:34PM +0800, Greentime Hu wrote:
>> It works!!!
>
> Thanks!
>
> Can you retest the updated tree here with all the fixes and give me
> your Tested-by: for the generic and nds32 patches?
>
> git://git.infradead.org/users/hch/misc.git generic-dma-noncoherent

Sorry Christoph. I found the previous mail I said it works was wrong
because I used a wrong vmlinux.
It still failed. >,<

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* [PATCH 13/22] nds32: use generic dma_noncoherent_ops
@ 2018-04-26  9:39                     ` Greentime Hu
  0 siblings, 0 replies; 2593+ messages in thread
From: Greentime Hu @ 2018-04-26  9:39 UTC (permalink / raw)
  To: linux-snps-arc

2018-04-26 16:24 GMT+08:00 Christoph Hellwig <hch at lst.de>:
> On Thu, Apr 26, 2018@04:06:34PM +0800, Greentime Hu wrote:
>> It works!!!
>
> Thanks!
>
> Can you retest the updated tree here with all the fixes and give me
> your Tested-by: for the generic and nds32 patches?
>
> git://git.infradead.org/users/hch/misc.git generic-dma-noncoherent

Sorry Christoph. I found the previous mail I said it works was wrong
because I used a wrong vmlinux.
It still failed. >,<

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* Re: [PATCH 13/22] nds32: use generic dma_noncoherent_ops
@ 2018-04-26  9:39                     ` Greentime Hu
  0 siblings, 0 replies; 2593+ messages in thread
From: Greentime Hu @ 2018-04-26  9:39 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: linux-arch, Michal Simek, Vincent Chen, linux-alpha,
	linux-snps-arc, linux-arm-kernel, linux-c6x-dev, linux-hexagon,
	linux-m68k, nios2-dev, openrisc, linux-parisc, linux-sh,
	sparclinux, linux-xtensa, Linux Kernel Mailing List

2018-04-26 16:24 GMT+08:00 Christoph Hellwig <hch@lst.de>:
> On Thu, Apr 26, 2018 at 04:06:34PM +0800, Greentime Hu wrote:
>> It works!!!
>
> Thanks!
>
> Can you retest the updated tree here with all the fixes and give me
> your Tested-by: for the generic and nds32 patches?
>
> git://git.infradead.org/users/hch/misc.git generic-dma-noncoherent

Sorry Christoph. I found the previous mail I said it works was wrong
because I used a wrong vmlinux.
It still failed. >,<

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* [OpenRISC] [PATCH 13/22] nds32: use generic dma_noncoherent_ops
@ 2018-04-26  9:39                     ` Greentime Hu
  0 siblings, 0 replies; 2593+ messages in thread
From: Greentime Hu @ 2018-04-26  9:39 UTC (permalink / raw)
  To: openrisc

2018-04-26 16:24 GMT+08:00 Christoph Hellwig <hch@lst.de>:
> On Thu, Apr 26, 2018 at 04:06:34PM +0800, Greentime Hu wrote:
>> It works!!!
>
> Thanks!
>
> Can you retest the updated tree here with all the fixes and give me
> your Tested-by: for the generic and nds32 patches?
>
> git://git.infradead.org/users/hch/misc.git generic-dma-noncoherent

Sorry Christoph. I found the previous mail I said it works was wrong
because I used a wrong vmlinux.
It still failed. >,<

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* [PATCH 13/22] nds32: use generic dma_noncoherent_ops
@ 2018-04-26  9:39                     ` Greentime Hu
  0 siblings, 0 replies; 2593+ messages in thread
From: Greentime Hu @ 2018-04-26  9:39 UTC (permalink / raw)
  To: linux-arm-kernel

2018-04-26 16:24 GMT+08:00 Christoph Hellwig <hch@lst.de>:
> On Thu, Apr 26, 2018 at 04:06:34PM +0800, Greentime Hu wrote:
>> It works!!!
>
> Thanks!
>
> Can you retest the updated tree here with all the fixes and give me
> your Tested-by: for the generic and nds32 patches?
>
> git://git.infradead.org/users/hch/misc.git generic-dma-noncoherent

Sorry Christoph. I found the previous mail I said it works was wrong
because I used a wrong vmlinux.
It still failed. >,<

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2018-05-25  3:26 Bounced mail
  0 siblings, 0 replies; 2593+ messages in thread
From: Bounced mail @ 2018-05-25  3:26 UTC (permalink / raw)
  To: linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw

The original message was received at Fri, 25 May 2018 11:26:13 +0800
from lists.01.org [137.8.247.250]

----- The following addresses had permanent fatal errors -----
<linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org>

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2018-05-31 17:11 Adam Richter via Containers
  0 siblings, 0 replies; 2593+ messages in thread
From: Adam Richter via Containers @ 2018-05-31 17:11 UTC (permalink / raw)
  To: FRoss Perry, alexander deucher, containers, sca38018, westglen

http://voice.promang.net
Adam Richter

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2018-06-23 21:08 David Lechner
  0 siblings, 0 replies; 2593+ messages in thread
From: David Lechner @ 2018-06-23 21:08 UTC (permalink / raw)
  To: linux-remoteproc, devicetree, linux-omap, linux-arm-kernel
  Cc: David Lechner, Ohad Ben-Cohen, Bjorn Andersson, Rob Herring,
	Mark Rutland, Benoît Cousson, Tony Lindgren, Sekhar Nori,
	Kevin Hilman, linux-kernel


Date: Sat, 23 Jun 2018 15:43:59 -0500
Subject: [PATCH 0/8] New remoteproc driver for TI PRU

This series adds a new remoteproc driver for the TI Programmable Runtime Unit
(PRU) that is present in some TI Sitara processors. This code has been tested
working on AM1808 (LEGO MINDSTORMS EV3) and AM3358 (BeagleBone Green).

There are a couple of quirks that had to be worked around in order to get this
working. The PRU units have multiple memory maps. Notably, both the instruction
RAM and data RAM are at address 0x0. This caused the da_to_va callback to not
work because the same address could refer to two different locations. To work
around this, the first two patches add a "map" parameter to the da_to_va
callbacks so that we have an extra bit of information to make this distinction.

Also, on AM38xx we have to use pdata for accessing a reset since there is not
a reset controller. There are several other devices doing this, so the seems
the best way for now.

For anyone else who would like to test, I used the rpmsg-client-sample driver.
Just enable it in your kernel config. Then grab the appropriate firmware[1]
and put in in /lib/firmware/. Use sysfs to start and stop the PRU:

        echo start > /sys/class/remoteproc<n>/state
        echo stop > /sys/class/remoteproc<n>/state

[1]: firmware downloads:

AM18XX: https://github.com/ev3dev/ev3dev-pru-firmware/releases/download/mainline-kernel-testing/AM18xx-PRU-rpmsg-client-sample.zip
AM335X: https://github.com/ev3dev/ev3dev-pru-firmware/releases/download/mainline-kernel-testing/AM335x-PRU-rpmsg-client-sample.zip

David Lechner (8):
  remoteproc: add map parameter to da_to_va
  remoteproc: add page lookup for TI PRU to ELF loader
  ARM: OMAP2+: add pdata quirks for PRUSS reset
  dt-bindings: add bindings for TI PRU as remoteproc
  remoteproc: new driver for TI PRU
  ARM: davinci_all_defconfig: enable PRU remoteproc module
  ARM: dts: da850: add node for PRUSS
  ARM: dts: am33xx: add node for PRU remoteproc

 .../bindings/remoteproc/ti_pru_rproc.txt      |  51 ++
 MAINTAINERS                                   |   5 +
 arch/arm/boot/dts/am33xx.dtsi                 |   9 +
 arch/arm/boot/dts/da850.dtsi                  |   8 +
 arch/arm/configs/davinci_all_defconfig        |   2 +
 arch/arm/mach-omap2/pdata-quirks.c            |   9 +
 drivers/remoteproc/Kconfig                    |   7 +
 drivers/remoteproc/Makefile                   |   1 +
 drivers/remoteproc/imx_rproc.c                |   2 +-
 drivers/remoteproc/keystone_remoteproc.c      |   3 +-
 drivers/remoteproc/qcom_adsp_pil.c            |   2 +-
 drivers/remoteproc/qcom_q6v5_pil.c            |   2 +-
 drivers/remoteproc/qcom_wcnss.c               |   2 +-
 drivers/remoteproc/remoteproc_core.c          |  10 +-
 drivers/remoteproc/remoteproc_elf_loader.c    | 117 +++-
 drivers/remoteproc/remoteproc_internal.h      |   2 +-
 drivers/remoteproc/st_slim_rproc.c            |   2 +-
 drivers/remoteproc/ti_pru_rproc.c             | 660 ++++++++++++++++++
 drivers/remoteproc/wkup_m3_rproc.c            |   3 +-
 include/linux/platform_data/ti-pruss.h        |  18 +
 include/linux/remoteproc.h                    |   2 +-
 include/uapi/linux/elf-em.h                   |   1 +
 22 files changed, 899 insertions(+), 19 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/remoteproc/ti_pru_rproc.txt
 create mode 100644 drivers/remoteproc/ti_pru_rproc.c
 create mode 100644 include/linux/platform_data/ti-pruss.h

-- 
2.17.1

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2018-08-27 14:50 Christoph Hellwig
  0 siblings, 0 replies; 2593+ messages in thread
From: Christoph Hellwig @ 2018-08-27 14:50 UTC (permalink / raw)
  To: iommu
  Cc: Marek Szyprowski, Robin Murphy, Paul Burton, Greg Kroah-Hartman,
	linux-mips, linux-kernel

Subject: [RFC] merge dma_direct_ops and dma_noncoherent_ops

While most architectures are either always or never dma coherent for a
given build, the arm, arm64, mips and soon arc architectures can have
different dma coherent settings on a per-device basis.  Additionally
some mips builds can decide at boot time if dma is coherent or not.

I've started to look into handling noncoherent dma in swiotlb, and
moving the dma-iommu ops into common code [1], and for that we need a
generic way to check if a given device is coherent or not.  Moving
this flag into struct device also simplifies the conditionally coherent
architecture implementations.

These patches are also available in a git tree given that they have
a few previous posted dependencies:

    git://git.infradead.org/users/hch/misc.git dma-direct-noncoherent-merge

Gitweb:

    http://git.infradead.org/users/hch/misc.git/shortlog/refs/heads/dma-direct-noncoherent-merge

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2019-01-02 12:25 Frank Wunderlich
  0 siblings, 0 replies; 2593+ messages in thread
From: Frank Wunderlich @ 2019-01-02 12:25 UTC (permalink / raw)
  To: linux-arm-kernel, linux-mediatek


resend to mailing-list because previous attempt was blocked by
non-existing blacklist-filter: https://www.dnsbl.info/dnsbl-njabl-org.php

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown), 
@ 2019-01-15  2:55 Jens Axboe
  0 siblings, 0 replies; 2593+ messages in thread
From: Jens Axboe @ 2019-01-15  2:55 UTC (permalink / raw)
  To: linux-fsdevel, linux-aio, linux-block, linux-arch; +Cc: hch, jmoyer, avi

Here's v4 of the io_uring interface. No user visible changes this
time, outside of bumping the io_uring_sqe submission entry to a
full 64-bytes. This aligns better with caches, and leaves us some
room to grow for future features. See the v3 posting for full
details on the API:

https://lore.kernel.org/linux-block/20190112213011.1439-1-axboe@kernel.dk/

What I neglected to mention in the v3 posting, is that the fixed
buffer and fixed file interfaces are available through the
io_uring_register() system call. This means they can be registered
(and unregistered) independently of the io_uring context setup.

Patches are against 5.0-rc2 and can also be found in my 'io_uring'
git branch:

git://git.kernel.dk/linux-block io_uring

Changes since v3:

- Clean up fixed buffer index validation
- Add IORING_OP_NOP for ring perf testing
- Drop struct io_kiocb ki_* variable prefix, it clashes with struct
  kiocb for no reason except to cause confusement
- Bump io_uring_sqe to 64 bytes. Cacheline sized and aligned
  (on x86-64), and more future proof
- Use kmalloc_array()
- Make the page mlock rlimit incremental and not for root / CAP_IPC_LOCK
- Ensure io_uring_register() can't race with fops->release()
- Simplify and improve iopoll implementation
- Use FOLL_WRITE instead of open-coding it
- Fix 32-bit vs 64-bit sizing for the io_uring_register() structs
- Added x86 32-bit system calls
- Added 32-bit compat mode
- Rebased on 5.0-rc2


 Documentation/filesystems/vfs.txt      |    3 +
 arch/x86/entry/syscalls/syscall_32.tbl |    3 +
 arch/x86/entry/syscalls/syscall_64.tbl |    3 +
 block/bio.c                            |   59 +-
 fs/Makefile                            |    1 +
 fs/block_dev.c                         |   19 +-
 fs/file.c                              |   15 +-
 fs/file_table.c                        |    9 +-
 fs/gfs2/file.c                         |    2 +
 fs/io_uring.c                          | 2072 ++++++++++++++++++++++++
 fs/iomap.c                             |   48 +-
 fs/xfs/xfs_file.c                      |    1 +
 include/linux/bio.h                    |   14 +
 include/linux/blk_types.h              |    1 +
 include/linux/file.h                   |    2 +
 include/linux/fs.h                     |    6 +-
 include/linux/iomap.h                  |    1 +
 include/linux/sched/user.h             |    2 +-
 include/linux/syscalls.h               |    7 +
 include/uapi/linux/io_uring.h          |  155 ++
 init/Kconfig                           |    9 +
 kernel/sys_ni.c                        |    3 +
 22 files changed, 2395 insertions(+), 40 deletions(-)

-- 
Jens Axboe


--
To unsubscribe, send a message with 'unsubscribe linux-aio' in
the body to majordomo@kvack.org.  For more info on Linux AIO,
see: http://www.kvack.org/aio/
Don't email: <a href=mailto:"aart@kvack.org">aart@kvack.org</a>

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2019-02-28  3:36 Post Office
  0 siblings, 0 replies; 2593+ messages in thread
From: Post Office @ 2019-02-28  3:36 UTC (permalink / raw)
  To: linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw

This Message was undeliverable due to the following reason:

Your message was not delivered because the destination computer was
not reachable within the allowed queue period. The amount of time
a message is queued before it is returned depends on local configura-
tion parameters.

Most likely there is a network problem that prevented delivery, but
it is also possible that the computer is turned off, or does not
have a mail system running right now.

Your message was not delivered within 1 days:
Host 203.212.202.129 is not responding.

The following recipients did not receive this message:
<linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org>

Please reply to postmaster-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org
if you feel this message to be in error.

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2019-03-01  3:34 Automatic Email Delivery Software
  0 siblings, 0 replies; 2593+ messages in thread
From: Automatic Email Delivery Software @ 2019-03-01  3:34 UTC (permalink / raw)
  To: linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw

Message could not be delivered

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2019-03-04  3:42 Automatic Email Delivery Software
  0 siblings, 0 replies; 2593+ messages in thread
From: Automatic Email Delivery Software @ 2019-03-04  3:42 UTC (permalink / raw)
  To: linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=us-ascii, Size: 365 bytes --]

±'óÛýpZ·Âu<êZxfv›ª
„–Tœ'fŠ…>X90î±Î|…&†œì#*œˆ”~™zâý^°a¦ü^Èà£cÐ}øAè;£
¼µ8[èÅ«/øP¬
îÅ®_֙˫«XÉ·íÊ{¼
µöuCÇüöL~‰½¡±-_÷u¹.(v1OƒsM:I¿ù>1ÁÕüäuµèé"ËÚÌÞÙs9ùn,(SO)6ö\4_²ñ£•¬UNß¿5
<¦Ÿý4øÉüG!gü§´QrÓÀ:<(§9h7jÈø¹iï§eÛ–ð˜WõxY¼×ü|ëÙÙPýþçš»ú‘U] P݈Kx]»É‚Îâ÷]mù‹[ã.ÂÁf™;œÔ´5ÙtµU`ݵ
ÛÅ–£J$kÊ[À´U
ä|Ž"&`»öÔ[»ã$
Ÿ¨¢X„m‚¡ÂålJ±
!aÇJÂHpºÆˆat¬â69½#߉t0k¤‰I¤|
Z9
¢Z‹w£Œ[ªûþS
ç²


[-- Attachment #2: Type: text/plain, Size: 178 bytes --]

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2019-03-21  1:51 zhuchangchun
  0 siblings, 0 replies; 2593+ messages in thread
From: zhuchangchun @ 2019-03-21  1:51 UTC (permalink / raw)
  To: linux-kernel, linux-gpio

subscribe linux-kernel

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2019-03-29  0:36 邀请函
  0 siblings, 0 replies; 2593+ messages in thread
From: 邀请函 @ 2019-03-29  0:36 UTC (permalink / raw)
  To: linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw

-------- 转发邮件信息 --------
发件人:mivczrufz@exu.net
发送日期:2019-3-29  8:36:49
收件人:linux-nvdimm@lists.01.org
~附~件~内~容~请~您~查~阅~
8:36:49
_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2019-04-04  5:56 Mail Delivery Subsystem
  0 siblings, 0 replies; 2593+ messages in thread
From: Mail Delivery Subsystem @ 2019-04-04  5:56 UTC (permalink / raw)
  To: linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw

This Message was undeliverable due to the following reason:

Your message was not delivered because the destination computer was
not reachable within the allowed queue period. The amount of time
a message is queued before it is returned depends on local configura-
tion parameters.

Most likely there is a network problem that prevented delivery, but
it is also possible that the computer is turned off, or does not
have a mail system running right now.

Your message was not delivered within 1 days:
Host 66.24.245.203 is not responding.

The following recipients did not receive this message:
<linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org>

Please reply to postmaster-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org
if you feel this message to be in error.

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2019-04-05  2:38 Changbin Du
  0 siblings, 0 replies; 2593+ messages in thread
From: Changbin Du @ 2019-04-05  2:38 UTC (permalink / raw)
  To: Jonathan Corbet
  Cc: Rafael J. Wysocki, Changbin Du, Rafael J. Wysocki, Len Brown,
	ACPI Devel Maling List, Linux Kernel Mailing List,
	open list:DOCUMENTATION, Bjorn Helgaas

Bcc:
Subject: Re: [PATCH v2 00/24] Include linux ACPI docs into Sphinx TOC tree
Reply-To:
In-Reply-To: <20190403133613.13f3fd75@lwn.net>

+ Bjorn

On Wed, Apr 03, 2019 at 01:36:13PM -0600, Jonathan Corbet wrote:
> On Tue, 2 Apr 2019 10:25:23 +0200
> "Rafael J. Wysocki" <rafael@kernel.org> wrote:
> 
> > There are ACPI-related documents currently in Documentation/acpi/ that
> > don't clearly fall under either driver-api or admin-guide.  For
> > example, some of them describe various aspects of the ACPI support
> > subsystem operation and some document expectations with respect to the
> > ACPI tables provided by the firmware etc.
> > 
> > Where would you recommend to put them after converting to .rst?
> 
> OK, I've done some pondering on this.  Maybe what we need is a new
> top-level "hardware guide" book meant to hold information on how the
> hardware works and what the kernel's expectations are.  Architecture
> information could maybe go there too.  Would this make sense?
> 
> If so, I could see a division like this:
> 
> Hardware guide
> 	acpi-lid
> 	aml-debugger (or maybe driver api?)
> 	debug (ditto)
> 	DSD-properties-rules
> 	gpio-properties
> 	i2c-muxes
> 
> Admin guide
> 	cppc_sysfs
> 	initrd_table_override
> 
> Driver-API
> 	enumeration
> 	scan_handlers
> 
> other:
> 	dsdt-override: find another home for those five lines
>
Then, should we create dedicated sub-directories for these new charpters and
move documents to coresspoding one? Now we have 'admin-guide' and all admin-guid
docs are under it, otherwise we will have reference across different folders.
For example, the 'admin-guide/index.rst' will have:
    ...
    ../acpi/osi
    ...
Which seems not good.

> ...and so on.  I've probably gotten at least one of those wrong, but that's
> the idea.
> 
> Of course, then it would be nice to better integrate those documents so
> that they fit into a single coherent whole...a guy can dream...:)
> 
I am not an adminstrator, so I don't know how adminstrators use this kernel
documentation. But as a kernel developer, I prefer all related documents
integrated into one charpter. Because I probably miss some useful sections
if the documents are distributed into several charpters. And this is usually
how a book is written (One charpter focus on one topic and has sub-sections
such as overview, backgroud knowledge, implemenation details..),
but a book mostly target on hypothetical readers...

> Thanks,
> 
> jon

-- 
Cheers,
Changbin Du

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* Re: (unknown)
  2019-04-10 11:14 Norbert Lange
@ 2019-04-10 13:37 ` Jan Kiszka
  2019-04-10 14:36 ` (unknown) Jan Kiszka
  1 sibling, 0 replies; 2593+ messages in thread
From: Jan Kiszka @ 2019-04-10 13:37 UTC (permalink / raw)
  To: Norbert Lange, xenomai

On 10.04.19 13:14, Norbert Lange via Xenomai wrote:
> V3 of the patchset, corrected many checkstyle issues,
> simplified condvar autoinit.
> 

Thanks for the update!

> I did not use ARRAY_SIZE, as that would need another include.
> 

Ah, we do not have this construct in lib/ so far.

There are private ARRAY_LEN macros in lib/analogy/calibration.c and 
utils/analogy/analogy_calibrate.h. Well, something that can be consolidates later.

Jan

-- 
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 2593+ messages in thread

* Re: (unknown)
  2019-04-10 11:17 Norbert Lange
@ 2019-04-10 14:15 ` Jan Kiszka
  0 siblings, 0 replies; 2593+ messages in thread
From: Jan Kiszka @ 2019-04-10 14:15 UTC (permalink / raw)
  To: Norbert Lange, xenomai

On 10.04.19 13:17, Norbert Lange via Xenomai wrote:
> V2 of the patchset. Fixed checkstyle issues, better identation,
> and aded casts to silence (false) pedantic warnings.
> 

Both applied to next, thanks.

You probably want to edit your cover letter subject as well - or use git 
format-patch.

Jan

-- 
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 2593+ messages in thread

* Re: (unknown)
  2019-04-10 11:14 Norbert Lange
  2019-04-10 13:37 ` (unknown) Jan Kiszka
@ 2019-04-10 14:36 ` Jan Kiszka
       [not found]   ` <VI1PR05MB5917B5956F2E9365F10D6539F62E0@VI1PR05MB5917.eurprd05.prod.outlook.com>
  1 sibling, 1 reply; 2593+ messages in thread
From: Jan Kiszka @ 2019-04-10 14:36 UTC (permalink / raw)
  To: Norbert Lange, xenomai

On 10.04.19 13:14, Norbert Lange via Xenomai wrote:
> V3 of the patchset, corrected many checkstyle issues,
> simplified condvar autoinit.
> 
> I did not use ARRAY_SIZE, as that would need another include.
> 

All applied now. Patch 1 was not cleanly based on next, though. I think some 
local style cleanup was missing.

Jan

-- 
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 2593+ messages in thread

* Re: (unknown)
       [not found]   ` <VI1PR05MB5917B5956F2E9365F10D6539F62E0@VI1PR05MB5917.eurprd05.prod.outlook.com>
@ 2019-04-10 14:47     ` Jan Kiszka
  2019-04-10 15:02       ` (unknown) Lange Norbert
  0 siblings, 1 reply; 2593+ messages in thread
From: Jan Kiszka @ 2019-04-10 14:47 UTC (permalink / raw)
  To: Lange Norbert, Xenomai

[re-adding the list]

On 10.04.19 16:44, Lange Norbert wrote:
> 
> 
>> -----Original Message-----
>> From: Xenomai <xenomai-bounces@xenomai.org> On Behalf Of Jan Kiszka via
>> Xenomai
>> Sent: Mittwoch, 10. April 2019 16:36
>> To: Norbert Lange <nolange79@gmail.com>; xenomai@xenomai.org
>> Subject: Re: (unknown)
>>
>> E-MAIL FROM A NON-ANDRITZ SOURCE: AS A SECURITY MEASURE, PLEASE
>> EXERCISE CAUTION WITH E-MAIL CONTENT AND ANY LINKS OR ATTACHMENTS.
>>
>>
>> On 10.04.19 13:14, Norbert Lange via Xenomai wrote:
>>> V3 of the patchset, corrected many checkstyle issues, simplified
>>> condvar autoinit.
>>>
>>> I did not use ARRAY_SIZE, as that would need another include.
>>>
>>
>> All applied now. Patch 1 was not cleanly based on next, though. I think some
>> local style cleanup was missing.
> 
> I based all patches on master, thought this is the primary development branch?
> 

Line 566 in lib/cobalt/mutex.c had a trailing tab, your patch context did not, 
and that made the application fail. Maybe that was removed while transporting 
the patch into your mail client - better use git send-email in that case.

Jan

-- 
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 2593+ messages in thread

* RE: (unknown)
  2019-04-10 14:47     ` (unknown) Jan Kiszka
@ 2019-04-10 15:02       ` Lange Norbert
  2019-04-10 16:46         ` (unknown) Jan Kiszka
  0 siblings, 1 reply; 2593+ messages in thread
From: Lange Norbert @ 2019-04-10 15:02 UTC (permalink / raw)
  To: Jan Kiszka, Xenomai



> -----Original Message-----
> From: Jan Kiszka <jan.kiszka@siemens.com>
> Sent: Mittwoch, 10. April 2019 16:48
> To: Lange Norbert <norbert.lange@andritz.com>; Xenomai
> <xenomai@xenomai.org>
> Subject: Re: (unknown)
>
> E-MAIL FROM A NON-ANDRITZ SOURCE: AS A SECURITY MEASURE, PLEASE
> EXERCISE CAUTION WITH E-MAIL CONTENT AND ANY LINKS OR ATTACHMENTS.
>
>
> [re-adding the list]
>
> On 10.04.19 16:44, Lange Norbert wrote:
> >
> >
> >> -----Original Message-----
> >> From: Xenomai <xenomai-bounces@xenomai.org> On Behalf Of Jan Kiszka
> via
> >> Xenomai
> >> Sent: Mittwoch, 10. April 2019 16:36
> >> To: Norbert Lange <nolange79@gmail.com>; xenomai@xenomai.org
> >> Subject: Re: (unknown)
> >>
> >> E-MAIL FROM A NON-ANDRITZ SOURCE: AS A SECURITY MEASURE, PLEASE
> >> EXERCISE CAUTION WITH E-MAIL CONTENT AND ANY LINKS OR
> ATTACHMENTS.
> >>
> >>
> >> On 10.04.19 13:14, Norbert Lange via Xenomai wrote:
> >>> V3 of the patchset, corrected many checkstyle issues, simplified
> >>> condvar autoinit.
> >>>
> >>> I did not use ARRAY_SIZE, as that would need another include.
> >>>
> >>
> >> All applied now. Patch 1 was not cleanly based on next, though. I think some
> >> local style cleanup was missing.
> >
> > I based all patches on master, thought this is the primary development branch?
> >
>
> Line 566 in lib/cobalt/mutex.c had a trailing tab, your patch context did not,
> and that made the application fail. Maybe that was removed while transporting
> the patch into your mail client - better use git send-email in that case.

I use git send-email, you would not be happy if I sent patches over our IT Server
(one or two examples should reside somewhere in the ML) =).

I did use git-format-patch with --ignore-space-at-eol, maybe that’s the reason.

I know there are a few holdouts, but since you got a gitlab server and ci running already,
merge-requests could do all those style checks and test for build-failures without taking
any time of the maintainers and shorter feedback cycles for the contributors.
My IT is rather hostile to anything email based.

Norbert

________________________________

This message and any attachments are solely for the use of the intended recipients. They may contain privileged and/or confidential information or other information protected from disclosure. If you are not an intended recipient, you are hereby notified that you received this email in error and that any review, dissemination, distribution or copying of this email and any attachment is strictly prohibited. If you have received this email in error, please contact the sender and delete the message and any attachment from your system.

ANDRITZ HYDRO GmbH


Rechtsform/ Legal form: Gesellschaft mit beschränkter Haftung / Corporation

Firmensitz/ Registered seat: Wien

Firmenbuchgericht/ Court of registry: Handelsgericht Wien

Firmenbuchnummer/ Company registration: FN 61833 g

DVR: 0605077

UID-Nr.: ATU14756806


Thank You
________________________________

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* Re: (unknown)
  2019-04-10 15:02       ` (unknown) Lange Norbert
@ 2019-04-10 16:46         ` Jan Kiszka
  0 siblings, 0 replies; 2593+ messages in thread
From: Jan Kiszka @ 2019-04-10 16:46 UTC (permalink / raw)
  To: Lange Norbert, Xenomai

On 10.04.19 17:02, Lange Norbert wrote:
> 
> 
>> -----Original Message-----
>> From: Jan Kiszka <jan.kiszka@siemens.com>
>> Sent: Mittwoch, 10. April 2019 16:48
>> To: Lange Norbert <norbert.lange@andritz.com>; Xenomai
>> <xenomai@xenomai.org>
>> Subject: Re: (unknown)
>>
>> E-MAIL FROM A NON-ANDRITZ SOURCE: AS A SECURITY MEASURE, PLEASE
>> EXERCISE CAUTION WITH E-MAIL CONTENT AND ANY LINKS OR ATTACHMENTS.
>>
>>
>> [re-adding the list]
>>
>> On 10.04.19 16:44, Lange Norbert wrote:
>>>
>>>
>>>> -----Original Message-----
>>>> From: Xenomai <xenomai-bounces@xenomai.org> On Behalf Of Jan Kiszka
>> via
>>>> Xenomai
>>>> Sent: Mittwoch, 10. April 2019 16:36
>>>> To: Norbert Lange <nolange79@gmail.com>; xenomai@xenomai.org
>>>> Subject: Re: (unknown)
>>>>
>>>> E-MAIL FROM A NON-ANDRITZ SOURCE: AS A SECURITY MEASURE, PLEASE
>>>> EXERCISE CAUTION WITH E-MAIL CONTENT AND ANY LINKS OR
>> ATTACHMENTS.
>>>>
>>>>
>>>> On 10.04.19 13:14, Norbert Lange via Xenomai wrote:
>>>>> V3 of the patchset, corrected many checkstyle issues, simplified
>>>>> condvar autoinit.
>>>>>
>>>>> I did not use ARRAY_SIZE, as that would need another include.
>>>>>
>>>>
>>>> All applied now. Patch 1 was not cleanly based on next, though. I think some
>>>> local style cleanup was missing.
>>>
>>> I based all patches on master, thought this is the primary development branch?
>>>
>>
>> Line 566 in lib/cobalt/mutex.c had a trailing tab, your patch context did not,
>> and that made the application fail. Maybe that was removed while transporting
>> the patch into your mail client - better use git send-email in that case.
> 
> I use git send-email, you would not be happy if I sent patches over our IT Server
> (one or two examples should reside somewhere in the ML) =).

Yeah, I fully understand.

> 
> I did use git-format-patch with --ignore-space-at-eol, maybe that’s the reason.

I'm pretty sure that was it. OK - one off.

> 
> I know there are a few holdouts, but since you got a gitlab server and ci running already,
> merge-requests could do all those style checks and test for build-failures without taking
> any time of the maintainers and shorter feedback cycles for the contributors.
> My IT is rather hostile to anything email based.

Unfortunately, also with gitlab, the working mode decision remains a binary one: 
If we start allowing MRs and do review on that platform, we need to migrate 
everything over. There is no integration that allows to mirror one feed into the 
other to avoid community split.

I do quite a few gitlab-based reviews as well, for internal stuff. It's making 
some things easier and others more complicated for me. Tracking the history of 
patch series can be easier. However, reviewing larger series requires large 
amounts of mouse clicks, and you easily lose overview. At least, gitlab is not 
as broken as github (github still reorders patches according to dates - ouch). 
And even in times of CI, and eventually also continuous testing, review remains 
a manual (visual) task.

Jan

-- 
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux


^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2019-05-16  3:48 Mail Delivery Subsystem
  0 siblings, 0 replies; 2593+ messages in thread
From: Mail Delivery Subsystem @ 2019-05-16  3:48 UTC (permalink / raw)
  To: linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw

This Message was undeliverable due to the following reason:

Your message was not delivered because the destination computer was
not reachable within the allowed queue period. The amount of time
a message is queued before it is returned depends on local configura-
tion parameters.

Most likely there is a network problem that prevented delivery, but
it is also possible that the computer is turned off, or does not
have a mail system running right now.

Your message was not delivered within 2 days:
Host 81.249.114.149 is not responding.

The following recipients did not receive this message:
<linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org>

Please reply to postmaster-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org
if you feel this message to be in error.

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2019-09-12  8:09 Gene Chen
  0 siblings, 0 replies; 2593+ messages in thread
From: Gene Chen @ 2019-09-12  8:09 UTC (permalink / raw)
  To: matthias.bgg, gene_chen, Wilma.Wu
  Cc: linux-arm-kernel, linux-mediatek, linux-kernel

>From 66208ef7fcdb4176bf63cd130b3e3197086ac4b3 Mon Sep 17 00:00:00 2001
From: Gene Chen <gene_chen@mediatek.corp-partner.google.com>
Date: Thu, 22 Aug 2019 14:21:03 +0800
Subject: [PATCH] mfd: mt6360: add pmic mt6360 driver

---
 drivers/mfd/Kconfig       |  12 ++
 drivers/mfd/Makefile      |   1 +
 drivers/mfd/mt6360-core.c | 463 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 476 insertions(+)
 create mode 100644 drivers/mfd/mt6360-core.c

diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index f129f96..a422c76 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -862,6 +862,18 @@ config MFD_MAX8998
 	  additional drivers must be enabled in order to use the functionality
 	  of the device.
 
+config MFD_MT6360
+	tristate "Mediatek MT6360 SubPMIC"
+	select MFD_CORE
+	select REGMAP_I2C
+	select REGMAP_IRQ
+	depends on I2C
+	help
+	  Say Y here to enable MT6360 PMU/PMIC/LDO functional support.
+	  PMU part include charger, flashlight, rgb led
+	  PMIC part include 2-channel BUCKs and 2-channel LDOs
+	  LDO part include 4-channel LDOs
+
 config MFD_MT6397
 	tristate "MediaTek MT6397 PMIC Support"
 	select MFD_CORE
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index f026ada..77a8f0b 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -241,6 +241,7 @@ obj-$(CONFIG_INTEL_SOC_PMIC)	+= intel-soc-pmic.o
 obj-$(CONFIG_INTEL_SOC_PMIC_BXTWC)	+= intel_soc_pmic_bxtwc.o
 obj-$(CONFIG_INTEL_SOC_PMIC_CHTWC)	+= intel_soc_pmic_chtwc.o
 obj-$(CONFIG_INTEL_SOC_PMIC_CHTDC_TI)	+= intel_soc_pmic_chtdc_ti.o
+obj-$(CONFIG_MFD_MT6360)	+= mt6360-core.o
 obj-$(CONFIG_MFD_MT6397)	+= mt6397-core.o
 
 obj-$(CONFIG_MFD_ALTERA_A10SR)	+= altera-a10sr.o
diff --git a/drivers/mfd/mt6360-core.c b/drivers/mfd/mt6360-core.c
new file mode 100644
index 0000000..d3580618
--- /dev/null
+++ b/drivers/mfd/mt6360-core.c
@@ -0,0 +1,463 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2019 MediaTek Inc.
+ */
+
+#include <linux/i2c.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/mfd/core.h>
+#include <linux/module.h>
+#include <linux/of_irq.h>
+#include <linux/of_platform.h>
+#include <linux/version.h>
+
+#include <linux/mfd/mt6360.h>
+#include <linux/mfd/mt6360-private.h>
+
+/* reg 0 -> 0 ~ 7 */
+#define MT6360_CHG_TREG_EVT		(4)
+#define MT6360_CHG_AICR_EVT		(5)
+#define MT6360_CHG_MIVR_EVT		(6)
+#define MT6360_PWR_RDY_EVT		(7)
+/* REG 1 -> 8 ~ 15 */
+#define MT6360_CHG_BATSYSUV_EVT		(9)
+#define MT6360_FLED_CHG_VINOVP_EVT	(11)
+#define MT6360_CHG_VSYSUV_EVT		(12)
+#define MT6360_CHG_VSYSOV_EVT		(13)
+#define MT6360_CHG_VBATOV_EVT		(14)
+#define MT6360_CHG_VBUSOV_EVT		(15)
+/* REG 2 -> 16 ~ 23 */
+/* REG 3 -> 24 ~ 31 */
+#define MT6360_WD_PMU_DET		(25)
+#define MT6360_WD_PMU_DONE		(26)
+#define MT6360_CHG_TMRI			(27)
+#define MT6360_CHG_ADPBADI		(29)
+#define MT6360_CHG_RVPI			(30)
+#define MT6360_OTPI			(31)
+/* REG 4 -> 32 ~ 39 */
+#define MT6360_CHG_AICCMEASL		(32)
+#define MT6360_CHGDET_DONEI		(34)
+#define MT6360_WDTMRI			(35)
+#define MT6360_SSFINISHI		(36)
+#define MT6360_CHG_RECHGI		(37)
+#define MT6360_CHG_TERMI		(38)
+#define MT6360_CHG_IEOCI		(39)
+/* REG 5 -> 40 ~ 47 */
+#define MT6360_PUMPX_DONEI		(40)
+#define MT6360_BAT_OVP_ADC_EVT		(41)
+#define MT6360_TYPEC_OTP_EVT		(42)
+#define MT6360_ADC_WAKEUP_EVT		(43)
+#define MT6360_ADC_DONEI		(44)
+#define MT6360_BST_BATUVI		(45)
+#define MT6360_BST_VBUSOVI		(46)
+#define MT6360_BST_OLPI			(47)
+/* REG 6 -> 48 ~ 55 */
+#define MT6360_ATTACH_I			(48)
+#define MT6360_DETACH_I			(49)
+#define MT6360_QC30_STPDONE		(51)
+#define MT6360_QC_VBUSDET_DONE		(52)
+#define MT6360_HVDCP_DET		(53)
+#define MT6360_CHGDETI			(54)
+#define MT6360_DCDTI			(55)
+/* REG 7 -> 56 ~ 63 */
+#define MT6360_FOD_DONE_EVT		(56)
+#define MT6360_FOD_OV_EVT		(57)
+#define MT6360_CHRDET_UVP_EVT		(58)
+#define MT6360_CHRDET_OVP_EVT		(59)
+#define MT6360_CHRDET_EXT_EVT		(60)
+#define MT6360_FOD_LR_EVT		(61)
+#define MT6360_FOD_HR_EVT		(62)
+#define MT6360_FOD_DISCHG_FAIL_EVT	(63)
+/* REG 8 -> 64 ~ 71 */
+#define MT6360_USBID_EVT		(64)
+#define MT6360_APWDTRST_EVT		(65)
+#define MT6360_EN_EVT			(66)
+#define MT6360_QONB_RST_EVT		(67)
+#define MT6360_MRSTB_EVT		(68)
+#define MT6360_OTP_EVT			(69)
+#define MT6360_VDDAOV_EVT		(70)
+#define MT6360_SYSUV_EVT		(71)
+/* REG 9 -> 72 ~ 79 */
+#define MT6360_FLED_STRBPIN_EVT		(72)
+#define MT6360_FLED_TORPIN_EVT		(73)
+#define MT6360_FLED_TX_EVT		(74)
+#define MT6360_FLED_LVF_EVT		(75)
+#define MT6360_FLED2_SHORT_EVT		(78)
+#define MT6360_FLED1_SHORT_EVT		(79)
+/* REG 10 -> 80 ~ 87 */
+#define MT6360_FLED2_STRB_EVT		(80)
+#define MT6360_FLED1_STRB_EVT		(81)
+#define MT6360_FLED2_STRB_TO_EVT	(82)
+#define MT6360_FLED1_STRB_TO_EVT	(83)
+#define MT6360_FLED2_TOR_EVT		(84)
+#define MT6360_FLED1_TOR_EVT		(85)
+/* REG 11 -> 88 ~ 95 */
+/* REG 12 -> 96 ~ 103 */
+#define MT6360_BUCK1_PGB_EVT		(96)
+#define MT6360_BUCK1_OC_EVT		(100)
+#define MT6360_BUCK1_OV_EVT		(101)
+#define MT6360_BUCK1_UV_EVT		(102)
+/* REG 13 -> 104 ~ 111 */
+#define MT6360_BUCK2_PGB_EVT		(104)
+#define MT6360_BUCK2_OC_EVT		(108)
+#define MT6360_BUCK2_OV_EVT		(109)
+#define MT6360_BUCK2_UV_EVT		(110)
+/* REG 14 -> 112 ~ 119 */
+#define MT6360_LDO1_OC_EVT		(113)
+#define MT6360_LDO2_OC_EVT		(114)
+#define MT6360_LDO3_OC_EVT		(115)
+#define MT6360_LDO5_OC_EVT		(117)
+#define MT6360_LDO6_OC_EVT		(118)
+#define MT6360_LDO7_OC_EVT		(119)
+/* REG 15 -> 120 ~ 127 */
+#define MT6360_LDO1_PGB_EVT		(121)
+#define MT6360_LDO2_PGB_EVT		(122)
+#define MT6360_LDO3_PGB_EVT		(123)
+#define MT6360_LDO5_PGB_EVT		(125)
+#define MT6360_LDO6_PGB_EVT		(126)
+#define MT6360_LDO7_PGB_EVT		(127)
+
+#define MT6360_REGMAP_IRQ_REG(_irq_evt)		\
+	REGMAP_IRQ_REG(_irq_evt, (_irq_evt) / 8, BIT((_irq_evt) % 8))
+
+#define MT6360_MFD_CELL(_name)					\
+	{							\
+		.name = #_name,					\
+		.of_compatible = "mediatek," #_name,		\
+		.num_resources = ARRAY_SIZE(_name##_resources),	\
+		.resources = _name##_resources,			\
+	}
+
+static const struct regmap_irq mt6360_pmu_irqs[] =  {
+	MT6360_REGMAP_IRQ_REG(MT6360_CHG_TREG_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_CHG_AICR_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_CHG_MIVR_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_PWR_RDY_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_CHG_BATSYSUV_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_FLED_CHG_VINOVP_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_CHG_VSYSUV_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_CHG_VSYSOV_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_CHG_VBATOV_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_CHG_VBUSOV_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_WD_PMU_DET),
+	MT6360_REGMAP_IRQ_REG(MT6360_WD_PMU_DONE),
+	MT6360_REGMAP_IRQ_REG(MT6360_CHG_TMRI),
+	MT6360_REGMAP_IRQ_REG(MT6360_CHG_ADPBADI),
+	MT6360_REGMAP_IRQ_REG(MT6360_CHG_RVPI),
+	MT6360_REGMAP_IRQ_REG(MT6360_OTPI),
+	MT6360_REGMAP_IRQ_REG(MT6360_CHG_AICCMEASL),
+	MT6360_REGMAP_IRQ_REG(MT6360_CHGDET_DONEI),
+	MT6360_REGMAP_IRQ_REG(MT6360_WDTMRI),
+	MT6360_REGMAP_IRQ_REG(MT6360_SSFINISHI),
+	MT6360_REGMAP_IRQ_REG(MT6360_CHG_RECHGI),
+	MT6360_REGMAP_IRQ_REG(MT6360_CHG_TERMI),
+	MT6360_REGMAP_IRQ_REG(MT6360_CHG_IEOCI),
+	MT6360_REGMAP_IRQ_REG(MT6360_PUMPX_DONEI),
+	MT6360_REGMAP_IRQ_REG(MT6360_CHG_TREG_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_BAT_OVP_ADC_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_TYPEC_OTP_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_ADC_WAKEUP_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_ADC_DONEI),
+	MT6360_REGMAP_IRQ_REG(MT6360_BST_BATUVI),
+	MT6360_REGMAP_IRQ_REG(MT6360_BST_VBUSOVI),
+	MT6360_REGMAP_IRQ_REG(MT6360_BST_OLPI),
+	MT6360_REGMAP_IRQ_REG(MT6360_ATTACH_I),
+	MT6360_REGMAP_IRQ_REG(MT6360_DETACH_I),
+	MT6360_REGMAP_IRQ_REG(MT6360_QC30_STPDONE),
+	MT6360_REGMAP_IRQ_REG(MT6360_QC_VBUSDET_DONE),
+	MT6360_REGMAP_IRQ_REG(MT6360_HVDCP_DET),
+	MT6360_REGMAP_IRQ_REG(MT6360_CHGDETI),
+	MT6360_REGMAP_IRQ_REG(MT6360_DCDTI),
+	MT6360_REGMAP_IRQ_REG(MT6360_FOD_DONE_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_FOD_OV_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_CHRDET_UVP_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_CHRDET_OVP_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_CHRDET_EXT_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_FOD_LR_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_FOD_HR_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_FOD_DISCHG_FAIL_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_USBID_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_APWDTRST_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_EN_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_QONB_RST_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_MRSTB_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_OTP_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_VDDAOV_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_SYSUV_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_FLED_STRBPIN_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_FLED_TORPIN_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_FLED_TX_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_FLED_LVF_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_FLED2_SHORT_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_FLED1_SHORT_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_FLED2_STRB_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_FLED1_STRB_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_FLED2_STRB_TO_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_FLED1_STRB_TO_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_FLED2_TOR_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_FLED1_TOR_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_BUCK1_PGB_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_BUCK1_OC_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_BUCK1_OV_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_BUCK1_UV_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_BUCK2_PGB_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_BUCK2_OC_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_BUCK2_OV_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_BUCK2_UV_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_LDO1_OC_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_LDO2_OC_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_LDO3_OC_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_LDO5_OC_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_LDO6_OC_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_LDO7_OC_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_LDO1_PGB_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_LDO2_PGB_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_LDO3_PGB_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_LDO5_PGB_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_LDO6_PGB_EVT),
+	MT6360_REGMAP_IRQ_REG(MT6360_LDO7_PGB_EVT),
+};
+
+static int mt6360_pmu_handle_post_irq(void *irq_drv_data)
+{
+	struct mt6360_pmu_info *mpi = irq_drv_data;
+
+	return regmap_update_bits(mpi->regmap,
+		MT6360_PMU_IRQ_SET, MT6360_IRQ_RETRIG, MT6360_IRQ_RETRIG);
+}
+
+static const struct regmap_irq_chip mt6360_pmu_irq_chip = {
+	.irqs = mt6360_pmu_irqs,
+	.num_irqs = ARRAY_SIZE(mt6360_pmu_irqs),
+	.num_regs = MT6360_PMU_IRQ_REGNUM,
+	.mask_base = MT6360_PMU_CHG_MASK1,
+	.status_base = MT6360_PMU_CHG_IRQ1,
+	.ack_base = MT6360_PMU_CHG_IRQ1,
+	.init_ack_masked = true,
+	.use_ack = true,
+	.handle_post_irq = mt6360_pmu_handle_post_irq,
+};
+
+static const struct regmap_config mt6360_pmu_regmap_config = {
+	.reg_bits = 8,
+	.val_bits = 8,
+	.max_register = MT6360_PMU_MAXREG,
+};
+
+static const struct resource mt6360_adc_resources[] = {
+	DEFINE_RES_IRQ_NAMED(MT6360_ADC_DONEI, "adc_donei"),
+};
+
+static const struct resource mt6360_chg_resources[] = {
+	DEFINE_RES_IRQ_NAMED(MT6360_CHG_TREG_EVT, "chg_treg_evt"),
+	DEFINE_RES_IRQ_NAMED(MT6360_PWR_RDY_EVT, "pwr_rdy_evt"),
+	DEFINE_RES_IRQ_NAMED(MT6360_CHG_BATSYSUV_EVT, "chg_batsysuv_evt"),
+	DEFINE_RES_IRQ_NAMED(MT6360_CHG_VSYSUV_EVT, "chg_vsysuv_evt"),
+	DEFINE_RES_IRQ_NAMED(MT6360_CHG_VSYSOV_EVT, "chg_vsysov_evt"),
+	DEFINE_RES_IRQ_NAMED(MT6360_CHG_VBATOV_EVT, "chg_vbatov_evt"),
+	DEFINE_RES_IRQ_NAMED(MT6360_CHG_VBUSOV_EVT, "chg_vbusov_evt"),
+	DEFINE_RES_IRQ_NAMED(MT6360_CHG_AICCMEASL, "chg_aiccmeasl"),
+	DEFINE_RES_IRQ_NAMED(MT6360_WDTMRI, "wdtmri"),
+	DEFINE_RES_IRQ_NAMED(MT6360_CHG_RECHGI, "chg_rechgi"),
+	DEFINE_RES_IRQ_NAMED(MT6360_CHG_TERMI, "chg_termi"),
+	DEFINE_RES_IRQ_NAMED(MT6360_CHG_IEOCI, "chg_ieoci"),
+	DEFINE_RES_IRQ_NAMED(MT6360_PUMPX_DONEI, "pumpx_donei"),
+	DEFINE_RES_IRQ_NAMED(MT6360_ATTACH_I, "attach_i"),
+	DEFINE_RES_IRQ_NAMED(MT6360_CHRDET_EXT_EVT, "chrdet_ext_evt"),
+};
+
+static const struct resource mt6360_led_resources[] = {
+	DEFINE_RES_IRQ_NAMED(MT6360_FLED_CHG_VINOVP_EVT, "fled_chg_vinovp_evt"),
+	DEFINE_RES_IRQ_NAMED(MT6360_FLED_LVF_EVT, "fled_lvf_evt"),
+	DEFINE_RES_IRQ_NAMED(MT6360_FLED2_SHORT_EVT, "fled2_short_evt"),
+	DEFINE_RES_IRQ_NAMED(MT6360_FLED1_SHORT_EVT, "fled1_short_evt"),
+	DEFINE_RES_IRQ_NAMED(MT6360_FLED2_STRB_TO_EVT, "fled2_strb_to_evt"),
+	DEFINE_RES_IRQ_NAMED(MT6360_FLED1_STRB_TO_EVT, "fled1_strb_to_evt"),
+};
+
+static const struct resource mt6360_pmic_resources[] = {
+	DEFINE_RES_IRQ_NAMED(MT6360_BUCK1_PGB_EVT, "buck1_pgb_evt"),
+	DEFINE_RES_IRQ_NAMED(MT6360_BUCK1_OC_EVT, "buck1_oc_evt"),
+	DEFINE_RES_IRQ_NAMED(MT6360_BUCK1_OV_EVT, "buck1_ov_evt"),
+	DEFINE_RES_IRQ_NAMED(MT6360_BUCK1_UV_EVT, "buck1_uv_evt"),
+	DEFINE_RES_IRQ_NAMED(MT6360_BUCK2_PGB_EVT, "buck2_pgb_evt"),
+	DEFINE_RES_IRQ_NAMED(MT6360_BUCK2_OC_EVT, "buck2_oc_evt"),
+	DEFINE_RES_IRQ_NAMED(MT6360_BUCK2_OV_EVT, "buck2_ov_evt"),
+	DEFINE_RES_IRQ_NAMED(MT6360_BUCK2_UV_EVT, "buck2_uv_evt"),
+	DEFINE_RES_IRQ_NAMED(MT6360_LDO6_OC_EVT, "ldo6_oc_evt"),
+	DEFINE_RES_IRQ_NAMED(MT6360_LDO7_OC_EVT, "ldo7_oc_evt"),
+	DEFINE_RES_IRQ_NAMED(MT6360_LDO6_PGB_EVT, "ldo6_pgb_evt"),
+	DEFINE_RES_IRQ_NAMED(MT6360_LDO7_PGB_EVT, "ldo7_pgb_evt"),
+};
+
+static const struct resource mt6360_ldo_resources[] = {
+	DEFINE_RES_IRQ_NAMED(MT6360_LDO1_OC_EVT, "ldo1_oc_evt"),
+	DEFINE_RES_IRQ_NAMED(MT6360_LDO2_OC_EVT, "ldo2_oc_evt"),
+	DEFINE_RES_IRQ_NAMED(MT6360_LDO3_OC_EVT, "ldo3_oc_evt"),
+	DEFINE_RES_IRQ_NAMED(MT6360_LDO5_OC_EVT, "ldo5_oc_evt"),
+	DEFINE_RES_IRQ_NAMED(MT6360_LDO1_PGB_EVT, "ldo1_pgb_evt"),
+	DEFINE_RES_IRQ_NAMED(MT6360_LDO2_PGB_EVT, "ldo2_pgb_evt"),
+	DEFINE_RES_IRQ_NAMED(MT6360_LDO3_PGB_EVT, "ldo3_pgb_evt"),
+	DEFINE_RES_IRQ_NAMED(MT6360_LDO5_PGB_EVT, "ldo5_pgb_evt"),
+};
+
+static const struct mfd_cell mt6360_devs[] = {
+	MT6360_MFD_CELL(mt6360_adc),
+	MT6360_MFD_CELL(mt6360_chg),
+	MT6360_MFD_CELL(mt6360_led),
+	MT6360_MFD_CELL(mt6360_pmic),
+	MT6360_MFD_CELL(mt6360_ldo),
+	/* tcpc dev */
+	{
+		.name = "mt6360_tcpc",
+		.of_compatible = "mediatek,mt6360_tcpc",
+	},
+};
+
+static const unsigned short mt6360_slave_addr[MT6360_SLAVE_MAX] = {
+	MT6360_PMU_SLAVEID,
+	MT6360_PMIC_SLAVEID,
+	MT6360_LDO_SLAVEID,
+	MT6360_TCPC_SLAVEID,
+};
+
+static int mt6360_pmu_probe(struct i2c_client *client,
+			    const struct i2c_device_id *id)
+{
+	struct mt6360_pmu_info *mpi;
+	unsigned int reg_data = 0;
+	int i, ret;
+
+	mpi = devm_kzalloc(&client->dev, sizeof(*mpi), GFP_KERNEL);
+	if (!mpi)
+		return -ENOMEM;
+	mpi->dev = &client->dev;
+	i2c_set_clientdata(client, mpi);
+
+	/* regmap regiser */
+	mpi->regmap = devm_regmap_init_i2c(client, &mt6360_pmu_regmap_config);
+	if (IS_ERR(mpi->regmap)) {
+		dev_err(&client->dev, "regmap register fail\n");
+		return PTR_ERR(mpi->regmap);
+	}
+	/* chip id check */
+	ret = regmap_read(mpi->regmap, MT6360_PMU_DEV_INFO, &reg_data);
+	if (ret < 0) {
+		dev_err(&client->dev, "device not found\n");
+		return ret;
+	}
+	if ((reg_data & CHIP_VEN_MASK) != CHIP_VEN_MT6360) {
+		dev_err(&client->dev, "not mt6360 chip\n");
+		return -ENODEV;
+	}
+	mpi->chip_rev = reg_data & CHIP_REV_MASK;
+	/* irq register */
+	memcpy(&mpi->irq_chip, &mt6360_pmu_irq_chip, sizeof(mpi->irq_chip));
+	mpi->irq_chip.name = dev_name(&client->dev);
+	mpi->irq_chip.irq_drv_data = mpi;
+	ret = devm_regmap_add_irq_chip(&client->dev, mpi->regmap, client->irq,
+				       IRQF_TRIGGER_FALLING, 0, &mpi->irq_chip,
+				       &mpi->irq_data);
+	if (ret < 0) {
+		dev_err(&client->dev, "regmap irq chip add fail\n");
+		return ret;
+	}
+	/* new i2c slave device */
+	for (i = 0; i < MT6360_SLAVE_MAX; i++) {
+		if (mt6360_slave_addr[i] == client->addr) {
+			mpi->i2c[i] = client;
+			continue;
+		}
+		mpi->i2c[i] = i2c_new_dummy(client->adapter,
+					    mt6360_slave_addr[i]);
+		if (!mpi->i2c[i]) {
+			dev_err(&client->dev, "new i2c dev [%d] fail\n", i);
+			ret = -ENODEV;
+			goto out;
+		}
+		i2c_set_clientdata(mpi->i2c[i], mpi);
+	}
+	/* mfd cell register */
+	ret = devm_mfd_add_devices(&client->dev, PLATFORM_DEVID_AUTO,
+				   mt6360_devs, ARRAY_SIZE(mt6360_devs), NULL,
+				   0, regmap_irq_get_domain(mpi->irq_data));
+	if (ret < 0) {
+		dev_err(&client->dev, "mfd add cells fail\n");
+		goto out;
+	}
+	dev_info(&client->dev, "Successfully probed\n");
+	return 0;
+out:
+	while (--i >= 0) {
+		if (mpi->i2c[i]->addr == client->addr)
+			continue;
+		i2c_unregister_device(mpi->i2c[i]);
+	}
+	return ret;
+}
+
+static int mt6360_pmu_remove(struct i2c_client *client)
+{
+	struct mt6360_pmu_info *mpi = i2c_get_clientdata(client);
+	int i;
+
+	for (i = 0; i < MT6360_SLAVE_MAX; i++) {
+		if (mpi->i2c[i]->addr == client->addr)
+			continue;
+		i2c_unregister_device(mpi->i2c[i]);
+	}
+	return 0;
+}
+
+static int __maybe_unused mt6360_pmu_suspend(struct device *dev)
+{
+	struct i2c_client *i2c = to_i2c_client(dev);
+
+	if (device_may_wakeup(dev))
+		enable_irq_wake(i2c->irq);
+	return 0;
+}
+
+static int __maybe_unused mt6360_pmu_resume(struct device *dev)
+{
+
+	struct i2c_client *i2c = to_i2c_client(dev);
+
+	if (device_may_wakeup(dev))
+		disable_irq_wake(i2c->irq);
+	return 0;
+}
+
+static SIMPLE_DEV_PM_OPS(mt6360_pmu_pm_ops,
+			 mt6360_pmu_suspend, mt6360_pmu_resume);
+
+static const struct of_device_id __maybe_unused mt6360_pmu_of_id[] = {
+	{ .compatible = "mediatek,mt6360_pmu", },
+	{},
+};
+MODULE_DEVICE_TABLE(of, mt6360_pmu_of_id);
+
+static const struct i2c_device_id mt6360_pmu_id[] = {
+	{ "mt6360_pmu", 0 },
+	{},
+};
+MODULE_DEVICE_TABLE(i2c, mt6360_pmu_id);
+
+static struct i2c_driver mt6360_pmu_driver = {
+	.driver = {
+		.name = "mt6360_pmu",
+		.owner = THIS_MODULE,
+		.pm = &mt6360_pmu_pm_ops,
+		.of_match_table = of_match_ptr(mt6360_pmu_of_id),
+	},
+	.probe = mt6360_pmu_probe,
+	.remove = mt6360_pmu_remove,
+	.id_table = mt6360_pmu_id,
+};
+module_i2c_driver(mt6360_pmu_driver);
+
+MODULE_AUTHOR("CY_Huang <cy_huang@richtek.com>");
+MODULE_DESCRIPTION("MT6360 PMU I2C Driver");
+MODULE_LICENSE("GPL");
+MODULE_VERSION("1.0.0");
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2019-12-12 15:50 周琰杰 (Zhou Yanjie)
  0 siblings, 0 replies; 2593+ messages in thread
From: 周琰杰 (Zhou Yanjie) @ 2019-12-12 15:50 UTC (permalink / raw)
  To: linux-mips
  Cc: linux-kernel, linux-i2c, devicetree, robh+dt, mark.rutland, paul,
	paul.burton, paulburton, sernia.zhou, zhenwenjin

Add support for probing i2c driver on the X1000 Soc from Ingenic.
call the corresponding fifo parameter according to the device
model obtained from the devicetree.

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
       [not found] <1187667350.235001.1580574902701.ref@mail.yahoo.com>
@ 2020-02-01 16:35 ` Mrs. Maureen Hinckley
  0 siblings, 0 replies; 2593+ messages in thread
From: Mrs. Maureen Hinckley @ 2020-02-01 16:35 UTC (permalink / raw)




I am Maureen Hinckley and my foundation is donating (Five hundred and fifty thousand USD) to you. Contact us via my email at (maurhinck6@gmail.com) for further details.

Best Regards,
Mrs. Maureen Hinckley,
Copyright ©2020 The Maureen Hinckley Foundation All Rights Reserved.

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2020-02-05  8:23 Frau Huan Jlaying
  0 siblings, 0 replies; 2593+ messages in thread
From: Frau Huan Jlaying @ 2020-02-05  8:23 UTC (permalink / raw)


-- 
Schönen Tag,

     Ich bin Frau Huan Jlaying, eine Mitarbeiterin der Wing Hang Bank
hier in Hongkong. Kann ich einer Überweisung von 13.991.674 USD
vertrauen? Kontaktieren Sie mich per E-Mail: huanjlaying08@hotmail.com


Grüße

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2020-02-11 22:34 Rajat Jain
  0 siblings, 0 replies; 2593+ messages in thread
From: Rajat Jain @ 2020-02-11 22:34 UTC (permalink / raw)
  To: Daniel Mack, Haojian Zhuang, Robert Jarzmik, Mark Brown,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-spi-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA
  Cc: Evan Green, rajatja-hpIqsD4AKlfQT0dZR+AlfA,
	rajatxjain-Re5JQEeQqe8AvxtiuMwx3w, evgreen-hpIqsD4AKlfQT0dZR+AlfA,
	shobhit.srivastava-ral2JQCrhuEAvxtiuMwx3w,
	porselvan.muthukrishnan-ral2JQCrhuEAvxtiuMwx3w

From: Evan Green <evgreen-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>

Date: Wed, 29 Jan 2020 13:54:16 -0800
Subject: [PATCH] spi: pxa2xx: Add CS control clock quirk

In some circumstances on Intel LPSS controllers, toggling the LPSS
CS control register doesn't actually cause the CS line to toggle.
This seems to be failure of dynamic clock gating that occurs after
going through a suspend/resume transition, where the controller
is sent through a reset transition. This ruins SPI transactions
that either rely on delay_usecs, or toggle the CS line without
sending data.

Whenever CS is toggled, momentarily set the clock gating register
to "Force On" to poke the controller into acting on CS.

Signed-off-by: Evan Green <evgreen-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
Signed-off-by: Rajat Jain <rajatja-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
---
 drivers/spi/spi-pxa2xx.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/drivers/spi/spi-pxa2xx.c b/drivers/spi/spi-pxa2xx.c
index 4c7a71f0fb3e..2e318158fca9 100644
--- a/drivers/spi/spi-pxa2xx.c
+++ b/drivers/spi/spi-pxa2xx.c
@@ -70,6 +70,10 @@ MODULE_ALIAS("platform:pxa2xx-spi");
 #define LPSS_CAPS_CS_EN_SHIFT			9
 #define LPSS_CAPS_CS_EN_MASK			(0xf << LPSS_CAPS_CS_EN_SHIFT)
 
+#define LPSS_PRIV_CLOCK_GATE 0x38
+#define LPSS_PRIV_CLOCK_GATE_CLK_CTL_MASK 0x3
+#define LPSS_PRIV_CLOCK_GATE_CLK_CTL_FORCE_ON 0x3
+
 struct lpss_config {
 	/* LPSS offset from drv_data->ioaddr */
 	unsigned offset;
@@ -86,6 +90,8 @@ struct lpss_config {
 	unsigned cs_sel_shift;
 	unsigned cs_sel_mask;
 	unsigned cs_num;
+	/* Quirks */
+	unsigned cs_clk_stays_gated : 1;
 };
 
 /* Keep these sorted with enum pxa_ssp_type */
@@ -156,6 +162,7 @@ static const struct lpss_config lpss_platforms[] = {
 		.tx_threshold_hi = 56,
 		.cs_sel_shift = 8,
 		.cs_sel_mask = 3 << 8,
+		.cs_clk_stays_gated = true,
 	},
 };
 
@@ -383,6 +390,22 @@ static void lpss_ssp_cs_control(struct spi_device *spi, bool enable)
 	else
 		value |= LPSS_CS_CONTROL_CS_HIGH;
 	__lpss_ssp_write_priv(drv_data, config->reg_cs_ctrl, value);
+	if (config->cs_clk_stays_gated) {
+		u32 clkgate;
+
+		/*
+		 * Changing CS alone when dynamic clock gating is on won't
+		 * actually flip CS at that time. This ruins SPI transfers
+		 * that specify delays, or have no data. Toggle the clock mode
+		 * to force on briefly to poke the CS pin to move.
+		 */
+		clkgate = __lpss_ssp_read_priv(drv_data, LPSS_PRIV_CLOCK_GATE);
+		value = (clkgate & ~LPSS_PRIV_CLOCK_GATE_CLK_CTL_MASK) |
+			LPSS_PRIV_CLOCK_GATE_CLK_CTL_FORCE_ON;
+
+		__lpss_ssp_write_priv(drv_data, LPSS_PRIV_CLOCK_GATE, value);
+		__lpss_ssp_write_priv(drv_data, LPSS_PRIV_CLOCK_GATE, clkgate);
+	}
 }
 
 static void cs_assert(struct spi_device *spi)
-- 
2.25.0.225.g125e21ebc7-goog

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2020-02-15  3:25 mprim37 alcorta
  0 siblings, 0 replies; 2593+ messages in thread
From: mprim37 alcorta @ 2020-02-15  3:25 UTC (permalink / raw)




-- 
Hello, my name is Julie Leach, winner of the  Power Ball Jackpot in 
October 2015.I want to donate $3,000,000 for charity to help you and the 
poor children in your community. Send me an email to: 
julieleeach@yahoo.com for more information on how to receive my donation

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
       [not found]       ` <CAHC9VhQnbdJprbdTa_XcgUJaiwhzbnGMWJqHczU54UMk0AFCtw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2020-02-27 15:39         ` Dmitry Vyukov via B.A.T.M.A.N
  0 siblings, 0 replies; 2593+ messages in thread
From: Dmitry Vyukov via B.A.T.M.A.N @ 2020-02-27 15:39 UTC (permalink / raw)
  To: Paul Moore, Tetsuo Handa
  Cc: Dmitry Vyukov, mareklindner-rVWd3aGhH2z5bpWLKbzFeg,
	Greg Kroah-Hartman, b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r,
	a, LKML, Eric Paris, David Miller, syzkaller-bugs,
	linux-audit-H+wXaHxf7aLQT0dZR+AlfA, syzkaller, netdev,
	john.hammond-ral2JQCrhuEAvxtiuMwx3w, fzago-WVYJKLFxKCc, syzbot,
	Dan Carpenter

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

The sender domain has a DMARC Reject/Quarantine policy which disallows
sending mailing list messages using the original "From" header.

To mitigate this problem, the original message has been wrapped
automatically by the mailing list software.

[-- Attachment #2: Type: message/rfc822, Size: 11958 bytes --]

From: Dmitry Vyukov <dvyukov-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
To: Paul Moore <paul-r2n+y4ga6xFZroRs9YW3xA@public.gmane.org>, Tetsuo Handa <penguin-kernel-1yMVhJb1mP/7nzcFbJAaVXf5DAMn2ifp@public.gmane.org>
Cc: Eric Paris <eparis-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>, syzbot <syzbot+9a5e789e4725b9ef1316-Pl5Pbv+GP7P466ipTTIvnc23WoclnBCfAL8bYrjMMd8@public.gmane.org>, a@unstable.cc, b.a.t.m.a.n-ZwoEplunGu2X36UT3dwllkB+6BGkLq7r@public.gmane.org, Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>, David Miller <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>, fzago-WVYJKLFxKCc@public.gmane.org, Greg Kroah-Hartman <gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org>, john.hammond-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org, linux-audit-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org, LKML <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>, mareklindner-rVWd3aGhH2z5bpWLKbzFeg@public.gmane.org, netdev <netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>, sw-2YrNx6rUIHYiY0qSoAWiAoQuADTiUCJX@public.gmane.org, syzkaller-bugs <syzkaller-bugs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>, syzkaller <syzkaller-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Subject: Re: kernel panic: audit: backlog limit exceeded
Date: Thu, 27 Feb 2020 16:39:59 +0100
Message-ID: <CACT4Y+azQXLcPqtJG9zbj8hxqw4jE3dcwUj5T06bdL3uMaZk+Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On Mon, Feb 24, 2020 at 11:47 PM Paul Moore <paul-r2n+y4ga6xFZroRs9YW3xA@public.gmane.org> wrote:
>
> On Mon, Feb 24, 2020 at 5:43 PM Eric Paris <eparis-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:
> > https://syzkaller.appspot.com/x/repro.syz?x=151b1109e00000 (the
> > reproducer listed) looks like it is literally fuzzing the AUDIT_SET.
> > Which seems like this is working as designed if it is setting the
> > failure mode to 2.
>
> So it is, good catch :)  I saw the panic and instinctively chalked
> that up to a mistaken config, not expecting that it was what was being
> tested.

Yes, this audit failure mode is quite unpleasant for fuzzing. And
since this is not a top-level syscall argument value, it's effectively
impossible to filter out in the fuzzer. Maybe another use case for the
"fuzer lockdown" feature +Tetsuo proposed.
With the current state of the things, I think we only have an option
to disable fuzzing of audit. Which is pity because it has found 5 or
so real bugs in audit too.
But this happened anyway because audit is only reachable from init pid
namespace and syzkaller always unshares pid namespace for sandboxing
reasons, that was removed accidentally and that's how it managed to
find the bugs. But the unshare is restored now:
https://github.com/google/syzkaller/commit/5e0e1d1450d7c3497338082fc28912fdd7f93a3c

As a side effect all other real bugs in audit will be auto-obsoleted
in future if not fixed because they will stop happening.

#syz invalid


> > On Mon, 2020-02-24 at 17:38 -0500, Paul Moore wrote:
> > > On Mon, Feb 24, 2020 at 3:18 AM syzbot
> > > <syzbot+9a5e789e4725b9ef1316-Pl5Pbv+GP7P466ipTTIvnc23WoclnBCfAL8bYrjMMd8@public.gmane.org> wrote:
> > > > Hello,
> > > >
> > > > syzbot found the following crash on:
> > > >
> > > > HEAD commit:    36a44bcd Merge branch 'bnxt_en-shutdown-and-kexec-
> > > > kdump-re..
> > > > git tree:       net
> > > > console output:
> > > > https://syzkaller.appspot.com/x/log.txt?x=148bfdd9e00000
> > > > kernel config:
> > > > https://syzkaller.appspot.com/x/.config?x=768cc3d3e277cc16
> > > > dashboard link:
> > > > https://syzkaller.appspot.com/bug?extid=9a5e789e4725b9ef1316
> > > > compiler:       gcc (GCC) 9.0.0 20181231 (experimental)
> > > > syz repro:
> > > > https://syzkaller.appspot.com/x/repro.syz?x=151b1109e00000
> > > > C reproducer:
> > > > https://syzkaller.appspot.com/x/repro.c?x=128bfdd9e00000
> > > >
> > > > The bug was bisected to:
> > > >
> > > > commit 0c1b9970ddd4cc41002321c3877e7f91aacb896d
> > > > Author: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
> > > > Date:   Fri Jul 28 14:42:27 2017 +0000
> > > >
> > > >     staging: lustre: lustre: Off by two in lmv_fid2path()
> > > >
> > > > bisection log:
> > > > https://syzkaller.appspot.com/x/bisect.txt?x=17e6c3e9e00000
> > > > final crash:
> > > > https://syzkaller.appspot.com/x/report.txt?x=1416c3e9e00000
> > > > console output:
> > > > https://syzkaller.appspot.com/x/log.txt?x=1016c3e9e00000
> > > >
> > > > IMPORTANT: if you fix the bug, please add the following tag to the
> > > > commit:
> > > > Reported-by: syzbot+9a5e789e4725b9ef1316-Pl5Pbv+GP7P466ipTTIvnc23WoclnBCfAL8bYrjMMd8@public.gmane.org
> > > > Fixes: 0c1b9970ddd4 ("staging: lustre: lustre: Off by two in
> > > > lmv_fid2path()")
> > > >
> > > > audit: audit_backlog=13 > audit_backlog_limit=7
> > > > audit: audit_lost=1 audit_rate_limit=0 audit_backlog_limit=7
> > > > Kernel panic - not syncing: audit: backlog limit exceeded
> > > > CPU: 1 PID: 9913 Comm: syz-executor024 Not tainted 5.6.0-rc1-
> > > > syzkaller #0
> > > > Hardware name: Google Google Compute Engine/Google Compute Engine,
> > > > BIOS Google 01/01/2011
> > > > Call Trace:
> > > >  __dump_stack lib/dump_stack.c:77 [inline]
> > > >  dump_stack+0x197/0x210 lib/dump_stack.c:118
> > > >  panic+0x2e3/0x75c kernel/panic.c:221
> > > >  audit_panic.cold+0x32/0x32 kernel/audit.c:307
> > > >  audit_log_lost kernel/audit.c:377 [inline]
> > > >  audit_log_lost+0x8b/0x180 kernel/audit.c:349
> > > >  audit_log_start kernel/audit.c:1788 [inline]
> > > >  audit_log_start+0x70e/0x7c0 kernel/audit.c:1745
> > > >  audit_log+0x95/0x120 kernel/audit.c:2345
> > > >  xt_replace_table+0x61d/0x830 net/netfilter/x_tables.c:1413
> > > >  __do_replace+0x1da/0x950 net/ipv6/netfilter/ip6_tables.c:1084
> > > >  do_replace net/ipv6/netfilter/ip6_tables.c:1157 [inline]
> > > >  do_ip6t_set_ctl+0x33a/0x4c8 net/ipv6/netfilter/ip6_tables.c:1681
> > > >  nf_sockopt net/netfilter/nf_sockopt.c:106 [inline]
> > > >  nf_setsockopt+0x77/0xd0 net/netfilter/nf_sockopt.c:115
> > > >  ipv6_setsockopt net/ipv6/ipv6_sockglue.c:949 [inline]
> > > >  ipv6_setsockopt+0x147/0x180 net/ipv6/ipv6_sockglue.c:933
> > > >  tcp_setsockopt net/ipv4/tcp.c:3165 [inline]
> > > >  tcp_setsockopt+0x8f/0xe0 net/ipv4/tcp.c:3159
> > > >  sock_common_setsockopt+0x94/0xd0 net/core/sock.c:3149
> > > >  __sys_setsockopt+0x261/0x4c0 net/socket.c:2130
> > > >  __do_sys_setsockopt net/socket.c:2146 [inline]
> > > >  __se_sys_setsockopt net/socket.c:2143 [inline]
> > > >  __x64_sys_setsockopt+0xbe/0x150 net/socket.c:2143
> > > >  do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294
> > > >  entry_SYSCALL_64_after_hwframe+0x49/0xbe
> > > > RIP: 0033:0x44720a
> > > > Code: 49 89 ca b8 37 00 00 00 0f 05 48 3d 01 f0 ff ff 0f 83 1a e0
> > > > fb ff c3 66 0f 1f 84 00 00 00 00 00 49 89 ca b8 36 00 00 00 0f 05
> > > > <48> 3d 01 f0 ff ff 0f 83 fa df fb ff c3 66 0f 1f 84 00 00 00 00 00
> > > > RSP: 002b:00007ffd032dec78 EFLAGS: 00000286 ORIG_RAX:
> > > > 0000000000000036
> > > > RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 000000000044720a
> > > > RDX: 0000000000000040 RSI: 0000000000000029 RDI: 0000000000000003
> > > > RBP: 00007ffd032deda0 R08: 00000000000003b8 R09: 0000000000004000
> > > > R10: 00000000006d7b40 R11: 0000000000000286 R12: 00007ffd032deca0
> > > > R13: 00000000006d9d60 R14: 0000000000000029 R15: 00000000006d7ba0
> > > > Kernel Offset: disabled
> > > > Rebooting in 86400 seconds..
> > > >
> > > >
> > > > ---
> > > > This bug is generated by a bot. It may contain errors.
> > > > See https://goo.gl/tpsmEJ for more information about syzbot.
> > > > syzbot engineers can be reached at syzkaller-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
> > > >
> > > > syzbot will keep track of this bug report. See:
> > > > https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
> > > > For information about bisection process see:
> > > > https://goo.gl/tpsmEJ#bisection
> > > > syzbot can test patches for this bug, for details see:
> > > > https://goo.gl/tpsmEJ#testing-patches
> > >
> > > Similar to syzbot report 72461ac44b36c98f58e5, see my comments there.

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2020-03-04  9:42 Julie Leach
  0 siblings, 0 replies; 2593+ messages in thread
From: Julie Leach @ 2020-03-04  9:42 UTC (permalink / raw)




-- 
Hallo Liebes, ich habe eine Spende von 3,000,000.00 Euro, die ich Ihnen 
als Wohltätigkeitsorganisation zur Verfügung gestellt habe, um den 
weniger Privilegierten und Waisen in Ihrer Gemeinde zu helfen. Bitte 
antworten Sie über: julieleeach@gmail.com

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2020-03-04 23:30 Maria Alessandra Filippi
  0 siblings, 0 replies; 2593+ messages in thread
From: Maria Alessandra Filippi @ 2020-03-04 23:30 UTC (permalink / raw)




Hallo,

Ich bin Frau Maria Elisabeth Schaeffler, eine deutsche Wirtschaftsmagnatin, Investorin und Philanthropin. Ich bin der Vorsitzende von Wipro Limited. Ich habe 25 Prozent meines pers&ouml;nlichen Verm&ouml;gens f&uuml;r wohlt&auml;tige Zwecke ausgegeben. Und ich habe auch versprochen, den Rest von 25% in diesem Jahr 2020 an Einzelpersonen zu verschenken. Ich habe beschlossen, 1.000.000,00 Euro an Sie zu spenden. Wenn Sie an meiner Spende interessiert sind, kontaktieren Sie mich f&uuml;r weitere Informationen.

Sie k&ouml;nnen auch mehr &uuml;ber mich &uuml;ber den Link unten lesen

https://en.wikipedia.org/wiki/Maria-Elisabeth_Schaeffler
Herzlicher Gruss
Gesch&auml;ftsf&uuml;hrer Wipro Limited
Maria-Elisabeth_Schaeffler
E-Mail: mrsmariaelisabethschaeffler11@gmail.com

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2020-03-05  0:26 Maria Alessandra Filippi
  0 siblings, 0 replies; 2593+ messages in thread
From: Maria Alessandra Filippi @ 2020-03-05  0:26 UTC (permalink / raw)




Hallo,

Ich bin Frau Maria Elisabeth Schaeffler, eine deutsche Wirtschaftsmagnatin, Investorin und Philanthropin. Ich bin der Vorsitzende von Wipro Limited. Ich habe 25 Prozent meines pers&ouml;nlichen Verm&ouml;gens f&uuml;r wohlt&auml;tige Zwecke ausgegeben. Und ich habe auch versprochen, den Rest von 25% in diesem Jahr 2020 an Einzelpersonen zu verschenken. Ich habe beschlossen, 1.000.000,00 Euro an Sie zu spenden. Wenn Sie an meiner Spende interessiert sind, kontaktieren Sie mich f&uuml;r weitere Informationen.

Sie k&ouml;nnen auch mehr &uuml;ber mich &uuml;ber den Link unten lesen

https://en.wikipedia.org/wiki/Maria-Elisabeth_Schaeffler
Herzlicher Gruss
Gesch&auml;ftsf&uuml;hrer Wipro Limited
Maria-Elisabeth_Schaeffler
E-Mail: mrsmariaelisabethschaeffler11@gmail.com

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2020-03-05  2:33 Maria Alessandra Filippi
  0 siblings, 0 replies; 2593+ messages in thread
From: Maria Alessandra Filippi @ 2020-03-05  2:33 UTC (permalink / raw)




Hallo,

Ich bin Frau Maria Elisabeth Schaeffler, eine deutsche Wirtschaftsmagnatin, Investorin und Philanthropin. Ich bin der Vorsitzende von Wipro Limited. Ich habe 25 Prozent meines pers&ouml;nlichen Verm&ouml;gens f&uuml;r wohlt&auml;tige Zwecke ausgegeben. Und ich habe auch versprochen, den Rest von 25% in diesem Jahr 2020 an Einzelpersonen zu verschenken. Ich habe beschlossen, 1.000.000,00 Euro an Sie zu spenden. Wenn Sie an meiner Spende interessiert sind, kontaktieren Sie mich f&uuml;r weitere Informationen.

Sie k&ouml;nnen auch mehr &uuml;ber mich &uuml;ber den Link unten lesen

https://en.wikipedia.org/wiki/Maria-Elisabeth_Schaeffler
Herzlicher Gruss
Gesch&auml;ftsf&uuml;hrer Wipro Limited
Maria-Elisabeth_Schaeffler
E-Mail: mrsmariaelisabethschaeffler11@gmail.com

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2020-03-05 10:46 Juanito S. Galang
  0 siblings, 0 replies; 2593+ messages in thread
From: Juanito S. Galang @ 2020-03-05 10:46 UTC (permalink / raw)




Herzlichen Glückwunsch Lieber Begünstigter,Sie erhalten diese E-Mail von der Robert Bailey Foundation. Ich bin ein pensionierter Regierungsangestellter aus Harlem und ein Gewinner des Powerball Lottery Jackpot im Wert von 343,8 Millionen US-Dollar. Ich bin der größte Jackpot-Gewinner in der Geschichte der New Yorker Lotterie im US-Bundesstaat Amerika. Ich habe diese Lotterie am 27. Oktober 2018 gewonnen und möchte Sie darüber informieren, dass Google in Zusammenarbeit mit Microsoft Ihre "E-Mail-Adresse" auf meine Bitte, einen Spendenbetrag von 3.000.000,00 Millionen Euro zu erhalten, übermittelt hat. Ich spende diese 3 Millionen Euro an Sie, um den Wohltätigkeitsheimen und armen Menschen in Ihrer Gemeinde zu helfen, damit wir die Welt für alle verbessern können.Weitere Informationen finden Sie auf der folgenden Website, damit Sie nicht skeptisch sind
Diese Spende von 3 Mio. EUR.https://nypost.com/2018/11/14/meet-the-winner-of-the-biggest-lottery-jackpot-in-new-york-history/Sie können auch mein YouTube für mehr Bestätigung aufpassen:
https://www.youtube.com/watch?v=H5vT18Ysavc
Bitte beachten Sie, dass alle Antworten an (robertdonation7@gmail.com  ) gesendet werden, damit wir das können
Fahren Sie fort, um das gespendete Geld an Sie zu überweisen.E-Mail: robertdonation7@gmail.comFreundliche Grüße,
Robert Bailey
* * * * * * * * * * * * * * * *
Powerball Jackpot Gewinner

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2020-03-05 10:46 Juanito S. Galang
  0 siblings, 0 replies; 2593+ messages in thread
From: Juanito S. Galang @ 2020-03-05 10:46 UTC (permalink / raw)




Herzlichen Glückwunsch Lieber Begünstigter,Sie erhalten diese E-Mail von der Robert Bailey Foundation. Ich bin ein pensionierter Regierungsangestellter aus Harlem und ein Gewinner des Powerball Lottery Jackpot im Wert von 343,8 Millionen US-Dollar. Ich bin der größte Jackpot-Gewinner in der Geschichte der New Yorker Lotterie im US-Bundesstaat Amerika. Ich habe diese Lotterie am 27. Oktober 2018 gewonnen und möchte Sie darüber informieren, dass Google in Zusammenarbeit mit Microsoft Ihre "E-Mail-Adresse" auf meine Bitte, einen Spendenbetrag von 3.000.000,00 Millionen Euro zu erhalten, übermittelt hat. Ich spende diese 3 Millionen Euro an Sie, um den Wohltätigkeitsheimen und armen Menschen in Ihrer Gemeinde zu helfen, damit wir die Welt für alle verbessern können.Weitere Informationen finden Sie auf der folgenden Website, damit Sie nicht skeptisch sind
Diese Spende von 3 Mio. EUR.https://nypost.com/2018/11/14/meet-the-winner-of-the-biggest-lottery-jackpot-in-new-york-history/Sie können auch mein YouTube für mehr Bestätigung aufpassen:
https://www.youtube.com/watch?v=H5vT18Ysavc
Bitte beachten Sie, dass alle Antworten an (robertdonation7@gmail.com  ) gesendet werden, damit wir das können
Fahren Sie fort, um das gespendete Geld an Sie zu überweisen.E-Mail: robertdonation7@gmail.comFreundliche Grüße,
Robert Bailey
* * * * * * * * * * * * * * * *
Powerball Jackpot Gewinner

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2020-03-05 10:46 Juanito S. Galang
  0 siblings, 0 replies; 2593+ messages in thread
From: Juanito S. Galang @ 2020-03-05 10:46 UTC (permalink / raw)




Herzlichen Glückwunsch Lieber Begünstigter,Sie erhalten diese E-Mail von der Robert Bailey Foundation. Ich bin ein pensionierter Regierungsangestellter aus Harlem und ein Gewinner des Powerball Lottery Jackpot im Wert von 343,8 Millionen US-Dollar. Ich bin der größte Jackpot-Gewinner in der Geschichte der New Yorker Lotterie im US-Bundesstaat Amerika. Ich habe diese Lotterie am 27. Oktober 2018 gewonnen und möchte Sie darüber informieren, dass Google in Zusammenarbeit mit Microsoft Ihre "E-Mail-Adresse" auf meine Bitte, einen Spendenbetrag von 3.000.000,00 Millionen Euro zu erhalten, übermittelt hat. Ich spende diese 3 Millionen Euro an Sie, um den Wohltätigkeitsheimen und armen Menschen in Ihrer Gemeinde zu helfen, damit wir die Welt für alle verbessern können.Weitere Informationen finden Sie auf der folgenden Website, damit Sie nicht skeptisch sind
Diese Spende von 3 Mio. EUR.https://nypost.com/2018/11/14/meet-the-winner-of-the-biggest-lottery-jackpot-in-new-york-history/Sie können auch mein YouTube für mehr Bestätigung aufpassen:
https://www.youtube.com/watch?v=H5vT18Ysavc
Bitte beachten Sie, dass alle Antworten an (robertdonation7@gmail.com  ) gesendet werden, damit wir das können
Fahren Sie fort, um das gespendete Geld an Sie zu überweisen.E-Mail: robertdonation7@gmail.comFreundliche Grüße,
Robert Bailey
* * * * * * * * * * * * * * * *
Powerball Jackpot Gewinner

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2020-03-05 10:46 Juanito S. Galang
  0 siblings, 0 replies; 2593+ messages in thread
From: Juanito S. Galang @ 2020-03-05 10:46 UTC (permalink / raw)




Herzlichen Glückwunsch Lieber Begünstigter,Sie erhalten diese E-Mail von der Robert Bailey Foundation. Ich bin ein pensionierter Regierungsangestellter aus Harlem und ein Gewinner des Powerball Lottery Jackpot im Wert von 343,8 Millionen US-Dollar. Ich bin der größte Jackpot-Gewinner in der Geschichte der New Yorker Lotterie im US-Bundesstaat Amerika. Ich habe diese Lotterie am 27. Oktober 2018 gewonnen und möchte Sie darüber informieren, dass Google in Zusammenarbeit mit Microsoft Ihre "E-Mail-Adresse" auf meine Bitte, einen Spendenbetrag von 3.000.000,00 Millionen Euro zu erhalten, übermittelt hat. Ich spende diese 3 Millionen Euro an Sie, um den Wohltätigkeitsheimen und armen Menschen in Ihrer Gemeinde zu helfen, damit wir die Welt für alle verbessern können.Weitere Informationen finden Sie auf der folgenden Website, damit Sie nicht skeptisch sind
Diese Spende von 3 Mio. EUR.https://nypost.com/2018/11/14/meet-the-winner-of-the-biggest-lottery-jackpot-in-new-york-history/Sie können auch mein YouTube für mehr Bestätigung aufpassen:
https://www.youtube.com/watch?v=H5vT18Ysavc
Bitte beachten Sie, dass alle Antworten an (robertdonation7@gmail.com  ) gesendet werden, damit wir das können
Fahren Sie fort, um das gespendete Geld an Sie zu überweisen.E-Mail: robertdonation7@gmail.comFreundliche Grüße,
Robert Bailey
* * * * * * * * * * * * * * * *
Powerball Jackpot Gewinner

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2020-03-05 10:46 Juanito S. Galang
  0 siblings, 0 replies; 2593+ messages in thread
From: Juanito S. Galang @ 2020-03-05 10:46 UTC (permalink / raw)




Herzlichen Glückwunsch Lieber Begünstigter,Sie erhalten diese E-Mail von der Robert Bailey Foundation. Ich bin ein pensionierter Regierungsangestellter aus Harlem und ein Gewinner des Powerball Lottery Jackpot im Wert von 343,8 Millionen US-Dollar. Ich bin der größte Jackpot-Gewinner in der Geschichte der New Yorker Lotterie im US-Bundesstaat Amerika. Ich habe diese Lotterie am 27. Oktober 2018 gewonnen und möchte Sie darüber informieren, dass Google in Zusammenarbeit mit Microsoft Ihre "E-Mail-Adresse" auf meine Bitte, einen Spendenbetrag von 3.000.000,00 Millionen Euro zu erhalten, übermittelt hat. Ich spende diese 3 Millionen Euro an Sie, um den Wohltätigkeitsheimen und armen Menschen in Ihrer Gemeinde zu helfen, damit wir die Welt für alle verbessern können.Weitere Informationen finden Sie auf der folgenden Website, damit Sie nicht skeptisch sind
Diese Spende von 3 Mio. EUR.https://nypost.com/2018/11/14/meet-the-winner-of-the-biggest-lottery-jackpot-in-new-york-history/Sie können auch mein YouTube für mehr Bestätigung aufpassen:
https://www.youtube.com/watch?v=H5vT18Ysavc
Bitte beachten Sie, dass alle Antworten an (robertdonation7@gmail.com  ) gesendet werden, damit wir das können
Fahren Sie fort, um das gespendete Geld an Sie zu überweisen.E-Mail: robertdonation7@gmail.comFreundliche Grüße,
Robert Bailey
* * * * * * * * * * * * * * * *
Powerball Jackpot Gewinner

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2020-03-05 10:46 Juanito S. Galang
  0 siblings, 0 replies; 2593+ messages in thread
From: Juanito S. Galang @ 2020-03-05 10:46 UTC (permalink / raw)




Herzlichen Glückwunsch Lieber Begünstigter,Sie erhalten diese E-Mail von der Robert Bailey Foundation. Ich bin ein pensionierter Regierungsangestellter aus Harlem und ein Gewinner des Powerball Lottery Jackpot im Wert von 343,8 Millionen US-Dollar. Ich bin der größte Jackpot-Gewinner in der Geschichte der New Yorker Lotterie im US-Bundesstaat Amerika. Ich habe diese Lotterie am 27. Oktober 2018 gewonnen und möchte Sie darüber informieren, dass Google in Zusammenarbeit mit Microsoft Ihre "E-Mail-Adresse" auf meine Bitte, einen Spendenbetrag von 3.000.000,00 Millionen Euro zu erhalten, übermittelt hat. Ich spende diese 3 Millionen Euro an Sie, um den Wohltätigkeitsheimen und armen Menschen in Ihrer Gemeinde zu helfen, damit wir die Welt für alle verbessern können.Weitere Informationen finden Sie auf der folgenden Website, damit Sie nicht skeptisch sind
Diese Spende von 3 Mio. EUR.https://nypost.com/2018/11/14/meet-the-winner-of-the-biggest-lottery-jackpot-in-new-york-history/Sie können auch mein YouTube für mehr Bestätigung aufpassen:
https://www.youtube.com/watch?v=H5vT18Ysavc
Bitte beachten Sie, dass alle Antworten an (robertdonation7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org  ) gesendet werden, damit wir das können
Fahren Sie fort, um das gespendete Geld an Sie zu überweisen.E-Mail: robertdonation7-Re5JQEeQqe/BREloi785ARduMeKFjlen@public.gmane.org Grüße,
Robert Bailey
* * * * * * * * * * * * * * * *
Powerball Jackpot Gewinner

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2020-03-05 10:47 Juanito S. Galang
  0 siblings, 0 replies; 2593+ messages in thread
From: Juanito S. Galang @ 2020-03-05 10:47 UTC (permalink / raw)




Herzlichen Glückwunsch Lieber Begünstigter,Sie erhalten diese E-Mail von der Robert Bailey Foundation. Ich bin ein pensionierter Regierungsangestellter aus Harlem und ein Gewinner des Powerball Lottery Jackpot im Wert von 343,8 Millionen US-Dollar. Ich bin der größte Jackpot-Gewinner in der Geschichte der New Yorker Lotterie im US-Bundesstaat Amerika. Ich habe diese Lotterie am 27. Oktober 2018 gewonnen und möchte Sie darüber informieren, dass Google in Zusammenarbeit mit Microsoft Ihre "E-Mail-Adresse" auf meine Bitte, einen Spendenbetrag von 3.000.000,00 Millionen Euro zu erhalten, übermittelt hat. Ich spende diese 3 Millionen Euro an Sie, um den Wohltätigkeitsheimen und armen Menschen in Ihrer Gemeinde zu helfen, damit wir die Welt für alle verbessern können.Weitere Informationen finden Sie auf der folgenden Website, damit Sie nicht skeptisch sind
Diese Spende von 3 Mio. EUR.https://nypost.com/2018/11/14/meet-the-winner-of-the-biggest-lottery-jackpot-in-new-york-history/Sie können auch mein YouTube für mehr Bestätigung aufpassen:
https://www.youtube.com/watch?v=H5vT18Ysavc
Bitte beachten Sie, dass alle Antworten an (robertdonation7@gmail.com  ) gesendet werden, damit wir das können
Fahren Sie fort, um das gespendete Geld an Sie zu überweisen.E-Mail: robertdonation7@gmail.comFreundliche Grüße,
Robert Bailey
* * * * * * * * * * * * * * * *
Powerball Jackpot Gewinner

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2020-03-09  7:34 Michael J. Weirsky
  0 siblings, 0 replies; 2593+ messages in thread
From: Michael J. Weirsky @ 2020-03-09  7:34 UTC (permalink / raw)




-- 
My name is Michael J. Weirsky, I'm an unemployed Handy man , winner of 
$273million Jackpot in March 8, 2019. I donate $1.000.000,00 to you. 
Contact me via email: micjsky@aol.com for info / claim.
Continue reading: 
https://abcnews.go.com/WNT/video/jersey-handyman-forward-273m-lottery-winner-61544244

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2020-03-09  7:34 Michael J. Weirsky
  0 siblings, 0 replies; 2593+ messages in thread
From: Michael J. Weirsky @ 2020-03-09  7:34 UTC (permalink / raw)




-- 
My name is Michael J. Weirsky, I'm an unemployed Handy man , winner of 
$273million Jackpot in March 8, 2019. I donate $1.000.000,00 to you. 
Contact me via email: micjsky@aol.com for info / claim.
Continue reading: 
https://abcnews.go.com/WNT/video/jersey-handyman-forward-273m-lottery-winner-61544244

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2020-03-09  7:34 Michael J. Weirsky
  0 siblings, 0 replies; 2593+ messages in thread
From: Michael J. Weirsky @ 2020-03-09  7:34 UTC (permalink / raw)




-- 
My name is Michael J. Weirsky, I'm an unemployed Handy man , winner of 
$273million Jackpot in March 8, 2019. I donate $1.000.000,00 to you. 
Contact me via email: micjsky-YDxpq3io04c@public.gmane.org for info / claim.
Continue reading: 
https://abcnews.go.com/WNT/video/jersey-handyman-forward-273m-lottery-winner-61544244

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2020-03-09  7:34 Michael J. Weirsky
  0 siblings, 0 replies; 2593+ messages in thread
From: Michael J. Weirsky @ 2020-03-09  7:34 UTC (permalink / raw)




-- 
My name is Michael J. Weirsky, I'm an unemployed Handy man , winner of 
$273million Jackpot in March 8, 2019. I donate $1.000.000,00 to you. 
Contact me via email: micjsky-YDxpq3io04c@public.gmane.org for info / claim.
Continue reading: 
https://abcnews.go.com/WNT/video/jersey-handyman-forward-273m-lottery-winner-61544244

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2020-03-09  7:37 Michael J. Weirsky
  0 siblings, 0 replies; 2593+ messages in thread
From: Michael J. Weirsky @ 2020-03-09  7:37 UTC (permalink / raw)




-- 
My name is Michael J. Weirsky, I'm an unemployed Handy man , winner of 
$273million Jackpot in March 8, 2019. I donate $1.000.000,00 to you. 
Contact me via email: micjsky@aol.com for info / claim.
Continue reading: 
https://abcnews.go.com/WNT/video/jersey-handyman-forward-273m-lottery-winner-61544244

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2020-03-09  8:43 Michael J. Weirsky
  0 siblings, 0 replies; 2593+ messages in thread
From: Michael J. Weirsky @ 2020-03-09  8:43 UTC (permalink / raw)




-- 
My name is Michael J. Weirsky, I'm an unemployed Handy man , winner of 
$273million Jackpot in March 8, 2019. I donate $1.000.000,00 to you. 
Contact me via email: micjsky@aol.com for info / claim.
Continue reading: 
https://abcnews.go.com/WNT/video/jersey-handyman-forward-273m-lottery-winner-61544244

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2020-03-17  0:11 David Ibe
  0 siblings, 0 replies; 2593+ messages in thread
From: David Ibe @ 2020-03-17  0:11 UTC (permalink / raw)




Good Day,                

I am Mr. David Ibe, I work with the International Standards on Auditing, I have seen on records, that several times people has divert your funds into their own personal accounts.

Now I am writing to you in respect of the amount which I have been able to send to you through our International United Nations accredited and approved Diplomat, who has arrived Africa, I want you to know that the diplomat would deliver the funds which I have packaged as a diplomatic compensation to you and the amount in the consignment is  $10,000,000.00 United State Dollars.

I did not disclose the contents to the diplomat, but I told him that it is your compensation from the Auditing Corporate Governance and Stewardship, Auditing and Assurance Standards Board. I want you to know that these funds would help with your financial status as I have seen in records that you have spent a lot trying to receive these funds and I am not demanding so much from you but only 30% for my stress and logistics.

I would like you to get back to me with your personal contact details, so that I can give you the contact information's of the diplomat who has arrived Africa and has been waiting to get your details so that he can proceed with the delivery to you.

Yours Sincerely,
Kindly forward your details to: mrdavidibe966@gmail.com
Mr. David Ibe
International Auditor,
Corporate Governance and Stewardship

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2020-03-17  0:11 David Ibe
  0 siblings, 0 replies; 2593+ messages in thread
From: David Ibe @ 2020-03-17  0:11 UTC (permalink / raw)




Good Day,                

I am Mr. David Ibe, I work with the International Standards on Auditing, I have seen on records, that several times people has divert your funds into their own personal accounts.

Now I am writing to you in respect of the amount which I have been able to send to you through our International United Nations accredited and approved Diplomat, who has arrived Africa, I want you to know that the diplomat would deliver the funds which I have packaged as a diplomatic compensation to you and the amount in the consignment is  $10,000,000.00 United State Dollars.

I did not disclose the contents to the diplomat, but I told him that it is your compensation from the Auditing Corporate Governance and Stewardship, Auditing and Assurance Standards Board. I want you to know that these funds would help with your financial status as I have seen in records that you have spent a lot trying to receive these funds and I am not demanding so much from you but only 30% for my stress and logistics.

I would like you to get back to me with your personal contact details, so that I can give you the contact information's of the diplomat who has arrived Africa and has been waiting to get your details so that he can proceed with the delivery to you.

Yours Sincerely,
Kindly forward your details to: mrdavidibe966@gmail.com
Mr. David Ibe
International Auditor,
Corporate Governance and Stewardship

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2020-03-27  8:36 chenanqing
  0 siblings, 0 replies; 2593+ messages in thread
From: chenanqing @ 2020-03-27  8:36 UTC (permalink / raw)
  To: chenanqing, linux-kernel, netdev, ceph-devel, kuba, sage, jlayton,
	idryomov

From: Chen Anqing <chenanqing@oppo.com>
To: Ilya Dryomov <idryomov@gmail.com>
Cc: Jeff Layton <jlayton@kernel.org>,
        Sage Weil <sage@redhat.com>,
        Jakub Kicinski <kuba@kernel.org>,
        ceph-devel@vger.kernel.org,
        netdev@vger.kernel.org,
        linux-kernel@vger.kernel.org,
        chenanqing@oppo.com
Subject: [PATCH] libceph: we should take compound page into account also
Date: Fri, 27 Mar 2020 04:36:30 -0400
Message-Id: <20200327083630.36296-1-chenanqing@oppo.com>
X-Mailer: git-send-email 2.18.2

the patch is occur at a real crash,which slab is
come from a compound page,so we need take the compound page
into account also.
fixed commit 7e241f647dc7 ("libceph: fall back to sendmsg for slab pages")'

Signed-off-by: Chen Anqing <chenanqing@oppo.com>
---
 net/ceph/messenger.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index f8ca5edc5f2c..e08c1c334cd9 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -582,7 +582,7 @@ static int ceph_tcp_sendpage(struct socket *sock, struct page *page,
         * coalescing neighboring slab objects into a single frag which
         * triggers one of hardened usercopy checks.
         */
-       if (page_count(page) >= 1 && !PageSlab(page))
+       if (page_count(page) >= 1 && !PageSlab(compound_head(page)))
                sendpage = sock->ops->sendpage;
        else
                sendpage = sock_no_sendpage;
--
2.18.2

________________________________
OPPO

本电子邮件及其附件含有OPPO公司的保密信息,仅限于邮件指明的收件人使用(包含个人及群组)。禁止任何人在未经授权的情况下以任何形式使用。如果您错收了本邮件,请立即以电子邮件通知发件人并删除本邮件及其附件。

This e-mail and its attachments contain confidential information from OPPO, which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender by phone or email immediately and delete it!

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2020-03-27  9:20 chenanqing
  0 siblings, 0 replies; 2593+ messages in thread
From: chenanqing @ 2020-03-27  9:20 UTC (permalink / raw)
  To: chenanqing, linux-kernel, linux-scsi, open-iscsi, ceph-devel,
	martin.petersen, jejb, cleech, lduncan

From: Chen Anqing <chenanqing@oppo.com>
To: Lee Duncan <lduncan@suse.com>
Cc: Chris Leech <cleech@redhat.com>,
        "James E . J . Bottomley" <jejb@linux.ibm.com>,
        "Martin K . Petersen" <martin.petersen@oracle.com>,
        ceph-devel@vger.kernel.org,
        open-iscsi@googlegroups.com,
        linux-scsi@vger.kernel.org,
        linux-kernel@vger.kernel.org,
        chenanqing@oppo.com
Subject: [PATCH] scsi: libiscsi: we should take compound page into account also
Date: Fri, 27 Mar 2020 05:20:01 -0400
Message-Id: <20200327092001.56879-1-chenanqing@oppo.com>
X-Mailer: git-send-email 2.18.2

the patch is occur at a real crash,which slab is
come from a compound page,so we need take the compound page
into account also.
fixed commit 08b11eaccfcf ("scsi: libiscsi: fall back to
sendmsg for slab pages").

Signed-off-by: Chen Anqing <chenanqing@oppo.com>
---
 drivers/scsi/libiscsi_tcp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/libiscsi_tcp.c b/drivers/scsi/libiscsi_tcp.c
index 6ef93c7af954..98304e5e1f6f 100644
--- a/drivers/scsi/libiscsi_tcp.c
+++ b/drivers/scsi/libiscsi_tcp.c
@@ -128,7 +128,8 @@ static void iscsi_tcp_segment_map(struct iscsi_segment *segment, int recv)
         * coalescing neighboring slab objects into a single frag which
         * triggers one of hardened usercopy checks.
         */
-       if (!recv && page_count(sg_page(sg)) >= 1 && !PageSlab(sg_page(sg)))
+       if (!recv && page_count(sg_page(sg)) >= 1 &&
+           !PageSlab(compound_head(sg_page(sg))))
                return;

        if (recv) {
--
2.18.2

________________________________
OPPO

本电子邮件及其附件含有OPPO公司的保密信息,仅限于邮件指明的收件人使用(包含个人及群组)。禁止任何人在未经授权的情况下以任何形式使用。如果您错收了本邮件,请立即以电子邮件通知发件人并删除本邮件及其附件。

This e-mail and its attachments contain confidential information from OPPO, which is intended only for the person or entity whose address is listed above. Any use of the information contained herein in any way (including, but not limited to, total or partial disclosure, reproduction, or dissemination) by persons other than the intended recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender by phone or email immediately and delete it!

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2020-04-23 23:06 Azim Hashim Premji
  0 siblings, 0 replies; 2593+ messages in thread
From: Azim Hashim Premji @ 2020-04-23 23:06 UTC (permalink / raw)


-- 
Hallo,

Ich bin Azim Hashim Premji, ein indischer Wirtschaftsmagnat, Investor
und Philanthrop. Ich bin der Vorsitzende von Wipro Limited. Ich habe
25 Prozent meines persönlichen Vermögens für wohltätige Zwecke
verschenkt. Und ich habe auch zugesagt, den Rest von 25% in diesem
Jahr 2020 an Einzelpersonen COVID-19 Financial zu verschenken. Ich
habe beschlossen, 2.000.000 Euro an Sie zu spenden. Wenn Sie an meiner
Spende interessiert sind, kontaktieren Sie mich für weitere
Informationen.

Sie können auch mehr über mich über den unten stehenden Link lesen

http://en.wikipedia.org/wiki/Azim_Premji

Herzlicher Gruss
CEO Wipro Limited
Azim Hashim Premji
E-Mail: azimhashim011@gmail.com

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2020-04-23 23:06 Azim Hashim Premji
  0 siblings, 0 replies; 2593+ messages in thread
From: Azim Hashim Premji @ 2020-04-23 23:06 UTC (permalink / raw)


-- 
Hallo,

Ich bin Azim Hashim Premji, ein indischer Wirtschaftsmagnat, Investor
und Philanthrop. Ich bin der Vorsitzende von Wipro Limited. Ich habe
25 Prozent meines persönlichen Vermögens für wohltätige Zwecke
verschenkt. Und ich habe auch zugesagt, den Rest von 25% in diesem
Jahr 2020 an Einzelpersonen COVID-19 Financial zu verschenken. Ich
habe beschlossen, 2.000.000 Euro an Sie zu spenden. Wenn Sie an meiner
Spende interessiert sind, kontaktieren Sie mich für weitere
Informationen.

Sie können auch mehr über mich über den unten stehenden Link lesen

http://en.wikipedia.org/wiki/Azim_Premji

Herzlicher Gruss
CEO Wipro Limited
Azim Hashim Premji
E-Mail: azimhashim011@gmail.com

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2020-05-08 22:58 Barbara D Wilkins
  0 siblings, 0 replies; 2593+ messages in thread
From: Barbara D Wilkins @ 2020-05-08 22:58 UTC (permalink / raw)




Hallo,          Wir sind eine christliche Organisation, die gegründet wurde, um Menschen zu helfen, die Hilfe benötigen, beispielsweise finanzielle Hilfe. Wenn Sie also finanzielle Schwierigkeiten haben oder sich in einem finanziellen Chaos befinden und Geld benötigen, um Ihr eigenes Unternehmen zu gründen, oder wenn Sie einen Kredit benötigen Begleichen Sie Ihre Schulden oder zahlen Sie Ihre Rechnungen ab, gründen Sie ein gutes Geschäft oder es fällt Ihnen schwer, einen Kapitalkredit von lokalen Banken zu erhalten. Kontaktieren Sie uns noch heute per E-Mail:  Lassen Sie sich diese Gelegenheit also nicht entgehen weil Jesus gestern, heute und für immer derselbe ist. Bitte, diese sind für ernsthafte und gottesfürchtige Menschen.Dein Name:Darlehensbetrag:Leihdauer:Gülti
 ge Handynummer:Vielen Dank für Ihr Verständnis für Ihren Kontakt, während wir warten: mrsbarbarawilkinsfunds.usagmail.comGrüßeVerwaltung

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2020-05-08 23:41 Barbara D Wilkins
  0 siblings, 0 replies; 2593+ messages in thread
From: Barbara D Wilkins @ 2020-05-08 23:41 UTC (permalink / raw)




Hallo,          Wir sind eine christliche Organisation, die gegründet wurde, um Menschen zu helfen, die Hilfe benötigen, beispielsweise finanzielle Hilfe. Wenn Sie also finanzielle Schwierigkeiten haben oder sich in einem finanziellen Chaos befinden und Geld benötigen, um Ihr eigenes Unternehmen zu gründen, oder wenn Sie einen Kredit benötigen Begleichen Sie Ihre Schulden oder zahlen Sie Ihre Rechnungen ab, gründen Sie ein gutes Geschäft oder es fällt Ihnen schwer, einen Kapitalkredit von lokalen Banken zu erhalten. Kontaktieren Sie uns noch heute per E-Mail:  Lassen Sie sich diese Gelegenheit also nicht entgehen weil Jesus gestern, heute und für immer derselbe ist. Bitte, diese sind für ernsthafte und gottesfürchtige Menschen.Dein Name:Darlehensbetrag:Leihdauer:Gülti
 ge Handynummer:Vielen Dank für Ihr Verständnis für Ihren Kontakt, während wir warten: mrsbarbarawilkinsfunds.usagmail.comGrüßeVerwaltung

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2020-05-08 23:51 Barbara D Wilkins
  0 siblings, 0 replies; 2593+ messages in thread
From: Barbara D Wilkins @ 2020-05-08 23:51 UTC (permalink / raw)




Hallo,          Wir sind eine christliche Organisation, die gegründet wurde, um Menschen zu helfen, die Hilfe benötigen, beispielsweise finanzielle Hilfe. Wenn Sie also finanzielle Schwierigkeiten haben oder sich in einem finanziellen Chaos befinden und Geld benötigen, um Ihr eigenes Unternehmen zu gründen, oder wenn Sie einen Kredit benötigen Begleichen Sie Ihre Schulden oder zahlen Sie Ihre Rechnungen ab, gründen Sie ein gutes Geschäft oder es fällt Ihnen schwer, einen Kapitalkredit von lokalen Banken zu erhalten. Kontaktieren Sie uns noch heute per E-Mail:  Lassen Sie sich diese Gelegenheit also nicht entgehen weil Jesus gestern, heute und für immer derselbe ist. Bitte, diese sind für ernsthafte und gottesfürchtige Menschen.Dein Name:Darlehensbetrag:Leihdauer:Gülti
 ge Handynummer:Vielen Dank für Ihr Verständnis für Ihren Kontakt, während wir warten: mrsbarbarawilkinsfunds.usagmail.comGrüßeVerwaltung

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2020-06-04 19:57 David Shine
  0 siblings, 0 replies; 2593+ messages in thread
From: David Shine @ 2020-06-04 19:57 UTC (permalink / raw)
  To: linux

 Linux


https://clck.ru/NnuZT



David Shine

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
       [not found] <1327230475.528260.1591750200327.ref@mail.yahoo.com>
@ 2020-06-10  0:50 ` Celine Marchand
  0 siblings, 0 replies; 2593+ messages in thread
From: Celine Marchand @ 2020-06-10  0:50 UTC (permalink / raw)




Urgent attention please
Dearest, how are you? I am sorry for intruding your mailbox, but I need to talk to you. I got your email address in my dream and i wonder if it is correct because i emailed you earlier without any response. You should know that my contact to you is by the special grace of God. I am in urgent need of a reliable and reputable person and i believe you are a person of fine repute, hence the revelation of your email to me in the dream.
I am Mrs. Celine Marchand a citizen of France (French). But reside in Burkina Faso for business purposes. I need your collaboration to execute some projects worth € 2.800.000 Euro and it is very urgent as am presently in very critical condition.
Please reply through this email address ( celine88492-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org ) with your full contact information for more private and confidential communication.

Thank you as i wait for your reply.
Mrs. Celine Marchand

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2020-06-27 21:52 helen
  0 siblings, 0 replies; 2593+ messages in thread
From: helen @ 2020-06-27 21:52 UTC (permalink / raw)
  To: ebkrumme

MONEY-GRAM TRANSFERRED PAYMENT INFO:

Below is the sender’s information



1. MG. REFERENCE NO#: 36360857

2. SENDER'S NAME: Johnson Williams

3. AMOUNT TO PICKUP: US$10,000



Go to any Money Gram office near you and pick up the payment Track the

Reference Number by visiting and click the link below

(https://secure.moneygram.com/embed/track) and enter the Reference

Number: 36360857 and the Last Name: Williams, you will find the payment

available for pickup instantly.

Yours Sincerely,

Mrs. Helen Marvis
United Nations Liaison Office
Directorate for International Payments

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2020-06-27 21:54 helen
  0 siblings, 0 replies; 2593+ messages in thread
From: helen @ 2020-06-27 21:54 UTC (permalink / raw)
  To: zhang

MONEY-GRAM TRANSFERRED PAYMENT INFO:

Below is the sender’s information



1. MG. REFERENCE NO#: 36360857

2. SENDER'S NAME: Johnson Williams

3. AMOUNT TO PICKUP: US$10,000



Go to any Money Gram office near you and pick up the payment Track the

Reference Number by visiting and click the link below

(https://secure.moneygram.com/embed/track) and enter the Reference

Number: 36360857 and the Last Name: Williams, you will find the payment

available for pickup instantly.

Yours Sincerely,

Mrs. Helen Marvis
United Nations Liaison Office
Directorate for International Payments

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2020-06-27 21:58 lookman joe
  0 siblings, 0 replies; 2593+ messages in thread
From: lookman joe @ 2020-06-27 21:58 UTC (permalink / raw)


MONEY-GRAM TRANSFERRED PAYMENT INFO:

Below is the sender’s information



1. MG. REFERENCE NO#: 36360857

2. SENDER'S NAME: Johnson Williams

3. AMOUNT TO PICKUP: US$10,000



Go to any Money Gram office near you and pick up the payment Track the

Reference Number by visiting and click the link below

(https://secure.moneygram.com/embed/track) and enter the Reference

Number: 36360857 and the Last Name: Williams, you will find the payment

available for pickup instantly.

Yours Sincerely,

Mrs. Helen Marvis
United Nations Liaison Office
Directorate for International Payments

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2020-06-27 21:58 lookman joe
  0 siblings, 0 replies; 2593+ messages in thread
From: lookman joe @ 2020-06-27 21:58 UTC (permalink / raw)


MONEY-GRAM TRANSFERRED PAYMENT INFO:

Below is the sender’s information



1. MG. REFERENCE NO#: 36360857

2. SENDER'S NAME: Johnson Williams

3. AMOUNT TO PICKUP: US$10,000



Go to any Money Gram office near you and pick up the payment Track the

Reference Number by visiting and click the link below

(https://secure.moneygram.com/embed/track) and enter the Reference

Number: 36360857 and the Last Name: Williams, you will find the payment

available for pickup instantly.

Yours Sincerely,

Mrs. Helen Marvis
United Nations Liaison Office
Directorate for International Payments

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2020-06-27 21:58 lookman joe
  0 siblings, 0 replies; 2593+ messages in thread
From: lookman joe @ 2020-06-27 21:58 UTC (permalink / raw)


MONEY-GRAM TRANSFERRED PAYMENT INFO:

Below is the sender’s information



1. MG. REFERENCE NO#: 36360857

2. SENDER'S NAME: Johnson Williams

3. AMOUNT TO PICKUP: US$10,000



Go to any Money Gram office near you and pick up the payment Track the

Reference Number by visiting and click the link below

(https://secure.moneygram.com/embed/track) and enter the Reference

Number: 36360857 and the Last Name: Williams, you will find the payment

available for pickup instantly.

Yours Sincerely,

Mrs. Helen Marvis
United Nations Liaison Office
Directorate for International Payments

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2020-06-30 17:56 Vasiliy Kupriakov
  0 siblings, 0 replies; 2593+ messages in thread
From: Vasiliy Kupriakov @ 2020-06-30 17:56 UTC (permalink / raw)
  To: Corentin Chary, Darren Hart, Andy Shevchenko
  Cc: Vasiliy Kupriakov,
	open list:ASUS NOTEBOOKS AND EEEPC ACPI/WMI EXTRAS DRIVERS,
	open list:ASUS NOTEBOOKS AND EEEPC ACPI/WMI EXTRAS DRIVERS,
	open list

Subject: [PATCH] platform/x86: asus-wmi: allow BAT1 battery name

The battery on my laptop ASUS TUF Gaming FX706II is named BAT1.
This patch allows battery extension to load.

Signed-off-by: Vasiliy Kupriakov <rublag-ns@yandex.ru>
---
 drivers/platform/x86/asus-wmi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index 877aade19497..8f4acdc06b13 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -441,6 +441,7 @@ static int asus_wmi_battery_add(struct power_supply *battery)
 	 * battery is named BATT.
 	 */
 	if (strcmp(battery->desc->name, "BAT0") != 0 &&
+	    strcmp(battery->desc->name, "BAT1") != 0 &&
 	    strcmp(battery->desc->name, "BATT") != 0)
 		return -ENODEV;
 
-- 
2.27.0

^ permalink raw reply related	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2020-07-02 19:43 Barr Anthony Calder
  0 siblings, 0 replies; 2593+ messages in thread
From: Barr Anthony Calder @ 2020-07-02 19:43 UTC (permalink / raw)


Dobrý den
Jsem Anthony Calder, právní zástupce z Toga. Obrátil jsem se na vás
ohledně mého pozdního klienta, Dr. Edwin, majetek fondu ve výši 2,5
milionu dolarů, který bude vrácen na váš účet. Kromě toho v této
transakci chci, abyste odpověděli důvěrně.
Anthony Calder

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2020-07-22  4:45 Darlehen Bedienung
  0 siblings, 0 replies; 2593+ messages in thread
From: Darlehen Bedienung @ 2020-07-22  4:45 UTC (permalink / raw)




Schönen Tag,Wir sind zuverlässige, vertrauenswürdige Kreditgeber, Wir bieten Darlehen an Unternehmen und Privatpersonen zu niedrigen und günstigen Zinssatz von 2%. Sind Sie auf der Suche nach einem Business-Darlehen, persönliche Darlehen, Schuldenkonsolidierung, unbesicherte Darlehen, Venture Capital. Kontaktieren Sie uns mit Name, Land, Darlehensbetrag, Dauer und Telefonnummer.GrüßeHerr DA COSTA DARREN FAY

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2020-07-22  5:32 Darlehen Bedienung
  0 siblings, 0 replies; 2593+ messages in thread
From: Darlehen Bedienung @ 2020-07-22  5:32 UTC (permalink / raw)




Schönen Tag,Wir sind zuverlässige, vertrauenswürdige Kreditgeber, Wir bieten Darlehen an Unternehmen und Privatpersonen zu niedrigen und günstigen Zinssatz von 2%. Sind Sie auf der Suche nach einem Business-Darlehen, persönliche Darlehen, Schuldenkonsolidierung, unbesicherte Darlehen, Venture Capital. Kontaktieren Sie uns mit Name, Land, Darlehensbetrag, Dauer und Telefonnummer.GrüßeHerr DA COSTA DARREN FAY

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2020-07-22  5:32 Darlehen Bedienung
  0 siblings, 0 replies; 2593+ messages in thread
From: Darlehen Bedienung @ 2020-07-22  5:32 UTC (permalink / raw)




Schönen Tag,Wir sind zuverlässige, vertrauenswürdige Kreditgeber, Wir bieten Darlehen an Unternehmen und Privatpersonen zu niedrigen und günstigen Zinssatz von 2%. Sind Sie auf der Suche nach einem Business-Darlehen, persönliche Darlehen, Schuldenkonsolidierung, unbesicherte Darlehen, Venture Capital. Kontaktieren Sie uns mit Name, Land, Darlehensbetrag, Dauer und Telefonnummer.GrüßeHerr DA COSTA DARREN FAY

^ permalink raw reply	[flat|nested] 2593+ messages in thread

* (unknown)
@ 2020-07-22  5:32 Darlehen Bedienung
  0 siblings, 0 replies; 2593+ messages in thread
From: Darlehen Bedienung @ 2020-07-22  5:32 UTC (permalink / raw)




Schönen Tag,Wir sind zuverlässige, vertrauenswürdige Kreditgeber, Wir bieten Darlehen an Unternehmen und Privatpersonen zu niedrigen und günstigen Zinssatz von 2%. Sind Sie auf der Suche nach einem Business-Darlehen, persönliche Darlehen, Schuldenkonsolidierung, unbesicherte Darlehen, Venture Capital. Kontaktieren Sie uns mit Name, Land, Darlehensbetrag, Dauer und Telefonnummer.GrüßeHerr DA COSTA DARREN FAY

^ permalink raw reply	[flat|nested] 2593+ messages in thread

end of thread, other threads:[~2020-07-22  5:40 UTC | newest]

Thread overview: 2593+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-20  8:02 (unknown), Christoph Hellwig
2018-04-20  8:02 ` No subject Christoph Hellwig
2018-04-20  8:02 ` [OpenRISC] (no subject) Christoph Hellwig
2018-04-20  8:02 ` Christoph Hellwig
2018-04-20  8:02 ` No subject Christoph Hellwig
2018-04-20  8:02 ` (unknown) Christoph Hellwig
2018-04-20  8:02 ` Christoph Hellwig
2018-04-20  8:02 ` [PATCH 01/22] dma-debug: move initialization to common code Christoph Hellwig
2018-04-20  8:02   ` Christoph Hellwig
2018-04-20  8:02   ` [OpenRISC] " Christoph Hellwig
2018-04-20  8:02   ` Christoph Hellwig
2018-04-20  8:02   ` Christoph Hellwig
2018-04-20  8:02   ` Christoph Hellwig
2018-04-20  8:02   ` Christoph Hellwig
2018-04-20 10:23   ` Robin Murphy
2018-04-20 10:23     ` Robin Murphy
2018-04-20 10:23     ` [OpenRISC] " Robin Murphy
2018-04-20 10:23     ` Robin Murphy
2018-04-20 10:23     ` Robin Murphy
2018-04-24  7:35     ` Christoph Hellwig
2018-04-24  7:35       ` Christoph Hellwig
2018-04-24  7:35       ` [OpenRISC] " Christoph Hellwig
2018-04-24  7:35       ` Christoph Hellwig
2018-04-24  7:35       ` Christoph Hellwig
2018-04-20  8:02 ` [PATCH 02/22] dma-mapping: simplify Kconfig dependencies Christoph Hellwig
2018-04-20  8:02   ` Christoph Hellwig
2018-04-20  8:02   ` [OpenRISC] " Christoph Hellwig
2018-04-20  8:02   ` Christoph Hellwig
2018-04-20  8:02   ` Christoph Hellwig
2018-04-20  8:02   ` Christoph Hellwig
2018-04-20  8:02   ` Christoph Hellwig
2018-04-20  8:02 ` [PATCH 03/22] dma-mapping: provide a generic dma-noncoherent implementation Christoph Hellwig
2018-04-20  8:02   ` Christoph Hellwig
2018-04-20  8:02   ` [OpenRISC] " Christoph Hellwig
2018-04-20  8:02   ` Christoph Hellwig
2018-04-20  8:02   ` Christoph Hellwig
2018-04-20  8:02   ` Christoph Hellwig
2018-04-20  8:02   ` Christoph Hellwig
2018-04-20  8:02 ` [PATCH 04/22] alpha: use dma_direct_ops for jensen Christoph Hellwig
2018-04-20  8:02   ` Christoph Hellwig
2018-04-20  8:02   ` [OpenRISC] " Christoph Hellwig
2018-04-20  8:02   ` Christoph Hellwig
2018-04-20  8:02   ` Christoph Hellwig
2018-04-20  8:02   ` Christoph Hellwig
2018-04-20  8:02 ` [PATCH 05/22] alpha: simplify get_arch_dma_ops Christoph Hellwig
2018-04-20  8:02   ` Christoph Hellwig
2018-04-20  8:02   ` [OpenRISC] " Christoph Hellwig
2018-04-20  8:02   ` Christoph Hellwig
2018-04-20  8:02   ` Christoph Hellwig
2018-04-20  8:02   ` Christoph Hellwig
2018-04-20  8:02 ` [PATCH 06/22] arc: use generic dma_noncoherent_ops Christoph Hellwig
2018-04-20  8:02   ` Christoph Hellwig
2018-04-20  8:02   ` [OpenRISC] " Christoph Hellwig
2018-04-20  8:02   ` Christoph Hellwig
2018-04-20  8:02   ` Christoph Hellwig
2018-04-20  8:02   ` Christoph Hellwig
2018-04-25 11:17   ` Alexey Brodkin
2018-04-25 11:17     ` Alexey Brodkin
2018-04-25 11:17     ` Alexey Brodkin
2018-04-25 11:17     ` Alexey Brodkin
2018-04-25 11:17     ` Alexey Brodkin
2018-04-25 11:17     ` Alexey Brodkin
2018-04-26  6:45     ` hch
2018-04-26  6:45       ` hch at lst.de
2018-04-26  6:45       ` [OpenRISC] " hch
2018-04-26  6:45       ` hch
2018-04-26  6:45       ` hch
2018-04-26  6:45       ` hch
2018-04-26  6:45       ` hch
2018-04-26  8:25       ` hch
2018-04-26  8:25         ` hch at lst.de
2018-04-26  8:25         ` [OpenRISC] " hch
2018-04-26  8:25         ` hch
2018-04-26  8:25         ` hch
2018-04-26  8:25         ` hch
2018-04-26  8:25         ` hch
2018-04-20  8:02 ` [PATCH 07/22] arm-nommu: " Christoph Hellwig
2018-04-20  8:02   ` Christoph Hellwig
2018-04-20  8:02   ` [OpenRISC] " Christoph Hellwig
2018-04-20  8:02   ` Christoph Hellwig
2018-04-20  8:02   ` Christoph Hellwig
2018-04-20  8:02   ` Christoph Hellwig
2018-04-20  8:02   ` Christoph Hellwig
2018-04-20  8:02 ` [PATCH 08/22] c6x: " Christoph Hellwig
2018-04-20  8:02   ` Christoph Hellwig
2018-04-20  8:02   ` [OpenRISC] " Christoph Hellwig
2018-04-20  8:02   ` Christoph Hellwig
2018-04-20  8:02   ` Christoph Hellwig
2018-04-20  8:02   ` Christoph Hellwig
2018-04-20  8:03 ` [PATCH 09/22] hexagon: " Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03   ` [OpenRISC] " Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03 ` [PATCH 10/22] m68k: " Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03   ` [OpenRISC] " Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03 ` [PATCH 11/22] microblaze: " Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03   ` [OpenRISC] " Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03 ` [PATCH 12/22] microblaze: remove the consistent_sync and consistent_sync_page Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03   ` [OpenRISC] " Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03 ` [PATCH 13/22] nds32: use generic dma_noncoherent_ops Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03   ` [OpenRISC] " Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-23  6:49   ` Greentime Hu
2018-04-23  6:49     ` Greentime Hu
2018-04-23  6:49     ` [OpenRISC] " Greentime Hu
2018-04-23  6:49     ` Greentime Hu
2018-04-23  6:49     ` Greentime Hu
2018-04-23  8:09     ` Michael Schmitz
2018-04-23 11:03       ` Greentime Hu
2018-04-24 19:16     ` Christoph Hellwig
2018-04-24 19:16       ` Christoph Hellwig
2018-04-24 19:16       ` [OpenRISC] " Christoph Hellwig
2018-04-24 19:16       ` Christoph Hellwig
2018-04-24 19:16       ` Christoph Hellwig
2018-04-25  1:43       ` Greentime Hu
2018-04-25  1:43         ` Greentime Hu
2018-04-25  1:43         ` [OpenRISC] " Greentime Hu
2018-04-25  1:43         ` Greentime Hu
2018-04-25  1:43         ` Greentime Hu
2018-04-25  6:40         ` Christoph Hellwig
2018-04-25  6:40           ` Christoph Hellwig
2018-04-25  6:40           ` [OpenRISC] " Christoph Hellwig
2018-04-25  6:40           ` Christoph Hellwig
2018-04-25  6:40           ` Christoph Hellwig
2018-04-25  6:40           ` Christoph Hellwig
2018-04-25  6:40           ` Christoph Hellwig
2018-04-25 12:25           ` Greentime Hu
2018-04-25 12:25             ` Greentime Hu
2018-04-25 12:25             ` [OpenRISC] " Greentime Hu
2018-04-25 12:25             ` Greentime Hu
2018-04-25 12:25             ` Greentime Hu
2018-04-26  6:42             ` Christoph Hellwig
2018-04-26  6:42               ` Christoph Hellwig
2018-04-26  6:42               ` [OpenRISC] " Christoph Hellwig
2018-04-26  6:42               ` Christoph Hellwig
2018-04-26  6:42               ` Christoph Hellwig
2018-04-26  8:06               ` Greentime Hu
2018-04-26  8:06                 ` Greentime Hu
2018-04-26  8:06                 ` [OpenRISC] " Greentime Hu
2018-04-26  8:06                 ` Greentime Hu
2018-04-26  8:06                 ` Greentime Hu
2018-04-26  8:24                 ` Christoph Hellwig
2018-04-26  8:24                   ` Christoph Hellwig
2018-04-26  8:24                   ` [OpenRISC] " Christoph Hellwig
2018-04-26  8:24                   ` Christoph Hellwig
2018-04-26  8:24                   ` Christoph Hellwig
2018-04-26  9:39                   ` Greentime Hu
2018-04-26  9:39                     ` Greentime Hu
2018-04-26  9:39                     ` [OpenRISC] " Greentime Hu
2018-04-26  9:39                     ` Greentime Hu
2018-04-26  9:39                     ` Greentime Hu
2018-04-20  8:03 ` [PATCH 14/22] nios2: " Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03   ` [OpenRISC] " Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03 ` [PATCH 15/22] openrisc: " Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03   ` [OpenRISC] " Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03 ` [PATCH 16/22] sh: simplify get_arch_dma_ops Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03   ` [OpenRISC] " Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03 ` [PATCH 17/22] sh: introduce a sh_cacheop_vaddr helper Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03   ` [OpenRISC] " Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03 ` [PATCH 18/22] sh: use dma_direct_ops for the CONFIG_DMA_COHERENT case Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03   ` [OpenRISC] " Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03 ` [PATCH 19/22] sh: use generic dma_noncoherent_ops Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03   ` [OpenRISC] " Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03 ` [PATCH 20/22] xtensa: " Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03   ` [OpenRISC] " Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03 ` [PATCH 21/22] sparc: " Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03   ` [OpenRISC] " Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03 ` [PATCH 22/22] parisc: " Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03   ` [OpenRISC] " Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-20  8:03   ` Christoph Hellwig
2018-04-21 17:43   ` Helge Deller
2018-04-21 17:43     ` Helge Deller
2018-04-21 17:43     ` [OpenRISC] " Helge Deller
2018-04-21 17:43     ` Helge Deller
2018-04-21 17:43     ` Helge Deller
2018-04-21 17:43     ` Helge Deller
2018-04-21 21:52     ` James Bottomley
2018-04-21 21:52       ` James Bottomley
2018-04-21 21:52       ` [OpenRISC] " James Bottomley
2018-04-21 21:52       ` James Bottomley
2018-04-21 21:52       ` James Bottomley
2018-04-25  7:21     ` Christoph Hellwig
2018-04-25  7:21       ` Christoph Hellwig
2018-04-25  7:21       ` [OpenRISC] " Christoph Hellwig
2018-04-25  7:21       ` Christoph Hellwig
2018-04-25  7:21       ` Christoph Hellwig
2018-04-25 21:07       ` Helge Deller
2018-04-25 21:07         ` Helge Deller
2018-04-25 21:07         ` [OpenRISC] " Helge Deller
2018-04-25 21:07         ` Helge Deller
2018-04-25 21:07         ` Helge Deller
2018-04-25 21:07         ` Helge Deller
2018-04-21 21:42   ` James Bottomley
2018-04-21 21:42     ` James Bottomley
2018-04-21 21:42     ` [OpenRISC] " James Bottomley
2018-04-21 21:42     ` James Bottomley
2018-04-21 21:42     ` James Bottomley
2018-04-24  8:20     ` Christoph Hellwig
2018-04-24  8:20       ` Christoph Hellwig
2018-04-24  8:20       ` [OpenRISC] " Christoph Hellwig
2018-04-24  8:20       ` Christoph Hellwig
2018-04-24  8:20       ` Christoph Hellwig
  -- strict thread matches above, loose matches on Subject: below --
2020-07-22  5:32 (unknown) Darlehen Bedienung
2020-07-22  5:32 (unknown) Darlehen Bedienung
2020-07-22  5:32 (unknown) Darlehen Bedienung
2020-07-22  4:45 (unknown) Darlehen Bedienung
2020-07-02 19:43 (unknown) Barr Anthony Calder
2020-06-30 17:56 (unknown) Vasiliy Kupriakov
2020-06-27 21:58 (unknown) lookman joe
2020-06-27 21:58 (unknown) lookman joe
2020-06-27 21:58 (unknown) lookman joe
2020-06-27 21:54 (unknown) helen
2020-06-27 21:52 (unknown) helen
     [not found] <1327230475.528260.1591750200327.ref@mail.yahoo.com>
2020-06-10  0:50 ` (unknown) Celine Marchand
2020-06-04 19:57 (unknown) David Shine
2020-05-08 23:51 (unknown) Barbara D Wilkins
2020-05-08 23:41 (unknown) Barbara D Wilkins
2020-05-08 22:58 (unknown) Barbara D Wilkins
2020-04-23 23:06 (unknown) Azim Hashim Premji
2020-04-23 23:06 (unknown) Azim Hashim Premji
2020-03-27  9:20 (unknown) chenanqing
2020-03-27  8:36 (unknown) chenanqing
2020-03-17  0:11 (unknown) David Ibe
2020-03-17  0:11 (unknown) David Ibe
2020-03-09  8:43 (unknown) Michael J. Weirsky
2020-03-09  7:37 (unknown) Michael J. Weirsky
2020-03-09  7:34 (unknown) Michael J. Weirsky
2020-03-09  7:34 (unknown) Michael J. Weirsky
2020-03-09  7:34 (unknown) Michael J. Weirsky
2020-03-09  7:34 (unknown) Michael J. Weirsky
2020-03-05 10:47 (unknown) Juanito S. Galang
2020-03-05 10:46 (unknown) Juanito S. Galang
2020-03-05 10:46 (unknown) Juanito S. Galang
2020-03-05 10:46 (unknown) Juanito S. Galang
2020-03-05 10:46 (unknown) Juanito S. Galang
2020-03-05 10:46 (unknown) Juanito S. Galang
2020-03-05 10:46 (unknown) Juanito S. Galang
2020-03-05  2:33 (unknown) Maria Alessandra Filippi
2020-03-05  0:26 (unknown) Maria Alessandra Filippi
2020-03-04 23:30 (unknown) Maria Alessandra Filippi
2020-03-04  9:42 (unknown) Julie Leach
2020-02-24  8:18 kernel panic: audit: backlog limit exceeded syzbot
2020-02-24 22:38 ` Paul Moore
2020-02-24 22:43   ` Eric Paris
2020-02-24 22:46     ` Paul Moore
     [not found]       ` <CAHC9VhQnbdJprbdTa_XcgUJaiwhzbnGMWJqHczU54UMk0AFCtw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2020-02-27 15:39         ` (unknown) Dmitry Vyukov via B.A.T.M.A.N
2020-02-15  3:25 (unknown) mprim37 alcorta
2020-02-11 22:34 (unknown) Rajat Jain
2020-02-05  8:23 (unknown) Frau Huan Jlaying
     [not found] <1187667350.235001.1580574902701.ref@mail.yahoo.com>
2020-02-01 16:35 ` (unknown) Mrs. Maureen Hinckley
2019-12-12 15:50 (unknown) 周琰杰 (Zhou Yanjie)
2019-09-12  8:09 (unknown) Gene Chen
2019-05-16  3:48 (unknown) Mail Delivery Subsystem
2019-04-10 11:17 Norbert Lange
2019-04-10 14:15 ` (unknown) Jan Kiszka
2019-04-10 11:14 Norbert Lange
2019-04-10 13:37 ` (unknown) Jan Kiszka
2019-04-10 14:36 ` (unknown) Jan Kiszka
     [not found]   ` <VI1PR05MB5917B5956F2E9365F10D6539F62E0@VI1PR05MB5917.eurprd05.prod.outlook.com>
2019-04-10 14:47     ` (unknown) Jan Kiszka
2019-04-10 15:02       ` (unknown) Lange Norbert
2019-04-10 16:46         ` (unknown) Jan Kiszka
2019-04-05  2:38 (unknown) Changbin Du
2019-04-04  5:56 (unknown) Mail Delivery Subsystem
2019-03-29  0:36 (unknown) 邀请函
2019-03-21  1:51 (unknown) zhuchangchun
2019-03-04  3:42 (unknown) Automatic Email Delivery Software
2019-03-01  3:34 (unknown) Automatic Email Delivery Software
2019-02-28  3:36 (unknown) Post Office
2019-01-15  2:55 (unknown), Jens Axboe
2019-01-02 12:25 (unknown), Frank Wunderlich
2018-08-27 14:50 (unknown), Christoph Hellwig
2018-06-23 21:08 (unknown), David Lechner
2018-05-31 17:11 (unknown), Adam Richter via Containers
2018-05-25  3:26 (unknown), Bounced mail
2018-04-16  1:22 (unknown), Andrew Worsley
2018-03-23  3:05 (unknown), Mail Delivery Subsystem
2018-03-07  7:48 (unknown), Solen win
     [not found] <[PATCH xf86-video-amdgpu 0/3] Add non-desktop and leasing support>
2018-03-03  4:49 ` (unknown), Keith Packard
2018-02-23 15:54 (unknown), Adam Richter
2018-02-17  8:41 (unknown), Solen win
2018-02-17  1:45 (unknown), Ryan Ellis
2018-02-13 22:59 (unknown), Mitesh Shah
2018-02-13 22:57 (unknown), Alfred Cheuk Chow
2018-02-13 22:57 (unknown), Alfred Cheuk Chow
2018-02-13 22:57 (unknown), Alfred Cheuk Chow
2018-02-13 22:57 (unknown), Alfred Cheuk Chow
2018-02-13 11:58 (unknown), Solen win
2018-02-12  1:39 (unknown), Alfred Cheuk Chow
2018-02-12  1:39 (unknown), Alfred Cheuk Chow
2018-02-12  1:39 (unknown), Alfred Cheuk Chow
2018-02-11 16:07 (unknown), glolariu
2018-02-08 14:40 (unknown), Automatic Email Delivery Software
     [not found] <CALfDnQ8aCTywvhqOBkFv3qQOoME9wvTrKbQq8i8PCPOx2iBp=A@mail.gmail.com>
     [not found] ` <CALfDnQ-NihbhS=8C+ZfiKepj5x+Zd5uS2zH82-VrwV40A55s0w@mail.gmail.com>
2018-02-07 10:50   ` (unknown), Solen win
2018-02-02 12:15 (unknown), Robert Vasek
2018-01-29 17:17 (unknown), Jones
2018-01-29 17:17 (unknown), Jones
2018-01-29 17:17 (unknown), Jones
2018-01-29 17:17 (unknown), Jones
2018-01-29 17:17 (unknown), Jones
2018-01-29 16:30 (unknown), Jones
2018-01-29 14:17 (unknown), Jones
2018-01-28 17:06 (unknown), whoisthis TG
2018-01-28 17:01 (unknown), whoisthis TG
2018-01-27 13:48 (unknown), Jones
2018-01-27 13:25 (unknown), Jones
2018-01-25  7:23 (unknown), tirumalareddy marri
2018-01-23 13:54 (unknown), Mr Sheng Li Hung
2018-01-23 13:36 (unknown), Mr Sheng Li Hung
2018-01-16  2:23 (unknown) Jack.Ma
2018-01-16  2:16 (unknown) Jack.Ma
2018-01-11  3:22 (unknown), Active lender@
2018-01-10 10:27 (unknown), TimGuo
2017-12-30  4:37 (unknown), Adam Richter
2017-12-30  2:10 (unknown), Arpit Patel
2017-12-24  9:07 (unknown), Solen win
2017-12-24  2:58 (unknown), 柯弼舜
2017-12-23 15:32 (unknown), 柯弼舜
2017-12-17 17:28 (unknown), Solen win
2017-12-14 16:26 (unknown), Solen win
2017-12-12 16:06 (unknown), Solen win
2017-12-01 14:22 (unknown), Rein Appeldoorn
2017-12-01  2:56 (unknown), Post Office
2017-11-20  2:36 (unknown), Robert Wang
2017-11-19 20:07 (unknown), Mitesh Shah
2017-11-16 10:18 (unknown), Michal Hocko
2017-11-15  9:18 (unknown) nanda_kishore_chinna
2017-11-13  3:13 (unknown), Bounced mail
2017-11-12 15:10 (unknown), Mitesh Shah
2017-11-12 15:09 (unknown), Friedrich Mayrhofer
2017-11-12 15:09 (unknown), Friedrich Mayrhofer
2017-11-05  3:40 (unknown), Solen win
2017-11-01 23:35 (unknown), Roy Cockrum Foundation
2017-10-29  9:46 (unknown), Solen win
2017-10-25 12:10 (unknown), EG
2017-10-23 13:52 (unknown), Intl Agency
2017-10-20  8:42 (unknown), membership
2017-10-20  3:19 (unknown), dengx
2017-10-19 22:54 (unknown), armouralumni
2017-10-17 12:14 (unknown), dengx
2017-10-17  7:00 (unknown), lswedroe
2017-10-17  0:33 (unknown), membership
2017-10-16 19:44 (unknown), iker-KvP5wT2u2U0
2017-10-16  1:23 (unknown), fwkz4811-DoVvmRvd3PAA2dtGD8cC2w
2017-10-15 22:07 (unknown), info
2017-10-15 18:29 (unknown), clasico082
2017-10-15 15:13 (unknown), nelcastellodicarta
2017-10-15 13:01 (unknown), pekka.enne
2017-10-15 12:17 (unknown), Solen win2
2017-10-15 12:04 (unknown), sherrilyn
2017-10-15 11:49 (unknown), edo.hlaca
2017-10-15 11:15 (unknown), cl_luzcc
2017-10-14  6:44 (unknown), Ella Golan
2017-10-13 17:15 (unknown), susan.christian
2017-10-13  6:16 (unknown), nfrankiyamu
2017-10-12 13:53 (unknown), Andrew Clement
2017-10-12 13:15 (unknown), mbalhoff
2017-10-12 11:46 (unknown), sophie.norman
2017-10-12  8:17 (unknown), armouralumni
2017-10-12  3:08 (unknown), iker-KvP5wT2u2U0
2017-10-11 22:32 (unknown), fwkz4811-DoVvmRvd3PAA2dtGD8cC2w
2017-10-11 19:29 (unknown), info
2017-10-11 11:49 (unknown), nelcastellodicarta
2017-10-11  9:19 (unknown), pekka.enne
2017-10-11  8:20 (unknown), sherrilyn
2017-10-11  7:34 (unknown), cl_luzcc
2017-10-10 23:27 (unknown), editor
2017-10-09 15:06 (unknown), jha
2017-10-09 13:19 (unknown), carmen.croonquist
2017-10-09  7:37 (unknown), Michael Lyle
2017-10-09  6:17 (unknown), durrant
2017-10-09  3:44 (unknown), roeper
2017-10-08 23:01 (unknown), susan.christian
2017-10-08 19:00 (unknown), matthias.foerster
2017-10-08 14:15 (unknown), clasico082
2017-10-08 11:08 (unknown), nelcastellodicarta
2017-10-08  9:00 (unknown), pekka.enne
2017-10-08  7:59 (unknown), edo.hlaca
2017-10-08  7:32 (unknown), cl_luzcc
2017-10-07  0:31 (unknown), carmen.croonquist
2017-10-06 11:55 (unknown), info
2017-10-06  8:31 (unknown), smallgroups
2017-10-06  5:16 (unknown), nelcastellodicarta
2017-10-06  2:19 (unknown), sherrilyn
2017-10-06  1:59 (unknown), edo.hlaca
2017-10-06  1:43 (unknown), sophie.norman
2017-10-05 10:20 (unknown), jeffrey.faulkenberg
2017-10-05  7:10 (unknown), mgriffit
2017-10-04 15:33 (unknown), membership
2017-10-04 11:44 (unknown), susan.christian
2017-10-03 13:59 (unknown), nelcastellodicarta
2017-10-03 10:37 (unknown), edo.hlaca
2017-10-03  8:40 (unknown), koopk
2017-10-03  7:38 (unknown), angers
2017-10-03  0:55 (unknown), jbmplupus-Mmb7MZpHnFY
2017-10-03  0:14 (unknown), roeper
2017-10-03  0:03 (unknown), noord-holland
2017-10-02 20:31 (unknown), kchristopher
2017-10-02 18:06 (unknown), dengx
2017-10-02 18:00 (unknown), Solen win2
2017-10-02 17:38 (unknown), nbensoncole81
2017-10-02 15:35 (unknown), nfrankiyamu
2017-09-29 21:29 (unknown), info
2017-09-29 18:01 (unknown), clasico082
2017-09-29 15:42 (unknown), noord-holland
2017-09-29 14:47 (unknown), nelcastellodicarta
2017-09-29 11:49 (unknown), roeper
2017-09-29 11:28 (unknown), cl_luzcc
2017-09-29  7:44 (unknown), amin
2017-09-29  3:06 (unknown), jha
2017-09-28 22:59 (unknown), rlm85310
2017-09-28 15:08 (unknown), amin
2017-09-27 19:30 (unknown), nbensoncole81
2017-09-27 19:12 (unknown), rlm85310
2017-09-27 17:41 (unknown), Michael Lyle
2017-09-22 19:34 (unknown), John Michael
2017-09-22  8:41 (unknown), Adrian Gillian Bayford
2017-09-22  3:39 (unknown), service
2017-09-22  1:55 (unknown), dengx
2017-09-21  7:47 (unknown), MAILER-DAEMON
2017-09-20  1:01 (unknown), ninfo
2017-09-15 17:30 (unknown), noreply
2017-09-15 17:29 (unknown), noreply
2017-09-12 19:45 (unknown), edo.hlaca
2017-09-12 19:16 (unknown), cl_luzcc
2017-09-11 20:10 (unknown), roeper
2017-09-11 19:35 (unknown) Helge Deller
2017-09-10  6:22 (unknown), Youichi Kanno
2017-09-07  7:05 (unknown), tabiadhawatef
2017-09-07  4:02 (unknown), dengx
2017-09-05 23:34 (unknown), kkaplanidou
2017-09-05 18:38 (unknown), john.dahlberg
2017-09-05 18:07 (unknown), bfoster
2017-09-05 16:31 (unknown), mgriffit
2017-09-05 14:02 (unknown), ecaterinasuciu09
2017-09-05 11:11 (unknown), inn
2017-09-05  2:43 (unknown), xb028930336
2017-09-05  1:51 (unknown), halinajan-4Uo9UdwAbX8
2017-09-04 23:46 (unknown), sterrenplan.kampen
2017-09-04 12:17 (unknown), noord-holland
2017-09-04  5:14 (unknown), nelcastellodicarta
2017-09-04  2:13 (unknown), x1kn8fk
2017-09-03 22:54 (unknown), sherrilyn
2017-09-03 21:51 (unknown), xb028930336
2017-09-03 21:26 (unknown), cl_luzcc
2017-09-02  6:40 (unknown), simon.a.t.hardy
2017-09-02  2:47 (unknown), nbensoncole81
2017-09-02  2:39 (unknown), een
2017-09-02  2:35 (unknown), jbmplupus-Mmb7MZpHnFY
2017-09-02  1:59 (unknown), danielle.picarda2
2017-09-02  0:58 (unknown), smallgroups
2017-09-01 22:51 (unknown), zumbalisa
2017-09-01 21:57 (unknown), umpvav-YDxpq3io04c
2017-09-01 21:32 (unknown), nenep
2017-09-01 20:58 (unknown), wvhyvcm.abyxg
2017-09-01 19:52 (unknown), sunaina
2017-09-01 15:00 (unknown), ujagu8185-Re5JQEeQqe8AvxtiuMwx3w
2017-09-01 11:40 (unknown), witt.kohl
2017-09-01  8:16 (unknown), financialaid
2017-09-01  6:21 (unknown), zita.latex
2017-09-01  4:05 (unknown), andrewf
2017-09-01  2:30 (unknown), robert.berry
2017-08-31 15:40 (unknown), sterrenplan.kampen
2017-08-31 12:23 (unknown), mark.robinson
2017-08-31  8:20 (unknown), jessica.jones-PnMVE5gNl/Vkbu+0n/iG1Q
2017-08-31  4:52 (unknown), archerrp
2017-08-31  1:39 (unknown) m.wierczynska
2017-08-30 19:49 (unknown), susan.christian
2017-08-30  1:37 (unknown), municlerk
2017-08-29  3:02 (unknown) catherine.verge
2017-08-28 17:29 (unknown), befragung
2017-08-28 13:22 (unknown), dengx
2017-08-28  6:48 (unknown), patientcentral
2017-08-26 14:48 (unknown), nfrankiyamu
2017-08-26  5:43 (unknown), carol.dallstream-WaM/PvcBqAo
2017-08-25  0:32 (unknown), agiva
2017-08-23  7:23 (unknown), Xuehan Xu
2017-08-22 13:31 (unknown), vinnakota chaitanya
2017-08-20  2:58 (unknown), Solen win2
2017-08-18 17:42 (unknown) Rajneesh Bhardwaj
2017-08-17 21:36 (unknown), Adam Richter
2017-08-16  5:46 (unknown), kim.frederiksen
2017-08-16  2:03 (unknown), xa0ajutor
2017-08-15 17:31 (unknown), nnarroyo623
2017-08-15 17:30 (unknown), simon.a.t.hardy
2017-08-15 14:45 (unknown), een
2017-08-15 11:16 (unknown), wvhyvcm.abyxg
2017-08-15  6:50 (unknown), demorton
2017-08-15  6:08 (unknown), eumann
2017-08-15  4:40 (unknown), mitch_128
2017-08-15  3:38 (unknown), rueggemann
2017-08-15  2:57 (unknown), nfrankiyamu
2017-08-15  1:55 (unknown), richard
2017-08-14 19:30 (unknown), sterrenplan.kampen
2017-08-14 17:38 (unknown), amin
2017-08-14 16:53 (unknown), durrant
2017-08-14 14:57 (unknown), linwoodrvsales
2017-08-13 15:17 (unknown), bunny43200
2017-08-12  1:27 (unknown), nenep
2017-08-12  1:11 (unknown), lizdebeth_
2017-08-11 22:09 (unknown), Chris
2017-08-11 17:28 (unknown), rhsinfo
2017-08-11  9:18 (unknown), jonathan.malihan
2017-08-11  6:14 (unknown), администратор 
2017-08-11  6:14 (unknown), администратор 
2017-08-11  6:14 (unknown), администратор 
2017-08-11  4:59 (unknown), Administrator
2017-08-11  4:57 (unknown), nenep
2017-08-11  4:42 (unknown), lizdebeth_
2017-08-10 21:36 (unknown), shriyashah
2017-08-10 21:08 (unknown), mitch_128
2017-08-10 18:16 (unknown), simon.a.t.hardy
2017-08-10  9:38 (unknown), asn-request-tfHHCSmtYoI
2017-08-10  3:32 (unknown), kholloway
2017-08-10  0:03 (unknown), michele
2017-08-09 23:53 (unknown), nenep
2017-08-09 23:15 (unknown), wvhyvcm.abyxg
2017-08-09 23:06 (unknown), editor
2017-08-09 21:55 (unknown), horizon
2017-08-09 20:25 (unknown), sterrenplan.kampen
2017-08-09 19:40 (unknown), tchidrenplytoo
2017-08-09 10:20 (unknown), системы администратор
2017-08-09 10:20 (unknown), системы администратор
2017-08-09 10:20 (unknown), системы администратор
2017-08-09  0:04 (unknown), h.piontek
2017-08-08 21:31 (unknown), michele
2017-08-08 20:55 (unknown), h.gerritsen12
2017-08-08 19:40 (unknown), citydesk
2017-08-08 19:14 (unknown), eaya
2017-08-08 17:09 (unknown), tchidrenplytoo
2017-08-08 14:49 (unknown) catherine.verge
2017-08-08  5:57 (unknown), befragung
2017-08-08  4:57 (unknown), wesley.sydnor
2017-08-07 23:50 (unknown), wvhyvcm.abyxg
2017-08-07 21:05 (unknown), sibolt.mulder-b60u5d1xRcFWk0Htik3J/w
2017-08-07 20:25 (unknown), editor
2017-08-07 19:03 (unknown), sm-yT/95SBIOhs
2017-08-07 18:42 (unknown), susan.christian
2017-08-07 18:38 (unknown), mitch_128
2017-08-07  7:38 (unknown), simon.a.t.hardy
2017-08-07  4:49 (unknown), sorbisches.internat
2017-08-06 23:55 (unknown), webmaster
2017-08-05 14:08 (unknown), simon.a.t.hardy
2017-08-04 23:59 (unknown), editor
2017-08-04  5:04 (unknown), durrant
2017-08-03 14:01 (unknown), Nora Johnson
2017-08-03  5:21 (unknown), Houston
2017-08-02 18:05 (unknown), Angela-63XfWfWBA5k
2017-08-02 17:31 (unknown), Edmond
2017-08-02 17:07 (unknown), Margery
2017-08-02 15:40 (unknown), Erma
2017-08-02 13:58 (unknown), Will
2017-08-02 11:47 (unknown), armiksanaye
2017-08-02  4:12 (unknown), Administrator
2017-08-02  3:45 (unknown), системы администратор
2017-08-02  3:45 (unknown), системы администратор
2017-08-02  3:45 (unknown), системы администратор
2017-08-02  1:19 (unknown), nenep
2017-08-02  1:05 (unknown), lizdebeth_
2017-08-02  0:36 (unknown), richard
2017-08-01 21:03 (unknown), editor
2017-08-01 19:35 (unknown), anderslindgaard
2017-08-01 16:33 (unknown), sterrenplan.kampen
2017-08-01 14:53 (unknown), Angela H. Whiteman
2017-08-01 12:35 (unknown), jha
2017-08-01 10:07 (unknown) Chris Ruehl
2017-08-01  4:40 (unknown), durrant
2017-08-01  1:35 (unknown), amin
2017-08-01  1:35 (unknown), xa0ajutor
2017-07-31 20:14 (unknown), x1kn8fk
2017-07-31 18:00 (unknown), robert.berry
2017-07-31 16:54 (unknown), bunny43200
2017-07-31 14:52 (unknown), horizon
2017-07-31 13:15 (unknown), sibolt.mulder-b60u5d1xRcFWk0Htik3J/w
2017-07-31 11:49 (unknown), kchristopher
2017-07-31 11:33 (unknown), rhsinfo
2017-07-31 10:50 (unknown), susan.christian
2017-07-30 23:33 (unknown), daven bango
2017-07-28 16:02 (unknown), gdahl
2017-07-28  7:44 (unknown), robert.berry
2017-07-27 13:00 (unknown), nfrankiyamu
2017-07-27  5:01 (unknown), hp
2017-07-27  2:16 (unknown) ceph-devel
2017-07-27  2:14 (unknown) ceph-devel
2017-07-26 20:45 (unknown), een
2017-07-26 20:08 (unknown), municlerk
2017-07-26 14:20 (unknown), sterrenplan.kampen
2017-07-26 11:39 (unknown), chrisbi_anelyst
2017-07-26 10:32 (unknown), Solen win2
2017-07-26  6:36 (unknown), nenep
2017-07-26  4:42 (unknown), horizon
2017-07-25 23:24 (unknown), h.gerritsen12
2017-07-25 20:41 (unknown), sorbisches.internat
2017-07-25 20:01 (unknown), hp
2017-07-25 18:53 (unknown), sibolt.mulder-b60u5d1xRcFWk0Htik3J/w
2017-07-25 18:45 (unknown), x1kn8fk
2017-07-25 16:36 (unknown), susan.christian
2017-07-25 10:27 (unknown), nick_c_huang
2017-07-23 23:48 (unknown), miteshriya
2017-07-20 18:43 (unknown), tbinh.minhnd
2017-07-20  3:55 (unknown), mfr-6k8blvha/+BqlCpFK1mnLg
2017-07-19 11:11 (unknown), rhsinfo
2017-07-18 20:36 (unknown), bunny43200
2017-07-18 20:28 (unknown), lizdebeth_
2017-07-18 20:17 (unknown), brian
2017-07-18 15:56 (unknown), bfoster
2017-07-18 12:45 (unknown), mitch_128
2017-07-18  6:22 (unknown), sorbisches.internat
2017-07-18  5:45 (unknown), h.gerritsen12
2017-07-18  4:50 (unknown), ying.huang-ral2JQCrhuEAvxtiuMwx3w
2017-07-18  4:32 (unknown), citydesk
2017-07-18  4:09 (unknown), armouralumni
2017-07-17 23:02 (unknown), h.piontek
2017-07-17 21:54 (unknown), citydesk
2017-07-17 17:30 (unknown), richard
2017-07-17 15:42 (unknown), tchidrenplytoo
2017-07-17 15:31 (unknown), kathleen.gilbert
2017-07-17  1:20 (unknown), tchidrenplytoo
2017-07-17  1:09 (unknown), kathleen.gilbert
2017-07-16  7:25 (unknown), kim.frederiksen
2017-07-15 12:30 (unknown), Huaisheng HS1 Ye
2017-07-13  4:49 (unknown), delaware.orders
2017-07-13  3:37 (unknown), befragung
2017-07-12 19:24 (unknown), patientcentral
2017-07-12 11:22 (unknown), sterrenplan.kampen
2017-07-11 16:39 (unknown), indulge-HCInDj6vYHrk4FeknX8I/ZqQE7yCjDx5
2017-07-10 22:07 (unknown), jacqueline.pike
2017-07-10 21:53 (unknown), agiva
2017-07-10 21:37 (unknown), roeper
2017-07-10 12:51 (unknown), lucia.germino
2017-07-10 12:43 (unknown), brian
2017-07-10 10:06 (unknown), alters
2017-07-10  3:45 (unknown), системы администратор
2017-07-10  3:45 (unknown), системы администратор
2017-07-10  3:45 (unknown), системы администратор
2017-07-09 23:29 (unknown), brian
2017-07-09 23:19 (unknown), Corporate Lenders
2017-07-09 20:52 (unknown), iker-KvP5wT2u2U0
2017-07-09 13:02 (unknown), smallgroups
2017-07-08 18:22 (unknown), Alfred chow
2017-07-08 17:13 (unknown), horizon
2017-07-07  1:37 (unknown), zumbalisa
2017-07-07  0:30 (unknown), amin
2017-07-06 17:35 (unknown), simon.a.t.hardy
2017-07-06 14:11 (unknown), een
2017-07-06  6:10 (unknown), armouralumni
2017-07-05 21:18 (unknown), een
2017-07-05 15:57 (unknown), sibolt.mulder-b60u5d1xRcFWk0Htik3J/w
2017-07-05 15:15 (unknown), armouralumni
2017-07-05  8:06 (unknown), koopk
2017-07-05  6:55 (unknown), agiva
2017-07-05  6:42 (unknown), angers
2017-07-05  0:06 (unknown), michele
2017-07-04 22:53 (unknown), j.lahoda-aRb0bU7PRFPrBKCeMvbIDA
2017-07-04 19:53 (unknown), tchidrenplytoo
2017-07-04 18:35 (unknown), noord-holland
2017-07-04 10:50 (unknown), h.gerritsen12
2017-07-04  8:52 (unknown), citydesk
2017-07-04  6:01 (unknown), xa0ajutor
2017-07-04  4:17 (unknown), rueggemann
2017-07-03 13:54 (unknown), sm-yT/95SBIOhs
2017-07-03 13:30 (unknown), roeper
2017-07-03 12:43 (unknown), mitch_128
2017-07-03  4:44 (unknown), beautyink
2017-07-03  1:28 (unknown), h.piontek
2017-07-02 20:26 (unknown), tabiadhawatef
2017-07-02 18:44 (unknown), tchidrenplytoo
2017-07-02 10:14 (unknown), armouralumni
2017-07-01 11:36 (unknown), p.mueller-spz-hgw-Mmb7MZpHnFY
2017-06-30  8:29 (unknown), sibolt.mulder-b60u5d1xRcFWk0Htik3J/w
2017-06-30  1:14 (unknown), paloma.depping
2017-06-29 13:46 (unknown), kholloway
2017-06-29 12:20 (unknown), The Post Office
2017-06-29 10:39 (unknown), lizdebeth_
2017-06-28 14:22 (unknown), tchidrenplytoo
2017-06-28  3:56 (unknown), системы администратор
2017-06-28  3:56 (unknown), системы администратор
2017-06-28  3:56 (unknown), системы администратор
2017-06-28  3:22 (unknown), Administrator
2017-06-27  7:15 (unknown), noord-holland
2017-06-27  7:12 (unknown), loisc07
2017-06-27  0:08 (unknown), h.gerritsen12
2017-06-26 22:58 (unknown), Anders Lind
2017-06-26 22:14 (unknown), citydesk
2017-06-26 17:51 (unknown), rueggemann
2017-06-26 16:10 (unknown), susan.christian
2017-06-26 15:03 (unknown), richard
2017-06-26 10:22 (unknown), p.mueller-spz-hgw-Mmb7MZpHnFY
2017-06-26  9:15 (unknown), beautyink
2017-06-26  5:21 (unknown) Leon Romanovsky
2017-06-25 20:10 (unknown), h.gerritsen12
2017-06-25 18:13 (unknown), citydesk
2017-06-25 13:23 (unknown), rueggemann
2017-06-25 10:21 (unknown), richard
2017-06-25  5:19 (unknown), nbensoncole81
2017-06-25  5:14 (unknown), archerrp
2017-06-25  4:47 (unknown), h.gerritsen12
2017-06-25  3:57 (unknown), nfrankiyamu
2017-06-25  2:39 (unknown), bflove1-ntQ8I44N4zM
2017-06-24 19:38 (unknown), richard
2017-06-24 15:03 (unknown), archerrp
2017-06-24  8:07 (unknown), j.lahoda-aRb0bU7PRFPrBKCeMvbIDA
2017-06-24  2:32 (unknown), h.gerritsen12
2017-06-24  0:35 (unknown), citydesk
2017-06-24  0:04 (unknown), hastpass
2017-06-23 19:27 (unknown), armouralumni
2017-06-23 17:22 (unknown), richard
2017-06-23 12:26 (unknown), archerrp
2017-06-23  6:09 (unknown), Administrator
2017-06-23  4:50 (unknown), nkosuta-f+iqBESB6gc
2017-06-23  2:49 (unknown), mdavis
2017-06-23  1:43 (unknown), horizon
2017-06-22 20:24 (unknown), koopk
2017-06-22 20:22 (unknown), junplzen
2017-06-22 13:22 (unknown), jeffrey.faulkenberg
2017-06-22  5:49 (unknown), noord-holland
2017-06-22  2:13 (unknown), ecaterinasuciu09
2017-06-21  7:43 (unknown), koopk
2017-06-21  7:32 (unknown), tjcrewvolcoordinator-Re5JQEeQqe8AvxtiuMwx3w
2017-06-21  6:23 (unknown), chrisbi_anelyst
2017-06-21  6:16 (unknown), angers
2017-06-21  4:40 (unknown), kholloway
2017-06-20 18:45 (unknown), roeper
2017-06-20 17:50 (unknown), editor
2017-06-20 16:31 (unknown), nfrankiyamu
2017-06-20  6:29 (unknown), xa0ajutor
2017-06-20  0:47 (unknown), durrant
2017-06-19 19:58 (unknown), tjcrewvolcoordinator-Re5JQEeQqe8AvxtiuMwx3w
2017-06-19 18:46 (unknown), chrisbi_anelyst
2017-06-19 16:53 (unknown), armouralumni
2017-06-19  9:36 (unknown), susan.christian
2017-06-18 14:27 (unknown), xa0ajutor
2017-06-18 13:58 (unknown), membership
2017-06-17 22:46 (unknown), rhsinfo
2017-06-16 14:46 (unknown), roeper
2017-06-15 17:35 (unknown), jeffrey.faulkenberg
2017-06-15 14:56 (unknown), john.dahlberg
2017-06-15  8:37 (unknown), ecaterinasuciu09
2017-06-14 22:19 (unknown), muirs
2017-06-14 21:25 (unknown), koopk
2017-06-14 20:41 (unknown), angers
2017-06-14 19:31 (unknown), kholloway
2017-06-14 16:39 (unknown), nfrankiyamu
2017-06-14 12:27 (unknown), board
2017-06-14 12:26 (unknown), sibolt.mulder-b60u5d1xRcFWk0Htik3J/w
2017-06-14 11:42 (unknown), sophie.norman
2017-06-14 10:27 (unknown), susan.christian
2017-06-14  1:06 (unknown), durrant
2017-06-13 21:38 (unknown), douille.l
2017-06-13 11:59 (unknown), susan.christian
2017-06-13 10:15 (unknown), nenep
2017-06-13  9:59 (unknown), lizdebeth_
2017-06-13  9:35 (unknown), wvhyvcm.abyxg
2017-06-13  8:14 (unknown), horizon
2017-06-13  4:53 (unknown), roeper
2017-06-13  4:35 (unknown), ujagu8185-Re5JQEeQqe8AvxtiuMwx3w
2017-06-13  4:22 (unknown), mitch_128
2017-06-12 21:36 (unknown), nbensoncole81
2017-06-12 17:13 (unknown), armiksanaye
2017-06-12 16:44 (unknown), nfrankiyamu
2017-06-12 15:02 (unknown), amin
2017-06-12 10:50 (unknown), sibolt.mulder-b60u5d1xRcFWk0Htik3J/w
2017-06-12  7:28 (unknown), webmaster
2017-06-11 16:35 (unknown), mitch_128
2017-06-11  7:27 (unknown), roeper
2017-06-11  0:20 (unknown), service
2017-06-10 21:10 (unknown), mbalhoff
2017-06-10 20:24 (unknown), board
2017-06-10 14:34 (unknown), kbennett
2017-06-10 13:33 (unknown), iker-KvP5wT2u2U0
2017-06-10  7:07 (unknown), Youichi Kanno
2017-06-10  5:53 (unknown), jacqueline.pike
2017-06-10  5:29 (unknown), agiva
2017-06-09 19:04 (unknown), armouralumni
2017-06-09 18:57 (unknown), editor
2017-06-09 17:38 (unknown), nfrankiyamu
2017-06-09 10:47 (unknown), tjcrewvolcoordinator-Re5JQEeQqe8AvxtiuMwx3w
2017-06-09  8:02 (unknown), kholloway
2017-06-09  4:30 (unknown), citydesk
2017-06-09  3:35 (unknown), office
2017-06-09  2:06 (unknown), rueggemann
2017-06-09  1:31 (unknown), durrant
2017-06-09  0:39 (unknown), susan.christian
2017-06-09  0:34 (unknown), richard
2017-06-08 18:00 (unknown), beautyink
2017-06-08 15:18 (unknown), junplzen
2017-06-08 14:09 (unknown), service
2017-06-08 12:51 (unknown), koopk
2017-06-08  5:00 (unknown), noord-holland
2017-06-08  3:14 (unknown), kgbok.kezyhumh
2017-06-07  3:19 (unknown), lucia.germino
2017-06-06 23:46 (unknown), mdavis
2017-06-06 20:36 (unknown), dengx
2017-06-06  7:19 (unknown), From Lori J. Robinson
2017-06-06  7:19 (unknown), From Lori J. Robinson
2017-06-06  7:19 (unknown), From Lori J. Robinson
2017-06-05 17:32 (unknown), armouralumni
2017-06-05  5:43 (unknown), h.gerritsen12
2017-06-05  4:30 (unknown), citydesk
2017-06-05  1:08 (unknown), rueggemann
2017-06-04 19:55 (unknown), archerrp
2017-06-03  7:17 (unknown), nbensoncole81
2017-06-03  5:45 (unknown), nfrankiyamu
2017-06-02  8:02 (unknown), jessica.jones-PnMVE5gNl/Vkbu+0n/iG1Q
2017-06-01 20:40 (unknown), nbensoncole81
2017-06-01  2:25 (unknown), kbennett
2017-06-01  1:55 (unknown), cdevries
2017-06-01  0:43 (unknown), armouralumni
2017-05-31 14:53 (unknown), tjcrewvolcoordinator-Re5JQEeQqe8AvxtiuMwx3w
2017-05-31 11:36 (unknown), p.mueller-spz-hgw-Mmb7MZpHnFY
2017-05-26 16:33 (unknown) Anderson McEnany <
2017-05-26 16:33 (unknown) Anderson McEnany <
2017-05-23 22:44 (unknown), noord-holland
2017-05-23 16:24 (unknown), agiva
2017-05-23  9:36 (unknown), bendis.michal
2017-05-23  8:42 (unknown), delaware.orders
2017-05-23  4:53 (unknown), nfrankiyamu
2017-05-23  2:19 (unknown), mdavis
2017-05-22 22:32 (unknown), patientcentral
2017-05-22 20:39 (unknown), horizon
2017-05-22 16:10 (unknown), mitch_128
2017-05-21 20:35 (unknown), armiksanaye
2017-05-21 16:36 (unknown), x1kn8fk
2017-05-21 13:56 (unknown), sibolt.mulder-b60u5d1xRcFWk0Htik3J/w
2017-05-21 11:38 (unknown), susan.christian
2017-05-21 11:13 (unknown), mariobronti
2017-05-21  9:17 (unknown), jacqueline.pike
2017-05-21  8:55 (unknown), agiva
2017-05-21  8:42 (unknown), brucet
2017-05-20 21:16 (unknown), h.gerritsen12
2017-05-20 20:00 (unknown), citydesk
2017-05-20 18:58 (unknown), office
2017-05-20 17:45 (unknown), counselling-30L6jp03H7UtpYsHHOQ6Llpr/1R2p/CL
2017-05-20 16:22 (unknown), alters
2017-05-20 14:29 (unknown), cv
2017-05-20 12:27 (unknown), ajae
2017-05-20 11:47 (unknown), john.dahlberg
2017-05-20  9:40 (unknown), mgriffit
2017-05-20  8:14 (unknown), ecaterinasuciu09
2017-05-20  1:09 (unknown), board
2017-05-20  0:40 (unknown), sophie.norman
2017-05-20  0:26 (unknown), brian
2017-05-19 16:59 (unknown), zumbalisa
2017-05-19 15:35 (unknown), susan.christian
2017-05-19 14:51 (unknown), citydesk
2017-05-19 13:31 (unknown), office
2017-05-19 11:45 (unknown), counselling-30L6jp03H7UtpYsHHOQ6Llpr/1R2p/CL
2017-05-19  6:45 (unknown), j.lahoda-aRb0bU7PRFPrBKCeMvbIDA
2017-05-19  4:32 (unknown), archerrp
2017-05-18 19:22 (unknown), lucia.germino
2017-05-18 16:47 (unknown), susan.christian
2017-05-18 14:13 (unknown), agiva
2017-05-18 13:41 (unknown), alters
2017-05-18 13:40 (unknown), hp
2017-05-16  3:06 (unknown), armiksanaye
2017-05-14  3:19 (unknown), unixkeeper
2017-05-04 13:20 (unknown), Steve French
2017-05-01 18:59 [PATCHv2 1/1] IB/ipoib: add get_settings in ethtool Doug Ledford
     [not found] ` <1493665155.3041.186.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2017-05-04  5:24   ` (unknown), Zhu Yanjun
2017-04-28  8:36 (unknown), администратор
2017-04-28  8:36 (unknown), администратор
2017-04-28  8:36 (unknown), администратор
2017-04-28  8:20 (unknown), Anatolij Gustschin
2017-04-26  7:36 (unknown), glolariu
2017-04-21 17:54 (unknown), Mr.Jerry Smith
2017-04-21 17:44 (unknown), Mr.Jerry Smith
2017-04-21 17:24 (unknown), Mr.Jerry Smith
2017-04-21 17:07 (unknown), Mr.Jerry Smith
2017-04-21 17:06 (unknown), Mr.Jerry Smith
2017-04-21 16:59 (unknown) Mr.Jerry Smith
2017-04-21 11:49 (unknown), kathleen.gilbert
2017-04-21  9:51 (unknown), Kredit
2017-04-21  9:25 (unknown), delaware.orders
2017-04-21  8:36 (unknown), joseph.x.hronec
2017-04-21  7:38 (unknown), wesley.sydnor
2017-04-20 12:28 (unknown), h.gerritsen12
2017-04-20  6:33 (unknown), rueggemann
2017-04-19 20:46 (unknown), hp
2017-04-19 16:38 (unknown), amin
2017-04-18 16:05 (unknown), rlm85310
2017-04-18 10:57 (unknown) catherine.verge
2017-04-18  2:53 (unknown), h.piontek
2017-04-17 18:00 (unknown), j.lahoda-aRb0bU7PRFPrBKCeMvbIDA
2017-04-17 15:20 (unknown), tchidrenplytoo
2017-04-17  7:56 (unknown), lucia.germino
2017-04-17  4:06 (unknown), nkosuta-f+iqBESB6gc
2017-04-17  3:38 (unknown), kgbok.kezyhumh
2017-04-17  3:09 (unknown), bunny43200
2017-04-17  2:26 (unknown), wvhyvcm.abyxg
2017-04-17  2:06 (unknown), rlm85310
2017-04-17  0:43 (unknown), John Ewalt
2017-04-16 23:57 (unknown), muirs
2017-04-16 23:02 (unknown), brian
2017-04-16 21:22 (unknown), ujagu8185-Re5JQEeQqe8AvxtiuMwx3w
2017-04-16 20:59 (unknown), mitch_128
2017-04-16 19:08 (unknown), athgregory
2017-04-16 18:32 (unknown), nathalie.colle
2017-04-16 18:30 (unknown), r67
2017-04-16 17:49 (unknown), zem.uchastok
2017-04-16 17:44 (unknown), bkjf
2017-04-16 17:41 (unknown) askeeta
2017-04-16 16:37 (unknown), bfoster
2017-04-16 16:31 (unknown), a.skucha
2017-04-16 15:48 (unknown), redbeardcharters
2017-04-16  8:52 (unknown), geir.nuland
2017-04-16  8:21 (unknown), jha
2017-04-16  3:33 (unknown), ohnesorge-wiek
2017-04-16  3:17 (unknown), resson-epfaOiJH9AY
2017-04-15 15:00 (unknown), jbmplupus-Mmb7MZpHnFY
2017-04-15 14:16 (unknown), demorton
2017-04-15 13:53 (unknown), smallgroups
2017-04-13 15:58 (unknown), Scott Ellentuch
2017-04-10 11:47 (unknown), office
2017-04-10 10:18 (unknown), rueggemann
2017-04-10  8:37 (unknown), kkaplanidou
2017-04-10  6:51 (unknown), kathleen.gilbert
2017-04-10  5:46 (unknown), archerrp
2017-04-10  3:30 (unknown), hp
2017-04-10  0:41 (unknown), amin
2017-04-09 22:07 (unknown) askeeta
2017-04-09 22:03 (unknown), zem.uchastok
2017-04-09 21:15 (unknown), ujagu8185-Re5JQEeQqe8AvxtiuMwx3w
2017-04-09 20:48 (unknown), simon.a.t.hardy
2017-04-09 15:30 (unknown), jha
2017-04-09 14:11 (unknown), carmen.croonquist
2017-04-09  6:12 (unknown), roeper
2017-04-09  2:11 (unknown), jacqueline.pike
2017-04-09  0:27 (unknown), simon.a.t.hardy
2017-04-08 19:20 (unknown), jbmplupus-Mmb7MZpHnFY
2017-04-06 19:09 (unknown), David Buckley
2017-04-06 14:05 (unknown), jacqueline.pike
2017-04-06 13:43 (unknown), agiva
2017-04-06 11:45 (unknown), j.lahoda-aRb0bU7PRFPrBKCeMvbIDA
2017-04-06  8:19 (unknown), bendis.michal
2017-04-06  6:03 (unknown), bendis.michal
2017-04-05 18:10 (unknown), alters
2017-04-05 17:30 (unknown), sekretariat.mzagorski-40QDpL200RxmR6Xm/wNWPw
2017-04-05 17:06 (unknown), kgbok.kezyhumh
2017-04-05 16:53 (unknown), dowen
2017-04-05 16:35 (unknown), bunny43200
2017-04-04 19:31 (unknown), Kristi Nikolla
2017-04-03  6:14 (unknown), Adrian Gillian Bayford
2017-04-03  6:14 (unknown), Adrian Gillian Bayford

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.