From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A0958C001DF for ; Thu, 3 Aug 2023 01:24:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=QUaPI8vlP2zRMO/dGYU09K7a0dybtSweHscSd+dQ804=; b=lh9nvDdRmmmh1u t7Ftp6eC91VCLiw+rjkJvFsPUuifd5dQksvbgho0p8OZeZv1WT+eZgAJm5OrT5ZpQS7D/dLqlFHG0 YTWyytt2RwXmVdTwzGZXOzfJHth55G+ohlJQ4AntYA3nInX2ox8F3DiM2ss8WHHA50Kfpit8uPkxM fRAl+YXpItRshXpceYTcjlF2dhwfMS3jvE5Yuqm8nX3ayY33meHYUfXQK2UrCfG3RVDQEViSZ1Y+L PgWavYICvAQ6WsJWOUI0qUq+FGKV27rg+f7ssTFeu9RaV2AWwT+PH/nckCtObYHt8rl48U8CJv7Li A/L7n45MNPDmmzM85yNw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qRN3y-006M8R-0o; Thu, 03 Aug 2023 01:23:38 +0000 Received: from mail-pl1-f180.google.com ([209.85.214.180]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qRN3u-006M7d-2R for linux-arm-kernel@lists.infradead.org; Thu, 03 Aug 2023 01:23:36 +0000 Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-1bb893e6365so3358415ad.2 for ; Wed, 02 Aug 2023 18:23:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691025811; x=1691630611; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=L99r2ZTEs0s1xRLWCPq6Icmbu/mSWzl3/Bl+vsItAA4=; b=ZLRqcJf72Yo+TT7BuCabjgjAj5g0YMCTjPjYGUPLSrd3ZpQIdJWvg/SqSxRcyvDWAs PoUpo5ltITjqbdkflbZA25vbpFOhLNoo7kyDWKf9dwJHjl2toz7Pci2amD1DiDyKBCPQ v3HpQx78IkaficXDCptAbU9e+QIAyIK5xU+8avf4Bd9cvbFEOjF4LVRb1GPhEUNg0Bmq f1TVGhLYXm34J87ASd6OT/oHsMqUIe3Bq6o73tNNQVx9XbZvQmEDcsnmkXQ+0CW1unAc 0v07extXknzxdX3MgHzdFeUbmfb1UryNLxmqfrWp9KLn12DOhqBfG3vNWh5/iVDxZQrk plQw== X-Gm-Message-State: ABy/qLYrDA69OaavMHHPMyQAojP69ygVLpz/S4yriWgNHd+2Jm7Rtxfm EcMWy1JUn68WApneIq+1UPDGPK5tYok= X-Google-Smtp-Source: APBJJlFyzZ0APpf2dycVzuSAvEuollZAIArFhKmP7z/2OuO+QhL68E2G6sLjZLtbq2SX86vDmTVLeg== X-Received: by 2002:a17:902:bb8d:b0:1b8:b436:c006 with SMTP id m13-20020a170902bb8d00b001b8b436c006mr15268682pls.12.1691025811335; Wed, 02 Aug 2023 18:23:31 -0700 (PDT) Received: from liuwe-devbox-debian-v2 ([20.69.120.36]) by smtp.gmail.com with ESMTPSA id 12-20020a170902c24c00b001b9c5e0393csm13073219plg.225.2023.08.02.18.23.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Aug 2023 18:23:30 -0700 (PDT) Date: Thu, 3 Aug 2023 01:23:24 +0000 From: Wei Liu To: Nuno Das Neves Cc: linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org, x86@kernel.org, linux-arm-kernel@lists.infradead.org, linux-arch@vger.kernel.org, mikelley@microsoft.com, kys@microsoft.com, wei.liu@kernel.org, haiyangz@microsoft.com, decui@microsoft.com, ssengar@linux.microsoft.com, mukeshrathor@microsoft.com, stanislav.kinsburskiy@gmail.com, jinankjain@linux.microsoft.com, apais@linux.microsoft.com, Tianyu.Lan@microsoft.com, vkuznets@redhat.com, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com, will@kernel.org, catalin.marinas@arm.com Subject: Re: [PATCH 15/15] Drivers: hv: Add modules to expose /dev/mshv to VMMs running on Hyper-V Message-ID: References: <1690487690-2428-1-git-send-email-nunodasneves@linux.microsoft.com> <1690487690-2428-16-git-send-email-nunodasneves@linux.microsoft.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1690487690-2428-16-git-send-email-nunodasneves@linux.microsoft.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230802_182334_803478_7006AECB X-CRM114-Status: GOOD ( 34.00 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Jul 27, 2023 at 12:54:50PM -0700, Nuno Das Neves wrote: > Add mshv, mshv_root, and mshv_vtl modules. > - mshv provides /dev/mshv and common code, and is the parent module > - mshv_root provides APIs for creating and managing child partitions > - mshv_vtl provides VTL (Virtual Trust Level) support for VMMs Please provide a slightly more detailed description of what these modules do. This is huge patch after all. People doing code archaeology will appreciate a better commit message. For example (please correct if I'm wrong): Module mshv provides /dev/mshv and common code, and is the parent module to the other two modules. At its core, it implements an eventfd frame work, and defines some helper functions for the other modules. Module mshv_root provides APIs for creating and managing child partitions. It defines abstractions for vcpus, partitions and other things related to running a guest inside the kernel. It also exposes user space interfaces for the VMMs. Module mshv_vtl provides VTL (Virtual Trust Level) support for VMMs. It allows the VMM to run in a higher trust level than the guest but still within the same context as the guest. This is a useful feature for in guest emulation for better isolation and performance. > > Signed-off-by: Nuno Das Neves > --- > drivers/hv/Kconfig | 54 + > drivers/hv/Makefile | 21 + > drivers/hv/hv_call.c | 119 ++ > drivers/hv/mshv.h | 156 +++ > drivers/hv/mshv_eventfd.c | 758 ++++++++++++ > drivers/hv/mshv_eventfd.h | 80 ++ > drivers/hv/mshv_main.c | 208 ++++ > drivers/hv/mshv_msi.c | 129 +++ > drivers/hv/mshv_portid_table.c | 84 ++ > drivers/hv/mshv_root.h | 194 ++++ > drivers/hv/mshv_root_hv_call.c | 1064 +++++++++++++++++ > drivers/hv/mshv_root_main.c | 1964 ++++++++++++++++++++++++++++++++ > drivers/hv/mshv_synic.c | 689 +++++++++++ > drivers/hv/mshv_vtl.h | 52 + > drivers/hv/mshv_vtl_main.c | 1541 +++++++++++++++++++++++++ > drivers/hv/xfer_to_guest.c | 28 + > include/uapi/linux/mshv.h | 298 +++++ > 17 files changed, 7439 insertions(+) > create mode 100644 drivers/hv/hv_call.c > create mode 100644 drivers/hv/mshv.h > create mode 100644 drivers/hv/mshv_eventfd.c > create mode 100644 drivers/hv/mshv_eventfd.h > create mode 100644 drivers/hv/mshv_main.c > create mode 100644 drivers/hv/mshv_msi.c > create mode 100644 drivers/hv/mshv_portid_table.c > create mode 100644 drivers/hv/mshv_root.h > create mode 100644 drivers/hv/mshv_root_hv_call.c > create mode 100644 drivers/hv/mshv_root_main.c > create mode 100644 drivers/hv/mshv_synic.c > create mode 100644 drivers/hv/mshv_vtl.h > create mode 100644 drivers/hv/mshv_vtl_main.c > create mode 100644 drivers/hv/xfer_to_guest.c > create mode 100644 include/uapi/linux/mshv.h > > diff --git a/drivers/hv/Kconfig b/drivers/hv/Kconfig > index 00242107d62e..b150d686e902 100644 > --- a/drivers/hv/Kconfig > +++ b/drivers/hv/Kconfig > @@ -54,4 +54,58 @@ config HYPERV_BALLOON > help > Select this option to enable Hyper-V Balloon driver. > > +config MSHV > + tristate "Microsoft Hypervisor root partition interfaces: /dev/mshv" > + depends on X86_64 && HYPERV > + select EVENTFD > + select MSHV_VFIO This is not needed yet, right? I think this is just dead code right now. It can be introduced when we start upstreaming the VFIO bits. > + select MSHV_XFER_TO_GUEST_WORK > + help > + Select this option to enable core functionality for managing guest > + virtual machines running under the Microsoft Hypervisor. > + > + The interfaces are provided via a device named /dev/mshv. > + > + To compile this as a module, choose M here. > + > + If unsure, say N. > + > +config MSHV_ROOT > + tristate "Microsoft Hyper-V root partition APIs driver" > + depends on MSHV > + help > + Select this option to provide /dev/mshv interfaces specific to > + running as the root partition on Microsoft Hypervisor. > + > + To compile this as a module, choose M here. > + > + If unsure, say N. > + > +config MSHV_VTL > + tristate "Microsoft Hyper-V VTL driver" > + depends on MSHV > + select HYPERV_VTL_MODE > + select TRANSPARENT_HUGEPAGE > + help > + Select this option to enable Hyper-V VTL driver. > + Virtual Secure Mode (VSM) is a set of hypervisor capabilities and > + enlightenments offered to host and guest partitions which enables > + the creation and management of new security boundaries within > + operating system software. > + > + VSM achieves and maintains isolation through Virtual Trust Levels > + (VTLs). Virtual Trust Levels are hierarchical, with higher levels > + being more privileged than lower levels. VTL0 is the least privileged > + level, and currently only other level supported is VTL2. > + > + To compile this as a module, choose M here. > + > + If unsure, say N. The changes to the function which indicates if output pages are needed should be in this patch. > + > +config MSHV_VFIO > + bool > + > +config MSHV_XFER_TO_GUEST_WORK > + bool > + > endmenu > diff --git a/drivers/hv/Makefile b/drivers/hv/Makefile > index d76df5c8c2a9..113c79cfadb9 100644 > --- a/drivers/hv/Makefile > +++ b/drivers/hv/Makefile > @@ -2,10 +2,31 @@ > obj-$(CONFIG_HYPERV) += hv_vmbus.o > obj-$(CONFIG_HYPERV_UTILS) += hv_utils.o > obj-$(CONFIG_HYPERV_BALLOON) += hv_balloon.o > +obj-$(CONFIG_DXGKRNL) += dxgkrnl/ This is not yet upstreamed. It shouldn't be here. Does this not break the build for you? The rest is basically a copy of what was posted many moons before plus some VTL stuff, and new code for the root scheduler and async hypercall support. I've probably gone through some versions of this code already, so I only skim the code. Since this is a Microsoft only driver, I don't expect to get much review from the community -- the last few rounds were quiet. I will however let this patch series float for a while before taking any further actions just in case. If people are interested in specific bits of the code in the driver, please let Nuno and I know. Thanks, Wei. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel