On 5/6/2025 6:37 PM, Tianyu Lan wrote:
> 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>
I think this new interface is not required. Device driver arch code can call
apic_update_vector() to invoke APIC driver's update_vector() callback.
Or is it that I am missing something? So, can you explain why this new interface
is needed?
- Neeraj
> ---
> 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;