xref: /OK3568_Linux_fs/kernel/Documentation/virt/paravirt_ops.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun.. SPDX-License-Identifier: GPL-2.0
2*4882a593Smuzhiyun
3*4882a593Smuzhiyun============
4*4882a593SmuzhiyunParavirt_ops
5*4882a593Smuzhiyun============
6*4882a593Smuzhiyun
7*4882a593SmuzhiyunLinux provides support for different hypervisor virtualization technologies.
8*4882a593SmuzhiyunHistorically different binary kernels would be required in order to support
9*4882a593Smuzhiyundifferent hypervisors, this restriction was removed with pv_ops.
10*4882a593SmuzhiyunLinux pv_ops is a virtualization API which enables support for different
11*4882a593Smuzhiyunhypervisors. It allows each hypervisor to override critical operations and
12*4882a593Smuzhiyunallows a single kernel binary to run on all supported execution environments
13*4882a593Smuzhiyunincluding native machine -- without any hypervisors.
14*4882a593Smuzhiyun
15*4882a593Smuzhiyunpv_ops provides a set of function pointers which represent operations
16*4882a593Smuzhiyuncorresponding to low level critical instructions and high level
17*4882a593Smuzhiyunfunctionalities in various areas. pv-ops allows for optimizations at run
18*4882a593Smuzhiyuntime by enabling binary patching of the low-ops critical operations
19*4882a593Smuzhiyunat boot time.
20*4882a593Smuzhiyun
21*4882a593Smuzhiyunpv_ops operations are classified into three categories:
22*4882a593Smuzhiyun
23*4882a593Smuzhiyun- simple indirect call
24*4882a593Smuzhiyun   These operations correspond to high level functionality where it is
25*4882a593Smuzhiyun   known that the overhead of indirect call isn't very important.
26*4882a593Smuzhiyun
27*4882a593Smuzhiyun- indirect call which allows optimization with binary patch
28*4882a593Smuzhiyun   Usually these operations correspond to low level critical instructions. They
29*4882a593Smuzhiyun   are called frequently and are performance critical. The overhead is
30*4882a593Smuzhiyun   very important.
31*4882a593Smuzhiyun
32*4882a593Smuzhiyun- a set of macros for hand written assembly code
33*4882a593Smuzhiyun   Hand written assembly codes (.S files) also need paravirtualization
34*4882a593Smuzhiyun   because they include sensitive instructions or some of code paths in
35*4882a593Smuzhiyun   them are very performance critical.
36