git: ade8a27ea4c2 - main - linuxkpi: Add `atomic_read_acquire()`
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 22 Apr 2026 18:10:26 UTC
The branch main has been updated by dumbbell:
URL: https://cgit.FreeBSD.org/src/commit/?id=ade8a27ea4c28d12fabc2d5f8e44386a3add23d1
commit ade8a27ea4c28d12fabc2d5f8e44386a3add23d1
Author: Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
AuthorDate: 2026-04-20 23:34:39 +0000
Commit: Jean-Sébastien Pédron <dumbbell@FreeBSD.org>
CommitDate: 2026-04-22 18:09:55 +0000
linuxkpi: Add `atomic_read_acquire()`
This function calls `raw_atomic_read_acquire()` which is also added.
They are located in <linux/atomic/*.h> headers, both included from
<linux/atomic.h>.
The amdgpu DRM driver started to use this in Linux 6.12.x.
Reviewed by: bz
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D56573
---
sys/compat/linuxkpi/common/include/linux/atomic.h | 2 ++
.../common/include/linux/atomic/atomic-arch-fallback.h | 16 ++++++++++++++++
.../common/include/linux/atomic/atomic-instrumented.h | 16 ++++++++++++++++
3 files changed, 34 insertions(+)
diff --git a/sys/compat/linuxkpi/common/include/linux/atomic.h b/sys/compat/linuxkpi/common/include/linux/atomic.h
index bc76928a7d67..9ba2c4d86076 100644
--- a/sys/compat/linuxkpi/common/include/linux/atomic.h
+++ b/sys/compat/linuxkpi/common/include/linux/atomic.h
@@ -29,7 +29,9 @@
#include <asm/atomic.h>
#include <asm/atomic64.h>
+#include <linux/atomic/atomic-arch-fallback.h>
#include <asm/atomic-long.h>
+#include <linux/atomic/atomic-instrumented.h>
#include <asm/barrier.h>
#endif /* _LINUXKPI_LINUX_ATOMIC_H_ */
diff --git a/sys/compat/linuxkpi/common/include/linux/atomic/atomic-arch-fallback.h b/sys/compat/linuxkpi/common/include/linux/atomic/atomic-arch-fallback.h
new file mode 100644
index 000000000000..2980c364cb88
--- /dev/null
+++ b/sys/compat/linuxkpi/common/include/linux/atomic/atomic-arch-fallback.h
@@ -0,0 +1,16 @@
+/*
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2026 The FreeBSD Foundation
+ */
+
+#ifndef _LINUXKPI_LINUX_ATOMIC_ATOMIC_ARCH_FALLBACK_H_
+#define _LINUXKPI_LINUX_ATOMIC_ATOMIC_ARCH_FALLBACK_H_
+
+static inline int
+raw_atomic_read_acquire(const atomic_t *v)
+{
+ return (atomic_load_acq_int(&v->counter));
+}
+
+#endif /* _LINUXKPI_LINUX_ATOMIC_ATOMIC_ARCH_FALLBACK_H_ */
diff --git a/sys/compat/linuxkpi/common/include/linux/atomic/atomic-instrumented.h b/sys/compat/linuxkpi/common/include/linux/atomic/atomic-instrumented.h
new file mode 100644
index 000000000000..af0b6af2ecfa
--- /dev/null
+++ b/sys/compat/linuxkpi/common/include/linux/atomic/atomic-instrumented.h
@@ -0,0 +1,16 @@
+/*
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (c) 2026 The FreeBSD Foundation
+ */
+
+#ifndef _LINUXKPI_LINUX_ATOMIC_ATOMIC_INSTRUMENTED_H_
+#define _LINUXKPI_LINUX_ATOMIC_ATOMIC_INSTRUMENTED_H_
+
+static inline int
+atomic_read_acquire(const atomic_t *v)
+{
+ return (raw_atomic_read_acquire(v));
+}
+
+#endif /* _LINUXKPI_LINUX_ATOMIC_ATOMIC_INSTRUMENTED_H_ */