162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci#ifndef _ASM_POWERPC_HVCALL_H 362306a36Sopenharmony_ci#define _ASM_POWERPC_HVCALL_H 462306a36Sopenharmony_ci#ifdef __KERNEL__ 562306a36Sopenharmony_ci 662306a36Sopenharmony_ci#define HVSC .long 0x44000022 762306a36Sopenharmony_ci 862306a36Sopenharmony_ci#define H_SUCCESS 0 962306a36Sopenharmony_ci#define H_BUSY 1 /* Hardware busy -- retry later */ 1062306a36Sopenharmony_ci#define H_CLOSED 2 /* Resource closed */ 1162306a36Sopenharmony_ci#define H_NOT_AVAILABLE 3 1262306a36Sopenharmony_ci#define H_CONSTRAINED 4 /* Resource request constrained to max allowed */ 1362306a36Sopenharmony_ci#define H_PARTIAL 5 1462306a36Sopenharmony_ci#define H_IN_PROGRESS 14 /* Kind of like busy */ 1562306a36Sopenharmony_ci#define H_PAGE_REGISTERED 15 1662306a36Sopenharmony_ci#define H_PARTIAL_STORE 16 1762306a36Sopenharmony_ci#define H_PENDING 17 /* returned from H_POLL_PENDING */ 1862306a36Sopenharmony_ci#define H_CONTINUE 18 /* Returned from H_Join on success */ 1962306a36Sopenharmony_ci#define H_LONG_BUSY_START_RANGE 9900 /* Start of long busy range */ 2062306a36Sopenharmony_ci#define H_LONG_BUSY_ORDER_1_MSEC 9900 /* Long busy, hint that 1msec \ 2162306a36Sopenharmony_ci is a good time to retry */ 2262306a36Sopenharmony_ci#define H_LONG_BUSY_ORDER_10_MSEC 9901 /* Long busy, hint that 10msec \ 2362306a36Sopenharmony_ci is a good time to retry */ 2462306a36Sopenharmony_ci#define H_LONG_BUSY_ORDER_100_MSEC 9902 /* Long busy, hint that 100msec \ 2562306a36Sopenharmony_ci is a good time to retry */ 2662306a36Sopenharmony_ci#define H_LONG_BUSY_ORDER_1_SEC 9903 /* Long busy, hint that 1sec \ 2762306a36Sopenharmony_ci is a good time to retry */ 2862306a36Sopenharmony_ci#define H_LONG_BUSY_ORDER_10_SEC 9904 /* Long busy, hint that 10sec \ 2962306a36Sopenharmony_ci is a good time to retry */ 3062306a36Sopenharmony_ci#define H_LONG_BUSY_ORDER_100_SEC 9905 /* Long busy, hint that 100sec \ 3162306a36Sopenharmony_ci is a good time to retry */ 3262306a36Sopenharmony_ci#define H_LONG_BUSY_END_RANGE 9905 /* End of long busy range */ 3362306a36Sopenharmony_ci 3462306a36Sopenharmony_ci/* Internal value used in book3s_hv kvm support; not returned to guests */ 3562306a36Sopenharmony_ci#define H_TOO_HARD 9999 3662306a36Sopenharmony_ci 3762306a36Sopenharmony_ci#define H_HARDWARE -1 /* Hardware error */ 3862306a36Sopenharmony_ci#define H_FUNCTION -2 /* Function not supported */ 3962306a36Sopenharmony_ci#define H_PRIVILEGE -3 /* Caller not privileged */ 4062306a36Sopenharmony_ci#define H_PARAMETER -4 /* Parameter invalid, out-of-range or conflicting */ 4162306a36Sopenharmony_ci#define H_BAD_MODE -5 /* Illegal msr value */ 4262306a36Sopenharmony_ci#define H_PTEG_FULL -6 /* PTEG is full */ 4362306a36Sopenharmony_ci#define H_NOT_FOUND -7 /* PTE was not found" */ 4462306a36Sopenharmony_ci#define H_RESERVED_DABR -8 /* DABR address is reserved by the hypervisor on this processor" */ 4562306a36Sopenharmony_ci#define H_NO_MEM -9 4662306a36Sopenharmony_ci#define H_AUTHORITY -10 4762306a36Sopenharmony_ci#define H_PERMISSION -11 4862306a36Sopenharmony_ci#define H_DROPPED -12 4962306a36Sopenharmony_ci#define H_SOURCE_PARM -13 5062306a36Sopenharmony_ci#define H_DEST_PARM -14 5162306a36Sopenharmony_ci#define H_REMOTE_PARM -15 5262306a36Sopenharmony_ci#define H_RESOURCE -16 5362306a36Sopenharmony_ci#define H_ADAPTER_PARM -17 5462306a36Sopenharmony_ci#define H_RH_PARM -18 5562306a36Sopenharmony_ci#define H_RCQ_PARM -19 5662306a36Sopenharmony_ci#define H_SCQ_PARM -20 5762306a36Sopenharmony_ci#define H_EQ_PARM -21 5862306a36Sopenharmony_ci#define H_RT_PARM -22 5962306a36Sopenharmony_ci#define H_ST_PARM -23 6062306a36Sopenharmony_ci#define H_SIGT_PARM -24 6162306a36Sopenharmony_ci#define H_TOKEN_PARM -25 6262306a36Sopenharmony_ci#define H_MLENGTH_PARM -27 6362306a36Sopenharmony_ci#define H_MEM_PARM -28 6462306a36Sopenharmony_ci#define H_MEM_ACCESS_PARM -29 6562306a36Sopenharmony_ci#define H_ATTR_PARM -30 6662306a36Sopenharmony_ci#define H_PORT_PARM -31 6762306a36Sopenharmony_ci#define H_MCG_PARM -32 6862306a36Sopenharmony_ci#define H_VL_PARM -33 6962306a36Sopenharmony_ci#define H_TSIZE_PARM -34 7062306a36Sopenharmony_ci#define H_TRACE_PARM -35 7162306a36Sopenharmony_ci 7262306a36Sopenharmony_ci#define H_MASK_PARM -37 7362306a36Sopenharmony_ci#define H_MCG_FULL -38 7462306a36Sopenharmony_ci#define H_ALIAS_EXIST -39 7562306a36Sopenharmony_ci#define H_P_COUNTER -40 7662306a36Sopenharmony_ci#define H_TABLE_FULL -41 7762306a36Sopenharmony_ci#define H_ALT_TABLE -42 7862306a36Sopenharmony_ci#define H_MR_CONDITION -43 7962306a36Sopenharmony_ci#define H_NOT_ENOUGH_RESOURCES -44 8062306a36Sopenharmony_ci#define H_R_STATE -45 8162306a36Sopenharmony_ci#define H_RESCINDED -46 8262306a36Sopenharmony_ci#define H_ABORTED -54 8362306a36Sopenharmony_ci#define H_P2 -55 8462306a36Sopenharmony_ci#define H_P3 -56 8562306a36Sopenharmony_ci#define H_P4 -57 8662306a36Sopenharmony_ci#define H_P5 -58 8762306a36Sopenharmony_ci#define H_P6 -59 8862306a36Sopenharmony_ci#define H_P7 -60 8962306a36Sopenharmony_ci#define H_P8 -61 9062306a36Sopenharmony_ci#define H_P9 -62 9162306a36Sopenharmony_ci#define H_NOOP -63 9262306a36Sopenharmony_ci#define H_TOO_BIG -64 9362306a36Sopenharmony_ci#define H_UNSUPPORTED -67 9462306a36Sopenharmony_ci#define H_OVERLAP -68 9562306a36Sopenharmony_ci#define H_INTERRUPT -69 9662306a36Sopenharmony_ci#define H_BAD_DATA -70 9762306a36Sopenharmony_ci#define H_NOT_ACTIVE -71 9862306a36Sopenharmony_ci#define H_SG_LIST -72 9962306a36Sopenharmony_ci#define H_OP_MODE -73 10062306a36Sopenharmony_ci#define H_COP_HW -74 10162306a36Sopenharmony_ci#define H_STATE -75 10262306a36Sopenharmony_ci#define H_IN_USE -77 10362306a36Sopenharmony_ci#define H_UNSUPPORTED_FLAG_START -256 10462306a36Sopenharmony_ci#define H_UNSUPPORTED_FLAG_END -511 10562306a36Sopenharmony_ci#define H_MULTI_THREADS_ACTIVE -9005 10662306a36Sopenharmony_ci#define H_OUTSTANDING_COP_OPS -9006 10762306a36Sopenharmony_ci 10862306a36Sopenharmony_ci 10962306a36Sopenharmony_ci/* Long Busy is a condition that can be returned by the firmware 11062306a36Sopenharmony_ci * when a call cannot be completed now, but the identical call 11162306a36Sopenharmony_ci * should be retried later. This prevents calls blocking in the 11262306a36Sopenharmony_ci * firmware for long periods of time. Annoyingly the firmware can return 11362306a36Sopenharmony_ci * a range of return codes, hinting at how long we should wait before 11462306a36Sopenharmony_ci * retrying. If you don't care for the hint, the macro below is a good 11562306a36Sopenharmony_ci * way to check for the long_busy return codes 11662306a36Sopenharmony_ci */ 11762306a36Sopenharmony_ci#define H_IS_LONG_BUSY(x) ((x >= H_LONG_BUSY_START_RANGE) \ 11862306a36Sopenharmony_ci && (x <= H_LONG_BUSY_END_RANGE)) 11962306a36Sopenharmony_ci 12062306a36Sopenharmony_ci/* Flags */ 12162306a36Sopenharmony_ci#define H_LARGE_PAGE (1UL<<(63-16)) 12262306a36Sopenharmony_ci#define H_EXACT (1UL<<(63-24)) /* Use exact PTE or return H_PTEG_FULL */ 12362306a36Sopenharmony_ci#define H_R_XLATE (1UL<<(63-25)) /* include a valid logical page num in the pte if the valid bit is set */ 12462306a36Sopenharmony_ci#define H_READ_4 (1UL<<(63-26)) /* Return 4 PTEs */ 12562306a36Sopenharmony_ci#define H_PAGE_STATE_CHANGE (1UL<<(63-28)) 12662306a36Sopenharmony_ci#define H_PAGE_UNUSED ((1UL<<(63-29)) | (1UL<<(63-30))) 12762306a36Sopenharmony_ci#define H_PAGE_SET_UNUSED (H_PAGE_STATE_CHANGE | H_PAGE_UNUSED) 12862306a36Sopenharmony_ci#define H_PAGE_SET_LOANED (H_PAGE_SET_UNUSED | (1UL<<(63-31))) 12962306a36Sopenharmony_ci#define H_PAGE_SET_ACTIVE H_PAGE_STATE_CHANGE 13062306a36Sopenharmony_ci#define H_AVPN (1UL<<(63-32)) /* An avpn is provided as a sanity test */ 13162306a36Sopenharmony_ci#define H_ANDCOND (1UL<<(63-33)) 13262306a36Sopenharmony_ci#define H_LOCAL (1UL<<(63-35)) 13362306a36Sopenharmony_ci#define H_ICACHE_INVALIDATE (1UL<<(63-40)) /* icbi, etc. (ignored for IO pages) */ 13462306a36Sopenharmony_ci#define H_ICACHE_SYNCHRONIZE (1UL<<(63-41)) /* dcbst, icbi, etc (ignored for IO pages */ 13562306a36Sopenharmony_ci#define H_COALESCE_CAND (1UL<<(63-42)) /* page is a good candidate for coalescing */ 13662306a36Sopenharmony_ci#define H_ZERO_PAGE (1UL<<(63-48)) /* zero the page before mapping (ignored for IO pages) */ 13762306a36Sopenharmony_ci#define H_COPY_PAGE (1UL<<(63-49)) 13862306a36Sopenharmony_ci#define H_N (1UL<<(63-61)) 13962306a36Sopenharmony_ci#define H_PP1 (1UL<<(63-62)) 14062306a36Sopenharmony_ci#define H_PP2 (1UL<<(63-63)) 14162306a36Sopenharmony_ci 14262306a36Sopenharmony_ci/* Flags for H_REGISTER_VPA subfunction field */ 14362306a36Sopenharmony_ci#define H_VPA_FUNC_SHIFT (63-18) /* Bit posn of subfunction code */ 14462306a36Sopenharmony_ci#define H_VPA_FUNC_MASK 7UL 14562306a36Sopenharmony_ci#define H_VPA_REG_VPA 1UL /* Register Virtual Processor Area */ 14662306a36Sopenharmony_ci#define H_VPA_REG_DTL 2UL /* Register Dispatch Trace Log */ 14762306a36Sopenharmony_ci#define H_VPA_REG_SLB 3UL /* Register SLB shadow buffer */ 14862306a36Sopenharmony_ci#define H_VPA_DEREG_VPA 5UL /* Deregister Virtual Processor Area */ 14962306a36Sopenharmony_ci#define H_VPA_DEREG_DTL 6UL /* Deregister Dispatch Trace Log */ 15062306a36Sopenharmony_ci#define H_VPA_DEREG_SLB 7UL /* Deregister SLB shadow buffer */ 15162306a36Sopenharmony_ci 15262306a36Sopenharmony_ci/* VASI States */ 15362306a36Sopenharmony_ci#define H_VASI_INVALID 0 15462306a36Sopenharmony_ci#define H_VASI_ENABLED 1 15562306a36Sopenharmony_ci#define H_VASI_ABORTED 2 15662306a36Sopenharmony_ci#define H_VASI_SUSPENDING 3 15762306a36Sopenharmony_ci#define H_VASI_SUSPENDED 4 15862306a36Sopenharmony_ci#define H_VASI_RESUMED 5 15962306a36Sopenharmony_ci#define H_VASI_COMPLETED 6 16062306a36Sopenharmony_ci 16162306a36Sopenharmony_ci/* VASI signal codes. Only the Cancel code is valid for H_VASI_SIGNAL. */ 16262306a36Sopenharmony_ci#define H_VASI_SIGNAL_CANCEL 1 16362306a36Sopenharmony_ci#define H_VASI_SIGNAL_ABORT 2 16462306a36Sopenharmony_ci#define H_VASI_SIGNAL_SUSPEND 3 16562306a36Sopenharmony_ci#define H_VASI_SIGNAL_COMPLETE 4 16662306a36Sopenharmony_ci#define H_VASI_SIGNAL_ENABLE 5 16762306a36Sopenharmony_ci#define H_VASI_SIGNAL_FAILOVER 6 16862306a36Sopenharmony_ci 16962306a36Sopenharmony_ci/* Each control block has to be on a 4K boundary */ 17062306a36Sopenharmony_ci#define H_CB_ALIGNMENT 4096 17162306a36Sopenharmony_ci 17262306a36Sopenharmony_ci/* pSeries hypervisor opcodes */ 17362306a36Sopenharmony_ci#define H_REMOVE 0x04 17462306a36Sopenharmony_ci#define H_ENTER 0x08 17562306a36Sopenharmony_ci#define H_READ 0x0c 17662306a36Sopenharmony_ci#define H_CLEAR_MOD 0x10 17762306a36Sopenharmony_ci#define H_CLEAR_REF 0x14 17862306a36Sopenharmony_ci#define H_PROTECT 0x18 17962306a36Sopenharmony_ci#define H_GET_TCE 0x1c 18062306a36Sopenharmony_ci#define H_PUT_TCE 0x20 18162306a36Sopenharmony_ci#define H_SET_SPRG0 0x24 18262306a36Sopenharmony_ci#define H_SET_DABR 0x28 18362306a36Sopenharmony_ci#define H_PAGE_INIT 0x2c 18462306a36Sopenharmony_ci#define H_SET_ASR 0x30 18562306a36Sopenharmony_ci#define H_ASR_ON 0x34 18662306a36Sopenharmony_ci#define H_ASR_OFF 0x38 18762306a36Sopenharmony_ci#define H_LOGICAL_CI_LOAD 0x3c 18862306a36Sopenharmony_ci#define H_LOGICAL_CI_STORE 0x40 18962306a36Sopenharmony_ci#define H_LOGICAL_CACHE_LOAD 0x44 19062306a36Sopenharmony_ci#define H_LOGICAL_CACHE_STORE 0x48 19162306a36Sopenharmony_ci#define H_LOGICAL_ICBI 0x4c 19262306a36Sopenharmony_ci#define H_LOGICAL_DCBF 0x50 19362306a36Sopenharmony_ci#define H_GET_TERM_CHAR 0x54 19462306a36Sopenharmony_ci#define H_PUT_TERM_CHAR 0x58 19562306a36Sopenharmony_ci#define H_REAL_TO_LOGICAL 0x5c 19662306a36Sopenharmony_ci#define H_HYPERVISOR_DATA 0x60 19762306a36Sopenharmony_ci#define H_EOI 0x64 19862306a36Sopenharmony_ci#define H_CPPR 0x68 19962306a36Sopenharmony_ci#define H_IPI 0x6c 20062306a36Sopenharmony_ci#define H_IPOLL 0x70 20162306a36Sopenharmony_ci#define H_XIRR 0x74 20262306a36Sopenharmony_ci#define H_PERFMON 0x7c 20362306a36Sopenharmony_ci#define H_MIGRATE_DMA 0x78 20462306a36Sopenharmony_ci#define H_REGISTER_VPA 0xDC 20562306a36Sopenharmony_ci#define H_CEDE 0xE0 20662306a36Sopenharmony_ci#define H_CONFER 0xE4 20762306a36Sopenharmony_ci#define H_PROD 0xE8 20862306a36Sopenharmony_ci#define H_GET_PPP 0xEC 20962306a36Sopenharmony_ci#define H_SET_PPP 0xF0 21062306a36Sopenharmony_ci#define H_PURR 0xF4 21162306a36Sopenharmony_ci#define H_PIC 0xF8 21262306a36Sopenharmony_ci#define H_REG_CRQ 0xFC 21362306a36Sopenharmony_ci#define H_FREE_CRQ 0x100 21462306a36Sopenharmony_ci#define H_VIO_SIGNAL 0x104 21562306a36Sopenharmony_ci#define H_SEND_CRQ 0x108 21662306a36Sopenharmony_ci#define H_COPY_RDMA 0x110 21762306a36Sopenharmony_ci#define H_REGISTER_LOGICAL_LAN 0x114 21862306a36Sopenharmony_ci#define H_FREE_LOGICAL_LAN 0x118 21962306a36Sopenharmony_ci#define H_ADD_LOGICAL_LAN_BUFFER 0x11C 22062306a36Sopenharmony_ci#define H_SEND_LOGICAL_LAN 0x120 22162306a36Sopenharmony_ci#define H_BULK_REMOVE 0x124 22262306a36Sopenharmony_ci#define H_MULTICAST_CTRL 0x130 22362306a36Sopenharmony_ci#define H_SET_XDABR 0x134 22462306a36Sopenharmony_ci#define H_STUFF_TCE 0x138 22562306a36Sopenharmony_ci#define H_PUT_TCE_INDIRECT 0x13C 22662306a36Sopenharmony_ci#define H_CHANGE_LOGICAL_LAN_MAC 0x14C 22762306a36Sopenharmony_ci#define H_VTERM_PARTNER_INFO 0x150 22862306a36Sopenharmony_ci#define H_REGISTER_VTERM 0x154 22962306a36Sopenharmony_ci#define H_FREE_VTERM 0x158 23062306a36Sopenharmony_ci#define H_RESET_EVENTS 0x15C 23162306a36Sopenharmony_ci#define H_ALLOC_RESOURCE 0x160 23262306a36Sopenharmony_ci#define H_FREE_RESOURCE 0x164 23362306a36Sopenharmony_ci#define H_MODIFY_QP 0x168 23462306a36Sopenharmony_ci#define H_QUERY_QP 0x16C 23562306a36Sopenharmony_ci#define H_REREGISTER_PMR 0x170 23662306a36Sopenharmony_ci#define H_REGISTER_SMR 0x174 23762306a36Sopenharmony_ci#define H_QUERY_MR 0x178 23862306a36Sopenharmony_ci#define H_QUERY_MW 0x17C 23962306a36Sopenharmony_ci#define H_QUERY_HCA 0x180 24062306a36Sopenharmony_ci#define H_QUERY_PORT 0x184 24162306a36Sopenharmony_ci#define H_MODIFY_PORT 0x188 24262306a36Sopenharmony_ci#define H_DEFINE_AQP1 0x18C 24362306a36Sopenharmony_ci#define H_GET_TRACE_BUFFER 0x190 24462306a36Sopenharmony_ci#define H_DEFINE_AQP0 0x194 24562306a36Sopenharmony_ci#define H_RESIZE_MR 0x198 24662306a36Sopenharmony_ci#define H_ATTACH_MCQP 0x19C 24762306a36Sopenharmony_ci#define H_DETACH_MCQP 0x1A0 24862306a36Sopenharmony_ci#define H_CREATE_RPT 0x1A4 24962306a36Sopenharmony_ci#define H_REMOVE_RPT 0x1A8 25062306a36Sopenharmony_ci#define H_REGISTER_RPAGES 0x1AC 25162306a36Sopenharmony_ci#define H_DISABLE_AND_GET 0x1B0 25262306a36Sopenharmony_ci#define H_ERROR_DATA 0x1B4 25362306a36Sopenharmony_ci#define H_GET_HCA_INFO 0x1B8 25462306a36Sopenharmony_ci#define H_GET_PERF_COUNT 0x1BC 25562306a36Sopenharmony_ci#define H_MANAGE_TRACE 0x1C0 25662306a36Sopenharmony_ci#define H_GET_CPU_CHARACTERISTICS 0x1C8 25762306a36Sopenharmony_ci#define H_FREE_LOGICAL_LAN_BUFFER 0x1D4 25862306a36Sopenharmony_ci#define H_QUERY_INT_STATE 0x1E4 25962306a36Sopenharmony_ci#define H_POLL_PENDING 0x1D8 26062306a36Sopenharmony_ci#define H_ILLAN_ATTRIBUTES 0x244 26162306a36Sopenharmony_ci#define H_MODIFY_HEA_QP 0x250 26262306a36Sopenharmony_ci#define H_QUERY_HEA_QP 0x254 26362306a36Sopenharmony_ci#define H_QUERY_HEA 0x258 26462306a36Sopenharmony_ci#define H_QUERY_HEA_PORT 0x25C 26562306a36Sopenharmony_ci#define H_MODIFY_HEA_PORT 0x260 26662306a36Sopenharmony_ci#define H_REG_BCMC 0x264 26762306a36Sopenharmony_ci#define H_DEREG_BCMC 0x268 26862306a36Sopenharmony_ci#define H_REGISTER_HEA_RPAGES 0x26C 26962306a36Sopenharmony_ci#define H_DISABLE_AND_GET_HEA 0x270 27062306a36Sopenharmony_ci#define H_GET_HEA_INFO 0x274 27162306a36Sopenharmony_ci#define H_ALLOC_HEA_RESOURCE 0x278 27262306a36Sopenharmony_ci#define H_ADD_CONN 0x284 27362306a36Sopenharmony_ci#define H_DEL_CONN 0x288 27462306a36Sopenharmony_ci#define H_JOIN 0x298 27562306a36Sopenharmony_ci#define H_VASI_SIGNAL 0x2A0 27662306a36Sopenharmony_ci#define H_VASI_STATE 0x2A4 27762306a36Sopenharmony_ci#define H_VIOCTL 0x2A8 27862306a36Sopenharmony_ci#define H_ENABLE_CRQ 0x2B0 27962306a36Sopenharmony_ci#define H_GET_EM_PARMS 0x2B8 28062306a36Sopenharmony_ci#define H_SET_MPP 0x2D0 28162306a36Sopenharmony_ci#define H_GET_MPP 0x2D4 28262306a36Sopenharmony_ci#define H_REG_SUB_CRQ 0x2DC 28362306a36Sopenharmony_ci#define H_HOME_NODE_ASSOCIATIVITY 0x2EC 28462306a36Sopenharmony_ci#define H_FREE_SUB_CRQ 0x2E0 28562306a36Sopenharmony_ci#define H_SEND_SUB_CRQ 0x2E4 28662306a36Sopenharmony_ci#define H_SEND_SUB_CRQ_INDIRECT 0x2E8 28762306a36Sopenharmony_ci#define H_BEST_ENERGY 0x2F4 28862306a36Sopenharmony_ci#define H_XIRR_X 0x2FC 28962306a36Sopenharmony_ci#define H_RANDOM 0x300 29062306a36Sopenharmony_ci#define H_COP 0x304 29162306a36Sopenharmony_ci#define H_GET_MPP_X 0x314 29262306a36Sopenharmony_ci#define H_SET_MODE 0x31C 29362306a36Sopenharmony_ci#define H_BLOCK_REMOVE 0x328 29462306a36Sopenharmony_ci#define H_CLEAR_HPT 0x358 29562306a36Sopenharmony_ci#define H_REQUEST_VMC 0x360 29662306a36Sopenharmony_ci#define H_RESIZE_HPT_PREPARE 0x36C 29762306a36Sopenharmony_ci#define H_RESIZE_HPT_COMMIT 0x370 29862306a36Sopenharmony_ci#define H_REGISTER_PROC_TBL 0x37C 29962306a36Sopenharmony_ci#define H_SIGNAL_SYS_RESET 0x380 30062306a36Sopenharmony_ci#define H_ALLOCATE_VAS_WINDOW 0x388 30162306a36Sopenharmony_ci#define H_MODIFY_VAS_WINDOW 0x38C 30262306a36Sopenharmony_ci#define H_DEALLOCATE_VAS_WINDOW 0x390 30362306a36Sopenharmony_ci#define H_QUERY_VAS_WINDOW 0x394 30462306a36Sopenharmony_ci#define H_QUERY_VAS_CAPABILITIES 0x398 30562306a36Sopenharmony_ci#define H_QUERY_NX_CAPABILITIES 0x39C 30662306a36Sopenharmony_ci#define H_GET_NX_FAULT 0x3A0 30762306a36Sopenharmony_ci#define H_INT_GET_SOURCE_INFO 0x3A8 30862306a36Sopenharmony_ci#define H_INT_SET_SOURCE_CONFIG 0x3AC 30962306a36Sopenharmony_ci#define H_INT_GET_SOURCE_CONFIG 0x3B0 31062306a36Sopenharmony_ci#define H_INT_GET_QUEUE_INFO 0x3B4 31162306a36Sopenharmony_ci#define H_INT_SET_QUEUE_CONFIG 0x3B8 31262306a36Sopenharmony_ci#define H_INT_GET_QUEUE_CONFIG 0x3BC 31362306a36Sopenharmony_ci#define H_INT_SET_OS_REPORTING_LINE 0x3C0 31462306a36Sopenharmony_ci#define H_INT_GET_OS_REPORTING_LINE 0x3C4 31562306a36Sopenharmony_ci#define H_INT_ESB 0x3C8 31662306a36Sopenharmony_ci#define H_INT_SYNC 0x3CC 31762306a36Sopenharmony_ci#define H_INT_RESET 0x3D0 31862306a36Sopenharmony_ci#define H_SCM_READ_METADATA 0x3E4 31962306a36Sopenharmony_ci#define H_SCM_WRITE_METADATA 0x3E8 32062306a36Sopenharmony_ci#define H_SCM_BIND_MEM 0x3EC 32162306a36Sopenharmony_ci#define H_SCM_UNBIND_MEM 0x3F0 32262306a36Sopenharmony_ci#define H_SCM_QUERY_BLOCK_MEM_BINDING 0x3F4 32362306a36Sopenharmony_ci#define H_SCM_QUERY_LOGICAL_MEM_BINDING 0x3F8 32462306a36Sopenharmony_ci#define H_SCM_UNBIND_ALL 0x3FC 32562306a36Sopenharmony_ci#define H_SCM_HEALTH 0x400 32662306a36Sopenharmony_ci#define H_SCM_PERFORMANCE_STATS 0x418 32762306a36Sopenharmony_ci#define H_PKS_GET_CONFIG 0x41C 32862306a36Sopenharmony_ci#define H_PKS_SET_PASSWORD 0x420 32962306a36Sopenharmony_ci#define H_PKS_GEN_PASSWORD 0x424 33062306a36Sopenharmony_ci#define H_PKS_WRITE_OBJECT 0x42C 33162306a36Sopenharmony_ci#define H_PKS_GEN_KEY 0x430 33262306a36Sopenharmony_ci#define H_PKS_READ_OBJECT 0x434 33362306a36Sopenharmony_ci#define H_PKS_REMOVE_OBJECT 0x438 33462306a36Sopenharmony_ci#define H_PKS_CONFIRM_OBJECT_FLUSHED 0x43C 33562306a36Sopenharmony_ci#define H_RPT_INVALIDATE 0x448 33662306a36Sopenharmony_ci#define H_SCM_FLUSH 0x44C 33762306a36Sopenharmony_ci#define H_GET_ENERGY_SCALE_INFO 0x450 33862306a36Sopenharmony_ci#define H_PKS_SIGNED_UPDATE 0x454 33962306a36Sopenharmony_ci#define H_WATCHDOG 0x45C 34062306a36Sopenharmony_ci#define MAX_HCALL_OPCODE H_WATCHDOG 34162306a36Sopenharmony_ci 34262306a36Sopenharmony_ci/* Scope args for H_SCM_UNBIND_ALL */ 34362306a36Sopenharmony_ci#define H_UNBIND_SCOPE_ALL (0x1) 34462306a36Sopenharmony_ci#define H_UNBIND_SCOPE_DRC (0x2) 34562306a36Sopenharmony_ci 34662306a36Sopenharmony_ci/* H_VIOCTL functions */ 34762306a36Sopenharmony_ci#define H_GET_VIOA_DUMP_SIZE 0x01 34862306a36Sopenharmony_ci#define H_GET_VIOA_DUMP 0x02 34962306a36Sopenharmony_ci#define H_GET_ILLAN_NUM_VLAN_IDS 0x03 35062306a36Sopenharmony_ci#define H_GET_ILLAN_VLAN_ID_LIST 0x04 35162306a36Sopenharmony_ci#define H_GET_ILLAN_SWITCH_ID 0x05 35262306a36Sopenharmony_ci#define H_DISABLE_MIGRATION 0x06 35362306a36Sopenharmony_ci#define H_ENABLE_MIGRATION 0x07 35462306a36Sopenharmony_ci#define H_GET_PARTNER_INFO 0x08 35562306a36Sopenharmony_ci#define H_GET_PARTNER_WWPN_LIST 0x09 35662306a36Sopenharmony_ci#define H_DISABLE_ALL_VIO_INTS 0x0A 35762306a36Sopenharmony_ci#define H_DISABLE_VIO_INTERRUPT 0x0B 35862306a36Sopenharmony_ci#define H_ENABLE_VIO_INTERRUPT 0x0C 35962306a36Sopenharmony_ci#define H_GET_SESSION_TOKEN 0x19 36062306a36Sopenharmony_ci#define H_SESSION_ERR_DETECTED 0x1A 36162306a36Sopenharmony_ci 36262306a36Sopenharmony_ci 36362306a36Sopenharmony_ci/* Platform specific hcalls, used by KVM */ 36462306a36Sopenharmony_ci#define H_RTAS 0xf000 36562306a36Sopenharmony_ci 36662306a36Sopenharmony_ci/* 36762306a36Sopenharmony_ci * Platform specific hcalls, used by QEMU/SLOF. These are ignored by 36862306a36Sopenharmony_ci * KVM and only kept here so we can identify them during tracing. 36962306a36Sopenharmony_ci */ 37062306a36Sopenharmony_ci#define H_LOGICAL_MEMOP 0xF001 37162306a36Sopenharmony_ci#define H_CAS 0XF002 37262306a36Sopenharmony_ci#define H_UPDATE_DT 0XF003 37362306a36Sopenharmony_ci 37462306a36Sopenharmony_ci/* "Platform specific hcalls", provided by PHYP */ 37562306a36Sopenharmony_ci#define H_GET_24X7_CATALOG_PAGE 0xF078 37662306a36Sopenharmony_ci#define H_GET_24X7_DATA 0xF07C 37762306a36Sopenharmony_ci#define H_GET_PERF_COUNTER_INFO 0xF080 37862306a36Sopenharmony_ci 37962306a36Sopenharmony_ci/* Platform-specific hcalls used for nested HV KVM */ 38062306a36Sopenharmony_ci#define H_SET_PARTITION_TABLE 0xF800 38162306a36Sopenharmony_ci#define H_ENTER_NESTED 0xF804 38262306a36Sopenharmony_ci#define H_TLB_INVALIDATE 0xF808 38362306a36Sopenharmony_ci#define H_COPY_TOFROM_GUEST 0xF80C 38462306a36Sopenharmony_ci 38562306a36Sopenharmony_ci/* Flags for H_SVM_PAGE_IN */ 38662306a36Sopenharmony_ci#define H_PAGE_IN_SHARED 0x1 38762306a36Sopenharmony_ci 38862306a36Sopenharmony_ci/* Platform-specific hcalls used by the Ultravisor */ 38962306a36Sopenharmony_ci#define H_SVM_PAGE_IN 0xEF00 39062306a36Sopenharmony_ci#define H_SVM_PAGE_OUT 0xEF04 39162306a36Sopenharmony_ci#define H_SVM_INIT_START 0xEF08 39262306a36Sopenharmony_ci#define H_SVM_INIT_DONE 0xEF0C 39362306a36Sopenharmony_ci#define H_SVM_INIT_ABORT 0xEF14 39462306a36Sopenharmony_ci 39562306a36Sopenharmony_ci/* Values for 2nd argument to H_SET_MODE */ 39662306a36Sopenharmony_ci#define H_SET_MODE_RESOURCE_SET_CIABR 1 39762306a36Sopenharmony_ci#define H_SET_MODE_RESOURCE_SET_DAWR0 2 39862306a36Sopenharmony_ci#define H_SET_MODE_RESOURCE_ADDR_TRANS_MODE 3 39962306a36Sopenharmony_ci#define H_SET_MODE_RESOURCE_LE 4 40062306a36Sopenharmony_ci#define H_SET_MODE_RESOURCE_SET_DAWR1 5 40162306a36Sopenharmony_ci 40262306a36Sopenharmony_ci/* Values for argument to H_SIGNAL_SYS_RESET */ 40362306a36Sopenharmony_ci#define H_SIGNAL_SYS_RESET_ALL -1 40462306a36Sopenharmony_ci#define H_SIGNAL_SYS_RESET_ALL_OTHERS -2 40562306a36Sopenharmony_ci/* >= 0 values are CPU number */ 40662306a36Sopenharmony_ci 40762306a36Sopenharmony_ci/* H_GET_CPU_CHARACTERISTICS return values */ 40862306a36Sopenharmony_ci#define H_CPU_CHAR_SPEC_BAR_ORI31 (1ull << 63) // IBM bit 0 40962306a36Sopenharmony_ci#define H_CPU_CHAR_BCCTRL_SERIALISED (1ull << 62) // IBM bit 1 41062306a36Sopenharmony_ci#define H_CPU_CHAR_L1D_FLUSH_ORI30 (1ull << 61) // IBM bit 2 41162306a36Sopenharmony_ci#define H_CPU_CHAR_L1D_FLUSH_TRIG2 (1ull << 60) // IBM bit 3 41262306a36Sopenharmony_ci#define H_CPU_CHAR_L1D_THREAD_PRIV (1ull << 59) // IBM bit 4 41362306a36Sopenharmony_ci#define H_CPU_CHAR_BRANCH_HINTS_HONORED (1ull << 58) // IBM bit 5 41462306a36Sopenharmony_ci#define H_CPU_CHAR_THREAD_RECONFIG_CTRL (1ull << 57) // IBM bit 6 41562306a36Sopenharmony_ci#define H_CPU_CHAR_COUNT_CACHE_DISABLED (1ull << 56) // IBM bit 7 41662306a36Sopenharmony_ci#define H_CPU_CHAR_BCCTR_FLUSH_ASSIST (1ull << 54) // IBM bit 9 41762306a36Sopenharmony_ci#define H_CPU_CHAR_BCCTR_LINK_FLUSH_ASSIST (1ull << 52) // IBM bit 11 41862306a36Sopenharmony_ci 41962306a36Sopenharmony_ci#define H_CPU_BEHAV_FAVOUR_SECURITY (1ull << 63) // IBM bit 0 42062306a36Sopenharmony_ci#define H_CPU_BEHAV_L1D_FLUSH_PR (1ull << 62) // IBM bit 1 42162306a36Sopenharmony_ci#define H_CPU_BEHAV_BNDS_CHK_SPEC_BAR (1ull << 61) // IBM bit 2 42262306a36Sopenharmony_ci#define H_CPU_BEHAV_FAVOUR_SECURITY_H (1ull << 60) // IBM bit 3 42362306a36Sopenharmony_ci#define H_CPU_BEHAV_FLUSH_COUNT_CACHE (1ull << 58) // IBM bit 5 42462306a36Sopenharmony_ci#define H_CPU_BEHAV_FLUSH_LINK_STACK (1ull << 57) // IBM bit 6 42562306a36Sopenharmony_ci#define H_CPU_BEHAV_NO_L1D_FLUSH_ENTRY (1ull << 56) // IBM bit 7 42662306a36Sopenharmony_ci#define H_CPU_BEHAV_NO_L1D_FLUSH_UACCESS (1ull << 55) // IBM bit 8 42762306a36Sopenharmony_ci#define H_CPU_BEHAV_NO_STF_BARRIER (1ull << 54) // IBM bit 9 42862306a36Sopenharmony_ci 42962306a36Sopenharmony_ci/* Flag values used in H_REGISTER_PROC_TBL hcall */ 43062306a36Sopenharmony_ci#define PROC_TABLE_OP_MASK 0x18 43162306a36Sopenharmony_ci#define PROC_TABLE_DEREG 0x10 43262306a36Sopenharmony_ci#define PROC_TABLE_NEW 0x18 43362306a36Sopenharmony_ci#define PROC_TABLE_TYPE_MASK 0x06 43462306a36Sopenharmony_ci#define PROC_TABLE_HPT_SLB 0x00 43562306a36Sopenharmony_ci#define PROC_TABLE_HPT_PT 0x02 43662306a36Sopenharmony_ci#define PROC_TABLE_RADIX 0x04 43762306a36Sopenharmony_ci#define PROC_TABLE_GTSE 0x01 43862306a36Sopenharmony_ci 43962306a36Sopenharmony_ci/* 44062306a36Sopenharmony_ci * Defines for 44162306a36Sopenharmony_ci * H_RPT_INVALIDATE - Invalidate RPT translation lookaside information. 44262306a36Sopenharmony_ci */ 44362306a36Sopenharmony_ci 44462306a36Sopenharmony_ci/* Type of translation to invalidate (type) */ 44562306a36Sopenharmony_ci#define H_RPTI_TYPE_NESTED 0x0001 /* Invalidate nested guest partition-scope */ 44662306a36Sopenharmony_ci#define H_RPTI_TYPE_TLB 0x0002 /* Invalidate TLB */ 44762306a36Sopenharmony_ci#define H_RPTI_TYPE_PWC 0x0004 /* Invalidate Page Walk Cache */ 44862306a36Sopenharmony_ci/* Invalidate caching of Process Table Entries if H_RPTI_TYPE_NESTED is clear */ 44962306a36Sopenharmony_ci#define H_RPTI_TYPE_PRT 0x0008 45062306a36Sopenharmony_ci/* Invalidate caching of Partition Table Entries if H_RPTI_TYPE_NESTED is set */ 45162306a36Sopenharmony_ci#define H_RPTI_TYPE_PAT 0x0008 45262306a36Sopenharmony_ci#define H_RPTI_TYPE_ALL (H_RPTI_TYPE_TLB | H_RPTI_TYPE_PWC | \ 45362306a36Sopenharmony_ci H_RPTI_TYPE_PRT) 45462306a36Sopenharmony_ci#define H_RPTI_TYPE_NESTED_ALL (H_RPTI_TYPE_TLB | H_RPTI_TYPE_PWC | \ 45562306a36Sopenharmony_ci H_RPTI_TYPE_PAT) 45662306a36Sopenharmony_ci 45762306a36Sopenharmony_ci/* Invalidation targets (target) */ 45862306a36Sopenharmony_ci#define H_RPTI_TARGET_CMMU 0x01 /* All virtual processors in the partition */ 45962306a36Sopenharmony_ci#define H_RPTI_TARGET_CMMU_LOCAL 0x02 /* Current virtual processor */ 46062306a36Sopenharmony_ci/* All nest/accelerator agents in use by the partition */ 46162306a36Sopenharmony_ci#define H_RPTI_TARGET_NMMU 0x04 46262306a36Sopenharmony_ci 46362306a36Sopenharmony_ci/* Page size mask (page sizes) */ 46462306a36Sopenharmony_ci#define H_RPTI_PAGE_4K 0x01 46562306a36Sopenharmony_ci#define H_RPTI_PAGE_64K 0x02 46662306a36Sopenharmony_ci#define H_RPTI_PAGE_2M 0x04 46762306a36Sopenharmony_ci#define H_RPTI_PAGE_1G 0x08 46862306a36Sopenharmony_ci#define H_RPTI_PAGE_ALL (-1UL) 46962306a36Sopenharmony_ci 47062306a36Sopenharmony_ci#ifndef __ASSEMBLY__ 47162306a36Sopenharmony_ci#include <linux/types.h> 47262306a36Sopenharmony_ci 47362306a36Sopenharmony_ci/** 47462306a36Sopenharmony_ci * plpar_hcall_norets: - Make a pseries hypervisor call with no return arguments 47562306a36Sopenharmony_ci * @opcode: The hypervisor call to make. 47662306a36Sopenharmony_ci * 47762306a36Sopenharmony_ci * This call supports up to 7 arguments and only returns the status of 47862306a36Sopenharmony_ci * the hcall. Use this version where possible, its slightly faster than 47962306a36Sopenharmony_ci * the other plpar_hcalls. 48062306a36Sopenharmony_ci */ 48162306a36Sopenharmony_cilong plpar_hcall_norets(unsigned long opcode, ...); 48262306a36Sopenharmony_ci 48362306a36Sopenharmony_ci/* Variant which does not do hcall tracing */ 48462306a36Sopenharmony_cilong plpar_hcall_norets_notrace(unsigned long opcode, ...); 48562306a36Sopenharmony_ci 48662306a36Sopenharmony_ci/** 48762306a36Sopenharmony_ci * plpar_hcall: - Make a pseries hypervisor call 48862306a36Sopenharmony_ci * @opcode: The hypervisor call to make. 48962306a36Sopenharmony_ci * @retbuf: Buffer to store up to 4 return arguments in. 49062306a36Sopenharmony_ci * 49162306a36Sopenharmony_ci * This call supports up to 6 arguments and 4 return arguments. Use 49262306a36Sopenharmony_ci * PLPAR_HCALL_BUFSIZE to size the return argument buffer. 49362306a36Sopenharmony_ci * 49462306a36Sopenharmony_ci * Used for all but the craziest of phyp interfaces (see plpar_hcall9) 49562306a36Sopenharmony_ci */ 49662306a36Sopenharmony_ci#define PLPAR_HCALL_BUFSIZE 4 49762306a36Sopenharmony_cilong plpar_hcall(unsigned long opcode, unsigned long *retbuf, ...); 49862306a36Sopenharmony_ci 49962306a36Sopenharmony_ci/** 50062306a36Sopenharmony_ci * plpar_hcall_raw: - Make a hypervisor call without calculating hcall stats 50162306a36Sopenharmony_ci * @opcode: The hypervisor call to make. 50262306a36Sopenharmony_ci * @retbuf: Buffer to store up to 4 return arguments in. 50362306a36Sopenharmony_ci * 50462306a36Sopenharmony_ci * This call supports up to 6 arguments and 4 return arguments. Use 50562306a36Sopenharmony_ci * PLPAR_HCALL_BUFSIZE to size the return argument buffer. 50662306a36Sopenharmony_ci * 50762306a36Sopenharmony_ci * Used when phyp interface needs to be called in real mode. Similar to 50862306a36Sopenharmony_ci * plpar_hcall, but plpar_hcall_raw works in real mode and does not 50962306a36Sopenharmony_ci * calculate hypervisor call statistics. 51062306a36Sopenharmony_ci */ 51162306a36Sopenharmony_cilong plpar_hcall_raw(unsigned long opcode, unsigned long *retbuf, ...); 51262306a36Sopenharmony_ci 51362306a36Sopenharmony_ci/** 51462306a36Sopenharmony_ci * plpar_hcall9: - Make a pseries hypervisor call with up to 9 return arguments 51562306a36Sopenharmony_ci * @opcode: The hypervisor call to make. 51662306a36Sopenharmony_ci * @retbuf: Buffer to store up to 9 return arguments in. 51762306a36Sopenharmony_ci * 51862306a36Sopenharmony_ci * This call supports up to 9 arguments and 9 return arguments. Use 51962306a36Sopenharmony_ci * PLPAR_HCALL9_BUFSIZE to size the return argument buffer. 52062306a36Sopenharmony_ci */ 52162306a36Sopenharmony_ci#define PLPAR_HCALL9_BUFSIZE 9 52262306a36Sopenharmony_cilong plpar_hcall9(unsigned long opcode, unsigned long *retbuf, ...); 52362306a36Sopenharmony_cilong plpar_hcall9_raw(unsigned long opcode, unsigned long *retbuf, ...); 52462306a36Sopenharmony_ci 52562306a36Sopenharmony_ci/* pseries hcall tracing */ 52662306a36Sopenharmony_ciextern struct static_key hcall_tracepoint_key; 52762306a36Sopenharmony_civoid __trace_hcall_entry(unsigned long opcode, unsigned long *args); 52862306a36Sopenharmony_civoid __trace_hcall_exit(long opcode, long retval, unsigned long *retbuf); 52962306a36Sopenharmony_ci 53062306a36Sopenharmony_cistruct hvcall_mpp_data { 53162306a36Sopenharmony_ci unsigned long entitled_mem; 53262306a36Sopenharmony_ci unsigned long mapped_mem; 53362306a36Sopenharmony_ci unsigned short group_num; 53462306a36Sopenharmony_ci unsigned short pool_num; 53562306a36Sopenharmony_ci unsigned char mem_weight; 53662306a36Sopenharmony_ci unsigned char unallocated_mem_weight; 53762306a36Sopenharmony_ci unsigned long unallocated_entitlement; /* value in bytes */ 53862306a36Sopenharmony_ci unsigned long pool_size; 53962306a36Sopenharmony_ci signed long loan_request; 54062306a36Sopenharmony_ci unsigned long backing_mem; 54162306a36Sopenharmony_ci}; 54262306a36Sopenharmony_ci 54362306a36Sopenharmony_ciint h_get_mpp(struct hvcall_mpp_data *); 54462306a36Sopenharmony_ci 54562306a36Sopenharmony_cistruct hvcall_mpp_x_data { 54662306a36Sopenharmony_ci unsigned long coalesced_bytes; 54762306a36Sopenharmony_ci unsigned long pool_coalesced_bytes; 54862306a36Sopenharmony_ci unsigned long pool_purr_cycles; 54962306a36Sopenharmony_ci unsigned long pool_spurr_cycles; 55062306a36Sopenharmony_ci unsigned long reserved[3]; 55162306a36Sopenharmony_ci}; 55262306a36Sopenharmony_ci 55362306a36Sopenharmony_ciint h_get_mpp_x(struct hvcall_mpp_x_data *mpp_x_data); 55462306a36Sopenharmony_ci 55562306a36Sopenharmony_cistatic inline unsigned int get_longbusy_msecs(int longbusy_rc) 55662306a36Sopenharmony_ci{ 55762306a36Sopenharmony_ci switch (longbusy_rc) { 55862306a36Sopenharmony_ci case H_LONG_BUSY_ORDER_1_MSEC: 55962306a36Sopenharmony_ci return 1; 56062306a36Sopenharmony_ci case H_LONG_BUSY_ORDER_10_MSEC: 56162306a36Sopenharmony_ci return 10; 56262306a36Sopenharmony_ci case H_LONG_BUSY_ORDER_100_MSEC: 56362306a36Sopenharmony_ci return 100; 56462306a36Sopenharmony_ci case H_LONG_BUSY_ORDER_1_SEC: 56562306a36Sopenharmony_ci return 1000; 56662306a36Sopenharmony_ci case H_LONG_BUSY_ORDER_10_SEC: 56762306a36Sopenharmony_ci return 10000; 56862306a36Sopenharmony_ci case H_LONG_BUSY_ORDER_100_SEC: 56962306a36Sopenharmony_ci return 100000; 57062306a36Sopenharmony_ci default: 57162306a36Sopenharmony_ci return 1; 57262306a36Sopenharmony_ci } 57362306a36Sopenharmony_ci} 57462306a36Sopenharmony_ci 57562306a36Sopenharmony_cistruct h_cpu_char_result { 57662306a36Sopenharmony_ci u64 character; 57762306a36Sopenharmony_ci u64 behaviour; 57862306a36Sopenharmony_ci}; 57962306a36Sopenharmony_ci 58062306a36Sopenharmony_ci/* 58162306a36Sopenharmony_ci * Register state for entering a nested guest with H_ENTER_NESTED. 58262306a36Sopenharmony_ci * New member must be added at the end. 58362306a36Sopenharmony_ci */ 58462306a36Sopenharmony_cistruct hv_guest_state { 58562306a36Sopenharmony_ci u64 version; /* version of this structure layout, must be first */ 58662306a36Sopenharmony_ci u32 lpid; 58762306a36Sopenharmony_ci u32 vcpu_token; 58862306a36Sopenharmony_ci /* These registers are hypervisor privileged (at least for writing) */ 58962306a36Sopenharmony_ci u64 lpcr; 59062306a36Sopenharmony_ci u64 pcr; 59162306a36Sopenharmony_ci u64 amor; 59262306a36Sopenharmony_ci u64 dpdes; 59362306a36Sopenharmony_ci u64 hfscr; 59462306a36Sopenharmony_ci s64 tb_offset; 59562306a36Sopenharmony_ci u64 dawr0; 59662306a36Sopenharmony_ci u64 dawrx0; 59762306a36Sopenharmony_ci u64 ciabr; 59862306a36Sopenharmony_ci u64 hdec_expiry; 59962306a36Sopenharmony_ci u64 purr; 60062306a36Sopenharmony_ci u64 spurr; 60162306a36Sopenharmony_ci u64 ic; 60262306a36Sopenharmony_ci u64 vtb; 60362306a36Sopenharmony_ci u64 hdar; 60462306a36Sopenharmony_ci u64 hdsisr; 60562306a36Sopenharmony_ci u64 heir; 60662306a36Sopenharmony_ci u64 asdr; 60762306a36Sopenharmony_ci /* These are OS privileged but need to be set late in guest entry */ 60862306a36Sopenharmony_ci u64 srr0; 60962306a36Sopenharmony_ci u64 srr1; 61062306a36Sopenharmony_ci u64 sprg[4]; 61162306a36Sopenharmony_ci u64 pidr; 61262306a36Sopenharmony_ci u64 cfar; 61362306a36Sopenharmony_ci u64 ppr; 61462306a36Sopenharmony_ci /* Version 1 ends here */ 61562306a36Sopenharmony_ci u64 dawr1; 61662306a36Sopenharmony_ci u64 dawrx1; 61762306a36Sopenharmony_ci /* Version 2 ends here */ 61862306a36Sopenharmony_ci}; 61962306a36Sopenharmony_ci 62062306a36Sopenharmony_ci/* Latest version of hv_guest_state structure */ 62162306a36Sopenharmony_ci#define HV_GUEST_STATE_VERSION 2 62262306a36Sopenharmony_ci 62362306a36Sopenharmony_cistatic inline int hv_guest_state_size(unsigned int version) 62462306a36Sopenharmony_ci{ 62562306a36Sopenharmony_ci switch (version) { 62662306a36Sopenharmony_ci case 1: 62762306a36Sopenharmony_ci return offsetofend(struct hv_guest_state, ppr); 62862306a36Sopenharmony_ci case 2: 62962306a36Sopenharmony_ci return offsetofend(struct hv_guest_state, dawrx1); 63062306a36Sopenharmony_ci default: 63162306a36Sopenharmony_ci return -1; 63262306a36Sopenharmony_ci } 63362306a36Sopenharmony_ci} 63462306a36Sopenharmony_ci 63562306a36Sopenharmony_ci/* 63662306a36Sopenharmony_ci * From the document "H_GetPerformanceCounterInfo Interface" v1.07 63762306a36Sopenharmony_ci * 63862306a36Sopenharmony_ci * H_GET_PERF_COUNTER_INFO argument 63962306a36Sopenharmony_ci */ 64062306a36Sopenharmony_cistruct hv_get_perf_counter_info_params { 64162306a36Sopenharmony_ci __be32 counter_request; /* I */ 64262306a36Sopenharmony_ci __be32 starting_index; /* IO */ 64362306a36Sopenharmony_ci __be16 secondary_index; /* IO */ 64462306a36Sopenharmony_ci __be16 returned_values; /* O */ 64562306a36Sopenharmony_ci __be32 detail_rc; /* O, only needed when called via *_norets() */ 64662306a36Sopenharmony_ci 64762306a36Sopenharmony_ci /* 64862306a36Sopenharmony_ci * O, size each of counter_value element in bytes, only set for version 64962306a36Sopenharmony_ci * >= 0x3 65062306a36Sopenharmony_ci */ 65162306a36Sopenharmony_ci __be16 cv_element_size; 65262306a36Sopenharmony_ci 65362306a36Sopenharmony_ci /* I, 0 (zero) for versions < 0x3 */ 65462306a36Sopenharmony_ci __u8 counter_info_version_in; 65562306a36Sopenharmony_ci 65662306a36Sopenharmony_ci /* O, 0 (zero) if version < 0x3. Must be set to 0 when making hcall */ 65762306a36Sopenharmony_ci __u8 counter_info_version_out; 65862306a36Sopenharmony_ci __u8 reserved[0xC]; 65962306a36Sopenharmony_ci __u8 counter_value[]; 66062306a36Sopenharmony_ci} __packed; 66162306a36Sopenharmony_ci 66262306a36Sopenharmony_ci#define HGPCI_REQ_BUFFER_SIZE 4096 66362306a36Sopenharmony_ci#define HGPCI_MAX_DATA_BYTES \ 66462306a36Sopenharmony_ci (HGPCI_REQ_BUFFER_SIZE - sizeof(struct hv_get_perf_counter_info_params)) 66562306a36Sopenharmony_ci 66662306a36Sopenharmony_cistruct hv_gpci_request_buffer { 66762306a36Sopenharmony_ci struct hv_get_perf_counter_info_params params; 66862306a36Sopenharmony_ci uint8_t bytes[HGPCI_MAX_DATA_BYTES]; 66962306a36Sopenharmony_ci} __packed; 67062306a36Sopenharmony_ci 67162306a36Sopenharmony_ci#endif /* __ASSEMBLY__ */ 67262306a36Sopenharmony_ci#endif /* __KERNEL__ */ 67362306a36Sopenharmony_ci#endif /* _ASM_POWERPC_HVCALL_H */ 674