lkml.org 
[lkml]   [2023]   [Jan]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v5 02/10] Documentation: KVM: s390: Describe KVM_S390_MEMOP_F_CMPXCHG
    Date
    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: Janis Schoetterl-Glausch <scgl@linux.ibm.com>
    Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
    ---
    Documentation/virt/kvm/api.rst | 20 ++++++++++++++++++--
    1 file changed, 18 insertions(+), 2 deletions(-)

    diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt/kvm/api.rst
    index deb494f759ed..be4bdcd2d489 100644
    --- a/Documentation/virt/kvm/api.rst
    +++ b/Documentation/virt/kvm/api.rst
    @@ -3728,7 +3728,8 @@ The fields in each entry are defined as follows:
    :Parameters: struct kvm_s390_mem_op (in)
    :Returns: = 0 on success,
    < 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,
    + other code > 0xffff with special meaning.

    Read or write data from/to the VM's memory.
    The KVM_CAP_S390_MEM_OP_EXTENSION capability specifies what functionality is
    @@ -3746,6 +3747,8 @@ Parameters are specified via the following structure::
    struct {
    __u8 ar; /* the access register number */
    __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 */
    __u8 reserved[32]; /* ignored */
    @@ -3828,8 +3831,21 @@ Absolute accesses are permitted for non-protected guests only.
    Supported flags:
    * ``KVM_S390_MEMOP_F_CHECK_ONLY``
    * ``KVM_S390_MEMOP_F_SKEY_PROTECTION``
    + * ``KVM_S390_MEMOP_F_CMPXCHG``
    +
    +The semantics of the flags common with logical accesses are as for logical
    +accesses.
    +
    +For write accesses, the KVM_S390_MEMOP_F_CMPXCHG flag is supported if
    +KVM_CAP_S390_MEM_OP_EXTENSION has flag KVM_S390_MEMOP_EXTENSION_CAP_CMPXCHG set.
    +In this case, 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, KVM_S390_MEMOP_R_NO_XCHG is returned.
    +In this case the value "old_addr" points to is replaced by the target value.

    -The semantics of the flags are as for logical accesses.

    SIDA read/write:
    ^^^^^^^^^^^^^^^^
    --
    2.34.1
    \
     
     \ /
      Last update: 2023-03-26 23:35    [W:3.789 / U:0.008 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site