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: Ben Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/14018
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Community-CI: Mellanox Build Bot
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Ben Walker 2022-08-08 10:53:37 -07:00 committed by Tomasz Zawadzki
parent a36bc251df
commit 1c098401d8

View File

@ -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;