summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSami Tolvanen <samitolvanen@google.com>2017-08-17 14:07:29 -0700
committerMichael Bestas <mkbestas@lineageos.org>2020-02-02 01:40:00 +0200
commit39dc15657a8bdc6416db005bb6f508ddc823ec64 (patch)
tree10b41d270ba03c344f586a6588107aebd4d3bc7c
parentaffbb18601e38b841cbb25f8c32f35a47772c41a (diff)
msm: sde: fix unaligned memory read
Prevent the compiler from combining two 32b writes to 4B-aligned iomem address, into a single 64b write to a non-8B-aligned iomem address, where the iomem address is fixed and cannot be realigned. Prevents a kernel panic ("Unhandled fault: alignment fault (0x96000061)"). Bug: 64527440 Bug: 62093296 Change-Id: I6dafc7427b5c52eb390beebabd5281133889bddc Signed-off-by: Sami Tolvanen <samitolvanen@google.com> Link: https://android.googlesource.com/kernel/msm/+/6e1393aa95a31da00a10c6a6f7f66d0fa840aeb6 Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
-rw-r--r--drivers/media/platform/msm/sde/rotator/sde_rotator_r3.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/drivers/media/platform/msm/sde/rotator/sde_rotator_r3.c b/drivers/media/platform/msm/sde/rotator/sde_rotator_r3.c
index 10f72a2155db..a858051cd578 100644
--- a/drivers/media/platform/msm/sde/rotator/sde_rotator_r3.c
+++ b/drivers/media/platform/msm/sde/rotator/sde_rotator_r3.c
@@ -49,29 +49,36 @@
/* Macro for constructing the REGDMA command */
#define SDE_REGDMA_WRITE(p, off, data) \
do { \
- *p++ = REGDMA_OP_REGWRITE | \
- ((off) & REGDMA_ADDR_OFFSET_MASK); \
- *p++ = (data); \
+ writel_relaxed(REGDMA_OP_REGWRITE | \
+ ((off) & REGDMA_ADDR_OFFSET_MASK), (p)); \
+ (p)++; \
+ writel_relaxed((data), (p)); \
+ (p)++; \
} while (0)
#define SDE_REGDMA_MODIFY(p, off, mask, data) \
do { \
- *p++ = REGDMA_OP_REGMODIFY | \
- ((off) & REGDMA_ADDR_OFFSET_MASK); \
- *p++ = (mask); \
- *p++ = (data); \
+ writel_relaxed(REGDMA_OP_REGMODIFY | \
+ ((off) & REGDMA_ADDR_OFFSET_MASK), (p)); \
+ (p)++; \
+ writel_relaxed((mask), (p)); \
+ (p)++; \
+ writel_relaxed((data), (p)); \
+ (p)++; \
} while (0)
#define SDE_REGDMA_BLKWRITE_INC(p, off, len) \
do { \
- *p++ = REGDMA_OP_BLKWRITE_INC | \
- ((off) & REGDMA_ADDR_OFFSET_MASK); \
- *p++ = (len); \
+ writel_relaxed(REGDMA_OP_BLKWRITE_INC | \
+ ((off) & REGDMA_ADDR_OFFSET_MASK), (p)); \
+ (p)++; \
+ writel_relaxed((len), (p)); \
+ (p)++; \
} while (0)
#define SDE_REGDMA_BLKWRITE_DATA(p, data) \
do { \
- *(p) = (data); \
+ writel_relaxed((data), (p)); \
(p)++; \
} while (0)