KVM: arm64/sve: Report and enable SVE API extensions for userspace
This patch adds the necessary API extensions to allow userspace to
detect SVE support for guests and enable it.
A new capability KVM_CAP_ARM_SVE is defined to allow userspace to
detect the availability of the KVM SVE API extensions in the usual
way. In addition, userspace must opt into these extensions by
passing the new KVM_VM_TYPE_ARM_SVE flag to KVM_CREATE_VM.
Userspace needs to enable or disable SVE explicitly per vcpu and
configure the set of SVE vector lengths available to the guest
before non-trivial ioctls (including KVM_ARM_VCPU_INIT and KVM_RUN)
are allowed on the vcpu. For these purposes, a new arm64-specific
vcpu ioctl KVM_ARM_SVE_CONFIG is added, with the following
subcommands (in rough order of expected use):
KVM_ARM_SVE_CONFIG_QUERY: report the set of vector lengths
supported by this host.
The resulting set can be supplied directly to
KVM_ARM_SVE_CONFIG_SET in order to obtain the maximal possible
set, or used to inform userspace's decision on the appropriate
set of vector lengths (possibly taking into account the
configuration of other nodes in the cluster so that the VM can
migrate freely).
KVM_ARM_SVE_CONFIG_SET: enable or disable SVE for this vcpu and
configure the set of vector lengths it offers to the guest (in
the enabled case).
This can only be done once, before the vcpu is run.
KVM_ARM_SVE_CONFIG_GET: report the set of vector lengths available
to the guest on this vcpu (for use when snapshotting or
migrating a VM).
Signed-off-by:
Dave Martin <Dave.Martin@arm.com>
Loading
Please register or sign in to comment