Commit a7b04173 authored by Janis Schoetterl-Glausch's avatar Janis Schoetterl-Glausch Committed by Janosch Frank

Documentation: KVM: s390: Describe KVM_S390_MEMOP_F_CMPXCHG

Describe the semantics of the new KVM_S390_MEMOP_F_CMPXCHG flag for
absolute vm write memops which allows user space to perform (storage key
checked) cmpxchg operations on guest memory.
Signed-off-by: default avatarJanis Schoetterl-Glausch <scgl@linux.ibm.com>
Reviewed-by: default avatarJanosch Frank <frankja@linux.ibm.com>
Link: https://lore.kernel.org/r/20230206164602.138068-14-scgl@linux.ibm.com
Message-Id: <20230206164602.138068-14-scgl@linux.ibm.com>
[frankja@de.ibm.com: Removed a line from an earlier version]
Signed-off-by: default avatarJanosch Frank <frankja@linux.ibm.com>
parent 3fd49805
...@@ -3728,7 +3728,7 @@ The fields in each entry are defined as follows: ...@@ -3728,7 +3728,7 @@ The fields in each entry are defined as follows:
:Parameters: struct kvm_s390_mem_op (in) :Parameters: struct kvm_s390_mem_op (in)
:Returns: = 0 on success, :Returns: = 0 on success,
< 0 on generic error (e.g. -EFAULT or -ENOMEM), < 0 on generic error (e.g. -EFAULT or -ENOMEM),
> 0 if an exception occurred while walking the page tables 16 bit program exception code if the access causes such an exception
Read or write data from/to the VM's memory. Read or write data from/to the VM's memory.
The KVM_CAP_S390_MEM_OP_EXTENSION capability specifies what functionality is The KVM_CAP_S390_MEM_OP_EXTENSION capability specifies what functionality is
...@@ -3746,6 +3746,8 @@ Parameters are specified via the following structure:: ...@@ -3746,6 +3746,8 @@ Parameters are specified via the following structure::
struct { struct {
__u8 ar; /* the access register number */ __u8 ar; /* the access register number */
__u8 key; /* access key, ignored if flag unset */ __u8 key; /* access key, ignored if flag unset */
__u8 pad1[6]; /* ignored */
__u64 old_addr; /* ignored if flag unset */
}; };
__u32 sida_offset; /* offset into the sida */ __u32 sida_offset; /* offset into the sida */
__u8 reserved[32]; /* ignored */ __u8 reserved[32]; /* ignored */
...@@ -3773,6 +3775,7 @@ Possible operations are: ...@@ -3773,6 +3775,7 @@ Possible operations are:
* ``KVM_S390_MEMOP_ABSOLUTE_WRITE`` * ``KVM_S390_MEMOP_ABSOLUTE_WRITE``
* ``KVM_S390_MEMOP_SIDA_READ`` * ``KVM_S390_MEMOP_SIDA_READ``
* ``KVM_S390_MEMOP_SIDA_WRITE`` * ``KVM_S390_MEMOP_SIDA_WRITE``
* ``KVM_S390_MEMOP_ABSOLUTE_CMPXCHG``
Logical read/write: Logical read/write:
^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^
...@@ -3821,7 +3824,7 @@ the checks required for storage key protection as one operation (as opposed to ...@@ -3821,7 +3824,7 @@ the checks required for storage key protection as one operation (as opposed to
user space getting the storage keys, performing the checks, and accessing user space getting the storage keys, performing the checks, and accessing
memory thereafter, which could lead to a delay between check and access). memory thereafter, which could lead to a delay between check and access).
Absolute accesses are permitted for the VM ioctl if KVM_CAP_S390_MEM_OP_EXTENSION Absolute accesses are permitted for the VM ioctl if KVM_CAP_S390_MEM_OP_EXTENSION
is > 0. has the KVM_S390_MEMOP_EXTENSION_CAP_BASE bit set.
Currently absolute accesses are not permitted for VCPU ioctls. Currently absolute accesses are not permitted for VCPU ioctls.
Absolute accesses are permitted for non-protected guests only. Absolute accesses are permitted for non-protected guests only.
...@@ -3829,7 +3832,26 @@ Supported flags: ...@@ -3829,7 +3832,26 @@ Supported flags:
* ``KVM_S390_MEMOP_F_CHECK_ONLY`` * ``KVM_S390_MEMOP_F_CHECK_ONLY``
* ``KVM_S390_MEMOP_F_SKEY_PROTECTION`` * ``KVM_S390_MEMOP_F_SKEY_PROTECTION``
The semantics of the flags are as for logical accesses. The semantics of the flags common with logical accesses are as for logical
accesses.
Absolute cmpxchg:
^^^^^^^^^^^^^^^^^
Perform cmpxchg on absolute guest memory. Intended for use with the
KVM_S390_MEMOP_F_SKEY_PROTECTION flag.
Instead of doing an unconditional write, the access occurs only if the target
location contains the value pointed to by "old_addr".
This is performed as an atomic cmpxchg with the length specified by the "size"
parameter. "size" must be a power of two up to and including 16.
If the exchange did not take place because the target value doesn't match the
old value, the value "old_addr" points to is replaced by the target value.
User space can tell if an exchange took place by checking if this replacement
occurred. The cmpxchg op is permitted for the VM ioctl if
KVM_CAP_S390_MEM_OP_EXTENSION has flag KVM_S390_MEMOP_EXTENSION_CAP_CMPXCHG set.
Supported flags:
* ``KVM_S390_MEMOP_F_SKEY_PROTECTION``
SIDA read/write: SIDA read/write:
^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment