[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID:
<SN6PR02MB41578D12A564ECC32BEFD6F1D44BA@SN6PR02MB4157.namprd02.prod.outlook.com>
Date: Fri, 11 Jul 2025 19:25:30 +0000
From: Michael Kelley <mhklinux@...look.com>
To: Nuno Das Neves <nunodasneves@...ux.microsoft.com>,
"linux-hyperv@...r.kernel.org" <linux-hyperv@...r.kernel.org>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "linux-pci@...r.kernel.org"
<linux-pci@...r.kernel.org>, "wei.liu@...nel.org" <wei.liu@...nel.org>,
"tglx@...utronix.de" <tglx@...utronix.de>, "bhelgaas@...gle.com"
<bhelgaas@...gle.com>, "romank@...ux.microsoft.com"
<romank@...ux.microsoft.com>
CC: "kys@...rosoft.com" <kys@...rosoft.com>, "haiyangz@...rosoft.com"
<haiyangz@...rosoft.com>, "decui@...rosoft.com" <decui@...rosoft.com>,
"catalin.marinas@....com" <catalin.marinas@....com>, "will@...nel.org"
<will@...nel.org>, "mingo@...hat.com" <mingo@...hat.com>, "bp@...en8.de"
<bp@...en8.de>, "dave.hansen@...ux.intel.com" <dave.hansen@...ux.intel.com>,
"hpa@...or.com" <hpa@...or.com>, "lpieralisi@...nel.org"
<lpieralisi@...nel.org>, "kw@...ux.com" <kw@...ux.com>, "robh@...nel.org"
<robh@...nel.org>, "jinankjain@...ux.microsoft.com"
<jinankjain@...ux.microsoft.com>, "skinsburskii@...ux.microsoft.com"
<skinsburskii@...ux.microsoft.com>, "mrathor@...ux.microsoft.com"
<mrathor@...ux.microsoft.com>, "x86@...nel.org" <x86@...nel.org>
Subject: RE: [PATCH v3 1/3] Drivers: hv: Use nested hypercall for post message
and signal event
From: Nuno Das Neves <nunodasneves@...ux.microsoft.com> Sent: Friday, July 11, 2025 12:19 PM
>
> When running nested, these hypercalls must be sent to the L0 hypervisor
> or VMBus will fail.
>
> Remove hv_do_nested_hypercall() and hv_do_fast_nested_hypercall8()
> altogether and open-code these cases, since there are only 2 and all
> they do is add the nested bit.
>
> Signed-off-by: Nuno Das Neves <nunodasneves@...ux.microsoft.com>
> Reviewed-by: Roman Kisel <romank@...ux.microsoft.com>
> ---
> arch/x86/include/asm/mshyperv.h | 20 --------------------
> drivers/hv/connection.c | 5 ++++-
> drivers/hv/hv.c | 6 ++++--
> 3 files changed, 8 insertions(+), 23 deletions(-)
>
> diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h
> index e1752ba47e67..ab097a3a8b75 100644
> --- a/arch/x86/include/asm/mshyperv.h
> +++ b/arch/x86/include/asm/mshyperv.h
> @@ -112,12 +112,6 @@ static inline u64 hv_do_hypercall(u64 control, void *input, void *output)
> return hv_status;
> }
>
> -/* Hypercall to the L0 hypervisor */
> -static inline u64 hv_do_nested_hypercall(u64 control, void *input, void *output)
> -{
> - return hv_do_hypercall(control | HV_HYPERCALL_NESTED, input, output);
> -}
> -
> /* Fast hypercall with 8 bytes of input and no output */
> static inline u64 _hv_do_fast_hypercall8(u64 control, u64 input1)
> {
> @@ -165,13 +159,6 @@ static inline u64 hv_do_fast_hypercall8(u16 code, u64 input1)
> return _hv_do_fast_hypercall8(control, input1);
> }
>
> -static inline u64 hv_do_fast_nested_hypercall8(u16 code, u64 input1)
> -{
> - u64 control = (u64)code | HV_HYPERCALL_FAST_BIT | HV_HYPERCALL_NESTED;
> -
> - return _hv_do_fast_hypercall8(control, input1);
> -}
> -
> /* Fast hypercall with 16 bytes of input */
> static inline u64 _hv_do_fast_hypercall16(u64 control, u64 input1, u64 input2)
> {
> @@ -223,13 +210,6 @@ static inline u64 hv_do_fast_hypercall16(u16 code, u64 input1, u64 input2)
> return _hv_do_fast_hypercall16(control, input1, input2);
> }
>
> -static inline u64 hv_do_fast_nested_hypercall16(u16 code, u64 input1, u64 input2)
> -{
> - u64 control = (u64)code | HV_HYPERCALL_FAST_BIT | HV_HYPERCALL_NESTED;
> -
> - return _hv_do_fast_hypercall16(control, input1, input2);
> -}
> -
> extern struct hv_vp_assist_page **hv_vp_assist_page;
>
> static inline struct hv_vp_assist_page *hv_get_vp_assist_page(unsigned int cpu)
> diff --git a/drivers/hv/connection.c b/drivers/hv/connection.c
> index be490c598785..1fe3573ae52a 100644
> --- a/drivers/hv/connection.c
> +++ b/drivers/hv/connection.c
> @@ -519,7 +519,10 @@ void vmbus_set_event(struct vmbus_channel *channel)
> else
> WARN_ON_ONCE(1);
> } else {
> - hv_do_fast_hypercall8(HVCALL_SIGNAL_EVENT, channel->sig_event);
> + u64 control = HVCALL_SIGNAL_EVENT;
> +
> + control |= hv_nested ? HV_HYPERCALL_NESTED : 0;
> + hv_do_fast_hypercall8(control, channel->sig_event);
> }
> }
> EXPORT_SYMBOL_GPL(vmbus_set_event);
> diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c
> index 308c8f279df8..b14c5f9e0ef2 100644
> --- a/drivers/hv/hv.c
> +++ b/drivers/hv/hv.c
> @@ -85,8 +85,10 @@ int hv_post_message(union hv_connection_id connection_id,
> else
> status = HV_STATUS_INVALID_PARAMETER;
> } else {
> - status = hv_do_hypercall(HVCALL_POST_MESSAGE,
> - aligned_msg, NULL);
> + u64 control = HVCALL_POST_MESSAGE;
> +
> + control |= hv_nested ? HV_HYPERCALL_NESTED : 0;
> + status = hv_do_hypercall(control, aligned_msg, NULL);
> }
>
> local_irq_restore(flags);
> --
> 2.34.1
Reviewed-by: Michael Kelley <mhklinux@...look.com>
Powered by blists - more mailing lists