ppc-spapr-uv-hcalls.rst 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. ===================================
  2. Hypervisor calls and the Ultravisor
  3. ===================================
  4. On PPC64 systems supporting Protected Execution Facility (PEF), system memory
  5. can be placed in a secured region where only an ultravisor running in firmware
  6. can provide access to. pSeries guests on such systems can communicate with
  7. the ultravisor (via ultracalls) to switch to a secure virtual machine (SVM) mode
  8. where the guest's memory is relocated to this secured region, making its memory
  9. inaccessible to normal processes/guests running on the host.
  10. The various ultracalls/hypercalls relating to SVM mode are currently only
  11. documented internally, but are planned for direct inclusion into the Linux on
  12. Power Architecture Reference document ([LoPAR]_). An internal ACR has been filed
  13. to reserve a hypercall number range specific to this use case to avoid any
  14. future conflicts with the IBM internally maintained Power Architecture Platform
  15. Reference (PAPR+) documentation specification. This document summarizes some of
  16. these details as they relate to QEMU.
  17. Hypercalls needed by the ultravisor
  18. ===================================
  19. Switching to SVM mode involves a number of hcalls issued by the ultravisor to
  20. the hypervisor to orchestrate the movement of guest memory to secure memory and
  21. various other aspects of the SVM mode. Numbers are assigned for these hcalls
  22. within the reserved range ``0xEF00-0xEF80``. The below documents the hcalls
  23. relevant to QEMU.
  24. ``H_TPM_COMM`` (``0xef10``)
  25. ---------------------------
  26. SVM file systems are encrypted using a symmetric key. This key is then
  27. wrapped/encrypted using the public key of a trusted system which has the private
  28. key stored in the system's TPM. An Ultravisor will use this hcall to
  29. unwrap/unseal the symmetric key using the system's TPM device or a TPM Resource
  30. Manager associated with the device.
  31. The Ultravisor sets up a separate session key with the TPM in advance during
  32. host system boot. All sensitive in and out values will be encrypted using the
  33. session key. Though the hypervisor will see the in and out buffers in raw form,
  34. any sensitive contents will generally be encrypted using this session key.
  35. Arguments:
  36. ``r3``: ``H_TPM_COMM`` (``0xef10``)
  37. ``r4``: ``TPM`` operation, one of:
  38. ``TPM_COMM_OP_EXECUTE`` (``0x1``): send a request to a TPM and receive a
  39. response, opening a new TPM session if one has not already been opened.
  40. ``TPM_COMM_OP_CLOSE_SESSION`` (``0x2``): close the existing TPM session, if
  41. any.
  42. ``r5``: ``in_buffer``, guest physical address of buffer containing the
  43. request. Caller may use the same address for both request and response.
  44. ``r6``: ``in_size``, size of the in buffer. Must be less than or equal to
  45. 4 KB.
  46. ``r7``: ``out_buffer``, guest physical address of buffer to store the
  47. response. Caller may use the same address for both request and response.
  48. ``r8``: ``out_size``, size of the out buffer. Must be at least 4 KB, as this
  49. is the maximum request/response size supported by most TPM implementations,
  50. including the TPM Resource Manager in the linux kernel.
  51. Return values:
  52. ``r3``: one of the following values:
  53. ``H_Success``: request processed successfully.
  54. ``H_PARAMETER``: invalid TPM operation.
  55. ``H_P2``: ``in_buffer`` is invalid.
  56. ``H_P3``: ``in_size`` is invalid.
  57. ``H_P4``: ``out_buffer`` is invalid.
  58. ``H_P5``: ``out_size`` is invalid.
  59. ``H_RESOURCE``: problem communicating with TPM.
  60. ``H_FUNCTION``: TPM access is not currently allowed/configured.
  61. ``r4``: For ``TPM_COMM_OP_EXECUTE``, the size of the response will be stored
  62. here upon success.