Merge tag 'kvm-x86-generic-6.4' of https://github.com/kvm-x86/linux into HEAD
authorPaolo Bonzini <pbonzini@redhat.com>
Wed, 26 Apr 2023 19:48:44 +0000 (15:48 -0400)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 26 Apr 2023 19:48:44 +0000 (15:48 -0400)
Common KVM changes for 6.4:

 - Drop unnecessary casts from "void *" throughout kvm_main.c

 - Tweak the layout of "struct kvm_mmu_memory_cache" to shrink the struct
   size by 8 bytes on 64-bit kernels by utilizing a padding hole

 - Fix a documentation format goof that was introduced when the KVM docs
   were converted to ReST

 - Constify MIPS's internal callbacks (a leftover from the hardware enabling
   rework that landed in 6.3)

1  2 
Documentation/virt/kvm/api.rst

index e54fdfaa75e2b7048eda3b746bb60ef3958c0d4b,a69e91088d769fb4ed10ce7a81a76792235bdac9..e0c63de8e8374d5645efdd3af61bdcdea7964926
@@@ -6030,44 -6030,6 +6030,44 @@@ delivery must be provided via the "reg_
  The "pad" and "reserved" fields may be used for future extensions and should be
  set to 0s by userspace.
  
 +4.138 KVM_ARM_SET_COUNTER_OFFSET
 +--------------------------------
 +
 +:Capability: KVM_CAP_COUNTER_OFFSET
 +:Architectures: arm64
 +:Type: vm ioctl
 +:Parameters: struct kvm_arm_counter_offset (in)
 +:Returns: 0 on success, < 0 on error
 +
 +This capability indicates that userspace is able to apply a single VM-wide
 +offset to both the virtual and physical counters as viewed by the guest
 +using the KVM_ARM_SET_CNT_OFFSET ioctl and the following data structure:
 +
 +::
 +
 +      struct kvm_arm_counter_offset {
 +              __u64 counter_offset;
 +              __u64 reserved;
 +      };
 +
 +The offset describes a number of counter cycles that are subtracted from
 +both virtual and physical counter views (similar to the effects of the
 +CNTVOFF_EL2 and CNTPOFF_EL2 system registers, but only global). The offset
 +always applies to all vcpus (already created or created after this ioctl)
 +for this VM.
 +
 +It is userspace's responsibility to compute the offset based, for example,
 +on previous values of the guest counters.
 +
 +Any value other than 0 for the "reserved" field may result in an error
 +(-EINVAL) being returned. This ioctl can also return -EBUSY if any vcpu
 +ioctl is issued concurrently.
 +
 +Note that using this ioctl results in KVM ignoring subsequent userspace
 +writes to the CNTVCT_EL0 and CNTPCT_EL0 registers using the SET_ONE_REG
 +interface. No error will be returned, but the resulting offset will not be
 +applied.
 +
  5. The kvm_run structure
  ========================
  
@@@ -6257,40 -6219,15 +6257,40 @@@ to the byte array
                        __u64 nr;
                        __u64 args[6];
                        __u64 ret;
 -                      __u32 longmode;
 -                      __u32 pad;
 +                      __u64 flags;
                } hypercall;
  
 -Unused.  This was once used for 'hypercall to userspace'.  To implement
 -such functionality, use KVM_EXIT_IO (x86) or KVM_EXIT_MMIO (all except s390).
 +
 +It is strongly recommended that userspace use ``KVM_EXIT_IO`` (x86) or
 +``KVM_EXIT_MMIO`` (all except s390) to implement functionality that
 +requires a guest to interact with host userpace.
  
  .. note:: KVM_EXIT_IO is significantly faster than KVM_EXIT_MMIO.
  
 +For arm64:
 +----------
 +
 +SMCCC exits can be enabled depending on the configuration of the SMCCC
 +filter. See the Documentation/virt/kvm/devices/vm.rst
 +``KVM_ARM_SMCCC_FILTER`` for more details.
 +
 +``nr`` contains the function ID of the guest's SMCCC call. Userspace is
 +expected to use the ``KVM_GET_ONE_REG`` ioctl to retrieve the call
 +parameters from the vCPU's GPRs.
 +
 +Definition of ``flags``:
 + - ``KVM_HYPERCALL_EXIT_SMC``: Indicates that the guest used the SMC
 +   conduit to initiate the SMCCC call. If this bit is 0 then the guest
 +   used the HVC conduit for the SMCCC call.
 +
 + - ``KVM_HYPERCALL_EXIT_16BIT``: Indicates that the guest used a 16bit
 +   instruction to initiate the SMCCC call. If this bit is 0 then the
 +   guest used a 32bit instruction. An AArch64 guest always has this
 +   bit set to 0.
 +
 +At the point of exit, PC points to the instruction immediately following
 +the trapping instruction.
 +
  ::
  
                /* KVM_EXIT_TPR_ACCESS */
@@@ -7330,6 -7267,7 +7330,7 @@@ and injected exceptions
         will clear DR6.RTM.
  
  7.18 KVM_CAP_MANUAL_DIRTY_LOG_PROTECT2
+ --------------------------------------
  
  :Architectures: x86, arm64, mips
  :Parameters: args[0] whether feature should be enabled or not