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 const struct uv_cb_qui *uv_get_query_data(void); 12 void uv_init(void); 13 int uv_setup(void); 14 void uv_create_guest(struct vm *vm); 15 void uv_destroy_guest(struct vm *vm); 16 int uv_unpack(struct vm *vm, uint64_t addr, uint64_t len, uint64_t tweak); 17 void uv_verify_load(struct vm *vm); 18 19 /* 20 * To run PV guests we need to setup a few things: 21 * - A valid primary ASCE that contains the guest memory and has the P bit set. 22 * - A valid home space ASCE for the UV calls that use home space addresses. 23 */ 24 static inline void uv_setup_asces(void) 25 { 26 uint64_t asce; 27 28 /* We need to have a valid primary ASCE to run guests. */ 29 setup_vm(); 30 31 /* Grab the ASCE which setup_vm() just set up */ 32 asce = stctg(1); 33 34 /* Copy ASCE into home space CR */ 35 lctlg(13, asce); 36 } 37 38 #endif /* UV_H */ 39