Merge tag 'x86_core_for_v5.19_rc1' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-block.git] / arch / x86 / kernel / process.c
index 96a9885b9c3ad53b91e888f6f0d9c14e88122634..cbe6aa3f649d8415cded6748a1eb8a45b4d730e5 100644 (file)
@@ -46,6 +46,7 @@
 #include <asm/proto.h>
 #include <asm/frame.h>
 #include <asm/unwind.h>
+#include <asm/tdx.h>
 
 #include "process.h"
 
@@ -331,7 +332,7 @@ static int get_cpuid_mode(void)
        return !test_thread_flag(TIF_NOCPUID);
 }
 
-static int set_cpuid_mode(struct task_struct *task, unsigned long cpuid_enabled)
+static int set_cpuid_mode(unsigned long cpuid_enabled)
 {
        if (!boot_cpu_has(X86_FEATURE_CPUID_FAULT))
                return -ENODEV;
@@ -402,7 +403,7 @@ static void tss_copy_io_bitmap(struct tss_struct *tss, struct io_bitmap *iobm)
 }
 
 /**
- * tss_update_io_bitmap - Update I/O bitmap before exiting to usermode
+ * native_tss_update_io_bitmap - Update I/O bitmap before exiting to user mode
  */
 void native_tss_update_io_bitmap(void)
 {
@@ -870,6 +871,9 @@ void select_idle_routine(const struct cpuinfo_x86 *c)
        } else if (prefer_mwait_c1_over_halt(c)) {
                pr_info("using mwait in idle threads\n");
                x86_idle = mwait_idle;
+       } else if (cpu_feature_enabled(X86_FEATURE_TDX_GUEST)) {
+               pr_info("using TDX aware idle routine\n");
+               x86_idle = tdx_safe_halt;
        } else
                x86_idle = default_idle;
 }
@@ -982,20 +986,19 @@ unsigned long __get_wchan(struct task_struct *p)
        return addr;
 }
 
-long do_arch_prctl_common(struct task_struct *task, int option,
-                         unsigned long arg2)
+long do_arch_prctl_common(int option, unsigned long arg2)
 {
        switch (option) {
        case ARCH_GET_CPUID:
                return get_cpuid_mode();
        case ARCH_SET_CPUID:
-               return set_cpuid_mode(task, arg2);
+               return set_cpuid_mode(arg2);
        case ARCH_GET_XCOMP_SUPP:
        case ARCH_GET_XCOMP_PERM:
        case ARCH_REQ_XCOMP_PERM:
        case ARCH_GET_XCOMP_GUEST_PERM:
        case ARCH_REQ_XCOMP_GUEST_PERM:
-               return fpu_xstate_prctl(task, option, arg2);
+               return fpu_xstate_prctl(option, arg2);
        }
 
        return -EINVAL;