[v4,38/45] bus/vmbus: use rte stdatomic API

Message ID 1713568003-30453-39-git-send-email-roretzla@linux.microsoft.com (mailing list archive)
State Superseded
Delegated to: Thomas Monjalon
Headers
Series use stdatomic API |

Checks

Context Check Description
ci/checkpatch warning coding style issues

Commit Message

Tyler Retzlaff April 19, 2024, 11:06 p.m. UTC
  Replace the use of gcc builtin __atomic_xxx intrinsics with
corresponding rte_atomic_xxx optional rte stdatomic API.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/bus/vmbus/rte_vmbus_reg.h | 2 +-
 drivers/bus/vmbus/vmbus_channel.c | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)
  

Patch

diff --git a/drivers/bus/vmbus/rte_vmbus_reg.h b/drivers/bus/vmbus/rte_vmbus_reg.h
index a17ce40..e3299aa 100644
--- a/drivers/bus/vmbus/rte_vmbus_reg.h
+++ b/drivers/bus/vmbus/rte_vmbus_reg.h
@@ -28,7 +28,7 @@  struct vmbus_message {
  */
 
 struct vmbus_mon_trig {
-	uint32_t	pending;
+	RTE_ATOMIC(uint32_t)	pending;
 	uint32_t	armed;
 } __rte_packed;
 
diff --git a/drivers/bus/vmbus/vmbus_channel.c b/drivers/bus/vmbus/vmbus_channel.c
index 4d74df3..925c2aa 100644
--- a/drivers/bus/vmbus/vmbus_channel.c
+++ b/drivers/bus/vmbus/vmbus_channel.c
@@ -19,16 +19,16 @@ 
 #include "private.h"
 
 static inline void
-vmbus_sync_set_bit(volatile uint32_t *addr, uint32_t mask)
+vmbus_sync_set_bit(volatile RTE_ATOMIC(uint32_t) *addr, uint32_t mask)
 {
-	/* Use GCC builtin which atomic does atomic OR operation */
-	__atomic_fetch_or(addr, mask, __ATOMIC_SEQ_CST);
+	rte_atomic_fetch_or_explicit(addr, mask, rte_memory_order_seq_cst);
 }
 
 static inline void
 vmbus_set_monitor(const struct vmbus_channel *channel, uint32_t monitor_id)
 {
-	uint32_t *monitor_addr, monitor_mask;
+	RTE_ATOMIC(uint32_t) *monitor_addr;
+	uint32_t monitor_mask;
 	unsigned int trigger_index;
 
 	trigger_index = monitor_id / HV_MON_TRIG_LEN;