diff --git a/debian/changelog b/debian/changelog index 51100c371..377914fab 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,8 @@ linux (3.13.4-2) UNRELEASED; urgency=medium * [armhf] net/wireless: Really enable WL_TI and dependent modules * aufs: Update to aufs3.13-20140127 (no functional changes) * [powerpc] Change I2C_POWERMAC from module to built-in (Closes: #713943) + * [mips] rtl8187: fix regression on MIPS without coherent DMA + (Closes: #739978) -- Ben Hutchings Sat, 22 Feb 2014 19:15:01 +0000 diff --git a/debian/patches/bugfix/all/rtl8187-fix-regression-on-MIPS-without-coherent-DMA.patch b/debian/patches/bugfix/all/rtl8187-fix-regression-on-MIPS-without-coherent-DMA.patch new file mode 100644 index 000000000..8d8537c4a --- /dev/null +++ b/debian/patches/bugfix/all/rtl8187-fix-regression-on-MIPS-without-coherent-DMA.patch @@ -0,0 +1,82 @@ +From: Stanislaw Gruszka +Date: Mon, 10 Feb 2014 22:38:28 +0100 +Subject: rtl8187: fix regression on MIPS without coherent DMA +Origin: https://git.kernel.org/linus/b6213e413a4e0c66548153516b074df14f9d08e0 +Bug: https://bugzilla.kernel.org/show_bug.cgi?id=54391 +Bug-Debian: http://bugs.debian.org/739978 + +This patch fixes regression caused by commit a16dad77634 "MIPS: Fix +potencial corruption". That commit fixes one corruption scenario in +cost of adding another one, which actually start to cause crashes +on Yeeloong laptop when rtl8187 driver is used. + +For correct DMA read operation on machines without DMA coherence, kernel +have to invalidate cache, such it will refill later with new data that +device wrote to memory, when that data is needed to process. We can only +invalidate full cache line. Hence when cache line includes both dma +buffer and some other data (written in cache, but not yet in main +memory), the other data can not hit memory due to invalidation. That +happen on rtl8187 where struct rtl8187_priv fields are located just +before and after small buffers that are passed to USB layer and DMA +is performed on them. + +To fix the problem we align buffers and reserve space after them to make +them match cache line. + +This patch does not resolve all possible MIPS problems entirely, for +that we have to assure that we always map cache aligned buffers for DMA, +what can be complex or even not possible. But patch fixes visible and +reproducible regression and seems other possible corruptions do not +happen in practice, since Yeeloong laptop works stable without rtl8187 +driver. + +Bug report: +https://bugzilla.kernel.org/show_bug.cgi?id=54391 + +Reported-by: Petr Pisar +Bisected-by: Tom Li +Reported-and-tested-by: Tom Li +Cc: stable@vger.kernel.org +Signed-off-by: Stanislaw Gruszka +Acked-by: Larry Finger +Acked-by: Hin-Tak Leung +Signed-off-by: John W. Linville +--- + drivers/net/wireless/rtl818x/rtl8187/rtl8187.h | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/wireless/rtl818x/rtl8187/rtl8187.h b/drivers/net/wireless/rtl818x/rtl8187/rtl8187.h +index 56aee06..a6ad79f 100644 +--- a/drivers/net/wireless/rtl818x/rtl8187/rtl8187.h ++++ b/drivers/net/wireless/rtl818x/rtl8187/rtl8187.h +@@ -15,6 +15,8 @@ + #ifndef RTL8187_H + #define RTL8187_H + ++#include ++ + #include "rtl818x.h" + #include "leds.h" + +@@ -139,7 +141,10 @@ struct rtl8187_priv { + u8 aifsn[4]; + u8 rfkill_mask; + struct { +- __le64 buf; ++ union { ++ __le64 buf; ++ u8 dummy1[L1_CACHE_BYTES]; ++ } ____cacheline_aligned; + struct sk_buff_head queue; + } b_tx_status; /* This queue is used by both -b and non-b devices */ + struct mutex io_mutex; +@@ -147,7 +152,8 @@ struct rtl8187_priv { + u8 bits8; + __le16 bits16; + __le32 bits32; +- } *io_dmabuf; ++ u8 dummy2[L1_CACHE_BYTES]; ++ } *io_dmabuf ____cacheline_aligned; + bool rfkill_off; + u16 seqno; + }; diff --git a/debian/patches/series b/debian/patches/series index c8291c464..7dbfee356 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -80,3 +80,4 @@ bugfix/all/i2c-designware-remove-HAVE_CLK-build-dependecy.patch debian/snd-pcsp-disable-autoload.patch bugfix/all/bluetooth-allocate-static-minor-for-vhci.patch bugfix/all/xhci-revert-generalised-sg-support.patch +bugfix/all/rtl8187-fix-regression-on-MIPS-without-coherent-DMA.patch