Commit 1c098401 authored by Ben Walker's avatar Ben Walker Committed by Tomasz Zawadzki
Browse files

idxd: Correctly memory barrier prior to submitting descriptors



The DSA specification calls out that software must use a memory barrier
such as sfence prior to writing a descriptor or incorrect data may be
transferred during the operation.

Change-Id: I12f20e5a748e41616c7a542ccdb158c6b548eea4
Signed-off-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14018


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: default avatarPaul Luse <paul.e.luse@intel.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent a36bc251
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -33,6 +33,12 @@ static inline void
_submit_to_hw(struct spdk_idxd_io_channel *chan, struct idxd_ops *op)
{
	STAILQ_INSERT_TAIL(&chan->ops_outstanding, op, link);
	/*
	 * We must barrier before writing the descriptor to ensure that data
	 * has been correctly flushed from the associated data buffers before DMA
	 * operations begin.
	 */
	_spdk_wmb();
	movdir64b(chan->portal + chan->portal_offset, op->desc);
	chan->portal_offset = (chan->portal_offset + chan->idxd->chan_per_device * PORTAL_STRIDE) &
			      PORTAL_MASK;