From a9bcd1b8719dea2e91512238d810e2a0037e174d Mon Sep 17 00:00:00 2001 From: Thomas Huth Date: Fri, 6 Feb 2015 15:54:58 +0100 Subject: 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 Acked-by: Christian Borntraeger Signed-off-by: Cornelia Huck --- target-s390x/mmu_helper.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'target-s390x/mmu_helper.c') 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)); -- cgit v1.2.1