aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation
diff options
context:
space:
mode:
authorThomas Huth <thuth@linux.vnet.ibm.com>2015-02-06 09:01:21 -0500
committerChristian Borntraeger <borntraeger@de.ibm.com>2015-03-17 11:26:24 -0400
commit41408c28f283b49202ae374b1c42bc8e9b33a048 (patch)
tree4acd40bb4bacc760ad3c65c82b5604145d64d437 /Documentation
parent664b4973537068402954bee6e2959b858f263a6f (diff)
KVM: s390: Add MEMOP ioctls for reading/writing guest memory
On s390, we've got to make sure to hold the IPTE lock while accessing logical memory. So let's add an ioctl for reading and writing logical memory to provide this feature for userspace, too. The maximum transfer size of this call is limited to 64kB to prevent that the guest can trigger huge copy_from/to_user transfers. QEMU currently only requests up to one or two pages so far, so 16*4kB seems to be a reasonable limit here. Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/virtual/kvm/api.txt46
1 files changed, 46 insertions, 0 deletions
diff --git a/Documentation/virtual/kvm/api.txt b/Documentation/virtual/kvm/api.txt
index ee47998ec368..281179d92a28 100644
--- a/Documentation/virtual/kvm/api.txt
+++ b/Documentation/virtual/kvm/api.txt
@@ -2716,6 +2716,52 @@ The fields in each entry are defined as follows:
2716 eax, ebx, ecx, edx: the values returned by the cpuid instruction for 2716 eax, ebx, ecx, edx: the values returned by the cpuid instruction for
2717 this function/index combination 2717 this function/index combination
2718 2718
27194.89 KVM_S390_MEM_OP
2720
2721Capability: KVM_CAP_S390_MEM_OP
2722Architectures: s390
2723Type: vcpu ioctl
2724Parameters: struct kvm_s390_mem_op (in)
2725Returns: = 0 on success,
2726 < 0 on generic error (e.g. -EFAULT or -ENOMEM),
2727 > 0 if an exception occurred while walking the page tables
2728
2729Read or write data from/to the logical (virtual) memory of a VPCU.
2730
2731Parameters are specified via the following structure:
2732
2733struct kvm_s390_mem_op {
2734 __u64 gaddr; /* the guest address */
2735 __u64 flags; /* flags */
2736 __u32 size; /* amount of bytes */
2737 __u32 op; /* type of operation */
2738 __u64 buf; /* buffer in userspace */
2739 __u8 ar; /* the access register number */
2740 __u8 reserved[31]; /* should be set to 0 */
2741};
2742
2743The type of operation is specified in the "op" field. It is either
2744KVM_S390_MEMOP_LOGICAL_READ for reading from logical memory space or
2745KVM_S390_MEMOP_LOGICAL_WRITE for writing to logical memory space. The
2746KVM_S390_MEMOP_F_CHECK_ONLY flag can be set in the "flags" field to check
2747whether the corresponding memory access would create an access exception
2748(without touching the data in the memory at the destination). In case an
2749access exception occurred while walking the MMU tables of the guest, the
2750ioctl returns a positive error number to indicate the type of exception.
2751This exception is also raised directly at the corresponding VCPU if the
2752flag KVM_S390_MEMOP_F_INJECT_EXCEPTION is set in the "flags" field.
2753
2754The start address of the memory region has to be specified in the "gaddr"
2755field, and the length of the region in the "size" field. "buf" is the buffer
2756supplied by the userspace application where the read data should be written
2757to for KVM_S390_MEMOP_LOGICAL_READ, or where the data that should be written
2758is stored for a KVM_S390_MEMOP_LOGICAL_WRITE. "buf" is unused and can be NULL
2759when KVM_S390_MEMOP_F_CHECK_ONLY is specified. "ar" designates the access
2760register number to be used.
2761
2762The "reserved" field is meant for future extensions. It is not used by
2763KVM with the currently defined set of flags.
2764
27195. The kvm_run structure 27655. The kvm_run structure
2720------------------------ 2766------------------------
2721 2767