treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / arch / powerpc / include / asm / ultravisor.h
blob790b0e63681fb21e098b9302feb2ec5eac16a5e4
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * Ultravisor definitions
5 * Copyright 2019, IBM Corporation.
7 */
8 #ifndef _ASM_POWERPC_ULTRAVISOR_H
9 #define _ASM_POWERPC_ULTRAVISOR_H
11 #include <asm/asm-prototypes.h>
12 #include <asm/ultravisor-api.h>
13 #include <asm/firmware.h>
15 int early_init_dt_scan_ultravisor(unsigned long node, const char *uname,
16 int depth, void *data);
19 * In ultravisor enabled systems, PTCR becomes ultravisor privileged only for
20 * writing and an attempt to write to it will cause a Hypervisor Emulation
21 * Assistance interrupt.
23 static inline void set_ptcr_when_no_uv(u64 val)
25 if (!firmware_has_feature(FW_FEATURE_ULTRAVISOR))
26 mtspr(SPRN_PTCR, val);
29 static inline int uv_register_pate(u64 lpid, u64 dw0, u64 dw1)
31 return ucall_norets(UV_WRITE_PATE, lpid, dw0, dw1);
34 static inline int uv_share_page(u64 pfn, u64 npages)
36 return ucall_norets(UV_SHARE_PAGE, pfn, npages);
39 static inline int uv_unshare_page(u64 pfn, u64 npages)
41 return ucall_norets(UV_UNSHARE_PAGE, pfn, npages);
44 static inline int uv_unshare_all_pages(void)
46 return ucall_norets(UV_UNSHARE_ALL_PAGES);
49 static inline int uv_page_in(u64 lpid, u64 src_ra, u64 dst_gpa, u64 flags,
50 u64 page_shift)
52 return ucall_norets(UV_PAGE_IN, lpid, src_ra, dst_gpa, flags,
53 page_shift);
56 static inline int uv_page_out(u64 lpid, u64 dst_ra, u64 src_gpa, u64 flags,
57 u64 page_shift)
59 return ucall_norets(UV_PAGE_OUT, lpid, dst_ra, src_gpa, flags,
60 page_shift);
63 static inline int uv_register_mem_slot(u64 lpid, u64 start_gpa, u64 size,
64 u64 flags, u64 slotid)
66 return ucall_norets(UV_REGISTER_MEM_SLOT, lpid, start_gpa,
67 size, flags, slotid);
70 static inline int uv_unregister_mem_slot(u64 lpid, u64 slotid)
72 return ucall_norets(UV_UNREGISTER_MEM_SLOT, lpid, slotid);
75 static inline int uv_page_inval(u64 lpid, u64 gpa, u64 page_shift)
77 return ucall_norets(UV_PAGE_INVAL, lpid, gpa, page_shift);
80 static inline int uv_svm_terminate(u64 lpid)
82 return ucall_norets(UV_SVM_TERMINATE, lpid);
85 #endif /* _ASM_POWERPC_ULTRAVISOR_H */