DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] eal: fix compile failure of asm on MSVC toolchain
@ 2023-10-17 14:06 Tyler Retzlaff
  2023-10-26  8:43 ` David Marchand
  0 siblings, 1 reply; 2+ messages in thread
From: Tyler Retzlaff @ 2023-10-17 14:06 UTC (permalink / raw)
  To: dev
  Cc: Anatoly Burakov, Bruce Richardson, Konstantin Ananyev,
	Sivaprasad Tummala, Tyler Retzlaff

Most MSVC targets do not support inline asm and __MWAITX__ is a GCC
implementation detail. Use a test of defined(RTE_TOOLCHAIN_MSVC) to
avoid conditional compilation of inline asm and instead use intrinsics
instead.

Fixes: c7ed1ce04704 ("eal/x86: add power intrinsics for AMD")
Cc: sivaprasad.tummala@amd.com

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 lib/eal/x86/rte_power_intrinsics.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/eal/x86/rte_power_intrinsics.c b/lib/eal/x86/rte_power_intrinsics.c
index 63a1f7e..483395d 100644
--- a/lib/eal/x86/rte_power_intrinsics.c
+++ b/lib/eal/x86/rte_power_intrinsics.c
@@ -60,7 +60,7 @@ static void intel_umwait(const uint64_t timeout)
  */
 static void amd_monitorx(volatile void *addr)
 {
-#if defined(__MWAITX__)
+#if defined(RTE_TOOLCHAIN_MSVC) || defined(__MWAITX__)
 	/* cast away "volatile" when using the intrinsic */
 	_mm_monitorx((void *)(uintptr_t)addr, 0, 0);
 #else
@@ -75,7 +75,7 @@ static void amd_monitorx(volatile void *addr)
 static void amd_mwaitx(const uint64_t timeout)
 {
 	RTE_SET_USED(timeout);
-#if defined(__MWAITX__)
+#if defined(RTE_TOOLCHAIN_MSVC) || defined(__MWAITX__)
 	_mm_mwaitx(0, 0, 0);
 #else
 	asm volatile(".byte 0x0f, 0x01, 0xfb;"
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] eal: fix compile failure of asm on MSVC toolchain
  2023-10-17 14:06 [PATCH] eal: fix compile failure of asm on MSVC toolchain Tyler Retzlaff
@ 2023-10-26  8:43 ` David Marchand
  0 siblings, 0 replies; 2+ messages in thread
From: David Marchand @ 2023-10-26  8:43 UTC (permalink / raw)
  To: Tyler Retzlaff
  Cc: dev, Anatoly Burakov, Bruce Richardson, Konstantin Ananyev,
	Sivaprasad Tummala

On Tue, Oct 17, 2023 at 4:06 PM Tyler Retzlaff
<roretzla@linux.microsoft.com> wrote:
>
> Most MSVC targets do not support inline asm and __MWAITX__ is a GCC
> implementation detail. Use a test of defined(RTE_TOOLCHAIN_MSVC) to
> avoid conditional compilation of inline asm and instead use intrinsics
> instead.
>
> Fixes: c7ed1ce04704 ("eal/x86: add power intrinsics for AMD")
>
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Acked-by: David Marchand <david.marchand@redhat.com>

Applied, thanks.


-- 
David Marchand


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-10-26  8:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-17 14:06 [PATCH] eal: fix compile failure of asm on MSVC toolchain Tyler Retzlaff
2023-10-26  8:43 ` David Marchand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).