From patchwork Thu Apr 13 21:25:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 126041 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E058642937; Thu, 13 Apr 2023 23:26:26 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C037642C54; Thu, 13 Apr 2023 23:26:10 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id E17D64114B for ; Thu, 13 Apr 2023 23:26:05 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id DB4F42179265; Thu, 13 Apr 2023 14:26:04 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com DB4F42179265 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1681421164; bh=Y/Lj3RIuKGa4rtY23mvZ/M9EKc5oRqKRALS/CL9pryE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nzyD1yWj3+CrK25EbMSDTHYlEzN1tRo0CYc48FgZPoh8rlx7/SuPS0EidFOeB5LCf gpd1zjXxU9YQmKFDTGi1+1vFjOdfoVvsmWiT80Xw4QK1ruoq3t9HhovBkPQXsPZzIq jkkVUfUaqYQQQRhMDUrt2XSRZkd9a+x1HkdsUb+w= From: Tyler Retzlaff To: dev@dpdk.org Cc: bruce.richardson@intel.com, david.marchand@redhat.com, thomas@monjalon.net, mb@smartsharesystems.com, konstantin.ananyev@huawei.com, Tyler Retzlaff Subject: [PATCH v5 01/14] eal: use rdtsc intrinsic Date: Thu, 13 Apr 2023 14:25:50 -0700 Message-Id: <1681421163-18578-2-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1681421163-18578-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1681421163-18578-1-git-send-email-roretzla@linux.microsoft.com> 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 Inline assembly is not supported for MSVC x64. Convert code to use __rdtsc intrinsic. Signed-off-by: Tyler Retzlaff Acked-by: Konstantin Ananyev --- lib/eal/x86/include/rte_cycles.h | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/eal/x86/include/rte_cycles.h b/lib/eal/x86/include/rte_cycles.h index a461a4d..cca5122 100644 --- a/lib/eal/x86/include/rte_cycles.h +++ b/lib/eal/x86/include/rte_cycles.h @@ -6,6 +6,12 @@ #ifndef _RTE_CYCLES_X86_64_H_ #define _RTE_CYCLES_X86_64_H_ +#ifndef RTE_TOOLCHAIN_MSVC +#include +#else +#include +#endif + #ifdef __cplusplus extern "C" { #endif @@ -23,6 +29,7 @@ static inline uint64_t rte_rdtsc(void) { +#ifdef RTE_LIBRTE_EAL_VMWARE_TSC_MAP_SUPPORT union { uint64_t tsc_64; RTE_STD_C11 @@ -32,7 +39,6 @@ }; } tsc; -#ifdef RTE_LIBRTE_EAL_VMWARE_TSC_MAP_SUPPORT if (unlikely(rte_cycles_vmware_tsc_map)) { /* ecx = 0x10000 corresponds to the physical TSC for VMware */ asm volatile("rdpmc" : @@ -42,11 +48,7 @@ return tsc.tsc_64; } #endif - - asm volatile("rdtsc" : - "=a" (tsc.lo_32), - "=d" (tsc.hi_32)); - return tsc.tsc_64; + return __rdtsc(); } static inline uint64_t From patchwork Thu Apr 13 21:25:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 126038 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A801042937; Thu, 13 Apr 2023 23:26:07 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7C13141138; Thu, 13 Apr 2023 23:26:07 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 9D73A410F9 for ; Thu, 13 Apr 2023 23:26:05 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id E77622179268; Thu, 13 Apr 2023 14:26:04 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com E77622179268 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1681421164; bh=O5hiIXhRzjksf2MgniKIdh+Pdoydf6xE/rYxi0V3rb4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Hh3iljKsTyAQfrOaiUVDuMdescKnwyiBj3F+CjwtlrFIIm2o8txOBVNC21dcOOafr BXkXpeqWXzX+3ARzYBQt4MebZStsAck31yuWa5jw942Hr2LDnPVcoVqTda08FtAh/B Z0NptZHkO25CJumFhyco2YELV0r918Nngsq8dtW8= From: Tyler Retzlaff To: dev@dpdk.org Cc: bruce.richardson@intel.com, david.marchand@redhat.com, thomas@monjalon.net, mb@smartsharesystems.com, konstantin.ananyev@huawei.com, Tyler Retzlaff Subject: [PATCH v5 02/14] eal: use rtm and xtest intrinsics Date: Thu, 13 Apr 2023 14:25:51 -0700 Message-Id: <1681421163-18578-3-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1681421163-18578-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1681421163-18578-1-git-send-email-roretzla@linux.microsoft.com> 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 Inline assembly is not supported for MSVC x64. Convert code to use _xend, _xabort and _xtest intrinsics. Signed-off-by: Tyler Retzlaff Acked-by: Bruce Richardson Acked-by: Konstantin Ananyev --- config/x86/meson.build | 6 ++++++ lib/eal/x86/include/rte_rtm.h | 18 +++++------------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/config/x86/meson.build b/config/x86/meson.build index 54345c4..4c0b06c 100644 --- a/config/x86/meson.build +++ b/config/x86/meson.build @@ -30,6 +30,12 @@ if cc.get_define('__SSE4_2__', args: machine_args) == '' machine_args += '-msse4' endif +# enable restricted transactional memory intrinsics +# https://gcc.gnu.org/onlinedocs/gcc/x86-transactional-memory-intrinsics.html +if cc.get_id() != 'msvc' + machine_args += '-mrtm' +endif + base_flags = ['SSE', 'SSE2', 'SSE3','SSSE3', 'SSE4_1', 'SSE4_2'] foreach f:base_flags compile_time_cpuflags += ['RTE_CPUFLAG_' + f] diff --git a/lib/eal/x86/include/rte_rtm.h b/lib/eal/x86/include/rte_rtm.h index 36bf498..b84e58e 100644 --- a/lib/eal/x86/include/rte_rtm.h +++ b/lib/eal/x86/include/rte_rtm.h @@ -5,6 +5,7 @@ #ifndef _RTE_RTM_H_ #define _RTE_RTM_H_ 1 +#include /* Official RTM intrinsics interface matching gcc/icc, but works on older gcc compatible compilers and binutils. */ @@ -28,31 +29,22 @@ static __rte_always_inline unsigned int rte_xbegin(void) { - unsigned int ret = RTE_XBEGIN_STARTED; - - asm volatile(".byte 0xc7,0xf8 ; .long 0" : "+a" (ret) :: "memory"); - return ret; + return _xbegin(); } static __rte_always_inline void rte_xend(void) { - asm volatile(".byte 0x0f,0x01,0xd5" ::: "memory"); + _xend(); } /* not an inline function to workaround a clang bug with -O0 */ -#define rte_xabort(status) do { \ - asm volatile(".byte 0xc6,0xf8,%P0" :: "i" (status) : "memory"); \ -} while (0) +#define rte_xabort(status) _xabort(status) static __rte_always_inline int rte_xtest(void) { - unsigned char out; - - asm volatile(".byte 0x0f,0x01,0xd6 ; setnz %0" : - "=r" (out) :: "memory"); - return out; + return _xtest(); } #ifdef __cplusplus From patchwork Thu Apr 13 21:25:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 126039 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 09CDD42937; Thu, 13 Apr 2023 23:26:13 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A4CE8427F2; Thu, 13 Apr 2023 23:26:08 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id CED3A4113D for ; Thu, 13 Apr 2023 23:26:05 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id F3A1A217926B; Thu, 13 Apr 2023 14:26:04 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com F3A1A217926B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1681421165; bh=ZHpRWU+uRHDaDNcLpCWnUi3kT75BRG1pBB0M87uawxo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dcUe/sBJ9GNWX03i6gE+VoFiW5xO09Z+FkMtlNGr59czOF1dJT5FsqK/DqBk43ojP 3qMLCl+P+P9/VIHJUFIeoirsSuIzXIlxZcGAOsfJka8zYGwdMCrolnYtWIwTcYCZl0 9I+xXfx+tvzmXmxavxa18OW4jL7fxNKj++WiZgag= From: Tyler Retzlaff To: dev@dpdk.org Cc: bruce.richardson@intel.com, david.marchand@redhat.com, thomas@monjalon.net, mb@smartsharesystems.com, konstantin.ananyev@huawei.com, Tyler Retzlaff Subject: [PATCH v5 03/14] eal: use barrier intrinsics Date: Thu, 13 Apr 2023 14:25:52 -0700 Message-Id: <1681421163-18578-4-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1681421163-18578-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1681421163-18578-1-git-send-email-roretzla@linux.microsoft.com> 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 Inline assembly is not supported for MSVC x64 instead expand rte_compiler_barrier as _ReadWriteBarrier and for rte_smp_mb _m_mfence intrinsics. Signed-off-by: Tyler Retzlaff Acked-by: Bruce Richardson Acked-by: Konstantin Ananyev --- lib/eal/include/generic/rte_atomic.h | 4 ++++ lib/eal/x86/include/rte_atomic.h | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/lib/eal/include/generic/rte_atomic.h b/lib/eal/include/generic/rte_atomic.h index 234b268..e973184 100644 --- a/lib/eal/include/generic/rte_atomic.h +++ b/lib/eal/include/generic/rte_atomic.h @@ -116,9 +116,13 @@ * Guarantees that operation reordering does not occur at compile time * for operations directly before and after the barrier. */ +#ifndef RTE_TOOLCHAIN_MSVC #define rte_compiler_barrier() do { \ asm volatile ("" : : : "memory"); \ } while(0) +#else +#define rte_compiler_barrier() _ReadWriteBarrier() +#endif /** * Synchronization fence between threads based on the specified memory order. diff --git a/lib/eal/x86/include/rte_atomic.h b/lib/eal/x86/include/rte_atomic.h index f2ee1a9..569d3ab 100644 --- a/lib/eal/x86/include/rte_atomic.h +++ b/lib/eal/x86/include/rte_atomic.h @@ -66,11 +66,15 @@ static __rte_always_inline void rte_smp_mb(void) { +#ifndef RTE_TOOLCHAIN_MSVC #ifdef RTE_ARCH_I686 asm volatile("lock addl $0, -128(%%esp); " ::: "memory"); #else asm volatile("lock addl $0, -128(%%rsp); " ::: "memory"); #endif +#else + _mm_mfence(); +#endif } #define rte_io_mb() rte_mb() From patchwork Thu Apr 13 21:25:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 126042 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9E9A042937; Thu, 13 Apr 2023 23:26:34 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D044242D12; Thu, 13 Apr 2023 23:26:11 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id E8C3F427E9 for ; Thu, 13 Apr 2023 23:26:05 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 0CF88217926C; Thu, 13 Apr 2023 14:26:04 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 0CF88217926C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1681421165; bh=QEbhk43xBKijIEQLnc+WbV50VNTIJ2/wSVboPo+RcK0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pHeIcE57rmiXAojs+ebSb3OQdF2IRTUNL569v+CG3FYf4PBD1GWLEl/fRI7m5cehS 0V2Gy+O5rRhD6Ga/vRGGzW/5mK5zM/m2QF52g0qYHWiJCRs9cFfnD3WcArmzFX01qu SRlan2CTJX8r0y2jnLXAP6xIFLux30SLO7bvibeI= From: Tyler Retzlaff To: dev@dpdk.org Cc: bruce.richardson@intel.com, david.marchand@redhat.com, thomas@monjalon.net, mb@smartsharesystems.com, konstantin.ananyev@huawei.com, Tyler Retzlaff Subject: [PATCH v5 04/14] eal: use cpuid and cpuidex intrinsics Date: Thu, 13 Apr 2023 14:25:53 -0700 Message-Id: <1681421163-18578-5-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1681421163-18578-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1681421163-18578-1-git-send-email-roretzla@linux.microsoft.com> 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 Inline assembly is not supported for MSVC x64 instead use __cpuid and __cpuidex intrinsics. Signed-off-by: Tyler Retzlaff --- lib/eal/x86/rte_cpuflags.c | 4 ++++ lib/eal/x86/rte_cpuid.h | 7 +++++++ lib/eal/x86/rte_cycles.c | 36 ++++++++++++++++++++++++++++++++++++ lib/eal/x86/rte_hypervisor.c | 4 ++++ 4 files changed, 51 insertions(+) diff --git a/lib/eal/x86/rte_cpuflags.c b/lib/eal/x86/rte_cpuflags.c index d6b5182..e3624e7 100644 --- a/lib/eal/x86/rte_cpuflags.c +++ b/lib/eal/x86/rte_cpuflags.c @@ -165,9 +165,13 @@ struct feature_entry { if (maxleaf < feat->leaf) return 0; +#ifndef RTE_TOOLCHAIN_MSVC __cpuid_count(feat->leaf, feat->subleaf, regs[RTE_REG_EAX], regs[RTE_REG_EBX], regs[RTE_REG_ECX], regs[RTE_REG_EDX]); +#else + __cpuidex(regs, feat->leaf, feat->subleaf); +#endif /* check if the feature is enabled */ return (regs[feat->reg] >> feat->bit) & 1; diff --git a/lib/eal/x86/rte_cpuid.h b/lib/eal/x86/rte_cpuid.h index b773ad9..c6abaad 100644 --- a/lib/eal/x86/rte_cpuid.h +++ b/lib/eal/x86/rte_cpuid.h @@ -5,7 +5,9 @@ #ifndef RTE_CPUID_H #define RTE_CPUID_H +#ifndef RTE_TOOLCHAIN_MSVC #include +#endif enum cpu_register_t { RTE_REG_EAX = 0, @@ -16,4 +18,9 @@ enum cpu_register_t { typedef uint32_t cpuid_registers_t[4]; +#ifdef RTE_TOOLCHAIN_MSVC +int +__get_cpuid_max(unsigned int e, unsigned int *s); +#endif + #endif /* RTE_CPUID_H */ diff --git a/lib/eal/x86/rte_cycles.c b/lib/eal/x86/rte_cycles.c index 0e695ca..db56d39 100644 --- a/lib/eal/x86/rte_cycles.c +++ b/lib/eal/x86/rte_cycles.c @@ -4,7 +4,11 @@ #include #include +#ifndef RTE_TOOLCHAIN_MSVC #include +#else +#define bit_AVX (1 << 28) +#endif #include "eal_private.h" @@ -82,9 +86,25 @@ return 0; } +#ifdef RTE_TOOLCHAIN_MSVC +int +__get_cpuid_max(unsigned int e, unsigned int *s) +{ + uint32_t cpuinfo[4]; + + __cpuid(cpuinfo, e); + if (s) + *s = cpuinfo[1]; + return cpuinfo[0]; +} +#endif + uint64_t get_tsc_freq_arch(void) { +#ifdef RTE_TOOLCHAIN_MSVC + int cpuinfo[4]; +#endif uint64_t tsc_hz = 0; uint32_t a, b, c, d, maxleaf; uint8_t mult, model; @@ -97,14 +117,30 @@ maxleaf = __get_cpuid_max(0, NULL); if (maxleaf >= 0x15) { +#ifndef RTE_TOOLCHAIN_MSVC __cpuid(0x15, a, b, c, d); +#else + __cpuid(cpuinfo, 0x15); + a = cpuinfo[0]; + b = cpuinfo[1]; + c = cpuinfo[2]; + d = cpuinfo[3]; +#endif /* EBX : TSC/Crystal ratio, ECX : Crystal Hz */ if (b && c) return c * (b / a); } +#ifndef RTE_TOOLCHAIN_MSVC __cpuid(0x1, a, b, c, d); +#else + __cpuid(cpuinfo, 0x1); + a = cpuinfo[0]; + b = cpuinfo[1]; + c = cpuinfo[2]; + d = cpuinfo[3]; +#endif model = rte_cpu_get_model(a); if (check_model_wsm_nhm(model)) diff --git a/lib/eal/x86/rte_hypervisor.c b/lib/eal/x86/rte_hypervisor.c index c38cfc0..a9c2017 100644 --- a/lib/eal/x86/rte_hypervisor.c +++ b/lib/eal/x86/rte_hypervisor.c @@ -23,9 +23,13 @@ enum rte_hypervisor if (!rte_cpu_get_flag_enabled(RTE_CPUFLAG_HYPERVISOR)) return RTE_HYPERVISOR_NONE; +#ifndef RTE_TOOLCHAIN_MSVC __cpuid(HYPERVISOR_INFO_LEAF, regs[RTE_REG_EAX], regs[RTE_REG_EBX], regs[RTE_REG_ECX], regs[RTE_REG_EDX]); +#else + __cpuid(regs, HYPERVISOR_INFO_LEAF); +#endif for (reg = 1; reg < 4; reg++) memcpy(name + (reg - 1) * 4, ®s[reg], 4); name[12] = '\0'; From patchwork Thu Apr 13 21:25:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 126043 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3A7F142937; Thu, 13 Apr 2023 23:26:42 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id F2652427EE; Thu, 13 Apr 2023 23:26:12 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 92252410F9 for ; Thu, 13 Apr 2023 23:26:06 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 198F7217926E; Thu, 13 Apr 2023 14:26:04 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 198F7217926E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1681421165; bh=b5Xj6Gqh5y2rycHG1bErPdD+FhQhAU9d2JB9fZ6+Cvk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HxYL9fDJw2rQ/NdPLGqnZjTRx6VSd5Bw0Lyv3kefj1Nd/vxD/+fswtTWesFtljSyI 2UVH9LSTHNG1n/W1l8JyCXtBPWFWoHZODVDjz6soQ9q+K4zZBPTzR9QfGtkd0sA2aP IDbLISyd0LeI26c4LM9TWJfHwGoaZxr5IsaquW68= From: Tyler Retzlaff To: dev@dpdk.org Cc: bruce.richardson@intel.com, david.marchand@redhat.com, thomas@monjalon.net, mb@smartsharesystems.com, konstantin.ananyev@huawei.com, Tyler Retzlaff Subject: [PATCH v5 05/14] eal: use umonitor umwait and tpause intrinsics Date: Thu, 13 Apr 2023 14:25:54 -0700 Message-Id: <1681421163-18578-6-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1681421163-18578-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1681421163-18578-1-git-send-email-roretzla@linux.microsoft.com> 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 Inline assembly is not supported for MSVC x64 instead use _umonitor, _umwait and _tpause intrinsics. Signed-off-by: Tyler Retzlaff --- lib/eal/x86/rte_power_intrinsics.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/eal/x86/rte_power_intrinsics.c b/lib/eal/x86/rte_power_intrinsics.c index f749da9..7d83c24 100644 --- a/lib/eal/x86/rte_power_intrinsics.c +++ b/lib/eal/x86/rte_power_intrinsics.c @@ -109,9 +109,13 @@ */ /* set address for UMONITOR */ +#ifndef RTE_TOOLCHAIN_MSVC asm volatile(".byte 0xf3, 0x0f, 0xae, 0xf7;" : : "D"(pmc->addr)); +#else + _umonitor(pmc->addr); +#endif /* now that we've put this address into monitor, we can unlock */ rte_spinlock_unlock(&s->lock); @@ -123,10 +127,14 @@ goto end; /* execute UMWAIT */ +#ifndef RTE_TOOLCHAIN_MSVC asm volatile(".byte 0xf2, 0x0f, 0xae, 0xf7;" : /* ignore rflags */ : "D"(0), /* enter C0.2 */ "a"(tsc_l), "d"(tsc_h)); +#else + _umwait(tsc_l, tsc_h); +#endif end: /* erase sleep address */ @@ -153,10 +161,14 @@ return -ENOTSUP; /* execute TPAUSE */ +#ifndef RTE_TOOLCHAIN_MSVC asm volatile(".byte 0x66, 0x0f, 0xae, 0xf7;" : /* ignore rflags */ : "D"(0), /* enter C0.2 */ "a"(tsc_l), "d"(tsc_h)); +#else + _tpause(tsc_l, tsc_h); +#endif return 0; } From patchwork Thu Apr 13 21:25:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 126045 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9A3B842937; Thu, 13 Apr 2023 23:26:58 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2B09B42D35; Thu, 13 Apr 2023 23:26:15 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 97A2D4114B for ; Thu, 13 Apr 2023 23:26:06 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 26293217926F; Thu, 13 Apr 2023 14:26:04 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 26293217926F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1681421165; bh=6JKSiNmZlSLNQ4Gs5uqxhoIoBRV9/5Pyp6y6uc2+ikE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LZX/okia4xzwXGJ8djScISKS3AmwSKxw6gc4G4gma19lW5BqZwd9T5hxvCQr3TwMy my9ZW6bnwkHXJFnjSFPPLC1/YY+VkT3nk6YF6LmYrwxFuSGqOLspTAT2zucofCJk3i McDecGYRgDqXl99Z5pgk8KFU4O68o7/r70vubC7s= From: Tyler Retzlaff To: dev@dpdk.org Cc: bruce.richardson@intel.com, david.marchand@redhat.com, thomas@monjalon.net, mb@smartsharesystems.com, konstantin.ananyev@huawei.com, Tyler Retzlaff Subject: [PATCH v5 06/14] eal: use prefetch intrinsics Date: Thu, 13 Apr 2023 14:25:55 -0700 Message-Id: <1681421163-18578-7-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1681421163-18578-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1681421163-18578-1-git-send-email-roretzla@linux.microsoft.com> 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 Inline assembly is not supported for MSVC x64 instead use _mm_prefetch and _mm_cldemote intrinsics. Signed-off-by: Tyler Retzlaff Acked-by: Bruce Richardson --- lib/eal/x86/include/rte_prefetch.h | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/lib/eal/x86/include/rte_prefetch.h b/lib/eal/x86/include/rte_prefetch.h index 7fd01c4..239e611 100644 --- a/lib/eal/x86/include/rte_prefetch.h +++ b/lib/eal/x86/include/rte_prefetch.h @@ -9,30 +9,38 @@ extern "C" { #endif +#include + #include #include #include "generic/rte_prefetch.h" +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wcast-qual" + static inline void rte_prefetch0(const volatile void *p) { - asm volatile ("prefetcht0 %[p]" : : [p] "m" (*(const volatile char *)p)); + _mm_prefetch((const void *)p, _MM_HINT_T0); } static inline void rte_prefetch1(const volatile void *p) { - asm volatile ("prefetcht1 %[p]" : : [p] "m" (*(const volatile char *)p)); + _mm_prefetch((const void *)p, _MM_HINT_T1); } static inline void rte_prefetch2(const volatile void *p) { - asm volatile ("prefetcht2 %[p]" : : [p] "m" (*(const volatile char *)p)); + _mm_prefetch((const void *)p, _MM_HINT_T2); } static inline void rte_prefetch_non_temporal(const volatile void *p) { - asm volatile ("prefetchnta %[p]" : : [p] "m" (*(const volatile char *)p)); + _mm_prefetch((const void *)p, _MM_HINT_NTA); } +#pragma GCC diagnostic pop + +#ifndef RTE_TOOLCHAIN_MSVC /* * We use raw byte codes for now as only the newest compiler * versions support this instruction natively. @@ -43,6 +51,15 @@ static inline void rte_prefetch_non_temporal(const volatile void *p) { asm volatile(".byte 0x0f, 0x1c, 0x06" :: "S" (p)); } +#else +__rte_experimental +static inline void +rte_cldemote(const volatile void *p) +{ + _mm_cldemote(p); +} +#endif + #ifdef __cplusplus } From patchwork Thu Apr 13 21:25:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 126044 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E6B8242937; Thu, 13 Apr 2023 23:26:49 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1572642D2D; Thu, 13 Apr 2023 23:26:14 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 979514113D for ; Thu, 13 Apr 2023 23:26:06 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 323C02179271; Thu, 13 Apr 2023 14:26:04 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 323C02179271 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1681421165; bh=O8eIfcU706HtoHy20gBgY5DpWwofcvOMRRQodvcDCsA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TidAFBRTaocqEiMKiNmw/Nx9cUNEPrLnEopDelajqBA1WUjyTNFdenbqLbov+x8Lm 5/zhGOf17OUuTrVk2VXBnzI23nnBAsBiiQ6HeGWvxO2+FgJFeOBUT4JgeGSeTtv7t0 7rJJ+Fk4CgM7rM5qR+wgwPoTotgXtzlTaKUWb4DY= From: Tyler Retzlaff To: dev@dpdk.org Cc: bruce.richardson@intel.com, david.marchand@redhat.com, thomas@monjalon.net, mb@smartsharesystems.com, konstantin.ananyev@huawei.com, Tyler Retzlaff Subject: [PATCH v5 07/14] eal: use byte swap intrinsics Date: Thu, 13 Apr 2023 14:25:56 -0700 Message-Id: <1681421163-18578-8-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1681421163-18578-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1681421163-18578-1-git-send-email-roretzla@linux.microsoft.com> 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 Inline assembly is not supported for MSVC x64 instead expand use _byteswap_u{ushort,ulong,uint64} intrinsics instead. Signed-off-by: Tyler Retzlaff --- lib/eal/include/generic/rte_byteorder.h | 11 +++++++++++ lib/eal/x86/include/rte_byteorder.h | 4 ++++ 2 files changed, 15 insertions(+) diff --git a/lib/eal/include/generic/rte_byteorder.h b/lib/eal/include/generic/rte_byteorder.h index a67e1d7..1e32a1b 100644 --- a/lib/eal/include/generic/rte_byteorder.h +++ b/lib/eal/include/generic/rte_byteorder.h @@ -234,6 +234,7 @@ #endif /* __DOXYGEN__ */ #ifdef RTE_FORCE_INTRINSICS +#ifndef RTE_TOOLCHAIN_MSVC #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8) #define rte_bswap16(x) __builtin_bswap16(x) #endif @@ -241,6 +242,16 @@ #define rte_bswap32(x) __builtin_bswap32(x) #define rte_bswap64(x) __builtin_bswap64(x) +#else +/* + * note: we may want to #pragma intrsinsic(_byteswap_u{short,long,uint64}) + */ +#define rte_bswap16(x) _byteswap_ushort(x) + +#define rte_bswap32(x) _byteswap_ulong(x) + +#define rte_bswap64(x) _byteswap_uint64(x) +#endif #endif diff --git a/lib/eal/x86/include/rte_byteorder.h b/lib/eal/x86/include/rte_byteorder.h index a2dfecc..3d6e58e 100644 --- a/lib/eal/x86/include/rte_byteorder.h +++ b/lib/eal/x86/include/rte_byteorder.h @@ -18,6 +18,7 @@ #define RTE_BYTE_ORDER RTE_LITTLE_ENDIAN #endif +#ifndef RTE_TOOLCHAIN_MSVC /* * An architecture-optimized byte swap for a 16-bit value. * @@ -69,6 +70,7 @@ static inline uint32_t rte_arch_bswap32(uint32_t _x) rte_arch_bswap16(x))) #endif #endif +#endif #define rte_cpu_to_le_16(x) (x) #define rte_cpu_to_le_32(x) (x) @@ -86,11 +88,13 @@ static inline uint32_t rte_arch_bswap32(uint32_t _x) #define rte_be_to_cpu_32(x) rte_bswap32(x) #define rte_be_to_cpu_64(x) rte_bswap64(x) +#ifndef RTE_TOOLCHAIN_MSVC #ifdef RTE_ARCH_I686 #include "rte_byteorder_32.h" #else #include "rte_byteorder_64.h" #endif +#endif #ifdef __cplusplus } From patchwork Thu Apr 13 21:25:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 126049 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2802142937; Thu, 13 Apr 2023 23:27:26 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 96FFA42D4F; Thu, 13 Apr 2023 23:26:19 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id AB1C6427EE for ; Thu, 13 Apr 2023 23:26:06 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 3E6BA2179272; Thu, 13 Apr 2023 14:26:05 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 3E6BA2179272 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1681421165; bh=P2ngFHSpNuERGVeW3hUOcWOaegkLTVNf1kCcncg0qRg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oIJXXXDHWudizq53jllpo6+zOj87YK4YVqL0qNuLR7xVPm1LRO8zDyvrtVbPmTutP DwqvAF+bMVha8sJ71/r32HDZTVt11hWf3gPJlVyERcXxzaYKGIB9bs8HetbyFWN0u6 LzWr5CHGPWaSjLNQW3nLAWGFr+yq6XUE9pmeDNyM= From: Tyler Retzlaff To: dev@dpdk.org Cc: bruce.richardson@intel.com, david.marchand@redhat.com, thomas@monjalon.net, mb@smartsharesystems.com, konstantin.ananyev@huawei.com, Tyler Retzlaff Subject: [PATCH v5 08/14] eal: typedef cpu flag enum as int Date: Thu, 13 Apr 2023 14:25:57 -0700 Message-Id: <1681421163-18578-9-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1681421163-18578-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1681421163-18578-1-git-send-email-roretzla@linux.microsoft.com> 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 Forward declaration of a enum is a non-standard extension and is not supported by MSVC. Use an int instead. Abstract the use of the int/enum rte_cpu_flag_t in function parameter lists by re-typdefing the enum rte_cpu_flag_t to the rte_cpu_flag_t identifier. Remove the use of __extension__ on function prototypes where rte_cpu_flag_t appeared in parameter lists, it is sufficient to have the conditionally compiled __extension__ at the non-standard forward declaration site. Signed-off-by: Tyler Retzlaff --- lib/eal/include/generic/rte_cpuflags.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/eal/include/generic/rte_cpuflags.h b/lib/eal/include/generic/rte_cpuflags.h index d35551e..87ab03c 100644 --- a/lib/eal/include/generic/rte_cpuflags.h +++ b/lib/eal/include/generic/rte_cpuflags.h @@ -44,8 +44,12 @@ struct rte_cpu_intrinsics { /** * Enumeration of all CPU features supported */ +#ifndef RTE_TOOLCHAIN_MSVC __extension__ -enum rte_cpu_flag_t; +typedef enum rte_cpu_flag_t rte_cpu_flag_t; +#else +typedef int rte_cpu_flag_t; +#endif /** * Get name of CPU flag @@ -56,9 +60,8 @@ struct rte_cpu_intrinsics { * flag name * NULL if flag ID is invalid */ -__extension__ const char * -rte_cpu_get_flag_name(enum rte_cpu_flag_t feature); +rte_cpu_get_flag_name(rte_cpu_flag_t feature); /** * Function for checking a CPU flag availability @@ -70,9 +73,8 @@ struct rte_cpu_intrinsics { * 0 if flag is not available * -ENOENT if flag is invalid */ -__extension__ int -rte_cpu_get_flag_enabled(enum rte_cpu_flag_t feature); +rte_cpu_get_flag_enabled(rte_cpu_flag_t feature); /** * This function checks that the currently used CPU supports the CPU features From patchwork Thu Apr 13 21:25:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 126046 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 652CD42937; Thu, 13 Apr 2023 23:27:06 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 29DC642D3B; Thu, 13 Apr 2023 23:26:16 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 9262E41138 for ; Thu, 13 Apr 2023 23:26:06 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 4AEE72179274; Thu, 13 Apr 2023 14:26:05 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 4AEE72179274 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1681421165; bh=AWyKJp6O9ApQXeYM5QkWKI26SuJSOfqATrO2lIL0Fm4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=amwxUhdjWOWwt2jLGhBv5LZNFzpUdcLs4rfjgViOFxDstxUMFm/uZuWKkW3E/+onS 78+yTsQ7S7vySEXYZUJUfe4yoqhKmtX5nKh39xoSyKN2QnvFNKknRCpzTAyHkQhNq7 CpaOj4Fc1wt4Uv4gkg/nRnVxikJdnE/vcHL0uZD4= From: Tyler Retzlaff To: dev@dpdk.org Cc: bruce.richardson@intel.com, david.marchand@redhat.com, thomas@monjalon.net, mb@smartsharesystems.com, konstantin.ananyev@huawei.com, Tyler Retzlaff Subject: [PATCH v5 09/14] eal: hide GCC extension based alignment markers Date: Thu, 13 Apr 2023 14:25:58 -0700 Message-Id: <1681421163-18578-10-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1681421163-18578-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1681421163-18578-1-git-send-email-roretzla@linux.microsoft.com> 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 When compiling with MSVC don't expose typedefs used as alignment markers. Signed-off-by: Tyler Retzlaff --- lib/eal/include/rte_common.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h index 15765b4..2f464e3 100644 --- a/lib/eal/include/rte_common.h +++ b/lib/eal/include/rte_common.h @@ -460,6 +460,8 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void) /*********** Structure alignment markers ********/ +#ifndef RTE_TOOLCHAIN_MSVC + /** Generic marker for any place in a structure. */ __extension__ typedef void *RTE_MARKER[0]; /** Marker for 1B alignment in a structure. */ @@ -471,6 +473,8 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void) /** Marker for 8B alignment in a structure. */ __extension__ typedef uint64_t RTE_MARKER64[0]; +#endif + /** * Combines 32b inputs most significant set bits into the least * significant bits to construct a value with the same MSBs as x From patchwork Thu Apr 13 21:25:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 126047 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2EA2642937; Thu, 13 Apr 2023 23:27:14 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4D8E742D3F; Thu, 13 Apr 2023 23:26:17 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 9CC7C427E9 for ; Thu, 13 Apr 2023 23:26:06 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 572922179275; Thu, 13 Apr 2023 14:26:05 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 572922179275 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1681421165; bh=QNqS/SqDPvc6VgF9WfdfN/EiXKiEaZ6ZLx8uVwNN/RI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LH09v+9Ob5b88SlvT9aDlmI3IP/ZmsVByVPMuuXKOzW4BhusndK0u4w76JQ4oHp4m YI7ykgEe5h//waOIViRk+2JasMZKNnzpidI5PX/+e5K7zJ/bUDwPJ/v9iyazC01uEH WU+Jjp2PGmejnvb2ZGDa8iIft2j0HBq8b14R9/Fs= From: Tyler Retzlaff To: dev@dpdk.org Cc: bruce.richardson@intel.com, david.marchand@redhat.com, thomas@monjalon.net, mb@smartsharesystems.com, konstantin.ananyev@huawei.com, Tyler Retzlaff Subject: [PATCH v5 10/14] eal: hide typedefs based on GCC vector extensions Date: Thu, 13 Apr 2023 14:25:59 -0700 Message-Id: <1681421163-18578-11-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1681421163-18578-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1681421163-18578-1-git-send-email-roretzla@linux.microsoft.com> 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 When compiling with MSVC don't expose typedefs based on GCC vector extensions. Signed-off-by: Tyler Retzlaff --- lib/eal/include/generic/rte_vect.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/eal/include/generic/rte_vect.h b/lib/eal/include/generic/rte_vect.h index 3fec2bf..777510c 100644 --- a/lib/eal/include/generic/rte_vect.h +++ b/lib/eal/include/generic/rte_vect.h @@ -17,6 +17,8 @@ #include +#ifndef RTE_TOOLCHAIN_MSVC + /* Unsigned vector types */ /** @@ -186,6 +188,8 @@ */ typedef int64_t rte_v256s64_t __attribute__((vector_size(32), aligned(32))); +#endif + /** * The max SIMD bitwidth value to limit vector path selection. */ From patchwork Thu Apr 13 21:26:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 126051 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 395A542937; Thu, 13 Apr 2023 23:27:36 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D36AE42D55; Thu, 13 Apr 2023 23:26:21 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id B8FDF42B71 for ; Thu, 13 Apr 2023 23:26:06 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 6373A2179277; Thu, 13 Apr 2023 14:26:05 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 6373A2179277 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1681421165; bh=41yLJAgNi/xV9yqiZ60mMe06Pd1e3Ago9tEarBQWj1I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wx6thqmPG9cg/zSGwGTcFbS9uOEfsV/K3SpJjn53g3zIU1HQ7LV67ZlhR6/QEonn7 2TYz91zhoAN3Wl0+ZS1ovA9q3T194sv67ScVeadIZKd7dYUGXnWOVTqVABE7fp0omh LhW52huRZtce6dSSV9I8Qlt/N9s2m8TJ/Qao7rE0= From: Tyler Retzlaff To: dev@dpdk.org Cc: bruce.richardson@intel.com, david.marchand@redhat.com, thomas@monjalon.net, mb@smartsharesystems.com, konstantin.ananyev@huawei.com, Tyler Retzlaff Subject: [PATCH v5 11/14] eal: expand most macros to empty when using MSVC Date: Thu, 13 Apr 2023 14:26:00 -0700 Message-Id: <1681421163-18578-12-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1681421163-18578-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1681421163-18578-1-git-send-email-roretzla@linux.microsoft.com> 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 For now expand a lot of common rte macros empty. The catch here is we need to test that most of the macros do what they should but at the same time they are blocking work needed to bootstrap of the unit tests. Later we will return and provide (where possible) expansions that work correctly for msvc and where not possible provide some alternate macros to achieve the same outcome. Signed-off-by: Tyler Retzlaff --- lib/eal/include/rte_branch_prediction.h | 8 ++++++ lib/eal/include/rte_common.h | 45 +++++++++++++++++++++++++++++++++ lib/eal/include/rte_compat.h | 20 +++++++++++++++ 3 files changed, 73 insertions(+) diff --git a/lib/eal/include/rte_branch_prediction.h b/lib/eal/include/rte_branch_prediction.h index 0256a9d..d9a0224 100644 --- a/lib/eal/include/rte_branch_prediction.h +++ b/lib/eal/include/rte_branch_prediction.h @@ -25,7 +25,11 @@ * */ #ifndef likely +#ifndef RTE_TOOLCHAIN_MSVC #define likely(x) __builtin_expect(!!(x), 1) +#else +#define likely(x) (x) +#endif #endif /* likely */ /** @@ -39,7 +43,11 @@ * */ #ifndef unlikely +#ifndef RTE_TOOLCHAIN_MSVC #define unlikely(x) __builtin_expect(!!(x), 0) +#else +#define unlikely(x) (x) +#endif #endif /* unlikely */ #ifdef __cplusplus diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h index 2f464e3..1bdaa2d 100644 --- a/lib/eal/include/rte_common.h +++ b/lib/eal/include/rte_common.h @@ -65,7 +65,11 @@ /** * Force alignment */ +#ifndef RTE_TOOLCHAIN_MSVC #define __rte_aligned(a) __attribute__((__aligned__(a))) +#else +#define __rte_aligned(a) +#endif #ifdef RTE_ARCH_STRICT_ALIGN typedef uint64_t unaligned_uint64_t __rte_aligned(1); @@ -80,16 +84,29 @@ /** * Force a structure to be packed */ +#ifndef RTE_TOOLCHAIN_MSVC #define __rte_packed __attribute__((__packed__)) +#else +#define __rte_packed +#endif /** * Macro to mark a type that is not subject to type-based aliasing rules */ +#ifndef RTE_TOOLCHAIN_MSVC #define __rte_may_alias __attribute__((__may_alias__)) +#else +#define __rte_may_alias +#endif /******* Macro to mark functions and fields scheduled for removal *****/ +#ifndef RTE_TOOLCHAIN_MSVC #define __rte_deprecated __attribute__((__deprecated__)) #define __rte_deprecated_msg(msg) __attribute__((__deprecated__(msg))) +#else +#define __rte_deprecated +#define __rte_deprecated_msg(msg) +#endif /** * Macro to mark macros and defines scheduled for removal @@ -110,14 +127,22 @@ /** * Force symbol to be generated even if it appears to be unused. */ +#ifndef RTE_TOOLCHAIN_MSVC #define __rte_used __attribute__((used)) +#else +#define __rte_used +#endif /*********** Macros to eliminate unused variable warnings ********/ /** * short definition to mark a function parameter unused */ +#ifndef RTE_TOOLCHAIN_MSVC #define __rte_unused __attribute__((__unused__)) +#else +#define __rte_unused +#endif /** * Mark pointer as restricted with regard to pointer aliasing. @@ -141,6 +166,7 @@ * even if the underlying stdio implementation is ANSI-compliant, * so this must be overridden. */ +#ifndef RTE_TOOLCHAIN_MSVC #if RTE_CC_IS_GNU #define __rte_format_printf(format_index, first_arg) \ __attribute__((format(gnu_printf, format_index, first_arg))) @@ -148,6 +174,9 @@ #define __rte_format_printf(format_index, first_arg) \ __attribute__((format(printf, format_index, first_arg))) #endif +#else +#define __rte_format_printf(format_index, first_arg) +#endif /** * Tells compiler that the function returns a value that points to @@ -222,7 +251,11 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void) /** * Hint never returning function */ +#ifndef RTE_TOOLCHAIN_MSVC #define __rte_noreturn __attribute__((noreturn)) +#else +#define __rte_noreturn +#endif /** * Issue a warning in case the function's return value is ignored. @@ -247,12 +280,20 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void) * } * @endcode */ +#ifndef RTE_TOOLCHAIN_MSVC #define __rte_warn_unused_result __attribute__((warn_unused_result)) +#else +#define __rte_warn_unused_result +#endif /** * Force a function to be inlined */ +#ifndef RTE_TOOLCHAIN_MSVC #define __rte_always_inline inline __attribute__((always_inline)) +#else +#define __rte_always_inline +#endif /** * Force a function to be noinlined @@ -437,7 +478,11 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void) #define RTE_CACHE_LINE_MIN_SIZE 64 /** Force alignment to cache line. */ +#ifndef RTE_TOOLCHAIN_MSVC #define __rte_cache_aligned __rte_aligned(RTE_CACHE_LINE_SIZE) +#else +#define __rte_cache_aligned +#endif /** Force minimum cache line alignment. */ #define __rte_cache_min_aligned __rte_aligned(RTE_CACHE_LINE_MIN_SIZE) diff --git a/lib/eal/include/rte_compat.h b/lib/eal/include/rte_compat.h index fc9fbaa..6a4b5ee 100644 --- a/lib/eal/include/rte_compat.h +++ b/lib/eal/include/rte_compat.h @@ -12,14 +12,22 @@ #ifndef ALLOW_EXPERIMENTAL_API +#ifndef RTE_TOOLCHAIN_MSVC #define __rte_experimental \ __attribute__((deprecated("Symbol is not yet part of stable ABI"), \ section(".text.experimental"))) +#else +#define __rte_experimental +#endif #else +#ifndef RTE_TOOLCHAIN_MSVC #define __rte_experimental \ __attribute__((section(".text.experimental"))) +#else +#define __rte_experimental +#endif #endif @@ -30,23 +38,35 @@ #if !defined ALLOW_INTERNAL_API && __has_attribute(error) /* For GCC */ +#ifndef RTE_TOOLCHAIN_MSVC #define __rte_internal \ __attribute__((error("Symbol is not public ABI"), \ section(".text.internal"))) +#else +#define __rte_internal +#endif #elif !defined ALLOW_INTERNAL_API && __has_attribute(diagnose_if) /* For clang */ +#ifndef RTE_TOOLCHAIN_MSVC #define __rte_internal \ _Pragma("GCC diagnostic push") \ _Pragma("GCC diagnostic ignored \"-Wgcc-compat\"") \ __attribute__((diagnose_if(1, "Symbol is not public ABI", "error"), \ section(".text.internal"))) \ _Pragma("GCC diagnostic pop") +#else +#define __rte_internal +#endif #else +#ifndef RTE_TOOLCHAIN_MSVC #define __rte_internal \ __attribute__((section(".text.internal"))) +#else +#define __rte_internal +#endif #endif From patchwork Thu Apr 13 21:26:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 126048 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D51E142937; Thu, 13 Apr 2023 23:27:20 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6EB8042D46; Thu, 13 Apr 2023 23:26:18 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id B6E1C427F2 for ; Thu, 13 Apr 2023 23:26:06 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 706292179278; Thu, 13 Apr 2023 14:26:05 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 706292179278 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1681421165; bh=k3KEqdgwVw2SDZ2O7PW5zaVaGmkEUm/4x4ucmbO54YE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gEqQ4trJUZO2krbPyu8CM3/rH0RSHO2vePCLLSzNN0d+pM52E6evNrGHr/V79dbhd NWiTNJl7Fo7/FvEb7OMtbTq76z3u+kxEHOkUbsmpmccGfoJ5JuI5dc2yqjX+ZSBp2R xe+HVhTvk8PQw6mVfURnlbQAbiZw/RSHXsBaP8ys= From: Tyler Retzlaff To: dev@dpdk.org Cc: bruce.richardson@intel.com, david.marchand@redhat.com, thomas@monjalon.net, mb@smartsharesystems.com, konstantin.ananyev@huawei.com, Tyler Retzlaff Subject: [PATCH v5 12/14] eal: exclude exposure of rte atomic APIs for MSVC builds Date: Thu, 13 Apr 2023 14:26:01 -0700 Message-Id: <1681421163-18578-13-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1681421163-18578-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1681421163-18578-1-git-send-email-roretzla@linux.microsoft.com> 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 It's discouraged to use rte_atomics APIs instead standard APIs should be used from C11. Since MSVC is a new toolchain/platform combination block visibility of the rte_atomic APIs from day 1. Signed-off-by: Tyler Retzlaff --- lib/eal/include/generic/rte_atomic.h | 7 +++++++ lib/eal/x86/include/rte_atomic.h | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/lib/eal/include/generic/rte_atomic.h b/lib/eal/include/generic/rte_atomic.h index e973184..1964697 100644 --- a/lib/eal/include/generic/rte_atomic.h +++ b/lib/eal/include/generic/rte_atomic.h @@ -131,6 +131,8 @@ /*------------------------- 16 bit atomic operations -------------------------*/ +#ifndef RTE_TOOLCHAIN_MSVC + /** * Atomic compare and set. * @@ -1038,8 +1040,11 @@ static inline void rte_atomic64_clear(rte_atomic64_t *v) } #endif +#endif + /*------------------------ 128 bit atomic operations -------------------------*/ + /** * 128-bit integer structure. */ @@ -1049,8 +1054,10 @@ static inline void rte_atomic64_clear(rte_atomic64_t *v) union { uint64_t val[2]; #ifdef RTE_ARCH_64 +#ifndef RTE_TOOLCHAIN_MSVC __extension__ __int128 int128; #endif +#endif }; } __rte_aligned(16) rte_int128_t; diff --git a/lib/eal/x86/include/rte_atomic.h b/lib/eal/x86/include/rte_atomic.h index 569d3ab..adf3309 100644 --- a/lib/eal/x86/include/rte_atomic.h +++ b/lib/eal/x86/include/rte_atomic.h @@ -83,6 +83,8 @@ #define rte_io_rmb() rte_compiler_barrier() +#ifndef RTE_TOOLCHAIN_MSVC + /** * Synchronization fence between threads based on the specified memory order. * @@ -279,6 +281,8 @@ static inline int rte_atomic32_dec_and_test(rte_atomic32_t *v) #include "rte_atomic_64.h" #endif +#endif + #ifdef __cplusplus } #endif From patchwork Thu Apr 13 21:26:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 126052 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D0D7242937; Thu, 13 Apr 2023 23:27:41 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D058F42D5C; Thu, 13 Apr 2023 23:26:22 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id DE4FF42B7E for ; Thu, 13 Apr 2023 23:26:06 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 7CE2E217927A; Thu, 13 Apr 2023 14:26:05 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 7CE2E217927A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1681421165; bh=/YkmuW0APYR2bfrzGw4AwOlwE0dvGFwKt7D9Pb5cbMI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RkSojYHJqxZi1DZsD6SxVTNbaz15iex5l5RapyCuOaui6QGeZ5GcOmxVQV7wV7Yke YQHQn/PIBDPHHsDDNWeKtYpiWV0ZI19sh7AWvndTsmKQ0cYqNBIcVeaj0G3g4JImfV ifkBEg+T2SfIGP8JxNO/1IymwqtK3F98ebwDyuBE= From: Tyler Retzlaff To: dev@dpdk.org Cc: bruce.richardson@intel.com, david.marchand@redhat.com, thomas@monjalon.net, mb@smartsharesystems.com, konstantin.ananyev@huawei.com, Tyler Retzlaff Subject: [PATCH v5 13/14] telemetry: avoid expanding versioned symbol macros on MSVC Date: Thu, 13 Apr 2023 14:26:02 -0700 Message-Id: <1681421163-18578-14-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1681421163-18578-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1681421163-18578-1-git-send-email-roretzla@linux.microsoft.com> 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 Windows does not support versioned symbols. Fortunately Windows also doesn't have an exported stable ABI. Export rte_tel_data_add_array_int -> rte_tel_data_add_array_int_24 and rte_tel_data_add_dict_int -> rte_tel_data_add_dict_int_v24 functions. Windows does have a way to achieve similar versioning for symbols but it is not a simple #define so it will be done as a work package later. Signed-off-by: Tyler Retzlaff Acked-by: Bruce Richardson --- lib/telemetry/telemetry_data.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/telemetry/telemetry_data.c b/lib/telemetry/telemetry_data.c index 2bac2de..284c16e 100644 --- a/lib/telemetry/telemetry_data.c +++ b/lib/telemetry/telemetry_data.c @@ -82,8 +82,16 @@ /* mark the v23 function as the older version, and v24 as the default version */ VERSION_SYMBOL(rte_tel_data_add_array_int, _v23, 23); BIND_DEFAULT_SYMBOL(rte_tel_data_add_array_int, _v24, 24); +#ifndef RTE_TOOLCHAIN_MSVC MAP_STATIC_SYMBOL(int rte_tel_data_add_array_int(struct rte_tel_data *d, int64_t x), rte_tel_data_add_array_int_v24); +#else +int +rte_tel_data_add_array_int(struct rte_tel_data *d, int64_t x) +{ + return rte_tel_data_add_array_int_v24(d, x); +} +#endif int rte_tel_data_add_array_uint(struct rte_tel_data *d, uint64_t x) @@ -220,8 +228,16 @@ /* mark the v23 function as the older version, and v24 as the default version */ VERSION_SYMBOL(rte_tel_data_add_dict_int, _v23, 23); BIND_DEFAULT_SYMBOL(rte_tel_data_add_dict_int, _v24, 24); +#ifndef RTE_TOOLCHAIN_MSVC MAP_STATIC_SYMBOL(int rte_tel_data_add_dict_int(struct rte_tel_data *d, const char *name, int64_t val), rte_tel_data_add_dict_int_v24); +#else +int +rte_tel_data_add_dict_int(struct rte_tel_data *d, const char *name, int64_t val) +{ + return rte_tel_data_add_dict_int_v24(d, name, val); +} +#endif int rte_tel_data_add_dict_uint(struct rte_tel_data *d, From patchwork Thu Apr 13 21:26:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 126050 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 04C1842937; Thu, 13 Apr 2023 23:27:31 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BF36B42D52; Thu, 13 Apr 2023 23:26:20 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id DED3242B8E for ; Thu, 13 Apr 2023 23:26:06 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 89A82217927B; Thu, 13 Apr 2023 14:26:05 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 89A82217927B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1681421165; bh=8on7f5KOnzyE/Ck4bUeZNE7S/wslIwvoL11klw2VH0Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N7Rh3ehF/+IaTGIJWHSJNHhxGvVTfMC7EGo70djEWU6BSMIx2xWZtDBXSBKdw2FlM 8LDMCAhMbzB6KYGmyfun8iqHYkEsFO3TXZXpsCj5KHbnfsKIKILXj4iqpVEme31hdL mnRrlxtzUInucho2DNFew5+wkahlIGk8opW809Kg= From: Tyler Retzlaff To: dev@dpdk.org Cc: bruce.richardson@intel.com, david.marchand@redhat.com, thomas@monjalon.net, mb@smartsharesystems.com, konstantin.ananyev@huawei.com, Tyler Retzlaff Subject: [PATCH v5 14/14] eal: always define MSVC as little endian Date: Thu, 13 Apr 2023 14:26:03 -0700 Message-Id: <1681421163-18578-15-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1681421163-18578-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1681421163-18578-1-git-send-email-roretzla@linux.microsoft.com> 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 The MSVC compiler does not target big endian platforms so define little endian always. Signed-off-by: Tyler Retzlaff --- lib/eal/include/generic/rte_byteorder.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/eal/include/generic/rte_byteorder.h b/lib/eal/include/generic/rte_byteorder.h index 1e32a1b..375f118 100644 --- a/lib/eal/include/generic/rte_byteorder.h +++ b/lib/eal/include/generic/rte_byteorder.h @@ -45,6 +45,8 @@ #define RTE_BYTE_ORDER RTE_BIG_ENDIAN #elif defined __LITTLE_ENDIAN__ #define RTE_BYTE_ORDER RTE_LITTLE_ENDIAN +#elif defined RTE_TOOLCHAIN_MSVC +#define RTE_BYTE_ORDER RTE_LITTLE_ENDIAN #endif #if !defined(RTE_BYTE_ORDER) #error Unknown endianness.