linux-hyperv.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Roman Kisel <romank@linux.microsoft.com>
To: arnd@arndb.de, bhelgaas@google.com, bp@alien8.de,
	catalin.marinas@arm.com, dave.hansen@linux.intel.com,
	decui@microsoft.com, haiyangz@microsoft.com, hpa@zytor.com,
	kw@linux.com, kys@microsoft.com, lenb@kernel.org,
	lpieralisi@kernel.org, mingo@redhat.com, rafael@kernel.org,
	robh@kernel.org, tglx@linutronix.de, wei.liu@kernel.org,
	will@kernel.org, linux-acpi@vger.kernel.org,
	linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-pci@vger.kernel.org, x86@kernel.org
Cc: apais@microsoft.com, benhill@microsoft.com,
	ssengar@microsoft.com, sunilmut@microsoft.com, vdso@hexbites.dev
Subject: [PATCH v3 0/7] arm64: hyperv: Support Virtual Trust Level Boot
Date: Fri, 26 Jul 2024 15:59:03 -0700	[thread overview]
Message-ID: <20240726225910.1912537-1-romank@linux.microsoft.com> (raw)

This patch set enables the Hyper-V code to boot on ARM64 inside a Virtual Trust
Level. These levels are a part of the Virtual Secure Mode documented in the
Top-Level Functional Specification available at
https://learn.microsoft.com/en-us/virtualization/hyper-v-on-windows/tlfs/vsm

[V3]
    - Employed the SMC recently implemented in the Microsoft Hyper-V hypervisor
      to detect running on Hyper-V/arm64. No dependence on ACPI/DT is needed
      anymore although the source code still falls back to ACPI as the new
      hypervisor might be available only in the Windows Insiders channel just
      yet.
    - As a part of the above, refactored detecting the hypervisor via ACPI FADT.
    - There was a suggestion to explore whether it is feasible or not to express
      that ACPI must be absent for the VTL mode and present for the regular guests
      in the Hyper-V Kconfig file.
      My current conclusion is that this will require refactoring in many places.
      That becomes especially convoluted on x86_64 due to the MSI and APIC
      dependencies. I'd ask to let us tackle that in another patch series (or chalk
      up to nice-have's rather than fires to put out) to separate concerns and
      decrease chances of breakage.
    - While refactoring `get_vtl(void)` and the related code, fixed the hypercall
      output address not to overlap with the input as the Hyper-V TLFS mandates:
      "The input and output parameter lists cannot overlap or cross page boundaries."
      See https://learn.microsoft.com/en-us/virtualization/hyper-v-on-windows/tlfs/hypercall-interface
      for more.
      Some might argue that should've been a topic for a separate patch series;
      I'd counter that the change is well-contained (one line), has no dependencies,
      and makes the code legal.
    - Made the VTL boot code (c)leaner as was suggested.
    - Set DMA cache coherency for the VMBus.
    - Updated DT bindings in the VMBus documentation (separated out into a new patch).
    - Fixed `vmbus_set_irq` to use the API that works both for the ACPI and OF.
    - Reworked setting up the vPCI MSI IRQ domain in the non-ACPI case. The logic
      looks a bit fiddly/ad-hoc as I couldn't find the API that would fit the bill.
      Added comments to explain myself.

[V2]
    https://lore.kernel.org/all/20240514224508.212318-1-romank@linux.microsoft.com/
    - Decreased number of #ifdef's
    - Updated the wording in the commit messages to adhere to the guidlines
    - Sending to the correct set of maintainers and mail lists

[V1]
    https://lore.kernel.org/all/20240510160602.1311352-1-romank@linux.microsoft.com/

For validation, I built kernels for the arch'es in question with the small initrd
embedded into the kernel and booted the Hyper-V VMs off of that.

Roman Kisel (7):
  arm64: hyperv: Use SMC to detect hypervisor presence
  Drivers: hv: Enable VTL mode for arm64
  Drivers: hv: Provide arch-neutral implementation of get_vtl()
  arm64: hyperv: Boot in a Virtual Trust Level
  dt-bindings: bus: Add Hyper-V VMBus cache coherency and IRQs
  Drivers: hv: vmbus: Get the IRQ number from DT
  PCI: hv: Get vPCI MSI IRQ domain from DT

 .../bindings/bus/microsoft,vmbus.yaml         | 11 +++
 arch/arm64/hyperv/Makefile                    |  1 +
 arch/arm64/hyperv/hv_vtl.c                    | 13 ++++
 arch/arm64/hyperv/mshyperv.c                  | 40 +++++++++--
 arch/arm64/include/asm/mshyperv.h             | 12 ++++
 arch/x86/hyperv/hv_init.c                     | 34 ---------
 arch/x86/include/asm/hyperv-tlfs.h            |  7 --
 drivers/hv/Kconfig                            |  6 +-
 drivers/hv/hv_common.c                        | 47 +++++++++++-
 drivers/hv/vmbus_drv.c                        | 72 ++++++++++++++++---
 drivers/pci/controller/pci-hyperv.c           | 55 +++++++++++++-
 include/asm-generic/hyperv-tlfs.h             |  7 ++
 include/asm-generic/mshyperv.h                |  6 ++
 include/linux/hyperv.h                        |  2 +
 14 files changed, 251 insertions(+), 62 deletions(-)
 create mode 100644 arch/arm64/hyperv/hv_vtl.c


