[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <E5D53B8D-5A2B-4F9C-9071-E0C56A44AE7D@zytor.com>
Date: Thu, 22 Jan 2026 09:22:56 -0800
From: Xin Li <xin@...or.com>
To: Binbin Wu <binbin.wu@...ux.intel.com>
Cc: linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
linux-doc@...r.kernel.org, pbonzini@...hat.com, seanjc@...gle.com,
corbet@....net, tglx@...utronix.de, mingo@...hat.com, bp@...en8.de,
dave.hansen@...ux.intel.com, x86@...nel.org, hpa@...or.com,
luto@...nel.org, peterz@...radead.org, andrew.cooper3@...rix.com,
chao.gao@...el.com, hch@...radead.org, sohil.mehta@...el.com
Subject: Re: [PATCH v9 07/22] KVM: VMX: Initialize VMCS FRED fields
>> The trouble comes from __this_cpu_ist_top_va():
>
> Oh, right!
> Sorry for the noise.
It’s absolutely NOT noise, because we don’t like #ifdef in C file.
With the following additional patch, we can remove this #ifdef CONFIG_X86_64:
diff --git a/arch/x86/include/asm/cpu_entry_area.h b/arch/x86/include/asm/cpu_entry_area.h
index 509e52fc3a0f..c35ef2cb9b8a 100644
--- a/arch/x86/include/asm/cpu_entry_area.h
+++ b/arch/x86/include/asm/cpu_entry_area.h
@@ -8,14 +8,6 @@
#include <asm/intel_ds.h>
#include <asm/pgtable_areas.h>
-#ifdef CONFIG_X86_64
-
-#ifdef CONFIG_AMD_MEM_ENCRYPT
-#define VC_EXCEPTION_STKSZ EXCEPTION_STKSZ
-#else
-#define VC_EXCEPTION_STKSZ 0
-#endif
-
/*
* The exception stack ordering in [cea_]exception_stacks
*/
@@ -26,9 +18,19 @@ enum exception_stack_ordering {
ESTACK_MCE,
ESTACK_VC,
ESTACK_VC2,
+#ifdef CONFIG_X86_64
N_EXCEPTION_STACKS
+#endif
};
+#ifdef CONFIG_X86_64
+
+#ifdef CONFIG_AMD_MEM_ENCRYPT
+#define VC_EXCEPTION_STKSZ EXCEPTION_STKSZ
+#else
+#define VC_EXCEPTION_STKSZ 0
+#endif
+
/* Macro to enforce the same ordering and stack sizes */
#define ESTACKS_MEMBERS(guardsize, optional_stack_size) \
char ESTACK_DF_stack_guard[guardsize]; \
@@ -75,6 +77,11 @@ struct doublefault_stack {
unsigned long stack[(PAGE_SIZE - sizeof(struct x86_hw_tss)) / sizeof(unsigned long)];
struct x86_hw_tss tss;
} __aligned(PAGE_SIZE);
+
+static inline unsigned long __this_cpu_ist_top_va(enum exception_stack_ordering stack)
+{
+ return 0;
+}
#endif
/*
Another simpler way to define __this_cpu_ist_top_va() in a VMX header, but
I don’t think it’s the right way.
Powered by blists - more mailing lists