xref: /kvm-unit-tests/lib/powerpc/asm/hcall.h (revision 0cc3a351b925928827baa4b69cf0e46ff5837083)
1e65bcc62SAndrew Jones #ifndef _ASMPOWERPC_HCALL_H_
2e65bcc62SAndrew Jones #define _ASMPOWERPC_HCALL_H_
3e65bcc62SAndrew Jones /*
4e65bcc62SAndrew Jones  * Copyright (C) 2016, Red Hat Inc, Andrew Jones <drjones@redhat.com>
5e65bcc62SAndrew Jones  *
6e65bcc62SAndrew Jones  * This work is licensed under the terms of the GNU LGPL, version 2.
7e65bcc62SAndrew Jones  */
8e65bcc62SAndrew Jones 
9e65bcc62SAndrew Jones #define SC1			0x44000022
10e65bcc62SAndrew Jones #define SC1_REPLACEMENT		0x7c000268
11e65bcc62SAndrew Jones 
12e65bcc62SAndrew Jones #define H_SUCCESS		0
13e65bcc62SAndrew Jones #define H_HARDWARE		-1
14e65bcc62SAndrew Jones #define H_FUNCTION		-2
15e65bcc62SAndrew Jones #define H_PRIVILEGE		-3
16e65bcc62SAndrew Jones #define H_PARAMETER		-4
17e65bcc62SAndrew Jones 
18c20e1e54SThomas Huth #define H_SET_SPRG0		0x24
19e65bcc62SAndrew Jones #define H_SET_DABR		0x28
20c20e1e54SThomas Huth #define H_PAGE_INIT		0x2c
21e7324a48SNicholas Piggin #define H_REGISTER_VPA		0xDC
22adb87bc4SSuraj Jitindar Singh #define H_CEDE			0xE0
231aee4297SAndrew Jones #define H_GET_TERM_CHAR		0x54
24e65bcc62SAndrew Jones #define H_PUT_TERM_CHAR		0x58
25c20e1e54SThomas Huth #define H_RANDOM		0x300
266842bc34SLaurent Vivier #define H_SET_MODE		0x31C
27d4c8e725SNicholas Piggin #define H_REGISTER_PROCESS_TABLE	0x37C
28d4c8e725SNicholas Piggin 
29d4c8e725SNicholas Piggin #define PTBL_NEW		0x18
30d4c8e725SNicholas Piggin #define PTBL_UNREGISTER		0x10
31d4c8e725SNicholas Piggin #define PTBL_RADIX		0x04
32d4c8e725SNicholas Piggin #define PTBL_GTSE		0x01
33e65bcc62SAndrew Jones 
34141b4584SDavid Gibson #define KVMPPC_HCALL_BASE	0xf000
35141b4584SDavid Gibson #define KVMPPC_H_RTAS		(KVMPPC_HCALL_BASE + 0x0)
36141b4584SDavid Gibson 
37*0cc3a351SSean Christopherson #ifndef __ASSEMBLER__
38e65bcc62SAndrew Jones /*
39e65bcc62SAndrew Jones  * hcall_have_broken_sc1 checks if we're on a host with a broken sc1.
40e65bcc62SAndrew Jones  * Returns 0 if we're not.
41e65bcc62SAndrew Jones  */
42e65bcc62SAndrew Jones extern int hcall_have_broken_sc1(void);
43e65bcc62SAndrew Jones 
44e65bcc62SAndrew Jones /*
45e65bcc62SAndrew Jones  * hcall is the hypercall wrapper function. unittests may do what
46e65bcc62SAndrew Jones  * they like, but the framework should make all hypercalls through
47e65bcc62SAndrew Jones  * here to ensure they use a working sc1 instruction. @nr is the
48e65bcc62SAndrew Jones  * hypercall number.
49e65bcc62SAndrew Jones  */
50e65bcc62SAndrew Jones extern unsigned long hcall(unsigned long nr, ...);
51e65bcc62SAndrew Jones 
52*0cc3a351SSean Christopherson #endif /* !__ASSEMBLER__ */
53e65bcc62SAndrew Jones #endif /* _ASMPOWERPC_HCALL_H_ */
54