[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<SN6PR02MB4157CE2673B36211FF3CF141D47CA@SN6PR02MB4157.namprd02.prod.outlook.com>
Date: Fri, 20 Jun 2025 02:17:28 +0000
From: Michael Kelley <mhklinux@...look.com>
To: Tianyu Lan <ltykernel@...il.com>, "kys@...rosoft.com" <kys@...rosoft.com>,
"haiyangz@...rosoft.com" <haiyangz@...rosoft.com>, "wei.liu@...nel.org"
<wei.liu@...nel.org>, "decui@...rosoft.com" <decui@...rosoft.com>,
"tglx@...utronix.de" <tglx@...utronix.de>, "mingo@...hat.com"
<mingo@...hat.com>, "bp@...en8.de" <bp@...en8.de>,
"dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>, "x86@...nel.org"
<x86@...nel.org>, "hpa@...or.com" <hpa@...or.com>, "kvijayab@....com"
<kvijayab@....com>, "Neeraj.Upadhyay@....com" <Neeraj.Upadhyay@....com>
CC: Tianyu Lan <tiala@...rosoft.com>, "linux-hyperv@...r.kernel.org"
<linux-hyperv@...r.kernel.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>
Subject: RE: [RFC Patch v2 2/4] drivers/hv: Allow vmbus message synic
interrupt injected from Hyper-V
From: Tianyu Lan <ltykernel@...il.com> Sent: Friday, June 13, 2025 4:08 AM
>
> From: Tianyu Lan <tiala@...rosoft.com>
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 <tiala@...rosoft.com>
> ---
> 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
>
Powered by blists - more mailing lists