From e9a94122b8704411b79157b25c4d07580246be6c Mon Sep 17 00:00:00 2001
From: Xue Liu <liuxue@loongson.cn>
Date: Thu, 1 Dec 2022 18:38:57 +0800
Subject: [PATCH 2/3] nvme/pcie: add memory barrier for LOONGARCH

Add memory barrier for LOONGARCH in nvme_pcie_qpair_process_completions.

Signed-off-by: Xue Liu <liuxue@loongson.cn>
Change-Id: Icc992ef612a00dd18ff33f70ab8f54e8c5d5c5b7
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/16083
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
---
 lib/nvme/nvme_pcie_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/nvme/nvme_pcie_common.c b/lib/nvme/nvme_pcie_common.c
index 0ef56cb..5fb6304 100644
--- a/lib/nvme/nvme_pcie_common.c
+++ b/lib/nvme/nvme_pcie_common.c
@@ -801,7 +801,7 @@ nvme_pcie_qpair_process_completions(struct spdk_nvme_qpair *qpair, uint32_t max_
 			__builtin_prefetch(&pqpair->tr[next_cpl->cid]);
 		}
 
-#ifdef __PPC64__
+#if defined(__PPC64__) || defined(__loongarch__)
 		/*
 		 * This memory barrier prevents reordering of:
 		 * - load after store from/to tr
-- 
2.20.1

