android_kernel_motorola_sm6225/drivers
Duan Fugang-B38611 d842a31f12 net:fec: fix WARNING caused by lack of calls to dma_mapping_error()
The driver fails to check the results of DMA mapping and results in
the following warning: (with kernel config "CONFIG_DMA_API_DEBUG" enable)

------------[ cut here ]------------
WARNING: at lib/dma-debug.c:937 check_unmap+0x43c/0x7d8()
fec 2188000.ethernet: DMA-API: device driver failed to check map
error[device address=0x00000000383a8040] [size=2048 bytes] [mapped as single]

Modules linked in:
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.10.17-16827-g9cdb0ba-dirty #188
[<80013c4c>] (unwind_backtrace+0x0/0xf8) from [<80011704>] (show_stack+0x10/0x14)
[<80011704>] (show_stack+0x10/0x14) from [<80025614>] (warn_slowpath_common+0x4c/0x6c)
[<80025614>] (warn_slowpath_common+0x4c/0x6c) from [<800256c8>] (warn_slowpath_fmt+0x30/0x40)
[<800256c8>] (warn_slowpath_fmt+0x30/0x40) from [<8026bfdc>] (check_unmap+0x43c/0x7d8)
[<8026bfdc>] (check_unmap+0x43c/0x7d8) from [<8026c584>] (debug_dma_unmap_page+0x6c/0x78)
[<8026c584>] (debug_dma_unmap_page+0x6c/0x78) from [<8038049c>] (fec_enet_rx_napi+0x254/0x8a8)
[<8038049c>] (fec_enet_rx_napi+0x254/0x8a8) from [<804dc8c0>] (net_rx_action+0x94/0x160)
[<804dc8c0>] (net_rx_action+0x94/0x160) from [<8002c758>] (__do_softirq+0xe8/0x1d0)
[<8002c758>] (__do_softirq+0xe8/0x1d0) from [<8002c8e8>] (do_softirq+0x4c/0x58)
[<8002c8e8>] (do_softirq+0x4c/0x58) from [<8002cb50>] (irq_exit+0x90/0xc8)
[<8002cb50>] (irq_exit+0x90/0xc8) from [<8000ea88>] (handle_IRQ+0x3c/0x94)
[<8000ea88>] (handle_IRQ+0x3c/0x94) from [<8000855c>] (gic_handle_irq+0x28/0x5c)
[<8000855c>] (gic_handle_irq+0x28/0x5c) from [<8000de00>] (__irq_svc+0x40/0x50)
Exception stack(0x815a5f38 to 0x815a5f80)
5f20:                                                       815a5f80 3b9aca00
5f40: 0fe52383 00000002 0dd8950e 00000002 81e7b080 00000000 00000000 815ac4d8
5f60: 806032ec 00000000 00000017 815a5f80 80059028 8041fc4c 60000013 ffffffff
[<8000de00>] (__irq_svc+0x40/0x50) from [<8041fc4c>] (cpuidle_enter_state+0x50/0xf0)
[<8041fc4c>] (cpuidle_enter_state+0x50/0xf0) from [<8041fd94>] (cpuidle_idle_call+0xa8/0x14c)
[<8041fd94>] (cpuidle_idle_call+0xa8/0x14c) from [<8000edac>] (arch_cpu_idle+0x10/0x4c)
[<8000edac>] (arch_cpu_idle+0x10/0x4c) from [<800582f8>] (cpu_startup_entry+0x60/0x130)
[<800582f8>] (cpu_startup_entry+0x60/0x130) from [<80bc7a48>] (start_kernel+0x2d0/0x328)
[<80bc7a48>] (start_kernel+0x2d0/0x328) from [<10008074>] (0x10008074)
---[ end trace c6edec32436e0042 ]---

Because dma-debug add new interfaces to debug dma mapping errors, pls refer
to: http://lwn.net/Articles/516640/

