diff options
author | David Hildenbrand <dahi@linux.vnet.ibm.com> | 2015-11-16 15:48:59 +0100 |
---|---|---|
committer | Christian Borntraeger <borntraeger@de.ibm.com> | 2016-02-10 13:12:51 +0100 |
commit | 34346b9a9388b28c3b4a865f8b4f98863f05df81 (patch) | |
tree | a58ffbb94c94f85fd5b5763582229cd5994f83aa /arch/s390/kvm/gaccess.h | |
parent | KVM: s390: gaccess: introduce access modes (diff) | |
download | linux-34346b9a9388b28c3b4a865f8b4f98863f05df81.tar.xz linux-34346b9a9388b28c3b4a865f8b4f98863f05df81.zip |
KVM: s390: gaccess: implement instruction fetching mode
When an instruction is to be fetched, special handling applies to
secondary-space mode and access-register mode. The instruction is to be
fetched from primary space.
We can easily support this by selecting the right asce for translation.
Access registers will never be used during translation, so don't
include them in the interface. As we only want to read from the current
PSW address for now, let's also hide that detail.
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Diffstat (limited to 'arch/s390/kvm/gaccess.h')
-rw-r--r-- | arch/s390/kvm/gaccess.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/arch/s390/kvm/gaccess.h b/arch/s390/kvm/gaccess.h index 2a6f8bfd22f8..df0a79dd8159 100644 --- a/arch/s390/kvm/gaccess.h +++ b/arch/s390/kvm/gaccess.h @@ -158,6 +158,7 @@ int read_guest_lc(struct kvm_vcpu *vcpu, unsigned long gra, void *data, enum gacc_mode { GACC_FETCH, GACC_STORE, + GACC_IFETCH, }; int guest_translate_address(struct kvm_vcpu *vcpu, unsigned long gva, @@ -244,6 +245,26 @@ int read_guest(struct kvm_vcpu *vcpu, unsigned long ga, ar_t ar, void *data, } /** + * read_guest_instr - copy instruction data from guest space to kernel space + * @vcpu: virtual cpu + * @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 + * space). + * + * The behaviour of read_guest_instr is identical to read_guest, except that + * instruction data will be read from primary space when in home-space or + * address-space mode. + */ +static inline __must_check +int read_guest_instr(struct kvm_vcpu *vcpu, void *data, unsigned long len) +{ + return access_guest(vcpu, vcpu->arch.sie_block->gpsw.addr, 0, data, len, + GACC_IFETCH); +} + +/** * write_guest_abs - copy data from kernel space to guest space absolute * @vcpu: virtual cpu * @gpa: guest physical (absolute) address |