KVM: s390: prepare to read random guest instructions
authorDavid Hildenbrand <dahi@linux.vnet.ibm.com>
Tue, 24 May 2016 10:00:49 +0000 (12:00 +0200)
committerChristian Borntraeger <borntraeger@de.ibm.com>
Mon, 30 Jan 2017 10:19:16 +0000 (11:19 +0100)
We will have to read instructions not residing at the current PSW
address.

Reviewed-by: Eric Farman <farman@linux.vnet.ibm.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Cc: David Hildenbrand <david@redhat.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
arch/s390/kvm/gaccess.h
arch/s390/kvm/kvm-s390.c

index 5c9cc18f3b4adf67289f11f018c575e27eec80a5..7ce47fd36f2872b08078c07191711dc870aa62a6 100644 (file)
@@ -247,10 +247,11 @@ int read_guest(struct kvm_vcpu *vcpu, unsigned long ga, u8 ar, void *data,
 /**
  * read_guest_instr - copy instruction data from guest space to kernel space
  * @vcpu: virtual cpu
+ * @ga: guest address
  * @data: destination address in kernel space
  * @len: number of bytes to copy
  *
- * Copy @len bytes from the current psw address (guest space) to @data (kernel
+ * Copy @len bytes from the given address (guest space) to @data (kernel
  * space).
  *
  * The behaviour of read_guest_instr is identical to read_guest, except that
@@ -258,10 +259,10 @@ int read_guest(struct kvm_vcpu *vcpu, unsigned long ga, u8 ar, void *data,
  * address-space mode.
  */
 static inline __must_check
-int read_guest_instr(struct kvm_vcpu *vcpu, void *data, unsigned long len)
+int read_guest_instr(struct kvm_vcpu *vcpu, unsigned long ga, void *data,
+                    unsigned long len)
 {
-       return access_guest(vcpu, vcpu->arch.sie_block->gpsw.addr, 0, data, len,
-                           GACC_IFETCH);
+       return access_guest(vcpu, ga, 0, data, len, GACC_IFETCH);
 }
 
 /**
index 69401b8d4521a0bf266084bf2254da8bc2185fb2..66e73f4ed64b80e6ee9274657944e8afb4e488b0 100644 (file)
@@ -2588,7 +2588,7 @@ static int vcpu_post_run_fault_in_sie(struct kvm_vcpu *vcpu)
         * to look up the current opcode to get the length of the instruction
         * to be able to forward the PSW.
         */
-       rc = read_guest_instr(vcpu, &opcode, 1);
+       rc = read_guest_instr(vcpu, vcpu->arch.sie_block->gpsw.addr, &opcode, 1);
        ilen = insn_length(opcode);
        if (rc < 0) {
                return rc;