Lines Matching +full:address +full:- +full:address +full:- +full:data

1 /* SPDX-License-Identifier: GPL-2.0 */
17 #include "kvm-s390.h"
20 * kvm_s390_real_to_abs - convert guest real address to guest absolute address
21 * @prefix - guest prefix
22 * @gra - guest real address
24 * Returns the guest absolute address that corresponds to the passed guest real
25 * address @gra of by applying the given prefix.
32 gra -= prefix; in _kvm_s390_real_to_abs()
37 * kvm_s390_real_to_abs - convert guest real address to guest absolute address
38 * @vcpu - guest virtual cpu
39 * @gra - guest real address
41 * Returns the guest absolute address that corresponds to the passed guest real
42 * address @gra of a virtual guest cpu by applying its prefix.
51 * _kvm_s390_logical_to_effective - convert guest logical to effective address
53 * @ga: guest logical address
55 * Convert a guest logical address to an effective address by applying the
69 return ga & ((1UL << 31) - 1); in _kvm_s390_logical_to_effective()
70 return ga & ((1UL << 24) - 1); in _kvm_s390_logical_to_effective()
74 * kvm_s390_logical_to_effective - convert guest logical to effective address
76 * @ga: guest logical address
78 * Convert a guest vcpu logical address to a guest vcpu effective address by
89 return _kvm_s390_logical_to_effective(&vcpu->arch.sie_block->gpsw, ga); in kvm_s390_logical_to_effective()
96 * guest memory access protection facilities, like key or low address
104 * put_guest_lc - write a simple variable to a guest vcpu's lowcore
107 * @gra: vcpu's destination guest real address
113 * Returns zero on success or -EFAULT on error.
128 kvm_write_guest(__vcpu->kvm, __gpa, &__x, sizeof(__x)); \
132 * write_guest_lc - copy data from kernel space to guest vcpu's lowcore
134 * @gra: vcpu's source guest real address
135 * @data: source address in kernel space
138 * Copy data from kernel space to guest vcpu's lowcore. The entire range must
141 * Returns zero on success or -EFAULT on error.
149 int write_guest_lc(struct kvm_vcpu *vcpu, unsigned long gra, void *data, in write_guest_lc() argument
154 return kvm_write_guest(vcpu->kvm, gpa, data, len); in write_guest_lc()
158 * read_guest_lc - copy data from guest vcpu's lowcore to kernel space
160 * @gra: vcpu's source guest real address
161 * @data: destination address in kernel space
164 * Copy data from guest vcpu's lowcore to kernel space. The entire range must
167 * Returns zero on success or -EFAULT on error.
175 int read_guest_lc(struct kvm_vcpu *vcpu, unsigned long gra, void *data, in read_guest_lc() argument
180 return kvm_read_guest(vcpu->kvm, gpa, data, len); in read_guest_lc()
199 int access_guest_abs_with_key(struct kvm *kvm, gpa_t gpa, void *data,
203 void *data, unsigned long len, enum gacc_mode mode,
207 void *data, unsigned long len, enum gacc_mode mode);
213 * write_guest_with_key - copy data from kernel space to guest space
215 * @ga: guest address
217 * @data: source address in kernel space
221 * Copy @len bytes from @data (kernel space) to @ga (guest address).
222 * In order to copy data to guest space the PSW of the vcpu is inspected:
223 * If DAT is off data will be copied to guest real or absolute memory.
224 * If DAT is on data will be copied to the address space as specified by
225 * the address space bits of the PSW:
227 * The addressing mode of the PSW is also inspected, so that address wrap
228 * around is taken into account for 24-, 31- and 64-bit addressing mode,
229 * if the to be copied data crosses page boundaries in guest address space.
230 * In addition low address, DAT and key protection checks are performed before
231 * copying any data.
235 * all data necessary so that a subsequent call to 'kvm_s390_inject_prog_vcpu()'
240 * Returns: - zero on success
241 * - a negative value if e.g. the guest mapping is broken or in
242 * case of out-of-memory. In this case the contents of pgm are
243 * undefined. Also parts of @data may have been copied to guest
245 * - a positive value if an access exception happened. In this case
248 * guest. No data has been copied to guest space.
250 * Note: in case an access exception is recognized no data has been copied to
251 * guest space (this is also true, if the to be copied data would cross
256 * if data has been changed in guest space in case of an exception.
260 void *data, unsigned long len, u8 access_key) in write_guest_with_key() argument
262 return access_guest_with_key(vcpu, ga, ar, data, len, GACC_STORE, in write_guest_with_key()
267 * write_guest - copy data from kernel space to guest space
269 * @ga: guest address
271 * @data: source address in kernel space
278 int write_guest(struct kvm_vcpu *vcpu, unsigned long ga, u8 ar, void *data, in write_guest() argument
281 u8 access_key = psw_bits(vcpu->arch.sie_block->gpsw).key; in write_guest()
283 return write_guest_with_key(vcpu, ga, ar, data, len, access_key); in write_guest()
287 * read_guest_with_key - copy data from guest space to kernel space
289 * @ga: guest address
291 * @data: destination address in kernel space
295 * Copy @len bytes from @ga (guest address) to @data (kernel space).
298 * except that data will be copied from guest space to kernel space.
302 void *data, unsigned long len, u8 access_key) in read_guest_with_key() argument
304 return access_guest_with_key(vcpu, ga, ar, data, len, GACC_FETCH, in read_guest_with_key()
309 * read_guest - copy data from guest space to kernel space
311 * @ga: guest address
313 * @data: destination address in kernel space
316 * Copy @len bytes from @ga (guest address) to @data (kernel space).
322 int read_guest(struct kvm_vcpu *vcpu, unsigned long ga, u8 ar, void *data, in read_guest() argument
325 u8 access_key = psw_bits(vcpu->arch.sie_block->gpsw).key; in read_guest()
327 return read_guest_with_key(vcpu, ga, ar, data, len, access_key); in read_guest()
331 * read_guest_instr - copy instruction data from guest space to kernel space
333 * @ga: guest address
334 * @data: destination address in kernel space
337 * Copy @len bytes from the given address (guest space) to @data (kernel
341 * instruction data will be read from primary space when in home-space or
342 * address-space mode.
345 int read_guest_instr(struct kvm_vcpu *vcpu, unsigned long ga, void *data, in read_guest_instr() argument
348 u8 access_key = psw_bits(vcpu->arch.sie_block->gpsw).key; in read_guest_instr()
350 return access_guest_with_key(vcpu, ga, 0, data, len, GACC_IFETCH, in read_guest_instr()
355 * write_guest_abs - copy data from kernel space to guest space absolute
357 * @gpa: guest physical (absolute) address
358 * @data: source address in kernel space
361 * Copy @len bytes from @data (kernel space) to @gpa (guest absolute address).
364 * Guest low address and key protection are not checked.
366 * Returns zero on success or -EFAULT on error.
368 * If an error occurs data may have been copied partially to guest memory.
371 int write_guest_abs(struct kvm_vcpu *vcpu, unsigned long gpa, void *data, in write_guest_abs() argument
374 return kvm_write_guest(vcpu->kvm, gpa, data, len); in write_guest_abs()
378 * read_guest_abs - copy data from guest space absolute to kernel space
380 * @gpa: guest physical (absolute) address
381 * @data: destination address in kernel space
384 * Copy @len bytes from @gpa (guest absolute address) to @data (kernel space).
389 * Returns zero on success or -EFAULT on error.
391 * If an error occurs data may have been copied partially to kernel space.
394 int read_guest_abs(struct kvm_vcpu *vcpu, unsigned long gpa, void *data, in read_guest_abs() argument
397 return kvm_read_guest(vcpu->kvm, gpa, data, len); in read_guest_abs()
401 * write_guest_real - copy data from kernel space to guest space real
403 * @gra: guest real address
404 * @data: source address in kernel space
407 * Copy @len bytes from @data (kernel space) to @gra (guest real address).
408 * Guest low address and key protection are not checked.
410 * Returns zero on success, -EFAULT when copying from @data failed, or
415 * If an error occurs data may have been copied partially to guest memory.
418 int write_guest_real(struct kvm_vcpu *vcpu, unsigned long gra, void *data, in write_guest_real() argument
421 return access_guest_real(vcpu, gra, data, len, 1); in write_guest_real()
425 * read_guest_real - copy data from guest space real to kernel space
427 * @gra: guest real address
428 * @data: destination address in kernel space
431 * Copy @len bytes from @gra (guest real address) to @data (kernel space).
434 * Returns zero on success, -EFAULT when copying to @data failed, or
439 * If an error occurs data may have been copied partially to kernel space.
442 int read_guest_real(struct kvm_vcpu *vcpu, unsigned long gra, void *data, in read_guest_real() argument
445 return access_guest_real(vcpu, gra, data, len, 0); in read_guest_real()