From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9D102A0C58; Tue, 30 Nov 2021 06:47:25 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1F2BC4068F; Tue, 30 Nov 2021 06:47:25 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 0C0264068B for ; Tue, 30 Nov 2021 06:47:23 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.1.2/8.16.1.2) with ESMTP id 1AU07O55026005 for ; Mon, 29 Nov 2021 21:47:22 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=V/hznvf9wZLBH8f5HYbeRffraOTO9hI2orgyxT4LRhg=; b=Ot3fg/YArJwDBqKy6x03Nu88V3Hu50235jd6o8+xxx44zfIWBMh8Pa2sU5ME6Olziss8 pqVV954lUgfaSgpRy/xFCHhHLbVwDWot7hAd1d11+7OP3icLkM/WDbHJUTXnUGC86QS5 jKJWnHPECTQNws37s8bF1dh78hHwhFicuCH1CUkKwvn8QMg/W0tGMmdrk7JTBwim0bJs Y0sEZ5j/BQ+0dBXL7nK/7l4+R6x/PyYkQrqfcLV0FR/ur9q2FHYuKiY/w4Ryk1AAKSQX bqHdJebzMi0cOuIUfjeaGLDK+ANhdINx9iVmo9IDVyUxCmg8h21YCeWqJ0W5U/i9fuMP 0Q== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3cn23wu1r2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Mon, 29 Nov 2021 21:47:21 -0800 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 29 Nov 2021 21:47:20 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 29 Nov 2021 21:47:20 -0800 Received: from lab-ci-142.marvell.com (unknown [10.28.36.142]) by maili.marvell.com (Postfix) with ESMTP id 528C85C68F2; Mon, 29 Nov 2021 21:47:17 -0800 (PST) From: Ashwin Sekhar T K To: CC: , , , , , , , , , Subject: [PATCH] common/cnxk: use cas with release semantics for batch alloc Date: Tue, 30 Nov 2021 11:15:27 +0530 Message-ID: <20211130054527.2696881-1-asekhar@marvell.com> X-Mailer: git-send-email 2.32.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: 8c5j_OIByBDwPlL6kCIPo-rFUq58ztFI X-Proofpoint-GUID: 8c5j_OIByBDwPlL6kCIPo-rFUq58ztFI X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-11-30_04,2021-11-28_01,2020-04-07_01 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Before issuing the batch alloc, we clear the first word of cache lines so that NPA can update the status. Make sure that this line clear is flushed before the batch alloc is issued. Signed-off-by: Ashwin Sekhar T K --- drivers/common/cnxk/roc_io.h | 12 ++++++++++++ drivers/common/cnxk/roc_io_generic.h | 9 +++++++++ drivers/common/cnxk/roc_npa.h | 2 +- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/drivers/common/cnxk/roc_io.h b/drivers/common/cnxk/roc_io.h index fe5f7f46d0..4f15503c29 100644 --- a/drivers/common/cnxk/roc_io.h +++ b/drivers/common/cnxk/roc_io.h @@ -78,6 +78,18 @@ roc_atomic64_cas(uint64_t compare, uint64_t swap, int64_t *ptr) return compare; } +static __plt_always_inline uint64_t +roc_atomic64_casl(uint64_t compare, uint64_t swap, int64_t *ptr) +{ + asm volatile(PLT_CPU_FEATURE_PREAMBLE + "casl %[compare], %[swap], [%[ptr]]\n" + : [compare] "+r"(compare) + : [swap] "r"(swap), [ptr] "r"(ptr) + : "memory"); + + return compare; +} + static __plt_always_inline uint64_t roc_atomic64_add_nosync(int64_t incr, int64_t *ptr) { diff --git a/drivers/common/cnxk/roc_io_generic.h b/drivers/common/cnxk/roc_io_generic.h index ceaa3a38d8..5f90835c09 100644 --- a/drivers/common/cnxk/roc_io_generic.h +++ b/drivers/common/cnxk/roc_io_generic.h @@ -41,6 +41,15 @@ roc_atomic64_cas(uint64_t compare, uint64_t swap, int64_t *ptr) return compare; } +static __plt_always_inline uint64_t +roc_atomic64_casl(uint64_t compare, uint64_t swap, int64_t *ptr) +{ + PLT_SET_USED(swap); + PLT_SET_USED(ptr); + + return compare; +} + static inline uint64_t roc_atomic64_add_nosync(int64_t incr, int64_t *ptr) { diff --git a/drivers/common/cnxk/roc_npa.h b/drivers/common/cnxk/roc_npa.h index 46350fdb48..19b9a9352c 100644 --- a/drivers/common/cnxk/roc_npa.h +++ b/drivers/common/cnxk/roc_npa.h @@ -218,7 +218,7 @@ roc_npa_aura_batch_alloc_issue(uint64_t aura_handle, uint64_t *buf, cmp.compare_s.dis_wait = dis_wait; cmp.compare_s.count = num; - res = roc_atomic64_cas(cmp.u, (uint64_t)buf, addr); + res = roc_atomic64_casl(cmp.u, (uint64_t)buf, addr); if (res != ALLOC_RESULT_ACCEPTED && res != ALLOC_RESULT_NOCORE) return -1; -- 2.32.0