@@ -204,7 +204,7 @@ Errors:
204204
205205 ====== ============================================================
206206 EFAULT the msr index list cannot be read from or written to
207- E2BIG the msr index list is to be to fit in the array specified by
207+ E2BIG the msr index list is too big to fit in the array specified by
208208 the user.
209209 ====== ============================================================
210210
@@ -3692,31 +3692,105 @@ which is the maximum number of possibly pending cpu-local interrupts.
36923692
36933693Queues an SMI on the thread's vcpu.
36943694
3695- 4.97 KVM_CAP_PPC_MULTITCE
3696- -------------------------
3695+ 4.97 KVM_X86_SET_MSR_FILTER
3696+ ----------------------------
36973697
3698- :Capability: KVM_CAP_PPC_MULTITCE
3699- :Architectures: ppc
3700- :Type: vm
3698+ :Capability: KVM_X86_SET_MSR_FILTER
3699+ :Architectures: x86
3700+ :Type: vm ioctl
3701+ :Parameters: struct kvm_msr_filter
3702+ :Returns: 0 on success, < 0 on error
37013703
3702- This capability means the kernel is capable of handling hypercalls
3703- H_PUT_TCE_INDIRECT and H_STUFF_TCE without passing those into the user
3704- space. This significantly accelerates DMA operations for PPC KVM guests.
3705- User space should expect that its handlers for these hypercalls
3706- are not going to be called if user space previously registered LIOBN
3707- in KVM (via KVM_CREATE_SPAPR_TCE or similar calls).
3704+ ::
37083705
3709- In order to enable H_PUT_TCE_INDIRECT and H_STUFF_TCE use in the guest,
3710- user space might have to advertise it for the guest. For example,
3711- IBM pSeries (sPAPR) guest starts using them if "hcall-multi-tce" is
3712- present in the "ibm,hypertas-functions" device-tree property.
3706+ struct kvm_msr_filter_range {
3707+ #define KVM_MSR_FILTER_READ (1 << 0)
3708+ #define KVM_MSR_FILTER_WRITE (1 << 1)
3709+ __u32 flags;
3710+ __u32 nmsrs; /* number of msrs in bitmap */
3711+ __u32 base; /* MSR index the bitmap starts at */
3712+ __u8 *bitmap; /* a 1 bit allows the operations in flags, 0 denies */
3713+ };
37133714
3714- The hypercalls mentioned above may or may not be processed successfully
3715- in the kernel based fast path. If they can not be handled by the kernel,
3716- they will get passed on to user space. So user space still has to have
3717- an implementation for these despite the in kernel acceleration.
3715+ #define KVM_MSR_FILTER_MAX_RANGES 16
3716+ struct kvm_msr_filter {
3717+ #define KVM_MSR_FILTER_DEFAULT_ALLOW (0 << 0)
3718+ #define KVM_MSR_FILTER_DEFAULT_DENY (1 << 0)
3719+ __u32 flags;
3720+ struct kvm_msr_filter_range ranges[KVM_MSR_FILTER_MAX_RANGES];
3721+ };
37183722
3719- This capability is always enabled.
3723+ flags values for ``struct kvm_msr_filter_range ``:
3724+
3725+ ``KVM_MSR_FILTER_READ ``
3726+
3727+ Filter read accesses to MSRs using the given bitmap. A 0 in the bitmap
3728+ indicates that a read should immediately fail, while a 1 indicates that
3729+ a read for a particular MSR should be handled regardless of the default
3730+ filter action.
3731+
3732+ ``KVM_MSR_FILTER_WRITE ``
3733+
3734+ Filter write accesses to MSRs using the given bitmap. A 0 in the bitmap
3735+ indicates that a write should immediately fail, while a 1 indicates that
3736+ a write for a particular MSR should be handled regardless of the default
3737+ filter action.
3738+
3739+ ``KVM_MSR_FILTER_READ | KVM_MSR_FILTER_WRITE ``
3740+
3741+ Filter both read and write accesses to MSRs using the given bitmap. A 0
3742+ in the bitmap indicates that both reads and writes should immediately fail,
3743+ while a 1 indicates that reads and writes for a particular MSR are not
3744+ filtered by this range.
3745+
3746+ flags values for ``struct kvm_msr_filter ``:
3747+
3748+ ``KVM_MSR_FILTER_DEFAULT_ALLOW ``
3749+
3750+ If no filter range matches an MSR index that is getting accessed, KVM will
3751+ fall back to allowing access to the MSR.
3752+
3753+ ``KVM_MSR_FILTER_DEFAULT_DENY ``
3754+
3755+ If no filter range matches an MSR index that is getting accessed, KVM will
3756+ fall back to rejecting access to the MSR. In this mode, all MSRs that should
3757+ be processed by KVM need to explicitly be marked as allowed in the bitmaps.
3758+
3759+ This ioctl allows user space to define up to 16 bitmaps of MSR ranges to
3760+ specify whether a certain MSR access should be explicitly filtered for or not.
3761+
3762+ If this ioctl has never been invoked, MSR accesses are not guarded and the
3763+ default KVM in-kernel emulation behavior is fully preserved.
3764+
3765+ Calling this ioctl with an empty set of ranges (all nmsrs == 0) disables MSR
3766+ filtering. In that mode, ``KVM_MSR_FILTER_DEFAULT_DENY `` is invalid and causes
3767+ an error.
3768+
3769+ As soon as the filtering is in place, every MSR access is processed through
3770+ the filtering except for accesses to the x2APIC MSRs (from 0x800 to 0x8ff);
3771+ x2APIC MSRs are always allowed, independent of the ``default_allow `` setting,
3772+ and their behavior depends on the ``X2APIC_ENABLE `` bit of the APIC base
3773+ register.
3774+
3775+ If a bit is within one of the defined ranges, read and write accesses are
3776+ guarded by the bitmap's value for the MSR index if the kind of access
3777+ is included in the ``struct kvm_msr_filter_range `` flags. If no range
3778+ cover this particular access, the behavior is determined by the flags
3779+ field in the kvm_msr_filter struct: ``KVM_MSR_FILTER_DEFAULT_ALLOW ``
3780+ and ``KVM_MSR_FILTER_DEFAULT_DENY ``.
3781+
3782+ Each bitmap range specifies a range of MSRs to potentially allow access on.
3783+ The range goes from MSR index [base .. base+nmsrs]. The flags field
3784+ indicates whether reads, writes or both reads and writes are filtered
3785+ by setting a 1 bit in the bitmap for the corresponding MSR index.
3786+
3787+ If an MSR access is not permitted through the filtering, it generates a
3788+ #GP inside the guest. When combined with KVM_CAP_X86_USER_SPACE_MSR, that
3789+ allows user space to deflect and potentially handle various MSR accesses
3790+ into user space.
3791+
3792+ If a vCPU is in running state while this ioctl is invoked, the vCPU may
3793+ experience inconsistent filtering behavior on MSR accesses.
37203794
372137954.98 KVM_CREATE_SPAPR_TCE_64
37223796----------------------------
@@ -4712,107 +4786,7 @@ KVM_PV_VM_VERIFY
47124786 Verify the integrity of the unpacked image. Only if this succeeds,
47134787 KVM is allowed to start protected VCPUs.
47144788
4715- 4.126 KVM_X86_SET_MSR_FILTER
4716- ----------------------------
4717-
4718- :Capability: KVM_X86_SET_MSR_FILTER
4719- :Architectures: x86
4720- :Type: vm ioctl
4721- :Parameters: struct kvm_msr_filter
4722- :Returns: 0 on success, < 0 on error
4723-
4724- ::
4725-
4726- struct kvm_msr_filter_range {
4727- #define KVM_MSR_FILTER_READ (1 << 0)
4728- #define KVM_MSR_FILTER_WRITE (1 << 1)
4729- __u32 flags;
4730- __u32 nmsrs; /* number of msrs in bitmap */
4731- __u32 base; /* MSR index the bitmap starts at */
4732- __u8 *bitmap; /* a 1 bit allows the operations in flags, 0 denies */
4733- };
4734-
4735- #define KVM_MSR_FILTER_MAX_RANGES 16
4736- struct kvm_msr_filter {
4737- #define KVM_MSR_FILTER_DEFAULT_ALLOW (0 << 0)
4738- #define KVM_MSR_FILTER_DEFAULT_DENY (1 << 0)
4739- __u32 flags;
4740- struct kvm_msr_filter_range ranges[KVM_MSR_FILTER_MAX_RANGES];
4741- };
4742-
4743- flags values for ``struct kvm_msr_filter_range ``:
4744-
4745- ``KVM_MSR_FILTER_READ ``
4746-
4747- Filter read accesses to MSRs using the given bitmap. A 0 in the bitmap
4748- indicates that a read should immediately fail, while a 1 indicates that
4749- a read for a particular MSR should be handled regardless of the default
4750- filter action.
4751-
4752- ``KVM_MSR_FILTER_WRITE ``
4753-
4754- Filter write accesses to MSRs using the given bitmap. A 0 in the bitmap
4755- indicates that a write should immediately fail, while a 1 indicates that
4756- a write for a particular MSR should be handled regardless of the default
4757- filter action.
4758-
4759- ``KVM_MSR_FILTER_READ | KVM_MSR_FILTER_WRITE ``
4760-
4761- Filter both read and write accesses to MSRs using the given bitmap. A 0
4762- in the bitmap indicates that both reads and writes should immediately fail,
4763- while a 1 indicates that reads and writes for a particular MSR are not
4764- filtered by this range.
4765-
4766- flags values for ``struct kvm_msr_filter ``:
4767-
4768- ``KVM_MSR_FILTER_DEFAULT_ALLOW ``
4769-
4770- If no filter range matches an MSR index that is getting accessed, KVM will
4771- fall back to allowing access to the MSR.
4772-
4773- ``KVM_MSR_FILTER_DEFAULT_DENY ``
4774-
4775- If no filter range matches an MSR index that is getting accessed, KVM will
4776- fall back to rejecting access to the MSR. In this mode, all MSRs that should
4777- be processed by KVM need to explicitly be marked as allowed in the bitmaps.
4778-
4779- This ioctl allows user space to define up to 16 bitmaps of MSR ranges to
4780- specify whether a certain MSR access should be explicitly filtered for or not.
4781-
4782- If this ioctl has never been invoked, MSR accesses are not guarded and the
4783- default KVM in-kernel emulation behavior is fully preserved.
4784-
4785- Calling this ioctl with an empty set of ranges (all nmsrs == 0) disables MSR
4786- filtering. In that mode, ``KVM_MSR_FILTER_DEFAULT_DENY `` is invalid and causes
4787- an error.
4788-
4789- As soon as the filtering is in place, every MSR access is processed through
4790- the filtering except for accesses to the x2APIC MSRs (from 0x800 to 0x8ff);
4791- x2APIC MSRs are always allowed, independent of the ``default_allow `` setting,
4792- and their behavior depends on the ``X2APIC_ENABLE `` bit of the APIC base
4793- register.
4794-
4795- If a bit is within one of the defined ranges, read and write accesses are
4796- guarded by the bitmap's value for the MSR index if the kind of access
4797- is included in the ``struct kvm_msr_filter_range `` flags. If no range
4798- cover this particular access, the behavior is determined by the flags
4799- field in the kvm_msr_filter struct: ``KVM_MSR_FILTER_DEFAULT_ALLOW ``
4800- and ``KVM_MSR_FILTER_DEFAULT_DENY ``.
4801-
4802- Each bitmap range specifies a range of MSRs to potentially allow access on.
4803- The range goes from MSR index [base .. base+nmsrs]. The flags field
4804- indicates whether reads, writes or both reads and writes are filtered
4805- by setting a 1 bit in the bitmap for the corresponding MSR index.
4806-
4807- If an MSR access is not permitted through the filtering, it generates a
4808- #GP inside the guest. When combined with KVM_CAP_X86_USER_SPACE_MSR, that
4809- allows user space to deflect and potentially handle various MSR accesses
4810- into user space.
4811-
4812- If a vCPU is in running state while this ioctl is invoked, the vCPU may
4813- experience inconsistent filtering behavior on MSR accesses.
4814-
4815- 4.127 KVM_XEN_HVM_SET_ATTR
4789+ 4.126 KVM_XEN_HVM_SET_ATTR
48164790--------------------------
48174791
48184792:Capability: KVM_CAP_XEN_HVM / KVM_XEN_HVM_CONFIG_SHARED_INFO
@@ -4855,7 +4829,7 @@ KVM_XEN_ATTR_TYPE_SHARED_INFO
48554829KVM_XEN_ATTR_TYPE_UPCALL_VECTOR
48564830 Sets the exception vector used to deliver Xen event channel upcalls.
48574831
4858- 4.128 KVM_XEN_HVM_GET_ATTR
4832+ 4.127 KVM_XEN_HVM_GET_ATTR
48594833--------------------------
48604834
48614835:Capability: KVM_CAP_XEN_HVM / KVM_XEN_HVM_CONFIG_SHARED_INFO
@@ -4867,7 +4841,7 @@ KVM_XEN_ATTR_TYPE_UPCALL_VECTOR
48674841Allows Xen VM attributes to be read. For the structure and types,
48684842see KVM_XEN_HVM_SET_ATTR above.
48694843
4870- 4.129 KVM_XEN_VCPU_SET_ATTR
4844+ 4.128 KVM_XEN_VCPU_SET_ATTR
48714845---------------------------
48724846
48734847:Capability: KVM_CAP_XEN_HVM / KVM_XEN_HVM_CONFIG_SHARED_INFO
@@ -4929,7 +4903,7 @@ KVM_XEN_VCPU_ATTR_TYPE_RUNSTATE_ADJUST
49294903 or RUNSTATE_offline) to set the current accounted state as of the
49304904 adjusted state_entry_time.
49314905
4932- 4.130 KVM_XEN_VCPU_GET_ATTR
4906+ 4.129 KVM_XEN_VCPU_GET_ATTR
49334907---------------------------
49344908
49354909:Capability: KVM_CAP_XEN_HVM / KVM_XEN_HVM_CONFIG_SHARED_INFO
@@ -6727,3 +6701,29 @@ vcpu_info is set.
67276701The KVM_XEN_HVM_CONFIG_RUNSTATE flag indicates that the runstate-related
67286702features KVM_XEN_VCPU_ATTR_TYPE_RUNSTATE_ADDR/_CURRENT/_DATA/_ADJUST are
67296703supported by the KVM_XEN_VCPU_SET_ATTR/KVM_XEN_VCPU_GET_ATTR ioctls.
6704+
6705+ 8.31 KVM_CAP_PPC_MULTITCE
6706+ -------------------------
6707+
6708+ :Capability: KVM_CAP_PPC_MULTITCE
6709+ :Architectures: ppc
6710+ :Type: vm
6711+
6712+ This capability means the kernel is capable of handling hypercalls
6713+ H_PUT_TCE_INDIRECT and H_STUFF_TCE without passing those into the user
6714+ space. This significantly accelerates DMA operations for PPC KVM guests.
6715+ User space should expect that its handlers for these hypercalls
6716+ are not going to be called if user space previously registered LIOBN
6717+ in KVM (via KVM_CREATE_SPAPR_TCE or similar calls).
6718+
6719+ In order to enable H_PUT_TCE_INDIRECT and H_STUFF_TCE use in the guest,
6720+ user space might have to advertise it for the guest. For example,
6721+ IBM pSeries (sPAPR) guest starts using them if "hcall-multi-tce" is
6722+ present in the "ibm,hypertas-functions" device-tree property.
6723+
6724+ The hypercalls mentioned above may or may not be processed successfully
6725+ in the kernel based fast path. If they can not be handled by the kernel,
6726+ they will get passed on to user space. So user space still has to have
6727+ an implementation for these despite the in kernel acceleration.
6728+
6729+ This capability is always enabled.
0 commit comments