qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: "Maciej S. Szmigiero" <mail@maciej.szmigiero.name>,
	qemu-devel@nongnu.org
Cc: Marcelo Tosatti <mtosatti@redhat.com>,
	David Hildenbrand <david@redhat.com>,
	kvm@vger.kernel.org
Subject: Re: [PATCH] vmbus: Print a warning when enabled without the recommended set of features
Date: Wed, 6 Mar 2024 23:51:45 +0100	[thread overview]
Message-ID: <33bac01d-6343-4bbb-8baf-f6a741b026ce@redhat.com> (raw)
In-Reply-To: <e2d961d56d795fe42ea54f1272c7157e40aeae1e.1706198618.git.maciej.szmigiero@oracle.com>

On 1/25/24 17:19, Maciej S. Szmigiero wrote:
> From: "Maciej S. Szmigiero" <maciej.szmigiero@oracle.com>
> 
> Some Windows versions crash at boot or fail to enable the VMBus device if
> they don't see the expected set of Hyper-V features (enlightenments).
> 
> Since this provides poor user experience let's warn user if the VMBus
> device is enabled without the recommended set of Hyper-V features.
> 
> The recommended set is the minimum set of Hyper-V features required to make
> the VMBus device work properly in Windows Server versions 2016, 2019 and
> 2022.
> 
> Signed-off-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com>

Acked-by: Paolo Bonzini <pbonzini@redhat.com>

Thanks,

Paolo

> ---
>   hw/hyperv/hyperv.c            | 12 ++++++++++++
>   hw/hyperv/vmbus.c             |  6 ++++++
>   include/hw/hyperv/hyperv.h    |  4 ++++
>   target/i386/kvm/hyperv-stub.c |  4 ++++
>   target/i386/kvm/hyperv.c      |  5 +++++
>   target/i386/kvm/hyperv.h      |  2 ++
>   target/i386/kvm/kvm.c         |  7 +++++++
>   7 files changed, 40 insertions(+)
> 
> diff --git a/hw/hyperv/hyperv.c b/hw/hyperv/hyperv.c
> index 57b402b95610..2c91de7ff4a8 100644
> --- a/hw/hyperv/hyperv.c
> +++ b/hw/hyperv/hyperv.c
> @@ -947,3 +947,15 @@ uint64_t hyperv_syndbg_query_options(void)
>   
>       return msg.u.query_options.options;
>   }
> +
> +static bool vmbus_recommended_features_enabled;
> +
> +bool hyperv_are_vmbus_recommended_features_enabled(void)
> +{
> +    return vmbus_recommended_features_enabled;
> +}
> +
> +void hyperv_set_vmbus_recommended_features_enabled(void)
> +{
> +    vmbus_recommended_features_enabled = true;
> +}
> diff --git a/hw/hyperv/vmbus.c b/hw/hyperv/vmbus.c
> index 380239af2c7b..f33afeeea27d 100644
> --- a/hw/hyperv/vmbus.c
> +++ b/hw/hyperv/vmbus.c
> @@ -2631,6 +2631,12 @@ static void vmbus_bridge_realize(DeviceState *dev, Error **errp)
>           return;
>       }
>   
> +    if (!hyperv_are_vmbus_recommended_features_enabled()) {
> +        warn_report("VMBus enabled without the recommended set of Hyper-V features: "
> +                    "hv-stimer, hv-vapic and hv-runtime. "
> +                    "Some Windows versions might not boot or enable the VMBus device");
> +    }
> +
>       bridge->bus = VMBUS(qbus_new(TYPE_VMBUS, dev, "vmbus"));
>   }
>   
> diff --git a/include/hw/hyperv/hyperv.h b/include/hw/hyperv/hyperv.h
> index 015c3524b1c2..d717b4e13d40 100644
> --- a/include/hw/hyperv/hyperv.h
> +++ b/include/hw/hyperv/hyperv.h
> @@ -139,4 +139,8 @@ typedef struct HvSynDbgMsg {
>   } HvSynDbgMsg;
>   typedef uint16_t (*HvSynDbgHandler)(void *context, HvSynDbgMsg *msg);
>   void hyperv_set_syndbg_handler(HvSynDbgHandler handler, void *context);
> +
> +bool hyperv_are_vmbus_recommended_features_enabled(void);
> +void hyperv_set_vmbus_recommended_features_enabled(void);
> +
>   #endif
> diff --git a/target/i386/kvm/hyperv-stub.c b/target/i386/kvm/hyperv-stub.c
> index 778ed782e6fc..3263dcf05d31 100644
> --- a/target/i386/kvm/hyperv-stub.c
> +++ b/target/i386/kvm/hyperv-stub.c
> @@ -52,3 +52,7 @@ void hyperv_x86_synic_reset(X86CPU *cpu)
>   void hyperv_x86_synic_update(X86CPU *cpu)
>   {
>   }
> +
> +void hyperv_x86_set_vmbus_recommended_features_enabled(void)
> +{
> +}
> diff --git a/target/i386/kvm/hyperv.c b/target/i386/kvm/hyperv.c
> index 6825c89af374..f2a3fe650a18 100644
> --- a/target/i386/kvm/hyperv.c
> +++ b/target/i386/kvm/hyperv.c
> @@ -149,3 +149,8 @@ int kvm_hv_handle_exit(X86CPU *cpu, struct kvm_hyperv_exit *exit)
>           return -1;
>       }
>   }
> +
> +void hyperv_x86_set_vmbus_recommended_features_enabled(void)
> +{
> +    hyperv_set_vmbus_recommended_features_enabled();
> +}
> diff --git a/target/i386/kvm/hyperv.h b/target/i386/kvm/hyperv.h
> index 67543296c3a4..e3982c8f4dd1 100644
> --- a/target/i386/kvm/hyperv.h
> +++ b/target/i386/kvm/hyperv.h
> @@ -26,4 +26,6 @@ int hyperv_x86_synic_add(X86CPU *cpu);
>   void hyperv_x86_synic_reset(X86CPU *cpu);
>   void hyperv_x86_synic_update(X86CPU *cpu);
>   
> +void hyperv_x86_set_vmbus_recommended_features_enabled(void);
> +
>   #endif
> diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c
> index e88e65fe014c..d3d01b3cf82d 100644
> --- a/target/i386/kvm/kvm.c
> +++ b/target/i386/kvm/kvm.c
> @@ -1650,6 +1650,13 @@ static int hyperv_init_vcpu(X86CPU *cpu)
>           }
>       }
>   
> +    /* Skip SynIC and VP_INDEX since they are hard deps already */
> +    if (hyperv_feat_enabled(cpu, HYPERV_FEAT_STIMER) &&
> +        hyperv_feat_enabled(cpu, HYPERV_FEAT_VAPIC) &&
> +        hyperv_feat_enabled(cpu, HYPERV_FEAT_RUNTIME)) {
> +        hyperv_x86_set_vmbus_recommended_features_enabled();
> +    }
> +
>       return 0;
>   }
>   
> 
> 



      parent reply	other threads:[~2024-03-06 22:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-25 16:19 [PATCH] vmbus: Print a warning when enabled without the recommended set of features Maciej S. Szmigiero
2024-02-29 15:44 ` Maciej S. Szmigiero
2024-03-06 22:51 ` Paolo Bonzini [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=33bac01d-6343-4bbb-8baf-f6a741b026ce@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=david@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mail@maciej.szmigiero.name \
    --cc=mtosatti@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).