diff options
author | Carsten Otte <cotte@de.ibm.com> | 2011-07-24 10:48:22 +0200 |
---|---|---|
committer | Martin Schwidefsky <schwidefsky@de.ibm.com> | 2011-07-24 10:48:21 +0200 |
commit | 092670cd90eb88c33661de21f1b4ee08d2597171 (patch) | |
tree | 2960d3ef459eccd0c2a7d0e2a77fad9bdb2437f2 /arch/s390/kvm/intercept.c | |
parent | 598841ca9919d008b520114d8a4378c4ce4e40a1 (diff) | |
download | blackbird-op-linux-092670cd90eb88c33661de21f1b4ee08d2597171.tar.gz blackbird-op-linux-092670cd90eb88c33661de21f1b4ee08d2597171.zip |
[S390] Use gmap translation for accessing guest memory
This patch removes kvm-s390 internal assumption of a linear mapping
of guest address space to user space. Previously, guest memory was
translated to user addresses using a fixed offset (gmsor). The new
code uses gmap_fault to resolve guest addresses.
Signed-off-by: Carsten Otte <cotte@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch/s390/kvm/intercept.c')
-rw-r--r-- | arch/s390/kvm/intercept.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/arch/s390/kvm/intercept.c b/arch/s390/kvm/intercept.c index 654fc1fa37e7..c7c51898984e 100644 --- a/arch/s390/kvm/intercept.c +++ b/arch/s390/kvm/intercept.c @@ -165,26 +165,30 @@ static int handle_validity(struct kvm_vcpu *vcpu) int rc; vcpu->stat.exit_validity++; - if ((viwhy == 0x37) && (vcpu->arch.sie_block->prefix - <= kvm_s390_vcpu_get_memsize(vcpu) - 2*PAGE_SIZE)) { - rc = fault_in_pages_writeable((char __user *) - vcpu->arch.sie_block->gmsor + - vcpu->arch.sie_block->prefix, - 2*PAGE_SIZE); + if (viwhy == 0x37) { + vmaddr = gmap_fault(vcpu->arch.sie_block->prefix, + vcpu->arch.gmap); + if (IS_ERR_VALUE(vmaddr)) { + rc = -EOPNOTSUPP; + goto out; + } + rc = fault_in_pages_writeable((char __user *) vmaddr, + PAGE_SIZE); if (rc) { /* user will receive sigsegv, exit to user */ rc = -EOPNOTSUPP; goto out; } - vmaddr = gmap_fault(vcpu->arch.sie_block->prefix, + vmaddr = gmap_fault(vcpu->arch.sie_block->prefix + PAGE_SIZE, vcpu->arch.gmap); if (IS_ERR_VALUE(vmaddr)) { rc = -EOPNOTSUPP; goto out; } - vmaddr = gmap_fault(vcpu->arch.sie_block->prefix + PAGE_SIZE, - vcpu->arch.gmap); - if (IS_ERR_VALUE(vmaddr)) { + rc = fault_in_pages_writeable((char __user *) vmaddr, + PAGE_SIZE); + if (rc) { + /* user will receive sigsegv, exit to user */ rc = -EOPNOTSUPP; goto out; } |