base-commit: 831bcbcead6668ebf20b64fdb27518f1362ace3a
-- 
2.34.1


             reply	other threads:[~2024-07-26 22:59 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-26 22:59 Roman Kisel [this message]
2024-07-26 22:59 ` [PATCH v3 1/7] arm64: hyperv: Use SMC to detect hypervisor presence Roman Kisel
2024-08-03  1:21   ` Wei Liu
2024-08-05 14:53     ` Roman Kisel
2024-08-05  3:01   ` Michael Kelley
2024-08-05 16:50     ` Roman Kisel
2024-08-05 20:30       ` Michael Kelley
2024-08-05 21:44         ` Roman Kisel
2024-08-05  3:53   ` Saurabh Singh Sengar
2024-08-05 15:17     ` Roman Kisel
2024-08-05 15:46       ` Saurabh Singh Sengar
2024-08-05 15:56         ` Roman Kisel
2024-07-26 22:59 ` [PATCH v3 2/7] Drivers: hv: Enable VTL mode for arm64 Roman Kisel
2024-08-03  1:21   ` Wei Liu
2024-08-05  3:01   ` Michael Kelley
2024-08-05  4:05     ` Saurabh Singh Sengar
2024-08-05 15:24       ` Roman Kisel
2024-08-05 19:51         ` Michael Kelley
2024-08-05 22:15           ` Roman Kisel
2024-07-26 22:59 ` [PATCH v3 3/7] Drivers: hv: Provide arch-neutral implementation of get_vtl() Roman Kisel
2024-08-03  1:21   ` Wei Liu
2024-08-05  5:45     ` Saurabh Singh Sengar
2024-08-05  3:02   ` Michael Kelley
2024-08-05 16:19     ` Roman Kisel
2024-08-05 20:13       ` Michael Kelley
2024-08-05 21:55         ` Roman Kisel
2024-07-26 22:59 ` [PATCH v3 4/7] arm64: hyperv: Boot in a Virtual Trust Level Roman Kisel
2024-08-03  1:22   ` Wei Liu
2024-08-05 14:55     ` Roman Kisel
2024-08-05  3:02   ` Michael Kelley
2024-08-05 16:20     ` Roman Kisel
2024-08-05  6:28   ` Saurabh Singh Sengar
2024-08-05 15:48     ` Roman Kisel
2024-07-26 22:59 ` [PATCH v3 5/7] dt-bindings: bus: Add Hyper-V VMBus cache coherency and IRQs Roman Kisel
2024-07-27  8:53   ` Krzysztof Kozlowski
2024-07-29 16:33     ` Roman Kisel
2024-07-26 22:59 ` [PATCH v3 6/7] Drivers: hv: vmbus: Get the IRQ number from DT Roman Kisel
2024-07-27  8:56   ` Krzysztof Kozlowski
2024-07-27  9:17     ` Arnd Bergmann
2024-07-27  9:20       ` Krzysztof Kozlowski
2024-07-29 16:51       ` Roman Kisel
2024-08-05  3:03         ` Michael Kelley
2024-08-05 16:26           ` Roman Kisel
2024-07-29 16:36     ` Roman Kisel
2024-08-05  8:30   ` Saurabh Singh Sengar
2024-08-05 14:12     ` Michael Kelley
2024-08-05 15:49       ` Roman Kisel
2024-07-26 22:59 ` [PATCH v3 7/7] PCI: hv: Get vPCI MSI IRQ domain " Roman Kisel
2024-08-03  1:20   ` Wei Liu
2024-08-05 14:51     ` Roman Kisel
2024-08-05 15:59       ` Roman Kisel
2024-08-05  3:03   ` Michael Kelley
2024-08-05 16:30     ` Roman Kisel

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=20240726225910.1912537-1-romank@linux.microsoft.com \
    --to=romank@linux.microsoft.com \
    --cc=apais@microsoft.com \
    --cc=arnd@arndb.de \
    --cc=benhill@microsoft.com \
    --cc=bhelgaas@google.com \
    --cc=bp@alien8.de \
    --cc=catalin.marinas@arm.com \
    --cc=dave.hansen@linux.intel.com \
    --cc=decui@microsoft.com \
    --cc=haiyangz@microsoft.com \
    --cc=hpa@zytor.com \
    --cc=kw@linux.com \
    --cc=kys@microsoft.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-hyperv@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=mingo@redhat.com \
    --cc=rafael@kernel.org \
    --cc=robh@kernel.org \
    --cc=ssengar@microsoft.com \
    --cc=sunilmut@microsoft.com \
    --cc=tglx@linutronix.de \
    --cc=vdso@hexbites.dev \
    --cc=wei.liu@kernel.org \
    --cc=will@kernel.org \
    --cc=x86@kernel.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).