[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250506130712.156583-3-ltykernel@gmail.com>
Date: Tue, 6 May 2025 09:07:07 -0400
From: Tianyu Lan <ltykernel@...il.com>
To: kys@...rosoft.com,
haiyangz@...rosoft.com,
wei.liu@...nel.org,
decui@...rosoft.com,
tglx@...utronix.de,
mingo@...hat.com,
bp@...en8.de,
dave.hansen@...ux.intel.com,
x86@...nel.org,
hpa@...or.com,
Neeraj.Upadhyay@....com,
yuehaibing@...wei.com,
kvijayab@....com,
jacob.jun.pan@...ux.intel.com,
jpoimboe@...nel.org,
tiala@...rosoft.com
Cc: linux-hyperv@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [RFC PATCH 2/6] x86/x2apic-savic: Expose x2apic_savic_update_vector()
From: Tianyu Lan <tiala@...rosoft.com>
Expose x2apic_savic_update_vector() and device driver
arch code may update AVIC backing page to allow Hyper-V
inject associated vector.
Signed-off-by: Tianyu Lan <tiala@...rosoft.com>
---
arch/x86/include/asm/apic.h | 9 +++++++++
arch/x86/kernel/apic/x2apic_savic.c | 8 ++++++++
2 files changed, 17 insertions(+)
diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h
index 6aa4b8ff08a9..949389e05dd7 100644
--- a/arch/x86/include/asm/apic.h
+++ b/arch/x86/include/asm/apic.h
@@ -241,6 +241,15 @@ static inline u64 native_x2apic_icr_read(void)
return val;
}
+#if defined(CONFIG_AMD_SECURE_AVIC)
+extern void x2apic_savic_update_vector(unsigned int cpu,
+ unsigned int vector,
+ bool set);
+#else
+static inline void x2apic_savic_update_vector(unsigned int cpu,
+ unsigned int vector, bool set) { }
+#endif
+
extern int x2apic_mode;
extern int x2apic_phys;
extern void __init x2apic_set_max_apicid(u32 apicid);
diff --git a/arch/x86/kernel/apic/x2apic_savic.c b/arch/x86/kernel/apic/x2apic_savic.c
index 6284d1f8dac9..0dd7e39931b0 100644
--- a/arch/x86/kernel/apic/x2apic_savic.c
+++ b/arch/x86/kernel/apic/x2apic_savic.c
@@ -321,6 +321,14 @@ static void savic_update_vector(unsigned int cpu, unsigned int vector, bool set)
update_vector(cpu, SAVIC_ALLOWED_IRR, vector, set);
}
+void x2apic_savic_update_vector(unsigned int cpu, unsigned int vector, bool set)
+{
+ if (!cc_platform_has(CC_ATTR_SNP_SECURE_AVIC))
+ return;
+
+ savic_update_vector(cpu, vector, set);
+}
+
static void init_apic_page(void)
{
u32 apic_id;
--
2.25.1
Powered by blists - more mailing lists