blob: 6cdcef20265e746682259446bc47b0547175b467 [file] [log] [blame]
Leonardo Garciaa23a72d2022-01-12 11:28:26 +01001======================
Leonardo Garciad483f2b2021-12-17 17:57:13 +01002sPAPR hypervisor calls
Leonardo Garciaa23a72d2022-01-12 11:28:26 +01003======================
Benjamin Herrenschmidtc73e3772012-06-18 20:21:37 +00004
Leonardo Garciad483f2b2021-12-17 17:57:13 +01005When used with the ``pseries`` machine type, ``qemu-system-ppc64`` implements
Leonardo Garciaa23a72d2022-01-12 11:28:26 +01006a set of hypervisor calls (a.k.a. hcalls) defined in the Linux on Power
7Architecture Reference ([LoPAR]_) document. This document is a subset of the
8Power Architecture Platform Reference (PAPR+) specification (IBM internal only),
9which is what PowerVM, the IBM proprietary hypervisor, adheres to.
Leonardo Garciad483f2b2021-12-17 17:57:13 +010010
11The subset in LoPAR is selected based on the requirements of Linux as a guest.
Benjamin Herrenschmidtc73e3772012-06-18 20:21:37 +000012
13In addition to those calls, we have added our own private hypervisor
14calls which are mostly used as a private interface between the firmware
15running in the guest and QEMU.
16
17All those hypercalls start at hcall number 0xf000 which correspond
Ville Skyttä9277d812018-06-12 09:51:50 +030018to an implementation specific range in PAPR.
Benjamin Herrenschmidtc73e3772012-06-18 20:21:37 +000019
Leonardo Garciaa23a72d2022-01-12 11:28:26 +010020``H_RTAS (0xf000)``
21===================
Benjamin Herrenschmidtc73e3772012-06-18 20:21:37 +000022
Leonardo Garciad483f2b2021-12-17 17:57:13 +010023RTAS stands for Run-Time Abstraction Sercies and is a set of runtime services
24generally provided by the firmware inside the guest to the operating system. It
25predates the existence of hypervisors (it was originally an extension to Open
26Firmware) and is still used by PAPR and LoPAR to provide various services that
27are not performance sensitive.
Benjamin Herrenschmidtc73e3772012-06-18 20:21:37 +000028
29We currently implement the RTAS services in QEMU itself. The actual RTAS
30"firmware" blob in the guest is a small stub of a few instructions which
31calls our private H_RTAS hypervisor call to pass the RTAS calls to QEMU.
32
33Arguments:
34
Leonardo Garciad483f2b2021-12-17 17:57:13 +010035 ``r3``: ``H_RTAS (0xf000)``
36
37 ``r4``: Guest physical address of RTAS parameter block.
Benjamin Herrenschmidtc73e3772012-06-18 20:21:37 +000038
39Returns:
40
Leonardo Garciad483f2b2021-12-17 17:57:13 +010041 ``H_SUCCESS``: Successfully called the RTAS function (RTAS result will have
42 been stored in the parameter block).
Benjamin Herrenschmidtc73e3772012-06-18 20:21:37 +000043
Leonardo Garciad483f2b2021-12-17 17:57:13 +010044 ``H_PARAMETER``: Unknown token.
Benjamin Herrenschmidtc73e3772012-06-18 20:21:37 +000045
Leonardo Garciaa23a72d2022-01-12 11:28:26 +010046``H_LOGICAL_MEMOP (0xf001)``
47============================
Benjamin Herrenschmidtc73e3772012-06-18 20:21:37 +000048
Leonardo Garciad483f2b2021-12-17 17:57:13 +010049When the guest runs in "real mode" (in powerpc terminology this means with MMU
50disabled, i.e. guest effective address equals to guest physical address), it
51only has access to a subset of memory and no I/Os.
52
53PAPR and LoPAR provides a set of hypervisor calls to perform cacheable or
Veres Lajos67cc32e2015-09-08 22:45:14 +010054non-cacheable accesses to any guest physical addresses that the
Benjamin Herrenschmidtc73e3772012-06-18 20:21:37 +000055guest can use in order to access IO devices while in real mode.
56
57This is typically used by the firmware running in the guest.
58
59However, doing a hypercall for each access is extremely inefficient
60(even more so when running KVM) when accessing the frame buffer. In
61that case, things like scrolling become unusably slow.
62
63This hypercall allows the guest to request a "memory op" to be applied
64to memory. The supported memory ops at this point are to copy a range
65of memory (supports overlap of source and destination) and XOR which
66is used by our SLOF firmware to invert the screen.
67
68Arguments:
69
Leonardo Garciad483f2b2021-12-17 17:57:13 +010070 ``r3 ``: ``H_LOGICAL_MEMOP (0xf001)``
71
72 ``r4``: Guest physical address of destination.
73
74 ``r5``: Guest physical address of source.
75
76 ``r6``: Individual element size, defined by the binary logarithm of the
77 desired size. Supported values are:
78
79 ``0`` = 1 byte
80
81 ``1`` = 2 bytes
82
83 ``2`` = 4 bytes
84
85 ``3`` = 8 bytes
86
87 ``r7``: Number of elements.
88
89 ``r8``: Operation. Supported values are:
90
91 ``0``: copy
92
93 ``1``: xor
Benjamin Herrenschmidtc73e3772012-06-18 20:21:37 +000094
95Returns:
96
Leonardo Garciad483f2b2021-12-17 17:57:13 +010097 ``H_SUCCESS``: Success.
Benjamin Herrenschmidtc73e3772012-06-18 20:21:37 +000098
Leonardo Garciad483f2b2021-12-17 17:57:13 +010099 ``H_PARAMETER``: Invalid argument.