linuxPackages.amneziawg: 1.0.20260322 -> 1.0.20260329-2 (#504732)
This commit is contained in:
@@ -9,21 +9,15 @@
|
||||
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "amneziawg";
|
||||
version = "1.0.20260322";
|
||||
version = "1.0.20260329-2";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "amnezia-vpn";
|
||||
repo = "amneziawg-linux-kernel-module";
|
||||
tag = "v${finalAttrs.version}";
|
||||
hash = "sha256-Y6TETOo5oAr3ZtqsJX909zm38rXq+1fAXiRFSt+g2Gw=";
|
||||
hash = "sha256-BlWnncTzVKDpCVvtLp8L+bABs81YH/Ce+9JGCoCm1LI=";
|
||||
};
|
||||
|
||||
patches = [
|
||||
# fix aarch64-linux builds with NEON
|
||||
# upstream PR: https://github.com/amnezia-vpn/amneziawg-linux-kernel-module/pull/159
|
||||
./neon-619.patch
|
||||
];
|
||||
|
||||
sourceRoot = "${finalAttrs.src.name}/src";
|
||||
hardeningDisable = [ "pic" ];
|
||||
nativeBuildInputs = kernel.moduleBuildDependencies;
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
--- a/compat/simd/include/linux/simd.h
|
||||
+++ b/compat/simd/include/linux/simd.h
|
||||
@@ -18,31 +18,42 @@ typedef enum {
|
||||
HAVE_NO_SIMD = 1 << 0,
|
||||
HAVE_FULL_SIMD = 1 << 1,
|
||||
HAVE_SIMD_IN_USE = 1 << 31
|
||||
+} simd_state_t;
|
||||
+
|
||||
+typedef struct {
|
||||
+ simd_state_t state;
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 19, 0) && defined(CONFIG_KERNEL_MODE_NEON)
|
||||
+ struct user_fpsimd_state kstate;
|
||||
+#endif
|
||||
} simd_context_t;
|
||||
|
||||
#define DONT_USE_SIMD ((simd_context_t []){ HAVE_NO_SIMD })
|
||||
|
||||
static inline void simd_get(simd_context_t *ctx)
|
||||
{
|
||||
- *ctx = !IS_ENABLED(CONFIG_PREEMPT_RT) && !IS_ENABLED(CONFIG_PREEMPT_RT_BASE) && may_use_simd() ? HAVE_FULL_SIMD : HAVE_NO_SIMD;
|
||||
+ ctx->state = !IS_ENABLED(CONFIG_PREEMPT_RT) && !IS_ENABLED(CONFIG_PREEMPT_RT_BASE) && may_use_simd() ? HAVE_FULL_SIMD : HAVE_NO_SIMD;
|
||||
}
|
||||
|
||||
static inline void simd_put(simd_context_t *ctx)
|
||||
{
|
||||
#if defined(CONFIG_X86_64)
|
||||
- if (*ctx & HAVE_SIMD_IN_USE)
|
||||
+ if (ctx->state & HAVE_SIMD_IN_USE)
|
||||
kernel_fpu_end();
|
||||
#elif defined(CONFIG_KERNEL_MODE_NEON)
|
||||
- if (*ctx & HAVE_SIMD_IN_USE)
|
||||
+ if (ctx->state & HAVE_SIMD_IN_USE)
|
||||
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 19, 0)
|
||||
+ kernel_neon_end(&ctx->kstate);
|
||||
+#else
|
||||
kernel_neon_end();
|
||||
#endif
|
||||
- *ctx = HAVE_NO_SIMD;
|
||||
+#endif
|
||||
+ ctx->state = HAVE_NO_SIMD;
|
||||
}
|
||||
|
||||
static inline bool simd_relax(simd_context_t *ctx)
|
||||
{
|
||||
#ifdef CONFIG_PREEMPT
|
||||
- if ((*ctx & HAVE_SIMD_IN_USE) && need_resched()) {
|
||||
+ if ((ctx->state & HAVE_SIMD_IN_USE) && need_resched()) {
|
||||
simd_put(ctx);
|
||||
simd_get(ctx);
|
||||
return true;
|
||||
@@ -53,16 +64,20 @@ static inline bool simd_relax(simd_context_t *ctx)
|
||||
|
||||
static __must_check inline bool simd_use(simd_context_t *ctx)
|
||||
{
|
||||
- if (!(*ctx & HAVE_FULL_SIMD))
|
||||
+ if (!(ctx->state & HAVE_FULL_SIMD))
|
||||
return false;
|
||||
- if (*ctx & HAVE_SIMD_IN_USE)
|
||||
+ if (ctx->state & HAVE_SIMD_IN_USE)
|
||||
return true;
|
||||
#if defined(CONFIG_X86_64)
|
||||
kernel_fpu_begin();
|
||||
#elif defined(CONFIG_KERNEL_MODE_NEON)
|
||||
+#if LINUX_VERSION_CODE > KERNEL_VERSION(6, 19, 0)
|
||||
+ kernel_neon_begin(&ctx->kstate);
|
||||
+#else
|
||||
kernel_neon_begin();
|
||||
#endif
|
||||
- *ctx |= HAVE_SIMD_IN_USE;
|
||||
+#endif
|
||||
+ ctx->state |= HAVE_SIMD_IN_USE;
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user