[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250401113616.204203-5-Neeraj.Upadhyay@amd.com>
Date: Tue, 1 Apr 2025 17:06:03 +0530
From: Neeraj Upadhyay <Neeraj.Upadhyay@....com>
To: <linux-kernel@...r.kernel.org>
CC: <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>, <seanjc@...gle.com>,
<pbonzini@...hat.com>, <kvm@...r.kernel.org>,
<kirill.shutemov@...ux.intel.com>, <huibo.wang@....com>,
<naveen.rao@....com>, <francescolavra.fl@...il.com>
Subject: [PATCH v3 04/17] x86/apic: Initialize APIC ID for Secure AVIC
Initialize the APIC ID in the Secure AVIC APIC backing page with
the APIC_ID msr value read from Hypervisor. CPU topology evaluation
later during boot would catch and report any duplicate APIC ID for
two CPUs.
Signed-off-by: Neeraj Upadhyay <Neeraj.Upadhyay@....com>
---
Changes since v2:
- Drop duplicate APIC ID checks.
arch/x86/kernel/apic/x2apic_savic.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/arch/x86/kernel/apic/x2apic_savic.c b/arch/x86/kernel/apic/x2apic_savic.c
index f1dd74724769..21f7c055995e 100644
--- a/arch/x86/kernel/apic/x2apic_savic.c
+++ b/arch/x86/kernel/apic/x2apic_savic.c
@@ -185,12 +185,25 @@ static void x2apic_savic_send_ipi_mask_allbutself(const struct cpumask *mask, in
__send_ipi_mask(mask, vector, true);
}
+static void init_apic_page(void)
+{
+ u32 apic_id;
+
+ /*
+ * Before Secure AVIC is enabled, APIC msr reads are intercepted.
+ * APIC_ID msr read returns the value from the Hypervisor.
+ */
+ apic_id = native_apic_msr_read(APIC_ID);
+ set_reg(APIC_ID, apic_id);
+}
+
static void x2apic_savic_setup(void)
{
void *backing_page;
enum es_result ret;
unsigned long gpa;
+ init_apic_page();
backing_page = this_cpu_ptr(apic_page);
gpa = __pa(backing_page);
--
2.34.1
Powered by blists - more mailing lists