* [PATCH] mmc: dw_mmc: fix 32bit little-endian access of des1 field
@ 2016-06-07 13:37 ` Ben Dooks
2016-06-08 9:55 ` Shawn Lin
2016-06-09 12:28 ` Jaehoon Chung
0 siblings, 2 replies; 4+ messages in thread
From: Ben Dooks @ 2016-06-07 13:37 UTC (permalink / raw)
To: linux-arm-kernel
The IDMAC_SET_BUFFER1_SIZE() macro modifies des1, but does
not check if the value being passed is big or little endian
desptire the des1 field being marked as __le32.
Fix the issue by ensuring the values are changed from the
cpu endian to the descriptor endian by using cpu_to_le32.
Spotted whilst doing big endian conversion work on Exynos,
and stops the mmc worker thread from stalling.
Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
---
Cc: Matthew Leach <matt.leach@codethink.co.uk>
Cc: Jaehoon Chung <jh80.chung@samsung.com>
Cc: Ulf Hansson <ulf.hansson@linaro.org>
Cc: linux-mmc at vger.kernel.org
Cc: linux-arm-kernel at lists.infradead.org
---
drivers/mmc/host/dw_mmc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 2cc6123..544397e 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -92,7 +92,7 @@ struct idmac_desc {
__le32 des1; /* Buffer sizes */
#define IDMAC_SET_BUFFER1_SIZE(d, s) \
- ((d)->des1 = ((d)->des1 & 0x03ffe000) | ((s) & 0x1fff))
+ ((d)->des1 = ((d)->des1 & cpu_to_le32(0x03ffe000)) | (cpu_to_le32((s) & 0x1fff)))
__le32 des2; /* buffer 1 physical address */
--
2.8.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] mmc: dw_mmc: fix 32bit little-endian access of des1 field
2016-06-07 13:37 ` [PATCH] mmc: dw_mmc: fix 32bit little-endian access of des1 field Ben Dooks
@ 2016-06-08 9:55 ` Shawn Lin
2016-06-08 10:11 ` Ben Dooks
2016-06-09 12:28 ` Jaehoon Chung
1 sibling, 1 reply; 4+ messages in thread
From: Shawn Lin @ 2016-06-08 9:55 UTC (permalink / raw)
To: linux-arm-kernel
Hi Ben,
On 2016-6-7 21:37, Ben Dooks wrote:
> The IDMAC_SET_BUFFER1_SIZE() macro modifies des1, but does
> not check if the value being passed is big or little endian
> desptire the des1 field being marked as __le32.
Looks good.
Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>
Test on Rockchip platform, so
Tested-by: Shawn Lin <shawn.lin@rock-chips.com>
> Fix the issue by ensuring the values are changed from the
> cpu endian to the descriptor endian by using cpu_to_le32.
>
> Spotted whilst doing big endian conversion work on Exynos,
> and stops the mmc worker thread from stalling.
>
> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
> ---
> Cc: Matthew Leach <matt.leach@codethink.co.uk>
> Cc: Jaehoon Chung <jh80.chung@samsung.com>
> Cc: Ulf Hansson <ulf.hansson@linaro.org>
> Cc: linux-mmc at vger.kernel.org
> Cc: linux-arm-kernel at lists.infradead.org
> ---
> drivers/mmc/host/dw_mmc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
> index 2cc6123..544397e 100644
> --- a/drivers/mmc/host/dw_mmc.c
> +++ b/drivers/mmc/host/dw_mmc.c
> @@ -92,7 +92,7 @@ struct idmac_desc {
>
> __le32 des1; /* Buffer sizes */
> #define IDMAC_SET_BUFFER1_SIZE(d, s) \
> - ((d)->des1 = ((d)->des1 & 0x03ffe000) | ((s) & 0x1fff))
> + ((d)->des1 = ((d)->des1 & cpu_to_le32(0x03ffe000)) | (cpu_to_le32((s) & 0x1fff)))
>
> __le32 des2; /* buffer 1 physical address */
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] mmc: dw_mmc: fix 32bit little-endian access of des1 field
2016-06-08 9:55 ` Shawn Lin
@ 2016-06-08 10:11 ` Ben Dooks
0 siblings, 0 replies; 4+ messages in thread
From: Ben Dooks @ 2016-06-08 10:11 UTC (permalink / raw)
To: linux-arm-kernel
On 08/06/16 10:55, Shawn Lin wrote:
> Hi Ben,
>
> On 2016-6-7 21:37, Ben Dooks wrote:
>> The IDMAC_SET_BUFFER1_SIZE() macro modifies des1, but does
>> not check if the value being passed is big or little endian
>> desptire the des1 field being marked as __le32.
>
> Looks good.
>
> Reviewed-by: Shawn Lin <shawn.lin@rock-chips.com>
>
> Test on Rockchip platform, so
>
> Tested-by: Shawn Lin <shawn.lin@rock-chips.com>
Thanks, I'lkl prod matt to add his tested line.
--
Ben Dooks http://www.codethink.co.uk/
Senior Engineer Codethink - Providing Genius
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] mmc: dw_mmc: fix 32bit little-endian access of des1 field
2016-06-07 13:37 ` [PATCH] mmc: dw_mmc: fix 32bit little-endian access of des1 field Ben Dooks
2016-06-08 9:55 ` Shawn Lin
@ 2016-06-09 12:28 ` Jaehoon Chung
1 sibling, 0 replies; 4+ messages in thread
From: Jaehoon Chung @ 2016-06-09 12:28 UTC (permalink / raw)
To: linux-arm-kernel
Hi Ben,
On 06/07/2016 10:37 PM, Ben Dooks wrote:
> The IDMAC_SET_BUFFER1_SIZE() macro modifies des1, but does
> not check if the value being passed is big or little endian
> desptire the des1 field being marked as __le32.
>
> Fix the issue by ensuring the values are changed from the
> cpu endian to the descriptor endian by using cpu_to_le32.
>
> Spotted whilst doing big endian conversion work on Exynos,
> and stops the mmc worker thread from stalling.
Applied this patch. Thanks!
Best Regards,
Jaehoon Chung
>
> Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk>
> ---
> Cc: Matthew Leach <matt.leach@codethink.co.uk>
> Cc: Jaehoon Chung <jh80.chung@samsung.com>
> Cc: Ulf Hansson <ulf.hansson@linaro.org>
> Cc: linux-mmc at vger.kernel.org
> Cc: linux-arm-kernel at lists.infradead.org
> ---
> drivers/mmc/host/dw_mmc.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
> index 2cc6123..544397e 100644
> --- a/drivers/mmc/host/dw_mmc.c
> +++ b/drivers/mmc/host/dw_mmc.c
> @@ -92,7 +92,7 @@ struct idmac_desc {
>
> __le32 des1; /* Buffer sizes */
> #define IDMAC_SET_BUFFER1_SIZE(d, s) \
> - ((d)->des1 = ((d)->des1 & 0x03ffe000) | ((s) & 0x1fff))
> + ((d)->des1 = ((d)->des1 & cpu_to_le32(0x03ffe000)) | (cpu_to_le32((s) & 0x1fff)))
>
> __le32 des2; /* buffer 1 physical address */
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-06-09 12:28 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CGME20160607133726epcas1p1c3274577f12dbf456a7a6bf3efb6e1fe@epcas1p1.samsung.com>
2016-06-07 13:37 ` [PATCH] mmc: dw_mmc: fix 32bit little-endian access of des1 field Ben Dooks
2016-06-08 9:55 ` Shawn Lin
2016-06-08 10:11 ` Ben Dooks
2016-06-09 12:28 ` Jaehoon Chung
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).