diff mbox series

[v2,20/23] docs: kvm: Add KVM_GET_XSAVE2

Message ID 20211217153003.1719189-21-jing2.liu@intel.com (mailing list archive)
State New, archived
Headers show
Series AMX Support in KVM | expand

Commit Message

Jing Liu Dec. 17, 2021, 3:30 p.m. UTC
From: Wei Wang <wei.w.wang@intel.com>

Update the api doc with the new KVM_GET_XSAVE2 ioctl, which is used
when KVM_CAP_XSAVE2 is negotiated with the userspace. KVM_SET_XSAVE
ioctl is re-used when KVM_CAP_XSAVE2 is used. The kvm_xsave struct
is updated to support data size larger that the legacy hardcoded 4KB.

Signed-off-by: Wei Wang <wei.w.wang@intel.com>
Signed-off-by: Zeng Guang <guang.zeng@intel.com>
Signed-off-by: Jing Liu <jing2.liu@intel.com>
---
 Documentation/virt/kvm/api.rst | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)

Comments

Paolo Bonzini Dec. 20, 2021, 9:04 a.m. UTC | #1
On 12/17/21 16:30, Jing Liu wrote:
> From: Wei Wang <wei.w.wang@intel.com>
> 
> Update the api doc with the new KVM_GET_XSAVE2 ioctl, which is used
> when KVM_CAP_XSAVE2 is negotiated with the userspace. KVM_SET_XSAVE
> ioctl is re-used when KVM_CAP_XSAVE2 is used. The kvm_xsave struct
> is updated to support data size larger that the legacy hardcoded 4KB.

This commit message is incorrect, since KVM_ENABLE_CAP(KVM_CAP_XSAVE2) 
was removed from the API.  You can squash this patch in patch 18, and 
also add to the documentation the same notes that I made in the reply.

Thanks,

Paolo

> Signed-off-by: Wei Wang <wei.w.wang@intel.com>
> Signed-off-by: Zeng Guang <guang.zeng@intel.com>
> Signed-off-by: Jing Liu <jing2.liu@intel.com>
> ---
>   Documentation/virt/kvm/api.rst | 29 ++++++++++++++++++++++++++++-
>   1 file changed, 28 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt/kvm/api.rst
> index eb5671ca2dba..0f4ed2d4aea6 100644
> --- a/Documentation/virt/kvm/api.rst
> +++ b/Documentation/virt/kvm/api.rst
> @@ -1566,15 +1566,18 @@ otherwise it will return EBUSY error.
>   
>     struct kvm_xsave {
>   	__u32 region[1024];
> +	__u32 extra[0];
>     };
>   
>   This ioctl would copy current vcpu's xsave struct to the userspace.
> +Application should use KVM_GET_XSAVE2 if xsave states are larger than
> +4KB.
>   
>   
>   4.43 KVM_SET_XSAVE
>   ------------------
>   
> -:Capability: KVM_CAP_XSAVE
> +:Capability: KVM_CAP_XSAVE and KVM_CAP_XSAVE2
>   :Architectures: x86
>   :Type: vcpu ioctl
>   :Parameters: struct kvm_xsave (in)
> @@ -1585,9 +1588,12 @@ This ioctl would copy current vcpu's xsave struct to the userspace.
>   
>     struct kvm_xsave {
>   	__u32 region[1024];
> +	__u32 extra[0];
>     };
>   
>   This ioctl would copy userspace's xsave struct to the kernel.
> +Application can use this ioctl for xstate buffer in any size
> +returned from KVM_CHECK_EXTENSION(KVM_CAP_XSAV2).

Typo, s/XSAV2/XSAVE2/

>   
>   4.44 KVM_GET_XCRS
> @@ -5507,6 +5513,27 @@ the trailing ``'\0'``, is indicated by ``name_size`` in the header.
>   The Stats Data block contains an array of 64-bit values in the same order
>   as the descriptors in Descriptors block.
>   
> +4.42 KVM_GET_XSAVE2
> +------------------
> +
> +:Capability: KVM_CAP_XSAVE2
> +:Architectures: x86
> +:Type: vcpu ioctl
> +:Parameters: struct kvm_xsave (out)
> +:Returns: 0 on success, -1 on error
> +
> +
> +::
> +
> +  struct kvm_xsave {
> +	__u32 region[1024];
> +	__u32 extra[0];
> +  };
> +
> +This ioctl would copy current vcpu's xsave struct to the userspace.
> +Application can use this ioctl for xstate buffer in any size
> +returned from KVM_CHECK_EXTENSION(KVM_CAP_XSAV2).

Typo, s/XSAV2/XSAVE2/

> +
>   5. The kvm_run structure
>   ========================
>   
>
diff mbox series

Patch

diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt/kvm/api.rst
index eb5671ca2dba..0f4ed2d4aea6 100644
--- a/Documentation/virt/kvm/api.rst
+++ b/Documentation/virt/kvm/api.rst
@@ -1566,15 +1566,18 @@  otherwise it will return EBUSY error.
 
   struct kvm_xsave {
 	__u32 region[1024];
+	__u32 extra[0];
   };
 
 This ioctl would copy current vcpu's xsave struct to the userspace.
+Application should use KVM_GET_XSAVE2 if xsave states are larger than
+4KB.
 
 
 4.43 KVM_SET_XSAVE
 ------------------
 
-:Capability: KVM_CAP_XSAVE
+:Capability: KVM_CAP_XSAVE and KVM_CAP_XSAVE2
 :Architectures: x86
 :Type: vcpu ioctl
 :Parameters: struct kvm_xsave (in)
@@ -1585,9 +1588,12 @@  This ioctl would copy current vcpu's xsave struct to the userspace.
 
   struct kvm_xsave {
 	__u32 region[1024];
+	__u32 extra[0];
   };
 
 This ioctl would copy userspace's xsave struct to the kernel.
+Application can use this ioctl for xstate buffer in any size
+returned from KVM_CHECK_EXTENSION(KVM_CAP_XSAV2).
 
 
 4.44 KVM_GET_XCRS
@@ -5507,6 +5513,27 @@  the trailing ``'\0'``, is indicated by ``name_size`` in the header.
 The Stats Data block contains an array of 64-bit values in the same order
 as the descriptors in Descriptors block.
 
+4.42 KVM_GET_XSAVE2
+------------------
+
+:Capability: KVM_CAP_XSAVE2
+:Architectures: x86
+:Type: vcpu ioctl
+:Parameters: struct kvm_xsave (out)
+:Returns: 0 on success, -1 on error
+
+
+::
+
+  struct kvm_xsave {
+	__u32 region[1024];
+	__u32 extra[0];
+  };
+
+This ioctl would copy current vcpu's xsave struct to the userspace.
+Application can use this ioctl for xstate buffer in any size
+returned from KVM_CHECK_EXTENSION(KVM_CAP_XSAV2).
+
 5. The kvm_run structure
 ========================