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 54DF3C2FC0F for ; Thu, 17 Aug 2023 17:57:41 +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:From:References:Cc:To: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=nUCNMlwMbrBqwUzEpX0q0UZdJnHCo+vs6fugg9OkjB0=; b=ifsGWR3LHaneIR AmRXvTbD8EiFRDWKoIDUa7Ir4RwiADt9fyhGCPA+Q46YHVpZppBaIQI32A+H1BcZNQqDaimlnkR1k kymeeAnAPMKtDPRn2W/rsyvuGJ5oJrSIQufBbjrcmt9RwmfofaC5EId3a4HHie2GA7Xq1NADihhJJ OxtHSfKvGW7FMHqe7FNCbTZYDXQeS5kNueXXI1WjzxV8vcOCTtx09HNZaLb49vQuSwVbZPg7S7OJ3 i3zvJVHz+bECAAdLCF1GcY25hw/QYy6mAhchy5t7lMB96OCU8u8PPPd4ntUWPceTTDmLVomASiyh1 Oq3xWtCySwwsNxjzx4kQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qWhFB-006vpP-2P; Thu, 17 Aug 2023 17:57:13 +0000 Received: from linux.microsoft.com ([13.77.154.182]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qWhF8-006vmw-2H for linux-arm-kernel@lists.infradead.org; Thu, 17 Aug 2023 17:57:12 +0000 Received: from [192.168.0.5] (71-212-112-68.tukw.qwest.net [71.212.112.68]) by linux.microsoft.com (Postfix) with ESMTPSA id B0B4A211F7B7; Thu, 17 Aug 2023 10:57:00 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com B0B4A211F7B7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1692295021; bh=fhtTpFYAMv833lQqJ6qJ8d9Ged09vSUMPZ70BIl7LAo=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=LXHg/W29TS59LwUP3n+sp1QoALQZsTgWtf53m3WQC6VWJ+BJEriZMBWp+B59fzoDS EdkcAAzjZs3w8LRRvpuw1m606KN1KdLQ2LQakAMDHzpDn8nBYpBXk6152pxRRTz1BI /1hWzX4aikb8SKgHS9F7J77r57WfsfR/hwD99Eec= Message-ID: Date: Thu, 17 Aug 2023 10:57:01 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 15/15] Drivers: hv: Add modules to expose /dev/mshv to VMMs running on Hyper-V Content-Language: en-US To: Wei Liu 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, 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 References: <1690487690-2428-1-git-send-email-nunodasneves@linux.microsoft.com> <1690487690-2428-16-git-send-email-nunodasneves@linux.microsoft.com> From: Nuno Das Neves In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230817_105710_800159_76C89D60 X-CRM114-Status: GOOD ( 39.97 ) 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 8/2/2023 6:23 PM, Wei Liu wrote: > 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. > Thanks - I will provide some more detail, including what you described. I will make a couple of changes - the eventfd framework is in mshv_root, not mshv. I will amend the mshv_vtl part a little for clarity. >> >> 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. > Right. Removed, along with config MSHV_VFIO below. >> + 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. > Yes - I will add it 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? > Oops! Nope, it doesn't seem to break the build... Anyway, removed. > 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