From: vwan@ti.com Date: Fri, 5 Dec 2014 20:10:39 +0000 (-0800) Subject: Remove VRING_USED_F_NO_NOTIFY flag in VirtQueue_kick and add barriers on QNX X-Git-Tag: 3.23.02.04~1 X-Git-Url: https://git.ti.com/gitweb?p=ipc%2Fipcdev.git;a=commitdiff_plain;h=bece49105dd30090112eaedf45d84ad965c555f4;ds=sidebyside Remove VRING_USED_F_NO_NOTIFY flag in VirtQueue_kick and add barriers on QNX This commit removes usage of VRING_USED_F_NO_NOTIFY flag in VirtQueue_kick on QNX. This causes an interrupt to be sent for every buffer. Also, barriers are added where appropriate to prevent any race condition due to the Cortex-A15 weak memory model. This addresses SDOCM00114151. Signed-off-by: VW --- diff --git a/qnx/src/ipc3x_dev/ti/syslink/ipc/hlos/knl/transports/virtio/VirtQueue.c b/qnx/src/ipc3x_dev/ti/syslink/ipc/hlos/knl/transports/virtio/VirtQueue.c index 8fc1c09..94f210d 100644 --- a/qnx/src/ipc3x_dev/ti/syslink/ipc/hlos/knl/transports/virtio/VirtQueue.c +++ b/qnx/src/ipc3x_dev/ti/syslink/ipc/hlos/knl/transports/virtio/VirtQueue.c @@ -138,12 +138,11 @@ Void VirtQueue_cb(Void *buf, VirtQueue_Handle vq) */ Void VirtQueue_kick(VirtQueue_Handle vq) { - /* For now, simply interrupt remote processor */ - if (vq->vring.used->flags & VRING_USED_F_NO_NOTIFY) { - GT_0trace(curTrace, GT_3CLASS, - "VirtQueue_kick: no kick because of VRING_USED_F_NO_NOTIFY"); - return; - } + /* + * We need to expose available array entries before sending an + * interrupt. + */ + asm(" DSB ST"); GT_2trace(curTrace, GT_2CLASS, "VirtQueue_kick: Sending interrupt to proc %d with payload 0x%x", @@ -217,6 +216,12 @@ Int VirtQueue_addAvailBuf(VirtQueue_Handle vq, Void *buf, UInt32 len, Int16 head vq->vring.desc[head].len = len; vq->vring.desc[head].flags = 0; + /* + * Descriptors and available array need to be set before we expose the + * new available array entries. + */ + asm(" DMB ST"); + vq->vring.avail->idx++; } @@ -238,6 +243,9 @@ Int16 VirtQueue_getUsedBuf(VirtQueue_Object *vq, Void **buf) return (-1); } + /* Only get used array entries after they have been exposed. */ + asm(" DMB"); + /* No need to know be kicked about added buffers anymore */ //vq->vring.avail->flags |= VRING_AVAIL_F_NO_INTERRUPT; // disabling for now, since there seems to be a race condition where an M3->A9 message is not detected because the interrupt isn't sent.