Skip to content

Commit 0d38cba

Browse files
hoshinolinajannau
authored andcommitted
media: apple: isp: Maybe fix some DMA ordering issues
Maybe. Signed-off-by: Asahi Lina <lina@asahilina.net>
1 parent 0c461c3 commit 0d38cba

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

drivers/media/platform/apple/isp/isp-fw.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ static int isp_firmware_boot_stage2(struct apple_isp *isp)
336336

337337
isp_gpio_write32(isp, ISP_GPIO_0, args_iova);
338338
isp_gpio_write32(isp, ISP_GPIO_1, args_iova >> 32);
339-
wmb();
339+
dma_wmb();
340340

341341
/* Wait for ISP_GPIO_7 to 0xf7fbdff9 -> 0x8042006 */
342342
isp_gpio_write32(isp, ISP_GPIO_7, 0xf7fbdff9);
@@ -498,7 +498,7 @@ static int isp_firmware_boot_stage3(struct apple_isp *isp)
498498
memcpy(msg_virt, &msg, sizeof(msg));
499499
}
500500
}
501-
wmb();
501+
dma_wmb();
502502

503503
/* Wait for ISP_GPIO_3 to 0x8042006 -> 0x0 */
504504
isp_gpio_write32(isp, ISP_GPIO_3, 0x8042006);

drivers/media/platform/apple/isp/isp-ipc.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,14 @@ static inline void chan_write_msg_index(struct apple_isp *isp,
7878
struct isp_channel *chan,
7979
struct isp_message *msg, u32 index)
8080
{
81-
memcpy(chan_msg_virt(chan, index), msg, sizeof(*msg));
81+
u64 *p0 = chan_msg_virt(chan, index);
82+
memcpy(p0 + 1, &msg->arg1, sizeof(*msg) - 8);
83+
84+
/* Make sure we write arg0 last, since that indicates message validity. */
85+
86+
dma_wmb();
87+
*p0 = msg->arg0;
88+
dma_wmb();
8289
}
8390

8491
static inline void chan_write_msg(struct apple_isp *isp,
@@ -164,7 +171,7 @@ int ipc_chan_send(struct apple_isp *isp, struct isp_channel *chan,
164171
long t;
165172

166173
chan_write_msg(isp, chan, &chan->req);
167-
wmb();
174+
dma_wmb();
168175

169176
isp_mbox_write32(isp, ISP_MBOX_IRQ_DOORBELL, chan->doorbell);
170177

0 commit comments

Comments
 (0)