From patchwork Tue Jul 11 16:49:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 129455 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 6985642E48; Tue, 11 Jul 2023 18:49:21 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DDEE94003C; Tue, 11 Jul 2023 18:49:20 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 418BD40A7D for ; Tue, 11 Jul 2023 18:49:19 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 8D25121C3A89; Tue, 11 Jul 2023 09:49:18 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 8D25121C3A89 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1689094158; bh=IrH2ynVpYKsiyF65alm/shyk0lKAgoOI0fwhRze6FZI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ia52I15doAH4P8kGyTlm1XrWMIQ4/ZsEMmmkTT5C3VHmYrRIo+HfLQLoA7Wo8OBJ3 eeYB0qWJPoKiAHj8pKr2PD2SB7j86drxVMsb6nkA6RM12xrXRLyncfjl32WkRjjwjC FOyGfS/Cb4G5GIuZCRJ5vLPHfXEENQxIXuXgE8Z4= From: Tyler Retzlaff To: dev@dpdk.org Cc: Bruce Richardson , Konstantin Ananyev , Ciara Power , thomas@monjalon.net, david.marchand@redhat.com, mb@smartsharesystems.com, Tyler Retzlaff Subject: [PATCH v9 01/14] eal: use rdtsc intrinsic Date: Tue, 11 Jul 2023 09:49:04 -0700 Message-Id: <1689094157-16873-2-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1689094157-16873-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1689094157-16873-1-git-send-email-roretzla@linux.microsoft.com> MIME-Version: 1.0 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 Acked-by: Morten Brørup --- 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..ca0fb10 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_ +#ifdef 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 Tue Jul 11 16:49:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 129457 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 56CFC42E48; Tue, 11 Jul 2023 18:49:31 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0F09A42B8C; Tue, 11 Jul 2023 18:49:23 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 546F740A89 for ; Tue, 11 Jul 2023 18:49:19 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 9A4EE21C3A8D; Tue, 11 Jul 2023 09:49:18 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 9A4EE21C3A8D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1689094158; bh=byPfLLUjMSJsBQ1JgxyTOR6ow5661BT1rTeQLtGbIts=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VJm92sL5Cafkj2E7z5qp8z4s1sz6/SDiTClLh5+KacwKevsGOSLPHq6/CYmXEU9wW jZQpQu1ydhQFappOzCvFIcZC07XDNwDqC+5exh5/m7zUwvgV8pbKWALiQ2uIvZCQSG 3MgrmfDBQGHnBEW70CQkvEp5elq6/8vOcTxKeLM8= From: Tyler Retzlaff To: dev@dpdk.org Cc: Bruce Richardson , Konstantin Ananyev , Ciara Power , thomas@monjalon.net, david.marchand@redhat.com, mb@smartsharesystems.com, Tyler Retzlaff Subject: [PATCH v9 02/14] eal: use rtm and xtest intrinsics Date: Tue, 11 Jul 2023 09:49:05 -0700 Message-Id: <1689094157-16873-3-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1689094157-16873-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1689094157-16873-1-git-send-email-roretzla@linux.microsoft.com> MIME-Version: 1.0 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 Acked-by: Morten Brørup --- 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 Tue Jul 11 16:49:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 129458 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 97CEC42E48; Tue, 11 Jul 2023 18:49:37 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2D0F442C4D; Tue, 11 Jul 2023 18:49:24 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 593BE40C35 for ; Tue, 11 Jul 2023 18:49:19 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id A91EA21C3A93; Tue, 11 Jul 2023 09:49:18 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com A91EA21C3A93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1689094158; bh=vY0QQgx3OOWa3+3NNuFfxU1b3j/IYPW0l1t9dJWYM7w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F7wB7lGekTDWOP+vbPk4xhLeEuCJpXDa49VH71Xy/Anr+afi9+Z0GwtNwRrz7X6S8 5XZMnua30GAB3ONAK3zS6IYVQoloBCOkLF7cuH8q6+Cfw9TPdWVbVNu0jvRL8+sveF 0q8vUJjsOrkx1ejbtH2DDHhqw+g1DbdY2FVPsgmQ= From: Tyler Retzlaff To: dev@dpdk.org Cc: Bruce Richardson , Konstantin Ananyev , Ciara Power , thomas@monjalon.net, david.marchand@redhat.com, mb@smartsharesystems.com, Tyler Retzlaff Subject: [PATCH v9 03/14] eal: use barrier intrinsics Date: Tue, 11 Jul 2023 09:49:06 -0700 Message-Id: <1689094157-16873-4-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1689094157-16873-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1689094157-16873-1-git-send-email-roretzla@linux.microsoft.com> MIME-Version: 1.0 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 Acked-by: Morten Brørup --- 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 58df843..6a6c394 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. */ +#ifdef RTE_TOOLCHAIN_MSVC +#define rte_compiler_barrier() _ReadWriteBarrier() +#else #define rte_compiler_barrier() do { \ asm volatile ("" : : : "memory"); \ } while(0) +#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..7aba1c3 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) { +#ifdef RTE_TOOLCHAIN_MSVC + _mm_mfence(); +#else #ifdef RTE_ARCH_I686 asm volatile("lock addl $0, -128(%%esp); " ::: "memory"); #else asm volatile("lock addl $0, -128(%%rsp); " ::: "memory"); #endif +#endif } #define rte_io_mb() rte_mb() From patchwork Tue Jul 11 16:49:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 129459 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 9F33242E48; Tue, 11 Jul 2023 18:49:44 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3E84642D10; Tue, 11 Jul 2023 18:49:25 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 832DA410DC for ; Tue, 11 Jul 2023 18:49:19 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id B61B521C3F06; Tue, 11 Jul 2023 09:49:18 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com B61B521C3F06 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1689094158; bh=bPgAm+R23dJoygVwnfMeNv3Rc6j/VXQwtzi9fLarLXU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dmYpxxJGKbQdvSyz+502TjTEF8aAHENFDOPxu6BtpiJAj6B1rJOtpfMvhQuzGwCOH BqE5ZxArhX1iJ3wCnWZzdviZHawyM8A5qRd40UUS3MryhnwVexDZ78TliPBRX1zbaq zchGVy8kKMETk36+Zl1eYxnSaEsvHQI2SrGL2DrM= From: Tyler Retzlaff To: dev@dpdk.org Cc: Bruce Richardson , Konstantin Ananyev , Ciara Power , thomas@monjalon.net, david.marchand@redhat.com, mb@smartsharesystems.com, Tyler Retzlaff Subject: [PATCH v9 04/14] eal: use cpuid and cpuidex intrinsics Date: Tue, 11 Jul 2023 09:49:07 -0700 Message-Id: <1689094157-16873-5-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1689094157-16873-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1689094157-16873-1-git-send-email-roretzla@linux.microsoft.com> MIME-Version: 1.0 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 Acked-by: Morten Brørup --- lib/eal/x86/rte_cpuflags.c | 6 +++++- lib/eal/x86/rte_cpuid.h | 7 +++++++ lib/eal/x86/rte_cycles.c | 36 ++++++++++++++++++++++++++++++++++++ lib/eal/x86/rte_hypervisor.c | 4 ++++ 4 files changed, 52 insertions(+), 1 deletion(-) diff --git a/lib/eal/x86/rte_cpuflags.c b/lib/eal/x86/rte_cpuflags.c index d6b5182..8a30f79 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; - __cpuid_count(feat->leaf, feat->subleaf, +#ifdef RTE_TOOLCHAIN_MSVC + __cpuidex(regs, feat->leaf, feat->subleaf); +#else + __cpuid_count(feat->leaf, feat->subleaf, regs[RTE_REG_EAX], regs[RTE_REG_EBX], regs[RTE_REG_ECX], regs[RTE_REG_EDX]); +#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..69ed59b 100644 --- a/lib/eal/x86/rte_cycles.c +++ b/lib/eal/x86/rte_cycles.c @@ -4,7 +4,11 @@ #include #include +#ifdef RTE_TOOLCHAIN_MSVC +#define bit_AVX (1 << 28) +#else #include +#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) { +#ifdef RTE_TOOLCHAIN_MSVC + __cpuid(cpuinfo, 0x15); + a = cpuinfo[0]; + b = cpuinfo[1]; + c = cpuinfo[2]; + d = cpuinfo[3]; +#else __cpuid(0x15, a, b, c, d); +#endif /* EBX : TSC/Crystal ratio, ECX : Crystal Hz */ if (b && c) return c * (b / a); } +#ifdef RTE_TOOLCHAIN_MSVC + __cpuid(cpuinfo, 0x1); + a = cpuinfo[0]; + b = cpuinfo[1]; + c = cpuinfo[2]; + d = cpuinfo[3]; +#else __cpuid(0x1, a, b, c, d); +#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..04fe767 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; +#ifdef RTE_TOOLCHAIN_MSVC + __cpuid(regs, HYPERVISOR_INFO_LEAF); +#else __cpuid(HYPERVISOR_INFO_LEAF, regs[RTE_REG_EAX], regs[RTE_REG_EBX], regs[RTE_REG_ECX], regs[RTE_REG_EDX]); +#endif for (reg = 1; reg < 4; reg++) memcpy(name + (reg - 1) * 4, ®s[reg], 4); name[12] = '\0'; From patchwork Tue Jul 11 16:49:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 129465 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 E568342E48; Tue, 11 Jul 2023 18:50:20 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1E78242D43; Tue, 11 Jul 2023 18:49:32 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 4363D410EE for ; Tue, 11 Jul 2023 18:49:20 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id C2C2821C3F29; Tue, 11 Jul 2023 09:49:18 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com C2C2821C3F29 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1689094158; bh=U8fBf6+L/dc/zzYVgJ5T4l8jR24GWdImZv4rIvBjEzY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B1pl77GcEqxaQOz1S2J0kviNaO1G6Gi5CzxSWZLLFTZu0+fHA/zkLnf4ZJy9gdW5p 4Ko4zzI8B7pj0FzQHimVaSHdp2xBZGqJPZ/KCFa198QaSJGAMs3vVWmmrX35tRfwlI cpdBw+1U8NBSoNRxNVVHmR4KBaQZcIzNf0yuHwwc= From: Tyler Retzlaff To: dev@dpdk.org Cc: Bruce Richardson , Konstantin Ananyev , Ciara Power , thomas@monjalon.net, david.marchand@redhat.com, mb@smartsharesystems.com, Tyler Retzlaff Subject: [PATCH v9 05/14] eal: use umonitor umwait and tpause intrinsics Date: Tue, 11 Jul 2023 09:49:08 -0700 Message-Id: <1689094157-16873-6-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1689094157-16873-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1689094157-16873-1-git-send-email-roretzla@linux.microsoft.com> MIME-Version: 1.0 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 Acked-by: Morten Brørup Acked-by: Konstantin Ananyev --- 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..4066d13 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 */ +#if defined(RTE_TOOLCHAIN_MSVC) || defined(__WAITPKG__) + _umonitor(pmc->addr); +#else asm volatile(".byte 0xf3, 0x0f, 0xae, 0xf7;" : : "D"(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 */ +#if defined(RTE_TOOLCHAIN_MSVC) || defined(__WAITPKG__) + _umwait(tsc_l, tsc_h); +#else asm volatile(".byte 0xf2, 0x0f, 0xae, 0xf7;" : /* ignore rflags */ : "D"(0), /* enter C0.2 */ "a"(tsc_l), "d"(tsc_h)); +#endif end: /* erase sleep address */ @@ -153,10 +161,14 @@ return -ENOTSUP; /* execute TPAUSE */ +#if defined(RTE_TOOLCHAIN_MSVC) || defined(__WAITPKG__) + _tpause(tsc_l, tsc_h); +#else asm volatile(".byte 0x66, 0x0f, 0xae, 0xf7;" : /* ignore rflags */ : "D"(0), /* enter C0.2 */ "a"(tsc_l), "d"(tsc_h)); +#endif return 0; } From patchwork Tue Jul 11 16:49:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 129460 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 DDFAE42E48; Tue, 11 Jul 2023 18:49:50 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4CD6F42D1A; Tue, 11 Jul 2023 18:49:26 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 0E5664003C for ; Tue, 11 Jul 2023 18:49:20 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id CF48C21C3F2C; Tue, 11 Jul 2023 09:49:18 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com CF48C21C3F2C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1689094158; bh=YPX3S+/nCL9ARjU2grly6sww6G3NMRVNvaByo0uTCb4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NPyPGXEWh+U/Llrqwi9MGzMGt31vMqZJ6aWeRrVHWav06/yGYX7uVJ26Uwi1q95z6 2oSRta8aLxtTTLABlJ2I8X7lnNJbqRTAy+CoVXHEQwlMg6r8ZrScf61a7tRNYv4WiE wQJ3c1qorjJBFAmY8JTkcWrQOXOE9MtIfpGCyWhc= From: Tyler Retzlaff To: dev@dpdk.org Cc: Bruce Richardson , Konstantin Ananyev , Ciara Power , thomas@monjalon.net, david.marchand@redhat.com, mb@smartsharesystems.com, Tyler Retzlaff Subject: [PATCH v9 06/14] eal: use prefetch intrinsics Date: Tue, 11 Jul 2023 09:49:09 -0700 Message-Id: <1689094157-16873-7-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1689094157-16873-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1689094157-16873-1-git-send-email-roretzla@linux.microsoft.com> MIME-Version: 1.0 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 Acked-by: Morten Brørup Acked-by: Konstantin Ananyev --- 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..7a6988e 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 + +#ifdef RTE_TOOLCHAIN_MSVC /* * We use raw byte codes for now as only the newest compiler * versions support this instruction natively. @@ -41,8 +49,17 @@ static inline void rte_prefetch_non_temporal(const volatile void *p) static inline void rte_cldemote(const volatile void *p) { + _mm_cldemote(p); +} +#else +__rte_experimental +static inline void +rte_cldemote(const volatile void *p) +{ asm volatile(".byte 0x0f, 0x1c, 0x06" :: "S" (p)); } +#endif + #ifdef __cplusplus } From patchwork Tue Jul 11 16:49:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 129469 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 D0E9F42E48; Tue, 11 Jul 2023 18:50:44 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1210E42D62; Tue, 11 Jul 2023 18:49:37 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 4DD7D41156 for ; Tue, 11 Jul 2023 18:49:20 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id DC1CF21C426A; Tue, 11 Jul 2023 09:49:18 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com DC1CF21C426A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1689094158; bh=w+QVq1B9vMO46jggBj+ImzeYs3RHkEKQSzKvJNzoXs8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AKsirmci2gadI0T5ViYkYxFSHHtuwLup2QqcMs1hcOIOMjc/bOLP40uVw0d2TYt7C /LG9Zs2Z1P853+D47F0AWPTWqVBawH1Q+Z7Oyvn0sO4cj6wffh+pskwc363WdBUQZK Y5kx1He2lOeytkSdfrpaDPNgsXGm/yfLkc5rERvY= From: Tyler Retzlaff To: dev@dpdk.org Cc: Bruce Richardson , Konstantin Ananyev , Ciara Power , thomas@monjalon.net, david.marchand@redhat.com, mb@smartsharesystems.com, Tyler Retzlaff Subject: [PATCH v9 07/14] eal: use byte swap intrinsics Date: Tue, 11 Jul 2023 09:49:10 -0700 Message-Id: <1689094157-16873-8-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1689094157-16873-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1689094157-16873-1-git-send-email-roretzla@linux.microsoft.com> MIME-Version: 1.0 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 Acked-by: Morten Brørup --- 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 Tue Jul 11 16:49:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 129461 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 EA03B42E48; Tue, 11 Jul 2023 18:49:56 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6D20642D2F; Tue, 11 Jul 2023 18:49:27 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 242DB40A89 for ; Tue, 11 Jul 2023 18:49:20 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id E98F821C426B; Tue, 11 Jul 2023 09:49:18 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com E98F821C426B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1689094158; bh=hVcXjboUtlBcPclyHf4F3+vkOKa1oA7i/++NKDwFha4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aIaCfjdpQ3OEr2jFUOLYx9IWZLYb/xpCnkBxIOkMtF99AITG1hxi22J68clqe3Onx LAD79r+ZPfVBoqvDRxbQ1LCgLwJlKSNCO28QqiUYkFdRN2hWgtC8QQ3XIoMxJ299Y9 X6xtTQ60i5MG/+X/7KLMej/OoSojRUL9ZaoTuHfE= From: Tyler Retzlaff To: dev@dpdk.org Cc: Bruce Richardson , Konstantin Ananyev , Ciara Power , thomas@monjalon.net, david.marchand@redhat.com, mb@smartsharesystems.com, Tyler Retzlaff Subject: [PATCH v9 08/14] eal: hide GCC extension based alignment markers Date: Tue, 11 Jul 2023 09:49:11 -0700 Message-Id: <1689094157-16873-9-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1689094157-16873-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1689094157-16873-1-git-send-email-roretzla@linux.microsoft.com> MIME-Version: 1.0 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 Acked-by: Morten Brørup --- 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 Tue Jul 11 16:49:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 129464 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 6E6B542E48; Tue, 11 Jul 2023 18:50:15 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EA6C342D3D; Tue, 11 Jul 2023 18:49:30 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 317FF410DC for ; Tue, 11 Jul 2023 18:49:20 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 0189D21C426C; Tue, 11 Jul 2023 09:49:18 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 0189D21C426C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1689094159; bh=Dw4BKv8rsv/Yb3I3QkIEPM5TGSByOm5uZqTbhIua5kg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YJircSXp8fzgMGpIx0T6FCcWzt76csIfiu541IPhiZ6Qbg4nyAwdNlLTdFrYRGejI sYrkA7UAcstd/0LUurLhg+SK9CiKNOOPAjeOHe40t4FKQJlcL8UTv5UNQvW60skMgN VhKqEQhmQ/JiBk7RG/QebLjG8cNGR5Lm8P5hgDQk= From: Tyler Retzlaff To: dev@dpdk.org Cc: Bruce Richardson , Konstantin Ananyev , Ciara Power , thomas@monjalon.net, david.marchand@redhat.com, mb@smartsharesystems.com, Tyler Retzlaff Subject: [PATCH v9 09/14] eal: hide typedefs based on GCC vector extensions Date: Tue, 11 Jul 2023 09:49:12 -0700 Message-Id: <1689094157-16873-10-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1689094157-16873-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1689094157-16873-1-git-send-email-roretzla@linux.microsoft.com> MIME-Version: 1.0 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 Acked-by: Morten Brørup --- 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 Tue Jul 11 16:49:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 129466 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 7B2CA42E48; Tue, 11 Jul 2023 18:50:28 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9EA1542D51; Tue, 11 Jul 2023 18:49:33 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 1FF8A40A7D for ; Tue, 11 Jul 2023 18:49:20 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 0ED1A21C426E; Tue, 11 Jul 2023 09:49:18 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 0ED1A21C426E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1689094159; bh=TmCYUzV7g0xwHsr3PQL3t3zjEGUlB0NGtLIr9M5trHw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f1PDR3WXYV0Y+h2JTGYaDiEEOFynn2Y6CmqQshUCnd7zP740HuAEcwViS5neHZZej tU5WvF1U5dvgWW8AeAn2wZt6XPei6EVIlr3QxRk4csjd9ugR5eR98uQBHwmTl86KU3 klkjpaNhEodhBwtK8d+seamUvzj2baKqbMQ69CW8= From: Tyler Retzlaff To: dev@dpdk.org Cc: Bruce Richardson , Konstantin Ananyev , Ciara Power , thomas@monjalon.net, david.marchand@redhat.com, mb@smartsharesystems.com, Tyler Retzlaff Subject: [PATCH v9 10/14] eal: expand most macros to empty when using MSVC Date: Tue, 11 Jul 2023 09:49:13 -0700 Message-Id: <1689094157-16873-11-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1689094157-16873-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1689094157-16873-1-git-send-email-roretzla@linux.microsoft.com> MIME-Version: 1.0 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 Acked-by: Morten Brørup --- lib/eal/include/rte_branch_prediction.h | 8 +++++ lib/eal/include/rte_common.h | 54 +++++++++++++++++++++++++++++++++ lib/eal/include/rte_compat.h | 20 ++++++++++++ 3 files changed, 82 insertions(+) diff --git a/lib/eal/include/rte_branch_prediction.h b/lib/eal/include/rte_branch_prediction.h index 414cd92..c0356ca 100644 --- a/lib/eal/include/rte_branch_prediction.h +++ b/lib/eal/include/rte_branch_prediction.h @@ -24,7 +24,11 @@ * do_stuff(); */ #ifndef likely +#ifdef RTE_TOOLCHAIN_MSVC +#define likely(x) (!!(x)) +#else #define likely(x) __builtin_expect(!!(x), 1) +#endif #endif /* likely */ /** @@ -37,7 +41,11 @@ * do_stuff(); */ #ifndef unlikely +#ifdef RTE_TOOLCHAIN_MSVC +#define unlikely(x) (!!(x)) +#else #define unlikely(x) __builtin_expect(!!(x), 0) +#endif #endif /* unlikely */ #ifdef __cplusplus diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h index 2f464e3..b087532 100644 --- a/lib/eal/include/rte_common.h +++ b/lib/eal/include/rte_common.h @@ -41,6 +41,10 @@ #define RTE_STD_C11 #endif +#ifdef RTE_TOOLCHAIN_MSVC +#define __extension__ +#endif + /* * RTE_TOOLCHAIN_GCC is defined if the target is built with GCC, * while a host application (like pmdinfogen) may have another compiler. @@ -65,7 +69,11 @@ /** * Force alignment */ +#ifdef RTE_TOOLCHAIN_MSVC +#define __rte_aligned(a) +#else #define __rte_aligned(a) __attribute__((__aligned__(a))) +#endif #ifdef RTE_ARCH_STRICT_ALIGN typedef uint64_t unaligned_uint64_t __rte_aligned(1); @@ -80,16 +88,29 @@ /** * Force a structure to be packed */ +#ifdef RTE_TOOLCHAIN_MSVC +#define __rte_packed +#else #define __rte_packed __attribute__((__packed__)) +#endif /** * Macro to mark a type that is not subject to type-based aliasing rules */ +#ifdef RTE_TOOLCHAIN_MSVC +#define __rte_may_alias +#else #define __rte_may_alias __attribute__((__may_alias__)) +#endif /******* Macro to mark functions and fields scheduled for removal *****/ +#ifdef RTE_TOOLCHAIN_MSVC +#define __rte_deprecated +#define __rte_deprecated_msg(msg) +#else #define __rte_deprecated __attribute__((__deprecated__)) #define __rte_deprecated_msg(msg) __attribute__((__deprecated__(msg))) +#endif /** * Macro to mark macros and defines scheduled for removal @@ -110,14 +131,22 @@ /** * Force symbol to be generated even if it appears to be unused. */ +#ifdef RTE_TOOLCHAIN_MSVC +#define __rte_used +#else #define __rte_used __attribute__((used)) +#endif /*********** Macros to eliminate unused variable warnings ********/ /** * short definition to mark a function parameter unused */ +#ifdef RTE_TOOLCHAIN_MSVC +#define __rte_unused +#else #define __rte_unused __attribute__((__unused__)) +#endif /** * Mark pointer as restricted with regard to pointer aliasing. @@ -141,6 +170,9 @@ * even if the underlying stdio implementation is ANSI-compliant, * so this must be overridden. */ +#ifdef RTE_TOOLCHAIN_MSVC +#define __rte_format_printf(format_index, first_arg) +#else #if RTE_CC_IS_GNU #define __rte_format_printf(format_index, first_arg) \ __attribute__((format(gnu_printf, format_index, first_arg))) @@ -148,6 +180,7 @@ #define __rte_format_printf(format_index, first_arg) \ __attribute__((format(printf, format_index, first_arg))) #endif +#endif /** * Tells compiler that the function returns a value that points to @@ -222,7 +255,11 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void) /** * Hint never returning function */ +#ifdef RTE_TOOLCHAIN_MSVC +#define __rte_noreturn +#else #define __rte_noreturn __attribute__((noreturn)) +#endif /** * Issue a warning in case the function's return value is ignored. @@ -247,12 +284,20 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void) * } * @endcode */ +#ifdef RTE_TOOLCHAIN_MSVC +#define __rte_warn_unused_result +#else #define __rte_warn_unused_result __attribute__((warn_unused_result)) +#endif /** * Force a function to be inlined */ +#ifdef RTE_TOOLCHAIN_MSVC +#define __rte_always_inline +#else #define __rte_always_inline inline __attribute__((always_inline)) +#endif /** * Force a function to be noinlined @@ -437,7 +482,11 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void) #define RTE_CACHE_LINE_MIN_SIZE 64 /** Force alignment to cache line. */ +#ifdef RTE_TOOLCHAIN_MSVC +#define __rte_cache_aligned +#else #define __rte_cache_aligned __rte_aligned(RTE_CACHE_LINE_SIZE) +#endif /** Force minimum cache line alignment. */ #define __rte_cache_min_aligned __rte_aligned(RTE_CACHE_LINE_MIN_SIZE) @@ -812,6 +861,10 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void) * struct wrapper *w = container_of(x, struct wrapper, c); */ #ifndef container_of +#ifdef RTE_TOOLCHAIN_MSVC +#define container_of(ptr, type, member) \ + ((type *)((uintptr_t)(ptr) - offsetof(type, member))) +#else #define container_of(ptr, type, member) __extension__ ({ \ const typeof(((type *)0)->member) *_ptr = (ptr); \ __rte_unused type *_target_ptr = \ @@ -819,6 +872,7 @@ static void __attribute__((destructor(RTE_PRIO(prio)), used)) func(void) (type *)(((uintptr_t)_ptr) - offsetof(type, member)); \ }) #endif +#endif /** Swap two variables. */ #define RTE_SWAP(a, b) \ diff --git a/lib/eal/include/rte_compat.h b/lib/eal/include/rte_compat.h index fc9fbaa..716bc03 100644 --- a/lib/eal/include/rte_compat.h +++ b/lib/eal/include/rte_compat.h @@ -12,14 +12,22 @@ #ifndef ALLOW_EXPERIMENTAL_API +#ifdef RTE_TOOLCHAIN_MSVC +#define __rte_experimental +#else #define __rte_experimental \ __attribute__((deprecated("Symbol is not yet part of stable ABI"), \ section(".text.experimental"))) +#endif #else +#ifdef RTE_TOOLCHAIN_MSVC +#define __rte_experimental +#else #define __rte_experimental \ __attribute__((section(".text.experimental"))) +#endif #endif @@ -30,23 +38,35 @@ #if !defined ALLOW_INTERNAL_API && __has_attribute(error) /* For GCC */ +#ifdef RTE_TOOLCHAIN_MSVC +#define __rte_internal +#else #define __rte_internal \ __attribute__((error("Symbol is not public ABI"), \ section(".text.internal"))) +#endif #elif !defined ALLOW_INTERNAL_API && __has_attribute(diagnose_if) /* For clang */ +#ifdef RTE_TOOLCHAIN_MSVC +#define __rte_internal +#else #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") +#endif #else +#ifdef RTE_TOOLCHAIN_MSVC +#define __rte_internal +#else #define __rte_internal \ __attribute__((section(".text.internal"))) +#endif #endif From patchwork Tue Jul 11 16:49:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 129463 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 E21D542E48; Tue, 11 Jul 2023 18:50:09 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B97FA42D39; Tue, 11 Jul 2023 18:49:29 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 2999C40C35 for ; Tue, 11 Jul 2023 18:49:20 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 1BC0821C426F; Tue, 11 Jul 2023 09:49:18 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 1BC0821C426F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1689094159; bh=Zd2j52QQJPm8bxZ40nCSB12LzcUyq299oMfkdipuZQo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p40eJi0Go1cnxZqTYmvpGKFlPKTnnVLhGlnRjqpwO7GBd8m3pG94uwg/RGktgfwkZ 3yoUUb11gJlEgcVM+QSjPIRFCX5095lVrCDbJSGWSBP/H6XNQW73Apk8RMHytlfKD8 6E1iTChJGxEnu+xoWyz07krVamDk/0VFc30UpS3k= From: Tyler Retzlaff To: dev@dpdk.org Cc: Bruce Richardson , Konstantin Ananyev , Ciara Power , thomas@monjalon.net, david.marchand@redhat.com, mb@smartsharesystems.com, Tyler Retzlaff Subject: [PATCH v9 11/14] eal: exclude exposure of rte atomic APIs for MSVC builds Date: Tue, 11 Jul 2023 09:49:14 -0700 Message-Id: <1689094157-16873-12-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1689094157-16873-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1689094157-16873-1-git-send-email-roretzla@linux.microsoft.com> MIME-Version: 1.0 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 Acked-by: Morten Brørup --- 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 6a6c394..0112208 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 7aba1c3..9ba61f8 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 Tue Jul 11 16:49:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 129462 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 DB7D342E48; Tue, 11 Jul 2023 18:50:03 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 871B142D33; Tue, 11 Jul 2023 18:49:28 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 39065410E9 for ; Tue, 11 Jul 2023 18:49:20 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 2843A21C4271; Tue, 11 Jul 2023 09:49:18 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 2843A21C4271 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1689094159; bh=PLuk/k0rF60gUozSw6zpv6b045cW1SU5joy8Ezn7qgA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OXQQ2LXESzHFNXX8PYwTz9Uggefm1PrliEMVZAxtpOeKVoFAjeaazFUwQPau8nYz0 CDeQZ6g0bwFS1iuUoZlq7AJZ0bTPPFCvv5pf2xcEN7wDMvojxAvdahJrskQ2pnYU4N k+yfnIRJa0gjeDUTDZfj2990sF9TFDylfw4RqTGw= From: Tyler Retzlaff To: dev@dpdk.org Cc: Bruce Richardson , Konstantin Ananyev , Ciara Power , thomas@monjalon.net, david.marchand@redhat.com, mb@smartsharesystems.com, Tyler Retzlaff Subject: [PATCH v9 12/14] telemetry: avoid expanding versioned symbol macros on MSVC Date: Tue, 11 Jul 2023 09:49:15 -0700 Message-Id: <1689094157-16873-13-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1689094157-16873-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1689094157-16873-1-git-send-email-roretzla@linux.microsoft.com> MIME-Version: 1.0 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 Acked-by: Morten Brørup --- 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 0c7187b..523287b 100644 --- a/lib/telemetry/telemetry_data.c +++ b/lib/telemetry/telemetry_data.c @@ -83,8 +83,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); +#ifdef RTE_TOOLCHAIN_MSVC +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); +} +#else 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); +#endif int rte_tel_data_add_array_uint(struct rte_tel_data *d, uint64_t x) @@ -218,8 +226,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); +#ifdef RTE_TOOLCHAIN_MSVC +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); +} +#else 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); +#endif int rte_tel_data_add_dict_uint(struct rte_tel_data *d, From patchwork Tue Jul 11 16:49:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 129467 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 E621942E48; Tue, 11 Jul 2023 18:50:33 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B11D742D59; Tue, 11 Jul 2023 18:49:34 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 7A742411F3 for ; Tue, 11 Jul 2023 18:49:20 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 34B6021C4273; Tue, 11 Jul 2023 09:49:18 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 34B6021C4273 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1689094159; bh=f9XhpQS5bAdnk1muTr2n/HijQiaMdsp9rYFoLB1Zol8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ck5GjIQdnAWUE8eRVPwX2eaZwuXAUFzvkSgdipCBSuSiqqoGNth7MGpG01+lsjId2 nH/3o6bTgFv4mdCDOdjl0eD4Ovw4Fx6NaAg8HFDf2P99+qOFj0JW0zpIq7/kANs7L6 I96IojCSBCzhgYZre++zH9YNBKJzdT2Kb2Gtel1c= From: Tyler Retzlaff To: dev@dpdk.org Cc: Bruce Richardson , Konstantin Ananyev , Ciara Power , thomas@monjalon.net, david.marchand@redhat.com, mb@smartsharesystems.com, Tyler Retzlaff Subject: [PATCH v9 13/14] eal: always define MSVC as little endian Date: Tue, 11 Jul 2023 09:49:16 -0700 Message-Id: <1689094157-16873-14-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1689094157-16873-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1689094157-16873-1-git-send-email-roretzla@linux.microsoft.com> MIME-Version: 1.0 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 Acked-by: Morten Brørup --- 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. From patchwork Tue Jul 11 16:49:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 129468 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 8F09E42E48; Tue, 11 Jul 2023 18:50:39 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DDD4342D5E; Tue, 11 Jul 2023 18:49:35 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 73F914003C for ; Tue, 11 Jul 2023 18:49:20 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id 412D421C4276; Tue, 11 Jul 2023 09:49:18 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 412D421C4276 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1689094159; bh=fSRL24XTQJ13bhTnh7j5EPaKb7bIYPb7MGySV6/5nQg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iECts2P1uIuQGZC9XVvNDzWao93O8L7h/x9S+IVuYtLKqE/08dl6mD660vlhUsKNi VjlO1AWZLMgYYpjM4LghVzTwXhe5rY3fQh3raYdQWyhv/2XlinT1obAY6yv3+siJAJ iSjUjH36O4eRNFuZ1Et2VBxmKgybuD54x6RLG9UM= From: Tyler Retzlaff To: dev@dpdk.org Cc: Bruce Richardson , Konstantin Ananyev , Ciara Power , thomas@monjalon.net, david.marchand@redhat.com, mb@smartsharesystems.com, Tyler Retzlaff Subject: [PATCH v9 14/14] eal: do not define typeof macro when building with MSVC Date: Tue, 11 Jul 2023 09:49:17 -0700 Message-Id: <1689094157-16873-15-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1689094157-16873-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> <1689094157-16873-1-git-send-email-roretzla@linux.microsoft.com> MIME-Version: 1.0 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 building with MSVC do not assume typeof is a macro and don't define a typeof macro that conflicts with C23 typeof keyword. Signed-off-by: Tyler Retzlaff Acked-by: Morten Brørup --- lib/eal/include/rte_common.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/eal/include/rte_common.h b/lib/eal/include/rte_common.h index b087532..cf7d8d8 100644 --- a/lib/eal/include/rte_common.h +++ b/lib/eal/include/rte_common.h @@ -24,9 +24,11 @@ /* OS specific include */ #include +#ifndef RTE_TOOLCHAIN_MSVC #ifndef typeof #define typeof __typeof__ #endif +#endif #ifndef __cplusplus #ifndef asm