1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 #ifndef _S390X_UV_H_ 3 #define _S390X_UV_H_ 4 5 #include <sie.h> 6 #include <asm/pgtable.h> 7 8 bool uv_os_is_guest(void); 9 bool uv_os_is_host(void); 10 bool uv_query_test_call(unsigned int nr); 11 void uv_init(void); 12 int uv_setup(void); 13 void uv_create_guest(struct vm *vm); 14 void uv_destroy_guest(struct vm *vm); 15 int uv_unpack(struct vm *vm, uint64_t addr, uint64_t len, uint64_t tweak); 16 void uv_verify_load(struct vm *vm); 17 18 /* 19 * To run PV guests we need to setup a few things: 20 * - A valid primary ASCE that contains the guest memory and has the P bit set. 21 * - A valid home space ASCE for the UV calls that use home space addresses. 22 */ 23 static inline void uv_setup_asces(void) 24 { 25 uint64_t asce; 26 27 /* We need to have a valid primary ASCE to run guests. */ 28 setup_vm(); 29 30 /* Set P bit in ASCE as it is required for PV guests */ 31 asce = stctg(1) | ASCE_P; 32 lctlg(1, asce); 33 34 /* Copy ASCE into home space CR */ 35 lctlg(13, asce); 36 } 37 38 #endif /* UV_H */ 39