Linux Documentation
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: David Woodhouse <dwmw2@infradead.org>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-hyperv@vger.kernel.org, linux-kselftest@vger.kernel.org,
	linux-doc@vger.kernel.org, "Paolo Bonzini" <pbonzini@redhat.com>,
	"Vitaly Kuznetsov" <vkuznets@redhat.com>,
	"Marcelo Tosatti" <mtosatti@redhat.com>,
	"Joerg Roedel" <joro@8bytes.org>,
	"Tom Lendacky" <thomas.lendacky@amd.com>,
	"James Bottomley" <James.Bottomley@hansenpartnership.com>,
	"Thara Gopinath" <tgopinath@linux.microsoft.com>,
	"Wei Liu" <wei.liu@kernel.org>,
	"Michael Kelley" <mhklinux@outlook.com>,
	"Nicolas Saenz Julienne" <nsaenz@amazon.com>,
	"Nikolas Wipper" <nik.wipper@gmx.de>,
	"Mushahid Hussain" <hmushi@amazon.co.uk>,
	"Sriram Nambakam" <snambakam@linux.microsoft.com>,
	"Zack Rusin" <zack.rusin@broadcom.com>,
	"Doug Covelli" <doug.covelli@broadcom.com>,
	"Thomas Gleixner" <tglx@kernel.org>,
	"Ingo Molnar" <mingo@redhat.com>,
	"Borislav Petkov" <bp@alien8.de>,
	"Dave Hansen" <dave.hansen@linux.intel.com>,
	x86@kernel.org, "H . Peter Anvin" <hpa@zytor.com>,
	"Jonathan Corbet" <corbet@lwn.net>,
	"Randy Dunlap" <rdunlap@infradead.org>,
	"Shuah Khan" <shuah@kernel.org>, "Paul Durrant" <paul@xen.org>,
	"Xin Li" <xin@zytor.com>, "Francesco Lavra" <flavra@baylibre.com>,
	"Radim Krčmář" <rkrcmar@ventanamicro.com>,
	"Liran Alon" <liran.alon@oracle.com>,
	"Arbel Moshe" <arbel.moshe@oracle.com>,
	"David Woodhouse" <dwmw@amazon.co.uk>
Subject: Re: [PATCH v2 0/4] KVM: x86: hyper-v: Forward unimplemented hypercalls to userspace
Date: Fri, 20 Nov 2026 10:11:24 -0800	[thread overview]
Message-ID: <awCNTITOOiS1JEod@seanjc-mac.roam.internal> (raw)
In-Reply-To: <5F8F490B-BC93-41EA-B77E-9EC108C09DBE@infradead.org>

On Fri, Nov 13, 2026, David Woodhouse wrote:
> On 13 November 2026 10:10:40 GMT-07:00, Sean Christopherson <seanjc@google.com> wrote:
> >On Fri, Nov 13, 2026, David Woodhouse wrote:
> >> From: David Woodhouse <dwmw@amazon.co.uk>
> >> 
> >> KVM implements a fixed set of Hyper-V hypercalls and fails every other
> >> code with HV_STATUS_INVALID_HYPERCALL_CODE. A VMM that wants to
> >> implement more of the TLFS, such as the VSM hypercalls Windows uses for
> >> Virtualization Based Security, never sees them.
> >> 
> >> This series adds KVM_CAP_HYPERV_FORWARD_HCALL. As with KVM_CAP_XEN_HVM
> >> and KVM_CAP_EXIT_HYPERCALL, KVM_CHECK_EXTENSION returns a bitmask of
> >> features and KVM_ENABLE_CAP takes the subset to enable, rejecting any
> >> bit the kernel does not report. The first feature,
> >> KVM_HYPERV_HCALL_FORWARD_UNKNOWN, sends the hypercalls KVM does not
> >> implement, and extended hypercalls in fast form, out through the
> >> existing KVM_EXIT_HYPERV_HCALL exit, whose format does not change at
> >> all.
> >
> >I'm not a fan of fowarding unknown hypercalls.  It seems like it would be quite
> >easy to end up with a mess where it's difficult for KVM to implement "native"
> >support without breaking userspace.
> >
> >How much code (and ongoing churn) would it be to add an allowlist of hypercalls
> >to forward to userspace?  And then obviously require userspace to configure its
> >forwarding "intercepts".
> 
> I'm following the model we used for Xen support, where the default assumption
> is that we do everything in userspace, then accelerate only what's absolutely
> necessary in the kernel.

Oh, right.  I was worried about people getting clever and abusing the Hyper-V
handling to implement bespoke, out-of-tree hypercalls, but that ship has sailed.

> Userspace can opt *in* to having the kernel support certain hypercalls, and
> later patches waiting in the wings already add the in-kernel VTL switching
> enabled via a bitmask when enabling the capability. 

Oh yeah, duh.  We need a capability either way.

      reply	other threads:[~2026-11-20 18:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13 17:05 [PATCH v2 0/4] KVM: x86: hyper-v: Forward unimplemented hypercalls to userspace David Woodhouse
2026-11-13 17:05 ` [PATCH v2 1/4] KVM: x86: hyper-v: Add KVM_CAP_HYPERV_FORWARD_HCALL David Woodhouse
2026-11-13 17:05 ` [PATCH v2 2/4] KVM: x86: Let userspace cancel a pending hypercall completion David Woodhouse
2026-11-13 17:05 ` [PATCH v2 3/4] KVM: x86: hyper-v: Advertise XMM fast hypercall output David Woodhouse
2026-11-13 17:05 ` [PATCH v2 4/4] KVM: selftests: Add Hyper-V hypercall forwarding test David Woodhouse
2026-11-13 17:10 ` [PATCH v2 0/4] KVM: x86: hyper-v: Forward unimplemented hypercalls to userspace Sean Christopherson
2026-11-13 17:23   ` David Woodhouse
2026-11-20 18:11     ` Sean Christopherson [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=awCNTITOOiS1JEod@seanjc-mac.roam.internal \
    --to=seanjc@google.com \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=arbel.moshe@oracle.com \
    --cc=bp@alien8.de \
    --cc=corbet@lwn.net \
    --cc=dave.hansen@linux.intel.com \
    --cc=doug.covelli@broadcom.com \
    --cc=dwmw2@infradead.org \
    --cc=dwmw@amazon.co.uk \
    --cc=flavra@baylibre.com \
    --cc=hmushi@amazon.co.uk \
    --cc=hpa@zytor.com \
    --cc=joro@8bytes.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=liran.alon@oracle.com \
    --cc=mhklinux@outlook.com \
    --cc=mingo@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=nik.wipper@gmx.de \
    --cc=nsaenz@amazon.com \
    --cc=paul@xen.org \
    --cc=pbonzini@redhat.com \
    --cc=rdunlap@infradead.org \
    --cc=rkrcmar@ventanamicro.com \
    --cc=shuah@kernel.org \
    --cc=snambakam@linux.microsoft.com \
    --cc=tglx@kernel.org \
    --cc=tgopinath@linux.microsoft.com \
    --cc=thomas.lendacky@amd.com \
    --cc=vkuznets@redhat.com \
    --cc=wei.liu@kernel.org \
    --cc=x86@kernel.org \
    --cc=xin@zytor.com \
    --cc=zack.rusin@broadcom.com \
    /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