Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 Apr 2026 21:43:03 +0000
From:      Jean-=?utf-8?Q?S=C3=A9bast?==?utf-8?Q?ien P=C3=A9?=dron <dumbbell@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 477761c7ada3 - stable/15 - linuxkpi: Add `atomic_read_acquire()`
Message-ID:  <69f27b67.18e86.19a1c92a@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch stable/15 has been updated by dumbbell:

URL: https://cgit.FreeBSD.org/src/commit/?id=477761c7ada3d31d5571abf4922c0c6023866fc5

commit 477761c7ada3d31d5571abf4922c0c6023866fc5
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-29 21:03:59 +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
    
    (cherry picked from commit ade8a27ea4c28d12fabc2d5f8e44386a3add23d1)
---
 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_ */


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69f27b67.18e86.19a1c92a>