Merge tag 'x86-core-2024-03-11' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6-microblaze.git] / arch / x86 / include / asm / uaccess_64.h
index d2a0c2a..04789f4 100644 (file)
@@ -11,6 +11,7 @@
 #include <asm/alternative.h>
 #include <asm/cpufeatures.h>
 #include <asm/page.h>
+#include <asm/percpu.h>
 
 #ifdef CONFIG_ADDRESS_MASKING
 /*
  */
 static inline unsigned long __untagged_addr(unsigned long addr)
 {
-       /*
-        * Refer tlbstate_untag_mask directly to avoid RIP-relative relocation
-        * in alternative instructions. The relocation gets wrong when gets
-        * copied to the target place.
-        */
        asm (ALTERNATIVE("",
-                        "and %%gs:tlbstate_untag_mask, %[addr]\n\t", X86_FEATURE_LAM)
-            : [addr] "+r" (addr) : "m" (tlbstate_untag_mask));
+                        "and " __percpu_arg([mask]) ", %[addr]", X86_FEATURE_LAM)
+            : [addr] "+r" (addr)
+            : [mask] "m" (__my_cpu_var(tlbstate_untag_mask)));
 
        return addr;
 }