Skip to content

Commit 259d6fe

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 886c006 commit 259d6fe

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
@@ -338,7 +338,7 @@ static int isp_firmware_boot_stage2(struct apple_isp *isp)
338338

339339
isp_gpio_write32(isp, ISP_GPIO_0, args_iova);
340340
isp_gpio_write32(isp, ISP_GPIO_1, args_iova >> 32);
341-
wmb();
341+
dma_wmb();
342342

343343
/* Wait for ISP_GPIO_7 to 0xf7fbdff9 -> 0x8042006 */
344344
isp_gpio_write32(isp, ISP_GPIO_7, 0xf7fbdff9);
@@ -500,7 +500,7 @@ static int isp_firmware_boot_stage3(struct apple_isp *isp)
500500
memcpy(msg_virt, &msg, sizeof(msg));
501501
}
502502
}
503-
wmb();
503+
dma_wmb();
504504

505505
/* Wait for ISP_GPIO_3 to 0x8042006 -> 0x0 */
506506
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)