index.rst 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. .. SPDX-License-Identifier: GPL-2.0
  2. =================
  3. Gunyah Hypervisor
  4. =================
  5. .. toctree::
  6. :maxdepth: 1
  7. vm-manager
  8. message-queue
  9. Gunyah is a Type-1 hypervisor which is independent of any OS kernel, and runs in
  10. a higher CPU privilege level. It does not depend on any lower-privileged operating system
  11. for its core functionality. This increases its security and can support a much smaller
  12. trusted computing base than a Type-2 hypervisor.
  13. Gunyah is an open source hypervisor. The source repo is available at
  14. https://github.com/quic/gunyah-hypervisor.
  15. Gunyah provides these following features.
  16. - Scheduling:
  17. A scheduler for virtual CPUs (vCPUs) on physical CPUs enables time-sharing
  18. of the CPUs. Gunyah supports two models of scheduling:
  19. 1. "Behind the back" scheduling in which Gunyah hypervisor schedules vCPUS on its own.
  20. 2. "Proxy" scheduling in which a delegated VM can donate part of one of its vCPU slice
  21. to another VM's vCPU via a hypercall.
  22. - Memory Management:
  23. APIs handling memory, abstracted as objects, limiting direct use of physical
  24. addresses. Memory ownership and usage tracking of all memory under its control.
  25. Memory partitioning between VMs is a fundamental security feature.
  26. - Interrupt Virtualization:
  27. Uses CPU hardware interrupt virtualization capabilities. Interrupts are handled
  28. in the hypervisor and routed to the assigned VM.
  29. - Inter-VM Communication:
  30. There are several different mechanisms provided for communicating between VMs.
  31. - Virtual platform:
  32. Architectural devices such as interrupt controllers and CPU timers are directly provided
  33. by the hypervisor as well as core virtual platform devices and system APIs such as ARM PSCI.
  34. - Device Virtualization:
  35. Para-virtualization of devices is supported using inter-VM communication.
  36. Architectures supported
  37. =======================
  38. AArch64 with a GIC
  39. Resources and Capabilities
  40. ==========================
  41. Some services or resources provided by the Gunyah hypervisor are described to a virtual machine by
  42. capability IDs. For instance, inter-VM communication is performed with doorbells and message queues.
  43. Gunyah allows access to manipulate that doorbell via the capability ID. These resources are
  44. described in Linux as a struct gh_resource.
  45. High level management of these resources is performed by the resource manager VM. RM informs a
  46. guest VM about resources it can access through either the device tree or via guest-initiated RPC.
  47. For each virtual machine, Gunyah maintains a table of resources which can be accessed by that VM.
  48. An entry in this table is called a "capability" and VMs can only access resources via this
  49. capability table. Hence, virtual Gunyah resources are referenced by a "capability IDs" and not
  50. "resource IDs". If 2 VMs have access to the same resource, they might not be using the same
  51. capability ID to access that resource since the capability tables are independent per VM.
  52. Resource Manager
  53. ================
  54. The resource manager (RM) is a privileged application VM supporting the Gunyah Hypervisor.
  55. It provides policy enforcement aspects of the virtualization system. The resource manager can
  56. be treated as an extension of the Hypervisor but is separated to its own partition to ensure
  57. that the hypervisor layer itself remains small and secure and to maintain a separation of policy
  58. and mechanism in the platform. RM runs at arm64 NS-EL1 similar to other virtual machines.
  59. Communication with the resource manager from each guest VM happens with message-queue.rst. Details
  60. about the specific messages can be found in drivers/virt/gunyah/rsc_mgr.c
  61. ::
  62. +-------+ +--------+ +--------+
  63. | RM | | VM_A | | VM_B |
  64. +-.-.-.-+ +---.----+ +---.----+
  65. | | | |
  66. +-.-.-----------.------------.----+
  67. | | \==========/ | |
  68. | \========================/ |
  69. | Gunyah |
  70. +---------------------------------+
  71. The source for the resource manager is available at https://github.com/quic/gunyah-resource-manager.
  72. The resource manager provides the following features:
  73. - VM lifecycle management: allocating a VM, starting VMs, destruction of VMs
  74. - VM access control policy, including memory sharing and lending
  75. - Interrupt routing configuration
  76. - Forwarding of system-level events (e.g. VM shutdown) to owner VM
  77. When booting a virtual machine which uses a devicetree such as Linux, resource manager overlays a
  78. /hypervisor node. This node can let Linux know it is running as a Gunyah guest VM,
  79. how to communicate with resource manager, and basic description and capabilities of
  80. this VM. See Documentation/devicetree/bindings/firmware/gunyah-hypervisor.yaml for a description
  81. of this node.