From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 16761A00C5; Thu, 11 Jun 2020 12:11:32 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5827C2C27; Thu, 11 Jun 2020 12:11:31 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 55E541252 for ; Thu, 11 Jun 2020 12:11:29 +0200 (CEST) IronPort-SDR: G1/itAIVe5+x7cbOs50CR3cEGkt05s2p1Fcn/dlOlYq+jahxWGamQTlrfz9I2Te0Onf9YTFFsm 5n69WlH+4AuA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jun 2020 03:11:28 -0700 IronPort-SDR: JJylUKakZJ66k9RZgI7NPUw4WXfyB2VFr+z3l9C6RYomJ6pvpgJ5czJKE4yw8No+wp2NObmzT1 QcpdDvEtn3VQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,499,1583222400"; d="scan'208";a="275286569" Received: from silpixa00383879.ir.intel.com ([10.237.222.142]) by orsmga006.jf.intel.com with ESMTP; 11 Jun 2020 03:11:26 -0700 From: Radu Nicolau To: dev@dpdk.org Cc: beilei.xing@intel.com, jia.guo@intel.com, bruce.richardson@intel.com, konstantin.ananyev@intel.com, Radu Nicolau Date: Thu, 11 Jun 2020 11:11:22 +0100 Message-Id: <1591870283-7776-1-git-send-email-radu.nicolau@intel.com> X-Mailer: git-send-email 2.7.4 Subject: [dpdk-dev] [PATCH v1 1/2] eal/x86: add WC store function X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Add rte_write32_wc function that implements a WC store using movdiri instruction. Signed-off-by: Radu Nicolau --- lib/librte_eal/x86/include/rte_io.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/lib/librte_eal/x86/include/rte_io.h b/lib/librte_eal/x86/include/rte_io.h index 2db71b1..3d74bec 100644 --- a/lib/librte_eal/x86/include/rte_io.h +++ b/lib/librte_eal/x86/include/rte_io.h @@ -11,6 +11,26 @@ extern "C" { #include "generic/rte_io.h" +/** + * Write a 32-bit value to I/O device memory address *addr*. + * Uses MOVDIRI instruction to perform a direct-store operation using WC + * memory write protocol. + * + * @param value + * Value to write + * @param addr + * I/O memory address to write the value to + */ +static __rte_always_inline void +rte_write32_wc(uint32_t value, volatile void *addr) +{ + asm volatile("sfence\n\t" + /* MOVDIRI */ + ".byte 0x40, 0x0f, 0x38, 0xf9, 0x02" + : + : "a" (value), "d" (addr)); +} + #ifdef __cplusplus } #endif -- 2.7.4