summaryrefslogtreecommitdiff
path: root/target-s390x/mmu_helper.c
diff options
context:
space:
mode:
authorThomas Huth <thuth@linux.vnet.ibm.com>2015-02-06 15:54:58 +0100
committerCornelia Huck <cornelia.huck@de.ibm.com>2015-04-30 13:21:42 +0200
commita9bcd1b8719dea2e91512238d810e2a0037e174d (patch)
tree9f4520bf1f7267b405dbf8e4b18074af306a56cd /target-s390x/mmu_helper.c
parentf07177a5599fb204e42a007db4820ceda1bc85ba (diff)
downloadqemu-a9bcd1b8719dea2e91512238d810e2a0037e174d.zip
s390x/mmu: Use ioctl for reading and writing from/to guest memory
Add code to make use of the new ioctl for reading from / writing to virtual guest memory. By using the ioctl, the memory accesses are now protected with the so-called ipte-lock in the kernel. [CH: moved error message into kvm_s390_mem_op()] Signed-off-by: Thomas Huth <thuth@linux.vnet.ibm.com> Acked-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Diffstat (limited to 'target-s390x/mmu_helper.c')
-rw-r--r--target-s390x/mmu_helper.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/target-s390x/mmu_helper.c b/target-s390x/mmu_helper.c
index 9b88498b39..cd2cb51629 100644
--- a/target-s390x/mmu_helper.c
+++ b/target-s390x/mmu_helper.c
@@ -450,6 +450,13 @@ int s390_cpu_virt_mem_rw(S390CPU *cpu, vaddr laddr, void *hostbuf,
target_ulong *pages;
int ret;
+ if (kvm_enabled()) {
+ ret = kvm_s390_mem_op(cpu, laddr, hostbuf, len, is_write);
+ if (ret >= 0) {
+ return ret;
+ }
+ }
+
nr_pages = (((laddr & ~TARGET_PAGE_MASK) + len - 1) >> TARGET_PAGE_BITS)
+ 1;
pages = g_malloc(nr_pages * sizeof(*pages));