<!DOCTYPE html>
<html lang="en" data-content_root="../../../">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Generic vm interface — The Linux Kernel documentation</title>
<link rel="stylesheet" type="text/css" href="../../../_static/pygments.css?v=fa44fd50" />
<link rel="stylesheet" type="text/css" href="../../../_static/alabaster.css?v=3918102e" />
<script src="../../../_static/documentation_options.js?v=5929fcd5"></script>
<script src="../../../_static/doctools.js?v=9bcbadda"></script>
<script src="../../../_static/sphinx_highlight.js?v=dc90522c"></script>
<link rel="index" title="Index" href="../../../genindex.html" />
<link rel="search" title="Search" href="../../../search.html" />
<link rel="next" title="XICS interrupt controller" href="xics.html" />
<link rel="prev" title="VFIO virtual device" href="vfio.html" />
<link rel="stylesheet" href="../../../_static/custom.css" type="text/css" />
</head><body>
<div class="document">
<div class="sphinxsidebar" role="navigation" aria-label="Main">
<div class="sphinxsidebarwrapper">
<p class="logo"><a href="../../../index.html">
<img class="logo" src="../../../_static/logo.svg" alt="Logo of The Linux Kernel"/>
</a></p>
<h1 class="logo"><a href="../../../index.html">The Linux Kernel</a></h1>
<p class="blurb">6.18.50</p>
<search id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="../../../search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"/>
<input type="submit" value="Go" />
</form>
</div>
</search>
<script>document.getElementById('searchbox').style.display = "block"</script>
<p>
<h3 class="kernel-toc-contents">Contents</h3>
<input type="checkbox" class="kernel-toc-toggle" id = "kernel-toc-toggle" checked>
<label class="kernel-toc-title" for="kernel-toc-toggle"></label>
<div class="kerneltoc" id="kerneltoc">
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../../process/development-process.html">Development process</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../process/submitting-patches.html">Submitting patches</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../process/code-of-conduct.html">Code of conduct</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../maintainer/index.html">Maintainer handbook</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../process/index.html">All development-process docs</a></li>
</ul>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../../core-api/index.html">Core API</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../driver-api/index.html">Driver APIs</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../../../subsystem-apis.html">Subsystems</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../../../subsystem-apis.html#core-subsystems">Core subsystems</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../subsystem-apis.html#human-interfaces">Human interfaces</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../subsystem-apis.html#networking-interfaces">Networking interfaces</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../../subsystem-apis.html#storage-interfaces">Storage interfaces</a></li>
<li class="toctree-l2 current"><a class="reference internal" href="../../../subsystem-apis.html#other-subsystems">Other subsystems</a><ul class="current">
<li class="toctree-l3"><a class="reference internal" href="../../../accounting/index.html">Accounting</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../cpu-freq/index.html">CPUFreq - CPU frequency and voltage scaling code in the Linux(TM) kernel</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../edac/index.html">EDAC Subsystem</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../fpga/index.html">FPGA</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../i2c/index.html">I2C/SMBus Subsystem</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../iio/index.html">Industrial I/O</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../pcmcia/index.html">PCMCIA</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../spi/index.html">Serial Peripheral Interface (SPI)</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../w1/index.html">1-Wire Subsystem</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../watchdog/index.html">Watchdog Support</a></li>
<li class="toctree-l3 current"><a class="reference internal" href="../../index.html">Virtualization Support</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../hwmon/index.html">Hardware Monitoring</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../accel/index.html">Compute Accelerators</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../security/index.html">Security Documentation</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../crypto/index.html">Crypto API</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../bpf/index.html">BPF Documentation</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../usb/index.html">USB support</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../PCI/index.html">PCI Bus Subsystem</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../misc-devices/index.html">Assorted Miscellaneous Devices Documentation</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../peci/index.html">PECI Subsystem</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../wmi/index.html">WMI Subsystem</a></li>
<li class="toctree-l3"><a class="reference internal" href="../../../tee/index.html">TEE Subsystem</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../../locking/index.html">Locking</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../../process/license-rules.html">Licensing rules</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../doc-guide/index.html">Writing documentation</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../dev-tools/index.html">Development tools</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../dev-tools/testing-overview.html">Testing guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../kernel-hacking/index.html">Hacking guide</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../trace/index.html">Tracing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../fault-injection/index.html">Fault injection</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../livepatch/index.html">Livepatching</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../rust/index.html">Rust</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../../admin-guide/index.html">Administration</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../kbuild/index.html">Build system</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../admin-guide/reporting-issues.html">Reporting issues</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../tools/index.html">Userspace tools</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../userspace-api/index.html">Userspace API</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../../firmware-guide/index.html">Firmware</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../../devicetree/index.html">Firmware and Devicetree</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../../arch/index.html">CPU architectures</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../../staging/index.html">Unsorted documentation</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="../../../translations/index.html">Translations</a></li>
</ul>
</div>
<script type="text/javascript"> <!--
var sbar = document.getElementsByClassName("sphinxsidebar")[0];
let currents = document.getElementsByClassName("current")
if (currents.length) {
sbar.scrollTop = currents[currents.length - 1].offsetTop;
}
--> </script>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="../../../_sources/virt/kvm/devices/vm.rst.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
</div>
</div>
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<section id="generic-vm-interface">
<h1>Generic vm interface<a class="headerlink" href="#generic-vm-interface" title="Link to this heading">¶</a></h1>
<p>The virtual machine “device” also accepts the ioctls KVM_SET_DEVICE_ATTR,
KVM_GET_DEVICE_ATTR, and KVM_HAS_DEVICE_ATTR. The interface uses the same
<code class="xref c c-struct broken_xref docutils literal notranslate"><span class="pre">struct</span> <span class="pre">kvm_device_attr</span></code> as other devices, but targets VM-wide settings
and controls.</p>
<p>The groups and attributes per virtual machine, if any, are architecture
specific.</p>
<section id="group-kvm-s390-vm-mem-ctrl">
<h2>1. GROUP: KVM_S390_VM_MEM_CTRL<a class="headerlink" href="#group-kvm-s390-vm-mem-ctrl" title="Link to this heading">¶</a></h2>
<dl class="field-list simple">
<dt class="field-odd">Architectures<span class="colon">:</span></dt>
<dd class="field-odd"><p>s390</p>
</dd>
</dl>
<section id="attribute-kvm-s390-vm-mem-enable-cmma">
<h3>1.1. ATTRIBUTE: KVM_S390_VM_MEM_ENABLE_CMMA<a class="headerlink" href="#attribute-kvm-s390-vm-mem-enable-cmma" title="Link to this heading">¶</a></h3>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p>none</p>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>-EBUSY if a vcpu is already defined, otherwise 0</p>
</dd>
</dl>
<p>Enables Collaborative Memory Management Assist (CMMA) for the virtual machine.</p>
</section>
<section id="attribute-kvm-s390-vm-mem-clr-cmma">
<h3>1.2. ATTRIBUTE: KVM_S390_VM_MEM_CLR_CMMA<a class="headerlink" href="#attribute-kvm-s390-vm-mem-clr-cmma" title="Link to this heading">¶</a></h3>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p>none</p>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>-EINVAL if CMMA was not enabled;
0 otherwise</p>
</dd>
</dl>
<p>Clear the CMMA status for all guest pages, so any pages the guest marked
as unused are again used any may not be reclaimed by the host.</p>
</section>
<section id="attribute-kvm-s390-vm-mem-limit-size">
<h3>1.3. ATTRIBUTE KVM_S390_VM_MEM_LIMIT_SIZE<a class="headerlink" href="#attribute-kvm-s390-vm-mem-limit-size" title="Link to this heading">¶</a></h3>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p>in attr->addr the address for the new limit of guest memory</p>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>-EFAULT if the given address is not accessible;
-EINVAL if the virtual machine is of type UCONTROL;
-E2BIG if the given guest memory is to big for that machine;
-EBUSY if a vcpu is already defined;
-ENOMEM if not enough memory is available for a new shadow guest mapping;
0 otherwise.</p>
</dd>
</dl>
<p>Allows userspace to query the actual limit and set a new limit for
the maximum guest memory size. The limit will be rounded up to
2048 MB, 4096 GB, 8192 TB respectively, as this limit is governed by
the number of page table levels. In the case that there is no limit we will set
the limit to KVM_S390_NO_MEM_LIMIT (U64_MAX).</p>
</section>
</section>
<section id="group-kvm-s390-vm-cpu-model">
<h2>2. GROUP: KVM_S390_VM_CPU_MODEL<a class="headerlink" href="#group-kvm-s390-vm-cpu-model" title="Link to this heading">¶</a></h2>
<dl class="field-list simple">
<dt class="field-odd">Architectures<span class="colon">:</span></dt>
<dd class="field-odd"><p>s390</p>
</dd>
</dl>
<section id="attribute-kvm-s390-vm-cpu-machine-r-o">
<h3>2.1. ATTRIBUTE: KVM_S390_VM_CPU_MACHINE (r/o)<a class="headerlink" href="#attribute-kvm-s390-vm-cpu-machine-r-o" title="Link to this heading">¶</a></h3>
<p>Allows user space to retrieve machine and kvm specific cpu related information:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>struct kvm_s390_vm_cpu_machine {
__u64 cpuid; # CPUID of host
__u32 ibc; # IBC level range offered by host
__u8 pad[4];
__u64 fac_mask[256]; # set of cpu facilities enabled by KVM
__u64 fac_list[256]; # set of cpu facilities offered by host
}
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p>address of buffer to store the machine related cpu data
of type <code class="xref c c-struct broken_xref docutils literal notranslate"><span class="pre">struct</span> <span class="pre">kvm_s390_vm_cpu_machine</span></code>*</p>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>-EFAULT if the given address is not accessible from kernel space;
-ENOMEM if not enough memory is available to process the ioctl;
0 in case of success.</p>
</dd>
</dl>
</section>
</section>
<section id="attribute-kvm-s390-vm-cpu-processor-r-w">
<h2>2.2. ATTRIBUTE: KVM_S390_VM_CPU_PROCESSOR (r/w)<a class="headerlink" href="#attribute-kvm-s390-vm-cpu-processor-r-w" title="Link to this heading">¶</a></h2>
<p>Allows user space to retrieve or request to change cpu related information for a vcpu:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>struct kvm_s390_vm_cpu_processor {
__u64 cpuid; # CPUID currently (to be) used by this vcpu
__u16 ibc; # IBC level currently (to be) used by this vcpu
__u8 pad[6];
__u64 fac_list[256]; # set of cpu facilities currently (to be) used
# by this vcpu
}
</pre></div>
</div>
<p>KVM does not enforce or limit the cpu model data in any form. Take the information
retrieved by means of KVM_S390_VM_CPU_MACHINE as hint for reasonable configuration
setups. Instruction interceptions triggered by additionally set facility bits that
are not handled by KVM need to by implemented in the VM driver code.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p>address of buffer to store/set the processor related cpu
data of type <code class="xref c c-struct broken_xref docutils literal notranslate"><span class="pre">struct</span> <span class="pre">kvm_s390_vm_cpu_processor</span></code>*.</p>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>-EBUSY in case 1 or more vcpus are already activated (only in write case);
-EFAULT if the given address is not accessible from kernel space;
-ENOMEM if not enough memory is available to process the ioctl;
0 in case of success.</p>
</dd>
</dl>
<section id="attribute-kvm-s390-vm-cpu-machine-feat-r-o">
<span id="kvm-s390-vm-cpu-machine-feat"></span><h3>2.3. ATTRIBUTE: KVM_S390_VM_CPU_MACHINE_FEAT (r/o)<a class="headerlink" href="#attribute-kvm-s390-vm-cpu-machine-feat-r-o" title="Link to this heading">¶</a></h3>
<p>Allows user space to retrieve available cpu features. A feature is available if
provided by the hardware and supported by kvm. In theory, cpu features could
even be completely emulated by kvm.</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>struct kvm_s390_vm_cpu_feat {
__u64 feat[16]; # Bitmap (1 = feature available), MSB 0 bit numbering
};
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p>address of a buffer to load the feature list from.</p>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>-EFAULT if the given address is not accessible from kernel space;
0 in case of success.</p>
</dd>
</dl>
</section>
<section id="attribute-kvm-s390-vm-cpu-processor-feat-r-w">
<h3>2.4. ATTRIBUTE: KVM_S390_VM_CPU_PROCESSOR_FEAT (r/w)<a class="headerlink" href="#attribute-kvm-s390-vm-cpu-processor-feat-r-w" title="Link to this heading">¶</a></h3>
<p>Allows user space to retrieve or change enabled cpu features for all VCPUs of a
VM. Features that are not available cannot be enabled.</p>
<p>See <a class="reference internal" href="#kvm-s390-vm-cpu-machine-feat"><span class="std std-ref">2.3. ATTRIBUTE: KVM_S390_VM_CPU_MACHINE_FEAT (r/o)</span></a> for
a description of the parameter struct.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p>address of a buffer to store/load the feature list from.</p>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>-EFAULT if the given address is not accessible from kernel space;
-EINVAL if a cpu feature that is not available is to be enabled;
-EBUSY if at least one VCPU has already been defined;
0 in case of success.</p>
</dd>
</dl>
</section>
<section id="attribute-kvm-s390-vm-cpu-machine-subfunc-r-o">
<span id="kvm-s390-vm-cpu-machine-subfunc"></span><h3>2.5. ATTRIBUTE: KVM_S390_VM_CPU_MACHINE_SUBFUNC (r/o)<a class="headerlink" href="#attribute-kvm-s390-vm-cpu-machine-subfunc-r-o" title="Link to this heading">¶</a></h3>
<p>Allows user space to retrieve available cpu subfunctions without any filtering
done by a set IBC. These subfunctions are indicated to the guest VCPU via
query or “test bit” subfunctions and used e.g. by cpacf functions, plo and ptff.</p>
<p>A subfunction block is only valid if KVM_S390_VM_CPU_MACHINE contains the
STFL(E) bit introducing the affected instruction. If the affected instruction
indicates subfunctions via a “query subfunction”, the response block is
contained in the returned struct. If the affected instruction
indicates subfunctions via a “test bit” mechanism, the subfunction codes are
contained in the returned <code class="xref c c-struct broken_xref docutils literal notranslate"><span class="pre">struct</span> <span class="pre">in</span></code> MSB 0 bit numbering.</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>struct kvm_s390_vm_cpu_subfunc {
u8 plo[32]; # always valid (ESA/390 feature)
u8 ptff[16]; # valid with TOD-clock steering
u8 kmac[16]; # valid with Message-Security-Assist
u8 kmc[16]; # valid with Message-Security-Assist
u8 km[16]; # valid with Message-Security-Assist
u8 kimd[16]; # valid with Message-Security-Assist
u8 klmd[16]; # valid with Message-Security-Assist
u8 pckmo[16]; # valid with Message-Security-Assist-Extension 3
u8 kmctr[16]; # valid with Message-Security-Assist-Extension 4
u8 kmf[16]; # valid with Message-Security-Assist-Extension 4
u8 kmo[16]; # valid with Message-Security-Assist-Extension 4
u8 pcc[16]; # valid with Message-Security-Assist-Extension 4
u8 ppno[16]; # valid with Message-Security-Assist-Extension 5
u8 kma[16]; # valid with Message-Security-Assist-Extension 8
u8 kdsa[16]; # valid with Message-Security-Assist-Extension 9
u8 reserved[1792]; # reserved for future instructions
};
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p>address of a buffer to load the subfunction blocks from.</p>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>-EFAULT if the given address is not accessible from kernel space;
0 in case of success.</p>
</dd>
</dl>
</section>
<section id="attribute-kvm-s390-vm-cpu-processor-subfunc-r-w">
<h3>2.6. ATTRIBUTE: KVM_S390_VM_CPU_PROCESSOR_SUBFUNC (r/w)<a class="headerlink" href="#attribute-kvm-s390-vm-cpu-processor-subfunc-r-w" title="Link to this heading">¶</a></h3>
<p>Allows user space to retrieve or change cpu subfunctions to be indicated for
all VCPUs of a VM. This attribute will only be available if kernel and
hardware support are in place.</p>
<p>The kernel uses the configured subfunction blocks for indication to
the guest. A subfunction block will only be used if the associated STFL(E) bit
has not been disabled by user space (so the instruction to be queried is
actually available for the guest).</p>
<p>As long as no data has been written, a read will fail. The IBC will be used
to determine available subfunctions in this case, this will guarantee backward
compatibility.</p>
<p>See <a class="reference internal" href="#kvm-s390-vm-cpu-machine-subfunc"><span class="std std-ref">2.5. ATTRIBUTE: KVM_S390_VM_CPU_MACHINE_SUBFUNC (r/o)</span></a> for a
description of the parameter struct.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p>address of a buffer to store/load the subfunction blocks from.</p>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>-EFAULT if the given address is not accessible from kernel space;
-EINVAL when reading, if there was no write yet;
-EBUSY if at least one VCPU has already been defined;
0 in case of success.</p>
</dd>
</dl>
</section>
</section>
<section id="group-kvm-s390-vm-tod">
<h2>3. GROUP: KVM_S390_VM_TOD<a class="headerlink" href="#group-kvm-s390-vm-tod" title="Link to this heading">¶</a></h2>
<dl class="field-list simple">
<dt class="field-odd">Architectures<span class="colon">:</span></dt>
<dd class="field-odd"><p>s390</p>
</dd>
</dl>
<section id="attribute-kvm-s390-vm-tod-high">
<h3>3.1. ATTRIBUTE: KVM_S390_VM_TOD_HIGH<a class="headerlink" href="#attribute-kvm-s390-vm-tod-high" title="Link to this heading">¶</a></h3>
<p>Allows user space to set/get the TOD clock extension (u8) (superseded by
KVM_S390_VM_TOD_EXT).</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p>address of a buffer in user space to store the data (u8) to</p>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>-EFAULT if the given address is not accessible from kernel space;
-EINVAL if setting the TOD clock extension to != 0 is not supported
-EOPNOTSUPP for a PV guest (TOD managed by the ultravisor)</p>
</dd>
</dl>
</section>
<section id="attribute-kvm-s390-vm-tod-low">
<h3>3.2. ATTRIBUTE: KVM_S390_VM_TOD_LOW<a class="headerlink" href="#attribute-kvm-s390-vm-tod-low" title="Link to this heading">¶</a></h3>
<p>Allows user space to set/get bits 0-63 of the TOD clock register as defined in
the POP (u64).</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p>address of a buffer in user space to store the data (u64) to</p>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>-EFAULT if the given address is not accessible from kernel space
-EOPNOTSUPP for a PV guest (TOD managed by the ultravisor)</p>
</dd>
</dl>
</section>
<section id="attribute-kvm-s390-vm-tod-ext">
<h3>3.3. ATTRIBUTE: KVM_S390_VM_TOD_EXT<a class="headerlink" href="#attribute-kvm-s390-vm-tod-ext" title="Link to this heading">¶</a></h3>
<p>Allows user space to set/get bits 0-63 of the TOD clock register as defined in
the POP (u64). If the guest CPU model supports the TOD clock extension (u8), it
also allows user space to get/set it. If the guest CPU model does not support
it, it is stored as 0 and not allowed to be set to a value != 0.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p>address of a buffer in user space to store the data
(kvm_s390_vm_tod_clock) to</p>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>-EFAULT if the given address is not accessible from kernel space;
-EINVAL if setting the TOD clock extension to != 0 is not supported
-EOPNOTSUPP for a PV guest (TOD managed by the ultravisor)</p>
</dd>
</dl>
</section>
</section>
<section id="group-kvm-s390-vm-crypto">
<h2>4. GROUP: KVM_S390_VM_CRYPTO<a class="headerlink" href="#group-kvm-s390-vm-crypto" title="Link to this heading">¶</a></h2>
<dl class="field-list simple">
<dt class="field-odd">Architectures<span class="colon">:</span></dt>
<dd class="field-odd"><p>s390</p>
</dd>
</dl>
<section id="attribute-kvm-s390-vm-crypto-enable-aes-kw-w-o">
<h3>4.1. ATTRIBUTE: KVM_S390_VM_CRYPTO_ENABLE_AES_KW (w/o)<a class="headerlink" href="#attribute-kvm-s390-vm-crypto-enable-aes-kw-w-o" title="Link to this heading">¶</a></h3>
<p>Allows user space to enable aes key wrapping, including generating a new
wrapping key.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p>none</p>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>0</p>
</dd>
</dl>
</section>
<section id="attribute-kvm-s390-vm-crypto-enable-dea-kw-w-o">
<h3>4.2. ATTRIBUTE: KVM_S390_VM_CRYPTO_ENABLE_DEA_KW (w/o)<a class="headerlink" href="#attribute-kvm-s390-vm-crypto-enable-dea-kw-w-o" title="Link to this heading">¶</a></h3>
<p>Allows user space to enable dea key wrapping, including generating a new
wrapping key.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p>none</p>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>0</p>
</dd>
</dl>
</section>
<section id="attribute-kvm-s390-vm-crypto-disable-aes-kw-w-o">
<h3>4.3. ATTRIBUTE: KVM_S390_VM_CRYPTO_DISABLE_AES_KW (w/o)<a class="headerlink" href="#attribute-kvm-s390-vm-crypto-disable-aes-kw-w-o" title="Link to this heading">¶</a></h3>
<p>Allows user space to disable aes key wrapping, clearing the wrapping key.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p>none</p>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>0</p>
</dd>
</dl>
</section>
<section id="attribute-kvm-s390-vm-crypto-disable-dea-kw-w-o">
<h3>4.4. ATTRIBUTE: KVM_S390_VM_CRYPTO_DISABLE_DEA_KW (w/o)<a class="headerlink" href="#attribute-kvm-s390-vm-crypto-disable-dea-kw-w-o" title="Link to this heading">¶</a></h3>
<p>Allows user space to disable dea key wrapping, clearing the wrapping key.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p>none</p>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>0</p>
</dd>
</dl>
</section>
</section>
<section id="group-kvm-s390-vm-migration">
<h2>5. GROUP: KVM_S390_VM_MIGRATION<a class="headerlink" href="#group-kvm-s390-vm-migration" title="Link to this heading">¶</a></h2>
<dl class="field-list simple">
<dt class="field-odd">Architectures<span class="colon">:</span></dt>
<dd class="field-odd"><p>s390</p>
</dd>
</dl>
<section id="attribute-kvm-s390-vm-migration-stop-w-o">
<h3>5.1. ATTRIBUTE: KVM_S390_VM_MIGRATION_STOP (w/o)<a class="headerlink" href="#attribute-kvm-s390-vm-migration-stop-w-o" title="Link to this heading">¶</a></h3>
<p>Allows userspace to stop migration mode, needed for PGSTE migration.
Setting this attribute when migration mode is not active will have no
effects.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p>none</p>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>0</p>
</dd>
</dl>
</section>
<section id="attribute-kvm-s390-vm-migration-start-w-o">
<h3>5.2. ATTRIBUTE: KVM_S390_VM_MIGRATION_START (w/o)<a class="headerlink" href="#attribute-kvm-s390-vm-migration-start-w-o" title="Link to this heading">¶</a></h3>
<p>Allows userspace to start migration mode, needed for PGSTE migration.
Setting this attribute when migration mode is already active will have
no effects.</p>
<p>Dirty tracking must be enabled on all memslots, else -EINVAL is returned. When
dirty tracking is disabled on any memslot, migration mode is automatically
stopped.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p>none</p>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>-ENOMEM if there is not enough free memory to start migration mode;
-EINVAL if the state of the VM is invalid (e.g. no memory defined);
0 in case of success.</p>
</dd>
</dl>
</section>
<section id="attribute-kvm-s390-vm-migration-status-r-o">
<h3>5.3. ATTRIBUTE: KVM_S390_VM_MIGRATION_STATUS (r/o)<a class="headerlink" href="#attribute-kvm-s390-vm-migration-status-r-o" title="Link to this heading">¶</a></h3>
<p>Allows userspace to query the status of migration mode.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p>address of a buffer in user space to store the data (u64) to;
the data itself is either 0 if migration mode is disabled or 1
if it is enabled</p>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><p>-EFAULT if the given address is not accessible from kernel space;
0 in case of success.</p>
</dd>
</dl>
</section>
</section>
<section id="group-kvm-arm-vm-smccc-ctrl">
<h2>6. GROUP: KVM_ARM_VM_SMCCC_CTRL<a class="headerlink" href="#group-kvm-arm-vm-smccc-ctrl" title="Link to this heading">¶</a></h2>
<dl class="field-list simple">
<dt class="field-odd">Architectures<span class="colon">:</span></dt>
<dd class="field-odd"><p>arm64</p>
</dd>
</dl>
<section id="attribute-kvm-arm-vm-smccc-filter-w-o">
<h3>6.1. ATTRIBUTE: KVM_ARM_VM_SMCCC_FILTER (w/o)<a class="headerlink" href="#attribute-kvm-arm-vm-smccc-filter-w-o" title="Link to this heading">¶</a></h3>
<dl class="field-list">
<dt class="field-odd">Parameters<span class="colon">:</span></dt>
<dd class="field-odd"><p>Pointer to a <code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">kvm_smccc_filter</span></code></p>
</dd>
<dt class="field-even">Returns<span class="colon">:</span></dt>
<dd class="field-even"><table class="docutils align-default">
<tbody>
<tr class="row-odd"><td><p>EEXIST</p></td>
<td><p>Range intersects with a previously inserted
or reserved range</p></td>
</tr>
<tr class="row-even"><td><p>EBUSY</p></td>
<td><p>A vCPU in the VM has already run</p></td>
</tr>
<tr class="row-odd"><td><p>EINVAL</p></td>
<td><p>Invalid filter configuration</p></td>
</tr>
<tr class="row-even"><td><p>ENOMEM</p></td>
<td><p>Failed to allocate memory for the in-kernel
representation of the SMCCC filter</p></td>
</tr>
</tbody>
</table>
</dd>
</dl>
<p>Requests the installation of an SMCCC call filter described as follows:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>enum kvm_smccc_filter_action {
KVM_SMCCC_FILTER_HANDLE = 0,
KVM_SMCCC_FILTER_DENY,
KVM_SMCCC_FILTER_FWD_TO_USER,
};
struct kvm_smccc_filter {
__u32 base;
__u32 nr_functions;
__u8 action;
__u8 pad[15];
};
</pre></div>
</div>
<p>The filter is defined as a set of non-overlapping ranges. Each
range defines an action to be applied to SMCCC calls within the range.
Userspace can insert multiple ranges into the filter by using
successive calls to this attribute.</p>
<p>The default configuration of KVM is such that all implemented SMCCC
calls are allowed. Thus, the SMCCC filter can be defined sparsely
by userspace, only describing ranges that modify the default behavior.</p>
<p>The range expressed by <code class="docutils literal notranslate"><span class="pre">struct</span> <span class="pre">kvm_smccc_filter</span></code> is
[<code class="docutils literal notranslate"><span class="pre">base</span></code>, <code class="docutils literal notranslate"><span class="pre">base</span> <span class="pre">+</span> <span class="pre">nr_functions</span></code>). The range is not allowed to wrap,
i.e. userspace cannot rely on <code class="docutils literal notranslate"><span class="pre">base</span> <span class="pre">+</span> <span class="pre">nr_functions</span></code> overflowing.</p>
<p>The SMCCC filter applies to both SMC and HVC calls initiated by the
guest. The SMCCC filter gates the in-kernel emulation of SMCCC calls
and as such takes effect before other interfaces that interact with
SMCCC calls (e.g. hypercall bitmap registers).</p>
<p>Actions:</p>
<blockquote>
<div><ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">KVM_SMCCC_FILTER_HANDLE</span></code>: Allows the guest SMCCC call to be
handled in-kernel. It is strongly recommended that userspace <em>not</em>
explicitly describe the allowed SMCCC call ranges.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">KVM_SMCCC_FILTER_DENY</span></code>: Rejects the guest SMCCC call in-kernel
and returns to the guest.</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">KVM_SMCCC_FILTER_FWD_TO_USER</span></code>: The guest SMCCC call is forwarded
to userspace with an exit reason of <code class="docutils literal notranslate"><span class="pre">KVM_EXIT_HYPERCALL</span></code>.</p></li>
</ul>
</div></blockquote>
<p>The <code class="docutils literal notranslate"><span class="pre">pad</span></code> field is reserved for future use and must be zero. KVM may
return <code class="docutils literal notranslate"><span class="pre">-EINVAL</span></code> if the field is nonzero.</p>
<p>KVM reserves the ‘Arm Architecture Calls’ range of function IDs and
will reject attempts to define a filter for any portion of these ranges:</p>
<blockquote>
<div><table class="docutils align-default">
<thead>
<tr class="row-odd"><th class="head"><p>Start</p></th>
<th class="head"><p>End (inclusive)</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p>0x8000_0000</p></td>
<td><p>0x8000_FFFF</p></td>
</tr>
<tr class="row-odd"><td><p>0xC000_0000</p></td>
<td><p>0xC000_FFFF</p></td>
</tr>
</tbody>
</table>
</div></blockquote>
</section>
</section>
</section>
</div>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer">
©The kernel development community.
|
Powered by <a href="https://www.sphinx-doc.org/">Sphinx 8.1.3</a>
& <a href="https://alabaster.readthedocs.io">Alabaster 0.7.16</a>
|
<a href="../../../_sources/virt/kvm/devices/vm.rst.txt"
rel="nofollow">Page source</a>
</div>
</body>
</html>