From: Tianyu Lan <[email protected]> Sent: Friday, June 13, 2025 4:08 AM
> 
> From: Tianyu Lan <[email protected]>

For consistency with existing commits, use "Drivers: hv:" as the Subject prefix.

> 
> When Secure AVIC is enabled, Vmbus driver should

s/Vmbus/VMBus/

> call x2apic Secure AVIC interface to allow Hyper-V
> to inject Vmbus message interrupt.

s/Vmbus/VMBus/

> 
> Signed-off-by: Tianyu Lan <[email protected]>
> ---
>  drivers/hv/hv.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c
> index 308c8f279df8..f78b46c51d69 100644
> --- a/drivers/hv/hv.c
> +++ b/drivers/hv/hv.c
> @@ -20,6 +20,7 @@
>  #include <linux/interrupt.h>
>  #include <clocksource/hyperv_timer.h>
>  #include <asm/mshyperv.h>
> +#include <asm/apic.h>
>  #include <linux/set_memory.h>
>  #include "hyperv_vmbus.h"
> 
> @@ -310,6 +311,7 @@ void hv_synic_enable_regs(unsigned int cpu)
>       if (vmbus_irq != -1)
>               enable_percpu_irq(vmbus_irq, 0);
>       shared_sint.as_uint64 = hv_get_msr(HV_MSR_SINT0 + VMBUS_MESSAGE_SINT);
> +     apic_update_vector(smp_processor_id(), vmbus_interrupt, true);

hv_synic_enable_regs() has an input parameter "cpu". Use that instead
of smp_processor_id().

Also, apic_update_vector() is an x86/x64 only function. But
hv_synic_enable_regs() is built for ARM64 as well, so there will be
a compile error on ARM64. We've worked hard to avoid adding
#ifdef CONFIG_X86 or #ifdef CONFIG_ARM64 in this source code, so
I don't like the idea of adding #ifdef around the call to
apic_update_vector().

A possible approach would be to create a wrapper function such as
"hv_enable_coco_interrupt()" with the same function signature as
apic_update_vector(). hv_enable_coco_interrupt() would go i
arch/x86/hyperv/hv_apic.c and would call apic_update_vector().
Then also implement a __weak stub in hv_common.c that does nothing.
hv_common.c already has several such stubs as a pattern to follow.
The stub would allow hv_synic_enable_regs() to compile on ARM64
without having to add #ifdef's. And perhaps in the future CoCo VMs
on Hyper-V ARM64 would need their own implementation of
hv_enable_coco_interrupt(), though I'm not familiar enough with the
ARM64 CCA architecture to know for sure.

Since hv_synic_enable_regs() is enabling the vmbus_interrupt
vector, should hv_synic_disable_regs() disable the vector? It seems
like there should be symmetry unless there is a good reason
otherwise.

> 
>       shared_sint.vector = vmbus_interrupt;
>       shared_sint.masked = false;
> --
> 2.25.1
> 


Reply via email to