After dma mapping, it must call dma_mapping_error() to check mapping error,
otherwise the map_err_type alway is MAP_ERR_NOT_CHECKED, check_unmap() define
the mapping is not checked and dump the error msg. So,add dma_mapping_error()
checking to fix the WARNING

And RX DMA buffers are used repeatedly and the driver copies it into an skb,
fec_enet_rx() should not map or unmap, use dma_sync_single_for_cpu()/dma_sync_single_for_device()
instead of dma_map_single()/dma_unmap_single().

There have another potential issue:  fec_enet_rx() passes the DMA address to __va().
Physical and DMA addresses are *not* the same thing. They may differ if the device
is behind an IOMMU or bounce buffering was required, or just because there is a fixed
offset between the device and host physical addresses. Also fix it in this patch.

=============================================
V2: add net_ratelimit() to limit map err message.
    use dma_sync_single_for_cpu() instead of dma_map_single().
    fix the issue that pass DMA addresses to __va() to get virture address.
V1: initial send
=============================================

Signed-off-by: Fugang Duan <B38611@freescale.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2013-11-14 16:37:33 -05:00
..
accessibility
acpi Merge branch 'x86-mce-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2013-11-12 11:16:44 +09:00
amba
ata Merge branch 'for-3.13' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata 2013-11-13 15:18:22 +09:00
atm
auxdisplay
base Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2013-11-13 15:34:18 +09:00
bcma Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2013-11-13 17:40:34 +09:00
block Via Paul Walmsley <paul@pwsan.com>: 2013-10-28 14:39:03 -07:00
bluetooth Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth 2013-11-05 15:58:21 -05:00
bus ARM: driver updates for 3.13 2013-11-11 17:05:37 +09:00
cdrom
char Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2013-11-13 17:40:34 +09:00
clk DeviceTree updates for 3.13. This is a bit larger pull request than 2013-11-12 16:52:17 +09:00
clocksource clocksource: sun4i: remove IRQF_DISABLED 2013-10-22 22:36:50 +02:00
connector
cpufreq DeviceTree updates for 3.13. This is a bit larger pull request than 2013-11-12 16:52:17 +09:00
cpuidle
crypto powerpc: add missing explicit OF includes for ppc 2013-11-11 09:10:50 -06:00
dca
devfreq
dio
dma drivers/dma/mmp_tdma.c: use gen_pool_dma_alloc() to allocate descriptor 2013-11-13 12:09:23 +09:00
edac DeviceTree updates for 3.13. This is a bit larger pull request than 2013-11-12 16:52:17 +09:00
eisa
extcon
firewire
firmware Merge branch 'x86-mce-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2013-11-12 11:16:44 +09:00
fmc
gpio DeviceTree updates for 3.13. This is a bit larger pull request than 2013-11-12 16:52:17 +09:00
gpu Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2013-11-13 15:34:18 +09:00
hid Staging driver update for 3.13-rc1 2013-11-07 15:07:58 +09:00
hsi
hv
hwmon spi: Updates for v3.13 2013-11-12 15:01:39 +09:00
hwspinlock
i2c Merge remote-tracking branch 'grant/devicetree/next' into for-next 2013-11-07 10:34:46 -06:00
ide H8/300 has been dead for several years, the kernel for it has 2013-11-12 14:13:14 +09:00
idle
iio iio: light: vcnl4000: Remove redundant code 2013-10-24 14:48:14 +01:00
infiniband net/mlx4_core: Initialize all mailbox buffers to zero before use 2013-11-07 19:22:47 -05:00
input DeviceTree updates for 3.13. This is a bit larger pull request than 2013-11-12 16:52:17 +09:00
iommu drivers/iommu/omap-iopgtable.h: remove unneeded cast of void* 2013-11-13 12:09:00 +09:00
ipack
irqchip Merge branch 'irq-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2013-11-12 10:02:59 +09:00
isdn isdn: icn: NULL dereference printing error message 2013-11-07 19:11:13 -05:00
leds leds: lp55xx: handle enable pin in driver 2013-10-25 10:13:25 -07:00
lguest
macintosh DeviceTree updates for 3.13. This is a bit larger pull request than 2013-11-12 16:52:17 +09:00
mailbox
md Driver Core / sysfs patches for 3.13-rc1 2013-11-07 11:42:15 +09:00
media Merge branch 'akpm' (patches from Andrew Morton) 2013-11-13 15:45:43 +09:00
memory
memstick drivers/memstick/core/ms_block.c: fix unreachable state in h_msb_read_page() 2013-11-13 12:09:35 +09:00
message drivers/message/i2o/driver.c: add missing destroy_workqueue() on error in i2o_driver_register() 2013-11-13 12:09:26 +09:00
mfd sound updates for 3.13-rc1 2013-11-12 15:29:53 +09:00
misc DeviceTree updates for 3.13. This is a bit larger pull request than 2013-11-12 16:52:17 +09:00
mmc
mtd Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2013-11-13 15:34:18 +09:00
net net:fec: fix WARNING caused by lack of calls to dma_mapping_error() 2013-11-14 16:37:33 -05:00
nfc
ntb
nubus
of DeviceTree updates for 3.13. This is a bit larger pull request than 2013-11-12 16:52:17 +09:00
oprofile
parisc
parport H8/300 has been dead for several years, the kernel for it has 2013-11-12 14:13:14 +09:00
pci DeviceTree updates for 3.13. This is a bit larger pull request than 2013-11-12 16:52:17 +09:00
pcmcia DeviceTree updates for 3.13. This is a bit larger pull request than 2013-11-12 16:52:17 +09:00
phy usb: patches for v3.13 2013-10-24 16:18:40 +01:00
pinctrl GPIO bulk changes for the v3.13 development cycle 2013-11-12 15:50:46 +09:00
platform sound updates for 3.13-rc1 2013-11-12 15:29:53 +09:00
pnp
power
pps drivers/pps/clients/pps-gpio.c: remove redundant of_match_ptr 2013-11-13 12:09:35 +09:00
ps3
ptp
pwm
rapidio
regulator Merge remote-tracking branch 'regulator/topic/tps65910' into regulator-next 2013-10-24 11:11:43 +01:00
remoteproc
reset
rpmsg
rtc drivers/rtc/rtc-as3722: add RTC driver 2013-11-13 12:09:31 +09:00
s390 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2013-11-13 17:40:34 +09:00
sbus
scsi Driver Core / sysfs patches for 3.13-rc1 2013-11-07 11:42:15 +09:00
sfi
sh
sn
spi DeviceTree updates for 3.13. This is a bit larger pull request than 2013-11-12 16:52:17 +09:00
ssb
staging Merge branch 'akpm' (patches from Andrew Morton) 2013-11-13 15:45:43 +09:00
target target/pscsi: fix return value check 2013-10-25 10:42:09 -07:00
tc
thermal
tty DeviceTree updates for 3.13. This is a bit larger pull request than 2013-11-12 16:52:17 +09:00
uio drivers/uio/uio_pruss.c: use gen_pool_dma_alloc() to allocate sram memory 2013-11-13 12:09:23 +09:00
usb Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2013-11-13 15:34:18 +09:00
uwb Driver Core / sysfs patches for 3.13-rc1 2013-11-07 11:42:15 +09:00
vfio
vhost vhost/scsi: Fix incorrect usage of get_user_pages_fast write parameter 2013-10-25 11:03:34 -07:00
video drivers/video/backlight/hx8357.c: remove redundant of_match_ptr 2013-11-13 12:09:22 +09:00
virt
virtio
vlynq
vme
w1 drivers: w1: make w1_slave::flags long to avoid memory corruption 2013-11-13 12:09:35 +09:00
watchdog DeviceTree updates for 3.13. This is a bit larger pull request than 2013-11-12 16:52:17 +09:00
xen
zorro
Kconfig
Makefile