lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250228085115.105648-4-Neeraj.Upadhyay@amd.com>
Date: Fri, 28 Feb 2025 14:20:59 +0530
From: Neeraj Upadhyay <Neeraj.Upadhyay@....com>
To: <seanjc@...gle.com>, <pbonzini@...hat.com>, <kvm@...r.kernel.org>
CC: <linux-kernel@...r.kernel.org>, <bp@...en8.de>, <tglx@...utronix.de>,
	<mingo@...hat.com>, <dave.hansen@...ux.intel.com>, <Thomas.Lendacky@....com>,
	<nikunj@....com>, <Santosh.Shukla@....com>, <Vasant.Hegde@....com>,
	<Suravee.Suthikulpanit@....com>, <David.Kaplan@....com>, <x86@...nel.org>,
	<hpa@...or.com>, <peterz@...radead.org>, <huibo.wang@....com>,
	<naveen.rao@....com>, <binbin.wu@...ux.intel.com>, <isaku.yamahata@...el.com>
Subject: [RFC PATCH 03/19] KVM: x86: Convert guest_apic_protected bool to an enum type

Convert guest_apic_protected lapic struct member to an enum..
This allows to categorize guest APIC state protection according
to the KVM interrupt delivery mechanism.

This is used to distinguish between SNP Secure AVIC's interrupt
injection-based interrupt delivery and TDX's posted interrupt
delivery mechanism. Use value 0 to indicate unprotected APIC
so that functions like kvm_cpu_has_interrupt(), which require
KVM to call an arch-specific callback to determine whether
there are any interrupts that need to be delivered to the vCPU,
can still use non-zero guest_apic_protected check. Subsequent
patches for Secure AVIC-specific interrupt injection checks
will need to use specific guest_apic_protected value.

Signed-off-by: Neeraj Upadhyay <Neeraj.Upadhyay@....com>
---
 arch/x86/kvm/lapic.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kvm/lapic.h b/arch/x86/kvm/lapic.h
index e33c969439f7..c9ef9bce438b 100644
--- a/arch/x86/kvm/lapic.h
+++ b/arch/x86/kvm/lapic.h
@@ -55,6 +55,12 @@ struct kvm_timer {
 	bool hv_timer_in_use;
 };
 
+enum kvm_apic_protection {
+	APIC_STATE_UNPROTECTED,
+	APIC_STATE_PROTECTED_POSTED_INTR,
+	APIC_STATE_PROTECTED_INJECTED_INTR,
+};
+
 struct kvm_lapic {
 	unsigned long base_address;
 	struct kvm_io_device dev;
@@ -66,7 +72,7 @@ struct kvm_lapic {
 	bool irr_pending;
 	bool lvt0_in_nmi_mode;
 	/* Select registers in the vAPIC cannot be read/written. */
-	bool guest_apic_protected;
+	enum kvm_apic_protection guest_apic_protected;
 	/* Number of bits set in ISR. */
 	s16 isr_count;
 	/* The highest vector set in ISR; if -1 - invalid, must scan ISR. */
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