[PATCH 5/9] KVM: x86: Move KVM_GUESTDBG_VALID_MASK from kvm_host.h => x86.c

From: Sean Christopherson

Date: Thu Jun 25 2026 - 18:05:32 EST


Move KVM_GUESTDBG_VALID_MASK into x86.c so that it's not globally visible.
As explained by commit 462474588b19 ("KVM: x86: Move misc "VALID MASK"
defines from kvm_host.h => x86.c"), which unintentionally missed GUESTDBG,
the set of valid flags/bits is very much a KVM-internal detail, as the
values from the hardcoded #defines are often captured and massaged by KVM's
setup code, i.e. *directly* using the macros outside of KVM x86 would be
actively dangerous.

No functional change intended.

Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx>
---
arch/x86/include/asm/kvm_host.h | 9 ---------
arch/x86/kvm/x86.c | 9 +++++++++
2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index fd712f604636..f24e0de00692 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -212,15 +212,6 @@ enum x86_intercept_stage;

#define KVM_NR_DB_REGS 4

-#define KVM_GUESTDBG_VALID_MASK \
- (KVM_GUESTDBG_ENABLE | \
- KVM_GUESTDBG_SINGLESTEP | \
- KVM_GUESTDBG_USE_HW_BP | \
- KVM_GUESTDBG_USE_SW_BP | \
- KVM_GUESTDBG_INJECT_BP | \
- KVM_GUESTDBG_INJECT_DB | \
- KVM_GUESTDBG_BLOCKIRQ)
-
#define PFERR_PRESENT_MASK BIT(0)
#define PFERR_WRITE_MASK BIT(1)
#define PFERR_USER_MASK BIT(2)
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 0626e835e9eb..5ee6d0c33009 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -115,6 +115,15 @@ EXPORT_SYMBOL_FOR_KVM_INTERNAL(kvm_host);

#define KVM_CAP_PMU_VALID_MASK KVM_PMU_CAP_DISABLE

+#define KVM_GUESTDBG_VALID_MASK \
+ (KVM_GUESTDBG_ENABLE | \
+ KVM_GUESTDBG_SINGLESTEP | \
+ KVM_GUESTDBG_USE_HW_BP | \
+ KVM_GUESTDBG_USE_SW_BP | \
+ KVM_GUESTDBG_INJECT_BP | \
+ KVM_GUESTDBG_INJECT_DB | \
+ KVM_GUESTDBG_BLOCKIRQ)
+
#define KVM_X2APIC_API_VALID_FLAGS (KVM_X2APIC_API_USE_32BIT_IDS | \
KVM_X2APIC_API_DISABLE_BROADCAST_QUIRK | \
KVM_X2APIC_ENABLE_SUPPRESS_EOI_BROADCAST | \
--
2.55.0.rc0.799.gd6f94ed593-goog