From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.214.200 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795198286; b=lQSLLGoMflPSpzpNlf1II/pmkM3BhE+FsuZhgtlM7pCNkoSExHT4sSKKbnGe6A+f3/kj mYKMrUe2kixX9EbCclLwjH3eQC8EKVX+KSpAYHDr23QcMJgvzdWeS+ivTvwiUkFL/AjEN NAECqPAne2omi5Iw5VuzCJJ5irqdIWpYGUapBuHRyyCZCsduuLF4+QtEG0VF512DrPDou 0K/fXKHUetlyWjgCWco+5by4nFwNrck36YRer9rIA3yD75treiGE5pxRUWss+ythF4FG+ mO7oLVhgK14d2LRVCZu90PZNkEpMtrw4MRktBrlYE6nr8NMLi49KFUcKV2FlGHE59Kw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795198286; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Received:Date:In-Reply-To: Mime-Version:References:Message-ID:Subject:From:To:Cc:Content-Type; bh=JDzbhiCoFBsB1LUGSE+FNJ8fs+B+4L9p62TVlpx0yJ4=; b=bZol2uFKxCVHWaUp+KuXT+mxGufk3Sv0RQUfiUEtCIiR0lzZzCtGquorCJ47QkHqBTDG M54oNSznayYdKypEFbdXLItwS72f9GFtNU7wJlrB9QBk5qasK7+RQbZC70lTnWpbglVQ6 enrhVcd5lGSL+zadC6164DORSKCXNZGqAdLrGnNpC5AEDNNG8fbvJNeUYDiaquTJidOUl mBDE22l7QpIwh7BU+XqxArgM/LBaU/WnTCb8VlGZdSZ6kVmQ7A23OmGU3KGhwTdSkC93e 20F6t5LnFIuTlE9QzH/dpEn+cie71cXg8gQ5zVxeiz/f7ak6AsSJxa8FYB8L6ELGx+Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=PVGHrCoa; arc=none smtp.remote-ip=209.85.214.200 Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D7BD2607A0DA for ; Fri, 20 Nov 2026 18:11:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org D7BD2607A0DA Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=PVGHrCoa Received: by mail-pl1-f200.google.com with SMTP id d9443c01a7336-2efad644688so11438515ad.3 for ; Fri, 20 Nov 2026 10:11:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20260707; t=1795198285; x=1795803085; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=JDzbhiCoFBsB1LUGSE+FNJ8fs+B+4L9p62TVlpx0yJ4=; b=PVGHrCoaAP/5w1paicQ+hrt9379ckz/YstH15fDT/2OfPNc3NuS+VgVBK31Y4KWR1c 6PEILfGm8mXVSYnE+ShXHiGg2+cjwadNYr6CVRAtBkojKCy3wAzMBHiN/hgp9Fr8I0rw pVTVrnraiWylu9/TACtXKP/yfxDi0m6zABmX4xVo2kPJHlkl/y54aRsSc9U/9fMEB2PJ esMW2rw0ckWd4dJpkMIpx7R4IXIDSCQJYl5yEpK1fzu07+gEa1XoH+hwVcUZ/VsnRp4j ChOPqNE4+HHfBFewHGbf5rwxwTNCY+3Zt+DtgYKz0OqIEnlWRHpodKCpTGesETGHl6Vc 6OIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795198285; x=1795803085; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=JDzbhiCoFBsB1LUGSE+FNJ8fs+B+4L9p62TVlpx0yJ4=; b=skLYrKZbYNYOpU6efYnJypQPupeRYhHSrfO44l47Yy/YJN1gClTL20FQEDLAZDyiYg d9exWIklcaVpGSACOhUtimNrREClEl0afXKXKVyGnwuoeCkEL+RO8nz9MpRjpLctZ9j6 +wRb8tNkIRs9eWP/paGI8MYqb4AhXzN4LOz/FIVIk3T6NkSD0G3CjSSa4aVOtdobfwbZ JMGTB3oAqTA9o0iyZueo05DUYYC5uWThW9f6nXzDca32FjAna+u0o/XeJ0romPoax9y6 Ji2IptKXcMuV/Zs8+2r2cQT5W1IJtu9jMLkCrkzYyxTEZXNFfiWJ5+XsSOt+GelfZ5En GaNQ== X-Forwarded-Encrypted: i=1; AL+hErFh0z1jQGlh+3pagmXlgmBJhCfGDhGog5Jg67svEkqlZSUzDL0b0P77c+X85yKHlj92jpZj++fUNZz1ARY=@vger.kernel.org X-Gm-Message-State: APuU4Z+bL8M9Rms9d2BmuO2OZINPYXXiWQmrGUZaL9tJwWGEur1dtYge Fi8qulLtGXK+aAWL4skyW/LDPvrOO2jhkxYmdvDPAa7ZKY2q8kiqAtEOhK3P6DgG1FlHc8oobpC +sg4gYw== X-Received: from plup11.prod.google.com ([2002:a17:903:4b2b:b0:2ed:e056:7a80]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:902:cf08:b0:2f0:59dd:4d07 with SMTP id d9443c01a7336-2f059dd50f7mr8708795ad.38.1795198285056; Fri, 20 Nov 2026 10:11:25 -0800 (PST) Date: Fri, 20 Nov 2026 10:11:24 -0800 In-Reply-To: <5F8F490B-BC93-41EA-B77E-9EC108C09DBE@infradead.org> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 References: <20261113170535.79246-1-dwmw2@infradead.org> <5F8F490B-BC93-41EA-B77E-9EC108C09DBE@infradead.org> Message-ID: Subject: Re: [PATCH v2 0/4] KVM: x86: hyper-v: Forward unimplemented hypercalls to userspace From: Sean Christopherson To: David Woodhouse 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 , Vitaly Kuznetsov , Marcelo Tosatti , Joerg Roedel , Tom Lendacky , James Bottomley , Thara Gopinath , Wei Liu , Michael Kelley , Nicolas Saenz Julienne , Nikolas Wipper , Mushahid Hussain , Sriram Nambakam , Zack Rusin , Doug Covelli , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H . Peter Anvin" , Jonathan Corbet , Randy Dunlap , Shuah Khan , Paul Durrant , Xin Li , Francesco Lavra , "Radim =?utf-8?B?S3LEjW3DocWZ?=" , Liran Alon , Arbel Moshe , David Woodhouse Content-Type: text/plain; charset="us-ascii" On Fri, Nov 13, 2026, David Woodhouse wrote: > On 13 November 2026 10:10:40 GMT-07:00, Sean Christopherson wrote: > >On Fri, Nov 13, 2026, David Woodhouse wrote: > >> From: David Woodhouse > >> > >> 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.