18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef _ASM_POWERPC_HVCALL_H
38c2ecf20Sopenharmony_ci#define _ASM_POWERPC_HVCALL_H
48c2ecf20Sopenharmony_ci#ifdef __KERNEL__
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci#define HVSC			.long 0x44000022
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#define H_SUCCESS	0
98c2ecf20Sopenharmony_ci#define H_BUSY		1	/* Hardware busy -- retry later */
108c2ecf20Sopenharmony_ci#define H_CLOSED	2	/* Resource closed */
118c2ecf20Sopenharmony_ci#define H_NOT_AVAILABLE 3
128c2ecf20Sopenharmony_ci#define H_CONSTRAINED	4	/* Resource request constrained to max allowed */
138c2ecf20Sopenharmony_ci#define H_PARTIAL       5
148c2ecf20Sopenharmony_ci#define H_IN_PROGRESS	14	/* Kind of like busy */
158c2ecf20Sopenharmony_ci#define H_PAGE_REGISTERED 15
168c2ecf20Sopenharmony_ci#define H_PARTIAL_STORE   16
178c2ecf20Sopenharmony_ci#define H_PENDING	17	/* returned from H_POLL_PENDING */
188c2ecf20Sopenharmony_ci#define H_CONTINUE	18	/* Returned from H_Join on success */
198c2ecf20Sopenharmony_ci#define H_LONG_BUSY_START_RANGE		9900  /* Start of long busy range */
208c2ecf20Sopenharmony_ci#define H_LONG_BUSY_ORDER_1_MSEC	9900  /* Long busy, hint that 1msec \
218c2ecf20Sopenharmony_ci						 is a good time to retry */
228c2ecf20Sopenharmony_ci#define H_LONG_BUSY_ORDER_10_MSEC	9901  /* Long busy, hint that 10msec \
238c2ecf20Sopenharmony_ci						 is a good time to retry */
248c2ecf20Sopenharmony_ci#define H_LONG_BUSY_ORDER_100_MSEC 	9902  /* Long busy, hint that 100msec \
258c2ecf20Sopenharmony_ci						 is a good time to retry */
268c2ecf20Sopenharmony_ci#define H_LONG_BUSY_ORDER_1_SEC		9903  /* Long busy, hint that 1sec \
278c2ecf20Sopenharmony_ci						 is a good time to retry */
288c2ecf20Sopenharmony_ci#define H_LONG_BUSY_ORDER_10_SEC	9904  /* Long busy, hint that 10sec \
298c2ecf20Sopenharmony_ci						 is a good time to retry */
308c2ecf20Sopenharmony_ci#define H_LONG_BUSY_ORDER_100_SEC	9905  /* Long busy, hint that 100sec \
318c2ecf20Sopenharmony_ci						 is a good time to retry */
328c2ecf20Sopenharmony_ci#define H_LONG_BUSY_END_RANGE		9905  /* End of long busy range */
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci/* Internal value used in book3s_hv kvm support; not returned to guests */
358c2ecf20Sopenharmony_ci#define H_TOO_HARD	9999
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci#define H_HARDWARE	-1	/* Hardware error */
388c2ecf20Sopenharmony_ci#define H_FUNCTION	-2	/* Function not supported */
398c2ecf20Sopenharmony_ci#define H_PRIVILEGE	-3	/* Caller not privileged */
408c2ecf20Sopenharmony_ci#define H_PARAMETER	-4	/* Parameter invalid, out-of-range or conflicting */
418c2ecf20Sopenharmony_ci#define H_BAD_MODE	-5	/* Illegal msr value */
428c2ecf20Sopenharmony_ci#define H_PTEG_FULL	-6	/* PTEG is full */
438c2ecf20Sopenharmony_ci#define H_NOT_FOUND	-7	/* PTE was not found" */
448c2ecf20Sopenharmony_ci#define H_RESERVED_DABR	-8	/* DABR address is reserved by the hypervisor on this processor" */
458c2ecf20Sopenharmony_ci#define H_NO_MEM	-9
468c2ecf20Sopenharmony_ci#define H_AUTHORITY	-10
478c2ecf20Sopenharmony_ci#define H_PERMISSION	-11
488c2ecf20Sopenharmony_ci#define H_DROPPED	-12
498c2ecf20Sopenharmony_ci#define H_SOURCE_PARM	-13
508c2ecf20Sopenharmony_ci#define H_DEST_PARM	-14
518c2ecf20Sopenharmony_ci#define H_REMOTE_PARM	-15
528c2ecf20Sopenharmony_ci#define H_RESOURCE	-16
538c2ecf20Sopenharmony_ci#define H_ADAPTER_PARM  -17
548c2ecf20Sopenharmony_ci#define H_RH_PARM       -18
558c2ecf20Sopenharmony_ci#define H_RCQ_PARM      -19
568c2ecf20Sopenharmony_ci#define H_SCQ_PARM      -20
578c2ecf20Sopenharmony_ci#define H_EQ_PARM       -21
588c2ecf20Sopenharmony_ci#define H_RT_PARM       -22
598c2ecf20Sopenharmony_ci#define H_ST_PARM       -23
608c2ecf20Sopenharmony_ci#define H_SIGT_PARM     -24
618c2ecf20Sopenharmony_ci#define H_TOKEN_PARM    -25
628c2ecf20Sopenharmony_ci#define H_MLENGTH_PARM  -27
638c2ecf20Sopenharmony_ci#define H_MEM_PARM      -28
648c2ecf20Sopenharmony_ci#define H_MEM_ACCESS_PARM -29
658c2ecf20Sopenharmony_ci#define H_ATTR_PARM     -30
668c2ecf20Sopenharmony_ci#define H_PORT_PARM     -31
678c2ecf20Sopenharmony_ci#define H_MCG_PARM      -32
688c2ecf20Sopenharmony_ci#define H_VL_PARM       -33
698c2ecf20Sopenharmony_ci#define H_TSIZE_PARM    -34
708c2ecf20Sopenharmony_ci#define H_TRACE_PARM    -35
718c2ecf20Sopenharmony_ci
728c2ecf20Sopenharmony_ci#define H_MASK_PARM     -37
738c2ecf20Sopenharmony_ci#define H_MCG_FULL      -38
748c2ecf20Sopenharmony_ci#define H_ALIAS_EXIST   -39
758c2ecf20Sopenharmony_ci#define H_P_COUNTER     -40
768c2ecf20Sopenharmony_ci#define H_TABLE_FULL    -41
778c2ecf20Sopenharmony_ci#define H_ALT_TABLE     -42
788c2ecf20Sopenharmony_ci#define H_MR_CONDITION  -43
798c2ecf20Sopenharmony_ci#define H_NOT_ENOUGH_RESOURCES -44
808c2ecf20Sopenharmony_ci#define H_R_STATE       -45
818c2ecf20Sopenharmony_ci#define H_RESCINDED     -46
828c2ecf20Sopenharmony_ci#define H_P2		-55
838c2ecf20Sopenharmony_ci#define H_P3		-56
848c2ecf20Sopenharmony_ci#define H_P4		-57
858c2ecf20Sopenharmony_ci#define H_P5		-58
868c2ecf20Sopenharmony_ci#define H_P6		-59
878c2ecf20Sopenharmony_ci#define H_P7		-60
888c2ecf20Sopenharmony_ci#define H_P8		-61
898c2ecf20Sopenharmony_ci#define H_P9		-62
908c2ecf20Sopenharmony_ci#define H_TOO_BIG	-64
918c2ecf20Sopenharmony_ci#define H_UNSUPPORTED	-67
928c2ecf20Sopenharmony_ci#define H_OVERLAP	-68
938c2ecf20Sopenharmony_ci#define H_INTERRUPT	-69
948c2ecf20Sopenharmony_ci#define H_BAD_DATA	-70
958c2ecf20Sopenharmony_ci#define H_NOT_ACTIVE	-71
968c2ecf20Sopenharmony_ci#define H_SG_LIST	-72
978c2ecf20Sopenharmony_ci#define H_OP_MODE	-73
988c2ecf20Sopenharmony_ci#define H_COP_HW	-74
998c2ecf20Sopenharmony_ci#define H_STATE		-75
1008c2ecf20Sopenharmony_ci#define H_UNSUPPORTED_FLAG_START	-256
1018c2ecf20Sopenharmony_ci#define H_UNSUPPORTED_FLAG_END		-511
1028c2ecf20Sopenharmony_ci#define H_MULTI_THREADS_ACTIVE	-9005
1038c2ecf20Sopenharmony_ci#define H_OUTSTANDING_COP_OPS	-9006
1048c2ecf20Sopenharmony_ci
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_ci/* Long Busy is a condition that can be returned by the firmware
1078c2ecf20Sopenharmony_ci * when a call cannot be completed now, but the identical call
1088c2ecf20Sopenharmony_ci * should be retried later.  This prevents calls blocking in the
1098c2ecf20Sopenharmony_ci * firmware for long periods of time.  Annoyingly the firmware can return
1108c2ecf20Sopenharmony_ci * a range of return codes, hinting at how long we should wait before
1118c2ecf20Sopenharmony_ci * retrying.  If you don't care for the hint, the macro below is a good
1128c2ecf20Sopenharmony_ci * way to check for the long_busy return codes
1138c2ecf20Sopenharmony_ci */
1148c2ecf20Sopenharmony_ci#define H_IS_LONG_BUSY(x)  ((x >= H_LONG_BUSY_START_RANGE) \
1158c2ecf20Sopenharmony_ci			     && (x <= H_LONG_BUSY_END_RANGE))
1168c2ecf20Sopenharmony_ci
1178c2ecf20Sopenharmony_ci/* Flags */
1188c2ecf20Sopenharmony_ci#define H_LARGE_PAGE		(1UL<<(63-16))
1198c2ecf20Sopenharmony_ci#define H_EXACT			(1UL<<(63-24))	/* Use exact PTE or return H_PTEG_FULL */
1208c2ecf20Sopenharmony_ci#define H_R_XLATE		(1UL<<(63-25))	/* include a valid logical page num in the pte if the valid bit is set */
1218c2ecf20Sopenharmony_ci#define H_READ_4		(1UL<<(63-26))	/* Return 4 PTEs */
1228c2ecf20Sopenharmony_ci#define H_PAGE_STATE_CHANGE	(1UL<<(63-28))
1238c2ecf20Sopenharmony_ci#define H_PAGE_UNUSED		((1UL<<(63-29)) | (1UL<<(63-30)))
1248c2ecf20Sopenharmony_ci#define H_PAGE_SET_UNUSED	(H_PAGE_STATE_CHANGE | H_PAGE_UNUSED)
1258c2ecf20Sopenharmony_ci#define H_PAGE_SET_LOANED	(H_PAGE_SET_UNUSED | (1UL<<(63-31)))
1268c2ecf20Sopenharmony_ci#define H_PAGE_SET_ACTIVE	H_PAGE_STATE_CHANGE
1278c2ecf20Sopenharmony_ci#define H_AVPN			(1UL<<(63-32))	/* An avpn is provided as a sanity test */
1288c2ecf20Sopenharmony_ci#define H_ANDCOND		(1UL<<(63-33))
1298c2ecf20Sopenharmony_ci#define H_LOCAL			(1UL<<(63-35))
1308c2ecf20Sopenharmony_ci#define H_ICACHE_INVALIDATE	(1UL<<(63-40))	/* icbi, etc.  (ignored for IO pages) */
1318c2ecf20Sopenharmony_ci#define H_ICACHE_SYNCHRONIZE	(1UL<<(63-41))	/* dcbst, icbi, etc (ignored for IO pages */
1328c2ecf20Sopenharmony_ci#define H_COALESCE_CAND	(1UL<<(63-42))	/* page is a good candidate for coalescing */
1338c2ecf20Sopenharmony_ci#define H_ZERO_PAGE		(1UL<<(63-48))	/* zero the page before mapping (ignored for IO pages) */
1348c2ecf20Sopenharmony_ci#define H_COPY_PAGE		(1UL<<(63-49))
1358c2ecf20Sopenharmony_ci#define H_N			(1UL<<(63-61))
1368c2ecf20Sopenharmony_ci#define H_PP1			(1UL<<(63-62))
1378c2ecf20Sopenharmony_ci#define H_PP2			(1UL<<(63-63))
1388c2ecf20Sopenharmony_ci
1398c2ecf20Sopenharmony_ci/* Flags for H_REGISTER_VPA subfunction field */
1408c2ecf20Sopenharmony_ci#define H_VPA_FUNC_SHIFT	(63-18)	/* Bit posn of subfunction code */
1418c2ecf20Sopenharmony_ci#define H_VPA_FUNC_MASK		7UL
1428c2ecf20Sopenharmony_ci#define H_VPA_REG_VPA		1UL	/* Register Virtual Processor Area */
1438c2ecf20Sopenharmony_ci#define H_VPA_REG_DTL		2UL	/* Register Dispatch Trace Log */
1448c2ecf20Sopenharmony_ci#define H_VPA_REG_SLB		3UL	/* Register SLB shadow buffer */
1458c2ecf20Sopenharmony_ci#define H_VPA_DEREG_VPA		5UL	/* Deregister Virtual Processor Area */
1468c2ecf20Sopenharmony_ci#define H_VPA_DEREG_DTL		6UL	/* Deregister Dispatch Trace Log */
1478c2ecf20Sopenharmony_ci#define H_VPA_DEREG_SLB		7UL	/* Deregister SLB shadow buffer */
1488c2ecf20Sopenharmony_ci
1498c2ecf20Sopenharmony_ci/* VASI States */
1508c2ecf20Sopenharmony_ci#define H_VASI_INVALID          0
1518c2ecf20Sopenharmony_ci#define H_VASI_ENABLED          1
1528c2ecf20Sopenharmony_ci#define H_VASI_ABORTED          2
1538c2ecf20Sopenharmony_ci#define H_VASI_SUSPENDING       3
1548c2ecf20Sopenharmony_ci#define H_VASI_SUSPENDED        4
1558c2ecf20Sopenharmony_ci#define H_VASI_RESUMED          5
1568c2ecf20Sopenharmony_ci#define H_VASI_COMPLETED        6
1578c2ecf20Sopenharmony_ci
1588c2ecf20Sopenharmony_ci/* Each control block has to be on a 4K boundary */
1598c2ecf20Sopenharmony_ci#define H_CB_ALIGNMENT          4096
1608c2ecf20Sopenharmony_ci
1618c2ecf20Sopenharmony_ci/* pSeries hypervisor opcodes */
1628c2ecf20Sopenharmony_ci#define H_REMOVE		0x04
1638c2ecf20Sopenharmony_ci#define H_ENTER			0x08
1648c2ecf20Sopenharmony_ci#define H_READ			0x0c
1658c2ecf20Sopenharmony_ci#define H_CLEAR_MOD		0x10
1668c2ecf20Sopenharmony_ci#define H_CLEAR_REF		0x14
1678c2ecf20Sopenharmony_ci#define H_PROTECT		0x18
1688c2ecf20Sopenharmony_ci#define H_GET_TCE		0x1c
1698c2ecf20Sopenharmony_ci#define H_PUT_TCE		0x20
1708c2ecf20Sopenharmony_ci#define H_SET_SPRG0		0x24
1718c2ecf20Sopenharmony_ci#define H_SET_DABR		0x28
1728c2ecf20Sopenharmony_ci#define H_PAGE_INIT		0x2c
1738c2ecf20Sopenharmony_ci#define H_SET_ASR		0x30
1748c2ecf20Sopenharmony_ci#define H_ASR_ON		0x34
1758c2ecf20Sopenharmony_ci#define H_ASR_OFF		0x38
1768c2ecf20Sopenharmony_ci#define H_LOGICAL_CI_LOAD	0x3c
1778c2ecf20Sopenharmony_ci#define H_LOGICAL_CI_STORE	0x40
1788c2ecf20Sopenharmony_ci#define H_LOGICAL_CACHE_LOAD	0x44
1798c2ecf20Sopenharmony_ci#define H_LOGICAL_CACHE_STORE	0x48
1808c2ecf20Sopenharmony_ci#define H_LOGICAL_ICBI		0x4c
1818c2ecf20Sopenharmony_ci#define H_LOGICAL_DCBF		0x50
1828c2ecf20Sopenharmony_ci#define H_GET_TERM_CHAR		0x54
1838c2ecf20Sopenharmony_ci#define H_PUT_TERM_CHAR		0x58
1848c2ecf20Sopenharmony_ci#define H_REAL_TO_LOGICAL	0x5c
1858c2ecf20Sopenharmony_ci#define H_HYPERVISOR_DATA	0x60
1868c2ecf20Sopenharmony_ci#define H_EOI			0x64
1878c2ecf20Sopenharmony_ci#define H_CPPR			0x68
1888c2ecf20Sopenharmony_ci#define H_IPI			0x6c
1898c2ecf20Sopenharmony_ci#define H_IPOLL			0x70
1908c2ecf20Sopenharmony_ci#define H_XIRR			0x74
1918c2ecf20Sopenharmony_ci#define H_PERFMON		0x7c
1928c2ecf20Sopenharmony_ci#define H_MIGRATE_DMA		0x78
1938c2ecf20Sopenharmony_ci#define H_REGISTER_VPA		0xDC
1948c2ecf20Sopenharmony_ci#define H_CEDE			0xE0
1958c2ecf20Sopenharmony_ci#define H_CONFER		0xE4
1968c2ecf20Sopenharmony_ci#define H_PROD			0xE8
1978c2ecf20Sopenharmony_ci#define H_GET_PPP		0xEC
1988c2ecf20Sopenharmony_ci#define H_SET_PPP		0xF0
1998c2ecf20Sopenharmony_ci#define H_PURR			0xF4
2008c2ecf20Sopenharmony_ci#define H_PIC			0xF8
2018c2ecf20Sopenharmony_ci#define H_REG_CRQ		0xFC
2028c2ecf20Sopenharmony_ci#define H_FREE_CRQ		0x100
2038c2ecf20Sopenharmony_ci#define H_VIO_SIGNAL		0x104
2048c2ecf20Sopenharmony_ci#define H_SEND_CRQ		0x108
2058c2ecf20Sopenharmony_ci#define H_COPY_RDMA		0x110
2068c2ecf20Sopenharmony_ci#define H_REGISTER_LOGICAL_LAN	0x114
2078c2ecf20Sopenharmony_ci#define H_FREE_LOGICAL_LAN	0x118
2088c2ecf20Sopenharmony_ci#define H_ADD_LOGICAL_LAN_BUFFER 0x11C
2098c2ecf20Sopenharmony_ci#define H_SEND_LOGICAL_LAN	0x120
2108c2ecf20Sopenharmony_ci#define H_BULK_REMOVE		0x124
2118c2ecf20Sopenharmony_ci#define H_MULTICAST_CTRL	0x130
2128c2ecf20Sopenharmony_ci#define H_SET_XDABR		0x134
2138c2ecf20Sopenharmony_ci#define H_STUFF_TCE		0x138
2148c2ecf20Sopenharmony_ci#define H_PUT_TCE_INDIRECT	0x13C
2158c2ecf20Sopenharmony_ci#define H_CHANGE_LOGICAL_LAN_MAC 0x14C
2168c2ecf20Sopenharmony_ci#define H_VTERM_PARTNER_INFO	0x150
2178c2ecf20Sopenharmony_ci#define H_REGISTER_VTERM	0x154
2188c2ecf20Sopenharmony_ci#define H_FREE_VTERM		0x158
2198c2ecf20Sopenharmony_ci#define H_RESET_EVENTS          0x15C
2208c2ecf20Sopenharmony_ci#define H_ALLOC_RESOURCE        0x160
2218c2ecf20Sopenharmony_ci#define H_FREE_RESOURCE         0x164
2228c2ecf20Sopenharmony_ci#define H_MODIFY_QP             0x168
2238c2ecf20Sopenharmony_ci#define H_QUERY_QP              0x16C
2248c2ecf20Sopenharmony_ci#define H_REREGISTER_PMR        0x170
2258c2ecf20Sopenharmony_ci#define H_REGISTER_SMR          0x174
2268c2ecf20Sopenharmony_ci#define H_QUERY_MR              0x178
2278c2ecf20Sopenharmony_ci#define H_QUERY_MW              0x17C
2288c2ecf20Sopenharmony_ci#define H_QUERY_HCA             0x180
2298c2ecf20Sopenharmony_ci#define H_QUERY_PORT            0x184
2308c2ecf20Sopenharmony_ci#define H_MODIFY_PORT           0x188
2318c2ecf20Sopenharmony_ci#define H_DEFINE_AQP1           0x18C
2328c2ecf20Sopenharmony_ci#define H_GET_TRACE_BUFFER      0x190
2338c2ecf20Sopenharmony_ci#define H_DEFINE_AQP0           0x194
2348c2ecf20Sopenharmony_ci#define H_RESIZE_MR             0x198
2358c2ecf20Sopenharmony_ci#define H_ATTACH_MCQP           0x19C
2368c2ecf20Sopenharmony_ci#define H_DETACH_MCQP           0x1A0
2378c2ecf20Sopenharmony_ci#define H_CREATE_RPT            0x1A4
2388c2ecf20Sopenharmony_ci#define H_REMOVE_RPT            0x1A8
2398c2ecf20Sopenharmony_ci#define H_REGISTER_RPAGES       0x1AC
2408c2ecf20Sopenharmony_ci#define H_DISABLE_AND_GET       0x1B0
2418c2ecf20Sopenharmony_ci#define H_ERROR_DATA            0x1B4
2428c2ecf20Sopenharmony_ci#define H_GET_HCA_INFO          0x1B8
2438c2ecf20Sopenharmony_ci#define H_GET_PERF_COUNT        0x1BC
2448c2ecf20Sopenharmony_ci#define H_MANAGE_TRACE          0x1C0
2458c2ecf20Sopenharmony_ci#define H_GET_CPU_CHARACTERISTICS 0x1C8
2468c2ecf20Sopenharmony_ci#define H_FREE_LOGICAL_LAN_BUFFER 0x1D4
2478c2ecf20Sopenharmony_ci#define H_QUERY_INT_STATE       0x1E4
2488c2ecf20Sopenharmony_ci#define H_POLL_PENDING		0x1D8
2498c2ecf20Sopenharmony_ci#define H_ILLAN_ATTRIBUTES	0x244
2508c2ecf20Sopenharmony_ci#define H_MODIFY_HEA_QP		0x250
2518c2ecf20Sopenharmony_ci#define H_QUERY_HEA_QP		0x254
2528c2ecf20Sopenharmony_ci#define H_QUERY_HEA		0x258
2538c2ecf20Sopenharmony_ci#define H_QUERY_HEA_PORT	0x25C
2548c2ecf20Sopenharmony_ci#define H_MODIFY_HEA_PORT	0x260
2558c2ecf20Sopenharmony_ci#define H_REG_BCMC		0x264
2568c2ecf20Sopenharmony_ci#define H_DEREG_BCMC		0x268
2578c2ecf20Sopenharmony_ci#define H_REGISTER_HEA_RPAGES	0x26C
2588c2ecf20Sopenharmony_ci#define H_DISABLE_AND_GET_HEA	0x270
2598c2ecf20Sopenharmony_ci#define H_GET_HEA_INFO		0x274
2608c2ecf20Sopenharmony_ci#define H_ALLOC_HEA_RESOURCE	0x278
2618c2ecf20Sopenharmony_ci#define H_ADD_CONN		0x284
2628c2ecf20Sopenharmony_ci#define H_DEL_CONN		0x288
2638c2ecf20Sopenharmony_ci#define H_JOIN			0x298
2648c2ecf20Sopenharmony_ci#define H_VASI_STATE            0x2A4
2658c2ecf20Sopenharmony_ci#define H_VIOCTL		0x2A8
2668c2ecf20Sopenharmony_ci#define H_ENABLE_CRQ		0x2B0
2678c2ecf20Sopenharmony_ci#define H_GET_EM_PARMS		0x2B8
2688c2ecf20Sopenharmony_ci#define H_SET_MPP		0x2D0
2698c2ecf20Sopenharmony_ci#define H_GET_MPP		0x2D4
2708c2ecf20Sopenharmony_ci#define H_REG_SUB_CRQ		0x2DC
2718c2ecf20Sopenharmony_ci#define H_HOME_NODE_ASSOCIATIVITY 0x2EC
2728c2ecf20Sopenharmony_ci#define H_FREE_SUB_CRQ		0x2E0
2738c2ecf20Sopenharmony_ci#define H_SEND_SUB_CRQ		0x2E4
2748c2ecf20Sopenharmony_ci#define H_SEND_SUB_CRQ_INDIRECT	0x2E8
2758c2ecf20Sopenharmony_ci#define H_BEST_ENERGY		0x2F4
2768c2ecf20Sopenharmony_ci#define H_XIRR_X		0x2FC
2778c2ecf20Sopenharmony_ci#define H_RANDOM		0x300
2788c2ecf20Sopenharmony_ci#define H_COP			0x304
2798c2ecf20Sopenharmony_ci#define H_GET_MPP_X		0x314
2808c2ecf20Sopenharmony_ci#define H_SET_MODE		0x31C
2818c2ecf20Sopenharmony_ci#define H_BLOCK_REMOVE		0x328
2828c2ecf20Sopenharmony_ci#define H_CLEAR_HPT		0x358
2838c2ecf20Sopenharmony_ci#define H_REQUEST_VMC		0x360
2848c2ecf20Sopenharmony_ci#define H_RESIZE_HPT_PREPARE	0x36C
2858c2ecf20Sopenharmony_ci#define H_RESIZE_HPT_COMMIT	0x370
2868c2ecf20Sopenharmony_ci#define H_REGISTER_PROC_TBL	0x37C
2878c2ecf20Sopenharmony_ci#define H_SIGNAL_SYS_RESET	0x380
2888c2ecf20Sopenharmony_ci#define H_INT_GET_SOURCE_INFO   0x3A8
2898c2ecf20Sopenharmony_ci#define H_INT_SET_SOURCE_CONFIG 0x3AC
2908c2ecf20Sopenharmony_ci#define H_INT_GET_SOURCE_CONFIG 0x3B0
2918c2ecf20Sopenharmony_ci#define H_INT_GET_QUEUE_INFO    0x3B4
2928c2ecf20Sopenharmony_ci#define H_INT_SET_QUEUE_CONFIG  0x3B8
2938c2ecf20Sopenharmony_ci#define H_INT_GET_QUEUE_CONFIG  0x3BC
2948c2ecf20Sopenharmony_ci#define H_INT_SET_OS_REPORTING_LINE 0x3C0
2958c2ecf20Sopenharmony_ci#define H_INT_GET_OS_REPORTING_LINE 0x3C4
2968c2ecf20Sopenharmony_ci#define H_INT_ESB               0x3C8
2978c2ecf20Sopenharmony_ci#define H_INT_SYNC              0x3CC
2988c2ecf20Sopenharmony_ci#define H_INT_RESET             0x3D0
2998c2ecf20Sopenharmony_ci#define H_SCM_READ_METADATA     0x3E4
3008c2ecf20Sopenharmony_ci#define H_SCM_WRITE_METADATA    0x3E8
3018c2ecf20Sopenharmony_ci#define H_SCM_BIND_MEM          0x3EC
3028c2ecf20Sopenharmony_ci#define H_SCM_UNBIND_MEM        0x3F0
3038c2ecf20Sopenharmony_ci#define H_SCM_QUERY_BLOCK_MEM_BINDING 0x3F4
3048c2ecf20Sopenharmony_ci#define H_SCM_QUERY_LOGICAL_MEM_BINDING 0x3F8
3058c2ecf20Sopenharmony_ci#define H_SCM_UNBIND_ALL        0x3FC
3068c2ecf20Sopenharmony_ci#define H_SCM_HEALTH            0x400
3078c2ecf20Sopenharmony_ci#define H_SCM_PERFORMANCE_STATS 0x418
3088c2ecf20Sopenharmony_ci#define H_RPT_INVALIDATE	0x448
3098c2ecf20Sopenharmony_ci#define MAX_HCALL_OPCODE	H_RPT_INVALIDATE
3108c2ecf20Sopenharmony_ci
3118c2ecf20Sopenharmony_ci/* Scope args for H_SCM_UNBIND_ALL */
3128c2ecf20Sopenharmony_ci#define H_UNBIND_SCOPE_ALL (0x1)
3138c2ecf20Sopenharmony_ci#define H_UNBIND_SCOPE_DRC (0x2)
3148c2ecf20Sopenharmony_ci
3158c2ecf20Sopenharmony_ci/* H_VIOCTL functions */
3168c2ecf20Sopenharmony_ci#define H_GET_VIOA_DUMP_SIZE	0x01
3178c2ecf20Sopenharmony_ci#define H_GET_VIOA_DUMP		0x02
3188c2ecf20Sopenharmony_ci#define H_GET_ILLAN_NUM_VLAN_IDS 0x03
3198c2ecf20Sopenharmony_ci#define H_GET_ILLAN_VLAN_ID_LIST 0x04
3208c2ecf20Sopenharmony_ci#define H_GET_ILLAN_SWITCH_ID	0x05
3218c2ecf20Sopenharmony_ci#define H_DISABLE_MIGRATION	0x06
3228c2ecf20Sopenharmony_ci#define H_ENABLE_MIGRATION	0x07
3238c2ecf20Sopenharmony_ci#define H_GET_PARTNER_INFO	0x08
3248c2ecf20Sopenharmony_ci#define H_GET_PARTNER_WWPN_LIST	0x09
3258c2ecf20Sopenharmony_ci#define H_DISABLE_ALL_VIO_INTS	0x0A
3268c2ecf20Sopenharmony_ci#define H_DISABLE_VIO_INTERRUPT	0x0B
3278c2ecf20Sopenharmony_ci#define H_ENABLE_VIO_INTERRUPT	0x0C
3288c2ecf20Sopenharmony_ci#define H_GET_SESSION_TOKEN	0x19
3298c2ecf20Sopenharmony_ci#define H_SESSION_ERR_DETECTED	0x1A
3308c2ecf20Sopenharmony_ci
3318c2ecf20Sopenharmony_ci
3328c2ecf20Sopenharmony_ci/* Platform specific hcalls, used by KVM */
3338c2ecf20Sopenharmony_ci#define H_RTAS			0xf000
3348c2ecf20Sopenharmony_ci
3358c2ecf20Sopenharmony_ci/* "Platform specific hcalls", provided by PHYP */
3368c2ecf20Sopenharmony_ci#define H_GET_24X7_CATALOG_PAGE	0xF078
3378c2ecf20Sopenharmony_ci#define H_GET_24X7_DATA		0xF07C
3388c2ecf20Sopenharmony_ci#define H_GET_PERF_COUNTER_INFO	0xF080
3398c2ecf20Sopenharmony_ci
3408c2ecf20Sopenharmony_ci/* Platform-specific hcalls used for nested HV KVM */
3418c2ecf20Sopenharmony_ci#define H_SET_PARTITION_TABLE	0xF800
3428c2ecf20Sopenharmony_ci#define H_ENTER_NESTED		0xF804
3438c2ecf20Sopenharmony_ci#define H_TLB_INVALIDATE	0xF808
3448c2ecf20Sopenharmony_ci#define H_COPY_TOFROM_GUEST	0xF80C
3458c2ecf20Sopenharmony_ci
3468c2ecf20Sopenharmony_ci/* Flags for H_SVM_PAGE_IN */
3478c2ecf20Sopenharmony_ci#define H_PAGE_IN_SHARED        0x1
3488c2ecf20Sopenharmony_ci
3498c2ecf20Sopenharmony_ci/* Platform-specific hcalls used by the Ultravisor */
3508c2ecf20Sopenharmony_ci#define H_SVM_PAGE_IN		0xEF00
3518c2ecf20Sopenharmony_ci#define H_SVM_PAGE_OUT		0xEF04
3528c2ecf20Sopenharmony_ci#define H_SVM_INIT_START	0xEF08
3538c2ecf20Sopenharmony_ci#define H_SVM_INIT_DONE		0xEF0C
3548c2ecf20Sopenharmony_ci#define H_SVM_INIT_ABORT	0xEF14
3558c2ecf20Sopenharmony_ci
3568c2ecf20Sopenharmony_ci/* Values for 2nd argument to H_SET_MODE */
3578c2ecf20Sopenharmony_ci#define H_SET_MODE_RESOURCE_SET_CIABR		1
3588c2ecf20Sopenharmony_ci#define H_SET_MODE_RESOURCE_SET_DAWR0		2
3598c2ecf20Sopenharmony_ci#define H_SET_MODE_RESOURCE_ADDR_TRANS_MODE	3
3608c2ecf20Sopenharmony_ci#define H_SET_MODE_RESOURCE_LE			4
3618c2ecf20Sopenharmony_ci#define H_SET_MODE_RESOURCE_SET_DAWR1		5
3628c2ecf20Sopenharmony_ci
3638c2ecf20Sopenharmony_ci/* Values for argument to H_SIGNAL_SYS_RESET */
3648c2ecf20Sopenharmony_ci#define H_SIGNAL_SYS_RESET_ALL			-1
3658c2ecf20Sopenharmony_ci#define H_SIGNAL_SYS_RESET_ALL_OTHERS		-2
3668c2ecf20Sopenharmony_ci/* >= 0 values are CPU number */
3678c2ecf20Sopenharmony_ci
3688c2ecf20Sopenharmony_ci/* H_GET_CPU_CHARACTERISTICS return values */
3698c2ecf20Sopenharmony_ci#define H_CPU_CHAR_SPEC_BAR_ORI31	(1ull << 63) // IBM bit 0
3708c2ecf20Sopenharmony_ci#define H_CPU_CHAR_BCCTRL_SERIALISED	(1ull << 62) // IBM bit 1
3718c2ecf20Sopenharmony_ci#define H_CPU_CHAR_L1D_FLUSH_ORI30	(1ull << 61) // IBM bit 2
3728c2ecf20Sopenharmony_ci#define H_CPU_CHAR_L1D_FLUSH_TRIG2	(1ull << 60) // IBM bit 3
3738c2ecf20Sopenharmony_ci#define H_CPU_CHAR_L1D_THREAD_PRIV	(1ull << 59) // IBM bit 4
3748c2ecf20Sopenharmony_ci#define H_CPU_CHAR_BRANCH_HINTS_HONORED	(1ull << 58) // IBM bit 5
3758c2ecf20Sopenharmony_ci#define H_CPU_CHAR_THREAD_RECONFIG_CTRL	(1ull << 57) // IBM bit 6
3768c2ecf20Sopenharmony_ci#define H_CPU_CHAR_COUNT_CACHE_DISABLED	(1ull << 56) // IBM bit 7
3778c2ecf20Sopenharmony_ci#define H_CPU_CHAR_BCCTR_FLUSH_ASSIST	(1ull << 54) // IBM bit 9
3788c2ecf20Sopenharmony_ci#define H_CPU_CHAR_BCCTR_LINK_FLUSH_ASSIST (1ull << 52) // IBM bit 11
3798c2ecf20Sopenharmony_ci
3808c2ecf20Sopenharmony_ci#define H_CPU_BEHAV_FAVOUR_SECURITY	(1ull << 63) // IBM bit 0
3818c2ecf20Sopenharmony_ci#define H_CPU_BEHAV_L1D_FLUSH_PR	(1ull << 62) // IBM bit 1
3828c2ecf20Sopenharmony_ci#define H_CPU_BEHAV_BNDS_CHK_SPEC_BAR	(1ull << 61) // IBM bit 2
3838c2ecf20Sopenharmony_ci#define H_CPU_BEHAV_FLUSH_COUNT_CACHE	(1ull << 58) // IBM bit 5
3848c2ecf20Sopenharmony_ci#define H_CPU_BEHAV_FLUSH_LINK_STACK	(1ull << 57) // IBM bit 6
3858c2ecf20Sopenharmony_ci#define H_CPU_BEHAV_NO_L1D_FLUSH_ENTRY	(1ull << 56) // IBM bit 7
3868c2ecf20Sopenharmony_ci#define H_CPU_BEHAV_NO_L1D_FLUSH_UACCESS (1ull << 55) // IBM bit 8
3878c2ecf20Sopenharmony_ci
3888c2ecf20Sopenharmony_ci/* Flag values used in H_REGISTER_PROC_TBL hcall */
3898c2ecf20Sopenharmony_ci#define PROC_TABLE_OP_MASK	0x18
3908c2ecf20Sopenharmony_ci#define PROC_TABLE_DEREG	0x10
3918c2ecf20Sopenharmony_ci#define PROC_TABLE_NEW		0x18
3928c2ecf20Sopenharmony_ci#define PROC_TABLE_TYPE_MASK	0x06
3938c2ecf20Sopenharmony_ci#define PROC_TABLE_HPT_SLB	0x00
3948c2ecf20Sopenharmony_ci#define PROC_TABLE_HPT_PT	0x02
3958c2ecf20Sopenharmony_ci#define PROC_TABLE_RADIX	0x04
3968c2ecf20Sopenharmony_ci#define PROC_TABLE_GTSE		0x01
3978c2ecf20Sopenharmony_ci
3988c2ecf20Sopenharmony_ci/*
3998c2ecf20Sopenharmony_ci * Defines for
4008c2ecf20Sopenharmony_ci * H_RPT_INVALIDATE - Invalidate RPT translation lookaside information.
4018c2ecf20Sopenharmony_ci */
4028c2ecf20Sopenharmony_ci
4038c2ecf20Sopenharmony_ci/* Type of translation to invalidate (type) */
4048c2ecf20Sopenharmony_ci#define H_RPTI_TYPE_NESTED	0x0001	/* Invalidate nested guest partition-scope */
4058c2ecf20Sopenharmony_ci#define H_RPTI_TYPE_TLB		0x0002	/* Invalidate TLB */
4068c2ecf20Sopenharmony_ci#define H_RPTI_TYPE_PWC		0x0004	/* Invalidate Page Walk Cache */
4078c2ecf20Sopenharmony_ci/* Invalidate Process Table Entries if H_RPTI_TYPE_NESTED is clear */
4088c2ecf20Sopenharmony_ci#define H_RPTI_TYPE_PRT		0x0008
4098c2ecf20Sopenharmony_ci/* Invalidate Partition Table Entries if H_RPTI_TYPE_NESTED is set */
4108c2ecf20Sopenharmony_ci#define H_RPTI_TYPE_PAT		0x0008
4118c2ecf20Sopenharmony_ci#define H_RPTI_TYPE_ALL		(H_RPTI_TYPE_TLB | H_RPTI_TYPE_PWC | \
4128c2ecf20Sopenharmony_ci				 H_RPTI_TYPE_PRT)
4138c2ecf20Sopenharmony_ci#define H_RPTI_TYPE_NESTED_ALL	(H_RPTI_TYPE_TLB | H_RPTI_TYPE_PWC | \
4148c2ecf20Sopenharmony_ci				 H_RPTI_TYPE_PAT)
4158c2ecf20Sopenharmony_ci
4168c2ecf20Sopenharmony_ci/* Invalidation targets (target) */
4178c2ecf20Sopenharmony_ci#define H_RPTI_TARGET_CMMU		0x01 /* All virtual processors in the partition */
4188c2ecf20Sopenharmony_ci#define H_RPTI_TARGET_CMMU_LOCAL	0x02 /* Current virtual processor */
4198c2ecf20Sopenharmony_ci/* All nest/accelerator agents in use by the partition */
4208c2ecf20Sopenharmony_ci#define H_RPTI_TARGET_NMMU		0x04
4218c2ecf20Sopenharmony_ci
4228c2ecf20Sopenharmony_ci/* Page size mask (page sizes) */
4238c2ecf20Sopenharmony_ci#define H_RPTI_PAGE_4K	0x01
4248c2ecf20Sopenharmony_ci#define H_RPTI_PAGE_64K	0x02
4258c2ecf20Sopenharmony_ci#define H_RPTI_PAGE_2M	0x04
4268c2ecf20Sopenharmony_ci#define H_RPTI_PAGE_1G	0x08
4278c2ecf20Sopenharmony_ci#define H_RPTI_PAGE_ALL (-1UL)
4288c2ecf20Sopenharmony_ci
4298c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__
4308c2ecf20Sopenharmony_ci#include <linux/types.h>
4318c2ecf20Sopenharmony_ci
4328c2ecf20Sopenharmony_ci/**
4338c2ecf20Sopenharmony_ci * plpar_hcall_norets: - Make a pseries hypervisor call with no return arguments
4348c2ecf20Sopenharmony_ci * @opcode: The hypervisor call to make.
4358c2ecf20Sopenharmony_ci *
4368c2ecf20Sopenharmony_ci * This call supports up to 7 arguments and only returns the status of
4378c2ecf20Sopenharmony_ci * the hcall. Use this version where possible, its slightly faster than
4388c2ecf20Sopenharmony_ci * the other plpar_hcalls.
4398c2ecf20Sopenharmony_ci */
4408c2ecf20Sopenharmony_cilong plpar_hcall_norets(unsigned long opcode, ...);
4418c2ecf20Sopenharmony_ci
4428c2ecf20Sopenharmony_ci/* Variant which does not do hcall tracing */
4438c2ecf20Sopenharmony_cilong plpar_hcall_norets_notrace(unsigned long opcode, ...);
4448c2ecf20Sopenharmony_ci
4458c2ecf20Sopenharmony_ci/**
4468c2ecf20Sopenharmony_ci * plpar_hcall: - Make a pseries hypervisor call
4478c2ecf20Sopenharmony_ci * @opcode: The hypervisor call to make.
4488c2ecf20Sopenharmony_ci * @retbuf: Buffer to store up to 4 return arguments in.
4498c2ecf20Sopenharmony_ci *
4508c2ecf20Sopenharmony_ci * This call supports up to 6 arguments and 4 return arguments. Use
4518c2ecf20Sopenharmony_ci * PLPAR_HCALL_BUFSIZE to size the return argument buffer.
4528c2ecf20Sopenharmony_ci *
4538c2ecf20Sopenharmony_ci * Used for all but the craziest of phyp interfaces (see plpar_hcall9)
4548c2ecf20Sopenharmony_ci */
4558c2ecf20Sopenharmony_ci#define PLPAR_HCALL_BUFSIZE 4
4568c2ecf20Sopenharmony_cilong plpar_hcall(unsigned long opcode, unsigned long *retbuf, ...);
4578c2ecf20Sopenharmony_ci
4588c2ecf20Sopenharmony_ci/**
4598c2ecf20Sopenharmony_ci * plpar_hcall_raw: - Make a hypervisor call without calculating hcall stats
4608c2ecf20Sopenharmony_ci * @opcode: The hypervisor call to make.
4618c2ecf20Sopenharmony_ci * @retbuf: Buffer to store up to 4 return arguments in.
4628c2ecf20Sopenharmony_ci *
4638c2ecf20Sopenharmony_ci * This call supports up to 6 arguments and 4 return arguments. Use
4648c2ecf20Sopenharmony_ci * PLPAR_HCALL_BUFSIZE to size the return argument buffer.
4658c2ecf20Sopenharmony_ci *
4668c2ecf20Sopenharmony_ci * Used when phyp interface needs to be called in real mode. Similar to
4678c2ecf20Sopenharmony_ci * plpar_hcall, but plpar_hcall_raw works in real mode and does not
4688c2ecf20Sopenharmony_ci * calculate hypervisor call statistics.
4698c2ecf20Sopenharmony_ci */
4708c2ecf20Sopenharmony_cilong plpar_hcall_raw(unsigned long opcode, unsigned long *retbuf, ...);
4718c2ecf20Sopenharmony_ci
4728c2ecf20Sopenharmony_ci/**
4738c2ecf20Sopenharmony_ci * plpar_hcall9: - Make a pseries hypervisor call with up to 9 return arguments
4748c2ecf20Sopenharmony_ci * @opcode: The hypervisor call to make.
4758c2ecf20Sopenharmony_ci * @retbuf: Buffer to store up to 9 return arguments in.
4768c2ecf20Sopenharmony_ci *
4778c2ecf20Sopenharmony_ci * This call supports up to 9 arguments and 9 return arguments. Use
4788c2ecf20Sopenharmony_ci * PLPAR_HCALL9_BUFSIZE to size the return argument buffer.
4798c2ecf20Sopenharmony_ci */
4808c2ecf20Sopenharmony_ci#define PLPAR_HCALL9_BUFSIZE 9
4818c2ecf20Sopenharmony_cilong plpar_hcall9(unsigned long opcode, unsigned long *retbuf, ...);
4828c2ecf20Sopenharmony_cilong plpar_hcall9_raw(unsigned long opcode, unsigned long *retbuf, ...);
4838c2ecf20Sopenharmony_ci
4848c2ecf20Sopenharmony_cistruct hvcall_mpp_data {
4858c2ecf20Sopenharmony_ci	unsigned long entitled_mem;
4868c2ecf20Sopenharmony_ci	unsigned long mapped_mem;
4878c2ecf20Sopenharmony_ci	unsigned short group_num;
4888c2ecf20Sopenharmony_ci	unsigned short pool_num;
4898c2ecf20Sopenharmony_ci	unsigned char mem_weight;
4908c2ecf20Sopenharmony_ci	unsigned char unallocated_mem_weight;
4918c2ecf20Sopenharmony_ci	unsigned long unallocated_entitlement;  /* value in bytes */
4928c2ecf20Sopenharmony_ci	unsigned long pool_size;
4938c2ecf20Sopenharmony_ci	signed long loan_request;
4948c2ecf20Sopenharmony_ci	unsigned long backing_mem;
4958c2ecf20Sopenharmony_ci};
4968c2ecf20Sopenharmony_ci
4978c2ecf20Sopenharmony_ciint h_get_mpp(struct hvcall_mpp_data *);
4988c2ecf20Sopenharmony_ci
4998c2ecf20Sopenharmony_cistruct hvcall_mpp_x_data {
5008c2ecf20Sopenharmony_ci	unsigned long coalesced_bytes;
5018c2ecf20Sopenharmony_ci	unsigned long pool_coalesced_bytes;
5028c2ecf20Sopenharmony_ci	unsigned long pool_purr_cycles;
5038c2ecf20Sopenharmony_ci	unsigned long pool_spurr_cycles;
5048c2ecf20Sopenharmony_ci	unsigned long reserved[3];
5058c2ecf20Sopenharmony_ci};
5068c2ecf20Sopenharmony_ci
5078c2ecf20Sopenharmony_ciint h_get_mpp_x(struct hvcall_mpp_x_data *mpp_x_data);
5088c2ecf20Sopenharmony_ci
5098c2ecf20Sopenharmony_cistatic inline unsigned int get_longbusy_msecs(int longbusy_rc)
5108c2ecf20Sopenharmony_ci{
5118c2ecf20Sopenharmony_ci	switch (longbusy_rc) {
5128c2ecf20Sopenharmony_ci	case H_LONG_BUSY_ORDER_1_MSEC:
5138c2ecf20Sopenharmony_ci		return 1;
5148c2ecf20Sopenharmony_ci	case H_LONG_BUSY_ORDER_10_MSEC:
5158c2ecf20Sopenharmony_ci		return 10;
5168c2ecf20Sopenharmony_ci	case H_LONG_BUSY_ORDER_100_MSEC:
5178c2ecf20Sopenharmony_ci		return 100;
5188c2ecf20Sopenharmony_ci	case H_LONG_BUSY_ORDER_1_SEC:
5198c2ecf20Sopenharmony_ci		return 1000;
5208c2ecf20Sopenharmony_ci	case H_LONG_BUSY_ORDER_10_SEC:
5218c2ecf20Sopenharmony_ci		return 10000;
5228c2ecf20Sopenharmony_ci	case H_LONG_BUSY_ORDER_100_SEC:
5238c2ecf20Sopenharmony_ci		return 100000;
5248c2ecf20Sopenharmony_ci	default:
5258c2ecf20Sopenharmony_ci		return 1;
5268c2ecf20Sopenharmony_ci	}
5278c2ecf20Sopenharmony_ci}
5288c2ecf20Sopenharmony_ci
5298c2ecf20Sopenharmony_cistruct h_cpu_char_result {
5308c2ecf20Sopenharmony_ci	u64 character;
5318c2ecf20Sopenharmony_ci	u64 behaviour;
5328c2ecf20Sopenharmony_ci};
5338c2ecf20Sopenharmony_ci
5348c2ecf20Sopenharmony_ci/* Register state for entering a nested guest with H_ENTER_NESTED */
5358c2ecf20Sopenharmony_cistruct hv_guest_state {
5368c2ecf20Sopenharmony_ci	u64 version;		/* version of this structure layout */
5378c2ecf20Sopenharmony_ci	u32 lpid;
5388c2ecf20Sopenharmony_ci	u32 vcpu_token;
5398c2ecf20Sopenharmony_ci	/* These registers are hypervisor privileged (at least for writing) */
5408c2ecf20Sopenharmony_ci	u64 lpcr;
5418c2ecf20Sopenharmony_ci	u64 pcr;
5428c2ecf20Sopenharmony_ci	u64 amor;
5438c2ecf20Sopenharmony_ci	u64 dpdes;
5448c2ecf20Sopenharmony_ci	u64 hfscr;
5458c2ecf20Sopenharmony_ci	s64 tb_offset;
5468c2ecf20Sopenharmony_ci	u64 dawr0;
5478c2ecf20Sopenharmony_ci	u64 dawrx0;
5488c2ecf20Sopenharmony_ci	u64 ciabr;
5498c2ecf20Sopenharmony_ci	u64 hdec_expiry;
5508c2ecf20Sopenharmony_ci	u64 purr;
5518c2ecf20Sopenharmony_ci	u64 spurr;
5528c2ecf20Sopenharmony_ci	u64 ic;
5538c2ecf20Sopenharmony_ci	u64 vtb;
5548c2ecf20Sopenharmony_ci	u64 hdar;
5558c2ecf20Sopenharmony_ci	u64 hdsisr;
5568c2ecf20Sopenharmony_ci	u64 heir;
5578c2ecf20Sopenharmony_ci	u64 asdr;
5588c2ecf20Sopenharmony_ci	/* These are OS privileged but need to be set late in guest entry */
5598c2ecf20Sopenharmony_ci	u64 srr0;
5608c2ecf20Sopenharmony_ci	u64 srr1;
5618c2ecf20Sopenharmony_ci	u64 sprg[4];
5628c2ecf20Sopenharmony_ci	u64 pidr;
5638c2ecf20Sopenharmony_ci	u64 cfar;
5648c2ecf20Sopenharmony_ci	u64 ppr;
5658c2ecf20Sopenharmony_ci};
5668c2ecf20Sopenharmony_ci
5678c2ecf20Sopenharmony_ci/* Latest version of hv_guest_state structure */
5688c2ecf20Sopenharmony_ci#define HV_GUEST_STATE_VERSION	1
5698c2ecf20Sopenharmony_ci
5708c2ecf20Sopenharmony_ci/*
5718c2ecf20Sopenharmony_ci * From the document "H_GetPerformanceCounterInfo Interface" v1.07
5728c2ecf20Sopenharmony_ci *
5738c2ecf20Sopenharmony_ci * H_GET_PERF_COUNTER_INFO argument
5748c2ecf20Sopenharmony_ci */
5758c2ecf20Sopenharmony_cistruct hv_get_perf_counter_info_params {
5768c2ecf20Sopenharmony_ci	__be32 counter_request; /* I */
5778c2ecf20Sopenharmony_ci	__be32 starting_index;  /* IO */
5788c2ecf20Sopenharmony_ci	__be16 secondary_index; /* IO */
5798c2ecf20Sopenharmony_ci	__be16 returned_values; /* O */
5808c2ecf20Sopenharmony_ci	__be32 detail_rc; /* O, only needed when called via *_norets() */
5818c2ecf20Sopenharmony_ci
5828c2ecf20Sopenharmony_ci	/*
5838c2ecf20Sopenharmony_ci	 * O, size each of counter_value element in bytes, only set for version
5848c2ecf20Sopenharmony_ci	 * >= 0x3
5858c2ecf20Sopenharmony_ci	 */
5868c2ecf20Sopenharmony_ci	__be16 cv_element_size;
5878c2ecf20Sopenharmony_ci
5888c2ecf20Sopenharmony_ci	/* I, 0 (zero) for versions < 0x3 */
5898c2ecf20Sopenharmony_ci	__u8 counter_info_version_in;
5908c2ecf20Sopenharmony_ci
5918c2ecf20Sopenharmony_ci	/* O, 0 (zero) if version < 0x3. Must be set to 0 when making hcall */
5928c2ecf20Sopenharmony_ci	__u8 counter_info_version_out;
5938c2ecf20Sopenharmony_ci	__u8 reserved[0xC];
5948c2ecf20Sopenharmony_ci	__u8 counter_value[];
5958c2ecf20Sopenharmony_ci} __packed;
5968c2ecf20Sopenharmony_ci
5978c2ecf20Sopenharmony_ci#define HGPCI_REQ_BUFFER_SIZE	4096
5988c2ecf20Sopenharmony_ci#define HGPCI_MAX_DATA_BYTES \
5998c2ecf20Sopenharmony_ci	(HGPCI_REQ_BUFFER_SIZE - sizeof(struct hv_get_perf_counter_info_params))
6008c2ecf20Sopenharmony_ci
6018c2ecf20Sopenharmony_cistruct hv_gpci_request_buffer {
6028c2ecf20Sopenharmony_ci	struct hv_get_perf_counter_info_params params;
6038c2ecf20Sopenharmony_ci	uint8_t bytes[HGPCI_MAX_DATA_BYTES];
6048c2ecf20Sopenharmony_ci} __packed;
6058c2ecf20Sopenharmony_ci
6068c2ecf20Sopenharmony_ci#endif /* __ASSEMBLY__ */
6078c2ecf20Sopenharmony_ci#endif /* __KERNEL__ */
6088c2ecf20Sopenharmony_ci#endif /* _ASM_POWERPC_HVCALL_H */
609