From: Tianyu Lan <ti...@microsoft.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 <ti...@microsoft.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